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.

15596 lines
423KB

  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 flanger
  1860. Apply a flanging effect to the audio.
  1861. The filter accepts the following options:
  1862. @table @option
  1863. @item delay
  1864. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  1865. @item depth
  1866. Set added swep delay in milliseconds. Range from 0 to 10. Default value is 2.
  1867. @item regen
  1868. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  1869. Default value is 0.
  1870. @item width
  1871. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  1872. Default value is 71.
  1873. @item speed
  1874. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  1875. @item shape
  1876. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  1877. Default value is @var{sinusoidal}.
  1878. @item phase
  1879. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  1880. Default value is 25.
  1881. @item interp
  1882. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  1883. Default is @var{linear}.
  1884. @end table
  1885. @section highpass
  1886. Apply a high-pass filter with 3dB point frequency.
  1887. The filter can be either single-pole, or double-pole (the default).
  1888. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  1889. The filter accepts the following options:
  1890. @table @option
  1891. @item frequency, f
  1892. Set frequency in Hz. Default is 3000.
  1893. @item poles, p
  1894. Set number of poles. Default is 2.
  1895. @item width_type
  1896. Set method to specify band-width of filter.
  1897. @table @option
  1898. @item h
  1899. Hz
  1900. @item q
  1901. Q-Factor
  1902. @item o
  1903. octave
  1904. @item s
  1905. slope
  1906. @end table
  1907. @item width, w
  1908. Specify the band-width of a filter in width_type units.
  1909. Applies only to double-pole filter.
  1910. The default is 0.707q and gives a Butterworth response.
  1911. @end table
  1912. @section join
  1913. Join multiple input streams into one multi-channel stream.
  1914. It accepts the following parameters:
  1915. @table @option
  1916. @item inputs
  1917. The number of input streams. It defaults to 2.
  1918. @item channel_layout
  1919. The desired output channel layout. It defaults to stereo.
  1920. @item map
  1921. Map channels from inputs to output. The argument is a '|'-separated list of
  1922. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  1923. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  1924. can be either the name of the input channel (e.g. FL for front left) or its
  1925. index in the specified input stream. @var{out_channel} is the name of the output
  1926. channel.
  1927. @end table
  1928. The filter will attempt to guess the mappings when they are not specified
  1929. explicitly. It does so by first trying to find an unused matching input channel
  1930. and if that fails it picks the first unused input channel.
  1931. Join 3 inputs (with properly set channel layouts):
  1932. @example
  1933. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  1934. @end example
  1935. Build a 5.1 output from 6 single-channel streams:
  1936. @example
  1937. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  1938. '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'
  1939. out
  1940. @end example
  1941. @section ladspa
  1942. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  1943. To enable compilation of this filter you need to configure FFmpeg with
  1944. @code{--enable-ladspa}.
  1945. @table @option
  1946. @item file, f
  1947. Specifies the name of LADSPA plugin library to load. If the environment
  1948. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  1949. each one of the directories specified by the colon separated list in
  1950. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  1951. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  1952. @file{/usr/lib/ladspa/}.
  1953. @item plugin, p
  1954. Specifies the plugin within the library. Some libraries contain only
  1955. one plugin, but others contain many of them. If this is not set filter
  1956. will list all available plugins within the specified library.
  1957. @item controls, c
  1958. Set the '|' separated list of controls which are zero or more floating point
  1959. values that determine the behavior of the loaded plugin (for example delay,
  1960. threshold or gain).
  1961. Controls need to be defined using the following syntax:
  1962. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  1963. @var{valuei} is the value set on the @var{i}-th control.
  1964. Alternatively they can be also defined using the following syntax:
  1965. @var{value0}|@var{value1}|@var{value2}|..., where
  1966. @var{valuei} is the value set on the @var{i}-th control.
  1967. If @option{controls} is set to @code{help}, all available controls and
  1968. their valid ranges are printed.
  1969. @item sample_rate, s
  1970. Specify the sample rate, default to 44100. Only used if plugin have
  1971. zero inputs.
  1972. @item nb_samples, n
  1973. Set the number of samples per channel per each output frame, default
  1974. is 1024. Only used if plugin have zero inputs.
  1975. @item duration, d
  1976. Set the minimum duration of the sourced audio. See
  1977. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  1978. for the accepted syntax.
  1979. Note that the resulting duration may be greater than the specified duration,
  1980. as the generated audio is always cut at the end of a complete frame.
  1981. If not specified, or the expressed duration is negative, the audio is
  1982. supposed to be generated forever.
  1983. Only used if plugin have zero inputs.
  1984. @end table
  1985. @subsection Examples
  1986. @itemize
  1987. @item
  1988. List all available plugins within amp (LADSPA example plugin) library:
  1989. @example
  1990. ladspa=file=amp
  1991. @end example
  1992. @item
  1993. List all available controls and their valid ranges for @code{vcf_notch}
  1994. plugin from @code{VCF} library:
  1995. @example
  1996. ladspa=f=vcf:p=vcf_notch:c=help
  1997. @end example
  1998. @item
  1999. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2000. plugin library:
  2001. @example
  2002. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2003. @end example
  2004. @item
  2005. Add reverberation to the audio using TAP-plugins
  2006. (Tom's Audio Processing plugins):
  2007. @example
  2008. ladspa=file=tap_reverb:tap_reverb
  2009. @end example
  2010. @item
  2011. Generate white noise, with 0.2 amplitude:
  2012. @example
  2013. ladspa=file=cmt:noise_source_white:c=c0=.2
  2014. @end example
  2015. @item
  2016. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2017. @code{C* Audio Plugin Suite} (CAPS) library:
  2018. @example
  2019. ladspa=file=caps:Click:c=c1=20'
  2020. @end example
  2021. @item
  2022. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2023. @example
  2024. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2025. @end example
  2026. @item
  2027. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2028. @code{SWH Plugins} collection:
  2029. @example
  2030. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2031. @end example
  2032. @item
  2033. Attenuate low frequencies using Multiband EQ from Steve Harris
  2034. @code{SWH Plugins} collection:
  2035. @example
  2036. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2037. @end example
  2038. @end itemize
  2039. @subsection Commands
  2040. This filter supports the following commands:
  2041. @table @option
  2042. @item cN
  2043. Modify the @var{N}-th control value.
  2044. If the specified value is not valid, it is ignored and prior one is kept.
  2045. @end table
  2046. @section lowpass
  2047. Apply a low-pass filter with 3dB point frequency.
  2048. The filter can be either single-pole or double-pole (the default).
  2049. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2050. The filter accepts the following options:
  2051. @table @option
  2052. @item frequency, f
  2053. Set frequency in Hz. Default is 500.
  2054. @item poles, p
  2055. Set number of poles. Default is 2.
  2056. @item width_type
  2057. Set method to specify band-width of filter.
  2058. @table @option
  2059. @item h
  2060. Hz
  2061. @item q
  2062. Q-Factor
  2063. @item o
  2064. octave
  2065. @item s
  2066. slope
  2067. @end table
  2068. @item width, w
  2069. Specify the band-width of a filter in width_type units.
  2070. Applies only to double-pole filter.
  2071. The default is 0.707q and gives a Butterworth response.
  2072. @end table
  2073. @anchor{pan}
  2074. @section pan
  2075. Mix channels with specific gain levels. The filter accepts the output
  2076. channel layout followed by a set of channels definitions.
  2077. This filter is also designed to efficiently remap the channels of an audio
  2078. stream.
  2079. The filter accepts parameters of the form:
  2080. "@var{l}|@var{outdef}|@var{outdef}|..."
  2081. @table @option
  2082. @item l
  2083. output channel layout or number of channels
  2084. @item outdef
  2085. output channel specification, of the form:
  2086. "@var{out_name}=[@var{gain}*]@var{in_name}[+[@var{gain}*]@var{in_name}...]"
  2087. @item out_name
  2088. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2089. number (c0, c1, etc.)
  2090. @item gain
  2091. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2092. @item in_name
  2093. input channel to use, see out_name for details; it is not possible to mix
  2094. named and numbered input channels
  2095. @end table
  2096. If the `=' in a channel specification is replaced by `<', then the gains for
  2097. that specification will be renormalized so that the total is 1, thus
  2098. avoiding clipping noise.
  2099. @subsection Mixing examples
  2100. For example, if you want to down-mix from stereo to mono, but with a bigger
  2101. factor for the left channel:
  2102. @example
  2103. pan=1c|c0=0.9*c0+0.1*c1
  2104. @end example
  2105. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2106. 7-channels surround:
  2107. @example
  2108. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2109. @end example
  2110. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2111. that should be preferred (see "-ac" option) unless you have very specific
  2112. needs.
  2113. @subsection Remapping examples
  2114. The channel remapping will be effective if, and only if:
  2115. @itemize
  2116. @item gain coefficients are zeroes or ones,
  2117. @item only one input per channel output,
  2118. @end itemize
  2119. If all these conditions are satisfied, the filter will notify the user ("Pure
  2120. channel mapping detected"), and use an optimized and lossless method to do the
  2121. remapping.
  2122. For example, if you have a 5.1 source and want a stereo audio stream by
  2123. dropping the extra channels:
  2124. @example
  2125. pan="stereo| c0=FL | c1=FR"
  2126. @end example
  2127. Given the same source, you can also switch front left and front right channels
  2128. and keep the input channel layout:
  2129. @example
  2130. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2131. @end example
  2132. If the input is a stereo audio stream, you can mute the front left channel (and
  2133. still keep the stereo channel layout) with:
  2134. @example
  2135. pan="stereo|c1=c1"
  2136. @end example
  2137. Still with a stereo audio stream input, you can copy the right channel in both
  2138. front left and right:
  2139. @example
  2140. pan="stereo| c0=FR | c1=FR"
  2141. @end example
  2142. @section replaygain
  2143. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2144. outputs it unchanged.
  2145. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2146. @section resample
  2147. Convert the audio sample format, sample rate and channel layout. It is
  2148. not meant to be used directly.
  2149. @section rubberband
  2150. Apply time-stretching and pitch-shifting with librubberband.
  2151. The filter accepts the following options:
  2152. @table @option
  2153. @item tempo
  2154. Set tempo scale factor.
  2155. @item pitch
  2156. Set pitch scale factor.
  2157. @item transients
  2158. Set transients detector.
  2159. Possible values are:
  2160. @table @var
  2161. @item crisp
  2162. @item mixed
  2163. @item smooth
  2164. @end table
  2165. @item detector
  2166. Set detector.
  2167. Possible values are:
  2168. @table @var
  2169. @item compound
  2170. @item percussive
  2171. @item soft
  2172. @end table
  2173. @item phase
  2174. Set phase.
  2175. Possible values are:
  2176. @table @var
  2177. @item laminar
  2178. @item independent
  2179. @end table
  2180. @item window
  2181. Set processing window size.
  2182. Possible values are:
  2183. @table @var
  2184. @item standard
  2185. @item short
  2186. @item long
  2187. @end table
  2188. @item smoothing
  2189. Set smoothing.
  2190. Possible values are:
  2191. @table @var
  2192. @item off
  2193. @item on
  2194. @end table
  2195. @item formant
  2196. Enable formant preservation when shift pitching.
  2197. Possible values are:
  2198. @table @var
  2199. @item shifted
  2200. @item preserved
  2201. @end table
  2202. @item pitchq
  2203. Set pitch quality.
  2204. Possible values are:
  2205. @table @var
  2206. @item quality
  2207. @item speed
  2208. @item consistency
  2209. @end table
  2210. @item channels
  2211. Set channels.
  2212. Possible values are:
  2213. @table @var
  2214. @item apart
  2215. @item together
  2216. @end table
  2217. @end table
  2218. @section sidechaincompress
  2219. This filter acts like normal compressor but has the ability to compress
  2220. detected signal using second input signal.
  2221. It needs two input streams and returns one output stream.
  2222. First input stream will be processed depending on second stream signal.
  2223. The filtered signal then can be filtered with other filters in later stages of
  2224. processing. See @ref{pan} and @ref{amerge} filter.
  2225. The filter accepts the following options:
  2226. @table @option
  2227. @item level_in
  2228. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2229. @item threshold
  2230. If a signal of second stream raises above this level it will affect the gain
  2231. reduction of first stream.
  2232. By default is 0.125. Range is between 0.00097563 and 1.
  2233. @item ratio
  2234. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2235. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2236. Default is 2. Range is between 1 and 20.
  2237. @item attack
  2238. Amount of milliseconds the signal has to rise above the threshold before gain
  2239. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2240. @item release
  2241. Amount of milliseconds the signal has to fall below the threshold before
  2242. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2243. @item makeup
  2244. Set the amount by how much signal will be amplified after processing.
  2245. Default is 2. Range is from 1 and 64.
  2246. @item knee
  2247. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2248. Default is 2.82843. Range is between 1 and 8.
  2249. @item link
  2250. Choose if the @code{average} level between all channels of side-chain stream
  2251. or the louder(@code{maximum}) channel of side-chain stream affects the
  2252. reduction. Default is @code{average}.
  2253. @item detection
  2254. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2255. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2256. @item level_sc
  2257. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2258. @item mix
  2259. How much to use compressed signal in output. Default is 1.
  2260. Range is between 0 and 1.
  2261. @end table
  2262. @subsection Examples
  2263. @itemize
  2264. @item
  2265. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2266. depending on the signal of 2nd input and later compressed signal to be
  2267. merged with 2nd input:
  2268. @example
  2269. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2270. @end example
  2271. @end itemize
  2272. @section sidechaingate
  2273. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2274. filter the detected signal before sending it to the gain reduction stage.
  2275. Normally a gate uses the full range signal to detect a level above the
  2276. threshold.
  2277. For example: If you cut all lower frequencies from your sidechain signal
  2278. the gate will decrease the volume of your track only if not enough highs
  2279. appear. With this technique you are able to reduce the resonation of a
  2280. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2281. guitar.
  2282. It needs two input streams and returns one output stream.
  2283. First input stream will be processed depending on second stream signal.
  2284. The filter accepts the following options:
  2285. @table @option
  2286. @item level_in
  2287. Set input level before filtering.
  2288. Default is 1. Allowed range is from 0.015625 to 64.
  2289. @item range
  2290. Set the level of gain reduction when the signal is below the threshold.
  2291. Default is 0.06125. Allowed range is from 0 to 1.
  2292. @item threshold
  2293. If a signal rises above this level the gain reduction is released.
  2294. Default is 0.125. Allowed range is from 0 to 1.
  2295. @item ratio
  2296. Set a ratio about which the signal is reduced.
  2297. Default is 2. Allowed range is from 1 to 9000.
  2298. @item attack
  2299. Amount of milliseconds the signal has to rise above the threshold before gain
  2300. reduction stops.
  2301. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2302. @item release
  2303. Amount of milliseconds the signal has to fall below the threshold before the
  2304. reduction is increased again. Default is 250 milliseconds.
  2305. Allowed range is from 0.01 to 9000.
  2306. @item makeup
  2307. Set amount of amplification of signal after processing.
  2308. Default is 1. Allowed range is from 1 to 64.
  2309. @item knee
  2310. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2311. Default is 2.828427125. Allowed range is from 1 to 8.
  2312. @item detection
  2313. Choose if exact signal should be taken for detection or an RMS like one.
  2314. Default is rms. Can be peak or rms.
  2315. @item link
  2316. Choose if the average level between all channels or the louder channel affects
  2317. the reduction.
  2318. Default is average. Can be average or maximum.
  2319. @item level_sc
  2320. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2321. @end table
  2322. @section silencedetect
  2323. Detect silence in an audio stream.
  2324. This filter logs a message when it detects that the input audio volume is less
  2325. or equal to a noise tolerance value for a duration greater or equal to the
  2326. minimum detected noise duration.
  2327. The printed times and duration are expressed in seconds.
  2328. The filter accepts the following options:
  2329. @table @option
  2330. @item duration, d
  2331. Set silence duration until notification (default is 2 seconds).
  2332. @item noise, n
  2333. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2334. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2335. @end table
  2336. @subsection Examples
  2337. @itemize
  2338. @item
  2339. Detect 5 seconds of silence with -50dB noise tolerance:
  2340. @example
  2341. silencedetect=n=-50dB:d=5
  2342. @end example
  2343. @item
  2344. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2345. tolerance in @file{silence.mp3}:
  2346. @example
  2347. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2348. @end example
  2349. @end itemize
  2350. @section silenceremove
  2351. Remove silence from the beginning, middle or end of the audio.
  2352. The filter accepts the following options:
  2353. @table @option
  2354. @item start_periods
  2355. This value is used to indicate if audio should be trimmed at beginning of
  2356. the audio. A value of zero indicates no silence should be trimmed from the
  2357. beginning. When specifying a non-zero value, it trims audio up until it
  2358. finds non-silence. Normally, when trimming silence from beginning of audio
  2359. the @var{start_periods} will be @code{1} but it can be increased to higher
  2360. values to trim all audio up to specific count of non-silence periods.
  2361. Default value is @code{0}.
  2362. @item start_duration
  2363. Specify the amount of time that non-silence must be detected before it stops
  2364. trimming audio. By increasing the duration, bursts of noises can be treated
  2365. as silence and trimmed off. Default value is @code{0}.
  2366. @item start_threshold
  2367. This indicates what sample value should be treated as silence. For digital
  2368. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2369. you may wish to increase the value to account for background noise.
  2370. Can be specified in dB (in case "dB" is appended to the specified value)
  2371. or amplitude ratio. Default value is @code{0}.
  2372. @item stop_periods
  2373. Set the count for trimming silence from the end of audio.
  2374. To remove silence from the middle of a file, specify a @var{stop_periods}
  2375. that is negative. This value is then treated as a positive value and is
  2376. used to indicate the effect should restart processing as specified by
  2377. @var{start_periods}, making it suitable for removing periods of silence
  2378. in the middle of the audio.
  2379. Default value is @code{0}.
  2380. @item stop_duration
  2381. Specify a duration of silence that must exist before audio is not copied any
  2382. more. By specifying a higher duration, silence that is wanted can be left in
  2383. the audio.
  2384. Default value is @code{0}.
  2385. @item stop_threshold
  2386. This is the same as @option{start_threshold} but for trimming silence from
  2387. the end of audio.
  2388. Can be specified in dB (in case "dB" is appended to the specified value)
  2389. or amplitude ratio. Default value is @code{0}.
  2390. @item leave_silence
  2391. This indicate that @var{stop_duration} length of audio should be left intact
  2392. at the beginning of each period of silence.
  2393. For example, if you want to remove long pauses between words but do not want
  2394. to remove the pauses completely. Default value is @code{0}.
  2395. @item detection
  2396. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  2397. and works better with digital silence which is exactly 0.
  2398. Default value is @code{rms}.
  2399. @item window
  2400. Set ratio used to calculate size of window for detecting silence.
  2401. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  2402. @end table
  2403. @subsection Examples
  2404. @itemize
  2405. @item
  2406. The following example shows how this filter can be used to start a recording
  2407. that does not contain the delay at the start which usually occurs between
  2408. pressing the record button and the start of the performance:
  2409. @example
  2410. silenceremove=1:5:0.02
  2411. @end example
  2412. @item
  2413. Trim all silence encountered from begining to end where there is more than 1
  2414. second of silence in audio:
  2415. @example
  2416. silenceremove=0:0:0:-1:1:-90dB
  2417. @end example
  2418. @end itemize
  2419. @section sofalizer
  2420. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  2421. loudspeakers around the user for binaural listening via headphones (audio
  2422. formats up to 9 channels supported).
  2423. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  2424. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  2425. Austrian Academy of Sciences.
  2426. To enable compilation of this filter you need to configure FFmpeg with
  2427. @code{--enable-netcdf}.
  2428. The filter accepts the following options:
  2429. @table @option
  2430. @item sofa
  2431. Set the SOFA file used for rendering.
  2432. @item gain
  2433. Set gain applied to audio. Value is in dB. Default is 0.
  2434. @item rotation
  2435. Set rotation of virtual loudspeakers in deg. Default is 0.
  2436. @item elevation
  2437. Set elevation of virtual speakers in deg. Default is 0.
  2438. @item radius
  2439. Set distance in meters between loudspeakers and the listener with near-field
  2440. HRTFs. Default is 1.
  2441. @item type
  2442. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2443. processing audio in time domain which is slow but gives high quality output.
  2444. @var{freq} is processing audio in frequency domain which is fast but gives
  2445. mediocre output. Default is @var{freq}.
  2446. @end table
  2447. @section stereotools
  2448. This filter has some handy utilities to manage stereo signals, for converting
  2449. M/S stereo recordings to L/R signal while having control over the parameters
  2450. or spreading the stereo image of master track.
  2451. The filter accepts the following options:
  2452. @table @option
  2453. @item level_in
  2454. Set input level before filtering for both channels. Defaults is 1.
  2455. Allowed range is from 0.015625 to 64.
  2456. @item level_out
  2457. Set output level after filtering for both channels. Defaults is 1.
  2458. Allowed range is from 0.015625 to 64.
  2459. @item balance_in
  2460. Set input balance between both channels. Default is 0.
  2461. Allowed range is from -1 to 1.
  2462. @item balance_out
  2463. Set output balance between both channels. Default is 0.
  2464. Allowed range is from -1 to 1.
  2465. @item softclip
  2466. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  2467. clipping. Disabled by default.
  2468. @item mutel
  2469. Mute the left channel. Disabled by default.
  2470. @item muter
  2471. Mute the right channel. Disabled by default.
  2472. @item phasel
  2473. Change the phase of the left channel. Disabled by default.
  2474. @item phaser
  2475. Change the phase of the right channel. Disabled by default.
  2476. @item mode
  2477. Set stereo mode. Available values are:
  2478. @table @samp
  2479. @item lr>lr
  2480. Left/Right to Left/Right, this is default.
  2481. @item lr>ms
  2482. Left/Right to Mid/Side.
  2483. @item ms>lr
  2484. Mid/Side to Left/Right.
  2485. @item lr>ll
  2486. Left/Right to Left/Left.
  2487. @item lr>rr
  2488. Left/Right to Right/Right.
  2489. @item lr>l+r
  2490. Left/Right to Left + Right.
  2491. @item lr>rl
  2492. Left/Right to Right/Left.
  2493. @end table
  2494. @item slev
  2495. Set level of side signal. Default is 1.
  2496. Allowed range is from 0.015625 to 64.
  2497. @item sbal
  2498. Set balance of side signal. Default is 0.
  2499. Allowed range is from -1 to 1.
  2500. @item mlev
  2501. Set level of the middle signal. Default is 1.
  2502. Allowed range is from 0.015625 to 64.
  2503. @item mpan
  2504. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  2505. @item base
  2506. Set stereo base between mono and inversed channels. Default is 0.
  2507. Allowed range is from -1 to 1.
  2508. @item delay
  2509. Set delay in milliseconds how much to delay left from right channel and
  2510. vice versa. Default is 0. Allowed range is from -20 to 20.
  2511. @item sclevel
  2512. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  2513. @item phase
  2514. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  2515. @end table
  2516. @section stereowiden
  2517. This filter enhance the stereo effect by suppressing signal common to both
  2518. channels and by delaying the signal of left into right and vice versa,
  2519. thereby widening the stereo effect.
  2520. The filter accepts the following options:
  2521. @table @option
  2522. @item delay
  2523. Time in milliseconds of the delay of left signal into right and vice versa.
  2524. Default is 20 milliseconds.
  2525. @item feedback
  2526. Amount of gain in delayed signal into right and vice versa. Gives a delay
  2527. effect of left signal in right output and vice versa which gives widening
  2528. effect. Default is 0.3.
  2529. @item crossfeed
  2530. Cross feed of left into right with inverted phase. This helps in suppressing
  2531. the mono. If the value is 1 it will cancel all the signal common to both
  2532. channels. Default is 0.3.
  2533. @item drymix
  2534. Set level of input signal of original channel. Default is 0.8.
  2535. @end table
  2536. @section treble
  2537. Boost or cut treble (upper) frequencies of the audio using a two-pole
  2538. shelving filter with a response similar to that of a standard
  2539. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2540. The filter accepts the following options:
  2541. @table @option
  2542. @item gain, g
  2543. Give the gain at whichever is the lower of ~22 kHz and the
  2544. Nyquist frequency. Its useful range is about -20 (for a large cut)
  2545. to +20 (for a large boost). Beware of clipping when using a positive gain.
  2546. @item frequency, f
  2547. Set the filter's central frequency and so can be used
  2548. to extend or reduce the frequency range to be boosted or cut.
  2549. The default value is @code{3000} Hz.
  2550. @item width_type
  2551. Set method to specify band-width of filter.
  2552. @table @option
  2553. @item h
  2554. Hz
  2555. @item q
  2556. Q-Factor
  2557. @item o
  2558. octave
  2559. @item s
  2560. slope
  2561. @end table
  2562. @item width, w
  2563. Determine how steep is the filter's shelf transition.
  2564. @end table
  2565. @section tremolo
  2566. Sinusoidal amplitude modulation.
  2567. The filter accepts the following options:
  2568. @table @option
  2569. @item f
  2570. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  2571. (20 Hz or lower) will result in a tremolo effect.
  2572. This filter may also be used as a ring modulator by specifying
  2573. a modulation frequency higher than 20 Hz.
  2574. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2575. @item d
  2576. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2577. Default value is 0.5.
  2578. @end table
  2579. @section vibrato
  2580. Sinusoidal phase modulation.
  2581. The filter accepts the following options:
  2582. @table @option
  2583. @item f
  2584. Modulation frequency in Hertz.
  2585. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2586. @item d
  2587. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2588. Default value is 0.5.
  2589. @end table
  2590. @section volume
  2591. Adjust the input audio volume.
  2592. It accepts the following parameters:
  2593. @table @option
  2594. @item volume
  2595. Set audio volume expression.
  2596. Output values are clipped to the maximum value.
  2597. The output audio volume is given by the relation:
  2598. @example
  2599. @var{output_volume} = @var{volume} * @var{input_volume}
  2600. @end example
  2601. The default value for @var{volume} is "1.0".
  2602. @item precision
  2603. This parameter represents the mathematical precision.
  2604. It determines which input sample formats will be allowed, which affects the
  2605. precision of the volume scaling.
  2606. @table @option
  2607. @item fixed
  2608. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  2609. @item float
  2610. 32-bit floating-point; this limits input sample format to FLT. (default)
  2611. @item double
  2612. 64-bit floating-point; this limits input sample format to DBL.
  2613. @end table
  2614. @item replaygain
  2615. Choose the behaviour on encountering ReplayGain side data in input frames.
  2616. @table @option
  2617. @item drop
  2618. Remove ReplayGain side data, ignoring its contents (the default).
  2619. @item ignore
  2620. Ignore ReplayGain side data, but leave it in the frame.
  2621. @item track
  2622. Prefer the track gain, if present.
  2623. @item album
  2624. Prefer the album gain, if present.
  2625. @end table
  2626. @item replaygain_preamp
  2627. Pre-amplification gain in dB to apply to the selected replaygain gain.
  2628. Default value for @var{replaygain_preamp} is 0.0.
  2629. @item eval
  2630. Set when the volume expression is evaluated.
  2631. It accepts the following values:
  2632. @table @samp
  2633. @item once
  2634. only evaluate expression once during the filter initialization, or
  2635. when the @samp{volume} command is sent
  2636. @item frame
  2637. evaluate expression for each incoming frame
  2638. @end table
  2639. Default value is @samp{once}.
  2640. @end table
  2641. The volume expression can contain the following parameters.
  2642. @table @option
  2643. @item n
  2644. frame number (starting at zero)
  2645. @item nb_channels
  2646. number of channels
  2647. @item nb_consumed_samples
  2648. number of samples consumed by the filter
  2649. @item nb_samples
  2650. number of samples in the current frame
  2651. @item pos
  2652. original frame position in the file
  2653. @item pts
  2654. frame PTS
  2655. @item sample_rate
  2656. sample rate
  2657. @item startpts
  2658. PTS at start of stream
  2659. @item startt
  2660. time at start of stream
  2661. @item t
  2662. frame time
  2663. @item tb
  2664. timestamp timebase
  2665. @item volume
  2666. last set volume value
  2667. @end table
  2668. Note that when @option{eval} is set to @samp{once} only the
  2669. @var{sample_rate} and @var{tb} variables are available, all other
  2670. variables will evaluate to NAN.
  2671. @subsection Commands
  2672. This filter supports the following commands:
  2673. @table @option
  2674. @item volume
  2675. Modify the volume expression.
  2676. The command accepts the same syntax of the corresponding option.
  2677. If the specified expression is not valid, it is kept at its current
  2678. value.
  2679. @item replaygain_noclip
  2680. Prevent clipping by limiting the gain applied.
  2681. Default value for @var{replaygain_noclip} is 1.
  2682. @end table
  2683. @subsection Examples
  2684. @itemize
  2685. @item
  2686. Halve the input audio volume:
  2687. @example
  2688. volume=volume=0.5
  2689. volume=volume=1/2
  2690. volume=volume=-6.0206dB
  2691. @end example
  2692. In all the above example the named key for @option{volume} can be
  2693. omitted, for example like in:
  2694. @example
  2695. volume=0.5
  2696. @end example
  2697. @item
  2698. Increase input audio power by 6 decibels using fixed-point precision:
  2699. @example
  2700. volume=volume=6dB:precision=fixed
  2701. @end example
  2702. @item
  2703. Fade volume after time 10 with an annihilation period of 5 seconds:
  2704. @example
  2705. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  2706. @end example
  2707. @end itemize
  2708. @section volumedetect
  2709. Detect the volume of the input video.
  2710. The filter has no parameters. The input is not modified. Statistics about
  2711. the volume will be printed in the log when the input stream end is reached.
  2712. In particular it will show the mean volume (root mean square), maximum
  2713. volume (on a per-sample basis), and the beginning of a histogram of the
  2714. registered volume values (from the maximum value to a cumulated 1/1000 of
  2715. the samples).
  2716. All volumes are in decibels relative to the maximum PCM value.
  2717. @subsection Examples
  2718. Here is an excerpt of the output:
  2719. @example
  2720. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  2721. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  2722. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  2723. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  2724. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  2725. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  2726. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  2727. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  2728. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  2729. @end example
  2730. It means that:
  2731. @itemize
  2732. @item
  2733. The mean square energy is approximately -27 dB, or 10^-2.7.
  2734. @item
  2735. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  2736. @item
  2737. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  2738. @end itemize
  2739. In other words, raising the volume by +4 dB does not cause any clipping,
  2740. raising it by +5 dB causes clipping for 6 samples, etc.
  2741. @c man end AUDIO FILTERS
  2742. @chapter Audio Sources
  2743. @c man begin AUDIO SOURCES
  2744. Below is a description of the currently available audio sources.
  2745. @section abuffer
  2746. Buffer audio frames, and make them available to the filter chain.
  2747. This source is mainly intended for a programmatic use, in particular
  2748. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  2749. It accepts the following parameters:
  2750. @table @option
  2751. @item time_base
  2752. The timebase which will be used for timestamps of submitted frames. It must be
  2753. either a floating-point number or in @var{numerator}/@var{denominator} form.
  2754. @item sample_rate
  2755. The sample rate of the incoming audio buffers.
  2756. @item sample_fmt
  2757. The sample format of the incoming audio buffers.
  2758. Either a sample format name or its corresponding integer representation from
  2759. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  2760. @item channel_layout
  2761. The channel layout of the incoming audio buffers.
  2762. Either a channel layout name from channel_layout_map in
  2763. @file{libavutil/channel_layout.c} or its corresponding integer representation
  2764. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  2765. @item channels
  2766. The number of channels of the incoming audio buffers.
  2767. If both @var{channels} and @var{channel_layout} are specified, then they
  2768. must be consistent.
  2769. @end table
  2770. @subsection Examples
  2771. @example
  2772. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  2773. @end example
  2774. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  2775. Since the sample format with name "s16p" corresponds to the number
  2776. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  2777. equivalent to:
  2778. @example
  2779. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  2780. @end example
  2781. @section aevalsrc
  2782. Generate an audio signal specified by an expression.
  2783. This source accepts in input one or more expressions (one for each
  2784. channel), which are evaluated and used to generate a corresponding
  2785. audio signal.
  2786. This source accepts the following options:
  2787. @table @option
  2788. @item exprs
  2789. Set the '|'-separated expressions list for each separate channel. In case the
  2790. @option{channel_layout} option is not specified, the selected channel layout
  2791. depends on the number of provided expressions. Otherwise the last
  2792. specified expression is applied to the remaining output channels.
  2793. @item channel_layout, c
  2794. Set the channel layout. The number of channels in the specified layout
  2795. must be equal to the number of specified expressions.
  2796. @item duration, d
  2797. Set the minimum duration of the sourced audio. See
  2798. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2799. for the accepted syntax.
  2800. Note that the resulting duration may be greater than the specified
  2801. duration, as the generated audio is always cut at the end of a
  2802. complete frame.
  2803. If not specified, or the expressed duration is negative, the audio is
  2804. supposed to be generated forever.
  2805. @item nb_samples, n
  2806. Set the number of samples per channel per each output frame,
  2807. default to 1024.
  2808. @item sample_rate, s
  2809. Specify the sample rate, default to 44100.
  2810. @end table
  2811. Each expression in @var{exprs} can contain the following constants:
  2812. @table @option
  2813. @item n
  2814. number of the evaluated sample, starting from 0
  2815. @item t
  2816. time of the evaluated sample expressed in seconds, starting from 0
  2817. @item s
  2818. sample rate
  2819. @end table
  2820. @subsection Examples
  2821. @itemize
  2822. @item
  2823. Generate silence:
  2824. @example
  2825. aevalsrc=0
  2826. @end example
  2827. @item
  2828. Generate a sin signal with frequency of 440 Hz, set sample rate to
  2829. 8000 Hz:
  2830. @example
  2831. aevalsrc="sin(440*2*PI*t):s=8000"
  2832. @end example
  2833. @item
  2834. Generate a two channels signal, specify the channel layout (Front
  2835. Center + Back Center) explicitly:
  2836. @example
  2837. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  2838. @end example
  2839. @item
  2840. Generate white noise:
  2841. @example
  2842. aevalsrc="-2+random(0)"
  2843. @end example
  2844. @item
  2845. Generate an amplitude modulated signal:
  2846. @example
  2847. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  2848. @end example
  2849. @item
  2850. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  2851. @example
  2852. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  2853. @end example
  2854. @end itemize
  2855. @section anullsrc
  2856. The null audio source, return unprocessed audio frames. It is mainly useful
  2857. as a template and to be employed in analysis / debugging tools, or as
  2858. the source for filters which ignore the input data (for example the sox
  2859. synth filter).
  2860. This source accepts the following options:
  2861. @table @option
  2862. @item channel_layout, cl
  2863. Specifies the channel layout, and can be either an integer or a string
  2864. representing a channel layout. The default value of @var{channel_layout}
  2865. is "stereo".
  2866. Check the channel_layout_map definition in
  2867. @file{libavutil/channel_layout.c} for the mapping between strings and
  2868. channel layout values.
  2869. @item sample_rate, r
  2870. Specifies the sample rate, and defaults to 44100.
  2871. @item nb_samples, n
  2872. Set the number of samples per requested frames.
  2873. @end table
  2874. @subsection Examples
  2875. @itemize
  2876. @item
  2877. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  2878. @example
  2879. anullsrc=r=48000:cl=4
  2880. @end example
  2881. @item
  2882. Do the same operation with a more obvious syntax:
  2883. @example
  2884. anullsrc=r=48000:cl=mono
  2885. @end example
  2886. @end itemize
  2887. All the parameters need to be explicitly defined.
  2888. @section flite
  2889. Synthesize a voice utterance using the libflite library.
  2890. To enable compilation of this filter you need to configure FFmpeg with
  2891. @code{--enable-libflite}.
  2892. Note that the flite library is not thread-safe.
  2893. The filter accepts the following options:
  2894. @table @option
  2895. @item list_voices
  2896. If set to 1, list the names of the available voices and exit
  2897. immediately. Default value is 0.
  2898. @item nb_samples, n
  2899. Set the maximum number of samples per frame. Default value is 512.
  2900. @item textfile
  2901. Set the filename containing the text to speak.
  2902. @item text
  2903. Set the text to speak.
  2904. @item voice, v
  2905. Set the voice to use for the speech synthesis. Default value is
  2906. @code{kal}. See also the @var{list_voices} option.
  2907. @end table
  2908. @subsection Examples
  2909. @itemize
  2910. @item
  2911. Read from file @file{speech.txt}, and synthesize the text using the
  2912. standard flite voice:
  2913. @example
  2914. flite=textfile=speech.txt
  2915. @end example
  2916. @item
  2917. Read the specified text selecting the @code{slt} voice:
  2918. @example
  2919. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  2920. @end example
  2921. @item
  2922. Input text to ffmpeg:
  2923. @example
  2924. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  2925. @end example
  2926. @item
  2927. Make @file{ffplay} speak the specified text, using @code{flite} and
  2928. the @code{lavfi} device:
  2929. @example
  2930. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  2931. @end example
  2932. @end itemize
  2933. For more information about libflite, check:
  2934. @url{http://www.speech.cs.cmu.edu/flite/}
  2935. @section anoisesrc
  2936. Generate a noise audio signal.
  2937. The filter accepts the following options:
  2938. @table @option
  2939. @item sample_rate, r
  2940. Specify the sample rate. Default value is 48000 Hz.
  2941. @item amplitude, a
  2942. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  2943. is 1.0.
  2944. @item duration, d
  2945. Specify the duration of the generated audio stream. Not specifying this option
  2946. results in noise with an infinite length.
  2947. @item color, colour, c
  2948. Specify the color of noise. Available noise colors are white, pink, and brown.
  2949. Default color is white.
  2950. @item seed, s
  2951. Specify a value used to seed the PRNG.
  2952. @item nb_samples, n
  2953. Set the number of samples per each output frame, default is 1024.
  2954. @end table
  2955. @subsection Examples
  2956. @itemize
  2957. @item
  2958. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  2959. @example
  2960. anoisesrc=d=60:c=pink:r=44100:a=0.5
  2961. @end example
  2962. @end itemize
  2963. @section sine
  2964. Generate an audio signal made of a sine wave with amplitude 1/8.
  2965. The audio signal is bit-exact.
  2966. The filter accepts the following options:
  2967. @table @option
  2968. @item frequency, f
  2969. Set the carrier frequency. Default is 440 Hz.
  2970. @item beep_factor, b
  2971. Enable a periodic beep every second with frequency @var{beep_factor} times
  2972. the carrier frequency. Default is 0, meaning the beep is disabled.
  2973. @item sample_rate, r
  2974. Specify the sample rate, default is 44100.
  2975. @item duration, d
  2976. Specify the duration of the generated audio stream.
  2977. @item samples_per_frame
  2978. Set the number of samples per output frame.
  2979. The expression can contain the following constants:
  2980. @table @option
  2981. @item n
  2982. The (sequential) number of the output audio frame, starting from 0.
  2983. @item pts
  2984. The PTS (Presentation TimeStamp) of the output audio frame,
  2985. expressed in @var{TB} units.
  2986. @item t
  2987. The PTS of the output audio frame, expressed in seconds.
  2988. @item TB
  2989. The timebase of the output audio frames.
  2990. @end table
  2991. Default is @code{1024}.
  2992. @end table
  2993. @subsection Examples
  2994. @itemize
  2995. @item
  2996. Generate a simple 440 Hz sine wave:
  2997. @example
  2998. sine
  2999. @end example
  3000. @item
  3001. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3002. @example
  3003. sine=220:4:d=5
  3004. sine=f=220:b=4:d=5
  3005. sine=frequency=220:beep_factor=4:duration=5
  3006. @end example
  3007. @item
  3008. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3009. pattern:
  3010. @example
  3011. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3012. @end example
  3013. @end itemize
  3014. @c man end AUDIO SOURCES
  3015. @chapter Audio Sinks
  3016. @c man begin AUDIO SINKS
  3017. Below is a description of the currently available audio sinks.
  3018. @section abuffersink
  3019. Buffer audio frames, and make them available to the end of filter chain.
  3020. This sink is mainly intended for programmatic use, in particular
  3021. through the interface defined in @file{libavfilter/buffersink.h}
  3022. or the options system.
  3023. It accepts a pointer to an AVABufferSinkContext structure, which
  3024. defines the incoming buffers' formats, to be passed as the opaque
  3025. parameter to @code{avfilter_init_filter} for initialization.
  3026. @section anullsink
  3027. Null audio sink; do absolutely nothing with the input audio. It is
  3028. mainly useful as a template and for use in analysis / debugging
  3029. tools.
  3030. @c man end AUDIO SINKS
  3031. @chapter Video Filters
  3032. @c man begin VIDEO FILTERS
  3033. When you configure your FFmpeg build, you can disable any of the
  3034. existing filters using @code{--disable-filters}.
  3035. The configure output will show the video filters included in your
  3036. build.
  3037. Below is a description of the currently available video filters.
  3038. @section alphaextract
  3039. Extract the alpha component from the input as a grayscale video. This
  3040. is especially useful with the @var{alphamerge} filter.
  3041. @section alphamerge
  3042. Add or replace the alpha component of the primary input with the
  3043. grayscale value of a second input. This is intended for use with
  3044. @var{alphaextract} to allow the transmission or storage of frame
  3045. sequences that have alpha in a format that doesn't support an alpha
  3046. channel.
  3047. For example, to reconstruct full frames from a normal YUV-encoded video
  3048. and a separate video created with @var{alphaextract}, you might use:
  3049. @example
  3050. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3051. @end example
  3052. Since this filter is designed for reconstruction, it operates on frame
  3053. sequences without considering timestamps, and terminates when either
  3054. input reaches end of stream. This will cause problems if your encoding
  3055. pipeline drops frames. If you're trying to apply an image as an
  3056. overlay to a video stream, consider the @var{overlay} filter instead.
  3057. @section ass
  3058. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3059. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3060. Substation Alpha) subtitles files.
  3061. This filter accepts the following option in addition to the common options from
  3062. the @ref{subtitles} filter:
  3063. @table @option
  3064. @item shaping
  3065. Set the shaping engine
  3066. Available values are:
  3067. @table @samp
  3068. @item auto
  3069. The default libass shaping engine, which is the best available.
  3070. @item simple
  3071. Fast, font-agnostic shaper that can do only substitutions
  3072. @item complex
  3073. Slower shaper using OpenType for substitutions and positioning
  3074. @end table
  3075. The default is @code{auto}.
  3076. @end table
  3077. @section atadenoise
  3078. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3079. The filter accepts the following options:
  3080. @table @option
  3081. @item 0a
  3082. Set threshold A for 1st plane. Default is 0.02.
  3083. Valid range is 0 to 0.3.
  3084. @item 0b
  3085. Set threshold B for 1st plane. Default is 0.04.
  3086. Valid range is 0 to 5.
  3087. @item 1a
  3088. Set threshold A for 2nd plane. Default is 0.02.
  3089. Valid range is 0 to 0.3.
  3090. @item 1b
  3091. Set threshold B for 2nd plane. Default is 0.04.
  3092. Valid range is 0 to 5.
  3093. @item 2a
  3094. Set threshold A for 3rd plane. Default is 0.02.
  3095. Valid range is 0 to 0.3.
  3096. @item 2b
  3097. Set threshold B for 3rd plane. Default is 0.04.
  3098. Valid range is 0 to 5.
  3099. Threshold A is designed to react on abrupt changes in the input signal and
  3100. threshold B is designed to react on continuous changes in the input signal.
  3101. @item s
  3102. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3103. number in range [5, 129].
  3104. @end table
  3105. @section bbox
  3106. Compute the bounding box for the non-black pixels in the input frame
  3107. luminance plane.
  3108. This filter computes the bounding box containing all the pixels with a
  3109. luminance value greater than the minimum allowed value.
  3110. The parameters describing the bounding box are printed on the filter
  3111. log.
  3112. The filter accepts the following option:
  3113. @table @option
  3114. @item min_val
  3115. Set the minimal luminance value. Default is @code{16}.
  3116. @end table
  3117. @section blackdetect
  3118. Detect video intervals that are (almost) completely black. Can be
  3119. useful to detect chapter transitions, commercials, or invalid
  3120. recordings. Output lines contains the time for the start, end and
  3121. duration of the detected black interval expressed in seconds.
  3122. In order to display the output lines, you need to set the loglevel at
  3123. least to the AV_LOG_INFO value.
  3124. The filter accepts the following options:
  3125. @table @option
  3126. @item black_min_duration, d
  3127. Set the minimum detected black duration expressed in seconds. It must
  3128. be a non-negative floating point number.
  3129. Default value is 2.0.
  3130. @item picture_black_ratio_th, pic_th
  3131. Set the threshold for considering a picture "black".
  3132. Express the minimum value for the ratio:
  3133. @example
  3134. @var{nb_black_pixels} / @var{nb_pixels}
  3135. @end example
  3136. for which a picture is considered black.
  3137. Default value is 0.98.
  3138. @item pixel_black_th, pix_th
  3139. Set the threshold for considering a pixel "black".
  3140. The threshold expresses the maximum pixel luminance value for which a
  3141. pixel is considered "black". The provided value is scaled according to
  3142. the following equation:
  3143. @example
  3144. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  3145. @end example
  3146. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  3147. the input video format, the range is [0-255] for YUV full-range
  3148. formats and [16-235] for YUV non full-range formats.
  3149. Default value is 0.10.
  3150. @end table
  3151. The following example sets the maximum pixel threshold to the minimum
  3152. value, and detects only black intervals of 2 or more seconds:
  3153. @example
  3154. blackdetect=d=2:pix_th=0.00
  3155. @end example
  3156. @section blackframe
  3157. Detect frames that are (almost) completely black. Can be useful to
  3158. detect chapter transitions or commercials. Output lines consist of
  3159. the frame number of the detected frame, the percentage of blackness,
  3160. the position in the file if known or -1 and the timestamp in seconds.
  3161. In order to display the output lines, you need to set the loglevel at
  3162. least to the AV_LOG_INFO value.
  3163. It accepts the following parameters:
  3164. @table @option
  3165. @item amount
  3166. The percentage of the pixels that have to be below the threshold; it defaults to
  3167. @code{98}.
  3168. @item threshold, thresh
  3169. The threshold below which a pixel value is considered black; it defaults to
  3170. @code{32}.
  3171. @end table
  3172. @section blend, tblend
  3173. Blend two video frames into each other.
  3174. The @code{blend} filter takes two input streams and outputs one
  3175. stream, the first input is the "top" layer and second input is
  3176. "bottom" layer. Output terminates when shortest input terminates.
  3177. The @code{tblend} (time blend) filter takes two consecutive frames
  3178. from one single stream, and outputs the result obtained by blending
  3179. the new frame on top of the old frame.
  3180. A description of the accepted options follows.
  3181. @table @option
  3182. @item c0_mode
  3183. @item c1_mode
  3184. @item c2_mode
  3185. @item c3_mode
  3186. @item all_mode
  3187. Set blend mode for specific pixel component or all pixel components in case
  3188. of @var{all_mode}. Default value is @code{normal}.
  3189. Available values for component modes are:
  3190. @table @samp
  3191. @item addition
  3192. @item addition128
  3193. @item and
  3194. @item average
  3195. @item burn
  3196. @item darken
  3197. @item difference
  3198. @item difference128
  3199. @item divide
  3200. @item dodge
  3201. @item exclusion
  3202. @item glow
  3203. @item hardlight
  3204. @item hardmix
  3205. @item lighten
  3206. @item linearlight
  3207. @item multiply
  3208. @item negation
  3209. @item normal
  3210. @item or
  3211. @item overlay
  3212. @item phoenix
  3213. @item pinlight
  3214. @item reflect
  3215. @item screen
  3216. @item softlight
  3217. @item subtract
  3218. @item vividlight
  3219. @item xor
  3220. @end table
  3221. @item c0_opacity
  3222. @item c1_opacity
  3223. @item c2_opacity
  3224. @item c3_opacity
  3225. @item all_opacity
  3226. Set blend opacity for specific pixel component or all pixel components in case
  3227. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  3228. @item c0_expr
  3229. @item c1_expr
  3230. @item c2_expr
  3231. @item c3_expr
  3232. @item all_expr
  3233. Set blend expression for specific pixel component or all pixel components in case
  3234. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3235. The expressions can use the following variables:
  3236. @table @option
  3237. @item N
  3238. The sequential number of the filtered frame, starting from @code{0}.
  3239. @item X
  3240. @item Y
  3241. the coordinates of the current sample
  3242. @item W
  3243. @item H
  3244. the width and height of currently filtered plane
  3245. @item SW
  3246. @item SH
  3247. Width and height scale depending on the currently filtered plane. It is the
  3248. ratio between the corresponding luma plane number of pixels and the current
  3249. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3250. @code{0.5,0.5} for chroma planes.
  3251. @item T
  3252. Time of the current frame, expressed in seconds.
  3253. @item TOP, A
  3254. Value of pixel component at current location for first video frame (top layer).
  3255. @item BOTTOM, B
  3256. Value of pixel component at current location for second video frame (bottom layer).
  3257. @end table
  3258. @item shortest
  3259. Force termination when the shortest input terminates. Default is
  3260. @code{0}. This option is only defined for the @code{blend} filter.
  3261. @item repeatlast
  3262. Continue applying the last bottom frame after the end of the stream. A value of
  3263. @code{0} disable the filter after the last frame of the bottom layer is reached.
  3264. Default is @code{1}. This option is only defined for the @code{blend} filter.
  3265. @end table
  3266. @subsection Examples
  3267. @itemize
  3268. @item
  3269. Apply transition from bottom layer to top layer in first 10 seconds:
  3270. @example
  3271. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3272. @end example
  3273. @item
  3274. Apply 1x1 checkerboard effect:
  3275. @example
  3276. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  3277. @end example
  3278. @item
  3279. Apply uncover left effect:
  3280. @example
  3281. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  3282. @end example
  3283. @item
  3284. Apply uncover down effect:
  3285. @example
  3286. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  3287. @end example
  3288. @item
  3289. Apply uncover up-left effect:
  3290. @example
  3291. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  3292. @end example
  3293. @item
  3294. Display differences between the current and the previous frame:
  3295. @example
  3296. tblend=all_mode=difference128
  3297. @end example
  3298. @end itemize
  3299. @section boxblur
  3300. Apply a boxblur algorithm to the input video.
  3301. It accepts the following parameters:
  3302. @table @option
  3303. @item luma_radius, lr
  3304. @item luma_power, lp
  3305. @item chroma_radius, cr
  3306. @item chroma_power, cp
  3307. @item alpha_radius, ar
  3308. @item alpha_power, ap
  3309. @end table
  3310. A description of the accepted options follows.
  3311. @table @option
  3312. @item luma_radius, lr
  3313. @item chroma_radius, cr
  3314. @item alpha_radius, ar
  3315. Set an expression for the box radius in pixels used for blurring the
  3316. corresponding input plane.
  3317. The radius value must be a non-negative number, and must not be
  3318. greater than the value of the expression @code{min(w,h)/2} for the
  3319. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  3320. planes.
  3321. Default value for @option{luma_radius} is "2". If not specified,
  3322. @option{chroma_radius} and @option{alpha_radius} default to the
  3323. corresponding value set for @option{luma_radius}.
  3324. The expressions can contain the following constants:
  3325. @table @option
  3326. @item w
  3327. @item h
  3328. The input width and height in pixels.
  3329. @item cw
  3330. @item ch
  3331. The input chroma image width and height in pixels.
  3332. @item hsub
  3333. @item vsub
  3334. The horizontal and vertical chroma subsample values. For example, for the
  3335. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  3336. @end table
  3337. @item luma_power, lp
  3338. @item chroma_power, cp
  3339. @item alpha_power, ap
  3340. Specify how many times the boxblur filter is applied to the
  3341. corresponding plane.
  3342. Default value for @option{luma_power} is 2. If not specified,
  3343. @option{chroma_power} and @option{alpha_power} default to the
  3344. corresponding value set for @option{luma_power}.
  3345. A value of 0 will disable the effect.
  3346. @end table
  3347. @subsection Examples
  3348. @itemize
  3349. @item
  3350. Apply a boxblur filter with the luma, chroma, and alpha radii
  3351. set to 2:
  3352. @example
  3353. boxblur=luma_radius=2:luma_power=1
  3354. boxblur=2:1
  3355. @end example
  3356. @item
  3357. Set the luma radius to 2, and alpha and chroma radius to 0:
  3358. @example
  3359. boxblur=2:1:cr=0:ar=0
  3360. @end example
  3361. @item
  3362. Set the luma and chroma radii to a fraction of the video dimension:
  3363. @example
  3364. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  3365. @end example
  3366. @end itemize
  3367. @section chromakey
  3368. YUV colorspace color/chroma keying.
  3369. The filter accepts the following options:
  3370. @table @option
  3371. @item color
  3372. The color which will be replaced with transparency.
  3373. @item similarity
  3374. Similarity percentage with the key color.
  3375. 0.01 matches only the exact key color, while 1.0 matches everything.
  3376. @item blend
  3377. Blend percentage.
  3378. 0.0 makes pixels either fully transparent, or not transparent at all.
  3379. Higher values result in semi-transparent pixels, with a higher transparency
  3380. the more similar the pixels color is to the key color.
  3381. @item yuv
  3382. Signals that the color passed is already in YUV instead of RGB.
  3383. Litteral colors like "green" or "red" don't make sense with this enabled anymore.
  3384. This can be used to pass exact YUV values as hexadecimal numbers.
  3385. @end table
  3386. @subsection Examples
  3387. @itemize
  3388. @item
  3389. Make every green pixel in the input image transparent:
  3390. @example
  3391. ffmpeg -i input.png -vf chromakey=green out.png
  3392. @end example
  3393. @item
  3394. Overlay a greenscreen-video on top of a static black background.
  3395. @example
  3396. 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
  3397. @end example
  3398. @end itemize
  3399. @section codecview
  3400. Visualize information exported by some codecs.
  3401. Some codecs can export information through frames using side-data or other
  3402. means. For example, some MPEG based codecs export motion vectors through the
  3403. @var{export_mvs} flag in the codec @option{flags2} option.
  3404. The filter accepts the following option:
  3405. @table @option
  3406. @item mv
  3407. Set motion vectors to visualize.
  3408. Available flags for @var{mv} are:
  3409. @table @samp
  3410. @item pf
  3411. forward predicted MVs of P-frames
  3412. @item bf
  3413. forward predicted MVs of B-frames
  3414. @item bb
  3415. backward predicted MVs of B-frames
  3416. @end table
  3417. @item qp
  3418. Display quantization parameters using the chroma planes
  3419. @end table
  3420. @subsection Examples
  3421. @itemize
  3422. @item
  3423. Visualizes multi-directionals MVs from P and B-Frames using @command{ffplay}:
  3424. @example
  3425. ffplay -flags2 +export_mvs input.mpg -vf codecview=mv=pf+bf+bb
  3426. @end example
  3427. @end itemize
  3428. @section colorbalance
  3429. Modify intensity of primary colors (red, green and blue) of input frames.
  3430. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  3431. regions for the red-cyan, green-magenta or blue-yellow balance.
  3432. A positive adjustment value shifts the balance towards the primary color, a negative
  3433. value towards the complementary color.
  3434. The filter accepts the following options:
  3435. @table @option
  3436. @item rs
  3437. @item gs
  3438. @item bs
  3439. Adjust red, green and blue shadows (darkest pixels).
  3440. @item rm
  3441. @item gm
  3442. @item bm
  3443. Adjust red, green and blue midtones (medium pixels).
  3444. @item rh
  3445. @item gh
  3446. @item bh
  3447. Adjust red, green and blue highlights (brightest pixels).
  3448. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3449. @end table
  3450. @subsection Examples
  3451. @itemize
  3452. @item
  3453. Add red color cast to shadows:
  3454. @example
  3455. colorbalance=rs=.3
  3456. @end example
  3457. @end itemize
  3458. @section colorkey
  3459. RGB colorspace color keying.
  3460. The filter accepts the following options:
  3461. @table @option
  3462. @item color
  3463. The color which will be replaced with transparency.
  3464. @item similarity
  3465. Similarity percentage with the key color.
  3466. 0.01 matches only the exact key color, while 1.0 matches everything.
  3467. @item blend
  3468. Blend percentage.
  3469. 0.0 makes pixels either fully transparent, or not transparent at all.
  3470. Higher values result in semi-transparent pixels, with a higher transparency
  3471. the more similar the pixels color is to the key color.
  3472. @end table
  3473. @subsection Examples
  3474. @itemize
  3475. @item
  3476. Make every green pixel in the input image transparent:
  3477. @example
  3478. ffmpeg -i input.png -vf colorkey=green out.png
  3479. @end example
  3480. @item
  3481. Overlay a greenscreen-video on top of a static background image.
  3482. @example
  3483. 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
  3484. @end example
  3485. @end itemize
  3486. @section colorlevels
  3487. Adjust video input frames using levels.
  3488. The filter accepts the following options:
  3489. @table @option
  3490. @item rimin
  3491. @item gimin
  3492. @item bimin
  3493. @item aimin
  3494. Adjust red, green, blue and alpha input black point.
  3495. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3496. @item rimax
  3497. @item gimax
  3498. @item bimax
  3499. @item aimax
  3500. Adjust red, green, blue and alpha input white point.
  3501. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  3502. Input levels are used to lighten highlights (bright tones), darken shadows
  3503. (dark tones), change the balance of bright and dark tones.
  3504. @item romin
  3505. @item gomin
  3506. @item bomin
  3507. @item aomin
  3508. Adjust red, green, blue and alpha output black point.
  3509. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  3510. @item romax
  3511. @item gomax
  3512. @item bomax
  3513. @item aomax
  3514. Adjust red, green, blue and alpha output white point.
  3515. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  3516. Output levels allows manual selection of a constrained output level range.
  3517. @end table
  3518. @subsection Examples
  3519. @itemize
  3520. @item
  3521. Make video output darker:
  3522. @example
  3523. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  3524. @end example
  3525. @item
  3526. Increase contrast:
  3527. @example
  3528. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  3529. @end example
  3530. @item
  3531. Make video output lighter:
  3532. @example
  3533. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  3534. @end example
  3535. @item
  3536. Increase brightness:
  3537. @example
  3538. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  3539. @end example
  3540. @end itemize
  3541. @section colorchannelmixer
  3542. Adjust video input frames by re-mixing color channels.
  3543. This filter modifies a color channel by adding the values associated to
  3544. the other channels of the same pixels. For example if the value to
  3545. modify is red, the output value will be:
  3546. @example
  3547. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  3548. @end example
  3549. The filter accepts the following options:
  3550. @table @option
  3551. @item rr
  3552. @item rg
  3553. @item rb
  3554. @item ra
  3555. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  3556. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  3557. @item gr
  3558. @item gg
  3559. @item gb
  3560. @item ga
  3561. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  3562. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  3563. @item br
  3564. @item bg
  3565. @item bb
  3566. @item ba
  3567. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  3568. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  3569. @item ar
  3570. @item ag
  3571. @item ab
  3572. @item aa
  3573. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  3574. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  3575. Allowed ranges for options are @code{[-2.0, 2.0]}.
  3576. @end table
  3577. @subsection Examples
  3578. @itemize
  3579. @item
  3580. Convert source to grayscale:
  3581. @example
  3582. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  3583. @end example
  3584. @item
  3585. Simulate sepia tones:
  3586. @example
  3587. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  3588. @end example
  3589. @end itemize
  3590. @section colormatrix
  3591. Convert color matrix.
  3592. The filter accepts the following options:
  3593. @table @option
  3594. @item src
  3595. @item dst
  3596. Specify the source and destination color matrix. Both values must be
  3597. specified.
  3598. The accepted values are:
  3599. @table @samp
  3600. @item bt709
  3601. BT.709
  3602. @item bt601
  3603. BT.601
  3604. @item smpte240m
  3605. SMPTE-240M
  3606. @item fcc
  3607. FCC
  3608. @end table
  3609. @end table
  3610. For example to convert from BT.601 to SMPTE-240M, use the command:
  3611. @example
  3612. colormatrix=bt601:smpte240m
  3613. @end example
  3614. @section convolution
  3615. Apply convolution 3x3 or 5x5 filter.
  3616. The filter accepts the following options:
  3617. @table @option
  3618. @item 0m
  3619. @item 1m
  3620. @item 2m
  3621. @item 3m
  3622. Set matrix for each plane.
  3623. Matrix is sequence of 9 or 25 signed integers.
  3624. @item 0rdiv
  3625. @item 1rdiv
  3626. @item 2rdiv
  3627. @item 3rdiv
  3628. Set multiplier for calculated value for each plane.
  3629. @item 0bias
  3630. @item 1bias
  3631. @item 2bias
  3632. @item 3bias
  3633. Set bias for each plane. This value is added to the result of the multiplication.
  3634. Useful for making the overall image brighter or darker. Default is 0.0.
  3635. @end table
  3636. @subsection Examples
  3637. @itemize
  3638. @item
  3639. Apply sharpen:
  3640. @example
  3641. 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"
  3642. @end example
  3643. @item
  3644. Apply blur:
  3645. @example
  3646. 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"
  3647. @end example
  3648. @item
  3649. Apply edge enhance:
  3650. @example
  3651. 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"
  3652. @end example
  3653. @item
  3654. Apply edge detect:
  3655. @example
  3656. 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"
  3657. @end example
  3658. @item
  3659. Apply emboss:
  3660. @example
  3661. 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"
  3662. @end example
  3663. @end itemize
  3664. @section copy
  3665. Copy the input source unchanged to the output. This is mainly useful for
  3666. testing purposes.
  3667. @section crop
  3668. Crop the input video to given dimensions.
  3669. It accepts the following parameters:
  3670. @table @option
  3671. @item w, out_w
  3672. The width of the output video. It defaults to @code{iw}.
  3673. This expression is evaluated only once during the filter
  3674. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  3675. @item h, out_h
  3676. The height of the output video. It defaults to @code{ih}.
  3677. This expression is evaluated only once during the filter
  3678. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  3679. @item x
  3680. The horizontal position, in the input video, of the left edge of the output
  3681. video. It defaults to @code{(in_w-out_w)/2}.
  3682. This expression is evaluated per-frame.
  3683. @item y
  3684. The vertical position, in the input video, of the top edge of the output video.
  3685. It defaults to @code{(in_h-out_h)/2}.
  3686. This expression is evaluated per-frame.
  3687. @item keep_aspect
  3688. If set to 1 will force the output display aspect ratio
  3689. to be the same of the input, by changing the output sample aspect
  3690. ratio. It defaults to 0.
  3691. @end table
  3692. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  3693. expressions containing the following constants:
  3694. @table @option
  3695. @item x
  3696. @item y
  3697. The computed values for @var{x} and @var{y}. They are evaluated for
  3698. each new frame.
  3699. @item in_w
  3700. @item in_h
  3701. The input width and height.
  3702. @item iw
  3703. @item ih
  3704. These are the same as @var{in_w} and @var{in_h}.
  3705. @item out_w
  3706. @item out_h
  3707. The output (cropped) width and height.
  3708. @item ow
  3709. @item oh
  3710. These are the same as @var{out_w} and @var{out_h}.
  3711. @item a
  3712. same as @var{iw} / @var{ih}
  3713. @item sar
  3714. input sample aspect ratio
  3715. @item dar
  3716. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  3717. @item hsub
  3718. @item vsub
  3719. horizontal and vertical chroma subsample values. For example for the
  3720. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  3721. @item n
  3722. The number of the input frame, starting from 0.
  3723. @item pos
  3724. the position in the file of the input frame, NAN if unknown
  3725. @item t
  3726. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  3727. @end table
  3728. The expression for @var{out_w} may depend on the value of @var{out_h},
  3729. and the expression for @var{out_h} may depend on @var{out_w}, but they
  3730. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  3731. evaluated after @var{out_w} and @var{out_h}.
  3732. The @var{x} and @var{y} parameters specify the expressions for the
  3733. position of the top-left corner of the output (non-cropped) area. They
  3734. are evaluated for each frame. If the evaluated value is not valid, it
  3735. is approximated to the nearest valid value.
  3736. The expression for @var{x} may depend on @var{y}, and the expression
  3737. for @var{y} may depend on @var{x}.
  3738. @subsection Examples
  3739. @itemize
  3740. @item
  3741. Crop area with size 100x100 at position (12,34).
  3742. @example
  3743. crop=100:100:12:34
  3744. @end example
  3745. Using named options, the example above becomes:
  3746. @example
  3747. crop=w=100:h=100:x=12:y=34
  3748. @end example
  3749. @item
  3750. Crop the central input area with size 100x100:
  3751. @example
  3752. crop=100:100
  3753. @end example
  3754. @item
  3755. Crop the central input area with size 2/3 of the input video:
  3756. @example
  3757. crop=2/3*in_w:2/3*in_h
  3758. @end example
  3759. @item
  3760. Crop the input video central square:
  3761. @example
  3762. crop=out_w=in_h
  3763. crop=in_h
  3764. @end example
  3765. @item
  3766. Delimit the rectangle with the top-left corner placed at position
  3767. 100:100 and the right-bottom corner corresponding to the right-bottom
  3768. corner of the input image.
  3769. @example
  3770. crop=in_w-100:in_h-100:100:100
  3771. @end example
  3772. @item
  3773. Crop 10 pixels from the left and right borders, and 20 pixels from
  3774. the top and bottom borders
  3775. @example
  3776. crop=in_w-2*10:in_h-2*20
  3777. @end example
  3778. @item
  3779. Keep only the bottom right quarter of the input image:
  3780. @example
  3781. crop=in_w/2:in_h/2:in_w/2:in_h/2
  3782. @end example
  3783. @item
  3784. Crop height for getting Greek harmony:
  3785. @example
  3786. crop=in_w:1/PHI*in_w
  3787. @end example
  3788. @item
  3789. Apply trembling effect:
  3790. @example
  3791. 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)
  3792. @end example
  3793. @item
  3794. Apply erratic camera effect depending on timestamp:
  3795. @example
  3796. 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)"
  3797. @end example
  3798. @item
  3799. Set x depending on the value of y:
  3800. @example
  3801. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  3802. @end example
  3803. @end itemize
  3804. @subsection Commands
  3805. This filter supports the following commands:
  3806. @table @option
  3807. @item w, out_w
  3808. @item h, out_h
  3809. @item x
  3810. @item y
  3811. Set width/height of the output video and the horizontal/vertical position
  3812. in the input video.
  3813. The command accepts the same syntax of the corresponding option.
  3814. If the specified expression is not valid, it is kept at its current
  3815. value.
  3816. @end table
  3817. @section cropdetect
  3818. Auto-detect the crop size.
  3819. It calculates the necessary cropping parameters and prints the
  3820. recommended parameters via the logging system. The detected dimensions
  3821. correspond to the non-black area of the input video.
  3822. It accepts the following parameters:
  3823. @table @option
  3824. @item limit
  3825. Set higher black value threshold, which can be optionally specified
  3826. from nothing (0) to everything (255 for 8bit based formats). An intensity
  3827. value greater to the set value is considered non-black. It defaults to 24.
  3828. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  3829. on the bitdepth of the pixel format.
  3830. @item round
  3831. The value which the width/height should be divisible by. It defaults to
  3832. 16. The offset is automatically adjusted to center the video. Use 2 to
  3833. get only even dimensions (needed for 4:2:2 video). 16 is best when
  3834. encoding to most video codecs.
  3835. @item reset_count, reset
  3836. Set the counter that determines after how many frames cropdetect will
  3837. reset the previously detected largest video area and start over to
  3838. detect the current optimal crop area. Default value is 0.
  3839. This can be useful when channel logos distort the video area. 0
  3840. indicates 'never reset', and returns the largest area encountered during
  3841. playback.
  3842. @end table
  3843. @anchor{curves}
  3844. @section curves
  3845. Apply color adjustments using curves.
  3846. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  3847. component (red, green and blue) has its values defined by @var{N} key points
  3848. tied from each other using a smooth curve. The x-axis represents the pixel
  3849. values from the input frame, and the y-axis the new pixel values to be set for
  3850. the output frame.
  3851. By default, a component curve is defined by the two points @var{(0;0)} and
  3852. @var{(1;1)}. This creates a straight line where each original pixel value is
  3853. "adjusted" to its own value, which means no change to the image.
  3854. The filter allows you to redefine these two points and add some more. A new
  3855. curve (using a natural cubic spline interpolation) will be define to pass
  3856. smoothly through all these new coordinates. The new defined points needs to be
  3857. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  3858. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  3859. the vector spaces, the values will be clipped accordingly.
  3860. If there is no key point defined in @code{x=0}, the filter will automatically
  3861. insert a @var{(0;0)} point. In the same way, if there is no key point defined
  3862. in @code{x=1}, the filter will automatically insert a @var{(1;1)} point.
  3863. The filter accepts the following options:
  3864. @table @option
  3865. @item preset
  3866. Select one of the available color presets. This option can be used in addition
  3867. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  3868. options takes priority on the preset values.
  3869. Available presets are:
  3870. @table @samp
  3871. @item none
  3872. @item color_negative
  3873. @item cross_process
  3874. @item darker
  3875. @item increase_contrast
  3876. @item lighter
  3877. @item linear_contrast
  3878. @item medium_contrast
  3879. @item negative
  3880. @item strong_contrast
  3881. @item vintage
  3882. @end table
  3883. Default is @code{none}.
  3884. @item master, m
  3885. Set the master key points. These points will define a second pass mapping. It
  3886. is sometimes called a "luminance" or "value" mapping. It can be used with
  3887. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  3888. post-processing LUT.
  3889. @item red, r
  3890. Set the key points for the red component.
  3891. @item green, g
  3892. Set the key points for the green component.
  3893. @item blue, b
  3894. Set the key points for the blue component.
  3895. @item all
  3896. Set the key points for all components (not including master).
  3897. Can be used in addition to the other key points component
  3898. options. In this case, the unset component(s) will fallback on this
  3899. @option{all} setting.
  3900. @item psfile
  3901. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  3902. @end table
  3903. To avoid some filtergraph syntax conflicts, each key points list need to be
  3904. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  3905. @subsection Examples
  3906. @itemize
  3907. @item
  3908. Increase slightly the middle level of blue:
  3909. @example
  3910. curves=blue='0.5/0.58'
  3911. @end example
  3912. @item
  3913. Vintage effect:
  3914. @example
  3915. curves=r='0/0.11 .42/.51 1/0.95':g='0.50/0.48':b='0/0.22 .49/.44 1/0.8'
  3916. @end example
  3917. Here we obtain the following coordinates for each components:
  3918. @table @var
  3919. @item red
  3920. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  3921. @item green
  3922. @code{(0;0) (0.50;0.48) (1;1)}
  3923. @item blue
  3924. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  3925. @end table
  3926. @item
  3927. The previous example can also be achieved with the associated built-in preset:
  3928. @example
  3929. curves=preset=vintage
  3930. @end example
  3931. @item
  3932. Or simply:
  3933. @example
  3934. curves=vintage
  3935. @end example
  3936. @item
  3937. Use a Photoshop preset and redefine the points of the green component:
  3938. @example
  3939. curves=psfile='MyCurvesPresets/purple.acv':green='0.45/0.53'
  3940. @end example
  3941. @end itemize
  3942. @section dctdnoiz
  3943. Denoise frames using 2D DCT (frequency domain filtering).
  3944. This filter is not designed for real time.
  3945. The filter accepts the following options:
  3946. @table @option
  3947. @item sigma, s
  3948. Set the noise sigma constant.
  3949. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  3950. coefficient (absolute value) below this threshold with be dropped.
  3951. If you need a more advanced filtering, see @option{expr}.
  3952. Default is @code{0}.
  3953. @item overlap
  3954. Set number overlapping pixels for each block. Since the filter can be slow, you
  3955. may want to reduce this value, at the cost of a less effective filter and the
  3956. risk of various artefacts.
  3957. If the overlapping value doesn't permit processing the whole input width or
  3958. height, a warning will be displayed and according borders won't be denoised.
  3959. Default value is @var{blocksize}-1, which is the best possible setting.
  3960. @item expr, e
  3961. Set the coefficient factor expression.
  3962. For each coefficient of a DCT block, this expression will be evaluated as a
  3963. multiplier value for the coefficient.
  3964. If this is option is set, the @option{sigma} option will be ignored.
  3965. The absolute value of the coefficient can be accessed through the @var{c}
  3966. variable.
  3967. @item n
  3968. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  3969. @var{blocksize}, which is the width and height of the processed blocks.
  3970. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  3971. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  3972. on the speed processing. Also, a larger block size does not necessarily means a
  3973. better de-noising.
  3974. @end table
  3975. @subsection Examples
  3976. Apply a denoise with a @option{sigma} of @code{4.5}:
  3977. @example
  3978. dctdnoiz=4.5
  3979. @end example
  3980. The same operation can be achieved using the expression system:
  3981. @example
  3982. dctdnoiz=e='gte(c, 4.5*3)'
  3983. @end example
  3984. Violent denoise using a block size of @code{16x16}:
  3985. @example
  3986. dctdnoiz=15:n=4
  3987. @end example
  3988. @section deband
  3989. Remove banding artifacts from input video.
  3990. It works by replacing banded pixels with average value of referenced pixels.
  3991. The filter accepts the following options:
  3992. @table @option
  3993. @item 1thr
  3994. @item 2thr
  3995. @item 3thr
  3996. @item 4thr
  3997. Set banding detection threshold for each plane. Default is 0.02.
  3998. Valid range is 0.00003 to 0.5.
  3999. If difference between current pixel and reference pixel is less than threshold,
  4000. it will be considered as banded.
  4001. @item range, r
  4002. Banding detection range in pixels. Default is 16. If positive, random number
  4003. in range 0 to set value will be used. If negative, exact absolute value
  4004. will be used.
  4005. The range defines square of four pixels around current pixel.
  4006. @item direction, d
  4007. Set direction in radians from which four pixel will be compared. If positive,
  4008. random direction from 0 to set direction will be picked. If negative, exact of
  4009. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  4010. will pick only pixels on same row and -PI/2 will pick only pixels on same
  4011. column.
  4012. @item blur
  4013. If enabled, current pixel is compared with average value of all four
  4014. surrounding pixels. The default is enabled. If disabled current pixel is
  4015. compared with all four surrounding pixels. The pixel is considered banded
  4016. if only all four differences with surrounding pixels are less than threshold.
  4017. @end table
  4018. @anchor{decimate}
  4019. @section decimate
  4020. Drop duplicated frames at regular intervals.
  4021. The filter accepts the following options:
  4022. @table @option
  4023. @item cycle
  4024. Set the number of frames from which one will be dropped. Setting this to
  4025. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  4026. Default is @code{5}.
  4027. @item dupthresh
  4028. Set the threshold for duplicate detection. If the difference metric for a frame
  4029. is less than or equal to this value, then it is declared as duplicate. Default
  4030. is @code{1.1}
  4031. @item scthresh
  4032. Set scene change threshold. Default is @code{15}.
  4033. @item blockx
  4034. @item blocky
  4035. Set the size of the x and y-axis blocks used during metric calculations.
  4036. Larger blocks give better noise suppression, but also give worse detection of
  4037. small movements. Must be a power of two. Default is @code{32}.
  4038. @item ppsrc
  4039. Mark main input as a pre-processed input and activate clean source input
  4040. stream. This allows the input to be pre-processed with various filters to help
  4041. the metrics calculation while keeping the frame selection lossless. When set to
  4042. @code{1}, the first stream is for the pre-processed input, and the second
  4043. stream is the clean source from where the kept frames are chosen. Default is
  4044. @code{0}.
  4045. @item chroma
  4046. Set whether or not chroma is considered in the metric calculations. Default is
  4047. @code{1}.
  4048. @end table
  4049. @section deflate
  4050. Apply deflate effect to the video.
  4051. This filter replaces the pixel by the local(3x3) average by taking into account
  4052. only values lower than the pixel.
  4053. It accepts the following options:
  4054. @table @option
  4055. @item threshold0
  4056. @item threshold1
  4057. @item threshold2
  4058. @item threshold3
  4059. Limit the maximum change for each plane, default is 65535.
  4060. If 0, plane will remain unchanged.
  4061. @end table
  4062. @section dejudder
  4063. Remove judder produced by partially interlaced telecined content.
  4064. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  4065. source was partially telecined content then the output of @code{pullup,dejudder}
  4066. will have a variable frame rate. May change the recorded frame rate of the
  4067. container. Aside from that change, this filter will not affect constant frame
  4068. rate video.
  4069. The option available in this filter is:
  4070. @table @option
  4071. @item cycle
  4072. Specify the length of the window over which the judder repeats.
  4073. Accepts any integer greater than 1. Useful values are:
  4074. @table @samp
  4075. @item 4
  4076. If the original was telecined from 24 to 30 fps (Film to NTSC).
  4077. @item 5
  4078. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  4079. @item 20
  4080. If a mixture of the two.
  4081. @end table
  4082. The default is @samp{4}.
  4083. @end table
  4084. @section delogo
  4085. Suppress a TV station logo by a simple interpolation of the surrounding
  4086. pixels. Just set a rectangle covering the logo and watch it disappear
  4087. (and sometimes something even uglier appear - your mileage may vary).
  4088. It accepts the following parameters:
  4089. @table @option
  4090. @item x
  4091. @item y
  4092. Specify the top left corner coordinates of the logo. They must be
  4093. specified.
  4094. @item w
  4095. @item h
  4096. Specify the width and height of the logo to clear. They must be
  4097. specified.
  4098. @item band, t
  4099. Specify the thickness of the fuzzy edge of the rectangle (added to
  4100. @var{w} and @var{h}). The default value is 1. This option is
  4101. deprecated, setting higher values should no longer be necessary and
  4102. is not recommended.
  4103. @item show
  4104. When set to 1, a green rectangle is drawn on the screen to simplify
  4105. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  4106. The default value is 0.
  4107. The rectangle is drawn on the outermost pixels which will be (partly)
  4108. replaced with interpolated values. The values of the next pixels
  4109. immediately outside this rectangle in each direction will be used to
  4110. compute the interpolated pixel values inside the rectangle.
  4111. @end table
  4112. @subsection Examples
  4113. @itemize
  4114. @item
  4115. Set a rectangle covering the area with top left corner coordinates 0,0
  4116. and size 100x77, and a band of size 10:
  4117. @example
  4118. delogo=x=0:y=0:w=100:h=77:band=10
  4119. @end example
  4120. @end itemize
  4121. @section deshake
  4122. Attempt to fix small changes in horizontal and/or vertical shift. This
  4123. filter helps remove camera shake from hand-holding a camera, bumping a
  4124. tripod, moving on a vehicle, etc.
  4125. The filter accepts the following options:
  4126. @table @option
  4127. @item x
  4128. @item y
  4129. @item w
  4130. @item h
  4131. Specify a rectangular area where to limit the search for motion
  4132. vectors.
  4133. If desired the search for motion vectors can be limited to a
  4134. rectangular area of the frame defined by its top left corner, width
  4135. and height. These parameters have the same meaning as the drawbox
  4136. filter which can be used to visualise the position of the bounding
  4137. box.
  4138. This is useful when simultaneous movement of subjects within the frame
  4139. might be confused for camera motion by the motion vector search.
  4140. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  4141. then the full frame is used. This allows later options to be set
  4142. without specifying the bounding box for the motion vector search.
  4143. Default - search the whole frame.
  4144. @item rx
  4145. @item ry
  4146. Specify the maximum extent of movement in x and y directions in the
  4147. range 0-64 pixels. Default 16.
  4148. @item edge
  4149. Specify how to generate pixels to fill blanks at the edge of the
  4150. frame. Available values are:
  4151. @table @samp
  4152. @item blank, 0
  4153. Fill zeroes at blank locations
  4154. @item original, 1
  4155. Original image at blank locations
  4156. @item clamp, 2
  4157. Extruded edge value at blank locations
  4158. @item mirror, 3
  4159. Mirrored edge at blank locations
  4160. @end table
  4161. Default value is @samp{mirror}.
  4162. @item blocksize
  4163. Specify the blocksize to use for motion search. Range 4-128 pixels,
  4164. default 8.
  4165. @item contrast
  4166. Specify the contrast threshold for blocks. Only blocks with more than
  4167. the specified contrast (difference between darkest and lightest
  4168. pixels) will be considered. Range 1-255, default 125.
  4169. @item search
  4170. Specify the search strategy. Available values are:
  4171. @table @samp
  4172. @item exhaustive, 0
  4173. Set exhaustive search
  4174. @item less, 1
  4175. Set less exhaustive search.
  4176. @end table
  4177. Default value is @samp{exhaustive}.
  4178. @item filename
  4179. If set then a detailed log of the motion search is written to the
  4180. specified file.
  4181. @item opencl
  4182. If set to 1, specify using OpenCL capabilities, only available if
  4183. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  4184. @end table
  4185. @section detelecine
  4186. Apply an exact inverse of the telecine operation. It requires a predefined
  4187. pattern specified using the pattern option which must be the same as that passed
  4188. to the telecine filter.
  4189. This filter accepts the following options:
  4190. @table @option
  4191. @item first_field
  4192. @table @samp
  4193. @item top, t
  4194. top field first
  4195. @item bottom, b
  4196. bottom field first
  4197. The default value is @code{top}.
  4198. @end table
  4199. @item pattern
  4200. A string of numbers representing the pulldown pattern you wish to apply.
  4201. The default value is @code{23}.
  4202. @item start_frame
  4203. A number representing position of the first frame with respect to the telecine
  4204. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  4205. @end table
  4206. @section dilation
  4207. Apply dilation effect to the video.
  4208. This filter replaces the pixel by the local(3x3) maximum.
  4209. It accepts the following options:
  4210. @table @option
  4211. @item threshold0
  4212. @item threshold1
  4213. @item threshold2
  4214. @item threshold3
  4215. Limit the maximum change for each plane, default is 65535.
  4216. If 0, plane will remain unchanged.
  4217. @item coordinates
  4218. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  4219. pixels are used.
  4220. Flags to local 3x3 coordinates maps like this:
  4221. 1 2 3
  4222. 4 5
  4223. 6 7 8
  4224. @end table
  4225. @section displace
  4226. Displace pixels as indicated by second and third input stream.
  4227. It takes three input streams and outputs one stream, the first input is the
  4228. source, and second and third input are displacement maps.
  4229. The second input specifies how much to displace pixels along the
  4230. x-axis, while the third input specifies how much to displace pixels
  4231. along the y-axis.
  4232. If one of displacement map streams terminates, last frame from that
  4233. displacement map will be used.
  4234. Note that once generated, displacements maps can be reused over and over again.
  4235. A description of the accepted options follows.
  4236. @table @option
  4237. @item edge
  4238. Set displace behavior for pixels that are out of range.
  4239. Available values are:
  4240. @table @samp
  4241. @item blank
  4242. Missing pixels are replaced by black pixels.
  4243. @item smear
  4244. Adjacent pixels will spread out to replace missing pixels.
  4245. @item wrap
  4246. Out of range pixels are wrapped so they point to pixels of other side.
  4247. @end table
  4248. Default is @samp{smear}.
  4249. @end table
  4250. @subsection Examples
  4251. @itemize
  4252. @item
  4253. Add ripple effect to rgb input of video size hd720:
  4254. @example
  4255. 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
  4256. @end example
  4257. @item
  4258. Add wave effect to rgb input of video size hd720:
  4259. @example
  4260. 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
  4261. @end example
  4262. @end itemize
  4263. @section drawbox
  4264. Draw a colored box on the input image.
  4265. It accepts the following parameters:
  4266. @table @option
  4267. @item x
  4268. @item y
  4269. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  4270. @item width, w
  4271. @item height, h
  4272. The expressions which specify the width and height of the box; if 0 they are interpreted as
  4273. the input width and height. It defaults to 0.
  4274. @item color, c
  4275. Specify the color of the box to write. For the general syntax of this option,
  4276. check the "Color" section in the ffmpeg-utils manual. If the special
  4277. value @code{invert} is used, the box edge color is the same as the
  4278. video with inverted luma.
  4279. @item thickness, t
  4280. The expression which sets the thickness of the box edge. Default value is @code{3}.
  4281. See below for the list of accepted constants.
  4282. @end table
  4283. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  4284. following constants:
  4285. @table @option
  4286. @item dar
  4287. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  4288. @item hsub
  4289. @item vsub
  4290. horizontal and vertical chroma subsample values. For example for the
  4291. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4292. @item in_h, ih
  4293. @item in_w, iw
  4294. The input width and height.
  4295. @item sar
  4296. The input sample aspect ratio.
  4297. @item x
  4298. @item y
  4299. The x and y offset coordinates where the box is drawn.
  4300. @item w
  4301. @item h
  4302. The width and height of the drawn box.
  4303. @item t
  4304. The thickness of the drawn box.
  4305. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  4306. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  4307. @end table
  4308. @subsection Examples
  4309. @itemize
  4310. @item
  4311. Draw a black box around the edge of the input image:
  4312. @example
  4313. drawbox
  4314. @end example
  4315. @item
  4316. Draw a box with color red and an opacity of 50%:
  4317. @example
  4318. drawbox=10:20:200:60:red@@0.5
  4319. @end example
  4320. The previous example can be specified as:
  4321. @example
  4322. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  4323. @end example
  4324. @item
  4325. Fill the box with pink color:
  4326. @example
  4327. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  4328. @end example
  4329. @item
  4330. Draw a 2-pixel red 2.40:1 mask:
  4331. @example
  4332. 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
  4333. @end example
  4334. @end itemize
  4335. @section drawgraph, adrawgraph
  4336. Draw a graph using input video or audio metadata.
  4337. It accepts the following parameters:
  4338. @table @option
  4339. @item m1
  4340. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  4341. @item fg1
  4342. Set 1st foreground color expression.
  4343. @item m2
  4344. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  4345. @item fg2
  4346. Set 2nd foreground color expression.
  4347. @item m3
  4348. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  4349. @item fg3
  4350. Set 3rd foreground color expression.
  4351. @item m4
  4352. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  4353. @item fg4
  4354. Set 4th foreground color expression.
  4355. @item min
  4356. Set minimal value of metadata value.
  4357. @item max
  4358. Set maximal value of metadata value.
  4359. @item bg
  4360. Set graph background color. Default is white.
  4361. @item mode
  4362. Set graph mode.
  4363. Available values for mode is:
  4364. @table @samp
  4365. @item bar
  4366. @item dot
  4367. @item line
  4368. @end table
  4369. Default is @code{line}.
  4370. @item slide
  4371. Set slide mode.
  4372. Available values for slide is:
  4373. @table @samp
  4374. @item frame
  4375. Draw new frame when right border is reached.
  4376. @item replace
  4377. Replace old columns with new ones.
  4378. @item scroll
  4379. Scroll from right to left.
  4380. @item rscroll
  4381. Scroll from left to right.
  4382. @end table
  4383. Default is @code{frame}.
  4384. @item size
  4385. Set size of graph video. For the syntax of this option, check the
  4386. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  4387. The default value is @code{900x256}.
  4388. The foreground color expressions can use the following variables:
  4389. @table @option
  4390. @item MIN
  4391. Minimal value of metadata value.
  4392. @item MAX
  4393. Maximal value of metadata value.
  4394. @item VAL
  4395. Current metadata key value.
  4396. @end table
  4397. The color is defined as 0xAABBGGRR.
  4398. @end table
  4399. Example using metadata from @ref{signalstats} filter:
  4400. @example
  4401. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  4402. @end example
  4403. Example using metadata from @ref{ebur128} filter:
  4404. @example
  4405. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  4406. @end example
  4407. @section drawgrid
  4408. Draw a grid on the input image.
  4409. It accepts the following parameters:
  4410. @table @option
  4411. @item x
  4412. @item y
  4413. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  4414. @item width, w
  4415. @item height, h
  4416. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  4417. input width and height, respectively, minus @code{thickness}, so image gets
  4418. framed. Default to 0.
  4419. @item color, c
  4420. Specify the color of the grid. For the general syntax of this option,
  4421. check the "Color" section in the ffmpeg-utils manual. If the special
  4422. value @code{invert} is used, the grid color is the same as the
  4423. video with inverted luma.
  4424. @item thickness, t
  4425. The expression which sets the thickness of the grid line. Default value is @code{1}.
  4426. See below for the list of accepted constants.
  4427. @end table
  4428. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  4429. following constants:
  4430. @table @option
  4431. @item dar
  4432. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  4433. @item hsub
  4434. @item vsub
  4435. horizontal and vertical chroma subsample values. For example for the
  4436. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4437. @item in_h, ih
  4438. @item in_w, iw
  4439. The input grid cell width and height.
  4440. @item sar
  4441. The input sample aspect ratio.
  4442. @item x
  4443. @item y
  4444. The x and y coordinates of some point of grid intersection (meant to configure offset).
  4445. @item w
  4446. @item h
  4447. The width and height of the drawn cell.
  4448. @item t
  4449. The thickness of the drawn cell.
  4450. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  4451. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  4452. @end table
  4453. @subsection Examples
  4454. @itemize
  4455. @item
  4456. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  4457. @example
  4458. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  4459. @end example
  4460. @item
  4461. Draw a white 3x3 grid with an opacity of 50%:
  4462. @example
  4463. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  4464. @end example
  4465. @end itemize
  4466. @anchor{drawtext}
  4467. @section drawtext
  4468. Draw a text string or text from a specified file on top of a video, using the
  4469. libfreetype library.
  4470. To enable compilation of this filter, you need to configure FFmpeg with
  4471. @code{--enable-libfreetype}.
  4472. To enable default font fallback and the @var{font} option you need to
  4473. configure FFmpeg with @code{--enable-libfontconfig}.
  4474. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  4475. @code{--enable-libfribidi}.
  4476. @subsection Syntax
  4477. It accepts the following parameters:
  4478. @table @option
  4479. @item box
  4480. Used to draw a box around text using the background color.
  4481. The value must be either 1 (enable) or 0 (disable).
  4482. The default value of @var{box} is 0.
  4483. @item boxborderw
  4484. Set the width of the border to be drawn around the box using @var{boxcolor}.
  4485. The default value of @var{boxborderw} is 0.
  4486. @item boxcolor
  4487. The color to be used for drawing box around text. For the syntax of this
  4488. option, check the "Color" section in the ffmpeg-utils manual.
  4489. The default value of @var{boxcolor} is "white".
  4490. @item borderw
  4491. Set the width of the border to be drawn around the text using @var{bordercolor}.
  4492. The default value of @var{borderw} is 0.
  4493. @item bordercolor
  4494. Set the color to be used for drawing border around text. For the syntax of this
  4495. option, check the "Color" section in the ffmpeg-utils manual.
  4496. The default value of @var{bordercolor} is "black".
  4497. @item expansion
  4498. Select how the @var{text} is expanded. Can be either @code{none},
  4499. @code{strftime} (deprecated) or
  4500. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  4501. below for details.
  4502. @item fix_bounds
  4503. If true, check and fix text coords to avoid clipping.
  4504. @item fontcolor
  4505. The color to be used for drawing fonts. For the syntax of this option, check
  4506. the "Color" section in the ffmpeg-utils manual.
  4507. The default value of @var{fontcolor} is "black".
  4508. @item fontcolor_expr
  4509. String which is expanded the same way as @var{text} to obtain dynamic
  4510. @var{fontcolor} value. By default this option has empty value and is not
  4511. processed. When this option is set, it overrides @var{fontcolor} option.
  4512. @item font
  4513. The font family to be used for drawing text. By default Sans.
  4514. @item fontfile
  4515. The font file to be used for drawing text. The path must be included.
  4516. This parameter is mandatory if the fontconfig support is disabled.
  4517. @item draw
  4518. This option does not exist, please see the timeline system
  4519. @item alpha
  4520. Draw the text applying alpha blending. The value can
  4521. be either a number between 0.0 and 1.0
  4522. The expression accepts the same variables @var{x, y} do.
  4523. The default value is 1.
  4524. Please see fontcolor_expr
  4525. @item fontsize
  4526. The font size to be used for drawing text.
  4527. The default value of @var{fontsize} is 16.
  4528. @item text_shaping
  4529. If set to 1, attempt to shape the text (for example, reverse the order of
  4530. right-to-left text and join Arabic characters) before drawing it.
  4531. Otherwise, just draw the text exactly as given.
  4532. By default 1 (if supported).
  4533. @item ft_load_flags
  4534. The flags to be used for loading the fonts.
  4535. The flags map the corresponding flags supported by libfreetype, and are
  4536. a combination of the following values:
  4537. @table @var
  4538. @item default
  4539. @item no_scale
  4540. @item no_hinting
  4541. @item render
  4542. @item no_bitmap
  4543. @item vertical_layout
  4544. @item force_autohint
  4545. @item crop_bitmap
  4546. @item pedantic
  4547. @item ignore_global_advance_width
  4548. @item no_recurse
  4549. @item ignore_transform
  4550. @item monochrome
  4551. @item linear_design
  4552. @item no_autohint
  4553. @end table
  4554. Default value is "default".
  4555. For more information consult the documentation for the FT_LOAD_*
  4556. libfreetype flags.
  4557. @item shadowcolor
  4558. The color to be used for drawing a shadow behind the drawn text. For the
  4559. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  4560. The default value of @var{shadowcolor} is "black".
  4561. @item shadowx
  4562. @item shadowy
  4563. The x and y offsets for the text shadow position with respect to the
  4564. position of the text. They can be either positive or negative
  4565. values. The default value for both is "0".
  4566. @item start_number
  4567. The starting frame number for the n/frame_num variable. The default value
  4568. is "0".
  4569. @item tabsize
  4570. The size in number of spaces to use for rendering the tab.
  4571. Default value is 4.
  4572. @item timecode
  4573. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  4574. format. It can be used with or without text parameter. @var{timecode_rate}
  4575. option must be specified.
  4576. @item timecode_rate, rate, r
  4577. Set the timecode frame rate (timecode only).
  4578. @item text
  4579. The text string to be drawn. The text must be a sequence of UTF-8
  4580. encoded characters.
  4581. This parameter is mandatory if no file is specified with the parameter
  4582. @var{textfile}.
  4583. @item textfile
  4584. A text file containing text to be drawn. The text must be a sequence
  4585. of UTF-8 encoded characters.
  4586. This parameter is mandatory if no text string is specified with the
  4587. parameter @var{text}.
  4588. If both @var{text} and @var{textfile} are specified, an error is thrown.
  4589. @item reload
  4590. If set to 1, the @var{textfile} will be reloaded before each frame.
  4591. Be sure to update it atomically, or it may be read partially, or even fail.
  4592. @item x
  4593. @item y
  4594. The expressions which specify the offsets where text will be drawn
  4595. within the video frame. They are relative to the top/left border of the
  4596. output image.
  4597. The default value of @var{x} and @var{y} is "0".
  4598. See below for the list of accepted constants and functions.
  4599. @end table
  4600. The parameters for @var{x} and @var{y} are expressions containing the
  4601. following constants and functions:
  4602. @table @option
  4603. @item dar
  4604. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  4605. @item hsub
  4606. @item vsub
  4607. horizontal and vertical chroma subsample values. For example for the
  4608. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4609. @item line_h, lh
  4610. the height of each text line
  4611. @item main_h, h, H
  4612. the input height
  4613. @item main_w, w, W
  4614. the input width
  4615. @item max_glyph_a, ascent
  4616. the maximum distance from the baseline to the highest/upper grid
  4617. coordinate used to place a glyph outline point, for all the rendered
  4618. glyphs.
  4619. It is a positive value, due to the grid's orientation with the Y axis
  4620. upwards.
  4621. @item max_glyph_d, descent
  4622. the maximum distance from the baseline to the lowest grid coordinate
  4623. used to place a glyph outline point, for all the rendered glyphs.
  4624. This is a negative value, due to the grid's orientation, with the Y axis
  4625. upwards.
  4626. @item max_glyph_h
  4627. maximum glyph height, that is the maximum height for all the glyphs
  4628. contained in the rendered text, it is equivalent to @var{ascent} -
  4629. @var{descent}.
  4630. @item max_glyph_w
  4631. maximum glyph width, that is the maximum width for all the glyphs
  4632. contained in the rendered text
  4633. @item n
  4634. the number of input frame, starting from 0
  4635. @item rand(min, max)
  4636. return a random number included between @var{min} and @var{max}
  4637. @item sar
  4638. The input sample aspect ratio.
  4639. @item t
  4640. timestamp expressed in seconds, NAN if the input timestamp is unknown
  4641. @item text_h, th
  4642. the height of the rendered text
  4643. @item text_w, tw
  4644. the width of the rendered text
  4645. @item x
  4646. @item y
  4647. the x and y offset coordinates where the text is drawn.
  4648. These parameters allow the @var{x} and @var{y} expressions to refer
  4649. each other, so you can for example specify @code{y=x/dar}.
  4650. @end table
  4651. @anchor{drawtext_expansion}
  4652. @subsection Text expansion
  4653. If @option{expansion} is set to @code{strftime},
  4654. the filter recognizes strftime() sequences in the provided text and
  4655. expands them accordingly. Check the documentation of strftime(). This
  4656. feature is deprecated.
  4657. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  4658. If @option{expansion} is set to @code{normal} (which is the default),
  4659. the following expansion mechanism is used.
  4660. The backslash character @samp{\}, followed by any character, always expands to
  4661. the second character.
  4662. Sequence of the form @code{%@{...@}} are expanded. The text between the
  4663. braces is a function name, possibly followed by arguments separated by ':'.
  4664. If the arguments contain special characters or delimiters (':' or '@}'),
  4665. they should be escaped.
  4666. Note that they probably must also be escaped as the value for the
  4667. @option{text} option in the filter argument string and as the filter
  4668. argument in the filtergraph description, and possibly also for the shell,
  4669. that makes up to four levels of escaping; using a text file avoids these
  4670. problems.
  4671. The following functions are available:
  4672. @table @command
  4673. @item expr, e
  4674. The expression evaluation result.
  4675. It must take one argument specifying the expression to be evaluated,
  4676. which accepts the same constants and functions as the @var{x} and
  4677. @var{y} values. Note that not all constants should be used, for
  4678. example the text size is not known when evaluating the expression, so
  4679. the constants @var{text_w} and @var{text_h} will have an undefined
  4680. value.
  4681. @item expr_int_format, eif
  4682. Evaluate the expression's value and output as formatted integer.
  4683. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  4684. The second argument specifies the output format. Allowed values are @samp{x},
  4685. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  4686. @code{printf} function.
  4687. The third parameter is optional and sets the number of positions taken by the output.
  4688. It can be used to add padding with zeros from the left.
  4689. @item gmtime
  4690. The time at which the filter is running, expressed in UTC.
  4691. It can accept an argument: a strftime() format string.
  4692. @item localtime
  4693. The time at which the filter is running, expressed in the local time zone.
  4694. It can accept an argument: a strftime() format string.
  4695. @item metadata
  4696. Frame metadata. It must take one argument specifying metadata key.
  4697. @item n, frame_num
  4698. The frame number, starting from 0.
  4699. @item pict_type
  4700. A 1 character description of the current picture type.
  4701. @item pts
  4702. The timestamp of the current frame.
  4703. It can take up to three arguments.
  4704. The first argument is the format of the timestamp; it defaults to @code{flt}
  4705. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  4706. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  4707. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  4708. @code{localtime} stands for the timestamp of the frame formatted as
  4709. local time zone time.
  4710. The second argument is an offset added to the timestamp.
  4711. If the format is set to @code{localtime} or @code{gmtime},
  4712. a third argument may be supplied: a strftime() format string.
  4713. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  4714. @end table
  4715. @subsection Examples
  4716. @itemize
  4717. @item
  4718. Draw "Test Text" with font FreeSerif, using the default values for the
  4719. optional parameters.
  4720. @example
  4721. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  4722. @end example
  4723. @item
  4724. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  4725. and y=50 (counting from the top-left corner of the screen), text is
  4726. yellow with a red box around it. Both the text and the box have an
  4727. opacity of 20%.
  4728. @example
  4729. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  4730. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  4731. @end example
  4732. Note that the double quotes are not necessary if spaces are not used
  4733. within the parameter list.
  4734. @item
  4735. Show the text at the center of the video frame:
  4736. @example
  4737. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  4738. @end example
  4739. @item
  4740. Show a text line sliding from right to left in the last row of the video
  4741. frame. The file @file{LONG_LINE} is assumed to contain a single line
  4742. with no newlines.
  4743. @example
  4744. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  4745. @end example
  4746. @item
  4747. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  4748. @example
  4749. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  4750. @end example
  4751. @item
  4752. Draw a single green letter "g", at the center of the input video.
  4753. The glyph baseline is placed at half screen height.
  4754. @example
  4755. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  4756. @end example
  4757. @item
  4758. Show text for 1 second every 3 seconds:
  4759. @example
  4760. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  4761. @end example
  4762. @item
  4763. Use fontconfig to set the font. Note that the colons need to be escaped.
  4764. @example
  4765. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  4766. @end example
  4767. @item
  4768. Print the date of a real-time encoding (see strftime(3)):
  4769. @example
  4770. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  4771. @end example
  4772. @item
  4773. Show text fading in and out (appearing/disappearing):
  4774. @example
  4775. #!/bin/sh
  4776. DS=1.0 # display start
  4777. DE=10.0 # display end
  4778. FID=1.5 # fade in duration
  4779. FOD=5 # fade out duration
  4780. 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 @}"
  4781. @end example
  4782. @end itemize
  4783. For more information about libfreetype, check:
  4784. @url{http://www.freetype.org/}.
  4785. For more information about fontconfig, check:
  4786. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  4787. For more information about libfribidi, check:
  4788. @url{http://fribidi.org/}.
  4789. @section edgedetect
  4790. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  4791. The filter accepts the following options:
  4792. @table @option
  4793. @item low
  4794. @item high
  4795. Set low and high threshold values used by the Canny thresholding
  4796. algorithm.
  4797. The high threshold selects the "strong" edge pixels, which are then
  4798. connected through 8-connectivity with the "weak" edge pixels selected
  4799. by the low threshold.
  4800. @var{low} and @var{high} threshold values must be chosen in the range
  4801. [0,1], and @var{low} should be lesser or equal to @var{high}.
  4802. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  4803. is @code{50/255}.
  4804. @item mode
  4805. Define the drawing mode.
  4806. @table @samp
  4807. @item wires
  4808. Draw white/gray wires on black background.
  4809. @item colormix
  4810. Mix the colors to create a paint/cartoon effect.
  4811. @end table
  4812. Default value is @var{wires}.
  4813. @end table
  4814. @subsection Examples
  4815. @itemize
  4816. @item
  4817. Standard edge detection with custom values for the hysteresis thresholding:
  4818. @example
  4819. edgedetect=low=0.1:high=0.4
  4820. @end example
  4821. @item
  4822. Painting effect without thresholding:
  4823. @example
  4824. edgedetect=mode=colormix:high=0
  4825. @end example
  4826. @end itemize
  4827. @section eq
  4828. Set brightness, contrast, saturation and approximate gamma adjustment.
  4829. The filter accepts the following options:
  4830. @table @option
  4831. @item contrast
  4832. Set the contrast expression. The value must be a float value in range
  4833. @code{-2.0} to @code{2.0}. The default value is "1".
  4834. @item brightness
  4835. Set the brightness expression. The value must be a float value in
  4836. range @code{-1.0} to @code{1.0}. The default value is "0".
  4837. @item saturation
  4838. Set the saturation expression. The value must be a float in
  4839. range @code{0.0} to @code{3.0}. The default value is "1".
  4840. @item gamma
  4841. Set the gamma expression. The value must be a float in range
  4842. @code{0.1} to @code{10.0}. The default value is "1".
  4843. @item gamma_r
  4844. Set the gamma expression for red. The value must be a float in
  4845. range @code{0.1} to @code{10.0}. The default value is "1".
  4846. @item gamma_g
  4847. Set the gamma expression for green. The value must be a float in range
  4848. @code{0.1} to @code{10.0}. The default value is "1".
  4849. @item gamma_b
  4850. Set the gamma expression for blue. The value must be a float in range
  4851. @code{0.1} to @code{10.0}. The default value is "1".
  4852. @item gamma_weight
  4853. Set the gamma weight expression. It can be used to reduce the effect
  4854. of a high gamma value on bright image areas, e.g. keep them from
  4855. getting overamplified and just plain white. The value must be a float
  4856. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  4857. gamma correction all the way down while @code{1.0} leaves it at its
  4858. full strength. Default is "1".
  4859. @item eval
  4860. Set when the expressions for brightness, contrast, saturation and
  4861. gamma expressions are evaluated.
  4862. It accepts the following values:
  4863. @table @samp
  4864. @item init
  4865. only evaluate expressions once during the filter initialization or
  4866. when a command is processed
  4867. @item frame
  4868. evaluate expressions for each incoming frame
  4869. @end table
  4870. Default value is @samp{init}.
  4871. @end table
  4872. The expressions accept the following parameters:
  4873. @table @option
  4874. @item n
  4875. frame count of the input frame starting from 0
  4876. @item pos
  4877. byte position of the corresponding packet in the input file, NAN if
  4878. unspecified
  4879. @item r
  4880. frame rate of the input video, NAN if the input frame rate is unknown
  4881. @item t
  4882. timestamp expressed in seconds, NAN if the input timestamp is unknown
  4883. @end table
  4884. @subsection Commands
  4885. The filter supports the following commands:
  4886. @table @option
  4887. @item contrast
  4888. Set the contrast expression.
  4889. @item brightness
  4890. Set the brightness expression.
  4891. @item saturation
  4892. Set the saturation expression.
  4893. @item gamma
  4894. Set the gamma expression.
  4895. @item gamma_r
  4896. Set the gamma_r expression.
  4897. @item gamma_g
  4898. Set gamma_g expression.
  4899. @item gamma_b
  4900. Set gamma_b expression.
  4901. @item gamma_weight
  4902. Set gamma_weight expression.
  4903. The command accepts the same syntax of the corresponding option.
  4904. If the specified expression is not valid, it is kept at its current
  4905. value.
  4906. @end table
  4907. @section erosion
  4908. Apply erosion effect to the video.
  4909. This filter replaces the pixel by the local(3x3) minimum.
  4910. It accepts the following options:
  4911. @table @option
  4912. @item threshold0
  4913. @item threshold1
  4914. @item threshold2
  4915. @item threshold3
  4916. Limit the maximum change for each plane, default is 65535.
  4917. If 0, plane will remain unchanged.
  4918. @item coordinates
  4919. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  4920. pixels are used.
  4921. Flags to local 3x3 coordinates maps like this:
  4922. 1 2 3
  4923. 4 5
  4924. 6 7 8
  4925. @end table
  4926. @section extractplanes
  4927. Extract color channel components from input video stream into
  4928. separate grayscale video streams.
  4929. The filter accepts the following option:
  4930. @table @option
  4931. @item planes
  4932. Set plane(s) to extract.
  4933. Available values for planes are:
  4934. @table @samp
  4935. @item y
  4936. @item u
  4937. @item v
  4938. @item a
  4939. @item r
  4940. @item g
  4941. @item b
  4942. @end table
  4943. Choosing planes not available in the input will result in an error.
  4944. That means you cannot select @code{r}, @code{g}, @code{b} planes
  4945. with @code{y}, @code{u}, @code{v} planes at same time.
  4946. @end table
  4947. @subsection Examples
  4948. @itemize
  4949. @item
  4950. Extract luma, u and v color channel component from input video frame
  4951. into 3 grayscale outputs:
  4952. @example
  4953. 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
  4954. @end example
  4955. @end itemize
  4956. @section elbg
  4957. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  4958. For each input image, the filter will compute the optimal mapping from
  4959. the input to the output given the codebook length, that is the number
  4960. of distinct output colors.
  4961. This filter accepts the following options.
  4962. @table @option
  4963. @item codebook_length, l
  4964. Set codebook length. The value must be a positive integer, and
  4965. represents the number of distinct output colors. Default value is 256.
  4966. @item nb_steps, n
  4967. Set the maximum number of iterations to apply for computing the optimal
  4968. mapping. The higher the value the better the result and the higher the
  4969. computation time. Default value is 1.
  4970. @item seed, s
  4971. Set a random seed, must be an integer included between 0 and
  4972. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  4973. will try to use a good random seed on a best effort basis.
  4974. @item pal8
  4975. Set pal8 output pixel format. This option does not work with codebook
  4976. length greater than 256.
  4977. @end table
  4978. @section fade
  4979. Apply a fade-in/out effect to the input video.
  4980. It accepts the following parameters:
  4981. @table @option
  4982. @item type, t
  4983. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  4984. effect.
  4985. Default is @code{in}.
  4986. @item start_frame, s
  4987. Specify the number of the frame to start applying the fade
  4988. effect at. Default is 0.
  4989. @item nb_frames, n
  4990. The number of frames that the fade effect lasts. At the end of the
  4991. fade-in effect, the output video will have the same intensity as the input video.
  4992. At the end of the fade-out transition, the output video will be filled with the
  4993. selected @option{color}.
  4994. Default is 25.
  4995. @item alpha
  4996. If set to 1, fade only alpha channel, if one exists on the input.
  4997. Default value is 0.
  4998. @item start_time, st
  4999. Specify the timestamp (in seconds) of the frame to start to apply the fade
  5000. effect. If both start_frame and start_time are specified, the fade will start at
  5001. whichever comes last. Default is 0.
  5002. @item duration, d
  5003. The number of seconds for which the fade effect has to last. At the end of the
  5004. fade-in effect the output video will have the same intensity as the input video,
  5005. at the end of the fade-out transition the output video will be filled with the
  5006. selected @option{color}.
  5007. If both duration and nb_frames are specified, duration is used. Default is 0
  5008. (nb_frames is used by default).
  5009. @item color, c
  5010. Specify the color of the fade. Default is "black".
  5011. @end table
  5012. @subsection Examples
  5013. @itemize
  5014. @item
  5015. Fade in the first 30 frames of video:
  5016. @example
  5017. fade=in:0:30
  5018. @end example
  5019. The command above is equivalent to:
  5020. @example
  5021. fade=t=in:s=0:n=30
  5022. @end example
  5023. @item
  5024. Fade out the last 45 frames of a 200-frame video:
  5025. @example
  5026. fade=out:155:45
  5027. fade=type=out:start_frame=155:nb_frames=45
  5028. @end example
  5029. @item
  5030. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  5031. @example
  5032. fade=in:0:25, fade=out:975:25
  5033. @end example
  5034. @item
  5035. Make the first 5 frames yellow, then fade in from frame 5-24:
  5036. @example
  5037. fade=in:5:20:color=yellow
  5038. @end example
  5039. @item
  5040. Fade in alpha over first 25 frames of video:
  5041. @example
  5042. fade=in:0:25:alpha=1
  5043. @end example
  5044. @item
  5045. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  5046. @example
  5047. fade=t=in:st=5.5:d=0.5
  5048. @end example
  5049. @end itemize
  5050. @section fftfilt
  5051. Apply arbitrary expressions to samples in frequency domain
  5052. @table @option
  5053. @item dc_Y
  5054. Adjust the dc value (gain) of the luma plane of the image. The filter
  5055. accepts an integer value in range @code{0} to @code{1000}. The default
  5056. value is set to @code{0}.
  5057. @item dc_U
  5058. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  5059. filter accepts an integer value in range @code{0} to @code{1000}. The
  5060. default value is set to @code{0}.
  5061. @item dc_V
  5062. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  5063. filter accepts an integer value in range @code{0} to @code{1000}. The
  5064. default value is set to @code{0}.
  5065. @item weight_Y
  5066. Set the frequency domain weight expression for the luma plane.
  5067. @item weight_U
  5068. Set the frequency domain weight expression for the 1st chroma plane.
  5069. @item weight_V
  5070. Set the frequency domain weight expression for the 2nd chroma plane.
  5071. The filter accepts the following variables:
  5072. @item X
  5073. @item Y
  5074. The coordinates of the current sample.
  5075. @item W
  5076. @item H
  5077. The width and height of the image.
  5078. @end table
  5079. @subsection Examples
  5080. @itemize
  5081. @item
  5082. High-pass:
  5083. @example
  5084. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  5085. @end example
  5086. @item
  5087. Low-pass:
  5088. @example
  5089. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  5090. @end example
  5091. @item
  5092. Sharpen:
  5093. @example
  5094. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  5095. @end example
  5096. @item
  5097. Blur:
  5098. @example
  5099. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  5100. @end example
  5101. @end itemize
  5102. @section field
  5103. Extract a single field from an interlaced image using stride
  5104. arithmetic to avoid wasting CPU time. The output frames are marked as
  5105. non-interlaced.
  5106. The filter accepts the following options:
  5107. @table @option
  5108. @item type
  5109. Specify whether to extract the top (if the value is @code{0} or
  5110. @code{top}) or the bottom field (if the value is @code{1} or
  5111. @code{bottom}).
  5112. @end table
  5113. @section fieldmatch
  5114. Field matching filter for inverse telecine. It is meant to reconstruct the
  5115. progressive frames from a telecined stream. The filter does not drop duplicated
  5116. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  5117. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  5118. The separation of the field matching and the decimation is notably motivated by
  5119. the possibility of inserting a de-interlacing filter fallback between the two.
  5120. If the source has mixed telecined and real interlaced content,
  5121. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  5122. But these remaining combed frames will be marked as interlaced, and thus can be
  5123. de-interlaced by a later filter such as @ref{yadif} before decimation.
  5124. In addition to the various configuration options, @code{fieldmatch} can take an
  5125. optional second stream, activated through the @option{ppsrc} option. If
  5126. enabled, the frames reconstruction will be based on the fields and frames from
  5127. this second stream. This allows the first input to be pre-processed in order to
  5128. help the various algorithms of the filter, while keeping the output lossless
  5129. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  5130. or brightness/contrast adjustments can help.
  5131. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  5132. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  5133. which @code{fieldmatch} is based on. While the semantic and usage are very
  5134. close, some behaviour and options names can differ.
  5135. The @ref{decimate} filter currently only works for constant frame rate input.
  5136. If your input has mixed telecined (30fps) and progressive content with a lower
  5137. framerate like 24fps use the following filterchain to produce the necessary cfr
  5138. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  5139. The filter accepts the following options:
  5140. @table @option
  5141. @item order
  5142. Specify the assumed field order of the input stream. Available values are:
  5143. @table @samp
  5144. @item auto
  5145. Auto detect parity (use FFmpeg's internal parity value).
  5146. @item bff
  5147. Assume bottom field first.
  5148. @item tff
  5149. Assume top field first.
  5150. @end table
  5151. Note that it is sometimes recommended not to trust the parity announced by the
  5152. stream.
  5153. Default value is @var{auto}.
  5154. @item mode
  5155. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  5156. sense that it won't risk creating jerkiness due to duplicate frames when
  5157. possible, but if there are bad edits or blended fields it will end up
  5158. outputting combed frames when a good match might actually exist. On the other
  5159. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  5160. but will almost always find a good frame if there is one. The other values are
  5161. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  5162. jerkiness and creating duplicate frames versus finding good matches in sections
  5163. with bad edits, orphaned fields, blended fields, etc.
  5164. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  5165. Available values are:
  5166. @table @samp
  5167. @item pc
  5168. 2-way matching (p/c)
  5169. @item pc_n
  5170. 2-way matching, and trying 3rd match if still combed (p/c + n)
  5171. @item pc_u
  5172. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  5173. @item pc_n_ub
  5174. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  5175. still combed (p/c + n + u/b)
  5176. @item pcn
  5177. 3-way matching (p/c/n)
  5178. @item pcn_ub
  5179. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  5180. detected as combed (p/c/n + u/b)
  5181. @end table
  5182. The parenthesis at the end indicate the matches that would be used for that
  5183. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  5184. @var{top}).
  5185. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  5186. the slowest.
  5187. Default value is @var{pc_n}.
  5188. @item ppsrc
  5189. Mark the main input stream as a pre-processed input, and enable the secondary
  5190. input stream as the clean source to pick the fields from. See the filter
  5191. introduction for more details. It is similar to the @option{clip2} feature from
  5192. VFM/TFM.
  5193. Default value is @code{0} (disabled).
  5194. @item field
  5195. Set the field to match from. It is recommended to set this to the same value as
  5196. @option{order} unless you experience matching failures with that setting. In
  5197. certain circumstances changing the field that is used to match from can have a
  5198. large impact on matching performance. Available values are:
  5199. @table @samp
  5200. @item auto
  5201. Automatic (same value as @option{order}).
  5202. @item bottom
  5203. Match from the bottom field.
  5204. @item top
  5205. Match from the top field.
  5206. @end table
  5207. Default value is @var{auto}.
  5208. @item mchroma
  5209. Set whether or not chroma is included during the match comparisons. In most
  5210. cases it is recommended to leave this enabled. You should set this to @code{0}
  5211. only if your clip has bad chroma problems such as heavy rainbowing or other
  5212. artifacts. Setting this to @code{0} could also be used to speed things up at
  5213. the cost of some accuracy.
  5214. Default value is @code{1}.
  5215. @item y0
  5216. @item y1
  5217. These define an exclusion band which excludes the lines between @option{y0} and
  5218. @option{y1} from being included in the field matching decision. An exclusion
  5219. band can be used to ignore subtitles, a logo, or other things that may
  5220. interfere with the matching. @option{y0} sets the starting scan line and
  5221. @option{y1} sets the ending line; all lines in between @option{y0} and
  5222. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  5223. @option{y0} and @option{y1} to the same value will disable the feature.
  5224. @option{y0} and @option{y1} defaults to @code{0}.
  5225. @item scthresh
  5226. Set the scene change detection threshold as a percentage of maximum change on
  5227. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  5228. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  5229. @option{scthresh} is @code{[0.0, 100.0]}.
  5230. Default value is @code{12.0}.
  5231. @item combmatch
  5232. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  5233. account the combed scores of matches when deciding what match to use as the
  5234. final match. Available values are:
  5235. @table @samp
  5236. @item none
  5237. No final matching based on combed scores.
  5238. @item sc
  5239. Combed scores are only used when a scene change is detected.
  5240. @item full
  5241. Use combed scores all the time.
  5242. @end table
  5243. Default is @var{sc}.
  5244. @item combdbg
  5245. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  5246. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  5247. Available values are:
  5248. @table @samp
  5249. @item none
  5250. No forced calculation.
  5251. @item pcn
  5252. Force p/c/n calculations.
  5253. @item pcnub
  5254. Force p/c/n/u/b calculations.
  5255. @end table
  5256. Default value is @var{none}.
  5257. @item cthresh
  5258. This is the area combing threshold used for combed frame detection. This
  5259. essentially controls how "strong" or "visible" combing must be to be detected.
  5260. Larger values mean combing must be more visible and smaller values mean combing
  5261. can be less visible or strong and still be detected. Valid settings are from
  5262. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  5263. be detected as combed). This is basically a pixel difference value. A good
  5264. range is @code{[8, 12]}.
  5265. Default value is @code{9}.
  5266. @item chroma
  5267. Sets whether or not chroma is considered in the combed frame decision. Only
  5268. disable this if your source has chroma problems (rainbowing, etc.) that are
  5269. causing problems for the combed frame detection with chroma enabled. Actually,
  5270. using @option{chroma}=@var{0} is usually more reliable, except for the case
  5271. where there is chroma only combing in the source.
  5272. Default value is @code{0}.
  5273. @item blockx
  5274. @item blocky
  5275. Respectively set the x-axis and y-axis size of the window used during combed
  5276. frame detection. This has to do with the size of the area in which
  5277. @option{combpel} pixels are required to be detected as combed for a frame to be
  5278. declared combed. See the @option{combpel} parameter description for more info.
  5279. Possible values are any number that is a power of 2 starting at 4 and going up
  5280. to 512.
  5281. Default value is @code{16}.
  5282. @item combpel
  5283. The number of combed pixels inside any of the @option{blocky} by
  5284. @option{blockx} size blocks on the frame for the frame to be detected as
  5285. combed. While @option{cthresh} controls how "visible" the combing must be, this
  5286. setting controls "how much" combing there must be in any localized area (a
  5287. window defined by the @option{blockx} and @option{blocky} settings) on the
  5288. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  5289. which point no frames will ever be detected as combed). This setting is known
  5290. as @option{MI} in TFM/VFM vocabulary.
  5291. Default value is @code{80}.
  5292. @end table
  5293. @anchor{p/c/n/u/b meaning}
  5294. @subsection p/c/n/u/b meaning
  5295. @subsubsection p/c/n
  5296. We assume the following telecined stream:
  5297. @example
  5298. Top fields: 1 2 2 3 4
  5299. Bottom fields: 1 2 3 4 4
  5300. @end example
  5301. The numbers correspond to the progressive frame the fields relate to. Here, the
  5302. first two frames are progressive, the 3rd and 4th are combed, and so on.
  5303. When @code{fieldmatch} is configured to run a matching from bottom
  5304. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  5305. @example
  5306. Input stream:
  5307. T 1 2 2 3 4
  5308. B 1 2 3 4 4 <-- matching reference
  5309. Matches: c c n n c
  5310. Output stream:
  5311. T 1 2 3 4 4
  5312. B 1 2 3 4 4
  5313. @end example
  5314. As a result of the field matching, we can see that some frames get duplicated.
  5315. To perform a complete inverse telecine, you need to rely on a decimation filter
  5316. after this operation. See for instance the @ref{decimate} filter.
  5317. The same operation now matching from top fields (@option{field}=@var{top})
  5318. looks like this:
  5319. @example
  5320. Input stream:
  5321. T 1 2 2 3 4 <-- matching reference
  5322. B 1 2 3 4 4
  5323. Matches: c c p p c
  5324. Output stream:
  5325. T 1 2 2 3 4
  5326. B 1 2 2 3 4
  5327. @end example
  5328. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  5329. basically, they refer to the frame and field of the opposite parity:
  5330. @itemize
  5331. @item @var{p} matches the field of the opposite parity in the previous frame
  5332. @item @var{c} matches the field of the opposite parity in the current frame
  5333. @item @var{n} matches the field of the opposite parity in the next frame
  5334. @end itemize
  5335. @subsubsection u/b
  5336. The @var{u} and @var{b} matching are a bit special in the sense that they match
  5337. from the opposite parity flag. In the following examples, we assume that we are
  5338. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  5339. 'x' is placed above and below each matched fields.
  5340. With bottom matching (@option{field}=@var{bottom}):
  5341. @example
  5342. Match: c p n b u
  5343. x x x x x
  5344. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  5345. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  5346. x x x x x
  5347. Output frames:
  5348. 2 1 2 2 2
  5349. 2 2 2 1 3
  5350. @end example
  5351. With top matching (@option{field}=@var{top}):
  5352. @example
  5353. Match: c p n b u
  5354. x x x x x
  5355. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  5356. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  5357. x x x x x
  5358. Output frames:
  5359. 2 2 2 1 2
  5360. 2 1 3 2 2
  5361. @end example
  5362. @subsection Examples
  5363. Simple IVTC of a top field first telecined stream:
  5364. @example
  5365. fieldmatch=order=tff:combmatch=none, decimate
  5366. @end example
  5367. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  5368. @example
  5369. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  5370. @end example
  5371. @section fieldorder
  5372. Transform the field order of the input video.
  5373. It accepts the following parameters:
  5374. @table @option
  5375. @item order
  5376. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  5377. for bottom field first.
  5378. @end table
  5379. The default value is @samp{tff}.
  5380. The transformation is done by shifting the picture content up or down
  5381. by one line, and filling the remaining line with appropriate picture content.
  5382. This method is consistent with most broadcast field order converters.
  5383. If the input video is not flagged as being interlaced, or it is already
  5384. flagged as being of the required output field order, then this filter does
  5385. not alter the incoming video.
  5386. It is very useful when converting to or from PAL DV material,
  5387. which is bottom field first.
  5388. For example:
  5389. @example
  5390. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  5391. @end example
  5392. @section fifo, afifo
  5393. Buffer input images and send them when they are requested.
  5394. It is mainly useful when auto-inserted by the libavfilter
  5395. framework.
  5396. It does not take parameters.
  5397. @section find_rect
  5398. Find a rectangular object
  5399. It accepts the following options:
  5400. @table @option
  5401. @item object
  5402. Filepath of the object image, needs to be in gray8.
  5403. @item threshold
  5404. Detection threshold, default is 0.5.
  5405. @item mipmaps
  5406. Number of mipmaps, default is 3.
  5407. @item xmin, ymin, xmax, ymax
  5408. Specifies the rectangle in which to search.
  5409. @end table
  5410. @subsection Examples
  5411. @itemize
  5412. @item
  5413. Generate a representative palette of a given video using @command{ffmpeg}:
  5414. @example
  5415. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  5416. @end example
  5417. @end itemize
  5418. @section cover_rect
  5419. Cover a rectangular object
  5420. It accepts the following options:
  5421. @table @option
  5422. @item cover
  5423. Filepath of the optional cover image, needs to be in yuv420.
  5424. @item mode
  5425. Set covering mode.
  5426. It accepts the following values:
  5427. @table @samp
  5428. @item cover
  5429. cover it by the supplied image
  5430. @item blur
  5431. cover it by interpolating the surrounding pixels
  5432. @end table
  5433. Default value is @var{blur}.
  5434. @end table
  5435. @subsection Examples
  5436. @itemize
  5437. @item
  5438. Generate a representative palette of a given video using @command{ffmpeg}:
  5439. @example
  5440. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  5441. @end example
  5442. @end itemize
  5443. @anchor{format}
  5444. @section format
  5445. Convert the input video to one of the specified pixel formats.
  5446. Libavfilter will try to pick one that is suitable as input to
  5447. the next filter.
  5448. It accepts the following parameters:
  5449. @table @option
  5450. @item pix_fmts
  5451. A '|'-separated list of pixel format names, such as
  5452. "pix_fmts=yuv420p|monow|rgb24".
  5453. @end table
  5454. @subsection Examples
  5455. @itemize
  5456. @item
  5457. Convert the input video to the @var{yuv420p} format
  5458. @example
  5459. format=pix_fmts=yuv420p
  5460. @end example
  5461. Convert the input video to any of the formats in the list
  5462. @example
  5463. format=pix_fmts=yuv420p|yuv444p|yuv410p
  5464. @end example
  5465. @end itemize
  5466. @anchor{fps}
  5467. @section fps
  5468. Convert the video to specified constant frame rate by duplicating or dropping
  5469. frames as necessary.
  5470. It accepts the following parameters:
  5471. @table @option
  5472. @item fps
  5473. The desired output frame rate. The default is @code{25}.
  5474. @item round
  5475. Rounding method.
  5476. Possible values are:
  5477. @table @option
  5478. @item zero
  5479. zero round towards 0
  5480. @item inf
  5481. round away from 0
  5482. @item down
  5483. round towards -infinity
  5484. @item up
  5485. round towards +infinity
  5486. @item near
  5487. round to nearest
  5488. @end table
  5489. The default is @code{near}.
  5490. @item start_time
  5491. Assume the first PTS should be the given value, in seconds. This allows for
  5492. padding/trimming at the start of stream. By default, no assumption is made
  5493. about the first frame's expected PTS, so no padding or trimming is done.
  5494. For example, this could be set to 0 to pad the beginning with duplicates of
  5495. the first frame if a video stream starts after the audio stream or to trim any
  5496. frames with a negative PTS.
  5497. @end table
  5498. Alternatively, the options can be specified as a flat string:
  5499. @var{fps}[:@var{round}].
  5500. See also the @ref{setpts} filter.
  5501. @subsection Examples
  5502. @itemize
  5503. @item
  5504. A typical usage in order to set the fps to 25:
  5505. @example
  5506. fps=fps=25
  5507. @end example
  5508. @item
  5509. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  5510. @example
  5511. fps=fps=film:round=near
  5512. @end example
  5513. @end itemize
  5514. @section framepack
  5515. Pack two different video streams into a stereoscopic video, setting proper
  5516. metadata on supported codecs. The two views should have the same size and
  5517. framerate and processing will stop when the shorter video ends. Please note
  5518. that you may conveniently adjust view properties with the @ref{scale} and
  5519. @ref{fps} filters.
  5520. It accepts the following parameters:
  5521. @table @option
  5522. @item format
  5523. The desired packing format. Supported values are:
  5524. @table @option
  5525. @item sbs
  5526. The views are next to each other (default).
  5527. @item tab
  5528. The views are on top of each other.
  5529. @item lines
  5530. The views are packed by line.
  5531. @item columns
  5532. The views are packed by column.
  5533. @item frameseq
  5534. The views are temporally interleaved.
  5535. @end table
  5536. @end table
  5537. Some examples:
  5538. @example
  5539. # Convert left and right views into a frame-sequential video
  5540. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  5541. # Convert views into a side-by-side video with the same output resolution as the input
  5542. 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
  5543. @end example
  5544. @section framerate
  5545. Change the frame rate by interpolating new video output frames from the source
  5546. frames.
  5547. This filter is not designed to function correctly with interlaced media. If
  5548. you wish to change the frame rate of interlaced media then you are required
  5549. to deinterlace before this filter and re-interlace after this filter.
  5550. A description of the accepted options follows.
  5551. @table @option
  5552. @item fps
  5553. Specify the output frames per second. This option can also be specified
  5554. as a value alone. The default is @code{50}.
  5555. @item interp_start
  5556. Specify the start of a range where the output frame will be created as a
  5557. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  5558. the default is @code{15}.
  5559. @item interp_end
  5560. Specify the end of a range where the output frame will be created as a
  5561. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  5562. the default is @code{240}.
  5563. @item scene
  5564. Specify the level at which a scene change is detected as a value between
  5565. 0 and 100 to indicate a new scene; a low value reflects a low
  5566. probability for the current frame to introduce a new scene, while a higher
  5567. value means the current frame is more likely to be one.
  5568. The default is @code{7}.
  5569. @item flags
  5570. Specify flags influencing the filter process.
  5571. Available value for @var{flags} is:
  5572. @table @option
  5573. @item scene_change_detect, scd
  5574. Enable scene change detection using the value of the option @var{scene}.
  5575. This flag is enabled by default.
  5576. @end table
  5577. @end table
  5578. @section framestep
  5579. Select one frame every N-th frame.
  5580. This filter accepts the following option:
  5581. @table @option
  5582. @item step
  5583. Select frame after every @code{step} frames.
  5584. Allowed values are positive integers higher than 0. Default value is @code{1}.
  5585. @end table
  5586. @anchor{frei0r}
  5587. @section frei0r
  5588. Apply a frei0r effect to the input video.
  5589. To enable the compilation of this filter, you need to install the frei0r
  5590. header and configure FFmpeg with @code{--enable-frei0r}.
  5591. It accepts the following parameters:
  5592. @table @option
  5593. @item filter_name
  5594. The name of the frei0r effect to load. If the environment variable
  5595. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  5596. directories specified by the colon-separated list in @env{FREIOR_PATH}.
  5597. Otherwise, the standard frei0r paths are searched, in this order:
  5598. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  5599. @file{/usr/lib/frei0r-1/}.
  5600. @item filter_params
  5601. A '|'-separated list of parameters to pass to the frei0r effect.
  5602. @end table
  5603. A frei0r effect parameter can be a boolean (its value is either
  5604. "y" or "n"), a double, a color (specified as
  5605. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  5606. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  5607. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  5608. @var{X} and @var{Y} are floating point numbers) and/or a string.
  5609. The number and types of parameters depend on the loaded effect. If an
  5610. effect parameter is not specified, the default value is set.
  5611. @subsection Examples
  5612. @itemize
  5613. @item
  5614. Apply the distort0r effect, setting the first two double parameters:
  5615. @example
  5616. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  5617. @end example
  5618. @item
  5619. Apply the colordistance effect, taking a color as the first parameter:
  5620. @example
  5621. frei0r=colordistance:0.2/0.3/0.4
  5622. frei0r=colordistance:violet
  5623. frei0r=colordistance:0x112233
  5624. @end example
  5625. @item
  5626. Apply the perspective effect, specifying the top left and top right image
  5627. positions:
  5628. @example
  5629. frei0r=perspective:0.2/0.2|0.8/0.2
  5630. @end example
  5631. @end itemize
  5632. For more information, see
  5633. @url{http://frei0r.dyne.org}
  5634. @section fspp
  5635. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  5636. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  5637. processing filter, one of them is performed once per block, not per pixel.
  5638. This allows for much higher speed.
  5639. The filter accepts the following options:
  5640. @table @option
  5641. @item quality
  5642. Set quality. This option defines the number of levels for averaging. It accepts
  5643. an integer in the range 4-5. Default value is @code{4}.
  5644. @item qp
  5645. Force a constant quantization parameter. It accepts an integer in range 0-63.
  5646. If not set, the filter will use the QP from the video stream (if available).
  5647. @item strength
  5648. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  5649. more details but also more artifacts, while higher values make the image smoother
  5650. but also blurrier. Default value is @code{0} − PSNR optimal.
  5651. @item use_bframe_qp
  5652. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  5653. option may cause flicker since the B-Frames have often larger QP. Default is
  5654. @code{0} (not enabled).
  5655. @end table
  5656. @section geq
  5657. The filter accepts the following options:
  5658. @table @option
  5659. @item lum_expr, lum
  5660. Set the luminance expression.
  5661. @item cb_expr, cb
  5662. Set the chrominance blue expression.
  5663. @item cr_expr, cr
  5664. Set the chrominance red expression.
  5665. @item alpha_expr, a
  5666. Set the alpha expression.
  5667. @item red_expr, r
  5668. Set the red expression.
  5669. @item green_expr, g
  5670. Set the green expression.
  5671. @item blue_expr, b
  5672. Set the blue expression.
  5673. @end table
  5674. The colorspace is selected according to the specified options. If one
  5675. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  5676. options is specified, the filter will automatically select a YCbCr
  5677. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  5678. @option{blue_expr} options is specified, it will select an RGB
  5679. colorspace.
  5680. If one of the chrominance expression is not defined, it falls back on the other
  5681. one. If no alpha expression is specified it will evaluate to opaque value.
  5682. If none of chrominance expressions are specified, they will evaluate
  5683. to the luminance expression.
  5684. The expressions can use the following variables and functions:
  5685. @table @option
  5686. @item N
  5687. The sequential number of the filtered frame, starting from @code{0}.
  5688. @item X
  5689. @item Y
  5690. The coordinates of the current sample.
  5691. @item W
  5692. @item H
  5693. The width and height of the image.
  5694. @item SW
  5695. @item SH
  5696. Width and height scale depending on the currently filtered plane. It is the
  5697. ratio between the corresponding luma plane number of pixels and the current
  5698. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  5699. @code{0.5,0.5} for chroma planes.
  5700. @item T
  5701. Time of the current frame, expressed in seconds.
  5702. @item p(x, y)
  5703. Return the value of the pixel at location (@var{x},@var{y}) of the current
  5704. plane.
  5705. @item lum(x, y)
  5706. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  5707. plane.
  5708. @item cb(x, y)
  5709. Return the value of the pixel at location (@var{x},@var{y}) of the
  5710. blue-difference chroma plane. Return 0 if there is no such plane.
  5711. @item cr(x, y)
  5712. Return the value of the pixel at location (@var{x},@var{y}) of the
  5713. red-difference chroma plane. Return 0 if there is no such plane.
  5714. @item r(x, y)
  5715. @item g(x, y)
  5716. @item b(x, y)
  5717. Return the value of the pixel at location (@var{x},@var{y}) of the
  5718. red/green/blue component. Return 0 if there is no such component.
  5719. @item alpha(x, y)
  5720. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  5721. plane. Return 0 if there is no such plane.
  5722. @end table
  5723. For functions, if @var{x} and @var{y} are outside the area, the value will be
  5724. automatically clipped to the closer edge.
  5725. @subsection Examples
  5726. @itemize
  5727. @item
  5728. Flip the image horizontally:
  5729. @example
  5730. geq=p(W-X\,Y)
  5731. @end example
  5732. @item
  5733. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  5734. wavelength of 100 pixels:
  5735. @example
  5736. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  5737. @end example
  5738. @item
  5739. Generate a fancy enigmatic moving light:
  5740. @example
  5741. 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
  5742. @end example
  5743. @item
  5744. Generate a quick emboss effect:
  5745. @example
  5746. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  5747. @end example
  5748. @item
  5749. Modify RGB components depending on pixel position:
  5750. @example
  5751. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  5752. @end example
  5753. @item
  5754. Create a radial gradient that is the same size as the input (also see
  5755. the @ref{vignette} filter):
  5756. @example
  5757. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  5758. @end example
  5759. @item
  5760. Create a linear gradient to use as a mask for another filter, then
  5761. compose with @ref{overlay}. In this example the video will gradually
  5762. become more blurry from the top to the bottom of the y-axis as defined
  5763. by the linear gradient:
  5764. @example
  5765. ffmpeg -i input.mp4 -filter_complex "geq=lum=255*(Y/H),format=gray[grad];[0:v]boxblur=4[blur];[blur][grad]alphamerge[alpha];[0:v][alpha]overlay" output.mp4
  5766. @end example
  5767. @end itemize
  5768. @section gradfun
  5769. Fix the banding artifacts that are sometimes introduced into nearly flat
  5770. regions by truncation to 8bit color depth.
  5771. Interpolate the gradients that should go where the bands are, and
  5772. dither them.
  5773. It is designed for playback only. Do not use it prior to
  5774. lossy compression, because compression tends to lose the dither and
  5775. bring back the bands.
  5776. It accepts the following parameters:
  5777. @table @option
  5778. @item strength
  5779. The maximum amount by which the filter will change any one pixel. This is also
  5780. the threshold for detecting nearly flat regions. Acceptable values range from
  5781. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  5782. valid range.
  5783. @item radius
  5784. The neighborhood to fit the gradient to. A larger radius makes for smoother
  5785. gradients, but also prevents the filter from modifying the pixels near detailed
  5786. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  5787. values will be clipped to the valid range.
  5788. @end table
  5789. Alternatively, the options can be specified as a flat string:
  5790. @var{strength}[:@var{radius}]
  5791. @subsection Examples
  5792. @itemize
  5793. @item
  5794. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  5795. @example
  5796. gradfun=3.5:8
  5797. @end example
  5798. @item
  5799. Specify radius, omitting the strength (which will fall-back to the default
  5800. value):
  5801. @example
  5802. gradfun=radius=8
  5803. @end example
  5804. @end itemize
  5805. @anchor{haldclut}
  5806. @section haldclut
  5807. Apply a Hald CLUT to a video stream.
  5808. First input is the video stream to process, and second one is the Hald CLUT.
  5809. The Hald CLUT input can be a simple picture or a complete video stream.
  5810. The filter accepts the following options:
  5811. @table @option
  5812. @item shortest
  5813. Force termination when the shortest input terminates. Default is @code{0}.
  5814. @item repeatlast
  5815. Continue applying the last CLUT after the end of the stream. A value of
  5816. @code{0} disable the filter after the last frame of the CLUT is reached.
  5817. Default is @code{1}.
  5818. @end table
  5819. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  5820. filters share the same internals).
  5821. More information about the Hald CLUT can be found on Eskil Steenberg's website
  5822. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  5823. @subsection Workflow examples
  5824. @subsubsection Hald CLUT video stream
  5825. Generate an identity Hald CLUT stream altered with various effects:
  5826. @example
  5827. 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
  5828. @end example
  5829. Note: make sure you use a lossless codec.
  5830. Then use it with @code{haldclut} to apply it on some random stream:
  5831. @example
  5832. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  5833. @end example
  5834. The Hald CLUT will be applied to the 10 first seconds (duration of
  5835. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  5836. to the remaining frames of the @code{mandelbrot} stream.
  5837. @subsubsection Hald CLUT with preview
  5838. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  5839. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  5840. biggest possible square starting at the top left of the picture. The remaining
  5841. padding pixels (bottom or right) will be ignored. This area can be used to add
  5842. a preview of the Hald CLUT.
  5843. Typically, the following generated Hald CLUT will be supported by the
  5844. @code{haldclut} filter:
  5845. @example
  5846. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  5847. pad=iw+320 [padded_clut];
  5848. smptebars=s=320x256, split [a][b];
  5849. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  5850. [main][b] overlay=W-320" -frames:v 1 clut.png
  5851. @end example
  5852. It contains the original and a preview of the effect of the CLUT: SMPTE color
  5853. bars are displayed on the right-top, and below the same color bars processed by
  5854. the color changes.
  5855. Then, the effect of this Hald CLUT can be visualized with:
  5856. @example
  5857. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  5858. @end example
  5859. @section hflip
  5860. Flip the input video horizontally.
  5861. For example, to horizontally flip the input video with @command{ffmpeg}:
  5862. @example
  5863. ffmpeg -i in.avi -vf "hflip" out.avi
  5864. @end example
  5865. @section histeq
  5866. This filter applies a global color histogram equalization on a
  5867. per-frame basis.
  5868. It can be used to correct video that has a compressed range of pixel
  5869. intensities. The filter redistributes the pixel intensities to
  5870. equalize their distribution across the intensity range. It may be
  5871. viewed as an "automatically adjusting contrast filter". This filter is
  5872. useful only for correcting degraded or poorly captured source
  5873. video.
  5874. The filter accepts the following options:
  5875. @table @option
  5876. @item strength
  5877. Determine the amount of equalization to be applied. As the strength
  5878. is reduced, the distribution of pixel intensities more-and-more
  5879. approaches that of the input frame. The value must be a float number
  5880. in the range [0,1] and defaults to 0.200.
  5881. @item intensity
  5882. Set the maximum intensity that can generated and scale the output
  5883. values appropriately. The strength should be set as desired and then
  5884. the intensity can be limited if needed to avoid washing-out. The value
  5885. must be a float number in the range [0,1] and defaults to 0.210.
  5886. @item antibanding
  5887. Set the antibanding level. If enabled the filter will randomly vary
  5888. the luminance of output pixels by a small amount to avoid banding of
  5889. the histogram. Possible values are @code{none}, @code{weak} or
  5890. @code{strong}. It defaults to @code{none}.
  5891. @end table
  5892. @section histogram
  5893. Compute and draw a color distribution histogram for the input video.
  5894. The computed histogram is a representation of the color component
  5895. distribution in an image.
  5896. Standard histogram displays the color components distribution in an image.
  5897. Displays color graph for each color component. Shows distribution of
  5898. the Y, U, V, A or R, G, B components, depending on input format, in the
  5899. current frame. Below each graph a color component scale meter is shown.
  5900. The filter accepts the following options:
  5901. @table @option
  5902. @item level_height
  5903. Set height of level. Default value is @code{200}.
  5904. Allowed range is [50, 2048].
  5905. @item scale_height
  5906. Set height of color scale. Default value is @code{12}.
  5907. Allowed range is [0, 40].
  5908. @item display_mode
  5909. Set display mode.
  5910. It accepts the following values:
  5911. @table @samp
  5912. @item parade
  5913. Per color component graphs are placed below each other.
  5914. @item overlay
  5915. Presents information identical to that in the @code{parade}, except
  5916. that the graphs representing color components are superimposed directly
  5917. over one another.
  5918. @end table
  5919. Default is @code{parade}.
  5920. @item levels_mode
  5921. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  5922. Default is @code{linear}.
  5923. @item components
  5924. Set what color components to display.
  5925. Default is @code{7}.
  5926. @end table
  5927. @subsection Examples
  5928. @itemize
  5929. @item
  5930. Calculate and draw histogram:
  5931. @example
  5932. ffplay -i input -vf histogram
  5933. @end example
  5934. @end itemize
  5935. @anchor{hqdn3d}
  5936. @section hqdn3d
  5937. This is a high precision/quality 3d denoise filter. It aims to reduce
  5938. image noise, producing smooth images and making still images really
  5939. still. It should enhance compressibility.
  5940. It accepts the following optional parameters:
  5941. @table @option
  5942. @item luma_spatial
  5943. A non-negative floating point number which specifies spatial luma strength.
  5944. It defaults to 4.0.
  5945. @item chroma_spatial
  5946. A non-negative floating point number which specifies spatial chroma strength.
  5947. It defaults to 3.0*@var{luma_spatial}/4.0.
  5948. @item luma_tmp
  5949. A floating point number which specifies luma temporal strength. It defaults to
  5950. 6.0*@var{luma_spatial}/4.0.
  5951. @item chroma_tmp
  5952. A floating point number which specifies chroma temporal strength. It defaults to
  5953. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  5954. @end table
  5955. @section hqx
  5956. Apply a high-quality magnification filter designed for pixel art. This filter
  5957. was originally created by Maxim Stepin.
  5958. It accepts the following option:
  5959. @table @option
  5960. @item n
  5961. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  5962. @code{hq3x} and @code{4} for @code{hq4x}.
  5963. Default is @code{3}.
  5964. @end table
  5965. @section hstack
  5966. Stack input videos horizontally.
  5967. All streams must be of same pixel format and of same height.
  5968. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  5969. to create same output.
  5970. The filter accept the following option:
  5971. @table @option
  5972. @item inputs
  5973. Set number of input streams. Default is 2.
  5974. @item shortest
  5975. If set to 1, force the output to terminate when the shortest input
  5976. terminates. Default value is 0.
  5977. @end table
  5978. @section hue
  5979. Modify the hue and/or the saturation of the input.
  5980. It accepts the following parameters:
  5981. @table @option
  5982. @item h
  5983. Specify the hue angle as a number of degrees. It accepts an expression,
  5984. and defaults to "0".
  5985. @item s
  5986. Specify the saturation in the [-10,10] range. It accepts an expression and
  5987. defaults to "1".
  5988. @item H
  5989. Specify the hue angle as a number of radians. It accepts an
  5990. expression, and defaults to "0".
  5991. @item b
  5992. Specify the brightness in the [-10,10] range. It accepts an expression and
  5993. defaults to "0".
  5994. @end table
  5995. @option{h} and @option{H} are mutually exclusive, and can't be
  5996. specified at the same time.
  5997. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  5998. expressions containing the following constants:
  5999. @table @option
  6000. @item n
  6001. frame count of the input frame starting from 0
  6002. @item pts
  6003. presentation timestamp of the input frame expressed in time base units
  6004. @item r
  6005. frame rate of the input video, NAN if the input frame rate is unknown
  6006. @item t
  6007. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6008. @item tb
  6009. time base of the input video
  6010. @end table
  6011. @subsection Examples
  6012. @itemize
  6013. @item
  6014. Set the hue to 90 degrees and the saturation to 1.0:
  6015. @example
  6016. hue=h=90:s=1
  6017. @end example
  6018. @item
  6019. Same command but expressing the hue in radians:
  6020. @example
  6021. hue=H=PI/2:s=1
  6022. @end example
  6023. @item
  6024. Rotate hue and make the saturation swing between 0
  6025. and 2 over a period of 1 second:
  6026. @example
  6027. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  6028. @end example
  6029. @item
  6030. Apply a 3 seconds saturation fade-in effect starting at 0:
  6031. @example
  6032. hue="s=min(t/3\,1)"
  6033. @end example
  6034. The general fade-in expression can be written as:
  6035. @example
  6036. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  6037. @end example
  6038. @item
  6039. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  6040. @example
  6041. hue="s=max(0\, min(1\, (8-t)/3))"
  6042. @end example
  6043. The general fade-out expression can be written as:
  6044. @example
  6045. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  6046. @end example
  6047. @end itemize
  6048. @subsection Commands
  6049. This filter supports the following commands:
  6050. @table @option
  6051. @item b
  6052. @item s
  6053. @item h
  6054. @item H
  6055. Modify the hue and/or the saturation and/or brightness of the input video.
  6056. The command accepts the same syntax of the corresponding option.
  6057. If the specified expression is not valid, it is kept at its current
  6058. value.
  6059. @end table
  6060. @section idet
  6061. Detect video interlacing type.
  6062. This filter tries to detect if the input frames as interlaced, progressive,
  6063. top or bottom field first. It will also try and detect fields that are
  6064. repeated between adjacent frames (a sign of telecine).
  6065. Single frame detection considers only immediately adjacent frames when classifying each frame.
  6066. Multiple frame detection incorporates the classification history of previous frames.
  6067. The filter will log these metadata values:
  6068. @table @option
  6069. @item single.current_frame
  6070. Detected type of current frame using single-frame detection. One of:
  6071. ``tff'' (top field first), ``bff'' (bottom field first),
  6072. ``progressive'', or ``undetermined''
  6073. @item single.tff
  6074. Cumulative number of frames detected as top field first using single-frame detection.
  6075. @item multiple.tff
  6076. Cumulative number of frames detected as top field first using multiple-frame detection.
  6077. @item single.bff
  6078. Cumulative number of frames detected as bottom field first using single-frame detection.
  6079. @item multiple.current_frame
  6080. Detected type of current frame using multiple-frame detection. One of:
  6081. ``tff'' (top field first), ``bff'' (bottom field first),
  6082. ``progressive'', or ``undetermined''
  6083. @item multiple.bff
  6084. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  6085. @item single.progressive
  6086. Cumulative number of frames detected as progressive using single-frame detection.
  6087. @item multiple.progressive
  6088. Cumulative number of frames detected as progressive using multiple-frame detection.
  6089. @item single.undetermined
  6090. Cumulative number of frames that could not be classified using single-frame detection.
  6091. @item multiple.undetermined
  6092. Cumulative number of frames that could not be classified using multiple-frame detection.
  6093. @item repeated.current_frame
  6094. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  6095. @item repeated.neither
  6096. Cumulative number of frames with no repeated field.
  6097. @item repeated.top
  6098. Cumulative number of frames with the top field repeated from the previous frame's top field.
  6099. @item repeated.bottom
  6100. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  6101. @end table
  6102. The filter accepts the following options:
  6103. @table @option
  6104. @item intl_thres
  6105. Set interlacing threshold.
  6106. @item prog_thres
  6107. Set progressive threshold.
  6108. @item repeat_thres
  6109. Threshold for repeated field detection.
  6110. @item half_life
  6111. Number of frames after which a given frame's contribution to the
  6112. statistics is halved (i.e., it contributes only 0.5 to it's
  6113. classification). The default of 0 means that all frames seen are given
  6114. full weight of 1.0 forever.
  6115. @item analyze_interlaced_flag
  6116. When this is not 0 then idet will use the specified number of frames to determine
  6117. if the interlaced flag is accurate, it will not count undetermined frames.
  6118. If the flag is found to be accurate it will be used without any further
  6119. computations, if it is found to be inaccurate it will be cleared without any
  6120. further computations. This allows inserting the idet filter as a low computational
  6121. method to clean up the interlaced flag
  6122. @end table
  6123. @section il
  6124. Deinterleave or interleave fields.
  6125. This filter allows one to process interlaced images fields without
  6126. deinterlacing them. Deinterleaving splits the input frame into 2
  6127. fields (so called half pictures). Odd lines are moved to the top
  6128. half of the output image, even lines to the bottom half.
  6129. You can process (filter) them independently and then re-interleave them.
  6130. The filter accepts the following options:
  6131. @table @option
  6132. @item luma_mode, l
  6133. @item chroma_mode, c
  6134. @item alpha_mode, a
  6135. Available values for @var{luma_mode}, @var{chroma_mode} and
  6136. @var{alpha_mode} are:
  6137. @table @samp
  6138. @item none
  6139. Do nothing.
  6140. @item deinterleave, d
  6141. Deinterleave fields, placing one above the other.
  6142. @item interleave, i
  6143. Interleave fields. Reverse the effect of deinterleaving.
  6144. @end table
  6145. Default value is @code{none}.
  6146. @item luma_swap, ls
  6147. @item chroma_swap, cs
  6148. @item alpha_swap, as
  6149. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  6150. @end table
  6151. @section inflate
  6152. Apply inflate effect to the video.
  6153. This filter replaces the pixel by the local(3x3) average by taking into account
  6154. only values higher than the pixel.
  6155. It accepts the following options:
  6156. @table @option
  6157. @item threshold0
  6158. @item threshold1
  6159. @item threshold2
  6160. @item threshold3
  6161. Limit the maximum change for each plane, default is 65535.
  6162. If 0, plane will remain unchanged.
  6163. @end table
  6164. @section interlace
  6165. Simple interlacing filter from progressive contents. This interleaves upper (or
  6166. lower) lines from odd frames with lower (or upper) lines from even frames,
  6167. halving the frame rate and preserving image height.
  6168. @example
  6169. Original Original New Frame
  6170. Frame 'j' Frame 'j+1' (tff)
  6171. ========== =========== ==================
  6172. Line 0 --------------------> Frame 'j' Line 0
  6173. Line 1 Line 1 ----> Frame 'j+1' Line 1
  6174. Line 2 ---------------------> Frame 'j' Line 2
  6175. Line 3 Line 3 ----> Frame 'j+1' Line 3
  6176. ... ... ...
  6177. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  6178. @end example
  6179. It accepts the following optional parameters:
  6180. @table @option
  6181. @item scan
  6182. This determines whether the interlaced frame is taken from the even
  6183. (tff - default) or odd (bff) lines of the progressive frame.
  6184. @item lowpass
  6185. Enable (default) or disable the vertical lowpass filter to avoid twitter
  6186. interlacing and reduce moire patterns.
  6187. @end table
  6188. @section kerndeint
  6189. Deinterlace input video by applying Donald Graft's adaptive kernel
  6190. deinterling. Work on interlaced parts of a video to produce
  6191. progressive frames.
  6192. The description of the accepted parameters follows.
  6193. @table @option
  6194. @item thresh
  6195. Set the threshold which affects the filter's tolerance when
  6196. determining if a pixel line must be processed. It must be an integer
  6197. in the range [0,255] and defaults to 10. A value of 0 will result in
  6198. applying the process on every pixels.
  6199. @item map
  6200. Paint pixels exceeding the threshold value to white if set to 1.
  6201. Default is 0.
  6202. @item order
  6203. Set the fields order. Swap fields if set to 1, leave fields alone if
  6204. 0. Default is 0.
  6205. @item sharp
  6206. Enable additional sharpening if set to 1. Default is 0.
  6207. @item twoway
  6208. Enable twoway sharpening if set to 1. Default is 0.
  6209. @end table
  6210. @subsection Examples
  6211. @itemize
  6212. @item
  6213. Apply default values:
  6214. @example
  6215. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  6216. @end example
  6217. @item
  6218. Enable additional sharpening:
  6219. @example
  6220. kerndeint=sharp=1
  6221. @end example
  6222. @item
  6223. Paint processed pixels in white:
  6224. @example
  6225. kerndeint=map=1
  6226. @end example
  6227. @end itemize
  6228. @section lenscorrection
  6229. Correct radial lens distortion
  6230. This filter can be used to correct for radial distortion as can result from the use
  6231. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  6232. one can use tools available for example as part of opencv or simply trial-and-error.
  6233. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  6234. and extract the k1 and k2 coefficients from the resulting matrix.
  6235. Note that effectively the same filter is available in the open-source tools Krita and
  6236. Digikam from the KDE project.
  6237. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  6238. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  6239. brightness distribution, so you may want to use both filters together in certain
  6240. cases, though you will have to take care of ordering, i.e. whether vignetting should
  6241. be applied before or after lens correction.
  6242. @subsection Options
  6243. The filter accepts the following options:
  6244. @table @option
  6245. @item cx
  6246. Relative x-coordinate of the focal point of the image, and thereby the center of the
  6247. distortion. This value has a range [0,1] and is expressed as fractions of the image
  6248. width.
  6249. @item cy
  6250. Relative y-coordinate of the focal point of the image, and thereby the center of the
  6251. distortion. This value has a range [0,1] and is expressed as fractions of the image
  6252. height.
  6253. @item k1
  6254. Coefficient of the quadratic correction term. 0.5 means no correction.
  6255. @item k2
  6256. Coefficient of the double quadratic correction term. 0.5 means no correction.
  6257. @end table
  6258. The formula that generates the correction is:
  6259. @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)
  6260. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  6261. distances from the focal point in the source and target images, respectively.
  6262. @anchor{lut3d}
  6263. @section lut3d
  6264. Apply a 3D LUT to an input video.
  6265. The filter accepts the following options:
  6266. @table @option
  6267. @item file
  6268. Set the 3D LUT file name.
  6269. Currently supported formats:
  6270. @table @samp
  6271. @item 3dl
  6272. AfterEffects
  6273. @item cube
  6274. Iridas
  6275. @item dat
  6276. DaVinci
  6277. @item m3d
  6278. Pandora
  6279. @end table
  6280. @item interp
  6281. Select interpolation mode.
  6282. Available values are:
  6283. @table @samp
  6284. @item nearest
  6285. Use values from the nearest defined point.
  6286. @item trilinear
  6287. Interpolate values using the 8 points defining a cube.
  6288. @item tetrahedral
  6289. Interpolate values using a tetrahedron.
  6290. @end table
  6291. @end table
  6292. @section lut, lutrgb, lutyuv
  6293. Compute a look-up table for binding each pixel component input value
  6294. to an output value, and apply it to the input video.
  6295. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  6296. to an RGB input video.
  6297. These filters accept the following parameters:
  6298. @table @option
  6299. @item c0
  6300. set first pixel component expression
  6301. @item c1
  6302. set second pixel component expression
  6303. @item c2
  6304. set third pixel component expression
  6305. @item c3
  6306. set fourth pixel component expression, corresponds to the alpha component
  6307. @item r
  6308. set red component expression
  6309. @item g
  6310. set green component expression
  6311. @item b
  6312. set blue component expression
  6313. @item a
  6314. alpha component expression
  6315. @item y
  6316. set Y/luminance component expression
  6317. @item u
  6318. set U/Cb component expression
  6319. @item v
  6320. set V/Cr component expression
  6321. @end table
  6322. Each of them specifies the expression to use for computing the lookup table for
  6323. the corresponding pixel component values.
  6324. The exact component associated to each of the @var{c*} options depends on the
  6325. format in input.
  6326. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  6327. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  6328. The expressions can contain the following constants and functions:
  6329. @table @option
  6330. @item w
  6331. @item h
  6332. The input width and height.
  6333. @item val
  6334. The input value for the pixel component.
  6335. @item clipval
  6336. The input value, clipped to the @var{minval}-@var{maxval} range.
  6337. @item maxval
  6338. The maximum value for the pixel component.
  6339. @item minval
  6340. The minimum value for the pixel component.
  6341. @item negval
  6342. The negated value for the pixel component value, clipped to the
  6343. @var{minval}-@var{maxval} range; it corresponds to the expression
  6344. "maxval-clipval+minval".
  6345. @item clip(val)
  6346. The computed value in @var{val}, clipped to the
  6347. @var{minval}-@var{maxval} range.
  6348. @item gammaval(gamma)
  6349. The computed gamma correction value of the pixel component value,
  6350. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  6351. expression
  6352. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  6353. @end table
  6354. All expressions default to "val".
  6355. @subsection Examples
  6356. @itemize
  6357. @item
  6358. Negate input video:
  6359. @example
  6360. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  6361. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  6362. @end example
  6363. The above is the same as:
  6364. @example
  6365. lutrgb="r=negval:g=negval:b=negval"
  6366. lutyuv="y=negval:u=negval:v=negval"
  6367. @end example
  6368. @item
  6369. Negate luminance:
  6370. @example
  6371. lutyuv=y=negval
  6372. @end example
  6373. @item
  6374. Remove chroma components, turning the video into a graytone image:
  6375. @example
  6376. lutyuv="u=128:v=128"
  6377. @end example
  6378. @item
  6379. Apply a luma burning effect:
  6380. @example
  6381. lutyuv="y=2*val"
  6382. @end example
  6383. @item
  6384. Remove green and blue components:
  6385. @example
  6386. lutrgb="g=0:b=0"
  6387. @end example
  6388. @item
  6389. Set a constant alpha channel value on input:
  6390. @example
  6391. format=rgba,lutrgb=a="maxval-minval/2"
  6392. @end example
  6393. @item
  6394. Correct luminance gamma by a factor of 0.5:
  6395. @example
  6396. lutyuv=y=gammaval(0.5)
  6397. @end example
  6398. @item
  6399. Discard least significant bits of luma:
  6400. @example
  6401. lutyuv=y='bitand(val, 128+64+32)'
  6402. @end example
  6403. @end itemize
  6404. @section maskedmerge
  6405. Merge the first input stream with the second input stream using per pixel
  6406. weights in the third input stream.
  6407. A value of 0 in the third stream pixel component means that pixel component
  6408. from first stream is returned unchanged, while maximum value (eg. 255 for
  6409. 8-bit videos) means that pixel component from second stream is returned
  6410. unchanged. Intermediate values define the amount of merging between both
  6411. input stream's pixel components.
  6412. This filter accepts the following options:
  6413. @table @option
  6414. @item planes
  6415. Set which planes will be processed as bitmap, unprocessed planes will be
  6416. copied from first stream.
  6417. By default value 0xf, all planes will be processed.
  6418. @end table
  6419. @section mcdeint
  6420. Apply motion-compensation deinterlacing.
  6421. It needs one field per frame as input and must thus be used together
  6422. with yadif=1/3 or equivalent.
  6423. This filter accepts the following options:
  6424. @table @option
  6425. @item mode
  6426. Set the deinterlacing mode.
  6427. It accepts one of the following values:
  6428. @table @samp
  6429. @item fast
  6430. @item medium
  6431. @item slow
  6432. use iterative motion estimation
  6433. @item extra_slow
  6434. like @samp{slow}, but use multiple reference frames.
  6435. @end table
  6436. Default value is @samp{fast}.
  6437. @item parity
  6438. Set the picture field parity assumed for the input video. It must be
  6439. one of the following values:
  6440. @table @samp
  6441. @item 0, tff
  6442. assume top field first
  6443. @item 1, bff
  6444. assume bottom field first
  6445. @end table
  6446. Default value is @samp{bff}.
  6447. @item qp
  6448. Set per-block quantization parameter (QP) used by the internal
  6449. encoder.
  6450. Higher values should result in a smoother motion vector field but less
  6451. optimal individual vectors. Default value is 1.
  6452. @end table
  6453. @section mergeplanes
  6454. Merge color channel components from several video streams.
  6455. The filter accepts up to 4 input streams, and merge selected input
  6456. planes to the output video.
  6457. This filter accepts the following options:
  6458. @table @option
  6459. @item mapping
  6460. Set input to output plane mapping. Default is @code{0}.
  6461. The mappings is specified as a bitmap. It should be specified as a
  6462. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  6463. mapping for the first plane of the output stream. 'A' sets the number of
  6464. the input stream to use (from 0 to 3), and 'a' the plane number of the
  6465. corresponding input to use (from 0 to 3). The rest of the mappings is
  6466. similar, 'Bb' describes the mapping for the output stream second
  6467. plane, 'Cc' describes the mapping for the output stream third plane and
  6468. 'Dd' describes the mapping for the output stream fourth plane.
  6469. @item format
  6470. Set output pixel format. Default is @code{yuva444p}.
  6471. @end table
  6472. @subsection Examples
  6473. @itemize
  6474. @item
  6475. Merge three gray video streams of same width and height into single video stream:
  6476. @example
  6477. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  6478. @end example
  6479. @item
  6480. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  6481. @example
  6482. [a0][a1]mergeplanes=0x00010210:yuva444p
  6483. @end example
  6484. @item
  6485. Swap Y and A plane in yuva444p stream:
  6486. @example
  6487. format=yuva444p,mergeplanes=0x03010200:yuva444p
  6488. @end example
  6489. @item
  6490. Swap U and V plane in yuv420p stream:
  6491. @example
  6492. format=yuv420p,mergeplanes=0x000201:yuv420p
  6493. @end example
  6494. @item
  6495. Cast a rgb24 clip to yuv444p:
  6496. @example
  6497. format=rgb24,mergeplanes=0x000102:yuv444p
  6498. @end example
  6499. @end itemize
  6500. @section mpdecimate
  6501. Drop frames that do not differ greatly from the previous frame in
  6502. order to reduce frame rate.
  6503. The main use of this filter is for very-low-bitrate encoding
  6504. (e.g. streaming over dialup modem), but it could in theory be used for
  6505. fixing movies that were inverse-telecined incorrectly.
  6506. A description of the accepted options follows.
  6507. @table @option
  6508. @item max
  6509. Set the maximum number of consecutive frames which can be dropped (if
  6510. positive), or the minimum interval between dropped frames (if
  6511. negative). If the value is 0, the frame is dropped unregarding the
  6512. number of previous sequentially dropped frames.
  6513. Default value is 0.
  6514. @item hi
  6515. @item lo
  6516. @item frac
  6517. Set the dropping threshold values.
  6518. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  6519. represent actual pixel value differences, so a threshold of 64
  6520. corresponds to 1 unit of difference for each pixel, or the same spread
  6521. out differently over the block.
  6522. A frame is a candidate for dropping if no 8x8 blocks differ by more
  6523. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  6524. meaning the whole image) differ by more than a threshold of @option{lo}.
  6525. Default value for @option{hi} is 64*12, default value for @option{lo} is
  6526. 64*5, and default value for @option{frac} is 0.33.
  6527. @end table
  6528. @section negate
  6529. Negate input video.
  6530. It accepts an integer in input; if non-zero it negates the
  6531. alpha component (if available). The default value in input is 0.
  6532. @section noformat
  6533. Force libavfilter not to use any of the specified pixel formats for the
  6534. input to the next filter.
  6535. It accepts the following parameters:
  6536. @table @option
  6537. @item pix_fmts
  6538. A '|'-separated list of pixel format names, such as
  6539. apix_fmts=yuv420p|monow|rgb24".
  6540. @end table
  6541. @subsection Examples
  6542. @itemize
  6543. @item
  6544. Force libavfilter to use a format different from @var{yuv420p} for the
  6545. input to the vflip filter:
  6546. @example
  6547. noformat=pix_fmts=yuv420p,vflip
  6548. @end example
  6549. @item
  6550. Convert the input video to any of the formats not contained in the list:
  6551. @example
  6552. noformat=yuv420p|yuv444p|yuv410p
  6553. @end example
  6554. @end itemize
  6555. @section noise
  6556. Add noise on video input frame.
  6557. The filter accepts the following options:
  6558. @table @option
  6559. @item all_seed
  6560. @item c0_seed
  6561. @item c1_seed
  6562. @item c2_seed
  6563. @item c3_seed
  6564. Set noise seed for specific pixel component or all pixel components in case
  6565. of @var{all_seed}. Default value is @code{123457}.
  6566. @item all_strength, alls
  6567. @item c0_strength, c0s
  6568. @item c1_strength, c1s
  6569. @item c2_strength, c2s
  6570. @item c3_strength, c3s
  6571. Set noise strength for specific pixel component or all pixel components in case
  6572. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  6573. @item all_flags, allf
  6574. @item c0_flags, c0f
  6575. @item c1_flags, c1f
  6576. @item c2_flags, c2f
  6577. @item c3_flags, c3f
  6578. Set pixel component flags or set flags for all components if @var{all_flags}.
  6579. Available values for component flags are:
  6580. @table @samp
  6581. @item a
  6582. averaged temporal noise (smoother)
  6583. @item p
  6584. mix random noise with a (semi)regular pattern
  6585. @item t
  6586. temporal noise (noise pattern changes between frames)
  6587. @item u
  6588. uniform noise (gaussian otherwise)
  6589. @end table
  6590. @end table
  6591. @subsection Examples
  6592. Add temporal and uniform noise to input video:
  6593. @example
  6594. noise=alls=20:allf=t+u
  6595. @end example
  6596. @section null
  6597. Pass the video source unchanged to the output.
  6598. @section ocr
  6599. Optical Character Recognition
  6600. This filter uses Tesseract for optical character recognition.
  6601. It accepts the following options:
  6602. @table @option
  6603. @item datapath
  6604. Set datapath to tesseract data. Default is to use whatever was
  6605. set at installation.
  6606. @item language
  6607. Set language, default is "eng".
  6608. @item whitelist
  6609. Set character whitelist.
  6610. @item blacklist
  6611. Set character blacklist.
  6612. @end table
  6613. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  6614. @section ocv
  6615. Apply a video transform using libopencv.
  6616. To enable this filter, install the libopencv library and headers and
  6617. configure FFmpeg with @code{--enable-libopencv}.
  6618. It accepts the following parameters:
  6619. @table @option
  6620. @item filter_name
  6621. The name of the libopencv filter to apply.
  6622. @item filter_params
  6623. The parameters to pass to the libopencv filter. If not specified, the default
  6624. values are assumed.
  6625. @end table
  6626. Refer to the official libopencv documentation for more precise
  6627. information:
  6628. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  6629. Several libopencv filters are supported; see the following subsections.
  6630. @anchor{dilate}
  6631. @subsection dilate
  6632. Dilate an image by using a specific structuring element.
  6633. It corresponds to the libopencv function @code{cvDilate}.
  6634. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  6635. @var{struct_el} represents a structuring element, and has the syntax:
  6636. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  6637. @var{cols} and @var{rows} represent the number of columns and rows of
  6638. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  6639. point, and @var{shape} the shape for the structuring element. @var{shape}
  6640. must be "rect", "cross", "ellipse", or "custom".
  6641. If the value for @var{shape} is "custom", it must be followed by a
  6642. string of the form "=@var{filename}". The file with name
  6643. @var{filename} is assumed to represent a binary image, with each
  6644. printable character corresponding to a bright pixel. When a custom
  6645. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  6646. or columns and rows of the read file are assumed instead.
  6647. The default value for @var{struct_el} is "3x3+0x0/rect".
  6648. @var{nb_iterations} specifies the number of times the transform is
  6649. applied to the image, and defaults to 1.
  6650. Some examples:
  6651. @example
  6652. # Use the default values
  6653. ocv=dilate
  6654. # Dilate using a structuring element with a 5x5 cross, iterating two times
  6655. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  6656. # Read the shape from the file diamond.shape, iterating two times.
  6657. # The file diamond.shape may contain a pattern of characters like this
  6658. # *
  6659. # ***
  6660. # *****
  6661. # ***
  6662. # *
  6663. # The specified columns and rows are ignored
  6664. # but the anchor point coordinates are not
  6665. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  6666. @end example
  6667. @subsection erode
  6668. Erode an image by using a specific structuring element.
  6669. It corresponds to the libopencv function @code{cvErode}.
  6670. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  6671. with the same syntax and semantics as the @ref{dilate} filter.
  6672. @subsection smooth
  6673. Smooth the input video.
  6674. The filter takes the following parameters:
  6675. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  6676. @var{type} is the type of smooth filter to apply, and must be one of
  6677. the following values: "blur", "blur_no_scale", "median", "gaussian",
  6678. or "bilateral". The default value is "gaussian".
  6679. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  6680. depend on the smooth type. @var{param1} and
  6681. @var{param2} accept integer positive values or 0. @var{param3} and
  6682. @var{param4} accept floating point values.
  6683. The default value for @var{param1} is 3. The default value for the
  6684. other parameters is 0.
  6685. These parameters correspond to the parameters assigned to the
  6686. libopencv function @code{cvSmooth}.
  6687. @anchor{overlay}
  6688. @section overlay
  6689. Overlay one video on top of another.
  6690. It takes two inputs and has one output. The first input is the "main"
  6691. video on which the second input is overlaid.
  6692. It accepts the following parameters:
  6693. A description of the accepted options follows.
  6694. @table @option
  6695. @item x
  6696. @item y
  6697. Set the expression for the x and y coordinates of the overlaid video
  6698. on the main video. Default value is "0" for both expressions. In case
  6699. the expression is invalid, it is set to a huge value (meaning that the
  6700. overlay will not be displayed within the output visible area).
  6701. @item eof_action
  6702. The action to take when EOF is encountered on the secondary input; it accepts
  6703. one of the following values:
  6704. @table @option
  6705. @item repeat
  6706. Repeat the last frame (the default).
  6707. @item endall
  6708. End both streams.
  6709. @item pass
  6710. Pass the main input through.
  6711. @end table
  6712. @item eval
  6713. Set when the expressions for @option{x}, and @option{y} are evaluated.
  6714. It accepts the following values:
  6715. @table @samp
  6716. @item init
  6717. only evaluate expressions once during the filter initialization or
  6718. when a command is processed
  6719. @item frame
  6720. evaluate expressions for each incoming frame
  6721. @end table
  6722. Default value is @samp{frame}.
  6723. @item shortest
  6724. If set to 1, force the output to terminate when the shortest input
  6725. terminates. Default value is 0.
  6726. @item format
  6727. Set the format for the output video.
  6728. It accepts the following values:
  6729. @table @samp
  6730. @item yuv420
  6731. force YUV420 output
  6732. @item yuv422
  6733. force YUV422 output
  6734. @item yuv444
  6735. force YUV444 output
  6736. @item rgb
  6737. force RGB output
  6738. @end table
  6739. Default value is @samp{yuv420}.
  6740. @item rgb @emph{(deprecated)}
  6741. If set to 1, force the filter to accept inputs in the RGB
  6742. color space. Default value is 0. This option is deprecated, use
  6743. @option{format} instead.
  6744. @item repeatlast
  6745. If set to 1, force the filter to draw the last overlay frame over the
  6746. main input until the end of the stream. A value of 0 disables this
  6747. behavior. Default value is 1.
  6748. @end table
  6749. The @option{x}, and @option{y} expressions can contain the following
  6750. parameters.
  6751. @table @option
  6752. @item main_w, W
  6753. @item main_h, H
  6754. The main input width and height.
  6755. @item overlay_w, w
  6756. @item overlay_h, h
  6757. The overlay input width and height.
  6758. @item x
  6759. @item y
  6760. The computed values for @var{x} and @var{y}. They are evaluated for
  6761. each new frame.
  6762. @item hsub
  6763. @item vsub
  6764. horizontal and vertical chroma subsample values of the output
  6765. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  6766. @var{vsub} is 1.
  6767. @item n
  6768. the number of input frame, starting from 0
  6769. @item pos
  6770. the position in the file of the input frame, NAN if unknown
  6771. @item t
  6772. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  6773. @end table
  6774. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  6775. when evaluation is done @emph{per frame}, and will evaluate to NAN
  6776. when @option{eval} is set to @samp{init}.
  6777. Be aware that frames are taken from each input video in timestamp
  6778. order, hence, if their initial timestamps differ, it is a good idea
  6779. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  6780. have them begin in the same zero timestamp, as the example for
  6781. the @var{movie} filter does.
  6782. You can chain together more overlays but you should test the
  6783. efficiency of such approach.
  6784. @subsection Commands
  6785. This filter supports the following commands:
  6786. @table @option
  6787. @item x
  6788. @item y
  6789. Modify the x and y of the overlay input.
  6790. The command accepts the same syntax of the corresponding option.
  6791. If the specified expression is not valid, it is kept at its current
  6792. value.
  6793. @end table
  6794. @subsection Examples
  6795. @itemize
  6796. @item
  6797. Draw the overlay at 10 pixels from the bottom right corner of the main
  6798. video:
  6799. @example
  6800. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  6801. @end example
  6802. Using named options the example above becomes:
  6803. @example
  6804. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  6805. @end example
  6806. @item
  6807. Insert a transparent PNG logo in the bottom left corner of the input,
  6808. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  6809. @example
  6810. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  6811. @end example
  6812. @item
  6813. Insert 2 different transparent PNG logos (second logo on bottom
  6814. right corner) using the @command{ffmpeg} tool:
  6815. @example
  6816. 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
  6817. @end example
  6818. @item
  6819. Add a transparent color layer on top of the main video; @code{WxH}
  6820. must specify the size of the main input to the overlay filter:
  6821. @example
  6822. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  6823. @end example
  6824. @item
  6825. Play an original video and a filtered version (here with the deshake
  6826. filter) side by side using the @command{ffplay} tool:
  6827. @example
  6828. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  6829. @end example
  6830. The above command is the same as:
  6831. @example
  6832. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  6833. @end example
  6834. @item
  6835. Make a sliding overlay appearing from the left to the right top part of the
  6836. screen starting since time 2:
  6837. @example
  6838. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  6839. @end example
  6840. @item
  6841. Compose output by putting two input videos side to side:
  6842. @example
  6843. ffmpeg -i left.avi -i right.avi -filter_complex "
  6844. nullsrc=size=200x100 [background];
  6845. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  6846. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  6847. [background][left] overlay=shortest=1 [background+left];
  6848. [background+left][right] overlay=shortest=1:x=100 [left+right]
  6849. "
  6850. @end example
  6851. @item
  6852. Mask 10-20 seconds of a video by applying the delogo filter to a section
  6853. @example
  6854. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  6855. -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]'
  6856. masked.avi
  6857. @end example
  6858. @item
  6859. Chain several overlays in cascade:
  6860. @example
  6861. nullsrc=s=200x200 [bg];
  6862. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  6863. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  6864. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  6865. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  6866. [in3] null, [mid2] overlay=100:100 [out0]
  6867. @end example
  6868. @end itemize
  6869. @section owdenoise
  6870. Apply Overcomplete Wavelet denoiser.
  6871. The filter accepts the following options:
  6872. @table @option
  6873. @item depth
  6874. Set depth.
  6875. Larger depth values will denoise lower frequency components more, but
  6876. slow down filtering.
  6877. Must be an int in the range 8-16, default is @code{8}.
  6878. @item luma_strength, ls
  6879. Set luma strength.
  6880. Must be a double value in the range 0-1000, default is @code{1.0}.
  6881. @item chroma_strength, cs
  6882. Set chroma strength.
  6883. Must be a double value in the range 0-1000, default is @code{1.0}.
  6884. @end table
  6885. @anchor{pad}
  6886. @section pad
  6887. Add paddings to the input image, and place the original input at the
  6888. provided @var{x}, @var{y} coordinates.
  6889. It accepts the following parameters:
  6890. @table @option
  6891. @item width, w
  6892. @item height, h
  6893. Specify an expression for the size of the output image with the
  6894. paddings added. If the value for @var{width} or @var{height} is 0, the
  6895. corresponding input size is used for the output.
  6896. The @var{width} expression can reference the value set by the
  6897. @var{height} expression, and vice versa.
  6898. The default value of @var{width} and @var{height} is 0.
  6899. @item x
  6900. @item y
  6901. Specify the offsets to place the input image at within the padded area,
  6902. with respect to the top/left border of the output image.
  6903. The @var{x} expression can reference the value set by the @var{y}
  6904. expression, and vice versa.
  6905. The default value of @var{x} and @var{y} is 0.
  6906. @item color
  6907. Specify the color of the padded area. For the syntax of this option,
  6908. check the "Color" section in the ffmpeg-utils manual.
  6909. The default value of @var{color} is "black".
  6910. @end table
  6911. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  6912. options are expressions containing the following constants:
  6913. @table @option
  6914. @item in_w
  6915. @item in_h
  6916. The input video width and height.
  6917. @item iw
  6918. @item ih
  6919. These are the same as @var{in_w} and @var{in_h}.
  6920. @item out_w
  6921. @item out_h
  6922. The output width and height (the size of the padded area), as
  6923. specified by the @var{width} and @var{height} expressions.
  6924. @item ow
  6925. @item oh
  6926. These are the same as @var{out_w} and @var{out_h}.
  6927. @item x
  6928. @item y
  6929. The x and y offsets as specified by the @var{x} and @var{y}
  6930. expressions, or NAN if not yet specified.
  6931. @item a
  6932. same as @var{iw} / @var{ih}
  6933. @item sar
  6934. input sample aspect ratio
  6935. @item dar
  6936. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  6937. @item hsub
  6938. @item vsub
  6939. The horizontal and vertical chroma subsample values. For example for the
  6940. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6941. @end table
  6942. @subsection Examples
  6943. @itemize
  6944. @item
  6945. Add paddings with the color "violet" to the input video. The output video
  6946. size is 640x480, and the top-left corner of the input video is placed at
  6947. column 0, row 40
  6948. @example
  6949. pad=640:480:0:40:violet
  6950. @end example
  6951. The example above is equivalent to the following command:
  6952. @example
  6953. pad=width=640:height=480:x=0:y=40:color=violet
  6954. @end example
  6955. @item
  6956. Pad the input to get an output with dimensions increased by 3/2,
  6957. and put the input video at the center of the padded area:
  6958. @example
  6959. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  6960. @end example
  6961. @item
  6962. Pad the input to get a squared output with size equal to the maximum
  6963. value between the input width and height, and put the input video at
  6964. the center of the padded area:
  6965. @example
  6966. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  6967. @end example
  6968. @item
  6969. Pad the input to get a final w/h ratio of 16:9:
  6970. @example
  6971. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  6972. @end example
  6973. @item
  6974. In case of anamorphic video, in order to set the output display aspect
  6975. correctly, it is necessary to use @var{sar} in the expression,
  6976. according to the relation:
  6977. @example
  6978. (ih * X / ih) * sar = output_dar
  6979. X = output_dar / sar
  6980. @end example
  6981. Thus the previous example needs to be modified to:
  6982. @example
  6983. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  6984. @end example
  6985. @item
  6986. Double the output size and put the input video in the bottom-right
  6987. corner of the output padded area:
  6988. @example
  6989. pad="2*iw:2*ih:ow-iw:oh-ih"
  6990. @end example
  6991. @end itemize
  6992. @anchor{palettegen}
  6993. @section palettegen
  6994. Generate one palette for a whole video stream.
  6995. It accepts the following options:
  6996. @table @option
  6997. @item max_colors
  6998. Set the maximum number of colors to quantize in the palette.
  6999. Note: the palette will still contain 256 colors; the unused palette entries
  7000. will be black.
  7001. @item reserve_transparent
  7002. Create a palette of 255 colors maximum and reserve the last one for
  7003. transparency. Reserving the transparency color is useful for GIF optimization.
  7004. If not set, the maximum of colors in the palette will be 256. You probably want
  7005. to disable this option for a standalone image.
  7006. Set by default.
  7007. @item stats_mode
  7008. Set statistics mode.
  7009. It accepts the following values:
  7010. @table @samp
  7011. @item full
  7012. Compute full frame histograms.
  7013. @item diff
  7014. Compute histograms only for the part that differs from previous frame. This
  7015. might be relevant to give more importance to the moving part of your input if
  7016. the background is static.
  7017. @end table
  7018. Default value is @var{full}.
  7019. @end table
  7020. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  7021. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  7022. color quantization of the palette. This information is also visible at
  7023. @var{info} logging level.
  7024. @subsection Examples
  7025. @itemize
  7026. @item
  7027. Generate a representative palette of a given video using @command{ffmpeg}:
  7028. @example
  7029. ffmpeg -i input.mkv -vf palettegen palette.png
  7030. @end example
  7031. @end itemize
  7032. @section paletteuse
  7033. Use a palette to downsample an input video stream.
  7034. The filter takes two inputs: one video stream and a palette. The palette must
  7035. be a 256 pixels image.
  7036. It accepts the following options:
  7037. @table @option
  7038. @item dither
  7039. Select dithering mode. Available algorithms are:
  7040. @table @samp
  7041. @item bayer
  7042. Ordered 8x8 bayer dithering (deterministic)
  7043. @item heckbert
  7044. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  7045. Note: this dithering is sometimes considered "wrong" and is included as a
  7046. reference.
  7047. @item floyd_steinberg
  7048. Floyd and Steingberg dithering (error diffusion)
  7049. @item sierra2
  7050. Frankie Sierra dithering v2 (error diffusion)
  7051. @item sierra2_4a
  7052. Frankie Sierra dithering v2 "Lite" (error diffusion)
  7053. @end table
  7054. Default is @var{sierra2_4a}.
  7055. @item bayer_scale
  7056. When @var{bayer} dithering is selected, this option defines the scale of the
  7057. pattern (how much the crosshatch pattern is visible). A low value means more
  7058. visible pattern for less banding, and higher value means less visible pattern
  7059. at the cost of more banding.
  7060. The option must be an integer value in the range [0,5]. Default is @var{2}.
  7061. @item diff_mode
  7062. If set, define the zone to process
  7063. @table @samp
  7064. @item rectangle
  7065. Only the changing rectangle will be reprocessed. This is similar to GIF
  7066. cropping/offsetting compression mechanism. This option can be useful for speed
  7067. if only a part of the image is changing, and has use cases such as limiting the
  7068. scope of the error diffusal @option{dither} to the rectangle that bounds the
  7069. moving scene (it leads to more deterministic output if the scene doesn't change
  7070. much, and as a result less moving noise and better GIF compression).
  7071. @end table
  7072. Default is @var{none}.
  7073. @end table
  7074. @subsection Examples
  7075. @itemize
  7076. @item
  7077. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  7078. using @command{ffmpeg}:
  7079. @example
  7080. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  7081. @end example
  7082. @end itemize
  7083. @section perspective
  7084. Correct perspective of video not recorded perpendicular to the screen.
  7085. A description of the accepted parameters follows.
  7086. @table @option
  7087. @item x0
  7088. @item y0
  7089. @item x1
  7090. @item y1
  7091. @item x2
  7092. @item y2
  7093. @item x3
  7094. @item y3
  7095. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  7096. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  7097. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  7098. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  7099. then the corners of the source will be sent to the specified coordinates.
  7100. The expressions can use the following variables:
  7101. @table @option
  7102. @item W
  7103. @item H
  7104. the width and height of video frame.
  7105. @end table
  7106. @item interpolation
  7107. Set interpolation for perspective correction.
  7108. It accepts the following values:
  7109. @table @samp
  7110. @item linear
  7111. @item cubic
  7112. @end table
  7113. Default value is @samp{linear}.
  7114. @item sense
  7115. Set interpretation of coordinate options.
  7116. It accepts the following values:
  7117. @table @samp
  7118. @item 0, source
  7119. Send point in the source specified by the given coordinates to
  7120. the corners of the destination.
  7121. @item 1, destination
  7122. Send the corners of the source to the point in the destination specified
  7123. by the given coordinates.
  7124. Default value is @samp{source}.
  7125. @end table
  7126. @end table
  7127. @section phase
  7128. Delay interlaced video by one field time so that the field order changes.
  7129. The intended use is to fix PAL movies that have been captured with the
  7130. opposite field order to the film-to-video transfer.
  7131. A description of the accepted parameters follows.
  7132. @table @option
  7133. @item mode
  7134. Set phase mode.
  7135. It accepts the following values:
  7136. @table @samp
  7137. @item t
  7138. Capture field order top-first, transfer bottom-first.
  7139. Filter will delay the bottom field.
  7140. @item b
  7141. Capture field order bottom-first, transfer top-first.
  7142. Filter will delay the top field.
  7143. @item p
  7144. Capture and transfer with the same field order. This mode only exists
  7145. for the documentation of the other options to refer to, but if you
  7146. actually select it, the filter will faithfully do nothing.
  7147. @item a
  7148. Capture field order determined automatically by field flags, transfer
  7149. opposite.
  7150. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  7151. basis using field flags. If no field information is available,
  7152. then this works just like @samp{u}.
  7153. @item u
  7154. Capture unknown or varying, transfer opposite.
  7155. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  7156. analyzing the images and selecting the alternative that produces best
  7157. match between the fields.
  7158. @item T
  7159. Capture top-first, transfer unknown or varying.
  7160. Filter selects among @samp{t} and @samp{p} using image analysis.
  7161. @item B
  7162. Capture bottom-first, transfer unknown or varying.
  7163. Filter selects among @samp{b} and @samp{p} using image analysis.
  7164. @item A
  7165. Capture determined by field flags, transfer unknown or varying.
  7166. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  7167. image analysis. If no field information is available, then this works just
  7168. like @samp{U}. This is the default mode.
  7169. @item U
  7170. Both capture and transfer unknown or varying.
  7171. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  7172. @end table
  7173. @end table
  7174. @section pixdesctest
  7175. Pixel format descriptor test filter, mainly useful for internal
  7176. testing. The output video should be equal to the input video.
  7177. For example:
  7178. @example
  7179. format=monow, pixdesctest
  7180. @end example
  7181. can be used to test the monowhite pixel format descriptor definition.
  7182. @section pp
  7183. Enable the specified chain of postprocessing subfilters using libpostproc. This
  7184. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  7185. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  7186. Each subfilter and some options have a short and a long name that can be used
  7187. interchangeably, i.e. dr/dering are the same.
  7188. The filters accept the following options:
  7189. @table @option
  7190. @item subfilters
  7191. Set postprocessing subfilters string.
  7192. @end table
  7193. All subfilters share common options to determine their scope:
  7194. @table @option
  7195. @item a/autoq
  7196. Honor the quality commands for this subfilter.
  7197. @item c/chrom
  7198. Do chrominance filtering, too (default).
  7199. @item y/nochrom
  7200. Do luminance filtering only (no chrominance).
  7201. @item n/noluma
  7202. Do chrominance filtering only (no luminance).
  7203. @end table
  7204. These options can be appended after the subfilter name, separated by a '|'.
  7205. Available subfilters are:
  7206. @table @option
  7207. @item hb/hdeblock[|difference[|flatness]]
  7208. Horizontal deblocking filter
  7209. @table @option
  7210. @item difference
  7211. Difference factor where higher values mean more deblocking (default: @code{32}).
  7212. @item flatness
  7213. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  7214. @end table
  7215. @item vb/vdeblock[|difference[|flatness]]
  7216. Vertical deblocking filter
  7217. @table @option
  7218. @item difference
  7219. Difference factor where higher values mean more deblocking (default: @code{32}).
  7220. @item flatness
  7221. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  7222. @end table
  7223. @item ha/hadeblock[|difference[|flatness]]
  7224. Accurate horizontal deblocking filter
  7225. @table @option
  7226. @item difference
  7227. Difference factor where higher values mean more deblocking (default: @code{32}).
  7228. @item flatness
  7229. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  7230. @end table
  7231. @item va/vadeblock[|difference[|flatness]]
  7232. Accurate vertical deblocking filter
  7233. @table @option
  7234. @item difference
  7235. Difference factor where higher values mean more deblocking (default: @code{32}).
  7236. @item flatness
  7237. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  7238. @end table
  7239. @end table
  7240. The horizontal and vertical deblocking filters share the difference and
  7241. flatness values so you cannot set different horizontal and vertical
  7242. thresholds.
  7243. @table @option
  7244. @item h1/x1hdeblock
  7245. Experimental horizontal deblocking filter
  7246. @item v1/x1vdeblock
  7247. Experimental vertical deblocking filter
  7248. @item dr/dering
  7249. Deringing filter
  7250. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  7251. @table @option
  7252. @item threshold1
  7253. larger -> stronger filtering
  7254. @item threshold2
  7255. larger -> stronger filtering
  7256. @item threshold3
  7257. larger -> stronger filtering
  7258. @end table
  7259. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  7260. @table @option
  7261. @item f/fullyrange
  7262. Stretch luminance to @code{0-255}.
  7263. @end table
  7264. @item lb/linblenddeint
  7265. Linear blend deinterlacing filter that deinterlaces the given block by
  7266. filtering all lines with a @code{(1 2 1)} filter.
  7267. @item li/linipoldeint
  7268. Linear interpolating deinterlacing filter that deinterlaces the given block by
  7269. linearly interpolating every second line.
  7270. @item ci/cubicipoldeint
  7271. Cubic interpolating deinterlacing filter deinterlaces the given block by
  7272. cubically interpolating every second line.
  7273. @item md/mediandeint
  7274. Median deinterlacing filter that deinterlaces the given block by applying a
  7275. median filter to every second line.
  7276. @item fd/ffmpegdeint
  7277. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  7278. second line with a @code{(-1 4 2 4 -1)} filter.
  7279. @item l5/lowpass5
  7280. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  7281. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  7282. @item fq/forceQuant[|quantizer]
  7283. Overrides the quantizer table from the input with the constant quantizer you
  7284. specify.
  7285. @table @option
  7286. @item quantizer
  7287. Quantizer to use
  7288. @end table
  7289. @item de/default
  7290. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  7291. @item fa/fast
  7292. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  7293. @item ac
  7294. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  7295. @end table
  7296. @subsection Examples
  7297. @itemize
  7298. @item
  7299. Apply horizontal and vertical deblocking, deringing and automatic
  7300. brightness/contrast:
  7301. @example
  7302. pp=hb/vb/dr/al
  7303. @end example
  7304. @item
  7305. Apply default filters without brightness/contrast correction:
  7306. @example
  7307. pp=de/-al
  7308. @end example
  7309. @item
  7310. Apply default filters and temporal denoiser:
  7311. @example
  7312. pp=default/tmpnoise|1|2|3
  7313. @end example
  7314. @item
  7315. Apply deblocking on luminance only, and switch vertical deblocking on or off
  7316. automatically depending on available CPU time:
  7317. @example
  7318. pp=hb|y/vb|a
  7319. @end example
  7320. @end itemize
  7321. @section pp7
  7322. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  7323. similar to spp = 6 with 7 point DCT, where only the center sample is
  7324. used after IDCT.
  7325. The filter accepts the following options:
  7326. @table @option
  7327. @item qp
  7328. Force a constant quantization parameter. It accepts an integer in range
  7329. 0 to 63. If not set, the filter will use the QP from the video stream
  7330. (if available).
  7331. @item mode
  7332. Set thresholding mode. Available modes are:
  7333. @table @samp
  7334. @item hard
  7335. Set hard thresholding.
  7336. @item soft
  7337. Set soft thresholding (better de-ringing effect, but likely blurrier).
  7338. @item medium
  7339. Set medium thresholding (good results, default).
  7340. @end table
  7341. @end table
  7342. @section psnr
  7343. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  7344. Ratio) between two input videos.
  7345. This filter takes in input two input videos, the first input is
  7346. considered the "main" source and is passed unchanged to the
  7347. output. The second input is used as a "reference" video for computing
  7348. the PSNR.
  7349. Both video inputs must have the same resolution and pixel format for
  7350. this filter to work correctly. Also it assumes that both inputs
  7351. have the same number of frames, which are compared one by one.
  7352. The obtained average PSNR is printed through the logging system.
  7353. The filter stores the accumulated MSE (mean squared error) of each
  7354. frame, and at the end of the processing it is averaged across all frames
  7355. equally, and the following formula is applied to obtain the PSNR:
  7356. @example
  7357. PSNR = 10*log10(MAX^2/MSE)
  7358. @end example
  7359. Where MAX is the average of the maximum values of each component of the
  7360. image.
  7361. The description of the accepted parameters follows.
  7362. @table @option
  7363. @item stats_file, f
  7364. If specified the filter will use the named file to save the PSNR of
  7365. each individual frame. When filename equals "-" the data is sent to
  7366. standard output.
  7367. @end table
  7368. The file printed if @var{stats_file} is selected, contains a sequence of
  7369. key/value pairs of the form @var{key}:@var{value} for each compared
  7370. couple of frames.
  7371. A description of each shown parameter follows:
  7372. @table @option
  7373. @item n
  7374. sequential number of the input frame, starting from 1
  7375. @item mse_avg
  7376. Mean Square Error pixel-by-pixel average difference of the compared
  7377. frames, averaged over all the image components.
  7378. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  7379. Mean Square Error pixel-by-pixel average difference of the compared
  7380. frames for the component specified by the suffix.
  7381. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  7382. Peak Signal to Noise ratio of the compared frames for the component
  7383. specified by the suffix.
  7384. @end table
  7385. For example:
  7386. @example
  7387. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  7388. [main][ref] psnr="stats_file=stats.log" [out]
  7389. @end example
  7390. On this example the input file being processed is compared with the
  7391. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  7392. is stored in @file{stats.log}.
  7393. @anchor{pullup}
  7394. @section pullup
  7395. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  7396. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  7397. content.
  7398. The pullup filter is designed to take advantage of future context in making
  7399. its decisions. This filter is stateless in the sense that it does not lock
  7400. onto a pattern to follow, but it instead looks forward to the following
  7401. fields in order to identify matches and rebuild progressive frames.
  7402. To produce content with an even framerate, insert the fps filter after
  7403. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  7404. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  7405. The filter accepts the following options:
  7406. @table @option
  7407. @item jl
  7408. @item jr
  7409. @item jt
  7410. @item jb
  7411. These options set the amount of "junk" to ignore at the left, right, top, and
  7412. bottom of the image, respectively. Left and right are in units of 8 pixels,
  7413. while top and bottom are in units of 2 lines.
  7414. The default is 8 pixels on each side.
  7415. @item sb
  7416. Set the strict breaks. Setting this option to 1 will reduce the chances of
  7417. filter generating an occasional mismatched frame, but it may also cause an
  7418. excessive number of frames to be dropped during high motion sequences.
  7419. Conversely, setting it to -1 will make filter match fields more easily.
  7420. This may help processing of video where there is slight blurring between
  7421. the fields, but may also cause there to be interlaced frames in the output.
  7422. Default value is @code{0}.
  7423. @item mp
  7424. Set the metric plane to use. It accepts the following values:
  7425. @table @samp
  7426. @item l
  7427. Use luma plane.
  7428. @item u
  7429. Use chroma blue plane.
  7430. @item v
  7431. Use chroma red plane.
  7432. @end table
  7433. This option may be set to use chroma plane instead of the default luma plane
  7434. for doing filter's computations. This may improve accuracy on very clean
  7435. source material, but more likely will decrease accuracy, especially if there
  7436. is chroma noise (rainbow effect) or any grayscale video.
  7437. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  7438. load and make pullup usable in realtime on slow machines.
  7439. @end table
  7440. For best results (without duplicated frames in the output file) it is
  7441. necessary to change the output frame rate. For example, to inverse
  7442. telecine NTSC input:
  7443. @example
  7444. ffmpeg -i input -vf pullup -r 24000/1001 ...
  7445. @end example
  7446. @section qp
  7447. Change video quantization parameters (QP).
  7448. The filter accepts the following option:
  7449. @table @option
  7450. @item qp
  7451. Set expression for quantization parameter.
  7452. @end table
  7453. The expression is evaluated through the eval API and can contain, among others,
  7454. the following constants:
  7455. @table @var
  7456. @item known
  7457. 1 if index is not 129, 0 otherwise.
  7458. @item qp
  7459. Sequentional index starting from -129 to 128.
  7460. @end table
  7461. @subsection Examples
  7462. @itemize
  7463. @item
  7464. Some equation like:
  7465. @example
  7466. qp=2+2*sin(PI*qp)
  7467. @end example
  7468. @end itemize
  7469. @section random
  7470. Flush video frames from internal cache of frames into a random order.
  7471. No frame is discarded.
  7472. Inspired by @ref{frei0r} nervous filter.
  7473. @table @option
  7474. @item frames
  7475. Set size in number of frames of internal cache, in range from @code{2} to
  7476. @code{512}. Default is @code{30}.
  7477. @item seed
  7478. Set seed for random number generator, must be an integer included between
  7479. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  7480. less than @code{0}, the filter will try to use a good random seed on a
  7481. best effort basis.
  7482. @end table
  7483. @section removegrain
  7484. The removegrain filter is a spatial denoiser for progressive video.
  7485. @table @option
  7486. @item m0
  7487. Set mode for the first plane.
  7488. @item m1
  7489. Set mode for the second plane.
  7490. @item m2
  7491. Set mode for the third plane.
  7492. @item m3
  7493. Set mode for the fourth plane.
  7494. @end table
  7495. Range of mode is from 0 to 24. Description of each mode follows:
  7496. @table @var
  7497. @item 0
  7498. Leave input plane unchanged. Default.
  7499. @item 1
  7500. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  7501. @item 2
  7502. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  7503. @item 3
  7504. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  7505. @item 4
  7506. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  7507. This is equivalent to a median filter.
  7508. @item 5
  7509. Line-sensitive clipping giving the minimal change.
  7510. @item 6
  7511. Line-sensitive clipping, intermediate.
  7512. @item 7
  7513. Line-sensitive clipping, intermediate.
  7514. @item 8
  7515. Line-sensitive clipping, intermediate.
  7516. @item 9
  7517. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  7518. @item 10
  7519. Replaces the target pixel with the closest neighbour.
  7520. @item 11
  7521. [1 2 1] horizontal and vertical kernel blur.
  7522. @item 12
  7523. Same as mode 11.
  7524. @item 13
  7525. Bob mode, interpolates top field from the line where the neighbours
  7526. pixels are the closest.
  7527. @item 14
  7528. Bob mode, interpolates bottom field from the line where the neighbours
  7529. pixels are the closest.
  7530. @item 15
  7531. Bob mode, interpolates top field. Same as 13 but with a more complicated
  7532. interpolation formula.
  7533. @item 16
  7534. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  7535. interpolation formula.
  7536. @item 17
  7537. Clips the pixel with the minimum and maximum of respectively the maximum and
  7538. minimum of each pair of opposite neighbour pixels.
  7539. @item 18
  7540. Line-sensitive clipping using opposite neighbours whose greatest distance from
  7541. the current pixel is minimal.
  7542. @item 19
  7543. Replaces the pixel with the average of its 8 neighbours.
  7544. @item 20
  7545. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  7546. @item 21
  7547. Clips pixels using the averages of opposite neighbour.
  7548. @item 22
  7549. Same as mode 21 but simpler and faster.
  7550. @item 23
  7551. Small edge and halo removal, but reputed useless.
  7552. @item 24
  7553. Similar as 23.
  7554. @end table
  7555. @section removelogo
  7556. Suppress a TV station logo, using an image file to determine which
  7557. pixels comprise the logo. It works by filling in the pixels that
  7558. comprise the logo with neighboring pixels.
  7559. The filter accepts the following options:
  7560. @table @option
  7561. @item filename, f
  7562. Set the filter bitmap file, which can be any image format supported by
  7563. libavformat. The width and height of the image file must match those of the
  7564. video stream being processed.
  7565. @end table
  7566. Pixels in the provided bitmap image with a value of zero are not
  7567. considered part of the logo, non-zero pixels are considered part of
  7568. the logo. If you use white (255) for the logo and black (0) for the
  7569. rest, you will be safe. For making the filter bitmap, it is
  7570. recommended to take a screen capture of a black frame with the logo
  7571. visible, and then using a threshold filter followed by the erode
  7572. filter once or twice.
  7573. If needed, little splotches can be fixed manually. Remember that if
  7574. logo pixels are not covered, the filter quality will be much
  7575. reduced. Marking too many pixels as part of the logo does not hurt as
  7576. much, but it will increase the amount of blurring needed to cover over
  7577. the image and will destroy more information than necessary, and extra
  7578. pixels will slow things down on a large logo.
  7579. @section repeatfields
  7580. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  7581. fields based on its value.
  7582. @section reverse, areverse
  7583. Reverse a clip.
  7584. Warning: This filter requires memory to buffer the entire clip, so trimming
  7585. is suggested.
  7586. @subsection Examples
  7587. @itemize
  7588. @item
  7589. Take the first 5 seconds of a clip, and reverse it.
  7590. @example
  7591. trim=end=5,reverse
  7592. @end example
  7593. @end itemize
  7594. @section rotate
  7595. Rotate video by an arbitrary angle expressed in radians.
  7596. The filter accepts the following options:
  7597. A description of the optional parameters follows.
  7598. @table @option
  7599. @item angle, a
  7600. Set an expression for the angle by which to rotate the input video
  7601. clockwise, expressed as a number of radians. A negative value will
  7602. result in a counter-clockwise rotation. By default it is set to "0".
  7603. This expression is evaluated for each frame.
  7604. @item out_w, ow
  7605. Set the output width expression, default value is "iw".
  7606. This expression is evaluated just once during configuration.
  7607. @item out_h, oh
  7608. Set the output height expression, default value is "ih".
  7609. This expression is evaluated just once during configuration.
  7610. @item bilinear
  7611. Enable bilinear interpolation if set to 1, a value of 0 disables
  7612. it. Default value is 1.
  7613. @item fillcolor, c
  7614. Set the color used to fill the output area not covered by the rotated
  7615. image. For the general syntax of this option, check the "Color" section in the
  7616. ffmpeg-utils manual. If the special value "none" is selected then no
  7617. background is printed (useful for example if the background is never shown).
  7618. Default value is "black".
  7619. @end table
  7620. The expressions for the angle and the output size can contain the
  7621. following constants and functions:
  7622. @table @option
  7623. @item n
  7624. sequential number of the input frame, starting from 0. It is always NAN
  7625. before the first frame is filtered.
  7626. @item t
  7627. time in seconds of the input frame, it is set to 0 when the filter is
  7628. configured. It is always NAN before the first frame is filtered.
  7629. @item hsub
  7630. @item vsub
  7631. horizontal and vertical chroma subsample values. For example for the
  7632. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7633. @item in_w, iw
  7634. @item in_h, ih
  7635. the input video width and height
  7636. @item out_w, ow
  7637. @item out_h, oh
  7638. the output width and height, that is the size of the padded area as
  7639. specified by the @var{width} and @var{height} expressions
  7640. @item rotw(a)
  7641. @item roth(a)
  7642. the minimal width/height required for completely containing the input
  7643. video rotated by @var{a} radians.
  7644. These are only available when computing the @option{out_w} and
  7645. @option{out_h} expressions.
  7646. @end table
  7647. @subsection Examples
  7648. @itemize
  7649. @item
  7650. Rotate the input by PI/6 radians clockwise:
  7651. @example
  7652. rotate=PI/6
  7653. @end example
  7654. @item
  7655. Rotate the input by PI/6 radians counter-clockwise:
  7656. @example
  7657. rotate=-PI/6
  7658. @end example
  7659. @item
  7660. Rotate the input by 45 degrees clockwise:
  7661. @example
  7662. rotate=45*PI/180
  7663. @end example
  7664. @item
  7665. Apply a constant rotation with period T, starting from an angle of PI/3:
  7666. @example
  7667. rotate=PI/3+2*PI*t/T
  7668. @end example
  7669. @item
  7670. Make the input video rotation oscillating with a period of T
  7671. seconds and an amplitude of A radians:
  7672. @example
  7673. rotate=A*sin(2*PI/T*t)
  7674. @end example
  7675. @item
  7676. Rotate the video, output size is chosen so that the whole rotating
  7677. input video is always completely contained in the output:
  7678. @example
  7679. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  7680. @end example
  7681. @item
  7682. Rotate the video, reduce the output size so that no background is ever
  7683. shown:
  7684. @example
  7685. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  7686. @end example
  7687. @end itemize
  7688. @subsection Commands
  7689. The filter supports the following commands:
  7690. @table @option
  7691. @item a, angle
  7692. Set the angle expression.
  7693. The command accepts the same syntax of the corresponding option.
  7694. If the specified expression is not valid, it is kept at its current
  7695. value.
  7696. @end table
  7697. @section sab
  7698. Apply Shape Adaptive Blur.
  7699. The filter accepts the following options:
  7700. @table @option
  7701. @item luma_radius, lr
  7702. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  7703. value is 1.0. A greater value will result in a more blurred image, and
  7704. in slower processing.
  7705. @item luma_pre_filter_radius, lpfr
  7706. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  7707. value is 1.0.
  7708. @item luma_strength, ls
  7709. Set luma maximum difference between pixels to still be considered, must
  7710. be a value in the 0.1-100.0 range, default value is 1.0.
  7711. @item chroma_radius, cr
  7712. Set chroma blur filter strength, must be a value in range 0.1-4.0. A
  7713. greater value will result in a more blurred image, and in slower
  7714. processing.
  7715. @item chroma_pre_filter_radius, cpfr
  7716. Set chroma pre-filter radius, must be a value in the 0.1-2.0 range.
  7717. @item chroma_strength, cs
  7718. Set chroma maximum difference between pixels to still be considered,
  7719. must be a value in the 0.1-100.0 range.
  7720. @end table
  7721. Each chroma option value, if not explicitly specified, is set to the
  7722. corresponding luma option value.
  7723. @anchor{scale}
  7724. @section scale
  7725. Scale (resize) the input video, using the libswscale library.
  7726. The scale filter forces the output display aspect ratio to be the same
  7727. of the input, by changing the output sample aspect ratio.
  7728. If the input image format is different from the format requested by
  7729. the next filter, the scale filter will convert the input to the
  7730. requested format.
  7731. @subsection Options
  7732. The filter accepts the following options, or any of the options
  7733. supported by the libswscale scaler.
  7734. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  7735. the complete list of scaler options.
  7736. @table @option
  7737. @item width, w
  7738. @item height, h
  7739. Set the output video dimension expression. Default value is the input
  7740. dimension.
  7741. If the value is 0, the input width is used for the output.
  7742. If one of the values is -1, the scale filter will use a value that
  7743. maintains the aspect ratio of the input image, calculated from the
  7744. other specified dimension. If both of them are -1, the input size is
  7745. used
  7746. If one of the values is -n with n > 1, the scale filter will also use a value
  7747. that maintains the aspect ratio of the input image, calculated from the other
  7748. specified dimension. After that it will, however, make sure that the calculated
  7749. dimension is divisible by n and adjust the value if necessary.
  7750. See below for the list of accepted constants for use in the dimension
  7751. expression.
  7752. @item eval
  7753. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  7754. @table @samp
  7755. @item init
  7756. Only evaluate expressions once during the filter initialization or when a command is processed.
  7757. @item frame
  7758. Evaluate expressions for each incoming frame.
  7759. @end table
  7760. Default value is @samp{init}.
  7761. @item interl
  7762. Set the interlacing mode. It accepts the following values:
  7763. @table @samp
  7764. @item 1
  7765. Force interlaced aware scaling.
  7766. @item 0
  7767. Do not apply interlaced scaling.
  7768. @item -1
  7769. Select interlaced aware scaling depending on whether the source frames
  7770. are flagged as interlaced or not.
  7771. @end table
  7772. Default value is @samp{0}.
  7773. @item flags
  7774. Set libswscale scaling flags. See
  7775. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  7776. complete list of values. If not explicitly specified the filter applies
  7777. the default flags.
  7778. @item param0, param1
  7779. Set libswscale input parameters for scaling algorithms that need them. See
  7780. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  7781. complete documentation. If not explicitly specified the filter applies
  7782. empty parameters.
  7783. @item size, s
  7784. Set the video size. For the syntax of this option, check the
  7785. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  7786. @item in_color_matrix
  7787. @item out_color_matrix
  7788. Set in/output YCbCr color space type.
  7789. This allows the autodetected value to be overridden as well as allows forcing
  7790. a specific value used for the output and encoder.
  7791. If not specified, the color space type depends on the pixel format.
  7792. Possible values:
  7793. @table @samp
  7794. @item auto
  7795. Choose automatically.
  7796. @item bt709
  7797. Format conforming to International Telecommunication Union (ITU)
  7798. Recommendation BT.709.
  7799. @item fcc
  7800. Set color space conforming to the United States Federal Communications
  7801. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  7802. @item bt601
  7803. Set color space conforming to:
  7804. @itemize
  7805. @item
  7806. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  7807. @item
  7808. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  7809. @item
  7810. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  7811. @end itemize
  7812. @item smpte240m
  7813. Set color space conforming to SMPTE ST 240:1999.
  7814. @end table
  7815. @item in_range
  7816. @item out_range
  7817. Set in/output YCbCr sample range.
  7818. This allows the autodetected value to be overridden as well as allows forcing
  7819. a specific value used for the output and encoder. If not specified, the
  7820. range depends on the pixel format. Possible values:
  7821. @table @samp
  7822. @item auto
  7823. Choose automatically.
  7824. @item jpeg/full/pc
  7825. Set full range (0-255 in case of 8-bit luma).
  7826. @item mpeg/tv
  7827. Set "MPEG" range (16-235 in case of 8-bit luma).
  7828. @end table
  7829. @item force_original_aspect_ratio
  7830. Enable decreasing or increasing output video width or height if necessary to
  7831. keep the original aspect ratio. Possible values:
  7832. @table @samp
  7833. @item disable
  7834. Scale the video as specified and disable this feature.
  7835. @item decrease
  7836. The output video dimensions will automatically be decreased if needed.
  7837. @item increase
  7838. The output video dimensions will automatically be increased if needed.
  7839. @end table
  7840. One useful instance of this option is that when you know a specific device's
  7841. maximum allowed resolution, you can use this to limit the output video to
  7842. that, while retaining the aspect ratio. For example, device A allows
  7843. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  7844. decrease) and specifying 1280x720 to the command line makes the output
  7845. 1280x533.
  7846. Please note that this is a different thing than specifying -1 for @option{w}
  7847. or @option{h}, you still need to specify the output resolution for this option
  7848. to work.
  7849. @end table
  7850. The values of the @option{w} and @option{h} options are expressions
  7851. containing the following constants:
  7852. @table @var
  7853. @item in_w
  7854. @item in_h
  7855. The input width and height
  7856. @item iw
  7857. @item ih
  7858. These are the same as @var{in_w} and @var{in_h}.
  7859. @item out_w
  7860. @item out_h
  7861. The output (scaled) width and height
  7862. @item ow
  7863. @item oh
  7864. These are the same as @var{out_w} and @var{out_h}
  7865. @item a
  7866. The same as @var{iw} / @var{ih}
  7867. @item sar
  7868. input sample aspect ratio
  7869. @item dar
  7870. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  7871. @item hsub
  7872. @item vsub
  7873. horizontal and vertical input chroma subsample values. For example for the
  7874. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7875. @item ohsub
  7876. @item ovsub
  7877. horizontal and vertical output chroma subsample values. For example for the
  7878. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7879. @end table
  7880. @subsection Examples
  7881. @itemize
  7882. @item
  7883. Scale the input video to a size of 200x100
  7884. @example
  7885. scale=w=200:h=100
  7886. @end example
  7887. This is equivalent to:
  7888. @example
  7889. scale=200:100
  7890. @end example
  7891. or:
  7892. @example
  7893. scale=200x100
  7894. @end example
  7895. @item
  7896. Specify a size abbreviation for the output size:
  7897. @example
  7898. scale=qcif
  7899. @end example
  7900. which can also be written as:
  7901. @example
  7902. scale=size=qcif
  7903. @end example
  7904. @item
  7905. Scale the input to 2x:
  7906. @example
  7907. scale=w=2*iw:h=2*ih
  7908. @end example
  7909. @item
  7910. The above is the same as:
  7911. @example
  7912. scale=2*in_w:2*in_h
  7913. @end example
  7914. @item
  7915. Scale the input to 2x with forced interlaced scaling:
  7916. @example
  7917. scale=2*iw:2*ih:interl=1
  7918. @end example
  7919. @item
  7920. Scale the input to half size:
  7921. @example
  7922. scale=w=iw/2:h=ih/2
  7923. @end example
  7924. @item
  7925. Increase the width, and set the height to the same size:
  7926. @example
  7927. scale=3/2*iw:ow
  7928. @end example
  7929. @item
  7930. Seek Greek harmony:
  7931. @example
  7932. scale=iw:1/PHI*iw
  7933. scale=ih*PHI:ih
  7934. @end example
  7935. @item
  7936. Increase the height, and set the width to 3/2 of the height:
  7937. @example
  7938. scale=w=3/2*oh:h=3/5*ih
  7939. @end example
  7940. @item
  7941. Increase the size, making the size a multiple of the chroma
  7942. subsample values:
  7943. @example
  7944. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  7945. @end example
  7946. @item
  7947. Increase the width to a maximum of 500 pixels,
  7948. keeping the same aspect ratio as the input:
  7949. @example
  7950. scale=w='min(500\, iw*3/2):h=-1'
  7951. @end example
  7952. @end itemize
  7953. @subsection Commands
  7954. This filter supports the following commands:
  7955. @table @option
  7956. @item width, w
  7957. @item height, h
  7958. Set the output video dimension expression.
  7959. The command accepts the same syntax of the corresponding option.
  7960. If the specified expression is not valid, it is kept at its current
  7961. value.
  7962. @end table
  7963. @section scale2ref
  7964. Scale (resize) the input video, based on a reference video.
  7965. See the scale filter for available options, scale2ref supports the same but
  7966. uses the reference video instead of the main input as basis.
  7967. @subsection Examples
  7968. @itemize
  7969. @item
  7970. Scale a subtitle stream to match the main video in size before overlaying
  7971. @example
  7972. 'scale2ref[b][a];[a][b]overlay'
  7973. @end example
  7974. @end itemize
  7975. @section selectivecolor
  7976. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  7977. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  7978. by the "purity" of the color (that is, how saturated it already is).
  7979. This filter is similar to the Adobe Photoshop Selective Color tool.
  7980. The filter accepts the following options:
  7981. @table @option
  7982. @item correction_method
  7983. Select color correction method.
  7984. Available values are:
  7985. @table @samp
  7986. @item absolute
  7987. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  7988. component value).
  7989. @item relative
  7990. Specified adjustments are relative to the original component value.
  7991. @end table
  7992. Default is @code{absolute}.
  7993. @item reds
  7994. Adjustments for red pixels (pixels where the red component is the maximum)
  7995. @item yellows
  7996. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  7997. @item greens
  7998. Adjustments for green pixels (pixels where the green component is the maximum)
  7999. @item cyans
  8000. Adjustments for cyan pixels (pixels where the red component is the minimum)
  8001. @item blues
  8002. Adjustments for blue pixels (pixels where the blue component is the maximum)
  8003. @item magentas
  8004. Adjustments for magenta pixels (pixels where the green component is the minimum)
  8005. @item whites
  8006. Adjustments for white pixels (pixels where all components are greater than 128)
  8007. @item neutrals
  8008. Adjustments for all pixels except pure black and pure white
  8009. @item blacks
  8010. Adjustments for black pixels (pixels where all components are lesser than 128)
  8011. @item psfile
  8012. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  8013. @end table
  8014. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  8015. 4 space separated floating point adjustment values in the [-1,1] range,
  8016. respectively to adjust the amount of cyan, magenta, yellow and black for the
  8017. pixels of its range.
  8018. @subsection Examples
  8019. @itemize
  8020. @item
  8021. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  8022. increase magenta by 27% in blue areas:
  8023. @example
  8024. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  8025. @end example
  8026. @item
  8027. Use a Photoshop selective color preset:
  8028. @example
  8029. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  8030. @end example
  8031. @end itemize
  8032. @section separatefields
  8033. The @code{separatefields} takes a frame-based video input and splits
  8034. each frame into its components fields, producing a new half height clip
  8035. with twice the frame rate and twice the frame count.
  8036. This filter use field-dominance information in frame to decide which
  8037. of each pair of fields to place first in the output.
  8038. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  8039. @section setdar, setsar
  8040. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  8041. output video.
  8042. This is done by changing the specified Sample (aka Pixel) Aspect
  8043. Ratio, according to the following equation:
  8044. @example
  8045. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  8046. @end example
  8047. Keep in mind that the @code{setdar} filter does not modify the pixel
  8048. dimensions of the video frame. Also, the display aspect ratio set by
  8049. this filter may be changed by later filters in the filterchain,
  8050. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  8051. applied.
  8052. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  8053. the filter output video.
  8054. Note that as a consequence of the application of this filter, the
  8055. output display aspect ratio will change according to the equation
  8056. above.
  8057. Keep in mind that the sample aspect ratio set by the @code{setsar}
  8058. filter may be changed by later filters in the filterchain, e.g. if
  8059. another "setsar" or a "setdar" filter is applied.
  8060. It accepts the following parameters:
  8061. @table @option
  8062. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  8063. Set the aspect ratio used by the filter.
  8064. The parameter can be a floating point number string, an expression, or
  8065. a string of the form @var{num}:@var{den}, where @var{num} and
  8066. @var{den} are the numerator and denominator of the aspect ratio. If
  8067. the parameter is not specified, it is assumed the value "0".
  8068. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  8069. should be escaped.
  8070. @item max
  8071. Set the maximum integer value to use for expressing numerator and
  8072. denominator when reducing the expressed aspect ratio to a rational.
  8073. Default value is @code{100}.
  8074. @end table
  8075. The parameter @var{sar} is an expression containing
  8076. the following constants:
  8077. @table @option
  8078. @item E, PI, PHI
  8079. These are approximated values for the mathematical constants e
  8080. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  8081. @item w, h
  8082. The input width and height.
  8083. @item a
  8084. These are the same as @var{w} / @var{h}.
  8085. @item sar
  8086. The input sample aspect ratio.
  8087. @item dar
  8088. The input display aspect ratio. It is the same as
  8089. (@var{w} / @var{h}) * @var{sar}.
  8090. @item hsub, vsub
  8091. Horizontal and vertical chroma subsample values. For example, for the
  8092. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8093. @end table
  8094. @subsection Examples
  8095. @itemize
  8096. @item
  8097. To change the display aspect ratio to 16:9, specify one of the following:
  8098. @example
  8099. setdar=dar=1.77777
  8100. setdar=dar=16/9
  8101. setdar=dar=1.77777
  8102. @end example
  8103. @item
  8104. To change the sample aspect ratio to 10:11, specify:
  8105. @example
  8106. setsar=sar=10/11
  8107. @end example
  8108. @item
  8109. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  8110. 1000 in the aspect ratio reduction, use the command:
  8111. @example
  8112. setdar=ratio=16/9:max=1000
  8113. @end example
  8114. @end itemize
  8115. @anchor{setfield}
  8116. @section setfield
  8117. Force field for the output video frame.
  8118. The @code{setfield} filter marks the interlace type field for the
  8119. output frames. It does not change the input frame, but only sets the
  8120. corresponding property, which affects how the frame is treated by
  8121. following filters (e.g. @code{fieldorder} or @code{yadif}).
  8122. The filter accepts the following options:
  8123. @table @option
  8124. @item mode
  8125. Available values are:
  8126. @table @samp
  8127. @item auto
  8128. Keep the same field property.
  8129. @item bff
  8130. Mark the frame as bottom-field-first.
  8131. @item tff
  8132. Mark the frame as top-field-first.
  8133. @item prog
  8134. Mark the frame as progressive.
  8135. @end table
  8136. @end table
  8137. @section showinfo
  8138. Show a line containing various information for each input video frame.
  8139. The input video is not modified.
  8140. The shown line contains a sequence of key/value pairs of the form
  8141. @var{key}:@var{value}.
  8142. The following values are shown in the output:
  8143. @table @option
  8144. @item n
  8145. The (sequential) number of the input frame, starting from 0.
  8146. @item pts
  8147. The Presentation TimeStamp of the input frame, expressed as a number of
  8148. time base units. The time base unit depends on the filter input pad.
  8149. @item pts_time
  8150. The Presentation TimeStamp of the input frame, expressed as a number of
  8151. seconds.
  8152. @item pos
  8153. The position of the frame in the input stream, or -1 if this information is
  8154. unavailable and/or meaningless (for example in case of synthetic video).
  8155. @item fmt
  8156. The pixel format name.
  8157. @item sar
  8158. The sample aspect ratio of the input frame, expressed in the form
  8159. @var{num}/@var{den}.
  8160. @item s
  8161. The size of the input frame. For the syntax of this option, check the
  8162. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8163. @item i
  8164. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  8165. for bottom field first).
  8166. @item iskey
  8167. This is 1 if the frame is a key frame, 0 otherwise.
  8168. @item type
  8169. The picture type of the input frame ("I" for an I-frame, "P" for a
  8170. P-frame, "B" for a B-frame, or "?" for an unknown type).
  8171. Also refer to the documentation of the @code{AVPictureType} enum and of
  8172. the @code{av_get_picture_type_char} function defined in
  8173. @file{libavutil/avutil.h}.
  8174. @item checksum
  8175. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  8176. @item plane_checksum
  8177. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  8178. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  8179. @end table
  8180. @section showpalette
  8181. Displays the 256 colors palette of each frame. This filter is only relevant for
  8182. @var{pal8} pixel format frames.
  8183. It accepts the following option:
  8184. @table @option
  8185. @item s
  8186. Set the size of the box used to represent one palette color entry. Default is
  8187. @code{30} (for a @code{30x30} pixel box).
  8188. @end table
  8189. @section shuffleframes
  8190. Reorder and/or duplicate video frames.
  8191. It accepts the following parameters:
  8192. @table @option
  8193. @item mapping
  8194. Set the destination indexes of input frames.
  8195. This is space or '|' separated list of indexes that maps input frames to output
  8196. frames. Number of indexes also sets maximal value that each index may have.
  8197. @end table
  8198. The first frame has the index 0. The default is to keep the input unchanged.
  8199. Swap second and third frame of every three frames of the input:
  8200. @example
  8201. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  8202. @end example
  8203. @section shuffleplanes
  8204. Reorder and/or duplicate video planes.
  8205. It accepts the following parameters:
  8206. @table @option
  8207. @item map0
  8208. The index of the input plane to be used as the first output plane.
  8209. @item map1
  8210. The index of the input plane to be used as the second output plane.
  8211. @item map2
  8212. The index of the input plane to be used as the third output plane.
  8213. @item map3
  8214. The index of the input plane to be used as the fourth output plane.
  8215. @end table
  8216. The first plane has the index 0. The default is to keep the input unchanged.
  8217. Swap the second and third planes of the input:
  8218. @example
  8219. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  8220. @end example
  8221. @anchor{signalstats}
  8222. @section signalstats
  8223. Evaluate various visual metrics that assist in determining issues associated
  8224. with the digitization of analog video media.
  8225. By default the filter will log these metadata values:
  8226. @table @option
  8227. @item YMIN
  8228. Display the minimal Y value contained within the input frame. Expressed in
  8229. range of [0-255].
  8230. @item YLOW
  8231. Display the Y value at the 10% percentile within the input frame. Expressed in
  8232. range of [0-255].
  8233. @item YAVG
  8234. Display the average Y value within the input frame. Expressed in range of
  8235. [0-255].
  8236. @item YHIGH
  8237. Display the Y value at the 90% percentile within the input frame. Expressed in
  8238. range of [0-255].
  8239. @item YMAX
  8240. Display the maximum Y value contained within the input frame. Expressed in
  8241. range of [0-255].
  8242. @item UMIN
  8243. Display the minimal U value contained within the input frame. Expressed in
  8244. range of [0-255].
  8245. @item ULOW
  8246. Display the U value at the 10% percentile within the input frame. Expressed in
  8247. range of [0-255].
  8248. @item UAVG
  8249. Display the average U value within the input frame. Expressed in range of
  8250. [0-255].
  8251. @item UHIGH
  8252. Display the U value at the 90% percentile within the input frame. Expressed in
  8253. range of [0-255].
  8254. @item UMAX
  8255. Display the maximum U value contained within the input frame. Expressed in
  8256. range of [0-255].
  8257. @item VMIN
  8258. Display the minimal V value contained within the input frame. Expressed in
  8259. range of [0-255].
  8260. @item VLOW
  8261. Display the V value at the 10% percentile within the input frame. Expressed in
  8262. range of [0-255].
  8263. @item VAVG
  8264. Display the average V value within the input frame. Expressed in range of
  8265. [0-255].
  8266. @item VHIGH
  8267. Display the V value at the 90% percentile within the input frame. Expressed in
  8268. range of [0-255].
  8269. @item VMAX
  8270. Display the maximum V value contained within the input frame. Expressed in
  8271. range of [0-255].
  8272. @item SATMIN
  8273. Display the minimal saturation value contained within the input frame.
  8274. Expressed in range of [0-~181.02].
  8275. @item SATLOW
  8276. Display the saturation value at the 10% percentile within the input frame.
  8277. Expressed in range of [0-~181.02].
  8278. @item SATAVG
  8279. Display the average saturation value within the input frame. Expressed in range
  8280. of [0-~181.02].
  8281. @item SATHIGH
  8282. Display the saturation value at the 90% percentile within the input frame.
  8283. Expressed in range of [0-~181.02].
  8284. @item SATMAX
  8285. Display the maximum saturation value contained within the input frame.
  8286. Expressed in range of [0-~181.02].
  8287. @item HUEMED
  8288. Display the median value for hue within the input frame. Expressed in range of
  8289. [0-360].
  8290. @item HUEAVG
  8291. Display the average value for hue within the input frame. Expressed in range of
  8292. [0-360].
  8293. @item YDIF
  8294. Display the average of sample value difference between all values of the Y
  8295. plane in the current frame and corresponding values of the previous input frame.
  8296. Expressed in range of [0-255].
  8297. @item UDIF
  8298. Display the average of sample value difference between all values of the U
  8299. plane in the current frame and corresponding values of the previous input frame.
  8300. Expressed in range of [0-255].
  8301. @item VDIF
  8302. Display the average of sample value difference between all values of the V
  8303. plane in the current frame and corresponding values of the previous input frame.
  8304. Expressed in range of [0-255].
  8305. @end table
  8306. The filter accepts the following options:
  8307. @table @option
  8308. @item stat
  8309. @item out
  8310. @option{stat} specify an additional form of image analysis.
  8311. @option{out} output video with the specified type of pixel highlighted.
  8312. Both options accept the following values:
  8313. @table @samp
  8314. @item tout
  8315. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  8316. unlike the neighboring pixels of the same field. Examples of temporal outliers
  8317. include the results of video dropouts, head clogs, or tape tracking issues.
  8318. @item vrep
  8319. Identify @var{vertical line repetition}. Vertical line repetition includes
  8320. similar rows of pixels within a frame. In born-digital video vertical line
  8321. repetition is common, but this pattern is uncommon in video digitized from an
  8322. analog source. When it occurs in video that results from the digitization of an
  8323. analog source it can indicate concealment from a dropout compensator.
  8324. @item brng
  8325. Identify pixels that fall outside of legal broadcast range.
  8326. @end table
  8327. @item color, c
  8328. Set the highlight color for the @option{out} option. The default color is
  8329. yellow.
  8330. @end table
  8331. @subsection Examples
  8332. @itemize
  8333. @item
  8334. Output data of various video metrics:
  8335. @example
  8336. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  8337. @end example
  8338. @item
  8339. Output specific data about the minimum and maximum values of the Y plane per frame:
  8340. @example
  8341. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  8342. @end example
  8343. @item
  8344. Playback video while highlighting pixels that are outside of broadcast range in red.
  8345. @example
  8346. ffplay example.mov -vf signalstats="out=brng:color=red"
  8347. @end example
  8348. @item
  8349. Playback video with signalstats metadata drawn over the frame.
  8350. @example
  8351. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  8352. @end example
  8353. The contents of signalstat_drawtext.txt used in the command are:
  8354. @example
  8355. time %@{pts:hms@}
  8356. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  8357. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  8358. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  8359. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  8360. @end example
  8361. @end itemize
  8362. @anchor{smartblur}
  8363. @section smartblur
  8364. Blur the input video without impacting the outlines.
  8365. It accepts the following options:
  8366. @table @option
  8367. @item luma_radius, lr
  8368. Set the luma radius. The option value must be a float number in
  8369. the range [0.1,5.0] that specifies the variance of the gaussian filter
  8370. used to blur the image (slower if larger). Default value is 1.0.
  8371. @item luma_strength, ls
  8372. Set the luma strength. The option value must be a float number
  8373. in the range [-1.0,1.0] that configures the blurring. A value included
  8374. in [0.0,1.0] will blur the image whereas a value included in
  8375. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  8376. @item luma_threshold, lt
  8377. Set the luma threshold used as a coefficient to determine
  8378. whether a pixel should be blurred or not. The option value must be an
  8379. integer in the range [-30,30]. A value of 0 will filter all the image,
  8380. a value included in [0,30] will filter flat areas and a value included
  8381. in [-30,0] will filter edges. Default value is 0.
  8382. @item chroma_radius, cr
  8383. Set the chroma radius. The option value must be a float number in
  8384. the range [0.1,5.0] that specifies the variance of the gaussian filter
  8385. used to blur the image (slower if larger). Default value is 1.0.
  8386. @item chroma_strength, cs
  8387. Set the chroma strength. The option value must be a float number
  8388. in the range [-1.0,1.0] that configures the blurring. A value included
  8389. in [0.0,1.0] will blur the image whereas a value included in
  8390. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  8391. @item chroma_threshold, ct
  8392. Set the chroma threshold used as a coefficient to determine
  8393. whether a pixel should be blurred or not. The option value must be an
  8394. integer in the range [-30,30]. A value of 0 will filter all the image,
  8395. a value included in [0,30] will filter flat areas and a value included
  8396. in [-30,0] will filter edges. Default value is 0.
  8397. @end table
  8398. If a chroma option is not explicitly set, the corresponding luma value
  8399. is set.
  8400. @section ssim
  8401. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  8402. This filter takes in input two input videos, the first input is
  8403. considered the "main" source and is passed unchanged to the
  8404. output. The second input is used as a "reference" video for computing
  8405. the SSIM.
  8406. Both video inputs must have the same resolution and pixel format for
  8407. this filter to work correctly. Also it assumes that both inputs
  8408. have the same number of frames, which are compared one by one.
  8409. The filter stores the calculated SSIM of each frame.
  8410. The description of the accepted parameters follows.
  8411. @table @option
  8412. @item stats_file, f
  8413. If specified the filter will use the named file to save the SSIM of
  8414. each individual frame. When filename equals "-" the data is sent to
  8415. standard output.
  8416. @end table
  8417. The file printed if @var{stats_file} is selected, contains a sequence of
  8418. key/value pairs of the form @var{key}:@var{value} for each compared
  8419. couple of frames.
  8420. A description of each shown parameter follows:
  8421. @table @option
  8422. @item n
  8423. sequential number of the input frame, starting from 1
  8424. @item Y, U, V, R, G, B
  8425. SSIM of the compared frames for the component specified by the suffix.
  8426. @item All
  8427. SSIM of the compared frames for the whole frame.
  8428. @item dB
  8429. Same as above but in dB representation.
  8430. @end table
  8431. For example:
  8432. @example
  8433. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  8434. [main][ref] ssim="stats_file=stats.log" [out]
  8435. @end example
  8436. On this example the input file being processed is compared with the
  8437. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  8438. is stored in @file{stats.log}.
  8439. Another example with both psnr and ssim at same time:
  8440. @example
  8441. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  8442. @end example
  8443. @section stereo3d
  8444. Convert between different stereoscopic image formats.
  8445. The filters accept the following options:
  8446. @table @option
  8447. @item in
  8448. Set stereoscopic image format of input.
  8449. Available values for input image formats are:
  8450. @table @samp
  8451. @item sbsl
  8452. side by side parallel (left eye left, right eye right)
  8453. @item sbsr
  8454. side by side crosseye (right eye left, left eye right)
  8455. @item sbs2l
  8456. side by side parallel with half width resolution
  8457. (left eye left, right eye right)
  8458. @item sbs2r
  8459. side by side crosseye with half width resolution
  8460. (right eye left, left eye right)
  8461. @item abl
  8462. above-below (left eye above, right eye below)
  8463. @item abr
  8464. above-below (right eye above, left eye below)
  8465. @item ab2l
  8466. above-below with half height resolution
  8467. (left eye above, right eye below)
  8468. @item ab2r
  8469. above-below with half height resolution
  8470. (right eye above, left eye below)
  8471. @item al
  8472. alternating frames (left eye first, right eye second)
  8473. @item ar
  8474. alternating frames (right eye first, left eye second)
  8475. @item irl
  8476. interleaved rows (left eye has top row, right eye starts on next row)
  8477. @item irr
  8478. interleaved rows (right eye has top row, left eye starts on next row)
  8479. @item icl
  8480. interleaved columns, left eye first
  8481. @item icr
  8482. interleaved columns, right eye first
  8483. Default value is @samp{sbsl}.
  8484. @end table
  8485. @item out
  8486. Set stereoscopic image format of output.
  8487. @table @samp
  8488. @item sbsl
  8489. side by side parallel (left eye left, right eye right)
  8490. @item sbsr
  8491. side by side crosseye (right eye left, left eye right)
  8492. @item sbs2l
  8493. side by side parallel with half width resolution
  8494. (left eye left, right eye right)
  8495. @item sbs2r
  8496. side by side crosseye with half width resolution
  8497. (right eye left, left eye right)
  8498. @item abl
  8499. above-below (left eye above, right eye below)
  8500. @item abr
  8501. above-below (right eye above, left eye below)
  8502. @item ab2l
  8503. above-below with half height resolution
  8504. (left eye above, right eye below)
  8505. @item ab2r
  8506. above-below with half height resolution
  8507. (right eye above, left eye below)
  8508. @item al
  8509. alternating frames (left eye first, right eye second)
  8510. @item ar
  8511. alternating frames (right eye first, left eye second)
  8512. @item irl
  8513. interleaved rows (left eye has top row, right eye starts on next row)
  8514. @item irr
  8515. interleaved rows (right eye has top row, left eye starts on next row)
  8516. @item arbg
  8517. anaglyph red/blue gray
  8518. (red filter on left eye, blue filter on right eye)
  8519. @item argg
  8520. anaglyph red/green gray
  8521. (red filter on left eye, green filter on right eye)
  8522. @item arcg
  8523. anaglyph red/cyan gray
  8524. (red filter on left eye, cyan filter on right eye)
  8525. @item arch
  8526. anaglyph red/cyan half colored
  8527. (red filter on left eye, cyan filter on right eye)
  8528. @item arcc
  8529. anaglyph red/cyan color
  8530. (red filter on left eye, cyan filter on right eye)
  8531. @item arcd
  8532. anaglyph red/cyan color optimized with the least squares projection of dubois
  8533. (red filter on left eye, cyan filter on right eye)
  8534. @item agmg
  8535. anaglyph green/magenta gray
  8536. (green filter on left eye, magenta filter on right eye)
  8537. @item agmh
  8538. anaglyph green/magenta half colored
  8539. (green filter on left eye, magenta filter on right eye)
  8540. @item agmc
  8541. anaglyph green/magenta colored
  8542. (green filter on left eye, magenta filter on right eye)
  8543. @item agmd
  8544. anaglyph green/magenta color optimized with the least squares projection of dubois
  8545. (green filter on left eye, magenta filter on right eye)
  8546. @item aybg
  8547. anaglyph yellow/blue gray
  8548. (yellow filter on left eye, blue filter on right eye)
  8549. @item aybh
  8550. anaglyph yellow/blue half colored
  8551. (yellow filter on left eye, blue filter on right eye)
  8552. @item aybc
  8553. anaglyph yellow/blue colored
  8554. (yellow filter on left eye, blue filter on right eye)
  8555. @item aybd
  8556. anaglyph yellow/blue color optimized with the least squares projection of dubois
  8557. (yellow filter on left eye, blue filter on right eye)
  8558. @item ml
  8559. mono output (left eye only)
  8560. @item mr
  8561. mono output (right eye only)
  8562. @item chl
  8563. checkerboard, left eye first
  8564. @item chr
  8565. checkerboard, right eye first
  8566. @item icl
  8567. interleaved columns, left eye first
  8568. @item icr
  8569. interleaved columns, right eye first
  8570. @end table
  8571. Default value is @samp{arcd}.
  8572. @end table
  8573. @subsection Examples
  8574. @itemize
  8575. @item
  8576. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  8577. @example
  8578. stereo3d=sbsl:aybd
  8579. @end example
  8580. @item
  8581. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  8582. @example
  8583. stereo3d=abl:sbsr
  8584. @end example
  8585. @end itemize
  8586. @anchor{spp}
  8587. @section spp
  8588. Apply a simple postprocessing filter that compresses and decompresses the image
  8589. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  8590. and average the results.
  8591. The filter accepts the following options:
  8592. @table @option
  8593. @item quality
  8594. Set quality. This option defines the number of levels for averaging. It accepts
  8595. an integer in the range 0-6. If set to @code{0}, the filter will have no
  8596. effect. A value of @code{6} means the higher quality. For each increment of
  8597. that value the speed drops by a factor of approximately 2. Default value is
  8598. @code{3}.
  8599. @item qp
  8600. Force a constant quantization parameter. If not set, the filter will use the QP
  8601. from the video stream (if available).
  8602. @item mode
  8603. Set thresholding mode. Available modes are:
  8604. @table @samp
  8605. @item hard
  8606. Set hard thresholding (default).
  8607. @item soft
  8608. Set soft thresholding (better de-ringing effect, but likely blurrier).
  8609. @end table
  8610. @item use_bframe_qp
  8611. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  8612. option may cause flicker since the B-Frames have often larger QP. Default is
  8613. @code{0} (not enabled).
  8614. @end table
  8615. @anchor{subtitles}
  8616. @section subtitles
  8617. Draw subtitles on top of input video using the libass library.
  8618. To enable compilation of this filter you need to configure FFmpeg with
  8619. @code{--enable-libass}. This filter also requires a build with libavcodec and
  8620. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  8621. Alpha) subtitles format.
  8622. The filter accepts the following options:
  8623. @table @option
  8624. @item filename, f
  8625. Set the filename of the subtitle file to read. It must be specified.
  8626. @item original_size
  8627. Specify the size of the original video, the video for which the ASS file
  8628. was composed. For the syntax of this option, check the
  8629. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8630. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  8631. correctly scale the fonts if the aspect ratio has been changed.
  8632. @item fontsdir
  8633. Set a directory path containing fonts that can be used by the filter.
  8634. These fonts will be used in addition to whatever the font provider uses.
  8635. @item charenc
  8636. Set subtitles input character encoding. @code{subtitles} filter only. Only
  8637. useful if not UTF-8.
  8638. @item stream_index, si
  8639. Set subtitles stream index. @code{subtitles} filter only.
  8640. @item force_style
  8641. Override default style or script info parameters of the subtitles. It accepts a
  8642. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  8643. @end table
  8644. If the first key is not specified, it is assumed that the first value
  8645. specifies the @option{filename}.
  8646. For example, to render the file @file{sub.srt} on top of the input
  8647. video, use the command:
  8648. @example
  8649. subtitles=sub.srt
  8650. @end example
  8651. which is equivalent to:
  8652. @example
  8653. subtitles=filename=sub.srt
  8654. @end example
  8655. To render the default subtitles stream from file @file{video.mkv}, use:
  8656. @example
  8657. subtitles=video.mkv
  8658. @end example
  8659. To render the second subtitles stream from that file, use:
  8660. @example
  8661. subtitles=video.mkv:si=1
  8662. @end example
  8663. To make the subtitles stream from @file{sub.srt} appear in transparent green
  8664. @code{DejaVu Serif}, use:
  8665. @example
  8666. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  8667. @end example
  8668. @section super2xsai
  8669. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  8670. Interpolate) pixel art scaling algorithm.
  8671. Useful for enlarging pixel art images without reducing sharpness.
  8672. @section swapuv
  8673. Swap U & V plane.
  8674. @section telecine
  8675. Apply telecine process to the video.
  8676. This filter accepts the following options:
  8677. @table @option
  8678. @item first_field
  8679. @table @samp
  8680. @item top, t
  8681. top field first
  8682. @item bottom, b
  8683. bottom field first
  8684. The default value is @code{top}.
  8685. @end table
  8686. @item pattern
  8687. A string of numbers representing the pulldown pattern you wish to apply.
  8688. The default value is @code{23}.
  8689. @end table
  8690. @example
  8691. Some typical patterns:
  8692. NTSC output (30i):
  8693. 27.5p: 32222
  8694. 24p: 23 (classic)
  8695. 24p: 2332 (preferred)
  8696. 20p: 33
  8697. 18p: 334
  8698. 16p: 3444
  8699. PAL output (25i):
  8700. 27.5p: 12222
  8701. 24p: 222222222223 ("Euro pulldown")
  8702. 16.67p: 33
  8703. 16p: 33333334
  8704. @end example
  8705. @section thumbnail
  8706. Select the most representative frame in a given sequence of consecutive frames.
  8707. The filter accepts the following options:
  8708. @table @option
  8709. @item n
  8710. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  8711. will pick one of them, and then handle the next batch of @var{n} frames until
  8712. the end. Default is @code{100}.
  8713. @end table
  8714. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  8715. value will result in a higher memory usage, so a high value is not recommended.
  8716. @subsection Examples
  8717. @itemize
  8718. @item
  8719. Extract one picture each 50 frames:
  8720. @example
  8721. thumbnail=50
  8722. @end example
  8723. @item
  8724. Complete example of a thumbnail creation with @command{ffmpeg}:
  8725. @example
  8726. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  8727. @end example
  8728. @end itemize
  8729. @section tile
  8730. Tile several successive frames together.
  8731. The filter accepts the following options:
  8732. @table @option
  8733. @item layout
  8734. Set the grid size (i.e. the number of lines and columns). For the syntax of
  8735. this option, check the
  8736. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8737. @item nb_frames
  8738. Set the maximum number of frames to render in the given area. It must be less
  8739. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  8740. the area will be used.
  8741. @item margin
  8742. Set the outer border margin in pixels.
  8743. @item padding
  8744. Set the inner border thickness (i.e. the number of pixels between frames). For
  8745. more advanced padding options (such as having different values for the edges),
  8746. refer to the pad video filter.
  8747. @item color
  8748. Specify the color of the unused area. For the syntax of this option, check the
  8749. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  8750. is "black".
  8751. @end table
  8752. @subsection Examples
  8753. @itemize
  8754. @item
  8755. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  8756. @example
  8757. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  8758. @end example
  8759. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  8760. duplicating each output frame to accommodate the originally detected frame
  8761. rate.
  8762. @item
  8763. Display @code{5} pictures in an area of @code{3x2} frames,
  8764. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  8765. mixed flat and named options:
  8766. @example
  8767. tile=3x2:nb_frames=5:padding=7:margin=2
  8768. @end example
  8769. @end itemize
  8770. @section tinterlace
  8771. Perform various types of temporal field interlacing.
  8772. Frames are counted starting from 1, so the first input frame is
  8773. considered odd.
  8774. The filter accepts the following options:
  8775. @table @option
  8776. @item mode
  8777. Specify the mode of the interlacing. This option can also be specified
  8778. as a value alone. See below for a list of values for this option.
  8779. Available values are:
  8780. @table @samp
  8781. @item merge, 0
  8782. Move odd frames into the upper field, even into the lower field,
  8783. generating a double height frame at half frame rate.
  8784. @example
  8785. ------> time
  8786. Input:
  8787. Frame 1 Frame 2 Frame 3 Frame 4
  8788. 11111 22222 33333 44444
  8789. 11111 22222 33333 44444
  8790. 11111 22222 33333 44444
  8791. 11111 22222 33333 44444
  8792. Output:
  8793. 11111 33333
  8794. 22222 44444
  8795. 11111 33333
  8796. 22222 44444
  8797. 11111 33333
  8798. 22222 44444
  8799. 11111 33333
  8800. 22222 44444
  8801. @end example
  8802. @item drop_odd, 1
  8803. Only output even frames, odd frames are dropped, generating a frame with
  8804. unchanged height at half frame rate.
  8805. @example
  8806. ------> time
  8807. Input:
  8808. Frame 1 Frame 2 Frame 3 Frame 4
  8809. 11111 22222 33333 44444
  8810. 11111 22222 33333 44444
  8811. 11111 22222 33333 44444
  8812. 11111 22222 33333 44444
  8813. Output:
  8814. 22222 44444
  8815. 22222 44444
  8816. 22222 44444
  8817. 22222 44444
  8818. @end example
  8819. @item drop_even, 2
  8820. Only output odd frames, even frames are dropped, generating a frame with
  8821. unchanged height at half frame rate.
  8822. @example
  8823. ------> time
  8824. Input:
  8825. Frame 1 Frame 2 Frame 3 Frame 4
  8826. 11111 22222 33333 44444
  8827. 11111 22222 33333 44444
  8828. 11111 22222 33333 44444
  8829. 11111 22222 33333 44444
  8830. Output:
  8831. 11111 33333
  8832. 11111 33333
  8833. 11111 33333
  8834. 11111 33333
  8835. @end example
  8836. @item pad, 3
  8837. Expand each frame to full height, but pad alternate lines with black,
  8838. generating a frame with double height at the same input frame rate.
  8839. @example
  8840. ------> time
  8841. Input:
  8842. Frame 1 Frame 2 Frame 3 Frame 4
  8843. 11111 22222 33333 44444
  8844. 11111 22222 33333 44444
  8845. 11111 22222 33333 44444
  8846. 11111 22222 33333 44444
  8847. Output:
  8848. 11111 ..... 33333 .....
  8849. ..... 22222 ..... 44444
  8850. 11111 ..... 33333 .....
  8851. ..... 22222 ..... 44444
  8852. 11111 ..... 33333 .....
  8853. ..... 22222 ..... 44444
  8854. 11111 ..... 33333 .....
  8855. ..... 22222 ..... 44444
  8856. @end example
  8857. @item interleave_top, 4
  8858. Interleave the upper field from odd frames with the lower field from
  8859. even frames, generating a frame with unchanged height at half frame rate.
  8860. @example
  8861. ------> time
  8862. Input:
  8863. Frame 1 Frame 2 Frame 3 Frame 4
  8864. 11111<- 22222 33333<- 44444
  8865. 11111 22222<- 33333 44444<-
  8866. 11111<- 22222 33333<- 44444
  8867. 11111 22222<- 33333 44444<-
  8868. Output:
  8869. 11111 33333
  8870. 22222 44444
  8871. 11111 33333
  8872. 22222 44444
  8873. @end example
  8874. @item interleave_bottom, 5
  8875. Interleave the lower field from odd frames with the upper field from
  8876. even frames, generating a frame with unchanged height at half frame rate.
  8877. @example
  8878. ------> time
  8879. Input:
  8880. Frame 1 Frame 2 Frame 3 Frame 4
  8881. 11111 22222<- 33333 44444<-
  8882. 11111<- 22222 33333<- 44444
  8883. 11111 22222<- 33333 44444<-
  8884. 11111<- 22222 33333<- 44444
  8885. Output:
  8886. 22222 44444
  8887. 11111 33333
  8888. 22222 44444
  8889. 11111 33333
  8890. @end example
  8891. @item interlacex2, 6
  8892. Double frame rate with unchanged height. Frames are inserted each
  8893. containing the second temporal field from the previous input frame and
  8894. the first temporal field from the next input frame. This mode relies on
  8895. the top_field_first flag. Useful for interlaced video displays with no
  8896. field synchronisation.
  8897. @example
  8898. ------> time
  8899. Input:
  8900. Frame 1 Frame 2 Frame 3 Frame 4
  8901. 11111 22222 33333 44444
  8902. 11111 22222 33333 44444
  8903. 11111 22222 33333 44444
  8904. 11111 22222 33333 44444
  8905. Output:
  8906. 11111 22222 22222 33333 33333 44444 44444
  8907. 11111 11111 22222 22222 33333 33333 44444
  8908. 11111 22222 22222 33333 33333 44444 44444
  8909. 11111 11111 22222 22222 33333 33333 44444
  8910. @end example
  8911. @item mergex2, 7
  8912. Move odd frames into the upper field, even into the lower field,
  8913. generating a double height frame at same frame rate.
  8914. @example
  8915. ------> time
  8916. Input:
  8917. Frame 1 Frame 2 Frame 3 Frame 4
  8918. 11111 22222 33333 44444
  8919. 11111 22222 33333 44444
  8920. 11111 22222 33333 44444
  8921. 11111 22222 33333 44444
  8922. Output:
  8923. 11111 33333 33333 55555
  8924. 22222 22222 44444 44444
  8925. 11111 33333 33333 55555
  8926. 22222 22222 44444 44444
  8927. 11111 33333 33333 55555
  8928. 22222 22222 44444 44444
  8929. 11111 33333 33333 55555
  8930. 22222 22222 44444 44444
  8931. @end example
  8932. @end table
  8933. Numeric values are deprecated but are accepted for backward
  8934. compatibility reasons.
  8935. Default mode is @code{merge}.
  8936. @item flags
  8937. Specify flags influencing the filter process.
  8938. Available value for @var{flags} is:
  8939. @table @option
  8940. @item low_pass_filter, vlfp
  8941. Enable vertical low-pass filtering in the filter.
  8942. Vertical low-pass filtering is required when creating an interlaced
  8943. destination from a progressive source which contains high-frequency
  8944. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  8945. patterning.
  8946. Vertical low-pass filtering can only be enabled for @option{mode}
  8947. @var{interleave_top} and @var{interleave_bottom}.
  8948. @end table
  8949. @end table
  8950. @section transpose
  8951. Transpose rows with columns in the input video and optionally flip it.
  8952. It accepts the following parameters:
  8953. @table @option
  8954. @item dir
  8955. Specify the transposition direction.
  8956. Can assume the following values:
  8957. @table @samp
  8958. @item 0, 4, cclock_flip
  8959. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  8960. @example
  8961. L.R L.l
  8962. . . -> . .
  8963. l.r R.r
  8964. @end example
  8965. @item 1, 5, clock
  8966. Rotate by 90 degrees clockwise, that is:
  8967. @example
  8968. L.R l.L
  8969. . . -> . .
  8970. l.r r.R
  8971. @end example
  8972. @item 2, 6, cclock
  8973. Rotate by 90 degrees counterclockwise, that is:
  8974. @example
  8975. L.R R.r
  8976. . . -> . .
  8977. l.r L.l
  8978. @end example
  8979. @item 3, 7, clock_flip
  8980. Rotate by 90 degrees clockwise and vertically flip, that is:
  8981. @example
  8982. L.R r.R
  8983. . . -> . .
  8984. l.r l.L
  8985. @end example
  8986. @end table
  8987. For values between 4-7, the transposition is only done if the input
  8988. video geometry is portrait and not landscape. These values are
  8989. deprecated, the @code{passthrough} option should be used instead.
  8990. Numerical values are deprecated, and should be dropped in favor of
  8991. symbolic constants.
  8992. @item passthrough
  8993. Do not apply the transposition if the input geometry matches the one
  8994. specified by the specified value. It accepts the following values:
  8995. @table @samp
  8996. @item none
  8997. Always apply transposition.
  8998. @item portrait
  8999. Preserve portrait geometry (when @var{height} >= @var{width}).
  9000. @item landscape
  9001. Preserve landscape geometry (when @var{width} >= @var{height}).
  9002. @end table
  9003. Default value is @code{none}.
  9004. @end table
  9005. For example to rotate by 90 degrees clockwise and preserve portrait
  9006. layout:
  9007. @example
  9008. transpose=dir=1:passthrough=portrait
  9009. @end example
  9010. The command above can also be specified as:
  9011. @example
  9012. transpose=1:portrait
  9013. @end example
  9014. @section trim
  9015. Trim the input so that the output contains one continuous subpart of the input.
  9016. It accepts the following parameters:
  9017. @table @option
  9018. @item start
  9019. Specify the time of the start of the kept section, i.e. the frame with the
  9020. timestamp @var{start} will be the first frame in the output.
  9021. @item end
  9022. Specify the time of the first frame that will be dropped, i.e. the frame
  9023. immediately preceding the one with the timestamp @var{end} will be the last
  9024. frame in the output.
  9025. @item start_pts
  9026. This is the same as @var{start}, except this option sets the start timestamp
  9027. in timebase units instead of seconds.
  9028. @item end_pts
  9029. This is the same as @var{end}, except this option sets the end timestamp
  9030. in timebase units instead of seconds.
  9031. @item duration
  9032. The maximum duration of the output in seconds.
  9033. @item start_frame
  9034. The number of the first frame that should be passed to the output.
  9035. @item end_frame
  9036. The number of the first frame that should be dropped.
  9037. @end table
  9038. @option{start}, @option{end}, and @option{duration} are expressed as time
  9039. duration specifications; see
  9040. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  9041. for the accepted syntax.
  9042. Note that the first two sets of the start/end options and the @option{duration}
  9043. option look at the frame timestamp, while the _frame variants simply count the
  9044. frames that pass through the filter. Also note that this filter does not modify
  9045. the timestamps. If you wish for the output timestamps to start at zero, insert a
  9046. setpts filter after the trim filter.
  9047. If multiple start or end options are set, this filter tries to be greedy and
  9048. keep all the frames that match at least one of the specified constraints. To keep
  9049. only the part that matches all the constraints at once, chain multiple trim
  9050. filters.
  9051. The defaults are such that all the input is kept. So it is possible to set e.g.
  9052. just the end values to keep everything before the specified time.
  9053. Examples:
  9054. @itemize
  9055. @item
  9056. Drop everything except the second minute of input:
  9057. @example
  9058. ffmpeg -i INPUT -vf trim=60:120
  9059. @end example
  9060. @item
  9061. Keep only the first second:
  9062. @example
  9063. ffmpeg -i INPUT -vf trim=duration=1
  9064. @end example
  9065. @end itemize
  9066. @anchor{unsharp}
  9067. @section unsharp
  9068. Sharpen or blur the input video.
  9069. It accepts the following parameters:
  9070. @table @option
  9071. @item luma_msize_x, lx
  9072. Set the luma matrix horizontal size. It must be an odd integer between
  9073. 3 and 63. The default value is 5.
  9074. @item luma_msize_y, ly
  9075. Set the luma matrix vertical size. It must be an odd integer between 3
  9076. and 63. The default value is 5.
  9077. @item luma_amount, la
  9078. Set the luma effect strength. It must be a floating point number, reasonable
  9079. values lay between -1.5 and 1.5.
  9080. Negative values will blur the input video, while positive values will
  9081. sharpen it, a value of zero will disable the effect.
  9082. Default value is 1.0.
  9083. @item chroma_msize_x, cx
  9084. Set the chroma matrix horizontal size. It must be an odd integer
  9085. between 3 and 63. The default value is 5.
  9086. @item chroma_msize_y, cy
  9087. Set the chroma matrix vertical size. It must be an odd integer
  9088. between 3 and 63. The default value is 5.
  9089. @item chroma_amount, ca
  9090. Set the chroma effect strength. It must be a floating point number, reasonable
  9091. values lay between -1.5 and 1.5.
  9092. Negative values will blur the input video, while positive values will
  9093. sharpen it, a value of zero will disable the effect.
  9094. Default value is 0.0.
  9095. @item opencl
  9096. If set to 1, specify using OpenCL capabilities, only available if
  9097. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  9098. @end table
  9099. All parameters are optional and default to the equivalent of the
  9100. string '5:5:1.0:5:5:0.0'.
  9101. @subsection Examples
  9102. @itemize
  9103. @item
  9104. Apply strong luma sharpen effect:
  9105. @example
  9106. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  9107. @end example
  9108. @item
  9109. Apply a strong blur of both luma and chroma parameters:
  9110. @example
  9111. unsharp=7:7:-2:7:7:-2
  9112. @end example
  9113. @end itemize
  9114. @section uspp
  9115. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  9116. the image at several (or - in the case of @option{quality} level @code{8} - all)
  9117. shifts and average the results.
  9118. The way this differs from the behavior of spp is that uspp actually encodes &
  9119. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  9120. DCT similar to MJPEG.
  9121. The filter accepts the following options:
  9122. @table @option
  9123. @item quality
  9124. Set quality. This option defines the number of levels for averaging. It accepts
  9125. an integer in the range 0-8. If set to @code{0}, the filter will have no
  9126. effect. A value of @code{8} means the higher quality. For each increment of
  9127. that value the speed drops by a factor of approximately 2. Default value is
  9128. @code{3}.
  9129. @item qp
  9130. Force a constant quantization parameter. If not set, the filter will use the QP
  9131. from the video stream (if available).
  9132. @end table
  9133. @section vectorscope
  9134. Display 2 color component values in the two dimensional graph (which is called
  9135. a vectorscope).
  9136. This filter accepts the following options:
  9137. @table @option
  9138. @item mode, m
  9139. Set vectorscope mode.
  9140. It accepts the following values:
  9141. @table @samp
  9142. @item gray
  9143. Gray values are displayed on graph, higher brightness means more pixels have
  9144. same component color value on location in graph. This is the default mode.
  9145. @item color
  9146. Gray values are displayed on graph. Surrounding pixels values which are not
  9147. present in video frame are drawn in gradient of 2 color components which are
  9148. set by option @code{x} and @code{y}.
  9149. @item color2
  9150. Actual color components values present in video frame are displayed on graph.
  9151. @item color3
  9152. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  9153. on graph increases value of another color component, which is luminance by
  9154. default values of @code{x} and @code{y}.
  9155. @item color4
  9156. Actual colors present in video frame are displayed on graph. If two different
  9157. colors map to same position on graph then color with higher value of component
  9158. not present in graph is picked.
  9159. @end table
  9160. @item x
  9161. Set which color component will be represented on X-axis. Default is @code{1}.
  9162. @item y
  9163. Set which color component will be represented on Y-axis. Default is @code{2}.
  9164. @item intensity, i
  9165. Set intensity, used by modes: gray, color and color3 for increasing brightness
  9166. of color component which represents frequency of (X, Y) location in graph.
  9167. @item envelope, e
  9168. @table @samp
  9169. @item none
  9170. No envelope, this is default.
  9171. @item instant
  9172. Instant envelope, even darkest single pixel will be clearly highlighted.
  9173. @item peak
  9174. Hold maximum and minimum values presented in graph over time. This way you
  9175. can still spot out of range values without constantly looking at vectorscope.
  9176. @item peak+instant
  9177. Peak and instant envelope combined together.
  9178. @end table
  9179. @end table
  9180. @anchor{vidstabdetect}
  9181. @section vidstabdetect
  9182. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  9183. @ref{vidstabtransform} for pass 2.
  9184. This filter generates a file with relative translation and rotation
  9185. transform information about subsequent frames, which is then used by
  9186. the @ref{vidstabtransform} filter.
  9187. To enable compilation of this filter you need to configure FFmpeg with
  9188. @code{--enable-libvidstab}.
  9189. This filter accepts the following options:
  9190. @table @option
  9191. @item result
  9192. Set the path to the file used to write the transforms information.
  9193. Default value is @file{transforms.trf}.
  9194. @item shakiness
  9195. Set how shaky the video is and how quick the camera is. It accepts an
  9196. integer in the range 1-10, a value of 1 means little shakiness, a
  9197. value of 10 means strong shakiness. Default value is 5.
  9198. @item accuracy
  9199. Set the accuracy of the detection process. It must be a value in the
  9200. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  9201. accuracy. Default value is 15.
  9202. @item stepsize
  9203. Set stepsize of the search process. The region around minimum is
  9204. scanned with 1 pixel resolution. Default value is 6.
  9205. @item mincontrast
  9206. Set minimum contrast. Below this value a local measurement field is
  9207. discarded. Must be a floating point value in the range 0-1. Default
  9208. value is 0.3.
  9209. @item tripod
  9210. Set reference frame number for tripod mode.
  9211. If enabled, the motion of the frames is compared to a reference frame
  9212. in the filtered stream, identified by the specified number. The idea
  9213. is to compensate all movements in a more-or-less static scene and keep
  9214. the camera view absolutely still.
  9215. If set to 0, it is disabled. The frames are counted starting from 1.
  9216. @item show
  9217. Show fields and transforms in the resulting frames. It accepts an
  9218. integer in the range 0-2. Default value is 0, which disables any
  9219. visualization.
  9220. @end table
  9221. @subsection Examples
  9222. @itemize
  9223. @item
  9224. Use default values:
  9225. @example
  9226. vidstabdetect
  9227. @end example
  9228. @item
  9229. Analyze strongly shaky movie and put the results in file
  9230. @file{mytransforms.trf}:
  9231. @example
  9232. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  9233. @end example
  9234. @item
  9235. Visualize the result of internal transformations in the resulting
  9236. video:
  9237. @example
  9238. vidstabdetect=show=1
  9239. @end example
  9240. @item
  9241. Analyze a video with medium shakiness using @command{ffmpeg}:
  9242. @example
  9243. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  9244. @end example
  9245. @end itemize
  9246. @anchor{vidstabtransform}
  9247. @section vidstabtransform
  9248. Video stabilization/deshaking: pass 2 of 2,
  9249. see @ref{vidstabdetect} for pass 1.
  9250. Read a file with transform information for each frame and
  9251. apply/compensate them. Together with the @ref{vidstabdetect}
  9252. filter this can be used to deshake videos. See also
  9253. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  9254. the @ref{unsharp} filter, see below.
  9255. To enable compilation of this filter you need to configure FFmpeg with
  9256. @code{--enable-libvidstab}.
  9257. @subsection Options
  9258. @table @option
  9259. @item input
  9260. Set path to the file used to read the transforms. Default value is
  9261. @file{transforms.trf}.
  9262. @item smoothing
  9263. Set the number of frames (value*2 + 1) used for lowpass filtering the
  9264. camera movements. Default value is 10.
  9265. For example a number of 10 means that 21 frames are used (10 in the
  9266. past and 10 in the future) to smoothen the motion in the video. A
  9267. larger value leads to a smoother video, but limits the acceleration of
  9268. the camera (pan/tilt movements). 0 is a special case where a static
  9269. camera is simulated.
  9270. @item optalgo
  9271. Set the camera path optimization algorithm.
  9272. Accepted values are:
  9273. @table @samp
  9274. @item gauss
  9275. gaussian kernel low-pass filter on camera motion (default)
  9276. @item avg
  9277. averaging on transformations
  9278. @end table
  9279. @item maxshift
  9280. Set maximal number of pixels to translate frames. Default value is -1,
  9281. meaning no limit.
  9282. @item maxangle
  9283. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  9284. value is -1, meaning no limit.
  9285. @item crop
  9286. Specify how to deal with borders that may be visible due to movement
  9287. compensation.
  9288. Available values are:
  9289. @table @samp
  9290. @item keep
  9291. keep image information from previous frame (default)
  9292. @item black
  9293. fill the border black
  9294. @end table
  9295. @item invert
  9296. Invert transforms if set to 1. Default value is 0.
  9297. @item relative
  9298. Consider transforms as relative to previous frame if set to 1,
  9299. absolute if set to 0. Default value is 0.
  9300. @item zoom
  9301. Set percentage to zoom. A positive value will result in a zoom-in
  9302. effect, a negative value in a zoom-out effect. Default value is 0 (no
  9303. zoom).
  9304. @item optzoom
  9305. Set optimal zooming to avoid borders.
  9306. Accepted values are:
  9307. @table @samp
  9308. @item 0
  9309. disabled
  9310. @item 1
  9311. optimal static zoom value is determined (only very strong movements
  9312. will lead to visible borders) (default)
  9313. @item 2
  9314. optimal adaptive zoom value is determined (no borders will be
  9315. visible), see @option{zoomspeed}
  9316. @end table
  9317. Note that the value given at zoom is added to the one calculated here.
  9318. @item zoomspeed
  9319. Set percent to zoom maximally each frame (enabled when
  9320. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  9321. 0.25.
  9322. @item interpol
  9323. Specify type of interpolation.
  9324. Available values are:
  9325. @table @samp
  9326. @item no
  9327. no interpolation
  9328. @item linear
  9329. linear only horizontal
  9330. @item bilinear
  9331. linear in both directions (default)
  9332. @item bicubic
  9333. cubic in both directions (slow)
  9334. @end table
  9335. @item tripod
  9336. Enable virtual tripod mode if set to 1, which is equivalent to
  9337. @code{relative=0:smoothing=0}. Default value is 0.
  9338. Use also @code{tripod} option of @ref{vidstabdetect}.
  9339. @item debug
  9340. Increase log verbosity if set to 1. Also the detected global motions
  9341. are written to the temporary file @file{global_motions.trf}. Default
  9342. value is 0.
  9343. @end table
  9344. @subsection Examples
  9345. @itemize
  9346. @item
  9347. Use @command{ffmpeg} for a typical stabilization with default values:
  9348. @example
  9349. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  9350. @end example
  9351. Note the use of the @ref{unsharp} filter which is always recommended.
  9352. @item
  9353. Zoom in a bit more and load transform data from a given file:
  9354. @example
  9355. vidstabtransform=zoom=5:input="mytransforms.trf"
  9356. @end example
  9357. @item
  9358. Smoothen the video even more:
  9359. @example
  9360. vidstabtransform=smoothing=30
  9361. @end example
  9362. @end itemize
  9363. @section vflip
  9364. Flip the input video vertically.
  9365. For example, to vertically flip a video with @command{ffmpeg}:
  9366. @example
  9367. ffmpeg -i in.avi -vf "vflip" out.avi
  9368. @end example
  9369. @anchor{vignette}
  9370. @section vignette
  9371. Make or reverse a natural vignetting effect.
  9372. The filter accepts the following options:
  9373. @table @option
  9374. @item angle, a
  9375. Set lens angle expression as a number of radians.
  9376. The value is clipped in the @code{[0,PI/2]} range.
  9377. Default value: @code{"PI/5"}
  9378. @item x0
  9379. @item y0
  9380. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  9381. by default.
  9382. @item mode
  9383. Set forward/backward mode.
  9384. Available modes are:
  9385. @table @samp
  9386. @item forward
  9387. The larger the distance from the central point, the darker the image becomes.
  9388. @item backward
  9389. The larger the distance from the central point, the brighter the image becomes.
  9390. This can be used to reverse a vignette effect, though there is no automatic
  9391. detection to extract the lens @option{angle} and other settings (yet). It can
  9392. also be used to create a burning effect.
  9393. @end table
  9394. Default value is @samp{forward}.
  9395. @item eval
  9396. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  9397. It accepts the following values:
  9398. @table @samp
  9399. @item init
  9400. Evaluate expressions only once during the filter initialization.
  9401. @item frame
  9402. Evaluate expressions for each incoming frame. This is way slower than the
  9403. @samp{init} mode since it requires all the scalers to be re-computed, but it
  9404. allows advanced dynamic expressions.
  9405. @end table
  9406. Default value is @samp{init}.
  9407. @item dither
  9408. Set dithering to reduce the circular banding effects. Default is @code{1}
  9409. (enabled).
  9410. @item aspect
  9411. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  9412. Setting this value to the SAR of the input will make a rectangular vignetting
  9413. following the dimensions of the video.
  9414. Default is @code{1/1}.
  9415. @end table
  9416. @subsection Expressions
  9417. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  9418. following parameters.
  9419. @table @option
  9420. @item w
  9421. @item h
  9422. input width and height
  9423. @item n
  9424. the number of input frame, starting from 0
  9425. @item pts
  9426. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  9427. @var{TB} units, NAN if undefined
  9428. @item r
  9429. frame rate of the input video, NAN if the input frame rate is unknown
  9430. @item t
  9431. the PTS (Presentation TimeStamp) of the filtered video frame,
  9432. expressed in seconds, NAN if undefined
  9433. @item tb
  9434. time base of the input video
  9435. @end table
  9436. @subsection Examples
  9437. @itemize
  9438. @item
  9439. Apply simple strong vignetting effect:
  9440. @example
  9441. vignette=PI/4
  9442. @end example
  9443. @item
  9444. Make a flickering vignetting:
  9445. @example
  9446. vignette='PI/4+random(1)*PI/50':eval=frame
  9447. @end example
  9448. @end itemize
  9449. @section vstack
  9450. Stack input videos vertically.
  9451. All streams must be of same pixel format and of same width.
  9452. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  9453. to create same output.
  9454. The filter accept the following option:
  9455. @table @option
  9456. @item inputs
  9457. Set number of input streams. Default is 2.
  9458. @item shortest
  9459. If set to 1, force the output to terminate when the shortest input
  9460. terminates. Default value is 0.
  9461. @end table
  9462. @section w3fdif
  9463. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  9464. Deinterlacing Filter").
  9465. Based on the process described by Martin Weston for BBC R&D, and
  9466. implemented based on the de-interlace algorithm written by Jim
  9467. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  9468. uses filter coefficients calculated by BBC R&D.
  9469. There are two sets of filter coefficients, so called "simple":
  9470. and "complex". Which set of filter coefficients is used can
  9471. be set by passing an optional parameter:
  9472. @table @option
  9473. @item filter
  9474. Set the interlacing filter coefficients. Accepts one of the following values:
  9475. @table @samp
  9476. @item simple
  9477. Simple filter coefficient set.
  9478. @item complex
  9479. More-complex filter coefficient set.
  9480. @end table
  9481. Default value is @samp{complex}.
  9482. @item deint
  9483. Specify which frames to deinterlace. Accept one of the following values:
  9484. @table @samp
  9485. @item all
  9486. Deinterlace all frames,
  9487. @item interlaced
  9488. Only deinterlace frames marked as interlaced.
  9489. @end table
  9490. Default value is @samp{all}.
  9491. @end table
  9492. @section waveform
  9493. Video waveform monitor.
  9494. The waveform monitor plots color component intensity. By default luminance
  9495. only. Each column of the waveform corresponds to a column of pixels in the
  9496. source video.
  9497. It accepts the following options:
  9498. @table @option
  9499. @item mode, m
  9500. Can be either @code{row}, or @code{column}. Default is @code{column}.
  9501. In row mode, the graph on the left side represents color component value 0 and
  9502. the right side represents value = 255. In column mode, the top side represents
  9503. color component value = 0 and bottom side represents value = 255.
  9504. @item intensity, i
  9505. Set intensity. Smaller values are useful to find out how many values of the same
  9506. luminance are distributed across input rows/columns.
  9507. Default value is @code{0.04}. Allowed range is [0, 1].
  9508. @item mirror, r
  9509. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  9510. In mirrored mode, higher values will be represented on the left
  9511. side for @code{row} mode and at the top for @code{column} mode. Default is
  9512. @code{1} (mirrored).
  9513. @item display, d
  9514. Set display mode.
  9515. It accepts the following values:
  9516. @table @samp
  9517. @item overlay
  9518. Presents information identical to that in the @code{parade}, except
  9519. that the graphs representing color components are superimposed directly
  9520. over one another.
  9521. This display mode makes it easier to spot relative differences or similarities
  9522. in overlapping areas of the color components that are supposed to be identical,
  9523. such as neutral whites, grays, or blacks.
  9524. @item parade
  9525. Display separate graph for the color components side by side in
  9526. @code{row} mode or one below the other in @code{column} mode.
  9527. Using this display mode makes it easy to spot color casts in the highlights
  9528. and shadows of an image, by comparing the contours of the top and the bottom
  9529. graphs of each waveform. Since whites, grays, and blacks are characterized
  9530. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  9531. should display three waveforms of roughly equal width/height. If not, the
  9532. correction is easy to perform by making level adjustments the three waveforms.
  9533. @end table
  9534. Default is @code{parade}.
  9535. @item components, c
  9536. Set which color components to display. Default is 1, which means only luminance
  9537. or red color component if input is in RGB colorspace. If is set for example to
  9538. 7 it will display all 3 (if) available color components.
  9539. @item envelope, e
  9540. @table @samp
  9541. @item none
  9542. No envelope, this is default.
  9543. @item instant
  9544. Instant envelope, minimum and maximum values presented in graph will be easily
  9545. visible even with small @code{step} value.
  9546. @item peak
  9547. Hold minimum and maximum values presented in graph across time. This way you
  9548. can still spot out of range values without constantly looking at waveforms.
  9549. @item peak+instant
  9550. Peak and instant envelope combined together.
  9551. @end table
  9552. @item filter, f
  9553. @table @samp
  9554. @item lowpass
  9555. No filtering, this is default.
  9556. @item flat
  9557. Luma and chroma combined together.
  9558. @item aflat
  9559. Similar as above, but shows difference between blue and red chroma.
  9560. @item chroma
  9561. Displays only chroma.
  9562. @item achroma
  9563. Similar as above, but shows difference between blue and red chroma.
  9564. @item color
  9565. Displays actual color value on waveform.
  9566. @end table
  9567. @end table
  9568. @section xbr
  9569. Apply the xBR high-quality magnification filter which is designed for pixel
  9570. art. It follows a set of edge-detection rules, see
  9571. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  9572. It accepts the following option:
  9573. @table @option
  9574. @item n
  9575. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  9576. @code{3xBR} and @code{4} for @code{4xBR}.
  9577. Default is @code{3}.
  9578. @end table
  9579. @anchor{yadif}
  9580. @section yadif
  9581. Deinterlace the input video ("yadif" means "yet another deinterlacing
  9582. filter").
  9583. It accepts the following parameters:
  9584. @table @option
  9585. @item mode
  9586. The interlacing mode to adopt. It accepts one of the following values:
  9587. @table @option
  9588. @item 0, send_frame
  9589. Output one frame for each frame.
  9590. @item 1, send_field
  9591. Output one frame for each field.
  9592. @item 2, send_frame_nospatial
  9593. Like @code{send_frame}, but it skips the spatial interlacing check.
  9594. @item 3, send_field_nospatial
  9595. Like @code{send_field}, but it skips the spatial interlacing check.
  9596. @end table
  9597. The default value is @code{send_frame}.
  9598. @item parity
  9599. The picture field parity assumed for the input interlaced video. It accepts one
  9600. of the following values:
  9601. @table @option
  9602. @item 0, tff
  9603. Assume the top field is first.
  9604. @item 1, bff
  9605. Assume the bottom field is first.
  9606. @item -1, auto
  9607. Enable automatic detection of field parity.
  9608. @end table
  9609. The default value is @code{auto}.
  9610. If the interlacing is unknown or the decoder does not export this information,
  9611. top field first will be assumed.
  9612. @item deint
  9613. Specify which frames to deinterlace. Accept one of the following
  9614. values:
  9615. @table @option
  9616. @item 0, all
  9617. Deinterlace all frames.
  9618. @item 1, interlaced
  9619. Only deinterlace frames marked as interlaced.
  9620. @end table
  9621. The default value is @code{all}.
  9622. @end table
  9623. @section zoompan
  9624. Apply Zoom & Pan effect.
  9625. This filter accepts the following options:
  9626. @table @option
  9627. @item zoom, z
  9628. Set the zoom expression. Default is 1.
  9629. @item x
  9630. @item y
  9631. Set the x and y expression. Default is 0.
  9632. @item d
  9633. Set the duration expression in number of frames.
  9634. This sets for how many number of frames effect will last for
  9635. single input image.
  9636. @item s
  9637. Set the output image size, default is 'hd720'.
  9638. @item fps
  9639. Set the output frame rate, default is '25'.
  9640. @end table
  9641. Each expression can contain the following constants:
  9642. @table @option
  9643. @item in_w, iw
  9644. Input width.
  9645. @item in_h, ih
  9646. Input height.
  9647. @item out_w, ow
  9648. Output width.
  9649. @item out_h, oh
  9650. Output height.
  9651. @item in
  9652. Input frame count.
  9653. @item on
  9654. Output frame count.
  9655. @item x
  9656. @item y
  9657. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  9658. for current input frame.
  9659. @item px
  9660. @item py
  9661. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  9662. not yet such frame (first input frame).
  9663. @item zoom
  9664. Last calculated zoom from 'z' expression for current input frame.
  9665. @item pzoom
  9666. Last calculated zoom of last output frame of previous input frame.
  9667. @item duration
  9668. Number of output frames for current input frame. Calculated from 'd' expression
  9669. for each input frame.
  9670. @item pduration
  9671. number of output frames created for previous input frame
  9672. @item a
  9673. Rational number: input width / input height
  9674. @item sar
  9675. sample aspect ratio
  9676. @item dar
  9677. display aspect ratio
  9678. @end table
  9679. @subsection Examples
  9680. @itemize
  9681. @item
  9682. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  9683. @example
  9684. 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
  9685. @end example
  9686. @item
  9687. Zoom-in up to 1.5 and pan always at center of picture:
  9688. @example
  9689. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  9690. @end example
  9691. @end itemize
  9692. @section zscale
  9693. Scale (resize) the input video, using the z.lib library:
  9694. https://github.com/sekrit-twc/zimg.
  9695. The zscale filter forces the output display aspect ratio to be the same
  9696. as the input, by changing the output sample aspect ratio.
  9697. If the input image format is different from the format requested by
  9698. the next filter, the zscale filter will convert the input to the
  9699. requested format.
  9700. @subsection Options
  9701. The filter accepts the following options.
  9702. @table @option
  9703. @item width, w
  9704. @item height, h
  9705. Set the output video dimension expression. Default value is the input
  9706. dimension.
  9707. If the @var{width} or @var{w} is 0, the input width is used for the output.
  9708. If the @var{height} or @var{h} is 0, the input height is used for the output.
  9709. If one of the values is -1, the zscale filter will use a value that
  9710. maintains the aspect ratio of the input image, calculated from the
  9711. other specified dimension. If both of them are -1, the input size is
  9712. used
  9713. If one of the values is -n with n > 1, the zscale filter will also use a value
  9714. that maintains the aspect ratio of the input image, calculated from the other
  9715. specified dimension. After that it will, however, make sure that the calculated
  9716. dimension is divisible by n and adjust the value if necessary.
  9717. See below for the list of accepted constants for use in the dimension
  9718. expression.
  9719. @item size, s
  9720. Set the video size. For the syntax of this option, check the
  9721. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9722. @item dither, d
  9723. Set the dither type.
  9724. Possible values are:
  9725. @table @var
  9726. @item none
  9727. @item ordered
  9728. @item random
  9729. @item error_diffusion
  9730. @end table
  9731. Default is none.
  9732. @item filter, f
  9733. Set the resize filter type.
  9734. Possible values are:
  9735. @table @var
  9736. @item point
  9737. @item bilinear
  9738. @item bicubic
  9739. @item spline16
  9740. @item spline36
  9741. @item lanczos
  9742. @end table
  9743. Default is bilinear.
  9744. @item range, r
  9745. Set the color range.
  9746. Possible values are:
  9747. @table @var
  9748. @item input
  9749. @item limited
  9750. @item full
  9751. @end table
  9752. Default is same as input.
  9753. @item primaries, p
  9754. Set the color primaries.
  9755. Possible values are:
  9756. @table @var
  9757. @item input
  9758. @item 709
  9759. @item unspecified
  9760. @item 170m
  9761. @item 240m
  9762. @item 2020
  9763. @end table
  9764. Default is same as input.
  9765. @item transfer, t
  9766. Set the transfer characteristics.
  9767. Possible values are:
  9768. @table @var
  9769. @item input
  9770. @item 709
  9771. @item unspecified
  9772. @item 601
  9773. @item linear
  9774. @item 2020_10
  9775. @item 2020_12
  9776. @end table
  9777. Default is same as input.
  9778. @item matrix, m
  9779. Set the colorspace matrix.
  9780. Possible value are:
  9781. @table @var
  9782. @item input
  9783. @item 709
  9784. @item unspecified
  9785. @item 470bg
  9786. @item 170m
  9787. @item 2020_ncl
  9788. @item 2020_cl
  9789. @end table
  9790. Default is same as input.
  9791. @item rangein, rin
  9792. Set the input color range.
  9793. Possible values are:
  9794. @table @var
  9795. @item input
  9796. @item limited
  9797. @item full
  9798. @end table
  9799. Default is same as input.
  9800. @item primariesin, pin
  9801. Set the input color primaries.
  9802. Possible values are:
  9803. @table @var
  9804. @item input
  9805. @item 709
  9806. @item unspecified
  9807. @item 170m
  9808. @item 240m
  9809. @item 2020
  9810. @end table
  9811. Default is same as input.
  9812. @item transferin, tin
  9813. Set the input transfer characteristics.
  9814. Possible values are:
  9815. @table @var
  9816. @item input
  9817. @item 709
  9818. @item unspecified
  9819. @item 601
  9820. @item linear
  9821. @item 2020_10
  9822. @item 2020_12
  9823. @end table
  9824. Default is same as input.
  9825. @item matrixin, min
  9826. Set the input colorspace matrix.
  9827. Possible value are:
  9828. @table @var
  9829. @item input
  9830. @item 709
  9831. @item unspecified
  9832. @item 470bg
  9833. @item 170m
  9834. @item 2020_ncl
  9835. @item 2020_cl
  9836. @end table
  9837. @end table
  9838. The values of the @option{w} and @option{h} options are expressions
  9839. containing the following constants:
  9840. @table @var
  9841. @item in_w
  9842. @item in_h
  9843. The input width and height
  9844. @item iw
  9845. @item ih
  9846. These are the same as @var{in_w} and @var{in_h}.
  9847. @item out_w
  9848. @item out_h
  9849. The output (scaled) width and height
  9850. @item ow
  9851. @item oh
  9852. These are the same as @var{out_w} and @var{out_h}
  9853. @item a
  9854. The same as @var{iw} / @var{ih}
  9855. @item sar
  9856. input sample aspect ratio
  9857. @item dar
  9858. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  9859. @item hsub
  9860. @item vsub
  9861. horizontal and vertical input chroma subsample values. For example for the
  9862. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9863. @item ohsub
  9864. @item ovsub
  9865. horizontal and vertical output chroma subsample values. For example for the
  9866. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9867. @end table
  9868. @table @option
  9869. @end table
  9870. @c man end VIDEO FILTERS
  9871. @chapter Video Sources
  9872. @c man begin VIDEO SOURCES
  9873. Below is a description of the currently available video sources.
  9874. @section buffer
  9875. Buffer video frames, and make them available to the filter chain.
  9876. This source is mainly intended for a programmatic use, in particular
  9877. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  9878. It accepts the following parameters:
  9879. @table @option
  9880. @item video_size
  9881. Specify the size (width and height) of the buffered video frames. For the
  9882. syntax of this option, check the
  9883. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9884. @item width
  9885. The input video width.
  9886. @item height
  9887. The input video height.
  9888. @item pix_fmt
  9889. A string representing the pixel format of the buffered video frames.
  9890. It may be a number corresponding to a pixel format, or a pixel format
  9891. name.
  9892. @item time_base
  9893. Specify the timebase assumed by the timestamps of the buffered frames.
  9894. @item frame_rate
  9895. Specify the frame rate expected for the video stream.
  9896. @item pixel_aspect, sar
  9897. The sample (pixel) aspect ratio of the input video.
  9898. @item sws_param
  9899. Specify the optional parameters to be used for the scale filter which
  9900. is automatically inserted when an input change is detected in the
  9901. input size or format.
  9902. @end table
  9903. For example:
  9904. @example
  9905. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  9906. @end example
  9907. will instruct the source to accept video frames with size 320x240 and
  9908. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  9909. square pixels (1:1 sample aspect ratio).
  9910. Since the pixel format with name "yuv410p" corresponds to the number 6
  9911. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  9912. this example corresponds to:
  9913. @example
  9914. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  9915. @end example
  9916. Alternatively, the options can be specified as a flat string, but this
  9917. syntax is deprecated:
  9918. @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}]
  9919. @section cellauto
  9920. Create a pattern generated by an elementary cellular automaton.
  9921. The initial state of the cellular automaton can be defined through the
  9922. @option{filename}, and @option{pattern} options. If such options are
  9923. not specified an initial state is created randomly.
  9924. At each new frame a new row in the video is filled with the result of
  9925. the cellular automaton next generation. The behavior when the whole
  9926. frame is filled is defined by the @option{scroll} option.
  9927. This source accepts the following options:
  9928. @table @option
  9929. @item filename, f
  9930. Read the initial cellular automaton state, i.e. the starting row, from
  9931. the specified file.
  9932. In the file, each non-whitespace character is considered an alive
  9933. cell, a newline will terminate the row, and further characters in the
  9934. file will be ignored.
  9935. @item pattern, p
  9936. Read the initial cellular automaton state, i.e. the starting row, from
  9937. the specified string.
  9938. Each non-whitespace character in the string is considered an alive
  9939. cell, a newline will terminate the row, and further characters in the
  9940. string will be ignored.
  9941. @item rate, r
  9942. Set the video rate, that is the number of frames generated per second.
  9943. Default is 25.
  9944. @item random_fill_ratio, ratio
  9945. Set the random fill ratio for the initial cellular automaton row. It
  9946. is a floating point number value ranging from 0 to 1, defaults to
  9947. 1/PHI.
  9948. This option is ignored when a file or a pattern is specified.
  9949. @item random_seed, seed
  9950. Set the seed for filling randomly the initial row, must be an integer
  9951. included between 0 and UINT32_MAX. If not specified, or if explicitly
  9952. set to -1, the filter will try to use a good random seed on a best
  9953. effort basis.
  9954. @item rule
  9955. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  9956. Default value is 110.
  9957. @item size, s
  9958. Set the size of the output video. For the syntax of this option, check the
  9959. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9960. If @option{filename} or @option{pattern} is specified, the size is set
  9961. by default to the width of the specified initial state row, and the
  9962. height is set to @var{width} * PHI.
  9963. If @option{size} is set, it must contain the width of the specified
  9964. pattern string, and the specified pattern will be centered in the
  9965. larger row.
  9966. If a filename or a pattern string is not specified, the size value
  9967. defaults to "320x518" (used for a randomly generated initial state).
  9968. @item scroll
  9969. If set to 1, scroll the output upward when all the rows in the output
  9970. have been already filled. If set to 0, the new generated row will be
  9971. written over the top row just after the bottom row is filled.
  9972. Defaults to 1.
  9973. @item start_full, full
  9974. If set to 1, completely fill the output with generated rows before
  9975. outputting the first frame.
  9976. This is the default behavior, for disabling set the value to 0.
  9977. @item stitch
  9978. If set to 1, stitch the left and right row edges together.
  9979. This is the default behavior, for disabling set the value to 0.
  9980. @end table
  9981. @subsection Examples
  9982. @itemize
  9983. @item
  9984. Read the initial state from @file{pattern}, and specify an output of
  9985. size 200x400.
  9986. @example
  9987. cellauto=f=pattern:s=200x400
  9988. @end example
  9989. @item
  9990. Generate a random initial row with a width of 200 cells, with a fill
  9991. ratio of 2/3:
  9992. @example
  9993. cellauto=ratio=2/3:s=200x200
  9994. @end example
  9995. @item
  9996. Create a pattern generated by rule 18 starting by a single alive cell
  9997. centered on an initial row with width 100:
  9998. @example
  9999. cellauto=p=@@:s=100x400:full=0:rule=18
  10000. @end example
  10001. @item
  10002. Specify a more elaborated initial pattern:
  10003. @example
  10004. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  10005. @end example
  10006. @end itemize
  10007. @section mandelbrot
  10008. Generate a Mandelbrot set fractal, and progressively zoom towards the
  10009. point specified with @var{start_x} and @var{start_y}.
  10010. This source accepts the following options:
  10011. @table @option
  10012. @item end_pts
  10013. Set the terminal pts value. Default value is 400.
  10014. @item end_scale
  10015. Set the terminal scale value.
  10016. Must be a floating point value. Default value is 0.3.
  10017. @item inner
  10018. Set the inner coloring mode, that is the algorithm used to draw the
  10019. Mandelbrot fractal internal region.
  10020. It shall assume one of the following values:
  10021. @table @option
  10022. @item black
  10023. Set black mode.
  10024. @item convergence
  10025. Show time until convergence.
  10026. @item mincol
  10027. Set color based on point closest to the origin of the iterations.
  10028. @item period
  10029. Set period mode.
  10030. @end table
  10031. Default value is @var{mincol}.
  10032. @item bailout
  10033. Set the bailout value. Default value is 10.0.
  10034. @item maxiter
  10035. Set the maximum of iterations performed by the rendering
  10036. algorithm. Default value is 7189.
  10037. @item outer
  10038. Set outer coloring mode.
  10039. It shall assume one of following values:
  10040. @table @option
  10041. @item iteration_count
  10042. Set iteration cound mode.
  10043. @item normalized_iteration_count
  10044. set normalized iteration count mode.
  10045. @end table
  10046. Default value is @var{normalized_iteration_count}.
  10047. @item rate, r
  10048. Set frame rate, expressed as number of frames per second. Default
  10049. value is "25".
  10050. @item size, s
  10051. Set frame size. For the syntax of this option, check the "Video
  10052. size" section in the ffmpeg-utils manual. Default value is "640x480".
  10053. @item start_scale
  10054. Set the initial scale value. Default value is 3.0.
  10055. @item start_x
  10056. Set the initial x position. Must be a floating point value between
  10057. -100 and 100. Default value is -0.743643887037158704752191506114774.
  10058. @item start_y
  10059. Set the initial y position. Must be a floating point value between
  10060. -100 and 100. Default value is -0.131825904205311970493132056385139.
  10061. @end table
  10062. @section mptestsrc
  10063. Generate various test patterns, as generated by the MPlayer test filter.
  10064. The size of the generated video is fixed, and is 256x256.
  10065. This source is useful in particular for testing encoding features.
  10066. This source accepts the following options:
  10067. @table @option
  10068. @item rate, r
  10069. Specify the frame rate of the sourced video, as the number of frames
  10070. generated per second. It has to be a string in the format
  10071. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  10072. number or a valid video frame rate abbreviation. The default value is
  10073. "25".
  10074. @item duration, d
  10075. Set the duration of the sourced video. See
  10076. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  10077. for the accepted syntax.
  10078. If not specified, or the expressed duration is negative, the video is
  10079. supposed to be generated forever.
  10080. @item test, t
  10081. Set the number or the name of the test to perform. Supported tests are:
  10082. @table @option
  10083. @item dc_luma
  10084. @item dc_chroma
  10085. @item freq_luma
  10086. @item freq_chroma
  10087. @item amp_luma
  10088. @item amp_chroma
  10089. @item cbp
  10090. @item mv
  10091. @item ring1
  10092. @item ring2
  10093. @item all
  10094. @end table
  10095. Default value is "all", which will cycle through the list of all tests.
  10096. @end table
  10097. Some examples:
  10098. @example
  10099. mptestsrc=t=dc_luma
  10100. @end example
  10101. will generate a "dc_luma" test pattern.
  10102. @section frei0r_src
  10103. Provide a frei0r source.
  10104. To enable compilation of this filter you need to install the frei0r
  10105. header and configure FFmpeg with @code{--enable-frei0r}.
  10106. This source accepts the following parameters:
  10107. @table @option
  10108. @item size
  10109. The size of the video to generate. For the syntax of this option, check the
  10110. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10111. @item framerate
  10112. The framerate of the generated video. It may be a string of the form
  10113. @var{num}/@var{den} or a frame rate abbreviation.
  10114. @item filter_name
  10115. The name to the frei0r source to load. For more information regarding frei0r and
  10116. how to set the parameters, read the @ref{frei0r} section in the video filters
  10117. documentation.
  10118. @item filter_params
  10119. A '|'-separated list of parameters to pass to the frei0r source.
  10120. @end table
  10121. For example, to generate a frei0r partik0l source with size 200x200
  10122. and frame rate 10 which is overlaid on the overlay filter main input:
  10123. @example
  10124. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  10125. @end example
  10126. @section life
  10127. Generate a life pattern.
  10128. This source is based on a generalization of John Conway's life game.
  10129. The sourced input represents a life grid, each pixel represents a cell
  10130. which can be in one of two possible states, alive or dead. Every cell
  10131. interacts with its eight neighbours, which are the cells that are
  10132. horizontally, vertically, or diagonally adjacent.
  10133. At each interaction the grid evolves according to the adopted rule,
  10134. which specifies the number of neighbor alive cells which will make a
  10135. cell stay alive or born. The @option{rule} option allows one to specify
  10136. the rule to adopt.
  10137. This source accepts the following options:
  10138. @table @option
  10139. @item filename, f
  10140. Set the file from which to read the initial grid state. In the file,
  10141. each non-whitespace character is considered an alive cell, and newline
  10142. is used to delimit the end of each row.
  10143. If this option is not specified, the initial grid is generated
  10144. randomly.
  10145. @item rate, r
  10146. Set the video rate, that is the number of frames generated per second.
  10147. Default is 25.
  10148. @item random_fill_ratio, ratio
  10149. Set the random fill ratio for the initial random grid. It is a
  10150. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  10151. It is ignored when a file is specified.
  10152. @item random_seed, seed
  10153. Set the seed for filling the initial random grid, must be an integer
  10154. included between 0 and UINT32_MAX. If not specified, or if explicitly
  10155. set to -1, the filter will try to use a good random seed on a best
  10156. effort basis.
  10157. @item rule
  10158. Set the life rule.
  10159. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  10160. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  10161. @var{NS} specifies the number of alive neighbor cells which make a
  10162. live cell stay alive, and @var{NB} the number of alive neighbor cells
  10163. which make a dead cell to become alive (i.e. to "born").
  10164. "s" and "b" can be used in place of "S" and "B", respectively.
  10165. Alternatively a rule can be specified by an 18-bits integer. The 9
  10166. high order bits are used to encode the next cell state if it is alive
  10167. for each number of neighbor alive cells, the low order bits specify
  10168. the rule for "borning" new cells. Higher order bits encode for an
  10169. higher number of neighbor cells.
  10170. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  10171. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  10172. Default value is "S23/B3", which is the original Conway's game of life
  10173. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  10174. cells, and will born a new cell if there are three alive cells around
  10175. a dead cell.
  10176. @item size, s
  10177. Set the size of the output video. For the syntax of this option, check the
  10178. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10179. If @option{filename} is specified, the size is set by default to the
  10180. same size of the input file. If @option{size} is set, it must contain
  10181. the size specified in the input file, and the initial grid defined in
  10182. that file is centered in the larger resulting area.
  10183. If a filename is not specified, the size value defaults to "320x240"
  10184. (used for a randomly generated initial grid).
  10185. @item stitch
  10186. If set to 1, stitch the left and right grid edges together, and the
  10187. top and bottom edges also. Defaults to 1.
  10188. @item mold
  10189. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  10190. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  10191. value from 0 to 255.
  10192. @item life_color
  10193. Set the color of living (or new born) cells.
  10194. @item death_color
  10195. Set the color of dead cells. If @option{mold} is set, this is the first color
  10196. used to represent a dead cell.
  10197. @item mold_color
  10198. Set mold color, for definitely dead and moldy cells.
  10199. For the syntax of these 3 color options, check the "Color" section in the
  10200. ffmpeg-utils manual.
  10201. @end table
  10202. @subsection Examples
  10203. @itemize
  10204. @item
  10205. Read a grid from @file{pattern}, and center it on a grid of size
  10206. 300x300 pixels:
  10207. @example
  10208. life=f=pattern:s=300x300
  10209. @end example
  10210. @item
  10211. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  10212. @example
  10213. life=ratio=2/3:s=200x200
  10214. @end example
  10215. @item
  10216. Specify a custom rule for evolving a randomly generated grid:
  10217. @example
  10218. life=rule=S14/B34
  10219. @end example
  10220. @item
  10221. Full example with slow death effect (mold) using @command{ffplay}:
  10222. @example
  10223. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  10224. @end example
  10225. @end itemize
  10226. @anchor{allrgb}
  10227. @anchor{allyuv}
  10228. @anchor{color}
  10229. @anchor{haldclutsrc}
  10230. @anchor{nullsrc}
  10231. @anchor{rgbtestsrc}
  10232. @anchor{smptebars}
  10233. @anchor{smptehdbars}
  10234. @anchor{testsrc}
  10235. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc
  10236. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  10237. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  10238. The @code{color} source provides an uniformly colored input.
  10239. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  10240. @ref{haldclut} filter.
  10241. The @code{nullsrc} source returns unprocessed video frames. It is
  10242. mainly useful to be employed in analysis / debugging tools, or as the
  10243. source for filters which ignore the input data.
  10244. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  10245. detecting RGB vs BGR issues. You should see a red, green and blue
  10246. stripe from top to bottom.
  10247. The @code{smptebars} source generates a color bars pattern, based on
  10248. the SMPTE Engineering Guideline EG 1-1990.
  10249. The @code{smptehdbars} source generates a color bars pattern, based on
  10250. the SMPTE RP 219-2002.
  10251. The @code{testsrc} source generates a test video pattern, showing a
  10252. color pattern, a scrolling gradient and a timestamp. This is mainly
  10253. intended for testing purposes.
  10254. The sources accept the following parameters:
  10255. @table @option
  10256. @item color, c
  10257. Specify the color of the source, only available in the @code{color}
  10258. source. For the syntax of this option, check the "Color" section in the
  10259. ffmpeg-utils manual.
  10260. @item level
  10261. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  10262. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  10263. pixels to be used as identity matrix for 3D lookup tables. Each component is
  10264. coded on a @code{1/(N*N)} scale.
  10265. @item size, s
  10266. Specify the size of the sourced video. For the syntax of this option, check the
  10267. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10268. The default value is @code{320x240}.
  10269. This option is not available with the @code{haldclutsrc} filter.
  10270. @item rate, r
  10271. Specify the frame rate of the sourced video, as the number of frames
  10272. generated per second. It has to be a string in the format
  10273. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  10274. number or a valid video frame rate abbreviation. The default value is
  10275. "25".
  10276. @item sar
  10277. Set the sample aspect ratio of the sourced video.
  10278. @item duration, d
  10279. Set the duration of the sourced video. See
  10280. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  10281. for the accepted syntax.
  10282. If not specified, or the expressed duration is negative, the video is
  10283. supposed to be generated forever.
  10284. @item decimals, n
  10285. Set the number of decimals to show in the timestamp, only available in the
  10286. @code{testsrc} source.
  10287. The displayed timestamp value will correspond to the original
  10288. timestamp value multiplied by the power of 10 of the specified
  10289. value. Default value is 0.
  10290. @end table
  10291. For example the following:
  10292. @example
  10293. testsrc=duration=5.3:size=qcif:rate=10
  10294. @end example
  10295. will generate a video with a duration of 5.3 seconds, with size
  10296. 176x144 and a frame rate of 10 frames per second.
  10297. The following graph description will generate a red source
  10298. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  10299. frames per second.
  10300. @example
  10301. color=c=red@@0.2:s=qcif:r=10
  10302. @end example
  10303. If the input content is to be ignored, @code{nullsrc} can be used. The
  10304. following command generates noise in the luminance plane by employing
  10305. the @code{geq} filter:
  10306. @example
  10307. nullsrc=s=256x256, geq=random(1)*255:128:128
  10308. @end example
  10309. @subsection Commands
  10310. The @code{color} source supports the following commands:
  10311. @table @option
  10312. @item c, color
  10313. Set the color of the created image. Accepts the same syntax of the
  10314. corresponding @option{color} option.
  10315. @end table
  10316. @c man end VIDEO SOURCES
  10317. @chapter Video Sinks
  10318. @c man begin VIDEO SINKS
  10319. Below is a description of the currently available video sinks.
  10320. @section buffersink
  10321. Buffer video frames, and make them available to the end of the filter
  10322. graph.
  10323. This sink is mainly intended for programmatic use, in particular
  10324. through the interface defined in @file{libavfilter/buffersink.h}
  10325. or the options system.
  10326. It accepts a pointer to an AVBufferSinkContext structure, which
  10327. defines the incoming buffers' formats, to be passed as the opaque
  10328. parameter to @code{avfilter_init_filter} for initialization.
  10329. @section nullsink
  10330. Null video sink: do absolutely nothing with the input video. It is
  10331. mainly useful as a template and for use in analysis / debugging
  10332. tools.
  10333. @c man end VIDEO SINKS
  10334. @chapter Multimedia Filters
  10335. @c man begin MULTIMEDIA FILTERS
  10336. Below is a description of the currently available multimedia filters.
  10337. @section ahistogram
  10338. Convert input audio to a video output, displaying the volume histogram.
  10339. The filter accepts the following options:
  10340. @table @option
  10341. @item dmode
  10342. Specify how histogram is calculated.
  10343. It accepts the following values:
  10344. @table @samp
  10345. @item single
  10346. Use single histogram for all channels.
  10347. @item separate
  10348. Use separate histogram for each channel.
  10349. @end table
  10350. Default is @code{single}.
  10351. @item rate, r
  10352. Set frame rate, expressed as number of frames per second. Default
  10353. value is "25".
  10354. @item size, s
  10355. Specify the video size for the output. For the syntax of this option, check the
  10356. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10357. Default value is @code{hd720}.
  10358. @item scale
  10359. Set display scale.
  10360. It accepts the following values:
  10361. @table @samp
  10362. @item log
  10363. logarithmic
  10364. @item sqrt
  10365. square root
  10366. @item cbrt
  10367. cubic root
  10368. @item lin
  10369. linear
  10370. @item rlog
  10371. reverse logarithmic
  10372. @end table
  10373. Default is @code{log}.
  10374. @item ascale
  10375. Set amplitude scale.
  10376. It accepts the following values:
  10377. @table @samp
  10378. @item log
  10379. logarithmic
  10380. @item lin
  10381. linear
  10382. @end table
  10383. Default is @code{log}.
  10384. @item acount
  10385. Set how much frames to accumulate in histogram.
  10386. Defauls is 1. Setting this to -1 accumulates all frames.
  10387. @item rheight
  10388. Set histogram ratio of window height.
  10389. @item slide
  10390. Set sonogram sliding.
  10391. It accepts the following values:
  10392. @table @samp
  10393. @item replace
  10394. replace old rows with new ones.
  10395. @item scroll
  10396. scroll from top to bottom.
  10397. @end table
  10398. Default is @code{replace}.
  10399. @end table
  10400. @section aphasemeter
  10401. Convert input audio to a video output, displaying the audio phase.
  10402. The filter accepts the following options:
  10403. @table @option
  10404. @item rate, r
  10405. Set the output frame rate. Default value is @code{25}.
  10406. @item size, s
  10407. Set the video size for the output. For the syntax of this option, check the
  10408. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10409. Default value is @code{800x400}.
  10410. @item rc
  10411. @item gc
  10412. @item bc
  10413. Specify the red, green, blue contrast. Default values are @code{2},
  10414. @code{7} and @code{1}.
  10415. Allowed range is @code{[0, 255]}.
  10416. @item mpc
  10417. Set color which will be used for drawing median phase. If color is
  10418. @code{none} which is default, no median phase value will be drawn.
  10419. @end table
  10420. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  10421. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  10422. The @code{-1} means left and right channels are completely out of phase and
  10423. @code{1} means channels are in phase.
  10424. @section avectorscope
  10425. Convert input audio to a video output, representing the audio vector
  10426. scope.
  10427. The filter is used to measure the difference between channels of stereo
  10428. audio stream. A monoaural signal, consisting of identical left and right
  10429. signal, results in straight vertical line. Any stereo separation is visible
  10430. as a deviation from this line, creating a Lissajous figure.
  10431. If the straight (or deviation from it) but horizontal line appears this
  10432. indicates that the left and right channels are out of phase.
  10433. The filter accepts the following options:
  10434. @table @option
  10435. @item mode, m
  10436. Set the vectorscope mode.
  10437. Available values are:
  10438. @table @samp
  10439. @item lissajous
  10440. Lissajous rotated by 45 degrees.
  10441. @item lissajous_xy
  10442. Same as above but not rotated.
  10443. @item polar
  10444. Shape resembling half of circle.
  10445. @end table
  10446. Default value is @samp{lissajous}.
  10447. @item size, s
  10448. Set the video size for the output. For the syntax of this option, check the
  10449. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10450. Default value is @code{400x400}.
  10451. @item rate, r
  10452. Set the output frame rate. Default value is @code{25}.
  10453. @item rc
  10454. @item gc
  10455. @item bc
  10456. @item ac
  10457. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  10458. @code{160}, @code{80} and @code{255}.
  10459. Allowed range is @code{[0, 255]}.
  10460. @item rf
  10461. @item gf
  10462. @item bf
  10463. @item af
  10464. Specify the red, green, blue and alpha fade. Default values are @code{15},
  10465. @code{10}, @code{5} and @code{5}.
  10466. Allowed range is @code{[0, 255]}.
  10467. @item zoom
  10468. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  10469. @item draw
  10470. Set the vectorscope drawing mode.
  10471. Available values are:
  10472. @table @samp
  10473. @item dot
  10474. Draw dot for each sample.
  10475. @item line
  10476. Draw line between previous and current sample.
  10477. @end table
  10478. Default value is @samp{dot}.
  10479. @end table
  10480. @subsection Examples
  10481. @itemize
  10482. @item
  10483. Complete example using @command{ffplay}:
  10484. @example
  10485. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  10486. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  10487. @end example
  10488. @end itemize
  10489. @section concat
  10490. Concatenate audio and video streams, joining them together one after the
  10491. other.
  10492. The filter works on segments of synchronized video and audio streams. All
  10493. segments must have the same number of streams of each type, and that will
  10494. also be the number of streams at output.
  10495. The filter accepts the following options:
  10496. @table @option
  10497. @item n
  10498. Set the number of segments. Default is 2.
  10499. @item v
  10500. Set the number of output video streams, that is also the number of video
  10501. streams in each segment. Default is 1.
  10502. @item a
  10503. Set the number of output audio streams, that is also the number of audio
  10504. streams in each segment. Default is 0.
  10505. @item unsafe
  10506. Activate unsafe mode: do not fail if segments have a different format.
  10507. @end table
  10508. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  10509. @var{a} audio outputs.
  10510. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  10511. segment, in the same order as the outputs, then the inputs for the second
  10512. segment, etc.
  10513. Related streams do not always have exactly the same duration, for various
  10514. reasons including codec frame size or sloppy authoring. For that reason,
  10515. related synchronized streams (e.g. a video and its audio track) should be
  10516. concatenated at once. The concat filter will use the duration of the longest
  10517. stream in each segment (except the last one), and if necessary pad shorter
  10518. audio streams with silence.
  10519. For this filter to work correctly, all segments must start at timestamp 0.
  10520. All corresponding streams must have the same parameters in all segments; the
  10521. filtering system will automatically select a common pixel format for video
  10522. streams, and a common sample format, sample rate and channel layout for
  10523. audio streams, but other settings, such as resolution, must be converted
  10524. explicitly by the user.
  10525. Different frame rates are acceptable but will result in variable frame rate
  10526. at output; be sure to configure the output file to handle it.
  10527. @subsection Examples
  10528. @itemize
  10529. @item
  10530. Concatenate an opening, an episode and an ending, all in bilingual version
  10531. (video in stream 0, audio in streams 1 and 2):
  10532. @example
  10533. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  10534. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  10535. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  10536. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  10537. @end example
  10538. @item
  10539. Concatenate two parts, handling audio and video separately, using the
  10540. (a)movie sources, and adjusting the resolution:
  10541. @example
  10542. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  10543. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  10544. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  10545. @end example
  10546. Note that a desync will happen at the stitch if the audio and video streams
  10547. do not have exactly the same duration in the first file.
  10548. @end itemize
  10549. @anchor{ebur128}
  10550. @section ebur128
  10551. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  10552. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  10553. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  10554. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  10555. The filter also has a video output (see the @var{video} option) with a real
  10556. time graph to observe the loudness evolution. The graphic contains the logged
  10557. message mentioned above, so it is not printed anymore when this option is set,
  10558. unless the verbose logging is set. The main graphing area contains the
  10559. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  10560. the momentary loudness (400 milliseconds).
  10561. More information about the Loudness Recommendation EBU R128 on
  10562. @url{http://tech.ebu.ch/loudness}.
  10563. The filter accepts the following options:
  10564. @table @option
  10565. @item video
  10566. Activate the video output. The audio stream is passed unchanged whether this
  10567. option is set or no. The video stream will be the first output stream if
  10568. activated. Default is @code{0}.
  10569. @item size
  10570. Set the video size. This option is for video only. For the syntax of this
  10571. option, check the
  10572. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10573. Default and minimum resolution is @code{640x480}.
  10574. @item meter
  10575. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  10576. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  10577. other integer value between this range is allowed.
  10578. @item metadata
  10579. Set metadata injection. If set to @code{1}, the audio input will be segmented
  10580. into 100ms output frames, each of them containing various loudness information
  10581. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  10582. Default is @code{0}.
  10583. @item framelog
  10584. Force the frame logging level.
  10585. Available values are:
  10586. @table @samp
  10587. @item info
  10588. information logging level
  10589. @item verbose
  10590. verbose logging level
  10591. @end table
  10592. By default, the logging level is set to @var{info}. If the @option{video} or
  10593. the @option{metadata} options are set, it switches to @var{verbose}.
  10594. @item peak
  10595. Set peak mode(s).
  10596. Available modes can be cumulated (the option is a @code{flag} type). Possible
  10597. values are:
  10598. @table @samp
  10599. @item none
  10600. Disable any peak mode (default).
  10601. @item sample
  10602. Enable sample-peak mode.
  10603. Simple peak mode looking for the higher sample value. It logs a message
  10604. for sample-peak (identified by @code{SPK}).
  10605. @item true
  10606. Enable true-peak mode.
  10607. If enabled, the peak lookup is done on an over-sampled version of the input
  10608. stream for better peak accuracy. It logs a message for true-peak.
  10609. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  10610. This mode requires a build with @code{libswresample}.
  10611. @end table
  10612. @item dualmono
  10613. Treat mono input files as "dual mono". If a mono file is intended for playback
  10614. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  10615. If set to @code{true}, this option will compensate for this effect.
  10616. Multi-channel input files are not affected by this option.
  10617. @item panlaw
  10618. Set a specific pan law to be used for the measurement of dual mono files.
  10619. This parameter is optional, and has a default value of -3.01dB.
  10620. @end table
  10621. @subsection Examples
  10622. @itemize
  10623. @item
  10624. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  10625. @example
  10626. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  10627. @end example
  10628. @item
  10629. Run an analysis with @command{ffmpeg}:
  10630. @example
  10631. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  10632. @end example
  10633. @end itemize
  10634. @section interleave, ainterleave
  10635. Temporally interleave frames from several inputs.
  10636. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  10637. These filters read frames from several inputs and send the oldest
  10638. queued frame to the output.
  10639. Input streams must have a well defined, monotonically increasing frame
  10640. timestamp values.
  10641. In order to submit one frame to output, these filters need to enqueue
  10642. at least one frame for each input, so they cannot work in case one
  10643. input is not yet terminated and will not receive incoming frames.
  10644. For example consider the case when one input is a @code{select} filter
  10645. which always drop input frames. The @code{interleave} filter will keep
  10646. reading from that input, but it will never be able to send new frames
  10647. to output until the input will send an end-of-stream signal.
  10648. Also, depending on inputs synchronization, the filters will drop
  10649. frames in case one input receives more frames than the other ones, and
  10650. the queue is already filled.
  10651. These filters accept the following options:
  10652. @table @option
  10653. @item nb_inputs, n
  10654. Set the number of different inputs, it is 2 by default.
  10655. @end table
  10656. @subsection Examples
  10657. @itemize
  10658. @item
  10659. Interleave frames belonging to different streams using @command{ffmpeg}:
  10660. @example
  10661. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  10662. @end example
  10663. @item
  10664. Add flickering blur effect:
  10665. @example
  10666. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  10667. @end example
  10668. @end itemize
  10669. @section perms, aperms
  10670. Set read/write permissions for the output frames.
  10671. These filters are mainly aimed at developers to test direct path in the
  10672. following filter in the filtergraph.
  10673. The filters accept the following options:
  10674. @table @option
  10675. @item mode
  10676. Select the permissions mode.
  10677. It accepts the following values:
  10678. @table @samp
  10679. @item none
  10680. Do nothing. This is the default.
  10681. @item ro
  10682. Set all the output frames read-only.
  10683. @item rw
  10684. Set all the output frames directly writable.
  10685. @item toggle
  10686. Make the frame read-only if writable, and writable if read-only.
  10687. @item random
  10688. Set each output frame read-only or writable randomly.
  10689. @end table
  10690. @item seed
  10691. Set the seed for the @var{random} mode, must be an integer included between
  10692. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  10693. @code{-1}, the filter will try to use a good random seed on a best effort
  10694. basis.
  10695. @end table
  10696. Note: in case of auto-inserted filter between the permission filter and the
  10697. following one, the permission might not be received as expected in that
  10698. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  10699. perms/aperms filter can avoid this problem.
  10700. @section realtime, arealtime
  10701. Slow down filtering to match real time approximatively.
  10702. These filters will pause the filtering for a variable amount of time to
  10703. match the output rate with the input timestamps.
  10704. They are similar to the @option{re} option to @code{ffmpeg}.
  10705. They accept the following options:
  10706. @table @option
  10707. @item limit
  10708. Time limit for the pauses. Any pause longer than that will be considered
  10709. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  10710. @end table
  10711. @section select, aselect
  10712. Select frames to pass in output.
  10713. This filter accepts the following options:
  10714. @table @option
  10715. @item expr, e
  10716. Set expression, which is evaluated for each input frame.
  10717. If the expression is evaluated to zero, the frame is discarded.
  10718. If the evaluation result is negative or NaN, the frame is sent to the
  10719. first output; otherwise it is sent to the output with index
  10720. @code{ceil(val)-1}, assuming that the input index starts from 0.
  10721. For example a value of @code{1.2} corresponds to the output with index
  10722. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  10723. @item outputs, n
  10724. Set the number of outputs. The output to which to send the selected
  10725. frame is based on the result of the evaluation. Default value is 1.
  10726. @end table
  10727. The expression can contain the following constants:
  10728. @table @option
  10729. @item n
  10730. The (sequential) number of the filtered frame, starting from 0.
  10731. @item selected_n
  10732. The (sequential) number of the selected frame, starting from 0.
  10733. @item prev_selected_n
  10734. The sequential number of the last selected frame. It's NAN if undefined.
  10735. @item TB
  10736. The timebase of the input timestamps.
  10737. @item pts
  10738. The PTS (Presentation TimeStamp) of the filtered video frame,
  10739. expressed in @var{TB} units. It's NAN if undefined.
  10740. @item t
  10741. The PTS of the filtered video frame,
  10742. expressed in seconds. It's NAN if undefined.
  10743. @item prev_pts
  10744. The PTS of the previously filtered video frame. It's NAN if undefined.
  10745. @item prev_selected_pts
  10746. The PTS of the last previously filtered video frame. It's NAN if undefined.
  10747. @item prev_selected_t
  10748. The PTS of the last previously selected video frame. It's NAN if undefined.
  10749. @item start_pts
  10750. The PTS of the first video frame in the video. It's NAN if undefined.
  10751. @item start_t
  10752. The time of the first video frame in the video. It's NAN if undefined.
  10753. @item pict_type @emph{(video only)}
  10754. The type of the filtered frame. It can assume one of the following
  10755. values:
  10756. @table @option
  10757. @item I
  10758. @item P
  10759. @item B
  10760. @item S
  10761. @item SI
  10762. @item SP
  10763. @item BI
  10764. @end table
  10765. @item interlace_type @emph{(video only)}
  10766. The frame interlace type. It can assume one of the following values:
  10767. @table @option
  10768. @item PROGRESSIVE
  10769. The frame is progressive (not interlaced).
  10770. @item TOPFIRST
  10771. The frame is top-field-first.
  10772. @item BOTTOMFIRST
  10773. The frame is bottom-field-first.
  10774. @end table
  10775. @item consumed_sample_n @emph{(audio only)}
  10776. the number of selected samples before the current frame
  10777. @item samples_n @emph{(audio only)}
  10778. the number of samples in the current frame
  10779. @item sample_rate @emph{(audio only)}
  10780. the input sample rate
  10781. @item key
  10782. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  10783. @item pos
  10784. the position in the file of the filtered frame, -1 if the information
  10785. is not available (e.g. for synthetic video)
  10786. @item scene @emph{(video only)}
  10787. value between 0 and 1 to indicate a new scene; a low value reflects a low
  10788. probability for the current frame to introduce a new scene, while a higher
  10789. value means the current frame is more likely to be one (see the example below)
  10790. @item concatdec_select
  10791. The concat demuxer can select only part of a concat input file by setting an
  10792. inpoint and an outpoint, but the output packets may not be entirely contained
  10793. in the selected interval. By using this variable, it is possible to skip frames
  10794. generated by the concat demuxer which are not exactly contained in the selected
  10795. interval.
  10796. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  10797. and the @var{lavf.concat.duration} packet metadata values which are also
  10798. present in the decoded frames.
  10799. The @var{concatdec_select} variable is -1 if the frame pts is at least
  10800. start_time and either the duration metadata is missing or the frame pts is less
  10801. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  10802. missing.
  10803. That basically means that an input frame is selected if its pts is within the
  10804. interval set by the concat demuxer.
  10805. @end table
  10806. The default value of the select expression is "1".
  10807. @subsection Examples
  10808. @itemize
  10809. @item
  10810. Select all frames in input:
  10811. @example
  10812. select
  10813. @end example
  10814. The example above is the same as:
  10815. @example
  10816. select=1
  10817. @end example
  10818. @item
  10819. Skip all frames:
  10820. @example
  10821. select=0
  10822. @end example
  10823. @item
  10824. Select only I-frames:
  10825. @example
  10826. select='eq(pict_type\,I)'
  10827. @end example
  10828. @item
  10829. Select one frame every 100:
  10830. @example
  10831. select='not(mod(n\,100))'
  10832. @end example
  10833. @item
  10834. Select only frames contained in the 10-20 time interval:
  10835. @example
  10836. select=between(t\,10\,20)
  10837. @end example
  10838. @item
  10839. Select only I frames contained in the 10-20 time interval:
  10840. @example
  10841. select=between(t\,10\,20)*eq(pict_type\,I)
  10842. @end example
  10843. @item
  10844. Select frames with a minimum distance of 10 seconds:
  10845. @example
  10846. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  10847. @end example
  10848. @item
  10849. Use aselect to select only audio frames with samples number > 100:
  10850. @example
  10851. aselect='gt(samples_n\,100)'
  10852. @end example
  10853. @item
  10854. Create a mosaic of the first scenes:
  10855. @example
  10856. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  10857. @end example
  10858. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  10859. choice.
  10860. @item
  10861. Send even and odd frames to separate outputs, and compose them:
  10862. @example
  10863. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  10864. @end example
  10865. @item
  10866. Select useful frames from an ffconcat file which is using inpoints and
  10867. outpoints but where the source files are not intra frame only.
  10868. @example
  10869. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  10870. @end example
  10871. @end itemize
  10872. @section sendcmd, asendcmd
  10873. Send commands to filters in the filtergraph.
  10874. These filters read commands to be sent to other filters in the
  10875. filtergraph.
  10876. @code{sendcmd} must be inserted between two video filters,
  10877. @code{asendcmd} must be inserted between two audio filters, but apart
  10878. from that they act the same way.
  10879. The specification of commands can be provided in the filter arguments
  10880. with the @var{commands} option, or in a file specified by the
  10881. @var{filename} option.
  10882. These filters accept the following options:
  10883. @table @option
  10884. @item commands, c
  10885. Set the commands to be read and sent to the other filters.
  10886. @item filename, f
  10887. Set the filename of the commands to be read and sent to the other
  10888. filters.
  10889. @end table
  10890. @subsection Commands syntax
  10891. A commands description consists of a sequence of interval
  10892. specifications, comprising a list of commands to be executed when a
  10893. particular event related to that interval occurs. The occurring event
  10894. is typically the current frame time entering or leaving a given time
  10895. interval.
  10896. An interval is specified by the following syntax:
  10897. @example
  10898. @var{START}[-@var{END}] @var{COMMANDS};
  10899. @end example
  10900. The time interval is specified by the @var{START} and @var{END} times.
  10901. @var{END} is optional and defaults to the maximum time.
  10902. The current frame time is considered within the specified interval if
  10903. it is included in the interval [@var{START}, @var{END}), that is when
  10904. the time is greater or equal to @var{START} and is lesser than
  10905. @var{END}.
  10906. @var{COMMANDS} consists of a sequence of one or more command
  10907. specifications, separated by ",", relating to that interval. The
  10908. syntax of a command specification is given by:
  10909. @example
  10910. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  10911. @end example
  10912. @var{FLAGS} is optional and specifies the type of events relating to
  10913. the time interval which enable sending the specified command, and must
  10914. be a non-null sequence of identifier flags separated by "+" or "|" and
  10915. enclosed between "[" and "]".
  10916. The following flags are recognized:
  10917. @table @option
  10918. @item enter
  10919. The command is sent when the current frame timestamp enters the
  10920. specified interval. In other words, the command is sent when the
  10921. previous frame timestamp was not in the given interval, and the
  10922. current is.
  10923. @item leave
  10924. The command is sent when the current frame timestamp leaves the
  10925. specified interval. In other words, the command is sent when the
  10926. previous frame timestamp was in the given interval, and the
  10927. current is not.
  10928. @end table
  10929. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  10930. assumed.
  10931. @var{TARGET} specifies the target of the command, usually the name of
  10932. the filter class or a specific filter instance name.
  10933. @var{COMMAND} specifies the name of the command for the target filter.
  10934. @var{ARG} is optional and specifies the optional list of argument for
  10935. the given @var{COMMAND}.
  10936. Between one interval specification and another, whitespaces, or
  10937. sequences of characters starting with @code{#} until the end of line,
  10938. are ignored and can be used to annotate comments.
  10939. A simplified BNF description of the commands specification syntax
  10940. follows:
  10941. @example
  10942. @var{COMMAND_FLAG} ::= "enter" | "leave"
  10943. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  10944. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  10945. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  10946. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  10947. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  10948. @end example
  10949. @subsection Examples
  10950. @itemize
  10951. @item
  10952. Specify audio tempo change at second 4:
  10953. @example
  10954. asendcmd=c='4.0 atempo tempo 1.5',atempo
  10955. @end example
  10956. @item
  10957. Specify a list of drawtext and hue commands in a file.
  10958. @example
  10959. # show text in the interval 5-10
  10960. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  10961. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  10962. # desaturate the image in the interval 15-20
  10963. 15.0-20.0 [enter] hue s 0,
  10964. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  10965. [leave] hue s 1,
  10966. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  10967. # apply an exponential saturation fade-out effect, starting from time 25
  10968. 25 [enter] hue s exp(25-t)
  10969. @end example
  10970. A filtergraph allowing to read and process the above command list
  10971. stored in a file @file{test.cmd}, can be specified with:
  10972. @example
  10973. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  10974. @end example
  10975. @end itemize
  10976. @anchor{setpts}
  10977. @section setpts, asetpts
  10978. Change the PTS (presentation timestamp) of the input frames.
  10979. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  10980. This filter accepts the following options:
  10981. @table @option
  10982. @item expr
  10983. The expression which is evaluated for each frame to construct its timestamp.
  10984. @end table
  10985. The expression is evaluated through the eval API and can contain the following
  10986. constants:
  10987. @table @option
  10988. @item FRAME_RATE
  10989. frame rate, only defined for constant frame-rate video
  10990. @item PTS
  10991. The presentation timestamp in input
  10992. @item N
  10993. The count of the input frame for video or the number of consumed samples,
  10994. not including the current frame for audio, starting from 0.
  10995. @item NB_CONSUMED_SAMPLES
  10996. The number of consumed samples, not including the current frame (only
  10997. audio)
  10998. @item NB_SAMPLES, S
  10999. The number of samples in the current frame (only audio)
  11000. @item SAMPLE_RATE, SR
  11001. The audio sample rate.
  11002. @item STARTPTS
  11003. The PTS of the first frame.
  11004. @item STARTT
  11005. the time in seconds of the first frame
  11006. @item INTERLACED
  11007. State whether the current frame is interlaced.
  11008. @item T
  11009. the time in seconds of the current frame
  11010. @item POS
  11011. original position in the file of the frame, or undefined if undefined
  11012. for the current frame
  11013. @item PREV_INPTS
  11014. The previous input PTS.
  11015. @item PREV_INT
  11016. previous input time in seconds
  11017. @item PREV_OUTPTS
  11018. The previous output PTS.
  11019. @item PREV_OUTT
  11020. previous output time in seconds
  11021. @item RTCTIME
  11022. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  11023. instead.
  11024. @item RTCSTART
  11025. The wallclock (RTC) time at the start of the movie in microseconds.
  11026. @item TB
  11027. The timebase of the input timestamps.
  11028. @end table
  11029. @subsection Examples
  11030. @itemize
  11031. @item
  11032. Start counting PTS from zero
  11033. @example
  11034. setpts=PTS-STARTPTS
  11035. @end example
  11036. @item
  11037. Apply fast motion effect:
  11038. @example
  11039. setpts=0.5*PTS
  11040. @end example
  11041. @item
  11042. Apply slow motion effect:
  11043. @example
  11044. setpts=2.0*PTS
  11045. @end example
  11046. @item
  11047. Set fixed rate of 25 frames per second:
  11048. @example
  11049. setpts=N/(25*TB)
  11050. @end example
  11051. @item
  11052. Set fixed rate 25 fps with some jitter:
  11053. @example
  11054. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  11055. @end example
  11056. @item
  11057. Apply an offset of 10 seconds to the input PTS:
  11058. @example
  11059. setpts=PTS+10/TB
  11060. @end example
  11061. @item
  11062. Generate timestamps from a "live source" and rebase onto the current timebase:
  11063. @example
  11064. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  11065. @end example
  11066. @item
  11067. Generate timestamps by counting samples:
  11068. @example
  11069. asetpts=N/SR/TB
  11070. @end example
  11071. @end itemize
  11072. @section settb, asettb
  11073. Set the timebase to use for the output frames timestamps.
  11074. It is mainly useful for testing timebase configuration.
  11075. It accepts the following parameters:
  11076. @table @option
  11077. @item expr, tb
  11078. The expression which is evaluated into the output timebase.
  11079. @end table
  11080. The value for @option{tb} is an arithmetic expression representing a
  11081. rational. The expression can contain the constants "AVTB" (the default
  11082. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  11083. audio only). Default value is "intb".
  11084. @subsection Examples
  11085. @itemize
  11086. @item
  11087. Set the timebase to 1/25:
  11088. @example
  11089. settb=expr=1/25
  11090. @end example
  11091. @item
  11092. Set the timebase to 1/10:
  11093. @example
  11094. settb=expr=0.1
  11095. @end example
  11096. @item
  11097. Set the timebase to 1001/1000:
  11098. @example
  11099. settb=1+0.001
  11100. @end example
  11101. @item
  11102. Set the timebase to 2*intb:
  11103. @example
  11104. settb=2*intb
  11105. @end example
  11106. @item
  11107. Set the default timebase value:
  11108. @example
  11109. settb=AVTB
  11110. @end example
  11111. @end itemize
  11112. @section showcqt
  11113. Convert input audio to a video output representing frequency spectrum
  11114. logarithmically using Brown-Puckette constant Q transform algorithm with
  11115. direct frequency domain coefficient calculation (but the transform itself
  11116. is not really constant Q, instead the Q factor is actually variable/clamped),
  11117. with musical tone scale, from E0 to D#10.
  11118. The filter accepts the following options:
  11119. @table @option
  11120. @item size, s
  11121. Specify the video size for the output. It must be even. For the syntax of this option,
  11122. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11123. Default value is @code{1920x1080}.
  11124. @item fps, rate, r
  11125. Set the output frame rate. Default value is @code{25}.
  11126. @item bar_h
  11127. Set the bargraph height. It must be even. Default value is @code{-1} which
  11128. computes the bargraph height automatically.
  11129. @item axis_h
  11130. Set the axis height. It must be even. Default value is @code{-1} which computes
  11131. the axis height automatically.
  11132. @item sono_h
  11133. Set the sonogram height. It must be even. Default value is @code{-1} which
  11134. computes the sonogram height automatically.
  11135. @item fullhd
  11136. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  11137. instead. Default value is @code{1}.
  11138. @item sono_v, volume
  11139. Specify the sonogram volume expression. It can contain variables:
  11140. @table @option
  11141. @item bar_v
  11142. the @var{bar_v} evaluated expression
  11143. @item frequency, freq, f
  11144. the frequency where it is evaluated
  11145. @item timeclamp, tc
  11146. the value of @var{timeclamp} option
  11147. @end table
  11148. and functions:
  11149. @table @option
  11150. @item a_weighting(f)
  11151. A-weighting of equal loudness
  11152. @item b_weighting(f)
  11153. B-weighting of equal loudness
  11154. @item c_weighting(f)
  11155. C-weighting of equal loudness.
  11156. @end table
  11157. Default value is @code{16}.
  11158. @item bar_v, volume2
  11159. Specify the bargraph volume expression. It can contain variables:
  11160. @table @option
  11161. @item sono_v
  11162. the @var{sono_v} evaluated expression
  11163. @item frequency, freq, f
  11164. the frequency where it is evaluated
  11165. @item timeclamp, tc
  11166. the value of @var{timeclamp} option
  11167. @end table
  11168. and functions:
  11169. @table @option
  11170. @item a_weighting(f)
  11171. A-weighting of equal loudness
  11172. @item b_weighting(f)
  11173. B-weighting of equal loudness
  11174. @item c_weighting(f)
  11175. C-weighting of equal loudness.
  11176. @end table
  11177. Default value is @code{sono_v}.
  11178. @item sono_g, gamma
  11179. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  11180. higher gamma makes the spectrum having more range. Default value is @code{3}.
  11181. Acceptable range is @code{[1, 7]}.
  11182. @item bar_g, gamma2
  11183. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  11184. @code{[1, 7]}.
  11185. @item timeclamp, tc
  11186. Specify the transform timeclamp. At low frequency, there is trade-off between
  11187. accuracy in time domain and frequency domain. If timeclamp is lower,
  11188. event in time domain is represented more accurately (such as fast bass drum),
  11189. otherwise event in frequency domain is represented more accurately
  11190. (such as bass guitar). Acceptable range is @code{[0.1, 1]}. Default value is @code{0.17}.
  11191. @item basefreq
  11192. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  11193. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  11194. @item endfreq
  11195. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  11196. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  11197. @item coeffclamp
  11198. This option is deprecated and ignored.
  11199. @item tlength
  11200. Specify the transform length in time domain. Use this option to control accuracy
  11201. trade-off between time domain and frequency domain at every frequency sample.
  11202. It can contain variables:
  11203. @table @option
  11204. @item frequency, freq, f
  11205. the frequency where it is evaluated
  11206. @item timeclamp, tc
  11207. the value of @var{timeclamp} option.
  11208. @end table
  11209. Default value is @code{384*tc/(384+tc*f)}.
  11210. @item count
  11211. Specify the transform count for every video frame. Default value is @code{6}.
  11212. Acceptable range is @code{[1, 30]}.
  11213. @item fcount
  11214. Specify the transform count for every single pixel. Default value is @code{0},
  11215. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  11216. @item fontfile
  11217. Specify font file for use with freetype to draw the axis. If not specified,
  11218. use embedded font. Note that drawing with font file or embedded font is not
  11219. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  11220. option instead.
  11221. @item fontcolor
  11222. Specify font color expression. This is arithmetic expression that should return
  11223. integer value 0xRRGGBB. It can contain variables:
  11224. @table @option
  11225. @item frequency, freq, f
  11226. the frequency where it is evaluated
  11227. @item timeclamp, tc
  11228. the value of @var{timeclamp} option
  11229. @end table
  11230. and functions:
  11231. @table @option
  11232. @item midi(f)
  11233. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  11234. @item r(x), g(x), b(x)
  11235. red, green, and blue value of intensity x.
  11236. @end table
  11237. Default value is @code{st(0, (midi(f)-59.5)/12);
  11238. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  11239. r(1-ld(1)) + b(ld(1))}.
  11240. @item axisfile
  11241. Specify image file to draw the axis. This option override @var{fontfile} and
  11242. @var{fontcolor} option.
  11243. @item axis, text
  11244. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  11245. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  11246. Default value is @code{1}.
  11247. @end table
  11248. @subsection Examples
  11249. @itemize
  11250. @item
  11251. Playing audio while showing the spectrum:
  11252. @example
  11253. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  11254. @end example
  11255. @item
  11256. Same as above, but with frame rate 30 fps:
  11257. @example
  11258. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  11259. @end example
  11260. @item
  11261. Playing at 1280x720:
  11262. @example
  11263. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  11264. @end example
  11265. @item
  11266. Disable sonogram display:
  11267. @example
  11268. sono_h=0
  11269. @end example
  11270. @item
  11271. A1 and its harmonics: A1, A2, (near)E3, A3:
  11272. @example
  11273. 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),
  11274. asplit[a][out1]; [a] showcqt [out0]'
  11275. @end example
  11276. @item
  11277. Same as above, but with more accuracy in frequency domain:
  11278. @example
  11279. 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),
  11280. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  11281. @end example
  11282. @item
  11283. Custom volume:
  11284. @example
  11285. bar_v=10:sono_v=bar_v*a_weighting(f)
  11286. @end example
  11287. @item
  11288. Custom gamma, now spectrum is linear to the amplitude.
  11289. @example
  11290. bar_g=2:sono_g=2
  11291. @end example
  11292. @item
  11293. Custom tlength equation:
  11294. @example
  11295. 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)))'
  11296. @end example
  11297. @item
  11298. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  11299. @example
  11300. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  11301. @end example
  11302. @item
  11303. Custom frequency range with custom axis using image file:
  11304. @example
  11305. axisfile=myaxis.png:basefreq=40:endfreq=10000
  11306. @end example
  11307. @end itemize
  11308. @section showfreqs
  11309. Convert input audio to video output representing the audio power spectrum.
  11310. Audio amplitude is on Y-axis while frequency is on X-axis.
  11311. The filter accepts the following options:
  11312. @table @option
  11313. @item size, s
  11314. Specify size of video. For the syntax of this option, check the
  11315. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11316. Default is @code{1024x512}.
  11317. @item mode
  11318. Set display mode.
  11319. This set how each frequency bin will be represented.
  11320. It accepts the following values:
  11321. @table @samp
  11322. @item line
  11323. @item bar
  11324. @item dot
  11325. @end table
  11326. Default is @code{bar}.
  11327. @item ascale
  11328. Set amplitude scale.
  11329. It accepts the following values:
  11330. @table @samp
  11331. @item lin
  11332. Linear scale.
  11333. @item sqrt
  11334. Square root scale.
  11335. @item cbrt
  11336. Cubic root scale.
  11337. @item log
  11338. Logarithmic scale.
  11339. @end table
  11340. Default is @code{log}.
  11341. @item fscale
  11342. Set frequency scale.
  11343. It accepts the following values:
  11344. @table @samp
  11345. @item lin
  11346. Linear scale.
  11347. @item log
  11348. Logarithmic scale.
  11349. @item rlog
  11350. Reverse logarithmic scale.
  11351. @end table
  11352. Default is @code{lin}.
  11353. @item win_size
  11354. Set window size.
  11355. It accepts the following values:
  11356. @table @samp
  11357. @item w16
  11358. @item w32
  11359. @item w64
  11360. @item w128
  11361. @item w256
  11362. @item w512
  11363. @item w1024
  11364. @item w2048
  11365. @item w4096
  11366. @item w8192
  11367. @item w16384
  11368. @item w32768
  11369. @item w65536
  11370. @end table
  11371. Default is @code{w2048}
  11372. @item win_func
  11373. Set windowing function.
  11374. It accepts the following values:
  11375. @table @samp
  11376. @item rect
  11377. @item bartlett
  11378. @item hanning
  11379. @item hamming
  11380. @item blackman
  11381. @item welch
  11382. @item flattop
  11383. @item bharris
  11384. @item bnuttall
  11385. @item bhann
  11386. @item sine
  11387. @item nuttall
  11388. @item lanczos
  11389. @item gauss
  11390. @item tukey
  11391. @end table
  11392. Default is @code{hanning}.
  11393. @item overlap
  11394. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  11395. which means optimal overlap for selected window function will be picked.
  11396. @item averaging
  11397. Set time averaging. Setting this to 0 will display current maximal peaks.
  11398. Default is @code{1}, which means time averaging is disabled.
  11399. @item colors
  11400. Specify list of colors separated by space or by '|' which will be used to
  11401. draw channel frequencies. Unrecognized or missing colors will be replaced
  11402. by white color.
  11403. @item cmode
  11404. Set channel display mode.
  11405. It accepts the following values:
  11406. @table @samp
  11407. @item combined
  11408. @item separate
  11409. @end table
  11410. Default is @code{combined}.
  11411. @end table
  11412. @anchor{showspectrum}
  11413. @section showspectrum
  11414. Convert input audio to a video output, representing the audio frequency
  11415. spectrum.
  11416. The filter accepts the following options:
  11417. @table @option
  11418. @item size, s
  11419. Specify the video size for the output. For the syntax of this option, check the
  11420. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11421. Default value is @code{640x512}.
  11422. @item slide
  11423. Specify how the spectrum should slide along the window.
  11424. It accepts the following values:
  11425. @table @samp
  11426. @item replace
  11427. the samples start again on the left when they reach the right
  11428. @item scroll
  11429. the samples scroll from right to left
  11430. @item rscroll
  11431. the samples scroll from left to right
  11432. @item fullframe
  11433. frames are only produced when the samples reach the right
  11434. @end table
  11435. Default value is @code{replace}.
  11436. @item mode
  11437. Specify display mode.
  11438. It accepts the following values:
  11439. @table @samp
  11440. @item combined
  11441. all channels are displayed in the same row
  11442. @item separate
  11443. all channels are displayed in separate rows
  11444. @end table
  11445. Default value is @samp{combined}.
  11446. @item color
  11447. Specify display color mode.
  11448. It accepts the following values:
  11449. @table @samp
  11450. @item channel
  11451. each channel is displayed in a separate color
  11452. @item intensity
  11453. each channel is displayed using the same color scheme
  11454. @item rainbow
  11455. each channel is displayed using the rainbow color scheme
  11456. @item moreland
  11457. each channel is displayed using the moreland color scheme
  11458. @item nebulae
  11459. each channel is displayed using the nebulae color scheme
  11460. @item fire
  11461. each channel is displayed using the fire color scheme
  11462. @item fiery
  11463. each channel is displayed using the fiery color scheme
  11464. @item fruit
  11465. each channel is displayed using the fruit color scheme
  11466. @item cool
  11467. each channel is displayed using the cool color scheme
  11468. @end table
  11469. Default value is @samp{channel}.
  11470. @item scale
  11471. Specify scale used for calculating intensity color values.
  11472. It accepts the following values:
  11473. @table @samp
  11474. @item lin
  11475. linear
  11476. @item sqrt
  11477. square root, default
  11478. @item cbrt
  11479. cubic root
  11480. @item 4thrt
  11481. 4th root
  11482. @item 5thrt
  11483. 5th root
  11484. @item log
  11485. logarithmic
  11486. @end table
  11487. Default value is @samp{sqrt}.
  11488. @item saturation
  11489. Set saturation modifier for displayed colors. Negative values provide
  11490. alternative color scheme. @code{0} is no saturation at all.
  11491. Saturation must be in [-10.0, 10.0] range.
  11492. Default value is @code{1}.
  11493. @item win_func
  11494. Set window function.
  11495. It accepts the following values:
  11496. @table @samp
  11497. @item rect
  11498. @item bartlett
  11499. @item hann
  11500. @item hanning
  11501. @item hamming
  11502. @item blackman
  11503. @item welch
  11504. @item flattop
  11505. @item bharris
  11506. @item bnuttall
  11507. @item bhann
  11508. @item sine
  11509. @item nuttall
  11510. @item lanczos
  11511. @item gauss
  11512. @item tukey
  11513. @end table
  11514. Default value is @code{hann}.
  11515. @item orientation
  11516. Set orientation of time vs frequency axis. Can be @code{vertical} or
  11517. @code{horizontal}. Default is @code{vertical}.
  11518. @item overlap
  11519. Set ratio of overlap window. Default value is @code{0}.
  11520. When value is @code{1} overlap is set to recommended size for specific
  11521. window function currently used.
  11522. @item gain
  11523. Set scale gain for calculating intensity color values.
  11524. Default value is @code{1}.
  11525. @item data
  11526. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  11527. @end table
  11528. The usage is very similar to the showwaves filter; see the examples in that
  11529. section.
  11530. @subsection Examples
  11531. @itemize
  11532. @item
  11533. Large window with logarithmic color scaling:
  11534. @example
  11535. showspectrum=s=1280x480:scale=log
  11536. @end example
  11537. @item
  11538. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  11539. @example
  11540. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  11541. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  11542. @end example
  11543. @end itemize
  11544. @section showspectrumpic
  11545. Convert input audio to a single video frame, representing the audio frequency
  11546. spectrum.
  11547. The filter accepts the following options:
  11548. @table @option
  11549. @item size, s
  11550. Specify the video size for the output. For the syntax of this option, check the
  11551. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11552. Default value is @code{4096x2048}.
  11553. @item mode
  11554. Specify display mode.
  11555. It accepts the following values:
  11556. @table @samp
  11557. @item combined
  11558. all channels are displayed in the same row
  11559. @item separate
  11560. all channels are displayed in separate rows
  11561. @end table
  11562. Default value is @samp{combined}.
  11563. @item color
  11564. Specify display color mode.
  11565. It accepts the following values:
  11566. @table @samp
  11567. @item channel
  11568. each channel is displayed in a separate color
  11569. @item intensity
  11570. each channel is displayed using the same color scheme
  11571. @item rainbow
  11572. each channel is displayed using the rainbow color scheme
  11573. @item moreland
  11574. each channel is displayed using the moreland color scheme
  11575. @item nebulae
  11576. each channel is displayed using the nebulae color scheme
  11577. @item fire
  11578. each channel is displayed using the fire color scheme
  11579. @item fiery
  11580. each channel is displayed using the fiery color scheme
  11581. @item fruit
  11582. each channel is displayed using the fruit color scheme
  11583. @item cool
  11584. each channel is displayed using the cool color scheme
  11585. @end table
  11586. Default value is @samp{intensity}.
  11587. @item scale
  11588. Specify scale used for calculating intensity color values.
  11589. It accepts the following values:
  11590. @table @samp
  11591. @item lin
  11592. linear
  11593. @item sqrt
  11594. square root, default
  11595. @item cbrt
  11596. cubic root
  11597. @item 4thrt
  11598. 4th root
  11599. @item 5thrt
  11600. 5th root
  11601. @item log
  11602. logarithmic
  11603. @end table
  11604. Default value is @samp{log}.
  11605. @item saturation
  11606. Set saturation modifier for displayed colors. Negative values provide
  11607. alternative color scheme. @code{0} is no saturation at all.
  11608. Saturation must be in [-10.0, 10.0] range.
  11609. Default value is @code{1}.
  11610. @item win_func
  11611. Set window function.
  11612. It accepts the following values:
  11613. @table @samp
  11614. @item rect
  11615. @item bartlett
  11616. @item hann
  11617. @item hanning
  11618. @item hamming
  11619. @item blackman
  11620. @item welch
  11621. @item flattop
  11622. @item bharris
  11623. @item bnuttall
  11624. @item bhann
  11625. @item sine
  11626. @item nuttall
  11627. @item lanczos
  11628. @item gauss
  11629. @item tukey
  11630. @end table
  11631. Default value is @code{hann}.
  11632. @item orientation
  11633. Set orientation of time vs frequency axis. Can be @code{vertical} or
  11634. @code{horizontal}. Default is @code{vertical}.
  11635. @item gain
  11636. Set scale gain for calculating intensity color values.
  11637. Default value is @code{1}.
  11638. @item legend
  11639. Draw time and frequency axes and legends. Default is enabled.
  11640. @end table
  11641. @subsection Examples
  11642. @itemize
  11643. @item
  11644. Extract an audio spectrogram of a whole audio track
  11645. in a 1024x1024 picture using @command{ffmpeg}:
  11646. @example
  11647. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  11648. @end example
  11649. @end itemize
  11650. @section showvolume
  11651. Convert input audio volume to a video output.
  11652. The filter accepts the following options:
  11653. @table @option
  11654. @item rate, r
  11655. Set video rate.
  11656. @item b
  11657. Set border width, allowed range is [0, 5]. Default is 1.
  11658. @item w
  11659. Set channel width, allowed range is [80, 1080]. Default is 400.
  11660. @item h
  11661. Set channel height, allowed range is [1, 100]. Default is 20.
  11662. @item f
  11663. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  11664. @item c
  11665. Set volume color expression.
  11666. The expression can use the following variables:
  11667. @table @option
  11668. @item VOLUME
  11669. Current max volume of channel in dB.
  11670. @item CHANNEL
  11671. Current channel number, starting from 0.
  11672. @end table
  11673. @item t
  11674. If set, displays channel names. Default is enabled.
  11675. @item v
  11676. If set, displays volume values. Default is enabled.
  11677. @end table
  11678. @section showwaves
  11679. Convert input audio to a video output, representing the samples waves.
  11680. The filter accepts the following options:
  11681. @table @option
  11682. @item size, s
  11683. Specify the video size for the output. For the syntax of this option, check the
  11684. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11685. Default value is @code{600x240}.
  11686. @item mode
  11687. Set display mode.
  11688. Available values are:
  11689. @table @samp
  11690. @item point
  11691. Draw a point for each sample.
  11692. @item line
  11693. Draw a vertical line for each sample.
  11694. @item p2p
  11695. Draw a point for each sample and a line between them.
  11696. @item cline
  11697. Draw a centered vertical line for each sample.
  11698. @end table
  11699. Default value is @code{point}.
  11700. @item n
  11701. Set the number of samples which are printed on the same column. A
  11702. larger value will decrease the frame rate. Must be a positive
  11703. integer. This option can be set only if the value for @var{rate}
  11704. is not explicitly specified.
  11705. @item rate, r
  11706. Set the (approximate) output frame rate. This is done by setting the
  11707. option @var{n}. Default value is "25".
  11708. @item split_channels
  11709. Set if channels should be drawn separately or overlap. Default value is 0.
  11710. @item colors
  11711. Set colors separated by '|' which are going to be used for drawing of each channel.
  11712. @item scale
  11713. Set amplitude scale. Can be linear @code{lin} or logarithmic @code{log}.
  11714. Default is linear.
  11715. @end table
  11716. @subsection Examples
  11717. @itemize
  11718. @item
  11719. Output the input file audio and the corresponding video representation
  11720. at the same time:
  11721. @example
  11722. amovie=a.mp3,asplit[out0],showwaves[out1]
  11723. @end example
  11724. @item
  11725. Create a synthetic signal and show it with showwaves, forcing a
  11726. frame rate of 30 frames per second:
  11727. @example
  11728. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  11729. @end example
  11730. @end itemize
  11731. @section showwavespic
  11732. Convert input audio to a single video frame, representing the samples waves.
  11733. The filter accepts the following options:
  11734. @table @option
  11735. @item size, s
  11736. Specify the video size for the output. For the syntax of this option, check the
  11737. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11738. Default value is @code{600x240}.
  11739. @item split_channels
  11740. Set if channels should be drawn separately or overlap. Default value is 0.
  11741. @item colors
  11742. Set colors separated by '|' which are going to be used for drawing of each channel.
  11743. @item scale
  11744. Set amplitude scale. Can be linear @code{lin} or logarithmic @code{log}.
  11745. Default is linear.
  11746. @end table
  11747. @subsection Examples
  11748. @itemize
  11749. @item
  11750. Extract a channel split representation of the wave form of a whole audio track
  11751. in a 1024x800 picture using @command{ffmpeg}:
  11752. @example
  11753. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  11754. @end example
  11755. @item
  11756. Colorize the waveform with colorchannelmixer. This example will make
  11757. the waveform a green color approximately RGB(66,217,150). Additional
  11758. channels will be shades of this color.
  11759. @example
  11760. ffmpeg -i audio.mp3 -filter_complex "showwavespic,colorchannelmixer=rr=66/255:gg=217/255:bb=150/255" waveform.png
  11761. @end example
  11762. @end itemize
  11763. @section spectrumsynth
  11764. Sythesize audio from 2 input video spectrums, first input stream represents
  11765. magnitude across time and second represents phase across time.
  11766. The filter will transform from frequency domain as displayed in videos back
  11767. to time domain as presented in audio output.
  11768. This filter is primarly created for reversing processed @ref{showspectrum}
  11769. filter outputs, but can synthesize sound from other spectrograms too.
  11770. But in such case results are going to be poor if the phase data is not
  11771. available, because in such cases phase data need to be recreated, usually
  11772. its just recreated from random noise.
  11773. For best results use gray only output (@code{channel} color mode in
  11774. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  11775. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  11776. @code{data} option. Inputs videos should generally use @code{fullframe}
  11777. slide mode as that saves resources needed for decoding video.
  11778. The filter accepts the following options:
  11779. @table @option
  11780. @item sample_rate
  11781. Specify sample rate of output audio, the sample rate of audio from which
  11782. spectrum was generated may differ.
  11783. @item channels
  11784. Set number of channels represented in input video spectrums.
  11785. @item scale
  11786. Set scale which was used when generating magnitude input spectrum.
  11787. Can be @code{lin} or @code{log}. Default is @code{log}.
  11788. @item slide
  11789. Set slide which was used when generating inputs spectrums.
  11790. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  11791. Default is @code{fullframe}.
  11792. @item win_func
  11793. Set window function used for resynthesis.
  11794. @item overlap
  11795. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  11796. which means optimal overlap for selected window function will be picked.
  11797. @item orientation
  11798. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  11799. Default is @code{vertical}.
  11800. @end table
  11801. @subsection Examples
  11802. @itemize
  11803. @item
  11804. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  11805. then resynthesize videos back to audio with spectrumsynth:
  11806. @example
  11807. 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
  11808. 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
  11809. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_fun=hann:overlap=0.875:slide=fullframe output.flac
  11810. @end example
  11811. @end itemize
  11812. @section split, asplit
  11813. Split input into several identical outputs.
  11814. @code{asplit} works with audio input, @code{split} with video.
  11815. The filter accepts a single parameter which specifies the number of outputs. If
  11816. unspecified, it defaults to 2.
  11817. @subsection Examples
  11818. @itemize
  11819. @item
  11820. Create two separate outputs from the same input:
  11821. @example
  11822. [in] split [out0][out1]
  11823. @end example
  11824. @item
  11825. To create 3 or more outputs, you need to specify the number of
  11826. outputs, like in:
  11827. @example
  11828. [in] asplit=3 [out0][out1][out2]
  11829. @end example
  11830. @item
  11831. Create two separate outputs from the same input, one cropped and
  11832. one padded:
  11833. @example
  11834. [in] split [splitout1][splitout2];
  11835. [splitout1] crop=100:100:0:0 [cropout];
  11836. [splitout2] pad=200:200:100:100 [padout];
  11837. @end example
  11838. @item
  11839. Create 5 copies of the input audio with @command{ffmpeg}:
  11840. @example
  11841. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  11842. @end example
  11843. @end itemize
  11844. @section zmq, azmq
  11845. Receive commands sent through a libzmq client, and forward them to
  11846. filters in the filtergraph.
  11847. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  11848. must be inserted between two video filters, @code{azmq} between two
  11849. audio filters.
  11850. To enable these filters you need to install the libzmq library and
  11851. headers and configure FFmpeg with @code{--enable-libzmq}.
  11852. For more information about libzmq see:
  11853. @url{http://www.zeromq.org/}
  11854. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  11855. receives messages sent through a network interface defined by the
  11856. @option{bind_address} option.
  11857. The received message must be in the form:
  11858. @example
  11859. @var{TARGET} @var{COMMAND} [@var{ARG}]
  11860. @end example
  11861. @var{TARGET} specifies the target of the command, usually the name of
  11862. the filter class or a specific filter instance name.
  11863. @var{COMMAND} specifies the name of the command for the target filter.
  11864. @var{ARG} is optional and specifies the optional argument list for the
  11865. given @var{COMMAND}.
  11866. Upon reception, the message is processed and the corresponding command
  11867. is injected into the filtergraph. Depending on the result, the filter
  11868. will send a reply to the client, adopting the format:
  11869. @example
  11870. @var{ERROR_CODE} @var{ERROR_REASON}
  11871. @var{MESSAGE}
  11872. @end example
  11873. @var{MESSAGE} is optional.
  11874. @subsection Examples
  11875. Look at @file{tools/zmqsend} for an example of a zmq client which can
  11876. be used to send commands processed by these filters.
  11877. Consider the following filtergraph generated by @command{ffplay}
  11878. @example
  11879. ffplay -dumpgraph 1 -f lavfi "
  11880. color=s=100x100:c=red [l];
  11881. color=s=100x100:c=blue [r];
  11882. nullsrc=s=200x100, zmq [bg];
  11883. [bg][l] overlay [bg+l];
  11884. [bg+l][r] overlay=x=100 "
  11885. @end example
  11886. To change the color of the left side of the video, the following
  11887. command can be used:
  11888. @example
  11889. echo Parsed_color_0 c yellow | tools/zmqsend
  11890. @end example
  11891. To change the right side:
  11892. @example
  11893. echo Parsed_color_1 c pink | tools/zmqsend
  11894. @end example
  11895. @c man end MULTIMEDIA FILTERS
  11896. @chapter Multimedia Sources
  11897. @c man begin MULTIMEDIA SOURCES
  11898. Below is a description of the currently available multimedia sources.
  11899. @section amovie
  11900. This is the same as @ref{movie} source, except it selects an audio
  11901. stream by default.
  11902. @anchor{movie}
  11903. @section movie
  11904. Read audio and/or video stream(s) from a movie container.
  11905. It accepts the following parameters:
  11906. @table @option
  11907. @item filename
  11908. The name of the resource to read (not necessarily a file; it can also be a
  11909. device or a stream accessed through some protocol).
  11910. @item format_name, f
  11911. Specifies the format assumed for the movie to read, and can be either
  11912. the name of a container or an input device. If not specified, the
  11913. format is guessed from @var{movie_name} or by probing.
  11914. @item seek_point, sp
  11915. Specifies the seek point in seconds. The frames will be output
  11916. starting from this seek point. The parameter is evaluated with
  11917. @code{av_strtod}, so the numerical value may be suffixed by an IS
  11918. postfix. The default value is "0".
  11919. @item streams, s
  11920. Specifies the streams to read. Several streams can be specified,
  11921. separated by "+". The source will then have as many outputs, in the
  11922. same order. The syntax is explained in the ``Stream specifiers''
  11923. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  11924. respectively the default (best suited) video and audio stream. Default
  11925. is "dv", or "da" if the filter is called as "amovie".
  11926. @item stream_index, si
  11927. Specifies the index of the video stream to read. If the value is -1,
  11928. the most suitable video stream will be automatically selected. The default
  11929. value is "-1". Deprecated. If the filter is called "amovie", it will select
  11930. audio instead of video.
  11931. @item loop
  11932. Specifies how many times to read the stream in sequence.
  11933. If the value is less than 1, the stream will be read again and again.
  11934. Default value is "1".
  11935. Note that when the movie is looped the source timestamps are not
  11936. changed, so it will generate non monotonically increasing timestamps.
  11937. @end table
  11938. It allows overlaying a second video on top of the main input of
  11939. a filtergraph, as shown in this graph:
  11940. @example
  11941. input -----------> deltapts0 --> overlay --> output
  11942. ^
  11943. |
  11944. movie --> scale--> deltapts1 -------+
  11945. @end example
  11946. @subsection Examples
  11947. @itemize
  11948. @item
  11949. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  11950. on top of the input labelled "in":
  11951. @example
  11952. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  11953. [in] setpts=PTS-STARTPTS [main];
  11954. [main][over] overlay=16:16 [out]
  11955. @end example
  11956. @item
  11957. Read from a video4linux2 device, and overlay it on top of the input
  11958. labelled "in":
  11959. @example
  11960. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  11961. [in] setpts=PTS-STARTPTS [main];
  11962. [main][over] overlay=16:16 [out]
  11963. @end example
  11964. @item
  11965. Read the first video stream and the audio stream with id 0x81 from
  11966. dvd.vob; the video is connected to the pad named "video" and the audio is
  11967. connected to the pad named "audio":
  11968. @example
  11969. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  11970. @end example
  11971. @end itemize
  11972. @c man end MULTIMEDIA SOURCES