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.

16316 lines
439KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program.
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  173. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  174. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  175. @var{FILTER} ::= [@var{LINKLABELS}] @var{NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  176. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  177. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  178. @end example
  179. @section Notes on filtergraph escaping
  180. Filtergraph description composition entails several levels of
  181. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  182. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  183. information about the employed escaping procedure.
  184. A first level escaping affects the content of each filter option
  185. value, which may contain the special character @code{:} used to
  186. separate values, or one of the escaping characters @code{\'}.
  187. A second level escaping affects the whole filter description, which
  188. may contain the escaping characters @code{\'} or the special
  189. characters @code{[],;} used by the filtergraph description.
  190. Finally, when you specify a filtergraph on a shell commandline, you
  191. need to perform a third level escaping for the shell special
  192. characters contained within it.
  193. For example, consider the following string to be embedded in
  194. the @ref{drawtext} filter description @option{text} value:
  195. @example
  196. this is a 'string': may contain one, or more, special characters
  197. @end example
  198. This string contains the @code{'} special escaping character, and the
  199. @code{:} special character, so it needs to be escaped in this way:
  200. @example
  201. text=this is a \'string\'\: may contain one, or more, special characters
  202. @end example
  203. A second level of escaping is required when embedding the filter
  204. description in a filtergraph description, in order to escape all the
  205. filtergraph special characters. Thus the example above becomes:
  206. @example
  207. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  208. @end example
  209. (note that in addition to the @code{\'} escaping special characters,
  210. also @code{,} needs to be escaped).
  211. Finally an additional level of escaping is needed when writing the
  212. filtergraph description in a shell command, which depends on the
  213. escaping rules of the adopted shell. For example, assuming that
  214. @code{\} is special and needs to be escaped with another @code{\}, the
  215. previous string will finally result in:
  216. @example
  217. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  218. @end example
  219. @chapter Timeline editing
  220. Some filters support a generic @option{enable} option. For the filters
  221. supporting timeline editing, this option can be set to an expression which is
  222. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  223. the filter will be enabled, otherwise the frame will be sent unchanged to the
  224. next filter in the filtergraph.
  225. The expression accepts the following values:
  226. @table @samp
  227. @item t
  228. timestamp expressed in seconds, NAN if the input timestamp is unknown
  229. @item n
  230. sequential number of the input frame, starting from 0
  231. @item pos
  232. the position in the file of the input frame, NAN if unknown
  233. @item w
  234. @item h
  235. width and height of the input frame if video
  236. @end table
  237. Additionally, these filters support an @option{enable} command that can be used
  238. to re-define the expression.
  239. Like any other filtering option, the @option{enable} option follows the same
  240. rules.
  241. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  242. minutes, and a @ref{curves} filter starting at 3 seconds:
  243. @example
  244. smartblur = enable='between(t,10,3*60)',
  245. curves = enable='gte(t,3)' : preset=cross_process
  246. @end example
  247. @c man end FILTERGRAPH DESCRIPTION
  248. @chapter Audio Filters
  249. @c man begin AUDIO FILTERS
  250. When you configure your FFmpeg build, you can disable any of the
  251. existing filters using @code{--disable-filters}.
  252. The configure output will show the audio filters included in your
  253. build.
  254. Below is a description of the currently available audio filters.
  255. @section acompressor
  256. A compressor is mainly used to reduce the dynamic range of a signal.
  257. Especially modern music is mostly compressed at a high ratio to
  258. improve the overall loudness. It's done to get the highest attention
  259. of a listener, "fatten" the sound and bring more "power" to the track.
  260. If a signal is compressed too much it may sound dull or "dead"
  261. afterwards or it may start to "pump" (which could be a powerful effect
  262. but can also destroy a track completely).
  263. The right compression is the key to reach a professional sound and is
  264. the high art of mixing and mastering. Because of its complex settings
  265. it may take a long time to get the right feeling for this kind of effect.
  266. Compression is done by detecting the volume above a chosen level
  267. @code{threshold} and dividing it by the factor set with @code{ratio}.
  268. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  269. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  270. the signal would cause distortion of the waveform the reduction can be
  271. levelled over the time. This is done by setting "Attack" and "Release".
  272. @code{attack} determines how long the signal has to rise above the threshold
  273. before any reduction will occur and @code{release} sets the time the signal
  274. has to fall below the threshold to reduce the reduction again. Shorter signals
  275. than the chosen attack time will be left untouched.
  276. The overall reduction of the signal can be made up afterwards with the
  277. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  278. raising the makeup to this level results in a signal twice as loud than the
  279. source. To gain a softer entry in the compression the @code{knee} flattens the
  280. hard edge at the threshold in the range of the chosen decibels.
  281. The filter accepts the following options:
  282. @table @option
  283. @item level_in
  284. Set input gain. Default is 1. Range is between 0.015625 and 64.
  285. @item threshold
  286. If a signal of second stream rises above this level it will affect the gain
  287. reduction of the first stream.
  288. By default it is 0.125. Range is between 0.00097563 and 1.
  289. @item ratio
  290. Set a ratio by which the signal is reduced. 1:2 means that if the level
  291. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  292. Default is 2. Range is between 1 and 20.
  293. @item attack
  294. Amount of milliseconds the signal has to rise above the threshold before gain
  295. reduction starts. Default is 20. Range is between 0.01 and 2000.
  296. @item release
  297. Amount of milliseconds the signal has to fall below the threshold before
  298. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  299. @item makeup
  300. Set the amount by how much signal will be amplified after processing.
  301. Default is 2. Range is from 1 and 64.
  302. @item knee
  303. Curve the sharp knee around the threshold to enter gain reduction more softly.
  304. Default is 2.82843. Range is between 1 and 8.
  305. @item link
  306. Choose if the @code{average} level between all channels of input stream
  307. or the louder(@code{maximum}) channel of input stream affects the
  308. reduction. Default is @code{average}.
  309. @item detection
  310. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  311. of @code{rms}. Default is @code{rms} which is mostly smoother.
  312. @item mix
  313. How much to use compressed signal in output. Default is 1.
  314. Range is between 0 and 1.
  315. @end table
  316. @section acrossfade
  317. Apply cross fade from one input audio stream to another input audio stream.
  318. The cross fade is applied for specified duration near the end of first stream.
  319. The filter accepts the following options:
  320. @table @option
  321. @item nb_samples, ns
  322. Specify the number of samples for which the cross fade effect has to last.
  323. At the end of the cross fade effect the first input audio will be completely
  324. silent. Default is 44100.
  325. @item duration, d
  326. Specify the duration of the cross fade effect. See
  327. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  328. for the accepted syntax.
  329. By default the duration is determined by @var{nb_samples}.
  330. If set this option is used instead of @var{nb_samples}.
  331. @item overlap, o
  332. Should first stream end overlap with second stream start. Default is enabled.
  333. @item curve1
  334. Set curve for cross fade transition for first stream.
  335. @item curve2
  336. Set curve for cross fade transition for second stream.
  337. For description of available curve types see @ref{afade} filter description.
  338. @end table
  339. @subsection Examples
  340. @itemize
  341. @item
  342. Cross fade from one input to another:
  343. @example
  344. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  345. @end example
  346. @item
  347. Cross fade from one input to another but without overlapping:
  348. @example
  349. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  350. @end example
  351. @end itemize
  352. @section adelay
  353. Delay one or more audio channels.
  354. Samples in delayed channel are filled with silence.
  355. The filter accepts the following option:
  356. @table @option
  357. @item delays
  358. Set list of delays in milliseconds for each channel separated by '|'.
  359. At least one delay greater than 0 should be provided.
  360. Unused delays will be silently ignored. If number of given delays is
  361. smaller than number of channels all remaining channels will not be delayed.
  362. @end table
  363. @subsection Examples
  364. @itemize
  365. @item
  366. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  367. the second channel (and any other channels that may be present) unchanged.
  368. @example
  369. adelay=1500|0|500
  370. @end example
  371. @end itemize
  372. @section aecho
  373. Apply echoing to the input audio.
  374. Echoes are reflected sound and can occur naturally amongst mountains
  375. (and sometimes large buildings) when talking or shouting; digital echo
  376. effects emulate this behaviour and are often used to help fill out the
  377. sound of a single instrument or vocal. The time difference between the
  378. original signal and the reflection is the @code{delay}, and the
  379. loudness of the reflected signal is the @code{decay}.
  380. Multiple echoes can have different delays and decays.
  381. A description of the accepted parameters follows.
  382. @table @option
  383. @item in_gain
  384. Set input gain of reflected signal. Default is @code{0.6}.
  385. @item out_gain
  386. Set output gain of reflected signal. Default is @code{0.3}.
  387. @item delays
  388. Set list of time intervals in milliseconds between original signal and reflections
  389. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  390. Default is @code{1000}.
  391. @item decays
  392. Set list of loudnesses of reflected signals separated by '|'.
  393. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  394. Default is @code{0.5}.
  395. @end table
  396. @subsection Examples
  397. @itemize
  398. @item
  399. Make it sound as if there are twice as many instruments as are actually playing:
  400. @example
  401. aecho=0.8:0.88:60:0.4
  402. @end example
  403. @item
  404. If delay is very short, then it sound like a (metallic) robot playing music:
  405. @example
  406. aecho=0.8:0.88:6:0.4
  407. @end example
  408. @item
  409. A longer delay will sound like an open air concert in the mountains:
  410. @example
  411. aecho=0.8:0.9:1000:0.3
  412. @end example
  413. @item
  414. Same as above but with one more mountain:
  415. @example
  416. aecho=0.8:0.9:1000|1800:0.3|0.25
  417. @end example
  418. @end itemize
  419. @section aemphasis
  420. Audio emphasis filter creates or restores material directly taken from LPs or
  421. emphased CDs with different filter curves. E.g. to store music on vinyl the
  422. signal has to be altered by a filter first to even out the disadvantages of
  423. this recording medium.
  424. Once the material is played back the inverse filter has to be applied to
  425. restore the distortion of the frequency response.
  426. The filter accepts the following options:
  427. @table @option
  428. @item level_in
  429. Set input gain.
  430. @item level_out
  431. Set output gain.
  432. @item mode
  433. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  434. use @code{production} mode. Default is @code{reproduction} mode.
  435. @item type
  436. Set filter type. Selects medium. Can be one of the following:
  437. @table @option
  438. @item col
  439. select Columbia.
  440. @item emi
  441. select EMI.
  442. @item bsi
  443. select BSI (78RPM).
  444. @item riaa
  445. select RIAA.
  446. @item cd
  447. select Compact Disc (CD).
  448. @item 50fm
  449. select 50µs (FM).
  450. @item 75fm
  451. select 75µs (FM).
  452. @item 50kf
  453. select 50µs (FM-KF).
  454. @item 75kf
  455. select 75µs (FM-KF).
  456. @end table
  457. @end table
  458. @section aeval
  459. Modify an audio signal according to the specified expressions.
  460. This filter accepts one or more expressions (one for each channel),
  461. which are evaluated and used to modify a corresponding audio signal.
  462. It accepts the following parameters:
  463. @table @option
  464. @item exprs
  465. Set the '|'-separated expressions list for each separate channel. If
  466. the number of input channels is greater than the number of
  467. expressions, the last specified expression is used for the remaining
  468. output channels.
  469. @item channel_layout, c
  470. Set output channel layout. If not specified, the channel layout is
  471. specified by the number of expressions. If set to @samp{same}, it will
  472. use by default the same input channel layout.
  473. @end table
  474. Each expression in @var{exprs} can contain the following constants and functions:
  475. @table @option
  476. @item ch
  477. channel number of the current expression
  478. @item n
  479. number of the evaluated sample, starting from 0
  480. @item s
  481. sample rate
  482. @item t
  483. time of the evaluated sample expressed in seconds
  484. @item nb_in_channels
  485. @item nb_out_channels
  486. input and output number of channels
  487. @item val(CH)
  488. the value of input channel with number @var{CH}
  489. @end table
  490. Note: this filter is slow. For faster processing you should use a
  491. dedicated filter.
  492. @subsection Examples
  493. @itemize
  494. @item
  495. Half volume:
  496. @example
  497. aeval=val(ch)/2:c=same
  498. @end example
  499. @item
  500. Invert phase of the second channel:
  501. @example
  502. aeval=val(0)|-val(1)
  503. @end example
  504. @end itemize
  505. @anchor{afade}
  506. @section afade
  507. Apply fade-in/out effect to input audio.
  508. A description of the accepted parameters follows.
  509. @table @option
  510. @item type, t
  511. Specify the effect type, can be either @code{in} for fade-in, or
  512. @code{out} for a fade-out effect. Default is @code{in}.
  513. @item start_sample, ss
  514. Specify the number of the start sample for starting to apply the fade
  515. effect. Default is 0.
  516. @item nb_samples, ns
  517. Specify the number of samples for which the fade effect has to last. At
  518. the end of the fade-in effect the output audio will have the same
  519. volume as the input audio, at the end of the fade-out transition
  520. the output audio will be silence. Default is 44100.
  521. @item start_time, st
  522. Specify the start time of the fade effect. Default is 0.
  523. The value must be specified as a time duration; see
  524. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  525. for the accepted syntax.
  526. If set this option is used instead of @var{start_sample}.
  527. @item duration, d
  528. Specify the duration of the fade effect. See
  529. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  530. for the accepted syntax.
  531. At the end of the fade-in effect the output audio will have the same
  532. volume as the input audio, at the end of the fade-out transition
  533. the output audio will be silence.
  534. By default the duration is determined by @var{nb_samples}.
  535. If set this option is used instead of @var{nb_samples}.
  536. @item curve
  537. Set curve for fade transition.
  538. It accepts the following values:
  539. @table @option
  540. @item tri
  541. select triangular, linear slope (default)
  542. @item qsin
  543. select quarter of sine wave
  544. @item hsin
  545. select half of sine wave
  546. @item esin
  547. select exponential sine wave
  548. @item log
  549. select logarithmic
  550. @item ipar
  551. select inverted parabola
  552. @item qua
  553. select quadratic
  554. @item cub
  555. select cubic
  556. @item squ
  557. select square root
  558. @item cbr
  559. select cubic root
  560. @item par
  561. select parabola
  562. @item exp
  563. select exponential
  564. @item iqsin
  565. select inverted quarter of sine wave
  566. @item ihsin
  567. select inverted half of sine wave
  568. @item dese
  569. select double-exponential seat
  570. @item desi
  571. select double-exponential sigmoid
  572. @end table
  573. @end table
  574. @subsection Examples
  575. @itemize
  576. @item
  577. Fade in first 15 seconds of audio:
  578. @example
  579. afade=t=in:ss=0:d=15
  580. @end example
  581. @item
  582. Fade out last 25 seconds of a 900 seconds audio:
  583. @example
  584. afade=t=out:st=875:d=25
  585. @end example
  586. @end itemize
  587. @section afftfilt
  588. Apply arbitrary expressions to samples in frequency domain.
  589. @table @option
  590. @item real
  591. Set frequency domain real expression for each separate channel separated
  592. by '|'. Default is "1".
  593. If the number of input channels is greater than the number of
  594. expressions, the last specified expression is used for the remaining
  595. output channels.
  596. @item imag
  597. Set frequency domain imaginary expression for each separate channel
  598. separated by '|'. If not set, @var{real} option is used.
  599. Each expression in @var{real} and @var{imag} can contain the following
  600. constants:
  601. @table @option
  602. @item sr
  603. sample rate
  604. @item b
  605. current frequency bin number
  606. @item nb
  607. number of available bins
  608. @item ch
  609. channel number of the current expression
  610. @item chs
  611. number of channels
  612. @item pts
  613. current frame pts
  614. @end table
  615. @item win_size
  616. Set window size.
  617. It accepts the following values:
  618. @table @samp
  619. @item w16
  620. @item w32
  621. @item w64
  622. @item w128
  623. @item w256
  624. @item w512
  625. @item w1024
  626. @item w2048
  627. @item w4096
  628. @item w8192
  629. @item w16384
  630. @item w32768
  631. @item w65536
  632. @end table
  633. Default is @code{w4096}
  634. @item win_func
  635. Set window function. Default is @code{hann}.
  636. @item overlap
  637. Set window overlap. If set to 1, the recommended overlap for selected
  638. window function will be picked. Default is @code{0.75}.
  639. @end table
  640. @subsection Examples
  641. @itemize
  642. @item
  643. Leave almost only low frequencies in audio:
  644. @example
  645. afftfilt="1-clip((b/nb)*b,0,1)"
  646. @end example
  647. @end itemize
  648. @anchor{aformat}
  649. @section aformat
  650. Set output format constraints for the input audio. The framework will
  651. negotiate the most appropriate format to minimize conversions.
  652. It accepts the following parameters:
  653. @table @option
  654. @item sample_fmts
  655. A '|'-separated list of requested sample formats.
  656. @item sample_rates
  657. A '|'-separated list of requested sample rates.
  658. @item channel_layouts
  659. A '|'-separated list of requested channel layouts.
  660. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  661. for the required syntax.
  662. @end table
  663. If a parameter is omitted, all values are allowed.
  664. Force the output to either unsigned 8-bit or signed 16-bit stereo
  665. @example
  666. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  667. @end example
  668. @section agate
  669. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  670. processing reduces disturbing noise between useful signals.
  671. Gating is done by detecting the volume below a chosen level @var{threshold}
  672. and divide it by the factor set with @var{ratio}. The bottom of the noise
  673. floor is set via @var{range}. Because an exact manipulation of the signal
  674. would cause distortion of the waveform the reduction can be levelled over
  675. time. This is done by setting @var{attack} and @var{release}.
  676. @var{attack} determines how long the signal has to fall below the threshold
  677. before any reduction will occur and @var{release} sets the time the signal
  678. has to raise above the threshold to reduce the reduction again.
  679. Shorter signals than the chosen attack time will be left untouched.
  680. @table @option
  681. @item level_in
  682. Set input level before filtering.
  683. Default is 1. Allowed range is from 0.015625 to 64.
  684. @item range
  685. Set the level of gain reduction when the signal is below the threshold.
  686. Default is 0.06125. Allowed range is from 0 to 1.
  687. @item threshold
  688. If a signal rises above this level the gain reduction is released.
  689. Default is 0.125. Allowed range is from 0 to 1.
  690. @item ratio
  691. Set a ratio about which the signal is reduced.
  692. Default is 2. Allowed range is from 1 to 9000.
  693. @item attack
  694. Amount of milliseconds the signal has to rise above the threshold before gain
  695. reduction stops.
  696. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  697. @item release
  698. Amount of milliseconds the signal has to fall below the threshold before the
  699. reduction is increased again. Default is 250 milliseconds.
  700. Allowed range is from 0.01 to 9000.
  701. @item makeup
  702. Set amount of amplification of signal after processing.
  703. Default is 1. Allowed range is from 1 to 64.
  704. @item knee
  705. Curve the sharp knee around the threshold to enter gain reduction more softly.
  706. Default is 2.828427125. Allowed range is from 1 to 8.
  707. @item detection
  708. Choose if exact signal should be taken for detection or an RMS like one.
  709. Default is rms. Can be peak or rms.
  710. @item link
  711. Choose if the average level between all channels or the louder channel affects
  712. the reduction.
  713. Default is average. Can be average or maximum.
  714. @end table
  715. @section alimiter
  716. The limiter prevents input signal from raising over a desired threshold.
  717. This limiter uses lookahead technology to prevent your signal from distorting.
  718. It means that there is a small delay after signal is processed. Keep in mind
  719. that the delay it produces is the attack time you set.
  720. The filter accepts the following options:
  721. @table @option
  722. @item level_in
  723. Set input gain. Default is 1.
  724. @item level_out
  725. Set output gain. Default is 1.
  726. @item limit
  727. Don't let signals above this level pass the limiter. Default is 1.
  728. @item attack
  729. The limiter will reach its attenuation level in this amount of time in
  730. milliseconds. Default is 5 milliseconds.
  731. @item release
  732. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  733. Default is 50 milliseconds.
  734. @item asc
  735. When gain reduction is always needed ASC takes care of releasing to an
  736. average reduction level rather than reaching a reduction of 0 in the release
  737. time.
  738. @item asc_level
  739. Select how much the release time is affected by ASC, 0 means nearly no changes
  740. in release time while 1 produces higher release times.
  741. @item level
  742. Auto level output signal. Default is enabled.
  743. This normalizes audio back to 0dB if enabled.
  744. @end table
  745. Depending on picked setting it is recommended to upsample input 2x or 4x times
  746. with @ref{aresample} before applying this filter.
  747. @section allpass
  748. Apply a two-pole all-pass filter with central frequency (in Hz)
  749. @var{frequency}, and filter-width @var{width}.
  750. An all-pass filter changes the audio's frequency to phase relationship
  751. without changing its frequency to amplitude relationship.
  752. The filter accepts the following options:
  753. @table @option
  754. @item frequency, f
  755. Set frequency in Hz.
  756. @item width_type
  757. Set method to specify band-width of filter.
  758. @table @option
  759. @item h
  760. Hz
  761. @item q
  762. Q-Factor
  763. @item o
  764. octave
  765. @item s
  766. slope
  767. @end table
  768. @item width, w
  769. Specify the band-width of a filter in width_type units.
  770. @end table
  771. @anchor{amerge}
  772. @section amerge
  773. Merge two or more audio streams into a single multi-channel stream.
  774. The filter accepts the following options:
  775. @table @option
  776. @item inputs
  777. Set the number of inputs. Default is 2.
  778. @end table
  779. If the channel layouts of the inputs are disjoint, and therefore compatible,
  780. the channel layout of the output will be set accordingly and the channels
  781. will be reordered as necessary. If the channel layouts of the inputs are not
  782. disjoint, the output will have all the channels of the first input then all
  783. the channels of the second input, in that order, and the channel layout of
  784. the output will be the default value corresponding to the total number of
  785. channels.
  786. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  787. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  788. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  789. first input, b1 is the first channel of the second input).
  790. On the other hand, if both input are in stereo, the output channels will be
  791. in the default order: a1, a2, b1, b2, and the channel layout will be
  792. arbitrarily set to 4.0, which may or may not be the expected value.
  793. All inputs must have the same sample rate, and format.
  794. If inputs do not have the same duration, the output will stop with the
  795. shortest.
  796. @subsection Examples
  797. @itemize
  798. @item
  799. Merge two mono files into a stereo stream:
  800. @example
  801. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  802. @end example
  803. @item
  804. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  805. @example
  806. ffmpeg -i input.mkv -filter_complex "[0:1][0:2][0:3][0:4][0:5][0:6] amerge=inputs=6" -c:a pcm_s16le output.mkv
  807. @end example
  808. @end itemize
  809. @section amix
  810. Mixes multiple audio inputs into a single output.
  811. Note that this filter only supports float samples (the @var{amerge}
  812. and @var{pan} audio filters support many formats). If the @var{amix}
  813. input has integer samples then @ref{aresample} will be automatically
  814. inserted to perform the conversion to float samples.
  815. For example
  816. @example
  817. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  818. @end example
  819. will mix 3 input audio streams to a single output with the same duration as the
  820. first input and a dropout transition time of 3 seconds.
  821. It accepts the following parameters:
  822. @table @option
  823. @item inputs
  824. The number of inputs. If unspecified, it defaults to 2.
  825. @item duration
  826. How to determine the end-of-stream.
  827. @table @option
  828. @item longest
  829. The duration of the longest input. (default)
  830. @item shortest
  831. The duration of the shortest input.
  832. @item first
  833. The duration of the first input.
  834. @end table
  835. @item dropout_transition
  836. The transition time, in seconds, for volume renormalization when an input
  837. stream ends. The default value is 2 seconds.
  838. @end table
  839. @section anequalizer
  840. High-order parametric multiband equalizer for each channel.
  841. It accepts the following parameters:
  842. @table @option
  843. @item params
  844. This option string is in format:
  845. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  846. Each equalizer band is separated by '|'.
  847. @table @option
  848. @item chn
  849. Set channel number to which equalization will be applied.
  850. If input doesn't have that channel the entry is ignored.
  851. @item cf
  852. Set central frequency for band.
  853. If input doesn't have that frequency the entry is ignored.
  854. @item w
  855. Set band width in hertz.
  856. @item g
  857. Set band gain in dB.
  858. @item f
  859. Set filter type for band, optional, can be:
  860. @table @samp
  861. @item 0
  862. Butterworth, this is default.
  863. @item 1
  864. Chebyshev type 1.
  865. @item 2
  866. Chebyshev type 2.
  867. @end table
  868. @end table
  869. @item curves
  870. With this option activated frequency response of anequalizer is displayed
  871. in video stream.
  872. @item size
  873. Set video stream size. Only useful if curves option is activated.
  874. @item mgain
  875. Set max gain that will be displayed. Only useful if curves option is activated.
  876. Setting this to reasonable value allows to display gain which is derived from
  877. neighbour bands which are too close to each other and thus produce higher gain
  878. when both are activated.
  879. @item fscale
  880. Set frequency scale used to draw frequency response in video output.
  881. Can be linear or logarithmic. Default is logarithmic.
  882. @item colors
  883. Set color for each channel curve which is going to be displayed in video stream.
  884. This is list of color names separated by space or by '|'.
  885. Unrecognised or missing colors will be replaced by white color.
  886. @end table
  887. @subsection Examples
  888. @itemize
  889. @item
  890. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  891. for first 2 channels using Chebyshev type 1 filter:
  892. @example
  893. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  894. @end example
  895. @end itemize
  896. @subsection Commands
  897. This filter supports the following commands:
  898. @table @option
  899. @item change
  900. Alter existing filter parameters.
  901. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  902. @var{fN} is existing filter number, starting from 0, if no such filter is available
  903. error is returned.
  904. @var{freq} set new frequency parameter.
  905. @var{width} set new width parameter in herz.
  906. @var{gain} set new gain parameter in dB.
  907. Full filter invocation with asendcmd may look like this:
  908. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  909. @end table
  910. @section anull
  911. Pass the audio source unchanged to the output.
  912. @section apad
  913. Pad the end of an audio stream with silence.
  914. This can be used together with @command{ffmpeg} @option{-shortest} to
  915. extend audio streams to the same length as the video stream.
  916. A description of the accepted options follows.
  917. @table @option
  918. @item packet_size
  919. Set silence packet size. Default value is 4096.
  920. @item pad_len
  921. Set the number of samples of silence to add to the end. After the
  922. value is reached, the stream is terminated. This option is mutually
  923. exclusive with @option{whole_len}.
  924. @item whole_len
  925. Set the minimum total number of samples in the output audio stream. If
  926. the value is longer than the input audio length, silence is added to
  927. the end, until the value is reached. This option is mutually exclusive
  928. with @option{pad_len}.
  929. @end table
  930. If neither the @option{pad_len} nor the @option{whole_len} option is
  931. set, the filter will add silence to the end of the input stream
  932. indefinitely.
  933. @subsection Examples
  934. @itemize
  935. @item
  936. Add 1024 samples of silence to the end of the input:
  937. @example
  938. apad=pad_len=1024
  939. @end example
  940. @item
  941. Make sure the audio output will contain at least 10000 samples, pad
  942. the input with silence if required:
  943. @example
  944. apad=whole_len=10000
  945. @end example
  946. @item
  947. Use @command{ffmpeg} to pad the audio input with silence, so that the
  948. video stream will always result the shortest and will be converted
  949. until the end in the output file when using the @option{shortest}
  950. option:
  951. @example
  952. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  953. @end example
  954. @end itemize
  955. @section aphaser
  956. Add a phasing effect to the input audio.
  957. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  958. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  959. A description of the accepted parameters follows.
  960. @table @option
  961. @item in_gain
  962. Set input gain. Default is 0.4.
  963. @item out_gain
  964. Set output gain. Default is 0.74
  965. @item delay
  966. Set delay in milliseconds. Default is 3.0.
  967. @item decay
  968. Set decay. Default is 0.4.
  969. @item speed
  970. Set modulation speed in Hz. Default is 0.5.
  971. @item type
  972. Set modulation type. Default is triangular.
  973. It accepts the following values:
  974. @table @samp
  975. @item triangular, t
  976. @item sinusoidal, s
  977. @end table
  978. @end table
  979. @section apulsator
  980. Audio pulsator is something between an autopanner and a tremolo.
  981. But it can produce funny stereo effects as well. Pulsator changes the volume
  982. of the left and right channel based on a LFO (low frequency oscillator) with
  983. different waveforms and shifted phases.
  984. This filter have the ability to define an offset between left and right
  985. channel. An offset of 0 means that both LFO shapes match each other.
  986. The left and right channel are altered equally - a conventional tremolo.
  987. An offset of 50% means that the shape of the right channel is exactly shifted
  988. in phase (or moved backwards about half of the frequency) - pulsator acts as
  989. an autopanner. At 1 both curves match again. Every setting in between moves the
  990. phase shift gapless between all stages and produces some "bypassing" sounds with
  991. sine and triangle waveforms. The more you set the offset near 1 (starting from
  992. the 0.5) the faster the signal passes from the left to the right speaker.
  993. The filter accepts the following options:
  994. @table @option
  995. @item level_in
  996. Set input gain. By default it is 1. Range is [0.015625 - 64].
  997. @item level_out
  998. Set output gain. By default it is 1. Range is [0.015625 - 64].
  999. @item mode
  1000. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1001. sawup or sawdown. Default is sine.
  1002. @item amount
  1003. Set modulation. Define how much of original signal is affected by the LFO.
  1004. @item offset_l
  1005. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1006. @item offset_r
  1007. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1008. @item width
  1009. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1010. @item timing
  1011. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1012. @item bpm
  1013. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1014. is set to bpm.
  1015. @item ms
  1016. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1017. is set to ms.
  1018. @item hz
  1019. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1020. if timing is set to hz.
  1021. @end table
  1022. @anchor{aresample}
  1023. @section aresample
  1024. Resample the input audio to the specified parameters, using the
  1025. libswresample library. If none are specified then the filter will
  1026. automatically convert between its input and output.
  1027. This filter is also able to stretch/squeeze the audio data to make it match
  1028. the timestamps or to inject silence / cut out audio to make it match the
  1029. timestamps, do a combination of both or do neither.
  1030. The filter accepts the syntax
  1031. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1032. expresses a sample rate and @var{resampler_options} is a list of
  1033. @var{key}=@var{value} pairs, separated by ":". See the
  1034. ffmpeg-resampler manual for the complete list of supported options.
  1035. @subsection Examples
  1036. @itemize
  1037. @item
  1038. Resample the input audio to 44100Hz:
  1039. @example
  1040. aresample=44100
  1041. @end example
  1042. @item
  1043. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1044. samples per second compensation:
  1045. @example
  1046. aresample=async=1000
  1047. @end example
  1048. @end itemize
  1049. @section asetnsamples
  1050. Set the number of samples per each output audio frame.
  1051. The last output packet may contain a different number of samples, as
  1052. the filter will flush all the remaining samples when the input audio
  1053. signal its end.
  1054. The filter accepts the following options:
  1055. @table @option
  1056. @item nb_out_samples, n
  1057. Set the number of frames per each output audio frame. The number is
  1058. intended as the number of samples @emph{per each channel}.
  1059. Default value is 1024.
  1060. @item pad, p
  1061. If set to 1, the filter will pad the last audio frame with zeroes, so
  1062. that the last frame will contain the same number of samples as the
  1063. previous ones. Default value is 1.
  1064. @end table
  1065. For example, to set the number of per-frame samples to 1234 and
  1066. disable padding for the last frame, use:
  1067. @example
  1068. asetnsamples=n=1234:p=0
  1069. @end example
  1070. @section asetrate
  1071. Set the sample rate without altering the PCM data.
  1072. This will result in a change of speed and pitch.
  1073. The filter accepts the following options:
  1074. @table @option
  1075. @item sample_rate, r
  1076. Set the output sample rate. Default is 44100 Hz.
  1077. @end table
  1078. @section ashowinfo
  1079. Show a line containing various information for each input audio frame.
  1080. The input audio is not modified.
  1081. The shown line contains a sequence of key/value pairs of the form
  1082. @var{key}:@var{value}.
  1083. The following values are shown in the output:
  1084. @table @option
  1085. @item n
  1086. The (sequential) number of the input frame, starting from 0.
  1087. @item pts
  1088. The presentation timestamp of the input frame, in time base units; the time base
  1089. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1090. @item pts_time
  1091. The presentation timestamp of the input frame in seconds.
  1092. @item pos
  1093. position of the frame in the input stream, -1 if this information in
  1094. unavailable and/or meaningless (for example in case of synthetic audio)
  1095. @item fmt
  1096. The sample format.
  1097. @item chlayout
  1098. The channel layout.
  1099. @item rate
  1100. The sample rate for the audio frame.
  1101. @item nb_samples
  1102. The number of samples (per channel) in the frame.
  1103. @item checksum
  1104. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1105. audio, the data is treated as if all the planes were concatenated.
  1106. @item plane_checksums
  1107. A list of Adler-32 checksums for each data plane.
  1108. @end table
  1109. @anchor{astats}
  1110. @section astats
  1111. Display time domain statistical information about the audio channels.
  1112. Statistics are calculated and displayed for each audio channel and,
  1113. where applicable, an overall figure is also given.
  1114. It accepts the following option:
  1115. @table @option
  1116. @item length
  1117. Short window length in seconds, used for peak and trough RMS measurement.
  1118. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  1119. @item metadata
  1120. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1121. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1122. disabled.
  1123. Available keys for each channel are:
  1124. DC_offset
  1125. Min_level
  1126. Max_level
  1127. Min_difference
  1128. Max_difference
  1129. Mean_difference
  1130. Peak_level
  1131. RMS_peak
  1132. RMS_trough
  1133. Crest_factor
  1134. Flat_factor
  1135. Peak_count
  1136. Bit_depth
  1137. and for Overall:
  1138. DC_offset
  1139. Min_level
  1140. Max_level
  1141. Min_difference
  1142. Max_difference
  1143. Mean_difference
  1144. Peak_level
  1145. RMS_level
  1146. RMS_peak
  1147. RMS_trough
  1148. Flat_factor
  1149. Peak_count
  1150. Bit_depth
  1151. Number_of_samples
  1152. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1153. this @code{lavfi.astats.Overall.Peak_count}.
  1154. For description what each key means read below.
  1155. @item reset
  1156. Set number of frame after which stats are going to be recalculated.
  1157. Default is disabled.
  1158. @end table
  1159. A description of each shown parameter follows:
  1160. @table @option
  1161. @item DC offset
  1162. Mean amplitude displacement from zero.
  1163. @item Min level
  1164. Minimal sample level.
  1165. @item Max level
  1166. Maximal sample level.
  1167. @item Min difference
  1168. Minimal difference between two consecutive samples.
  1169. @item Max difference
  1170. Maximal difference between two consecutive samples.
  1171. @item Mean difference
  1172. Mean difference between two consecutive samples.
  1173. The average of each difference between two consecutive samples.
  1174. @item Peak level dB
  1175. @item RMS level dB
  1176. Standard peak and RMS level measured in dBFS.
  1177. @item RMS peak dB
  1178. @item RMS trough dB
  1179. Peak and trough values for RMS level measured over a short window.
  1180. @item Crest factor
  1181. Standard ratio of peak to RMS level (note: not in dB).
  1182. @item Flat factor
  1183. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1184. (i.e. either @var{Min level} or @var{Max level}).
  1185. @item Peak count
  1186. Number of occasions (not the number of samples) that the signal attained either
  1187. @var{Min level} or @var{Max level}.
  1188. @item Bit depth
  1189. Overall bit depth of audio. Number of bits used for each sample.
  1190. @end table
  1191. @section asyncts
  1192. Synchronize audio data with timestamps by squeezing/stretching it and/or
  1193. dropping samples/adding silence when needed.
  1194. This filter is not built by default, please use @ref{aresample} to do squeezing/stretching.
  1195. It accepts the following parameters:
  1196. @table @option
  1197. @item compensate
  1198. Enable stretching/squeezing the data to make it match the timestamps. Disabled
  1199. by default. When disabled, time gaps are covered with silence.
  1200. @item min_delta
  1201. The minimum difference between timestamps and audio data (in seconds) to trigger
  1202. adding/dropping samples. The default value is 0.1. If you get an imperfect
  1203. sync with this filter, try setting this parameter to 0.
  1204. @item max_comp
  1205. The maximum compensation in samples per second. Only relevant with compensate=1.
  1206. The default value is 500.
  1207. @item first_pts
  1208. Assume that the first PTS should be this value. The time base is 1 / sample
  1209. rate. This allows for padding/trimming at the start of the stream. By default,
  1210. no assumption is made about the first frame's expected PTS, so no padding or
  1211. trimming is done. For example, this could be set to 0 to pad the beginning with
  1212. silence if an audio stream starts after the video stream or to trim any samples
  1213. with a negative PTS due to encoder delay.
  1214. @end table
  1215. @section atempo
  1216. Adjust audio tempo.
  1217. The filter accepts exactly one parameter, the audio tempo. If not
  1218. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1219. be in the [0.5, 2.0] range.
  1220. @subsection Examples
  1221. @itemize
  1222. @item
  1223. Slow down audio to 80% tempo:
  1224. @example
  1225. atempo=0.8
  1226. @end example
  1227. @item
  1228. To speed up audio to 125% tempo:
  1229. @example
  1230. atempo=1.25
  1231. @end example
  1232. @end itemize
  1233. @section atrim
  1234. Trim the input so that the output contains one continuous subpart of the input.
  1235. It accepts the following parameters:
  1236. @table @option
  1237. @item start
  1238. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1239. sample with the timestamp @var{start} will be the first sample in the output.
  1240. @item end
  1241. Specify time of the first audio sample that will be dropped, i.e. the
  1242. audio sample immediately preceding the one with the timestamp @var{end} will be
  1243. the last sample in the output.
  1244. @item start_pts
  1245. Same as @var{start}, except this option sets the start timestamp in samples
  1246. instead of seconds.
  1247. @item end_pts
  1248. Same as @var{end}, except this option sets the end timestamp in samples instead
  1249. of seconds.
  1250. @item duration
  1251. The maximum duration of the output in seconds.
  1252. @item start_sample
  1253. The number of the first sample that should be output.
  1254. @item end_sample
  1255. The number of the first sample that should be dropped.
  1256. @end table
  1257. @option{start}, @option{end}, and @option{duration} are expressed as time
  1258. duration specifications; see
  1259. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1260. Note that the first two sets of the start/end options and the @option{duration}
  1261. option look at the frame timestamp, while the _sample options simply count the
  1262. samples that pass through the filter. So start/end_pts and start/end_sample will
  1263. give different results when the timestamps are wrong, inexact or do not start at
  1264. zero. Also note that this filter does not modify the timestamps. If you wish
  1265. to have the output timestamps start at zero, insert the asetpts filter after the
  1266. atrim filter.
  1267. If multiple start or end options are set, this filter tries to be greedy and
  1268. keep all samples that match at least one of the specified constraints. To keep
  1269. only the part that matches all the constraints at once, chain multiple atrim
  1270. filters.
  1271. The defaults are such that all the input is kept. So it is possible to set e.g.
  1272. just the end values to keep everything before the specified time.
  1273. Examples:
  1274. @itemize
  1275. @item
  1276. Drop everything except the second minute of input:
  1277. @example
  1278. ffmpeg -i INPUT -af atrim=60:120
  1279. @end example
  1280. @item
  1281. Keep only the first 1000 samples:
  1282. @example
  1283. ffmpeg -i INPUT -af atrim=end_sample=1000
  1284. @end example
  1285. @end itemize
  1286. @section bandpass
  1287. Apply a two-pole Butterworth band-pass filter with central
  1288. frequency @var{frequency}, and (3dB-point) band-width width.
  1289. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1290. instead of the default: constant 0dB peak gain.
  1291. The filter roll off at 6dB per octave (20dB per decade).
  1292. The filter accepts the following options:
  1293. @table @option
  1294. @item frequency, f
  1295. Set the filter's central frequency. Default is @code{3000}.
  1296. @item csg
  1297. Constant skirt gain if set to 1. Defaults to 0.
  1298. @item width_type
  1299. Set method to specify band-width of filter.
  1300. @table @option
  1301. @item h
  1302. Hz
  1303. @item q
  1304. Q-Factor
  1305. @item o
  1306. octave
  1307. @item s
  1308. slope
  1309. @end table
  1310. @item width, w
  1311. Specify the band-width of a filter in width_type units.
  1312. @end table
  1313. @section bandreject
  1314. Apply a two-pole Butterworth band-reject filter with central
  1315. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1316. The filter roll off at 6dB per octave (20dB per decade).
  1317. The filter accepts the following options:
  1318. @table @option
  1319. @item frequency, f
  1320. Set the filter's central frequency. Default is @code{3000}.
  1321. @item width_type
  1322. Set method to specify band-width of filter.
  1323. @table @option
  1324. @item h
  1325. Hz
  1326. @item q
  1327. Q-Factor
  1328. @item o
  1329. octave
  1330. @item s
  1331. slope
  1332. @end table
  1333. @item width, w
  1334. Specify the band-width of a filter in width_type units.
  1335. @end table
  1336. @section bass
  1337. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1338. shelving filter with a response similar to that of a standard
  1339. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1340. The filter accepts the following options:
  1341. @table @option
  1342. @item gain, g
  1343. Give the gain at 0 Hz. Its useful range is about -20
  1344. (for a large cut) to +20 (for a large boost).
  1345. Beware of clipping when using a positive gain.
  1346. @item frequency, f
  1347. Set the filter's central frequency and so can be used
  1348. to extend or reduce the frequency range to be boosted or cut.
  1349. The default value is @code{100} Hz.
  1350. @item width_type
  1351. Set method to specify band-width of filter.
  1352. @table @option
  1353. @item h
  1354. Hz
  1355. @item q
  1356. Q-Factor
  1357. @item o
  1358. octave
  1359. @item s
  1360. slope
  1361. @end table
  1362. @item width, w
  1363. Determine how steep is the filter's shelf transition.
  1364. @end table
  1365. @section biquad
  1366. Apply a biquad IIR filter with the given coefficients.
  1367. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1368. are the numerator and denominator coefficients respectively.
  1369. @section bs2b
  1370. Bauer stereo to binaural transformation, which improves headphone listening of
  1371. stereo audio records.
  1372. It accepts the following parameters:
  1373. @table @option
  1374. @item profile
  1375. Pre-defined crossfeed level.
  1376. @table @option
  1377. @item default
  1378. Default level (fcut=700, feed=50).
  1379. @item cmoy
  1380. Chu Moy circuit (fcut=700, feed=60).
  1381. @item jmeier
  1382. Jan Meier circuit (fcut=650, feed=95).
  1383. @end table
  1384. @item fcut
  1385. Cut frequency (in Hz).
  1386. @item feed
  1387. Feed level (in Hz).
  1388. @end table
  1389. @section channelmap
  1390. Remap input channels to new locations.
  1391. It accepts the following parameters:
  1392. @table @option
  1393. @item channel_layout
  1394. The channel layout of the output stream.
  1395. @item map
  1396. Map channels from input to output. The argument is a '|'-separated list of
  1397. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1398. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1399. channel (e.g. FL for front left) or its index in the input channel layout.
  1400. @var{out_channel} is the name of the output channel or its index in the output
  1401. channel layout. If @var{out_channel} is not given then it is implicitly an
  1402. index, starting with zero and increasing by one for each mapping.
  1403. @end table
  1404. If no mapping is present, the filter will implicitly map input channels to
  1405. output channels, preserving indices.
  1406. For example, assuming a 5.1+downmix input MOV file,
  1407. @example
  1408. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1409. @end example
  1410. will create an output WAV file tagged as stereo from the downmix channels of
  1411. the input.
  1412. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1413. @example
  1414. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1415. @end example
  1416. @section channelsplit
  1417. Split each channel from an input audio stream into a separate output stream.
  1418. It accepts the following parameters:
  1419. @table @option
  1420. @item channel_layout
  1421. The channel layout of the input stream. The default is "stereo".
  1422. @end table
  1423. For example, assuming a stereo input MP3 file,
  1424. @example
  1425. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1426. @end example
  1427. will create an output Matroska file with two audio streams, one containing only
  1428. the left channel and the other the right channel.
  1429. Split a 5.1 WAV file into per-channel files:
  1430. @example
  1431. ffmpeg -i in.wav -filter_complex
  1432. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1433. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1434. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1435. side_right.wav
  1436. @end example
  1437. @section chorus
  1438. Add a chorus effect to the audio.
  1439. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1440. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1441. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1442. The modulation depth defines the range the modulated delay is played before or after
  1443. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1444. sound tuned around the original one, like in a chorus where some vocals are slightly
  1445. off key.
  1446. It accepts the following parameters:
  1447. @table @option
  1448. @item in_gain
  1449. Set input gain. Default is 0.4.
  1450. @item out_gain
  1451. Set output gain. Default is 0.4.
  1452. @item delays
  1453. Set delays. A typical delay is around 40ms to 60ms.
  1454. @item decays
  1455. Set decays.
  1456. @item speeds
  1457. Set speeds.
  1458. @item depths
  1459. Set depths.
  1460. @end table
  1461. @subsection Examples
  1462. @itemize
  1463. @item
  1464. A single delay:
  1465. @example
  1466. chorus=0.7:0.9:55:0.4:0.25:2
  1467. @end example
  1468. @item
  1469. Two delays:
  1470. @example
  1471. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1472. @end example
  1473. @item
  1474. Fuller sounding chorus with three delays:
  1475. @example
  1476. chorus=0.5:0.9:50|60|40:0.4|0.32|0.3:0.25|0.4|0.3:2|2.3|1.3
  1477. @end example
  1478. @end itemize
  1479. @section compand
  1480. Compress or expand the audio's dynamic range.
  1481. It accepts the following parameters:
  1482. @table @option
  1483. @item attacks
  1484. @item decays
  1485. A list of times in seconds for each channel over which the instantaneous level
  1486. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1487. increase of volume and @var{decays} refers to decrease of volume. For most
  1488. situations, the attack time (response to the audio getting louder) should be
  1489. shorter than the decay time, because the human ear is more sensitive to sudden
  1490. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1491. a typical value for decay is 0.8 seconds.
  1492. If specified number of attacks & decays is lower than number of channels, the last
  1493. set attack/decay will be used for all remaining channels.
  1494. @item points
  1495. A list of points for the transfer function, specified in dB relative to the
  1496. maximum possible signal amplitude. Each key points list must be defined using
  1497. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1498. @code{x0/y0 x1/y1 x2/y2 ....}
  1499. The input values must be in strictly increasing order but the transfer function
  1500. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1501. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1502. function are @code{-70/-70|-60/-20}.
  1503. @item soft-knee
  1504. Set the curve radius in dB for all joints. It defaults to 0.01.
  1505. @item gain
  1506. Set the additional gain in dB to be applied at all points on the transfer
  1507. function. This allows for easy adjustment of the overall gain.
  1508. It defaults to 0.
  1509. @item volume
  1510. Set an initial volume, in dB, to be assumed for each channel when filtering
  1511. starts. This permits the user to supply a nominal level initially, so that, for
  1512. example, a very large gain is not applied to initial signal levels before the
  1513. companding has begun to operate. A typical value for audio which is initially
  1514. quiet is -90 dB. It defaults to 0.
  1515. @item delay
  1516. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1517. delayed before being fed to the volume adjuster. Specifying a delay
  1518. approximately equal to the attack/decay times allows the filter to effectively
  1519. operate in predictive rather than reactive mode. It defaults to 0.
  1520. @end table
  1521. @subsection Examples
  1522. @itemize
  1523. @item
  1524. Make music with both quiet and loud passages suitable for listening to in a
  1525. noisy environment:
  1526. @example
  1527. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1528. @end example
  1529. Another example for audio with whisper and explosion parts:
  1530. @example
  1531. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1532. @end example
  1533. @item
  1534. A noise gate for when the noise is at a lower level than the signal:
  1535. @example
  1536. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1537. @end example
  1538. @item
  1539. Here is another noise gate, this time for when the noise is at a higher level
  1540. than the signal (making it, in some ways, similar to squelch):
  1541. @example
  1542. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1543. @end example
  1544. @item
  1545. 2:1 compression starting at -6dB:
  1546. @example
  1547. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1548. @end example
  1549. @item
  1550. 2:1 compression starting at -9dB:
  1551. @example
  1552. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1553. @end example
  1554. @item
  1555. 2:1 compression starting at -12dB:
  1556. @example
  1557. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1558. @end example
  1559. @item
  1560. 2:1 compression starting at -18dB:
  1561. @example
  1562. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1563. @end example
  1564. @item
  1565. 3:1 compression starting at -15dB:
  1566. @example
  1567. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1568. @end example
  1569. @item
  1570. Compressor/Gate:
  1571. @example
  1572. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1573. @end example
  1574. @item
  1575. Expander:
  1576. @example
  1577. compand=attacks=0:points=-80/-169|-54/-80|-49.5/-64.6|-41.1/-41.1|-25.8/-15|-10.8/-4.5|0/0|20/8.3
  1578. @end example
  1579. @item
  1580. Hard limiter at -6dB:
  1581. @example
  1582. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1583. @end example
  1584. @item
  1585. Hard limiter at -12dB:
  1586. @example
  1587. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1588. @end example
  1589. @item
  1590. Hard noise gate at -35 dB:
  1591. @example
  1592. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1593. @end example
  1594. @item
  1595. Soft limiter:
  1596. @example
  1597. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1598. @end example
  1599. @end itemize
  1600. @section compensationdelay
  1601. Compensation Delay Line is a metric based delay to compensate differing
  1602. positions of microphones or speakers.
  1603. For example, you have recorded guitar with two microphones placed in
  1604. different location. Because the front of sound wave has fixed speed in
  1605. normal conditions, the phasing of microphones can vary and depends on
  1606. their location and interposition. The best sound mix can be achieved when
  1607. these microphones are in phase (synchronized). Note that distance of
  1608. ~30 cm between microphones makes one microphone to capture signal in
  1609. antiphase to another microphone. That makes the final mix sounding moody.
  1610. This filter helps to solve phasing problems by adding different delays
  1611. to each microphone track and make them synchronized.
  1612. The best result can be reached when you take one track as base and
  1613. synchronize other tracks one by one with it.
  1614. Remember that synchronization/delay tolerance depends on sample rate, too.
  1615. Higher sample rates will give more tolerance.
  1616. It accepts the following parameters:
  1617. @table @option
  1618. @item mm
  1619. Set millimeters distance. This is compensation distance for fine tuning.
  1620. Default is 0.
  1621. @item cm
  1622. Set cm distance. This is compensation distance for tightening distance setup.
  1623. Default is 0.
  1624. @item m
  1625. Set meters distance. This is compensation distance for hard distance setup.
  1626. Default is 0.
  1627. @item dry
  1628. Set dry amount. Amount of unprocessed (dry) signal.
  1629. Default is 0.
  1630. @item wet
  1631. Set wet amount. Amount of processed (wet) signal.
  1632. Default is 1.
  1633. @item temp
  1634. Set temperature degree in Celsius. This is the temperature of the environment.
  1635. Default is 20.
  1636. @end table
  1637. @section dcshift
  1638. Apply a DC shift to the audio.
  1639. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1640. in the recording chain) from the audio. The effect of a DC offset is reduced
  1641. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1642. a signal has a DC offset.
  1643. @table @option
  1644. @item shift
  1645. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1646. the audio.
  1647. @item limitergain
  1648. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1649. used to prevent clipping.
  1650. @end table
  1651. @section dynaudnorm
  1652. Dynamic Audio Normalizer.
  1653. This filter applies a certain amount of gain to the input audio in order
  1654. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1655. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1656. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1657. This allows for applying extra gain to the "quiet" sections of the audio
  1658. while avoiding distortions or clipping the "loud" sections. In other words:
  1659. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1660. sections, in the sense that the volume of each section is brought to the
  1661. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1662. this goal *without* applying "dynamic range compressing". It will retain 100%
  1663. of the dynamic range *within* each section of the audio file.
  1664. @table @option
  1665. @item f
  1666. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1667. Default is 500 milliseconds.
  1668. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1669. referred to as frames. This is required, because a peak magnitude has no
  1670. meaning for just a single sample value. Instead, we need to determine the
  1671. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1672. normalizer would simply use the peak magnitude of the complete file, the
  1673. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1674. frame. The length of a frame is specified in milliseconds. By default, the
  1675. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1676. been found to give good results with most files.
  1677. Note that the exact frame length, in number of samples, will be determined
  1678. automatically, based on the sampling rate of the individual input audio file.
  1679. @item g
  1680. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1681. number. Default is 31.
  1682. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1683. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1684. is specified in frames, centered around the current frame. For the sake of
  1685. simplicity, this must be an odd number. Consequently, the default value of 31
  1686. takes into account the current frame, as well as the 15 preceding frames and
  1687. the 15 subsequent frames. Using a larger window results in a stronger
  1688. smoothing effect and thus in less gain variation, i.e. slower gain
  1689. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1690. effect and thus in more gain variation, i.e. faster gain adaptation.
  1691. In other words, the more you increase this value, the more the Dynamic Audio
  1692. Normalizer will behave like a "traditional" normalization filter. On the
  1693. contrary, the more you decrease this value, the more the Dynamic Audio
  1694. Normalizer will behave like a dynamic range compressor.
  1695. @item p
  1696. Set the target peak value. This specifies the highest permissible magnitude
  1697. level for the normalized audio input. This filter will try to approach the
  1698. target peak magnitude as closely as possible, but at the same time it also
  1699. makes sure that the normalized signal will never exceed the peak magnitude.
  1700. A frame's maximum local gain factor is imposed directly by the target peak
  1701. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1702. It is not recommended to go above this value.
  1703. @item m
  1704. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1705. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1706. factor for each input frame, i.e. the maximum gain factor that does not
  1707. result in clipping or distortion. The maximum gain factor is determined by
  1708. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1709. additionally bounds the frame's maximum gain factor by a predetermined
  1710. (global) maximum gain factor. This is done in order to avoid excessive gain
  1711. factors in "silent" or almost silent frames. By default, the maximum gain
  1712. factor is 10.0, For most inputs the default value should be sufficient and
  1713. it usually is not recommended to increase this value. Though, for input
  1714. with an extremely low overall volume level, it may be necessary to allow even
  1715. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1716. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1717. Instead, a "sigmoid" threshold function will be applied. This way, the
  1718. gain factors will smoothly approach the threshold value, but never exceed that
  1719. value.
  1720. @item r
  1721. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1722. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1723. This means that the maximum local gain factor for each frame is defined
  1724. (only) by the frame's highest magnitude sample. This way, the samples can
  1725. be amplified as much as possible without exceeding the maximum signal
  1726. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1727. Normalizer can also take into account the frame's root mean square,
  1728. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1729. determine the power of a time-varying signal. It is therefore considered
  1730. that the RMS is a better approximation of the "perceived loudness" than
  1731. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1732. frames to a constant RMS value, a uniform "perceived loudness" can be
  1733. established. If a target RMS value has been specified, a frame's local gain
  1734. factor is defined as the factor that would result in exactly that RMS value.
  1735. Note, however, that the maximum local gain factor is still restricted by the
  1736. frame's highest magnitude sample, in order to prevent clipping.
  1737. @item n
  1738. Enable channels coupling. By default is enabled.
  1739. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1740. amount. This means the same gain factor will be applied to all channels, i.e.
  1741. the maximum possible gain factor is determined by the "loudest" channel.
  1742. However, in some recordings, it may happen that the volume of the different
  1743. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1744. In this case, this option can be used to disable the channel coupling. This way,
  1745. the gain factor will be determined independently for each channel, depending
  1746. only on the individual channel's highest magnitude sample. This allows for
  1747. harmonizing the volume of the different channels.
  1748. @item c
  1749. Enable DC bias correction. By default is disabled.
  1750. An audio signal (in the time domain) is a sequence of sample values.
  1751. In the Dynamic Audio Normalizer these sample values are represented in the
  1752. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1753. audio signal, or "waveform", should be centered around the zero point.
  1754. That means if we calculate the mean value of all samples in a file, or in a
  1755. single frame, then the result should be 0.0 or at least very close to that
  1756. value. If, however, there is a significant deviation of the mean value from
  1757. 0.0, in either positive or negative direction, this is referred to as a
  1758. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1759. Audio Normalizer provides optional DC bias correction.
  1760. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1761. the mean value, or "DC correction" offset, of each input frame and subtract
  1762. that value from all of the frame's sample values which ensures those samples
  1763. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1764. boundaries, the DC correction offset values will be interpolated smoothly
  1765. between neighbouring frames.
  1766. @item b
  1767. Enable alternative boundary mode. By default is disabled.
  1768. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1769. around each frame. This includes the preceding frames as well as the
  1770. subsequent frames. However, for the "boundary" frames, located at the very
  1771. beginning and at the very end of the audio file, not all neighbouring
  1772. frames are available. In particular, for the first few frames in the audio
  1773. file, the preceding frames are not known. And, similarly, for the last few
  1774. frames in the audio file, the subsequent frames are not known. Thus, the
  1775. question arises which gain factors should be assumed for the missing frames
  1776. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1777. to deal with this situation. The default boundary mode assumes a gain factor
  1778. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1779. "fade out" at the beginning and at the end of the input, respectively.
  1780. @item s
  1781. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1782. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1783. compression. This means that signal peaks will not be pruned and thus the
  1784. full dynamic range will be retained within each local neighbourhood. However,
  1785. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1786. normalization algorithm with a more "traditional" compression.
  1787. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1788. (thresholding) function. If (and only if) the compression feature is enabled,
  1789. all input frames will be processed by a soft knee thresholding function prior
  1790. to the actual normalization process. Put simply, the thresholding function is
  1791. going to prune all samples whose magnitude exceeds a certain threshold value.
  1792. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1793. value. Instead, the threshold value will be adjusted for each individual
  1794. frame.
  1795. In general, smaller parameters result in stronger compression, and vice versa.
  1796. Values below 3.0 are not recommended, because audible distortion may appear.
  1797. @end table
  1798. @section earwax
  1799. Make audio easier to listen to on headphones.
  1800. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1801. so that when listened to on headphones the stereo image is moved from
  1802. inside your head (standard for headphones) to outside and in front of
  1803. the listener (standard for speakers).
  1804. Ported from SoX.
  1805. @section equalizer
  1806. Apply a two-pole peaking equalisation (EQ) filter. With this
  1807. filter, the signal-level at and around a selected frequency can
  1808. be increased or decreased, whilst (unlike bandpass and bandreject
  1809. filters) that at all other frequencies is unchanged.
  1810. In order to produce complex equalisation curves, this filter can
  1811. be given several times, each with a different central frequency.
  1812. The filter accepts the following options:
  1813. @table @option
  1814. @item frequency, f
  1815. Set the filter's central frequency in Hz.
  1816. @item width_type
  1817. Set method to specify band-width of filter.
  1818. @table @option
  1819. @item h
  1820. Hz
  1821. @item q
  1822. Q-Factor
  1823. @item o
  1824. octave
  1825. @item s
  1826. slope
  1827. @end table
  1828. @item width, w
  1829. Specify the band-width of a filter in width_type units.
  1830. @item gain, g
  1831. Set the required gain or attenuation in dB.
  1832. Beware of clipping when using a positive gain.
  1833. @end table
  1834. @subsection Examples
  1835. @itemize
  1836. @item
  1837. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  1838. @example
  1839. equalizer=f=1000:width_type=h:width=200:g=-10
  1840. @end example
  1841. @item
  1842. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  1843. @example
  1844. equalizer=f=1000:width_type=q:width=1:g=2,equalizer=f=100:width_type=q:width=2:g=-5
  1845. @end example
  1846. @end itemize
  1847. @section extrastereo
  1848. Linearly increases the difference between left and right channels which
  1849. adds some sort of "live" effect to playback.
  1850. The filter accepts the following option:
  1851. @table @option
  1852. @item m
  1853. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  1854. (average of both channels), with 1.0 sound will be unchanged, with
  1855. -1.0 left and right channels will be swapped.
  1856. @item c
  1857. Enable clipping. By default is enabled.
  1858. @end table
  1859. @section firequalizer
  1860. Apply FIR Equalization using arbitrary frequency response.
  1861. The filter accepts the following option:
  1862. @table @option
  1863. @item gain
  1864. Set gain curve equation (in dB). The expression can contain variables:
  1865. @table @option
  1866. @item f
  1867. the evaluated frequency
  1868. @item sr
  1869. sample rate
  1870. @item ch
  1871. channel number, set to 0 when multichannels evaluation is disabled
  1872. @item chid
  1873. channel id, see libavutil/channel_layout.h, set to the first channel id when
  1874. multichannels evaluation is disabled
  1875. @item chs
  1876. number of channels
  1877. @item chlayout
  1878. channel_layout, see libavutil/channel_layout.h
  1879. @end table
  1880. and functions:
  1881. @table @option
  1882. @item gain_interpolate(f)
  1883. interpolate gain on frequency f based on gain_entry
  1884. @end table
  1885. This option is also available as command. Default is @code{gain_interpolate(f)}.
  1886. @item gain_entry
  1887. Set gain entry for gain_interpolate function. The expression can
  1888. contain functions:
  1889. @table @option
  1890. @item entry(f, g)
  1891. store gain entry at frequency f with value g
  1892. @end table
  1893. This option is also available as command.
  1894. @item delay
  1895. Set filter delay in seconds. Higher value means more accurate.
  1896. Default is @code{0.01}.
  1897. @item accuracy
  1898. Set filter accuracy in Hz. Lower value means more accurate.
  1899. Default is @code{5}.
  1900. @item wfunc
  1901. Set window function. Acceptable values are:
  1902. @table @option
  1903. @item rectangular
  1904. rectangular window, useful when gain curve is already smooth
  1905. @item hann
  1906. hann window (default)
  1907. @item hamming
  1908. hamming window
  1909. @item blackman
  1910. blackman window
  1911. @item nuttall3
  1912. 3-terms continuous 1st derivative nuttall window
  1913. @item mnuttall3
  1914. minimum 3-terms discontinuous nuttall window
  1915. @item nuttall
  1916. 4-terms continuous 1st derivative nuttall window
  1917. @item bnuttall
  1918. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  1919. @item bharris
  1920. blackman-harris window
  1921. @end table
  1922. @item fixed
  1923. If enabled, use fixed number of audio samples. This improves speed when
  1924. filtering with large delay. Default is disabled.
  1925. @item multi
  1926. Enable multichannels evaluation on gain. Default is disabled.
  1927. @end table
  1928. @subsection Examples
  1929. @itemize
  1930. @item
  1931. lowpass at 1000 Hz:
  1932. @example
  1933. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  1934. @end example
  1935. @item
  1936. lowpass at 1000 Hz with gain_entry:
  1937. @example
  1938. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  1939. @end example
  1940. @item
  1941. custom equalization:
  1942. @example
  1943. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  1944. @end example
  1945. @item
  1946. higher delay:
  1947. @example
  1948. firequalizer=delay=0.1:fixed=on
  1949. @end example
  1950. @item
  1951. lowpass on left channel, highpass on right channel:
  1952. @example
  1953. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  1954. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  1955. @end example
  1956. @end itemize
  1957. @section flanger
  1958. Apply a flanging effect to the audio.
  1959. The filter accepts the following options:
  1960. @table @option
  1961. @item delay
  1962. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  1963. @item depth
  1964. Set added swep delay in milliseconds. Range from 0 to 10. Default value is 2.
  1965. @item regen
  1966. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  1967. Default value is 0.
  1968. @item width
  1969. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  1970. Default value is 71.
  1971. @item speed
  1972. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  1973. @item shape
  1974. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  1975. Default value is @var{sinusoidal}.
  1976. @item phase
  1977. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  1978. Default value is 25.
  1979. @item interp
  1980. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  1981. Default is @var{linear}.
  1982. @end table
  1983. @section highpass
  1984. Apply a high-pass filter with 3dB point frequency.
  1985. The filter can be either single-pole, or double-pole (the default).
  1986. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  1987. The filter accepts the following options:
  1988. @table @option
  1989. @item frequency, f
  1990. Set frequency in Hz. Default is 3000.
  1991. @item poles, p
  1992. Set number of poles. Default is 2.
  1993. @item width_type
  1994. Set method to specify band-width of filter.
  1995. @table @option
  1996. @item h
  1997. Hz
  1998. @item q
  1999. Q-Factor
  2000. @item o
  2001. octave
  2002. @item s
  2003. slope
  2004. @end table
  2005. @item width, w
  2006. Specify the band-width of a filter in width_type units.
  2007. Applies only to double-pole filter.
  2008. The default is 0.707q and gives a Butterworth response.
  2009. @end table
  2010. @section join
  2011. Join multiple input streams into one multi-channel stream.
  2012. It accepts the following parameters:
  2013. @table @option
  2014. @item inputs
  2015. The number of input streams. It defaults to 2.
  2016. @item channel_layout
  2017. The desired output channel layout. It defaults to stereo.
  2018. @item map
  2019. Map channels from inputs to output. The argument is a '|'-separated list of
  2020. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2021. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2022. can be either the name of the input channel (e.g. FL for front left) or its
  2023. index in the specified input stream. @var{out_channel} is the name of the output
  2024. channel.
  2025. @end table
  2026. The filter will attempt to guess the mappings when they are not specified
  2027. explicitly. It does so by first trying to find an unused matching input channel
  2028. and if that fails it picks the first unused input channel.
  2029. Join 3 inputs (with properly set channel layouts):
  2030. @example
  2031. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2032. @end example
  2033. Build a 5.1 output from 6 single-channel streams:
  2034. @example
  2035. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2036. 'join=inputs=6:channel_layout=5.1:map=0.0-FL|1.0-FR|2.0-FC|3.0-SL|4.0-SR|5.0-LFE'
  2037. out
  2038. @end example
  2039. @section ladspa
  2040. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2041. To enable compilation of this filter you need to configure FFmpeg with
  2042. @code{--enable-ladspa}.
  2043. @table @option
  2044. @item file, f
  2045. Specifies the name of LADSPA plugin library to load. If the environment
  2046. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2047. each one of the directories specified by the colon separated list in
  2048. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2049. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2050. @file{/usr/lib/ladspa/}.
  2051. @item plugin, p
  2052. Specifies the plugin within the library. Some libraries contain only
  2053. one plugin, but others contain many of them. If this is not set filter
  2054. will list all available plugins within the specified library.
  2055. @item controls, c
  2056. Set the '|' separated list of controls which are zero or more floating point
  2057. values that determine the behavior of the loaded plugin (for example delay,
  2058. threshold or gain).
  2059. Controls need to be defined using the following syntax:
  2060. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2061. @var{valuei} is the value set on the @var{i}-th control.
  2062. Alternatively they can be also defined using the following syntax:
  2063. @var{value0}|@var{value1}|@var{value2}|..., where
  2064. @var{valuei} is the value set on the @var{i}-th control.
  2065. If @option{controls} is set to @code{help}, all available controls and
  2066. their valid ranges are printed.
  2067. @item sample_rate, s
  2068. Specify the sample rate, default to 44100. Only used if plugin have
  2069. zero inputs.
  2070. @item nb_samples, n
  2071. Set the number of samples per channel per each output frame, default
  2072. is 1024. Only used if plugin have zero inputs.
  2073. @item duration, d
  2074. Set the minimum duration of the sourced audio. See
  2075. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2076. for the accepted syntax.
  2077. Note that the resulting duration may be greater than the specified duration,
  2078. as the generated audio is always cut at the end of a complete frame.
  2079. If not specified, or the expressed duration is negative, the audio is
  2080. supposed to be generated forever.
  2081. Only used if plugin have zero inputs.
  2082. @end table
  2083. @subsection Examples
  2084. @itemize
  2085. @item
  2086. List all available plugins within amp (LADSPA example plugin) library:
  2087. @example
  2088. ladspa=file=amp
  2089. @end example
  2090. @item
  2091. List all available controls and their valid ranges for @code{vcf_notch}
  2092. plugin from @code{VCF} library:
  2093. @example
  2094. ladspa=f=vcf:p=vcf_notch:c=help
  2095. @end example
  2096. @item
  2097. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2098. plugin library:
  2099. @example
  2100. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2101. @end example
  2102. @item
  2103. Add reverberation to the audio using TAP-plugins
  2104. (Tom's Audio Processing plugins):
  2105. @example
  2106. ladspa=file=tap_reverb:tap_reverb
  2107. @end example
  2108. @item
  2109. Generate white noise, with 0.2 amplitude:
  2110. @example
  2111. ladspa=file=cmt:noise_source_white:c=c0=.2
  2112. @end example
  2113. @item
  2114. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2115. @code{C* Audio Plugin Suite} (CAPS) library:
  2116. @example
  2117. ladspa=file=caps:Click:c=c1=20'
  2118. @end example
  2119. @item
  2120. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2121. @example
  2122. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2123. @end example
  2124. @item
  2125. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2126. @code{SWH Plugins} collection:
  2127. @example
  2128. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2129. @end example
  2130. @item
  2131. Attenuate low frequencies using Multiband EQ from Steve Harris
  2132. @code{SWH Plugins} collection:
  2133. @example
  2134. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2135. @end example
  2136. @end itemize
  2137. @subsection Commands
  2138. This filter supports the following commands:
  2139. @table @option
  2140. @item cN
  2141. Modify the @var{N}-th control value.
  2142. If the specified value is not valid, it is ignored and prior one is kept.
  2143. @end table
  2144. @section lowpass
  2145. Apply a low-pass filter with 3dB point frequency.
  2146. The filter can be either single-pole or double-pole (the default).
  2147. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2148. The filter accepts the following options:
  2149. @table @option
  2150. @item frequency, f
  2151. Set frequency in Hz. Default is 500.
  2152. @item poles, p
  2153. Set number of poles. Default is 2.
  2154. @item width_type
  2155. Set method to specify band-width of filter.
  2156. @table @option
  2157. @item h
  2158. Hz
  2159. @item q
  2160. Q-Factor
  2161. @item o
  2162. octave
  2163. @item s
  2164. slope
  2165. @end table
  2166. @item width, w
  2167. Specify the band-width of a filter in width_type units.
  2168. Applies only to double-pole filter.
  2169. The default is 0.707q and gives a Butterworth response.
  2170. @end table
  2171. @anchor{pan}
  2172. @section pan
  2173. Mix channels with specific gain levels. The filter accepts the output
  2174. channel layout followed by a set of channels definitions.
  2175. This filter is also designed to efficiently remap the channels of an audio
  2176. stream.
  2177. The filter accepts parameters of the form:
  2178. "@var{l}|@var{outdef}|@var{outdef}|..."
  2179. @table @option
  2180. @item l
  2181. output channel layout or number of channels
  2182. @item outdef
  2183. output channel specification, of the form:
  2184. "@var{out_name}=[@var{gain}*]@var{in_name}[+[@var{gain}*]@var{in_name}...]"
  2185. @item out_name
  2186. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2187. number (c0, c1, etc.)
  2188. @item gain
  2189. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2190. @item in_name
  2191. input channel to use, see out_name for details; it is not possible to mix
  2192. named and numbered input channels
  2193. @end table
  2194. If the `=' in a channel specification is replaced by `<', then the gains for
  2195. that specification will be renormalized so that the total is 1, thus
  2196. avoiding clipping noise.
  2197. @subsection Mixing examples
  2198. For example, if you want to down-mix from stereo to mono, but with a bigger
  2199. factor for the left channel:
  2200. @example
  2201. pan=1c|c0=0.9*c0+0.1*c1
  2202. @end example
  2203. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2204. 7-channels surround:
  2205. @example
  2206. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2207. @end example
  2208. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2209. that should be preferred (see "-ac" option) unless you have very specific
  2210. needs.
  2211. @subsection Remapping examples
  2212. The channel remapping will be effective if, and only if:
  2213. @itemize
  2214. @item gain coefficients are zeroes or ones,
  2215. @item only one input per channel output,
  2216. @end itemize
  2217. If all these conditions are satisfied, the filter will notify the user ("Pure
  2218. channel mapping detected"), and use an optimized and lossless method to do the
  2219. remapping.
  2220. For example, if you have a 5.1 source and want a stereo audio stream by
  2221. dropping the extra channels:
  2222. @example
  2223. pan="stereo| c0=FL | c1=FR"
  2224. @end example
  2225. Given the same source, you can also switch front left and front right channels
  2226. and keep the input channel layout:
  2227. @example
  2228. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2229. @end example
  2230. If the input is a stereo audio stream, you can mute the front left channel (and
  2231. still keep the stereo channel layout) with:
  2232. @example
  2233. pan="stereo|c1=c1"
  2234. @end example
  2235. Still with a stereo audio stream input, you can copy the right channel in both
  2236. front left and right:
  2237. @example
  2238. pan="stereo| c0=FR | c1=FR"
  2239. @end example
  2240. @section replaygain
  2241. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2242. outputs it unchanged.
  2243. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2244. @section resample
  2245. Convert the audio sample format, sample rate and channel layout. It is
  2246. not meant to be used directly.
  2247. @section rubberband
  2248. Apply time-stretching and pitch-shifting with librubberband.
  2249. The filter accepts the following options:
  2250. @table @option
  2251. @item tempo
  2252. Set tempo scale factor.
  2253. @item pitch
  2254. Set pitch scale factor.
  2255. @item transients
  2256. Set transients detector.
  2257. Possible values are:
  2258. @table @var
  2259. @item crisp
  2260. @item mixed
  2261. @item smooth
  2262. @end table
  2263. @item detector
  2264. Set detector.
  2265. Possible values are:
  2266. @table @var
  2267. @item compound
  2268. @item percussive
  2269. @item soft
  2270. @end table
  2271. @item phase
  2272. Set phase.
  2273. Possible values are:
  2274. @table @var
  2275. @item laminar
  2276. @item independent
  2277. @end table
  2278. @item window
  2279. Set processing window size.
  2280. Possible values are:
  2281. @table @var
  2282. @item standard
  2283. @item short
  2284. @item long
  2285. @end table
  2286. @item smoothing
  2287. Set smoothing.
  2288. Possible values are:
  2289. @table @var
  2290. @item off
  2291. @item on
  2292. @end table
  2293. @item formant
  2294. Enable formant preservation when shift pitching.
  2295. Possible values are:
  2296. @table @var
  2297. @item shifted
  2298. @item preserved
  2299. @end table
  2300. @item pitchq
  2301. Set pitch quality.
  2302. Possible values are:
  2303. @table @var
  2304. @item quality
  2305. @item speed
  2306. @item consistency
  2307. @end table
  2308. @item channels
  2309. Set channels.
  2310. Possible values are:
  2311. @table @var
  2312. @item apart
  2313. @item together
  2314. @end table
  2315. @end table
  2316. @section sidechaincompress
  2317. This filter acts like normal compressor but has the ability to compress
  2318. detected signal using second input signal.
  2319. It needs two input streams and returns one output stream.
  2320. First input stream will be processed depending on second stream signal.
  2321. The filtered signal then can be filtered with other filters in later stages of
  2322. processing. See @ref{pan} and @ref{amerge} filter.
  2323. The filter accepts the following options:
  2324. @table @option
  2325. @item level_in
  2326. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2327. @item threshold
  2328. If a signal of second stream raises above this level it will affect the gain
  2329. reduction of first stream.
  2330. By default is 0.125. Range is between 0.00097563 and 1.
  2331. @item ratio
  2332. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2333. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2334. Default is 2. Range is between 1 and 20.
  2335. @item attack
  2336. Amount of milliseconds the signal has to rise above the threshold before gain
  2337. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2338. @item release
  2339. Amount of milliseconds the signal has to fall below the threshold before
  2340. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2341. @item makeup
  2342. Set the amount by how much signal will be amplified after processing.
  2343. Default is 2. Range is from 1 and 64.
  2344. @item knee
  2345. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2346. Default is 2.82843. Range is between 1 and 8.
  2347. @item link
  2348. Choose if the @code{average} level between all channels of side-chain stream
  2349. or the louder(@code{maximum}) channel of side-chain stream affects the
  2350. reduction. Default is @code{average}.
  2351. @item detection
  2352. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2353. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2354. @item level_sc
  2355. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2356. @item mix
  2357. How much to use compressed signal in output. Default is 1.
  2358. Range is between 0 and 1.
  2359. @end table
  2360. @subsection Examples
  2361. @itemize
  2362. @item
  2363. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2364. depending on the signal of 2nd input and later compressed signal to be
  2365. merged with 2nd input:
  2366. @example
  2367. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2368. @end example
  2369. @end itemize
  2370. @section sidechaingate
  2371. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2372. filter the detected signal before sending it to the gain reduction stage.
  2373. Normally a gate uses the full range signal to detect a level above the
  2374. threshold.
  2375. For example: If you cut all lower frequencies from your sidechain signal
  2376. the gate will decrease the volume of your track only if not enough highs
  2377. appear. With this technique you are able to reduce the resonation of a
  2378. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2379. guitar.
  2380. It needs two input streams and returns one output stream.
  2381. First input stream will be processed depending on second stream signal.
  2382. The filter accepts the following options:
  2383. @table @option
  2384. @item level_in
  2385. Set input level before filtering.
  2386. Default is 1. Allowed range is from 0.015625 to 64.
  2387. @item range
  2388. Set the level of gain reduction when the signal is below the threshold.
  2389. Default is 0.06125. Allowed range is from 0 to 1.
  2390. @item threshold
  2391. If a signal rises above this level the gain reduction is released.
  2392. Default is 0.125. Allowed range is from 0 to 1.
  2393. @item ratio
  2394. Set a ratio about which the signal is reduced.
  2395. Default is 2. Allowed range is from 1 to 9000.
  2396. @item attack
  2397. Amount of milliseconds the signal has to rise above the threshold before gain
  2398. reduction stops.
  2399. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2400. @item release
  2401. Amount of milliseconds the signal has to fall below the threshold before the
  2402. reduction is increased again. Default is 250 milliseconds.
  2403. Allowed range is from 0.01 to 9000.
  2404. @item makeup
  2405. Set amount of amplification of signal after processing.
  2406. Default is 1. Allowed range is from 1 to 64.
  2407. @item knee
  2408. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2409. Default is 2.828427125. Allowed range is from 1 to 8.
  2410. @item detection
  2411. Choose if exact signal should be taken for detection or an RMS like one.
  2412. Default is rms. Can be peak or rms.
  2413. @item link
  2414. Choose if the average level between all channels or the louder channel affects
  2415. the reduction.
  2416. Default is average. Can be average or maximum.
  2417. @item level_sc
  2418. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2419. @end table
  2420. @section silencedetect
  2421. Detect silence in an audio stream.
  2422. This filter logs a message when it detects that the input audio volume is less
  2423. or equal to a noise tolerance value for a duration greater or equal to the
  2424. minimum detected noise duration.
  2425. The printed times and duration are expressed in seconds.
  2426. The filter accepts the following options:
  2427. @table @option
  2428. @item duration, d
  2429. Set silence duration until notification (default is 2 seconds).
  2430. @item noise, n
  2431. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2432. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2433. @end table
  2434. @subsection Examples
  2435. @itemize
  2436. @item
  2437. Detect 5 seconds of silence with -50dB noise tolerance:
  2438. @example
  2439. silencedetect=n=-50dB:d=5
  2440. @end example
  2441. @item
  2442. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2443. tolerance in @file{silence.mp3}:
  2444. @example
  2445. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2446. @end example
  2447. @end itemize
  2448. @section silenceremove
  2449. Remove silence from the beginning, middle or end of the audio.
  2450. The filter accepts the following options:
  2451. @table @option
  2452. @item start_periods
  2453. This value is used to indicate if audio should be trimmed at beginning of
  2454. the audio. A value of zero indicates no silence should be trimmed from the
  2455. beginning. When specifying a non-zero value, it trims audio up until it
  2456. finds non-silence. Normally, when trimming silence from beginning of audio
  2457. the @var{start_periods} will be @code{1} but it can be increased to higher
  2458. values to trim all audio up to specific count of non-silence periods.
  2459. Default value is @code{0}.
  2460. @item start_duration
  2461. Specify the amount of time that non-silence must be detected before it stops
  2462. trimming audio. By increasing the duration, bursts of noises can be treated
  2463. as silence and trimmed off. Default value is @code{0}.
  2464. @item start_threshold
  2465. This indicates what sample value should be treated as silence. For digital
  2466. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2467. you may wish to increase the value to account for background noise.
  2468. Can be specified in dB (in case "dB" is appended to the specified value)
  2469. or amplitude ratio. Default value is @code{0}.
  2470. @item stop_periods
  2471. Set the count for trimming silence from the end of audio.
  2472. To remove silence from the middle of a file, specify a @var{stop_periods}
  2473. that is negative. This value is then treated as a positive value and is
  2474. used to indicate the effect should restart processing as specified by
  2475. @var{start_periods}, making it suitable for removing periods of silence
  2476. in the middle of the audio.
  2477. Default value is @code{0}.
  2478. @item stop_duration
  2479. Specify a duration of silence that must exist before audio is not copied any
  2480. more. By specifying a higher duration, silence that is wanted can be left in
  2481. the audio.
  2482. Default value is @code{0}.
  2483. @item stop_threshold
  2484. This is the same as @option{start_threshold} but for trimming silence from
  2485. the end of audio.
  2486. Can be specified in dB (in case "dB" is appended to the specified value)
  2487. or amplitude ratio. Default value is @code{0}.
  2488. @item leave_silence
  2489. This indicate that @var{stop_duration} length of audio should be left intact
  2490. at the beginning of each period of silence.
  2491. For example, if you want to remove long pauses between words but do not want
  2492. to remove the pauses completely. Default value is @code{0}.
  2493. @item detection
  2494. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  2495. and works better with digital silence which is exactly 0.
  2496. Default value is @code{rms}.
  2497. @item window
  2498. Set ratio used to calculate size of window for detecting silence.
  2499. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  2500. @end table
  2501. @subsection Examples
  2502. @itemize
  2503. @item
  2504. The following example shows how this filter can be used to start a recording
  2505. that does not contain the delay at the start which usually occurs between
  2506. pressing the record button and the start of the performance:
  2507. @example
  2508. silenceremove=1:5:0.02
  2509. @end example
  2510. @item
  2511. Trim all silence encountered from begining to end where there is more than 1
  2512. second of silence in audio:
  2513. @example
  2514. silenceremove=0:0:0:-1:1:-90dB
  2515. @end example
  2516. @end itemize
  2517. @section sofalizer
  2518. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  2519. loudspeakers around the user for binaural listening via headphones (audio
  2520. formats up to 9 channels supported).
  2521. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  2522. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  2523. Austrian Academy of Sciences.
  2524. To enable compilation of this filter you need to configure FFmpeg with
  2525. @code{--enable-netcdf}.
  2526. The filter accepts the following options:
  2527. @table @option
  2528. @item sofa
  2529. Set the SOFA file used for rendering.
  2530. @item gain
  2531. Set gain applied to audio. Value is in dB. Default is 0.
  2532. @item rotation
  2533. Set rotation of virtual loudspeakers in deg. Default is 0.
  2534. @item elevation
  2535. Set elevation of virtual speakers in deg. Default is 0.
  2536. @item radius
  2537. Set distance in meters between loudspeakers and the listener with near-field
  2538. HRTFs. Default is 1.
  2539. @item type
  2540. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2541. processing audio in time domain which is slow but gives high quality output.
  2542. @var{freq} is processing audio in frequency domain which is fast but gives
  2543. mediocre output. Default is @var{freq}.
  2544. @end table
  2545. @section stereotools
  2546. This filter has some handy utilities to manage stereo signals, for converting
  2547. M/S stereo recordings to L/R signal while having control over the parameters
  2548. or spreading the stereo image of master track.
  2549. The filter accepts the following options:
  2550. @table @option
  2551. @item level_in
  2552. Set input level before filtering for both channels. Defaults is 1.
  2553. Allowed range is from 0.015625 to 64.
  2554. @item level_out
  2555. Set output level after filtering for both channels. Defaults is 1.
  2556. Allowed range is from 0.015625 to 64.
  2557. @item balance_in
  2558. Set input balance between both channels. Default is 0.
  2559. Allowed range is from -1 to 1.
  2560. @item balance_out
  2561. Set output balance between both channels. Default is 0.
  2562. Allowed range is from -1 to 1.
  2563. @item softclip
  2564. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  2565. clipping. Disabled by default.
  2566. @item mutel
  2567. Mute the left channel. Disabled by default.
  2568. @item muter
  2569. Mute the right channel. Disabled by default.
  2570. @item phasel
  2571. Change the phase of the left channel. Disabled by default.
  2572. @item phaser
  2573. Change the phase of the right channel. Disabled by default.
  2574. @item mode
  2575. Set stereo mode. Available values are:
  2576. @table @samp
  2577. @item lr>lr
  2578. Left/Right to Left/Right, this is default.
  2579. @item lr>ms
  2580. Left/Right to Mid/Side.
  2581. @item ms>lr
  2582. Mid/Side to Left/Right.
  2583. @item lr>ll
  2584. Left/Right to Left/Left.
  2585. @item lr>rr
  2586. Left/Right to Right/Right.
  2587. @item lr>l+r
  2588. Left/Right to Left + Right.
  2589. @item lr>rl
  2590. Left/Right to Right/Left.
  2591. @end table
  2592. @item slev
  2593. Set level of side signal. Default is 1.
  2594. Allowed range is from 0.015625 to 64.
  2595. @item sbal
  2596. Set balance of side signal. Default is 0.
  2597. Allowed range is from -1 to 1.
  2598. @item mlev
  2599. Set level of the middle signal. Default is 1.
  2600. Allowed range is from 0.015625 to 64.
  2601. @item mpan
  2602. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  2603. @item base
  2604. Set stereo base between mono and inversed channels. Default is 0.
  2605. Allowed range is from -1 to 1.
  2606. @item delay
  2607. Set delay in milliseconds how much to delay left from right channel and
  2608. vice versa. Default is 0. Allowed range is from -20 to 20.
  2609. @item sclevel
  2610. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  2611. @item phase
  2612. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  2613. @end table
  2614. @section stereowiden
  2615. This filter enhance the stereo effect by suppressing signal common to both
  2616. channels and by delaying the signal of left into right and vice versa,
  2617. thereby widening the stereo effect.
  2618. The filter accepts the following options:
  2619. @table @option
  2620. @item delay
  2621. Time in milliseconds of the delay of left signal into right and vice versa.
  2622. Default is 20 milliseconds.
  2623. @item feedback
  2624. Amount of gain in delayed signal into right and vice versa. Gives a delay
  2625. effect of left signal in right output and vice versa which gives widening
  2626. effect. Default is 0.3.
  2627. @item crossfeed
  2628. Cross feed of left into right with inverted phase. This helps in suppressing
  2629. the mono. If the value is 1 it will cancel all the signal common to both
  2630. channels. Default is 0.3.
  2631. @item drymix
  2632. Set level of input signal of original channel. Default is 0.8.
  2633. @end table
  2634. @section treble
  2635. Boost or cut treble (upper) frequencies of the audio using a two-pole
  2636. shelving filter with a response similar to that of a standard
  2637. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2638. The filter accepts the following options:
  2639. @table @option
  2640. @item gain, g
  2641. Give the gain at whichever is the lower of ~22 kHz and the
  2642. Nyquist frequency. Its useful range is about -20 (for a large cut)
  2643. to +20 (for a large boost). Beware of clipping when using a positive gain.
  2644. @item frequency, f
  2645. Set the filter's central frequency and so can be used
  2646. to extend or reduce the frequency range to be boosted or cut.
  2647. The default value is @code{3000} Hz.
  2648. @item width_type
  2649. Set method to specify band-width of filter.
  2650. @table @option
  2651. @item h
  2652. Hz
  2653. @item q
  2654. Q-Factor
  2655. @item o
  2656. octave
  2657. @item s
  2658. slope
  2659. @end table
  2660. @item width, w
  2661. Determine how steep is the filter's shelf transition.
  2662. @end table
  2663. @section tremolo
  2664. Sinusoidal amplitude modulation.
  2665. The filter accepts the following options:
  2666. @table @option
  2667. @item f
  2668. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  2669. (20 Hz or lower) will result in a tremolo effect.
  2670. This filter may also be used as a ring modulator by specifying
  2671. a modulation frequency higher than 20 Hz.
  2672. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2673. @item d
  2674. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2675. Default value is 0.5.
  2676. @end table
  2677. @section vibrato
  2678. Sinusoidal phase modulation.
  2679. The filter accepts the following options:
  2680. @table @option
  2681. @item f
  2682. Modulation frequency in Hertz.
  2683. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2684. @item d
  2685. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2686. Default value is 0.5.
  2687. @end table
  2688. @section volume
  2689. Adjust the input audio volume.
  2690. It accepts the following parameters:
  2691. @table @option
  2692. @item volume
  2693. Set audio volume expression.
  2694. Output values are clipped to the maximum value.
  2695. The output audio volume is given by the relation:
  2696. @example
  2697. @var{output_volume} = @var{volume} * @var{input_volume}
  2698. @end example
  2699. The default value for @var{volume} is "1.0".
  2700. @item precision
  2701. This parameter represents the mathematical precision.
  2702. It determines which input sample formats will be allowed, which affects the
  2703. precision of the volume scaling.
  2704. @table @option
  2705. @item fixed
  2706. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  2707. @item float
  2708. 32-bit floating-point; this limits input sample format to FLT. (default)
  2709. @item double
  2710. 64-bit floating-point; this limits input sample format to DBL.
  2711. @end table
  2712. @item replaygain
  2713. Choose the behaviour on encountering ReplayGain side data in input frames.
  2714. @table @option
  2715. @item drop
  2716. Remove ReplayGain side data, ignoring its contents (the default).
  2717. @item ignore
  2718. Ignore ReplayGain side data, but leave it in the frame.
  2719. @item track
  2720. Prefer the track gain, if present.
  2721. @item album
  2722. Prefer the album gain, if present.
  2723. @end table
  2724. @item replaygain_preamp
  2725. Pre-amplification gain in dB to apply to the selected replaygain gain.
  2726. Default value for @var{replaygain_preamp} is 0.0.
  2727. @item eval
  2728. Set when the volume expression is evaluated.
  2729. It accepts the following values:
  2730. @table @samp
  2731. @item once
  2732. only evaluate expression once during the filter initialization, or
  2733. when the @samp{volume} command is sent
  2734. @item frame
  2735. evaluate expression for each incoming frame
  2736. @end table
  2737. Default value is @samp{once}.
  2738. @end table
  2739. The volume expression can contain the following parameters.
  2740. @table @option
  2741. @item n
  2742. frame number (starting at zero)
  2743. @item nb_channels
  2744. number of channels
  2745. @item nb_consumed_samples
  2746. number of samples consumed by the filter
  2747. @item nb_samples
  2748. number of samples in the current frame
  2749. @item pos
  2750. original frame position in the file
  2751. @item pts
  2752. frame PTS
  2753. @item sample_rate
  2754. sample rate
  2755. @item startpts
  2756. PTS at start of stream
  2757. @item startt
  2758. time at start of stream
  2759. @item t
  2760. frame time
  2761. @item tb
  2762. timestamp timebase
  2763. @item volume
  2764. last set volume value
  2765. @end table
  2766. Note that when @option{eval} is set to @samp{once} only the
  2767. @var{sample_rate} and @var{tb} variables are available, all other
  2768. variables will evaluate to NAN.
  2769. @subsection Commands
  2770. This filter supports the following commands:
  2771. @table @option
  2772. @item volume
  2773. Modify the volume expression.
  2774. The command accepts the same syntax of the corresponding option.
  2775. If the specified expression is not valid, it is kept at its current
  2776. value.
  2777. @item replaygain_noclip
  2778. Prevent clipping by limiting the gain applied.
  2779. Default value for @var{replaygain_noclip} is 1.
  2780. @end table
  2781. @subsection Examples
  2782. @itemize
  2783. @item
  2784. Halve the input audio volume:
  2785. @example
  2786. volume=volume=0.5
  2787. volume=volume=1/2
  2788. volume=volume=-6.0206dB
  2789. @end example
  2790. In all the above example the named key for @option{volume} can be
  2791. omitted, for example like in:
  2792. @example
  2793. volume=0.5
  2794. @end example
  2795. @item
  2796. Increase input audio power by 6 decibels using fixed-point precision:
  2797. @example
  2798. volume=volume=6dB:precision=fixed
  2799. @end example
  2800. @item
  2801. Fade volume after time 10 with an annihilation period of 5 seconds:
  2802. @example
  2803. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  2804. @end example
  2805. @end itemize
  2806. @section volumedetect
  2807. Detect the volume of the input video.
  2808. The filter has no parameters. The input is not modified. Statistics about
  2809. the volume will be printed in the log when the input stream end is reached.
  2810. In particular it will show the mean volume (root mean square), maximum
  2811. volume (on a per-sample basis), and the beginning of a histogram of the
  2812. registered volume values (from the maximum value to a cumulated 1/1000 of
  2813. the samples).
  2814. All volumes are in decibels relative to the maximum PCM value.
  2815. @subsection Examples
  2816. Here is an excerpt of the output:
  2817. @example
  2818. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  2819. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  2820. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  2821. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  2822. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  2823. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  2824. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  2825. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  2826. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  2827. @end example
  2828. It means that:
  2829. @itemize
  2830. @item
  2831. The mean square energy is approximately -27 dB, or 10^-2.7.
  2832. @item
  2833. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  2834. @item
  2835. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  2836. @end itemize
  2837. In other words, raising the volume by +4 dB does not cause any clipping,
  2838. raising it by +5 dB causes clipping for 6 samples, etc.
  2839. @c man end AUDIO FILTERS
  2840. @chapter Audio Sources
  2841. @c man begin AUDIO SOURCES
  2842. Below is a description of the currently available audio sources.
  2843. @section abuffer
  2844. Buffer audio frames, and make them available to the filter chain.
  2845. This source is mainly intended for a programmatic use, in particular
  2846. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  2847. It accepts the following parameters:
  2848. @table @option
  2849. @item time_base
  2850. The timebase which will be used for timestamps of submitted frames. It must be
  2851. either a floating-point number or in @var{numerator}/@var{denominator} form.
  2852. @item sample_rate
  2853. The sample rate of the incoming audio buffers.
  2854. @item sample_fmt
  2855. The sample format of the incoming audio buffers.
  2856. Either a sample format name or its corresponding integer representation from
  2857. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  2858. @item channel_layout
  2859. The channel layout of the incoming audio buffers.
  2860. Either a channel layout name from channel_layout_map in
  2861. @file{libavutil/channel_layout.c} or its corresponding integer representation
  2862. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  2863. @item channels
  2864. The number of channels of the incoming audio buffers.
  2865. If both @var{channels} and @var{channel_layout} are specified, then they
  2866. must be consistent.
  2867. @end table
  2868. @subsection Examples
  2869. @example
  2870. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  2871. @end example
  2872. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  2873. Since the sample format with name "s16p" corresponds to the number
  2874. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  2875. equivalent to:
  2876. @example
  2877. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  2878. @end example
  2879. @section aevalsrc
  2880. Generate an audio signal specified by an expression.
  2881. This source accepts in input one or more expressions (one for each
  2882. channel), which are evaluated and used to generate a corresponding
  2883. audio signal.
  2884. This source accepts the following options:
  2885. @table @option
  2886. @item exprs
  2887. Set the '|'-separated expressions list for each separate channel. In case the
  2888. @option{channel_layout} option is not specified, the selected channel layout
  2889. depends on the number of provided expressions. Otherwise the last
  2890. specified expression is applied to the remaining output channels.
  2891. @item channel_layout, c
  2892. Set the channel layout. The number of channels in the specified layout
  2893. must be equal to the number of specified expressions.
  2894. @item duration, d
  2895. Set the minimum duration of the sourced audio. See
  2896. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2897. for the accepted syntax.
  2898. Note that the resulting duration may be greater than the specified
  2899. duration, as the generated audio is always cut at the end of a
  2900. complete frame.
  2901. If not specified, or the expressed duration is negative, the audio is
  2902. supposed to be generated forever.
  2903. @item nb_samples, n
  2904. Set the number of samples per channel per each output frame,
  2905. default to 1024.
  2906. @item sample_rate, s
  2907. Specify the sample rate, default to 44100.
  2908. @end table
  2909. Each expression in @var{exprs} can contain the following constants:
  2910. @table @option
  2911. @item n
  2912. number of the evaluated sample, starting from 0
  2913. @item t
  2914. time of the evaluated sample expressed in seconds, starting from 0
  2915. @item s
  2916. sample rate
  2917. @end table
  2918. @subsection Examples
  2919. @itemize
  2920. @item
  2921. Generate silence:
  2922. @example
  2923. aevalsrc=0
  2924. @end example
  2925. @item
  2926. Generate a sin signal with frequency of 440 Hz, set sample rate to
  2927. 8000 Hz:
  2928. @example
  2929. aevalsrc="sin(440*2*PI*t):s=8000"
  2930. @end example
  2931. @item
  2932. Generate a two channels signal, specify the channel layout (Front
  2933. Center + Back Center) explicitly:
  2934. @example
  2935. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  2936. @end example
  2937. @item
  2938. Generate white noise:
  2939. @example
  2940. aevalsrc="-2+random(0)"
  2941. @end example
  2942. @item
  2943. Generate an amplitude modulated signal:
  2944. @example
  2945. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  2946. @end example
  2947. @item
  2948. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  2949. @example
  2950. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  2951. @end example
  2952. @end itemize
  2953. @section anullsrc
  2954. The null audio source, return unprocessed audio frames. It is mainly useful
  2955. as a template and to be employed in analysis / debugging tools, or as
  2956. the source for filters which ignore the input data (for example the sox
  2957. synth filter).
  2958. This source accepts the following options:
  2959. @table @option
  2960. @item channel_layout, cl
  2961. Specifies the channel layout, and can be either an integer or a string
  2962. representing a channel layout. The default value of @var{channel_layout}
  2963. is "stereo".
  2964. Check the channel_layout_map definition in
  2965. @file{libavutil/channel_layout.c} for the mapping between strings and
  2966. channel layout values.
  2967. @item sample_rate, r
  2968. Specifies the sample rate, and defaults to 44100.
  2969. @item nb_samples, n
  2970. Set the number of samples per requested frames.
  2971. @end table
  2972. @subsection Examples
  2973. @itemize
  2974. @item
  2975. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  2976. @example
  2977. anullsrc=r=48000:cl=4
  2978. @end example
  2979. @item
  2980. Do the same operation with a more obvious syntax:
  2981. @example
  2982. anullsrc=r=48000:cl=mono
  2983. @end example
  2984. @end itemize
  2985. All the parameters need to be explicitly defined.
  2986. @section flite
  2987. Synthesize a voice utterance using the libflite library.
  2988. To enable compilation of this filter you need to configure FFmpeg with
  2989. @code{--enable-libflite}.
  2990. Note that the flite library is not thread-safe.
  2991. The filter accepts the following options:
  2992. @table @option
  2993. @item list_voices
  2994. If set to 1, list the names of the available voices and exit
  2995. immediately. Default value is 0.
  2996. @item nb_samples, n
  2997. Set the maximum number of samples per frame. Default value is 512.
  2998. @item textfile
  2999. Set the filename containing the text to speak.
  3000. @item text
  3001. Set the text to speak.
  3002. @item voice, v
  3003. Set the voice to use for the speech synthesis. Default value is
  3004. @code{kal}. See also the @var{list_voices} option.
  3005. @end table
  3006. @subsection Examples
  3007. @itemize
  3008. @item
  3009. Read from file @file{speech.txt}, and synthesize the text using the
  3010. standard flite voice:
  3011. @example
  3012. flite=textfile=speech.txt
  3013. @end example
  3014. @item
  3015. Read the specified text selecting the @code{slt} voice:
  3016. @example
  3017. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3018. @end example
  3019. @item
  3020. Input text to ffmpeg:
  3021. @example
  3022. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3023. @end example
  3024. @item
  3025. Make @file{ffplay} speak the specified text, using @code{flite} and
  3026. the @code{lavfi} device:
  3027. @example
  3028. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3029. @end example
  3030. @end itemize
  3031. For more information about libflite, check:
  3032. @url{http://www.speech.cs.cmu.edu/flite/}
  3033. @section anoisesrc
  3034. Generate a noise audio signal.
  3035. The filter accepts the following options:
  3036. @table @option
  3037. @item sample_rate, r
  3038. Specify the sample rate. Default value is 48000 Hz.
  3039. @item amplitude, a
  3040. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3041. is 1.0.
  3042. @item duration, d
  3043. Specify the duration of the generated audio stream. Not specifying this option
  3044. results in noise with an infinite length.
  3045. @item color, colour, c
  3046. Specify the color of noise. Available noise colors are white, pink, and brown.
  3047. Default color is white.
  3048. @item seed, s
  3049. Specify a value used to seed the PRNG.
  3050. @item nb_samples, n
  3051. Set the number of samples per each output frame, default is 1024.
  3052. @end table
  3053. @subsection Examples
  3054. @itemize
  3055. @item
  3056. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3057. @example
  3058. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3059. @end example
  3060. @end itemize
  3061. @section sine
  3062. Generate an audio signal made of a sine wave with amplitude 1/8.
  3063. The audio signal is bit-exact.
  3064. The filter accepts the following options:
  3065. @table @option
  3066. @item frequency, f
  3067. Set the carrier frequency. Default is 440 Hz.
  3068. @item beep_factor, b
  3069. Enable a periodic beep every second with frequency @var{beep_factor} times
  3070. the carrier frequency. Default is 0, meaning the beep is disabled.
  3071. @item sample_rate, r
  3072. Specify the sample rate, default is 44100.
  3073. @item duration, d
  3074. Specify the duration of the generated audio stream.
  3075. @item samples_per_frame
  3076. Set the number of samples per output frame.
  3077. The expression can contain the following constants:
  3078. @table @option
  3079. @item n
  3080. The (sequential) number of the output audio frame, starting from 0.
  3081. @item pts
  3082. The PTS (Presentation TimeStamp) of the output audio frame,
  3083. expressed in @var{TB} units.
  3084. @item t
  3085. The PTS of the output audio frame, expressed in seconds.
  3086. @item TB
  3087. The timebase of the output audio frames.
  3088. @end table
  3089. Default is @code{1024}.
  3090. @end table
  3091. @subsection Examples
  3092. @itemize
  3093. @item
  3094. Generate a simple 440 Hz sine wave:
  3095. @example
  3096. sine
  3097. @end example
  3098. @item
  3099. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3100. @example
  3101. sine=220:4:d=5
  3102. sine=f=220:b=4:d=5
  3103. sine=frequency=220:beep_factor=4:duration=5
  3104. @end example
  3105. @item
  3106. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3107. pattern:
  3108. @example
  3109. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3110. @end example
  3111. @end itemize
  3112. @c man end AUDIO SOURCES
  3113. @chapter Audio Sinks
  3114. @c man begin AUDIO SINKS
  3115. Below is a description of the currently available audio sinks.
  3116. @section abuffersink
  3117. Buffer audio frames, and make them available to the end of filter chain.
  3118. This sink is mainly intended for programmatic use, in particular
  3119. through the interface defined in @file{libavfilter/buffersink.h}
  3120. or the options system.
  3121. It accepts a pointer to an AVABufferSinkContext structure, which
  3122. defines the incoming buffers' formats, to be passed as the opaque
  3123. parameter to @code{avfilter_init_filter} for initialization.
  3124. @section anullsink
  3125. Null audio sink; do absolutely nothing with the input audio. It is
  3126. mainly useful as a template and for use in analysis / debugging
  3127. tools.
  3128. @c man end AUDIO SINKS
  3129. @chapter Video Filters
  3130. @c man begin VIDEO FILTERS
  3131. When you configure your FFmpeg build, you can disable any of the
  3132. existing filters using @code{--disable-filters}.
  3133. The configure output will show the video filters included in your
  3134. build.
  3135. Below is a description of the currently available video filters.
  3136. @section alphaextract
  3137. Extract the alpha component from the input as a grayscale video. This
  3138. is especially useful with the @var{alphamerge} filter.
  3139. @section alphamerge
  3140. Add or replace the alpha component of the primary input with the
  3141. grayscale value of a second input. This is intended for use with
  3142. @var{alphaextract} to allow the transmission or storage of frame
  3143. sequences that have alpha in a format that doesn't support an alpha
  3144. channel.
  3145. For example, to reconstruct full frames from a normal YUV-encoded video
  3146. and a separate video created with @var{alphaextract}, you might use:
  3147. @example
  3148. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3149. @end example
  3150. Since this filter is designed for reconstruction, it operates on frame
  3151. sequences without considering timestamps, and terminates when either
  3152. input reaches end of stream. This will cause problems if your encoding
  3153. pipeline drops frames. If you're trying to apply an image as an
  3154. overlay to a video stream, consider the @var{overlay} filter instead.
  3155. @section ass
  3156. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3157. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3158. Substation Alpha) subtitles files.
  3159. This filter accepts the following option in addition to the common options from
  3160. the @ref{subtitles} filter:
  3161. @table @option
  3162. @item shaping
  3163. Set the shaping engine
  3164. Available values are:
  3165. @table @samp
  3166. @item auto
  3167. The default libass shaping engine, which is the best available.
  3168. @item simple
  3169. Fast, font-agnostic shaper that can do only substitutions
  3170. @item complex
  3171. Slower shaper using OpenType for substitutions and positioning
  3172. @end table
  3173. The default is @code{auto}.
  3174. @end table
  3175. @section atadenoise
  3176. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3177. The filter accepts the following options:
  3178. @table @option
  3179. @item 0a
  3180. Set threshold A for 1st plane. Default is 0.02.
  3181. Valid range is 0 to 0.3.
  3182. @item 0b
  3183. Set threshold B for 1st plane. Default is 0.04.
  3184. Valid range is 0 to 5.
  3185. @item 1a
  3186. Set threshold A for 2nd plane. Default is 0.02.
  3187. Valid range is 0 to 0.3.
  3188. @item 1b
  3189. Set threshold B for 2nd plane. Default is 0.04.
  3190. Valid range is 0 to 5.
  3191. @item 2a
  3192. Set threshold A for 3rd plane. Default is 0.02.
  3193. Valid range is 0 to 0.3.
  3194. @item 2b
  3195. Set threshold B for 3rd plane. Default is 0.04.
  3196. Valid range is 0 to 5.
  3197. Threshold A is designed to react on abrupt changes in the input signal and
  3198. threshold B is designed to react on continuous changes in the input signal.
  3199. @item s
  3200. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3201. number in range [5, 129].
  3202. @end table
  3203. @section bbox
  3204. Compute the bounding box for the non-black pixels in the input frame
  3205. luminance plane.
  3206. This filter computes the bounding box containing all the pixels with a
  3207. luminance value greater than the minimum allowed value.
  3208. The parameters describing the bounding box are printed on the filter
  3209. log.
  3210. The filter accepts the following option:
  3211. @table @option
  3212. @item min_val
  3213. Set the minimal luminance value. Default is @code{16}.
  3214. @end table
  3215. @section blackdetect
  3216. Detect video intervals that are (almost) completely black. Can be
  3217. useful to detect chapter transitions, commercials, or invalid
  3218. recordings. Output lines contains the time for the start, end and
  3219. duration of the detected black interval expressed in seconds.
  3220. In order to display the output lines, you need to set the loglevel at
  3221. least to the AV_LOG_INFO value.
  3222. The filter accepts the following options:
  3223. @table @option
  3224. @item black_min_duration, d
  3225. Set the minimum detected black duration expressed in seconds. It must
  3226. be a non-negative floating point number.
  3227. Default value is 2.0.
  3228. @item picture_black_ratio_th, pic_th
  3229. Set the threshold for considering a picture "black".
  3230. Express the minimum value for the ratio:
  3231. @example
  3232. @var{nb_black_pixels} / @var{nb_pixels}
  3233. @end example
  3234. for which a picture is considered black.
  3235. Default value is 0.98.
  3236. @item pixel_black_th, pix_th
  3237. Set the threshold for considering a pixel "black".
  3238. The threshold expresses the maximum pixel luminance value for which a
  3239. pixel is considered "black". The provided value is scaled according to
  3240. the following equation:
  3241. @example
  3242. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  3243. @end example
  3244. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  3245. the input video format, the range is [0-255] for YUV full-range
  3246. formats and [16-235] for YUV non full-range formats.
  3247. Default value is 0.10.
  3248. @end table
  3249. The following example sets the maximum pixel threshold to the minimum
  3250. value, and detects only black intervals of 2 or more seconds:
  3251. @example
  3252. blackdetect=d=2:pix_th=0.00
  3253. @end example
  3254. @section blackframe
  3255. Detect frames that are (almost) completely black. Can be useful to
  3256. detect chapter transitions or commercials. Output lines consist of
  3257. the frame number of the detected frame, the percentage of blackness,
  3258. the position in the file if known or -1 and the timestamp in seconds.
  3259. In order to display the output lines, you need to set the loglevel at
  3260. least to the AV_LOG_INFO value.
  3261. It accepts the following parameters:
  3262. @table @option
  3263. @item amount
  3264. The percentage of the pixels that have to be below the threshold; it defaults to
  3265. @code{98}.
  3266. @item threshold, thresh
  3267. The threshold below which a pixel value is considered black; it defaults to
  3268. @code{32}.
  3269. @end table
  3270. @section blend, tblend
  3271. Blend two video frames into each other.
  3272. The @code{blend} filter takes two input streams and outputs one
  3273. stream, the first input is the "top" layer and second input is
  3274. "bottom" layer. Output terminates when shortest input terminates.
  3275. The @code{tblend} (time blend) filter takes two consecutive frames
  3276. from one single stream, and outputs the result obtained by blending
  3277. the new frame on top of the old frame.
  3278. A description of the accepted options follows.
  3279. @table @option
  3280. @item c0_mode
  3281. @item c1_mode
  3282. @item c2_mode
  3283. @item c3_mode
  3284. @item all_mode
  3285. Set blend mode for specific pixel component or all pixel components in case
  3286. of @var{all_mode}. Default value is @code{normal}.
  3287. Available values for component modes are:
  3288. @table @samp
  3289. @item addition
  3290. @item addition128
  3291. @item and
  3292. @item average
  3293. @item burn
  3294. @item darken
  3295. @item difference
  3296. @item difference128
  3297. @item divide
  3298. @item dodge
  3299. @item freeze
  3300. @item exclusion
  3301. @item glow
  3302. @item hardlight
  3303. @item hardmix
  3304. @item heat
  3305. @item lighten
  3306. @item linearlight
  3307. @item multiply
  3308. @item multiply128
  3309. @item negation
  3310. @item normal
  3311. @item or
  3312. @item overlay
  3313. @item phoenix
  3314. @item pinlight
  3315. @item reflect
  3316. @item screen
  3317. @item softlight
  3318. @item subtract
  3319. @item vividlight
  3320. @item xor
  3321. @end table
  3322. @item c0_opacity
  3323. @item c1_opacity
  3324. @item c2_opacity
  3325. @item c3_opacity
  3326. @item all_opacity
  3327. Set blend opacity for specific pixel component or all pixel components in case
  3328. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  3329. @item c0_expr
  3330. @item c1_expr
  3331. @item c2_expr
  3332. @item c3_expr
  3333. @item all_expr
  3334. Set blend expression for specific pixel component or all pixel components in case
  3335. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3336. The expressions can use the following variables:
  3337. @table @option
  3338. @item N
  3339. The sequential number of the filtered frame, starting from @code{0}.
  3340. @item X
  3341. @item Y
  3342. the coordinates of the current sample
  3343. @item W
  3344. @item H
  3345. the width and height of currently filtered plane
  3346. @item SW
  3347. @item SH
  3348. Width and height scale depending on the currently filtered plane. It is the
  3349. ratio between the corresponding luma plane number of pixels and the current
  3350. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3351. @code{0.5,0.5} for chroma planes.
  3352. @item T
  3353. Time of the current frame, expressed in seconds.
  3354. @item TOP, A
  3355. Value of pixel component at current location for first video frame (top layer).
  3356. @item BOTTOM, B
  3357. Value of pixel component at current location for second video frame (bottom layer).
  3358. @end table
  3359. @item shortest
  3360. Force termination when the shortest input terminates. Default is
  3361. @code{0}. This option is only defined for the @code{blend} filter.
  3362. @item repeatlast
  3363. Continue applying the last bottom frame after the end of the stream. A value of
  3364. @code{0} disable the filter after the last frame of the bottom layer is reached.
  3365. Default is @code{1}. This option is only defined for the @code{blend} filter.
  3366. @end table
  3367. @subsection Examples
  3368. @itemize
  3369. @item
  3370. Apply transition from bottom layer to top layer in first 10 seconds:
  3371. @example
  3372. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3373. @end example
  3374. @item
  3375. Apply 1x1 checkerboard effect:
  3376. @example
  3377. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  3378. @end example
  3379. @item
  3380. Apply uncover left effect:
  3381. @example
  3382. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  3383. @end example
  3384. @item
  3385. Apply uncover down effect:
  3386. @example
  3387. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  3388. @end example
  3389. @item
  3390. Apply uncover up-left effect:
  3391. @example
  3392. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  3393. @end example
  3394. @item
  3395. Split diagonally video and shows top and bottom layer on each side:
  3396. @example
  3397. blend=all_expr=if(gt(X,Y*(W/H)),A,B)
  3398. @end example
  3399. @item
  3400. Display differences between the current and the previous frame:
  3401. @example
  3402. tblend=all_mode=difference128
  3403. @end example
  3404. @end itemize
  3405. @section bwdif
  3406. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  3407. Deinterlacing Filter").
  3408. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  3409. interpolation algorithms.
  3410. It accepts the following parameters:
  3411. @table @option
  3412. @item mode
  3413. The interlacing mode to adopt. It accepts one of the following values:
  3414. @table @option
  3415. @item 0, send_frame
  3416. Output one frame for each frame.
  3417. @item 1, send_field
  3418. Output one frame for each field.
  3419. @end table
  3420. The default value is @code{send_field}.
  3421. @item parity
  3422. The picture field parity assumed for the input interlaced video. It accepts one
  3423. of the following values:
  3424. @table @option
  3425. @item 0, tff
  3426. Assume the top field is first.
  3427. @item 1, bff
  3428. Assume the bottom field is first.
  3429. @item -1, auto
  3430. Enable automatic detection of field parity.
  3431. @end table
  3432. The default value is @code{auto}.
  3433. If the interlacing is unknown or the decoder does not export this information,
  3434. top field first will be assumed.
  3435. @item deint
  3436. Specify which frames to deinterlace. Accept one of the following
  3437. values:
  3438. @table @option
  3439. @item 0, all
  3440. Deinterlace all frames.
  3441. @item 1, interlaced
  3442. Only deinterlace frames marked as interlaced.
  3443. @end table
  3444. The default value is @code{all}.
  3445. @end table
  3446. @section boxblur
  3447. Apply a boxblur algorithm to the input video.
  3448. It accepts the following parameters:
  3449. @table @option
  3450. @item luma_radius, lr
  3451. @item luma_power, lp
  3452. @item chroma_radius, cr
  3453. @item chroma_power, cp
  3454. @item alpha_radius, ar
  3455. @item alpha_power, ap
  3456. @end table
  3457. A description of the accepted options follows.
  3458. @table @option
  3459. @item luma_radius, lr
  3460. @item chroma_radius, cr
  3461. @item alpha_radius, ar
  3462. Set an expression for the box radius in pixels used for blurring the
  3463. corresponding input plane.
  3464. The radius value must be a non-negative number, and must not be
  3465. greater than the value of the expression @code{min(w,h)/2} for the
  3466. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  3467. planes.
  3468. Default value for @option{luma_radius} is "2". If not specified,
  3469. @option{chroma_radius} and @option{alpha_radius} default to the
  3470. corresponding value set for @option{luma_radius}.
  3471. The expressions can contain the following constants:
  3472. @table @option
  3473. @item w
  3474. @item h
  3475. The input width and height in pixels.
  3476. @item cw
  3477. @item ch
  3478. The input chroma image width and height in pixels.
  3479. @item hsub
  3480. @item vsub
  3481. The horizontal and vertical chroma subsample values. For example, for the
  3482. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  3483. @end table
  3484. @item luma_power, lp
  3485. @item chroma_power, cp
  3486. @item alpha_power, ap
  3487. Specify how many times the boxblur filter is applied to the
  3488. corresponding plane.
  3489. Default value for @option{luma_power} is 2. If not specified,
  3490. @option{chroma_power} and @option{alpha_power} default to the
  3491. corresponding value set for @option{luma_power}.
  3492. A value of 0 will disable the effect.
  3493. @end table
  3494. @subsection Examples
  3495. @itemize
  3496. @item
  3497. Apply a boxblur filter with the luma, chroma, and alpha radii
  3498. set to 2:
  3499. @example
  3500. boxblur=luma_radius=2:luma_power=1
  3501. boxblur=2:1
  3502. @end example
  3503. @item
  3504. Set the luma radius to 2, and alpha and chroma radius to 0:
  3505. @example
  3506. boxblur=2:1:cr=0:ar=0
  3507. @end example
  3508. @item
  3509. Set the luma and chroma radii to a fraction of the video dimension:
  3510. @example
  3511. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  3512. @end example
  3513. @end itemize
  3514. @section chromakey
  3515. YUV colorspace color/chroma keying.
  3516. The filter accepts the following options:
  3517. @table @option
  3518. @item color
  3519. The color which will be replaced with transparency.
  3520. @item similarity
  3521. Similarity percentage with the key color.
  3522. 0.01 matches only the exact key color, while 1.0 matches everything.
  3523. @item blend
  3524. Blend percentage.
  3525. 0.0 makes pixels either fully transparent, or not transparent at all.
  3526. Higher values result in semi-transparent pixels, with a higher transparency
  3527. the more similar the pixels color is to the key color.
  3528. @item yuv
  3529. Signals that the color passed is already in YUV instead of RGB.
  3530. Litteral colors like "green" or "red" don't make sense with this enabled anymore.
  3531. This can be used to pass exact YUV values as hexadecimal numbers.
  3532. @end table
  3533. @subsection Examples
  3534. @itemize
  3535. @item
  3536. Make every green pixel in the input image transparent:
  3537. @example
  3538. ffmpeg -i input.png -vf chromakey=green out.png
  3539. @end example
  3540. @item
  3541. Overlay a greenscreen-video on top of a static black background.
  3542. @example
  3543. 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
  3544. @end example
  3545. @end itemize
  3546. @section ciescope
  3547. Display CIE color diagram with pixels overlaid onto it.
  3548. The filter acccepts the following options:
  3549. @table @option
  3550. @item system
  3551. Set color system.
  3552. @table @samp
  3553. @item ntsc, 470m
  3554. @item ebu, 470bg
  3555. @item smpte
  3556. @item 240m
  3557. @item apple
  3558. @item widergb
  3559. @item cie1931
  3560. @item rec709, hdtv
  3561. @item uhdtv, rec2020
  3562. @end table
  3563. @item cie
  3564. Set CIE system.
  3565. @table @samp
  3566. @item xyy
  3567. @item ucs
  3568. @item luv
  3569. @end table
  3570. @item gamuts
  3571. Set what gamuts to draw.
  3572. See @code{system} option for avaiable values.
  3573. @item size, s
  3574. Set ciescope size, by default set to 512.
  3575. @item intensity, i
  3576. Set intensity used to map input pixel values to CIE diagram.
  3577. @item contrast
  3578. Set contrast used to draw tongue colors that are out of active color system gamut.
  3579. @item corrgamma
  3580. Correct gamma displayed on scope, by default enabled.
  3581. @item showwhite
  3582. Show white point on CIE diagram, by default disabled.
  3583. @item gamma
  3584. Set input gamma. Used only with XYZ input color space.
  3585. @end table
  3586. @section codecview
  3587. Visualize information exported by some codecs.
  3588. Some codecs can export information through frames using side-data or other
  3589. means. For example, some MPEG based codecs export motion vectors through the
  3590. @var{export_mvs} flag in the codec @option{flags2} option.
  3591. The filter accepts the following option:
  3592. @table @option
  3593. @item mv
  3594. Set motion vectors to visualize.
  3595. Available flags for @var{mv} are:
  3596. @table @samp
  3597. @item pf
  3598. forward predicted MVs of P-frames
  3599. @item bf
  3600. forward predicted MVs of B-frames
  3601. @item bb
  3602. backward predicted MVs of B-frames
  3603. @end table
  3604. @item qp
  3605. Display quantization parameters using the chroma planes
  3606. @end table
  3607. @subsection Examples
  3608. @itemize
  3609. @item
  3610. Visualizes multi-directionals MVs from P and B-Frames using @command{ffplay}:
  3611. @example
  3612. ffplay -flags2 +export_mvs input.mpg -vf codecview=mv=pf+bf+bb
  3613. @end example
  3614. @end itemize
  3615. @section colorbalance
  3616. Modify intensity of primary colors (red, green and blue) of input frames.
  3617. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  3618. regions for the red-cyan, green-magenta or blue-yellow balance.
  3619. A positive adjustment value shifts the balance towards the primary color, a negative
  3620. value towards the complementary color.
  3621. The filter accepts the following options:
  3622. @table @option
  3623. @item rs
  3624. @item gs
  3625. @item bs
  3626. Adjust red, green and blue shadows (darkest pixels).
  3627. @item rm
  3628. @item gm
  3629. @item bm
  3630. Adjust red, green and blue midtones (medium pixels).
  3631. @item rh
  3632. @item gh
  3633. @item bh
  3634. Adjust red, green and blue highlights (brightest pixels).
  3635. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3636. @end table
  3637. @subsection Examples
  3638. @itemize
  3639. @item
  3640. Add red color cast to shadows:
  3641. @example
  3642. colorbalance=rs=.3
  3643. @end example
  3644. @end itemize
  3645. @section colorkey
  3646. RGB colorspace color keying.
  3647. The filter accepts the following options:
  3648. @table @option
  3649. @item color
  3650. The color which will be replaced with transparency.
  3651. @item similarity
  3652. Similarity percentage with the key color.
  3653. 0.01 matches only the exact key color, while 1.0 matches everything.
  3654. @item blend
  3655. Blend percentage.
  3656. 0.0 makes pixels either fully transparent, or not transparent at all.
  3657. Higher values result in semi-transparent pixels, with a higher transparency
  3658. the more similar the pixels color is to the key color.
  3659. @end table
  3660. @subsection Examples
  3661. @itemize
  3662. @item
  3663. Make every green pixel in the input image transparent:
  3664. @example
  3665. ffmpeg -i input.png -vf colorkey=green out.png
  3666. @end example
  3667. @item
  3668. Overlay a greenscreen-video on top of a static background image.
  3669. @example
  3670. 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
  3671. @end example
  3672. @end itemize
  3673. @section colorlevels
  3674. Adjust video input frames using levels.
  3675. The filter accepts the following options:
  3676. @table @option
  3677. @item rimin
  3678. @item gimin
  3679. @item bimin
  3680. @item aimin
  3681. Adjust red, green, blue and alpha input black point.
  3682. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3683. @item rimax
  3684. @item gimax
  3685. @item bimax
  3686. @item aimax
  3687. Adjust red, green, blue and alpha input white point.
  3688. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  3689. Input levels are used to lighten highlights (bright tones), darken shadows
  3690. (dark tones), change the balance of bright and dark tones.
  3691. @item romin
  3692. @item gomin
  3693. @item bomin
  3694. @item aomin
  3695. Adjust red, green, blue and alpha output black point.
  3696. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  3697. @item romax
  3698. @item gomax
  3699. @item bomax
  3700. @item aomax
  3701. Adjust red, green, blue and alpha output white point.
  3702. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  3703. Output levels allows manual selection of a constrained output level range.
  3704. @end table
  3705. @subsection Examples
  3706. @itemize
  3707. @item
  3708. Make video output darker:
  3709. @example
  3710. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  3711. @end example
  3712. @item
  3713. Increase contrast:
  3714. @example
  3715. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  3716. @end example
  3717. @item
  3718. Make video output lighter:
  3719. @example
  3720. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  3721. @end example
  3722. @item
  3723. Increase brightness:
  3724. @example
  3725. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  3726. @end example
  3727. @end itemize
  3728. @section colorchannelmixer
  3729. Adjust video input frames by re-mixing color channels.
  3730. This filter modifies a color channel by adding the values associated to
  3731. the other channels of the same pixels. For example if the value to
  3732. modify is red, the output value will be:
  3733. @example
  3734. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  3735. @end example
  3736. The filter accepts the following options:
  3737. @table @option
  3738. @item rr
  3739. @item rg
  3740. @item rb
  3741. @item ra
  3742. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  3743. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  3744. @item gr
  3745. @item gg
  3746. @item gb
  3747. @item ga
  3748. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  3749. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  3750. @item br
  3751. @item bg
  3752. @item bb
  3753. @item ba
  3754. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  3755. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  3756. @item ar
  3757. @item ag
  3758. @item ab
  3759. @item aa
  3760. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  3761. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  3762. Allowed ranges for options are @code{[-2.0, 2.0]}.
  3763. @end table
  3764. @subsection Examples
  3765. @itemize
  3766. @item
  3767. Convert source to grayscale:
  3768. @example
  3769. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  3770. @end example
  3771. @item
  3772. Simulate sepia tones:
  3773. @example
  3774. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  3775. @end example
  3776. @end itemize
  3777. @section colormatrix
  3778. Convert color matrix.
  3779. The filter accepts the following options:
  3780. @table @option
  3781. @item src
  3782. @item dst
  3783. Specify the source and destination color matrix. Both values must be
  3784. specified.
  3785. The accepted values are:
  3786. @table @samp
  3787. @item bt709
  3788. BT.709
  3789. @item bt601
  3790. BT.601
  3791. @item smpte240m
  3792. SMPTE-240M
  3793. @item fcc
  3794. FCC
  3795. @end table
  3796. @end table
  3797. For example to convert from BT.601 to SMPTE-240M, use the command:
  3798. @example
  3799. colormatrix=bt601:smpte240m
  3800. @end example
  3801. @section convolution
  3802. Apply convolution 3x3 or 5x5 filter.
  3803. The filter accepts the following options:
  3804. @table @option
  3805. @item 0m
  3806. @item 1m
  3807. @item 2m
  3808. @item 3m
  3809. Set matrix for each plane.
  3810. Matrix is sequence of 9 or 25 signed integers.
  3811. @item 0rdiv
  3812. @item 1rdiv
  3813. @item 2rdiv
  3814. @item 3rdiv
  3815. Set multiplier for calculated value for each plane.
  3816. @item 0bias
  3817. @item 1bias
  3818. @item 2bias
  3819. @item 3bias
  3820. Set bias for each plane. This value is added to the result of the multiplication.
  3821. Useful for making the overall image brighter or darker. Default is 0.0.
  3822. @end table
  3823. @subsection Examples
  3824. @itemize
  3825. @item
  3826. Apply sharpen:
  3827. @example
  3828. 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"
  3829. @end example
  3830. @item
  3831. Apply blur:
  3832. @example
  3833. 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"
  3834. @end example
  3835. @item
  3836. Apply edge enhance:
  3837. @example
  3838. 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"
  3839. @end example
  3840. @item
  3841. Apply edge detect:
  3842. @example
  3843. 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"
  3844. @end example
  3845. @item
  3846. Apply emboss:
  3847. @example
  3848. 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"
  3849. @end example
  3850. @end itemize
  3851. @section copy
  3852. Copy the input source unchanged to the output. This is mainly useful for
  3853. testing purposes.
  3854. @section crop
  3855. Crop the input video to given dimensions.
  3856. It accepts the following parameters:
  3857. @table @option
  3858. @item w, out_w
  3859. The width of the output video. It defaults to @code{iw}.
  3860. This expression is evaluated only once during the filter
  3861. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  3862. @item h, out_h
  3863. The height of the output video. It defaults to @code{ih}.
  3864. This expression is evaluated only once during the filter
  3865. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  3866. @item x
  3867. The horizontal position, in the input video, of the left edge of the output
  3868. video. It defaults to @code{(in_w-out_w)/2}.
  3869. This expression is evaluated per-frame.
  3870. @item y
  3871. The vertical position, in the input video, of the top edge of the output video.
  3872. It defaults to @code{(in_h-out_h)/2}.
  3873. This expression is evaluated per-frame.
  3874. @item keep_aspect
  3875. If set to 1 will force the output display aspect ratio
  3876. to be the same of the input, by changing the output sample aspect
  3877. ratio. It defaults to 0.
  3878. @end table
  3879. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  3880. expressions containing the following constants:
  3881. @table @option
  3882. @item x
  3883. @item y
  3884. The computed values for @var{x} and @var{y}. They are evaluated for
  3885. each new frame.
  3886. @item in_w
  3887. @item in_h
  3888. The input width and height.
  3889. @item iw
  3890. @item ih
  3891. These are the same as @var{in_w} and @var{in_h}.
  3892. @item out_w
  3893. @item out_h
  3894. The output (cropped) width and height.
  3895. @item ow
  3896. @item oh
  3897. These are the same as @var{out_w} and @var{out_h}.
  3898. @item a
  3899. same as @var{iw} / @var{ih}
  3900. @item sar
  3901. input sample aspect ratio
  3902. @item dar
  3903. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  3904. @item hsub
  3905. @item vsub
  3906. horizontal and vertical chroma subsample values. For example for the
  3907. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  3908. @item n
  3909. The number of the input frame, starting from 0.
  3910. @item pos
  3911. the position in the file of the input frame, NAN if unknown
  3912. @item t
  3913. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  3914. @end table
  3915. The expression for @var{out_w} may depend on the value of @var{out_h},
  3916. and the expression for @var{out_h} may depend on @var{out_w}, but they
  3917. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  3918. evaluated after @var{out_w} and @var{out_h}.
  3919. The @var{x} and @var{y} parameters specify the expressions for the
  3920. position of the top-left corner of the output (non-cropped) area. They
  3921. are evaluated for each frame. If the evaluated value is not valid, it
  3922. is approximated to the nearest valid value.
  3923. The expression for @var{x} may depend on @var{y}, and the expression
  3924. for @var{y} may depend on @var{x}.
  3925. @subsection Examples
  3926. @itemize
  3927. @item
  3928. Crop area with size 100x100 at position (12,34).
  3929. @example
  3930. crop=100:100:12:34
  3931. @end example
  3932. Using named options, the example above becomes:
  3933. @example
  3934. crop=w=100:h=100:x=12:y=34
  3935. @end example
  3936. @item
  3937. Crop the central input area with size 100x100:
  3938. @example
  3939. crop=100:100
  3940. @end example
  3941. @item
  3942. Crop the central input area with size 2/3 of the input video:
  3943. @example
  3944. crop=2/3*in_w:2/3*in_h
  3945. @end example
  3946. @item
  3947. Crop the input video central square:
  3948. @example
  3949. crop=out_w=in_h
  3950. crop=in_h
  3951. @end example
  3952. @item
  3953. Delimit the rectangle with the top-left corner placed at position
  3954. 100:100 and the right-bottom corner corresponding to the right-bottom
  3955. corner of the input image.
  3956. @example
  3957. crop=in_w-100:in_h-100:100:100
  3958. @end example
  3959. @item
  3960. Crop 10 pixels from the left and right borders, and 20 pixels from
  3961. the top and bottom borders
  3962. @example
  3963. crop=in_w-2*10:in_h-2*20
  3964. @end example
  3965. @item
  3966. Keep only the bottom right quarter of the input image:
  3967. @example
  3968. crop=in_w/2:in_h/2:in_w/2:in_h/2
  3969. @end example
  3970. @item
  3971. Crop height for getting Greek harmony:
  3972. @example
  3973. crop=in_w:1/PHI*in_w
  3974. @end example
  3975. @item
  3976. Apply trembling effect:
  3977. @example
  3978. 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)
  3979. @end example
  3980. @item
  3981. Apply erratic camera effect depending on timestamp:
  3982. @example
  3983. 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)"
  3984. @end example
  3985. @item
  3986. Set x depending on the value of y:
  3987. @example
  3988. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  3989. @end example
  3990. @end itemize
  3991. @subsection Commands
  3992. This filter supports the following commands:
  3993. @table @option
  3994. @item w, out_w
  3995. @item h, out_h
  3996. @item x
  3997. @item y
  3998. Set width/height of the output video and the horizontal/vertical position
  3999. in the input video.
  4000. The command accepts the same syntax of the corresponding option.
  4001. If the specified expression is not valid, it is kept at its current
  4002. value.
  4003. @end table
  4004. @section cropdetect
  4005. Auto-detect the crop size.
  4006. It calculates the necessary cropping parameters and prints the
  4007. recommended parameters via the logging system. The detected dimensions
  4008. correspond to the non-black area of the input video.
  4009. It accepts the following parameters:
  4010. @table @option
  4011. @item limit
  4012. Set higher black value threshold, which can be optionally specified
  4013. from nothing (0) to everything (255 for 8bit based formats). An intensity
  4014. value greater to the set value is considered non-black. It defaults to 24.
  4015. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  4016. on the bitdepth of the pixel format.
  4017. @item round
  4018. The value which the width/height should be divisible by. It defaults to
  4019. 16. The offset is automatically adjusted to center the video. Use 2 to
  4020. get only even dimensions (needed for 4:2:2 video). 16 is best when
  4021. encoding to most video codecs.
  4022. @item reset_count, reset
  4023. Set the counter that determines after how many frames cropdetect will
  4024. reset the previously detected largest video area and start over to
  4025. detect the current optimal crop area. Default value is 0.
  4026. This can be useful when channel logos distort the video area. 0
  4027. indicates 'never reset', and returns the largest area encountered during
  4028. playback.
  4029. @end table
  4030. @anchor{curves}
  4031. @section curves
  4032. Apply color adjustments using curves.
  4033. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  4034. component (red, green and blue) has its values defined by @var{N} key points
  4035. tied from each other using a smooth curve. The x-axis represents the pixel
  4036. values from the input frame, and the y-axis the new pixel values to be set for
  4037. the output frame.
  4038. By default, a component curve is defined by the two points @var{(0;0)} and
  4039. @var{(1;1)}. This creates a straight line where each original pixel value is
  4040. "adjusted" to its own value, which means no change to the image.
  4041. The filter allows you to redefine these two points and add some more. A new
  4042. curve (using a natural cubic spline interpolation) will be define to pass
  4043. smoothly through all these new coordinates. The new defined points needs to be
  4044. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  4045. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  4046. the vector spaces, the values will be clipped accordingly.
  4047. If there is no key point defined in @code{x=0}, the filter will automatically
  4048. insert a @var{(0;0)} point. In the same way, if there is no key point defined
  4049. in @code{x=1}, the filter will automatically insert a @var{(1;1)} point.
  4050. The filter accepts the following options:
  4051. @table @option
  4052. @item preset
  4053. Select one of the available color presets. This option can be used in addition
  4054. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  4055. options takes priority on the preset values.
  4056. Available presets are:
  4057. @table @samp
  4058. @item none
  4059. @item color_negative
  4060. @item cross_process
  4061. @item darker
  4062. @item increase_contrast
  4063. @item lighter
  4064. @item linear_contrast
  4065. @item medium_contrast
  4066. @item negative
  4067. @item strong_contrast
  4068. @item vintage
  4069. @end table
  4070. Default is @code{none}.
  4071. @item master, m
  4072. Set the master key points. These points will define a second pass mapping. It
  4073. is sometimes called a "luminance" or "value" mapping. It can be used with
  4074. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  4075. post-processing LUT.
  4076. @item red, r
  4077. Set the key points for the red component.
  4078. @item green, g
  4079. Set the key points for the green component.
  4080. @item blue, b
  4081. Set the key points for the blue component.
  4082. @item all
  4083. Set the key points for all components (not including master).
  4084. Can be used in addition to the other key points component
  4085. options. In this case, the unset component(s) will fallback on this
  4086. @option{all} setting.
  4087. @item psfile
  4088. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  4089. @end table
  4090. To avoid some filtergraph syntax conflicts, each key points list need to be
  4091. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  4092. @subsection Examples
  4093. @itemize
  4094. @item
  4095. Increase slightly the middle level of blue:
  4096. @example
  4097. curves=blue='0.5/0.58'
  4098. @end example
  4099. @item
  4100. Vintage effect:
  4101. @example
  4102. curves=r='0/0.11 .42/.51 1/0.95':g='0.50/0.48':b='0/0.22 .49/.44 1/0.8'
  4103. @end example
  4104. Here we obtain the following coordinates for each components:
  4105. @table @var
  4106. @item red
  4107. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  4108. @item green
  4109. @code{(0;0) (0.50;0.48) (1;1)}
  4110. @item blue
  4111. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  4112. @end table
  4113. @item
  4114. The previous example can also be achieved with the associated built-in preset:
  4115. @example
  4116. curves=preset=vintage
  4117. @end example
  4118. @item
  4119. Or simply:
  4120. @example
  4121. curves=vintage
  4122. @end example
  4123. @item
  4124. Use a Photoshop preset and redefine the points of the green component:
  4125. @example
  4126. curves=psfile='MyCurvesPresets/purple.acv':green='0.45/0.53'
  4127. @end example
  4128. @end itemize
  4129. @section datascope
  4130. Video data analysis filter.
  4131. This filter shows hexadecimal pixel values of part of video.
  4132. The filter accepts the following options:
  4133. @table @option
  4134. @item size, s
  4135. Set output video size.
  4136. @item x
  4137. Set x offset from where to pick pixels.
  4138. @item y
  4139. Set y offset from where to pick pixels.
  4140. @item mode
  4141. Set scope mode, can be one of the following:
  4142. @table @samp
  4143. @item mono
  4144. Draw hexadecimal pixel values with white color on black background.
  4145. @item color
  4146. Draw hexadecimal pixel values with input video pixel color on black
  4147. background.
  4148. @item color2
  4149. Draw hexadecimal pixel values on color background picked from input video,
  4150. the text color is picked in such way so its always visible.
  4151. @end table
  4152. @item axis
  4153. Draw rows and columns numbers on left and top of video.
  4154. @end table
  4155. @section dctdnoiz
  4156. Denoise frames using 2D DCT (frequency domain filtering).
  4157. This filter is not designed for real time.
  4158. The filter accepts the following options:
  4159. @table @option
  4160. @item sigma, s
  4161. Set the noise sigma constant.
  4162. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  4163. coefficient (absolute value) below this threshold with be dropped.
  4164. If you need a more advanced filtering, see @option{expr}.
  4165. Default is @code{0}.
  4166. @item overlap
  4167. Set number overlapping pixels for each block. Since the filter can be slow, you
  4168. may want to reduce this value, at the cost of a less effective filter and the
  4169. risk of various artefacts.
  4170. If the overlapping value doesn't permit processing the whole input width or
  4171. height, a warning will be displayed and according borders won't be denoised.
  4172. Default value is @var{blocksize}-1, which is the best possible setting.
  4173. @item expr, e
  4174. Set the coefficient factor expression.
  4175. For each coefficient of a DCT block, this expression will be evaluated as a
  4176. multiplier value for the coefficient.
  4177. If this is option is set, the @option{sigma} option will be ignored.
  4178. The absolute value of the coefficient can be accessed through the @var{c}
  4179. variable.
  4180. @item n
  4181. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  4182. @var{blocksize}, which is the width and height of the processed blocks.
  4183. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  4184. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  4185. on the speed processing. Also, a larger block size does not necessarily means a
  4186. better de-noising.
  4187. @end table
  4188. @subsection Examples
  4189. Apply a denoise with a @option{sigma} of @code{4.5}:
  4190. @example
  4191. dctdnoiz=4.5
  4192. @end example
  4193. The same operation can be achieved using the expression system:
  4194. @example
  4195. dctdnoiz=e='gte(c, 4.5*3)'
  4196. @end example
  4197. Violent denoise using a block size of @code{16x16}:
  4198. @example
  4199. dctdnoiz=15:n=4
  4200. @end example
  4201. @section deband
  4202. Remove banding artifacts from input video.
  4203. It works by replacing banded pixels with average value of referenced pixels.
  4204. The filter accepts the following options:
  4205. @table @option
  4206. @item 1thr
  4207. @item 2thr
  4208. @item 3thr
  4209. @item 4thr
  4210. Set banding detection threshold for each plane. Default is 0.02.
  4211. Valid range is 0.00003 to 0.5.
  4212. If difference between current pixel and reference pixel is less than threshold,
  4213. it will be considered as banded.
  4214. @item range, r
  4215. Banding detection range in pixels. Default is 16. If positive, random number
  4216. in range 0 to set value will be used. If negative, exact absolute value
  4217. will be used.
  4218. The range defines square of four pixels around current pixel.
  4219. @item direction, d
  4220. Set direction in radians from which four pixel will be compared. If positive,
  4221. random direction from 0 to set direction will be picked. If negative, exact of
  4222. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  4223. will pick only pixels on same row and -PI/2 will pick only pixels on same
  4224. column.
  4225. @item blur
  4226. If enabled, current pixel is compared with average value of all four
  4227. surrounding pixels. The default is enabled. If disabled current pixel is
  4228. compared with all four surrounding pixels. The pixel is considered banded
  4229. if only all four differences with surrounding pixels are less than threshold.
  4230. @end table
  4231. @anchor{decimate}
  4232. @section decimate
  4233. Drop duplicated frames at regular intervals.
  4234. The filter accepts the following options:
  4235. @table @option
  4236. @item cycle
  4237. Set the number of frames from which one will be dropped. Setting this to
  4238. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  4239. Default is @code{5}.
  4240. @item dupthresh
  4241. Set the threshold for duplicate detection. If the difference metric for a frame
  4242. is less than or equal to this value, then it is declared as duplicate. Default
  4243. is @code{1.1}
  4244. @item scthresh
  4245. Set scene change threshold. Default is @code{15}.
  4246. @item blockx
  4247. @item blocky
  4248. Set the size of the x and y-axis blocks used during metric calculations.
  4249. Larger blocks give better noise suppression, but also give worse detection of
  4250. small movements. Must be a power of two. Default is @code{32}.
  4251. @item ppsrc
  4252. Mark main input as a pre-processed input and activate clean source input
  4253. stream. This allows the input to be pre-processed with various filters to help
  4254. the metrics calculation while keeping the frame selection lossless. When set to
  4255. @code{1}, the first stream is for the pre-processed input, and the second
  4256. stream is the clean source from where the kept frames are chosen. Default is
  4257. @code{0}.
  4258. @item chroma
  4259. Set whether or not chroma is considered in the metric calculations. Default is
  4260. @code{1}.
  4261. @end table
  4262. @section deflate
  4263. Apply deflate effect to the video.
  4264. This filter replaces the pixel by the local(3x3) average by taking into account
  4265. only values lower than the pixel.
  4266. It accepts the following options:
  4267. @table @option
  4268. @item threshold0
  4269. @item threshold1
  4270. @item threshold2
  4271. @item threshold3
  4272. Limit the maximum change for each plane, default is 65535.
  4273. If 0, plane will remain unchanged.
  4274. @end table
  4275. @section dejudder
  4276. Remove judder produced by partially interlaced telecined content.
  4277. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  4278. source was partially telecined content then the output of @code{pullup,dejudder}
  4279. will have a variable frame rate. May change the recorded frame rate of the
  4280. container. Aside from that change, this filter will not affect constant frame
  4281. rate video.
  4282. The option available in this filter is:
  4283. @table @option
  4284. @item cycle
  4285. Specify the length of the window over which the judder repeats.
  4286. Accepts any integer greater than 1. Useful values are:
  4287. @table @samp
  4288. @item 4
  4289. If the original was telecined from 24 to 30 fps (Film to NTSC).
  4290. @item 5
  4291. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  4292. @item 20
  4293. If a mixture of the two.
  4294. @end table
  4295. The default is @samp{4}.
  4296. @end table
  4297. @section delogo
  4298. Suppress a TV station logo by a simple interpolation of the surrounding
  4299. pixels. Just set a rectangle covering the logo and watch it disappear
  4300. (and sometimes something even uglier appear - your mileage may vary).
  4301. It accepts the following parameters:
  4302. @table @option
  4303. @item x
  4304. @item y
  4305. Specify the top left corner coordinates of the logo. They must be
  4306. specified.
  4307. @item w
  4308. @item h
  4309. Specify the width and height of the logo to clear. They must be
  4310. specified.
  4311. @item band, t
  4312. Specify the thickness of the fuzzy edge of the rectangle (added to
  4313. @var{w} and @var{h}). The default value is 1. This option is
  4314. deprecated, setting higher values should no longer be necessary and
  4315. is not recommended.
  4316. @item show
  4317. When set to 1, a green rectangle is drawn on the screen to simplify
  4318. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  4319. The default value is 0.
  4320. The rectangle is drawn on the outermost pixels which will be (partly)
  4321. replaced with interpolated values. The values of the next pixels
  4322. immediately outside this rectangle in each direction will be used to
  4323. compute the interpolated pixel values inside the rectangle.
  4324. @end table
  4325. @subsection Examples
  4326. @itemize
  4327. @item
  4328. Set a rectangle covering the area with top left corner coordinates 0,0
  4329. and size 100x77, and a band of size 10:
  4330. @example
  4331. delogo=x=0:y=0:w=100:h=77:band=10
  4332. @end example
  4333. @end itemize
  4334. @section deshake
  4335. Attempt to fix small changes in horizontal and/or vertical shift. This
  4336. filter helps remove camera shake from hand-holding a camera, bumping a
  4337. tripod, moving on a vehicle, etc.
  4338. The filter accepts the following options:
  4339. @table @option
  4340. @item x
  4341. @item y
  4342. @item w
  4343. @item h
  4344. Specify a rectangular area where to limit the search for motion
  4345. vectors.
  4346. If desired the search for motion vectors can be limited to a
  4347. rectangular area of the frame defined by its top left corner, width
  4348. and height. These parameters have the same meaning as the drawbox
  4349. filter which can be used to visualise the position of the bounding
  4350. box.
  4351. This is useful when simultaneous movement of subjects within the frame
  4352. might be confused for camera motion by the motion vector search.
  4353. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  4354. then the full frame is used. This allows later options to be set
  4355. without specifying the bounding box for the motion vector search.
  4356. Default - search the whole frame.
  4357. @item rx
  4358. @item ry
  4359. Specify the maximum extent of movement in x and y directions in the
  4360. range 0-64 pixels. Default 16.
  4361. @item edge
  4362. Specify how to generate pixels to fill blanks at the edge of the
  4363. frame. Available values are:
  4364. @table @samp
  4365. @item blank, 0
  4366. Fill zeroes at blank locations
  4367. @item original, 1
  4368. Original image at blank locations
  4369. @item clamp, 2
  4370. Extruded edge value at blank locations
  4371. @item mirror, 3
  4372. Mirrored edge at blank locations
  4373. @end table
  4374. Default value is @samp{mirror}.
  4375. @item blocksize
  4376. Specify the blocksize to use for motion search. Range 4-128 pixels,
  4377. default 8.
  4378. @item contrast
  4379. Specify the contrast threshold for blocks. Only blocks with more than
  4380. the specified contrast (difference between darkest and lightest
  4381. pixels) will be considered. Range 1-255, default 125.
  4382. @item search
  4383. Specify the search strategy. Available values are:
  4384. @table @samp
  4385. @item exhaustive, 0
  4386. Set exhaustive search
  4387. @item less, 1
  4388. Set less exhaustive search.
  4389. @end table
  4390. Default value is @samp{exhaustive}.
  4391. @item filename
  4392. If set then a detailed log of the motion search is written to the
  4393. specified file.
  4394. @item opencl
  4395. If set to 1, specify using OpenCL capabilities, only available if
  4396. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  4397. @end table
  4398. @section detelecine
  4399. Apply an exact inverse of the telecine operation. It requires a predefined
  4400. pattern specified using the pattern option which must be the same as that passed
  4401. to the telecine filter.
  4402. This filter accepts the following options:
  4403. @table @option
  4404. @item first_field
  4405. @table @samp
  4406. @item top, t
  4407. top field first
  4408. @item bottom, b
  4409. bottom field first
  4410. The default value is @code{top}.
  4411. @end table
  4412. @item pattern
  4413. A string of numbers representing the pulldown pattern you wish to apply.
  4414. The default value is @code{23}.
  4415. @item start_frame
  4416. A number representing position of the first frame with respect to the telecine
  4417. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  4418. @end table
  4419. @section dilation
  4420. Apply dilation effect to the video.
  4421. This filter replaces the pixel by the local(3x3) maximum.
  4422. It accepts the following options:
  4423. @table @option
  4424. @item threshold0
  4425. @item threshold1
  4426. @item threshold2
  4427. @item threshold3
  4428. Limit the maximum change for each plane, default is 65535.
  4429. If 0, plane will remain unchanged.
  4430. @item coordinates
  4431. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  4432. pixels are used.
  4433. Flags to local 3x3 coordinates maps like this:
  4434. 1 2 3
  4435. 4 5
  4436. 6 7 8
  4437. @end table
  4438. @section displace
  4439. Displace pixels as indicated by second and third input stream.
  4440. It takes three input streams and outputs one stream, the first input is the
  4441. source, and second and third input are displacement maps.
  4442. The second input specifies how much to displace pixels along the
  4443. x-axis, while the third input specifies how much to displace pixels
  4444. along the y-axis.
  4445. If one of displacement map streams terminates, last frame from that
  4446. displacement map will be used.
  4447. Note that once generated, displacements maps can be reused over and over again.
  4448. A description of the accepted options follows.
  4449. @table @option
  4450. @item edge
  4451. Set displace behavior for pixels that are out of range.
  4452. Available values are:
  4453. @table @samp
  4454. @item blank
  4455. Missing pixels are replaced by black pixels.
  4456. @item smear
  4457. Adjacent pixels will spread out to replace missing pixels.
  4458. @item wrap
  4459. Out of range pixels are wrapped so they point to pixels of other side.
  4460. @end table
  4461. Default is @samp{smear}.
  4462. @end table
  4463. @subsection Examples
  4464. @itemize
  4465. @item
  4466. Add ripple effect to rgb input of video size hd720:
  4467. @example
  4468. 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
  4469. @end example
  4470. @item
  4471. Add wave effect to rgb input of video size hd720:
  4472. @example
  4473. 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
  4474. @end example
  4475. @end itemize
  4476. @section drawbox
  4477. Draw a colored box on the input image.
  4478. It accepts the following parameters:
  4479. @table @option
  4480. @item x
  4481. @item y
  4482. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  4483. @item width, w
  4484. @item height, h
  4485. The expressions which specify the width and height of the box; if 0 they are interpreted as
  4486. the input width and height. It defaults to 0.
  4487. @item color, c
  4488. Specify the color of the box to write. For the general syntax of this option,
  4489. check the "Color" section in the ffmpeg-utils manual. If the special
  4490. value @code{invert} is used, the box edge color is the same as the
  4491. video with inverted luma.
  4492. @item thickness, t
  4493. The expression which sets the thickness of the box edge. Default value is @code{3}.
  4494. See below for the list of accepted constants.
  4495. @end table
  4496. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  4497. following constants:
  4498. @table @option
  4499. @item dar
  4500. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  4501. @item hsub
  4502. @item vsub
  4503. horizontal and vertical chroma subsample values. For example for the
  4504. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4505. @item in_h, ih
  4506. @item in_w, iw
  4507. The input width and height.
  4508. @item sar
  4509. The input sample aspect ratio.
  4510. @item x
  4511. @item y
  4512. The x and y offset coordinates where the box is drawn.
  4513. @item w
  4514. @item h
  4515. The width and height of the drawn box.
  4516. @item t
  4517. The thickness of the drawn box.
  4518. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  4519. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  4520. @end table
  4521. @subsection Examples
  4522. @itemize
  4523. @item
  4524. Draw a black box around the edge of the input image:
  4525. @example
  4526. drawbox
  4527. @end example
  4528. @item
  4529. Draw a box with color red and an opacity of 50%:
  4530. @example
  4531. drawbox=10:20:200:60:red@@0.5
  4532. @end example
  4533. The previous example can be specified as:
  4534. @example
  4535. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  4536. @end example
  4537. @item
  4538. Fill the box with pink color:
  4539. @example
  4540. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  4541. @end example
  4542. @item
  4543. Draw a 2-pixel red 2.40:1 mask:
  4544. @example
  4545. 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
  4546. @end example
  4547. @end itemize
  4548. @section drawgraph, adrawgraph
  4549. Draw a graph using input video or audio metadata.
  4550. It accepts the following parameters:
  4551. @table @option
  4552. @item m1
  4553. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  4554. @item fg1
  4555. Set 1st foreground color expression.
  4556. @item m2
  4557. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  4558. @item fg2
  4559. Set 2nd foreground color expression.
  4560. @item m3
  4561. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  4562. @item fg3
  4563. Set 3rd foreground color expression.
  4564. @item m4
  4565. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  4566. @item fg4
  4567. Set 4th foreground color expression.
  4568. @item min
  4569. Set minimal value of metadata value.
  4570. @item max
  4571. Set maximal value of metadata value.
  4572. @item bg
  4573. Set graph background color. Default is white.
  4574. @item mode
  4575. Set graph mode.
  4576. Available values for mode is:
  4577. @table @samp
  4578. @item bar
  4579. @item dot
  4580. @item line
  4581. @end table
  4582. Default is @code{line}.
  4583. @item slide
  4584. Set slide mode.
  4585. Available values for slide is:
  4586. @table @samp
  4587. @item frame
  4588. Draw new frame when right border is reached.
  4589. @item replace
  4590. Replace old columns with new ones.
  4591. @item scroll
  4592. Scroll from right to left.
  4593. @item rscroll
  4594. Scroll from left to right.
  4595. @end table
  4596. Default is @code{frame}.
  4597. @item size
  4598. Set size of graph video. For the syntax of this option, check the
  4599. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  4600. The default value is @code{900x256}.
  4601. The foreground color expressions can use the following variables:
  4602. @table @option
  4603. @item MIN
  4604. Minimal value of metadata value.
  4605. @item MAX
  4606. Maximal value of metadata value.
  4607. @item VAL
  4608. Current metadata key value.
  4609. @end table
  4610. The color is defined as 0xAABBGGRR.
  4611. @end table
  4612. Example using metadata from @ref{signalstats} filter:
  4613. @example
  4614. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  4615. @end example
  4616. Example using metadata from @ref{ebur128} filter:
  4617. @example
  4618. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  4619. @end example
  4620. @section drawgrid
  4621. Draw a grid on the input image.
  4622. It accepts the following parameters:
  4623. @table @option
  4624. @item x
  4625. @item y
  4626. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  4627. @item width, w
  4628. @item height, h
  4629. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  4630. input width and height, respectively, minus @code{thickness}, so image gets
  4631. framed. Default to 0.
  4632. @item color, c
  4633. Specify the color of the grid. For the general syntax of this option,
  4634. check the "Color" section in the ffmpeg-utils manual. If the special
  4635. value @code{invert} is used, the grid color is the same as the
  4636. video with inverted luma.
  4637. @item thickness, t
  4638. The expression which sets the thickness of the grid line. Default value is @code{1}.
  4639. See below for the list of accepted constants.
  4640. @end table
  4641. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  4642. following constants:
  4643. @table @option
  4644. @item dar
  4645. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  4646. @item hsub
  4647. @item vsub
  4648. horizontal and vertical chroma subsample values. For example for the
  4649. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4650. @item in_h, ih
  4651. @item in_w, iw
  4652. The input grid cell width and height.
  4653. @item sar
  4654. The input sample aspect ratio.
  4655. @item x
  4656. @item y
  4657. The x and y coordinates of some point of grid intersection (meant to configure offset).
  4658. @item w
  4659. @item h
  4660. The width and height of the drawn cell.
  4661. @item t
  4662. The thickness of the drawn cell.
  4663. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  4664. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  4665. @end table
  4666. @subsection Examples
  4667. @itemize
  4668. @item
  4669. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  4670. @example
  4671. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  4672. @end example
  4673. @item
  4674. Draw a white 3x3 grid with an opacity of 50%:
  4675. @example
  4676. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  4677. @end example
  4678. @end itemize
  4679. @anchor{drawtext}
  4680. @section drawtext
  4681. Draw a text string or text from a specified file on top of a video, using the
  4682. libfreetype library.
  4683. To enable compilation of this filter, you need to configure FFmpeg with
  4684. @code{--enable-libfreetype}.
  4685. To enable default font fallback and the @var{font} option you need to
  4686. configure FFmpeg with @code{--enable-libfontconfig}.
  4687. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  4688. @code{--enable-libfribidi}.
  4689. @subsection Syntax
  4690. It accepts the following parameters:
  4691. @table @option
  4692. @item box
  4693. Used to draw a box around text using the background color.
  4694. The value must be either 1 (enable) or 0 (disable).
  4695. The default value of @var{box} is 0.
  4696. @item boxborderw
  4697. Set the width of the border to be drawn around the box using @var{boxcolor}.
  4698. The default value of @var{boxborderw} is 0.
  4699. @item boxcolor
  4700. The color to be used for drawing box around text. For the syntax of this
  4701. option, check the "Color" section in the ffmpeg-utils manual.
  4702. The default value of @var{boxcolor} is "white".
  4703. @item borderw
  4704. Set the width of the border to be drawn around the text using @var{bordercolor}.
  4705. The default value of @var{borderw} is 0.
  4706. @item bordercolor
  4707. Set the color to be used for drawing border around text. For the syntax of this
  4708. option, check the "Color" section in the ffmpeg-utils manual.
  4709. The default value of @var{bordercolor} is "black".
  4710. @item expansion
  4711. Select how the @var{text} is expanded. Can be either @code{none},
  4712. @code{strftime} (deprecated) or
  4713. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  4714. below for details.
  4715. @item fix_bounds
  4716. If true, check and fix text coords to avoid clipping.
  4717. @item fontcolor
  4718. The color to be used for drawing fonts. For the syntax of this option, check
  4719. the "Color" section in the ffmpeg-utils manual.
  4720. The default value of @var{fontcolor} is "black".
  4721. @item fontcolor_expr
  4722. String which is expanded the same way as @var{text} to obtain dynamic
  4723. @var{fontcolor} value. By default this option has empty value and is not
  4724. processed. When this option is set, it overrides @var{fontcolor} option.
  4725. @item font
  4726. The font family to be used for drawing text. By default Sans.
  4727. @item fontfile
  4728. The font file to be used for drawing text. The path must be included.
  4729. This parameter is mandatory if the fontconfig support is disabled.
  4730. @item draw
  4731. This option does not exist, please see the timeline system
  4732. @item alpha
  4733. Draw the text applying alpha blending. The value can
  4734. be either a number between 0.0 and 1.0
  4735. The expression accepts the same variables @var{x, y} do.
  4736. The default value is 1.
  4737. Please see fontcolor_expr
  4738. @item fontsize
  4739. The font size to be used for drawing text.
  4740. The default value of @var{fontsize} is 16.
  4741. @item text_shaping
  4742. If set to 1, attempt to shape the text (for example, reverse the order of
  4743. right-to-left text and join Arabic characters) before drawing it.
  4744. Otherwise, just draw the text exactly as given.
  4745. By default 1 (if supported).
  4746. @item ft_load_flags
  4747. The flags to be used for loading the fonts.
  4748. The flags map the corresponding flags supported by libfreetype, and are
  4749. a combination of the following values:
  4750. @table @var
  4751. @item default
  4752. @item no_scale
  4753. @item no_hinting
  4754. @item render
  4755. @item no_bitmap
  4756. @item vertical_layout
  4757. @item force_autohint
  4758. @item crop_bitmap
  4759. @item pedantic
  4760. @item ignore_global_advance_width
  4761. @item no_recurse
  4762. @item ignore_transform
  4763. @item monochrome
  4764. @item linear_design
  4765. @item no_autohint
  4766. @end table
  4767. Default value is "default".
  4768. For more information consult the documentation for the FT_LOAD_*
  4769. libfreetype flags.
  4770. @item shadowcolor
  4771. The color to be used for drawing a shadow behind the drawn text. For the
  4772. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  4773. The default value of @var{shadowcolor} is "black".
  4774. @item shadowx
  4775. @item shadowy
  4776. The x and y offsets for the text shadow position with respect to the
  4777. position of the text. They can be either positive or negative
  4778. values. The default value for both is "0".
  4779. @item start_number
  4780. The starting frame number for the n/frame_num variable. The default value
  4781. is "0".
  4782. @item tabsize
  4783. The size in number of spaces to use for rendering the tab.
  4784. Default value is 4.
  4785. @item timecode
  4786. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  4787. format. It can be used with or without text parameter. @var{timecode_rate}
  4788. option must be specified.
  4789. @item timecode_rate, rate, r
  4790. Set the timecode frame rate (timecode only).
  4791. @item text
  4792. The text string to be drawn. The text must be a sequence of UTF-8
  4793. encoded characters.
  4794. This parameter is mandatory if no file is specified with the parameter
  4795. @var{textfile}.
  4796. @item textfile
  4797. A text file containing text to be drawn. The text must be a sequence
  4798. of UTF-8 encoded characters.
  4799. This parameter is mandatory if no text string is specified with the
  4800. parameter @var{text}.
  4801. If both @var{text} and @var{textfile} are specified, an error is thrown.
  4802. @item reload
  4803. If set to 1, the @var{textfile} will be reloaded before each frame.
  4804. Be sure to update it atomically, or it may be read partially, or even fail.
  4805. @item x
  4806. @item y
  4807. The expressions which specify the offsets where text will be drawn
  4808. within the video frame. They are relative to the top/left border of the
  4809. output image.
  4810. The default value of @var{x} and @var{y} is "0".
  4811. See below for the list of accepted constants and functions.
  4812. @end table
  4813. The parameters for @var{x} and @var{y} are expressions containing the
  4814. following constants and functions:
  4815. @table @option
  4816. @item dar
  4817. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  4818. @item hsub
  4819. @item vsub
  4820. horizontal and vertical chroma subsample values. For example for the
  4821. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4822. @item line_h, lh
  4823. the height of each text line
  4824. @item main_h, h, H
  4825. the input height
  4826. @item main_w, w, W
  4827. the input width
  4828. @item max_glyph_a, ascent
  4829. the maximum distance from the baseline to the highest/upper grid
  4830. coordinate used to place a glyph outline point, for all the rendered
  4831. glyphs.
  4832. It is a positive value, due to the grid's orientation with the Y axis
  4833. upwards.
  4834. @item max_glyph_d, descent
  4835. the maximum distance from the baseline to the lowest grid coordinate
  4836. used to place a glyph outline point, for all the rendered glyphs.
  4837. This is a negative value, due to the grid's orientation, with the Y axis
  4838. upwards.
  4839. @item max_glyph_h
  4840. maximum glyph height, that is the maximum height for all the glyphs
  4841. contained in the rendered text, it is equivalent to @var{ascent} -
  4842. @var{descent}.
  4843. @item max_glyph_w
  4844. maximum glyph width, that is the maximum width for all the glyphs
  4845. contained in the rendered text
  4846. @item n
  4847. the number of input frame, starting from 0
  4848. @item rand(min, max)
  4849. return a random number included between @var{min} and @var{max}
  4850. @item sar
  4851. The input sample aspect ratio.
  4852. @item t
  4853. timestamp expressed in seconds, NAN if the input timestamp is unknown
  4854. @item text_h, th
  4855. the height of the rendered text
  4856. @item text_w, tw
  4857. the width of the rendered text
  4858. @item x
  4859. @item y
  4860. the x and y offset coordinates where the text is drawn.
  4861. These parameters allow the @var{x} and @var{y} expressions to refer
  4862. each other, so you can for example specify @code{y=x/dar}.
  4863. @end table
  4864. @anchor{drawtext_expansion}
  4865. @subsection Text expansion
  4866. If @option{expansion} is set to @code{strftime},
  4867. the filter recognizes strftime() sequences in the provided text and
  4868. expands them accordingly. Check the documentation of strftime(). This
  4869. feature is deprecated.
  4870. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  4871. If @option{expansion} is set to @code{normal} (which is the default),
  4872. the following expansion mechanism is used.
  4873. The backslash character @samp{\}, followed by any character, always expands to
  4874. the second character.
  4875. Sequence of the form @code{%@{...@}} are expanded. The text between the
  4876. braces is a function name, possibly followed by arguments separated by ':'.
  4877. If the arguments contain special characters or delimiters (':' or '@}'),
  4878. they should be escaped.
  4879. Note that they probably must also be escaped as the value for the
  4880. @option{text} option in the filter argument string and as the filter
  4881. argument in the filtergraph description, and possibly also for the shell,
  4882. that makes up to four levels of escaping; using a text file avoids these
  4883. problems.
  4884. The following functions are available:
  4885. @table @command
  4886. @item expr, e
  4887. The expression evaluation result.
  4888. It must take one argument specifying the expression to be evaluated,
  4889. which accepts the same constants and functions as the @var{x} and
  4890. @var{y} values. Note that not all constants should be used, for
  4891. example the text size is not known when evaluating the expression, so
  4892. the constants @var{text_w} and @var{text_h} will have an undefined
  4893. value.
  4894. @item expr_int_format, eif
  4895. Evaluate the expression's value and output as formatted integer.
  4896. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  4897. The second argument specifies the output format. Allowed values are @samp{x},
  4898. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  4899. @code{printf} function.
  4900. The third parameter is optional and sets the number of positions taken by the output.
  4901. It can be used to add padding with zeros from the left.
  4902. @item gmtime
  4903. The time at which the filter is running, expressed in UTC.
  4904. It can accept an argument: a strftime() format string.
  4905. @item localtime
  4906. The time at which the filter is running, expressed in the local time zone.
  4907. It can accept an argument: a strftime() format string.
  4908. @item metadata
  4909. Frame metadata. It must take one argument specifying metadata key.
  4910. @item n, frame_num
  4911. The frame number, starting from 0.
  4912. @item pict_type
  4913. A 1 character description of the current picture type.
  4914. @item pts
  4915. The timestamp of the current frame.
  4916. It can take up to three arguments.
  4917. The first argument is the format of the timestamp; it defaults to @code{flt}
  4918. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  4919. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  4920. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  4921. @code{localtime} stands for the timestamp of the frame formatted as
  4922. local time zone time.
  4923. The second argument is an offset added to the timestamp.
  4924. If the format is set to @code{localtime} or @code{gmtime},
  4925. a third argument may be supplied: a strftime() format string.
  4926. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  4927. @end table
  4928. @subsection Examples
  4929. @itemize
  4930. @item
  4931. Draw "Test Text" with font FreeSerif, using the default values for the
  4932. optional parameters.
  4933. @example
  4934. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  4935. @end example
  4936. @item
  4937. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  4938. and y=50 (counting from the top-left corner of the screen), text is
  4939. yellow with a red box around it. Both the text and the box have an
  4940. opacity of 20%.
  4941. @example
  4942. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  4943. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  4944. @end example
  4945. Note that the double quotes are not necessary if spaces are not used
  4946. within the parameter list.
  4947. @item
  4948. Show the text at the center of the video frame:
  4949. @example
  4950. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  4951. @end example
  4952. @item
  4953. Show a text line sliding from right to left in the last row of the video
  4954. frame. The file @file{LONG_LINE} is assumed to contain a single line
  4955. with no newlines.
  4956. @example
  4957. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  4958. @end example
  4959. @item
  4960. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  4961. @example
  4962. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  4963. @end example
  4964. @item
  4965. Draw a single green letter "g", at the center of the input video.
  4966. The glyph baseline is placed at half screen height.
  4967. @example
  4968. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  4969. @end example
  4970. @item
  4971. Show text for 1 second every 3 seconds:
  4972. @example
  4973. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  4974. @end example
  4975. @item
  4976. Use fontconfig to set the font. Note that the colons need to be escaped.
  4977. @example
  4978. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  4979. @end example
  4980. @item
  4981. Print the date of a real-time encoding (see strftime(3)):
  4982. @example
  4983. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  4984. @end example
  4985. @item
  4986. Show text fading in and out (appearing/disappearing):
  4987. @example
  4988. #!/bin/sh
  4989. DS=1.0 # display start
  4990. DE=10.0 # display end
  4991. FID=1.5 # fade in duration
  4992. FOD=5 # fade out duration
  4993. 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 @}"
  4994. @end example
  4995. @end itemize
  4996. For more information about libfreetype, check:
  4997. @url{http://www.freetype.org/}.
  4998. For more information about fontconfig, check:
  4999. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  5000. For more information about libfribidi, check:
  5001. @url{http://fribidi.org/}.
  5002. @section edgedetect
  5003. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  5004. The filter accepts the following options:
  5005. @table @option
  5006. @item low
  5007. @item high
  5008. Set low and high threshold values used by the Canny thresholding
  5009. algorithm.
  5010. The high threshold selects the "strong" edge pixels, which are then
  5011. connected through 8-connectivity with the "weak" edge pixels selected
  5012. by the low threshold.
  5013. @var{low} and @var{high} threshold values must be chosen in the range
  5014. [0,1], and @var{low} should be lesser or equal to @var{high}.
  5015. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  5016. is @code{50/255}.
  5017. @item mode
  5018. Define the drawing mode.
  5019. @table @samp
  5020. @item wires
  5021. Draw white/gray wires on black background.
  5022. @item colormix
  5023. Mix the colors to create a paint/cartoon effect.
  5024. @end table
  5025. Default value is @var{wires}.
  5026. @end table
  5027. @subsection Examples
  5028. @itemize
  5029. @item
  5030. Standard edge detection with custom values for the hysteresis thresholding:
  5031. @example
  5032. edgedetect=low=0.1:high=0.4
  5033. @end example
  5034. @item
  5035. Painting effect without thresholding:
  5036. @example
  5037. edgedetect=mode=colormix:high=0
  5038. @end example
  5039. @end itemize
  5040. @section eq
  5041. Set brightness, contrast, saturation and approximate gamma adjustment.
  5042. The filter accepts the following options:
  5043. @table @option
  5044. @item contrast
  5045. Set the contrast expression. The value must be a float value in range
  5046. @code{-2.0} to @code{2.0}. The default value is "1".
  5047. @item brightness
  5048. Set the brightness expression. The value must be a float value in
  5049. range @code{-1.0} to @code{1.0}. The default value is "0".
  5050. @item saturation
  5051. Set the saturation expression. The value must be a float in
  5052. range @code{0.0} to @code{3.0}. The default value is "1".
  5053. @item gamma
  5054. Set the gamma expression. The value must be a float in range
  5055. @code{0.1} to @code{10.0}. The default value is "1".
  5056. @item gamma_r
  5057. Set the gamma expression for red. The value must be a float in
  5058. range @code{0.1} to @code{10.0}. The default value is "1".
  5059. @item gamma_g
  5060. Set the gamma expression for green. The value must be a float in range
  5061. @code{0.1} to @code{10.0}. The default value is "1".
  5062. @item gamma_b
  5063. Set the gamma expression for blue. The value must be a float in range
  5064. @code{0.1} to @code{10.0}. The default value is "1".
  5065. @item gamma_weight
  5066. Set the gamma weight expression. It can be used to reduce the effect
  5067. of a high gamma value on bright image areas, e.g. keep them from
  5068. getting overamplified and just plain white. The value must be a float
  5069. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  5070. gamma correction all the way down while @code{1.0} leaves it at its
  5071. full strength. Default is "1".
  5072. @item eval
  5073. Set when the expressions for brightness, contrast, saturation and
  5074. gamma expressions are evaluated.
  5075. It accepts the following values:
  5076. @table @samp
  5077. @item init
  5078. only evaluate expressions once during the filter initialization or
  5079. when a command is processed
  5080. @item frame
  5081. evaluate expressions for each incoming frame
  5082. @end table
  5083. Default value is @samp{init}.
  5084. @end table
  5085. The expressions accept the following parameters:
  5086. @table @option
  5087. @item n
  5088. frame count of the input frame starting from 0
  5089. @item pos
  5090. byte position of the corresponding packet in the input file, NAN if
  5091. unspecified
  5092. @item r
  5093. frame rate of the input video, NAN if the input frame rate is unknown
  5094. @item t
  5095. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5096. @end table
  5097. @subsection Commands
  5098. The filter supports the following commands:
  5099. @table @option
  5100. @item contrast
  5101. Set the contrast expression.
  5102. @item brightness
  5103. Set the brightness expression.
  5104. @item saturation
  5105. Set the saturation expression.
  5106. @item gamma
  5107. Set the gamma expression.
  5108. @item gamma_r
  5109. Set the gamma_r expression.
  5110. @item gamma_g
  5111. Set gamma_g expression.
  5112. @item gamma_b
  5113. Set gamma_b expression.
  5114. @item gamma_weight
  5115. Set gamma_weight expression.
  5116. The command accepts the same syntax of the corresponding option.
  5117. If the specified expression is not valid, it is kept at its current
  5118. value.
  5119. @end table
  5120. @section erosion
  5121. Apply erosion effect to the video.
  5122. This filter replaces the pixel by the local(3x3) minimum.
  5123. It accepts the following options:
  5124. @table @option
  5125. @item threshold0
  5126. @item threshold1
  5127. @item threshold2
  5128. @item threshold3
  5129. Limit the maximum change for each plane, default is 65535.
  5130. If 0, plane will remain unchanged.
  5131. @item coordinates
  5132. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5133. pixels are used.
  5134. Flags to local 3x3 coordinates maps like this:
  5135. 1 2 3
  5136. 4 5
  5137. 6 7 8
  5138. @end table
  5139. @section extractplanes
  5140. Extract color channel components from input video stream into
  5141. separate grayscale video streams.
  5142. The filter accepts the following option:
  5143. @table @option
  5144. @item planes
  5145. Set plane(s) to extract.
  5146. Available values for planes are:
  5147. @table @samp
  5148. @item y
  5149. @item u
  5150. @item v
  5151. @item a
  5152. @item r
  5153. @item g
  5154. @item b
  5155. @end table
  5156. Choosing planes not available in the input will result in an error.
  5157. That means you cannot select @code{r}, @code{g}, @code{b} planes
  5158. with @code{y}, @code{u}, @code{v} planes at same time.
  5159. @end table
  5160. @subsection Examples
  5161. @itemize
  5162. @item
  5163. Extract luma, u and v color channel component from input video frame
  5164. into 3 grayscale outputs:
  5165. @example
  5166. 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
  5167. @end example
  5168. @end itemize
  5169. @section elbg
  5170. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  5171. For each input image, the filter will compute the optimal mapping from
  5172. the input to the output given the codebook length, that is the number
  5173. of distinct output colors.
  5174. This filter accepts the following options.
  5175. @table @option
  5176. @item codebook_length, l
  5177. Set codebook length. The value must be a positive integer, and
  5178. represents the number of distinct output colors. Default value is 256.
  5179. @item nb_steps, n
  5180. Set the maximum number of iterations to apply for computing the optimal
  5181. mapping. The higher the value the better the result and the higher the
  5182. computation time. Default value is 1.
  5183. @item seed, s
  5184. Set a random seed, must be an integer included between 0 and
  5185. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  5186. will try to use a good random seed on a best effort basis.
  5187. @item pal8
  5188. Set pal8 output pixel format. This option does not work with codebook
  5189. length greater than 256.
  5190. @end table
  5191. @section fade
  5192. Apply a fade-in/out effect to the input video.
  5193. It accepts the following parameters:
  5194. @table @option
  5195. @item type, t
  5196. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  5197. effect.
  5198. Default is @code{in}.
  5199. @item start_frame, s
  5200. Specify the number of the frame to start applying the fade
  5201. effect at. Default is 0.
  5202. @item nb_frames, n
  5203. The number of frames that the fade effect lasts. At the end of the
  5204. fade-in effect, the output video will have the same intensity as the input video.
  5205. At the end of the fade-out transition, the output video will be filled with the
  5206. selected @option{color}.
  5207. Default is 25.
  5208. @item alpha
  5209. If set to 1, fade only alpha channel, if one exists on the input.
  5210. Default value is 0.
  5211. @item start_time, st
  5212. Specify the timestamp (in seconds) of the frame to start to apply the fade
  5213. effect. If both start_frame and start_time are specified, the fade will start at
  5214. whichever comes last. Default is 0.
  5215. @item duration, d
  5216. The number of seconds for which the fade effect has to last. At the end of the
  5217. fade-in effect the output video will have the same intensity as the input video,
  5218. at the end of the fade-out transition the output video will be filled with the
  5219. selected @option{color}.
  5220. If both duration and nb_frames are specified, duration is used. Default is 0
  5221. (nb_frames is used by default).
  5222. @item color, c
  5223. Specify the color of the fade. Default is "black".
  5224. @end table
  5225. @subsection Examples
  5226. @itemize
  5227. @item
  5228. Fade in the first 30 frames of video:
  5229. @example
  5230. fade=in:0:30
  5231. @end example
  5232. The command above is equivalent to:
  5233. @example
  5234. fade=t=in:s=0:n=30
  5235. @end example
  5236. @item
  5237. Fade out the last 45 frames of a 200-frame video:
  5238. @example
  5239. fade=out:155:45
  5240. fade=type=out:start_frame=155:nb_frames=45
  5241. @end example
  5242. @item
  5243. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  5244. @example
  5245. fade=in:0:25, fade=out:975:25
  5246. @end example
  5247. @item
  5248. Make the first 5 frames yellow, then fade in from frame 5-24:
  5249. @example
  5250. fade=in:5:20:color=yellow
  5251. @end example
  5252. @item
  5253. Fade in alpha over first 25 frames of video:
  5254. @example
  5255. fade=in:0:25:alpha=1
  5256. @end example
  5257. @item
  5258. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  5259. @example
  5260. fade=t=in:st=5.5:d=0.5
  5261. @end example
  5262. @end itemize
  5263. @section fftfilt
  5264. Apply arbitrary expressions to samples in frequency domain
  5265. @table @option
  5266. @item dc_Y
  5267. Adjust the dc value (gain) of the luma plane of the image. The filter
  5268. accepts an integer value in range @code{0} to @code{1000}. The default
  5269. value is set to @code{0}.
  5270. @item dc_U
  5271. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  5272. filter accepts an integer value in range @code{0} to @code{1000}. The
  5273. default value is set to @code{0}.
  5274. @item dc_V
  5275. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  5276. filter accepts an integer value in range @code{0} to @code{1000}. The
  5277. default value is set to @code{0}.
  5278. @item weight_Y
  5279. Set the frequency domain weight expression for the luma plane.
  5280. @item weight_U
  5281. Set the frequency domain weight expression for the 1st chroma plane.
  5282. @item weight_V
  5283. Set the frequency domain weight expression for the 2nd chroma plane.
  5284. The filter accepts the following variables:
  5285. @item X
  5286. @item Y
  5287. The coordinates of the current sample.
  5288. @item W
  5289. @item H
  5290. The width and height of the image.
  5291. @end table
  5292. @subsection Examples
  5293. @itemize
  5294. @item
  5295. High-pass:
  5296. @example
  5297. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  5298. @end example
  5299. @item
  5300. Low-pass:
  5301. @example
  5302. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  5303. @end example
  5304. @item
  5305. Sharpen:
  5306. @example
  5307. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  5308. @end example
  5309. @item
  5310. Blur:
  5311. @example
  5312. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  5313. @end example
  5314. @end itemize
  5315. @section field
  5316. Extract a single field from an interlaced image using stride
  5317. arithmetic to avoid wasting CPU time. The output frames are marked as
  5318. non-interlaced.
  5319. The filter accepts the following options:
  5320. @table @option
  5321. @item type
  5322. Specify whether to extract the top (if the value is @code{0} or
  5323. @code{top}) or the bottom field (if the value is @code{1} or
  5324. @code{bottom}).
  5325. @end table
  5326. @section fieldhint
  5327. Create new frames by copying the top and bottom fields from surrounding frames
  5328. supplied as numbers by the hint file.
  5329. @table @option
  5330. @item hint
  5331. Set file containing hints: absolute/relative frame numbers.
  5332. There must be one line for each frame in a clip. Each line must contain two
  5333. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  5334. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  5335. is current frame number for @code{absolute} mode or out of [-1, 1] range
  5336. for @code{relative} mode. First number tells from which frame to pick up top
  5337. field and second number tells from which frame to pick up bottom field.
  5338. If optionally followed by @code{+} output frame will be marked as interlaced,
  5339. else if followed by @code{-} output frame will be marked as progressive, else
  5340. it will be marked same as input frame.
  5341. If line starts with @code{#} or @code{;} that line is skipped.
  5342. @item mode
  5343. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  5344. @end table
  5345. Example of first several lines of @code{hint} file for @code{relative} mode:
  5346. @example
  5347. 0,0 - # first frame
  5348. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  5349. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  5350. 1,0 -
  5351. 0,0 -
  5352. 0,0 -
  5353. 1,0 -
  5354. 1,0 -
  5355. 1,0 -
  5356. 0,0 -
  5357. 0,0 -
  5358. 1,0 -
  5359. 1,0 -
  5360. 1,0 -
  5361. 0,0 -
  5362. @end example
  5363. @section fieldmatch
  5364. Field matching filter for inverse telecine. It is meant to reconstruct the
  5365. progressive frames from a telecined stream. The filter does not drop duplicated
  5366. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  5367. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  5368. The separation of the field matching and the decimation is notably motivated by
  5369. the possibility of inserting a de-interlacing filter fallback between the two.
  5370. If the source has mixed telecined and real interlaced content,
  5371. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  5372. But these remaining combed frames will be marked as interlaced, and thus can be
  5373. de-interlaced by a later filter such as @ref{yadif} before decimation.
  5374. In addition to the various configuration options, @code{fieldmatch} can take an
  5375. optional second stream, activated through the @option{ppsrc} option. If
  5376. enabled, the frames reconstruction will be based on the fields and frames from
  5377. this second stream. This allows the first input to be pre-processed in order to
  5378. help the various algorithms of the filter, while keeping the output lossless
  5379. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  5380. or brightness/contrast adjustments can help.
  5381. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  5382. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  5383. which @code{fieldmatch} is based on. While the semantic and usage are very
  5384. close, some behaviour and options names can differ.
  5385. The @ref{decimate} filter currently only works for constant frame rate input.
  5386. If your input has mixed telecined (30fps) and progressive content with a lower
  5387. framerate like 24fps use the following filterchain to produce the necessary cfr
  5388. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  5389. The filter accepts the following options:
  5390. @table @option
  5391. @item order
  5392. Specify the assumed field order of the input stream. Available values are:
  5393. @table @samp
  5394. @item auto
  5395. Auto detect parity (use FFmpeg's internal parity value).
  5396. @item bff
  5397. Assume bottom field first.
  5398. @item tff
  5399. Assume top field first.
  5400. @end table
  5401. Note that it is sometimes recommended not to trust the parity announced by the
  5402. stream.
  5403. Default value is @var{auto}.
  5404. @item mode
  5405. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  5406. sense that it won't risk creating jerkiness due to duplicate frames when
  5407. possible, but if there are bad edits or blended fields it will end up
  5408. outputting combed frames when a good match might actually exist. On the other
  5409. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  5410. but will almost always find a good frame if there is one. The other values are
  5411. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  5412. jerkiness and creating duplicate frames versus finding good matches in sections
  5413. with bad edits, orphaned fields, blended fields, etc.
  5414. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  5415. Available values are:
  5416. @table @samp
  5417. @item pc
  5418. 2-way matching (p/c)
  5419. @item pc_n
  5420. 2-way matching, and trying 3rd match if still combed (p/c + n)
  5421. @item pc_u
  5422. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  5423. @item pc_n_ub
  5424. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  5425. still combed (p/c + n + u/b)
  5426. @item pcn
  5427. 3-way matching (p/c/n)
  5428. @item pcn_ub
  5429. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  5430. detected as combed (p/c/n + u/b)
  5431. @end table
  5432. The parenthesis at the end indicate the matches that would be used for that
  5433. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  5434. @var{top}).
  5435. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  5436. the slowest.
  5437. Default value is @var{pc_n}.
  5438. @item ppsrc
  5439. Mark the main input stream as a pre-processed input, and enable the secondary
  5440. input stream as the clean source to pick the fields from. See the filter
  5441. introduction for more details. It is similar to the @option{clip2} feature from
  5442. VFM/TFM.
  5443. Default value is @code{0} (disabled).
  5444. @item field
  5445. Set the field to match from. It is recommended to set this to the same value as
  5446. @option{order} unless you experience matching failures with that setting. In
  5447. certain circumstances changing the field that is used to match from can have a
  5448. large impact on matching performance. Available values are:
  5449. @table @samp
  5450. @item auto
  5451. Automatic (same value as @option{order}).
  5452. @item bottom
  5453. Match from the bottom field.
  5454. @item top
  5455. Match from the top field.
  5456. @end table
  5457. Default value is @var{auto}.
  5458. @item mchroma
  5459. Set whether or not chroma is included during the match comparisons. In most
  5460. cases it is recommended to leave this enabled. You should set this to @code{0}
  5461. only if your clip has bad chroma problems such as heavy rainbowing or other
  5462. artifacts. Setting this to @code{0} could also be used to speed things up at
  5463. the cost of some accuracy.
  5464. Default value is @code{1}.
  5465. @item y0
  5466. @item y1
  5467. These define an exclusion band which excludes the lines between @option{y0} and
  5468. @option{y1} from being included in the field matching decision. An exclusion
  5469. band can be used to ignore subtitles, a logo, or other things that may
  5470. interfere with the matching. @option{y0} sets the starting scan line and
  5471. @option{y1} sets the ending line; all lines in between @option{y0} and
  5472. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  5473. @option{y0} and @option{y1} to the same value will disable the feature.
  5474. @option{y0} and @option{y1} defaults to @code{0}.
  5475. @item scthresh
  5476. Set the scene change detection threshold as a percentage of maximum change on
  5477. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  5478. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  5479. @option{scthresh} is @code{[0.0, 100.0]}.
  5480. Default value is @code{12.0}.
  5481. @item combmatch
  5482. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  5483. account the combed scores of matches when deciding what match to use as the
  5484. final match. Available values are:
  5485. @table @samp
  5486. @item none
  5487. No final matching based on combed scores.
  5488. @item sc
  5489. Combed scores are only used when a scene change is detected.
  5490. @item full
  5491. Use combed scores all the time.
  5492. @end table
  5493. Default is @var{sc}.
  5494. @item combdbg
  5495. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  5496. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  5497. Available values are:
  5498. @table @samp
  5499. @item none
  5500. No forced calculation.
  5501. @item pcn
  5502. Force p/c/n calculations.
  5503. @item pcnub
  5504. Force p/c/n/u/b calculations.
  5505. @end table
  5506. Default value is @var{none}.
  5507. @item cthresh
  5508. This is the area combing threshold used for combed frame detection. This
  5509. essentially controls how "strong" or "visible" combing must be to be detected.
  5510. Larger values mean combing must be more visible and smaller values mean combing
  5511. can be less visible or strong and still be detected. Valid settings are from
  5512. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  5513. be detected as combed). This is basically a pixel difference value. A good
  5514. range is @code{[8, 12]}.
  5515. Default value is @code{9}.
  5516. @item chroma
  5517. Sets whether or not chroma is considered in the combed frame decision. Only
  5518. disable this if your source has chroma problems (rainbowing, etc.) that are
  5519. causing problems for the combed frame detection with chroma enabled. Actually,
  5520. using @option{chroma}=@var{0} is usually more reliable, except for the case
  5521. where there is chroma only combing in the source.
  5522. Default value is @code{0}.
  5523. @item blockx
  5524. @item blocky
  5525. Respectively set the x-axis and y-axis size of the window used during combed
  5526. frame detection. This has to do with the size of the area in which
  5527. @option{combpel} pixels are required to be detected as combed for a frame to be
  5528. declared combed. See the @option{combpel} parameter description for more info.
  5529. Possible values are any number that is a power of 2 starting at 4 and going up
  5530. to 512.
  5531. Default value is @code{16}.
  5532. @item combpel
  5533. The number of combed pixels inside any of the @option{blocky} by
  5534. @option{blockx} size blocks on the frame for the frame to be detected as
  5535. combed. While @option{cthresh} controls how "visible" the combing must be, this
  5536. setting controls "how much" combing there must be in any localized area (a
  5537. window defined by the @option{blockx} and @option{blocky} settings) on the
  5538. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  5539. which point no frames will ever be detected as combed). This setting is known
  5540. as @option{MI} in TFM/VFM vocabulary.
  5541. Default value is @code{80}.
  5542. @end table
  5543. @anchor{p/c/n/u/b meaning}
  5544. @subsection p/c/n/u/b meaning
  5545. @subsubsection p/c/n
  5546. We assume the following telecined stream:
  5547. @example
  5548. Top fields: 1 2 2 3 4
  5549. Bottom fields: 1 2 3 4 4
  5550. @end example
  5551. The numbers correspond to the progressive frame the fields relate to. Here, the
  5552. first two frames are progressive, the 3rd and 4th are combed, and so on.
  5553. When @code{fieldmatch} is configured to run a matching from bottom
  5554. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  5555. @example
  5556. Input stream:
  5557. T 1 2 2 3 4
  5558. B 1 2 3 4 4 <-- matching reference
  5559. Matches: c c n n c
  5560. Output stream:
  5561. T 1 2 3 4 4
  5562. B 1 2 3 4 4
  5563. @end example
  5564. As a result of the field matching, we can see that some frames get duplicated.
  5565. To perform a complete inverse telecine, you need to rely on a decimation filter
  5566. after this operation. See for instance the @ref{decimate} filter.
  5567. The same operation now matching from top fields (@option{field}=@var{top})
  5568. looks like this:
  5569. @example
  5570. Input stream:
  5571. T 1 2 2 3 4 <-- matching reference
  5572. B 1 2 3 4 4
  5573. Matches: c c p p c
  5574. Output stream:
  5575. T 1 2 2 3 4
  5576. B 1 2 2 3 4
  5577. @end example
  5578. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  5579. basically, they refer to the frame and field of the opposite parity:
  5580. @itemize
  5581. @item @var{p} matches the field of the opposite parity in the previous frame
  5582. @item @var{c} matches the field of the opposite parity in the current frame
  5583. @item @var{n} matches the field of the opposite parity in the next frame
  5584. @end itemize
  5585. @subsubsection u/b
  5586. The @var{u} and @var{b} matching are a bit special in the sense that they match
  5587. from the opposite parity flag. In the following examples, we assume that we are
  5588. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  5589. 'x' is placed above and below each matched fields.
  5590. With bottom matching (@option{field}=@var{bottom}):
  5591. @example
  5592. Match: c p n b u
  5593. x x x x x
  5594. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  5595. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  5596. x x x x x
  5597. Output frames:
  5598. 2 1 2 2 2
  5599. 2 2 2 1 3
  5600. @end example
  5601. With top matching (@option{field}=@var{top}):
  5602. @example
  5603. Match: c p n b u
  5604. x x x x x
  5605. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  5606. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  5607. x x x x x
  5608. Output frames:
  5609. 2 2 2 1 2
  5610. 2 1 3 2 2
  5611. @end example
  5612. @subsection Examples
  5613. Simple IVTC of a top field first telecined stream:
  5614. @example
  5615. fieldmatch=order=tff:combmatch=none, decimate
  5616. @end example
  5617. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  5618. @example
  5619. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  5620. @end example
  5621. @section fieldorder
  5622. Transform the field order of the input video.
  5623. It accepts the following parameters:
  5624. @table @option
  5625. @item order
  5626. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  5627. for bottom field first.
  5628. @end table
  5629. The default value is @samp{tff}.
  5630. The transformation is done by shifting the picture content up or down
  5631. by one line, and filling the remaining line with appropriate picture content.
  5632. This method is consistent with most broadcast field order converters.
  5633. If the input video is not flagged as being interlaced, or it is already
  5634. flagged as being of the required output field order, then this filter does
  5635. not alter the incoming video.
  5636. It is very useful when converting to or from PAL DV material,
  5637. which is bottom field first.
  5638. For example:
  5639. @example
  5640. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  5641. @end example
  5642. @section fifo, afifo
  5643. Buffer input images and send them when they are requested.
  5644. It is mainly useful when auto-inserted by the libavfilter
  5645. framework.
  5646. It does not take parameters.
  5647. @section find_rect
  5648. Find a rectangular object
  5649. It accepts the following options:
  5650. @table @option
  5651. @item object
  5652. Filepath of the object image, needs to be in gray8.
  5653. @item threshold
  5654. Detection threshold, default is 0.5.
  5655. @item mipmaps
  5656. Number of mipmaps, default is 3.
  5657. @item xmin, ymin, xmax, ymax
  5658. Specifies the rectangle in which to search.
  5659. @end table
  5660. @subsection Examples
  5661. @itemize
  5662. @item
  5663. Generate a representative palette of a given video using @command{ffmpeg}:
  5664. @example
  5665. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  5666. @end example
  5667. @end itemize
  5668. @section cover_rect
  5669. Cover a rectangular object
  5670. It accepts the following options:
  5671. @table @option
  5672. @item cover
  5673. Filepath of the optional cover image, needs to be in yuv420.
  5674. @item mode
  5675. Set covering mode.
  5676. It accepts the following values:
  5677. @table @samp
  5678. @item cover
  5679. cover it by the supplied image
  5680. @item blur
  5681. cover it by interpolating the surrounding pixels
  5682. @end table
  5683. Default value is @var{blur}.
  5684. @end table
  5685. @subsection Examples
  5686. @itemize
  5687. @item
  5688. Generate a representative palette of a given video using @command{ffmpeg}:
  5689. @example
  5690. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  5691. @end example
  5692. @end itemize
  5693. @anchor{format}
  5694. @section format
  5695. Convert the input video to one of the specified pixel formats.
  5696. Libavfilter will try to pick one that is suitable as input to
  5697. the next filter.
  5698. It accepts the following parameters:
  5699. @table @option
  5700. @item pix_fmts
  5701. A '|'-separated list of pixel format names, such as
  5702. "pix_fmts=yuv420p|monow|rgb24".
  5703. @end table
  5704. @subsection Examples
  5705. @itemize
  5706. @item
  5707. Convert the input video to the @var{yuv420p} format
  5708. @example
  5709. format=pix_fmts=yuv420p
  5710. @end example
  5711. Convert the input video to any of the formats in the list
  5712. @example
  5713. format=pix_fmts=yuv420p|yuv444p|yuv410p
  5714. @end example
  5715. @end itemize
  5716. @anchor{fps}
  5717. @section fps
  5718. Convert the video to specified constant frame rate by duplicating or dropping
  5719. frames as necessary.
  5720. It accepts the following parameters:
  5721. @table @option
  5722. @item fps
  5723. The desired output frame rate. The default is @code{25}.
  5724. @item round
  5725. Rounding method.
  5726. Possible values are:
  5727. @table @option
  5728. @item zero
  5729. zero round towards 0
  5730. @item inf
  5731. round away from 0
  5732. @item down
  5733. round towards -infinity
  5734. @item up
  5735. round towards +infinity
  5736. @item near
  5737. round to nearest
  5738. @end table
  5739. The default is @code{near}.
  5740. @item start_time
  5741. Assume the first PTS should be the given value, in seconds. This allows for
  5742. padding/trimming at the start of stream. By default, no assumption is made
  5743. about the first frame's expected PTS, so no padding or trimming is done.
  5744. For example, this could be set to 0 to pad the beginning with duplicates of
  5745. the first frame if a video stream starts after the audio stream or to trim any
  5746. frames with a negative PTS.
  5747. @end table
  5748. Alternatively, the options can be specified as a flat string:
  5749. @var{fps}[:@var{round}].
  5750. See also the @ref{setpts} filter.
  5751. @subsection Examples
  5752. @itemize
  5753. @item
  5754. A typical usage in order to set the fps to 25:
  5755. @example
  5756. fps=fps=25
  5757. @end example
  5758. @item
  5759. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  5760. @example
  5761. fps=fps=film:round=near
  5762. @end example
  5763. @end itemize
  5764. @section framepack
  5765. Pack two different video streams into a stereoscopic video, setting proper
  5766. metadata on supported codecs. The two views should have the same size and
  5767. framerate and processing will stop when the shorter video ends. Please note
  5768. that you may conveniently adjust view properties with the @ref{scale} and
  5769. @ref{fps} filters.
  5770. It accepts the following parameters:
  5771. @table @option
  5772. @item format
  5773. The desired packing format. Supported values are:
  5774. @table @option
  5775. @item sbs
  5776. The views are next to each other (default).
  5777. @item tab
  5778. The views are on top of each other.
  5779. @item lines
  5780. The views are packed by line.
  5781. @item columns
  5782. The views are packed by column.
  5783. @item frameseq
  5784. The views are temporally interleaved.
  5785. @end table
  5786. @end table
  5787. Some examples:
  5788. @example
  5789. # Convert left and right views into a frame-sequential video
  5790. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  5791. # Convert views into a side-by-side video with the same output resolution as the input
  5792. 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
  5793. @end example
  5794. @section framerate
  5795. Change the frame rate by interpolating new video output frames from the source
  5796. frames.
  5797. This filter is not designed to function correctly with interlaced media. If
  5798. you wish to change the frame rate of interlaced media then you are required
  5799. to deinterlace before this filter and re-interlace after this filter.
  5800. A description of the accepted options follows.
  5801. @table @option
  5802. @item fps
  5803. Specify the output frames per second. This option can also be specified
  5804. as a value alone. The default is @code{50}.
  5805. @item interp_start
  5806. Specify the start of a range where the output frame will be created as a
  5807. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  5808. the default is @code{15}.
  5809. @item interp_end
  5810. Specify the end of a range where the output frame will be created as a
  5811. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  5812. the default is @code{240}.
  5813. @item scene
  5814. Specify the level at which a scene change is detected as a value between
  5815. 0 and 100 to indicate a new scene; a low value reflects a low
  5816. probability for the current frame to introduce a new scene, while a higher
  5817. value means the current frame is more likely to be one.
  5818. The default is @code{7}.
  5819. @item flags
  5820. Specify flags influencing the filter process.
  5821. Available value for @var{flags} is:
  5822. @table @option
  5823. @item scene_change_detect, scd
  5824. Enable scene change detection using the value of the option @var{scene}.
  5825. This flag is enabled by default.
  5826. @end table
  5827. @end table
  5828. @section framestep
  5829. Select one frame every N-th frame.
  5830. This filter accepts the following option:
  5831. @table @option
  5832. @item step
  5833. Select frame after every @code{step} frames.
  5834. Allowed values are positive integers higher than 0. Default value is @code{1}.
  5835. @end table
  5836. @anchor{frei0r}
  5837. @section frei0r
  5838. Apply a frei0r effect to the input video.
  5839. To enable the compilation of this filter, you need to install the frei0r
  5840. header and configure FFmpeg with @code{--enable-frei0r}.
  5841. It accepts the following parameters:
  5842. @table @option
  5843. @item filter_name
  5844. The name of the frei0r effect to load. If the environment variable
  5845. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  5846. directories specified by the colon-separated list in @env{FREIOR_PATH}.
  5847. Otherwise, the standard frei0r paths are searched, in this order:
  5848. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  5849. @file{/usr/lib/frei0r-1/}.
  5850. @item filter_params
  5851. A '|'-separated list of parameters to pass to the frei0r effect.
  5852. @end table
  5853. A frei0r effect parameter can be a boolean (its value is either
  5854. "y" or "n"), a double, a color (specified as
  5855. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  5856. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  5857. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  5858. @var{X} and @var{Y} are floating point numbers) and/or a string.
  5859. The number and types of parameters depend on the loaded effect. If an
  5860. effect parameter is not specified, the default value is set.
  5861. @subsection Examples
  5862. @itemize
  5863. @item
  5864. Apply the distort0r effect, setting the first two double parameters:
  5865. @example
  5866. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  5867. @end example
  5868. @item
  5869. Apply the colordistance effect, taking a color as the first parameter:
  5870. @example
  5871. frei0r=colordistance:0.2/0.3/0.4
  5872. frei0r=colordistance:violet
  5873. frei0r=colordistance:0x112233
  5874. @end example
  5875. @item
  5876. Apply the perspective effect, specifying the top left and top right image
  5877. positions:
  5878. @example
  5879. frei0r=perspective:0.2/0.2|0.8/0.2
  5880. @end example
  5881. @end itemize
  5882. For more information, see
  5883. @url{http://frei0r.dyne.org}
  5884. @section fspp
  5885. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  5886. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  5887. processing filter, one of them is performed once per block, not per pixel.
  5888. This allows for much higher speed.
  5889. The filter accepts the following options:
  5890. @table @option
  5891. @item quality
  5892. Set quality. This option defines the number of levels for averaging. It accepts
  5893. an integer in the range 4-5. Default value is @code{4}.
  5894. @item qp
  5895. Force a constant quantization parameter. It accepts an integer in range 0-63.
  5896. If not set, the filter will use the QP from the video stream (if available).
  5897. @item strength
  5898. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  5899. more details but also more artifacts, while higher values make the image smoother
  5900. but also blurrier. Default value is @code{0} − PSNR optimal.
  5901. @item use_bframe_qp
  5902. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  5903. option may cause flicker since the B-Frames have often larger QP. Default is
  5904. @code{0} (not enabled).
  5905. @end table
  5906. @section geq
  5907. The filter accepts the following options:
  5908. @table @option
  5909. @item lum_expr, lum
  5910. Set the luminance expression.
  5911. @item cb_expr, cb
  5912. Set the chrominance blue expression.
  5913. @item cr_expr, cr
  5914. Set the chrominance red expression.
  5915. @item alpha_expr, a
  5916. Set the alpha expression.
  5917. @item red_expr, r
  5918. Set the red expression.
  5919. @item green_expr, g
  5920. Set the green expression.
  5921. @item blue_expr, b
  5922. Set the blue expression.
  5923. @end table
  5924. The colorspace is selected according to the specified options. If one
  5925. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  5926. options is specified, the filter will automatically select a YCbCr
  5927. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  5928. @option{blue_expr} options is specified, it will select an RGB
  5929. colorspace.
  5930. If one of the chrominance expression is not defined, it falls back on the other
  5931. one. If no alpha expression is specified it will evaluate to opaque value.
  5932. If none of chrominance expressions are specified, they will evaluate
  5933. to the luminance expression.
  5934. The expressions can use the following variables and functions:
  5935. @table @option
  5936. @item N
  5937. The sequential number of the filtered frame, starting from @code{0}.
  5938. @item X
  5939. @item Y
  5940. The coordinates of the current sample.
  5941. @item W
  5942. @item H
  5943. The width and height of the image.
  5944. @item SW
  5945. @item SH
  5946. Width and height scale depending on the currently filtered plane. It is the
  5947. ratio between the corresponding luma plane number of pixels and the current
  5948. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  5949. @code{0.5,0.5} for chroma planes.
  5950. @item T
  5951. Time of the current frame, expressed in seconds.
  5952. @item p(x, y)
  5953. Return the value of the pixel at location (@var{x},@var{y}) of the current
  5954. plane.
  5955. @item lum(x, y)
  5956. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  5957. plane.
  5958. @item cb(x, y)
  5959. Return the value of the pixel at location (@var{x},@var{y}) of the
  5960. blue-difference chroma plane. Return 0 if there is no such plane.
  5961. @item cr(x, y)
  5962. Return the value of the pixel at location (@var{x},@var{y}) of the
  5963. red-difference chroma plane. Return 0 if there is no such plane.
  5964. @item r(x, y)
  5965. @item g(x, y)
  5966. @item b(x, y)
  5967. Return the value of the pixel at location (@var{x},@var{y}) of the
  5968. red/green/blue component. Return 0 if there is no such component.
  5969. @item alpha(x, y)
  5970. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  5971. plane. Return 0 if there is no such plane.
  5972. @end table
  5973. For functions, if @var{x} and @var{y} are outside the area, the value will be
  5974. automatically clipped to the closer edge.
  5975. @subsection Examples
  5976. @itemize
  5977. @item
  5978. Flip the image horizontally:
  5979. @example
  5980. geq=p(W-X\,Y)
  5981. @end example
  5982. @item
  5983. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  5984. wavelength of 100 pixels:
  5985. @example
  5986. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  5987. @end example
  5988. @item
  5989. Generate a fancy enigmatic moving light:
  5990. @example
  5991. 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
  5992. @end example
  5993. @item
  5994. Generate a quick emboss effect:
  5995. @example
  5996. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  5997. @end example
  5998. @item
  5999. Modify RGB components depending on pixel position:
  6000. @example
  6001. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  6002. @end example
  6003. @item
  6004. Create a radial gradient that is the same size as the input (also see
  6005. the @ref{vignette} filter):
  6006. @example
  6007. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  6008. @end example
  6009. @end itemize
  6010. @section gradfun
  6011. Fix the banding artifacts that are sometimes introduced into nearly flat
  6012. regions by truncation to 8bit color depth.
  6013. Interpolate the gradients that should go where the bands are, and
  6014. dither them.
  6015. It is designed for playback only. Do not use it prior to
  6016. lossy compression, because compression tends to lose the dither and
  6017. bring back the bands.
  6018. It accepts the following parameters:
  6019. @table @option
  6020. @item strength
  6021. The maximum amount by which the filter will change any one pixel. This is also
  6022. the threshold for detecting nearly flat regions. Acceptable values range from
  6023. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  6024. valid range.
  6025. @item radius
  6026. The neighborhood to fit the gradient to. A larger radius makes for smoother
  6027. gradients, but also prevents the filter from modifying the pixels near detailed
  6028. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  6029. values will be clipped to the valid range.
  6030. @end table
  6031. Alternatively, the options can be specified as a flat string:
  6032. @var{strength}[:@var{radius}]
  6033. @subsection Examples
  6034. @itemize
  6035. @item
  6036. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  6037. @example
  6038. gradfun=3.5:8
  6039. @end example
  6040. @item
  6041. Specify radius, omitting the strength (which will fall-back to the default
  6042. value):
  6043. @example
  6044. gradfun=radius=8
  6045. @end example
  6046. @end itemize
  6047. @anchor{haldclut}
  6048. @section haldclut
  6049. Apply a Hald CLUT to a video stream.
  6050. First input is the video stream to process, and second one is the Hald CLUT.
  6051. The Hald CLUT input can be a simple picture or a complete video stream.
  6052. The filter accepts the following options:
  6053. @table @option
  6054. @item shortest
  6055. Force termination when the shortest input terminates. Default is @code{0}.
  6056. @item repeatlast
  6057. Continue applying the last CLUT after the end of the stream. A value of
  6058. @code{0} disable the filter after the last frame of the CLUT is reached.
  6059. Default is @code{1}.
  6060. @end table
  6061. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  6062. filters share the same internals).
  6063. More information about the Hald CLUT can be found on Eskil Steenberg's website
  6064. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  6065. @subsection Workflow examples
  6066. @subsubsection Hald CLUT video stream
  6067. Generate an identity Hald CLUT stream altered with various effects:
  6068. @example
  6069. 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
  6070. @end example
  6071. Note: make sure you use a lossless codec.
  6072. Then use it with @code{haldclut} to apply it on some random stream:
  6073. @example
  6074. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  6075. @end example
  6076. The Hald CLUT will be applied to the 10 first seconds (duration of
  6077. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  6078. to the remaining frames of the @code{mandelbrot} stream.
  6079. @subsubsection Hald CLUT with preview
  6080. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  6081. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  6082. biggest possible square starting at the top left of the picture. The remaining
  6083. padding pixels (bottom or right) will be ignored. This area can be used to add
  6084. a preview of the Hald CLUT.
  6085. Typically, the following generated Hald CLUT will be supported by the
  6086. @code{haldclut} filter:
  6087. @example
  6088. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  6089. pad=iw+320 [padded_clut];
  6090. smptebars=s=320x256, split [a][b];
  6091. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  6092. [main][b] overlay=W-320" -frames:v 1 clut.png
  6093. @end example
  6094. It contains the original and a preview of the effect of the CLUT: SMPTE color
  6095. bars are displayed on the right-top, and below the same color bars processed by
  6096. the color changes.
  6097. Then, the effect of this Hald CLUT can be visualized with:
  6098. @example
  6099. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  6100. @end example
  6101. @section hflip
  6102. Flip the input video horizontally.
  6103. For example, to horizontally flip the input video with @command{ffmpeg}:
  6104. @example
  6105. ffmpeg -i in.avi -vf "hflip" out.avi
  6106. @end example
  6107. @section histeq
  6108. This filter applies a global color histogram equalization on a
  6109. per-frame basis.
  6110. It can be used to correct video that has a compressed range of pixel
  6111. intensities. The filter redistributes the pixel intensities to
  6112. equalize their distribution across the intensity range. It may be
  6113. viewed as an "automatically adjusting contrast filter". This filter is
  6114. useful only for correcting degraded or poorly captured source
  6115. video.
  6116. The filter accepts the following options:
  6117. @table @option
  6118. @item strength
  6119. Determine the amount of equalization to be applied. As the strength
  6120. is reduced, the distribution of pixel intensities more-and-more
  6121. approaches that of the input frame. The value must be a float number
  6122. in the range [0,1] and defaults to 0.200.
  6123. @item intensity
  6124. Set the maximum intensity that can generated and scale the output
  6125. values appropriately. The strength should be set as desired and then
  6126. the intensity can be limited if needed to avoid washing-out. The value
  6127. must be a float number in the range [0,1] and defaults to 0.210.
  6128. @item antibanding
  6129. Set the antibanding level. If enabled the filter will randomly vary
  6130. the luminance of output pixels by a small amount to avoid banding of
  6131. the histogram. Possible values are @code{none}, @code{weak} or
  6132. @code{strong}. It defaults to @code{none}.
  6133. @end table
  6134. @section histogram
  6135. Compute and draw a color distribution histogram for the input video.
  6136. The computed histogram is a representation of the color component
  6137. distribution in an image.
  6138. Standard histogram displays the color components distribution in an image.
  6139. Displays color graph for each color component. Shows distribution of
  6140. the Y, U, V, A or R, G, B components, depending on input format, in the
  6141. current frame. Below each graph a color component scale meter is shown.
  6142. The filter accepts the following options:
  6143. @table @option
  6144. @item level_height
  6145. Set height of level. Default value is @code{200}.
  6146. Allowed range is [50, 2048].
  6147. @item scale_height
  6148. Set height of color scale. Default value is @code{12}.
  6149. Allowed range is [0, 40].
  6150. @item display_mode
  6151. Set display mode.
  6152. It accepts the following values:
  6153. @table @samp
  6154. @item parade
  6155. Per color component graphs are placed below each other.
  6156. @item overlay
  6157. Presents information identical to that in the @code{parade}, except
  6158. that the graphs representing color components are superimposed directly
  6159. over one another.
  6160. @end table
  6161. Default is @code{parade}.
  6162. @item levels_mode
  6163. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  6164. Default is @code{linear}.
  6165. @item components
  6166. Set what color components to display.
  6167. Default is @code{7}.
  6168. @end table
  6169. @subsection Examples
  6170. @itemize
  6171. @item
  6172. Calculate and draw histogram:
  6173. @example
  6174. ffplay -i input -vf histogram
  6175. @end example
  6176. @end itemize
  6177. @anchor{hqdn3d}
  6178. @section hqdn3d
  6179. This is a high precision/quality 3d denoise filter. It aims to reduce
  6180. image noise, producing smooth images and making still images really
  6181. still. It should enhance compressibility.
  6182. It accepts the following optional parameters:
  6183. @table @option
  6184. @item luma_spatial
  6185. A non-negative floating point number which specifies spatial luma strength.
  6186. It defaults to 4.0.
  6187. @item chroma_spatial
  6188. A non-negative floating point number which specifies spatial chroma strength.
  6189. It defaults to 3.0*@var{luma_spatial}/4.0.
  6190. @item luma_tmp
  6191. A floating point number which specifies luma temporal strength. It defaults to
  6192. 6.0*@var{luma_spatial}/4.0.
  6193. @item chroma_tmp
  6194. A floating point number which specifies chroma temporal strength. It defaults to
  6195. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  6196. @end table
  6197. @anchor{hwupload_cuda}
  6198. @section hwupload_cuda
  6199. Upload system memory frames to a CUDA device.
  6200. It accepts the following optional parameters:
  6201. @table @option
  6202. @item device
  6203. The number of the CUDA device to use
  6204. @end table
  6205. @section hqx
  6206. Apply a high-quality magnification filter designed for pixel art. This filter
  6207. was originally created by Maxim Stepin.
  6208. It accepts the following option:
  6209. @table @option
  6210. @item n
  6211. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  6212. @code{hq3x} and @code{4} for @code{hq4x}.
  6213. Default is @code{3}.
  6214. @end table
  6215. @section hstack
  6216. Stack input videos horizontally.
  6217. All streams must be of same pixel format and of same height.
  6218. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  6219. to create same output.
  6220. The filter accept the following option:
  6221. @table @option
  6222. @item inputs
  6223. Set number of input streams. Default is 2.
  6224. @item shortest
  6225. If set to 1, force the output to terminate when the shortest input
  6226. terminates. Default value is 0.
  6227. @end table
  6228. @section hue
  6229. Modify the hue and/or the saturation of the input.
  6230. It accepts the following parameters:
  6231. @table @option
  6232. @item h
  6233. Specify the hue angle as a number of degrees. It accepts an expression,
  6234. and defaults to "0".
  6235. @item s
  6236. Specify the saturation in the [-10,10] range. It accepts an expression and
  6237. defaults to "1".
  6238. @item H
  6239. Specify the hue angle as a number of radians. It accepts an
  6240. expression, and defaults to "0".
  6241. @item b
  6242. Specify the brightness in the [-10,10] range. It accepts an expression and
  6243. defaults to "0".
  6244. @end table
  6245. @option{h} and @option{H} are mutually exclusive, and can't be
  6246. specified at the same time.
  6247. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  6248. expressions containing the following constants:
  6249. @table @option
  6250. @item n
  6251. frame count of the input frame starting from 0
  6252. @item pts
  6253. presentation timestamp of the input frame expressed in time base units
  6254. @item r
  6255. frame rate of the input video, NAN if the input frame rate is unknown
  6256. @item t
  6257. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6258. @item tb
  6259. time base of the input video
  6260. @end table
  6261. @subsection Examples
  6262. @itemize
  6263. @item
  6264. Set the hue to 90 degrees and the saturation to 1.0:
  6265. @example
  6266. hue=h=90:s=1
  6267. @end example
  6268. @item
  6269. Same command but expressing the hue in radians:
  6270. @example
  6271. hue=H=PI/2:s=1
  6272. @end example
  6273. @item
  6274. Rotate hue and make the saturation swing between 0
  6275. and 2 over a period of 1 second:
  6276. @example
  6277. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  6278. @end example
  6279. @item
  6280. Apply a 3 seconds saturation fade-in effect starting at 0:
  6281. @example
  6282. hue="s=min(t/3\,1)"
  6283. @end example
  6284. The general fade-in expression can be written as:
  6285. @example
  6286. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  6287. @end example
  6288. @item
  6289. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  6290. @example
  6291. hue="s=max(0\, min(1\, (8-t)/3))"
  6292. @end example
  6293. The general fade-out expression can be written as:
  6294. @example
  6295. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  6296. @end example
  6297. @end itemize
  6298. @subsection Commands
  6299. This filter supports the following commands:
  6300. @table @option
  6301. @item b
  6302. @item s
  6303. @item h
  6304. @item H
  6305. Modify the hue and/or the saturation and/or brightness of the input video.
  6306. The command accepts the same syntax of the corresponding option.
  6307. If the specified expression is not valid, it is kept at its current
  6308. value.
  6309. @end table
  6310. @section idet
  6311. Detect video interlacing type.
  6312. This filter tries to detect if the input frames as interlaced, progressive,
  6313. top or bottom field first. It will also try and detect fields that are
  6314. repeated between adjacent frames (a sign of telecine).
  6315. Single frame detection considers only immediately adjacent frames when classifying each frame.
  6316. Multiple frame detection incorporates the classification history of previous frames.
  6317. The filter will log these metadata values:
  6318. @table @option
  6319. @item single.current_frame
  6320. Detected type of current frame using single-frame detection. One of:
  6321. ``tff'' (top field first), ``bff'' (bottom field first),
  6322. ``progressive'', or ``undetermined''
  6323. @item single.tff
  6324. Cumulative number of frames detected as top field first using single-frame detection.
  6325. @item multiple.tff
  6326. Cumulative number of frames detected as top field first using multiple-frame detection.
  6327. @item single.bff
  6328. Cumulative number of frames detected as bottom field first using single-frame detection.
  6329. @item multiple.current_frame
  6330. Detected type of current frame using multiple-frame detection. One of:
  6331. ``tff'' (top field first), ``bff'' (bottom field first),
  6332. ``progressive'', or ``undetermined''
  6333. @item multiple.bff
  6334. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  6335. @item single.progressive
  6336. Cumulative number of frames detected as progressive using single-frame detection.
  6337. @item multiple.progressive
  6338. Cumulative number of frames detected as progressive using multiple-frame detection.
  6339. @item single.undetermined
  6340. Cumulative number of frames that could not be classified using single-frame detection.
  6341. @item multiple.undetermined
  6342. Cumulative number of frames that could not be classified using multiple-frame detection.
  6343. @item repeated.current_frame
  6344. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  6345. @item repeated.neither
  6346. Cumulative number of frames with no repeated field.
  6347. @item repeated.top
  6348. Cumulative number of frames with the top field repeated from the previous frame's top field.
  6349. @item repeated.bottom
  6350. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  6351. @end table
  6352. The filter accepts the following options:
  6353. @table @option
  6354. @item intl_thres
  6355. Set interlacing threshold.
  6356. @item prog_thres
  6357. Set progressive threshold.
  6358. @item rep_thres
  6359. Threshold for repeated field detection.
  6360. @item half_life
  6361. Number of frames after which a given frame's contribution to the
  6362. statistics is halved (i.e., it contributes only 0.5 to it's
  6363. classification). The default of 0 means that all frames seen are given
  6364. full weight of 1.0 forever.
  6365. @item analyze_interlaced_flag
  6366. When this is not 0 then idet will use the specified number of frames to determine
  6367. if the interlaced flag is accurate, it will not count undetermined frames.
  6368. If the flag is found to be accurate it will be used without any further
  6369. computations, if it is found to be inaccurate it will be cleared without any
  6370. further computations. This allows inserting the idet filter as a low computational
  6371. method to clean up the interlaced flag
  6372. @end table
  6373. @section il
  6374. Deinterleave or interleave fields.
  6375. This filter allows one to process interlaced images fields without
  6376. deinterlacing them. Deinterleaving splits the input frame into 2
  6377. fields (so called half pictures). Odd lines are moved to the top
  6378. half of the output image, even lines to the bottom half.
  6379. You can process (filter) them independently and then re-interleave them.
  6380. The filter accepts the following options:
  6381. @table @option
  6382. @item luma_mode, l
  6383. @item chroma_mode, c
  6384. @item alpha_mode, a
  6385. Available values for @var{luma_mode}, @var{chroma_mode} and
  6386. @var{alpha_mode} are:
  6387. @table @samp
  6388. @item none
  6389. Do nothing.
  6390. @item deinterleave, d
  6391. Deinterleave fields, placing one above the other.
  6392. @item interleave, i
  6393. Interleave fields. Reverse the effect of deinterleaving.
  6394. @end table
  6395. Default value is @code{none}.
  6396. @item luma_swap, ls
  6397. @item chroma_swap, cs
  6398. @item alpha_swap, as
  6399. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  6400. @end table
  6401. @section inflate
  6402. Apply inflate effect to the video.
  6403. This filter replaces the pixel by the local(3x3) average by taking into account
  6404. only values higher than the pixel.
  6405. It accepts the following options:
  6406. @table @option
  6407. @item threshold0
  6408. @item threshold1
  6409. @item threshold2
  6410. @item threshold3
  6411. Limit the maximum change for each plane, default is 65535.
  6412. If 0, plane will remain unchanged.
  6413. @end table
  6414. @section interlace
  6415. Simple interlacing filter from progressive contents. This interleaves upper (or
  6416. lower) lines from odd frames with lower (or upper) lines from even frames,
  6417. halving the frame rate and preserving image height.
  6418. @example
  6419. Original Original New Frame
  6420. Frame 'j' Frame 'j+1' (tff)
  6421. ========== =========== ==================
  6422. Line 0 --------------------> Frame 'j' Line 0
  6423. Line 1 Line 1 ----> Frame 'j+1' Line 1
  6424. Line 2 ---------------------> Frame 'j' Line 2
  6425. Line 3 Line 3 ----> Frame 'j+1' Line 3
  6426. ... ... ...
  6427. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  6428. @end example
  6429. It accepts the following optional parameters:
  6430. @table @option
  6431. @item scan
  6432. This determines whether the interlaced frame is taken from the even
  6433. (tff - default) or odd (bff) lines of the progressive frame.
  6434. @item lowpass
  6435. Enable (default) or disable the vertical lowpass filter to avoid twitter
  6436. interlacing and reduce moire patterns.
  6437. @end table
  6438. @section kerndeint
  6439. Deinterlace input video by applying Donald Graft's adaptive kernel
  6440. deinterling. Work on interlaced parts of a video to produce
  6441. progressive frames.
  6442. The description of the accepted parameters follows.
  6443. @table @option
  6444. @item thresh
  6445. Set the threshold which affects the filter's tolerance when
  6446. determining if a pixel line must be processed. It must be an integer
  6447. in the range [0,255] and defaults to 10. A value of 0 will result in
  6448. applying the process on every pixels.
  6449. @item map
  6450. Paint pixels exceeding the threshold value to white if set to 1.
  6451. Default is 0.
  6452. @item order
  6453. Set the fields order. Swap fields if set to 1, leave fields alone if
  6454. 0. Default is 0.
  6455. @item sharp
  6456. Enable additional sharpening if set to 1. Default is 0.
  6457. @item twoway
  6458. Enable twoway sharpening if set to 1. Default is 0.
  6459. @end table
  6460. @subsection Examples
  6461. @itemize
  6462. @item
  6463. Apply default values:
  6464. @example
  6465. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  6466. @end example
  6467. @item
  6468. Enable additional sharpening:
  6469. @example
  6470. kerndeint=sharp=1
  6471. @end example
  6472. @item
  6473. Paint processed pixels in white:
  6474. @example
  6475. kerndeint=map=1
  6476. @end example
  6477. @end itemize
  6478. @section lenscorrection
  6479. Correct radial lens distortion
  6480. This filter can be used to correct for radial distortion as can result from the use
  6481. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  6482. one can use tools available for example as part of opencv or simply trial-and-error.
  6483. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  6484. and extract the k1 and k2 coefficients from the resulting matrix.
  6485. Note that effectively the same filter is available in the open-source tools Krita and
  6486. Digikam from the KDE project.
  6487. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  6488. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  6489. brightness distribution, so you may want to use both filters together in certain
  6490. cases, though you will have to take care of ordering, i.e. whether vignetting should
  6491. be applied before or after lens correction.
  6492. @subsection Options
  6493. The filter accepts the following options:
  6494. @table @option
  6495. @item cx
  6496. Relative x-coordinate of the focal point of the image, and thereby the center of the
  6497. distortion. This value has a range [0,1] and is expressed as fractions of the image
  6498. width.
  6499. @item cy
  6500. Relative y-coordinate of the focal point of the image, and thereby the center of the
  6501. distortion. This value has a range [0,1] and is expressed as fractions of the image
  6502. height.
  6503. @item k1
  6504. Coefficient of the quadratic correction term. 0.5 means no correction.
  6505. @item k2
  6506. Coefficient of the double quadratic correction term. 0.5 means no correction.
  6507. @end table
  6508. The formula that generates the correction is:
  6509. @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)
  6510. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  6511. distances from the focal point in the source and target images, respectively.
  6512. @section loop, aloop
  6513. Loop video frames or audio samples.
  6514. Those filters accepts the following options:
  6515. @table @option
  6516. @item loop
  6517. Set the number of loops.
  6518. @item size
  6519. Set maximal size in number of frames for @code{loop} filter or maximal number
  6520. of samples in case of @code{aloop} filter.
  6521. @item start
  6522. Set first frame of loop for @code{loop} filter or first sample of loop in case
  6523. of @code{aloop} filter.
  6524. @end table
  6525. @anchor{lut3d}
  6526. @section lut3d
  6527. Apply a 3D LUT to an input video.
  6528. The filter accepts the following options:
  6529. @table @option
  6530. @item file
  6531. Set the 3D LUT file name.
  6532. Currently supported formats:
  6533. @table @samp
  6534. @item 3dl
  6535. AfterEffects
  6536. @item cube
  6537. Iridas
  6538. @item dat
  6539. DaVinci
  6540. @item m3d
  6541. Pandora
  6542. @end table
  6543. @item interp
  6544. Select interpolation mode.
  6545. Available values are:
  6546. @table @samp
  6547. @item nearest
  6548. Use values from the nearest defined point.
  6549. @item trilinear
  6550. Interpolate values using the 8 points defining a cube.
  6551. @item tetrahedral
  6552. Interpolate values using a tetrahedron.
  6553. @end table
  6554. @end table
  6555. @section lut, lutrgb, lutyuv
  6556. Compute a look-up table for binding each pixel component input value
  6557. to an output value, and apply it to the input video.
  6558. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  6559. to an RGB input video.
  6560. These filters accept the following parameters:
  6561. @table @option
  6562. @item c0
  6563. set first pixel component expression
  6564. @item c1
  6565. set second pixel component expression
  6566. @item c2
  6567. set third pixel component expression
  6568. @item c3
  6569. set fourth pixel component expression, corresponds to the alpha component
  6570. @item r
  6571. set red component expression
  6572. @item g
  6573. set green component expression
  6574. @item b
  6575. set blue component expression
  6576. @item a
  6577. alpha component expression
  6578. @item y
  6579. set Y/luminance component expression
  6580. @item u
  6581. set U/Cb component expression
  6582. @item v
  6583. set V/Cr component expression
  6584. @end table
  6585. Each of them specifies the expression to use for computing the lookup table for
  6586. the corresponding pixel component values.
  6587. The exact component associated to each of the @var{c*} options depends on the
  6588. format in input.
  6589. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  6590. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  6591. The expressions can contain the following constants and functions:
  6592. @table @option
  6593. @item w
  6594. @item h
  6595. The input width and height.
  6596. @item val
  6597. The input value for the pixel component.
  6598. @item clipval
  6599. The input value, clipped to the @var{minval}-@var{maxval} range.
  6600. @item maxval
  6601. The maximum value for the pixel component.
  6602. @item minval
  6603. The minimum value for the pixel component.
  6604. @item negval
  6605. The negated value for the pixel component value, clipped to the
  6606. @var{minval}-@var{maxval} range; it corresponds to the expression
  6607. "maxval-clipval+minval".
  6608. @item clip(val)
  6609. The computed value in @var{val}, clipped to the
  6610. @var{minval}-@var{maxval} range.
  6611. @item gammaval(gamma)
  6612. The computed gamma correction value of the pixel component value,
  6613. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  6614. expression
  6615. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  6616. @end table
  6617. All expressions default to "val".
  6618. @subsection Examples
  6619. @itemize
  6620. @item
  6621. Negate input video:
  6622. @example
  6623. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  6624. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  6625. @end example
  6626. The above is the same as:
  6627. @example
  6628. lutrgb="r=negval:g=negval:b=negval"
  6629. lutyuv="y=negval:u=negval:v=negval"
  6630. @end example
  6631. @item
  6632. Negate luminance:
  6633. @example
  6634. lutyuv=y=negval
  6635. @end example
  6636. @item
  6637. Remove chroma components, turning the video into a graytone image:
  6638. @example
  6639. lutyuv="u=128:v=128"
  6640. @end example
  6641. @item
  6642. Apply a luma burning effect:
  6643. @example
  6644. lutyuv="y=2*val"
  6645. @end example
  6646. @item
  6647. Remove green and blue components:
  6648. @example
  6649. lutrgb="g=0:b=0"
  6650. @end example
  6651. @item
  6652. Set a constant alpha channel value on input:
  6653. @example
  6654. format=rgba,lutrgb=a="maxval-minval/2"
  6655. @end example
  6656. @item
  6657. Correct luminance gamma by a factor of 0.5:
  6658. @example
  6659. lutyuv=y=gammaval(0.5)
  6660. @end example
  6661. @item
  6662. Discard least significant bits of luma:
  6663. @example
  6664. lutyuv=y='bitand(val, 128+64+32)'
  6665. @end example
  6666. @end itemize
  6667. @section maskedmerge
  6668. Merge the first input stream with the second input stream using per pixel
  6669. weights in the third input stream.
  6670. A value of 0 in the third stream pixel component means that pixel component
  6671. from first stream is returned unchanged, while maximum value (eg. 255 for
  6672. 8-bit videos) means that pixel component from second stream is returned
  6673. unchanged. Intermediate values define the amount of merging between both
  6674. input stream's pixel components.
  6675. This filter accepts the following options:
  6676. @table @option
  6677. @item planes
  6678. Set which planes will be processed as bitmap, unprocessed planes will be
  6679. copied from first stream.
  6680. By default value 0xf, all planes will be processed.
  6681. @end table
  6682. @section mcdeint
  6683. Apply motion-compensation deinterlacing.
  6684. It needs one field per frame as input and must thus be used together
  6685. with yadif=1/3 or equivalent.
  6686. This filter accepts the following options:
  6687. @table @option
  6688. @item mode
  6689. Set the deinterlacing mode.
  6690. It accepts one of the following values:
  6691. @table @samp
  6692. @item fast
  6693. @item medium
  6694. @item slow
  6695. use iterative motion estimation
  6696. @item extra_slow
  6697. like @samp{slow}, but use multiple reference frames.
  6698. @end table
  6699. Default value is @samp{fast}.
  6700. @item parity
  6701. Set the picture field parity assumed for the input video. It must be
  6702. one of the following values:
  6703. @table @samp
  6704. @item 0, tff
  6705. assume top field first
  6706. @item 1, bff
  6707. assume bottom field first
  6708. @end table
  6709. Default value is @samp{bff}.
  6710. @item qp
  6711. Set per-block quantization parameter (QP) used by the internal
  6712. encoder.
  6713. Higher values should result in a smoother motion vector field but less
  6714. optimal individual vectors. Default value is 1.
  6715. @end table
  6716. @section mergeplanes
  6717. Merge color channel components from several video streams.
  6718. The filter accepts up to 4 input streams, and merge selected input
  6719. planes to the output video.
  6720. This filter accepts the following options:
  6721. @table @option
  6722. @item mapping
  6723. Set input to output plane mapping. Default is @code{0}.
  6724. The mappings is specified as a bitmap. It should be specified as a
  6725. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  6726. mapping for the first plane of the output stream. 'A' sets the number of
  6727. the input stream to use (from 0 to 3), and 'a' the plane number of the
  6728. corresponding input to use (from 0 to 3). The rest of the mappings is
  6729. similar, 'Bb' describes the mapping for the output stream second
  6730. plane, 'Cc' describes the mapping for the output stream third plane and
  6731. 'Dd' describes the mapping for the output stream fourth plane.
  6732. @item format
  6733. Set output pixel format. Default is @code{yuva444p}.
  6734. @end table
  6735. @subsection Examples
  6736. @itemize
  6737. @item
  6738. Merge three gray video streams of same width and height into single video stream:
  6739. @example
  6740. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  6741. @end example
  6742. @item
  6743. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  6744. @example
  6745. [a0][a1]mergeplanes=0x00010210:yuva444p
  6746. @end example
  6747. @item
  6748. Swap Y and A plane in yuva444p stream:
  6749. @example
  6750. format=yuva444p,mergeplanes=0x03010200:yuva444p
  6751. @end example
  6752. @item
  6753. Swap U and V plane in yuv420p stream:
  6754. @example
  6755. format=yuv420p,mergeplanes=0x000201:yuv420p
  6756. @end example
  6757. @item
  6758. Cast a rgb24 clip to yuv444p:
  6759. @example
  6760. format=rgb24,mergeplanes=0x000102:yuv444p
  6761. @end example
  6762. @end itemize
  6763. @section metadata, ametadata
  6764. Manipulate frame metadata.
  6765. This filter accepts the following options:
  6766. @table @option
  6767. @item mode
  6768. Set mode of operation of the filter.
  6769. Can be one of the following:
  6770. @table @samp
  6771. @item select
  6772. If both @code{value} and @code{key} is set, select frames
  6773. which have such metadata. If only @code{key} is set, select
  6774. every frame that has such key in metadata.
  6775. @item add
  6776. Add new metadata @code{key} and @code{value}. If key is already available
  6777. do nothing.
  6778. @item modify
  6779. Modify value of already present key.
  6780. @item delete
  6781. If @code{value} is set, delete only keys that have such value.
  6782. Otherwise, delete key.
  6783. @item print
  6784. Print key and its value if metadata was found. If @code{key} is not set print all
  6785. metadata values available in frame.
  6786. @end table
  6787. @item key
  6788. Set key used with all modes. Must be set for all modes except @code{print}.
  6789. @item value
  6790. Set metadata value which will be used. This option is mandatory for
  6791. @code{modify} and @code{add} mode.
  6792. @item function
  6793. Which function to use when comparing metadata value and @code{value}.
  6794. Can be one of following:
  6795. @table @samp
  6796. @item same_str
  6797. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  6798. @item starts_with
  6799. Values are interpreted as strings, returns true if metadata value starts with
  6800. the @code{value} option string.
  6801. @item less
  6802. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  6803. @item equal
  6804. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  6805. @item greater
  6806. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  6807. @item expr
  6808. Values are interpreted as floats, returns true if expression from option @code{expr}
  6809. evaluates to true.
  6810. @end table
  6811. @item expr
  6812. Set expression which is used when @code{function} is set to @code{expr}.
  6813. The expression is evaluated through the eval API and can contain the following
  6814. constants:
  6815. @table @option
  6816. @item VALUE1
  6817. Float representation of @code{value} from metadata key.
  6818. @item VALUE2
  6819. Float representation of @code{value} as supplied by user in @code{value} option.
  6820. @end table
  6821. @item file
  6822. If specified in @code{print} mode, output is written to the named file. When
  6823. filename equals "-" data is written to standard output.
  6824. If @code{file} option is not set, output is written to the log with AV_LOG_INFO
  6825. loglevel.
  6826. @end table
  6827. @subsection Examples
  6828. @itemize
  6829. @item
  6830. Print all metadata values for frames with key @code{lavfi.singnalstats.YDIF} with values
  6831. between 0 and 1.
  6832. @example
  6833. @end example
  6834. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  6835. @end itemize
  6836. @section mpdecimate
  6837. Drop frames that do not differ greatly from the previous frame in
  6838. order to reduce frame rate.
  6839. The main use of this filter is for very-low-bitrate encoding
  6840. (e.g. streaming over dialup modem), but it could in theory be used for
  6841. fixing movies that were inverse-telecined incorrectly.
  6842. A description of the accepted options follows.
  6843. @table @option
  6844. @item max
  6845. Set the maximum number of consecutive frames which can be dropped (if
  6846. positive), or the minimum interval between dropped frames (if
  6847. negative). If the value is 0, the frame is dropped unregarding the
  6848. number of previous sequentially dropped frames.
  6849. Default value is 0.
  6850. @item hi
  6851. @item lo
  6852. @item frac
  6853. Set the dropping threshold values.
  6854. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  6855. represent actual pixel value differences, so a threshold of 64
  6856. corresponds to 1 unit of difference for each pixel, or the same spread
  6857. out differently over the block.
  6858. A frame is a candidate for dropping if no 8x8 blocks differ by more
  6859. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  6860. meaning the whole image) differ by more than a threshold of @option{lo}.
  6861. Default value for @option{hi} is 64*12, default value for @option{lo} is
  6862. 64*5, and default value for @option{frac} is 0.33.
  6863. @end table
  6864. @section negate
  6865. Negate input video.
  6866. It accepts an integer in input; if non-zero it negates the
  6867. alpha component (if available). The default value in input is 0.
  6868. @section nnedi
  6869. Deinterlace video using neural network edge directed interpolation.
  6870. This filter accepts the following options:
  6871. @table @option
  6872. @item weights
  6873. Mandatory option, without binary file filter can not work.
  6874. Currently file can be found here:
  6875. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  6876. @item deint
  6877. Set which frames to deinterlace, by default it is @code{all}.
  6878. Can be @code{all} or @code{interlaced}.
  6879. @item field
  6880. Set mode of operation.
  6881. Can be one of the following:
  6882. @table @samp
  6883. @item af
  6884. Use frame flags, both fields.
  6885. @item a
  6886. Use frame flags, single field.
  6887. @item t
  6888. Use top field only.
  6889. @item b
  6890. Use bottom field only.
  6891. @item tf
  6892. Use both fields, top first.
  6893. @item bf
  6894. Use both fields, bottom first.
  6895. @end table
  6896. @item planes
  6897. Set which planes to process, by default filter process all frames.
  6898. @item nsize
  6899. Set size of local neighborhood around each pixel, used by the predictor neural
  6900. network.
  6901. Can be one of the following:
  6902. @table @samp
  6903. @item s8x6
  6904. @item s16x6
  6905. @item s32x6
  6906. @item s48x6
  6907. @item s8x4
  6908. @item s16x4
  6909. @item s32x4
  6910. @end table
  6911. @item nns
  6912. Set the number of neurons in predicctor neural network.
  6913. Can be one of the following:
  6914. @table @samp
  6915. @item n16
  6916. @item n32
  6917. @item n64
  6918. @item n128
  6919. @item n256
  6920. @end table
  6921. @item qual
  6922. Controls the number of different neural network predictions that are blended
  6923. together to compute the final output value. Can be @code{fast}, default or
  6924. @code{slow}.
  6925. @item etype
  6926. Set which set of weights to use in the predictor.
  6927. Can be one of the following:
  6928. @table @samp
  6929. @item a
  6930. weights trained to minimize absolute error
  6931. @item s
  6932. weights trained to minimize squared error
  6933. @end table
  6934. @item pscrn
  6935. Controls whether or not the prescreener neural network is used to decide
  6936. which pixels should be processed by the predictor neural network and which
  6937. can be handled by simple cubic interpolation.
  6938. The prescreener is trained to know whether cubic interpolation will be
  6939. sufficient for a pixel or whether it should be predicted by the predictor nn.
  6940. The computational complexity of the prescreener nn is much less than that of
  6941. the predictor nn. Since most pixels can be handled by cubic interpolation,
  6942. using the prescreener generally results in much faster processing.
  6943. The prescreener is pretty accurate, so the difference between using it and not
  6944. using it is almost always unnoticeable.
  6945. Can be one of the following:
  6946. @table @samp
  6947. @item none
  6948. @item original
  6949. @item new
  6950. @end table
  6951. Default is @code{new}.
  6952. @item fapprox
  6953. Set various debugging flags.
  6954. @end table
  6955. @section noformat
  6956. Force libavfilter not to use any of the specified pixel formats for the
  6957. input to the next filter.
  6958. It accepts the following parameters:
  6959. @table @option
  6960. @item pix_fmts
  6961. A '|'-separated list of pixel format names, such as
  6962. apix_fmts=yuv420p|monow|rgb24".
  6963. @end table
  6964. @subsection Examples
  6965. @itemize
  6966. @item
  6967. Force libavfilter to use a format different from @var{yuv420p} for the
  6968. input to the vflip filter:
  6969. @example
  6970. noformat=pix_fmts=yuv420p,vflip
  6971. @end example
  6972. @item
  6973. Convert the input video to any of the formats not contained in the list:
  6974. @example
  6975. noformat=yuv420p|yuv444p|yuv410p
  6976. @end example
  6977. @end itemize
  6978. @section noise
  6979. Add noise on video input frame.
  6980. The filter accepts the following options:
  6981. @table @option
  6982. @item all_seed
  6983. @item c0_seed
  6984. @item c1_seed
  6985. @item c2_seed
  6986. @item c3_seed
  6987. Set noise seed for specific pixel component or all pixel components in case
  6988. of @var{all_seed}. Default value is @code{123457}.
  6989. @item all_strength, alls
  6990. @item c0_strength, c0s
  6991. @item c1_strength, c1s
  6992. @item c2_strength, c2s
  6993. @item c3_strength, c3s
  6994. Set noise strength for specific pixel component or all pixel components in case
  6995. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  6996. @item all_flags, allf
  6997. @item c0_flags, c0f
  6998. @item c1_flags, c1f
  6999. @item c2_flags, c2f
  7000. @item c3_flags, c3f
  7001. Set pixel component flags or set flags for all components if @var{all_flags}.
  7002. Available values for component flags are:
  7003. @table @samp
  7004. @item a
  7005. averaged temporal noise (smoother)
  7006. @item p
  7007. mix random noise with a (semi)regular pattern
  7008. @item t
  7009. temporal noise (noise pattern changes between frames)
  7010. @item u
  7011. uniform noise (gaussian otherwise)
  7012. @end table
  7013. @end table
  7014. @subsection Examples
  7015. Add temporal and uniform noise to input video:
  7016. @example
  7017. noise=alls=20:allf=t+u
  7018. @end example
  7019. @section null
  7020. Pass the video source unchanged to the output.
  7021. @section ocr
  7022. Optical Character Recognition
  7023. This filter uses Tesseract for optical character recognition.
  7024. It accepts the following options:
  7025. @table @option
  7026. @item datapath
  7027. Set datapath to tesseract data. Default is to use whatever was
  7028. set at installation.
  7029. @item language
  7030. Set language, default is "eng".
  7031. @item whitelist
  7032. Set character whitelist.
  7033. @item blacklist
  7034. Set character blacklist.
  7035. @end table
  7036. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  7037. @section ocv
  7038. Apply a video transform using libopencv.
  7039. To enable this filter, install the libopencv library and headers and
  7040. configure FFmpeg with @code{--enable-libopencv}.
  7041. It accepts the following parameters:
  7042. @table @option
  7043. @item filter_name
  7044. The name of the libopencv filter to apply.
  7045. @item filter_params
  7046. The parameters to pass to the libopencv filter. If not specified, the default
  7047. values are assumed.
  7048. @end table
  7049. Refer to the official libopencv documentation for more precise
  7050. information:
  7051. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  7052. Several libopencv filters are supported; see the following subsections.
  7053. @anchor{dilate}
  7054. @subsection dilate
  7055. Dilate an image by using a specific structuring element.
  7056. It corresponds to the libopencv function @code{cvDilate}.
  7057. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  7058. @var{struct_el} represents a structuring element, and has the syntax:
  7059. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  7060. @var{cols} and @var{rows} represent the number of columns and rows of
  7061. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  7062. point, and @var{shape} the shape for the structuring element. @var{shape}
  7063. must be "rect", "cross", "ellipse", or "custom".
  7064. If the value for @var{shape} is "custom", it must be followed by a
  7065. string of the form "=@var{filename}". The file with name
  7066. @var{filename} is assumed to represent a binary image, with each
  7067. printable character corresponding to a bright pixel. When a custom
  7068. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  7069. or columns and rows of the read file are assumed instead.
  7070. The default value for @var{struct_el} is "3x3+0x0/rect".
  7071. @var{nb_iterations} specifies the number of times the transform is
  7072. applied to the image, and defaults to 1.
  7073. Some examples:
  7074. @example
  7075. # Use the default values
  7076. ocv=dilate
  7077. # Dilate using a structuring element with a 5x5 cross, iterating two times
  7078. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  7079. # Read the shape from the file diamond.shape, iterating two times.
  7080. # The file diamond.shape may contain a pattern of characters like this
  7081. # *
  7082. # ***
  7083. # *****
  7084. # ***
  7085. # *
  7086. # The specified columns and rows are ignored
  7087. # but the anchor point coordinates are not
  7088. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  7089. @end example
  7090. @subsection erode
  7091. Erode an image by using a specific structuring element.
  7092. It corresponds to the libopencv function @code{cvErode}.
  7093. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  7094. with the same syntax and semantics as the @ref{dilate} filter.
  7095. @subsection smooth
  7096. Smooth the input video.
  7097. The filter takes the following parameters:
  7098. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  7099. @var{type} is the type of smooth filter to apply, and must be one of
  7100. the following values: "blur", "blur_no_scale", "median", "gaussian",
  7101. or "bilateral". The default value is "gaussian".
  7102. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  7103. depend on the smooth type. @var{param1} and
  7104. @var{param2} accept integer positive values or 0. @var{param3} and
  7105. @var{param4} accept floating point values.
  7106. The default value for @var{param1} is 3. The default value for the
  7107. other parameters is 0.
  7108. These parameters correspond to the parameters assigned to the
  7109. libopencv function @code{cvSmooth}.
  7110. @anchor{overlay}
  7111. @section overlay
  7112. Overlay one video on top of another.
  7113. It takes two inputs and has one output. The first input is the "main"
  7114. video on which the second input is overlaid.
  7115. It accepts the following parameters:
  7116. A description of the accepted options follows.
  7117. @table @option
  7118. @item x
  7119. @item y
  7120. Set the expression for the x and y coordinates of the overlaid video
  7121. on the main video. Default value is "0" for both expressions. In case
  7122. the expression is invalid, it is set to a huge value (meaning that the
  7123. overlay will not be displayed within the output visible area).
  7124. @item eof_action
  7125. The action to take when EOF is encountered on the secondary input; it accepts
  7126. one of the following values:
  7127. @table @option
  7128. @item repeat
  7129. Repeat the last frame (the default).
  7130. @item endall
  7131. End both streams.
  7132. @item pass
  7133. Pass the main input through.
  7134. @end table
  7135. @item eval
  7136. Set when the expressions for @option{x}, and @option{y} are evaluated.
  7137. It accepts the following values:
  7138. @table @samp
  7139. @item init
  7140. only evaluate expressions once during the filter initialization or
  7141. when a command is processed
  7142. @item frame
  7143. evaluate expressions for each incoming frame
  7144. @end table
  7145. Default value is @samp{frame}.
  7146. @item shortest
  7147. If set to 1, force the output to terminate when the shortest input
  7148. terminates. Default value is 0.
  7149. @item format
  7150. Set the format for the output video.
  7151. It accepts the following values:
  7152. @table @samp
  7153. @item yuv420
  7154. force YUV420 output
  7155. @item yuv422
  7156. force YUV422 output
  7157. @item yuv444
  7158. force YUV444 output
  7159. @item rgb
  7160. force RGB output
  7161. @end table
  7162. Default value is @samp{yuv420}.
  7163. @item rgb @emph{(deprecated)}
  7164. If set to 1, force the filter to accept inputs in the RGB
  7165. color space. Default value is 0. This option is deprecated, use
  7166. @option{format} instead.
  7167. @item repeatlast
  7168. If set to 1, force the filter to draw the last overlay frame over the
  7169. main input until the end of the stream. A value of 0 disables this
  7170. behavior. Default value is 1.
  7171. @end table
  7172. The @option{x}, and @option{y} expressions can contain the following
  7173. parameters.
  7174. @table @option
  7175. @item main_w, W
  7176. @item main_h, H
  7177. The main input width and height.
  7178. @item overlay_w, w
  7179. @item overlay_h, h
  7180. The overlay input width and height.
  7181. @item x
  7182. @item y
  7183. The computed values for @var{x} and @var{y}. They are evaluated for
  7184. each new frame.
  7185. @item hsub
  7186. @item vsub
  7187. horizontal and vertical chroma subsample values of the output
  7188. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  7189. @var{vsub} is 1.
  7190. @item n
  7191. the number of input frame, starting from 0
  7192. @item pos
  7193. the position in the file of the input frame, NAN if unknown
  7194. @item t
  7195. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  7196. @end table
  7197. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  7198. when evaluation is done @emph{per frame}, and will evaluate to NAN
  7199. when @option{eval} is set to @samp{init}.
  7200. Be aware that frames are taken from each input video in timestamp
  7201. order, hence, if their initial timestamps differ, it is a good idea
  7202. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  7203. have them begin in the same zero timestamp, as the example for
  7204. the @var{movie} filter does.
  7205. You can chain together more overlays but you should test the
  7206. efficiency of such approach.
  7207. @subsection Commands
  7208. This filter supports the following commands:
  7209. @table @option
  7210. @item x
  7211. @item y
  7212. Modify the x and y of the overlay input.
  7213. The command accepts the same syntax of the corresponding option.
  7214. If the specified expression is not valid, it is kept at its current
  7215. value.
  7216. @end table
  7217. @subsection Examples
  7218. @itemize
  7219. @item
  7220. Draw the overlay at 10 pixels from the bottom right corner of the main
  7221. video:
  7222. @example
  7223. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  7224. @end example
  7225. Using named options the example above becomes:
  7226. @example
  7227. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  7228. @end example
  7229. @item
  7230. Insert a transparent PNG logo in the bottom left corner of the input,
  7231. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  7232. @example
  7233. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  7234. @end example
  7235. @item
  7236. Insert 2 different transparent PNG logos (second logo on bottom
  7237. right corner) using the @command{ffmpeg} tool:
  7238. @example
  7239. 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
  7240. @end example
  7241. @item
  7242. Add a transparent color layer on top of the main video; @code{WxH}
  7243. must specify the size of the main input to the overlay filter:
  7244. @example
  7245. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  7246. @end example
  7247. @item
  7248. Play an original video and a filtered version (here with the deshake
  7249. filter) side by side using the @command{ffplay} tool:
  7250. @example
  7251. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  7252. @end example
  7253. The above command is the same as:
  7254. @example
  7255. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  7256. @end example
  7257. @item
  7258. Make a sliding overlay appearing from the left to the right top part of the
  7259. screen starting since time 2:
  7260. @example
  7261. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  7262. @end example
  7263. @item
  7264. Compose output by putting two input videos side to side:
  7265. @example
  7266. ffmpeg -i left.avi -i right.avi -filter_complex "
  7267. nullsrc=size=200x100 [background];
  7268. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  7269. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  7270. [background][left] overlay=shortest=1 [background+left];
  7271. [background+left][right] overlay=shortest=1:x=100 [left+right]
  7272. "
  7273. @end example
  7274. @item
  7275. Mask 10-20 seconds of a video by applying the delogo filter to a section
  7276. @example
  7277. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  7278. -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]'
  7279. masked.avi
  7280. @end example
  7281. @item
  7282. Chain several overlays in cascade:
  7283. @example
  7284. nullsrc=s=200x200 [bg];
  7285. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  7286. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  7287. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  7288. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  7289. [in3] null, [mid2] overlay=100:100 [out0]
  7290. @end example
  7291. @end itemize
  7292. @section owdenoise
  7293. Apply Overcomplete Wavelet denoiser.
  7294. The filter accepts the following options:
  7295. @table @option
  7296. @item depth
  7297. Set depth.
  7298. Larger depth values will denoise lower frequency components more, but
  7299. slow down filtering.
  7300. Must be an int in the range 8-16, default is @code{8}.
  7301. @item luma_strength, ls
  7302. Set luma strength.
  7303. Must be a double value in the range 0-1000, default is @code{1.0}.
  7304. @item chroma_strength, cs
  7305. Set chroma strength.
  7306. Must be a double value in the range 0-1000, default is @code{1.0}.
  7307. @end table
  7308. @anchor{pad}
  7309. @section pad
  7310. Add paddings to the input image, and place the original input at the
  7311. provided @var{x}, @var{y} coordinates.
  7312. It accepts the following parameters:
  7313. @table @option
  7314. @item width, w
  7315. @item height, h
  7316. Specify an expression for the size of the output image with the
  7317. paddings added. If the value for @var{width} or @var{height} is 0, the
  7318. corresponding input size is used for the output.
  7319. The @var{width} expression can reference the value set by the
  7320. @var{height} expression, and vice versa.
  7321. The default value of @var{width} and @var{height} is 0.
  7322. @item x
  7323. @item y
  7324. Specify the offsets to place the input image at within the padded area,
  7325. with respect to the top/left border of the output image.
  7326. The @var{x} expression can reference the value set by the @var{y}
  7327. expression, and vice versa.
  7328. The default value of @var{x} and @var{y} is 0.
  7329. @item color
  7330. Specify the color of the padded area. For the syntax of this option,
  7331. check the "Color" section in the ffmpeg-utils manual.
  7332. The default value of @var{color} is "black".
  7333. @end table
  7334. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  7335. options are expressions containing the following constants:
  7336. @table @option
  7337. @item in_w
  7338. @item in_h
  7339. The input video width and height.
  7340. @item iw
  7341. @item ih
  7342. These are the same as @var{in_w} and @var{in_h}.
  7343. @item out_w
  7344. @item out_h
  7345. The output width and height (the size of the padded area), as
  7346. specified by the @var{width} and @var{height} expressions.
  7347. @item ow
  7348. @item oh
  7349. These are the same as @var{out_w} and @var{out_h}.
  7350. @item x
  7351. @item y
  7352. The x and y offsets as specified by the @var{x} and @var{y}
  7353. expressions, or NAN if not yet specified.
  7354. @item a
  7355. same as @var{iw} / @var{ih}
  7356. @item sar
  7357. input sample aspect ratio
  7358. @item dar
  7359. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  7360. @item hsub
  7361. @item vsub
  7362. The horizontal and vertical chroma subsample values. For example for the
  7363. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7364. @end table
  7365. @subsection Examples
  7366. @itemize
  7367. @item
  7368. Add paddings with the color "violet" to the input video. The output video
  7369. size is 640x480, and the top-left corner of the input video is placed at
  7370. column 0, row 40
  7371. @example
  7372. pad=640:480:0:40:violet
  7373. @end example
  7374. The example above is equivalent to the following command:
  7375. @example
  7376. pad=width=640:height=480:x=0:y=40:color=violet
  7377. @end example
  7378. @item
  7379. Pad the input to get an output with dimensions increased by 3/2,
  7380. and put the input video at the center of the padded area:
  7381. @example
  7382. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  7383. @end example
  7384. @item
  7385. Pad the input to get a squared output with size equal to the maximum
  7386. value between the input width and height, and put the input video at
  7387. the center of the padded area:
  7388. @example
  7389. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  7390. @end example
  7391. @item
  7392. Pad the input to get a final w/h ratio of 16:9:
  7393. @example
  7394. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  7395. @end example
  7396. @item
  7397. In case of anamorphic video, in order to set the output display aspect
  7398. correctly, it is necessary to use @var{sar} in the expression,
  7399. according to the relation:
  7400. @example
  7401. (ih * X / ih) * sar = output_dar
  7402. X = output_dar / sar
  7403. @end example
  7404. Thus the previous example needs to be modified to:
  7405. @example
  7406. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  7407. @end example
  7408. @item
  7409. Double the output size and put the input video in the bottom-right
  7410. corner of the output padded area:
  7411. @example
  7412. pad="2*iw:2*ih:ow-iw:oh-ih"
  7413. @end example
  7414. @end itemize
  7415. @anchor{palettegen}
  7416. @section palettegen
  7417. Generate one palette for a whole video stream.
  7418. It accepts the following options:
  7419. @table @option
  7420. @item max_colors
  7421. Set the maximum number of colors to quantize in the palette.
  7422. Note: the palette will still contain 256 colors; the unused palette entries
  7423. will be black.
  7424. @item reserve_transparent
  7425. Create a palette of 255 colors maximum and reserve the last one for
  7426. transparency. Reserving the transparency color is useful for GIF optimization.
  7427. If not set, the maximum of colors in the palette will be 256. You probably want
  7428. to disable this option for a standalone image.
  7429. Set by default.
  7430. @item stats_mode
  7431. Set statistics mode.
  7432. It accepts the following values:
  7433. @table @samp
  7434. @item full
  7435. Compute full frame histograms.
  7436. @item diff
  7437. Compute histograms only for the part that differs from previous frame. This
  7438. might be relevant to give more importance to the moving part of your input if
  7439. the background is static.
  7440. @end table
  7441. Default value is @var{full}.
  7442. @end table
  7443. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  7444. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  7445. color quantization of the palette. This information is also visible at
  7446. @var{info} logging level.
  7447. @subsection Examples
  7448. @itemize
  7449. @item
  7450. Generate a representative palette of a given video using @command{ffmpeg}:
  7451. @example
  7452. ffmpeg -i input.mkv -vf palettegen palette.png
  7453. @end example
  7454. @end itemize
  7455. @section paletteuse
  7456. Use a palette to downsample an input video stream.
  7457. The filter takes two inputs: one video stream and a palette. The palette must
  7458. be a 256 pixels image.
  7459. It accepts the following options:
  7460. @table @option
  7461. @item dither
  7462. Select dithering mode. Available algorithms are:
  7463. @table @samp
  7464. @item bayer
  7465. Ordered 8x8 bayer dithering (deterministic)
  7466. @item heckbert
  7467. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  7468. Note: this dithering is sometimes considered "wrong" and is included as a
  7469. reference.
  7470. @item floyd_steinberg
  7471. Floyd and Steingberg dithering (error diffusion)
  7472. @item sierra2
  7473. Frankie Sierra dithering v2 (error diffusion)
  7474. @item sierra2_4a
  7475. Frankie Sierra dithering v2 "Lite" (error diffusion)
  7476. @end table
  7477. Default is @var{sierra2_4a}.
  7478. @item bayer_scale
  7479. When @var{bayer} dithering is selected, this option defines the scale of the
  7480. pattern (how much the crosshatch pattern is visible). A low value means more
  7481. visible pattern for less banding, and higher value means less visible pattern
  7482. at the cost of more banding.
  7483. The option must be an integer value in the range [0,5]. Default is @var{2}.
  7484. @item diff_mode
  7485. If set, define the zone to process
  7486. @table @samp
  7487. @item rectangle
  7488. Only the changing rectangle will be reprocessed. This is similar to GIF
  7489. cropping/offsetting compression mechanism. This option can be useful for speed
  7490. if only a part of the image is changing, and has use cases such as limiting the
  7491. scope of the error diffusal @option{dither} to the rectangle that bounds the
  7492. moving scene (it leads to more deterministic output if the scene doesn't change
  7493. much, and as a result less moving noise and better GIF compression).
  7494. @end table
  7495. Default is @var{none}.
  7496. @end table
  7497. @subsection Examples
  7498. @itemize
  7499. @item
  7500. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  7501. using @command{ffmpeg}:
  7502. @example
  7503. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  7504. @end example
  7505. @end itemize
  7506. @section perspective
  7507. Correct perspective of video not recorded perpendicular to the screen.
  7508. A description of the accepted parameters follows.
  7509. @table @option
  7510. @item x0
  7511. @item y0
  7512. @item x1
  7513. @item y1
  7514. @item x2
  7515. @item y2
  7516. @item x3
  7517. @item y3
  7518. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  7519. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  7520. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  7521. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  7522. then the corners of the source will be sent to the specified coordinates.
  7523. The expressions can use the following variables:
  7524. @table @option
  7525. @item W
  7526. @item H
  7527. the width and height of video frame.
  7528. @end table
  7529. @item interpolation
  7530. Set interpolation for perspective correction.
  7531. It accepts the following values:
  7532. @table @samp
  7533. @item linear
  7534. @item cubic
  7535. @end table
  7536. Default value is @samp{linear}.
  7537. @item sense
  7538. Set interpretation of coordinate options.
  7539. It accepts the following values:
  7540. @table @samp
  7541. @item 0, source
  7542. Send point in the source specified by the given coordinates to
  7543. the corners of the destination.
  7544. @item 1, destination
  7545. Send the corners of the source to the point in the destination specified
  7546. by the given coordinates.
  7547. Default value is @samp{source}.
  7548. @end table
  7549. @end table
  7550. @section phase
  7551. Delay interlaced video by one field time so that the field order changes.
  7552. The intended use is to fix PAL movies that have been captured with the
  7553. opposite field order to the film-to-video transfer.
  7554. A description of the accepted parameters follows.
  7555. @table @option
  7556. @item mode
  7557. Set phase mode.
  7558. It accepts the following values:
  7559. @table @samp
  7560. @item t
  7561. Capture field order top-first, transfer bottom-first.
  7562. Filter will delay the bottom field.
  7563. @item b
  7564. Capture field order bottom-first, transfer top-first.
  7565. Filter will delay the top field.
  7566. @item p
  7567. Capture and transfer with the same field order. This mode only exists
  7568. for the documentation of the other options to refer to, but if you
  7569. actually select it, the filter will faithfully do nothing.
  7570. @item a
  7571. Capture field order determined automatically by field flags, transfer
  7572. opposite.
  7573. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  7574. basis using field flags. If no field information is available,
  7575. then this works just like @samp{u}.
  7576. @item u
  7577. Capture unknown or varying, transfer opposite.
  7578. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  7579. analyzing the images and selecting the alternative that produces best
  7580. match between the fields.
  7581. @item T
  7582. Capture top-first, transfer unknown or varying.
  7583. Filter selects among @samp{t} and @samp{p} using image analysis.
  7584. @item B
  7585. Capture bottom-first, transfer unknown or varying.
  7586. Filter selects among @samp{b} and @samp{p} using image analysis.
  7587. @item A
  7588. Capture determined by field flags, transfer unknown or varying.
  7589. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  7590. image analysis. If no field information is available, then this works just
  7591. like @samp{U}. This is the default mode.
  7592. @item U
  7593. Both capture and transfer unknown or varying.
  7594. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  7595. @end table
  7596. @end table
  7597. @section pixdesctest
  7598. Pixel format descriptor test filter, mainly useful for internal
  7599. testing. The output video should be equal to the input video.
  7600. For example:
  7601. @example
  7602. format=monow, pixdesctest
  7603. @end example
  7604. can be used to test the monowhite pixel format descriptor definition.
  7605. @section pp
  7606. Enable the specified chain of postprocessing subfilters using libpostproc. This
  7607. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  7608. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  7609. Each subfilter and some options have a short and a long name that can be used
  7610. interchangeably, i.e. dr/dering are the same.
  7611. The filters accept the following options:
  7612. @table @option
  7613. @item subfilters
  7614. Set postprocessing subfilters string.
  7615. @end table
  7616. All subfilters share common options to determine their scope:
  7617. @table @option
  7618. @item a/autoq
  7619. Honor the quality commands for this subfilter.
  7620. @item c/chrom
  7621. Do chrominance filtering, too (default).
  7622. @item y/nochrom
  7623. Do luminance filtering only (no chrominance).
  7624. @item n/noluma
  7625. Do chrominance filtering only (no luminance).
  7626. @end table
  7627. These options can be appended after the subfilter name, separated by a '|'.
  7628. Available subfilters are:
  7629. @table @option
  7630. @item hb/hdeblock[|difference[|flatness]]
  7631. Horizontal deblocking filter
  7632. @table @option
  7633. @item difference
  7634. Difference factor where higher values mean more deblocking (default: @code{32}).
  7635. @item flatness
  7636. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  7637. @end table
  7638. @item vb/vdeblock[|difference[|flatness]]
  7639. Vertical deblocking filter
  7640. @table @option
  7641. @item difference
  7642. Difference factor where higher values mean more deblocking (default: @code{32}).
  7643. @item flatness
  7644. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  7645. @end table
  7646. @item ha/hadeblock[|difference[|flatness]]
  7647. Accurate horizontal deblocking filter
  7648. @table @option
  7649. @item difference
  7650. Difference factor where higher values mean more deblocking (default: @code{32}).
  7651. @item flatness
  7652. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  7653. @end table
  7654. @item va/vadeblock[|difference[|flatness]]
  7655. Accurate vertical deblocking filter
  7656. @table @option
  7657. @item difference
  7658. Difference factor where higher values mean more deblocking (default: @code{32}).
  7659. @item flatness
  7660. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  7661. @end table
  7662. @end table
  7663. The horizontal and vertical deblocking filters share the difference and
  7664. flatness values so you cannot set different horizontal and vertical
  7665. thresholds.
  7666. @table @option
  7667. @item h1/x1hdeblock
  7668. Experimental horizontal deblocking filter
  7669. @item v1/x1vdeblock
  7670. Experimental vertical deblocking filter
  7671. @item dr/dering
  7672. Deringing filter
  7673. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  7674. @table @option
  7675. @item threshold1
  7676. larger -> stronger filtering
  7677. @item threshold2
  7678. larger -> stronger filtering
  7679. @item threshold3
  7680. larger -> stronger filtering
  7681. @end table
  7682. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  7683. @table @option
  7684. @item f/fullyrange
  7685. Stretch luminance to @code{0-255}.
  7686. @end table
  7687. @item lb/linblenddeint
  7688. Linear blend deinterlacing filter that deinterlaces the given block by
  7689. filtering all lines with a @code{(1 2 1)} filter.
  7690. @item li/linipoldeint
  7691. Linear interpolating deinterlacing filter that deinterlaces the given block by
  7692. linearly interpolating every second line.
  7693. @item ci/cubicipoldeint
  7694. Cubic interpolating deinterlacing filter deinterlaces the given block by
  7695. cubically interpolating every second line.
  7696. @item md/mediandeint
  7697. Median deinterlacing filter that deinterlaces the given block by applying a
  7698. median filter to every second line.
  7699. @item fd/ffmpegdeint
  7700. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  7701. second line with a @code{(-1 4 2 4 -1)} filter.
  7702. @item l5/lowpass5
  7703. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  7704. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  7705. @item fq/forceQuant[|quantizer]
  7706. Overrides the quantizer table from the input with the constant quantizer you
  7707. specify.
  7708. @table @option
  7709. @item quantizer
  7710. Quantizer to use
  7711. @end table
  7712. @item de/default
  7713. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  7714. @item fa/fast
  7715. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  7716. @item ac
  7717. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  7718. @end table
  7719. @subsection Examples
  7720. @itemize
  7721. @item
  7722. Apply horizontal and vertical deblocking, deringing and automatic
  7723. brightness/contrast:
  7724. @example
  7725. pp=hb/vb/dr/al
  7726. @end example
  7727. @item
  7728. Apply default filters without brightness/contrast correction:
  7729. @example
  7730. pp=de/-al
  7731. @end example
  7732. @item
  7733. Apply default filters and temporal denoiser:
  7734. @example
  7735. pp=default/tmpnoise|1|2|3
  7736. @end example
  7737. @item
  7738. Apply deblocking on luminance only, and switch vertical deblocking on or off
  7739. automatically depending on available CPU time:
  7740. @example
  7741. pp=hb|y/vb|a
  7742. @end example
  7743. @end itemize
  7744. @section pp7
  7745. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  7746. similar to spp = 6 with 7 point DCT, where only the center sample is
  7747. used after IDCT.
  7748. The filter accepts the following options:
  7749. @table @option
  7750. @item qp
  7751. Force a constant quantization parameter. It accepts an integer in range
  7752. 0 to 63. If not set, the filter will use the QP from the video stream
  7753. (if available).
  7754. @item mode
  7755. Set thresholding mode. Available modes are:
  7756. @table @samp
  7757. @item hard
  7758. Set hard thresholding.
  7759. @item soft
  7760. Set soft thresholding (better de-ringing effect, but likely blurrier).
  7761. @item medium
  7762. Set medium thresholding (good results, default).
  7763. @end table
  7764. @end table
  7765. @section psnr
  7766. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  7767. Ratio) between two input videos.
  7768. This filter takes in input two input videos, the first input is
  7769. considered the "main" source and is passed unchanged to the
  7770. output. The second input is used as a "reference" video for computing
  7771. the PSNR.
  7772. Both video inputs must have the same resolution and pixel format for
  7773. this filter to work correctly. Also it assumes that both inputs
  7774. have the same number of frames, which are compared one by one.
  7775. The obtained average PSNR is printed through the logging system.
  7776. The filter stores the accumulated MSE (mean squared error) of each
  7777. frame, and at the end of the processing it is averaged across all frames
  7778. equally, and the following formula is applied to obtain the PSNR:
  7779. @example
  7780. PSNR = 10*log10(MAX^2/MSE)
  7781. @end example
  7782. Where MAX is the average of the maximum values of each component of the
  7783. image.
  7784. The description of the accepted parameters follows.
  7785. @table @option
  7786. @item stats_file, f
  7787. If specified the filter will use the named file to save the PSNR of
  7788. each individual frame. When filename equals "-" the data is sent to
  7789. standard output.
  7790. @end table
  7791. The file printed if @var{stats_file} is selected, contains a sequence of
  7792. key/value pairs of the form @var{key}:@var{value} for each compared
  7793. couple of frames.
  7794. A description of each shown parameter follows:
  7795. @table @option
  7796. @item n
  7797. sequential number of the input frame, starting from 1
  7798. @item mse_avg
  7799. Mean Square Error pixel-by-pixel average difference of the compared
  7800. frames, averaged over all the image components.
  7801. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  7802. Mean Square Error pixel-by-pixel average difference of the compared
  7803. frames for the component specified by the suffix.
  7804. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  7805. Peak Signal to Noise ratio of the compared frames for the component
  7806. specified by the suffix.
  7807. @end table
  7808. For example:
  7809. @example
  7810. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  7811. [main][ref] psnr="stats_file=stats.log" [out]
  7812. @end example
  7813. On this example the input file being processed is compared with the
  7814. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  7815. is stored in @file{stats.log}.
  7816. @anchor{pullup}
  7817. @section pullup
  7818. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  7819. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  7820. content.
  7821. The pullup filter is designed to take advantage of future context in making
  7822. its decisions. This filter is stateless in the sense that it does not lock
  7823. onto a pattern to follow, but it instead looks forward to the following
  7824. fields in order to identify matches and rebuild progressive frames.
  7825. To produce content with an even framerate, insert the fps filter after
  7826. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  7827. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  7828. The filter accepts the following options:
  7829. @table @option
  7830. @item jl
  7831. @item jr
  7832. @item jt
  7833. @item jb
  7834. These options set the amount of "junk" to ignore at the left, right, top, and
  7835. bottom of the image, respectively. Left and right are in units of 8 pixels,
  7836. while top and bottom are in units of 2 lines.
  7837. The default is 8 pixels on each side.
  7838. @item sb
  7839. Set the strict breaks. Setting this option to 1 will reduce the chances of
  7840. filter generating an occasional mismatched frame, but it may also cause an
  7841. excessive number of frames to be dropped during high motion sequences.
  7842. Conversely, setting it to -1 will make filter match fields more easily.
  7843. This may help processing of video where there is slight blurring between
  7844. the fields, but may also cause there to be interlaced frames in the output.
  7845. Default value is @code{0}.
  7846. @item mp
  7847. Set the metric plane to use. It accepts the following values:
  7848. @table @samp
  7849. @item l
  7850. Use luma plane.
  7851. @item u
  7852. Use chroma blue plane.
  7853. @item v
  7854. Use chroma red plane.
  7855. @end table
  7856. This option may be set to use chroma plane instead of the default luma plane
  7857. for doing filter's computations. This may improve accuracy on very clean
  7858. source material, but more likely will decrease accuracy, especially if there
  7859. is chroma noise (rainbow effect) or any grayscale video.
  7860. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  7861. load and make pullup usable in realtime on slow machines.
  7862. @end table
  7863. For best results (without duplicated frames in the output file) it is
  7864. necessary to change the output frame rate. For example, to inverse
  7865. telecine NTSC input:
  7866. @example
  7867. ffmpeg -i input -vf pullup -r 24000/1001 ...
  7868. @end example
  7869. @section qp
  7870. Change video quantization parameters (QP).
  7871. The filter accepts the following option:
  7872. @table @option
  7873. @item qp
  7874. Set expression for quantization parameter.
  7875. @end table
  7876. The expression is evaluated through the eval API and can contain, among others,
  7877. the following constants:
  7878. @table @var
  7879. @item known
  7880. 1 if index is not 129, 0 otherwise.
  7881. @item qp
  7882. Sequentional index starting from -129 to 128.
  7883. @end table
  7884. @subsection Examples
  7885. @itemize
  7886. @item
  7887. Some equation like:
  7888. @example
  7889. qp=2+2*sin(PI*qp)
  7890. @end example
  7891. @end itemize
  7892. @section random
  7893. Flush video frames from internal cache of frames into a random order.
  7894. No frame is discarded.
  7895. Inspired by @ref{frei0r} nervous filter.
  7896. @table @option
  7897. @item frames
  7898. Set size in number of frames of internal cache, in range from @code{2} to
  7899. @code{512}. Default is @code{30}.
  7900. @item seed
  7901. Set seed for random number generator, must be an integer included between
  7902. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  7903. less than @code{0}, the filter will try to use a good random seed on a
  7904. best effort basis.
  7905. @end table
  7906. @section removegrain
  7907. The removegrain filter is a spatial denoiser for progressive video.
  7908. @table @option
  7909. @item m0
  7910. Set mode for the first plane.
  7911. @item m1
  7912. Set mode for the second plane.
  7913. @item m2
  7914. Set mode for the third plane.
  7915. @item m3
  7916. Set mode for the fourth plane.
  7917. @end table
  7918. Range of mode is from 0 to 24. Description of each mode follows:
  7919. @table @var
  7920. @item 0
  7921. Leave input plane unchanged. Default.
  7922. @item 1
  7923. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  7924. @item 2
  7925. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  7926. @item 3
  7927. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  7928. @item 4
  7929. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  7930. This is equivalent to a median filter.
  7931. @item 5
  7932. Line-sensitive clipping giving the minimal change.
  7933. @item 6
  7934. Line-sensitive clipping, intermediate.
  7935. @item 7
  7936. Line-sensitive clipping, intermediate.
  7937. @item 8
  7938. Line-sensitive clipping, intermediate.
  7939. @item 9
  7940. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  7941. @item 10
  7942. Replaces the target pixel with the closest neighbour.
  7943. @item 11
  7944. [1 2 1] horizontal and vertical kernel blur.
  7945. @item 12
  7946. Same as mode 11.
  7947. @item 13
  7948. Bob mode, interpolates top field from the line where the neighbours
  7949. pixels are the closest.
  7950. @item 14
  7951. Bob mode, interpolates bottom field from the line where the neighbours
  7952. pixels are the closest.
  7953. @item 15
  7954. Bob mode, interpolates top field. Same as 13 but with a more complicated
  7955. interpolation formula.
  7956. @item 16
  7957. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  7958. interpolation formula.
  7959. @item 17
  7960. Clips the pixel with the minimum and maximum of respectively the maximum and
  7961. minimum of each pair of opposite neighbour pixels.
  7962. @item 18
  7963. Line-sensitive clipping using opposite neighbours whose greatest distance from
  7964. the current pixel is minimal.
  7965. @item 19
  7966. Replaces the pixel with the average of its 8 neighbours.
  7967. @item 20
  7968. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  7969. @item 21
  7970. Clips pixels using the averages of opposite neighbour.
  7971. @item 22
  7972. Same as mode 21 but simpler and faster.
  7973. @item 23
  7974. Small edge and halo removal, but reputed useless.
  7975. @item 24
  7976. Similar as 23.
  7977. @end table
  7978. @section removelogo
  7979. Suppress a TV station logo, using an image file to determine which
  7980. pixels comprise the logo. It works by filling in the pixels that
  7981. comprise the logo with neighboring pixels.
  7982. The filter accepts the following options:
  7983. @table @option
  7984. @item filename, f
  7985. Set the filter bitmap file, which can be any image format supported by
  7986. libavformat. The width and height of the image file must match those of the
  7987. video stream being processed.
  7988. @end table
  7989. Pixels in the provided bitmap image with a value of zero are not
  7990. considered part of the logo, non-zero pixels are considered part of
  7991. the logo. If you use white (255) for the logo and black (0) for the
  7992. rest, you will be safe. For making the filter bitmap, it is
  7993. recommended to take a screen capture of a black frame with the logo
  7994. visible, and then using a threshold filter followed by the erode
  7995. filter once or twice.
  7996. If needed, little splotches can be fixed manually. Remember that if
  7997. logo pixels are not covered, the filter quality will be much
  7998. reduced. Marking too many pixels as part of the logo does not hurt as
  7999. much, but it will increase the amount of blurring needed to cover over
  8000. the image and will destroy more information than necessary, and extra
  8001. pixels will slow things down on a large logo.
  8002. @section repeatfields
  8003. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  8004. fields based on its value.
  8005. @section reverse, areverse
  8006. Reverse a clip.
  8007. Warning: This filter requires memory to buffer the entire clip, so trimming
  8008. is suggested.
  8009. @subsection Examples
  8010. @itemize
  8011. @item
  8012. Take the first 5 seconds of a clip, and reverse it.
  8013. @example
  8014. trim=end=5,reverse
  8015. @end example
  8016. @end itemize
  8017. @section rotate
  8018. Rotate video by an arbitrary angle expressed in radians.
  8019. The filter accepts the following options:
  8020. A description of the optional parameters follows.
  8021. @table @option
  8022. @item angle, a
  8023. Set an expression for the angle by which to rotate the input video
  8024. clockwise, expressed as a number of radians. A negative value will
  8025. result in a counter-clockwise rotation. By default it is set to "0".
  8026. This expression is evaluated for each frame.
  8027. @item out_w, ow
  8028. Set the output width expression, default value is "iw".
  8029. This expression is evaluated just once during configuration.
  8030. @item out_h, oh
  8031. Set the output height expression, default value is "ih".
  8032. This expression is evaluated just once during configuration.
  8033. @item bilinear
  8034. Enable bilinear interpolation if set to 1, a value of 0 disables
  8035. it. Default value is 1.
  8036. @item fillcolor, c
  8037. Set the color used to fill the output area not covered by the rotated
  8038. image. For the general syntax of this option, check the "Color" section in the
  8039. ffmpeg-utils manual. If the special value "none" is selected then no
  8040. background is printed (useful for example if the background is never shown).
  8041. Default value is "black".
  8042. @end table
  8043. The expressions for the angle and the output size can contain the
  8044. following constants and functions:
  8045. @table @option
  8046. @item n
  8047. sequential number of the input frame, starting from 0. It is always NAN
  8048. before the first frame is filtered.
  8049. @item t
  8050. time in seconds of the input frame, it is set to 0 when the filter is
  8051. configured. It is always NAN before the first frame is filtered.
  8052. @item hsub
  8053. @item vsub
  8054. horizontal and vertical chroma subsample values. For example for the
  8055. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8056. @item in_w, iw
  8057. @item in_h, ih
  8058. the input video width and height
  8059. @item out_w, ow
  8060. @item out_h, oh
  8061. the output width and height, that is the size of the padded area as
  8062. specified by the @var{width} and @var{height} expressions
  8063. @item rotw(a)
  8064. @item roth(a)
  8065. the minimal width/height required for completely containing the input
  8066. video rotated by @var{a} radians.
  8067. These are only available when computing the @option{out_w} and
  8068. @option{out_h} expressions.
  8069. @end table
  8070. @subsection Examples
  8071. @itemize
  8072. @item
  8073. Rotate the input by PI/6 radians clockwise:
  8074. @example
  8075. rotate=PI/6
  8076. @end example
  8077. @item
  8078. Rotate the input by PI/6 radians counter-clockwise:
  8079. @example
  8080. rotate=-PI/6
  8081. @end example
  8082. @item
  8083. Rotate the input by 45 degrees clockwise:
  8084. @example
  8085. rotate=45*PI/180
  8086. @end example
  8087. @item
  8088. Apply a constant rotation with period T, starting from an angle of PI/3:
  8089. @example
  8090. rotate=PI/3+2*PI*t/T
  8091. @end example
  8092. @item
  8093. Make the input video rotation oscillating with a period of T
  8094. seconds and an amplitude of A radians:
  8095. @example
  8096. rotate=A*sin(2*PI/T*t)
  8097. @end example
  8098. @item
  8099. Rotate the video, output size is chosen so that the whole rotating
  8100. input video is always completely contained in the output:
  8101. @example
  8102. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  8103. @end example
  8104. @item
  8105. Rotate the video, reduce the output size so that no background is ever
  8106. shown:
  8107. @example
  8108. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  8109. @end example
  8110. @end itemize
  8111. @subsection Commands
  8112. The filter supports the following commands:
  8113. @table @option
  8114. @item a, angle
  8115. Set the angle expression.
  8116. The command accepts the same syntax of the corresponding option.
  8117. If the specified expression is not valid, it is kept at its current
  8118. value.
  8119. @end table
  8120. @section sab
  8121. Apply Shape Adaptive Blur.
  8122. The filter accepts the following options:
  8123. @table @option
  8124. @item luma_radius, lr
  8125. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  8126. value is 1.0. A greater value will result in a more blurred image, and
  8127. in slower processing.
  8128. @item luma_pre_filter_radius, lpfr
  8129. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  8130. value is 1.0.
  8131. @item luma_strength, ls
  8132. Set luma maximum difference between pixels to still be considered, must
  8133. be a value in the 0.1-100.0 range, default value is 1.0.
  8134. @item chroma_radius, cr
  8135. Set chroma blur filter strength, must be a value in range 0.1-4.0. A
  8136. greater value will result in a more blurred image, and in slower
  8137. processing.
  8138. @item chroma_pre_filter_radius, cpfr
  8139. Set chroma pre-filter radius, must be a value in the 0.1-2.0 range.
  8140. @item chroma_strength, cs
  8141. Set chroma maximum difference between pixels to still be considered,
  8142. must be a value in the 0.1-100.0 range.
  8143. @end table
  8144. Each chroma option value, if not explicitly specified, is set to the
  8145. corresponding luma option value.
  8146. @anchor{scale}
  8147. @section scale
  8148. Scale (resize) the input video, using the libswscale library.
  8149. The scale filter forces the output display aspect ratio to be the same
  8150. of the input, by changing the output sample aspect ratio.
  8151. If the input image format is different from the format requested by
  8152. the next filter, the scale filter will convert the input to the
  8153. requested format.
  8154. @subsection Options
  8155. The filter accepts the following options, or any of the options
  8156. supported by the libswscale scaler.
  8157. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  8158. the complete list of scaler options.
  8159. @table @option
  8160. @item width, w
  8161. @item height, h
  8162. Set the output video dimension expression. Default value is the input
  8163. dimension.
  8164. If the value is 0, the input width is used for the output.
  8165. If one of the values is -1, the scale filter will use a value that
  8166. maintains the aspect ratio of the input image, calculated from the
  8167. other specified dimension. If both of them are -1, the input size is
  8168. used
  8169. If one of the values is -n with n > 1, the scale filter will also use a value
  8170. that maintains the aspect ratio of the input image, calculated from the other
  8171. specified dimension. After that it will, however, make sure that the calculated
  8172. dimension is divisible by n and adjust the value if necessary.
  8173. See below for the list of accepted constants for use in the dimension
  8174. expression.
  8175. @item eval
  8176. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  8177. @table @samp
  8178. @item init
  8179. Only evaluate expressions once during the filter initialization or when a command is processed.
  8180. @item frame
  8181. Evaluate expressions for each incoming frame.
  8182. @end table
  8183. Default value is @samp{init}.
  8184. @item interl
  8185. Set the interlacing mode. It accepts the following values:
  8186. @table @samp
  8187. @item 1
  8188. Force interlaced aware scaling.
  8189. @item 0
  8190. Do not apply interlaced scaling.
  8191. @item -1
  8192. Select interlaced aware scaling depending on whether the source frames
  8193. are flagged as interlaced or not.
  8194. @end table
  8195. Default value is @samp{0}.
  8196. @item flags
  8197. Set libswscale scaling flags. See
  8198. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  8199. complete list of values. If not explicitly specified the filter applies
  8200. the default flags.
  8201. @item param0, param1
  8202. Set libswscale input parameters for scaling algorithms that need them. See
  8203. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  8204. complete documentation. If not explicitly specified the filter applies
  8205. empty parameters.
  8206. @item size, s
  8207. Set the video size. For the syntax of this option, check the
  8208. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8209. @item in_color_matrix
  8210. @item out_color_matrix
  8211. Set in/output YCbCr color space type.
  8212. This allows the autodetected value to be overridden as well as allows forcing
  8213. a specific value used for the output and encoder.
  8214. If not specified, the color space type depends on the pixel format.
  8215. Possible values:
  8216. @table @samp
  8217. @item auto
  8218. Choose automatically.
  8219. @item bt709
  8220. Format conforming to International Telecommunication Union (ITU)
  8221. Recommendation BT.709.
  8222. @item fcc
  8223. Set color space conforming to the United States Federal Communications
  8224. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  8225. @item bt601
  8226. Set color space conforming to:
  8227. @itemize
  8228. @item
  8229. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  8230. @item
  8231. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  8232. @item
  8233. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  8234. @end itemize
  8235. @item smpte240m
  8236. Set color space conforming to SMPTE ST 240:1999.
  8237. @end table
  8238. @item in_range
  8239. @item out_range
  8240. Set in/output YCbCr sample range.
  8241. This allows the autodetected value to be overridden as well as allows forcing
  8242. a specific value used for the output and encoder. If not specified, the
  8243. range depends on the pixel format. Possible values:
  8244. @table @samp
  8245. @item auto
  8246. Choose automatically.
  8247. @item jpeg/full/pc
  8248. Set full range (0-255 in case of 8-bit luma).
  8249. @item mpeg/tv
  8250. Set "MPEG" range (16-235 in case of 8-bit luma).
  8251. @end table
  8252. @item force_original_aspect_ratio
  8253. Enable decreasing or increasing output video width or height if necessary to
  8254. keep the original aspect ratio. Possible values:
  8255. @table @samp
  8256. @item disable
  8257. Scale the video as specified and disable this feature.
  8258. @item decrease
  8259. The output video dimensions will automatically be decreased if needed.
  8260. @item increase
  8261. The output video dimensions will automatically be increased if needed.
  8262. @end table
  8263. One useful instance of this option is that when you know a specific device's
  8264. maximum allowed resolution, you can use this to limit the output video to
  8265. that, while retaining the aspect ratio. For example, device A allows
  8266. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  8267. decrease) and specifying 1280x720 to the command line makes the output
  8268. 1280x533.
  8269. Please note that this is a different thing than specifying -1 for @option{w}
  8270. or @option{h}, you still need to specify the output resolution for this option
  8271. to work.
  8272. @end table
  8273. The values of the @option{w} and @option{h} options are expressions
  8274. containing the following constants:
  8275. @table @var
  8276. @item in_w
  8277. @item in_h
  8278. The input width and height
  8279. @item iw
  8280. @item ih
  8281. These are the same as @var{in_w} and @var{in_h}.
  8282. @item out_w
  8283. @item out_h
  8284. The output (scaled) width and height
  8285. @item ow
  8286. @item oh
  8287. These are the same as @var{out_w} and @var{out_h}
  8288. @item a
  8289. The same as @var{iw} / @var{ih}
  8290. @item sar
  8291. input sample aspect ratio
  8292. @item dar
  8293. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  8294. @item hsub
  8295. @item vsub
  8296. horizontal and vertical input chroma subsample values. For example for the
  8297. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8298. @item ohsub
  8299. @item ovsub
  8300. horizontal and vertical output chroma subsample values. For example for the
  8301. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8302. @end table
  8303. @subsection Examples
  8304. @itemize
  8305. @item
  8306. Scale the input video to a size of 200x100
  8307. @example
  8308. scale=w=200:h=100
  8309. @end example
  8310. This is equivalent to:
  8311. @example
  8312. scale=200:100
  8313. @end example
  8314. or:
  8315. @example
  8316. scale=200x100
  8317. @end example
  8318. @item
  8319. Specify a size abbreviation for the output size:
  8320. @example
  8321. scale=qcif
  8322. @end example
  8323. which can also be written as:
  8324. @example
  8325. scale=size=qcif
  8326. @end example
  8327. @item
  8328. Scale the input to 2x:
  8329. @example
  8330. scale=w=2*iw:h=2*ih
  8331. @end example
  8332. @item
  8333. The above is the same as:
  8334. @example
  8335. scale=2*in_w:2*in_h
  8336. @end example
  8337. @item
  8338. Scale the input to 2x with forced interlaced scaling:
  8339. @example
  8340. scale=2*iw:2*ih:interl=1
  8341. @end example
  8342. @item
  8343. Scale the input to half size:
  8344. @example
  8345. scale=w=iw/2:h=ih/2
  8346. @end example
  8347. @item
  8348. Increase the width, and set the height to the same size:
  8349. @example
  8350. scale=3/2*iw:ow
  8351. @end example
  8352. @item
  8353. Seek Greek harmony:
  8354. @example
  8355. scale=iw:1/PHI*iw
  8356. scale=ih*PHI:ih
  8357. @end example
  8358. @item
  8359. Increase the height, and set the width to 3/2 of the height:
  8360. @example
  8361. scale=w=3/2*oh:h=3/5*ih
  8362. @end example
  8363. @item
  8364. Increase the size, making the size a multiple of the chroma
  8365. subsample values:
  8366. @example
  8367. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  8368. @end example
  8369. @item
  8370. Increase the width to a maximum of 500 pixels,
  8371. keeping the same aspect ratio as the input:
  8372. @example
  8373. scale=w='min(500\, iw*3/2):h=-1'
  8374. @end example
  8375. @end itemize
  8376. @subsection Commands
  8377. This filter supports the following commands:
  8378. @table @option
  8379. @item width, w
  8380. @item height, h
  8381. Set the output video dimension expression.
  8382. The command accepts the same syntax of the corresponding option.
  8383. If the specified expression is not valid, it is kept at its current
  8384. value.
  8385. @end table
  8386. @section scale2ref
  8387. Scale (resize) the input video, based on a reference video.
  8388. See the scale filter for available options, scale2ref supports the same but
  8389. uses the reference video instead of the main input as basis.
  8390. @subsection Examples
  8391. @itemize
  8392. @item
  8393. Scale a subtitle stream to match the main video in size before overlaying
  8394. @example
  8395. 'scale2ref[b][a];[a][b]overlay'
  8396. @end example
  8397. @end itemize
  8398. @anchor{selectivecolor}
  8399. @section selectivecolor
  8400. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  8401. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  8402. by the "purity" of the color (that is, how saturated it already is).
  8403. This filter is similar to the Adobe Photoshop Selective Color tool.
  8404. The filter accepts the following options:
  8405. @table @option
  8406. @item correction_method
  8407. Select color correction method.
  8408. Available values are:
  8409. @table @samp
  8410. @item absolute
  8411. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  8412. component value).
  8413. @item relative
  8414. Specified adjustments are relative to the original component value.
  8415. @end table
  8416. Default is @code{absolute}.
  8417. @item reds
  8418. Adjustments for red pixels (pixels where the red component is the maximum)
  8419. @item yellows
  8420. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  8421. @item greens
  8422. Adjustments for green pixels (pixels where the green component is the maximum)
  8423. @item cyans
  8424. Adjustments for cyan pixels (pixels where the red component is the minimum)
  8425. @item blues
  8426. Adjustments for blue pixels (pixels where the blue component is the maximum)
  8427. @item magentas
  8428. Adjustments for magenta pixels (pixels where the green component is the minimum)
  8429. @item whites
  8430. Adjustments for white pixels (pixels where all components are greater than 128)
  8431. @item neutrals
  8432. Adjustments for all pixels except pure black and pure white
  8433. @item blacks
  8434. Adjustments for black pixels (pixels where all components are lesser than 128)
  8435. @item psfile
  8436. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  8437. @end table
  8438. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  8439. 4 space separated floating point adjustment values in the [-1,1] range,
  8440. respectively to adjust the amount of cyan, magenta, yellow and black for the
  8441. pixels of its range.
  8442. @subsection Examples
  8443. @itemize
  8444. @item
  8445. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  8446. increase magenta by 27% in blue areas:
  8447. @example
  8448. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  8449. @end example
  8450. @item
  8451. Use a Photoshop selective color preset:
  8452. @example
  8453. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  8454. @end example
  8455. @end itemize
  8456. @section separatefields
  8457. The @code{separatefields} takes a frame-based video input and splits
  8458. each frame into its components fields, producing a new half height clip
  8459. with twice the frame rate and twice the frame count.
  8460. This filter use field-dominance information in frame to decide which
  8461. of each pair of fields to place first in the output.
  8462. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  8463. @section setdar, setsar
  8464. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  8465. output video.
  8466. This is done by changing the specified Sample (aka Pixel) Aspect
  8467. Ratio, according to the following equation:
  8468. @example
  8469. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  8470. @end example
  8471. Keep in mind that the @code{setdar} filter does not modify the pixel
  8472. dimensions of the video frame. Also, the display aspect ratio set by
  8473. this filter may be changed by later filters in the filterchain,
  8474. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  8475. applied.
  8476. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  8477. the filter output video.
  8478. Note that as a consequence of the application of this filter, the
  8479. output display aspect ratio will change according to the equation
  8480. above.
  8481. Keep in mind that the sample aspect ratio set by the @code{setsar}
  8482. filter may be changed by later filters in the filterchain, e.g. if
  8483. another "setsar" or a "setdar" filter is applied.
  8484. It accepts the following parameters:
  8485. @table @option
  8486. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  8487. Set the aspect ratio used by the filter.
  8488. The parameter can be a floating point number string, an expression, or
  8489. a string of the form @var{num}:@var{den}, where @var{num} and
  8490. @var{den} are the numerator and denominator of the aspect ratio. If
  8491. the parameter is not specified, it is assumed the value "0".
  8492. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  8493. should be escaped.
  8494. @item max
  8495. Set the maximum integer value to use for expressing numerator and
  8496. denominator when reducing the expressed aspect ratio to a rational.
  8497. Default value is @code{100}.
  8498. @end table
  8499. The parameter @var{sar} is an expression containing
  8500. the following constants:
  8501. @table @option
  8502. @item E, PI, PHI
  8503. These are approximated values for the mathematical constants e
  8504. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  8505. @item w, h
  8506. The input width and height.
  8507. @item a
  8508. These are the same as @var{w} / @var{h}.
  8509. @item sar
  8510. The input sample aspect ratio.
  8511. @item dar
  8512. The input display aspect ratio. It is the same as
  8513. (@var{w} / @var{h}) * @var{sar}.
  8514. @item hsub, vsub
  8515. Horizontal and vertical chroma subsample values. For example, for the
  8516. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8517. @end table
  8518. @subsection Examples
  8519. @itemize
  8520. @item
  8521. To change the display aspect ratio to 16:9, specify one of the following:
  8522. @example
  8523. setdar=dar=1.77777
  8524. setdar=dar=16/9
  8525. setdar=dar=1.77777
  8526. @end example
  8527. @item
  8528. To change the sample aspect ratio to 10:11, specify:
  8529. @example
  8530. setsar=sar=10/11
  8531. @end example
  8532. @item
  8533. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  8534. 1000 in the aspect ratio reduction, use the command:
  8535. @example
  8536. setdar=ratio=16/9:max=1000
  8537. @end example
  8538. @end itemize
  8539. @anchor{setfield}
  8540. @section setfield
  8541. Force field for the output video frame.
  8542. The @code{setfield} filter marks the interlace type field for the
  8543. output frames. It does not change the input frame, but only sets the
  8544. corresponding property, which affects how the frame is treated by
  8545. following filters (e.g. @code{fieldorder} or @code{yadif}).
  8546. The filter accepts the following options:
  8547. @table @option
  8548. @item mode
  8549. Available values are:
  8550. @table @samp
  8551. @item auto
  8552. Keep the same field property.
  8553. @item bff
  8554. Mark the frame as bottom-field-first.
  8555. @item tff
  8556. Mark the frame as top-field-first.
  8557. @item prog
  8558. Mark the frame as progressive.
  8559. @end table
  8560. @end table
  8561. @section showinfo
  8562. Show a line containing various information for each input video frame.
  8563. The input video is not modified.
  8564. The shown line contains a sequence of key/value pairs of the form
  8565. @var{key}:@var{value}.
  8566. The following values are shown in the output:
  8567. @table @option
  8568. @item n
  8569. The (sequential) number of the input frame, starting from 0.
  8570. @item pts
  8571. The Presentation TimeStamp of the input frame, expressed as a number of
  8572. time base units. The time base unit depends on the filter input pad.
  8573. @item pts_time
  8574. The Presentation TimeStamp of the input frame, expressed as a number of
  8575. seconds.
  8576. @item pos
  8577. The position of the frame in the input stream, or -1 if this information is
  8578. unavailable and/or meaningless (for example in case of synthetic video).
  8579. @item fmt
  8580. The pixel format name.
  8581. @item sar
  8582. The sample aspect ratio of the input frame, expressed in the form
  8583. @var{num}/@var{den}.
  8584. @item s
  8585. The size of the input frame. For the syntax of this option, check the
  8586. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8587. @item i
  8588. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  8589. for bottom field first).
  8590. @item iskey
  8591. This is 1 if the frame is a key frame, 0 otherwise.
  8592. @item type
  8593. The picture type of the input frame ("I" for an I-frame, "P" for a
  8594. P-frame, "B" for a B-frame, or "?" for an unknown type).
  8595. Also refer to the documentation of the @code{AVPictureType} enum and of
  8596. the @code{av_get_picture_type_char} function defined in
  8597. @file{libavutil/avutil.h}.
  8598. @item checksum
  8599. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  8600. @item plane_checksum
  8601. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  8602. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  8603. @end table
  8604. @section showpalette
  8605. Displays the 256 colors palette of each frame. This filter is only relevant for
  8606. @var{pal8} pixel format frames.
  8607. It accepts the following option:
  8608. @table @option
  8609. @item s
  8610. Set the size of the box used to represent one palette color entry. Default is
  8611. @code{30} (for a @code{30x30} pixel box).
  8612. @end table
  8613. @section shuffleframes
  8614. Reorder and/or duplicate video frames.
  8615. It accepts the following parameters:
  8616. @table @option
  8617. @item mapping
  8618. Set the destination indexes of input frames.
  8619. This is space or '|' separated list of indexes that maps input frames to output
  8620. frames. Number of indexes also sets maximal value that each index may have.
  8621. @end table
  8622. The first frame has the index 0. The default is to keep the input unchanged.
  8623. Swap second and third frame of every three frames of the input:
  8624. @example
  8625. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  8626. @end example
  8627. @section shuffleplanes
  8628. Reorder and/or duplicate video planes.
  8629. It accepts the following parameters:
  8630. @table @option
  8631. @item map0
  8632. The index of the input plane to be used as the first output plane.
  8633. @item map1
  8634. The index of the input plane to be used as the second output plane.
  8635. @item map2
  8636. The index of the input plane to be used as the third output plane.
  8637. @item map3
  8638. The index of the input plane to be used as the fourth output plane.
  8639. @end table
  8640. The first plane has the index 0. The default is to keep the input unchanged.
  8641. Swap the second and third planes of the input:
  8642. @example
  8643. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  8644. @end example
  8645. @anchor{signalstats}
  8646. @section signalstats
  8647. Evaluate various visual metrics that assist in determining issues associated
  8648. with the digitization of analog video media.
  8649. By default the filter will log these metadata values:
  8650. @table @option
  8651. @item YMIN
  8652. Display the minimal Y value contained within the input frame. Expressed in
  8653. range of [0-255].
  8654. @item YLOW
  8655. Display the Y value at the 10% percentile within the input frame. Expressed in
  8656. range of [0-255].
  8657. @item YAVG
  8658. Display the average Y value within the input frame. Expressed in range of
  8659. [0-255].
  8660. @item YHIGH
  8661. Display the Y value at the 90% percentile within the input frame. Expressed in
  8662. range of [0-255].
  8663. @item YMAX
  8664. Display the maximum Y value contained within the input frame. Expressed in
  8665. range of [0-255].
  8666. @item UMIN
  8667. Display the minimal U value contained within the input frame. Expressed in
  8668. range of [0-255].
  8669. @item ULOW
  8670. Display the U value at the 10% percentile within the input frame. Expressed in
  8671. range of [0-255].
  8672. @item UAVG
  8673. Display the average U value within the input frame. Expressed in range of
  8674. [0-255].
  8675. @item UHIGH
  8676. Display the U value at the 90% percentile within the input frame. Expressed in
  8677. range of [0-255].
  8678. @item UMAX
  8679. Display the maximum U value contained within the input frame. Expressed in
  8680. range of [0-255].
  8681. @item VMIN
  8682. Display the minimal V value contained within the input frame. Expressed in
  8683. range of [0-255].
  8684. @item VLOW
  8685. Display the V value at the 10% percentile within the input frame. Expressed in
  8686. range of [0-255].
  8687. @item VAVG
  8688. Display the average V value within the input frame. Expressed in range of
  8689. [0-255].
  8690. @item VHIGH
  8691. Display the V value at the 90% percentile within the input frame. Expressed in
  8692. range of [0-255].
  8693. @item VMAX
  8694. Display the maximum V value contained within the input frame. Expressed in
  8695. range of [0-255].
  8696. @item SATMIN
  8697. Display the minimal saturation value contained within the input frame.
  8698. Expressed in range of [0-~181.02].
  8699. @item SATLOW
  8700. Display the saturation value at the 10% percentile within the input frame.
  8701. Expressed in range of [0-~181.02].
  8702. @item SATAVG
  8703. Display the average saturation value within the input frame. Expressed in range
  8704. of [0-~181.02].
  8705. @item SATHIGH
  8706. Display the saturation value at the 90% percentile within the input frame.
  8707. Expressed in range of [0-~181.02].
  8708. @item SATMAX
  8709. Display the maximum saturation value contained within the input frame.
  8710. Expressed in range of [0-~181.02].
  8711. @item HUEMED
  8712. Display the median value for hue within the input frame. Expressed in range of
  8713. [0-360].
  8714. @item HUEAVG
  8715. Display the average value for hue within the input frame. Expressed in range of
  8716. [0-360].
  8717. @item YDIF
  8718. Display the average of sample value difference between all values of the Y
  8719. plane in the current frame and corresponding values of the previous input frame.
  8720. Expressed in range of [0-255].
  8721. @item UDIF
  8722. Display the average of sample value difference between all values of the U
  8723. plane in the current frame and corresponding values of the previous input frame.
  8724. Expressed in range of [0-255].
  8725. @item VDIF
  8726. Display the average of sample value difference between all values of the V
  8727. plane in the current frame and corresponding values of the previous input frame.
  8728. Expressed in range of [0-255].
  8729. @end table
  8730. The filter accepts the following options:
  8731. @table @option
  8732. @item stat
  8733. @item out
  8734. @option{stat} specify an additional form of image analysis.
  8735. @option{out} output video with the specified type of pixel highlighted.
  8736. Both options accept the following values:
  8737. @table @samp
  8738. @item tout
  8739. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  8740. unlike the neighboring pixels of the same field. Examples of temporal outliers
  8741. include the results of video dropouts, head clogs, or tape tracking issues.
  8742. @item vrep
  8743. Identify @var{vertical line repetition}. Vertical line repetition includes
  8744. similar rows of pixels within a frame. In born-digital video vertical line
  8745. repetition is common, but this pattern is uncommon in video digitized from an
  8746. analog source. When it occurs in video that results from the digitization of an
  8747. analog source it can indicate concealment from a dropout compensator.
  8748. @item brng
  8749. Identify pixels that fall outside of legal broadcast range.
  8750. @end table
  8751. @item color, c
  8752. Set the highlight color for the @option{out} option. The default color is
  8753. yellow.
  8754. @end table
  8755. @subsection Examples
  8756. @itemize
  8757. @item
  8758. Output data of various video metrics:
  8759. @example
  8760. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  8761. @end example
  8762. @item
  8763. Output specific data about the minimum and maximum values of the Y plane per frame:
  8764. @example
  8765. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  8766. @end example
  8767. @item
  8768. Playback video while highlighting pixels that are outside of broadcast range in red.
  8769. @example
  8770. ffplay example.mov -vf signalstats="out=brng:color=red"
  8771. @end example
  8772. @item
  8773. Playback video with signalstats metadata drawn over the frame.
  8774. @example
  8775. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  8776. @end example
  8777. The contents of signalstat_drawtext.txt used in the command are:
  8778. @example
  8779. time %@{pts:hms@}
  8780. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  8781. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  8782. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  8783. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  8784. @end example
  8785. @end itemize
  8786. @anchor{smartblur}
  8787. @section smartblur
  8788. Blur the input video without impacting the outlines.
  8789. It accepts the following options:
  8790. @table @option
  8791. @item luma_radius, lr
  8792. Set the luma radius. The option value must be a float number in
  8793. the range [0.1,5.0] that specifies the variance of the gaussian filter
  8794. used to blur the image (slower if larger). Default value is 1.0.
  8795. @item luma_strength, ls
  8796. Set the luma strength. The option value must be a float number
  8797. in the range [-1.0,1.0] that configures the blurring. A value included
  8798. in [0.0,1.0] will blur the image whereas a value included in
  8799. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  8800. @item luma_threshold, lt
  8801. Set the luma threshold used as a coefficient to determine
  8802. whether a pixel should be blurred or not. The option value must be an
  8803. integer in the range [-30,30]. A value of 0 will filter all the image,
  8804. a value included in [0,30] will filter flat areas and a value included
  8805. in [-30,0] will filter edges. Default value is 0.
  8806. @item chroma_radius, cr
  8807. Set the chroma radius. The option value must be a float number in
  8808. the range [0.1,5.0] that specifies the variance of the gaussian filter
  8809. used to blur the image (slower if larger). Default value is 1.0.
  8810. @item chroma_strength, cs
  8811. Set the chroma strength. The option value must be a float number
  8812. in the range [-1.0,1.0] that configures the blurring. A value included
  8813. in [0.0,1.0] will blur the image whereas a value included in
  8814. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  8815. @item chroma_threshold, ct
  8816. Set the chroma threshold used as a coefficient to determine
  8817. whether a pixel should be blurred or not. The option value must be an
  8818. integer in the range [-30,30]. A value of 0 will filter all the image,
  8819. a value included in [0,30] will filter flat areas and a value included
  8820. in [-30,0] will filter edges. Default value is 0.
  8821. @end table
  8822. If a chroma option is not explicitly set, the corresponding luma value
  8823. is set.
  8824. @section ssim
  8825. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  8826. This filter takes in input two input videos, the first input is
  8827. considered the "main" source and is passed unchanged to the
  8828. output. The second input is used as a "reference" video for computing
  8829. the SSIM.
  8830. Both video inputs must have the same resolution and pixel format for
  8831. this filter to work correctly. Also it assumes that both inputs
  8832. have the same number of frames, which are compared one by one.
  8833. The filter stores the calculated SSIM of each frame.
  8834. The description of the accepted parameters follows.
  8835. @table @option
  8836. @item stats_file, f
  8837. If specified the filter will use the named file to save the SSIM of
  8838. each individual frame. When filename equals "-" the data is sent to
  8839. standard output.
  8840. @end table
  8841. The file printed if @var{stats_file} is selected, contains a sequence of
  8842. key/value pairs of the form @var{key}:@var{value} for each compared
  8843. couple of frames.
  8844. A description of each shown parameter follows:
  8845. @table @option
  8846. @item n
  8847. sequential number of the input frame, starting from 1
  8848. @item Y, U, V, R, G, B
  8849. SSIM of the compared frames for the component specified by the suffix.
  8850. @item All
  8851. SSIM of the compared frames for the whole frame.
  8852. @item dB
  8853. Same as above but in dB representation.
  8854. @end table
  8855. For example:
  8856. @example
  8857. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  8858. [main][ref] ssim="stats_file=stats.log" [out]
  8859. @end example
  8860. On this example the input file being processed is compared with the
  8861. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  8862. is stored in @file{stats.log}.
  8863. Another example with both psnr and ssim at same time:
  8864. @example
  8865. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  8866. @end example
  8867. @section stereo3d
  8868. Convert between different stereoscopic image formats.
  8869. The filters accept the following options:
  8870. @table @option
  8871. @item in
  8872. Set stereoscopic image format of input.
  8873. Available values for input image formats are:
  8874. @table @samp
  8875. @item sbsl
  8876. side by side parallel (left eye left, right eye right)
  8877. @item sbsr
  8878. side by side crosseye (right eye left, left eye right)
  8879. @item sbs2l
  8880. side by side parallel with half width resolution
  8881. (left eye left, right eye right)
  8882. @item sbs2r
  8883. side by side crosseye with half width resolution
  8884. (right eye left, left eye right)
  8885. @item abl
  8886. above-below (left eye above, right eye below)
  8887. @item abr
  8888. above-below (right eye above, left eye below)
  8889. @item ab2l
  8890. above-below with half height resolution
  8891. (left eye above, right eye below)
  8892. @item ab2r
  8893. above-below with half height resolution
  8894. (right eye above, left eye below)
  8895. @item al
  8896. alternating frames (left eye first, right eye second)
  8897. @item ar
  8898. alternating frames (right eye first, left eye second)
  8899. @item irl
  8900. interleaved rows (left eye has top row, right eye starts on next row)
  8901. @item irr
  8902. interleaved rows (right eye has top row, left eye starts on next row)
  8903. @item icl
  8904. interleaved columns, left eye first
  8905. @item icr
  8906. interleaved columns, right eye first
  8907. Default value is @samp{sbsl}.
  8908. @end table
  8909. @item out
  8910. Set stereoscopic image format of output.
  8911. @table @samp
  8912. @item sbsl
  8913. side by side parallel (left eye left, right eye right)
  8914. @item sbsr
  8915. side by side crosseye (right eye left, left eye right)
  8916. @item sbs2l
  8917. side by side parallel with half width resolution
  8918. (left eye left, right eye right)
  8919. @item sbs2r
  8920. side by side crosseye with half width resolution
  8921. (right eye left, left eye right)
  8922. @item abl
  8923. above-below (left eye above, right eye below)
  8924. @item abr
  8925. above-below (right eye above, left eye below)
  8926. @item ab2l
  8927. above-below with half height resolution
  8928. (left eye above, right eye below)
  8929. @item ab2r
  8930. above-below with half height resolution
  8931. (right eye above, left eye below)
  8932. @item al
  8933. alternating frames (left eye first, right eye second)
  8934. @item ar
  8935. alternating frames (right eye first, left eye second)
  8936. @item irl
  8937. interleaved rows (left eye has top row, right eye starts on next row)
  8938. @item irr
  8939. interleaved rows (right eye has top row, left eye starts on next row)
  8940. @item arbg
  8941. anaglyph red/blue gray
  8942. (red filter on left eye, blue filter on right eye)
  8943. @item argg
  8944. anaglyph red/green gray
  8945. (red filter on left eye, green filter on right eye)
  8946. @item arcg
  8947. anaglyph red/cyan gray
  8948. (red filter on left eye, cyan filter on right eye)
  8949. @item arch
  8950. anaglyph red/cyan half colored
  8951. (red filter on left eye, cyan filter on right eye)
  8952. @item arcc
  8953. anaglyph red/cyan color
  8954. (red filter on left eye, cyan filter on right eye)
  8955. @item arcd
  8956. anaglyph red/cyan color optimized with the least squares projection of dubois
  8957. (red filter on left eye, cyan filter on right eye)
  8958. @item agmg
  8959. anaglyph green/magenta gray
  8960. (green filter on left eye, magenta filter on right eye)
  8961. @item agmh
  8962. anaglyph green/magenta half colored
  8963. (green filter on left eye, magenta filter on right eye)
  8964. @item agmc
  8965. anaglyph green/magenta colored
  8966. (green filter on left eye, magenta filter on right eye)
  8967. @item agmd
  8968. anaglyph green/magenta color optimized with the least squares projection of dubois
  8969. (green filter on left eye, magenta filter on right eye)
  8970. @item aybg
  8971. anaglyph yellow/blue gray
  8972. (yellow filter on left eye, blue filter on right eye)
  8973. @item aybh
  8974. anaglyph yellow/blue half colored
  8975. (yellow filter on left eye, blue filter on right eye)
  8976. @item aybc
  8977. anaglyph yellow/blue colored
  8978. (yellow filter on left eye, blue filter on right eye)
  8979. @item aybd
  8980. anaglyph yellow/blue color optimized with the least squares projection of dubois
  8981. (yellow filter on left eye, blue filter on right eye)
  8982. @item ml
  8983. mono output (left eye only)
  8984. @item mr
  8985. mono output (right eye only)
  8986. @item chl
  8987. checkerboard, left eye first
  8988. @item chr
  8989. checkerboard, right eye first
  8990. @item icl
  8991. interleaved columns, left eye first
  8992. @item icr
  8993. interleaved columns, right eye first
  8994. @end table
  8995. Default value is @samp{arcd}.
  8996. @end table
  8997. @subsection Examples
  8998. @itemize
  8999. @item
  9000. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  9001. @example
  9002. stereo3d=sbsl:aybd
  9003. @end example
  9004. @item
  9005. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  9006. @example
  9007. stereo3d=abl:sbsr
  9008. @end example
  9009. @end itemize
  9010. @section streamselect, astreamselect
  9011. Select video or audio streams.
  9012. The filter accepts the following options:
  9013. @table @option
  9014. @item inputs
  9015. Set number of inputs. Default is 2.
  9016. @item map
  9017. Set input indexes to remap to outputs.
  9018. @end table
  9019. @subsection Commands
  9020. The @code{streamselect} and @code{astreamselect} filter supports the following
  9021. commands:
  9022. @table @option
  9023. @item map
  9024. Set input indexes to remap to outputs.
  9025. @end table
  9026. @subsection Examples
  9027. @itemize
  9028. @item
  9029. Select first 5 seconds 1st stream and rest of time 2nd stream:
  9030. @example
  9031. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  9032. @end example
  9033. @item
  9034. Same as above, but for audio:
  9035. @example
  9036. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  9037. @end example
  9038. @end itemize
  9039. @anchor{spp}
  9040. @section spp
  9041. Apply a simple postprocessing filter that compresses and decompresses the image
  9042. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  9043. and average the results.
  9044. The filter accepts the following options:
  9045. @table @option
  9046. @item quality
  9047. Set quality. This option defines the number of levels for averaging. It accepts
  9048. an integer in the range 0-6. If set to @code{0}, the filter will have no
  9049. effect. A value of @code{6} means the higher quality. For each increment of
  9050. that value the speed drops by a factor of approximately 2. Default value is
  9051. @code{3}.
  9052. @item qp
  9053. Force a constant quantization parameter. If not set, the filter will use the QP
  9054. from the video stream (if available).
  9055. @item mode
  9056. Set thresholding mode. Available modes are:
  9057. @table @samp
  9058. @item hard
  9059. Set hard thresholding (default).
  9060. @item soft
  9061. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9062. @end table
  9063. @item use_bframe_qp
  9064. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  9065. option may cause flicker since the B-Frames have often larger QP. Default is
  9066. @code{0} (not enabled).
  9067. @end table
  9068. @anchor{subtitles}
  9069. @section subtitles
  9070. Draw subtitles on top of input video using the libass library.
  9071. To enable compilation of this filter you need to configure FFmpeg with
  9072. @code{--enable-libass}. This filter also requires a build with libavcodec and
  9073. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  9074. Alpha) subtitles format.
  9075. The filter accepts the following options:
  9076. @table @option
  9077. @item filename, f
  9078. Set the filename of the subtitle file to read. It must be specified.
  9079. @item original_size
  9080. Specify the size of the original video, the video for which the ASS file
  9081. was composed. For the syntax of this option, check the
  9082. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9083. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  9084. correctly scale the fonts if the aspect ratio has been changed.
  9085. @item fontsdir
  9086. Set a directory path containing fonts that can be used by the filter.
  9087. These fonts will be used in addition to whatever the font provider uses.
  9088. @item charenc
  9089. Set subtitles input character encoding. @code{subtitles} filter only. Only
  9090. useful if not UTF-8.
  9091. @item stream_index, si
  9092. Set subtitles stream index. @code{subtitles} filter only.
  9093. @item force_style
  9094. Override default style or script info parameters of the subtitles. It accepts a
  9095. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  9096. @end table
  9097. If the first key is not specified, it is assumed that the first value
  9098. specifies the @option{filename}.
  9099. For example, to render the file @file{sub.srt} on top of the input
  9100. video, use the command:
  9101. @example
  9102. subtitles=sub.srt
  9103. @end example
  9104. which is equivalent to:
  9105. @example
  9106. subtitles=filename=sub.srt
  9107. @end example
  9108. To render the default subtitles stream from file @file{video.mkv}, use:
  9109. @example
  9110. subtitles=video.mkv
  9111. @end example
  9112. To render the second subtitles stream from that file, use:
  9113. @example
  9114. subtitles=video.mkv:si=1
  9115. @end example
  9116. To make the subtitles stream from @file{sub.srt} appear in transparent green
  9117. @code{DejaVu Serif}, use:
  9118. @example
  9119. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  9120. @end example
  9121. @section super2xsai
  9122. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  9123. Interpolate) pixel art scaling algorithm.
  9124. Useful for enlarging pixel art images without reducing sharpness.
  9125. @section swaprect
  9126. Swap two rectangular objects in video.
  9127. This filter accepts the following options:
  9128. @table @option
  9129. @item w
  9130. Set object width.
  9131. @item h
  9132. Set object height.
  9133. @item x1
  9134. Set 1st rect x coordinate.
  9135. @item y1
  9136. Set 1st rect y coordinate.
  9137. @item x2
  9138. Set 2nd rect x coordinate.
  9139. @item y2
  9140. Set 2nd rect y coordinate.
  9141. All expressions are evaluated once for each frame.
  9142. @end table
  9143. The all options are expressions containing the following constants:
  9144. @table @option
  9145. @item w
  9146. @item h
  9147. The input width and height.
  9148. @item a
  9149. same as @var{w} / @var{h}
  9150. @item sar
  9151. input sample aspect ratio
  9152. @item dar
  9153. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  9154. @item n
  9155. The number of the input frame, starting from 0.
  9156. @item t
  9157. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  9158. @item pos
  9159. the position in the file of the input frame, NAN if unknown
  9160. @end table
  9161. @section swapuv
  9162. Swap U & V plane.
  9163. @section telecine
  9164. Apply telecine process to the video.
  9165. This filter accepts the following options:
  9166. @table @option
  9167. @item first_field
  9168. @table @samp
  9169. @item top, t
  9170. top field first
  9171. @item bottom, b
  9172. bottom field first
  9173. The default value is @code{top}.
  9174. @end table
  9175. @item pattern
  9176. A string of numbers representing the pulldown pattern you wish to apply.
  9177. The default value is @code{23}.
  9178. @end table
  9179. @example
  9180. Some typical patterns:
  9181. NTSC output (30i):
  9182. 27.5p: 32222
  9183. 24p: 23 (classic)
  9184. 24p: 2332 (preferred)
  9185. 20p: 33
  9186. 18p: 334
  9187. 16p: 3444
  9188. PAL output (25i):
  9189. 27.5p: 12222
  9190. 24p: 222222222223 ("Euro pulldown")
  9191. 16.67p: 33
  9192. 16p: 33333334
  9193. @end example
  9194. @section thumbnail
  9195. Select the most representative frame in a given sequence of consecutive frames.
  9196. The filter accepts the following options:
  9197. @table @option
  9198. @item n
  9199. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  9200. will pick one of them, and then handle the next batch of @var{n} frames until
  9201. the end. Default is @code{100}.
  9202. @end table
  9203. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  9204. value will result in a higher memory usage, so a high value is not recommended.
  9205. @subsection Examples
  9206. @itemize
  9207. @item
  9208. Extract one picture each 50 frames:
  9209. @example
  9210. thumbnail=50
  9211. @end example
  9212. @item
  9213. Complete example of a thumbnail creation with @command{ffmpeg}:
  9214. @example
  9215. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  9216. @end example
  9217. @end itemize
  9218. @section tile
  9219. Tile several successive frames together.
  9220. The filter accepts the following options:
  9221. @table @option
  9222. @item layout
  9223. Set the grid size (i.e. the number of lines and columns). For the syntax of
  9224. this option, check the
  9225. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9226. @item nb_frames
  9227. Set the maximum number of frames to render in the given area. It must be less
  9228. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  9229. the area will be used.
  9230. @item margin
  9231. Set the outer border margin in pixels.
  9232. @item padding
  9233. Set the inner border thickness (i.e. the number of pixels between frames). For
  9234. more advanced padding options (such as having different values for the edges),
  9235. refer to the pad video filter.
  9236. @item color
  9237. Specify the color of the unused area. For the syntax of this option, check the
  9238. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  9239. is "black".
  9240. @end table
  9241. @subsection Examples
  9242. @itemize
  9243. @item
  9244. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  9245. @example
  9246. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  9247. @end example
  9248. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  9249. duplicating each output frame to accommodate the originally detected frame
  9250. rate.
  9251. @item
  9252. Display @code{5} pictures in an area of @code{3x2} frames,
  9253. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  9254. mixed flat and named options:
  9255. @example
  9256. tile=3x2:nb_frames=5:padding=7:margin=2
  9257. @end example
  9258. @end itemize
  9259. @section tinterlace
  9260. Perform various types of temporal field interlacing.
  9261. Frames are counted starting from 1, so the first input frame is
  9262. considered odd.
  9263. The filter accepts the following options:
  9264. @table @option
  9265. @item mode
  9266. Specify the mode of the interlacing. This option can also be specified
  9267. as a value alone. See below for a list of values for this option.
  9268. Available values are:
  9269. @table @samp
  9270. @item merge, 0
  9271. Move odd frames into the upper field, even into the lower field,
  9272. generating a double height frame at half frame rate.
  9273. @example
  9274. ------> time
  9275. Input:
  9276. Frame 1 Frame 2 Frame 3 Frame 4
  9277. 11111 22222 33333 44444
  9278. 11111 22222 33333 44444
  9279. 11111 22222 33333 44444
  9280. 11111 22222 33333 44444
  9281. Output:
  9282. 11111 33333
  9283. 22222 44444
  9284. 11111 33333
  9285. 22222 44444
  9286. 11111 33333
  9287. 22222 44444
  9288. 11111 33333
  9289. 22222 44444
  9290. @end example
  9291. @item drop_odd, 1
  9292. Only output even frames, odd frames are dropped, generating a frame with
  9293. unchanged height at half frame rate.
  9294. @example
  9295. ------> time
  9296. Input:
  9297. Frame 1 Frame 2 Frame 3 Frame 4
  9298. 11111 22222 33333 44444
  9299. 11111 22222 33333 44444
  9300. 11111 22222 33333 44444
  9301. 11111 22222 33333 44444
  9302. Output:
  9303. 22222 44444
  9304. 22222 44444
  9305. 22222 44444
  9306. 22222 44444
  9307. @end example
  9308. @item drop_even, 2
  9309. Only output odd frames, even frames are dropped, generating a frame with
  9310. unchanged height at half frame rate.
  9311. @example
  9312. ------> time
  9313. Input:
  9314. Frame 1 Frame 2 Frame 3 Frame 4
  9315. 11111 22222 33333 44444
  9316. 11111 22222 33333 44444
  9317. 11111 22222 33333 44444
  9318. 11111 22222 33333 44444
  9319. Output:
  9320. 11111 33333
  9321. 11111 33333
  9322. 11111 33333
  9323. 11111 33333
  9324. @end example
  9325. @item pad, 3
  9326. Expand each frame to full height, but pad alternate lines with black,
  9327. generating a frame with double height at the same input frame rate.
  9328. @example
  9329. ------> time
  9330. Input:
  9331. Frame 1 Frame 2 Frame 3 Frame 4
  9332. 11111 22222 33333 44444
  9333. 11111 22222 33333 44444
  9334. 11111 22222 33333 44444
  9335. 11111 22222 33333 44444
  9336. Output:
  9337. 11111 ..... 33333 .....
  9338. ..... 22222 ..... 44444
  9339. 11111 ..... 33333 .....
  9340. ..... 22222 ..... 44444
  9341. 11111 ..... 33333 .....
  9342. ..... 22222 ..... 44444
  9343. 11111 ..... 33333 .....
  9344. ..... 22222 ..... 44444
  9345. @end example
  9346. @item interleave_top, 4
  9347. Interleave the upper field from odd frames with the lower field from
  9348. even frames, generating a frame with unchanged height at half frame rate.
  9349. @example
  9350. ------> time
  9351. Input:
  9352. Frame 1 Frame 2 Frame 3 Frame 4
  9353. 11111<- 22222 33333<- 44444
  9354. 11111 22222<- 33333 44444<-
  9355. 11111<- 22222 33333<- 44444
  9356. 11111 22222<- 33333 44444<-
  9357. Output:
  9358. 11111 33333
  9359. 22222 44444
  9360. 11111 33333
  9361. 22222 44444
  9362. @end example
  9363. @item interleave_bottom, 5
  9364. Interleave the lower field from odd frames with the upper field from
  9365. even frames, generating a frame with unchanged height at half frame rate.
  9366. @example
  9367. ------> time
  9368. Input:
  9369. Frame 1 Frame 2 Frame 3 Frame 4
  9370. 11111 22222<- 33333 44444<-
  9371. 11111<- 22222 33333<- 44444
  9372. 11111 22222<- 33333 44444<-
  9373. 11111<- 22222 33333<- 44444
  9374. Output:
  9375. 22222 44444
  9376. 11111 33333
  9377. 22222 44444
  9378. 11111 33333
  9379. @end example
  9380. @item interlacex2, 6
  9381. Double frame rate with unchanged height. Frames are inserted each
  9382. containing the second temporal field from the previous input frame and
  9383. the first temporal field from the next input frame. This mode relies on
  9384. the top_field_first flag. Useful for interlaced video displays with no
  9385. field synchronisation.
  9386. @example
  9387. ------> time
  9388. Input:
  9389. Frame 1 Frame 2 Frame 3 Frame 4
  9390. 11111 22222 33333 44444
  9391. 11111 22222 33333 44444
  9392. 11111 22222 33333 44444
  9393. 11111 22222 33333 44444
  9394. Output:
  9395. 11111 22222 22222 33333 33333 44444 44444
  9396. 11111 11111 22222 22222 33333 33333 44444
  9397. 11111 22222 22222 33333 33333 44444 44444
  9398. 11111 11111 22222 22222 33333 33333 44444
  9399. @end example
  9400. @item mergex2, 7
  9401. Move odd frames into the upper field, even into the lower field,
  9402. generating a double height frame at same frame rate.
  9403. @example
  9404. ------> time
  9405. Input:
  9406. Frame 1 Frame 2 Frame 3 Frame 4
  9407. 11111 22222 33333 44444
  9408. 11111 22222 33333 44444
  9409. 11111 22222 33333 44444
  9410. 11111 22222 33333 44444
  9411. Output:
  9412. 11111 33333 33333 55555
  9413. 22222 22222 44444 44444
  9414. 11111 33333 33333 55555
  9415. 22222 22222 44444 44444
  9416. 11111 33333 33333 55555
  9417. 22222 22222 44444 44444
  9418. 11111 33333 33333 55555
  9419. 22222 22222 44444 44444
  9420. @end example
  9421. @end table
  9422. Numeric values are deprecated but are accepted for backward
  9423. compatibility reasons.
  9424. Default mode is @code{merge}.
  9425. @item flags
  9426. Specify flags influencing the filter process.
  9427. Available value for @var{flags} is:
  9428. @table @option
  9429. @item low_pass_filter, vlfp
  9430. Enable vertical low-pass filtering in the filter.
  9431. Vertical low-pass filtering is required when creating an interlaced
  9432. destination from a progressive source which contains high-frequency
  9433. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  9434. patterning.
  9435. Vertical low-pass filtering can only be enabled for @option{mode}
  9436. @var{interleave_top} and @var{interleave_bottom}.
  9437. @end table
  9438. @end table
  9439. @section transpose
  9440. Transpose rows with columns in the input video and optionally flip it.
  9441. It accepts the following parameters:
  9442. @table @option
  9443. @item dir
  9444. Specify the transposition direction.
  9445. Can assume the following values:
  9446. @table @samp
  9447. @item 0, 4, cclock_flip
  9448. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  9449. @example
  9450. L.R L.l
  9451. . . -> . .
  9452. l.r R.r
  9453. @end example
  9454. @item 1, 5, clock
  9455. Rotate by 90 degrees clockwise, that is:
  9456. @example
  9457. L.R l.L
  9458. . . -> . .
  9459. l.r r.R
  9460. @end example
  9461. @item 2, 6, cclock
  9462. Rotate by 90 degrees counterclockwise, that is:
  9463. @example
  9464. L.R R.r
  9465. . . -> . .
  9466. l.r L.l
  9467. @end example
  9468. @item 3, 7, clock_flip
  9469. Rotate by 90 degrees clockwise and vertically flip, that is:
  9470. @example
  9471. L.R r.R
  9472. . . -> . .
  9473. l.r l.L
  9474. @end example
  9475. @end table
  9476. For values between 4-7, the transposition is only done if the input
  9477. video geometry is portrait and not landscape. These values are
  9478. deprecated, the @code{passthrough} option should be used instead.
  9479. Numerical values are deprecated, and should be dropped in favor of
  9480. symbolic constants.
  9481. @item passthrough
  9482. Do not apply the transposition if the input geometry matches the one
  9483. specified by the specified value. It accepts the following values:
  9484. @table @samp
  9485. @item none
  9486. Always apply transposition.
  9487. @item portrait
  9488. Preserve portrait geometry (when @var{height} >= @var{width}).
  9489. @item landscape
  9490. Preserve landscape geometry (when @var{width} >= @var{height}).
  9491. @end table
  9492. Default value is @code{none}.
  9493. @end table
  9494. For example to rotate by 90 degrees clockwise and preserve portrait
  9495. layout:
  9496. @example
  9497. transpose=dir=1:passthrough=portrait
  9498. @end example
  9499. The command above can also be specified as:
  9500. @example
  9501. transpose=1:portrait
  9502. @end example
  9503. @section trim
  9504. Trim the input so that the output contains one continuous subpart of the input.
  9505. It accepts the following parameters:
  9506. @table @option
  9507. @item start
  9508. Specify the time of the start of the kept section, i.e. the frame with the
  9509. timestamp @var{start} will be the first frame in the output.
  9510. @item end
  9511. Specify the time of the first frame that will be dropped, i.e. the frame
  9512. immediately preceding the one with the timestamp @var{end} will be the last
  9513. frame in the output.
  9514. @item start_pts
  9515. This is the same as @var{start}, except this option sets the start timestamp
  9516. in timebase units instead of seconds.
  9517. @item end_pts
  9518. This is the same as @var{end}, except this option sets the end timestamp
  9519. in timebase units instead of seconds.
  9520. @item duration
  9521. The maximum duration of the output in seconds.
  9522. @item start_frame
  9523. The number of the first frame that should be passed to the output.
  9524. @item end_frame
  9525. The number of the first frame that should be dropped.
  9526. @end table
  9527. @option{start}, @option{end}, and @option{duration} are expressed as time
  9528. duration specifications; see
  9529. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  9530. for the accepted syntax.
  9531. Note that the first two sets of the start/end options and the @option{duration}
  9532. option look at the frame timestamp, while the _frame variants simply count the
  9533. frames that pass through the filter. Also note that this filter does not modify
  9534. the timestamps. If you wish for the output timestamps to start at zero, insert a
  9535. setpts filter after the trim filter.
  9536. If multiple start or end options are set, this filter tries to be greedy and
  9537. keep all the frames that match at least one of the specified constraints. To keep
  9538. only the part that matches all the constraints at once, chain multiple trim
  9539. filters.
  9540. The defaults are such that all the input is kept. So it is possible to set e.g.
  9541. just the end values to keep everything before the specified time.
  9542. Examples:
  9543. @itemize
  9544. @item
  9545. Drop everything except the second minute of input:
  9546. @example
  9547. ffmpeg -i INPUT -vf trim=60:120
  9548. @end example
  9549. @item
  9550. Keep only the first second:
  9551. @example
  9552. ffmpeg -i INPUT -vf trim=duration=1
  9553. @end example
  9554. @end itemize
  9555. @anchor{unsharp}
  9556. @section unsharp
  9557. Sharpen or blur the input video.
  9558. It accepts the following parameters:
  9559. @table @option
  9560. @item luma_msize_x, lx
  9561. Set the luma matrix horizontal size. It must be an odd integer between
  9562. 3 and 63. The default value is 5.
  9563. @item luma_msize_y, ly
  9564. Set the luma matrix vertical size. It must be an odd integer between 3
  9565. and 63. The default value is 5.
  9566. @item luma_amount, la
  9567. Set the luma effect strength. It must be a floating point number, reasonable
  9568. values lay between -1.5 and 1.5.
  9569. Negative values will blur the input video, while positive values will
  9570. sharpen it, a value of zero will disable the effect.
  9571. Default value is 1.0.
  9572. @item chroma_msize_x, cx
  9573. Set the chroma matrix horizontal size. It must be an odd integer
  9574. between 3 and 63. The default value is 5.
  9575. @item chroma_msize_y, cy
  9576. Set the chroma matrix vertical size. It must be an odd integer
  9577. between 3 and 63. The default value is 5.
  9578. @item chroma_amount, ca
  9579. Set the chroma effect strength. It must be a floating point number, reasonable
  9580. values lay between -1.5 and 1.5.
  9581. Negative values will blur the input video, while positive values will
  9582. sharpen it, a value of zero will disable the effect.
  9583. Default value is 0.0.
  9584. @item opencl
  9585. If set to 1, specify using OpenCL capabilities, only available if
  9586. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  9587. @end table
  9588. All parameters are optional and default to the equivalent of the
  9589. string '5:5:1.0:5:5:0.0'.
  9590. @subsection Examples
  9591. @itemize
  9592. @item
  9593. Apply strong luma sharpen effect:
  9594. @example
  9595. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  9596. @end example
  9597. @item
  9598. Apply a strong blur of both luma and chroma parameters:
  9599. @example
  9600. unsharp=7:7:-2:7:7:-2
  9601. @end example
  9602. @end itemize
  9603. @section uspp
  9604. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  9605. the image at several (or - in the case of @option{quality} level @code{8} - all)
  9606. shifts and average the results.
  9607. The way this differs from the behavior of spp is that uspp actually encodes &
  9608. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  9609. DCT similar to MJPEG.
  9610. The filter accepts the following options:
  9611. @table @option
  9612. @item quality
  9613. Set quality. This option defines the number of levels for averaging. It accepts
  9614. an integer in the range 0-8. If set to @code{0}, the filter will have no
  9615. effect. A value of @code{8} means the higher quality. For each increment of
  9616. that value the speed drops by a factor of approximately 2. Default value is
  9617. @code{3}.
  9618. @item qp
  9619. Force a constant quantization parameter. If not set, the filter will use the QP
  9620. from the video stream (if available).
  9621. @end table
  9622. @section vectorscope
  9623. Display 2 color component values in the two dimensional graph (which is called
  9624. a vectorscope).
  9625. This filter accepts the following options:
  9626. @table @option
  9627. @item mode, m
  9628. Set vectorscope mode.
  9629. It accepts the following values:
  9630. @table @samp
  9631. @item gray
  9632. Gray values are displayed on graph, higher brightness means more pixels have
  9633. same component color value on location in graph. This is the default mode.
  9634. @item color
  9635. Gray values are displayed on graph. Surrounding pixels values which are not
  9636. present in video frame are drawn in gradient of 2 color components which are
  9637. set by option @code{x} and @code{y}. The 3rd color component is static.
  9638. @item color2
  9639. Actual color components values present in video frame are displayed on graph.
  9640. @item color3
  9641. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  9642. on graph increases value of another color component, which is luminance by
  9643. default values of @code{x} and @code{y}.
  9644. @item color4
  9645. Actual colors present in video frame are displayed on graph. If two different
  9646. colors map to same position on graph then color with higher value of component
  9647. not present in graph is picked.
  9648. @item color5
  9649. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  9650. component picked from radial gradient.
  9651. @end table
  9652. @item x
  9653. Set which color component will be represented on X-axis. Default is @code{1}.
  9654. @item y
  9655. Set which color component will be represented on Y-axis. Default is @code{2}.
  9656. @item intensity, i
  9657. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  9658. of color component which represents frequency of (X, Y) location in graph.
  9659. @item envelope, e
  9660. @table @samp
  9661. @item none
  9662. No envelope, this is default.
  9663. @item instant
  9664. Instant envelope, even darkest single pixel will be clearly highlighted.
  9665. @item peak
  9666. Hold maximum and minimum values presented in graph over time. This way you
  9667. can still spot out of range values without constantly looking at vectorscope.
  9668. @item peak+instant
  9669. Peak and instant envelope combined together.
  9670. @end table
  9671. @item graticule, g
  9672. Set what kind of graticule to draw.
  9673. @table @samp
  9674. @item none
  9675. @item green
  9676. @item color
  9677. @end table
  9678. @item opacity, o
  9679. Set graticule opacity.
  9680. @item flags, f
  9681. Set graticule flags.
  9682. @table @samp
  9683. @item white
  9684. Draw graticule for white point.
  9685. @item black
  9686. Draw graticule for black point.
  9687. @end table
  9688. @item bgopacity, b
  9689. Set background opacity.
  9690. @item lthreshold, l
  9691. Set low threshold for color component not represented on X or Y axis.
  9692. Values lower than this value will be ignored. Default is 0.
  9693. Note this value is multiplied with actual max possible value one pixel component
  9694. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  9695. is 0.1 * 255 = 25.
  9696. @item hthreshold, h
  9697. Set high threshold for color component not represented on X or Y axis.
  9698. Values higher than this value will be ignored. Default is 1.
  9699. Note this value is multiplied with actual max possible value one pixel component
  9700. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  9701. is 0.9 * 255 = 230.
  9702. @end table
  9703. @anchor{vidstabdetect}
  9704. @section vidstabdetect
  9705. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  9706. @ref{vidstabtransform} for pass 2.
  9707. This filter generates a file with relative translation and rotation
  9708. transform information about subsequent frames, which is then used by
  9709. the @ref{vidstabtransform} filter.
  9710. To enable compilation of this filter you need to configure FFmpeg with
  9711. @code{--enable-libvidstab}.
  9712. This filter accepts the following options:
  9713. @table @option
  9714. @item result
  9715. Set the path to the file used to write the transforms information.
  9716. Default value is @file{transforms.trf}.
  9717. @item shakiness
  9718. Set how shaky the video is and how quick the camera is. It accepts an
  9719. integer in the range 1-10, a value of 1 means little shakiness, a
  9720. value of 10 means strong shakiness. Default value is 5.
  9721. @item accuracy
  9722. Set the accuracy of the detection process. It must be a value in the
  9723. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  9724. accuracy. Default value is 15.
  9725. @item stepsize
  9726. Set stepsize of the search process. The region around minimum is
  9727. scanned with 1 pixel resolution. Default value is 6.
  9728. @item mincontrast
  9729. Set minimum contrast. Below this value a local measurement field is
  9730. discarded. Must be a floating point value in the range 0-1. Default
  9731. value is 0.3.
  9732. @item tripod
  9733. Set reference frame number for tripod mode.
  9734. If enabled, the motion of the frames is compared to a reference frame
  9735. in the filtered stream, identified by the specified number. The idea
  9736. is to compensate all movements in a more-or-less static scene and keep
  9737. the camera view absolutely still.
  9738. If set to 0, it is disabled. The frames are counted starting from 1.
  9739. @item show
  9740. Show fields and transforms in the resulting frames. It accepts an
  9741. integer in the range 0-2. Default value is 0, which disables any
  9742. visualization.
  9743. @end table
  9744. @subsection Examples
  9745. @itemize
  9746. @item
  9747. Use default values:
  9748. @example
  9749. vidstabdetect
  9750. @end example
  9751. @item
  9752. Analyze strongly shaky movie and put the results in file
  9753. @file{mytransforms.trf}:
  9754. @example
  9755. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  9756. @end example
  9757. @item
  9758. Visualize the result of internal transformations in the resulting
  9759. video:
  9760. @example
  9761. vidstabdetect=show=1
  9762. @end example
  9763. @item
  9764. Analyze a video with medium shakiness using @command{ffmpeg}:
  9765. @example
  9766. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  9767. @end example
  9768. @end itemize
  9769. @anchor{vidstabtransform}
  9770. @section vidstabtransform
  9771. Video stabilization/deshaking: pass 2 of 2,
  9772. see @ref{vidstabdetect} for pass 1.
  9773. Read a file with transform information for each frame and
  9774. apply/compensate them. Together with the @ref{vidstabdetect}
  9775. filter this can be used to deshake videos. See also
  9776. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  9777. the @ref{unsharp} filter, see below.
  9778. To enable compilation of this filter you need to configure FFmpeg with
  9779. @code{--enable-libvidstab}.
  9780. @subsection Options
  9781. @table @option
  9782. @item input
  9783. Set path to the file used to read the transforms. Default value is
  9784. @file{transforms.trf}.
  9785. @item smoothing
  9786. Set the number of frames (value*2 + 1) used for lowpass filtering the
  9787. camera movements. Default value is 10.
  9788. For example a number of 10 means that 21 frames are used (10 in the
  9789. past and 10 in the future) to smoothen the motion in the video. A
  9790. larger value leads to a smoother video, but limits the acceleration of
  9791. the camera (pan/tilt movements). 0 is a special case where a static
  9792. camera is simulated.
  9793. @item optalgo
  9794. Set the camera path optimization algorithm.
  9795. Accepted values are:
  9796. @table @samp
  9797. @item gauss
  9798. gaussian kernel low-pass filter on camera motion (default)
  9799. @item avg
  9800. averaging on transformations
  9801. @end table
  9802. @item maxshift
  9803. Set maximal number of pixels to translate frames. Default value is -1,
  9804. meaning no limit.
  9805. @item maxangle
  9806. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  9807. value is -1, meaning no limit.
  9808. @item crop
  9809. Specify how to deal with borders that may be visible due to movement
  9810. compensation.
  9811. Available values are:
  9812. @table @samp
  9813. @item keep
  9814. keep image information from previous frame (default)
  9815. @item black
  9816. fill the border black
  9817. @end table
  9818. @item invert
  9819. Invert transforms if set to 1. Default value is 0.
  9820. @item relative
  9821. Consider transforms as relative to previous frame if set to 1,
  9822. absolute if set to 0. Default value is 0.
  9823. @item zoom
  9824. Set percentage to zoom. A positive value will result in a zoom-in
  9825. effect, a negative value in a zoom-out effect. Default value is 0 (no
  9826. zoom).
  9827. @item optzoom
  9828. Set optimal zooming to avoid borders.
  9829. Accepted values are:
  9830. @table @samp
  9831. @item 0
  9832. disabled
  9833. @item 1
  9834. optimal static zoom value is determined (only very strong movements
  9835. will lead to visible borders) (default)
  9836. @item 2
  9837. optimal adaptive zoom value is determined (no borders will be
  9838. visible), see @option{zoomspeed}
  9839. @end table
  9840. Note that the value given at zoom is added to the one calculated here.
  9841. @item zoomspeed
  9842. Set percent to zoom maximally each frame (enabled when
  9843. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  9844. 0.25.
  9845. @item interpol
  9846. Specify type of interpolation.
  9847. Available values are:
  9848. @table @samp
  9849. @item no
  9850. no interpolation
  9851. @item linear
  9852. linear only horizontal
  9853. @item bilinear
  9854. linear in both directions (default)
  9855. @item bicubic
  9856. cubic in both directions (slow)
  9857. @end table
  9858. @item tripod
  9859. Enable virtual tripod mode if set to 1, which is equivalent to
  9860. @code{relative=0:smoothing=0}. Default value is 0.
  9861. Use also @code{tripod} option of @ref{vidstabdetect}.
  9862. @item debug
  9863. Increase log verbosity if set to 1. Also the detected global motions
  9864. are written to the temporary file @file{global_motions.trf}. Default
  9865. value is 0.
  9866. @end table
  9867. @subsection Examples
  9868. @itemize
  9869. @item
  9870. Use @command{ffmpeg} for a typical stabilization with default values:
  9871. @example
  9872. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  9873. @end example
  9874. Note the use of the @ref{unsharp} filter which is always recommended.
  9875. @item
  9876. Zoom in a bit more and load transform data from a given file:
  9877. @example
  9878. vidstabtransform=zoom=5:input="mytransforms.trf"
  9879. @end example
  9880. @item
  9881. Smoothen the video even more:
  9882. @example
  9883. vidstabtransform=smoothing=30
  9884. @end example
  9885. @end itemize
  9886. @section vflip
  9887. Flip the input video vertically.
  9888. For example, to vertically flip a video with @command{ffmpeg}:
  9889. @example
  9890. ffmpeg -i in.avi -vf "vflip" out.avi
  9891. @end example
  9892. @anchor{vignette}
  9893. @section vignette
  9894. Make or reverse a natural vignetting effect.
  9895. The filter accepts the following options:
  9896. @table @option
  9897. @item angle, a
  9898. Set lens angle expression as a number of radians.
  9899. The value is clipped in the @code{[0,PI/2]} range.
  9900. Default value: @code{"PI/5"}
  9901. @item x0
  9902. @item y0
  9903. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  9904. by default.
  9905. @item mode
  9906. Set forward/backward mode.
  9907. Available modes are:
  9908. @table @samp
  9909. @item forward
  9910. The larger the distance from the central point, the darker the image becomes.
  9911. @item backward
  9912. The larger the distance from the central point, the brighter the image becomes.
  9913. This can be used to reverse a vignette effect, though there is no automatic
  9914. detection to extract the lens @option{angle} and other settings (yet). It can
  9915. also be used to create a burning effect.
  9916. @end table
  9917. Default value is @samp{forward}.
  9918. @item eval
  9919. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  9920. It accepts the following values:
  9921. @table @samp
  9922. @item init
  9923. Evaluate expressions only once during the filter initialization.
  9924. @item frame
  9925. Evaluate expressions for each incoming frame. This is way slower than the
  9926. @samp{init} mode since it requires all the scalers to be re-computed, but it
  9927. allows advanced dynamic expressions.
  9928. @end table
  9929. Default value is @samp{init}.
  9930. @item dither
  9931. Set dithering to reduce the circular banding effects. Default is @code{1}
  9932. (enabled).
  9933. @item aspect
  9934. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  9935. Setting this value to the SAR of the input will make a rectangular vignetting
  9936. following the dimensions of the video.
  9937. Default is @code{1/1}.
  9938. @end table
  9939. @subsection Expressions
  9940. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  9941. following parameters.
  9942. @table @option
  9943. @item w
  9944. @item h
  9945. input width and height
  9946. @item n
  9947. the number of input frame, starting from 0
  9948. @item pts
  9949. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  9950. @var{TB} units, NAN if undefined
  9951. @item r
  9952. frame rate of the input video, NAN if the input frame rate is unknown
  9953. @item t
  9954. the PTS (Presentation TimeStamp) of the filtered video frame,
  9955. expressed in seconds, NAN if undefined
  9956. @item tb
  9957. time base of the input video
  9958. @end table
  9959. @subsection Examples
  9960. @itemize
  9961. @item
  9962. Apply simple strong vignetting effect:
  9963. @example
  9964. vignette=PI/4
  9965. @end example
  9966. @item
  9967. Make a flickering vignetting:
  9968. @example
  9969. vignette='PI/4+random(1)*PI/50':eval=frame
  9970. @end example
  9971. @end itemize
  9972. @section vstack
  9973. Stack input videos vertically.
  9974. All streams must be of same pixel format and of same width.
  9975. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  9976. to create same output.
  9977. The filter accept the following option:
  9978. @table @option
  9979. @item inputs
  9980. Set number of input streams. Default is 2.
  9981. @item shortest
  9982. If set to 1, force the output to terminate when the shortest input
  9983. terminates. Default value is 0.
  9984. @end table
  9985. @section w3fdif
  9986. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  9987. Deinterlacing Filter").
  9988. Based on the process described by Martin Weston for BBC R&D, and
  9989. implemented based on the de-interlace algorithm written by Jim
  9990. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  9991. uses filter coefficients calculated by BBC R&D.
  9992. There are two sets of filter coefficients, so called "simple":
  9993. and "complex". Which set of filter coefficients is used can
  9994. be set by passing an optional parameter:
  9995. @table @option
  9996. @item filter
  9997. Set the interlacing filter coefficients. Accepts one of the following values:
  9998. @table @samp
  9999. @item simple
  10000. Simple filter coefficient set.
  10001. @item complex
  10002. More-complex filter coefficient set.
  10003. @end table
  10004. Default value is @samp{complex}.
  10005. @item deint
  10006. Specify which frames to deinterlace. Accept one of the following values:
  10007. @table @samp
  10008. @item all
  10009. Deinterlace all frames,
  10010. @item interlaced
  10011. Only deinterlace frames marked as interlaced.
  10012. @end table
  10013. Default value is @samp{all}.
  10014. @end table
  10015. @section waveform
  10016. Video waveform monitor.
  10017. The waveform monitor plots color component intensity. By default luminance
  10018. only. Each column of the waveform corresponds to a column of pixels in the
  10019. source video.
  10020. It accepts the following options:
  10021. @table @option
  10022. @item mode, m
  10023. Can be either @code{row}, or @code{column}. Default is @code{column}.
  10024. In row mode, the graph on the left side represents color component value 0 and
  10025. the right side represents value = 255. In column mode, the top side represents
  10026. color component value = 0 and bottom side represents value = 255.
  10027. @item intensity, i
  10028. Set intensity. Smaller values are useful to find out how many values of the same
  10029. luminance are distributed across input rows/columns.
  10030. Default value is @code{0.04}. Allowed range is [0, 1].
  10031. @item mirror, r
  10032. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  10033. In mirrored mode, higher values will be represented on the left
  10034. side for @code{row} mode and at the top for @code{column} mode. Default is
  10035. @code{1} (mirrored).
  10036. @item display, d
  10037. Set display mode.
  10038. It accepts the following values:
  10039. @table @samp
  10040. @item overlay
  10041. Presents information identical to that in the @code{parade}, except
  10042. that the graphs representing color components are superimposed directly
  10043. over one another.
  10044. This display mode makes it easier to spot relative differences or similarities
  10045. in overlapping areas of the color components that are supposed to be identical,
  10046. such as neutral whites, grays, or blacks.
  10047. @item parade
  10048. Display separate graph for the color components side by side in
  10049. @code{row} mode or one below the other in @code{column} mode.
  10050. Using this display mode makes it easy to spot color casts in the highlights
  10051. and shadows of an image, by comparing the contours of the top and the bottom
  10052. graphs of each waveform. Since whites, grays, and blacks are characterized
  10053. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  10054. should display three waveforms of roughly equal width/height. If not, the
  10055. correction is easy to perform by making level adjustments the three waveforms.
  10056. @end table
  10057. Default is @code{parade}.
  10058. @item components, c
  10059. Set which color components to display. Default is 1, which means only luminance
  10060. or red color component if input is in RGB colorspace. If is set for example to
  10061. 7 it will display all 3 (if) available color components.
  10062. @item envelope, e
  10063. @table @samp
  10064. @item none
  10065. No envelope, this is default.
  10066. @item instant
  10067. Instant envelope, minimum and maximum values presented in graph will be easily
  10068. visible even with small @code{step} value.
  10069. @item peak
  10070. Hold minimum and maximum values presented in graph across time. This way you
  10071. can still spot out of range values without constantly looking at waveforms.
  10072. @item peak+instant
  10073. Peak and instant envelope combined together.
  10074. @end table
  10075. @item filter, f
  10076. @table @samp
  10077. @item lowpass
  10078. No filtering, this is default.
  10079. @item flat
  10080. Luma and chroma combined together.
  10081. @item aflat
  10082. Similar as above, but shows difference between blue and red chroma.
  10083. @item chroma
  10084. Displays only chroma.
  10085. @item achroma
  10086. Similar as above, but shows difference between blue and red chroma.
  10087. @item color
  10088. Displays actual color value on waveform.
  10089. @end table
  10090. @end table
  10091. @section xbr
  10092. Apply the xBR high-quality magnification filter which is designed for pixel
  10093. art. It follows a set of edge-detection rules, see
  10094. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  10095. It accepts the following option:
  10096. @table @option
  10097. @item n
  10098. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  10099. @code{3xBR} and @code{4} for @code{4xBR}.
  10100. Default is @code{3}.
  10101. @end table
  10102. @anchor{yadif}
  10103. @section yadif
  10104. Deinterlace the input video ("yadif" means "yet another deinterlacing
  10105. filter").
  10106. It accepts the following parameters:
  10107. @table @option
  10108. @item mode
  10109. The interlacing mode to adopt. It accepts one of the following values:
  10110. @table @option
  10111. @item 0, send_frame
  10112. Output one frame for each frame.
  10113. @item 1, send_field
  10114. Output one frame for each field.
  10115. @item 2, send_frame_nospatial
  10116. Like @code{send_frame}, but it skips the spatial interlacing check.
  10117. @item 3, send_field_nospatial
  10118. Like @code{send_field}, but it skips the spatial interlacing check.
  10119. @end table
  10120. The default value is @code{send_frame}.
  10121. @item parity
  10122. The picture field parity assumed for the input interlaced video. It accepts one
  10123. of the following values:
  10124. @table @option
  10125. @item 0, tff
  10126. Assume the top field is first.
  10127. @item 1, bff
  10128. Assume the bottom field is first.
  10129. @item -1, auto
  10130. Enable automatic detection of field parity.
  10131. @end table
  10132. The default value is @code{auto}.
  10133. If the interlacing is unknown or the decoder does not export this information,
  10134. top field first will be assumed.
  10135. @item deint
  10136. Specify which frames to deinterlace. Accept one of the following
  10137. values:
  10138. @table @option
  10139. @item 0, all
  10140. Deinterlace all frames.
  10141. @item 1, interlaced
  10142. Only deinterlace frames marked as interlaced.
  10143. @end table
  10144. The default value is @code{all}.
  10145. @end table
  10146. @section zoompan
  10147. Apply Zoom & Pan effect.
  10148. This filter accepts the following options:
  10149. @table @option
  10150. @item zoom, z
  10151. Set the zoom expression. Default is 1.
  10152. @item x
  10153. @item y
  10154. Set the x and y expression. Default is 0.
  10155. @item d
  10156. Set the duration expression in number of frames.
  10157. This sets for how many number of frames effect will last for
  10158. single input image.
  10159. @item s
  10160. Set the output image size, default is 'hd720'.
  10161. @item fps
  10162. Set the output frame rate, default is '25'.
  10163. @end table
  10164. Each expression can contain the following constants:
  10165. @table @option
  10166. @item in_w, iw
  10167. Input width.
  10168. @item in_h, ih
  10169. Input height.
  10170. @item out_w, ow
  10171. Output width.
  10172. @item out_h, oh
  10173. Output height.
  10174. @item in
  10175. Input frame count.
  10176. @item on
  10177. Output frame count.
  10178. @item x
  10179. @item y
  10180. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  10181. for current input frame.
  10182. @item px
  10183. @item py
  10184. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  10185. not yet such frame (first input frame).
  10186. @item zoom
  10187. Last calculated zoom from 'z' expression for current input frame.
  10188. @item pzoom
  10189. Last calculated zoom of last output frame of previous input frame.
  10190. @item duration
  10191. Number of output frames for current input frame. Calculated from 'd' expression
  10192. for each input frame.
  10193. @item pduration
  10194. number of output frames created for previous input frame
  10195. @item a
  10196. Rational number: input width / input height
  10197. @item sar
  10198. sample aspect ratio
  10199. @item dar
  10200. display aspect ratio
  10201. @end table
  10202. @subsection Examples
  10203. @itemize
  10204. @item
  10205. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  10206. @example
  10207. 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
  10208. @end example
  10209. @item
  10210. Zoom-in up to 1.5 and pan always at center of picture:
  10211. @example
  10212. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  10213. @end example
  10214. @end itemize
  10215. @section zscale
  10216. Scale (resize) the input video, using the z.lib library:
  10217. https://github.com/sekrit-twc/zimg.
  10218. The zscale filter forces the output display aspect ratio to be the same
  10219. as the input, by changing the output sample aspect ratio.
  10220. If the input image format is different from the format requested by
  10221. the next filter, the zscale filter will convert the input to the
  10222. requested format.
  10223. @subsection Options
  10224. The filter accepts the following options.
  10225. @table @option
  10226. @item width, w
  10227. @item height, h
  10228. Set the output video dimension expression. Default value is the input
  10229. dimension.
  10230. If the @var{width} or @var{w} is 0, the input width is used for the output.
  10231. If the @var{height} or @var{h} is 0, the input height is used for the output.
  10232. If one of the values is -1, the zscale filter will use a value that
  10233. maintains the aspect ratio of the input image, calculated from the
  10234. other specified dimension. If both of them are -1, the input size is
  10235. used
  10236. If one of the values is -n with n > 1, the zscale filter will also use a value
  10237. that maintains the aspect ratio of the input image, calculated from the other
  10238. specified dimension. After that it will, however, make sure that the calculated
  10239. dimension is divisible by n and adjust the value if necessary.
  10240. See below for the list of accepted constants for use in the dimension
  10241. expression.
  10242. @item size, s
  10243. Set the video size. For the syntax of this option, check the
  10244. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10245. @item dither, d
  10246. Set the dither type.
  10247. Possible values are:
  10248. @table @var
  10249. @item none
  10250. @item ordered
  10251. @item random
  10252. @item error_diffusion
  10253. @end table
  10254. Default is none.
  10255. @item filter, f
  10256. Set the resize filter type.
  10257. Possible values are:
  10258. @table @var
  10259. @item point
  10260. @item bilinear
  10261. @item bicubic
  10262. @item spline16
  10263. @item spline36
  10264. @item lanczos
  10265. @end table
  10266. Default is bilinear.
  10267. @item range, r
  10268. Set the color range.
  10269. Possible values are:
  10270. @table @var
  10271. @item input
  10272. @item limited
  10273. @item full
  10274. @end table
  10275. Default is same as input.
  10276. @item primaries, p
  10277. Set the color primaries.
  10278. Possible values are:
  10279. @table @var
  10280. @item input
  10281. @item 709
  10282. @item unspecified
  10283. @item 170m
  10284. @item 240m
  10285. @item 2020
  10286. @end table
  10287. Default is same as input.
  10288. @item transfer, t
  10289. Set the transfer characteristics.
  10290. Possible values are:
  10291. @table @var
  10292. @item input
  10293. @item 709
  10294. @item unspecified
  10295. @item 601
  10296. @item linear
  10297. @item 2020_10
  10298. @item 2020_12
  10299. @end table
  10300. Default is same as input.
  10301. @item matrix, m
  10302. Set the colorspace matrix.
  10303. Possible value are:
  10304. @table @var
  10305. @item input
  10306. @item 709
  10307. @item unspecified
  10308. @item 470bg
  10309. @item 170m
  10310. @item 2020_ncl
  10311. @item 2020_cl
  10312. @end table
  10313. Default is same as input.
  10314. @item rangein, rin
  10315. Set the input color range.
  10316. Possible values are:
  10317. @table @var
  10318. @item input
  10319. @item limited
  10320. @item full
  10321. @end table
  10322. Default is same as input.
  10323. @item primariesin, pin
  10324. Set the input color primaries.
  10325. Possible values are:
  10326. @table @var
  10327. @item input
  10328. @item 709
  10329. @item unspecified
  10330. @item 170m
  10331. @item 240m
  10332. @item 2020
  10333. @end table
  10334. Default is same as input.
  10335. @item transferin, tin
  10336. Set the input transfer characteristics.
  10337. Possible values are:
  10338. @table @var
  10339. @item input
  10340. @item 709
  10341. @item unspecified
  10342. @item 601
  10343. @item linear
  10344. @item 2020_10
  10345. @item 2020_12
  10346. @end table
  10347. Default is same as input.
  10348. @item matrixin, min
  10349. Set the input colorspace matrix.
  10350. Possible value are:
  10351. @table @var
  10352. @item input
  10353. @item 709
  10354. @item unspecified
  10355. @item 470bg
  10356. @item 170m
  10357. @item 2020_ncl
  10358. @item 2020_cl
  10359. @end table
  10360. @end table
  10361. The values of the @option{w} and @option{h} options are expressions
  10362. containing the following constants:
  10363. @table @var
  10364. @item in_w
  10365. @item in_h
  10366. The input width and height
  10367. @item iw
  10368. @item ih
  10369. These are the same as @var{in_w} and @var{in_h}.
  10370. @item out_w
  10371. @item out_h
  10372. The output (scaled) width and height
  10373. @item ow
  10374. @item oh
  10375. These are the same as @var{out_w} and @var{out_h}
  10376. @item a
  10377. The same as @var{iw} / @var{ih}
  10378. @item sar
  10379. input sample aspect ratio
  10380. @item dar
  10381. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  10382. @item hsub
  10383. @item vsub
  10384. horizontal and vertical input chroma subsample values. For example for the
  10385. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10386. @item ohsub
  10387. @item ovsub
  10388. horizontal and vertical output chroma subsample values. For example for the
  10389. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10390. @end table
  10391. @table @option
  10392. @end table
  10393. @c man end VIDEO FILTERS
  10394. @chapter Video Sources
  10395. @c man begin VIDEO SOURCES
  10396. Below is a description of the currently available video sources.
  10397. @section buffer
  10398. Buffer video frames, and make them available to the filter chain.
  10399. This source is mainly intended for a programmatic use, in particular
  10400. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  10401. It accepts the following parameters:
  10402. @table @option
  10403. @item video_size
  10404. Specify the size (width and height) of the buffered video frames. For the
  10405. syntax of this option, check the
  10406. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10407. @item width
  10408. The input video width.
  10409. @item height
  10410. The input video height.
  10411. @item pix_fmt
  10412. A string representing the pixel format of the buffered video frames.
  10413. It may be a number corresponding to a pixel format, or a pixel format
  10414. name.
  10415. @item time_base
  10416. Specify the timebase assumed by the timestamps of the buffered frames.
  10417. @item frame_rate
  10418. Specify the frame rate expected for the video stream.
  10419. @item pixel_aspect, sar
  10420. The sample (pixel) aspect ratio of the input video.
  10421. @item sws_param
  10422. Specify the optional parameters to be used for the scale filter which
  10423. is automatically inserted when an input change is detected in the
  10424. input size or format.
  10425. @item hw_frames_ctx
  10426. When using a hardware pixel format, this should be a reference to an
  10427. AVHWFramesContext describing input frames.
  10428. @end table
  10429. For example:
  10430. @example
  10431. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  10432. @end example
  10433. will instruct the source to accept video frames with size 320x240 and
  10434. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  10435. square pixels (1:1 sample aspect ratio).
  10436. Since the pixel format with name "yuv410p" corresponds to the number 6
  10437. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  10438. this example corresponds to:
  10439. @example
  10440. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  10441. @end example
  10442. Alternatively, the options can be specified as a flat string, but this
  10443. syntax is deprecated:
  10444. @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}]
  10445. @section cellauto
  10446. Create a pattern generated by an elementary cellular automaton.
  10447. The initial state of the cellular automaton can be defined through the
  10448. @option{filename}, and @option{pattern} options. If such options are
  10449. not specified an initial state is created randomly.
  10450. At each new frame a new row in the video is filled with the result of
  10451. the cellular automaton next generation. The behavior when the whole
  10452. frame is filled is defined by the @option{scroll} option.
  10453. This source accepts the following options:
  10454. @table @option
  10455. @item filename, f
  10456. Read the initial cellular automaton state, i.e. the starting row, from
  10457. the specified file.
  10458. In the file, each non-whitespace character is considered an alive
  10459. cell, a newline will terminate the row, and further characters in the
  10460. file will be ignored.
  10461. @item pattern, p
  10462. Read the initial cellular automaton state, i.e. the starting row, from
  10463. the specified string.
  10464. Each non-whitespace character in the string is considered an alive
  10465. cell, a newline will terminate the row, and further characters in the
  10466. string will be ignored.
  10467. @item rate, r
  10468. Set the video rate, that is the number of frames generated per second.
  10469. Default is 25.
  10470. @item random_fill_ratio, ratio
  10471. Set the random fill ratio for the initial cellular automaton row. It
  10472. is a floating point number value ranging from 0 to 1, defaults to
  10473. 1/PHI.
  10474. This option is ignored when a file or a pattern is specified.
  10475. @item random_seed, seed
  10476. Set the seed for filling randomly the initial row, must be an integer
  10477. included between 0 and UINT32_MAX. If not specified, or if explicitly
  10478. set to -1, the filter will try to use a good random seed on a best
  10479. effort basis.
  10480. @item rule
  10481. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  10482. Default value is 110.
  10483. @item size, s
  10484. Set the size of the output video. For the syntax of this option, check the
  10485. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10486. If @option{filename} or @option{pattern} is specified, the size is set
  10487. by default to the width of the specified initial state row, and the
  10488. height is set to @var{width} * PHI.
  10489. If @option{size} is set, it must contain the width of the specified
  10490. pattern string, and the specified pattern will be centered in the
  10491. larger row.
  10492. If a filename or a pattern string is not specified, the size value
  10493. defaults to "320x518" (used for a randomly generated initial state).
  10494. @item scroll
  10495. If set to 1, scroll the output upward when all the rows in the output
  10496. have been already filled. If set to 0, the new generated row will be
  10497. written over the top row just after the bottom row is filled.
  10498. Defaults to 1.
  10499. @item start_full, full
  10500. If set to 1, completely fill the output with generated rows before
  10501. outputting the first frame.
  10502. This is the default behavior, for disabling set the value to 0.
  10503. @item stitch
  10504. If set to 1, stitch the left and right row edges together.
  10505. This is the default behavior, for disabling set the value to 0.
  10506. @end table
  10507. @subsection Examples
  10508. @itemize
  10509. @item
  10510. Read the initial state from @file{pattern}, and specify an output of
  10511. size 200x400.
  10512. @example
  10513. cellauto=f=pattern:s=200x400
  10514. @end example
  10515. @item
  10516. Generate a random initial row with a width of 200 cells, with a fill
  10517. ratio of 2/3:
  10518. @example
  10519. cellauto=ratio=2/3:s=200x200
  10520. @end example
  10521. @item
  10522. Create a pattern generated by rule 18 starting by a single alive cell
  10523. centered on an initial row with width 100:
  10524. @example
  10525. cellauto=p=@@:s=100x400:full=0:rule=18
  10526. @end example
  10527. @item
  10528. Specify a more elaborated initial pattern:
  10529. @example
  10530. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  10531. @end example
  10532. @end itemize
  10533. @section mandelbrot
  10534. Generate a Mandelbrot set fractal, and progressively zoom towards the
  10535. point specified with @var{start_x} and @var{start_y}.
  10536. This source accepts the following options:
  10537. @table @option
  10538. @item end_pts
  10539. Set the terminal pts value. Default value is 400.
  10540. @item end_scale
  10541. Set the terminal scale value.
  10542. Must be a floating point value. Default value is 0.3.
  10543. @item inner
  10544. Set the inner coloring mode, that is the algorithm used to draw the
  10545. Mandelbrot fractal internal region.
  10546. It shall assume one of the following values:
  10547. @table @option
  10548. @item black
  10549. Set black mode.
  10550. @item convergence
  10551. Show time until convergence.
  10552. @item mincol
  10553. Set color based on point closest to the origin of the iterations.
  10554. @item period
  10555. Set period mode.
  10556. @end table
  10557. Default value is @var{mincol}.
  10558. @item bailout
  10559. Set the bailout value. Default value is 10.0.
  10560. @item maxiter
  10561. Set the maximum of iterations performed by the rendering
  10562. algorithm. Default value is 7189.
  10563. @item outer
  10564. Set outer coloring mode.
  10565. It shall assume one of following values:
  10566. @table @option
  10567. @item iteration_count
  10568. Set iteration cound mode.
  10569. @item normalized_iteration_count
  10570. set normalized iteration count mode.
  10571. @end table
  10572. Default value is @var{normalized_iteration_count}.
  10573. @item rate, r
  10574. Set frame rate, expressed as number of frames per second. Default
  10575. value is "25".
  10576. @item size, s
  10577. Set frame size. For the syntax of this option, check the "Video
  10578. size" section in the ffmpeg-utils manual. Default value is "640x480".
  10579. @item start_scale
  10580. Set the initial scale value. Default value is 3.0.
  10581. @item start_x
  10582. Set the initial x position. Must be a floating point value between
  10583. -100 and 100. Default value is -0.743643887037158704752191506114774.
  10584. @item start_y
  10585. Set the initial y position. Must be a floating point value between
  10586. -100 and 100. Default value is -0.131825904205311970493132056385139.
  10587. @end table
  10588. @section mptestsrc
  10589. Generate various test patterns, as generated by the MPlayer test filter.
  10590. The size of the generated video is fixed, and is 256x256.
  10591. This source is useful in particular for testing encoding features.
  10592. This source accepts the following options:
  10593. @table @option
  10594. @item rate, r
  10595. Specify the frame rate of the sourced video, as the number of frames
  10596. generated per second. It has to be a string in the format
  10597. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  10598. number or a valid video frame rate abbreviation. The default value is
  10599. "25".
  10600. @item duration, d
  10601. Set the duration of the sourced video. See
  10602. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  10603. for the accepted syntax.
  10604. If not specified, or the expressed duration is negative, the video is
  10605. supposed to be generated forever.
  10606. @item test, t
  10607. Set the number or the name of the test to perform. Supported tests are:
  10608. @table @option
  10609. @item dc_luma
  10610. @item dc_chroma
  10611. @item freq_luma
  10612. @item freq_chroma
  10613. @item amp_luma
  10614. @item amp_chroma
  10615. @item cbp
  10616. @item mv
  10617. @item ring1
  10618. @item ring2
  10619. @item all
  10620. @end table
  10621. Default value is "all", which will cycle through the list of all tests.
  10622. @end table
  10623. Some examples:
  10624. @example
  10625. mptestsrc=t=dc_luma
  10626. @end example
  10627. will generate a "dc_luma" test pattern.
  10628. @section frei0r_src
  10629. Provide a frei0r source.
  10630. To enable compilation of this filter you need to install the frei0r
  10631. header and configure FFmpeg with @code{--enable-frei0r}.
  10632. This source accepts the following parameters:
  10633. @table @option
  10634. @item size
  10635. The size of the video to generate. For the syntax of this option, check the
  10636. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10637. @item framerate
  10638. The framerate of the generated video. It may be a string of the form
  10639. @var{num}/@var{den} or a frame rate abbreviation.
  10640. @item filter_name
  10641. The name to the frei0r source to load. For more information regarding frei0r and
  10642. how to set the parameters, read the @ref{frei0r} section in the video filters
  10643. documentation.
  10644. @item filter_params
  10645. A '|'-separated list of parameters to pass to the frei0r source.
  10646. @end table
  10647. For example, to generate a frei0r partik0l source with size 200x200
  10648. and frame rate 10 which is overlaid on the overlay filter main input:
  10649. @example
  10650. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  10651. @end example
  10652. @section life
  10653. Generate a life pattern.
  10654. This source is based on a generalization of John Conway's life game.
  10655. The sourced input represents a life grid, each pixel represents a cell
  10656. which can be in one of two possible states, alive or dead. Every cell
  10657. interacts with its eight neighbours, which are the cells that are
  10658. horizontally, vertically, or diagonally adjacent.
  10659. At each interaction the grid evolves according to the adopted rule,
  10660. which specifies the number of neighbor alive cells which will make a
  10661. cell stay alive or born. The @option{rule} option allows one to specify
  10662. the rule to adopt.
  10663. This source accepts the following options:
  10664. @table @option
  10665. @item filename, f
  10666. Set the file from which to read the initial grid state. In the file,
  10667. each non-whitespace character is considered an alive cell, and newline
  10668. is used to delimit the end of each row.
  10669. If this option is not specified, the initial grid is generated
  10670. randomly.
  10671. @item rate, r
  10672. Set the video rate, that is the number of frames generated per second.
  10673. Default is 25.
  10674. @item random_fill_ratio, ratio
  10675. Set the random fill ratio for the initial random grid. It is a
  10676. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  10677. It is ignored when a file is specified.
  10678. @item random_seed, seed
  10679. Set the seed for filling the initial random grid, must be an integer
  10680. included between 0 and UINT32_MAX. If not specified, or if explicitly
  10681. set to -1, the filter will try to use a good random seed on a best
  10682. effort basis.
  10683. @item rule
  10684. Set the life rule.
  10685. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  10686. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  10687. @var{NS} specifies the number of alive neighbor cells which make a
  10688. live cell stay alive, and @var{NB} the number of alive neighbor cells
  10689. which make a dead cell to become alive (i.e. to "born").
  10690. "s" and "b" can be used in place of "S" and "B", respectively.
  10691. Alternatively a rule can be specified by an 18-bits integer. The 9
  10692. high order bits are used to encode the next cell state if it is alive
  10693. for each number of neighbor alive cells, the low order bits specify
  10694. the rule for "borning" new cells. Higher order bits encode for an
  10695. higher number of neighbor cells.
  10696. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  10697. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  10698. Default value is "S23/B3", which is the original Conway's game of life
  10699. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  10700. cells, and will born a new cell if there are three alive cells around
  10701. a dead cell.
  10702. @item size, s
  10703. Set the size of the output video. For the syntax of this option, check the
  10704. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10705. If @option{filename} is specified, the size is set by default to the
  10706. same size of the input file. If @option{size} is set, it must contain
  10707. the size specified in the input file, and the initial grid defined in
  10708. that file is centered in the larger resulting area.
  10709. If a filename is not specified, the size value defaults to "320x240"
  10710. (used for a randomly generated initial grid).
  10711. @item stitch
  10712. If set to 1, stitch the left and right grid edges together, and the
  10713. top and bottom edges also. Defaults to 1.
  10714. @item mold
  10715. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  10716. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  10717. value from 0 to 255.
  10718. @item life_color
  10719. Set the color of living (or new born) cells.
  10720. @item death_color
  10721. Set the color of dead cells. If @option{mold} is set, this is the first color
  10722. used to represent a dead cell.
  10723. @item mold_color
  10724. Set mold color, for definitely dead and moldy cells.
  10725. For the syntax of these 3 color options, check the "Color" section in the
  10726. ffmpeg-utils manual.
  10727. @end table
  10728. @subsection Examples
  10729. @itemize
  10730. @item
  10731. Read a grid from @file{pattern}, and center it on a grid of size
  10732. 300x300 pixels:
  10733. @example
  10734. life=f=pattern:s=300x300
  10735. @end example
  10736. @item
  10737. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  10738. @example
  10739. life=ratio=2/3:s=200x200
  10740. @end example
  10741. @item
  10742. Specify a custom rule for evolving a randomly generated grid:
  10743. @example
  10744. life=rule=S14/B34
  10745. @end example
  10746. @item
  10747. Full example with slow death effect (mold) using @command{ffplay}:
  10748. @example
  10749. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  10750. @end example
  10751. @end itemize
  10752. @anchor{allrgb}
  10753. @anchor{allyuv}
  10754. @anchor{color}
  10755. @anchor{haldclutsrc}
  10756. @anchor{nullsrc}
  10757. @anchor{rgbtestsrc}
  10758. @anchor{smptebars}
  10759. @anchor{smptehdbars}
  10760. @anchor{testsrc}
  10761. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc
  10762. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  10763. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  10764. The @code{color} source provides an uniformly colored input.
  10765. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  10766. @ref{haldclut} filter.
  10767. The @code{nullsrc} source returns unprocessed video frames. It is
  10768. mainly useful to be employed in analysis / debugging tools, or as the
  10769. source for filters which ignore the input data.
  10770. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  10771. detecting RGB vs BGR issues. You should see a red, green and blue
  10772. stripe from top to bottom.
  10773. The @code{smptebars} source generates a color bars pattern, based on
  10774. the SMPTE Engineering Guideline EG 1-1990.
  10775. The @code{smptehdbars} source generates a color bars pattern, based on
  10776. the SMPTE RP 219-2002.
  10777. The @code{testsrc} source generates a test video pattern, showing a
  10778. color pattern, a scrolling gradient and a timestamp. This is mainly
  10779. intended for testing purposes.
  10780. The sources accept the following parameters:
  10781. @table @option
  10782. @item color, c
  10783. Specify the color of the source, only available in the @code{color}
  10784. source. For the syntax of this option, check the "Color" section in the
  10785. ffmpeg-utils manual.
  10786. @item level
  10787. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  10788. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  10789. pixels to be used as identity matrix for 3D lookup tables. Each component is
  10790. coded on a @code{1/(N*N)} scale.
  10791. @item size, s
  10792. Specify the size of the sourced video. For the syntax of this option, check the
  10793. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10794. The default value is @code{320x240}.
  10795. This option is not available with the @code{haldclutsrc} filter.
  10796. @item rate, r
  10797. Specify the frame rate of the sourced video, as the number of frames
  10798. generated per second. It has to be a string in the format
  10799. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  10800. number or a valid video frame rate abbreviation. The default value is
  10801. "25".
  10802. @item sar
  10803. Set the sample aspect ratio of the sourced video.
  10804. @item duration, d
  10805. Set the duration of the sourced video. See
  10806. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  10807. for the accepted syntax.
  10808. If not specified, or the expressed duration is negative, the video is
  10809. supposed to be generated forever.
  10810. @item decimals, n
  10811. Set the number of decimals to show in the timestamp, only available in the
  10812. @code{testsrc} source.
  10813. The displayed timestamp value will correspond to the original
  10814. timestamp value multiplied by the power of 10 of the specified
  10815. value. Default value is 0.
  10816. @end table
  10817. For example the following:
  10818. @example
  10819. testsrc=duration=5.3:size=qcif:rate=10
  10820. @end example
  10821. will generate a video with a duration of 5.3 seconds, with size
  10822. 176x144 and a frame rate of 10 frames per second.
  10823. The following graph description will generate a red source
  10824. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  10825. frames per second.
  10826. @example
  10827. color=c=red@@0.2:s=qcif:r=10
  10828. @end example
  10829. If the input content is to be ignored, @code{nullsrc} can be used. The
  10830. following command generates noise in the luminance plane by employing
  10831. the @code{geq} filter:
  10832. @example
  10833. nullsrc=s=256x256, geq=random(1)*255:128:128
  10834. @end example
  10835. @subsection Commands
  10836. The @code{color} source supports the following commands:
  10837. @table @option
  10838. @item c, color
  10839. Set the color of the created image. Accepts the same syntax of the
  10840. corresponding @option{color} option.
  10841. @end table
  10842. @c man end VIDEO SOURCES
  10843. @chapter Video Sinks
  10844. @c man begin VIDEO SINKS
  10845. Below is a description of the currently available video sinks.
  10846. @section buffersink
  10847. Buffer video frames, and make them available to the end of the filter
  10848. graph.
  10849. This sink is mainly intended for programmatic use, in particular
  10850. through the interface defined in @file{libavfilter/buffersink.h}
  10851. or the options system.
  10852. It accepts a pointer to an AVBufferSinkContext structure, which
  10853. defines the incoming buffers' formats, to be passed as the opaque
  10854. parameter to @code{avfilter_init_filter} for initialization.
  10855. @section nullsink
  10856. Null video sink: do absolutely nothing with the input video. It is
  10857. mainly useful as a template and for use in analysis / debugging
  10858. tools.
  10859. @c man end VIDEO SINKS
  10860. @chapter Multimedia Filters
  10861. @c man begin MULTIMEDIA FILTERS
  10862. Below is a description of the currently available multimedia filters.
  10863. @section ahistogram
  10864. Convert input audio to a video output, displaying the volume histogram.
  10865. The filter accepts the following options:
  10866. @table @option
  10867. @item dmode
  10868. Specify how histogram is calculated.
  10869. It accepts the following values:
  10870. @table @samp
  10871. @item single
  10872. Use single histogram for all channels.
  10873. @item separate
  10874. Use separate histogram for each channel.
  10875. @end table
  10876. Default is @code{single}.
  10877. @item rate, r
  10878. Set frame rate, expressed as number of frames per second. Default
  10879. value is "25".
  10880. @item size, s
  10881. Specify the video size for the output. For the syntax of this option, check the
  10882. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10883. Default value is @code{hd720}.
  10884. @item scale
  10885. Set display scale.
  10886. It accepts the following values:
  10887. @table @samp
  10888. @item log
  10889. logarithmic
  10890. @item sqrt
  10891. square root
  10892. @item cbrt
  10893. cubic root
  10894. @item lin
  10895. linear
  10896. @item rlog
  10897. reverse logarithmic
  10898. @end table
  10899. Default is @code{log}.
  10900. @item ascale
  10901. Set amplitude scale.
  10902. It accepts the following values:
  10903. @table @samp
  10904. @item log
  10905. logarithmic
  10906. @item lin
  10907. linear
  10908. @end table
  10909. Default is @code{log}.
  10910. @item acount
  10911. Set how much frames to accumulate in histogram.
  10912. Defauls is 1. Setting this to -1 accumulates all frames.
  10913. @item rheight
  10914. Set histogram ratio of window height.
  10915. @item slide
  10916. Set sonogram sliding.
  10917. It accepts the following values:
  10918. @table @samp
  10919. @item replace
  10920. replace old rows with new ones.
  10921. @item scroll
  10922. scroll from top to bottom.
  10923. @end table
  10924. Default is @code{replace}.
  10925. @end table
  10926. @section aphasemeter
  10927. Convert input audio to a video output, displaying the audio phase.
  10928. The filter accepts the following options:
  10929. @table @option
  10930. @item rate, r
  10931. Set the output frame rate. Default value is @code{25}.
  10932. @item size, s
  10933. Set the video size for the output. For the syntax of this option, check the
  10934. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10935. Default value is @code{800x400}.
  10936. @item rc
  10937. @item gc
  10938. @item bc
  10939. Specify the red, green, blue contrast. Default values are @code{2},
  10940. @code{7} and @code{1}.
  10941. Allowed range is @code{[0, 255]}.
  10942. @item mpc
  10943. Set color which will be used for drawing median phase. If color is
  10944. @code{none} which is default, no median phase value will be drawn.
  10945. @end table
  10946. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  10947. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  10948. The @code{-1} means left and right channels are completely out of phase and
  10949. @code{1} means channels are in phase.
  10950. @section avectorscope
  10951. Convert input audio to a video output, representing the audio vector
  10952. scope.
  10953. The filter is used to measure the difference between channels of stereo
  10954. audio stream. A monoaural signal, consisting of identical left and right
  10955. signal, results in straight vertical line. Any stereo separation is visible
  10956. as a deviation from this line, creating a Lissajous figure.
  10957. If the straight (or deviation from it) but horizontal line appears this
  10958. indicates that the left and right channels are out of phase.
  10959. The filter accepts the following options:
  10960. @table @option
  10961. @item mode, m
  10962. Set the vectorscope mode.
  10963. Available values are:
  10964. @table @samp
  10965. @item lissajous
  10966. Lissajous rotated by 45 degrees.
  10967. @item lissajous_xy
  10968. Same as above but not rotated.
  10969. @item polar
  10970. Shape resembling half of circle.
  10971. @end table
  10972. Default value is @samp{lissajous}.
  10973. @item size, s
  10974. Set the video size for the output. For the syntax of this option, check the
  10975. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10976. Default value is @code{400x400}.
  10977. @item rate, r
  10978. Set the output frame rate. Default value is @code{25}.
  10979. @item rc
  10980. @item gc
  10981. @item bc
  10982. @item ac
  10983. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  10984. @code{160}, @code{80} and @code{255}.
  10985. Allowed range is @code{[0, 255]}.
  10986. @item rf
  10987. @item gf
  10988. @item bf
  10989. @item af
  10990. Specify the red, green, blue and alpha fade. Default values are @code{15},
  10991. @code{10}, @code{5} and @code{5}.
  10992. Allowed range is @code{[0, 255]}.
  10993. @item zoom
  10994. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  10995. @item draw
  10996. Set the vectorscope drawing mode.
  10997. Available values are:
  10998. @table @samp
  10999. @item dot
  11000. Draw dot for each sample.
  11001. @item line
  11002. Draw line between previous and current sample.
  11003. @end table
  11004. Default value is @samp{dot}.
  11005. @end table
  11006. @subsection Examples
  11007. @itemize
  11008. @item
  11009. Complete example using @command{ffplay}:
  11010. @example
  11011. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  11012. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  11013. @end example
  11014. @end itemize
  11015. @section bench, abench
  11016. Benchmark part of a filtergraph.
  11017. The filter accepts the following options:
  11018. @table @option
  11019. @item action
  11020. Start or stop a timer.
  11021. Available values are:
  11022. @table @samp
  11023. @item start
  11024. Get the current time, set it as frame metadata (using the key
  11025. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  11026. @item stop
  11027. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  11028. the input frame metadata to get the time difference. Time difference, average,
  11029. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  11030. @code{min}) are then printed. The timestamps are expressed in seconds.
  11031. @end table
  11032. @end table
  11033. @subsection Examples
  11034. @itemize
  11035. @item
  11036. Benchmark @ref{selectivecolor} filter:
  11037. @example
  11038. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  11039. @end example
  11040. @end itemize
  11041. @section concat
  11042. Concatenate audio and video streams, joining them together one after the
  11043. other.
  11044. The filter works on segments of synchronized video and audio streams. All
  11045. segments must have the same number of streams of each type, and that will
  11046. also be the number of streams at output.
  11047. The filter accepts the following options:
  11048. @table @option
  11049. @item n
  11050. Set the number of segments. Default is 2.
  11051. @item v
  11052. Set the number of output video streams, that is also the number of video
  11053. streams in each segment. Default is 1.
  11054. @item a
  11055. Set the number of output audio streams, that is also the number of audio
  11056. streams in each segment. Default is 0.
  11057. @item unsafe
  11058. Activate unsafe mode: do not fail if segments have a different format.
  11059. @end table
  11060. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  11061. @var{a} audio outputs.
  11062. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  11063. segment, in the same order as the outputs, then the inputs for the second
  11064. segment, etc.
  11065. Related streams do not always have exactly the same duration, for various
  11066. reasons including codec frame size or sloppy authoring. For that reason,
  11067. related synchronized streams (e.g. a video and its audio track) should be
  11068. concatenated at once. The concat filter will use the duration of the longest
  11069. stream in each segment (except the last one), and if necessary pad shorter
  11070. audio streams with silence.
  11071. For this filter to work correctly, all segments must start at timestamp 0.
  11072. All corresponding streams must have the same parameters in all segments; the
  11073. filtering system will automatically select a common pixel format for video
  11074. streams, and a common sample format, sample rate and channel layout for
  11075. audio streams, but other settings, such as resolution, must be converted
  11076. explicitly by the user.
  11077. Different frame rates are acceptable but will result in variable frame rate
  11078. at output; be sure to configure the output file to handle it.
  11079. @subsection Examples
  11080. @itemize
  11081. @item
  11082. Concatenate an opening, an episode and an ending, all in bilingual version
  11083. (video in stream 0, audio in streams 1 and 2):
  11084. @example
  11085. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  11086. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  11087. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  11088. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  11089. @end example
  11090. @item
  11091. Concatenate two parts, handling audio and video separately, using the
  11092. (a)movie sources, and adjusting the resolution:
  11093. @example
  11094. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  11095. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  11096. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  11097. @end example
  11098. Note that a desync will happen at the stitch if the audio and video streams
  11099. do not have exactly the same duration in the first file.
  11100. @end itemize
  11101. @anchor{ebur128}
  11102. @section ebur128
  11103. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  11104. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  11105. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  11106. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  11107. The filter also has a video output (see the @var{video} option) with a real
  11108. time graph to observe the loudness evolution. The graphic contains the logged
  11109. message mentioned above, so it is not printed anymore when this option is set,
  11110. unless the verbose logging is set. The main graphing area contains the
  11111. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  11112. the momentary loudness (400 milliseconds).
  11113. More information about the Loudness Recommendation EBU R128 on
  11114. @url{http://tech.ebu.ch/loudness}.
  11115. The filter accepts the following options:
  11116. @table @option
  11117. @item video
  11118. Activate the video output. The audio stream is passed unchanged whether this
  11119. option is set or no. The video stream will be the first output stream if
  11120. activated. Default is @code{0}.
  11121. @item size
  11122. Set the video size. This option is for video only. For the syntax of this
  11123. option, check the
  11124. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11125. Default and minimum resolution is @code{640x480}.
  11126. @item meter
  11127. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  11128. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  11129. other integer value between this range is allowed.
  11130. @item metadata
  11131. Set metadata injection. If set to @code{1}, the audio input will be segmented
  11132. into 100ms output frames, each of them containing various loudness information
  11133. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  11134. Default is @code{0}.
  11135. @item framelog
  11136. Force the frame logging level.
  11137. Available values are:
  11138. @table @samp
  11139. @item info
  11140. information logging level
  11141. @item verbose
  11142. verbose logging level
  11143. @end table
  11144. By default, the logging level is set to @var{info}. If the @option{video} or
  11145. the @option{metadata} options are set, it switches to @var{verbose}.
  11146. @item peak
  11147. Set peak mode(s).
  11148. Available modes can be cumulated (the option is a @code{flag} type). Possible
  11149. values are:
  11150. @table @samp
  11151. @item none
  11152. Disable any peak mode (default).
  11153. @item sample
  11154. Enable sample-peak mode.
  11155. Simple peak mode looking for the higher sample value. It logs a message
  11156. for sample-peak (identified by @code{SPK}).
  11157. @item true
  11158. Enable true-peak mode.
  11159. If enabled, the peak lookup is done on an over-sampled version of the input
  11160. stream for better peak accuracy. It logs a message for true-peak.
  11161. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  11162. This mode requires a build with @code{libswresample}.
  11163. @end table
  11164. @item dualmono
  11165. Treat mono input files as "dual mono". If a mono file is intended for playback
  11166. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  11167. If set to @code{true}, this option will compensate for this effect.
  11168. Multi-channel input files are not affected by this option.
  11169. @item panlaw
  11170. Set a specific pan law to be used for the measurement of dual mono files.
  11171. This parameter is optional, and has a default value of -3.01dB.
  11172. @end table
  11173. @subsection Examples
  11174. @itemize
  11175. @item
  11176. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  11177. @example
  11178. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  11179. @end example
  11180. @item
  11181. Run an analysis with @command{ffmpeg}:
  11182. @example
  11183. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  11184. @end example
  11185. @end itemize
  11186. @section interleave, ainterleave
  11187. Temporally interleave frames from several inputs.
  11188. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  11189. These filters read frames from several inputs and send the oldest
  11190. queued frame to the output.
  11191. Input streams must have a well defined, monotonically increasing frame
  11192. timestamp values.
  11193. In order to submit one frame to output, these filters need to enqueue
  11194. at least one frame for each input, so they cannot work in case one
  11195. input is not yet terminated and will not receive incoming frames.
  11196. For example consider the case when one input is a @code{select} filter
  11197. which always drop input frames. The @code{interleave} filter will keep
  11198. reading from that input, but it will never be able to send new frames
  11199. to output until the input will send an end-of-stream signal.
  11200. Also, depending on inputs synchronization, the filters will drop
  11201. frames in case one input receives more frames than the other ones, and
  11202. the queue is already filled.
  11203. These filters accept the following options:
  11204. @table @option
  11205. @item nb_inputs, n
  11206. Set the number of different inputs, it is 2 by default.
  11207. @end table
  11208. @subsection Examples
  11209. @itemize
  11210. @item
  11211. Interleave frames belonging to different streams using @command{ffmpeg}:
  11212. @example
  11213. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  11214. @end example
  11215. @item
  11216. Add flickering blur effect:
  11217. @example
  11218. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  11219. @end example
  11220. @end itemize
  11221. @section perms, aperms
  11222. Set read/write permissions for the output frames.
  11223. These filters are mainly aimed at developers to test direct path in the
  11224. following filter in the filtergraph.
  11225. The filters accept the following options:
  11226. @table @option
  11227. @item mode
  11228. Select the permissions mode.
  11229. It accepts the following values:
  11230. @table @samp
  11231. @item none
  11232. Do nothing. This is the default.
  11233. @item ro
  11234. Set all the output frames read-only.
  11235. @item rw
  11236. Set all the output frames directly writable.
  11237. @item toggle
  11238. Make the frame read-only if writable, and writable if read-only.
  11239. @item random
  11240. Set each output frame read-only or writable randomly.
  11241. @end table
  11242. @item seed
  11243. Set the seed for the @var{random} mode, must be an integer included between
  11244. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  11245. @code{-1}, the filter will try to use a good random seed on a best effort
  11246. basis.
  11247. @end table
  11248. Note: in case of auto-inserted filter between the permission filter and the
  11249. following one, the permission might not be received as expected in that
  11250. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  11251. perms/aperms filter can avoid this problem.
  11252. @section realtime, arealtime
  11253. Slow down filtering to match real time approximatively.
  11254. These filters will pause the filtering for a variable amount of time to
  11255. match the output rate with the input timestamps.
  11256. They are similar to the @option{re} option to @code{ffmpeg}.
  11257. They accept the following options:
  11258. @table @option
  11259. @item limit
  11260. Time limit for the pauses. Any pause longer than that will be considered
  11261. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  11262. @end table
  11263. @section select, aselect
  11264. Select frames to pass in output.
  11265. This filter accepts the following options:
  11266. @table @option
  11267. @item expr, e
  11268. Set expression, which is evaluated for each input frame.
  11269. If the expression is evaluated to zero, the frame is discarded.
  11270. If the evaluation result is negative or NaN, the frame is sent to the
  11271. first output; otherwise it is sent to the output with index
  11272. @code{ceil(val)-1}, assuming that the input index starts from 0.
  11273. For example a value of @code{1.2} corresponds to the output with index
  11274. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  11275. @item outputs, n
  11276. Set the number of outputs. The output to which to send the selected
  11277. frame is based on the result of the evaluation. Default value is 1.
  11278. @end table
  11279. The expression can contain the following constants:
  11280. @table @option
  11281. @item n
  11282. The (sequential) number of the filtered frame, starting from 0.
  11283. @item selected_n
  11284. The (sequential) number of the selected frame, starting from 0.
  11285. @item prev_selected_n
  11286. The sequential number of the last selected frame. It's NAN if undefined.
  11287. @item TB
  11288. The timebase of the input timestamps.
  11289. @item pts
  11290. The PTS (Presentation TimeStamp) of the filtered video frame,
  11291. expressed in @var{TB} units. It's NAN if undefined.
  11292. @item t
  11293. The PTS of the filtered video frame,
  11294. expressed in seconds. It's NAN if undefined.
  11295. @item prev_pts
  11296. The PTS of the previously filtered video frame. It's NAN if undefined.
  11297. @item prev_selected_pts
  11298. The PTS of the last previously filtered video frame. It's NAN if undefined.
  11299. @item prev_selected_t
  11300. The PTS of the last previously selected video frame. It's NAN if undefined.
  11301. @item start_pts
  11302. The PTS of the first video frame in the video. It's NAN if undefined.
  11303. @item start_t
  11304. The time of the first video frame in the video. It's NAN if undefined.
  11305. @item pict_type @emph{(video only)}
  11306. The type of the filtered frame. It can assume one of the following
  11307. values:
  11308. @table @option
  11309. @item I
  11310. @item P
  11311. @item B
  11312. @item S
  11313. @item SI
  11314. @item SP
  11315. @item BI
  11316. @end table
  11317. @item interlace_type @emph{(video only)}
  11318. The frame interlace type. It can assume one of the following values:
  11319. @table @option
  11320. @item PROGRESSIVE
  11321. The frame is progressive (not interlaced).
  11322. @item TOPFIRST
  11323. The frame is top-field-first.
  11324. @item BOTTOMFIRST
  11325. The frame is bottom-field-first.
  11326. @end table
  11327. @item consumed_sample_n @emph{(audio only)}
  11328. the number of selected samples before the current frame
  11329. @item samples_n @emph{(audio only)}
  11330. the number of samples in the current frame
  11331. @item sample_rate @emph{(audio only)}
  11332. the input sample rate
  11333. @item key
  11334. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  11335. @item pos
  11336. the position in the file of the filtered frame, -1 if the information
  11337. is not available (e.g. for synthetic video)
  11338. @item scene @emph{(video only)}
  11339. value between 0 and 1 to indicate a new scene; a low value reflects a low
  11340. probability for the current frame to introduce a new scene, while a higher
  11341. value means the current frame is more likely to be one (see the example below)
  11342. @item concatdec_select
  11343. The concat demuxer can select only part of a concat input file by setting an
  11344. inpoint and an outpoint, but the output packets may not be entirely contained
  11345. in the selected interval. By using this variable, it is possible to skip frames
  11346. generated by the concat demuxer which are not exactly contained in the selected
  11347. interval.
  11348. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  11349. and the @var{lavf.concat.duration} packet metadata values which are also
  11350. present in the decoded frames.
  11351. The @var{concatdec_select} variable is -1 if the frame pts is at least
  11352. start_time and either the duration metadata is missing or the frame pts is less
  11353. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  11354. missing.
  11355. That basically means that an input frame is selected if its pts is within the
  11356. interval set by the concat demuxer.
  11357. @end table
  11358. The default value of the select expression is "1".
  11359. @subsection Examples
  11360. @itemize
  11361. @item
  11362. Select all frames in input:
  11363. @example
  11364. select
  11365. @end example
  11366. The example above is the same as:
  11367. @example
  11368. select=1
  11369. @end example
  11370. @item
  11371. Skip all frames:
  11372. @example
  11373. select=0
  11374. @end example
  11375. @item
  11376. Select only I-frames:
  11377. @example
  11378. select='eq(pict_type\,I)'
  11379. @end example
  11380. @item
  11381. Select one frame every 100:
  11382. @example
  11383. select='not(mod(n\,100))'
  11384. @end example
  11385. @item
  11386. Select only frames contained in the 10-20 time interval:
  11387. @example
  11388. select=between(t\,10\,20)
  11389. @end example
  11390. @item
  11391. Select only I frames contained in the 10-20 time interval:
  11392. @example
  11393. select=between(t\,10\,20)*eq(pict_type\,I)
  11394. @end example
  11395. @item
  11396. Select frames with a minimum distance of 10 seconds:
  11397. @example
  11398. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  11399. @end example
  11400. @item
  11401. Use aselect to select only audio frames with samples number > 100:
  11402. @example
  11403. aselect='gt(samples_n\,100)'
  11404. @end example
  11405. @item
  11406. Create a mosaic of the first scenes:
  11407. @example
  11408. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  11409. @end example
  11410. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  11411. choice.
  11412. @item
  11413. Send even and odd frames to separate outputs, and compose them:
  11414. @example
  11415. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  11416. @end example
  11417. @item
  11418. Select useful frames from an ffconcat file which is using inpoints and
  11419. outpoints but where the source files are not intra frame only.
  11420. @example
  11421. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  11422. @end example
  11423. @end itemize
  11424. @section sendcmd, asendcmd
  11425. Send commands to filters in the filtergraph.
  11426. These filters read commands to be sent to other filters in the
  11427. filtergraph.
  11428. @code{sendcmd} must be inserted between two video filters,
  11429. @code{asendcmd} must be inserted between two audio filters, but apart
  11430. from that they act the same way.
  11431. The specification of commands can be provided in the filter arguments
  11432. with the @var{commands} option, or in a file specified by the
  11433. @var{filename} option.
  11434. These filters accept the following options:
  11435. @table @option
  11436. @item commands, c
  11437. Set the commands to be read and sent to the other filters.
  11438. @item filename, f
  11439. Set the filename of the commands to be read and sent to the other
  11440. filters.
  11441. @end table
  11442. @subsection Commands syntax
  11443. A commands description consists of a sequence of interval
  11444. specifications, comprising a list of commands to be executed when a
  11445. particular event related to that interval occurs. The occurring event
  11446. is typically the current frame time entering or leaving a given time
  11447. interval.
  11448. An interval is specified by the following syntax:
  11449. @example
  11450. @var{START}[-@var{END}] @var{COMMANDS};
  11451. @end example
  11452. The time interval is specified by the @var{START} and @var{END} times.
  11453. @var{END} is optional and defaults to the maximum time.
  11454. The current frame time is considered within the specified interval if
  11455. it is included in the interval [@var{START}, @var{END}), that is when
  11456. the time is greater or equal to @var{START} and is lesser than
  11457. @var{END}.
  11458. @var{COMMANDS} consists of a sequence of one or more command
  11459. specifications, separated by ",", relating to that interval. The
  11460. syntax of a command specification is given by:
  11461. @example
  11462. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  11463. @end example
  11464. @var{FLAGS} is optional and specifies the type of events relating to
  11465. the time interval which enable sending the specified command, and must
  11466. be a non-null sequence of identifier flags separated by "+" or "|" and
  11467. enclosed between "[" and "]".
  11468. The following flags are recognized:
  11469. @table @option
  11470. @item enter
  11471. The command is sent when the current frame timestamp enters the
  11472. specified interval. In other words, the command is sent when the
  11473. previous frame timestamp was not in the given interval, and the
  11474. current is.
  11475. @item leave
  11476. The command is sent when the current frame timestamp leaves the
  11477. specified interval. In other words, the command is sent when the
  11478. previous frame timestamp was in the given interval, and the
  11479. current is not.
  11480. @end table
  11481. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  11482. assumed.
  11483. @var{TARGET} specifies the target of the command, usually the name of
  11484. the filter class or a specific filter instance name.
  11485. @var{COMMAND} specifies the name of the command for the target filter.
  11486. @var{ARG} is optional and specifies the optional list of argument for
  11487. the given @var{COMMAND}.
  11488. Between one interval specification and another, whitespaces, or
  11489. sequences of characters starting with @code{#} until the end of line,
  11490. are ignored and can be used to annotate comments.
  11491. A simplified BNF description of the commands specification syntax
  11492. follows:
  11493. @example
  11494. @var{COMMAND_FLAG} ::= "enter" | "leave"
  11495. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  11496. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  11497. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  11498. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  11499. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  11500. @end example
  11501. @subsection Examples
  11502. @itemize
  11503. @item
  11504. Specify audio tempo change at second 4:
  11505. @example
  11506. asendcmd=c='4.0 atempo tempo 1.5',atempo
  11507. @end example
  11508. @item
  11509. Specify a list of drawtext and hue commands in a file.
  11510. @example
  11511. # show text in the interval 5-10
  11512. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  11513. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  11514. # desaturate the image in the interval 15-20
  11515. 15.0-20.0 [enter] hue s 0,
  11516. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  11517. [leave] hue s 1,
  11518. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  11519. # apply an exponential saturation fade-out effect, starting from time 25
  11520. 25 [enter] hue s exp(25-t)
  11521. @end example
  11522. A filtergraph allowing to read and process the above command list
  11523. stored in a file @file{test.cmd}, can be specified with:
  11524. @example
  11525. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  11526. @end example
  11527. @end itemize
  11528. @anchor{setpts}
  11529. @section setpts, asetpts
  11530. Change the PTS (presentation timestamp) of the input frames.
  11531. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  11532. This filter accepts the following options:
  11533. @table @option
  11534. @item expr
  11535. The expression which is evaluated for each frame to construct its timestamp.
  11536. @end table
  11537. The expression is evaluated through the eval API and can contain the following
  11538. constants:
  11539. @table @option
  11540. @item FRAME_RATE
  11541. frame rate, only defined for constant frame-rate video
  11542. @item PTS
  11543. The presentation timestamp in input
  11544. @item N
  11545. The count of the input frame for video or the number of consumed samples,
  11546. not including the current frame for audio, starting from 0.
  11547. @item NB_CONSUMED_SAMPLES
  11548. The number of consumed samples, not including the current frame (only
  11549. audio)
  11550. @item NB_SAMPLES, S
  11551. The number of samples in the current frame (only audio)
  11552. @item SAMPLE_RATE, SR
  11553. The audio sample rate.
  11554. @item STARTPTS
  11555. The PTS of the first frame.
  11556. @item STARTT
  11557. the time in seconds of the first frame
  11558. @item INTERLACED
  11559. State whether the current frame is interlaced.
  11560. @item T
  11561. the time in seconds of the current frame
  11562. @item POS
  11563. original position in the file of the frame, or undefined if undefined
  11564. for the current frame
  11565. @item PREV_INPTS
  11566. The previous input PTS.
  11567. @item PREV_INT
  11568. previous input time in seconds
  11569. @item PREV_OUTPTS
  11570. The previous output PTS.
  11571. @item PREV_OUTT
  11572. previous output time in seconds
  11573. @item RTCTIME
  11574. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  11575. instead.
  11576. @item RTCSTART
  11577. The wallclock (RTC) time at the start of the movie in microseconds.
  11578. @item TB
  11579. The timebase of the input timestamps.
  11580. @end table
  11581. @subsection Examples
  11582. @itemize
  11583. @item
  11584. Start counting PTS from zero
  11585. @example
  11586. setpts=PTS-STARTPTS
  11587. @end example
  11588. @item
  11589. Apply fast motion effect:
  11590. @example
  11591. setpts=0.5*PTS
  11592. @end example
  11593. @item
  11594. Apply slow motion effect:
  11595. @example
  11596. setpts=2.0*PTS
  11597. @end example
  11598. @item
  11599. Set fixed rate of 25 frames per second:
  11600. @example
  11601. setpts=N/(25*TB)
  11602. @end example
  11603. @item
  11604. Set fixed rate 25 fps with some jitter:
  11605. @example
  11606. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  11607. @end example
  11608. @item
  11609. Apply an offset of 10 seconds to the input PTS:
  11610. @example
  11611. setpts=PTS+10/TB
  11612. @end example
  11613. @item
  11614. Generate timestamps from a "live source" and rebase onto the current timebase:
  11615. @example
  11616. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  11617. @end example
  11618. @item
  11619. Generate timestamps by counting samples:
  11620. @example
  11621. asetpts=N/SR/TB
  11622. @end example
  11623. @end itemize
  11624. @section settb, asettb
  11625. Set the timebase to use for the output frames timestamps.
  11626. It is mainly useful for testing timebase configuration.
  11627. It accepts the following parameters:
  11628. @table @option
  11629. @item expr, tb
  11630. The expression which is evaluated into the output timebase.
  11631. @end table
  11632. The value for @option{tb} is an arithmetic expression representing a
  11633. rational. The expression can contain the constants "AVTB" (the default
  11634. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  11635. audio only). Default value is "intb".
  11636. @subsection Examples
  11637. @itemize
  11638. @item
  11639. Set the timebase to 1/25:
  11640. @example
  11641. settb=expr=1/25
  11642. @end example
  11643. @item
  11644. Set the timebase to 1/10:
  11645. @example
  11646. settb=expr=0.1
  11647. @end example
  11648. @item
  11649. Set the timebase to 1001/1000:
  11650. @example
  11651. settb=1+0.001
  11652. @end example
  11653. @item
  11654. Set the timebase to 2*intb:
  11655. @example
  11656. settb=2*intb
  11657. @end example
  11658. @item
  11659. Set the default timebase value:
  11660. @example
  11661. settb=AVTB
  11662. @end example
  11663. @end itemize
  11664. @section showcqt
  11665. Convert input audio to a video output representing frequency spectrum
  11666. logarithmically using Brown-Puckette constant Q transform algorithm with
  11667. direct frequency domain coefficient calculation (but the transform itself
  11668. is not really constant Q, instead the Q factor is actually variable/clamped),
  11669. with musical tone scale, from E0 to D#10.
  11670. The filter accepts the following options:
  11671. @table @option
  11672. @item size, s
  11673. Specify the video size for the output. It must be even. For the syntax of this option,
  11674. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11675. Default value is @code{1920x1080}.
  11676. @item fps, rate, r
  11677. Set the output frame rate. Default value is @code{25}.
  11678. @item bar_h
  11679. Set the bargraph height. It must be even. Default value is @code{-1} which
  11680. computes the bargraph height automatically.
  11681. @item axis_h
  11682. Set the axis height. It must be even. Default value is @code{-1} which computes
  11683. the axis height automatically.
  11684. @item sono_h
  11685. Set the sonogram height. It must be even. Default value is @code{-1} which
  11686. computes the sonogram height automatically.
  11687. @item fullhd
  11688. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  11689. instead. Default value is @code{1}.
  11690. @item sono_v, volume
  11691. Specify the sonogram volume expression. It can contain variables:
  11692. @table @option
  11693. @item bar_v
  11694. the @var{bar_v} evaluated expression
  11695. @item frequency, freq, f
  11696. the frequency where it is evaluated
  11697. @item timeclamp, tc
  11698. the value of @var{timeclamp} option
  11699. @end table
  11700. and functions:
  11701. @table @option
  11702. @item a_weighting(f)
  11703. A-weighting of equal loudness
  11704. @item b_weighting(f)
  11705. B-weighting of equal loudness
  11706. @item c_weighting(f)
  11707. C-weighting of equal loudness.
  11708. @end table
  11709. Default value is @code{16}.
  11710. @item bar_v, volume2
  11711. Specify the bargraph volume expression. It can contain variables:
  11712. @table @option
  11713. @item sono_v
  11714. the @var{sono_v} evaluated expression
  11715. @item frequency, freq, f
  11716. the frequency where it is evaluated
  11717. @item timeclamp, tc
  11718. the value of @var{timeclamp} option
  11719. @end table
  11720. and functions:
  11721. @table @option
  11722. @item a_weighting(f)
  11723. A-weighting of equal loudness
  11724. @item b_weighting(f)
  11725. B-weighting of equal loudness
  11726. @item c_weighting(f)
  11727. C-weighting of equal loudness.
  11728. @end table
  11729. Default value is @code{sono_v}.
  11730. @item sono_g, gamma
  11731. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  11732. higher gamma makes the spectrum having more range. Default value is @code{3}.
  11733. Acceptable range is @code{[1, 7]}.
  11734. @item bar_g, gamma2
  11735. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  11736. @code{[1, 7]}.
  11737. @item timeclamp, tc
  11738. Specify the transform timeclamp. At low frequency, there is trade-off between
  11739. accuracy in time domain and frequency domain. If timeclamp is lower,
  11740. event in time domain is represented more accurately (such as fast bass drum),
  11741. otherwise event in frequency domain is represented more accurately
  11742. (such as bass guitar). Acceptable range is @code{[0.1, 1]}. Default value is @code{0.17}.
  11743. @item basefreq
  11744. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  11745. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  11746. @item endfreq
  11747. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  11748. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  11749. @item coeffclamp
  11750. This option is deprecated and ignored.
  11751. @item tlength
  11752. Specify the transform length in time domain. Use this option to control accuracy
  11753. trade-off between time domain and frequency domain at every frequency sample.
  11754. It can contain variables:
  11755. @table @option
  11756. @item frequency, freq, f
  11757. the frequency where it is evaluated
  11758. @item timeclamp, tc
  11759. the value of @var{timeclamp} option.
  11760. @end table
  11761. Default value is @code{384*tc/(384+tc*f)}.
  11762. @item count
  11763. Specify the transform count for every video frame. Default value is @code{6}.
  11764. Acceptable range is @code{[1, 30]}.
  11765. @item fcount
  11766. Specify the transform count for every single pixel. Default value is @code{0},
  11767. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  11768. @item fontfile
  11769. Specify font file for use with freetype to draw the axis. If not specified,
  11770. use embedded font. Note that drawing with font file or embedded font is not
  11771. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  11772. option instead.
  11773. @item fontcolor
  11774. Specify font color expression. This is arithmetic expression that should return
  11775. integer value 0xRRGGBB. It can contain variables:
  11776. @table @option
  11777. @item frequency, freq, f
  11778. the frequency where it is evaluated
  11779. @item timeclamp, tc
  11780. the value of @var{timeclamp} option
  11781. @end table
  11782. and functions:
  11783. @table @option
  11784. @item midi(f)
  11785. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  11786. @item r(x), g(x), b(x)
  11787. red, green, and blue value of intensity x.
  11788. @end table
  11789. Default value is @code{st(0, (midi(f)-59.5)/12);
  11790. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  11791. r(1-ld(1)) + b(ld(1))}.
  11792. @item axisfile
  11793. Specify image file to draw the axis. This option override @var{fontfile} and
  11794. @var{fontcolor} option.
  11795. @item axis, text
  11796. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  11797. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  11798. Default value is @code{1}.
  11799. @end table
  11800. @subsection Examples
  11801. @itemize
  11802. @item
  11803. Playing audio while showing the spectrum:
  11804. @example
  11805. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  11806. @end example
  11807. @item
  11808. Same as above, but with frame rate 30 fps:
  11809. @example
  11810. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  11811. @end example
  11812. @item
  11813. Playing at 1280x720:
  11814. @example
  11815. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  11816. @end example
  11817. @item
  11818. Disable sonogram display:
  11819. @example
  11820. sono_h=0
  11821. @end example
  11822. @item
  11823. A1 and its harmonics: A1, A2, (near)E3, A3:
  11824. @example
  11825. 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),
  11826. asplit[a][out1]; [a] showcqt [out0]'
  11827. @end example
  11828. @item
  11829. Same as above, but with more accuracy in frequency domain:
  11830. @example
  11831. 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),
  11832. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  11833. @end example
  11834. @item
  11835. Custom volume:
  11836. @example
  11837. bar_v=10:sono_v=bar_v*a_weighting(f)
  11838. @end example
  11839. @item
  11840. Custom gamma, now spectrum is linear to the amplitude.
  11841. @example
  11842. bar_g=2:sono_g=2
  11843. @end example
  11844. @item
  11845. Custom tlength equation:
  11846. @example
  11847. 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)))'
  11848. @end example
  11849. @item
  11850. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  11851. @example
  11852. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  11853. @end example
  11854. @item
  11855. Custom frequency range with custom axis using image file:
  11856. @example
  11857. axisfile=myaxis.png:basefreq=40:endfreq=10000
  11858. @end example
  11859. @end itemize
  11860. @section showfreqs
  11861. Convert input audio to video output representing the audio power spectrum.
  11862. Audio amplitude is on Y-axis while frequency is on X-axis.
  11863. The filter accepts the following options:
  11864. @table @option
  11865. @item size, s
  11866. Specify size of video. For the syntax of this option, check the
  11867. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11868. Default is @code{1024x512}.
  11869. @item mode
  11870. Set display mode.
  11871. This set how each frequency bin will be represented.
  11872. It accepts the following values:
  11873. @table @samp
  11874. @item line
  11875. @item bar
  11876. @item dot
  11877. @end table
  11878. Default is @code{bar}.
  11879. @item ascale
  11880. Set amplitude scale.
  11881. It accepts the following values:
  11882. @table @samp
  11883. @item lin
  11884. Linear scale.
  11885. @item sqrt
  11886. Square root scale.
  11887. @item cbrt
  11888. Cubic root scale.
  11889. @item log
  11890. Logarithmic scale.
  11891. @end table
  11892. Default is @code{log}.
  11893. @item fscale
  11894. Set frequency scale.
  11895. It accepts the following values:
  11896. @table @samp
  11897. @item lin
  11898. Linear scale.
  11899. @item log
  11900. Logarithmic scale.
  11901. @item rlog
  11902. Reverse logarithmic scale.
  11903. @end table
  11904. Default is @code{lin}.
  11905. @item win_size
  11906. Set window size.
  11907. It accepts the following values:
  11908. @table @samp
  11909. @item w16
  11910. @item w32
  11911. @item w64
  11912. @item w128
  11913. @item w256
  11914. @item w512
  11915. @item w1024
  11916. @item w2048
  11917. @item w4096
  11918. @item w8192
  11919. @item w16384
  11920. @item w32768
  11921. @item w65536
  11922. @end table
  11923. Default is @code{w2048}
  11924. @item win_func
  11925. Set windowing function.
  11926. It accepts the following values:
  11927. @table @samp
  11928. @item rect
  11929. @item bartlett
  11930. @item hanning
  11931. @item hamming
  11932. @item blackman
  11933. @item welch
  11934. @item flattop
  11935. @item bharris
  11936. @item bnuttall
  11937. @item bhann
  11938. @item sine
  11939. @item nuttall
  11940. @item lanczos
  11941. @item gauss
  11942. @item tukey
  11943. @end table
  11944. Default is @code{hanning}.
  11945. @item overlap
  11946. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  11947. which means optimal overlap for selected window function will be picked.
  11948. @item averaging
  11949. Set time averaging. Setting this to 0 will display current maximal peaks.
  11950. Default is @code{1}, which means time averaging is disabled.
  11951. @item colors
  11952. Specify list of colors separated by space or by '|' which will be used to
  11953. draw channel frequencies. Unrecognized or missing colors will be replaced
  11954. by white color.
  11955. @item cmode
  11956. Set channel display mode.
  11957. It accepts the following values:
  11958. @table @samp
  11959. @item combined
  11960. @item separate
  11961. @end table
  11962. Default is @code{combined}.
  11963. @end table
  11964. @anchor{showspectrum}
  11965. @section showspectrum
  11966. Convert input audio to a video output, representing the audio frequency
  11967. spectrum.
  11968. The filter accepts the following options:
  11969. @table @option
  11970. @item size, s
  11971. Specify the video size for the output. For the syntax of this option, check the
  11972. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11973. Default value is @code{640x512}.
  11974. @item slide
  11975. Specify how the spectrum should slide along the window.
  11976. It accepts the following values:
  11977. @table @samp
  11978. @item replace
  11979. the samples start again on the left when they reach the right
  11980. @item scroll
  11981. the samples scroll from right to left
  11982. @item rscroll
  11983. the samples scroll from left to right
  11984. @item fullframe
  11985. frames are only produced when the samples reach the right
  11986. @end table
  11987. Default value is @code{replace}.
  11988. @item mode
  11989. Specify display mode.
  11990. It accepts the following values:
  11991. @table @samp
  11992. @item combined
  11993. all channels are displayed in the same row
  11994. @item separate
  11995. all channels are displayed in separate rows
  11996. @end table
  11997. Default value is @samp{combined}.
  11998. @item color
  11999. Specify display color mode.
  12000. It accepts the following values:
  12001. @table @samp
  12002. @item channel
  12003. each channel is displayed in a separate color
  12004. @item intensity
  12005. each channel is displayed using the same color scheme
  12006. @item rainbow
  12007. each channel is displayed using the rainbow color scheme
  12008. @item moreland
  12009. each channel is displayed using the moreland color scheme
  12010. @item nebulae
  12011. each channel is displayed using the nebulae color scheme
  12012. @item fire
  12013. each channel is displayed using the fire color scheme
  12014. @item fiery
  12015. each channel is displayed using the fiery color scheme
  12016. @item fruit
  12017. each channel is displayed using the fruit color scheme
  12018. @item cool
  12019. each channel is displayed using the cool color scheme
  12020. @end table
  12021. Default value is @samp{channel}.
  12022. @item scale
  12023. Specify scale used for calculating intensity color values.
  12024. It accepts the following values:
  12025. @table @samp
  12026. @item lin
  12027. linear
  12028. @item sqrt
  12029. square root, default
  12030. @item cbrt
  12031. cubic root
  12032. @item 4thrt
  12033. 4th root
  12034. @item 5thrt
  12035. 5th root
  12036. @item log
  12037. logarithmic
  12038. @end table
  12039. Default value is @samp{sqrt}.
  12040. @item saturation
  12041. Set saturation modifier for displayed colors. Negative values provide
  12042. alternative color scheme. @code{0} is no saturation at all.
  12043. Saturation must be in [-10.0, 10.0] range.
  12044. Default value is @code{1}.
  12045. @item win_func
  12046. Set window function.
  12047. It accepts the following values:
  12048. @table @samp
  12049. @item rect
  12050. @item bartlett
  12051. @item hann
  12052. @item hanning
  12053. @item hamming
  12054. @item blackman
  12055. @item welch
  12056. @item flattop
  12057. @item bharris
  12058. @item bnuttall
  12059. @item bhann
  12060. @item sine
  12061. @item nuttall
  12062. @item lanczos
  12063. @item gauss
  12064. @item tukey
  12065. @end table
  12066. Default value is @code{hann}.
  12067. @item orientation
  12068. Set orientation of time vs frequency axis. Can be @code{vertical} or
  12069. @code{horizontal}. Default is @code{vertical}.
  12070. @item overlap
  12071. Set ratio of overlap window. Default value is @code{0}.
  12072. When value is @code{1} overlap is set to recommended size for specific
  12073. window function currently used.
  12074. @item gain
  12075. Set scale gain for calculating intensity color values.
  12076. Default value is @code{1}.
  12077. @item data
  12078. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  12079. @end table
  12080. The usage is very similar to the showwaves filter; see the examples in that
  12081. section.
  12082. @subsection Examples
  12083. @itemize
  12084. @item
  12085. Large window with logarithmic color scaling:
  12086. @example
  12087. showspectrum=s=1280x480:scale=log
  12088. @end example
  12089. @item
  12090. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  12091. @example
  12092. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  12093. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  12094. @end example
  12095. @end itemize
  12096. @section showspectrumpic
  12097. Convert input audio to a single video frame, representing the audio frequency
  12098. spectrum.
  12099. The filter accepts the following options:
  12100. @table @option
  12101. @item size, s
  12102. Specify the video size for the output. For the syntax of this option, check the
  12103. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12104. Default value is @code{4096x2048}.
  12105. @item mode
  12106. Specify display mode.
  12107. It accepts the following values:
  12108. @table @samp
  12109. @item combined
  12110. all channels are displayed in the same row
  12111. @item separate
  12112. all channels are displayed in separate rows
  12113. @end table
  12114. Default value is @samp{combined}.
  12115. @item color
  12116. Specify display color mode.
  12117. It accepts the following values:
  12118. @table @samp
  12119. @item channel
  12120. each channel is displayed in a separate color
  12121. @item intensity
  12122. each channel is displayed using the same color scheme
  12123. @item rainbow
  12124. each channel is displayed using the rainbow color scheme
  12125. @item moreland
  12126. each channel is displayed using the moreland color scheme
  12127. @item nebulae
  12128. each channel is displayed using the nebulae color scheme
  12129. @item fire
  12130. each channel is displayed using the fire color scheme
  12131. @item fiery
  12132. each channel is displayed using the fiery color scheme
  12133. @item fruit
  12134. each channel is displayed using the fruit color scheme
  12135. @item cool
  12136. each channel is displayed using the cool color scheme
  12137. @end table
  12138. Default value is @samp{intensity}.
  12139. @item scale
  12140. Specify scale used for calculating intensity color values.
  12141. It accepts the following values:
  12142. @table @samp
  12143. @item lin
  12144. linear
  12145. @item sqrt
  12146. square root, default
  12147. @item cbrt
  12148. cubic root
  12149. @item 4thrt
  12150. 4th root
  12151. @item 5thrt
  12152. 5th root
  12153. @item log
  12154. logarithmic
  12155. @end table
  12156. Default value is @samp{log}.
  12157. @item saturation
  12158. Set saturation modifier for displayed colors. Negative values provide
  12159. alternative color scheme. @code{0} is no saturation at all.
  12160. Saturation must be in [-10.0, 10.0] range.
  12161. Default value is @code{1}.
  12162. @item win_func
  12163. Set window function.
  12164. It accepts the following values:
  12165. @table @samp
  12166. @item rect
  12167. @item bartlett
  12168. @item hann
  12169. @item hanning
  12170. @item hamming
  12171. @item blackman
  12172. @item welch
  12173. @item flattop
  12174. @item bharris
  12175. @item bnuttall
  12176. @item bhann
  12177. @item sine
  12178. @item nuttall
  12179. @item lanczos
  12180. @item gauss
  12181. @item tukey
  12182. @end table
  12183. Default value is @code{hann}.
  12184. @item orientation
  12185. Set orientation of time vs frequency axis. Can be @code{vertical} or
  12186. @code{horizontal}. Default is @code{vertical}.
  12187. @item gain
  12188. Set scale gain for calculating intensity color values.
  12189. Default value is @code{1}.
  12190. @item legend
  12191. Draw time and frequency axes and legends. Default is enabled.
  12192. @end table
  12193. @subsection Examples
  12194. @itemize
  12195. @item
  12196. Extract an audio spectrogram of a whole audio track
  12197. in a 1024x1024 picture using @command{ffmpeg}:
  12198. @example
  12199. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  12200. @end example
  12201. @end itemize
  12202. @section showvolume
  12203. Convert input audio volume to a video output.
  12204. The filter accepts the following options:
  12205. @table @option
  12206. @item rate, r
  12207. Set video rate.
  12208. @item b
  12209. Set border width, allowed range is [0, 5]. Default is 1.
  12210. @item w
  12211. Set channel width, allowed range is [80, 8192]. Default is 400.
  12212. @item h
  12213. Set channel height, allowed range is [1, 900]. Default is 20.
  12214. @item f
  12215. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  12216. @item c
  12217. Set volume color expression.
  12218. The expression can use the following variables:
  12219. @table @option
  12220. @item VOLUME
  12221. Current max volume of channel in dB.
  12222. @item CHANNEL
  12223. Current channel number, starting from 0.
  12224. @end table
  12225. @item t
  12226. If set, displays channel names. Default is enabled.
  12227. @item v
  12228. If set, displays volume values. Default is enabled.
  12229. @item o
  12230. Set orientation, can be @code{horizontal} or @code{vertical},
  12231. default is @code{horizontal}.
  12232. @item s
  12233. Set step size, allowed range s [0, 5]. Default is 0, which means
  12234. step is disabled.
  12235. @end table
  12236. @section showwaves
  12237. Convert input audio to a video output, representing the samples waves.
  12238. The filter accepts the following options:
  12239. @table @option
  12240. @item size, s
  12241. Specify the video size for the output. For the syntax of this option, check the
  12242. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12243. Default value is @code{600x240}.
  12244. @item mode
  12245. Set display mode.
  12246. Available values are:
  12247. @table @samp
  12248. @item point
  12249. Draw a point for each sample.
  12250. @item line
  12251. Draw a vertical line for each sample.
  12252. @item p2p
  12253. Draw a point for each sample and a line between them.
  12254. @item cline
  12255. Draw a centered vertical line for each sample.
  12256. @end table
  12257. Default value is @code{point}.
  12258. @item n
  12259. Set the number of samples which are printed on the same column. A
  12260. larger value will decrease the frame rate. Must be a positive
  12261. integer. This option can be set only if the value for @var{rate}
  12262. is not explicitly specified.
  12263. @item rate, r
  12264. Set the (approximate) output frame rate. This is done by setting the
  12265. option @var{n}. Default value is "25".
  12266. @item split_channels
  12267. Set if channels should be drawn separately or overlap. Default value is 0.
  12268. @item colors
  12269. Set colors separated by '|' which are going to be used for drawing of each channel.
  12270. @item scale
  12271. Set amplitude scale. Can be linear @code{lin} or logarithmic @code{log}.
  12272. Default is linear.
  12273. @end table
  12274. @subsection Examples
  12275. @itemize
  12276. @item
  12277. Output the input file audio and the corresponding video representation
  12278. at the same time:
  12279. @example
  12280. amovie=a.mp3,asplit[out0],showwaves[out1]
  12281. @end example
  12282. @item
  12283. Create a synthetic signal and show it with showwaves, forcing a
  12284. frame rate of 30 frames per second:
  12285. @example
  12286. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  12287. @end example
  12288. @end itemize
  12289. @section showwavespic
  12290. Convert input audio to a single video frame, representing the samples waves.
  12291. The filter accepts the following options:
  12292. @table @option
  12293. @item size, s
  12294. Specify the video size for the output. For the syntax of this option, check the
  12295. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12296. Default value is @code{600x240}.
  12297. @item split_channels
  12298. Set if channels should be drawn separately or overlap. Default value is 0.
  12299. @item colors
  12300. Set colors separated by '|' which are going to be used for drawing of each channel.
  12301. @item scale
  12302. Set amplitude scale. Can be linear @code{lin} or logarithmic @code{log}.
  12303. Default is linear.
  12304. @end table
  12305. @subsection Examples
  12306. @itemize
  12307. @item
  12308. Extract a channel split representation of the wave form of a whole audio track
  12309. in a 1024x800 picture using @command{ffmpeg}:
  12310. @example
  12311. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  12312. @end example
  12313. @item
  12314. Colorize the waveform with colorchannelmixer. This example will make
  12315. the waveform a green color approximately RGB(66,217,150). Additional
  12316. channels will be shades of this color.
  12317. @example
  12318. ffmpeg -i audio.mp3 -filter_complex "showwavespic,colorchannelmixer=rr=66/255:gg=217/255:bb=150/255" waveform.png
  12319. @end example
  12320. @end itemize
  12321. @section spectrumsynth
  12322. Sythesize audio from 2 input video spectrums, first input stream represents
  12323. magnitude across time and second represents phase across time.
  12324. The filter will transform from frequency domain as displayed in videos back
  12325. to time domain as presented in audio output.
  12326. This filter is primarly created for reversing processed @ref{showspectrum}
  12327. filter outputs, but can synthesize sound from other spectrograms too.
  12328. But in such case results are going to be poor if the phase data is not
  12329. available, because in such cases phase data need to be recreated, usually
  12330. its just recreated from random noise.
  12331. For best results use gray only output (@code{channel} color mode in
  12332. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  12333. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  12334. @code{data} option. Inputs videos should generally use @code{fullframe}
  12335. slide mode as that saves resources needed for decoding video.
  12336. The filter accepts the following options:
  12337. @table @option
  12338. @item sample_rate
  12339. Specify sample rate of output audio, the sample rate of audio from which
  12340. spectrum was generated may differ.
  12341. @item channels
  12342. Set number of channels represented in input video spectrums.
  12343. @item scale
  12344. Set scale which was used when generating magnitude input spectrum.
  12345. Can be @code{lin} or @code{log}. Default is @code{log}.
  12346. @item slide
  12347. Set slide which was used when generating inputs spectrums.
  12348. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  12349. Default is @code{fullframe}.
  12350. @item win_func
  12351. Set window function used for resynthesis.
  12352. @item overlap
  12353. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  12354. which means optimal overlap for selected window function will be picked.
  12355. @item orientation
  12356. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  12357. Default is @code{vertical}.
  12358. @end table
  12359. @subsection Examples
  12360. @itemize
  12361. @item
  12362. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  12363. then resynthesize videos back to audio with spectrumsynth:
  12364. @example
  12365. 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
  12366. 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
  12367. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  12368. @end example
  12369. @end itemize
  12370. @section split, asplit
  12371. Split input into several identical outputs.
  12372. @code{asplit} works with audio input, @code{split} with video.
  12373. The filter accepts a single parameter which specifies the number of outputs. If
  12374. unspecified, it defaults to 2.
  12375. @subsection Examples
  12376. @itemize
  12377. @item
  12378. Create two separate outputs from the same input:
  12379. @example
  12380. [in] split [out0][out1]
  12381. @end example
  12382. @item
  12383. To create 3 or more outputs, you need to specify the number of
  12384. outputs, like in:
  12385. @example
  12386. [in] asplit=3 [out0][out1][out2]
  12387. @end example
  12388. @item
  12389. Create two separate outputs from the same input, one cropped and
  12390. one padded:
  12391. @example
  12392. [in] split [splitout1][splitout2];
  12393. [splitout1] crop=100:100:0:0 [cropout];
  12394. [splitout2] pad=200:200:100:100 [padout];
  12395. @end example
  12396. @item
  12397. Create 5 copies of the input audio with @command{ffmpeg}:
  12398. @example
  12399. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  12400. @end example
  12401. @end itemize
  12402. @section zmq, azmq
  12403. Receive commands sent through a libzmq client, and forward them to
  12404. filters in the filtergraph.
  12405. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  12406. must be inserted between two video filters, @code{azmq} between two
  12407. audio filters.
  12408. To enable these filters you need to install the libzmq library and
  12409. headers and configure FFmpeg with @code{--enable-libzmq}.
  12410. For more information about libzmq see:
  12411. @url{http://www.zeromq.org/}
  12412. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  12413. receives messages sent through a network interface defined by the
  12414. @option{bind_address} option.
  12415. The received message must be in the form:
  12416. @example
  12417. @var{TARGET} @var{COMMAND} [@var{ARG}]
  12418. @end example
  12419. @var{TARGET} specifies the target of the command, usually the name of
  12420. the filter class or a specific filter instance name.
  12421. @var{COMMAND} specifies the name of the command for the target filter.
  12422. @var{ARG} is optional and specifies the optional argument list for the
  12423. given @var{COMMAND}.
  12424. Upon reception, the message is processed and the corresponding command
  12425. is injected into the filtergraph. Depending on the result, the filter
  12426. will send a reply to the client, adopting the format:
  12427. @example
  12428. @var{ERROR_CODE} @var{ERROR_REASON}
  12429. @var{MESSAGE}
  12430. @end example
  12431. @var{MESSAGE} is optional.
  12432. @subsection Examples
  12433. Look at @file{tools/zmqsend} for an example of a zmq client which can
  12434. be used to send commands processed by these filters.
  12435. Consider the following filtergraph generated by @command{ffplay}
  12436. @example
  12437. ffplay -dumpgraph 1 -f lavfi "
  12438. color=s=100x100:c=red [l];
  12439. color=s=100x100:c=blue [r];
  12440. nullsrc=s=200x100, zmq [bg];
  12441. [bg][l] overlay [bg+l];
  12442. [bg+l][r] overlay=x=100 "
  12443. @end example
  12444. To change the color of the left side of the video, the following
  12445. command can be used:
  12446. @example
  12447. echo Parsed_color_0 c yellow | tools/zmqsend
  12448. @end example
  12449. To change the right side:
  12450. @example
  12451. echo Parsed_color_1 c pink | tools/zmqsend
  12452. @end example
  12453. @c man end MULTIMEDIA FILTERS
  12454. @chapter Multimedia Sources
  12455. @c man begin MULTIMEDIA SOURCES
  12456. Below is a description of the currently available multimedia sources.
  12457. @section amovie
  12458. This is the same as @ref{movie} source, except it selects an audio
  12459. stream by default.
  12460. @anchor{movie}
  12461. @section movie
  12462. Read audio and/or video stream(s) from a movie container.
  12463. It accepts the following parameters:
  12464. @table @option
  12465. @item filename
  12466. The name of the resource to read (not necessarily a file; it can also be a
  12467. device or a stream accessed through some protocol).
  12468. @item format_name, f
  12469. Specifies the format assumed for the movie to read, and can be either
  12470. the name of a container or an input device. If not specified, the
  12471. format is guessed from @var{movie_name} or by probing.
  12472. @item seek_point, sp
  12473. Specifies the seek point in seconds. The frames will be output
  12474. starting from this seek point. The parameter is evaluated with
  12475. @code{av_strtod}, so the numerical value may be suffixed by an IS
  12476. postfix. The default value is "0".
  12477. @item streams, s
  12478. Specifies the streams to read. Several streams can be specified,
  12479. separated by "+". The source will then have as many outputs, in the
  12480. same order. The syntax is explained in the ``Stream specifiers''
  12481. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  12482. respectively the default (best suited) video and audio stream. Default
  12483. is "dv", or "da" if the filter is called as "amovie".
  12484. @item stream_index, si
  12485. Specifies the index of the video stream to read. If the value is -1,
  12486. the most suitable video stream will be automatically selected. The default
  12487. value is "-1". Deprecated. If the filter is called "amovie", it will select
  12488. audio instead of video.
  12489. @item loop
  12490. Specifies how many times to read the stream in sequence.
  12491. If the value is less than 1, the stream will be read again and again.
  12492. Default value is "1".
  12493. Note that when the movie is looped the source timestamps are not
  12494. changed, so it will generate non monotonically increasing timestamps.
  12495. @end table
  12496. It allows overlaying a second video on top of the main input of
  12497. a filtergraph, as shown in this graph:
  12498. @example
  12499. input -----------> deltapts0 --> overlay --> output
  12500. ^
  12501. |
  12502. movie --> scale--> deltapts1 -------+
  12503. @end example
  12504. @subsection Examples
  12505. @itemize
  12506. @item
  12507. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  12508. on top of the input labelled "in":
  12509. @example
  12510. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  12511. [in] setpts=PTS-STARTPTS [main];
  12512. [main][over] overlay=16:16 [out]
  12513. @end example
  12514. @item
  12515. Read from a video4linux2 device, and overlay it on top of the input
  12516. labelled "in":
  12517. @example
  12518. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  12519. [in] setpts=PTS-STARTPTS [main];
  12520. [main][over] overlay=16:16 [out]
  12521. @end example
  12522. @item
  12523. Read the first video stream and the audio stream with id 0x81 from
  12524. dvd.vob; the video is connected to the pad named "video" and the audio is
  12525. connected to the pad named "audio":
  12526. @example
  12527. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  12528. @end example
  12529. @end itemize
  12530. @c man end MULTIMEDIA SOURCES