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.

18764 lines
498KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @section Notes on filtergraph escaping
  181. Filtergraph description composition entails several levels of
  182. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  183. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  184. information about the employed escaping procedure.
  185. A first level escaping affects the content of each filter option
  186. value, which may contain the special character @code{:} used to
  187. separate values, or one of the escaping characters @code{\'}.
  188. A second level escaping affects the whole filter description, which
  189. may contain the escaping characters @code{\'} or the special
  190. characters @code{[],;} used by the filtergraph description.
  191. Finally, when you specify a filtergraph on a shell commandline, you
  192. need to perform a third level escaping for the shell special
  193. characters contained within it.
  194. For example, consider the following string to be embedded in
  195. the @ref{drawtext} filter description @option{text} value:
  196. @example
  197. this is a 'string': may contain one, or more, special characters
  198. @end example
  199. This string contains the @code{'} special escaping character, and the
  200. @code{:} special character, so it needs to be escaped in this way:
  201. @example
  202. text=this is a \'string\'\: may contain one, or more, special characters
  203. @end example
  204. A second level of escaping is required when embedding the filter
  205. description in a filtergraph description, in order to escape all the
  206. filtergraph special characters. Thus the example above becomes:
  207. @example
  208. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  209. @end example
  210. (note that in addition to the @code{\'} escaping special characters,
  211. also @code{,} needs to be escaped).
  212. Finally an additional level of escaping is needed when writing the
  213. filtergraph description in a shell command, which depends on the
  214. escaping rules of the adopted shell. For example, assuming that
  215. @code{\} is special and needs to be escaped with another @code{\}, the
  216. previous string will finally result in:
  217. @example
  218. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  219. @end example
  220. @chapter Timeline editing
  221. Some filters support a generic @option{enable} option. For the filters
  222. supporting timeline editing, this option can be set to an expression which is
  223. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  224. the filter will be enabled, otherwise the frame will be sent unchanged to the
  225. next filter in the filtergraph.
  226. The expression accepts the following values:
  227. @table @samp
  228. @item t
  229. timestamp expressed in seconds, NAN if the input timestamp is unknown
  230. @item n
  231. sequential number of the input frame, starting from 0
  232. @item pos
  233. the position in the file of the input frame, NAN if unknown
  234. @item w
  235. @item h
  236. width and height of the input frame if video
  237. @end table
  238. Additionally, these filters support an @option{enable} command that can be used
  239. to re-define the expression.
  240. Like any other filtering option, the @option{enable} option follows the same
  241. rules.
  242. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  243. minutes, and a @ref{curves} filter starting at 3 seconds:
  244. @example
  245. smartblur = enable='between(t,10,3*60)',
  246. curves = enable='gte(t,3)' : preset=cross_process
  247. @end example
  248. See @code{ffmpeg -filters} to view which filters have timeline support.
  249. @c man end FILTERGRAPH DESCRIPTION
  250. @chapter Audio Filters
  251. @c man begin AUDIO FILTERS
  252. When you configure your FFmpeg build, you can disable any of the
  253. existing filters using @code{--disable-filters}.
  254. The configure output will show the audio filters included in your
  255. build.
  256. Below is a description of the currently available audio filters.
  257. @section acompressor
  258. A compressor is mainly used to reduce the dynamic range of a signal.
  259. Especially modern music is mostly compressed at a high ratio to
  260. improve the overall loudness. It's done to get the highest attention
  261. of a listener, "fatten" the sound and bring more "power" to the track.
  262. If a signal is compressed too much it may sound dull or "dead"
  263. afterwards or it may start to "pump" (which could be a powerful effect
  264. but can also destroy a track completely).
  265. The right compression is the key to reach a professional sound and is
  266. the high art of mixing and mastering. Because of its complex settings
  267. it may take a long time to get the right feeling for this kind of effect.
  268. Compression is done by detecting the volume above a chosen level
  269. @code{threshold} and dividing it by the factor set with @code{ratio}.
  270. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  271. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  272. the signal would cause distortion of the waveform the reduction can be
  273. levelled over the time. This is done by setting "Attack" and "Release".
  274. @code{attack} determines how long the signal has to rise above the threshold
  275. before any reduction will occur and @code{release} sets the time the signal
  276. has to fall below the threshold to reduce the reduction again. Shorter signals
  277. than the chosen attack time will be left untouched.
  278. The overall reduction of the signal can be made up afterwards with the
  279. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  280. raising the makeup to this level results in a signal twice as loud than the
  281. source. To gain a softer entry in the compression the @code{knee} flattens the
  282. hard edge at the threshold in the range of the chosen decibels.
  283. The filter accepts the following options:
  284. @table @option
  285. @item level_in
  286. Set input gain. Default is 1. Range is between 0.015625 and 64.
  287. @item threshold
  288. If a signal of stream rises above this level it will affect the gain
  289. reduction.
  290. By default it is 0.125. Range is between 0.00097563 and 1.
  291. @item ratio
  292. Set a ratio by which the signal is reduced. 1:2 means that if the level
  293. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  294. Default is 2. Range is between 1 and 20.
  295. @item attack
  296. Amount of milliseconds the signal has to rise above the threshold before gain
  297. reduction starts. Default is 20. Range is between 0.01 and 2000.
  298. @item release
  299. Amount of milliseconds the signal has to fall below the threshold before
  300. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  301. @item makeup
  302. Set the amount by how much signal will be amplified after processing.
  303. Default is 1. Range is from 1 to 64.
  304. @item knee
  305. Curve the sharp knee around the threshold to enter gain reduction more softly.
  306. Default is 2.82843. Range is between 1 and 8.
  307. @item link
  308. Choose if the @code{average} level between all channels of input stream
  309. or the louder(@code{maximum}) channel of input stream affects the
  310. reduction. Default is @code{average}.
  311. @item detection
  312. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  313. of @code{rms}. Default is @code{rms} which is mostly smoother.
  314. @item mix
  315. How much to use compressed signal in output. Default is 1.
  316. Range is between 0 and 1.
  317. @end table
  318. @section acopy
  319. Copy the input audio source unchanged to the output. This is mainly useful for
  320. testing purposes.
  321. @section acrossfade
  322. Apply cross fade from one input audio stream to another input audio stream.
  323. The cross fade is applied for specified duration near the end of first stream.
  324. The filter accepts the following options:
  325. @table @option
  326. @item nb_samples, ns
  327. Specify the number of samples for which the cross fade effect has to last.
  328. At the end of the cross fade effect the first input audio will be completely
  329. silent. Default is 44100.
  330. @item duration, d
  331. Specify the duration of the cross fade effect. See
  332. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  333. for the accepted syntax.
  334. By default the duration is determined by @var{nb_samples}.
  335. If set this option is used instead of @var{nb_samples}.
  336. @item overlap, o
  337. Should first stream end overlap with second stream start. Default is enabled.
  338. @item curve1
  339. Set curve for cross fade transition for first stream.
  340. @item curve2
  341. Set curve for cross fade transition for second stream.
  342. For description of available curve types see @ref{afade} filter description.
  343. @end table
  344. @subsection Examples
  345. @itemize
  346. @item
  347. Cross fade from one input to another:
  348. @example
  349. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  350. @end example
  351. @item
  352. Cross fade from one input to another but without overlapping:
  353. @example
  354. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  355. @end example
  356. @end itemize
  357. @section acrusher
  358. Reduce audio bit resolution.
  359. This filter is bit crusher with enhanced functionality. A bit crusher
  360. is used to audibly reduce number of bits an audio signal is sampled
  361. with. This doesn't change the bit depth at all, it just produces the
  362. effect. Material reduced in bit depth sounds more harsh and "digital".
  363. This filter is able to even round to continuous values instead of discrete
  364. bit depths.
  365. Additionally it has a D/C offset which results in different crushing of
  366. the lower and the upper half of the signal.
  367. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  368. Another feature of this filter is the logarithmic mode.
  369. This setting switches from linear distances between bits to logarithmic ones.
  370. The result is a much more "natural" sounding crusher which doesn't gate low
  371. signals for example. The human ear has a logarithmic perception, too
  372. so this kind of crushing is much more pleasant.
  373. Logarithmic crushing is also able to get anti-aliased.
  374. The filter accepts the following options:
  375. @table @option
  376. @item level_in
  377. Set level in.
  378. @item level_out
  379. Set level out.
  380. @item bits
  381. Set bit reduction.
  382. @item mix
  383. Set mixing amount.
  384. @item mode
  385. Can be linear: @code{lin} or logarithmic: @code{log}.
  386. @item dc
  387. Set DC.
  388. @item aa
  389. Set anti-aliasing.
  390. @item samples
  391. Set sample reduction.
  392. @item lfo
  393. Enable LFO. By default disabled.
  394. @item lforange
  395. Set LFO range.
  396. @item lforate
  397. Set LFO rate.
  398. @end table
  399. @section adelay
  400. Delay one or more audio channels.
  401. Samples in delayed channel are filled with silence.
  402. The filter accepts the following option:
  403. @table @option
  404. @item delays
  405. Set list of delays in milliseconds for each channel separated by '|'.
  406. At least one delay greater than 0 should be provided.
  407. Unused delays will be silently ignored. If number of given delays is
  408. smaller than number of channels all remaining channels will not be delayed.
  409. If you want to delay exact number of samples, append 'S' to number.
  410. @end table
  411. @subsection Examples
  412. @itemize
  413. @item
  414. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  415. the second channel (and any other channels that may be present) unchanged.
  416. @example
  417. adelay=1500|0|500
  418. @end example
  419. @item
  420. Delay second channel by 500 samples, the third channel by 700 samples and leave
  421. the first channel (and any other channels that may be present) unchanged.
  422. @example
  423. adelay=0|500S|700S
  424. @end example
  425. @end itemize
  426. @section aecho
  427. Apply echoing to the input audio.
  428. Echoes are reflected sound and can occur naturally amongst mountains
  429. (and sometimes large buildings) when talking or shouting; digital echo
  430. effects emulate this behaviour and are often used to help fill out the
  431. sound of a single instrument or vocal. The time difference between the
  432. original signal and the reflection is the @code{delay}, and the
  433. loudness of the reflected signal is the @code{decay}.
  434. Multiple echoes can have different delays and decays.
  435. A description of the accepted parameters follows.
  436. @table @option
  437. @item in_gain
  438. Set input gain of reflected signal. Default is @code{0.6}.
  439. @item out_gain
  440. Set output gain of reflected signal. Default is @code{0.3}.
  441. @item delays
  442. Set list of time intervals in milliseconds between original signal and reflections
  443. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  444. Default is @code{1000}.
  445. @item decays
  446. Set list of loudnesses of reflected signals separated by '|'.
  447. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  448. Default is @code{0.5}.
  449. @end table
  450. @subsection Examples
  451. @itemize
  452. @item
  453. Make it sound as if there are twice as many instruments as are actually playing:
  454. @example
  455. aecho=0.8:0.88:60:0.4
  456. @end example
  457. @item
  458. If delay is very short, then it sound like a (metallic) robot playing music:
  459. @example
  460. aecho=0.8:0.88:6:0.4
  461. @end example
  462. @item
  463. A longer delay will sound like an open air concert in the mountains:
  464. @example
  465. aecho=0.8:0.9:1000:0.3
  466. @end example
  467. @item
  468. Same as above but with one more mountain:
  469. @example
  470. aecho=0.8:0.9:1000|1800:0.3|0.25
  471. @end example
  472. @end itemize
  473. @section aemphasis
  474. Audio emphasis filter creates or restores material directly taken from LPs or
  475. emphased CDs with different filter curves. E.g. to store music on vinyl the
  476. signal has to be altered by a filter first to even out the disadvantages of
  477. this recording medium.
  478. Once the material is played back the inverse filter has to be applied to
  479. restore the distortion of the frequency response.
  480. The filter accepts the following options:
  481. @table @option
  482. @item level_in
  483. Set input gain.
  484. @item level_out
  485. Set output gain.
  486. @item mode
  487. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  488. use @code{production} mode. Default is @code{reproduction} mode.
  489. @item type
  490. Set filter type. Selects medium. Can be one of the following:
  491. @table @option
  492. @item col
  493. select Columbia.
  494. @item emi
  495. select EMI.
  496. @item bsi
  497. select BSI (78RPM).
  498. @item riaa
  499. select RIAA.
  500. @item cd
  501. select Compact Disc (CD).
  502. @item 50fm
  503. select 50µs (FM).
  504. @item 75fm
  505. select 75µs (FM).
  506. @item 50kf
  507. select 50µs (FM-KF).
  508. @item 75kf
  509. select 75µs (FM-KF).
  510. @end table
  511. @end table
  512. @section aeval
  513. Modify an audio signal according to the specified expressions.
  514. This filter accepts one or more expressions (one for each channel),
  515. which are evaluated and used to modify a corresponding audio signal.
  516. It accepts the following parameters:
  517. @table @option
  518. @item exprs
  519. Set the '|'-separated expressions list for each separate channel. If
  520. the number of input channels is greater than the number of
  521. expressions, the last specified expression is used for the remaining
  522. output channels.
  523. @item channel_layout, c
  524. Set output channel layout. If not specified, the channel layout is
  525. specified by the number of expressions. If set to @samp{same}, it will
  526. use by default the same input channel layout.
  527. @end table
  528. Each expression in @var{exprs} can contain the following constants and functions:
  529. @table @option
  530. @item ch
  531. channel number of the current expression
  532. @item n
  533. number of the evaluated sample, starting from 0
  534. @item s
  535. sample rate
  536. @item t
  537. time of the evaluated sample expressed in seconds
  538. @item nb_in_channels
  539. @item nb_out_channels
  540. input and output number of channels
  541. @item val(CH)
  542. the value of input channel with number @var{CH}
  543. @end table
  544. Note: this filter is slow. For faster processing you should use a
  545. dedicated filter.
  546. @subsection Examples
  547. @itemize
  548. @item
  549. Half volume:
  550. @example
  551. aeval=val(ch)/2:c=same
  552. @end example
  553. @item
  554. Invert phase of the second channel:
  555. @example
  556. aeval=val(0)|-val(1)
  557. @end example
  558. @end itemize
  559. @anchor{afade}
  560. @section afade
  561. Apply fade-in/out effect to input audio.
  562. A description of the accepted parameters follows.
  563. @table @option
  564. @item type, t
  565. Specify the effect type, can be either @code{in} for fade-in, or
  566. @code{out} for a fade-out effect. Default is @code{in}.
  567. @item start_sample, ss
  568. Specify the number of the start sample for starting to apply the fade
  569. effect. Default is 0.
  570. @item nb_samples, ns
  571. Specify the number of samples for which the fade effect has to last. At
  572. the end of the fade-in effect the output audio will have the same
  573. volume as the input audio, at the end of the fade-out transition
  574. the output audio will be silence. Default is 44100.
  575. @item start_time, st
  576. Specify the start time of the fade effect. Default is 0.
  577. The value must be specified as a time duration; see
  578. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  579. for the accepted syntax.
  580. If set this option is used instead of @var{start_sample}.
  581. @item duration, d
  582. Specify the duration of the fade effect. See
  583. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  584. for the accepted syntax.
  585. At the end of the fade-in effect the output audio will have the same
  586. volume as the input audio, at the end of the fade-out transition
  587. the output audio will be silence.
  588. By default the duration is determined by @var{nb_samples}.
  589. If set this option is used instead of @var{nb_samples}.
  590. @item curve
  591. Set curve for fade transition.
  592. It accepts the following values:
  593. @table @option
  594. @item tri
  595. select triangular, linear slope (default)
  596. @item qsin
  597. select quarter of sine wave
  598. @item hsin
  599. select half of sine wave
  600. @item esin
  601. select exponential sine wave
  602. @item log
  603. select logarithmic
  604. @item ipar
  605. select inverted parabola
  606. @item qua
  607. select quadratic
  608. @item cub
  609. select cubic
  610. @item squ
  611. select square root
  612. @item cbr
  613. select cubic root
  614. @item par
  615. select parabola
  616. @item exp
  617. select exponential
  618. @item iqsin
  619. select inverted quarter of sine wave
  620. @item ihsin
  621. select inverted half of sine wave
  622. @item dese
  623. select double-exponential seat
  624. @item desi
  625. select double-exponential sigmoid
  626. @end table
  627. @end table
  628. @subsection Examples
  629. @itemize
  630. @item
  631. Fade in first 15 seconds of audio:
  632. @example
  633. afade=t=in:ss=0:d=15
  634. @end example
  635. @item
  636. Fade out last 25 seconds of a 900 seconds audio:
  637. @example
  638. afade=t=out:st=875:d=25
  639. @end example
  640. @end itemize
  641. @section afftfilt
  642. Apply arbitrary expressions to samples in frequency domain.
  643. @table @option
  644. @item real
  645. Set frequency domain real expression for each separate channel separated
  646. by '|'. Default is "1".
  647. If the number of input channels is greater than the number of
  648. expressions, the last specified expression is used for the remaining
  649. output channels.
  650. @item imag
  651. Set frequency domain imaginary expression for each separate channel
  652. separated by '|'. If not set, @var{real} option is used.
  653. Each expression in @var{real} and @var{imag} can contain the following
  654. constants:
  655. @table @option
  656. @item sr
  657. sample rate
  658. @item b
  659. current frequency bin number
  660. @item nb
  661. number of available bins
  662. @item ch
  663. channel number of the current expression
  664. @item chs
  665. number of channels
  666. @item pts
  667. current frame pts
  668. @end table
  669. @item win_size
  670. Set window size.
  671. It accepts the following values:
  672. @table @samp
  673. @item w16
  674. @item w32
  675. @item w64
  676. @item w128
  677. @item w256
  678. @item w512
  679. @item w1024
  680. @item w2048
  681. @item w4096
  682. @item w8192
  683. @item w16384
  684. @item w32768
  685. @item w65536
  686. @end table
  687. Default is @code{w4096}
  688. @item win_func
  689. Set window function. Default is @code{hann}.
  690. @item overlap
  691. Set window overlap. If set to 1, the recommended overlap for selected
  692. window function will be picked. Default is @code{0.75}.
  693. @end table
  694. @subsection Examples
  695. @itemize
  696. @item
  697. Leave almost only low frequencies in audio:
  698. @example
  699. afftfilt="1-clip((b/nb)*b,0,1)"
  700. @end example
  701. @end itemize
  702. @section afir
  703. Apply an arbitrary Frequency Impulse Response filter.
  704. This filter is designed for applying long FIR filters,
  705. up to 30 seconds long.
  706. It can be used as component for digital crossover filters,
  707. room equalization, cross talk cancellation, wavefield synthesis,
  708. auralization, ambiophonics and ambisonics.
  709. This filter uses second stream as FIR coefficients.
  710. If second stream holds single channel, it will be used
  711. for all input channels in first stream, otherwise
  712. number of channels in second stream must be same as
  713. number of channels in first stream.
  714. It accepts the following parameters:
  715. @table @option
  716. @item dry
  717. Set dry gain. This sets input gain.
  718. @item wet
  719. Set wet gain. This sets final output gain.
  720. @item length
  721. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  722. @item again
  723. Enable applying gain measured from power of IR.
  724. @end table
  725. @subsection Examples
  726. @itemize
  727. @item
  728. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  729. @example
  730. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  731. @end example
  732. @end itemize
  733. @anchor{aformat}
  734. @section aformat
  735. Set output format constraints for the input audio. The framework will
  736. negotiate the most appropriate format to minimize conversions.
  737. It accepts the following parameters:
  738. @table @option
  739. @item sample_fmts
  740. A '|'-separated list of requested sample formats.
  741. @item sample_rates
  742. A '|'-separated list of requested sample rates.
  743. @item channel_layouts
  744. A '|'-separated list of requested channel layouts.
  745. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  746. for the required syntax.
  747. @end table
  748. If a parameter is omitted, all values are allowed.
  749. Force the output to either unsigned 8-bit or signed 16-bit stereo
  750. @example
  751. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  752. @end example
  753. @section agate
  754. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  755. processing reduces disturbing noise between useful signals.
  756. Gating is done by detecting the volume below a chosen level @var{threshold}
  757. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  758. floor is set via @var{range}. Because an exact manipulation of the signal
  759. would cause distortion of the waveform the reduction can be levelled over
  760. time. This is done by setting @var{attack} and @var{release}.
  761. @var{attack} determines how long the signal has to fall below the threshold
  762. before any reduction will occur and @var{release} sets the time the signal
  763. has to rise above the threshold to reduce the reduction again.
  764. Shorter signals than the chosen attack time will be left untouched.
  765. @table @option
  766. @item level_in
  767. Set input level before filtering.
  768. Default is 1. Allowed range is from 0.015625 to 64.
  769. @item range
  770. Set the level of gain reduction when the signal is below the threshold.
  771. Default is 0.06125. Allowed range is from 0 to 1.
  772. @item threshold
  773. If a signal rises above this level the gain reduction is released.
  774. Default is 0.125. Allowed range is from 0 to 1.
  775. @item ratio
  776. Set a ratio by which the signal is reduced.
  777. Default is 2. Allowed range is from 1 to 9000.
  778. @item attack
  779. Amount of milliseconds the signal has to rise above the threshold before gain
  780. reduction stops.
  781. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  782. @item release
  783. Amount of milliseconds the signal has to fall below the threshold before the
  784. reduction is increased again. Default is 250 milliseconds.
  785. Allowed range is from 0.01 to 9000.
  786. @item makeup
  787. Set amount of amplification of signal after processing.
  788. Default is 1. Allowed range is from 1 to 64.
  789. @item knee
  790. Curve the sharp knee around the threshold to enter gain reduction more softly.
  791. Default is 2.828427125. Allowed range is from 1 to 8.
  792. @item detection
  793. Choose if exact signal should be taken for detection or an RMS like one.
  794. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  795. @item link
  796. Choose if the average level between all channels or the louder channel affects
  797. the reduction.
  798. Default is @code{average}. Can be @code{average} or @code{maximum}.
  799. @end table
  800. @section alimiter
  801. The limiter prevents an input signal from rising over a desired threshold.
  802. This limiter uses lookahead technology to prevent your signal from distorting.
  803. It means that there is a small delay after the signal is processed. Keep in mind
  804. that the delay it produces is the attack time you set.
  805. The filter accepts the following options:
  806. @table @option
  807. @item level_in
  808. Set input gain. Default is 1.
  809. @item level_out
  810. Set output gain. Default is 1.
  811. @item limit
  812. Don't let signals above this level pass the limiter. Default is 1.
  813. @item attack
  814. The limiter will reach its attenuation level in this amount of time in
  815. milliseconds. Default is 5 milliseconds.
  816. @item release
  817. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  818. Default is 50 milliseconds.
  819. @item asc
  820. When gain reduction is always needed ASC takes care of releasing to an
  821. average reduction level rather than reaching a reduction of 0 in the release
  822. time.
  823. @item asc_level
  824. Select how much the release time is affected by ASC, 0 means nearly no changes
  825. in release time while 1 produces higher release times.
  826. @item level
  827. Auto level output signal. Default is enabled.
  828. This normalizes audio back to 0dB if enabled.
  829. @end table
  830. Depending on picked setting it is recommended to upsample input 2x or 4x times
  831. with @ref{aresample} before applying this filter.
  832. @section allpass
  833. Apply a two-pole all-pass filter with central frequency (in Hz)
  834. @var{frequency}, and filter-width @var{width}.
  835. An all-pass filter changes the audio's frequency to phase relationship
  836. without changing its frequency to amplitude relationship.
  837. The filter accepts the following options:
  838. @table @option
  839. @item frequency, f
  840. Set frequency in Hz.
  841. @item width_type
  842. Set method to specify band-width of filter.
  843. @table @option
  844. @item h
  845. Hz
  846. @item q
  847. Q-Factor
  848. @item o
  849. octave
  850. @item s
  851. slope
  852. @end table
  853. @item width, w
  854. Specify the band-width of a filter in width_type units.
  855. @item channels, c
  856. Specify which channels to filter, by default all available are filtered.
  857. @end table
  858. @section aloop
  859. Loop audio samples.
  860. The filter accepts the following options:
  861. @table @option
  862. @item loop
  863. Set the number of loops.
  864. @item size
  865. Set maximal number of samples.
  866. @item start
  867. Set first sample of loop.
  868. @end table
  869. @anchor{amerge}
  870. @section amerge
  871. Merge two or more audio streams into a single multi-channel stream.
  872. The filter accepts the following options:
  873. @table @option
  874. @item inputs
  875. Set the number of inputs. Default is 2.
  876. @end table
  877. If the channel layouts of the inputs are disjoint, and therefore compatible,
  878. the channel layout of the output will be set accordingly and the channels
  879. will be reordered as necessary. If the channel layouts of the inputs are not
  880. disjoint, the output will have all the channels of the first input then all
  881. the channels of the second input, in that order, and the channel layout of
  882. the output will be the default value corresponding to the total number of
  883. channels.
  884. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  885. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  886. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  887. first input, b1 is the first channel of the second input).
  888. On the other hand, if both input are in stereo, the output channels will be
  889. in the default order: a1, a2, b1, b2, and the channel layout will be
  890. arbitrarily set to 4.0, which may or may not be the expected value.
  891. All inputs must have the same sample rate, and format.
  892. If inputs do not have the same duration, the output will stop with the
  893. shortest.
  894. @subsection Examples
  895. @itemize
  896. @item
  897. Merge two mono files into a stereo stream:
  898. @example
  899. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  900. @end example
  901. @item
  902. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  903. @example
  904. 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
  905. @end example
  906. @end itemize
  907. @section amix
  908. Mixes multiple audio inputs into a single output.
  909. Note that this filter only supports float samples (the @var{amerge}
  910. and @var{pan} audio filters support many formats). If the @var{amix}
  911. input has integer samples then @ref{aresample} will be automatically
  912. inserted to perform the conversion to float samples.
  913. For example
  914. @example
  915. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  916. @end example
  917. will mix 3 input audio streams to a single output with the same duration as the
  918. first input and a dropout transition time of 3 seconds.
  919. It accepts the following parameters:
  920. @table @option
  921. @item inputs
  922. The number of inputs. If unspecified, it defaults to 2.
  923. @item duration
  924. How to determine the end-of-stream.
  925. @table @option
  926. @item longest
  927. The duration of the longest input. (default)
  928. @item shortest
  929. The duration of the shortest input.
  930. @item first
  931. The duration of the first input.
  932. @end table
  933. @item dropout_transition
  934. The transition time, in seconds, for volume renormalization when an input
  935. stream ends. The default value is 2 seconds.
  936. @end table
  937. @section anequalizer
  938. High-order parametric multiband equalizer for each channel.
  939. It accepts the following parameters:
  940. @table @option
  941. @item params
  942. This option string is in format:
  943. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  944. Each equalizer band is separated by '|'.
  945. @table @option
  946. @item chn
  947. Set channel number to which equalization will be applied.
  948. If input doesn't have that channel the entry is ignored.
  949. @item f
  950. Set central frequency for band.
  951. If input doesn't have that frequency the entry is ignored.
  952. @item w
  953. Set band width in hertz.
  954. @item g
  955. Set band gain in dB.
  956. @item t
  957. Set filter type for band, optional, can be:
  958. @table @samp
  959. @item 0
  960. Butterworth, this is default.
  961. @item 1
  962. Chebyshev type 1.
  963. @item 2
  964. Chebyshev type 2.
  965. @end table
  966. @end table
  967. @item curves
  968. With this option activated frequency response of anequalizer is displayed
  969. in video stream.
  970. @item size
  971. Set video stream size. Only useful if curves option is activated.
  972. @item mgain
  973. Set max gain that will be displayed. Only useful if curves option is activated.
  974. Setting this to a reasonable value makes it possible to display gain which is derived from
  975. neighbour bands which are too close to each other and thus produce higher gain
  976. when both are activated.
  977. @item fscale
  978. Set frequency scale used to draw frequency response in video output.
  979. Can be linear or logarithmic. Default is logarithmic.
  980. @item colors
  981. Set color for each channel curve which is going to be displayed in video stream.
  982. This is list of color names separated by space or by '|'.
  983. Unrecognised or missing colors will be replaced by white color.
  984. @end table
  985. @subsection Examples
  986. @itemize
  987. @item
  988. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  989. for first 2 channels using Chebyshev type 1 filter:
  990. @example
  991. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  992. @end example
  993. @end itemize
  994. @subsection Commands
  995. This filter supports the following commands:
  996. @table @option
  997. @item change
  998. Alter existing filter parameters.
  999. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1000. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1001. error is returned.
  1002. @var{freq} set new frequency parameter.
  1003. @var{width} set new width parameter in herz.
  1004. @var{gain} set new gain parameter in dB.
  1005. Full filter invocation with asendcmd may look like this:
  1006. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1007. @end table
  1008. @section anull
  1009. Pass the audio source unchanged to the output.
  1010. @section apad
  1011. Pad the end of an audio stream with silence.
  1012. This can be used together with @command{ffmpeg} @option{-shortest} to
  1013. extend audio streams to the same length as the video stream.
  1014. A description of the accepted options follows.
  1015. @table @option
  1016. @item packet_size
  1017. Set silence packet size. Default value is 4096.
  1018. @item pad_len
  1019. Set the number of samples of silence to add to the end. After the
  1020. value is reached, the stream is terminated. This option is mutually
  1021. exclusive with @option{whole_len}.
  1022. @item whole_len
  1023. Set the minimum total number of samples in the output audio stream. If
  1024. the value is longer than the input audio length, silence is added to
  1025. the end, until the value is reached. This option is mutually exclusive
  1026. with @option{pad_len}.
  1027. @end table
  1028. If neither the @option{pad_len} nor the @option{whole_len} option is
  1029. set, the filter will add silence to the end of the input stream
  1030. indefinitely.
  1031. @subsection Examples
  1032. @itemize
  1033. @item
  1034. Add 1024 samples of silence to the end of the input:
  1035. @example
  1036. apad=pad_len=1024
  1037. @end example
  1038. @item
  1039. Make sure the audio output will contain at least 10000 samples, pad
  1040. the input with silence if required:
  1041. @example
  1042. apad=whole_len=10000
  1043. @end example
  1044. @item
  1045. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1046. video stream will always result the shortest and will be converted
  1047. until the end in the output file when using the @option{shortest}
  1048. option:
  1049. @example
  1050. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1051. @end example
  1052. @end itemize
  1053. @section aphaser
  1054. Add a phasing effect to the input audio.
  1055. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1056. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1057. A description of the accepted parameters follows.
  1058. @table @option
  1059. @item in_gain
  1060. Set input gain. Default is 0.4.
  1061. @item out_gain
  1062. Set output gain. Default is 0.74
  1063. @item delay
  1064. Set delay in milliseconds. Default is 3.0.
  1065. @item decay
  1066. Set decay. Default is 0.4.
  1067. @item speed
  1068. Set modulation speed in Hz. Default is 0.5.
  1069. @item type
  1070. Set modulation type. Default is triangular.
  1071. It accepts the following values:
  1072. @table @samp
  1073. @item triangular, t
  1074. @item sinusoidal, s
  1075. @end table
  1076. @end table
  1077. @section apulsator
  1078. Audio pulsator is something between an autopanner and a tremolo.
  1079. But it can produce funny stereo effects as well. Pulsator changes the volume
  1080. of the left and right channel based on a LFO (low frequency oscillator) with
  1081. different waveforms and shifted phases.
  1082. This filter have the ability to define an offset between left and right
  1083. channel. An offset of 0 means that both LFO shapes match each other.
  1084. The left and right channel are altered equally - a conventional tremolo.
  1085. An offset of 50% means that the shape of the right channel is exactly shifted
  1086. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1087. an autopanner. At 1 both curves match again. Every setting in between moves the
  1088. phase shift gapless between all stages and produces some "bypassing" sounds with
  1089. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1090. the 0.5) the faster the signal passes from the left to the right speaker.
  1091. The filter accepts the following options:
  1092. @table @option
  1093. @item level_in
  1094. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1095. @item level_out
  1096. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1097. @item mode
  1098. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1099. sawup or sawdown. Default is sine.
  1100. @item amount
  1101. Set modulation. Define how much of original signal is affected by the LFO.
  1102. @item offset_l
  1103. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1104. @item offset_r
  1105. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1106. @item width
  1107. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1108. @item timing
  1109. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1110. @item bpm
  1111. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1112. is set to bpm.
  1113. @item ms
  1114. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1115. is set to ms.
  1116. @item hz
  1117. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1118. if timing is set to hz.
  1119. @end table
  1120. @anchor{aresample}
  1121. @section aresample
  1122. Resample the input audio to the specified parameters, using the
  1123. libswresample library. If none are specified then the filter will
  1124. automatically convert between its input and output.
  1125. This filter is also able to stretch/squeeze the audio data to make it match
  1126. the timestamps or to inject silence / cut out audio to make it match the
  1127. timestamps, do a combination of both or do neither.
  1128. The filter accepts the syntax
  1129. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1130. expresses a sample rate and @var{resampler_options} is a list of
  1131. @var{key}=@var{value} pairs, separated by ":". See the
  1132. @ref{Resampler Options,,the "Resampler Options" section in the
  1133. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1134. for the complete list of supported options.
  1135. @subsection Examples
  1136. @itemize
  1137. @item
  1138. Resample the input audio to 44100Hz:
  1139. @example
  1140. aresample=44100
  1141. @end example
  1142. @item
  1143. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1144. samples per second compensation:
  1145. @example
  1146. aresample=async=1000
  1147. @end example
  1148. @end itemize
  1149. @section areverse
  1150. Reverse an audio clip.
  1151. Warning: This filter requires memory to buffer the entire clip, so trimming
  1152. is suggested.
  1153. @subsection Examples
  1154. @itemize
  1155. @item
  1156. Take the first 5 seconds of a clip, and reverse it.
  1157. @example
  1158. atrim=end=5,areverse
  1159. @end example
  1160. @end itemize
  1161. @section asetnsamples
  1162. Set the number of samples per each output audio frame.
  1163. The last output packet may contain a different number of samples, as
  1164. the filter will flush all the remaining samples when the input audio
  1165. signals its end.
  1166. The filter accepts the following options:
  1167. @table @option
  1168. @item nb_out_samples, n
  1169. Set the number of frames per each output audio frame. The number is
  1170. intended as the number of samples @emph{per each channel}.
  1171. Default value is 1024.
  1172. @item pad, p
  1173. If set to 1, the filter will pad the last audio frame with zeroes, so
  1174. that the last frame will contain the same number of samples as the
  1175. previous ones. Default value is 1.
  1176. @end table
  1177. For example, to set the number of per-frame samples to 1234 and
  1178. disable padding for the last frame, use:
  1179. @example
  1180. asetnsamples=n=1234:p=0
  1181. @end example
  1182. @section asetrate
  1183. Set the sample rate without altering the PCM data.
  1184. This will result in a change of speed and pitch.
  1185. The filter accepts the following options:
  1186. @table @option
  1187. @item sample_rate, r
  1188. Set the output sample rate. Default is 44100 Hz.
  1189. @end table
  1190. @section ashowinfo
  1191. Show a line containing various information for each input audio frame.
  1192. The input audio is not modified.
  1193. The shown line contains a sequence of key/value pairs of the form
  1194. @var{key}:@var{value}.
  1195. The following values are shown in the output:
  1196. @table @option
  1197. @item n
  1198. The (sequential) number of the input frame, starting from 0.
  1199. @item pts
  1200. The presentation timestamp of the input frame, in time base units; the time base
  1201. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1202. @item pts_time
  1203. The presentation timestamp of the input frame in seconds.
  1204. @item pos
  1205. position of the frame in the input stream, -1 if this information in
  1206. unavailable and/or meaningless (for example in case of synthetic audio)
  1207. @item fmt
  1208. The sample format.
  1209. @item chlayout
  1210. The channel layout.
  1211. @item rate
  1212. The sample rate for the audio frame.
  1213. @item nb_samples
  1214. The number of samples (per channel) in the frame.
  1215. @item checksum
  1216. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1217. audio, the data is treated as if all the planes were concatenated.
  1218. @item plane_checksums
  1219. A list of Adler-32 checksums for each data plane.
  1220. @end table
  1221. @anchor{astats}
  1222. @section astats
  1223. Display time domain statistical information about the audio channels.
  1224. Statistics are calculated and displayed for each audio channel and,
  1225. where applicable, an overall figure is also given.
  1226. It accepts the following option:
  1227. @table @option
  1228. @item length
  1229. Short window length in seconds, used for peak and trough RMS measurement.
  1230. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  1231. @item metadata
  1232. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1233. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1234. disabled.
  1235. Available keys for each channel are:
  1236. DC_offset
  1237. Min_level
  1238. Max_level
  1239. Min_difference
  1240. Max_difference
  1241. Mean_difference
  1242. RMS_difference
  1243. Peak_level
  1244. RMS_peak
  1245. RMS_trough
  1246. Crest_factor
  1247. Flat_factor
  1248. Peak_count
  1249. Bit_depth
  1250. and for Overall:
  1251. DC_offset
  1252. Min_level
  1253. Max_level
  1254. Min_difference
  1255. Max_difference
  1256. Mean_difference
  1257. RMS_difference
  1258. Peak_level
  1259. RMS_level
  1260. RMS_peak
  1261. RMS_trough
  1262. Flat_factor
  1263. Peak_count
  1264. Bit_depth
  1265. Number_of_samples
  1266. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1267. this @code{lavfi.astats.Overall.Peak_count}.
  1268. For description what each key means read below.
  1269. @item reset
  1270. Set number of frame after which stats are going to be recalculated.
  1271. Default is disabled.
  1272. @end table
  1273. A description of each shown parameter follows:
  1274. @table @option
  1275. @item DC offset
  1276. Mean amplitude displacement from zero.
  1277. @item Min level
  1278. Minimal sample level.
  1279. @item Max level
  1280. Maximal sample level.
  1281. @item Min difference
  1282. Minimal difference between two consecutive samples.
  1283. @item Max difference
  1284. Maximal difference between two consecutive samples.
  1285. @item Mean difference
  1286. Mean difference between two consecutive samples.
  1287. The average of each difference between two consecutive samples.
  1288. @item RMS difference
  1289. Root Mean Square difference between two consecutive samples.
  1290. @item Peak level dB
  1291. @item RMS level dB
  1292. Standard peak and RMS level measured in dBFS.
  1293. @item RMS peak dB
  1294. @item RMS trough dB
  1295. Peak and trough values for RMS level measured over a short window.
  1296. @item Crest factor
  1297. Standard ratio of peak to RMS level (note: not in dB).
  1298. @item Flat factor
  1299. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1300. (i.e. either @var{Min level} or @var{Max level}).
  1301. @item Peak count
  1302. Number of occasions (not the number of samples) that the signal attained either
  1303. @var{Min level} or @var{Max level}.
  1304. @item Bit depth
  1305. Overall bit depth of audio. Number of bits used for each sample.
  1306. @end table
  1307. @section atempo
  1308. Adjust audio tempo.
  1309. The filter accepts exactly one parameter, the audio tempo. If not
  1310. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1311. be in the [0.5, 2.0] range.
  1312. @subsection Examples
  1313. @itemize
  1314. @item
  1315. Slow down audio to 80% tempo:
  1316. @example
  1317. atempo=0.8
  1318. @end example
  1319. @item
  1320. To speed up audio to 125% tempo:
  1321. @example
  1322. atempo=1.25
  1323. @end example
  1324. @end itemize
  1325. @section atrim
  1326. Trim the input so that the output contains one continuous subpart of the input.
  1327. It accepts the following parameters:
  1328. @table @option
  1329. @item start
  1330. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1331. sample with the timestamp @var{start} will be the first sample in the output.
  1332. @item end
  1333. Specify time of the first audio sample that will be dropped, i.e. the
  1334. audio sample immediately preceding the one with the timestamp @var{end} will be
  1335. the last sample in the output.
  1336. @item start_pts
  1337. Same as @var{start}, except this option sets the start timestamp in samples
  1338. instead of seconds.
  1339. @item end_pts
  1340. Same as @var{end}, except this option sets the end timestamp in samples instead
  1341. of seconds.
  1342. @item duration
  1343. The maximum duration of the output in seconds.
  1344. @item start_sample
  1345. The number of the first sample that should be output.
  1346. @item end_sample
  1347. The number of the first sample that should be dropped.
  1348. @end table
  1349. @option{start}, @option{end}, and @option{duration} are expressed as time
  1350. duration specifications; see
  1351. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1352. Note that the first two sets of the start/end options and the @option{duration}
  1353. option look at the frame timestamp, while the _sample options simply count the
  1354. samples that pass through the filter. So start/end_pts and start/end_sample will
  1355. give different results when the timestamps are wrong, inexact or do not start at
  1356. zero. Also note that this filter does not modify the timestamps. If you wish
  1357. to have the output timestamps start at zero, insert the asetpts filter after the
  1358. atrim filter.
  1359. If multiple start or end options are set, this filter tries to be greedy and
  1360. keep all samples that match at least one of the specified constraints. To keep
  1361. only the part that matches all the constraints at once, chain multiple atrim
  1362. filters.
  1363. The defaults are such that all the input is kept. So it is possible to set e.g.
  1364. just the end values to keep everything before the specified time.
  1365. Examples:
  1366. @itemize
  1367. @item
  1368. Drop everything except the second minute of input:
  1369. @example
  1370. ffmpeg -i INPUT -af atrim=60:120
  1371. @end example
  1372. @item
  1373. Keep only the first 1000 samples:
  1374. @example
  1375. ffmpeg -i INPUT -af atrim=end_sample=1000
  1376. @end example
  1377. @end itemize
  1378. @section bandpass
  1379. Apply a two-pole Butterworth band-pass filter with central
  1380. frequency @var{frequency}, and (3dB-point) band-width width.
  1381. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1382. instead of the default: constant 0dB peak gain.
  1383. The filter roll off at 6dB per octave (20dB per decade).
  1384. The filter accepts the following options:
  1385. @table @option
  1386. @item frequency, f
  1387. Set the filter's central frequency. Default is @code{3000}.
  1388. @item csg
  1389. Constant skirt gain if set to 1. Defaults to 0.
  1390. @item width_type
  1391. Set method to specify band-width of filter.
  1392. @table @option
  1393. @item h
  1394. Hz
  1395. @item q
  1396. Q-Factor
  1397. @item o
  1398. octave
  1399. @item s
  1400. slope
  1401. @end table
  1402. @item width, w
  1403. Specify the band-width of a filter in width_type units.
  1404. @item channels, c
  1405. Specify which channels to filter, by default all available are filtered.
  1406. @end table
  1407. @section bandreject
  1408. Apply a two-pole Butterworth band-reject filter with central
  1409. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1410. The filter roll off at 6dB per octave (20dB per decade).
  1411. The filter accepts the following options:
  1412. @table @option
  1413. @item frequency, f
  1414. Set the filter's central frequency. Default is @code{3000}.
  1415. @item width_type
  1416. Set method to specify band-width of filter.
  1417. @table @option
  1418. @item h
  1419. Hz
  1420. @item q
  1421. Q-Factor
  1422. @item o
  1423. octave
  1424. @item s
  1425. slope
  1426. @end table
  1427. @item width, w
  1428. Specify the band-width of a filter in width_type units.
  1429. @item channels, c
  1430. Specify which channels to filter, by default all available are filtered.
  1431. @end table
  1432. @section bass
  1433. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1434. shelving filter with a response similar to that of a standard
  1435. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1436. The filter accepts the following options:
  1437. @table @option
  1438. @item gain, g
  1439. Give the gain at 0 Hz. Its useful range is about -20
  1440. (for a large cut) to +20 (for a large boost).
  1441. Beware of clipping when using a positive gain.
  1442. @item frequency, f
  1443. Set the filter's central frequency and so can be used
  1444. to extend or reduce the frequency range to be boosted or cut.
  1445. The default value is @code{100} Hz.
  1446. @item width_type
  1447. Set method to specify band-width of filter.
  1448. @table @option
  1449. @item h
  1450. Hz
  1451. @item q
  1452. Q-Factor
  1453. @item o
  1454. octave
  1455. @item s
  1456. slope
  1457. @end table
  1458. @item width, w
  1459. Determine how steep is the filter's shelf transition.
  1460. @item channels, c
  1461. Specify which channels to filter, by default all available are filtered.
  1462. @end table
  1463. @section biquad
  1464. Apply a biquad IIR filter with the given coefficients.
  1465. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1466. are the numerator and denominator coefficients respectively.
  1467. and @var{channels}, @var{c} specify which channels to filter, by default all
  1468. available are filtered.
  1469. @section bs2b
  1470. Bauer stereo to binaural transformation, which improves headphone listening of
  1471. stereo audio records.
  1472. To enable compilation of this filter you need to configure FFmpeg with
  1473. @code{--enable-libbs2b}.
  1474. It accepts the following parameters:
  1475. @table @option
  1476. @item profile
  1477. Pre-defined crossfeed level.
  1478. @table @option
  1479. @item default
  1480. Default level (fcut=700, feed=50).
  1481. @item cmoy
  1482. Chu Moy circuit (fcut=700, feed=60).
  1483. @item jmeier
  1484. Jan Meier circuit (fcut=650, feed=95).
  1485. @end table
  1486. @item fcut
  1487. Cut frequency (in Hz).
  1488. @item feed
  1489. Feed level (in Hz).
  1490. @end table
  1491. @section channelmap
  1492. Remap input channels to new locations.
  1493. It accepts the following parameters:
  1494. @table @option
  1495. @item map
  1496. Map channels from input to output. The argument is a '|'-separated list of
  1497. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1498. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1499. channel (e.g. FL for front left) or its index in the input channel layout.
  1500. @var{out_channel} is the name of the output channel or its index in the output
  1501. channel layout. If @var{out_channel} is not given then it is implicitly an
  1502. index, starting with zero and increasing by one for each mapping.
  1503. @item channel_layout
  1504. The channel layout of the output stream.
  1505. @end table
  1506. If no mapping is present, the filter will implicitly map input channels to
  1507. output channels, preserving indices.
  1508. For example, assuming a 5.1+downmix input MOV file,
  1509. @example
  1510. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1511. @end example
  1512. will create an output WAV file tagged as stereo from the downmix channels of
  1513. the input.
  1514. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1515. @example
  1516. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1517. @end example
  1518. @section channelsplit
  1519. Split each channel from an input audio stream into a separate output stream.
  1520. It accepts the following parameters:
  1521. @table @option
  1522. @item channel_layout
  1523. The channel layout of the input stream. The default is "stereo".
  1524. @end table
  1525. For example, assuming a stereo input MP3 file,
  1526. @example
  1527. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1528. @end example
  1529. will create an output Matroska file with two audio streams, one containing only
  1530. the left channel and the other the right channel.
  1531. Split a 5.1 WAV file into per-channel files:
  1532. @example
  1533. ffmpeg -i in.wav -filter_complex
  1534. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1535. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1536. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1537. side_right.wav
  1538. @end example
  1539. @section chorus
  1540. Add a chorus effect to the audio.
  1541. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1542. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1543. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1544. The modulation depth defines the range the modulated delay is played before or after
  1545. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1546. sound tuned around the original one, like in a chorus where some vocals are slightly
  1547. off key.
  1548. It accepts the following parameters:
  1549. @table @option
  1550. @item in_gain
  1551. Set input gain. Default is 0.4.
  1552. @item out_gain
  1553. Set output gain. Default is 0.4.
  1554. @item delays
  1555. Set delays. A typical delay is around 40ms to 60ms.
  1556. @item decays
  1557. Set decays.
  1558. @item speeds
  1559. Set speeds.
  1560. @item depths
  1561. Set depths.
  1562. @end table
  1563. @subsection Examples
  1564. @itemize
  1565. @item
  1566. A single delay:
  1567. @example
  1568. chorus=0.7:0.9:55:0.4:0.25:2
  1569. @end example
  1570. @item
  1571. Two delays:
  1572. @example
  1573. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1574. @end example
  1575. @item
  1576. Fuller sounding chorus with three delays:
  1577. @example
  1578. 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
  1579. @end example
  1580. @end itemize
  1581. @section compand
  1582. Compress or expand the audio's dynamic range.
  1583. It accepts the following parameters:
  1584. @table @option
  1585. @item attacks
  1586. @item decays
  1587. A list of times in seconds for each channel over which the instantaneous level
  1588. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1589. increase of volume and @var{decays} refers to decrease of volume. For most
  1590. situations, the attack time (response to the audio getting louder) should be
  1591. shorter than the decay time, because the human ear is more sensitive to sudden
  1592. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1593. a typical value for decay is 0.8 seconds.
  1594. If specified number of attacks & decays is lower than number of channels, the last
  1595. set attack/decay will be used for all remaining channels.
  1596. @item points
  1597. A list of points for the transfer function, specified in dB relative to the
  1598. maximum possible signal amplitude. Each key points list must be defined using
  1599. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1600. @code{x0/y0 x1/y1 x2/y2 ....}
  1601. The input values must be in strictly increasing order but the transfer function
  1602. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1603. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1604. function are @code{-70/-70|-60/-20|1/0}.
  1605. @item soft-knee
  1606. Set the curve radius in dB for all joints. It defaults to 0.01.
  1607. @item gain
  1608. Set the additional gain in dB to be applied at all points on the transfer
  1609. function. This allows for easy adjustment of the overall gain.
  1610. It defaults to 0.
  1611. @item volume
  1612. Set an initial volume, in dB, to be assumed for each channel when filtering
  1613. starts. This permits the user to supply a nominal level initially, so that, for
  1614. example, a very large gain is not applied to initial signal levels before the
  1615. companding has begun to operate. A typical value for audio which is initially
  1616. quiet is -90 dB. It defaults to 0.
  1617. @item delay
  1618. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1619. delayed before being fed to the volume adjuster. Specifying a delay
  1620. approximately equal to the attack/decay times allows the filter to effectively
  1621. operate in predictive rather than reactive mode. It defaults to 0.
  1622. @end table
  1623. @subsection Examples
  1624. @itemize
  1625. @item
  1626. Make music with both quiet and loud passages suitable for listening to in a
  1627. noisy environment:
  1628. @example
  1629. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1630. @end example
  1631. Another example for audio with whisper and explosion parts:
  1632. @example
  1633. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1634. @end example
  1635. @item
  1636. A noise gate for when the noise is at a lower level than the signal:
  1637. @example
  1638. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1639. @end example
  1640. @item
  1641. Here is another noise gate, this time for when the noise is at a higher level
  1642. than the signal (making it, in some ways, similar to squelch):
  1643. @example
  1644. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1645. @end example
  1646. @item
  1647. 2:1 compression starting at -6dB:
  1648. @example
  1649. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1650. @end example
  1651. @item
  1652. 2:1 compression starting at -9dB:
  1653. @example
  1654. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1655. @end example
  1656. @item
  1657. 2:1 compression starting at -12dB:
  1658. @example
  1659. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1660. @end example
  1661. @item
  1662. 2:1 compression starting at -18dB:
  1663. @example
  1664. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1665. @end example
  1666. @item
  1667. 3:1 compression starting at -15dB:
  1668. @example
  1669. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1670. @end example
  1671. @item
  1672. Compressor/Gate:
  1673. @example
  1674. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1675. @end example
  1676. @item
  1677. Expander:
  1678. @example
  1679. 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
  1680. @end example
  1681. @item
  1682. Hard limiter at -6dB:
  1683. @example
  1684. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1685. @end example
  1686. @item
  1687. Hard limiter at -12dB:
  1688. @example
  1689. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1690. @end example
  1691. @item
  1692. Hard noise gate at -35 dB:
  1693. @example
  1694. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1695. @end example
  1696. @item
  1697. Soft limiter:
  1698. @example
  1699. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1700. @end example
  1701. @end itemize
  1702. @section compensationdelay
  1703. Compensation Delay Line is a metric based delay to compensate differing
  1704. positions of microphones or speakers.
  1705. For example, you have recorded guitar with two microphones placed in
  1706. different location. Because the front of sound wave has fixed speed in
  1707. normal conditions, the phasing of microphones can vary and depends on
  1708. their location and interposition. The best sound mix can be achieved when
  1709. these microphones are in phase (synchronized). Note that distance of
  1710. ~30 cm between microphones makes one microphone to capture signal in
  1711. antiphase to another microphone. That makes the final mix sounding moody.
  1712. This filter helps to solve phasing problems by adding different delays
  1713. to each microphone track and make them synchronized.
  1714. The best result can be reached when you take one track as base and
  1715. synchronize other tracks one by one with it.
  1716. Remember that synchronization/delay tolerance depends on sample rate, too.
  1717. Higher sample rates will give more tolerance.
  1718. It accepts the following parameters:
  1719. @table @option
  1720. @item mm
  1721. Set millimeters distance. This is compensation distance for fine tuning.
  1722. Default is 0.
  1723. @item cm
  1724. Set cm distance. This is compensation distance for tightening distance setup.
  1725. Default is 0.
  1726. @item m
  1727. Set meters distance. This is compensation distance for hard distance setup.
  1728. Default is 0.
  1729. @item dry
  1730. Set dry amount. Amount of unprocessed (dry) signal.
  1731. Default is 0.
  1732. @item wet
  1733. Set wet amount. Amount of processed (wet) signal.
  1734. Default is 1.
  1735. @item temp
  1736. Set temperature degree in Celsius. This is the temperature of the environment.
  1737. Default is 20.
  1738. @end table
  1739. @section crossfeed
  1740. Apply headphone crossfeed filter.
  1741. Crossfeed is the process of blending the left and right channels of stereo
  1742. audio recording.
  1743. It is mainly used to reduce extreme stereo separation of low frequencies.
  1744. The intent is to produce more speaker like sound to the listener.
  1745. The filter accepts the following options:
  1746. @table @option
  1747. @item strength
  1748. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  1749. This sets gain of low shelf filter for side part of stereo image.
  1750. Default is -6dB. Max allowed is -30db when strength is set to 1.
  1751. @item range
  1752. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  1753. This sets cut off frequency of low shelf filter. Default is cut off near
  1754. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  1755. @item level_in
  1756. Set input gain. Default is 0.9.
  1757. @item level_out
  1758. Set output gain. Default is 1.
  1759. @end table
  1760. @section crystalizer
  1761. Simple algorithm to expand audio dynamic range.
  1762. The filter accepts the following options:
  1763. @table @option
  1764. @item i
  1765. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  1766. (unchanged sound) to 10.0 (maximum effect).
  1767. @item c
  1768. Enable clipping. By default is enabled.
  1769. @end table
  1770. @section dcshift
  1771. Apply a DC shift to the audio.
  1772. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1773. in the recording chain) from the audio. The effect of a DC offset is reduced
  1774. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1775. a signal has a DC offset.
  1776. @table @option
  1777. @item shift
  1778. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1779. the audio.
  1780. @item limitergain
  1781. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1782. used to prevent clipping.
  1783. @end table
  1784. @section dynaudnorm
  1785. Dynamic Audio Normalizer.
  1786. This filter applies a certain amount of gain to the input audio in order
  1787. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1788. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1789. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1790. This allows for applying extra gain to the "quiet" sections of the audio
  1791. while avoiding distortions or clipping the "loud" sections. In other words:
  1792. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1793. sections, in the sense that the volume of each section is brought to the
  1794. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1795. this goal *without* applying "dynamic range compressing". It will retain 100%
  1796. of the dynamic range *within* each section of the audio file.
  1797. @table @option
  1798. @item f
  1799. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1800. Default is 500 milliseconds.
  1801. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1802. referred to as frames. This is required, because a peak magnitude has no
  1803. meaning for just a single sample value. Instead, we need to determine the
  1804. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1805. normalizer would simply use the peak magnitude of the complete file, the
  1806. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1807. frame. The length of a frame is specified in milliseconds. By default, the
  1808. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1809. been found to give good results with most files.
  1810. Note that the exact frame length, in number of samples, will be determined
  1811. automatically, based on the sampling rate of the individual input audio file.
  1812. @item g
  1813. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1814. number. Default is 31.
  1815. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1816. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1817. is specified in frames, centered around the current frame. For the sake of
  1818. simplicity, this must be an odd number. Consequently, the default value of 31
  1819. takes into account the current frame, as well as the 15 preceding frames and
  1820. the 15 subsequent frames. Using a larger window results in a stronger
  1821. smoothing effect and thus in less gain variation, i.e. slower gain
  1822. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1823. effect and thus in more gain variation, i.e. faster gain adaptation.
  1824. In other words, the more you increase this value, the more the Dynamic Audio
  1825. Normalizer will behave like a "traditional" normalization filter. On the
  1826. contrary, the more you decrease this value, the more the Dynamic Audio
  1827. Normalizer will behave like a dynamic range compressor.
  1828. @item p
  1829. Set the target peak value. This specifies the highest permissible magnitude
  1830. level for the normalized audio input. This filter will try to approach the
  1831. target peak magnitude as closely as possible, but at the same time it also
  1832. makes sure that the normalized signal will never exceed the peak magnitude.
  1833. A frame's maximum local gain factor is imposed directly by the target peak
  1834. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1835. It is not recommended to go above this value.
  1836. @item m
  1837. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1838. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1839. factor for each input frame, i.e. the maximum gain factor that does not
  1840. result in clipping or distortion. The maximum gain factor is determined by
  1841. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1842. additionally bounds the frame's maximum gain factor by a predetermined
  1843. (global) maximum gain factor. This is done in order to avoid excessive gain
  1844. factors in "silent" or almost silent frames. By default, the maximum gain
  1845. factor is 10.0, For most inputs the default value should be sufficient and
  1846. it usually is not recommended to increase this value. Though, for input
  1847. with an extremely low overall volume level, it may be necessary to allow even
  1848. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1849. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1850. Instead, a "sigmoid" threshold function will be applied. This way, the
  1851. gain factors will smoothly approach the threshold value, but never exceed that
  1852. value.
  1853. @item r
  1854. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1855. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1856. This means that the maximum local gain factor for each frame is defined
  1857. (only) by the frame's highest magnitude sample. This way, the samples can
  1858. be amplified as much as possible without exceeding the maximum signal
  1859. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1860. Normalizer can also take into account the frame's root mean square,
  1861. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1862. determine the power of a time-varying signal. It is therefore considered
  1863. that the RMS is a better approximation of the "perceived loudness" than
  1864. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1865. frames to a constant RMS value, a uniform "perceived loudness" can be
  1866. established. If a target RMS value has been specified, a frame's local gain
  1867. factor is defined as the factor that would result in exactly that RMS value.
  1868. Note, however, that the maximum local gain factor is still restricted by the
  1869. frame's highest magnitude sample, in order to prevent clipping.
  1870. @item n
  1871. Enable channels coupling. By default is enabled.
  1872. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1873. amount. This means the same gain factor will be applied to all channels, i.e.
  1874. the maximum possible gain factor is determined by the "loudest" channel.
  1875. However, in some recordings, it may happen that the volume of the different
  1876. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1877. In this case, this option can be used to disable the channel coupling. This way,
  1878. the gain factor will be determined independently for each channel, depending
  1879. only on the individual channel's highest magnitude sample. This allows for
  1880. harmonizing the volume of the different channels.
  1881. @item c
  1882. Enable DC bias correction. By default is disabled.
  1883. An audio signal (in the time domain) is a sequence of sample values.
  1884. In the Dynamic Audio Normalizer these sample values are represented in the
  1885. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1886. audio signal, or "waveform", should be centered around the zero point.
  1887. That means if we calculate the mean value of all samples in a file, or in a
  1888. single frame, then the result should be 0.0 or at least very close to that
  1889. value. If, however, there is a significant deviation of the mean value from
  1890. 0.0, in either positive or negative direction, this is referred to as a
  1891. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1892. Audio Normalizer provides optional DC bias correction.
  1893. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1894. the mean value, or "DC correction" offset, of each input frame and subtract
  1895. that value from all of the frame's sample values which ensures those samples
  1896. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1897. boundaries, the DC correction offset values will be interpolated smoothly
  1898. between neighbouring frames.
  1899. @item b
  1900. Enable alternative boundary mode. By default is disabled.
  1901. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1902. around each frame. This includes the preceding frames as well as the
  1903. subsequent frames. However, for the "boundary" frames, located at the very
  1904. beginning and at the very end of the audio file, not all neighbouring
  1905. frames are available. In particular, for the first few frames in the audio
  1906. file, the preceding frames are not known. And, similarly, for the last few
  1907. frames in the audio file, the subsequent frames are not known. Thus, the
  1908. question arises which gain factors should be assumed for the missing frames
  1909. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1910. to deal with this situation. The default boundary mode assumes a gain factor
  1911. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1912. "fade out" at the beginning and at the end of the input, respectively.
  1913. @item s
  1914. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1915. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1916. compression. This means that signal peaks will not be pruned and thus the
  1917. full dynamic range will be retained within each local neighbourhood. However,
  1918. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1919. normalization algorithm with a more "traditional" compression.
  1920. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1921. (thresholding) function. If (and only if) the compression feature is enabled,
  1922. all input frames will be processed by a soft knee thresholding function prior
  1923. to the actual normalization process. Put simply, the thresholding function is
  1924. going to prune all samples whose magnitude exceeds a certain threshold value.
  1925. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1926. value. Instead, the threshold value will be adjusted for each individual
  1927. frame.
  1928. In general, smaller parameters result in stronger compression, and vice versa.
  1929. Values below 3.0 are not recommended, because audible distortion may appear.
  1930. @end table
  1931. @section earwax
  1932. Make audio easier to listen to on headphones.
  1933. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1934. so that when listened to on headphones the stereo image is moved from
  1935. inside your head (standard for headphones) to outside and in front of
  1936. the listener (standard for speakers).
  1937. Ported from SoX.
  1938. @section equalizer
  1939. Apply a two-pole peaking equalisation (EQ) filter. With this
  1940. filter, the signal-level at and around a selected frequency can
  1941. be increased or decreased, whilst (unlike bandpass and bandreject
  1942. filters) that at all other frequencies is unchanged.
  1943. In order to produce complex equalisation curves, this filter can
  1944. be given several times, each with a different central frequency.
  1945. The filter accepts the following options:
  1946. @table @option
  1947. @item frequency, f
  1948. Set the filter's central frequency in Hz.
  1949. @item width_type
  1950. Set method to specify band-width of filter.
  1951. @table @option
  1952. @item h
  1953. Hz
  1954. @item q
  1955. Q-Factor
  1956. @item o
  1957. octave
  1958. @item s
  1959. slope
  1960. @end table
  1961. @item width, w
  1962. Specify the band-width of a filter in width_type units.
  1963. @item gain, g
  1964. Set the required gain or attenuation in dB.
  1965. Beware of clipping when using a positive gain.
  1966. @item channels, c
  1967. Specify which channels to filter, by default all available are filtered.
  1968. @end table
  1969. @subsection Examples
  1970. @itemize
  1971. @item
  1972. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  1973. @example
  1974. equalizer=f=1000:width_type=h:width=200:g=-10
  1975. @end example
  1976. @item
  1977. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  1978. @example
  1979. equalizer=f=1000:width_type=q:width=1:g=2,equalizer=f=100:width_type=q:width=2:g=-5
  1980. @end example
  1981. @end itemize
  1982. @section extrastereo
  1983. Linearly increases the difference between left and right channels which
  1984. adds some sort of "live" effect to playback.
  1985. The filter accepts the following options:
  1986. @table @option
  1987. @item m
  1988. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  1989. (average of both channels), with 1.0 sound will be unchanged, with
  1990. -1.0 left and right channels will be swapped.
  1991. @item c
  1992. Enable clipping. By default is enabled.
  1993. @end table
  1994. @section firequalizer
  1995. Apply FIR Equalization using arbitrary frequency response.
  1996. The filter accepts the following option:
  1997. @table @option
  1998. @item gain
  1999. Set gain curve equation (in dB). The expression can contain variables:
  2000. @table @option
  2001. @item f
  2002. the evaluated frequency
  2003. @item sr
  2004. sample rate
  2005. @item ch
  2006. channel number, set to 0 when multichannels evaluation is disabled
  2007. @item chid
  2008. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2009. multichannels evaluation is disabled
  2010. @item chs
  2011. number of channels
  2012. @item chlayout
  2013. channel_layout, see libavutil/channel_layout.h
  2014. @end table
  2015. and functions:
  2016. @table @option
  2017. @item gain_interpolate(f)
  2018. interpolate gain on frequency f based on gain_entry
  2019. @item cubic_interpolate(f)
  2020. same as gain_interpolate, but smoother
  2021. @end table
  2022. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2023. @item gain_entry
  2024. Set gain entry for gain_interpolate function. The expression can
  2025. contain functions:
  2026. @table @option
  2027. @item entry(f, g)
  2028. store gain entry at frequency f with value g
  2029. @end table
  2030. This option is also available as command.
  2031. @item delay
  2032. Set filter delay in seconds. Higher value means more accurate.
  2033. Default is @code{0.01}.
  2034. @item accuracy
  2035. Set filter accuracy in Hz. Lower value means more accurate.
  2036. Default is @code{5}.
  2037. @item wfunc
  2038. Set window function. Acceptable values are:
  2039. @table @option
  2040. @item rectangular
  2041. rectangular window, useful when gain curve is already smooth
  2042. @item hann
  2043. hann window (default)
  2044. @item hamming
  2045. hamming window
  2046. @item blackman
  2047. blackman window
  2048. @item nuttall3
  2049. 3-terms continuous 1st derivative nuttall window
  2050. @item mnuttall3
  2051. minimum 3-terms discontinuous nuttall window
  2052. @item nuttall
  2053. 4-terms continuous 1st derivative nuttall window
  2054. @item bnuttall
  2055. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2056. @item bharris
  2057. blackman-harris window
  2058. @item tukey
  2059. tukey window
  2060. @end table
  2061. @item fixed
  2062. If enabled, use fixed number of audio samples. This improves speed when
  2063. filtering with large delay. Default is disabled.
  2064. @item multi
  2065. Enable multichannels evaluation on gain. Default is disabled.
  2066. @item zero_phase
  2067. Enable zero phase mode by subtracting timestamp to compensate delay.
  2068. Default is disabled.
  2069. @item scale
  2070. Set scale used by gain. Acceptable values are:
  2071. @table @option
  2072. @item linlin
  2073. linear frequency, linear gain
  2074. @item linlog
  2075. linear frequency, logarithmic (in dB) gain (default)
  2076. @item loglin
  2077. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2078. @item loglog
  2079. logarithmic frequency, logarithmic gain
  2080. @end table
  2081. @item dumpfile
  2082. Set file for dumping, suitable for gnuplot.
  2083. @item dumpscale
  2084. Set scale for dumpfile. Acceptable values are same with scale option.
  2085. Default is linlog.
  2086. @item fft2
  2087. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2088. Default is disabled.
  2089. @end table
  2090. @subsection Examples
  2091. @itemize
  2092. @item
  2093. lowpass at 1000 Hz:
  2094. @example
  2095. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2096. @end example
  2097. @item
  2098. lowpass at 1000 Hz with gain_entry:
  2099. @example
  2100. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2101. @end example
  2102. @item
  2103. custom equalization:
  2104. @example
  2105. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2106. @end example
  2107. @item
  2108. higher delay with zero phase to compensate delay:
  2109. @example
  2110. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2111. @end example
  2112. @item
  2113. lowpass on left channel, highpass on right channel:
  2114. @example
  2115. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2116. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2117. @end example
  2118. @end itemize
  2119. @section flanger
  2120. Apply a flanging effect to the audio.
  2121. The filter accepts the following options:
  2122. @table @option
  2123. @item delay
  2124. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2125. @item depth
  2126. Set added swep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2127. @item regen
  2128. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2129. Default value is 0.
  2130. @item width
  2131. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2132. Default value is 71.
  2133. @item speed
  2134. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2135. @item shape
  2136. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2137. Default value is @var{sinusoidal}.
  2138. @item phase
  2139. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2140. Default value is 25.
  2141. @item interp
  2142. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2143. Default is @var{linear}.
  2144. @end table
  2145. @section hdcd
  2146. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2147. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2148. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2149. of HDCD, and detects the Transient Filter flag.
  2150. @example
  2151. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2152. @end example
  2153. When using the filter with wav, note the default encoding for wav is 16-bit,
  2154. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2155. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2156. @example
  2157. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2158. ffmpeg -i HDCD16.wav -af hdcd -acodec pcm_s24le OUT24.wav
  2159. @end example
  2160. The filter accepts the following options:
  2161. @table @option
  2162. @item disable_autoconvert
  2163. Disable any automatic format conversion or resampling in the filter graph.
  2164. @item process_stereo
  2165. Process the stereo channels together. If target_gain does not match between
  2166. channels, consider it invalid and use the last valid target_gain.
  2167. @item cdt_ms
  2168. Set the code detect timer period in ms.
  2169. @item force_pe
  2170. Always extend peaks above -3dBFS even if PE isn't signaled.
  2171. @item analyze_mode
  2172. Replace audio with a solid tone and adjust the amplitude to signal some
  2173. specific aspect of the decoding process. The output file can be loaded in
  2174. an audio editor alongside the original to aid analysis.
  2175. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2176. Modes are:
  2177. @table @samp
  2178. @item 0, off
  2179. Disabled
  2180. @item 1, lle
  2181. Gain adjustment level at each sample
  2182. @item 2, pe
  2183. Samples where peak extend occurs
  2184. @item 3, cdt
  2185. Samples where the code detect timer is active
  2186. @item 4, tgm
  2187. Samples where the target gain does not match between channels
  2188. @end table
  2189. @end table
  2190. @section highpass
  2191. Apply a high-pass filter with 3dB point frequency.
  2192. The filter can be either single-pole, or double-pole (the default).
  2193. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2194. The filter accepts the following options:
  2195. @table @option
  2196. @item frequency, f
  2197. Set frequency in Hz. Default is 3000.
  2198. @item poles, p
  2199. Set number of poles. Default is 2.
  2200. @item width_type
  2201. Set method to specify band-width of filter.
  2202. @table @option
  2203. @item h
  2204. Hz
  2205. @item q
  2206. Q-Factor
  2207. @item o
  2208. octave
  2209. @item s
  2210. slope
  2211. @end table
  2212. @item width, w
  2213. Specify the band-width of a filter in width_type units.
  2214. Applies only to double-pole filter.
  2215. The default is 0.707q and gives a Butterworth response.
  2216. @item channels, c
  2217. Specify which channels to filter, by default all available are filtered.
  2218. @end table
  2219. @section join
  2220. Join multiple input streams into one multi-channel stream.
  2221. It accepts the following parameters:
  2222. @table @option
  2223. @item inputs
  2224. The number of input streams. It defaults to 2.
  2225. @item channel_layout
  2226. The desired output channel layout. It defaults to stereo.
  2227. @item map
  2228. Map channels from inputs to output. The argument is a '|'-separated list of
  2229. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2230. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2231. can be either the name of the input channel (e.g. FL for front left) or its
  2232. index in the specified input stream. @var{out_channel} is the name of the output
  2233. channel.
  2234. @end table
  2235. The filter will attempt to guess the mappings when they are not specified
  2236. explicitly. It does so by first trying to find an unused matching input channel
  2237. and if that fails it picks the first unused input channel.
  2238. Join 3 inputs (with properly set channel layouts):
  2239. @example
  2240. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2241. @end example
  2242. Build a 5.1 output from 6 single-channel streams:
  2243. @example
  2244. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2245. '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'
  2246. out
  2247. @end example
  2248. @section ladspa
  2249. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2250. To enable compilation of this filter you need to configure FFmpeg with
  2251. @code{--enable-ladspa}.
  2252. @table @option
  2253. @item file, f
  2254. Specifies the name of LADSPA plugin library to load. If the environment
  2255. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2256. each one of the directories specified by the colon separated list in
  2257. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2258. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2259. @file{/usr/lib/ladspa/}.
  2260. @item plugin, p
  2261. Specifies the plugin within the library. Some libraries contain only
  2262. one plugin, but others contain many of them. If this is not set filter
  2263. will list all available plugins within the specified library.
  2264. @item controls, c
  2265. Set the '|' separated list of controls which are zero or more floating point
  2266. values that determine the behavior of the loaded plugin (for example delay,
  2267. threshold or gain).
  2268. Controls need to be defined using the following syntax:
  2269. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2270. @var{valuei} is the value set on the @var{i}-th control.
  2271. Alternatively they can be also defined using the following syntax:
  2272. @var{value0}|@var{value1}|@var{value2}|..., where
  2273. @var{valuei} is the value set on the @var{i}-th control.
  2274. If @option{controls} is set to @code{help}, all available controls and
  2275. their valid ranges are printed.
  2276. @item sample_rate, s
  2277. Specify the sample rate, default to 44100. Only used if plugin have
  2278. zero inputs.
  2279. @item nb_samples, n
  2280. Set the number of samples per channel per each output frame, default
  2281. is 1024. Only used if plugin have zero inputs.
  2282. @item duration, d
  2283. Set the minimum duration of the sourced audio. See
  2284. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2285. for the accepted syntax.
  2286. Note that the resulting duration may be greater than the specified duration,
  2287. as the generated audio is always cut at the end of a complete frame.
  2288. If not specified, or the expressed duration is negative, the audio is
  2289. supposed to be generated forever.
  2290. Only used if plugin have zero inputs.
  2291. @end table
  2292. @subsection Examples
  2293. @itemize
  2294. @item
  2295. List all available plugins within amp (LADSPA example plugin) library:
  2296. @example
  2297. ladspa=file=amp
  2298. @end example
  2299. @item
  2300. List all available controls and their valid ranges for @code{vcf_notch}
  2301. plugin from @code{VCF} library:
  2302. @example
  2303. ladspa=f=vcf:p=vcf_notch:c=help
  2304. @end example
  2305. @item
  2306. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2307. plugin library:
  2308. @example
  2309. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2310. @end example
  2311. @item
  2312. Add reverberation to the audio using TAP-plugins
  2313. (Tom's Audio Processing plugins):
  2314. @example
  2315. ladspa=file=tap_reverb:tap_reverb
  2316. @end example
  2317. @item
  2318. Generate white noise, with 0.2 amplitude:
  2319. @example
  2320. ladspa=file=cmt:noise_source_white:c=c0=.2
  2321. @end example
  2322. @item
  2323. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2324. @code{C* Audio Plugin Suite} (CAPS) library:
  2325. @example
  2326. ladspa=file=caps:Click:c=c1=20'
  2327. @end example
  2328. @item
  2329. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2330. @example
  2331. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2332. @end example
  2333. @item
  2334. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2335. @code{SWH Plugins} collection:
  2336. @example
  2337. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2338. @end example
  2339. @item
  2340. Attenuate low frequencies using Multiband EQ from Steve Harris
  2341. @code{SWH Plugins} collection:
  2342. @example
  2343. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2344. @end example
  2345. @item
  2346. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2347. (CAPS) library:
  2348. @example
  2349. ladspa=caps:Narrower
  2350. @end example
  2351. @item
  2352. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2353. @example
  2354. ladspa=caps:White:.2
  2355. @end example
  2356. @item
  2357. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2358. @example
  2359. ladspa=caps:Fractal:c=c1=1
  2360. @end example
  2361. @item
  2362. Dynamic volume normalization using @code{VLevel} plugin:
  2363. @example
  2364. ladspa=vlevel-ladspa:vlevel_mono
  2365. @end example
  2366. @end itemize
  2367. @subsection Commands
  2368. This filter supports the following commands:
  2369. @table @option
  2370. @item cN
  2371. Modify the @var{N}-th control value.
  2372. If the specified value is not valid, it is ignored and prior one is kept.
  2373. @end table
  2374. @section loudnorm
  2375. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2376. Support for both single pass (livestreams, files) and double pass (files) modes.
  2377. This algorithm can target IL, LRA, and maximum true peak.
  2378. The filter accepts the following options:
  2379. @table @option
  2380. @item I, i
  2381. Set integrated loudness target.
  2382. Range is -70.0 - -5.0. Default value is -24.0.
  2383. @item LRA, lra
  2384. Set loudness range target.
  2385. Range is 1.0 - 20.0. Default value is 7.0.
  2386. @item TP, tp
  2387. Set maximum true peak.
  2388. Range is -9.0 - +0.0. Default value is -2.0.
  2389. @item measured_I, measured_i
  2390. Measured IL of input file.
  2391. Range is -99.0 - +0.0.
  2392. @item measured_LRA, measured_lra
  2393. Measured LRA of input file.
  2394. Range is 0.0 - 99.0.
  2395. @item measured_TP, measured_tp
  2396. Measured true peak of input file.
  2397. Range is -99.0 - +99.0.
  2398. @item measured_thresh
  2399. Measured threshold of input file.
  2400. Range is -99.0 - +0.0.
  2401. @item offset
  2402. Set offset gain. Gain is applied before the true-peak limiter.
  2403. Range is -99.0 - +99.0. Default is +0.0.
  2404. @item linear
  2405. Normalize linearly if possible.
  2406. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2407. to be specified in order to use this mode.
  2408. Options are true or false. Default is true.
  2409. @item dual_mono
  2410. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2411. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2412. If set to @code{true}, this option will compensate for this effect.
  2413. Multi-channel input files are not affected by this option.
  2414. Options are true or false. Default is false.
  2415. @item print_format
  2416. Set print format for stats. Options are summary, json, or none.
  2417. Default value is none.
  2418. @end table
  2419. @section lowpass
  2420. Apply a low-pass filter with 3dB point frequency.
  2421. The filter can be either single-pole or double-pole (the default).
  2422. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2423. The filter accepts the following options:
  2424. @table @option
  2425. @item frequency, f
  2426. Set frequency in Hz. Default is 500.
  2427. @item poles, p
  2428. Set number of poles. Default is 2.
  2429. @item width_type
  2430. Set method to specify band-width of filter.
  2431. @table @option
  2432. @item h
  2433. Hz
  2434. @item q
  2435. Q-Factor
  2436. @item o
  2437. octave
  2438. @item s
  2439. slope
  2440. @end table
  2441. @item width, w
  2442. Specify the band-width of a filter in width_type units.
  2443. Applies only to double-pole filter.
  2444. The default is 0.707q and gives a Butterworth response.
  2445. @item channels, c
  2446. Specify which channels to filter, by default all available are filtered.
  2447. @end table
  2448. @subsection Examples
  2449. @itemize
  2450. @item
  2451. Lowpass only LFE channel, it LFE is not present it does nothing:
  2452. @example
  2453. lowpass=c=LFE
  2454. @end example
  2455. @end itemize
  2456. @anchor{pan}
  2457. @section pan
  2458. Mix channels with specific gain levels. The filter accepts the output
  2459. channel layout followed by a set of channels definitions.
  2460. This filter is also designed to efficiently remap the channels of an audio
  2461. stream.
  2462. The filter accepts parameters of the form:
  2463. "@var{l}|@var{outdef}|@var{outdef}|..."
  2464. @table @option
  2465. @item l
  2466. output channel layout or number of channels
  2467. @item outdef
  2468. output channel specification, of the form:
  2469. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  2470. @item out_name
  2471. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2472. number (c0, c1, etc.)
  2473. @item gain
  2474. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2475. @item in_name
  2476. input channel to use, see out_name for details; it is not possible to mix
  2477. named and numbered input channels
  2478. @end table
  2479. If the `=' in a channel specification is replaced by `<', then the gains for
  2480. that specification will be renormalized so that the total is 1, thus
  2481. avoiding clipping noise.
  2482. @subsection Mixing examples
  2483. For example, if you want to down-mix from stereo to mono, but with a bigger
  2484. factor for the left channel:
  2485. @example
  2486. pan=1c|c0=0.9*c0+0.1*c1
  2487. @end example
  2488. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2489. 7-channels surround:
  2490. @example
  2491. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2492. @end example
  2493. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2494. that should be preferred (see "-ac" option) unless you have very specific
  2495. needs.
  2496. @subsection Remapping examples
  2497. The channel remapping will be effective if, and only if:
  2498. @itemize
  2499. @item gain coefficients are zeroes or ones,
  2500. @item only one input per channel output,
  2501. @end itemize
  2502. If all these conditions are satisfied, the filter will notify the user ("Pure
  2503. channel mapping detected"), and use an optimized and lossless method to do the
  2504. remapping.
  2505. For example, if you have a 5.1 source and want a stereo audio stream by
  2506. dropping the extra channels:
  2507. @example
  2508. pan="stereo| c0=FL | c1=FR"
  2509. @end example
  2510. Given the same source, you can also switch front left and front right channels
  2511. and keep the input channel layout:
  2512. @example
  2513. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2514. @end example
  2515. If the input is a stereo audio stream, you can mute the front left channel (and
  2516. still keep the stereo channel layout) with:
  2517. @example
  2518. pan="stereo|c1=c1"
  2519. @end example
  2520. Still with a stereo audio stream input, you can copy the right channel in both
  2521. front left and right:
  2522. @example
  2523. pan="stereo| c0=FR | c1=FR"
  2524. @end example
  2525. @section replaygain
  2526. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2527. outputs it unchanged.
  2528. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2529. @section resample
  2530. Convert the audio sample format, sample rate and channel layout. It is
  2531. not meant to be used directly.
  2532. @section rubberband
  2533. Apply time-stretching and pitch-shifting with librubberband.
  2534. The filter accepts the following options:
  2535. @table @option
  2536. @item tempo
  2537. Set tempo scale factor.
  2538. @item pitch
  2539. Set pitch scale factor.
  2540. @item transients
  2541. Set transients detector.
  2542. Possible values are:
  2543. @table @var
  2544. @item crisp
  2545. @item mixed
  2546. @item smooth
  2547. @end table
  2548. @item detector
  2549. Set detector.
  2550. Possible values are:
  2551. @table @var
  2552. @item compound
  2553. @item percussive
  2554. @item soft
  2555. @end table
  2556. @item phase
  2557. Set phase.
  2558. Possible values are:
  2559. @table @var
  2560. @item laminar
  2561. @item independent
  2562. @end table
  2563. @item window
  2564. Set processing window size.
  2565. Possible values are:
  2566. @table @var
  2567. @item standard
  2568. @item short
  2569. @item long
  2570. @end table
  2571. @item smoothing
  2572. Set smoothing.
  2573. Possible values are:
  2574. @table @var
  2575. @item off
  2576. @item on
  2577. @end table
  2578. @item formant
  2579. Enable formant preservation when shift pitching.
  2580. Possible values are:
  2581. @table @var
  2582. @item shifted
  2583. @item preserved
  2584. @end table
  2585. @item pitchq
  2586. Set pitch quality.
  2587. Possible values are:
  2588. @table @var
  2589. @item quality
  2590. @item speed
  2591. @item consistency
  2592. @end table
  2593. @item channels
  2594. Set channels.
  2595. Possible values are:
  2596. @table @var
  2597. @item apart
  2598. @item together
  2599. @end table
  2600. @end table
  2601. @section sidechaincompress
  2602. This filter acts like normal compressor but has the ability to compress
  2603. detected signal using second input signal.
  2604. It needs two input streams and returns one output stream.
  2605. First input stream will be processed depending on second stream signal.
  2606. The filtered signal then can be filtered with other filters in later stages of
  2607. processing. See @ref{pan} and @ref{amerge} filter.
  2608. The filter accepts the following options:
  2609. @table @option
  2610. @item level_in
  2611. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2612. @item threshold
  2613. If a signal of second stream raises above this level it will affect the gain
  2614. reduction of first stream.
  2615. By default is 0.125. Range is between 0.00097563 and 1.
  2616. @item ratio
  2617. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2618. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2619. Default is 2. Range is between 1 and 20.
  2620. @item attack
  2621. Amount of milliseconds the signal has to rise above the threshold before gain
  2622. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2623. @item release
  2624. Amount of milliseconds the signal has to fall below the threshold before
  2625. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2626. @item makeup
  2627. Set the amount by how much signal will be amplified after processing.
  2628. Default is 1. Range is from 1 to 64.
  2629. @item knee
  2630. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2631. Default is 2.82843. Range is between 1 and 8.
  2632. @item link
  2633. Choose if the @code{average} level between all channels of side-chain stream
  2634. or the louder(@code{maximum}) channel of side-chain stream affects the
  2635. reduction. Default is @code{average}.
  2636. @item detection
  2637. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2638. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2639. @item level_sc
  2640. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2641. @item mix
  2642. How much to use compressed signal in output. Default is 1.
  2643. Range is between 0 and 1.
  2644. @end table
  2645. @subsection Examples
  2646. @itemize
  2647. @item
  2648. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2649. depending on the signal of 2nd input and later compressed signal to be
  2650. merged with 2nd input:
  2651. @example
  2652. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2653. @end example
  2654. @end itemize
  2655. @section sidechaingate
  2656. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2657. filter the detected signal before sending it to the gain reduction stage.
  2658. Normally a gate uses the full range signal to detect a level above the
  2659. threshold.
  2660. For example: If you cut all lower frequencies from your sidechain signal
  2661. the gate will decrease the volume of your track only if not enough highs
  2662. appear. With this technique you are able to reduce the resonation of a
  2663. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2664. guitar.
  2665. It needs two input streams and returns one output stream.
  2666. First input stream will be processed depending on second stream signal.
  2667. The filter accepts the following options:
  2668. @table @option
  2669. @item level_in
  2670. Set input level before filtering.
  2671. Default is 1. Allowed range is from 0.015625 to 64.
  2672. @item range
  2673. Set the level of gain reduction when the signal is below the threshold.
  2674. Default is 0.06125. Allowed range is from 0 to 1.
  2675. @item threshold
  2676. If a signal rises above this level the gain reduction is released.
  2677. Default is 0.125. Allowed range is from 0 to 1.
  2678. @item ratio
  2679. Set a ratio about which the signal is reduced.
  2680. Default is 2. Allowed range is from 1 to 9000.
  2681. @item attack
  2682. Amount of milliseconds the signal has to rise above the threshold before gain
  2683. reduction stops.
  2684. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2685. @item release
  2686. Amount of milliseconds the signal has to fall below the threshold before the
  2687. reduction is increased again. Default is 250 milliseconds.
  2688. Allowed range is from 0.01 to 9000.
  2689. @item makeup
  2690. Set amount of amplification of signal after processing.
  2691. Default is 1. Allowed range is from 1 to 64.
  2692. @item knee
  2693. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2694. Default is 2.828427125. Allowed range is from 1 to 8.
  2695. @item detection
  2696. Choose if exact signal should be taken for detection or an RMS like one.
  2697. Default is rms. Can be peak or rms.
  2698. @item link
  2699. Choose if the average level between all channels or the louder channel affects
  2700. the reduction.
  2701. Default is average. Can be average or maximum.
  2702. @item level_sc
  2703. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2704. @end table
  2705. @section silencedetect
  2706. Detect silence in an audio stream.
  2707. This filter logs a message when it detects that the input audio volume is less
  2708. or equal to a noise tolerance value for a duration greater or equal to the
  2709. minimum detected noise duration.
  2710. The printed times and duration are expressed in seconds.
  2711. The filter accepts the following options:
  2712. @table @option
  2713. @item duration, d
  2714. Set silence duration until notification (default is 2 seconds).
  2715. @item noise, n
  2716. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2717. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2718. @end table
  2719. @subsection Examples
  2720. @itemize
  2721. @item
  2722. Detect 5 seconds of silence with -50dB noise tolerance:
  2723. @example
  2724. silencedetect=n=-50dB:d=5
  2725. @end example
  2726. @item
  2727. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2728. tolerance in @file{silence.mp3}:
  2729. @example
  2730. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2731. @end example
  2732. @end itemize
  2733. @section silenceremove
  2734. Remove silence from the beginning, middle or end of the audio.
  2735. The filter accepts the following options:
  2736. @table @option
  2737. @item start_periods
  2738. This value is used to indicate if audio should be trimmed at beginning of
  2739. the audio. A value of zero indicates no silence should be trimmed from the
  2740. beginning. When specifying a non-zero value, it trims audio up until it
  2741. finds non-silence. Normally, when trimming silence from beginning of audio
  2742. the @var{start_periods} will be @code{1} but it can be increased to higher
  2743. values to trim all audio up to specific count of non-silence periods.
  2744. Default value is @code{0}.
  2745. @item start_duration
  2746. Specify the amount of time that non-silence must be detected before it stops
  2747. trimming audio. By increasing the duration, bursts of noises can be treated
  2748. as silence and trimmed off. Default value is @code{0}.
  2749. @item start_threshold
  2750. This indicates what sample value should be treated as silence. For digital
  2751. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2752. you may wish to increase the value to account for background noise.
  2753. Can be specified in dB (in case "dB" is appended to the specified value)
  2754. or amplitude ratio. Default value is @code{0}.
  2755. @item stop_periods
  2756. Set the count for trimming silence from the end of audio.
  2757. To remove silence from the middle of a file, specify a @var{stop_periods}
  2758. that is negative. This value is then treated as a positive value and is
  2759. used to indicate the effect should restart processing as specified by
  2760. @var{start_periods}, making it suitable for removing periods of silence
  2761. in the middle of the audio.
  2762. Default value is @code{0}.
  2763. @item stop_duration
  2764. Specify a duration of silence that must exist before audio is not copied any
  2765. more. By specifying a higher duration, silence that is wanted can be left in
  2766. the audio.
  2767. Default value is @code{0}.
  2768. @item stop_threshold
  2769. This is the same as @option{start_threshold} but for trimming silence from
  2770. the end of audio.
  2771. Can be specified in dB (in case "dB" is appended to the specified value)
  2772. or amplitude ratio. Default value is @code{0}.
  2773. @item leave_silence
  2774. This indicates that @var{stop_duration} length of audio should be left intact
  2775. at the beginning of each period of silence.
  2776. For example, if you want to remove long pauses between words but do not want
  2777. to remove the pauses completely. Default value is @code{0}.
  2778. @item detection
  2779. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  2780. and works better with digital silence which is exactly 0.
  2781. Default value is @code{rms}.
  2782. @item window
  2783. Set ratio used to calculate size of window for detecting silence.
  2784. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  2785. @end table
  2786. @subsection Examples
  2787. @itemize
  2788. @item
  2789. The following example shows how this filter can be used to start a recording
  2790. that does not contain the delay at the start which usually occurs between
  2791. pressing the record button and the start of the performance:
  2792. @example
  2793. silenceremove=1:5:0.02
  2794. @end example
  2795. @item
  2796. Trim all silence encountered from beginning to end where there is more than 1
  2797. second of silence in audio:
  2798. @example
  2799. silenceremove=0:0:0:-1:1:-90dB
  2800. @end example
  2801. @end itemize
  2802. @section sofalizer
  2803. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  2804. loudspeakers around the user for binaural listening via headphones (audio
  2805. formats up to 9 channels supported).
  2806. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  2807. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  2808. Austrian Academy of Sciences.
  2809. To enable compilation of this filter you need to configure FFmpeg with
  2810. @code{--enable-libmysofa}.
  2811. The filter accepts the following options:
  2812. @table @option
  2813. @item sofa
  2814. Set the SOFA file used for rendering.
  2815. @item gain
  2816. Set gain applied to audio. Value is in dB. Default is 0.
  2817. @item rotation
  2818. Set rotation of virtual loudspeakers in deg. Default is 0.
  2819. @item elevation
  2820. Set elevation of virtual speakers in deg. Default is 0.
  2821. @item radius
  2822. Set distance in meters between loudspeakers and the listener with near-field
  2823. HRTFs. Default is 1.
  2824. @item type
  2825. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2826. processing audio in time domain which is slow.
  2827. @var{freq} is processing audio in frequency domain which is fast.
  2828. Default is @var{freq}.
  2829. @item speakers
  2830. Set custom positions of virtual loudspeakers. Syntax for this option is:
  2831. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  2832. Each virtual loudspeaker is described with short channel name following with
  2833. azimuth and elevation in degreees.
  2834. Each virtual loudspeaker description is separated by '|'.
  2835. For example to override front left and front right channel positions use:
  2836. 'speakers=FL 45 15|FR 345 15'.
  2837. Descriptions with unrecognised channel names are ignored.
  2838. @item lfegain
  2839. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2840. @end table
  2841. @subsection Examples
  2842. @itemize
  2843. @item
  2844. Using ClubFritz6 sofa file:
  2845. @example
  2846. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  2847. @end example
  2848. @item
  2849. Using ClubFritz12 sofa file and bigger radius with small rotation:
  2850. @example
  2851. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  2852. @end example
  2853. @item
  2854. Similar as above but with custom speaker positions for front left, front right, back left and back right
  2855. and also with custom gain:
  2856. @example
  2857. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  2858. @end example
  2859. @end itemize
  2860. @section stereotools
  2861. This filter has some handy utilities to manage stereo signals, for converting
  2862. M/S stereo recordings to L/R signal while having control over the parameters
  2863. or spreading the stereo image of master track.
  2864. The filter accepts the following options:
  2865. @table @option
  2866. @item level_in
  2867. Set input level before filtering for both channels. Defaults is 1.
  2868. Allowed range is from 0.015625 to 64.
  2869. @item level_out
  2870. Set output level after filtering for both channels. Defaults is 1.
  2871. Allowed range is from 0.015625 to 64.
  2872. @item balance_in
  2873. Set input balance between both channels. Default is 0.
  2874. Allowed range is from -1 to 1.
  2875. @item balance_out
  2876. Set output balance between both channels. Default is 0.
  2877. Allowed range is from -1 to 1.
  2878. @item softclip
  2879. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  2880. clipping. Disabled by default.
  2881. @item mutel
  2882. Mute the left channel. Disabled by default.
  2883. @item muter
  2884. Mute the right channel. Disabled by default.
  2885. @item phasel
  2886. Change the phase of the left channel. Disabled by default.
  2887. @item phaser
  2888. Change the phase of the right channel. Disabled by default.
  2889. @item mode
  2890. Set stereo mode. Available values are:
  2891. @table @samp
  2892. @item lr>lr
  2893. Left/Right to Left/Right, this is default.
  2894. @item lr>ms
  2895. Left/Right to Mid/Side.
  2896. @item ms>lr
  2897. Mid/Side to Left/Right.
  2898. @item lr>ll
  2899. Left/Right to Left/Left.
  2900. @item lr>rr
  2901. Left/Right to Right/Right.
  2902. @item lr>l+r
  2903. Left/Right to Left + Right.
  2904. @item lr>rl
  2905. Left/Right to Right/Left.
  2906. @end table
  2907. @item slev
  2908. Set level of side signal. Default is 1.
  2909. Allowed range is from 0.015625 to 64.
  2910. @item sbal
  2911. Set balance of side signal. Default is 0.
  2912. Allowed range is from -1 to 1.
  2913. @item mlev
  2914. Set level of the middle signal. Default is 1.
  2915. Allowed range is from 0.015625 to 64.
  2916. @item mpan
  2917. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  2918. @item base
  2919. Set stereo base between mono and inversed channels. Default is 0.
  2920. Allowed range is from -1 to 1.
  2921. @item delay
  2922. Set delay in milliseconds how much to delay left from right channel and
  2923. vice versa. Default is 0. Allowed range is from -20 to 20.
  2924. @item sclevel
  2925. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  2926. @item phase
  2927. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  2928. @item bmode_in, bmode_out
  2929. Set balance mode for balance_in/balance_out option.
  2930. Can be one of the following:
  2931. @table @samp
  2932. @item balance
  2933. Classic balance mode. Attenuate one channel at time.
  2934. Gain is raised up to 1.
  2935. @item amplitude
  2936. Similar as classic mode above but gain is raised up to 2.
  2937. @item power
  2938. Equal power distribution, from -6dB to +6dB range.
  2939. @end table
  2940. @end table
  2941. @subsection Examples
  2942. @itemize
  2943. @item
  2944. Apply karaoke like effect:
  2945. @example
  2946. stereotools=mlev=0.015625
  2947. @end example
  2948. @item
  2949. Convert M/S signal to L/R:
  2950. @example
  2951. "stereotools=mode=ms>lr"
  2952. @end example
  2953. @end itemize
  2954. @section stereowiden
  2955. This filter enhance the stereo effect by suppressing signal common to both
  2956. channels and by delaying the signal of left into right and vice versa,
  2957. thereby widening the stereo effect.
  2958. The filter accepts the following options:
  2959. @table @option
  2960. @item delay
  2961. Time in milliseconds of the delay of left signal into right and vice versa.
  2962. Default is 20 milliseconds.
  2963. @item feedback
  2964. Amount of gain in delayed signal into right and vice versa. Gives a delay
  2965. effect of left signal in right output and vice versa which gives widening
  2966. effect. Default is 0.3.
  2967. @item crossfeed
  2968. Cross feed of left into right with inverted phase. This helps in suppressing
  2969. the mono. If the value is 1 it will cancel all the signal common to both
  2970. channels. Default is 0.3.
  2971. @item drymix
  2972. Set level of input signal of original channel. Default is 0.8.
  2973. @end table
  2974. @section surround
  2975. Apply audio surround upmix filter.
  2976. This filter allows to produce multichannel output from audio stream.
  2977. The filter accepts the following options:
  2978. @table @option
  2979. @item chl_out
  2980. Set output channel layout. By default, this is @var{5.1}.
  2981. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2982. for the required syntax.
  2983. @item chl_in
  2984. Set input channel layout. By default, this is @var{stereo}.
  2985. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2986. for the required syntax.
  2987. @item level_in
  2988. Set input volume level. By default, this is @var{1}.
  2989. @item level_out
  2990. Set output volume level. By default, this is @var{1}.
  2991. @item lfe
  2992. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  2993. @item lfe_low
  2994. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  2995. @item lfe_high
  2996. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  2997. @end table
  2998. @section treble
  2999. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3000. shelving filter with a response similar to that of a standard
  3001. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3002. The filter accepts the following options:
  3003. @table @option
  3004. @item gain, g
  3005. Give the gain at whichever is the lower of ~22 kHz and the
  3006. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3007. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3008. @item frequency, f
  3009. Set the filter's central frequency and so can be used
  3010. to extend or reduce the frequency range to be boosted or cut.
  3011. The default value is @code{3000} Hz.
  3012. @item width_type
  3013. Set method to specify band-width of filter.
  3014. @table @option
  3015. @item h
  3016. Hz
  3017. @item q
  3018. Q-Factor
  3019. @item o
  3020. octave
  3021. @item s
  3022. slope
  3023. @end table
  3024. @item width, w
  3025. Determine how steep is the filter's shelf transition.
  3026. @item channels, c
  3027. Specify which channels to filter, by default all available are filtered.
  3028. @end table
  3029. @section tremolo
  3030. Sinusoidal amplitude modulation.
  3031. The filter accepts the following options:
  3032. @table @option
  3033. @item f
  3034. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3035. (20 Hz or lower) will result in a tremolo effect.
  3036. This filter may also be used as a ring modulator by specifying
  3037. a modulation frequency higher than 20 Hz.
  3038. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3039. @item d
  3040. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3041. Default value is 0.5.
  3042. @end table
  3043. @section vibrato
  3044. Sinusoidal phase modulation.
  3045. The filter accepts the following options:
  3046. @table @option
  3047. @item f
  3048. Modulation frequency in Hertz.
  3049. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3050. @item d
  3051. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3052. Default value is 0.5.
  3053. @end table
  3054. @section volume
  3055. Adjust the input audio volume.
  3056. It accepts the following parameters:
  3057. @table @option
  3058. @item volume
  3059. Set audio volume expression.
  3060. Output values are clipped to the maximum value.
  3061. The output audio volume is given by the relation:
  3062. @example
  3063. @var{output_volume} = @var{volume} * @var{input_volume}
  3064. @end example
  3065. The default value for @var{volume} is "1.0".
  3066. @item precision
  3067. This parameter represents the mathematical precision.
  3068. It determines which input sample formats will be allowed, which affects the
  3069. precision of the volume scaling.
  3070. @table @option
  3071. @item fixed
  3072. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3073. @item float
  3074. 32-bit floating-point; this limits input sample format to FLT. (default)
  3075. @item double
  3076. 64-bit floating-point; this limits input sample format to DBL.
  3077. @end table
  3078. @item replaygain
  3079. Choose the behaviour on encountering ReplayGain side data in input frames.
  3080. @table @option
  3081. @item drop
  3082. Remove ReplayGain side data, ignoring its contents (the default).
  3083. @item ignore
  3084. Ignore ReplayGain side data, but leave it in the frame.
  3085. @item track
  3086. Prefer the track gain, if present.
  3087. @item album
  3088. Prefer the album gain, if present.
  3089. @end table
  3090. @item replaygain_preamp
  3091. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3092. Default value for @var{replaygain_preamp} is 0.0.
  3093. @item eval
  3094. Set when the volume expression is evaluated.
  3095. It accepts the following values:
  3096. @table @samp
  3097. @item once
  3098. only evaluate expression once during the filter initialization, or
  3099. when the @samp{volume} command is sent
  3100. @item frame
  3101. evaluate expression for each incoming frame
  3102. @end table
  3103. Default value is @samp{once}.
  3104. @end table
  3105. The volume expression can contain the following parameters.
  3106. @table @option
  3107. @item n
  3108. frame number (starting at zero)
  3109. @item nb_channels
  3110. number of channels
  3111. @item nb_consumed_samples
  3112. number of samples consumed by the filter
  3113. @item nb_samples
  3114. number of samples in the current frame
  3115. @item pos
  3116. original frame position in the file
  3117. @item pts
  3118. frame PTS
  3119. @item sample_rate
  3120. sample rate
  3121. @item startpts
  3122. PTS at start of stream
  3123. @item startt
  3124. time at start of stream
  3125. @item t
  3126. frame time
  3127. @item tb
  3128. timestamp timebase
  3129. @item volume
  3130. last set volume value
  3131. @end table
  3132. Note that when @option{eval} is set to @samp{once} only the
  3133. @var{sample_rate} and @var{tb} variables are available, all other
  3134. variables will evaluate to NAN.
  3135. @subsection Commands
  3136. This filter supports the following commands:
  3137. @table @option
  3138. @item volume
  3139. Modify the volume expression.
  3140. The command accepts the same syntax of the corresponding option.
  3141. If the specified expression is not valid, it is kept at its current
  3142. value.
  3143. @item replaygain_noclip
  3144. Prevent clipping by limiting the gain applied.
  3145. Default value for @var{replaygain_noclip} is 1.
  3146. @end table
  3147. @subsection Examples
  3148. @itemize
  3149. @item
  3150. Halve the input audio volume:
  3151. @example
  3152. volume=volume=0.5
  3153. volume=volume=1/2
  3154. volume=volume=-6.0206dB
  3155. @end example
  3156. In all the above example the named key for @option{volume} can be
  3157. omitted, for example like in:
  3158. @example
  3159. volume=0.5
  3160. @end example
  3161. @item
  3162. Increase input audio power by 6 decibels using fixed-point precision:
  3163. @example
  3164. volume=volume=6dB:precision=fixed
  3165. @end example
  3166. @item
  3167. Fade volume after time 10 with an annihilation period of 5 seconds:
  3168. @example
  3169. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3170. @end example
  3171. @end itemize
  3172. @section volumedetect
  3173. Detect the volume of the input video.
  3174. The filter has no parameters. The input is not modified. Statistics about
  3175. the volume will be printed in the log when the input stream end is reached.
  3176. In particular it will show the mean volume (root mean square), maximum
  3177. volume (on a per-sample basis), and the beginning of a histogram of the
  3178. registered volume values (from the maximum value to a cumulated 1/1000 of
  3179. the samples).
  3180. All volumes are in decibels relative to the maximum PCM value.
  3181. @subsection Examples
  3182. Here is an excerpt of the output:
  3183. @example
  3184. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3185. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3186. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3187. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3188. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3189. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3190. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3191. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3192. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3193. @end example
  3194. It means that:
  3195. @itemize
  3196. @item
  3197. The mean square energy is approximately -27 dB, or 10^-2.7.
  3198. @item
  3199. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3200. @item
  3201. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3202. @end itemize
  3203. In other words, raising the volume by +4 dB does not cause any clipping,
  3204. raising it by +5 dB causes clipping for 6 samples, etc.
  3205. @c man end AUDIO FILTERS
  3206. @chapter Audio Sources
  3207. @c man begin AUDIO SOURCES
  3208. Below is a description of the currently available audio sources.
  3209. @section abuffer
  3210. Buffer audio frames, and make them available to the filter chain.
  3211. This source is mainly intended for a programmatic use, in particular
  3212. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3213. It accepts the following parameters:
  3214. @table @option
  3215. @item time_base
  3216. The timebase which will be used for timestamps of submitted frames. It must be
  3217. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3218. @item sample_rate
  3219. The sample rate of the incoming audio buffers.
  3220. @item sample_fmt
  3221. The sample format of the incoming audio buffers.
  3222. Either a sample format name or its corresponding integer representation from
  3223. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3224. @item channel_layout
  3225. The channel layout of the incoming audio buffers.
  3226. Either a channel layout name from channel_layout_map in
  3227. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3228. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3229. @item channels
  3230. The number of channels of the incoming audio buffers.
  3231. If both @var{channels} and @var{channel_layout} are specified, then they
  3232. must be consistent.
  3233. @end table
  3234. @subsection Examples
  3235. @example
  3236. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3237. @end example
  3238. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3239. Since the sample format with name "s16p" corresponds to the number
  3240. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3241. equivalent to:
  3242. @example
  3243. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3244. @end example
  3245. @section aevalsrc
  3246. Generate an audio signal specified by an expression.
  3247. This source accepts in input one or more expressions (one for each
  3248. channel), which are evaluated and used to generate a corresponding
  3249. audio signal.
  3250. This source accepts the following options:
  3251. @table @option
  3252. @item exprs
  3253. Set the '|'-separated expressions list for each separate channel. In case the
  3254. @option{channel_layout} option is not specified, the selected channel layout
  3255. depends on the number of provided expressions. Otherwise the last
  3256. specified expression is applied to the remaining output channels.
  3257. @item channel_layout, c
  3258. Set the channel layout. The number of channels in the specified layout
  3259. must be equal to the number of specified expressions.
  3260. @item duration, d
  3261. Set the minimum duration of the sourced audio. See
  3262. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3263. for the accepted syntax.
  3264. Note that the resulting duration may be greater than the specified
  3265. duration, as the generated audio is always cut at the end of a
  3266. complete frame.
  3267. If not specified, or the expressed duration is negative, the audio is
  3268. supposed to be generated forever.
  3269. @item nb_samples, n
  3270. Set the number of samples per channel per each output frame,
  3271. default to 1024.
  3272. @item sample_rate, s
  3273. Specify the sample rate, default to 44100.
  3274. @end table
  3275. Each expression in @var{exprs} can contain the following constants:
  3276. @table @option
  3277. @item n
  3278. number of the evaluated sample, starting from 0
  3279. @item t
  3280. time of the evaluated sample expressed in seconds, starting from 0
  3281. @item s
  3282. sample rate
  3283. @end table
  3284. @subsection Examples
  3285. @itemize
  3286. @item
  3287. Generate silence:
  3288. @example
  3289. aevalsrc=0
  3290. @end example
  3291. @item
  3292. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3293. 8000 Hz:
  3294. @example
  3295. aevalsrc="sin(440*2*PI*t):s=8000"
  3296. @end example
  3297. @item
  3298. Generate a two channels signal, specify the channel layout (Front
  3299. Center + Back Center) explicitly:
  3300. @example
  3301. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3302. @end example
  3303. @item
  3304. Generate white noise:
  3305. @example
  3306. aevalsrc="-2+random(0)"
  3307. @end example
  3308. @item
  3309. Generate an amplitude modulated signal:
  3310. @example
  3311. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3312. @end example
  3313. @item
  3314. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3315. @example
  3316. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3317. @end example
  3318. @end itemize
  3319. @section anullsrc
  3320. The null audio source, return unprocessed audio frames. It is mainly useful
  3321. as a template and to be employed in analysis / debugging tools, or as
  3322. the source for filters which ignore the input data (for example the sox
  3323. synth filter).
  3324. This source accepts the following options:
  3325. @table @option
  3326. @item channel_layout, cl
  3327. Specifies the channel layout, and can be either an integer or a string
  3328. representing a channel layout. The default value of @var{channel_layout}
  3329. is "stereo".
  3330. Check the channel_layout_map definition in
  3331. @file{libavutil/channel_layout.c} for the mapping between strings and
  3332. channel layout values.
  3333. @item sample_rate, r
  3334. Specifies the sample rate, and defaults to 44100.
  3335. @item nb_samples, n
  3336. Set the number of samples per requested frames.
  3337. @end table
  3338. @subsection Examples
  3339. @itemize
  3340. @item
  3341. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3342. @example
  3343. anullsrc=r=48000:cl=4
  3344. @end example
  3345. @item
  3346. Do the same operation with a more obvious syntax:
  3347. @example
  3348. anullsrc=r=48000:cl=mono
  3349. @end example
  3350. @end itemize
  3351. All the parameters need to be explicitly defined.
  3352. @section flite
  3353. Synthesize a voice utterance using the libflite library.
  3354. To enable compilation of this filter you need to configure FFmpeg with
  3355. @code{--enable-libflite}.
  3356. Note that the flite library is not thread-safe.
  3357. The filter accepts the following options:
  3358. @table @option
  3359. @item list_voices
  3360. If set to 1, list the names of the available voices and exit
  3361. immediately. Default value is 0.
  3362. @item nb_samples, n
  3363. Set the maximum number of samples per frame. Default value is 512.
  3364. @item textfile
  3365. Set the filename containing the text to speak.
  3366. @item text
  3367. Set the text to speak.
  3368. @item voice, v
  3369. Set the voice to use for the speech synthesis. Default value is
  3370. @code{kal}. See also the @var{list_voices} option.
  3371. @end table
  3372. @subsection Examples
  3373. @itemize
  3374. @item
  3375. Read from file @file{speech.txt}, and synthesize the text using the
  3376. standard flite voice:
  3377. @example
  3378. flite=textfile=speech.txt
  3379. @end example
  3380. @item
  3381. Read the specified text selecting the @code{slt} voice:
  3382. @example
  3383. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3384. @end example
  3385. @item
  3386. Input text to ffmpeg:
  3387. @example
  3388. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3389. @end example
  3390. @item
  3391. Make @file{ffplay} speak the specified text, using @code{flite} and
  3392. the @code{lavfi} device:
  3393. @example
  3394. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3395. @end example
  3396. @end itemize
  3397. For more information about libflite, check:
  3398. @url{http://www.speech.cs.cmu.edu/flite/}
  3399. @section anoisesrc
  3400. Generate a noise audio signal.
  3401. The filter accepts the following options:
  3402. @table @option
  3403. @item sample_rate, r
  3404. Specify the sample rate. Default value is 48000 Hz.
  3405. @item amplitude, a
  3406. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3407. is 1.0.
  3408. @item duration, d
  3409. Specify the duration of the generated audio stream. Not specifying this option
  3410. results in noise with an infinite length.
  3411. @item color, colour, c
  3412. Specify the color of noise. Available noise colors are white, pink, and brown.
  3413. Default color is white.
  3414. @item seed, s
  3415. Specify a value used to seed the PRNG.
  3416. @item nb_samples, n
  3417. Set the number of samples per each output frame, default is 1024.
  3418. @end table
  3419. @subsection Examples
  3420. @itemize
  3421. @item
  3422. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3423. @example
  3424. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3425. @end example
  3426. @end itemize
  3427. @section sine
  3428. Generate an audio signal made of a sine wave with amplitude 1/8.
  3429. The audio signal is bit-exact.
  3430. The filter accepts the following options:
  3431. @table @option
  3432. @item frequency, f
  3433. Set the carrier frequency. Default is 440 Hz.
  3434. @item beep_factor, b
  3435. Enable a periodic beep every second with frequency @var{beep_factor} times
  3436. the carrier frequency. Default is 0, meaning the beep is disabled.
  3437. @item sample_rate, r
  3438. Specify the sample rate, default is 44100.
  3439. @item duration, d
  3440. Specify the duration of the generated audio stream.
  3441. @item samples_per_frame
  3442. Set the number of samples per output frame.
  3443. The expression can contain the following constants:
  3444. @table @option
  3445. @item n
  3446. The (sequential) number of the output audio frame, starting from 0.
  3447. @item pts
  3448. The PTS (Presentation TimeStamp) of the output audio frame,
  3449. expressed in @var{TB} units.
  3450. @item t
  3451. The PTS of the output audio frame, expressed in seconds.
  3452. @item TB
  3453. The timebase of the output audio frames.
  3454. @end table
  3455. Default is @code{1024}.
  3456. @end table
  3457. @subsection Examples
  3458. @itemize
  3459. @item
  3460. Generate a simple 440 Hz sine wave:
  3461. @example
  3462. sine
  3463. @end example
  3464. @item
  3465. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3466. @example
  3467. sine=220:4:d=5
  3468. sine=f=220:b=4:d=5
  3469. sine=frequency=220:beep_factor=4:duration=5
  3470. @end example
  3471. @item
  3472. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3473. pattern:
  3474. @example
  3475. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3476. @end example
  3477. @end itemize
  3478. @c man end AUDIO SOURCES
  3479. @chapter Audio Sinks
  3480. @c man begin AUDIO SINKS
  3481. Below is a description of the currently available audio sinks.
  3482. @section abuffersink
  3483. Buffer audio frames, and make them available to the end of filter chain.
  3484. This sink is mainly intended for programmatic use, in particular
  3485. through the interface defined in @file{libavfilter/buffersink.h}
  3486. or the options system.
  3487. It accepts a pointer to an AVABufferSinkContext structure, which
  3488. defines the incoming buffers' formats, to be passed as the opaque
  3489. parameter to @code{avfilter_init_filter} for initialization.
  3490. @section anullsink
  3491. Null audio sink; do absolutely nothing with the input audio. It is
  3492. mainly useful as a template and for use in analysis / debugging
  3493. tools.
  3494. @c man end AUDIO SINKS
  3495. @chapter Video Filters
  3496. @c man begin VIDEO FILTERS
  3497. When you configure your FFmpeg build, you can disable any of the
  3498. existing filters using @code{--disable-filters}.
  3499. The configure output will show the video filters included in your
  3500. build.
  3501. Below is a description of the currently available video filters.
  3502. @section alphaextract
  3503. Extract the alpha component from the input as a grayscale video. This
  3504. is especially useful with the @var{alphamerge} filter.
  3505. @section alphamerge
  3506. Add or replace the alpha component of the primary input with the
  3507. grayscale value of a second input. This is intended for use with
  3508. @var{alphaextract} to allow the transmission or storage of frame
  3509. sequences that have alpha in a format that doesn't support an alpha
  3510. channel.
  3511. For example, to reconstruct full frames from a normal YUV-encoded video
  3512. and a separate video created with @var{alphaextract}, you might use:
  3513. @example
  3514. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3515. @end example
  3516. Since this filter is designed for reconstruction, it operates on frame
  3517. sequences without considering timestamps, and terminates when either
  3518. input reaches end of stream. This will cause problems if your encoding
  3519. pipeline drops frames. If you're trying to apply an image as an
  3520. overlay to a video stream, consider the @var{overlay} filter instead.
  3521. @section ass
  3522. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3523. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3524. Substation Alpha) subtitles files.
  3525. This filter accepts the following option in addition to the common options from
  3526. the @ref{subtitles} filter:
  3527. @table @option
  3528. @item shaping
  3529. Set the shaping engine
  3530. Available values are:
  3531. @table @samp
  3532. @item auto
  3533. The default libass shaping engine, which is the best available.
  3534. @item simple
  3535. Fast, font-agnostic shaper that can do only substitutions
  3536. @item complex
  3537. Slower shaper using OpenType for substitutions and positioning
  3538. @end table
  3539. The default is @code{auto}.
  3540. @end table
  3541. @section atadenoise
  3542. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3543. The filter accepts the following options:
  3544. @table @option
  3545. @item 0a
  3546. Set threshold A for 1st plane. Default is 0.02.
  3547. Valid range is 0 to 0.3.
  3548. @item 0b
  3549. Set threshold B for 1st plane. Default is 0.04.
  3550. Valid range is 0 to 5.
  3551. @item 1a
  3552. Set threshold A for 2nd plane. Default is 0.02.
  3553. Valid range is 0 to 0.3.
  3554. @item 1b
  3555. Set threshold B for 2nd plane. Default is 0.04.
  3556. Valid range is 0 to 5.
  3557. @item 2a
  3558. Set threshold A for 3rd plane. Default is 0.02.
  3559. Valid range is 0 to 0.3.
  3560. @item 2b
  3561. Set threshold B for 3rd plane. Default is 0.04.
  3562. Valid range is 0 to 5.
  3563. Threshold A is designed to react on abrupt changes in the input signal and
  3564. threshold B is designed to react on continuous changes in the input signal.
  3565. @item s
  3566. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3567. number in range [5, 129].
  3568. @item p
  3569. Set what planes of frame filter will use for averaging. Default is all.
  3570. @end table
  3571. @section avgblur
  3572. Apply average blur filter.
  3573. The filter accepts the following options:
  3574. @table @option
  3575. @item sizeX
  3576. Set horizontal kernel size.
  3577. @item planes
  3578. Set which planes to filter. By default all planes are filtered.
  3579. @item sizeY
  3580. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  3581. Default is @code{0}.
  3582. @end table
  3583. @section bbox
  3584. Compute the bounding box for the non-black pixels in the input frame
  3585. luminance plane.
  3586. This filter computes the bounding box containing all the pixels with a
  3587. luminance value greater than the minimum allowed value.
  3588. The parameters describing the bounding box are printed on the filter
  3589. log.
  3590. The filter accepts the following option:
  3591. @table @option
  3592. @item min_val
  3593. Set the minimal luminance value. Default is @code{16}.
  3594. @end table
  3595. @section bitplanenoise
  3596. Show and measure bit plane noise.
  3597. The filter accepts the following options:
  3598. @table @option
  3599. @item bitplane
  3600. Set which plane to analyze. Default is @code{1}.
  3601. @item filter
  3602. Filter out noisy pixels from @code{bitplane} set above.
  3603. Default is disabled.
  3604. @end table
  3605. @section blackdetect
  3606. Detect video intervals that are (almost) completely black. Can be
  3607. useful to detect chapter transitions, commercials, or invalid
  3608. recordings. Output lines contains the time for the start, end and
  3609. duration of the detected black interval expressed in seconds.
  3610. In order to display the output lines, you need to set the loglevel at
  3611. least to the AV_LOG_INFO value.
  3612. The filter accepts the following options:
  3613. @table @option
  3614. @item black_min_duration, d
  3615. Set the minimum detected black duration expressed in seconds. It must
  3616. be a non-negative floating point number.
  3617. Default value is 2.0.
  3618. @item picture_black_ratio_th, pic_th
  3619. Set the threshold for considering a picture "black".
  3620. Express the minimum value for the ratio:
  3621. @example
  3622. @var{nb_black_pixels} / @var{nb_pixels}
  3623. @end example
  3624. for which a picture is considered black.
  3625. Default value is 0.98.
  3626. @item pixel_black_th, pix_th
  3627. Set the threshold for considering a pixel "black".
  3628. The threshold expresses the maximum pixel luminance value for which a
  3629. pixel is considered "black". The provided value is scaled according to
  3630. the following equation:
  3631. @example
  3632. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  3633. @end example
  3634. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  3635. the input video format, the range is [0-255] for YUV full-range
  3636. formats and [16-235] for YUV non full-range formats.
  3637. Default value is 0.10.
  3638. @end table
  3639. The following example sets the maximum pixel threshold to the minimum
  3640. value, and detects only black intervals of 2 or more seconds:
  3641. @example
  3642. blackdetect=d=2:pix_th=0.00
  3643. @end example
  3644. @section blackframe
  3645. Detect frames that are (almost) completely black. Can be useful to
  3646. detect chapter transitions or commercials. Output lines consist of
  3647. the frame number of the detected frame, the percentage of blackness,
  3648. the position in the file if known or -1 and the timestamp in seconds.
  3649. In order to display the output lines, you need to set the loglevel at
  3650. least to the AV_LOG_INFO value.
  3651. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  3652. The value represents the percentage of pixels in the picture that
  3653. are below the threshold value.
  3654. It accepts the following parameters:
  3655. @table @option
  3656. @item amount
  3657. The percentage of the pixels that have to be below the threshold; it defaults to
  3658. @code{98}.
  3659. @item threshold, thresh
  3660. The threshold below which a pixel value is considered black; it defaults to
  3661. @code{32}.
  3662. @end table
  3663. @section blend, tblend
  3664. Blend two video frames into each other.
  3665. The @code{blend} filter takes two input streams and outputs one
  3666. stream, the first input is the "top" layer and second input is
  3667. "bottom" layer. By default, the output terminates when the longest input terminates.
  3668. The @code{tblend} (time blend) filter takes two consecutive frames
  3669. from one single stream, and outputs the result obtained by blending
  3670. the new frame on top of the old frame.
  3671. A description of the accepted options follows.
  3672. @table @option
  3673. @item c0_mode
  3674. @item c1_mode
  3675. @item c2_mode
  3676. @item c3_mode
  3677. @item all_mode
  3678. Set blend mode for specific pixel component or all pixel components in case
  3679. of @var{all_mode}. Default value is @code{normal}.
  3680. Available values for component modes are:
  3681. @table @samp
  3682. @item addition
  3683. @item addition128
  3684. @item and
  3685. @item average
  3686. @item burn
  3687. @item darken
  3688. @item difference
  3689. @item difference128
  3690. @item divide
  3691. @item dodge
  3692. @item freeze
  3693. @item exclusion
  3694. @item glow
  3695. @item hardlight
  3696. @item hardmix
  3697. @item heat
  3698. @item lighten
  3699. @item linearlight
  3700. @item multiply
  3701. @item multiply128
  3702. @item negation
  3703. @item normal
  3704. @item or
  3705. @item overlay
  3706. @item phoenix
  3707. @item pinlight
  3708. @item reflect
  3709. @item screen
  3710. @item softlight
  3711. @item subtract
  3712. @item vividlight
  3713. @item xor
  3714. @end table
  3715. @item c0_opacity
  3716. @item c1_opacity
  3717. @item c2_opacity
  3718. @item c3_opacity
  3719. @item all_opacity
  3720. Set blend opacity for specific pixel component or all pixel components in case
  3721. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  3722. @item c0_expr
  3723. @item c1_expr
  3724. @item c2_expr
  3725. @item c3_expr
  3726. @item all_expr
  3727. Set blend expression for specific pixel component or all pixel components in case
  3728. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3729. The expressions can use the following variables:
  3730. @table @option
  3731. @item N
  3732. The sequential number of the filtered frame, starting from @code{0}.
  3733. @item X
  3734. @item Y
  3735. the coordinates of the current sample
  3736. @item W
  3737. @item H
  3738. the width and height of currently filtered plane
  3739. @item SW
  3740. @item SH
  3741. Width and height scale depending on the currently filtered plane. It is the
  3742. ratio between the corresponding luma plane number of pixels and the current
  3743. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3744. @code{0.5,0.5} for chroma planes.
  3745. @item T
  3746. Time of the current frame, expressed in seconds.
  3747. @item TOP, A
  3748. Value of pixel component at current location for first video frame (top layer).
  3749. @item BOTTOM, B
  3750. Value of pixel component at current location for second video frame (bottom layer).
  3751. @end table
  3752. @item shortest
  3753. Force termination when the shortest input terminates. Default is
  3754. @code{0}. This option is only defined for the @code{blend} filter.
  3755. @item repeatlast
  3756. Continue applying the last bottom frame after the end of the stream. A value of
  3757. @code{0} disable the filter after the last frame of the bottom layer is reached.
  3758. Default is @code{1}. This option is only defined for the @code{blend} filter.
  3759. @end table
  3760. @subsection Examples
  3761. @itemize
  3762. @item
  3763. Apply transition from bottom layer to top layer in first 10 seconds:
  3764. @example
  3765. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3766. @end example
  3767. @item
  3768. Apply 1x1 checkerboard effect:
  3769. @example
  3770. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  3771. @end example
  3772. @item
  3773. Apply uncover left effect:
  3774. @example
  3775. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  3776. @end example
  3777. @item
  3778. Apply uncover down effect:
  3779. @example
  3780. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  3781. @end example
  3782. @item
  3783. Apply uncover up-left effect:
  3784. @example
  3785. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  3786. @end example
  3787. @item
  3788. Split diagonally video and shows top and bottom layer on each side:
  3789. @example
  3790. blend=all_expr=if(gt(X,Y*(W/H)),A,B)
  3791. @end example
  3792. @item
  3793. Display differences between the current and the previous frame:
  3794. @example
  3795. tblend=all_mode=difference128
  3796. @end example
  3797. @end itemize
  3798. @section boxblur
  3799. Apply a boxblur algorithm to the input video.
  3800. It accepts the following parameters:
  3801. @table @option
  3802. @item luma_radius, lr
  3803. @item luma_power, lp
  3804. @item chroma_radius, cr
  3805. @item chroma_power, cp
  3806. @item alpha_radius, ar
  3807. @item alpha_power, ap
  3808. @end table
  3809. A description of the accepted options follows.
  3810. @table @option
  3811. @item luma_radius, lr
  3812. @item chroma_radius, cr
  3813. @item alpha_radius, ar
  3814. Set an expression for the box radius in pixels used for blurring the
  3815. corresponding input plane.
  3816. The radius value must be a non-negative number, and must not be
  3817. greater than the value of the expression @code{min(w,h)/2} for the
  3818. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  3819. planes.
  3820. Default value for @option{luma_radius} is "2". If not specified,
  3821. @option{chroma_radius} and @option{alpha_radius} default to the
  3822. corresponding value set for @option{luma_radius}.
  3823. The expressions can contain the following constants:
  3824. @table @option
  3825. @item w
  3826. @item h
  3827. The input width and height in pixels.
  3828. @item cw
  3829. @item ch
  3830. The input chroma image width and height in pixels.
  3831. @item hsub
  3832. @item vsub
  3833. The horizontal and vertical chroma subsample values. For example, for the
  3834. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  3835. @end table
  3836. @item luma_power, lp
  3837. @item chroma_power, cp
  3838. @item alpha_power, ap
  3839. Specify how many times the boxblur filter is applied to the
  3840. corresponding plane.
  3841. Default value for @option{luma_power} is 2. If not specified,
  3842. @option{chroma_power} and @option{alpha_power} default to the
  3843. corresponding value set for @option{luma_power}.
  3844. A value of 0 will disable the effect.
  3845. @end table
  3846. @subsection Examples
  3847. @itemize
  3848. @item
  3849. Apply a boxblur filter with the luma, chroma, and alpha radii
  3850. set to 2:
  3851. @example
  3852. boxblur=luma_radius=2:luma_power=1
  3853. boxblur=2:1
  3854. @end example
  3855. @item
  3856. Set the luma radius to 2, and alpha and chroma radius to 0:
  3857. @example
  3858. boxblur=2:1:cr=0:ar=0
  3859. @end example
  3860. @item
  3861. Set the luma and chroma radii to a fraction of the video dimension:
  3862. @example
  3863. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  3864. @end example
  3865. @end itemize
  3866. @section bwdif
  3867. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  3868. Deinterlacing Filter").
  3869. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  3870. interpolation algorithms.
  3871. It accepts the following parameters:
  3872. @table @option
  3873. @item mode
  3874. The interlacing mode to adopt. It accepts one of the following values:
  3875. @table @option
  3876. @item 0, send_frame
  3877. Output one frame for each frame.
  3878. @item 1, send_field
  3879. Output one frame for each field.
  3880. @end table
  3881. The default value is @code{send_field}.
  3882. @item parity
  3883. The picture field parity assumed for the input interlaced video. It accepts one
  3884. of the following values:
  3885. @table @option
  3886. @item 0, tff
  3887. Assume the top field is first.
  3888. @item 1, bff
  3889. Assume the bottom field is first.
  3890. @item -1, auto
  3891. Enable automatic detection of field parity.
  3892. @end table
  3893. The default value is @code{auto}.
  3894. If the interlacing is unknown or the decoder does not export this information,
  3895. top field first will be assumed.
  3896. @item deint
  3897. Specify which frames to deinterlace. Accept one of the following
  3898. values:
  3899. @table @option
  3900. @item 0, all
  3901. Deinterlace all frames.
  3902. @item 1, interlaced
  3903. Only deinterlace frames marked as interlaced.
  3904. @end table
  3905. The default value is @code{all}.
  3906. @end table
  3907. @section chromakey
  3908. YUV colorspace color/chroma keying.
  3909. The filter accepts the following options:
  3910. @table @option
  3911. @item color
  3912. The color which will be replaced with transparency.
  3913. @item similarity
  3914. Similarity percentage with the key color.
  3915. 0.01 matches only the exact key color, while 1.0 matches everything.
  3916. @item blend
  3917. Blend percentage.
  3918. 0.0 makes pixels either fully transparent, or not transparent at all.
  3919. Higher values result in semi-transparent pixels, with a higher transparency
  3920. the more similar the pixels color is to the key color.
  3921. @item yuv
  3922. Signals that the color passed is already in YUV instead of RGB.
  3923. Litteral colors like "green" or "red" don't make sense with this enabled anymore.
  3924. This can be used to pass exact YUV values as hexadecimal numbers.
  3925. @end table
  3926. @subsection Examples
  3927. @itemize
  3928. @item
  3929. Make every green pixel in the input image transparent:
  3930. @example
  3931. ffmpeg -i input.png -vf chromakey=green out.png
  3932. @end example
  3933. @item
  3934. Overlay a greenscreen-video on top of a static black background.
  3935. @example
  3936. 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
  3937. @end example
  3938. @end itemize
  3939. @section ciescope
  3940. Display CIE color diagram with pixels overlaid onto it.
  3941. The filter accepts the following options:
  3942. @table @option
  3943. @item system
  3944. Set color system.
  3945. @table @samp
  3946. @item ntsc, 470m
  3947. @item ebu, 470bg
  3948. @item smpte
  3949. @item 240m
  3950. @item apple
  3951. @item widergb
  3952. @item cie1931
  3953. @item rec709, hdtv
  3954. @item uhdtv, rec2020
  3955. @end table
  3956. @item cie
  3957. Set CIE system.
  3958. @table @samp
  3959. @item xyy
  3960. @item ucs
  3961. @item luv
  3962. @end table
  3963. @item gamuts
  3964. Set what gamuts to draw.
  3965. See @code{system} option for available values.
  3966. @item size, s
  3967. Set ciescope size, by default set to 512.
  3968. @item intensity, i
  3969. Set intensity used to map input pixel values to CIE diagram.
  3970. @item contrast
  3971. Set contrast used to draw tongue colors that are out of active color system gamut.
  3972. @item corrgamma
  3973. Correct gamma displayed on scope, by default enabled.
  3974. @item showwhite
  3975. Show white point on CIE diagram, by default disabled.
  3976. @item gamma
  3977. Set input gamma. Used only with XYZ input color space.
  3978. @end table
  3979. @section codecview
  3980. Visualize information exported by some codecs.
  3981. Some codecs can export information through frames using side-data or other
  3982. means. For example, some MPEG based codecs export motion vectors through the
  3983. @var{export_mvs} flag in the codec @option{flags2} option.
  3984. The filter accepts the following option:
  3985. @table @option
  3986. @item mv
  3987. Set motion vectors to visualize.
  3988. Available flags for @var{mv} are:
  3989. @table @samp
  3990. @item pf
  3991. forward predicted MVs of P-frames
  3992. @item bf
  3993. forward predicted MVs of B-frames
  3994. @item bb
  3995. backward predicted MVs of B-frames
  3996. @end table
  3997. @item qp
  3998. Display quantization parameters using the chroma planes.
  3999. @item mv_type, mvt
  4000. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4001. Available flags for @var{mv_type} are:
  4002. @table @samp
  4003. @item fp
  4004. forward predicted MVs
  4005. @item bp
  4006. backward predicted MVs
  4007. @end table
  4008. @item frame_type, ft
  4009. Set frame type to visualize motion vectors of.
  4010. Available flags for @var{frame_type} are:
  4011. @table @samp
  4012. @item if
  4013. intra-coded frames (I-frames)
  4014. @item pf
  4015. predicted frames (P-frames)
  4016. @item bf
  4017. bi-directionally predicted frames (B-frames)
  4018. @end table
  4019. @end table
  4020. @subsection Examples
  4021. @itemize
  4022. @item
  4023. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4024. @example
  4025. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4026. @end example
  4027. @item
  4028. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4029. @example
  4030. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4031. @end example
  4032. @end itemize
  4033. @section colorbalance
  4034. Modify intensity of primary colors (red, green and blue) of input frames.
  4035. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4036. regions for the red-cyan, green-magenta or blue-yellow balance.
  4037. A positive adjustment value shifts the balance towards the primary color, a negative
  4038. value towards the complementary color.
  4039. The filter accepts the following options:
  4040. @table @option
  4041. @item rs
  4042. @item gs
  4043. @item bs
  4044. Adjust red, green and blue shadows (darkest pixels).
  4045. @item rm
  4046. @item gm
  4047. @item bm
  4048. Adjust red, green and blue midtones (medium pixels).
  4049. @item rh
  4050. @item gh
  4051. @item bh
  4052. Adjust red, green and blue highlights (brightest pixels).
  4053. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4054. @end table
  4055. @subsection Examples
  4056. @itemize
  4057. @item
  4058. Add red color cast to shadows:
  4059. @example
  4060. colorbalance=rs=.3
  4061. @end example
  4062. @end itemize
  4063. @section colorkey
  4064. RGB colorspace color keying.
  4065. The filter accepts the following options:
  4066. @table @option
  4067. @item color
  4068. The color which will be replaced with transparency.
  4069. @item similarity
  4070. Similarity percentage with the key color.
  4071. 0.01 matches only the exact key color, while 1.0 matches everything.
  4072. @item blend
  4073. Blend percentage.
  4074. 0.0 makes pixels either fully transparent, or not transparent at all.
  4075. Higher values result in semi-transparent pixels, with a higher transparency
  4076. the more similar the pixels color is to the key color.
  4077. @end table
  4078. @subsection Examples
  4079. @itemize
  4080. @item
  4081. Make every green pixel in the input image transparent:
  4082. @example
  4083. ffmpeg -i input.png -vf colorkey=green out.png
  4084. @end example
  4085. @item
  4086. Overlay a greenscreen-video on top of a static background image.
  4087. @example
  4088. 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
  4089. @end example
  4090. @end itemize
  4091. @section colorlevels
  4092. Adjust video input frames using levels.
  4093. The filter accepts the following options:
  4094. @table @option
  4095. @item rimin
  4096. @item gimin
  4097. @item bimin
  4098. @item aimin
  4099. Adjust red, green, blue and alpha input black point.
  4100. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4101. @item rimax
  4102. @item gimax
  4103. @item bimax
  4104. @item aimax
  4105. Adjust red, green, blue and alpha input white point.
  4106. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  4107. Input levels are used to lighten highlights (bright tones), darken shadows
  4108. (dark tones), change the balance of bright and dark tones.
  4109. @item romin
  4110. @item gomin
  4111. @item bomin
  4112. @item aomin
  4113. Adjust red, green, blue and alpha output black point.
  4114. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  4115. @item romax
  4116. @item gomax
  4117. @item bomax
  4118. @item aomax
  4119. Adjust red, green, blue and alpha output white point.
  4120. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  4121. Output levels allows manual selection of a constrained output level range.
  4122. @end table
  4123. @subsection Examples
  4124. @itemize
  4125. @item
  4126. Make video output darker:
  4127. @example
  4128. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4129. @end example
  4130. @item
  4131. Increase contrast:
  4132. @example
  4133. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4134. @end example
  4135. @item
  4136. Make video output lighter:
  4137. @example
  4138. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4139. @end example
  4140. @item
  4141. Increase brightness:
  4142. @example
  4143. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4144. @end example
  4145. @end itemize
  4146. @section colorchannelmixer
  4147. Adjust video input frames by re-mixing color channels.
  4148. This filter modifies a color channel by adding the values associated to
  4149. the other channels of the same pixels. For example if the value to
  4150. modify is red, the output value will be:
  4151. @example
  4152. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4153. @end example
  4154. The filter accepts the following options:
  4155. @table @option
  4156. @item rr
  4157. @item rg
  4158. @item rb
  4159. @item ra
  4160. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4161. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4162. @item gr
  4163. @item gg
  4164. @item gb
  4165. @item ga
  4166. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4167. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4168. @item br
  4169. @item bg
  4170. @item bb
  4171. @item ba
  4172. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4173. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4174. @item ar
  4175. @item ag
  4176. @item ab
  4177. @item aa
  4178. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4179. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4180. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4181. @end table
  4182. @subsection Examples
  4183. @itemize
  4184. @item
  4185. Convert source to grayscale:
  4186. @example
  4187. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4188. @end example
  4189. @item
  4190. Simulate sepia tones:
  4191. @example
  4192. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4193. @end example
  4194. @end itemize
  4195. @section colormatrix
  4196. Convert color matrix.
  4197. The filter accepts the following options:
  4198. @table @option
  4199. @item src
  4200. @item dst
  4201. Specify the source and destination color matrix. Both values must be
  4202. specified.
  4203. The accepted values are:
  4204. @table @samp
  4205. @item bt709
  4206. BT.709
  4207. @item fcc
  4208. FCC
  4209. @item bt601
  4210. BT.601
  4211. @item bt470
  4212. BT.470
  4213. @item bt470bg
  4214. BT.470BG
  4215. @item smpte170m
  4216. SMPTE-170M
  4217. @item smpte240m
  4218. SMPTE-240M
  4219. @item bt2020
  4220. BT.2020
  4221. @end table
  4222. @end table
  4223. For example to convert from BT.601 to SMPTE-240M, use the command:
  4224. @example
  4225. colormatrix=bt601:smpte240m
  4226. @end example
  4227. @section colorspace
  4228. Convert colorspace, transfer characteristics or color primaries.
  4229. Input video needs to have an even size.
  4230. The filter accepts the following options:
  4231. @table @option
  4232. @anchor{all}
  4233. @item all
  4234. Specify all color properties at once.
  4235. The accepted values are:
  4236. @table @samp
  4237. @item bt470m
  4238. BT.470M
  4239. @item bt470bg
  4240. BT.470BG
  4241. @item bt601-6-525
  4242. BT.601-6 525
  4243. @item bt601-6-625
  4244. BT.601-6 625
  4245. @item bt709
  4246. BT.709
  4247. @item smpte170m
  4248. SMPTE-170M
  4249. @item smpte240m
  4250. SMPTE-240M
  4251. @item bt2020
  4252. BT.2020
  4253. @end table
  4254. @anchor{space}
  4255. @item space
  4256. Specify output colorspace.
  4257. The accepted values are:
  4258. @table @samp
  4259. @item bt709
  4260. BT.709
  4261. @item fcc
  4262. FCC
  4263. @item bt470bg
  4264. BT.470BG or BT.601-6 625
  4265. @item smpte170m
  4266. SMPTE-170M or BT.601-6 525
  4267. @item smpte240m
  4268. SMPTE-240M
  4269. @item ycgco
  4270. YCgCo
  4271. @item bt2020ncl
  4272. BT.2020 with non-constant luminance
  4273. @end table
  4274. @anchor{trc}
  4275. @item trc
  4276. Specify output transfer characteristics.
  4277. The accepted values are:
  4278. @table @samp
  4279. @item bt709
  4280. BT.709
  4281. @item bt470m
  4282. BT.470M
  4283. @item bt470bg
  4284. BT.470BG
  4285. @item gamma22
  4286. Constant gamma of 2.2
  4287. @item gamma28
  4288. Constant gamma of 2.8
  4289. @item smpte170m
  4290. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4291. @item smpte240m
  4292. SMPTE-240M
  4293. @item srgb
  4294. SRGB
  4295. @item iec61966-2-1
  4296. iec61966-2-1
  4297. @item iec61966-2-4
  4298. iec61966-2-4
  4299. @item xvycc
  4300. xvycc
  4301. @item bt2020-10
  4302. BT.2020 for 10-bits content
  4303. @item bt2020-12
  4304. BT.2020 for 12-bits content
  4305. @end table
  4306. @anchor{primaries}
  4307. @item primaries
  4308. Specify output color primaries.
  4309. The accepted values are:
  4310. @table @samp
  4311. @item bt709
  4312. BT.709
  4313. @item bt470m
  4314. BT.470M
  4315. @item bt470bg
  4316. BT.470BG or BT.601-6 625
  4317. @item smpte170m
  4318. SMPTE-170M or BT.601-6 525
  4319. @item smpte240m
  4320. SMPTE-240M
  4321. @item film
  4322. film
  4323. @item smpte431
  4324. SMPTE-431
  4325. @item smpte432
  4326. SMPTE-432
  4327. @item bt2020
  4328. BT.2020
  4329. @item jedec-p22
  4330. JEDEC P22 phosphors
  4331. @end table
  4332. @anchor{range}
  4333. @item range
  4334. Specify output color range.
  4335. The accepted values are:
  4336. @table @samp
  4337. @item tv
  4338. TV (restricted) range
  4339. @item mpeg
  4340. MPEG (restricted) range
  4341. @item pc
  4342. PC (full) range
  4343. @item jpeg
  4344. JPEG (full) range
  4345. @end table
  4346. @item format
  4347. Specify output color format.
  4348. The accepted values are:
  4349. @table @samp
  4350. @item yuv420p
  4351. YUV 4:2:0 planar 8-bits
  4352. @item yuv420p10
  4353. YUV 4:2:0 planar 10-bits
  4354. @item yuv420p12
  4355. YUV 4:2:0 planar 12-bits
  4356. @item yuv422p
  4357. YUV 4:2:2 planar 8-bits
  4358. @item yuv422p10
  4359. YUV 4:2:2 planar 10-bits
  4360. @item yuv422p12
  4361. YUV 4:2:2 planar 12-bits
  4362. @item yuv444p
  4363. YUV 4:4:4 planar 8-bits
  4364. @item yuv444p10
  4365. YUV 4:4:4 planar 10-bits
  4366. @item yuv444p12
  4367. YUV 4:4:4 planar 12-bits
  4368. @end table
  4369. @item fast
  4370. Do a fast conversion, which skips gamma/primary correction. This will take
  4371. significantly less CPU, but will be mathematically incorrect. To get output
  4372. compatible with that produced by the colormatrix filter, use fast=1.
  4373. @item dither
  4374. Specify dithering mode.
  4375. The accepted values are:
  4376. @table @samp
  4377. @item none
  4378. No dithering
  4379. @item fsb
  4380. Floyd-Steinberg dithering
  4381. @end table
  4382. @item wpadapt
  4383. Whitepoint adaptation mode.
  4384. The accepted values are:
  4385. @table @samp
  4386. @item bradford
  4387. Bradford whitepoint adaptation
  4388. @item vonkries
  4389. von Kries whitepoint adaptation
  4390. @item identity
  4391. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4392. @end table
  4393. @item iall
  4394. Override all input properties at once. Same accepted values as @ref{all}.
  4395. @item ispace
  4396. Override input colorspace. Same accepted values as @ref{space}.
  4397. @item iprimaries
  4398. Override input color primaries. Same accepted values as @ref{primaries}.
  4399. @item itrc
  4400. Override input transfer characteristics. Same accepted values as @ref{trc}.
  4401. @item irange
  4402. Override input color range. Same accepted values as @ref{range}.
  4403. @end table
  4404. The filter converts the transfer characteristics, color space and color
  4405. primaries to the specified user values. The output value, if not specified,
  4406. is set to a default value based on the "all" property. If that property is
  4407. also not specified, the filter will log an error. The output color range and
  4408. format default to the same value as the input color range and format. The
  4409. input transfer characteristics, color space, color primaries and color range
  4410. should be set on the input data. If any of these are missing, the filter will
  4411. log an error and no conversion will take place.
  4412. For example to convert the input to SMPTE-240M, use the command:
  4413. @example
  4414. colorspace=smpte240m
  4415. @end example
  4416. @section convolution
  4417. Apply convolution 3x3 or 5x5 filter.
  4418. The filter accepts the following options:
  4419. @table @option
  4420. @item 0m
  4421. @item 1m
  4422. @item 2m
  4423. @item 3m
  4424. Set matrix for each plane.
  4425. Matrix is sequence of 9 or 25 signed integers.
  4426. @item 0rdiv
  4427. @item 1rdiv
  4428. @item 2rdiv
  4429. @item 3rdiv
  4430. Set multiplier for calculated value for each plane.
  4431. @item 0bias
  4432. @item 1bias
  4433. @item 2bias
  4434. @item 3bias
  4435. Set bias for each plane. This value is added to the result of the multiplication.
  4436. Useful for making the overall image brighter or darker. Default is 0.0.
  4437. @end table
  4438. @subsection Examples
  4439. @itemize
  4440. @item
  4441. Apply sharpen:
  4442. @example
  4443. 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"
  4444. @end example
  4445. @item
  4446. Apply blur:
  4447. @example
  4448. 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"
  4449. @end example
  4450. @item
  4451. Apply edge enhance:
  4452. @example
  4453. 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"
  4454. @end example
  4455. @item
  4456. Apply edge detect:
  4457. @example
  4458. 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"
  4459. @end example
  4460. @item
  4461. Apply emboss:
  4462. @example
  4463. 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"
  4464. @end example
  4465. @end itemize
  4466. @section copy
  4467. Copy the input video source unchanged to the output. This is mainly useful for
  4468. testing purposes.
  4469. @anchor{coreimage}
  4470. @section coreimage
  4471. Video filtering on GPU using Apple's CoreImage API on OSX.
  4472. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4473. processed by video hardware. However, software-based OpenGL implementations
  4474. exist which means there is no guarantee for hardware processing. It depends on
  4475. the respective OSX.
  4476. There are many filters and image generators provided by Apple that come with a
  4477. large variety of options. The filter has to be referenced by its name along
  4478. with its options.
  4479. The coreimage filter accepts the following options:
  4480. @table @option
  4481. @item list_filters
  4482. List all available filters and generators along with all their respective
  4483. options as well as possible minimum and maximum values along with the default
  4484. values.
  4485. @example
  4486. list_filters=true
  4487. @end example
  4488. @item filter
  4489. Specify all filters by their respective name and options.
  4490. Use @var{list_filters} to determine all valid filter names and options.
  4491. Numerical options are specified by a float value and are automatically clamped
  4492. to their respective value range. Vector and color options have to be specified
  4493. by a list of space separated float values. Character escaping has to be done.
  4494. A special option name @code{default} is available to use default options for a
  4495. filter.
  4496. It is required to specify either @code{default} or at least one of the filter options.
  4497. All omitted options are used with their default values.
  4498. The syntax of the filter string is as follows:
  4499. @example
  4500. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  4501. @end example
  4502. @item output_rect
  4503. Specify a rectangle where the output of the filter chain is copied into the
  4504. input image. It is given by a list of space separated float values:
  4505. @example
  4506. output_rect=x\ y\ width\ height
  4507. @end example
  4508. If not given, the output rectangle equals the dimensions of the input image.
  4509. The output rectangle is automatically cropped at the borders of the input
  4510. image. Negative values are valid for each component.
  4511. @example
  4512. output_rect=25\ 25\ 100\ 100
  4513. @end example
  4514. @end table
  4515. Several filters can be chained for successive processing without GPU-HOST
  4516. transfers allowing for fast processing of complex filter chains.
  4517. Currently, only filters with zero (generators) or exactly one (filters) input
  4518. image and one output image are supported. Also, transition filters are not yet
  4519. usable as intended.
  4520. Some filters generate output images with additional padding depending on the
  4521. respective filter kernel. The padding is automatically removed to ensure the
  4522. filter output has the same size as the input image.
  4523. For image generators, the size of the output image is determined by the
  4524. previous output image of the filter chain or the input image of the whole
  4525. filterchain, respectively. The generators do not use the pixel information of
  4526. this image to generate their output. However, the generated output is
  4527. blended onto this image, resulting in partial or complete coverage of the
  4528. output image.
  4529. The @ref{coreimagesrc} video source can be used for generating input images
  4530. which are directly fed into the filter chain. By using it, providing input
  4531. images by another video source or an input video is not required.
  4532. @subsection Examples
  4533. @itemize
  4534. @item
  4535. List all filters available:
  4536. @example
  4537. coreimage=list_filters=true
  4538. @end example
  4539. @item
  4540. Use the CIBoxBlur filter with default options to blur an image:
  4541. @example
  4542. coreimage=filter=CIBoxBlur@@default
  4543. @end example
  4544. @item
  4545. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  4546. its center at 100x100 and a radius of 50 pixels:
  4547. @example
  4548. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  4549. @end example
  4550. @item
  4551. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  4552. given as complete and escaped command-line for Apple's standard bash shell:
  4553. @example
  4554. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  4555. @end example
  4556. @end itemize
  4557. @section crop
  4558. Crop the input video to given dimensions.
  4559. It accepts the following parameters:
  4560. @table @option
  4561. @item w, out_w
  4562. The width of the output video. It defaults to @code{iw}.
  4563. This expression is evaluated only once during the filter
  4564. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  4565. @item h, out_h
  4566. The height of the output video. It defaults to @code{ih}.
  4567. This expression is evaluated only once during the filter
  4568. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  4569. @item x
  4570. The horizontal position, in the input video, of the left edge of the output
  4571. video. It defaults to @code{(in_w-out_w)/2}.
  4572. This expression is evaluated per-frame.
  4573. @item y
  4574. The vertical position, in the input video, of the top edge of the output video.
  4575. It defaults to @code{(in_h-out_h)/2}.
  4576. This expression is evaluated per-frame.
  4577. @item keep_aspect
  4578. If set to 1 will force the output display aspect ratio
  4579. to be the same of the input, by changing the output sample aspect
  4580. ratio. It defaults to 0.
  4581. @item exact
  4582. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  4583. width/height/x/y as specified and will not be rounded to nearest smaller value.
  4584. It defaults to 0.
  4585. @end table
  4586. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  4587. expressions containing the following constants:
  4588. @table @option
  4589. @item x
  4590. @item y
  4591. The computed values for @var{x} and @var{y}. They are evaluated for
  4592. each new frame.
  4593. @item in_w
  4594. @item in_h
  4595. The input width and height.
  4596. @item iw
  4597. @item ih
  4598. These are the same as @var{in_w} and @var{in_h}.
  4599. @item out_w
  4600. @item out_h
  4601. The output (cropped) width and height.
  4602. @item ow
  4603. @item oh
  4604. These are the same as @var{out_w} and @var{out_h}.
  4605. @item a
  4606. same as @var{iw} / @var{ih}
  4607. @item sar
  4608. input sample aspect ratio
  4609. @item dar
  4610. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4611. @item hsub
  4612. @item vsub
  4613. horizontal and vertical chroma subsample values. For example for the
  4614. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4615. @item n
  4616. The number of the input frame, starting from 0.
  4617. @item pos
  4618. the position in the file of the input frame, NAN if unknown
  4619. @item t
  4620. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  4621. @end table
  4622. The expression for @var{out_w} may depend on the value of @var{out_h},
  4623. and the expression for @var{out_h} may depend on @var{out_w}, but they
  4624. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  4625. evaluated after @var{out_w} and @var{out_h}.
  4626. The @var{x} and @var{y} parameters specify the expressions for the
  4627. position of the top-left corner of the output (non-cropped) area. They
  4628. are evaluated for each frame. If the evaluated value is not valid, it
  4629. is approximated to the nearest valid value.
  4630. The expression for @var{x} may depend on @var{y}, and the expression
  4631. for @var{y} may depend on @var{x}.
  4632. @subsection Examples
  4633. @itemize
  4634. @item
  4635. Crop area with size 100x100 at position (12,34).
  4636. @example
  4637. crop=100:100:12:34
  4638. @end example
  4639. Using named options, the example above becomes:
  4640. @example
  4641. crop=w=100:h=100:x=12:y=34
  4642. @end example
  4643. @item
  4644. Crop the central input area with size 100x100:
  4645. @example
  4646. crop=100:100
  4647. @end example
  4648. @item
  4649. Crop the central input area with size 2/3 of the input video:
  4650. @example
  4651. crop=2/3*in_w:2/3*in_h
  4652. @end example
  4653. @item
  4654. Crop the input video central square:
  4655. @example
  4656. crop=out_w=in_h
  4657. crop=in_h
  4658. @end example
  4659. @item
  4660. Delimit the rectangle with the top-left corner placed at position
  4661. 100:100 and the right-bottom corner corresponding to the right-bottom
  4662. corner of the input image.
  4663. @example
  4664. crop=in_w-100:in_h-100:100:100
  4665. @end example
  4666. @item
  4667. Crop 10 pixels from the left and right borders, and 20 pixels from
  4668. the top and bottom borders
  4669. @example
  4670. crop=in_w-2*10:in_h-2*20
  4671. @end example
  4672. @item
  4673. Keep only the bottom right quarter of the input image:
  4674. @example
  4675. crop=in_w/2:in_h/2:in_w/2:in_h/2
  4676. @end example
  4677. @item
  4678. Crop height for getting Greek harmony:
  4679. @example
  4680. crop=in_w:1/PHI*in_w
  4681. @end example
  4682. @item
  4683. Apply trembling effect:
  4684. @example
  4685. 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)
  4686. @end example
  4687. @item
  4688. Apply erratic camera effect depending on timestamp:
  4689. @example
  4690. 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)"
  4691. @end example
  4692. @item
  4693. Set x depending on the value of y:
  4694. @example
  4695. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  4696. @end example
  4697. @end itemize
  4698. @subsection Commands
  4699. This filter supports the following commands:
  4700. @table @option
  4701. @item w, out_w
  4702. @item h, out_h
  4703. @item x
  4704. @item y
  4705. Set width/height of the output video and the horizontal/vertical position
  4706. in the input video.
  4707. The command accepts the same syntax of the corresponding option.
  4708. If the specified expression is not valid, it is kept at its current
  4709. value.
  4710. @end table
  4711. @section cropdetect
  4712. Auto-detect the crop size.
  4713. It calculates the necessary cropping parameters and prints the
  4714. recommended parameters via the logging system. The detected dimensions
  4715. correspond to the non-black area of the input video.
  4716. It accepts the following parameters:
  4717. @table @option
  4718. @item limit
  4719. Set higher black value threshold, which can be optionally specified
  4720. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  4721. value greater to the set value is considered non-black. It defaults to 24.
  4722. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  4723. on the bitdepth of the pixel format.
  4724. @item round
  4725. The value which the width/height should be divisible by. It defaults to
  4726. 16. The offset is automatically adjusted to center the video. Use 2 to
  4727. get only even dimensions (needed for 4:2:2 video). 16 is best when
  4728. encoding to most video codecs.
  4729. @item reset_count, reset
  4730. Set the counter that determines after how many frames cropdetect will
  4731. reset the previously detected largest video area and start over to
  4732. detect the current optimal crop area. Default value is 0.
  4733. This can be useful when channel logos distort the video area. 0
  4734. indicates 'never reset', and returns the largest area encountered during
  4735. playback.
  4736. @end table
  4737. @anchor{curves}
  4738. @section curves
  4739. Apply color adjustments using curves.
  4740. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  4741. component (red, green and blue) has its values defined by @var{N} key points
  4742. tied from each other using a smooth curve. The x-axis represents the pixel
  4743. values from the input frame, and the y-axis the new pixel values to be set for
  4744. the output frame.
  4745. By default, a component curve is defined by the two points @var{(0;0)} and
  4746. @var{(1;1)}. This creates a straight line where each original pixel value is
  4747. "adjusted" to its own value, which means no change to the image.
  4748. The filter allows you to redefine these two points and add some more. A new
  4749. curve (using a natural cubic spline interpolation) will be define to pass
  4750. smoothly through all these new coordinates. The new defined points needs to be
  4751. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  4752. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  4753. the vector spaces, the values will be clipped accordingly.
  4754. The filter accepts the following options:
  4755. @table @option
  4756. @item preset
  4757. Select one of the available color presets. This option can be used in addition
  4758. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  4759. options takes priority on the preset values.
  4760. Available presets are:
  4761. @table @samp
  4762. @item none
  4763. @item color_negative
  4764. @item cross_process
  4765. @item darker
  4766. @item increase_contrast
  4767. @item lighter
  4768. @item linear_contrast
  4769. @item medium_contrast
  4770. @item negative
  4771. @item strong_contrast
  4772. @item vintage
  4773. @end table
  4774. Default is @code{none}.
  4775. @item master, m
  4776. Set the master key points. These points will define a second pass mapping. It
  4777. is sometimes called a "luminance" or "value" mapping. It can be used with
  4778. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  4779. post-processing LUT.
  4780. @item red, r
  4781. Set the key points for the red component.
  4782. @item green, g
  4783. Set the key points for the green component.
  4784. @item blue, b
  4785. Set the key points for the blue component.
  4786. @item all
  4787. Set the key points for all components (not including master).
  4788. Can be used in addition to the other key points component
  4789. options. In this case, the unset component(s) will fallback on this
  4790. @option{all} setting.
  4791. @item psfile
  4792. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  4793. @item plot
  4794. Save Gnuplot script of the curves in specified file.
  4795. @end table
  4796. To avoid some filtergraph syntax conflicts, each key points list need to be
  4797. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  4798. @subsection Examples
  4799. @itemize
  4800. @item
  4801. Increase slightly the middle level of blue:
  4802. @example
  4803. curves=blue='0/0 0.5/0.58 1/1'
  4804. @end example
  4805. @item
  4806. Vintage effect:
  4807. @example
  4808. curves=r='0/0.11 .42/.51 1/0.95':g='0/0 0.50/0.48 1/1':b='0/0.22 .49/.44 1/0.8'
  4809. @end example
  4810. Here we obtain the following coordinates for each components:
  4811. @table @var
  4812. @item red
  4813. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  4814. @item green
  4815. @code{(0;0) (0.50;0.48) (1;1)}
  4816. @item blue
  4817. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  4818. @end table
  4819. @item
  4820. The previous example can also be achieved with the associated built-in preset:
  4821. @example
  4822. curves=preset=vintage
  4823. @end example
  4824. @item
  4825. Or simply:
  4826. @example
  4827. curves=vintage
  4828. @end example
  4829. @item
  4830. Use a Photoshop preset and redefine the points of the green component:
  4831. @example
  4832. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  4833. @end example
  4834. @item
  4835. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  4836. and @command{gnuplot}:
  4837. @example
  4838. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  4839. gnuplot -p /tmp/curves.plt
  4840. @end example
  4841. @end itemize
  4842. @section datascope
  4843. Video data analysis filter.
  4844. This filter shows hexadecimal pixel values of part of video.
  4845. The filter accepts the following options:
  4846. @table @option
  4847. @item size, s
  4848. Set output video size.
  4849. @item x
  4850. Set x offset from where to pick pixels.
  4851. @item y
  4852. Set y offset from where to pick pixels.
  4853. @item mode
  4854. Set scope mode, can be one of the following:
  4855. @table @samp
  4856. @item mono
  4857. Draw hexadecimal pixel values with white color on black background.
  4858. @item color
  4859. Draw hexadecimal pixel values with input video pixel color on black
  4860. background.
  4861. @item color2
  4862. Draw hexadecimal pixel values on color background picked from input video,
  4863. the text color is picked in such way so its always visible.
  4864. @end table
  4865. @item axis
  4866. Draw rows and columns numbers on left and top of video.
  4867. @item opacity
  4868. Set background opacity.
  4869. @end table
  4870. @section dctdnoiz
  4871. Denoise frames using 2D DCT (frequency domain filtering).
  4872. This filter is not designed for real time.
  4873. The filter accepts the following options:
  4874. @table @option
  4875. @item sigma, s
  4876. Set the noise sigma constant.
  4877. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  4878. coefficient (absolute value) below this threshold with be dropped.
  4879. If you need a more advanced filtering, see @option{expr}.
  4880. Default is @code{0}.
  4881. @item overlap
  4882. Set number overlapping pixels for each block. Since the filter can be slow, you
  4883. may want to reduce this value, at the cost of a less effective filter and the
  4884. risk of various artefacts.
  4885. If the overlapping value doesn't permit processing the whole input width or
  4886. height, a warning will be displayed and according borders won't be denoised.
  4887. Default value is @var{blocksize}-1, which is the best possible setting.
  4888. @item expr, e
  4889. Set the coefficient factor expression.
  4890. For each coefficient of a DCT block, this expression will be evaluated as a
  4891. multiplier value for the coefficient.
  4892. If this is option is set, the @option{sigma} option will be ignored.
  4893. The absolute value of the coefficient can be accessed through the @var{c}
  4894. variable.
  4895. @item n
  4896. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  4897. @var{blocksize}, which is the width and height of the processed blocks.
  4898. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  4899. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  4900. on the speed processing. Also, a larger block size does not necessarily means a
  4901. better de-noising.
  4902. @end table
  4903. @subsection Examples
  4904. Apply a denoise with a @option{sigma} of @code{4.5}:
  4905. @example
  4906. dctdnoiz=4.5
  4907. @end example
  4908. The same operation can be achieved using the expression system:
  4909. @example
  4910. dctdnoiz=e='gte(c, 4.5*3)'
  4911. @end example
  4912. Violent denoise using a block size of @code{16x16}:
  4913. @example
  4914. dctdnoiz=15:n=4
  4915. @end example
  4916. @section deband
  4917. Remove banding artifacts from input video.
  4918. It works by replacing banded pixels with average value of referenced pixels.
  4919. The filter accepts the following options:
  4920. @table @option
  4921. @item 1thr
  4922. @item 2thr
  4923. @item 3thr
  4924. @item 4thr
  4925. Set banding detection threshold for each plane. Default is 0.02.
  4926. Valid range is 0.00003 to 0.5.
  4927. If difference between current pixel and reference pixel is less than threshold,
  4928. it will be considered as banded.
  4929. @item range, r
  4930. Banding detection range in pixels. Default is 16. If positive, random number
  4931. in range 0 to set value will be used. If negative, exact absolute value
  4932. will be used.
  4933. The range defines square of four pixels around current pixel.
  4934. @item direction, d
  4935. Set direction in radians from which four pixel will be compared. If positive,
  4936. random direction from 0 to set direction will be picked. If negative, exact of
  4937. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  4938. will pick only pixels on same row and -PI/2 will pick only pixels on same
  4939. column.
  4940. @item blur, b
  4941. If enabled, current pixel is compared with average value of all four
  4942. surrounding pixels. The default is enabled. If disabled current pixel is
  4943. compared with all four surrounding pixels. The pixel is considered banded
  4944. if only all four differences with surrounding pixels are less than threshold.
  4945. @item coupling, c
  4946. If enabled, current pixel is changed if and only if all pixel components are banded,
  4947. e.g. banding detection threshold is triggered for all color components.
  4948. The default is disabled.
  4949. @end table
  4950. @anchor{decimate}
  4951. @section decimate
  4952. Drop duplicated frames at regular intervals.
  4953. The filter accepts the following options:
  4954. @table @option
  4955. @item cycle
  4956. Set the number of frames from which one will be dropped. Setting this to
  4957. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  4958. Default is @code{5}.
  4959. @item dupthresh
  4960. Set the threshold for duplicate detection. If the difference metric for a frame
  4961. is less than or equal to this value, then it is declared as duplicate. Default
  4962. is @code{1.1}
  4963. @item scthresh
  4964. Set scene change threshold. Default is @code{15}.
  4965. @item blockx
  4966. @item blocky
  4967. Set the size of the x and y-axis blocks used during metric calculations.
  4968. Larger blocks give better noise suppression, but also give worse detection of
  4969. small movements. Must be a power of two. Default is @code{32}.
  4970. @item ppsrc
  4971. Mark main input as a pre-processed input and activate clean source input
  4972. stream. This allows the input to be pre-processed with various filters to help
  4973. the metrics calculation while keeping the frame selection lossless. When set to
  4974. @code{1}, the first stream is for the pre-processed input, and the second
  4975. stream is the clean source from where the kept frames are chosen. Default is
  4976. @code{0}.
  4977. @item chroma
  4978. Set whether or not chroma is considered in the metric calculations. Default is
  4979. @code{1}.
  4980. @end table
  4981. @section deflate
  4982. Apply deflate effect to the video.
  4983. This filter replaces the pixel by the local(3x3) average by taking into account
  4984. only values lower than the pixel.
  4985. It accepts the following options:
  4986. @table @option
  4987. @item threshold0
  4988. @item threshold1
  4989. @item threshold2
  4990. @item threshold3
  4991. Limit the maximum change for each plane, default is 65535.
  4992. If 0, plane will remain unchanged.
  4993. @end table
  4994. @section deflicker
  4995. Remove temporal frame luminance variations.
  4996. It accepts the following options:
  4997. @table @option
  4998. @item size, s
  4999. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  5000. @item mode, m
  5001. Set averaging mode to smooth temporal luminance variations.
  5002. Available values are:
  5003. @table @samp
  5004. @item am
  5005. Arithmetic mean
  5006. @item gm
  5007. Geometric mean
  5008. @item hm
  5009. Harmonic mean
  5010. @item qm
  5011. Quadratic mean
  5012. @item cm
  5013. Cubic mean
  5014. @item pm
  5015. Power mean
  5016. @item median
  5017. Median
  5018. @end table
  5019. @item bypass
  5020. Do not actually modify frame. Useful when one only wants metadata.
  5021. @end table
  5022. @section dejudder
  5023. Remove judder produced by partially interlaced telecined content.
  5024. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  5025. source was partially telecined content then the output of @code{pullup,dejudder}
  5026. will have a variable frame rate. May change the recorded frame rate of the
  5027. container. Aside from that change, this filter will not affect constant frame
  5028. rate video.
  5029. The option available in this filter is:
  5030. @table @option
  5031. @item cycle
  5032. Specify the length of the window over which the judder repeats.
  5033. Accepts any integer greater than 1. Useful values are:
  5034. @table @samp
  5035. @item 4
  5036. If the original was telecined from 24 to 30 fps (Film to NTSC).
  5037. @item 5
  5038. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  5039. @item 20
  5040. If a mixture of the two.
  5041. @end table
  5042. The default is @samp{4}.
  5043. @end table
  5044. @section delogo
  5045. Suppress a TV station logo by a simple interpolation of the surrounding
  5046. pixels. Just set a rectangle covering the logo and watch it disappear
  5047. (and sometimes something even uglier appear - your mileage may vary).
  5048. It accepts the following parameters:
  5049. @table @option
  5050. @item x
  5051. @item y
  5052. Specify the top left corner coordinates of the logo. They must be
  5053. specified.
  5054. @item w
  5055. @item h
  5056. Specify the width and height of the logo to clear. They must be
  5057. specified.
  5058. @item band, t
  5059. Specify the thickness of the fuzzy edge of the rectangle (added to
  5060. @var{w} and @var{h}). The default value is 1. This option is
  5061. deprecated, setting higher values should no longer be necessary and
  5062. is not recommended.
  5063. @item show
  5064. When set to 1, a green rectangle is drawn on the screen to simplify
  5065. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  5066. The default value is 0.
  5067. The rectangle is drawn on the outermost pixels which will be (partly)
  5068. replaced with interpolated values. The values of the next pixels
  5069. immediately outside this rectangle in each direction will be used to
  5070. compute the interpolated pixel values inside the rectangle.
  5071. @end table
  5072. @subsection Examples
  5073. @itemize
  5074. @item
  5075. Set a rectangle covering the area with top left corner coordinates 0,0
  5076. and size 100x77, and a band of size 10:
  5077. @example
  5078. delogo=x=0:y=0:w=100:h=77:band=10
  5079. @end example
  5080. @end itemize
  5081. @section deshake
  5082. Attempt to fix small changes in horizontal and/or vertical shift. This
  5083. filter helps remove camera shake from hand-holding a camera, bumping a
  5084. tripod, moving on a vehicle, etc.
  5085. The filter accepts the following options:
  5086. @table @option
  5087. @item x
  5088. @item y
  5089. @item w
  5090. @item h
  5091. Specify a rectangular area where to limit the search for motion
  5092. vectors.
  5093. If desired the search for motion vectors can be limited to a
  5094. rectangular area of the frame defined by its top left corner, width
  5095. and height. These parameters have the same meaning as the drawbox
  5096. filter which can be used to visualise the position of the bounding
  5097. box.
  5098. This is useful when simultaneous movement of subjects within the frame
  5099. might be confused for camera motion by the motion vector search.
  5100. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  5101. then the full frame is used. This allows later options to be set
  5102. without specifying the bounding box for the motion vector search.
  5103. Default - search the whole frame.
  5104. @item rx
  5105. @item ry
  5106. Specify the maximum extent of movement in x and y directions in the
  5107. range 0-64 pixels. Default 16.
  5108. @item edge
  5109. Specify how to generate pixels to fill blanks at the edge of the
  5110. frame. Available values are:
  5111. @table @samp
  5112. @item blank, 0
  5113. Fill zeroes at blank locations
  5114. @item original, 1
  5115. Original image at blank locations
  5116. @item clamp, 2
  5117. Extruded edge value at blank locations
  5118. @item mirror, 3
  5119. Mirrored edge at blank locations
  5120. @end table
  5121. Default value is @samp{mirror}.
  5122. @item blocksize
  5123. Specify the blocksize to use for motion search. Range 4-128 pixels,
  5124. default 8.
  5125. @item contrast
  5126. Specify the contrast threshold for blocks. Only blocks with more than
  5127. the specified contrast (difference between darkest and lightest
  5128. pixels) will be considered. Range 1-255, default 125.
  5129. @item search
  5130. Specify the search strategy. Available values are:
  5131. @table @samp
  5132. @item exhaustive, 0
  5133. Set exhaustive search
  5134. @item less, 1
  5135. Set less exhaustive search.
  5136. @end table
  5137. Default value is @samp{exhaustive}.
  5138. @item filename
  5139. If set then a detailed log of the motion search is written to the
  5140. specified file.
  5141. @item opencl
  5142. If set to 1, specify using OpenCL capabilities, only available if
  5143. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  5144. @end table
  5145. @section detelecine
  5146. Apply an exact inverse of the telecine operation. It requires a predefined
  5147. pattern specified using the pattern option which must be the same as that passed
  5148. to the telecine filter.
  5149. This filter accepts the following options:
  5150. @table @option
  5151. @item first_field
  5152. @table @samp
  5153. @item top, t
  5154. top field first
  5155. @item bottom, b
  5156. bottom field first
  5157. The default value is @code{top}.
  5158. @end table
  5159. @item pattern
  5160. A string of numbers representing the pulldown pattern you wish to apply.
  5161. The default value is @code{23}.
  5162. @item start_frame
  5163. A number representing position of the first frame with respect to the telecine
  5164. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  5165. @end table
  5166. @section dilation
  5167. Apply dilation effect to the video.
  5168. This filter replaces the pixel by the local(3x3) maximum.
  5169. It accepts the following options:
  5170. @table @option
  5171. @item threshold0
  5172. @item threshold1
  5173. @item threshold2
  5174. @item threshold3
  5175. Limit the maximum change for each plane, default is 65535.
  5176. If 0, plane will remain unchanged.
  5177. @item coordinates
  5178. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5179. pixels are used.
  5180. Flags to local 3x3 coordinates maps like this:
  5181. 1 2 3
  5182. 4 5
  5183. 6 7 8
  5184. @end table
  5185. @section displace
  5186. Displace pixels as indicated by second and third input stream.
  5187. It takes three input streams and outputs one stream, the first input is the
  5188. source, and second and third input are displacement maps.
  5189. The second input specifies how much to displace pixels along the
  5190. x-axis, while the third input specifies how much to displace pixels
  5191. along the y-axis.
  5192. If one of displacement map streams terminates, last frame from that
  5193. displacement map will be used.
  5194. Note that once generated, displacements maps can be reused over and over again.
  5195. A description of the accepted options follows.
  5196. @table @option
  5197. @item edge
  5198. Set displace behavior for pixels that are out of range.
  5199. Available values are:
  5200. @table @samp
  5201. @item blank
  5202. Missing pixels are replaced by black pixels.
  5203. @item smear
  5204. Adjacent pixels will spread out to replace missing pixels.
  5205. @item wrap
  5206. Out of range pixels are wrapped so they point to pixels of other side.
  5207. @end table
  5208. Default is @samp{smear}.
  5209. @end table
  5210. @subsection Examples
  5211. @itemize
  5212. @item
  5213. Add ripple effect to rgb input of video size hd720:
  5214. @example
  5215. 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
  5216. @end example
  5217. @item
  5218. Add wave effect to rgb input of video size hd720:
  5219. @example
  5220. 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
  5221. @end example
  5222. @end itemize
  5223. @section drawbox
  5224. Draw a colored box on the input image.
  5225. It accepts the following parameters:
  5226. @table @option
  5227. @item x
  5228. @item y
  5229. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5230. @item width, w
  5231. @item height, h
  5232. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5233. the input width and height. It defaults to 0.
  5234. @item color, c
  5235. Specify the color of the box to write. For the general syntax of this option,
  5236. check the "Color" section in the ffmpeg-utils manual. If the special
  5237. value @code{invert} is used, the box edge color is the same as the
  5238. video with inverted luma.
  5239. @item thickness, t
  5240. The expression which sets the thickness of the box edge. Default value is @code{3}.
  5241. See below for the list of accepted constants.
  5242. @end table
  5243. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5244. following constants:
  5245. @table @option
  5246. @item dar
  5247. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5248. @item hsub
  5249. @item vsub
  5250. horizontal and vertical chroma subsample values. For example for the
  5251. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5252. @item in_h, ih
  5253. @item in_w, iw
  5254. The input width and height.
  5255. @item sar
  5256. The input sample aspect ratio.
  5257. @item x
  5258. @item y
  5259. The x and y offset coordinates where the box is drawn.
  5260. @item w
  5261. @item h
  5262. The width and height of the drawn box.
  5263. @item t
  5264. The thickness of the drawn box.
  5265. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5266. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5267. @end table
  5268. @subsection Examples
  5269. @itemize
  5270. @item
  5271. Draw a black box around the edge of the input image:
  5272. @example
  5273. drawbox
  5274. @end example
  5275. @item
  5276. Draw a box with color red and an opacity of 50%:
  5277. @example
  5278. drawbox=10:20:200:60:red@@0.5
  5279. @end example
  5280. The previous example can be specified as:
  5281. @example
  5282. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5283. @end example
  5284. @item
  5285. Fill the box with pink color:
  5286. @example
  5287. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  5288. @end example
  5289. @item
  5290. Draw a 2-pixel red 2.40:1 mask:
  5291. @example
  5292. 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
  5293. @end example
  5294. @end itemize
  5295. @section drawgrid
  5296. Draw a grid on the input image.
  5297. It accepts the following parameters:
  5298. @table @option
  5299. @item x
  5300. @item y
  5301. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5302. @item width, w
  5303. @item height, h
  5304. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5305. input width and height, respectively, minus @code{thickness}, so image gets
  5306. framed. Default to 0.
  5307. @item color, c
  5308. Specify the color of the grid. For the general syntax of this option,
  5309. check the "Color" section in the ffmpeg-utils manual. If the special
  5310. value @code{invert} is used, the grid color is the same as the
  5311. video with inverted luma.
  5312. @item thickness, t
  5313. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5314. See below for the list of accepted constants.
  5315. @end table
  5316. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5317. following constants:
  5318. @table @option
  5319. @item dar
  5320. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5321. @item hsub
  5322. @item vsub
  5323. horizontal and vertical chroma subsample values. For example for the
  5324. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5325. @item in_h, ih
  5326. @item in_w, iw
  5327. The input grid cell width and height.
  5328. @item sar
  5329. The input sample aspect ratio.
  5330. @item x
  5331. @item y
  5332. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5333. @item w
  5334. @item h
  5335. The width and height of the drawn cell.
  5336. @item t
  5337. The thickness of the drawn cell.
  5338. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5339. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5340. @end table
  5341. @subsection Examples
  5342. @itemize
  5343. @item
  5344. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5345. @example
  5346. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5347. @end example
  5348. @item
  5349. Draw a white 3x3 grid with an opacity of 50%:
  5350. @example
  5351. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5352. @end example
  5353. @end itemize
  5354. @anchor{drawtext}
  5355. @section drawtext
  5356. Draw a text string or text from a specified file on top of a video, using the
  5357. libfreetype library.
  5358. To enable compilation of this filter, you need to configure FFmpeg with
  5359. @code{--enable-libfreetype}.
  5360. To enable default font fallback and the @var{font} option you need to
  5361. configure FFmpeg with @code{--enable-libfontconfig}.
  5362. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5363. @code{--enable-libfribidi}.
  5364. @subsection Syntax
  5365. It accepts the following parameters:
  5366. @table @option
  5367. @item box
  5368. Used to draw a box around text using the background color.
  5369. The value must be either 1 (enable) or 0 (disable).
  5370. The default value of @var{box} is 0.
  5371. @item boxborderw
  5372. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5373. The default value of @var{boxborderw} is 0.
  5374. @item boxcolor
  5375. The color to be used for drawing box around text. For the syntax of this
  5376. option, check the "Color" section in the ffmpeg-utils manual.
  5377. The default value of @var{boxcolor} is "white".
  5378. @item line_spacing
  5379. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  5380. The default value of @var{line_spacing} is 0.
  5381. @item borderw
  5382. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5383. The default value of @var{borderw} is 0.
  5384. @item bordercolor
  5385. Set the color to be used for drawing border around text. For the syntax of this
  5386. option, check the "Color" section in the ffmpeg-utils manual.
  5387. The default value of @var{bordercolor} is "black".
  5388. @item expansion
  5389. Select how the @var{text} is expanded. Can be either @code{none},
  5390. @code{strftime} (deprecated) or
  5391. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5392. below for details.
  5393. @item basetime
  5394. Set a start time for the count. Value is in microseconds. Only applied
  5395. in the deprecated strftime expansion mode. To emulate in normal expansion
  5396. mode use the @code{pts} function, supplying the start time (in seconds)
  5397. as the second argument.
  5398. @item fix_bounds
  5399. If true, check and fix text coords to avoid clipping.
  5400. @item fontcolor
  5401. The color to be used for drawing fonts. For the syntax of this option, check
  5402. the "Color" section in the ffmpeg-utils manual.
  5403. The default value of @var{fontcolor} is "black".
  5404. @item fontcolor_expr
  5405. String which is expanded the same way as @var{text} to obtain dynamic
  5406. @var{fontcolor} value. By default this option has empty value and is not
  5407. processed. When this option is set, it overrides @var{fontcolor} option.
  5408. @item font
  5409. The font family to be used for drawing text. By default Sans.
  5410. @item fontfile
  5411. The font file to be used for drawing text. The path must be included.
  5412. This parameter is mandatory if the fontconfig support is disabled.
  5413. @item alpha
  5414. Draw the text applying alpha blending. The value can
  5415. be a number between 0.0 and 1.0.
  5416. The expression accepts the same variables @var{x, y} as well.
  5417. The default value is 1.
  5418. Please see @var{fontcolor_expr}.
  5419. @item fontsize
  5420. The font size to be used for drawing text.
  5421. The default value of @var{fontsize} is 16.
  5422. @item text_shaping
  5423. If set to 1, attempt to shape the text (for example, reverse the order of
  5424. right-to-left text and join Arabic characters) before drawing it.
  5425. Otherwise, just draw the text exactly as given.
  5426. By default 1 (if supported).
  5427. @item ft_load_flags
  5428. The flags to be used for loading the fonts.
  5429. The flags map the corresponding flags supported by libfreetype, and are
  5430. a combination of the following values:
  5431. @table @var
  5432. @item default
  5433. @item no_scale
  5434. @item no_hinting
  5435. @item render
  5436. @item no_bitmap
  5437. @item vertical_layout
  5438. @item force_autohint
  5439. @item crop_bitmap
  5440. @item pedantic
  5441. @item ignore_global_advance_width
  5442. @item no_recurse
  5443. @item ignore_transform
  5444. @item monochrome
  5445. @item linear_design
  5446. @item no_autohint
  5447. @end table
  5448. Default value is "default".
  5449. For more information consult the documentation for the FT_LOAD_*
  5450. libfreetype flags.
  5451. @item shadowcolor
  5452. The color to be used for drawing a shadow behind the drawn text. For the
  5453. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  5454. The default value of @var{shadowcolor} is "black".
  5455. @item shadowx
  5456. @item shadowy
  5457. The x and y offsets for the text shadow position with respect to the
  5458. position of the text. They can be either positive or negative
  5459. values. The default value for both is "0".
  5460. @item start_number
  5461. The starting frame number for the n/frame_num variable. The default value
  5462. is "0".
  5463. @item tabsize
  5464. The size in number of spaces to use for rendering the tab.
  5465. Default value is 4.
  5466. @item timecode
  5467. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5468. format. It can be used with or without text parameter. @var{timecode_rate}
  5469. option must be specified.
  5470. @item timecode_rate, rate, r
  5471. Set the timecode frame rate (timecode only).
  5472. @item tc24hmax
  5473. If set to 1, the output of the timecode option will wrap around at 24 hours.
  5474. Default is 0 (disabled).
  5475. @item text
  5476. The text string to be drawn. The text must be a sequence of UTF-8
  5477. encoded characters.
  5478. This parameter is mandatory if no file is specified with the parameter
  5479. @var{textfile}.
  5480. @item textfile
  5481. A text file containing text to be drawn. The text must be a sequence
  5482. of UTF-8 encoded characters.
  5483. This parameter is mandatory if no text string is specified with the
  5484. parameter @var{text}.
  5485. If both @var{text} and @var{textfile} are specified, an error is thrown.
  5486. @item reload
  5487. If set to 1, the @var{textfile} will be reloaded before each frame.
  5488. Be sure to update it atomically, or it may be read partially, or even fail.
  5489. @item x
  5490. @item y
  5491. The expressions which specify the offsets where text will be drawn
  5492. within the video frame. They are relative to the top/left border of the
  5493. output image.
  5494. The default value of @var{x} and @var{y} is "0".
  5495. See below for the list of accepted constants and functions.
  5496. @end table
  5497. The parameters for @var{x} and @var{y} are expressions containing the
  5498. following constants and functions:
  5499. @table @option
  5500. @item dar
  5501. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  5502. @item hsub
  5503. @item vsub
  5504. horizontal and vertical chroma subsample values. For example for the
  5505. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5506. @item line_h, lh
  5507. the height of each text line
  5508. @item main_h, h, H
  5509. the input height
  5510. @item main_w, w, W
  5511. the input width
  5512. @item max_glyph_a, ascent
  5513. the maximum distance from the baseline to the highest/upper grid
  5514. coordinate used to place a glyph outline point, for all the rendered
  5515. glyphs.
  5516. It is a positive value, due to the grid's orientation with the Y axis
  5517. upwards.
  5518. @item max_glyph_d, descent
  5519. the maximum distance from the baseline to the lowest grid coordinate
  5520. used to place a glyph outline point, for all the rendered glyphs.
  5521. This is a negative value, due to the grid's orientation, with the Y axis
  5522. upwards.
  5523. @item max_glyph_h
  5524. maximum glyph height, that is the maximum height for all the glyphs
  5525. contained in the rendered text, it is equivalent to @var{ascent} -
  5526. @var{descent}.
  5527. @item max_glyph_w
  5528. maximum glyph width, that is the maximum width for all the glyphs
  5529. contained in the rendered text
  5530. @item n
  5531. the number of input frame, starting from 0
  5532. @item rand(min, max)
  5533. return a random number included between @var{min} and @var{max}
  5534. @item sar
  5535. The input sample aspect ratio.
  5536. @item t
  5537. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5538. @item text_h, th
  5539. the height of the rendered text
  5540. @item text_w, tw
  5541. the width of the rendered text
  5542. @item x
  5543. @item y
  5544. the x and y offset coordinates where the text is drawn.
  5545. These parameters allow the @var{x} and @var{y} expressions to refer
  5546. each other, so you can for example specify @code{y=x/dar}.
  5547. @end table
  5548. @anchor{drawtext_expansion}
  5549. @subsection Text expansion
  5550. If @option{expansion} is set to @code{strftime},
  5551. the filter recognizes strftime() sequences in the provided text and
  5552. expands them accordingly. Check the documentation of strftime(). This
  5553. feature is deprecated.
  5554. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  5555. If @option{expansion} is set to @code{normal} (which is the default),
  5556. the following expansion mechanism is used.
  5557. The backslash character @samp{\}, followed by any character, always expands to
  5558. the second character.
  5559. Sequences of the form @code{%@{...@}} are expanded. The text between the
  5560. braces is a function name, possibly followed by arguments separated by ':'.
  5561. If the arguments contain special characters or delimiters (':' or '@}'),
  5562. they should be escaped.
  5563. Note that they probably must also be escaped as the value for the
  5564. @option{text} option in the filter argument string and as the filter
  5565. argument in the filtergraph description, and possibly also for the shell,
  5566. that makes up to four levels of escaping; using a text file avoids these
  5567. problems.
  5568. The following functions are available:
  5569. @table @command
  5570. @item expr, e
  5571. The expression evaluation result.
  5572. It must take one argument specifying the expression to be evaluated,
  5573. which accepts the same constants and functions as the @var{x} and
  5574. @var{y} values. Note that not all constants should be used, for
  5575. example the text size is not known when evaluating the expression, so
  5576. the constants @var{text_w} and @var{text_h} will have an undefined
  5577. value.
  5578. @item expr_int_format, eif
  5579. Evaluate the expression's value and output as formatted integer.
  5580. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  5581. The second argument specifies the output format. Allowed values are @samp{x},
  5582. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  5583. @code{printf} function.
  5584. The third parameter is optional and sets the number of positions taken by the output.
  5585. It can be used to add padding with zeros from the left.
  5586. @item gmtime
  5587. The time at which the filter is running, expressed in UTC.
  5588. It can accept an argument: a strftime() format string.
  5589. @item localtime
  5590. The time at which the filter is running, expressed in the local time zone.
  5591. It can accept an argument: a strftime() format string.
  5592. @item metadata
  5593. Frame metadata. Takes one or two arguments.
  5594. The first argument is mandatory and specifies the metadata key.
  5595. The second argument is optional and specifies a default value, used when the
  5596. metadata key is not found or empty.
  5597. @item n, frame_num
  5598. The frame number, starting from 0.
  5599. @item pict_type
  5600. A 1 character description of the current picture type.
  5601. @item pts
  5602. The timestamp of the current frame.
  5603. It can take up to three arguments.
  5604. The first argument is the format of the timestamp; it defaults to @code{flt}
  5605. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  5606. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  5607. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  5608. @code{localtime} stands for the timestamp of the frame formatted as
  5609. local time zone time.
  5610. The second argument is an offset added to the timestamp.
  5611. If the format is set to @code{localtime} or @code{gmtime},
  5612. a third argument may be supplied: a strftime() format string.
  5613. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  5614. @end table
  5615. @subsection Examples
  5616. @itemize
  5617. @item
  5618. Draw "Test Text" with font FreeSerif, using the default values for the
  5619. optional parameters.
  5620. @example
  5621. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  5622. @end example
  5623. @item
  5624. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  5625. and y=50 (counting from the top-left corner of the screen), text is
  5626. yellow with a red box around it. Both the text and the box have an
  5627. opacity of 20%.
  5628. @example
  5629. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  5630. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  5631. @end example
  5632. Note that the double quotes are not necessary if spaces are not used
  5633. within the parameter list.
  5634. @item
  5635. Show the text at the center of the video frame:
  5636. @example
  5637. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  5638. @end example
  5639. @item
  5640. Show the text at a random position, switching to a new position every 30 seconds:
  5641. @example
  5642. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=if(eq(mod(t\,30)\,0)\,rand(0\,(w-text_w))\,x):y=if(eq(mod(t\,30)\,0)\,rand(0\,(h-text_h))\,y)"
  5643. @end example
  5644. @item
  5645. Show a text line sliding from right to left in the last row of the video
  5646. frame. The file @file{LONG_LINE} is assumed to contain a single line
  5647. with no newlines.
  5648. @example
  5649. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  5650. @end example
  5651. @item
  5652. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  5653. @example
  5654. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  5655. @end example
  5656. @item
  5657. Draw a single green letter "g", at the center of the input video.
  5658. The glyph baseline is placed at half screen height.
  5659. @example
  5660. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  5661. @end example
  5662. @item
  5663. Show text for 1 second every 3 seconds:
  5664. @example
  5665. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  5666. @end example
  5667. @item
  5668. Use fontconfig to set the font. Note that the colons need to be escaped.
  5669. @example
  5670. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  5671. @end example
  5672. @item
  5673. Print the date of a real-time encoding (see strftime(3)):
  5674. @example
  5675. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  5676. @end example
  5677. @item
  5678. Show text fading in and out (appearing/disappearing):
  5679. @example
  5680. #!/bin/sh
  5681. DS=1.0 # display start
  5682. DE=10.0 # display end
  5683. FID=1.5 # fade in duration
  5684. FOD=5 # fade out duration
  5685. 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 @}"
  5686. @end example
  5687. @item
  5688. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  5689. and the @option{fontsize} value are included in the @option{y} offset.
  5690. @example
  5691. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  5692. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  5693. @end example
  5694. @end itemize
  5695. For more information about libfreetype, check:
  5696. @url{http://www.freetype.org/}.
  5697. For more information about fontconfig, check:
  5698. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  5699. For more information about libfribidi, check:
  5700. @url{http://fribidi.org/}.
  5701. @section edgedetect
  5702. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  5703. The filter accepts the following options:
  5704. @table @option
  5705. @item low
  5706. @item high
  5707. Set low and high threshold values used by the Canny thresholding
  5708. algorithm.
  5709. The high threshold selects the "strong" edge pixels, which are then
  5710. connected through 8-connectivity with the "weak" edge pixels selected
  5711. by the low threshold.
  5712. @var{low} and @var{high} threshold values must be chosen in the range
  5713. [0,1], and @var{low} should be lesser or equal to @var{high}.
  5714. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  5715. is @code{50/255}.
  5716. @item mode
  5717. Define the drawing mode.
  5718. @table @samp
  5719. @item wires
  5720. Draw white/gray wires on black background.
  5721. @item colormix
  5722. Mix the colors to create a paint/cartoon effect.
  5723. @end table
  5724. Default value is @var{wires}.
  5725. @end table
  5726. @subsection Examples
  5727. @itemize
  5728. @item
  5729. Standard edge detection with custom values for the hysteresis thresholding:
  5730. @example
  5731. edgedetect=low=0.1:high=0.4
  5732. @end example
  5733. @item
  5734. Painting effect without thresholding:
  5735. @example
  5736. edgedetect=mode=colormix:high=0
  5737. @end example
  5738. @end itemize
  5739. @section eq
  5740. Set brightness, contrast, saturation and approximate gamma adjustment.
  5741. The filter accepts the following options:
  5742. @table @option
  5743. @item contrast
  5744. Set the contrast expression. The value must be a float value in range
  5745. @code{-2.0} to @code{2.0}. The default value is "1".
  5746. @item brightness
  5747. Set the brightness expression. The value must be a float value in
  5748. range @code{-1.0} to @code{1.0}. The default value is "0".
  5749. @item saturation
  5750. Set the saturation expression. The value must be a float in
  5751. range @code{0.0} to @code{3.0}. The default value is "1".
  5752. @item gamma
  5753. Set the gamma expression. The value must be a float in range
  5754. @code{0.1} to @code{10.0}. The default value is "1".
  5755. @item gamma_r
  5756. Set the gamma expression for red. The value must be a float in
  5757. range @code{0.1} to @code{10.0}. The default value is "1".
  5758. @item gamma_g
  5759. Set the gamma expression for green. The value must be a float in range
  5760. @code{0.1} to @code{10.0}. The default value is "1".
  5761. @item gamma_b
  5762. Set the gamma expression for blue. The value must be a float in range
  5763. @code{0.1} to @code{10.0}. The default value is "1".
  5764. @item gamma_weight
  5765. Set the gamma weight expression. It can be used to reduce the effect
  5766. of a high gamma value on bright image areas, e.g. keep them from
  5767. getting overamplified and just plain white. The value must be a float
  5768. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  5769. gamma correction all the way down while @code{1.0} leaves it at its
  5770. full strength. Default is "1".
  5771. @item eval
  5772. Set when the expressions for brightness, contrast, saturation and
  5773. gamma expressions are evaluated.
  5774. It accepts the following values:
  5775. @table @samp
  5776. @item init
  5777. only evaluate expressions once during the filter initialization or
  5778. when a command is processed
  5779. @item frame
  5780. evaluate expressions for each incoming frame
  5781. @end table
  5782. Default value is @samp{init}.
  5783. @end table
  5784. The expressions accept the following parameters:
  5785. @table @option
  5786. @item n
  5787. frame count of the input frame starting from 0
  5788. @item pos
  5789. byte position of the corresponding packet in the input file, NAN if
  5790. unspecified
  5791. @item r
  5792. frame rate of the input video, NAN if the input frame rate is unknown
  5793. @item t
  5794. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5795. @end table
  5796. @subsection Commands
  5797. The filter supports the following commands:
  5798. @table @option
  5799. @item contrast
  5800. Set the contrast expression.
  5801. @item brightness
  5802. Set the brightness expression.
  5803. @item saturation
  5804. Set the saturation expression.
  5805. @item gamma
  5806. Set the gamma expression.
  5807. @item gamma_r
  5808. Set the gamma_r expression.
  5809. @item gamma_g
  5810. Set gamma_g expression.
  5811. @item gamma_b
  5812. Set gamma_b expression.
  5813. @item gamma_weight
  5814. Set gamma_weight expression.
  5815. The command accepts the same syntax of the corresponding option.
  5816. If the specified expression is not valid, it is kept at its current
  5817. value.
  5818. @end table
  5819. @section erosion
  5820. Apply erosion effect to the video.
  5821. This filter replaces the pixel by the local(3x3) minimum.
  5822. It accepts the following options:
  5823. @table @option
  5824. @item threshold0
  5825. @item threshold1
  5826. @item threshold2
  5827. @item threshold3
  5828. Limit the maximum change for each plane, default is 65535.
  5829. If 0, plane will remain unchanged.
  5830. @item coordinates
  5831. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5832. pixels are used.
  5833. Flags to local 3x3 coordinates maps like this:
  5834. 1 2 3
  5835. 4 5
  5836. 6 7 8
  5837. @end table
  5838. @section extractplanes
  5839. Extract color channel components from input video stream into
  5840. separate grayscale video streams.
  5841. The filter accepts the following option:
  5842. @table @option
  5843. @item planes
  5844. Set plane(s) to extract.
  5845. Available values for planes are:
  5846. @table @samp
  5847. @item y
  5848. @item u
  5849. @item v
  5850. @item a
  5851. @item r
  5852. @item g
  5853. @item b
  5854. @end table
  5855. Choosing planes not available in the input will result in an error.
  5856. That means you cannot select @code{r}, @code{g}, @code{b} planes
  5857. with @code{y}, @code{u}, @code{v} planes at same time.
  5858. @end table
  5859. @subsection Examples
  5860. @itemize
  5861. @item
  5862. Extract luma, u and v color channel component from input video frame
  5863. into 3 grayscale outputs:
  5864. @example
  5865. 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
  5866. @end example
  5867. @end itemize
  5868. @section elbg
  5869. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  5870. For each input image, the filter will compute the optimal mapping from
  5871. the input to the output given the codebook length, that is the number
  5872. of distinct output colors.
  5873. This filter accepts the following options.
  5874. @table @option
  5875. @item codebook_length, l
  5876. Set codebook length. The value must be a positive integer, and
  5877. represents the number of distinct output colors. Default value is 256.
  5878. @item nb_steps, n
  5879. Set the maximum number of iterations to apply for computing the optimal
  5880. mapping. The higher the value the better the result and the higher the
  5881. computation time. Default value is 1.
  5882. @item seed, s
  5883. Set a random seed, must be an integer included between 0 and
  5884. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  5885. will try to use a good random seed on a best effort basis.
  5886. @item pal8
  5887. Set pal8 output pixel format. This option does not work with codebook
  5888. length greater than 256.
  5889. @end table
  5890. @section fade
  5891. Apply a fade-in/out effect to the input video.
  5892. It accepts the following parameters:
  5893. @table @option
  5894. @item type, t
  5895. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  5896. effect.
  5897. Default is @code{in}.
  5898. @item start_frame, s
  5899. Specify the number of the frame to start applying the fade
  5900. effect at. Default is 0.
  5901. @item nb_frames, n
  5902. The number of frames that the fade effect lasts. At the end of the
  5903. fade-in effect, the output video will have the same intensity as the input video.
  5904. At the end of the fade-out transition, the output video will be filled with the
  5905. selected @option{color}.
  5906. Default is 25.
  5907. @item alpha
  5908. If set to 1, fade only alpha channel, if one exists on the input.
  5909. Default value is 0.
  5910. @item start_time, st
  5911. Specify the timestamp (in seconds) of the frame to start to apply the fade
  5912. effect. If both start_frame and start_time are specified, the fade will start at
  5913. whichever comes last. Default is 0.
  5914. @item duration, d
  5915. The number of seconds for which the fade effect has to last. At the end of the
  5916. fade-in effect the output video will have the same intensity as the input video,
  5917. at the end of the fade-out transition the output video will be filled with the
  5918. selected @option{color}.
  5919. If both duration and nb_frames are specified, duration is used. Default is 0
  5920. (nb_frames is used by default).
  5921. @item color, c
  5922. Specify the color of the fade. Default is "black".
  5923. @end table
  5924. @subsection Examples
  5925. @itemize
  5926. @item
  5927. Fade in the first 30 frames of video:
  5928. @example
  5929. fade=in:0:30
  5930. @end example
  5931. The command above is equivalent to:
  5932. @example
  5933. fade=t=in:s=0:n=30
  5934. @end example
  5935. @item
  5936. Fade out the last 45 frames of a 200-frame video:
  5937. @example
  5938. fade=out:155:45
  5939. fade=type=out:start_frame=155:nb_frames=45
  5940. @end example
  5941. @item
  5942. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  5943. @example
  5944. fade=in:0:25, fade=out:975:25
  5945. @end example
  5946. @item
  5947. Make the first 5 frames yellow, then fade in from frame 5-24:
  5948. @example
  5949. fade=in:5:20:color=yellow
  5950. @end example
  5951. @item
  5952. Fade in alpha over first 25 frames of video:
  5953. @example
  5954. fade=in:0:25:alpha=1
  5955. @end example
  5956. @item
  5957. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  5958. @example
  5959. fade=t=in:st=5.5:d=0.5
  5960. @end example
  5961. @end itemize
  5962. @section fftfilt
  5963. Apply arbitrary expressions to samples in frequency domain
  5964. @table @option
  5965. @item dc_Y
  5966. Adjust the dc value (gain) of the luma plane of the image. The filter
  5967. accepts an integer value in range @code{0} to @code{1000}. The default
  5968. value is set to @code{0}.
  5969. @item dc_U
  5970. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  5971. filter accepts an integer value in range @code{0} to @code{1000}. The
  5972. default value is set to @code{0}.
  5973. @item dc_V
  5974. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  5975. filter accepts an integer value in range @code{0} to @code{1000}. The
  5976. default value is set to @code{0}.
  5977. @item weight_Y
  5978. Set the frequency domain weight expression for the luma plane.
  5979. @item weight_U
  5980. Set the frequency domain weight expression for the 1st chroma plane.
  5981. @item weight_V
  5982. Set the frequency domain weight expression for the 2nd chroma plane.
  5983. The filter accepts the following variables:
  5984. @item X
  5985. @item Y
  5986. The coordinates of the current sample.
  5987. @item W
  5988. @item H
  5989. The width and height of the image.
  5990. @end table
  5991. @subsection Examples
  5992. @itemize
  5993. @item
  5994. High-pass:
  5995. @example
  5996. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  5997. @end example
  5998. @item
  5999. Low-pass:
  6000. @example
  6001. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  6002. @end example
  6003. @item
  6004. Sharpen:
  6005. @example
  6006. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  6007. @end example
  6008. @item
  6009. Blur:
  6010. @example
  6011. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  6012. @end example
  6013. @end itemize
  6014. @section field
  6015. Extract a single field from an interlaced image using stride
  6016. arithmetic to avoid wasting CPU time. The output frames are marked as
  6017. non-interlaced.
  6018. The filter accepts the following options:
  6019. @table @option
  6020. @item type
  6021. Specify whether to extract the top (if the value is @code{0} or
  6022. @code{top}) or the bottom field (if the value is @code{1} or
  6023. @code{bottom}).
  6024. @end table
  6025. @section fieldhint
  6026. Create new frames by copying the top and bottom fields from surrounding frames
  6027. supplied as numbers by the hint file.
  6028. @table @option
  6029. @item hint
  6030. Set file containing hints: absolute/relative frame numbers.
  6031. There must be one line for each frame in a clip. Each line must contain two
  6032. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  6033. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  6034. is current frame number for @code{absolute} mode or out of [-1, 1] range
  6035. for @code{relative} mode. First number tells from which frame to pick up top
  6036. field and second number tells from which frame to pick up bottom field.
  6037. If optionally followed by @code{+} output frame will be marked as interlaced,
  6038. else if followed by @code{-} output frame will be marked as progressive, else
  6039. it will be marked same as input frame.
  6040. If line starts with @code{#} or @code{;} that line is skipped.
  6041. @item mode
  6042. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  6043. @end table
  6044. Example of first several lines of @code{hint} file for @code{relative} mode:
  6045. @example
  6046. 0,0 - # first frame
  6047. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  6048. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  6049. 1,0 -
  6050. 0,0 -
  6051. 0,0 -
  6052. 1,0 -
  6053. 1,0 -
  6054. 1,0 -
  6055. 0,0 -
  6056. 0,0 -
  6057. 1,0 -
  6058. 1,0 -
  6059. 1,0 -
  6060. 0,0 -
  6061. @end example
  6062. @section fieldmatch
  6063. Field matching filter for inverse telecine. It is meant to reconstruct the
  6064. progressive frames from a telecined stream. The filter does not drop duplicated
  6065. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  6066. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  6067. The separation of the field matching and the decimation is notably motivated by
  6068. the possibility of inserting a de-interlacing filter fallback between the two.
  6069. If the source has mixed telecined and real interlaced content,
  6070. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  6071. But these remaining combed frames will be marked as interlaced, and thus can be
  6072. de-interlaced by a later filter such as @ref{yadif} before decimation.
  6073. In addition to the various configuration options, @code{fieldmatch} can take an
  6074. optional second stream, activated through the @option{ppsrc} option. If
  6075. enabled, the frames reconstruction will be based on the fields and frames from
  6076. this second stream. This allows the first input to be pre-processed in order to
  6077. help the various algorithms of the filter, while keeping the output lossless
  6078. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  6079. or brightness/contrast adjustments can help.
  6080. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  6081. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  6082. which @code{fieldmatch} is based on. While the semantic and usage are very
  6083. close, some behaviour and options names can differ.
  6084. The @ref{decimate} filter currently only works for constant frame rate input.
  6085. If your input has mixed telecined (30fps) and progressive content with a lower
  6086. framerate like 24fps use the following filterchain to produce the necessary cfr
  6087. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  6088. The filter accepts the following options:
  6089. @table @option
  6090. @item order
  6091. Specify the assumed field order of the input stream. Available values are:
  6092. @table @samp
  6093. @item auto
  6094. Auto detect parity (use FFmpeg's internal parity value).
  6095. @item bff
  6096. Assume bottom field first.
  6097. @item tff
  6098. Assume top field first.
  6099. @end table
  6100. Note that it is sometimes recommended not to trust the parity announced by the
  6101. stream.
  6102. Default value is @var{auto}.
  6103. @item mode
  6104. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  6105. sense that it won't risk creating jerkiness due to duplicate frames when
  6106. possible, but if there are bad edits or blended fields it will end up
  6107. outputting combed frames when a good match might actually exist. On the other
  6108. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  6109. but will almost always find a good frame if there is one. The other values are
  6110. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  6111. jerkiness and creating duplicate frames versus finding good matches in sections
  6112. with bad edits, orphaned fields, blended fields, etc.
  6113. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  6114. Available values are:
  6115. @table @samp
  6116. @item pc
  6117. 2-way matching (p/c)
  6118. @item pc_n
  6119. 2-way matching, and trying 3rd match if still combed (p/c + n)
  6120. @item pc_u
  6121. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  6122. @item pc_n_ub
  6123. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  6124. still combed (p/c + n + u/b)
  6125. @item pcn
  6126. 3-way matching (p/c/n)
  6127. @item pcn_ub
  6128. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  6129. detected as combed (p/c/n + u/b)
  6130. @end table
  6131. The parenthesis at the end indicate the matches that would be used for that
  6132. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  6133. @var{top}).
  6134. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  6135. the slowest.
  6136. Default value is @var{pc_n}.
  6137. @item ppsrc
  6138. Mark the main input stream as a pre-processed input, and enable the secondary
  6139. input stream as the clean source to pick the fields from. See the filter
  6140. introduction for more details. It is similar to the @option{clip2} feature from
  6141. VFM/TFM.
  6142. Default value is @code{0} (disabled).
  6143. @item field
  6144. Set the field to match from. It is recommended to set this to the same value as
  6145. @option{order} unless you experience matching failures with that setting. In
  6146. certain circumstances changing the field that is used to match from can have a
  6147. large impact on matching performance. Available values are:
  6148. @table @samp
  6149. @item auto
  6150. Automatic (same value as @option{order}).
  6151. @item bottom
  6152. Match from the bottom field.
  6153. @item top
  6154. Match from the top field.
  6155. @end table
  6156. Default value is @var{auto}.
  6157. @item mchroma
  6158. Set whether or not chroma is included during the match comparisons. In most
  6159. cases it is recommended to leave this enabled. You should set this to @code{0}
  6160. only if your clip has bad chroma problems such as heavy rainbowing or other
  6161. artifacts. Setting this to @code{0} could also be used to speed things up at
  6162. the cost of some accuracy.
  6163. Default value is @code{1}.
  6164. @item y0
  6165. @item y1
  6166. These define an exclusion band which excludes the lines between @option{y0} and
  6167. @option{y1} from being included in the field matching decision. An exclusion
  6168. band can be used to ignore subtitles, a logo, or other things that may
  6169. interfere with the matching. @option{y0} sets the starting scan line and
  6170. @option{y1} sets the ending line; all lines in between @option{y0} and
  6171. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6172. @option{y0} and @option{y1} to the same value will disable the feature.
  6173. @option{y0} and @option{y1} defaults to @code{0}.
  6174. @item scthresh
  6175. Set the scene change detection threshold as a percentage of maximum change on
  6176. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6177. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6178. @option{scthresh} is @code{[0.0, 100.0]}.
  6179. Default value is @code{12.0}.
  6180. @item combmatch
  6181. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6182. account the combed scores of matches when deciding what match to use as the
  6183. final match. Available values are:
  6184. @table @samp
  6185. @item none
  6186. No final matching based on combed scores.
  6187. @item sc
  6188. Combed scores are only used when a scene change is detected.
  6189. @item full
  6190. Use combed scores all the time.
  6191. @end table
  6192. Default is @var{sc}.
  6193. @item combdbg
  6194. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  6195. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  6196. Available values are:
  6197. @table @samp
  6198. @item none
  6199. No forced calculation.
  6200. @item pcn
  6201. Force p/c/n calculations.
  6202. @item pcnub
  6203. Force p/c/n/u/b calculations.
  6204. @end table
  6205. Default value is @var{none}.
  6206. @item cthresh
  6207. This is the area combing threshold used for combed frame detection. This
  6208. essentially controls how "strong" or "visible" combing must be to be detected.
  6209. Larger values mean combing must be more visible and smaller values mean combing
  6210. can be less visible or strong and still be detected. Valid settings are from
  6211. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6212. be detected as combed). This is basically a pixel difference value. A good
  6213. range is @code{[8, 12]}.
  6214. Default value is @code{9}.
  6215. @item chroma
  6216. Sets whether or not chroma is considered in the combed frame decision. Only
  6217. disable this if your source has chroma problems (rainbowing, etc.) that are
  6218. causing problems for the combed frame detection with chroma enabled. Actually,
  6219. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6220. where there is chroma only combing in the source.
  6221. Default value is @code{0}.
  6222. @item blockx
  6223. @item blocky
  6224. Respectively set the x-axis and y-axis size of the window used during combed
  6225. frame detection. This has to do with the size of the area in which
  6226. @option{combpel} pixels are required to be detected as combed for a frame to be
  6227. declared combed. See the @option{combpel} parameter description for more info.
  6228. Possible values are any number that is a power of 2 starting at 4 and going up
  6229. to 512.
  6230. Default value is @code{16}.
  6231. @item combpel
  6232. The number of combed pixels inside any of the @option{blocky} by
  6233. @option{blockx} size blocks on the frame for the frame to be detected as
  6234. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6235. setting controls "how much" combing there must be in any localized area (a
  6236. window defined by the @option{blockx} and @option{blocky} settings) on the
  6237. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6238. which point no frames will ever be detected as combed). This setting is known
  6239. as @option{MI} in TFM/VFM vocabulary.
  6240. Default value is @code{80}.
  6241. @end table
  6242. @anchor{p/c/n/u/b meaning}
  6243. @subsection p/c/n/u/b meaning
  6244. @subsubsection p/c/n
  6245. We assume the following telecined stream:
  6246. @example
  6247. Top fields: 1 2 2 3 4
  6248. Bottom fields: 1 2 3 4 4
  6249. @end example
  6250. The numbers correspond to the progressive frame the fields relate to. Here, the
  6251. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6252. When @code{fieldmatch} is configured to run a matching from bottom
  6253. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6254. @example
  6255. Input stream:
  6256. T 1 2 2 3 4
  6257. B 1 2 3 4 4 <-- matching reference
  6258. Matches: c c n n c
  6259. Output stream:
  6260. T 1 2 3 4 4
  6261. B 1 2 3 4 4
  6262. @end example
  6263. As a result of the field matching, we can see that some frames get duplicated.
  6264. To perform a complete inverse telecine, you need to rely on a decimation filter
  6265. after this operation. See for instance the @ref{decimate} filter.
  6266. The same operation now matching from top fields (@option{field}=@var{top})
  6267. looks like this:
  6268. @example
  6269. Input stream:
  6270. T 1 2 2 3 4 <-- matching reference
  6271. B 1 2 3 4 4
  6272. Matches: c c p p c
  6273. Output stream:
  6274. T 1 2 2 3 4
  6275. B 1 2 2 3 4
  6276. @end example
  6277. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6278. basically, they refer to the frame and field of the opposite parity:
  6279. @itemize
  6280. @item @var{p} matches the field of the opposite parity in the previous frame
  6281. @item @var{c} matches the field of the opposite parity in the current frame
  6282. @item @var{n} matches the field of the opposite parity in the next frame
  6283. @end itemize
  6284. @subsubsection u/b
  6285. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6286. from the opposite parity flag. In the following examples, we assume that we are
  6287. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6288. 'x' is placed above and below each matched fields.
  6289. With bottom matching (@option{field}=@var{bottom}):
  6290. @example
  6291. Match: c p n b u
  6292. x x x x x
  6293. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6294. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6295. x x x x x
  6296. Output frames:
  6297. 2 1 2 2 2
  6298. 2 2 2 1 3
  6299. @end example
  6300. With top matching (@option{field}=@var{top}):
  6301. @example
  6302. Match: c p n b u
  6303. x x x x x
  6304. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6305. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6306. x x x x x
  6307. Output frames:
  6308. 2 2 2 1 2
  6309. 2 1 3 2 2
  6310. @end example
  6311. @subsection Examples
  6312. Simple IVTC of a top field first telecined stream:
  6313. @example
  6314. fieldmatch=order=tff:combmatch=none, decimate
  6315. @end example
  6316. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6317. @example
  6318. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6319. @end example
  6320. @section fieldorder
  6321. Transform the field order of the input video.
  6322. It accepts the following parameters:
  6323. @table @option
  6324. @item order
  6325. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6326. for bottom field first.
  6327. @end table
  6328. The default value is @samp{tff}.
  6329. The transformation is done by shifting the picture content up or down
  6330. by one line, and filling the remaining line with appropriate picture content.
  6331. This method is consistent with most broadcast field order converters.
  6332. If the input video is not flagged as being interlaced, or it is already
  6333. flagged as being of the required output field order, then this filter does
  6334. not alter the incoming video.
  6335. It is very useful when converting to or from PAL DV material,
  6336. which is bottom field first.
  6337. For example:
  6338. @example
  6339. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6340. @end example
  6341. @section fifo, afifo
  6342. Buffer input images and send them when they are requested.
  6343. It is mainly useful when auto-inserted by the libavfilter
  6344. framework.
  6345. It does not take parameters.
  6346. @section find_rect
  6347. Find a rectangular object
  6348. It accepts the following options:
  6349. @table @option
  6350. @item object
  6351. Filepath of the object image, needs to be in gray8.
  6352. @item threshold
  6353. Detection threshold, default is 0.5.
  6354. @item mipmaps
  6355. Number of mipmaps, default is 3.
  6356. @item xmin, ymin, xmax, ymax
  6357. Specifies the rectangle in which to search.
  6358. @end table
  6359. @subsection Examples
  6360. @itemize
  6361. @item
  6362. Generate a representative palette of a given video using @command{ffmpeg}:
  6363. @example
  6364. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6365. @end example
  6366. @end itemize
  6367. @section cover_rect
  6368. Cover a rectangular object
  6369. It accepts the following options:
  6370. @table @option
  6371. @item cover
  6372. Filepath of the optional cover image, needs to be in yuv420.
  6373. @item mode
  6374. Set covering mode.
  6375. It accepts the following values:
  6376. @table @samp
  6377. @item cover
  6378. cover it by the supplied image
  6379. @item blur
  6380. cover it by interpolating the surrounding pixels
  6381. @end table
  6382. Default value is @var{blur}.
  6383. @end table
  6384. @subsection Examples
  6385. @itemize
  6386. @item
  6387. Generate a representative palette of a given video using @command{ffmpeg}:
  6388. @example
  6389. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6390. @end example
  6391. @end itemize
  6392. @anchor{format}
  6393. @section format
  6394. Convert the input video to one of the specified pixel formats.
  6395. Libavfilter will try to pick one that is suitable as input to
  6396. the next filter.
  6397. It accepts the following parameters:
  6398. @table @option
  6399. @item pix_fmts
  6400. A '|'-separated list of pixel format names, such as
  6401. "pix_fmts=yuv420p|monow|rgb24".
  6402. @end table
  6403. @subsection Examples
  6404. @itemize
  6405. @item
  6406. Convert the input video to the @var{yuv420p} format
  6407. @example
  6408. format=pix_fmts=yuv420p
  6409. @end example
  6410. Convert the input video to any of the formats in the list
  6411. @example
  6412. format=pix_fmts=yuv420p|yuv444p|yuv410p
  6413. @end example
  6414. @end itemize
  6415. @anchor{fps}
  6416. @section fps
  6417. Convert the video to specified constant frame rate by duplicating or dropping
  6418. frames as necessary.
  6419. It accepts the following parameters:
  6420. @table @option
  6421. @item fps
  6422. The desired output frame rate. The default is @code{25}.
  6423. @item round
  6424. Rounding method.
  6425. Possible values are:
  6426. @table @option
  6427. @item zero
  6428. zero round towards 0
  6429. @item inf
  6430. round away from 0
  6431. @item down
  6432. round towards -infinity
  6433. @item up
  6434. round towards +infinity
  6435. @item near
  6436. round to nearest
  6437. @end table
  6438. The default is @code{near}.
  6439. @item start_time
  6440. Assume the first PTS should be the given value, in seconds. This allows for
  6441. padding/trimming at the start of stream. By default, no assumption is made
  6442. about the first frame's expected PTS, so no padding or trimming is done.
  6443. For example, this could be set to 0 to pad the beginning with duplicates of
  6444. the first frame if a video stream starts after the audio stream or to trim any
  6445. frames with a negative PTS.
  6446. @end table
  6447. Alternatively, the options can be specified as a flat string:
  6448. @var{fps}[:@var{round}].
  6449. See also the @ref{setpts} filter.
  6450. @subsection Examples
  6451. @itemize
  6452. @item
  6453. A typical usage in order to set the fps to 25:
  6454. @example
  6455. fps=fps=25
  6456. @end example
  6457. @item
  6458. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  6459. @example
  6460. fps=fps=film:round=near
  6461. @end example
  6462. @end itemize
  6463. @section framepack
  6464. Pack two different video streams into a stereoscopic video, setting proper
  6465. metadata on supported codecs. The two views should have the same size and
  6466. framerate and processing will stop when the shorter video ends. Please note
  6467. that you may conveniently adjust view properties with the @ref{scale} and
  6468. @ref{fps} filters.
  6469. It accepts the following parameters:
  6470. @table @option
  6471. @item format
  6472. The desired packing format. Supported values are:
  6473. @table @option
  6474. @item sbs
  6475. The views are next to each other (default).
  6476. @item tab
  6477. The views are on top of each other.
  6478. @item lines
  6479. The views are packed by line.
  6480. @item columns
  6481. The views are packed by column.
  6482. @item frameseq
  6483. The views are temporally interleaved.
  6484. @end table
  6485. @end table
  6486. Some examples:
  6487. @example
  6488. # Convert left and right views into a frame-sequential video
  6489. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  6490. # Convert views into a side-by-side video with the same output resolution as the input
  6491. 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
  6492. @end example
  6493. @section framerate
  6494. Change the frame rate by interpolating new video output frames from the source
  6495. frames.
  6496. This filter is not designed to function correctly with interlaced media. If
  6497. you wish to change the frame rate of interlaced media then you are required
  6498. to deinterlace before this filter and re-interlace after this filter.
  6499. A description of the accepted options follows.
  6500. @table @option
  6501. @item fps
  6502. Specify the output frames per second. This option can also be specified
  6503. as a value alone. The default is @code{50}.
  6504. @item interp_start
  6505. Specify the start of a range where the output frame will be created as a
  6506. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6507. the default is @code{15}.
  6508. @item interp_end
  6509. Specify the end of a range where the output frame will be created as a
  6510. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6511. the default is @code{240}.
  6512. @item scene
  6513. Specify the level at which a scene change is detected as a value between
  6514. 0 and 100 to indicate a new scene; a low value reflects a low
  6515. probability for the current frame to introduce a new scene, while a higher
  6516. value means the current frame is more likely to be one.
  6517. The default is @code{7}.
  6518. @item flags
  6519. Specify flags influencing the filter process.
  6520. Available value for @var{flags} is:
  6521. @table @option
  6522. @item scene_change_detect, scd
  6523. Enable scene change detection using the value of the option @var{scene}.
  6524. This flag is enabled by default.
  6525. @end table
  6526. @end table
  6527. @section framestep
  6528. Select one frame every N-th frame.
  6529. This filter accepts the following option:
  6530. @table @option
  6531. @item step
  6532. Select frame after every @code{step} frames.
  6533. Allowed values are positive integers higher than 0. Default value is @code{1}.
  6534. @end table
  6535. @anchor{frei0r}
  6536. @section frei0r
  6537. Apply a frei0r effect to the input video.
  6538. To enable the compilation of this filter, you need to install the frei0r
  6539. header and configure FFmpeg with @code{--enable-frei0r}.
  6540. It accepts the following parameters:
  6541. @table @option
  6542. @item filter_name
  6543. The name of the frei0r effect to load. If the environment variable
  6544. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  6545. directories specified by the colon-separated list in @env{FREIOR_PATH}.
  6546. Otherwise, the standard frei0r paths are searched, in this order:
  6547. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  6548. @file{/usr/lib/frei0r-1/}.
  6549. @item filter_params
  6550. A '|'-separated list of parameters to pass to the frei0r effect.
  6551. @end table
  6552. A frei0r effect parameter can be a boolean (its value is either
  6553. "y" or "n"), a double, a color (specified as
  6554. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  6555. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  6556. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  6557. @var{X} and @var{Y} are floating point numbers) and/or a string.
  6558. The number and types of parameters depend on the loaded effect. If an
  6559. effect parameter is not specified, the default value is set.
  6560. @subsection Examples
  6561. @itemize
  6562. @item
  6563. Apply the distort0r effect, setting the first two double parameters:
  6564. @example
  6565. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  6566. @end example
  6567. @item
  6568. Apply the colordistance effect, taking a color as the first parameter:
  6569. @example
  6570. frei0r=colordistance:0.2/0.3/0.4
  6571. frei0r=colordistance:violet
  6572. frei0r=colordistance:0x112233
  6573. @end example
  6574. @item
  6575. Apply the perspective effect, specifying the top left and top right image
  6576. positions:
  6577. @example
  6578. frei0r=perspective:0.2/0.2|0.8/0.2
  6579. @end example
  6580. @end itemize
  6581. For more information, see
  6582. @url{http://frei0r.dyne.org}
  6583. @section fspp
  6584. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  6585. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  6586. processing filter, one of them is performed once per block, not per pixel.
  6587. This allows for much higher speed.
  6588. The filter accepts the following options:
  6589. @table @option
  6590. @item quality
  6591. Set quality. This option defines the number of levels for averaging. It accepts
  6592. an integer in the range 4-5. Default value is @code{4}.
  6593. @item qp
  6594. Force a constant quantization parameter. It accepts an integer in range 0-63.
  6595. If not set, the filter will use the QP from the video stream (if available).
  6596. @item strength
  6597. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  6598. more details but also more artifacts, while higher values make the image smoother
  6599. but also blurrier. Default value is @code{0} − PSNR optimal.
  6600. @item use_bframe_qp
  6601. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  6602. option may cause flicker since the B-Frames have often larger QP. Default is
  6603. @code{0} (not enabled).
  6604. @end table
  6605. @section gblur
  6606. Apply Gaussian blur filter.
  6607. The filter accepts the following options:
  6608. @table @option
  6609. @item sigma
  6610. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  6611. @item steps
  6612. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  6613. @item planes
  6614. Set which planes to filter. By default all planes are filtered.
  6615. @item sigmaV
  6616. Set vertical sigma, if negative it will be same as @code{sigma}.
  6617. Default is @code{-1}.
  6618. @end table
  6619. @section geq
  6620. The filter accepts the following options:
  6621. @table @option
  6622. @item lum_expr, lum
  6623. Set the luminance expression.
  6624. @item cb_expr, cb
  6625. Set the chrominance blue expression.
  6626. @item cr_expr, cr
  6627. Set the chrominance red expression.
  6628. @item alpha_expr, a
  6629. Set the alpha expression.
  6630. @item red_expr, r
  6631. Set the red expression.
  6632. @item green_expr, g
  6633. Set the green expression.
  6634. @item blue_expr, b
  6635. Set the blue expression.
  6636. @end table
  6637. The colorspace is selected according to the specified options. If one
  6638. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  6639. options is specified, the filter will automatically select a YCbCr
  6640. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  6641. @option{blue_expr} options is specified, it will select an RGB
  6642. colorspace.
  6643. If one of the chrominance expression is not defined, it falls back on the other
  6644. one. If no alpha expression is specified it will evaluate to opaque value.
  6645. If none of chrominance expressions are specified, they will evaluate
  6646. to the luminance expression.
  6647. The expressions can use the following variables and functions:
  6648. @table @option
  6649. @item N
  6650. The sequential number of the filtered frame, starting from @code{0}.
  6651. @item X
  6652. @item Y
  6653. The coordinates of the current sample.
  6654. @item W
  6655. @item H
  6656. The width and height of the image.
  6657. @item SW
  6658. @item SH
  6659. Width and height scale depending on the currently filtered plane. It is the
  6660. ratio between the corresponding luma plane number of pixels and the current
  6661. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  6662. @code{0.5,0.5} for chroma planes.
  6663. @item T
  6664. Time of the current frame, expressed in seconds.
  6665. @item p(x, y)
  6666. Return the value of the pixel at location (@var{x},@var{y}) of the current
  6667. plane.
  6668. @item lum(x, y)
  6669. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  6670. plane.
  6671. @item cb(x, y)
  6672. Return the value of the pixel at location (@var{x},@var{y}) of the
  6673. blue-difference chroma plane. Return 0 if there is no such plane.
  6674. @item cr(x, y)
  6675. Return the value of the pixel at location (@var{x},@var{y}) of the
  6676. red-difference chroma plane. Return 0 if there is no such plane.
  6677. @item r(x, y)
  6678. @item g(x, y)
  6679. @item b(x, y)
  6680. Return the value of the pixel at location (@var{x},@var{y}) of the
  6681. red/green/blue component. Return 0 if there is no such component.
  6682. @item alpha(x, y)
  6683. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  6684. plane. Return 0 if there is no such plane.
  6685. @end table
  6686. For functions, if @var{x} and @var{y} are outside the area, the value will be
  6687. automatically clipped to the closer edge.
  6688. @subsection Examples
  6689. @itemize
  6690. @item
  6691. Flip the image horizontally:
  6692. @example
  6693. geq=p(W-X\,Y)
  6694. @end example
  6695. @item
  6696. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  6697. wavelength of 100 pixels:
  6698. @example
  6699. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  6700. @end example
  6701. @item
  6702. Generate a fancy enigmatic moving light:
  6703. @example
  6704. 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
  6705. @end example
  6706. @item
  6707. Generate a quick emboss effect:
  6708. @example
  6709. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  6710. @end example
  6711. @item
  6712. Modify RGB components depending on pixel position:
  6713. @example
  6714. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  6715. @end example
  6716. @item
  6717. Create a radial gradient that is the same size as the input (also see
  6718. the @ref{vignette} filter):
  6719. @example
  6720. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  6721. @end example
  6722. @end itemize
  6723. @section gradfun
  6724. Fix the banding artifacts that are sometimes introduced into nearly flat
  6725. regions by truncation to 8-bit color depth.
  6726. Interpolate the gradients that should go where the bands are, and
  6727. dither them.
  6728. It is designed for playback only. Do not use it prior to
  6729. lossy compression, because compression tends to lose the dither and
  6730. bring back the bands.
  6731. It accepts the following parameters:
  6732. @table @option
  6733. @item strength
  6734. The maximum amount by which the filter will change any one pixel. This is also
  6735. the threshold for detecting nearly flat regions. Acceptable values range from
  6736. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  6737. valid range.
  6738. @item radius
  6739. The neighborhood to fit the gradient to. A larger radius makes for smoother
  6740. gradients, but also prevents the filter from modifying the pixels near detailed
  6741. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  6742. values will be clipped to the valid range.
  6743. @end table
  6744. Alternatively, the options can be specified as a flat string:
  6745. @var{strength}[:@var{radius}]
  6746. @subsection Examples
  6747. @itemize
  6748. @item
  6749. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  6750. @example
  6751. gradfun=3.5:8
  6752. @end example
  6753. @item
  6754. Specify radius, omitting the strength (which will fall-back to the default
  6755. value):
  6756. @example
  6757. gradfun=radius=8
  6758. @end example
  6759. @end itemize
  6760. @anchor{haldclut}
  6761. @section haldclut
  6762. Apply a Hald CLUT to a video stream.
  6763. First input is the video stream to process, and second one is the Hald CLUT.
  6764. The Hald CLUT input can be a simple picture or a complete video stream.
  6765. The filter accepts the following options:
  6766. @table @option
  6767. @item shortest
  6768. Force termination when the shortest input terminates. Default is @code{0}.
  6769. @item repeatlast
  6770. Continue applying the last CLUT after the end of the stream. A value of
  6771. @code{0} disable the filter after the last frame of the CLUT is reached.
  6772. Default is @code{1}.
  6773. @end table
  6774. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  6775. filters share the same internals).
  6776. More information about the Hald CLUT can be found on Eskil Steenberg's website
  6777. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  6778. @subsection Workflow examples
  6779. @subsubsection Hald CLUT video stream
  6780. Generate an identity Hald CLUT stream altered with various effects:
  6781. @example
  6782. 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
  6783. @end example
  6784. Note: make sure you use a lossless codec.
  6785. Then use it with @code{haldclut} to apply it on some random stream:
  6786. @example
  6787. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  6788. @end example
  6789. The Hald CLUT will be applied to the 10 first seconds (duration of
  6790. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  6791. to the remaining frames of the @code{mandelbrot} stream.
  6792. @subsubsection Hald CLUT with preview
  6793. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  6794. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  6795. biggest possible square starting at the top left of the picture. The remaining
  6796. padding pixels (bottom or right) will be ignored. This area can be used to add
  6797. a preview of the Hald CLUT.
  6798. Typically, the following generated Hald CLUT will be supported by the
  6799. @code{haldclut} filter:
  6800. @example
  6801. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  6802. pad=iw+320 [padded_clut];
  6803. smptebars=s=320x256, split [a][b];
  6804. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  6805. [main][b] overlay=W-320" -frames:v 1 clut.png
  6806. @end example
  6807. It contains the original and a preview of the effect of the CLUT: SMPTE color
  6808. bars are displayed on the right-top, and below the same color bars processed by
  6809. the color changes.
  6810. Then, the effect of this Hald CLUT can be visualized with:
  6811. @example
  6812. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  6813. @end example
  6814. @section hflip
  6815. Flip the input video horizontally.
  6816. For example, to horizontally flip the input video with @command{ffmpeg}:
  6817. @example
  6818. ffmpeg -i in.avi -vf "hflip" out.avi
  6819. @end example
  6820. @section histeq
  6821. This filter applies a global color histogram equalization on a
  6822. per-frame basis.
  6823. It can be used to correct video that has a compressed range of pixel
  6824. intensities. The filter redistributes the pixel intensities to
  6825. equalize their distribution across the intensity range. It may be
  6826. viewed as an "automatically adjusting contrast filter". This filter is
  6827. useful only for correcting degraded or poorly captured source
  6828. video.
  6829. The filter accepts the following options:
  6830. @table @option
  6831. @item strength
  6832. Determine the amount of equalization to be applied. As the strength
  6833. is reduced, the distribution of pixel intensities more-and-more
  6834. approaches that of the input frame. The value must be a float number
  6835. in the range [0,1] and defaults to 0.200.
  6836. @item intensity
  6837. Set the maximum intensity that can generated and scale the output
  6838. values appropriately. The strength should be set as desired and then
  6839. the intensity can be limited if needed to avoid washing-out. The value
  6840. must be a float number in the range [0,1] and defaults to 0.210.
  6841. @item antibanding
  6842. Set the antibanding level. If enabled the filter will randomly vary
  6843. the luminance of output pixels by a small amount to avoid banding of
  6844. the histogram. Possible values are @code{none}, @code{weak} or
  6845. @code{strong}. It defaults to @code{none}.
  6846. @end table
  6847. @section histogram
  6848. Compute and draw a color distribution histogram for the input video.
  6849. The computed histogram is a representation of the color component
  6850. distribution in an image.
  6851. Standard histogram displays the color components distribution in an image.
  6852. Displays color graph for each color component. Shows distribution of
  6853. the Y, U, V, A or R, G, B components, depending on input format, in the
  6854. current frame. Below each graph a color component scale meter is shown.
  6855. The filter accepts the following options:
  6856. @table @option
  6857. @item level_height
  6858. Set height of level. Default value is @code{200}.
  6859. Allowed range is [50, 2048].
  6860. @item scale_height
  6861. Set height of color scale. Default value is @code{12}.
  6862. Allowed range is [0, 40].
  6863. @item display_mode
  6864. Set display mode.
  6865. It accepts the following values:
  6866. @table @samp
  6867. @item stack
  6868. Per color component graphs are placed below each other.
  6869. @item parade
  6870. Per color component graphs are placed side by side.
  6871. @item overlay
  6872. Presents information identical to that in the @code{parade}, except
  6873. that the graphs representing color components are superimposed directly
  6874. over one another.
  6875. @end table
  6876. Default is @code{stack}.
  6877. @item levels_mode
  6878. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  6879. Default is @code{linear}.
  6880. @item components
  6881. Set what color components to display.
  6882. Default is @code{7}.
  6883. @item fgopacity
  6884. Set foreground opacity. Default is @code{0.7}.
  6885. @item bgopacity
  6886. Set background opacity. Default is @code{0.5}.
  6887. @end table
  6888. @subsection Examples
  6889. @itemize
  6890. @item
  6891. Calculate and draw histogram:
  6892. @example
  6893. ffplay -i input -vf histogram
  6894. @end example
  6895. @end itemize
  6896. @anchor{hqdn3d}
  6897. @section hqdn3d
  6898. This is a high precision/quality 3d denoise filter. It aims to reduce
  6899. image noise, producing smooth images and making still images really
  6900. still. It should enhance compressibility.
  6901. It accepts the following optional parameters:
  6902. @table @option
  6903. @item luma_spatial
  6904. A non-negative floating point number which specifies spatial luma strength.
  6905. It defaults to 4.0.
  6906. @item chroma_spatial
  6907. A non-negative floating point number which specifies spatial chroma strength.
  6908. It defaults to 3.0*@var{luma_spatial}/4.0.
  6909. @item luma_tmp
  6910. A floating point number which specifies luma temporal strength. It defaults to
  6911. 6.0*@var{luma_spatial}/4.0.
  6912. @item chroma_tmp
  6913. A floating point number which specifies chroma temporal strength. It defaults to
  6914. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  6915. @end table
  6916. @anchor{hwupload_cuda}
  6917. @section hwupload_cuda
  6918. Upload system memory frames to a CUDA device.
  6919. It accepts the following optional parameters:
  6920. @table @option
  6921. @item device
  6922. The number of the CUDA device to use
  6923. @end table
  6924. @section hqx
  6925. Apply a high-quality magnification filter designed for pixel art. This filter
  6926. was originally created by Maxim Stepin.
  6927. It accepts the following option:
  6928. @table @option
  6929. @item n
  6930. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  6931. @code{hq3x} and @code{4} for @code{hq4x}.
  6932. Default is @code{3}.
  6933. @end table
  6934. @section hstack
  6935. Stack input videos horizontally.
  6936. All streams must be of same pixel format and of same height.
  6937. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  6938. to create same output.
  6939. The filter accept the following option:
  6940. @table @option
  6941. @item inputs
  6942. Set number of input streams. Default is 2.
  6943. @item shortest
  6944. If set to 1, force the output to terminate when the shortest input
  6945. terminates. Default value is 0.
  6946. @end table
  6947. @section hue
  6948. Modify the hue and/or the saturation of the input.
  6949. It accepts the following parameters:
  6950. @table @option
  6951. @item h
  6952. Specify the hue angle as a number of degrees. It accepts an expression,
  6953. and defaults to "0".
  6954. @item s
  6955. Specify the saturation in the [-10,10] range. It accepts an expression and
  6956. defaults to "1".
  6957. @item H
  6958. Specify the hue angle as a number of radians. It accepts an
  6959. expression, and defaults to "0".
  6960. @item b
  6961. Specify the brightness in the [-10,10] range. It accepts an expression and
  6962. defaults to "0".
  6963. @end table
  6964. @option{h} and @option{H} are mutually exclusive, and can't be
  6965. specified at the same time.
  6966. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  6967. expressions containing the following constants:
  6968. @table @option
  6969. @item n
  6970. frame count of the input frame starting from 0
  6971. @item pts
  6972. presentation timestamp of the input frame expressed in time base units
  6973. @item r
  6974. frame rate of the input video, NAN if the input frame rate is unknown
  6975. @item t
  6976. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6977. @item tb
  6978. time base of the input video
  6979. @end table
  6980. @subsection Examples
  6981. @itemize
  6982. @item
  6983. Set the hue to 90 degrees and the saturation to 1.0:
  6984. @example
  6985. hue=h=90:s=1
  6986. @end example
  6987. @item
  6988. Same command but expressing the hue in radians:
  6989. @example
  6990. hue=H=PI/2:s=1
  6991. @end example
  6992. @item
  6993. Rotate hue and make the saturation swing between 0
  6994. and 2 over a period of 1 second:
  6995. @example
  6996. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  6997. @end example
  6998. @item
  6999. Apply a 3 seconds saturation fade-in effect starting at 0:
  7000. @example
  7001. hue="s=min(t/3\,1)"
  7002. @end example
  7003. The general fade-in expression can be written as:
  7004. @example
  7005. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  7006. @end example
  7007. @item
  7008. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  7009. @example
  7010. hue="s=max(0\, min(1\, (8-t)/3))"
  7011. @end example
  7012. The general fade-out expression can be written as:
  7013. @example
  7014. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  7015. @end example
  7016. @end itemize
  7017. @subsection Commands
  7018. This filter supports the following commands:
  7019. @table @option
  7020. @item b
  7021. @item s
  7022. @item h
  7023. @item H
  7024. Modify the hue and/or the saturation and/or brightness of the input video.
  7025. The command accepts the same syntax of the corresponding option.
  7026. If the specified expression is not valid, it is kept at its current
  7027. value.
  7028. @end table
  7029. @section hysteresis
  7030. Grow first stream into second stream by connecting components.
  7031. This makes it possible to build more robust edge masks.
  7032. This filter accepts the following options:
  7033. @table @option
  7034. @item planes
  7035. Set which planes will be processed as bitmap, unprocessed planes will be
  7036. copied from first stream.
  7037. By default value 0xf, all planes will be processed.
  7038. @item threshold
  7039. Set threshold which is used in filtering. If pixel component value is higher than
  7040. this value filter algorithm for connecting components is activated.
  7041. By default value is 0.
  7042. @end table
  7043. @section idet
  7044. Detect video interlacing type.
  7045. This filter tries to detect if the input frames are interlaced, progressive,
  7046. top or bottom field first. It will also try to detect fields that are
  7047. repeated between adjacent frames (a sign of telecine).
  7048. Single frame detection considers only immediately adjacent frames when classifying each frame.
  7049. Multiple frame detection incorporates the classification history of previous frames.
  7050. The filter will log these metadata values:
  7051. @table @option
  7052. @item single.current_frame
  7053. Detected type of current frame using single-frame detection. One of:
  7054. ``tff'' (top field first), ``bff'' (bottom field first),
  7055. ``progressive'', or ``undetermined''
  7056. @item single.tff
  7057. Cumulative number of frames detected as top field first using single-frame detection.
  7058. @item multiple.tff
  7059. Cumulative number of frames detected as top field first using multiple-frame detection.
  7060. @item single.bff
  7061. Cumulative number of frames detected as bottom field first using single-frame detection.
  7062. @item multiple.current_frame
  7063. Detected type of current frame using multiple-frame detection. One of:
  7064. ``tff'' (top field first), ``bff'' (bottom field first),
  7065. ``progressive'', or ``undetermined''
  7066. @item multiple.bff
  7067. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  7068. @item single.progressive
  7069. Cumulative number of frames detected as progressive using single-frame detection.
  7070. @item multiple.progressive
  7071. Cumulative number of frames detected as progressive using multiple-frame detection.
  7072. @item single.undetermined
  7073. Cumulative number of frames that could not be classified using single-frame detection.
  7074. @item multiple.undetermined
  7075. Cumulative number of frames that could not be classified using multiple-frame detection.
  7076. @item repeated.current_frame
  7077. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  7078. @item repeated.neither
  7079. Cumulative number of frames with no repeated field.
  7080. @item repeated.top
  7081. Cumulative number of frames with the top field repeated from the previous frame's top field.
  7082. @item repeated.bottom
  7083. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  7084. @end table
  7085. The filter accepts the following options:
  7086. @table @option
  7087. @item intl_thres
  7088. Set interlacing threshold.
  7089. @item prog_thres
  7090. Set progressive threshold.
  7091. @item rep_thres
  7092. Threshold for repeated field detection.
  7093. @item half_life
  7094. Number of frames after which a given frame's contribution to the
  7095. statistics is halved (i.e., it contributes only 0.5 to its
  7096. classification). The default of 0 means that all frames seen are given
  7097. full weight of 1.0 forever.
  7098. @item analyze_interlaced_flag
  7099. When this is not 0 then idet will use the specified number of frames to determine
  7100. if the interlaced flag is accurate, it will not count undetermined frames.
  7101. If the flag is found to be accurate it will be used without any further
  7102. computations, if it is found to be inaccurate it will be cleared without any
  7103. further computations. This allows inserting the idet filter as a low computational
  7104. method to clean up the interlaced flag
  7105. @end table
  7106. @section il
  7107. Deinterleave or interleave fields.
  7108. This filter allows one to process interlaced images fields without
  7109. deinterlacing them. Deinterleaving splits the input frame into 2
  7110. fields (so called half pictures). Odd lines are moved to the top
  7111. half of the output image, even lines to the bottom half.
  7112. You can process (filter) them independently and then re-interleave them.
  7113. The filter accepts the following options:
  7114. @table @option
  7115. @item luma_mode, l
  7116. @item chroma_mode, c
  7117. @item alpha_mode, a
  7118. Available values for @var{luma_mode}, @var{chroma_mode} and
  7119. @var{alpha_mode} are:
  7120. @table @samp
  7121. @item none
  7122. Do nothing.
  7123. @item deinterleave, d
  7124. Deinterleave fields, placing one above the other.
  7125. @item interleave, i
  7126. Interleave fields. Reverse the effect of deinterleaving.
  7127. @end table
  7128. Default value is @code{none}.
  7129. @item luma_swap, ls
  7130. @item chroma_swap, cs
  7131. @item alpha_swap, as
  7132. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  7133. @end table
  7134. @section inflate
  7135. Apply inflate effect to the video.
  7136. This filter replaces the pixel by the local(3x3) average by taking into account
  7137. only values higher than the pixel.
  7138. It accepts the following options:
  7139. @table @option
  7140. @item threshold0
  7141. @item threshold1
  7142. @item threshold2
  7143. @item threshold3
  7144. Limit the maximum change for each plane, default is 65535.
  7145. If 0, plane will remain unchanged.
  7146. @end table
  7147. @section interlace
  7148. Simple interlacing filter from progressive contents. This interleaves upper (or
  7149. lower) lines from odd frames with lower (or upper) lines from even frames,
  7150. halving the frame rate and preserving image height.
  7151. @example
  7152. Original Original New Frame
  7153. Frame 'j' Frame 'j+1' (tff)
  7154. ========== =========== ==================
  7155. Line 0 --------------------> Frame 'j' Line 0
  7156. Line 1 Line 1 ----> Frame 'j+1' Line 1
  7157. Line 2 ---------------------> Frame 'j' Line 2
  7158. Line 3 Line 3 ----> Frame 'j+1' Line 3
  7159. ... ... ...
  7160. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  7161. @end example
  7162. It accepts the following optional parameters:
  7163. @table @option
  7164. @item scan
  7165. This determines whether the interlaced frame is taken from the even
  7166. (tff - default) or odd (bff) lines of the progressive frame.
  7167. @item lowpass
  7168. Vertical lowpass filter to avoid twitter interlacing and
  7169. reduce moire patterns.
  7170. @table @samp
  7171. @item 0, off
  7172. Disable vertical lowpass filter
  7173. @item 1, linear
  7174. Enable linear filter (default)
  7175. @item 2, complex
  7176. Enable complex filter. This will slightly less reduce twitter and moire
  7177. but better retain detail and subjective sharpness impression.
  7178. @end table
  7179. @end table
  7180. @section kerndeint
  7181. Deinterlace input video by applying Donald Graft's adaptive kernel
  7182. deinterling. Work on interlaced parts of a video to produce
  7183. progressive frames.
  7184. The description of the accepted parameters follows.
  7185. @table @option
  7186. @item thresh
  7187. Set the threshold which affects the filter's tolerance when
  7188. determining if a pixel line must be processed. It must be an integer
  7189. in the range [0,255] and defaults to 10. A value of 0 will result in
  7190. applying the process on every pixels.
  7191. @item map
  7192. Paint pixels exceeding the threshold value to white if set to 1.
  7193. Default is 0.
  7194. @item order
  7195. Set the fields order. Swap fields if set to 1, leave fields alone if
  7196. 0. Default is 0.
  7197. @item sharp
  7198. Enable additional sharpening if set to 1. Default is 0.
  7199. @item twoway
  7200. Enable twoway sharpening if set to 1. Default is 0.
  7201. @end table
  7202. @subsection Examples
  7203. @itemize
  7204. @item
  7205. Apply default values:
  7206. @example
  7207. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  7208. @end example
  7209. @item
  7210. Enable additional sharpening:
  7211. @example
  7212. kerndeint=sharp=1
  7213. @end example
  7214. @item
  7215. Paint processed pixels in white:
  7216. @example
  7217. kerndeint=map=1
  7218. @end example
  7219. @end itemize
  7220. @section lenscorrection
  7221. Correct radial lens distortion
  7222. This filter can be used to correct for radial distortion as can result from the use
  7223. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  7224. one can use tools available for example as part of opencv or simply trial-and-error.
  7225. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  7226. and extract the k1 and k2 coefficients from the resulting matrix.
  7227. Note that effectively the same filter is available in the open-source tools Krita and
  7228. Digikam from the KDE project.
  7229. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  7230. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  7231. brightness distribution, so you may want to use both filters together in certain
  7232. cases, though you will have to take care of ordering, i.e. whether vignetting should
  7233. be applied before or after lens correction.
  7234. @subsection Options
  7235. The filter accepts the following options:
  7236. @table @option
  7237. @item cx
  7238. Relative x-coordinate of the focal point of the image, and thereby the center of the
  7239. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7240. width.
  7241. @item cy
  7242. Relative y-coordinate of the focal point of the image, and thereby the center of the
  7243. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7244. height.
  7245. @item k1
  7246. Coefficient of the quadratic correction term. 0.5 means no correction.
  7247. @item k2
  7248. Coefficient of the double quadratic correction term. 0.5 means no correction.
  7249. @end table
  7250. The formula that generates the correction is:
  7251. @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)
  7252. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  7253. distances from the focal point in the source and target images, respectively.
  7254. @section loop
  7255. Loop video frames.
  7256. The filter accepts the following options:
  7257. @table @option
  7258. @item loop
  7259. Set the number of loops.
  7260. @item size
  7261. Set maximal size in number of frames.
  7262. @item start
  7263. Set first frame of loop.
  7264. @end table
  7265. @anchor{lut3d}
  7266. @section lut3d
  7267. Apply a 3D LUT to an input video.
  7268. The filter accepts the following options:
  7269. @table @option
  7270. @item file
  7271. Set the 3D LUT file name.
  7272. Currently supported formats:
  7273. @table @samp
  7274. @item 3dl
  7275. AfterEffects
  7276. @item cube
  7277. Iridas
  7278. @item dat
  7279. DaVinci
  7280. @item m3d
  7281. Pandora
  7282. @end table
  7283. @item interp
  7284. Select interpolation mode.
  7285. Available values are:
  7286. @table @samp
  7287. @item nearest
  7288. Use values from the nearest defined point.
  7289. @item trilinear
  7290. Interpolate values using the 8 points defining a cube.
  7291. @item tetrahedral
  7292. Interpolate values using a tetrahedron.
  7293. @end table
  7294. @end table
  7295. @section lumakey
  7296. Turn certain luma values into transparency.
  7297. The filter accepts the following options:
  7298. @table @option
  7299. @item threshold
  7300. Set the luma which will be used as base for transparency.
  7301. Default value is @code{0}.
  7302. @item tolerance
  7303. Set the range of luma values to be keyed out.
  7304. Default value is @code{0}.
  7305. @item softness
  7306. Set the range of softness. Default value is @code{0}.
  7307. Use this to control gradual transition from zero to full transparency.
  7308. @end table
  7309. @section lut, lutrgb, lutyuv
  7310. Compute a look-up table for binding each pixel component input value
  7311. to an output value, and apply it to the input video.
  7312. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  7313. to an RGB input video.
  7314. These filters accept the following parameters:
  7315. @table @option
  7316. @item c0
  7317. set first pixel component expression
  7318. @item c1
  7319. set second pixel component expression
  7320. @item c2
  7321. set third pixel component expression
  7322. @item c3
  7323. set fourth pixel component expression, corresponds to the alpha component
  7324. @item r
  7325. set red component expression
  7326. @item g
  7327. set green component expression
  7328. @item b
  7329. set blue component expression
  7330. @item a
  7331. alpha component expression
  7332. @item y
  7333. set Y/luminance component expression
  7334. @item u
  7335. set U/Cb component expression
  7336. @item v
  7337. set V/Cr component expression
  7338. @end table
  7339. Each of them specifies the expression to use for computing the lookup table for
  7340. the corresponding pixel component values.
  7341. The exact component associated to each of the @var{c*} options depends on the
  7342. format in input.
  7343. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  7344. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  7345. The expressions can contain the following constants and functions:
  7346. @table @option
  7347. @item w
  7348. @item h
  7349. The input width and height.
  7350. @item val
  7351. The input value for the pixel component.
  7352. @item clipval
  7353. The input value, clipped to the @var{minval}-@var{maxval} range.
  7354. @item maxval
  7355. The maximum value for the pixel component.
  7356. @item minval
  7357. The minimum value for the pixel component.
  7358. @item negval
  7359. The negated value for the pixel component value, clipped to the
  7360. @var{minval}-@var{maxval} range; it corresponds to the expression
  7361. "maxval-clipval+minval".
  7362. @item clip(val)
  7363. The computed value in @var{val}, clipped to the
  7364. @var{minval}-@var{maxval} range.
  7365. @item gammaval(gamma)
  7366. The computed gamma correction value of the pixel component value,
  7367. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  7368. expression
  7369. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  7370. @end table
  7371. All expressions default to "val".
  7372. @subsection Examples
  7373. @itemize
  7374. @item
  7375. Negate input video:
  7376. @example
  7377. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  7378. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  7379. @end example
  7380. The above is the same as:
  7381. @example
  7382. lutrgb="r=negval:g=negval:b=negval"
  7383. lutyuv="y=negval:u=negval:v=negval"
  7384. @end example
  7385. @item
  7386. Negate luminance:
  7387. @example
  7388. lutyuv=y=negval
  7389. @end example
  7390. @item
  7391. Remove chroma components, turning the video into a graytone image:
  7392. @example
  7393. lutyuv="u=128:v=128"
  7394. @end example
  7395. @item
  7396. Apply a luma burning effect:
  7397. @example
  7398. lutyuv="y=2*val"
  7399. @end example
  7400. @item
  7401. Remove green and blue components:
  7402. @example
  7403. lutrgb="g=0:b=0"
  7404. @end example
  7405. @item
  7406. Set a constant alpha channel value on input:
  7407. @example
  7408. format=rgba,lutrgb=a="maxval-minval/2"
  7409. @end example
  7410. @item
  7411. Correct luminance gamma by a factor of 0.5:
  7412. @example
  7413. lutyuv=y=gammaval(0.5)
  7414. @end example
  7415. @item
  7416. Discard least significant bits of luma:
  7417. @example
  7418. lutyuv=y='bitand(val, 128+64+32)'
  7419. @end example
  7420. @item
  7421. Technicolor like effect:
  7422. @example
  7423. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  7424. @end example
  7425. @end itemize
  7426. @section lut2
  7427. Compute and apply a lookup table from two video inputs.
  7428. This filter accepts the following parameters:
  7429. @table @option
  7430. @item c0
  7431. set first pixel component expression
  7432. @item c1
  7433. set second pixel component expression
  7434. @item c2
  7435. set third pixel component expression
  7436. @item c3
  7437. set fourth pixel component expression, corresponds to the alpha component
  7438. @end table
  7439. Each of them specifies the expression to use for computing the lookup table for
  7440. the corresponding pixel component values.
  7441. The exact component associated to each of the @var{c*} options depends on the
  7442. format in inputs.
  7443. The expressions can contain the following constants:
  7444. @table @option
  7445. @item w
  7446. @item h
  7447. The input width and height.
  7448. @item x
  7449. The first input value for the pixel component.
  7450. @item y
  7451. The second input value for the pixel component.
  7452. @item bdx
  7453. The first input video bit depth.
  7454. @item bdy
  7455. The second input video bit depth.
  7456. @end table
  7457. All expressions default to "x".
  7458. @subsection Examples
  7459. @itemize
  7460. @item
  7461. Highlight differences between two RGB video streams:
  7462. @example
  7463. lut2='ifnot(x-y,0,pow(2,bdx)-1):ifnot(x-y,0,pow(2,bdx)-1):ifnot(x-y,0,pow(2,bdx)-1)'
  7464. @end example
  7465. @item
  7466. Highlight differences between two YUV video streams:
  7467. @example
  7468. lut2='ifnot(x-y,0,pow(2,bdx)-1):ifnot(x-y,pow(2,bdx-1),pow(2,bdx)-1):ifnot(x-y,pow(2,bdx-1),pow(2,bdx)-1)'
  7469. @end example
  7470. @end itemize
  7471. @section maskedclamp
  7472. Clamp the first input stream with the second input and third input stream.
  7473. Returns the value of first stream to be between second input
  7474. stream - @code{undershoot} and third input stream + @code{overshoot}.
  7475. This filter accepts the following options:
  7476. @table @option
  7477. @item undershoot
  7478. Default value is @code{0}.
  7479. @item overshoot
  7480. Default value is @code{0}.
  7481. @item planes
  7482. Set which planes will be processed as bitmap, unprocessed planes will be
  7483. copied from first stream.
  7484. By default value 0xf, all planes will be processed.
  7485. @end table
  7486. @section maskedmerge
  7487. Merge the first input stream with the second input stream using per pixel
  7488. weights in the third input stream.
  7489. A value of 0 in the third stream pixel component means that pixel component
  7490. from first stream is returned unchanged, while maximum value (eg. 255 for
  7491. 8-bit videos) means that pixel component from second stream is returned
  7492. unchanged. Intermediate values define the amount of merging between both
  7493. input stream's pixel components.
  7494. This filter accepts the following options:
  7495. @table @option
  7496. @item planes
  7497. Set which planes will be processed as bitmap, unprocessed planes will be
  7498. copied from first stream.
  7499. By default value 0xf, all planes will be processed.
  7500. @end table
  7501. @section mcdeint
  7502. Apply motion-compensation deinterlacing.
  7503. It needs one field per frame as input and must thus be used together
  7504. with yadif=1/3 or equivalent.
  7505. This filter accepts the following options:
  7506. @table @option
  7507. @item mode
  7508. Set the deinterlacing mode.
  7509. It accepts one of the following values:
  7510. @table @samp
  7511. @item fast
  7512. @item medium
  7513. @item slow
  7514. use iterative motion estimation
  7515. @item extra_slow
  7516. like @samp{slow}, but use multiple reference frames.
  7517. @end table
  7518. Default value is @samp{fast}.
  7519. @item parity
  7520. Set the picture field parity assumed for the input video. It must be
  7521. one of the following values:
  7522. @table @samp
  7523. @item 0, tff
  7524. assume top field first
  7525. @item 1, bff
  7526. assume bottom field first
  7527. @end table
  7528. Default value is @samp{bff}.
  7529. @item qp
  7530. Set per-block quantization parameter (QP) used by the internal
  7531. encoder.
  7532. Higher values should result in a smoother motion vector field but less
  7533. optimal individual vectors. Default value is 1.
  7534. @end table
  7535. @section mergeplanes
  7536. Merge color channel components from several video streams.
  7537. The filter accepts up to 4 input streams, and merge selected input
  7538. planes to the output video.
  7539. This filter accepts the following options:
  7540. @table @option
  7541. @item mapping
  7542. Set input to output plane mapping. Default is @code{0}.
  7543. The mappings is specified as a bitmap. It should be specified as a
  7544. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  7545. mapping for the first plane of the output stream. 'A' sets the number of
  7546. the input stream to use (from 0 to 3), and 'a' the plane number of the
  7547. corresponding input to use (from 0 to 3). The rest of the mappings is
  7548. similar, 'Bb' describes the mapping for the output stream second
  7549. plane, 'Cc' describes the mapping for the output stream third plane and
  7550. 'Dd' describes the mapping for the output stream fourth plane.
  7551. @item format
  7552. Set output pixel format. Default is @code{yuva444p}.
  7553. @end table
  7554. @subsection Examples
  7555. @itemize
  7556. @item
  7557. Merge three gray video streams of same width and height into single video stream:
  7558. @example
  7559. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  7560. @end example
  7561. @item
  7562. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  7563. @example
  7564. [a0][a1]mergeplanes=0x00010210:yuva444p
  7565. @end example
  7566. @item
  7567. Swap Y and A plane in yuva444p stream:
  7568. @example
  7569. format=yuva444p,mergeplanes=0x03010200:yuva444p
  7570. @end example
  7571. @item
  7572. Swap U and V plane in yuv420p stream:
  7573. @example
  7574. format=yuv420p,mergeplanes=0x000201:yuv420p
  7575. @end example
  7576. @item
  7577. Cast a rgb24 clip to yuv444p:
  7578. @example
  7579. format=rgb24,mergeplanes=0x000102:yuv444p
  7580. @end example
  7581. @end itemize
  7582. @section mestimate
  7583. Estimate and export motion vectors using block matching algorithms.
  7584. Motion vectors are stored in frame side data to be used by other filters.
  7585. This filter accepts the following options:
  7586. @table @option
  7587. @item method
  7588. Specify the motion estimation method. Accepts one of the following values:
  7589. @table @samp
  7590. @item esa
  7591. Exhaustive search algorithm.
  7592. @item tss
  7593. Three step search algorithm.
  7594. @item tdls
  7595. Two dimensional logarithmic search algorithm.
  7596. @item ntss
  7597. New three step search algorithm.
  7598. @item fss
  7599. Four step search algorithm.
  7600. @item ds
  7601. Diamond search algorithm.
  7602. @item hexbs
  7603. Hexagon-based search algorithm.
  7604. @item epzs
  7605. Enhanced predictive zonal search algorithm.
  7606. @item umh
  7607. Uneven multi-hexagon search algorithm.
  7608. @end table
  7609. Default value is @samp{esa}.
  7610. @item mb_size
  7611. Macroblock size. Default @code{16}.
  7612. @item search_param
  7613. Search parameter. Default @code{7}.
  7614. @end table
  7615. @section midequalizer
  7616. Apply Midway Image Equalization effect using two video streams.
  7617. Midway Image Equalization adjusts a pair of images to have the same
  7618. histogram, while maintaining their dynamics as much as possible. It's
  7619. useful for e.g. matching exposures from a pair of stereo cameras.
  7620. This filter has two inputs and one output, which must be of same pixel format, but
  7621. may be of different sizes. The output of filter is first input adjusted with
  7622. midway histogram of both inputs.
  7623. This filter accepts the following option:
  7624. @table @option
  7625. @item planes
  7626. Set which planes to process. Default is @code{15}, which is all available planes.
  7627. @end table
  7628. @section minterpolate
  7629. Convert the video to specified frame rate using motion interpolation.
  7630. This filter accepts the following options:
  7631. @table @option
  7632. @item fps
  7633. Specify the output frame rate. This can be rational e.g. @code{60000/1001}. Frames are dropped if @var{fps} is lower than source fps. Default @code{60}.
  7634. @item mi_mode
  7635. Motion interpolation mode. Following values are accepted:
  7636. @table @samp
  7637. @item dup
  7638. Duplicate previous or next frame for interpolating new ones.
  7639. @item blend
  7640. Blend source frames. Interpolated frame is mean of previous and next frames.
  7641. @item mci
  7642. Motion compensated interpolation. Following options are effective when this mode is selected:
  7643. @table @samp
  7644. @item mc_mode
  7645. Motion compensation mode. Following values are accepted:
  7646. @table @samp
  7647. @item obmc
  7648. Overlapped block motion compensation.
  7649. @item aobmc
  7650. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  7651. @end table
  7652. Default mode is @samp{obmc}.
  7653. @item me_mode
  7654. Motion estimation mode. Following values are accepted:
  7655. @table @samp
  7656. @item bidir
  7657. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  7658. @item bilat
  7659. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  7660. @end table
  7661. Default mode is @samp{bilat}.
  7662. @item me
  7663. The algorithm to be used for motion estimation. Following values are accepted:
  7664. @table @samp
  7665. @item esa
  7666. Exhaustive search algorithm.
  7667. @item tss
  7668. Three step search algorithm.
  7669. @item tdls
  7670. Two dimensional logarithmic search algorithm.
  7671. @item ntss
  7672. New three step search algorithm.
  7673. @item fss
  7674. Four step search algorithm.
  7675. @item ds
  7676. Diamond search algorithm.
  7677. @item hexbs
  7678. Hexagon-based search algorithm.
  7679. @item epzs
  7680. Enhanced predictive zonal search algorithm.
  7681. @item umh
  7682. Uneven multi-hexagon search algorithm.
  7683. @end table
  7684. Default algorithm is @samp{epzs}.
  7685. @item mb_size
  7686. Macroblock size. Default @code{16}.
  7687. @item search_param
  7688. Motion estimation search parameter. Default @code{32}.
  7689. @item vsbmc
  7690. Enable variable-size block motion compensation. Motion estimation is applied with smaller block sizes at object boundaries in order to make the them less blur. Default is @code{0} (disabled).
  7691. @end table
  7692. @end table
  7693. @item scd
  7694. Scene change detection method. Scene change leads motion vectors to be in random direction. Scene change detection replace interpolated frames by duplicate ones. May not be needed for other modes. Following values are accepted:
  7695. @table @samp
  7696. @item none
  7697. Disable scene change detection.
  7698. @item fdiff
  7699. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  7700. @end table
  7701. Default method is @samp{fdiff}.
  7702. @item scd_threshold
  7703. Scene change detection threshold. Default is @code{5.0}.
  7704. @end table
  7705. @section mpdecimate
  7706. Drop frames that do not differ greatly from the previous frame in
  7707. order to reduce frame rate.
  7708. The main use of this filter is for very-low-bitrate encoding
  7709. (e.g. streaming over dialup modem), but it could in theory be used for
  7710. fixing movies that were inverse-telecined incorrectly.
  7711. A description of the accepted options follows.
  7712. @table @option
  7713. @item max
  7714. Set the maximum number of consecutive frames which can be dropped (if
  7715. positive), or the minimum interval between dropped frames (if
  7716. negative). If the value is 0, the frame is dropped unregarding the
  7717. number of previous sequentially dropped frames.
  7718. Default value is 0.
  7719. @item hi
  7720. @item lo
  7721. @item frac
  7722. Set the dropping threshold values.
  7723. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  7724. represent actual pixel value differences, so a threshold of 64
  7725. corresponds to 1 unit of difference for each pixel, or the same spread
  7726. out differently over the block.
  7727. A frame is a candidate for dropping if no 8x8 blocks differ by more
  7728. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  7729. meaning the whole image) differ by more than a threshold of @option{lo}.
  7730. Default value for @option{hi} is 64*12, default value for @option{lo} is
  7731. 64*5, and default value for @option{frac} is 0.33.
  7732. @end table
  7733. @section negate
  7734. Negate input video.
  7735. It accepts an integer in input; if non-zero it negates the
  7736. alpha component (if available). The default value in input is 0.
  7737. @section nlmeans
  7738. Denoise frames using Non-Local Means algorithm.
  7739. Each pixel is adjusted by looking for other pixels with similar contexts. This
  7740. context similarity is defined by comparing their surrounding patches of size
  7741. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  7742. around the pixel.
  7743. Note that the research area defines centers for patches, which means some
  7744. patches will be made of pixels outside that research area.
  7745. The filter accepts the following options.
  7746. @table @option
  7747. @item s
  7748. Set denoising strength.
  7749. @item p
  7750. Set patch size.
  7751. @item pc
  7752. Same as @option{p} but for chroma planes.
  7753. The default value is @var{0} and means automatic.
  7754. @item r
  7755. Set research size.
  7756. @item rc
  7757. Same as @option{r} but for chroma planes.
  7758. The default value is @var{0} and means automatic.
  7759. @end table
  7760. @section nnedi
  7761. Deinterlace video using neural network edge directed interpolation.
  7762. This filter accepts the following options:
  7763. @table @option
  7764. @item weights
  7765. Mandatory option, without binary file filter can not work.
  7766. Currently file can be found here:
  7767. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  7768. @item deint
  7769. Set which frames to deinterlace, by default it is @code{all}.
  7770. Can be @code{all} or @code{interlaced}.
  7771. @item field
  7772. Set mode of operation.
  7773. Can be one of the following:
  7774. @table @samp
  7775. @item af
  7776. Use frame flags, both fields.
  7777. @item a
  7778. Use frame flags, single field.
  7779. @item t
  7780. Use top field only.
  7781. @item b
  7782. Use bottom field only.
  7783. @item tf
  7784. Use both fields, top first.
  7785. @item bf
  7786. Use both fields, bottom first.
  7787. @end table
  7788. @item planes
  7789. Set which planes to process, by default filter process all frames.
  7790. @item nsize
  7791. Set size of local neighborhood around each pixel, used by the predictor neural
  7792. network.
  7793. Can be one of the following:
  7794. @table @samp
  7795. @item s8x6
  7796. @item s16x6
  7797. @item s32x6
  7798. @item s48x6
  7799. @item s8x4
  7800. @item s16x4
  7801. @item s32x4
  7802. @end table
  7803. @item nns
  7804. Set the number of neurons in predicctor neural network.
  7805. Can be one of the following:
  7806. @table @samp
  7807. @item n16
  7808. @item n32
  7809. @item n64
  7810. @item n128
  7811. @item n256
  7812. @end table
  7813. @item qual
  7814. Controls the number of different neural network predictions that are blended
  7815. together to compute the final output value. Can be @code{fast}, default or
  7816. @code{slow}.
  7817. @item etype
  7818. Set which set of weights to use in the predictor.
  7819. Can be one of the following:
  7820. @table @samp
  7821. @item a
  7822. weights trained to minimize absolute error
  7823. @item s
  7824. weights trained to minimize squared error
  7825. @end table
  7826. @item pscrn
  7827. Controls whether or not the prescreener neural network is used to decide
  7828. which pixels should be processed by the predictor neural network and which
  7829. can be handled by simple cubic interpolation.
  7830. The prescreener is trained to know whether cubic interpolation will be
  7831. sufficient for a pixel or whether it should be predicted by the predictor nn.
  7832. The computational complexity of the prescreener nn is much less than that of
  7833. the predictor nn. Since most pixels can be handled by cubic interpolation,
  7834. using the prescreener generally results in much faster processing.
  7835. The prescreener is pretty accurate, so the difference between using it and not
  7836. using it is almost always unnoticeable.
  7837. Can be one of the following:
  7838. @table @samp
  7839. @item none
  7840. @item original
  7841. @item new
  7842. @end table
  7843. Default is @code{new}.
  7844. @item fapprox
  7845. Set various debugging flags.
  7846. @end table
  7847. @section noformat
  7848. Force libavfilter not to use any of the specified pixel formats for the
  7849. input to the next filter.
  7850. It accepts the following parameters:
  7851. @table @option
  7852. @item pix_fmts
  7853. A '|'-separated list of pixel format names, such as
  7854. apix_fmts=yuv420p|monow|rgb24".
  7855. @end table
  7856. @subsection Examples
  7857. @itemize
  7858. @item
  7859. Force libavfilter to use a format different from @var{yuv420p} for the
  7860. input to the vflip filter:
  7861. @example
  7862. noformat=pix_fmts=yuv420p,vflip
  7863. @end example
  7864. @item
  7865. Convert the input video to any of the formats not contained in the list:
  7866. @example
  7867. noformat=yuv420p|yuv444p|yuv410p
  7868. @end example
  7869. @end itemize
  7870. @section noise
  7871. Add noise on video input frame.
  7872. The filter accepts the following options:
  7873. @table @option
  7874. @item all_seed
  7875. @item c0_seed
  7876. @item c1_seed
  7877. @item c2_seed
  7878. @item c3_seed
  7879. Set noise seed for specific pixel component or all pixel components in case
  7880. of @var{all_seed}. Default value is @code{123457}.
  7881. @item all_strength, alls
  7882. @item c0_strength, c0s
  7883. @item c1_strength, c1s
  7884. @item c2_strength, c2s
  7885. @item c3_strength, c3s
  7886. Set noise strength for specific pixel component or all pixel components in case
  7887. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  7888. @item all_flags, allf
  7889. @item c0_flags, c0f
  7890. @item c1_flags, c1f
  7891. @item c2_flags, c2f
  7892. @item c3_flags, c3f
  7893. Set pixel component flags or set flags for all components if @var{all_flags}.
  7894. Available values for component flags are:
  7895. @table @samp
  7896. @item a
  7897. averaged temporal noise (smoother)
  7898. @item p
  7899. mix random noise with a (semi)regular pattern
  7900. @item t
  7901. temporal noise (noise pattern changes between frames)
  7902. @item u
  7903. uniform noise (gaussian otherwise)
  7904. @end table
  7905. @end table
  7906. @subsection Examples
  7907. Add temporal and uniform noise to input video:
  7908. @example
  7909. noise=alls=20:allf=t+u
  7910. @end example
  7911. @section null
  7912. Pass the video source unchanged to the output.
  7913. @section ocr
  7914. Optical Character Recognition
  7915. This filter uses Tesseract for optical character recognition.
  7916. It accepts the following options:
  7917. @table @option
  7918. @item datapath
  7919. Set datapath to tesseract data. Default is to use whatever was
  7920. set at installation.
  7921. @item language
  7922. Set language, default is "eng".
  7923. @item whitelist
  7924. Set character whitelist.
  7925. @item blacklist
  7926. Set character blacklist.
  7927. @end table
  7928. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  7929. @section ocv
  7930. Apply a video transform using libopencv.
  7931. To enable this filter, install the libopencv library and headers and
  7932. configure FFmpeg with @code{--enable-libopencv}.
  7933. It accepts the following parameters:
  7934. @table @option
  7935. @item filter_name
  7936. The name of the libopencv filter to apply.
  7937. @item filter_params
  7938. The parameters to pass to the libopencv filter. If not specified, the default
  7939. values are assumed.
  7940. @end table
  7941. Refer to the official libopencv documentation for more precise
  7942. information:
  7943. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  7944. Several libopencv filters are supported; see the following subsections.
  7945. @anchor{dilate}
  7946. @subsection dilate
  7947. Dilate an image by using a specific structuring element.
  7948. It corresponds to the libopencv function @code{cvDilate}.
  7949. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  7950. @var{struct_el} represents a structuring element, and has the syntax:
  7951. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  7952. @var{cols} and @var{rows} represent the number of columns and rows of
  7953. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  7954. point, and @var{shape} the shape for the structuring element. @var{shape}
  7955. must be "rect", "cross", "ellipse", or "custom".
  7956. If the value for @var{shape} is "custom", it must be followed by a
  7957. string of the form "=@var{filename}". The file with name
  7958. @var{filename} is assumed to represent a binary image, with each
  7959. printable character corresponding to a bright pixel. When a custom
  7960. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  7961. or columns and rows of the read file are assumed instead.
  7962. The default value for @var{struct_el} is "3x3+0x0/rect".
  7963. @var{nb_iterations} specifies the number of times the transform is
  7964. applied to the image, and defaults to 1.
  7965. Some examples:
  7966. @example
  7967. # Use the default values
  7968. ocv=dilate
  7969. # Dilate using a structuring element with a 5x5 cross, iterating two times
  7970. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  7971. # Read the shape from the file diamond.shape, iterating two times.
  7972. # The file diamond.shape may contain a pattern of characters like this
  7973. # *
  7974. # ***
  7975. # *****
  7976. # ***
  7977. # *
  7978. # The specified columns and rows are ignored
  7979. # but the anchor point coordinates are not
  7980. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  7981. @end example
  7982. @subsection erode
  7983. Erode an image by using a specific structuring element.
  7984. It corresponds to the libopencv function @code{cvErode}.
  7985. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  7986. with the same syntax and semantics as the @ref{dilate} filter.
  7987. @subsection smooth
  7988. Smooth the input video.
  7989. The filter takes the following parameters:
  7990. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  7991. @var{type} is the type of smooth filter to apply, and must be one of
  7992. the following values: "blur", "blur_no_scale", "median", "gaussian",
  7993. or "bilateral". The default value is "gaussian".
  7994. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  7995. depend on the smooth type. @var{param1} and
  7996. @var{param2} accept integer positive values or 0. @var{param3} and
  7997. @var{param4} accept floating point values.
  7998. The default value for @var{param1} is 3. The default value for the
  7999. other parameters is 0.
  8000. These parameters correspond to the parameters assigned to the
  8001. libopencv function @code{cvSmooth}.
  8002. @section oscilloscope
  8003. 2D Video Oscilloscope.
  8004. Useful to measure spatial impulse, step responses, chroma delays, etc.
  8005. It accepts the following parameters:
  8006. @table @option
  8007. @item x
  8008. Set scope center x position.
  8009. @item y
  8010. Set scope center y position.
  8011. @item s
  8012. Set scope size, relative to frame diagonal.
  8013. @item t
  8014. Set scope tilt/rotation.
  8015. @item o
  8016. Set trace opacity.
  8017. @item tx
  8018. Set trace center x position.
  8019. @item ty
  8020. Set trace center y position.
  8021. @item tw
  8022. Set trace width, relative to width of frame.
  8023. @item th
  8024. Set trace height, relative to height of frame.
  8025. @item c
  8026. Set which components to trace. By default it traces first three components.
  8027. @item g
  8028. Draw trace grid. By default is enabled.
  8029. @item st
  8030. Draw some statistics. By default is enabled.
  8031. @item sc
  8032. Draw scope. By default is enabled.
  8033. @end table
  8034. @subsection Examples
  8035. @itemize
  8036. @item
  8037. Inspect full first row of video frame.
  8038. @example
  8039. oscilloscope=x=0.5:y=0:s=1
  8040. @end example
  8041. @item
  8042. Inspect full last row of video frame.
  8043. @example
  8044. oscilloscope=x=0.5:y=1:s=1
  8045. @end example
  8046. @item
  8047. Inspect full 5th line of video frame of height 1080.
  8048. @example
  8049. oscilloscope=x=0.5:y=5/1080:s=1
  8050. @end example
  8051. @item
  8052. Inspect full last column of video frame.
  8053. @example
  8054. oscilloscope=x=1:y=0.5:s=1:t=1
  8055. @end example
  8056. @end itemize
  8057. @anchor{overlay}
  8058. @section overlay
  8059. Overlay one video on top of another.
  8060. It takes two inputs and has one output. The first input is the "main"
  8061. video on which the second input is overlaid.
  8062. It accepts the following parameters:
  8063. A description of the accepted options follows.
  8064. @table @option
  8065. @item x
  8066. @item y
  8067. Set the expression for the x and y coordinates of the overlaid video
  8068. on the main video. Default value is "0" for both expressions. In case
  8069. the expression is invalid, it is set to a huge value (meaning that the
  8070. overlay will not be displayed within the output visible area).
  8071. @item eof_action
  8072. The action to take when EOF is encountered on the secondary input; it accepts
  8073. one of the following values:
  8074. @table @option
  8075. @item repeat
  8076. Repeat the last frame (the default).
  8077. @item endall
  8078. End both streams.
  8079. @item pass
  8080. Pass the main input through.
  8081. @end table
  8082. @item eval
  8083. Set when the expressions for @option{x}, and @option{y} are evaluated.
  8084. It accepts the following values:
  8085. @table @samp
  8086. @item init
  8087. only evaluate expressions once during the filter initialization or
  8088. when a command is processed
  8089. @item frame
  8090. evaluate expressions for each incoming frame
  8091. @end table
  8092. Default value is @samp{frame}.
  8093. @item shortest
  8094. If set to 1, force the output to terminate when the shortest input
  8095. terminates. Default value is 0.
  8096. @item format
  8097. Set the format for the output video.
  8098. It accepts the following values:
  8099. @table @samp
  8100. @item yuv420
  8101. force YUV420 output
  8102. @item yuv422
  8103. force YUV422 output
  8104. @item yuv444
  8105. force YUV444 output
  8106. @item rgb
  8107. force packed RGB output
  8108. @item gbrp
  8109. force planar RGB output
  8110. @end table
  8111. Default value is @samp{yuv420}.
  8112. @item rgb @emph{(deprecated)}
  8113. If set to 1, force the filter to accept inputs in the RGB
  8114. color space. Default value is 0. This option is deprecated, use
  8115. @option{format} instead.
  8116. @item repeatlast
  8117. If set to 1, force the filter to draw the last overlay frame over the
  8118. main input until the end of the stream. A value of 0 disables this
  8119. behavior. Default value is 1.
  8120. @end table
  8121. The @option{x}, and @option{y} expressions can contain the following
  8122. parameters.
  8123. @table @option
  8124. @item main_w, W
  8125. @item main_h, H
  8126. The main input width and height.
  8127. @item overlay_w, w
  8128. @item overlay_h, h
  8129. The overlay input width and height.
  8130. @item x
  8131. @item y
  8132. The computed values for @var{x} and @var{y}. They are evaluated for
  8133. each new frame.
  8134. @item hsub
  8135. @item vsub
  8136. horizontal and vertical chroma subsample values of the output
  8137. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  8138. @var{vsub} is 1.
  8139. @item n
  8140. the number of input frame, starting from 0
  8141. @item pos
  8142. the position in the file of the input frame, NAN if unknown
  8143. @item t
  8144. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  8145. @end table
  8146. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  8147. when evaluation is done @emph{per frame}, and will evaluate to NAN
  8148. when @option{eval} is set to @samp{init}.
  8149. Be aware that frames are taken from each input video in timestamp
  8150. order, hence, if their initial timestamps differ, it is a good idea
  8151. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  8152. have them begin in the same zero timestamp, as the example for
  8153. the @var{movie} filter does.
  8154. You can chain together more overlays but you should test the
  8155. efficiency of such approach.
  8156. @subsection Commands
  8157. This filter supports the following commands:
  8158. @table @option
  8159. @item x
  8160. @item y
  8161. Modify the x and y of the overlay input.
  8162. The command accepts the same syntax of the corresponding option.
  8163. If the specified expression is not valid, it is kept at its current
  8164. value.
  8165. @end table
  8166. @subsection Examples
  8167. @itemize
  8168. @item
  8169. Draw the overlay at 10 pixels from the bottom right corner of the main
  8170. video:
  8171. @example
  8172. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  8173. @end example
  8174. Using named options the example above becomes:
  8175. @example
  8176. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  8177. @end example
  8178. @item
  8179. Insert a transparent PNG logo in the bottom left corner of the input,
  8180. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  8181. @example
  8182. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  8183. @end example
  8184. @item
  8185. Insert 2 different transparent PNG logos (second logo on bottom
  8186. right corner) using the @command{ffmpeg} tool:
  8187. @example
  8188. 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
  8189. @end example
  8190. @item
  8191. Add a transparent color layer on top of the main video; @code{WxH}
  8192. must specify the size of the main input to the overlay filter:
  8193. @example
  8194. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  8195. @end example
  8196. @item
  8197. Play an original video and a filtered version (here with the deshake
  8198. filter) side by side using the @command{ffplay} tool:
  8199. @example
  8200. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  8201. @end example
  8202. The above command is the same as:
  8203. @example
  8204. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  8205. @end example
  8206. @item
  8207. Make a sliding overlay appearing from the left to the right top part of the
  8208. screen starting since time 2:
  8209. @example
  8210. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  8211. @end example
  8212. @item
  8213. Compose output by putting two input videos side to side:
  8214. @example
  8215. ffmpeg -i left.avi -i right.avi -filter_complex "
  8216. nullsrc=size=200x100 [background];
  8217. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  8218. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  8219. [background][left] overlay=shortest=1 [background+left];
  8220. [background+left][right] overlay=shortest=1:x=100 [left+right]
  8221. "
  8222. @end example
  8223. @item
  8224. Mask 10-20 seconds of a video by applying the delogo filter to a section
  8225. @example
  8226. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  8227. -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]'
  8228. masked.avi
  8229. @end example
  8230. @item
  8231. Chain several overlays in cascade:
  8232. @example
  8233. nullsrc=s=200x200 [bg];
  8234. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  8235. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  8236. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  8237. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  8238. [in3] null, [mid2] overlay=100:100 [out0]
  8239. @end example
  8240. @end itemize
  8241. @section owdenoise
  8242. Apply Overcomplete Wavelet denoiser.
  8243. The filter accepts the following options:
  8244. @table @option
  8245. @item depth
  8246. Set depth.
  8247. Larger depth values will denoise lower frequency components more, but
  8248. slow down filtering.
  8249. Must be an int in the range 8-16, default is @code{8}.
  8250. @item luma_strength, ls
  8251. Set luma strength.
  8252. Must be a double value in the range 0-1000, default is @code{1.0}.
  8253. @item chroma_strength, cs
  8254. Set chroma strength.
  8255. Must be a double value in the range 0-1000, default is @code{1.0}.
  8256. @end table
  8257. @anchor{pad}
  8258. @section pad
  8259. Add paddings to the input image, and place the original input at the
  8260. provided @var{x}, @var{y} coordinates.
  8261. It accepts the following parameters:
  8262. @table @option
  8263. @item width, w
  8264. @item height, h
  8265. Specify an expression for the size of the output image with the
  8266. paddings added. If the value for @var{width} or @var{height} is 0, the
  8267. corresponding input size is used for the output.
  8268. The @var{width} expression can reference the value set by the
  8269. @var{height} expression, and vice versa.
  8270. The default value of @var{width} and @var{height} is 0.
  8271. @item x
  8272. @item y
  8273. Specify the offsets to place the input image at within the padded area,
  8274. with respect to the top/left border of the output image.
  8275. The @var{x} expression can reference the value set by the @var{y}
  8276. expression, and vice versa.
  8277. The default value of @var{x} and @var{y} is 0.
  8278. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  8279. so the input image is centered on the padded area.
  8280. @item color
  8281. Specify the color of the padded area. For the syntax of this option,
  8282. check the "Color" section in the ffmpeg-utils manual.
  8283. The default value of @var{color} is "black".
  8284. @item eval
  8285. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  8286. It accepts the following values:
  8287. @table @samp
  8288. @item init
  8289. Only evaluate expressions once during the filter initialization or when
  8290. a command is processed.
  8291. @item frame
  8292. Evaluate expressions for each incoming frame.
  8293. @end table
  8294. Default value is @samp{init}.
  8295. @item aspect
  8296. Pad to aspect instead to a resolution.
  8297. @end table
  8298. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  8299. options are expressions containing the following constants:
  8300. @table @option
  8301. @item in_w
  8302. @item in_h
  8303. The input video width and height.
  8304. @item iw
  8305. @item ih
  8306. These are the same as @var{in_w} and @var{in_h}.
  8307. @item out_w
  8308. @item out_h
  8309. The output width and height (the size of the padded area), as
  8310. specified by the @var{width} and @var{height} expressions.
  8311. @item ow
  8312. @item oh
  8313. These are the same as @var{out_w} and @var{out_h}.
  8314. @item x
  8315. @item y
  8316. The x and y offsets as specified by the @var{x} and @var{y}
  8317. expressions, or NAN if not yet specified.
  8318. @item a
  8319. same as @var{iw} / @var{ih}
  8320. @item sar
  8321. input sample aspect ratio
  8322. @item dar
  8323. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  8324. @item hsub
  8325. @item vsub
  8326. The horizontal and vertical chroma subsample values. For example for the
  8327. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8328. @end table
  8329. @subsection Examples
  8330. @itemize
  8331. @item
  8332. Add paddings with the color "violet" to the input video. The output video
  8333. size is 640x480, and the top-left corner of the input video is placed at
  8334. column 0, row 40
  8335. @example
  8336. pad=640:480:0:40:violet
  8337. @end example
  8338. The example above is equivalent to the following command:
  8339. @example
  8340. pad=width=640:height=480:x=0:y=40:color=violet
  8341. @end example
  8342. @item
  8343. Pad the input to get an output with dimensions increased by 3/2,
  8344. and put the input video at the center of the padded area:
  8345. @example
  8346. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  8347. @end example
  8348. @item
  8349. Pad the input to get a squared output with size equal to the maximum
  8350. value between the input width and height, and put the input video at
  8351. the center of the padded area:
  8352. @example
  8353. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  8354. @end example
  8355. @item
  8356. Pad the input to get a final w/h ratio of 16:9:
  8357. @example
  8358. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  8359. @end example
  8360. @item
  8361. In case of anamorphic video, in order to set the output display aspect
  8362. correctly, it is necessary to use @var{sar} in the expression,
  8363. according to the relation:
  8364. @example
  8365. (ih * X / ih) * sar = output_dar
  8366. X = output_dar / sar
  8367. @end example
  8368. Thus the previous example needs to be modified to:
  8369. @example
  8370. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  8371. @end example
  8372. @item
  8373. Double the output size and put the input video in the bottom-right
  8374. corner of the output padded area:
  8375. @example
  8376. pad="2*iw:2*ih:ow-iw:oh-ih"
  8377. @end example
  8378. @end itemize
  8379. @anchor{palettegen}
  8380. @section palettegen
  8381. Generate one palette for a whole video stream.
  8382. It accepts the following options:
  8383. @table @option
  8384. @item max_colors
  8385. Set the maximum number of colors to quantize in the palette.
  8386. Note: the palette will still contain 256 colors; the unused palette entries
  8387. will be black.
  8388. @item reserve_transparent
  8389. Create a palette of 255 colors maximum and reserve the last one for
  8390. transparency. Reserving the transparency color is useful for GIF optimization.
  8391. If not set, the maximum of colors in the palette will be 256. You probably want
  8392. to disable this option for a standalone image.
  8393. Set by default.
  8394. @item stats_mode
  8395. Set statistics mode.
  8396. It accepts the following values:
  8397. @table @samp
  8398. @item full
  8399. Compute full frame histograms.
  8400. @item diff
  8401. Compute histograms only for the part that differs from previous frame. This
  8402. might be relevant to give more importance to the moving part of your input if
  8403. the background is static.
  8404. @item single
  8405. Compute new histogram for each frame.
  8406. @end table
  8407. Default value is @var{full}.
  8408. @end table
  8409. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  8410. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  8411. color quantization of the palette. This information is also visible at
  8412. @var{info} logging level.
  8413. @subsection Examples
  8414. @itemize
  8415. @item
  8416. Generate a representative palette of a given video using @command{ffmpeg}:
  8417. @example
  8418. ffmpeg -i input.mkv -vf palettegen palette.png
  8419. @end example
  8420. @end itemize
  8421. @section paletteuse
  8422. Use a palette to downsample an input video stream.
  8423. The filter takes two inputs: one video stream and a palette. The palette must
  8424. be a 256 pixels image.
  8425. It accepts the following options:
  8426. @table @option
  8427. @item dither
  8428. Select dithering mode. Available algorithms are:
  8429. @table @samp
  8430. @item bayer
  8431. Ordered 8x8 bayer dithering (deterministic)
  8432. @item heckbert
  8433. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  8434. Note: this dithering is sometimes considered "wrong" and is included as a
  8435. reference.
  8436. @item floyd_steinberg
  8437. Floyd and Steingberg dithering (error diffusion)
  8438. @item sierra2
  8439. Frankie Sierra dithering v2 (error diffusion)
  8440. @item sierra2_4a
  8441. Frankie Sierra dithering v2 "Lite" (error diffusion)
  8442. @end table
  8443. Default is @var{sierra2_4a}.
  8444. @item bayer_scale
  8445. When @var{bayer} dithering is selected, this option defines the scale of the
  8446. pattern (how much the crosshatch pattern is visible). A low value means more
  8447. visible pattern for less banding, and higher value means less visible pattern
  8448. at the cost of more banding.
  8449. The option must be an integer value in the range [0,5]. Default is @var{2}.
  8450. @item diff_mode
  8451. If set, define the zone to process
  8452. @table @samp
  8453. @item rectangle
  8454. Only the changing rectangle will be reprocessed. This is similar to GIF
  8455. cropping/offsetting compression mechanism. This option can be useful for speed
  8456. if only a part of the image is changing, and has use cases such as limiting the
  8457. scope of the error diffusal @option{dither} to the rectangle that bounds the
  8458. moving scene (it leads to more deterministic output if the scene doesn't change
  8459. much, and as a result less moving noise and better GIF compression).
  8460. @end table
  8461. Default is @var{none}.
  8462. @item new
  8463. Take new palette for each output frame.
  8464. @end table
  8465. @subsection Examples
  8466. @itemize
  8467. @item
  8468. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  8469. using @command{ffmpeg}:
  8470. @example
  8471. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  8472. @end example
  8473. @end itemize
  8474. @section perspective
  8475. Correct perspective of video not recorded perpendicular to the screen.
  8476. A description of the accepted parameters follows.
  8477. @table @option
  8478. @item x0
  8479. @item y0
  8480. @item x1
  8481. @item y1
  8482. @item x2
  8483. @item y2
  8484. @item x3
  8485. @item y3
  8486. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  8487. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  8488. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  8489. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  8490. then the corners of the source will be sent to the specified coordinates.
  8491. The expressions can use the following variables:
  8492. @table @option
  8493. @item W
  8494. @item H
  8495. the width and height of video frame.
  8496. @item in
  8497. Input frame count.
  8498. @item on
  8499. Output frame count.
  8500. @end table
  8501. @item interpolation
  8502. Set interpolation for perspective correction.
  8503. It accepts the following values:
  8504. @table @samp
  8505. @item linear
  8506. @item cubic
  8507. @end table
  8508. Default value is @samp{linear}.
  8509. @item sense
  8510. Set interpretation of coordinate options.
  8511. It accepts the following values:
  8512. @table @samp
  8513. @item 0, source
  8514. Send point in the source specified by the given coordinates to
  8515. the corners of the destination.
  8516. @item 1, destination
  8517. Send the corners of the source to the point in the destination specified
  8518. by the given coordinates.
  8519. Default value is @samp{source}.
  8520. @end table
  8521. @item eval
  8522. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  8523. It accepts the following values:
  8524. @table @samp
  8525. @item init
  8526. only evaluate expressions once during the filter initialization or
  8527. when a command is processed
  8528. @item frame
  8529. evaluate expressions for each incoming frame
  8530. @end table
  8531. Default value is @samp{init}.
  8532. @end table
  8533. @section phase
  8534. Delay interlaced video by one field time so that the field order changes.
  8535. The intended use is to fix PAL movies that have been captured with the
  8536. opposite field order to the film-to-video transfer.
  8537. A description of the accepted parameters follows.
  8538. @table @option
  8539. @item mode
  8540. Set phase mode.
  8541. It accepts the following values:
  8542. @table @samp
  8543. @item t
  8544. Capture field order top-first, transfer bottom-first.
  8545. Filter will delay the bottom field.
  8546. @item b
  8547. Capture field order bottom-first, transfer top-first.
  8548. Filter will delay the top field.
  8549. @item p
  8550. Capture and transfer with the same field order. This mode only exists
  8551. for the documentation of the other options to refer to, but if you
  8552. actually select it, the filter will faithfully do nothing.
  8553. @item a
  8554. Capture field order determined automatically by field flags, transfer
  8555. opposite.
  8556. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  8557. basis using field flags. If no field information is available,
  8558. then this works just like @samp{u}.
  8559. @item u
  8560. Capture unknown or varying, transfer opposite.
  8561. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  8562. analyzing the images and selecting the alternative that produces best
  8563. match between the fields.
  8564. @item T
  8565. Capture top-first, transfer unknown or varying.
  8566. Filter selects among @samp{t} and @samp{p} using image analysis.
  8567. @item B
  8568. Capture bottom-first, transfer unknown or varying.
  8569. Filter selects among @samp{b} and @samp{p} using image analysis.
  8570. @item A
  8571. Capture determined by field flags, transfer unknown or varying.
  8572. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  8573. image analysis. If no field information is available, then this works just
  8574. like @samp{U}. This is the default mode.
  8575. @item U
  8576. Both capture and transfer unknown or varying.
  8577. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  8578. @end table
  8579. @end table
  8580. @section pixdesctest
  8581. Pixel format descriptor test filter, mainly useful for internal
  8582. testing. The output video should be equal to the input video.
  8583. For example:
  8584. @example
  8585. format=monow, pixdesctest
  8586. @end example
  8587. can be used to test the monowhite pixel format descriptor definition.
  8588. @section pixscope
  8589. Display sample values of color channels. Mainly useful for checking color and levels.
  8590. The filters accept the following options:
  8591. @table @option
  8592. @item x
  8593. Set scope X position, offset on X axis.
  8594. @item y
  8595. Set scope Y position, offset on Y axis.
  8596. @item w
  8597. Set scope width.
  8598. @item h
  8599. Set scope height.
  8600. @item o
  8601. Set window opacity. This window also holds statistics about pixel area.
  8602. @end table
  8603. @section pp
  8604. Enable the specified chain of postprocessing subfilters using libpostproc. This
  8605. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  8606. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  8607. Each subfilter and some options have a short and a long name that can be used
  8608. interchangeably, i.e. dr/dering are the same.
  8609. The filters accept the following options:
  8610. @table @option
  8611. @item subfilters
  8612. Set postprocessing subfilters string.
  8613. @end table
  8614. All subfilters share common options to determine their scope:
  8615. @table @option
  8616. @item a/autoq
  8617. Honor the quality commands for this subfilter.
  8618. @item c/chrom
  8619. Do chrominance filtering, too (default).
  8620. @item y/nochrom
  8621. Do luminance filtering only (no chrominance).
  8622. @item n/noluma
  8623. Do chrominance filtering only (no luminance).
  8624. @end table
  8625. These options can be appended after the subfilter name, separated by a '|'.
  8626. Available subfilters are:
  8627. @table @option
  8628. @item hb/hdeblock[|difference[|flatness]]
  8629. Horizontal deblocking filter
  8630. @table @option
  8631. @item difference
  8632. Difference factor where higher values mean more deblocking (default: @code{32}).
  8633. @item flatness
  8634. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8635. @end table
  8636. @item vb/vdeblock[|difference[|flatness]]
  8637. Vertical deblocking filter
  8638. @table @option
  8639. @item difference
  8640. Difference factor where higher values mean more deblocking (default: @code{32}).
  8641. @item flatness
  8642. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8643. @end table
  8644. @item ha/hadeblock[|difference[|flatness]]
  8645. Accurate horizontal deblocking filter
  8646. @table @option
  8647. @item difference
  8648. Difference factor where higher values mean more deblocking (default: @code{32}).
  8649. @item flatness
  8650. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8651. @end table
  8652. @item va/vadeblock[|difference[|flatness]]
  8653. Accurate vertical deblocking filter
  8654. @table @option
  8655. @item difference
  8656. Difference factor where higher values mean more deblocking (default: @code{32}).
  8657. @item flatness
  8658. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8659. @end table
  8660. @end table
  8661. The horizontal and vertical deblocking filters share the difference and
  8662. flatness values so you cannot set different horizontal and vertical
  8663. thresholds.
  8664. @table @option
  8665. @item h1/x1hdeblock
  8666. Experimental horizontal deblocking filter
  8667. @item v1/x1vdeblock
  8668. Experimental vertical deblocking filter
  8669. @item dr/dering
  8670. Deringing filter
  8671. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  8672. @table @option
  8673. @item threshold1
  8674. larger -> stronger filtering
  8675. @item threshold2
  8676. larger -> stronger filtering
  8677. @item threshold3
  8678. larger -> stronger filtering
  8679. @end table
  8680. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  8681. @table @option
  8682. @item f/fullyrange
  8683. Stretch luminance to @code{0-255}.
  8684. @end table
  8685. @item lb/linblenddeint
  8686. Linear blend deinterlacing filter that deinterlaces the given block by
  8687. filtering all lines with a @code{(1 2 1)} filter.
  8688. @item li/linipoldeint
  8689. Linear interpolating deinterlacing filter that deinterlaces the given block by
  8690. linearly interpolating every second line.
  8691. @item ci/cubicipoldeint
  8692. Cubic interpolating deinterlacing filter deinterlaces the given block by
  8693. cubically interpolating every second line.
  8694. @item md/mediandeint
  8695. Median deinterlacing filter that deinterlaces the given block by applying a
  8696. median filter to every second line.
  8697. @item fd/ffmpegdeint
  8698. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  8699. second line with a @code{(-1 4 2 4 -1)} filter.
  8700. @item l5/lowpass5
  8701. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  8702. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  8703. @item fq/forceQuant[|quantizer]
  8704. Overrides the quantizer table from the input with the constant quantizer you
  8705. specify.
  8706. @table @option
  8707. @item quantizer
  8708. Quantizer to use
  8709. @end table
  8710. @item de/default
  8711. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  8712. @item fa/fast
  8713. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  8714. @item ac
  8715. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  8716. @end table
  8717. @subsection Examples
  8718. @itemize
  8719. @item
  8720. Apply horizontal and vertical deblocking, deringing and automatic
  8721. brightness/contrast:
  8722. @example
  8723. pp=hb/vb/dr/al
  8724. @end example
  8725. @item
  8726. Apply default filters without brightness/contrast correction:
  8727. @example
  8728. pp=de/-al
  8729. @end example
  8730. @item
  8731. Apply default filters and temporal denoiser:
  8732. @example
  8733. pp=default/tmpnoise|1|2|3
  8734. @end example
  8735. @item
  8736. Apply deblocking on luminance only, and switch vertical deblocking on or off
  8737. automatically depending on available CPU time:
  8738. @example
  8739. pp=hb|y/vb|a
  8740. @end example
  8741. @end itemize
  8742. @section pp7
  8743. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  8744. similar to spp = 6 with 7 point DCT, where only the center sample is
  8745. used after IDCT.
  8746. The filter accepts the following options:
  8747. @table @option
  8748. @item qp
  8749. Force a constant quantization parameter. It accepts an integer in range
  8750. 0 to 63. If not set, the filter will use the QP from the video stream
  8751. (if available).
  8752. @item mode
  8753. Set thresholding mode. Available modes are:
  8754. @table @samp
  8755. @item hard
  8756. Set hard thresholding.
  8757. @item soft
  8758. Set soft thresholding (better de-ringing effect, but likely blurrier).
  8759. @item medium
  8760. Set medium thresholding (good results, default).
  8761. @end table
  8762. @end table
  8763. @section premultiply
  8764. Apply alpha premultiply effect to input video stream using first plane
  8765. of second stream as alpha.
  8766. Both streams must have same dimensions and same pixel format.
  8767. The filter accepts the following option:
  8768. @table @option
  8769. @item planes
  8770. Set which planes will be processed, unprocessed planes will be copied.
  8771. By default value 0xf, all planes will be processed.
  8772. @end table
  8773. @section prewitt
  8774. Apply prewitt operator to input video stream.
  8775. The filter accepts the following option:
  8776. @table @option
  8777. @item planes
  8778. Set which planes will be processed, unprocessed planes will be copied.
  8779. By default value 0xf, all planes will be processed.
  8780. @item scale
  8781. Set value which will be multiplied with filtered result.
  8782. @item delta
  8783. Set value which will be added to filtered result.
  8784. @end table
  8785. @section psnr
  8786. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  8787. Ratio) between two input videos.
  8788. This filter takes in input two input videos, the first input is
  8789. considered the "main" source and is passed unchanged to the
  8790. output. The second input is used as a "reference" video for computing
  8791. the PSNR.
  8792. Both video inputs must have the same resolution and pixel format for
  8793. this filter to work correctly. Also it assumes that both inputs
  8794. have the same number of frames, which are compared one by one.
  8795. The obtained average PSNR is printed through the logging system.
  8796. The filter stores the accumulated MSE (mean squared error) of each
  8797. frame, and at the end of the processing it is averaged across all frames
  8798. equally, and the following formula is applied to obtain the PSNR:
  8799. @example
  8800. PSNR = 10*log10(MAX^2/MSE)
  8801. @end example
  8802. Where MAX is the average of the maximum values of each component of the
  8803. image.
  8804. The description of the accepted parameters follows.
  8805. @table @option
  8806. @item stats_file, f
  8807. If specified the filter will use the named file to save the PSNR of
  8808. each individual frame. When filename equals "-" the data is sent to
  8809. standard output.
  8810. @item stats_version
  8811. Specifies which version of the stats file format to use. Details of
  8812. each format are written below.
  8813. Default value is 1.
  8814. @item stats_add_max
  8815. Determines whether the max value is output to the stats log.
  8816. Default value is 0.
  8817. Requires stats_version >= 2. If this is set and stats_version < 2,
  8818. the filter will return an error.
  8819. @end table
  8820. The file printed if @var{stats_file} is selected, contains a sequence of
  8821. key/value pairs of the form @var{key}:@var{value} for each compared
  8822. couple of frames.
  8823. If a @var{stats_version} greater than 1 is specified, a header line precedes
  8824. the list of per-frame-pair stats, with key value pairs following the frame
  8825. format with the following parameters:
  8826. @table @option
  8827. @item psnr_log_version
  8828. The version of the log file format. Will match @var{stats_version}.
  8829. @item fields
  8830. A comma separated list of the per-frame-pair parameters included in
  8831. the log.
  8832. @end table
  8833. A description of each shown per-frame-pair parameter follows:
  8834. @table @option
  8835. @item n
  8836. sequential number of the input frame, starting from 1
  8837. @item mse_avg
  8838. Mean Square Error pixel-by-pixel average difference of the compared
  8839. frames, averaged over all the image components.
  8840. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  8841. Mean Square Error pixel-by-pixel average difference of the compared
  8842. frames for the component specified by the suffix.
  8843. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  8844. Peak Signal to Noise ratio of the compared frames for the component
  8845. specified by the suffix.
  8846. @item max_avg, max_y, max_u, max_v
  8847. Maximum allowed value for each channel, and average over all
  8848. channels.
  8849. @end table
  8850. For example:
  8851. @example
  8852. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  8853. [main][ref] psnr="stats_file=stats.log" [out]
  8854. @end example
  8855. On this example the input file being processed is compared with the
  8856. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  8857. is stored in @file{stats.log}.
  8858. @anchor{pullup}
  8859. @section pullup
  8860. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  8861. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  8862. content.
  8863. The pullup filter is designed to take advantage of future context in making
  8864. its decisions. This filter is stateless in the sense that it does not lock
  8865. onto a pattern to follow, but it instead looks forward to the following
  8866. fields in order to identify matches and rebuild progressive frames.
  8867. To produce content with an even framerate, insert the fps filter after
  8868. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  8869. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  8870. The filter accepts the following options:
  8871. @table @option
  8872. @item jl
  8873. @item jr
  8874. @item jt
  8875. @item jb
  8876. These options set the amount of "junk" to ignore at the left, right, top, and
  8877. bottom of the image, respectively. Left and right are in units of 8 pixels,
  8878. while top and bottom are in units of 2 lines.
  8879. The default is 8 pixels on each side.
  8880. @item sb
  8881. Set the strict breaks. Setting this option to 1 will reduce the chances of
  8882. filter generating an occasional mismatched frame, but it may also cause an
  8883. excessive number of frames to be dropped during high motion sequences.
  8884. Conversely, setting it to -1 will make filter match fields more easily.
  8885. This may help processing of video where there is slight blurring between
  8886. the fields, but may also cause there to be interlaced frames in the output.
  8887. Default value is @code{0}.
  8888. @item mp
  8889. Set the metric plane to use. It accepts the following values:
  8890. @table @samp
  8891. @item l
  8892. Use luma plane.
  8893. @item u
  8894. Use chroma blue plane.
  8895. @item v
  8896. Use chroma red plane.
  8897. @end table
  8898. This option may be set to use chroma plane instead of the default luma plane
  8899. for doing filter's computations. This may improve accuracy on very clean
  8900. source material, but more likely will decrease accuracy, especially if there
  8901. is chroma noise (rainbow effect) or any grayscale video.
  8902. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  8903. load and make pullup usable in realtime on slow machines.
  8904. @end table
  8905. For best results (without duplicated frames in the output file) it is
  8906. necessary to change the output frame rate. For example, to inverse
  8907. telecine NTSC input:
  8908. @example
  8909. ffmpeg -i input -vf pullup -r 24000/1001 ...
  8910. @end example
  8911. @section qp
  8912. Change video quantization parameters (QP).
  8913. The filter accepts the following option:
  8914. @table @option
  8915. @item qp
  8916. Set expression for quantization parameter.
  8917. @end table
  8918. The expression is evaluated through the eval API and can contain, among others,
  8919. the following constants:
  8920. @table @var
  8921. @item known
  8922. 1 if index is not 129, 0 otherwise.
  8923. @item qp
  8924. Sequentional index starting from -129 to 128.
  8925. @end table
  8926. @subsection Examples
  8927. @itemize
  8928. @item
  8929. Some equation like:
  8930. @example
  8931. qp=2+2*sin(PI*qp)
  8932. @end example
  8933. @end itemize
  8934. @section random
  8935. Flush video frames from internal cache of frames into a random order.
  8936. No frame is discarded.
  8937. Inspired by @ref{frei0r} nervous filter.
  8938. @table @option
  8939. @item frames
  8940. Set size in number of frames of internal cache, in range from @code{2} to
  8941. @code{512}. Default is @code{30}.
  8942. @item seed
  8943. Set seed for random number generator, must be an integer included between
  8944. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  8945. less than @code{0}, the filter will try to use a good random seed on a
  8946. best effort basis.
  8947. @end table
  8948. @section readeia608
  8949. Read closed captioning (EIA-608) information from the top lines of a video frame.
  8950. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  8951. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  8952. with EIA-608 data (starting from 0). A description of each metadata value follows:
  8953. @table @option
  8954. @item lavfi.readeia608.X.cc
  8955. The two bytes stored as EIA-608 data (printed in hexadecimal).
  8956. @item lavfi.readeia608.X.line
  8957. The number of the line on which the EIA-608 data was identified and read.
  8958. @end table
  8959. This filter accepts the following options:
  8960. @table @option
  8961. @item scan_min
  8962. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  8963. @item scan_max
  8964. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  8965. @item mac
  8966. Set minimal acceptable amplitude change for sync codes detection.
  8967. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  8968. @item spw
  8969. Set the ratio of width reserved for sync code detection.
  8970. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  8971. @item mhd
  8972. Set the max peaks height difference for sync code detection.
  8973. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  8974. @item mpd
  8975. Set max peaks period difference for sync code detection.
  8976. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  8977. @item msd
  8978. Set the first two max start code bits differences.
  8979. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  8980. @item bhd
  8981. Set the minimum ratio of bits height compared to 3rd start code bit.
  8982. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  8983. @item th_w
  8984. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  8985. @item th_b
  8986. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  8987. @item chp
  8988. Enable checking the parity bit. In the event of a parity error, the filter will output
  8989. @code{0x00} for that character. Default is false.
  8990. @end table
  8991. @subsection Examples
  8992. @itemize
  8993. @item
  8994. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  8995. @example
  8996. ffprobe -f lavfi -i movie=captioned_video.mov,readeia608 -show_entries frame=pkt_pts_time:frame_tags=lavfi.readeia608.0.cc,lavfi.readeia608.1.cc -of csv
  8997. @end example
  8998. @end itemize
  8999. @section readvitc
  9000. Read vertical interval timecode (VITC) information from the top lines of a
  9001. video frame.
  9002. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  9003. timecode value, if a valid timecode has been detected. Further metadata key
  9004. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  9005. timecode data has been found or not.
  9006. This filter accepts the following options:
  9007. @table @option
  9008. @item scan_max
  9009. Set the maximum number of lines to scan for VITC data. If the value is set to
  9010. @code{-1} the full video frame is scanned. Default is @code{45}.
  9011. @item thr_b
  9012. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  9013. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  9014. @item thr_w
  9015. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  9016. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  9017. @end table
  9018. @subsection Examples
  9019. @itemize
  9020. @item
  9021. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  9022. draw @code{--:--:--:--} as a placeholder:
  9023. @example
  9024. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  9025. @end example
  9026. @end itemize
  9027. @section remap
  9028. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  9029. Destination pixel at position (X, Y) will be picked from source (x, y) position
  9030. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  9031. value for pixel will be used for destination pixel.
  9032. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  9033. will have Xmap/Ymap video stream dimensions.
  9034. Xmap and Ymap input video streams are 16bit depth, single channel.
  9035. @section removegrain
  9036. The removegrain filter is a spatial denoiser for progressive video.
  9037. @table @option
  9038. @item m0
  9039. Set mode for the first plane.
  9040. @item m1
  9041. Set mode for the second plane.
  9042. @item m2
  9043. Set mode for the third plane.
  9044. @item m3
  9045. Set mode for the fourth plane.
  9046. @end table
  9047. Range of mode is from 0 to 24. Description of each mode follows:
  9048. @table @var
  9049. @item 0
  9050. Leave input plane unchanged. Default.
  9051. @item 1
  9052. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  9053. @item 2
  9054. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  9055. @item 3
  9056. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  9057. @item 4
  9058. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  9059. This is equivalent to a median filter.
  9060. @item 5
  9061. Line-sensitive clipping giving the minimal change.
  9062. @item 6
  9063. Line-sensitive clipping, intermediate.
  9064. @item 7
  9065. Line-sensitive clipping, intermediate.
  9066. @item 8
  9067. Line-sensitive clipping, intermediate.
  9068. @item 9
  9069. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  9070. @item 10
  9071. Replaces the target pixel with the closest neighbour.
  9072. @item 11
  9073. [1 2 1] horizontal and vertical kernel blur.
  9074. @item 12
  9075. Same as mode 11.
  9076. @item 13
  9077. Bob mode, interpolates top field from the line where the neighbours
  9078. pixels are the closest.
  9079. @item 14
  9080. Bob mode, interpolates bottom field from the line where the neighbours
  9081. pixels are the closest.
  9082. @item 15
  9083. Bob mode, interpolates top field. Same as 13 but with a more complicated
  9084. interpolation formula.
  9085. @item 16
  9086. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  9087. interpolation formula.
  9088. @item 17
  9089. Clips the pixel with the minimum and maximum of respectively the maximum and
  9090. minimum of each pair of opposite neighbour pixels.
  9091. @item 18
  9092. Line-sensitive clipping using opposite neighbours whose greatest distance from
  9093. the current pixel is minimal.
  9094. @item 19
  9095. Replaces the pixel with the average of its 8 neighbours.
  9096. @item 20
  9097. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  9098. @item 21
  9099. Clips pixels using the averages of opposite neighbour.
  9100. @item 22
  9101. Same as mode 21 but simpler and faster.
  9102. @item 23
  9103. Small edge and halo removal, but reputed useless.
  9104. @item 24
  9105. Similar as 23.
  9106. @end table
  9107. @section removelogo
  9108. Suppress a TV station logo, using an image file to determine which
  9109. pixels comprise the logo. It works by filling in the pixels that
  9110. comprise the logo with neighboring pixels.
  9111. The filter accepts the following options:
  9112. @table @option
  9113. @item filename, f
  9114. Set the filter bitmap file, which can be any image format supported by
  9115. libavformat. The width and height of the image file must match those of the
  9116. video stream being processed.
  9117. @end table
  9118. Pixels in the provided bitmap image with a value of zero are not
  9119. considered part of the logo, non-zero pixels are considered part of
  9120. the logo. If you use white (255) for the logo and black (0) for the
  9121. rest, you will be safe. For making the filter bitmap, it is
  9122. recommended to take a screen capture of a black frame with the logo
  9123. visible, and then using a threshold filter followed by the erode
  9124. filter once or twice.
  9125. If needed, little splotches can be fixed manually. Remember that if
  9126. logo pixels are not covered, the filter quality will be much
  9127. reduced. Marking too many pixels as part of the logo does not hurt as
  9128. much, but it will increase the amount of blurring needed to cover over
  9129. the image and will destroy more information than necessary, and extra
  9130. pixels will slow things down on a large logo.
  9131. @section repeatfields
  9132. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  9133. fields based on its value.
  9134. @section reverse
  9135. Reverse a video clip.
  9136. Warning: This filter requires memory to buffer the entire clip, so trimming
  9137. is suggested.
  9138. @subsection Examples
  9139. @itemize
  9140. @item
  9141. Take the first 5 seconds of a clip, and reverse it.
  9142. @example
  9143. trim=end=5,reverse
  9144. @end example
  9145. @end itemize
  9146. @section rotate
  9147. Rotate video by an arbitrary angle expressed in radians.
  9148. The filter accepts the following options:
  9149. A description of the optional parameters follows.
  9150. @table @option
  9151. @item angle, a
  9152. Set an expression for the angle by which to rotate the input video
  9153. clockwise, expressed as a number of radians. A negative value will
  9154. result in a counter-clockwise rotation. By default it is set to "0".
  9155. This expression is evaluated for each frame.
  9156. @item out_w, ow
  9157. Set the output width expression, default value is "iw".
  9158. This expression is evaluated just once during configuration.
  9159. @item out_h, oh
  9160. Set the output height expression, default value is "ih".
  9161. This expression is evaluated just once during configuration.
  9162. @item bilinear
  9163. Enable bilinear interpolation if set to 1, a value of 0 disables
  9164. it. Default value is 1.
  9165. @item fillcolor, c
  9166. Set the color used to fill the output area not covered by the rotated
  9167. image. For the general syntax of this option, check the "Color" section in the
  9168. ffmpeg-utils manual. If the special value "none" is selected then no
  9169. background is printed (useful for example if the background is never shown).
  9170. Default value is "black".
  9171. @end table
  9172. The expressions for the angle and the output size can contain the
  9173. following constants and functions:
  9174. @table @option
  9175. @item n
  9176. sequential number of the input frame, starting from 0. It is always NAN
  9177. before the first frame is filtered.
  9178. @item t
  9179. time in seconds of the input frame, it is set to 0 when the filter is
  9180. configured. It is always NAN before the first frame is filtered.
  9181. @item hsub
  9182. @item vsub
  9183. horizontal and vertical chroma subsample values. For example for the
  9184. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9185. @item in_w, iw
  9186. @item in_h, ih
  9187. the input video width and height
  9188. @item out_w, ow
  9189. @item out_h, oh
  9190. the output width and height, that is the size of the padded area as
  9191. specified by the @var{width} and @var{height} expressions
  9192. @item rotw(a)
  9193. @item roth(a)
  9194. the minimal width/height required for completely containing the input
  9195. video rotated by @var{a} radians.
  9196. These are only available when computing the @option{out_w} and
  9197. @option{out_h} expressions.
  9198. @end table
  9199. @subsection Examples
  9200. @itemize
  9201. @item
  9202. Rotate the input by PI/6 radians clockwise:
  9203. @example
  9204. rotate=PI/6
  9205. @end example
  9206. @item
  9207. Rotate the input by PI/6 radians counter-clockwise:
  9208. @example
  9209. rotate=-PI/6
  9210. @end example
  9211. @item
  9212. Rotate the input by 45 degrees clockwise:
  9213. @example
  9214. rotate=45*PI/180
  9215. @end example
  9216. @item
  9217. Apply a constant rotation with period T, starting from an angle of PI/3:
  9218. @example
  9219. rotate=PI/3+2*PI*t/T
  9220. @end example
  9221. @item
  9222. Make the input video rotation oscillating with a period of T
  9223. seconds and an amplitude of A radians:
  9224. @example
  9225. rotate=A*sin(2*PI/T*t)
  9226. @end example
  9227. @item
  9228. Rotate the video, output size is chosen so that the whole rotating
  9229. input video is always completely contained in the output:
  9230. @example
  9231. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  9232. @end example
  9233. @item
  9234. Rotate the video, reduce the output size so that no background is ever
  9235. shown:
  9236. @example
  9237. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  9238. @end example
  9239. @end itemize
  9240. @subsection Commands
  9241. The filter supports the following commands:
  9242. @table @option
  9243. @item a, angle
  9244. Set the angle expression.
  9245. The command accepts the same syntax of the corresponding option.
  9246. If the specified expression is not valid, it is kept at its current
  9247. value.
  9248. @end table
  9249. @section sab
  9250. Apply Shape Adaptive Blur.
  9251. The filter accepts the following options:
  9252. @table @option
  9253. @item luma_radius, lr
  9254. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  9255. value is 1.0. A greater value will result in a more blurred image, and
  9256. in slower processing.
  9257. @item luma_pre_filter_radius, lpfr
  9258. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  9259. value is 1.0.
  9260. @item luma_strength, ls
  9261. Set luma maximum difference between pixels to still be considered, must
  9262. be a value in the 0.1-100.0 range, default value is 1.0.
  9263. @item chroma_radius, cr
  9264. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  9265. greater value will result in a more blurred image, and in slower
  9266. processing.
  9267. @item chroma_pre_filter_radius, cpfr
  9268. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  9269. @item chroma_strength, cs
  9270. Set chroma maximum difference between pixels to still be considered,
  9271. must be a value in the -0.9-100.0 range.
  9272. @end table
  9273. Each chroma option value, if not explicitly specified, is set to the
  9274. corresponding luma option value.
  9275. @anchor{scale}
  9276. @section scale
  9277. Scale (resize) the input video, using the libswscale library.
  9278. The scale filter forces the output display aspect ratio to be the same
  9279. of the input, by changing the output sample aspect ratio.
  9280. If the input image format is different from the format requested by
  9281. the next filter, the scale filter will convert the input to the
  9282. requested format.
  9283. @subsection Options
  9284. The filter accepts the following options, or any of the options
  9285. supported by the libswscale scaler.
  9286. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  9287. the complete list of scaler options.
  9288. @table @option
  9289. @item width, w
  9290. @item height, h
  9291. Set the output video dimension expression. Default value is the input
  9292. dimension.
  9293. If the value is 0, the input width is used for the output.
  9294. If one of the values is -1, the scale filter will use a value that
  9295. maintains the aspect ratio of the input image, calculated from the
  9296. other specified dimension. If both of them are -1, the input size is
  9297. used
  9298. If one of the values is -n with n > 1, the scale filter will also use a value
  9299. that maintains the aspect ratio of the input image, calculated from the other
  9300. specified dimension. After that it will, however, make sure that the calculated
  9301. dimension is divisible by n and adjust the value if necessary.
  9302. See below for the list of accepted constants for use in the dimension
  9303. expression.
  9304. @item eval
  9305. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  9306. @table @samp
  9307. @item init
  9308. Only evaluate expressions once during the filter initialization or when a command is processed.
  9309. @item frame
  9310. Evaluate expressions for each incoming frame.
  9311. @end table
  9312. Default value is @samp{init}.
  9313. @item interl
  9314. Set the interlacing mode. It accepts the following values:
  9315. @table @samp
  9316. @item 1
  9317. Force interlaced aware scaling.
  9318. @item 0
  9319. Do not apply interlaced scaling.
  9320. @item -1
  9321. Select interlaced aware scaling depending on whether the source frames
  9322. are flagged as interlaced or not.
  9323. @end table
  9324. Default value is @samp{0}.
  9325. @item flags
  9326. Set libswscale scaling flags. See
  9327. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9328. complete list of values. If not explicitly specified the filter applies
  9329. the default flags.
  9330. @item param0, param1
  9331. Set libswscale input parameters for scaling algorithms that need them. See
  9332. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9333. complete documentation. If not explicitly specified the filter applies
  9334. empty parameters.
  9335. @item size, s
  9336. Set the video size. For the syntax of this option, check the
  9337. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9338. @item in_color_matrix
  9339. @item out_color_matrix
  9340. Set in/output YCbCr color space type.
  9341. This allows the autodetected value to be overridden as well as allows forcing
  9342. a specific value used for the output and encoder.
  9343. If not specified, the color space type depends on the pixel format.
  9344. Possible values:
  9345. @table @samp
  9346. @item auto
  9347. Choose automatically.
  9348. @item bt709
  9349. Format conforming to International Telecommunication Union (ITU)
  9350. Recommendation BT.709.
  9351. @item fcc
  9352. Set color space conforming to the United States Federal Communications
  9353. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  9354. @item bt601
  9355. Set color space conforming to:
  9356. @itemize
  9357. @item
  9358. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  9359. @item
  9360. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  9361. @item
  9362. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  9363. @end itemize
  9364. @item smpte240m
  9365. Set color space conforming to SMPTE ST 240:1999.
  9366. @end table
  9367. @item in_range
  9368. @item out_range
  9369. Set in/output YCbCr sample range.
  9370. This allows the autodetected value to be overridden as well as allows forcing
  9371. a specific value used for the output and encoder. If not specified, the
  9372. range depends on the pixel format. Possible values:
  9373. @table @samp
  9374. @item auto
  9375. Choose automatically.
  9376. @item jpeg/full/pc
  9377. Set full range (0-255 in case of 8-bit luma).
  9378. @item mpeg/tv
  9379. Set "MPEG" range (16-235 in case of 8-bit luma).
  9380. @end table
  9381. @item force_original_aspect_ratio
  9382. Enable decreasing or increasing output video width or height if necessary to
  9383. keep the original aspect ratio. Possible values:
  9384. @table @samp
  9385. @item disable
  9386. Scale the video as specified and disable this feature.
  9387. @item decrease
  9388. The output video dimensions will automatically be decreased if needed.
  9389. @item increase
  9390. The output video dimensions will automatically be increased if needed.
  9391. @end table
  9392. One useful instance of this option is that when you know a specific device's
  9393. maximum allowed resolution, you can use this to limit the output video to
  9394. that, while retaining the aspect ratio. For example, device A allows
  9395. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  9396. decrease) and specifying 1280x720 to the command line makes the output
  9397. 1280x533.
  9398. Please note that this is a different thing than specifying -1 for @option{w}
  9399. or @option{h}, you still need to specify the output resolution for this option
  9400. to work.
  9401. @end table
  9402. The values of the @option{w} and @option{h} options are expressions
  9403. containing the following constants:
  9404. @table @var
  9405. @item in_w
  9406. @item in_h
  9407. The input width and height
  9408. @item iw
  9409. @item ih
  9410. These are the same as @var{in_w} and @var{in_h}.
  9411. @item out_w
  9412. @item out_h
  9413. The output (scaled) width and height
  9414. @item ow
  9415. @item oh
  9416. These are the same as @var{out_w} and @var{out_h}
  9417. @item a
  9418. The same as @var{iw} / @var{ih}
  9419. @item sar
  9420. input sample aspect ratio
  9421. @item dar
  9422. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  9423. @item hsub
  9424. @item vsub
  9425. horizontal and vertical input chroma subsample values. For example for the
  9426. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9427. @item ohsub
  9428. @item ovsub
  9429. horizontal and vertical output chroma subsample values. For example for the
  9430. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9431. @end table
  9432. @subsection Examples
  9433. @itemize
  9434. @item
  9435. Scale the input video to a size of 200x100
  9436. @example
  9437. scale=w=200:h=100
  9438. @end example
  9439. This is equivalent to:
  9440. @example
  9441. scale=200:100
  9442. @end example
  9443. or:
  9444. @example
  9445. scale=200x100
  9446. @end example
  9447. @item
  9448. Specify a size abbreviation for the output size:
  9449. @example
  9450. scale=qcif
  9451. @end example
  9452. which can also be written as:
  9453. @example
  9454. scale=size=qcif
  9455. @end example
  9456. @item
  9457. Scale the input to 2x:
  9458. @example
  9459. scale=w=2*iw:h=2*ih
  9460. @end example
  9461. @item
  9462. The above is the same as:
  9463. @example
  9464. scale=2*in_w:2*in_h
  9465. @end example
  9466. @item
  9467. Scale the input to 2x with forced interlaced scaling:
  9468. @example
  9469. scale=2*iw:2*ih:interl=1
  9470. @end example
  9471. @item
  9472. Scale the input to half size:
  9473. @example
  9474. scale=w=iw/2:h=ih/2
  9475. @end example
  9476. @item
  9477. Increase the width, and set the height to the same size:
  9478. @example
  9479. scale=3/2*iw:ow
  9480. @end example
  9481. @item
  9482. Seek Greek harmony:
  9483. @example
  9484. scale=iw:1/PHI*iw
  9485. scale=ih*PHI:ih
  9486. @end example
  9487. @item
  9488. Increase the height, and set the width to 3/2 of the height:
  9489. @example
  9490. scale=w=3/2*oh:h=3/5*ih
  9491. @end example
  9492. @item
  9493. Increase the size, making the size a multiple of the chroma
  9494. subsample values:
  9495. @example
  9496. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  9497. @end example
  9498. @item
  9499. Increase the width to a maximum of 500 pixels,
  9500. keeping the same aspect ratio as the input:
  9501. @example
  9502. scale=w='min(500\, iw*3/2):h=-1'
  9503. @end example
  9504. @end itemize
  9505. @subsection Commands
  9506. This filter supports the following commands:
  9507. @table @option
  9508. @item width, w
  9509. @item height, h
  9510. Set the output video dimension expression.
  9511. The command accepts the same syntax of the corresponding option.
  9512. If the specified expression is not valid, it is kept at its current
  9513. value.
  9514. @end table
  9515. @section scale_npp
  9516. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  9517. format conversion on CUDA video frames. Setting the output width and height
  9518. works in the same way as for the @var{scale} filter.
  9519. The following additional options are accepted:
  9520. @table @option
  9521. @item format
  9522. The pixel format of the output CUDA frames. If set to the string "same" (the
  9523. default), the input format will be kept. Note that automatic format negotiation
  9524. and conversion is not yet supported for hardware frames
  9525. @item interp_algo
  9526. The interpolation algorithm used for resizing. One of the following:
  9527. @table @option
  9528. @item nn
  9529. Nearest neighbour.
  9530. @item linear
  9531. @item cubic
  9532. @item cubic2p_bspline
  9533. 2-parameter cubic (B=1, C=0)
  9534. @item cubic2p_catmullrom
  9535. 2-parameter cubic (B=0, C=1/2)
  9536. @item cubic2p_b05c03
  9537. 2-parameter cubic (B=1/2, C=3/10)
  9538. @item super
  9539. Supersampling
  9540. @item lanczos
  9541. @end table
  9542. @end table
  9543. @section scale2ref
  9544. Scale (resize) the input video, based on a reference video.
  9545. See the scale filter for available options, scale2ref supports the same but
  9546. uses the reference video instead of the main input as basis. scale2ref also
  9547. supports the following additional constants for the @option{w} and
  9548. @option{h} options:
  9549. @table @var
  9550. @item main_w
  9551. @item main_h
  9552. The main input video's width and height
  9553. @item main_a
  9554. The same as @var{main_w} / @var{main_h}
  9555. @item main_sar
  9556. The main input video's sample aspect ratio
  9557. @item main_dar, mdar
  9558. The main input video's display aspect ratio. Calculated from
  9559. @code{(main_w / main_h) * main_sar}.
  9560. @item main_hsub
  9561. @item main_vsub
  9562. The main input video's horizontal and vertical chroma subsample values.
  9563. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  9564. is 1.
  9565. @end table
  9566. @subsection Examples
  9567. @itemize
  9568. @item
  9569. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  9570. @example
  9571. 'scale2ref[b][a];[a][b]overlay'
  9572. @end example
  9573. @end itemize
  9574. @anchor{selectivecolor}
  9575. @section selectivecolor
  9576. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  9577. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  9578. by the "purity" of the color (that is, how saturated it already is).
  9579. This filter is similar to the Adobe Photoshop Selective Color tool.
  9580. The filter accepts the following options:
  9581. @table @option
  9582. @item correction_method
  9583. Select color correction method.
  9584. Available values are:
  9585. @table @samp
  9586. @item absolute
  9587. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  9588. component value).
  9589. @item relative
  9590. Specified adjustments are relative to the original component value.
  9591. @end table
  9592. Default is @code{absolute}.
  9593. @item reds
  9594. Adjustments for red pixels (pixels where the red component is the maximum)
  9595. @item yellows
  9596. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  9597. @item greens
  9598. Adjustments for green pixels (pixels where the green component is the maximum)
  9599. @item cyans
  9600. Adjustments for cyan pixels (pixels where the red component is the minimum)
  9601. @item blues
  9602. Adjustments for blue pixels (pixels where the blue component is the maximum)
  9603. @item magentas
  9604. Adjustments for magenta pixels (pixels where the green component is the minimum)
  9605. @item whites
  9606. Adjustments for white pixels (pixels where all components are greater than 128)
  9607. @item neutrals
  9608. Adjustments for all pixels except pure black and pure white
  9609. @item blacks
  9610. Adjustments for black pixels (pixels where all components are lesser than 128)
  9611. @item psfile
  9612. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  9613. @end table
  9614. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  9615. 4 space separated floating point adjustment values in the [-1,1] range,
  9616. respectively to adjust the amount of cyan, magenta, yellow and black for the
  9617. pixels of its range.
  9618. @subsection Examples
  9619. @itemize
  9620. @item
  9621. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  9622. increase magenta by 27% in blue areas:
  9623. @example
  9624. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  9625. @end example
  9626. @item
  9627. Use a Photoshop selective color preset:
  9628. @example
  9629. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  9630. @end example
  9631. @end itemize
  9632. @anchor{separatefields}
  9633. @section separatefields
  9634. The @code{separatefields} takes a frame-based video input and splits
  9635. each frame into its components fields, producing a new half height clip
  9636. with twice the frame rate and twice the frame count.
  9637. This filter use field-dominance information in frame to decide which
  9638. of each pair of fields to place first in the output.
  9639. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  9640. @section setdar, setsar
  9641. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  9642. output video.
  9643. This is done by changing the specified Sample (aka Pixel) Aspect
  9644. Ratio, according to the following equation:
  9645. @example
  9646. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  9647. @end example
  9648. Keep in mind that the @code{setdar} filter does not modify the pixel
  9649. dimensions of the video frame. Also, the display aspect ratio set by
  9650. this filter may be changed by later filters in the filterchain,
  9651. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  9652. applied.
  9653. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  9654. the filter output video.
  9655. Note that as a consequence of the application of this filter, the
  9656. output display aspect ratio will change according to the equation
  9657. above.
  9658. Keep in mind that the sample aspect ratio set by the @code{setsar}
  9659. filter may be changed by later filters in the filterchain, e.g. if
  9660. another "setsar" or a "setdar" filter is applied.
  9661. It accepts the following parameters:
  9662. @table @option
  9663. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  9664. Set the aspect ratio used by the filter.
  9665. The parameter can be a floating point number string, an expression, or
  9666. a string of the form @var{num}:@var{den}, where @var{num} and
  9667. @var{den} are the numerator and denominator of the aspect ratio. If
  9668. the parameter is not specified, it is assumed the value "0".
  9669. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  9670. should be escaped.
  9671. @item max
  9672. Set the maximum integer value to use for expressing numerator and
  9673. denominator when reducing the expressed aspect ratio to a rational.
  9674. Default value is @code{100}.
  9675. @end table
  9676. The parameter @var{sar} is an expression containing
  9677. the following constants:
  9678. @table @option
  9679. @item E, PI, PHI
  9680. These are approximated values for the mathematical constants e
  9681. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  9682. @item w, h
  9683. The input width and height.
  9684. @item a
  9685. These are the same as @var{w} / @var{h}.
  9686. @item sar
  9687. The input sample aspect ratio.
  9688. @item dar
  9689. The input display aspect ratio. It is the same as
  9690. (@var{w} / @var{h}) * @var{sar}.
  9691. @item hsub, vsub
  9692. Horizontal and vertical chroma subsample values. For example, for the
  9693. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9694. @end table
  9695. @subsection Examples
  9696. @itemize
  9697. @item
  9698. To change the display aspect ratio to 16:9, specify one of the following:
  9699. @example
  9700. setdar=dar=1.77777
  9701. setdar=dar=16/9
  9702. @end example
  9703. @item
  9704. To change the sample aspect ratio to 10:11, specify:
  9705. @example
  9706. setsar=sar=10/11
  9707. @end example
  9708. @item
  9709. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  9710. 1000 in the aspect ratio reduction, use the command:
  9711. @example
  9712. setdar=ratio=16/9:max=1000
  9713. @end example
  9714. @end itemize
  9715. @anchor{setfield}
  9716. @section setfield
  9717. Force field for the output video frame.
  9718. The @code{setfield} filter marks the interlace type field for the
  9719. output frames. It does not change the input frame, but only sets the
  9720. corresponding property, which affects how the frame is treated by
  9721. following filters (e.g. @code{fieldorder} or @code{yadif}).
  9722. The filter accepts the following options:
  9723. @table @option
  9724. @item mode
  9725. Available values are:
  9726. @table @samp
  9727. @item auto
  9728. Keep the same field property.
  9729. @item bff
  9730. Mark the frame as bottom-field-first.
  9731. @item tff
  9732. Mark the frame as top-field-first.
  9733. @item prog
  9734. Mark the frame as progressive.
  9735. @end table
  9736. @end table
  9737. @section showinfo
  9738. Show a line containing various information for each input video frame.
  9739. The input video is not modified.
  9740. The shown line contains a sequence of key/value pairs of the form
  9741. @var{key}:@var{value}.
  9742. The following values are shown in the output:
  9743. @table @option
  9744. @item n
  9745. The (sequential) number of the input frame, starting from 0.
  9746. @item pts
  9747. The Presentation TimeStamp of the input frame, expressed as a number of
  9748. time base units. The time base unit depends on the filter input pad.
  9749. @item pts_time
  9750. The Presentation TimeStamp of the input frame, expressed as a number of
  9751. seconds.
  9752. @item pos
  9753. The position of the frame in the input stream, or -1 if this information is
  9754. unavailable and/or meaningless (for example in case of synthetic video).
  9755. @item fmt
  9756. The pixel format name.
  9757. @item sar
  9758. The sample aspect ratio of the input frame, expressed in the form
  9759. @var{num}/@var{den}.
  9760. @item s
  9761. The size of the input frame. For the syntax of this option, check the
  9762. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9763. @item i
  9764. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  9765. for bottom field first).
  9766. @item iskey
  9767. This is 1 if the frame is a key frame, 0 otherwise.
  9768. @item type
  9769. The picture type of the input frame ("I" for an I-frame, "P" for a
  9770. P-frame, "B" for a B-frame, or "?" for an unknown type).
  9771. Also refer to the documentation of the @code{AVPictureType} enum and of
  9772. the @code{av_get_picture_type_char} function defined in
  9773. @file{libavutil/avutil.h}.
  9774. @item checksum
  9775. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  9776. @item plane_checksum
  9777. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  9778. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  9779. @end table
  9780. @section showpalette
  9781. Displays the 256 colors palette of each frame. This filter is only relevant for
  9782. @var{pal8} pixel format frames.
  9783. It accepts the following option:
  9784. @table @option
  9785. @item s
  9786. Set the size of the box used to represent one palette color entry. Default is
  9787. @code{30} (for a @code{30x30} pixel box).
  9788. @end table
  9789. @section shuffleframes
  9790. Reorder and/or duplicate and/or drop video frames.
  9791. It accepts the following parameters:
  9792. @table @option
  9793. @item mapping
  9794. Set the destination indexes of input frames.
  9795. This is space or '|' separated list of indexes that maps input frames to output
  9796. frames. Number of indexes also sets maximal value that each index may have.
  9797. '-1' index have special meaning and that is to drop frame.
  9798. @end table
  9799. The first frame has the index 0. The default is to keep the input unchanged.
  9800. @subsection Examples
  9801. @itemize
  9802. @item
  9803. Swap second and third frame of every three frames of the input:
  9804. @example
  9805. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  9806. @end example
  9807. @item
  9808. Swap 10th and 1st frame of every ten frames of the input:
  9809. @example
  9810. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  9811. @end example
  9812. @end itemize
  9813. @section shuffleplanes
  9814. Reorder and/or duplicate video planes.
  9815. It accepts the following parameters:
  9816. @table @option
  9817. @item map0
  9818. The index of the input plane to be used as the first output plane.
  9819. @item map1
  9820. The index of the input plane to be used as the second output plane.
  9821. @item map2
  9822. The index of the input plane to be used as the third output plane.
  9823. @item map3
  9824. The index of the input plane to be used as the fourth output plane.
  9825. @end table
  9826. The first plane has the index 0. The default is to keep the input unchanged.
  9827. @subsection Examples
  9828. @itemize
  9829. @item
  9830. Swap the second and third planes of the input:
  9831. @example
  9832. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  9833. @end example
  9834. @end itemize
  9835. @anchor{signalstats}
  9836. @section signalstats
  9837. Evaluate various visual metrics that assist in determining issues associated
  9838. with the digitization of analog video media.
  9839. By default the filter will log these metadata values:
  9840. @table @option
  9841. @item YMIN
  9842. Display the minimal Y value contained within the input frame. Expressed in
  9843. range of [0-255].
  9844. @item YLOW
  9845. Display the Y value at the 10% percentile within the input frame. Expressed in
  9846. range of [0-255].
  9847. @item YAVG
  9848. Display the average Y value within the input frame. Expressed in range of
  9849. [0-255].
  9850. @item YHIGH
  9851. Display the Y value at the 90% percentile within the input frame. Expressed in
  9852. range of [0-255].
  9853. @item YMAX
  9854. Display the maximum Y value contained within the input frame. Expressed in
  9855. range of [0-255].
  9856. @item UMIN
  9857. Display the minimal U value contained within the input frame. Expressed in
  9858. range of [0-255].
  9859. @item ULOW
  9860. Display the U value at the 10% percentile within the input frame. Expressed in
  9861. range of [0-255].
  9862. @item UAVG
  9863. Display the average U value within the input frame. Expressed in range of
  9864. [0-255].
  9865. @item UHIGH
  9866. Display the U value at the 90% percentile within the input frame. Expressed in
  9867. range of [0-255].
  9868. @item UMAX
  9869. Display the maximum U value contained within the input frame. Expressed in
  9870. range of [0-255].
  9871. @item VMIN
  9872. Display the minimal V value contained within the input frame. Expressed in
  9873. range of [0-255].
  9874. @item VLOW
  9875. Display the V value at the 10% percentile within the input frame. Expressed in
  9876. range of [0-255].
  9877. @item VAVG
  9878. Display the average V value within the input frame. Expressed in range of
  9879. [0-255].
  9880. @item VHIGH
  9881. Display the V value at the 90% percentile within the input frame. Expressed in
  9882. range of [0-255].
  9883. @item VMAX
  9884. Display the maximum V value contained within the input frame. Expressed in
  9885. range of [0-255].
  9886. @item SATMIN
  9887. Display the minimal saturation value contained within the input frame.
  9888. Expressed in range of [0-~181.02].
  9889. @item SATLOW
  9890. Display the saturation value at the 10% percentile within the input frame.
  9891. Expressed in range of [0-~181.02].
  9892. @item SATAVG
  9893. Display the average saturation value within the input frame. Expressed in range
  9894. of [0-~181.02].
  9895. @item SATHIGH
  9896. Display the saturation value at the 90% percentile within the input frame.
  9897. Expressed in range of [0-~181.02].
  9898. @item SATMAX
  9899. Display the maximum saturation value contained within the input frame.
  9900. Expressed in range of [0-~181.02].
  9901. @item HUEMED
  9902. Display the median value for hue within the input frame. Expressed in range of
  9903. [0-360].
  9904. @item HUEAVG
  9905. Display the average value for hue within the input frame. Expressed in range of
  9906. [0-360].
  9907. @item YDIF
  9908. Display the average of sample value difference between all values of the Y
  9909. plane in the current frame and corresponding values of the previous input frame.
  9910. Expressed in range of [0-255].
  9911. @item UDIF
  9912. Display the average of sample value difference between all values of the U
  9913. plane in the current frame and corresponding values of the previous input frame.
  9914. Expressed in range of [0-255].
  9915. @item VDIF
  9916. Display the average of sample value difference between all values of the V
  9917. plane in the current frame and corresponding values of the previous input frame.
  9918. Expressed in range of [0-255].
  9919. @item YBITDEPTH
  9920. Display bit depth of Y plane in current frame.
  9921. Expressed in range of [0-16].
  9922. @item UBITDEPTH
  9923. Display bit depth of U plane in current frame.
  9924. Expressed in range of [0-16].
  9925. @item VBITDEPTH
  9926. Display bit depth of V plane in current frame.
  9927. Expressed in range of [0-16].
  9928. @end table
  9929. The filter accepts the following options:
  9930. @table @option
  9931. @item stat
  9932. @item out
  9933. @option{stat} specify an additional form of image analysis.
  9934. @option{out} output video with the specified type of pixel highlighted.
  9935. Both options accept the following values:
  9936. @table @samp
  9937. @item tout
  9938. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  9939. unlike the neighboring pixels of the same field. Examples of temporal outliers
  9940. include the results of video dropouts, head clogs, or tape tracking issues.
  9941. @item vrep
  9942. Identify @var{vertical line repetition}. Vertical line repetition includes
  9943. similar rows of pixels within a frame. In born-digital video vertical line
  9944. repetition is common, but this pattern is uncommon in video digitized from an
  9945. analog source. When it occurs in video that results from the digitization of an
  9946. analog source it can indicate concealment from a dropout compensator.
  9947. @item brng
  9948. Identify pixels that fall outside of legal broadcast range.
  9949. @end table
  9950. @item color, c
  9951. Set the highlight color for the @option{out} option. The default color is
  9952. yellow.
  9953. @end table
  9954. @subsection Examples
  9955. @itemize
  9956. @item
  9957. Output data of various video metrics:
  9958. @example
  9959. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  9960. @end example
  9961. @item
  9962. Output specific data about the minimum and maximum values of the Y plane per frame:
  9963. @example
  9964. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  9965. @end example
  9966. @item
  9967. Playback video while highlighting pixels that are outside of broadcast range in red.
  9968. @example
  9969. ffplay example.mov -vf signalstats="out=brng:color=red"
  9970. @end example
  9971. @item
  9972. Playback video with signalstats metadata drawn over the frame.
  9973. @example
  9974. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  9975. @end example
  9976. The contents of signalstat_drawtext.txt used in the command are:
  9977. @example
  9978. time %@{pts:hms@}
  9979. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  9980. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  9981. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  9982. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  9983. @end example
  9984. @end itemize
  9985. @anchor{signature}
  9986. @section signature
  9987. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  9988. input. In this case the matching between the inputs can be calculated additionally.
  9989. The filter always passes through the first input. The signature of each stream can
  9990. be written into a file.
  9991. It accepts the following options:
  9992. @table @option
  9993. @item detectmode
  9994. Enable or disable the matching process.
  9995. Available values are:
  9996. @table @samp
  9997. @item off
  9998. Disable the calculation of a matching (default).
  9999. @item full
  10000. Calculate the matching for the whole video and output whether the whole video
  10001. matches or only parts.
  10002. @item fast
  10003. Calculate only until a matching is found or the video ends. Should be faster in
  10004. some cases.
  10005. @end table
  10006. @item nb_inputs
  10007. Set the number of inputs. The option value must be a non negative integer.
  10008. Default value is 1.
  10009. @item filename
  10010. Set the path to which the output is written. If there is more than one input,
  10011. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  10012. integer), that will be replaced with the input number. If no filename is
  10013. specified, no output will be written. This is the default.
  10014. @item format
  10015. Choose the output format.
  10016. Available values are:
  10017. @table @samp
  10018. @item binary
  10019. Use the specified binary representation (default).
  10020. @item xml
  10021. Use the specified xml representation.
  10022. @end table
  10023. @item th_d
  10024. Set threshold to detect one word as similar. The option value must be an integer
  10025. greater than zero. The default value is 9000.
  10026. @item th_dc
  10027. Set threshold to detect all words as similar. The option value must be an integer
  10028. greater than zero. The default value is 60000.
  10029. @item th_xh
  10030. Set threshold to detect frames as similar. The option value must be an integer
  10031. greater than zero. The default value is 116.
  10032. @item th_di
  10033. Set the minimum length of a sequence in frames to recognize it as matching
  10034. sequence. The option value must be a non negative integer value.
  10035. The default value is 0.
  10036. @item th_it
  10037. Set the minimum relation, that matching frames to all frames must have.
  10038. The option value must be a double value between 0 and 1. The default value is 0.5.
  10039. @end table
  10040. @subsection Examples
  10041. @itemize
  10042. @item
  10043. To calculate the signature of an input video and store it in signature.bin:
  10044. @example
  10045. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  10046. @end example
  10047. @item
  10048. To detect whether two videos match and store the signatures in XML format in
  10049. signature0.xml and signature1.xml:
  10050. @example
  10051. ffmpeg -i input1.mkv -i input2.mkv -filter_complex "[0:v][1:v] signature=nb_inputs=2:detectmode=full:format=xml:filename=signature%d.xml" -map :v -f null -
  10052. @end example
  10053. @end itemize
  10054. @anchor{smartblur}
  10055. @section smartblur
  10056. Blur the input video without impacting the outlines.
  10057. It accepts the following options:
  10058. @table @option
  10059. @item luma_radius, lr
  10060. Set the luma radius. The option value must be a float number in
  10061. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10062. used to blur the image (slower if larger). Default value is 1.0.
  10063. @item luma_strength, ls
  10064. Set the luma strength. The option value must be a float number
  10065. in the range [-1.0,1.0] that configures the blurring. A value included
  10066. in [0.0,1.0] will blur the image whereas a value included in
  10067. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  10068. @item luma_threshold, lt
  10069. Set the luma threshold used as a coefficient to determine
  10070. whether a pixel should be blurred or not. The option value must be an
  10071. integer in the range [-30,30]. A value of 0 will filter all the image,
  10072. a value included in [0,30] will filter flat areas and a value included
  10073. in [-30,0] will filter edges. Default value is 0.
  10074. @item chroma_radius, cr
  10075. Set the chroma radius. The option value must be a float number in
  10076. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10077. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  10078. @item chroma_strength, cs
  10079. Set the chroma strength. The option value must be a float number
  10080. in the range [-1.0,1.0] that configures the blurring. A value included
  10081. in [0.0,1.0] will blur the image whereas a value included in
  10082. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  10083. @item chroma_threshold, ct
  10084. Set the chroma threshold used as a coefficient to determine
  10085. whether a pixel should be blurred or not. The option value must be an
  10086. integer in the range [-30,30]. A value of 0 will filter all the image,
  10087. a value included in [0,30] will filter flat areas and a value included
  10088. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  10089. @end table
  10090. If a chroma option is not explicitly set, the corresponding luma value
  10091. is set.
  10092. @section ssim
  10093. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  10094. This filter takes in input two input videos, the first input is
  10095. considered the "main" source and is passed unchanged to the
  10096. output. The second input is used as a "reference" video for computing
  10097. the SSIM.
  10098. Both video inputs must have the same resolution and pixel format for
  10099. this filter to work correctly. Also it assumes that both inputs
  10100. have the same number of frames, which are compared one by one.
  10101. The filter stores the calculated SSIM of each frame.
  10102. The description of the accepted parameters follows.
  10103. @table @option
  10104. @item stats_file, f
  10105. If specified the filter will use the named file to save the SSIM of
  10106. each individual frame. When filename equals "-" the data is sent to
  10107. standard output.
  10108. @end table
  10109. The file printed if @var{stats_file} is selected, contains a sequence of
  10110. key/value pairs of the form @var{key}:@var{value} for each compared
  10111. couple of frames.
  10112. A description of each shown parameter follows:
  10113. @table @option
  10114. @item n
  10115. sequential number of the input frame, starting from 1
  10116. @item Y, U, V, R, G, B
  10117. SSIM of the compared frames for the component specified by the suffix.
  10118. @item All
  10119. SSIM of the compared frames for the whole frame.
  10120. @item dB
  10121. Same as above but in dB representation.
  10122. @end table
  10123. For example:
  10124. @example
  10125. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10126. [main][ref] ssim="stats_file=stats.log" [out]
  10127. @end example
  10128. On this example the input file being processed is compared with the
  10129. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  10130. is stored in @file{stats.log}.
  10131. Another example with both psnr and ssim at same time:
  10132. @example
  10133. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  10134. @end example
  10135. @section stereo3d
  10136. Convert between different stereoscopic image formats.
  10137. The filters accept the following options:
  10138. @table @option
  10139. @item in
  10140. Set stereoscopic image format of input.
  10141. Available values for input image formats are:
  10142. @table @samp
  10143. @item sbsl
  10144. side by side parallel (left eye left, right eye right)
  10145. @item sbsr
  10146. side by side crosseye (right eye left, left eye right)
  10147. @item sbs2l
  10148. side by side parallel with half width resolution
  10149. (left eye left, right eye right)
  10150. @item sbs2r
  10151. side by side crosseye with half width resolution
  10152. (right eye left, left eye right)
  10153. @item abl
  10154. above-below (left eye above, right eye below)
  10155. @item abr
  10156. above-below (right eye above, left eye below)
  10157. @item ab2l
  10158. above-below with half height resolution
  10159. (left eye above, right eye below)
  10160. @item ab2r
  10161. above-below with half height resolution
  10162. (right eye above, left eye below)
  10163. @item al
  10164. alternating frames (left eye first, right eye second)
  10165. @item ar
  10166. alternating frames (right eye first, left eye second)
  10167. @item irl
  10168. interleaved rows (left eye has top row, right eye starts on next row)
  10169. @item irr
  10170. interleaved rows (right eye has top row, left eye starts on next row)
  10171. @item icl
  10172. interleaved columns, left eye first
  10173. @item icr
  10174. interleaved columns, right eye first
  10175. Default value is @samp{sbsl}.
  10176. @end table
  10177. @item out
  10178. Set stereoscopic image format of output.
  10179. @table @samp
  10180. @item sbsl
  10181. side by side parallel (left eye left, right eye right)
  10182. @item sbsr
  10183. side by side crosseye (right eye left, left eye right)
  10184. @item sbs2l
  10185. side by side parallel with half width resolution
  10186. (left eye left, right eye right)
  10187. @item sbs2r
  10188. side by side crosseye with half width resolution
  10189. (right eye left, left eye right)
  10190. @item abl
  10191. above-below (left eye above, right eye below)
  10192. @item abr
  10193. above-below (right eye above, left eye below)
  10194. @item ab2l
  10195. above-below with half height resolution
  10196. (left eye above, right eye below)
  10197. @item ab2r
  10198. above-below with half height resolution
  10199. (right eye above, left eye below)
  10200. @item al
  10201. alternating frames (left eye first, right eye second)
  10202. @item ar
  10203. alternating frames (right eye first, left eye second)
  10204. @item irl
  10205. interleaved rows (left eye has top row, right eye starts on next row)
  10206. @item irr
  10207. interleaved rows (right eye has top row, left eye starts on next row)
  10208. @item arbg
  10209. anaglyph red/blue gray
  10210. (red filter on left eye, blue filter on right eye)
  10211. @item argg
  10212. anaglyph red/green gray
  10213. (red filter on left eye, green filter on right eye)
  10214. @item arcg
  10215. anaglyph red/cyan gray
  10216. (red filter on left eye, cyan filter on right eye)
  10217. @item arch
  10218. anaglyph red/cyan half colored
  10219. (red filter on left eye, cyan filter on right eye)
  10220. @item arcc
  10221. anaglyph red/cyan color
  10222. (red filter on left eye, cyan filter on right eye)
  10223. @item arcd
  10224. anaglyph red/cyan color optimized with the least squares projection of dubois
  10225. (red filter on left eye, cyan filter on right eye)
  10226. @item agmg
  10227. anaglyph green/magenta gray
  10228. (green filter on left eye, magenta filter on right eye)
  10229. @item agmh
  10230. anaglyph green/magenta half colored
  10231. (green filter on left eye, magenta filter on right eye)
  10232. @item agmc
  10233. anaglyph green/magenta colored
  10234. (green filter on left eye, magenta filter on right eye)
  10235. @item agmd
  10236. anaglyph green/magenta color optimized with the least squares projection of dubois
  10237. (green filter on left eye, magenta filter on right eye)
  10238. @item aybg
  10239. anaglyph yellow/blue gray
  10240. (yellow filter on left eye, blue filter on right eye)
  10241. @item aybh
  10242. anaglyph yellow/blue half colored
  10243. (yellow filter on left eye, blue filter on right eye)
  10244. @item aybc
  10245. anaglyph yellow/blue colored
  10246. (yellow filter on left eye, blue filter on right eye)
  10247. @item aybd
  10248. anaglyph yellow/blue color optimized with the least squares projection of dubois
  10249. (yellow filter on left eye, blue filter on right eye)
  10250. @item ml
  10251. mono output (left eye only)
  10252. @item mr
  10253. mono output (right eye only)
  10254. @item chl
  10255. checkerboard, left eye first
  10256. @item chr
  10257. checkerboard, right eye first
  10258. @item icl
  10259. interleaved columns, left eye first
  10260. @item icr
  10261. interleaved columns, right eye first
  10262. @item hdmi
  10263. HDMI frame pack
  10264. @end table
  10265. Default value is @samp{arcd}.
  10266. @end table
  10267. @subsection Examples
  10268. @itemize
  10269. @item
  10270. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  10271. @example
  10272. stereo3d=sbsl:aybd
  10273. @end example
  10274. @item
  10275. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  10276. @example
  10277. stereo3d=abl:sbsr
  10278. @end example
  10279. @end itemize
  10280. @section streamselect, astreamselect
  10281. Select video or audio streams.
  10282. The filter accepts the following options:
  10283. @table @option
  10284. @item inputs
  10285. Set number of inputs. Default is 2.
  10286. @item map
  10287. Set input indexes to remap to outputs.
  10288. @end table
  10289. @subsection Commands
  10290. The @code{streamselect} and @code{astreamselect} filter supports the following
  10291. commands:
  10292. @table @option
  10293. @item map
  10294. Set input indexes to remap to outputs.
  10295. @end table
  10296. @subsection Examples
  10297. @itemize
  10298. @item
  10299. Select first 5 seconds 1st stream and rest of time 2nd stream:
  10300. @example
  10301. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  10302. @end example
  10303. @item
  10304. Same as above, but for audio:
  10305. @example
  10306. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  10307. @end example
  10308. @end itemize
  10309. @section sobel
  10310. Apply sobel operator to input video stream.
  10311. The filter accepts the following option:
  10312. @table @option
  10313. @item planes
  10314. Set which planes will be processed, unprocessed planes will be copied.
  10315. By default value 0xf, all planes will be processed.
  10316. @item scale
  10317. Set value which will be multiplied with filtered result.
  10318. @item delta
  10319. Set value which will be added to filtered result.
  10320. @end table
  10321. @anchor{spp}
  10322. @section spp
  10323. Apply a simple postprocessing filter that compresses and decompresses the image
  10324. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  10325. and average the results.
  10326. The filter accepts the following options:
  10327. @table @option
  10328. @item quality
  10329. Set quality. This option defines the number of levels for averaging. It accepts
  10330. an integer in the range 0-6. If set to @code{0}, the filter will have no
  10331. effect. A value of @code{6} means the higher quality. For each increment of
  10332. that value the speed drops by a factor of approximately 2. Default value is
  10333. @code{3}.
  10334. @item qp
  10335. Force a constant quantization parameter. If not set, the filter will use the QP
  10336. from the video stream (if available).
  10337. @item mode
  10338. Set thresholding mode. Available modes are:
  10339. @table @samp
  10340. @item hard
  10341. Set hard thresholding (default).
  10342. @item soft
  10343. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10344. @end table
  10345. @item use_bframe_qp
  10346. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  10347. option may cause flicker since the B-Frames have often larger QP. Default is
  10348. @code{0} (not enabled).
  10349. @end table
  10350. @anchor{subtitles}
  10351. @section subtitles
  10352. Draw subtitles on top of input video using the libass library.
  10353. To enable compilation of this filter you need to configure FFmpeg with
  10354. @code{--enable-libass}. This filter also requires a build with libavcodec and
  10355. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  10356. Alpha) subtitles format.
  10357. The filter accepts the following options:
  10358. @table @option
  10359. @item filename, f
  10360. Set the filename of the subtitle file to read. It must be specified.
  10361. @item original_size
  10362. Specify the size of the original video, the video for which the ASS file
  10363. was composed. For the syntax of this option, check the
  10364. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10365. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  10366. correctly scale the fonts if the aspect ratio has been changed.
  10367. @item fontsdir
  10368. Set a directory path containing fonts that can be used by the filter.
  10369. These fonts will be used in addition to whatever the font provider uses.
  10370. @item charenc
  10371. Set subtitles input character encoding. @code{subtitles} filter only. Only
  10372. useful if not UTF-8.
  10373. @item stream_index, si
  10374. Set subtitles stream index. @code{subtitles} filter only.
  10375. @item force_style
  10376. Override default style or script info parameters of the subtitles. It accepts a
  10377. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  10378. @end table
  10379. If the first key is not specified, it is assumed that the first value
  10380. specifies the @option{filename}.
  10381. For example, to render the file @file{sub.srt} on top of the input
  10382. video, use the command:
  10383. @example
  10384. subtitles=sub.srt
  10385. @end example
  10386. which is equivalent to:
  10387. @example
  10388. subtitles=filename=sub.srt
  10389. @end example
  10390. To render the default subtitles stream from file @file{video.mkv}, use:
  10391. @example
  10392. subtitles=video.mkv
  10393. @end example
  10394. To render the second subtitles stream from that file, use:
  10395. @example
  10396. subtitles=video.mkv:si=1
  10397. @end example
  10398. To make the subtitles stream from @file{sub.srt} appear in transparent green
  10399. @code{DejaVu Serif}, use:
  10400. @example
  10401. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  10402. @end example
  10403. @section super2xsai
  10404. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  10405. Interpolate) pixel art scaling algorithm.
  10406. Useful for enlarging pixel art images without reducing sharpness.
  10407. @section swaprect
  10408. Swap two rectangular objects in video.
  10409. This filter accepts the following options:
  10410. @table @option
  10411. @item w
  10412. Set object width.
  10413. @item h
  10414. Set object height.
  10415. @item x1
  10416. Set 1st rect x coordinate.
  10417. @item y1
  10418. Set 1st rect y coordinate.
  10419. @item x2
  10420. Set 2nd rect x coordinate.
  10421. @item y2
  10422. Set 2nd rect y coordinate.
  10423. All expressions are evaluated once for each frame.
  10424. @end table
  10425. The all options are expressions containing the following constants:
  10426. @table @option
  10427. @item w
  10428. @item h
  10429. The input width and height.
  10430. @item a
  10431. same as @var{w} / @var{h}
  10432. @item sar
  10433. input sample aspect ratio
  10434. @item dar
  10435. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  10436. @item n
  10437. The number of the input frame, starting from 0.
  10438. @item t
  10439. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  10440. @item pos
  10441. the position in the file of the input frame, NAN if unknown
  10442. @end table
  10443. @section swapuv
  10444. Swap U & V plane.
  10445. @section telecine
  10446. Apply telecine process to the video.
  10447. This filter accepts the following options:
  10448. @table @option
  10449. @item first_field
  10450. @table @samp
  10451. @item top, t
  10452. top field first
  10453. @item bottom, b
  10454. bottom field first
  10455. The default value is @code{top}.
  10456. @end table
  10457. @item pattern
  10458. A string of numbers representing the pulldown pattern you wish to apply.
  10459. The default value is @code{23}.
  10460. @end table
  10461. @example
  10462. Some typical patterns:
  10463. NTSC output (30i):
  10464. 27.5p: 32222
  10465. 24p: 23 (classic)
  10466. 24p: 2332 (preferred)
  10467. 20p: 33
  10468. 18p: 334
  10469. 16p: 3444
  10470. PAL output (25i):
  10471. 27.5p: 12222
  10472. 24p: 222222222223 ("Euro pulldown")
  10473. 16.67p: 33
  10474. 16p: 33333334
  10475. @end example
  10476. @section threshold
  10477. Apply threshold effect to video stream.
  10478. This filter needs four video streams to perform thresholding.
  10479. First stream is stream we are filtering.
  10480. Second stream is holding threshold values, third stream is holding min values,
  10481. and last, fourth stream is holding max values.
  10482. The filter accepts the following option:
  10483. @table @option
  10484. @item planes
  10485. Set which planes will be processed, unprocessed planes will be copied.
  10486. By default value 0xf, all planes will be processed.
  10487. @end table
  10488. For example if first stream pixel's component value is less then threshold value
  10489. of pixel component from 2nd threshold stream, third stream value will picked,
  10490. otherwise fourth stream pixel component value will be picked.
  10491. Using color source filter one can perform various types of thresholding:
  10492. @subsection Examples
  10493. @itemize
  10494. @item
  10495. Binary threshold, using gray color as threshold:
  10496. @example
  10497. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  10498. @end example
  10499. @item
  10500. Inverted binary threshold, using gray color as threshold:
  10501. @example
  10502. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  10503. @end example
  10504. @item
  10505. Truncate binary threshold, using gray color as threshold:
  10506. @example
  10507. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  10508. @end example
  10509. @item
  10510. Threshold to zero, using gray color as threshold:
  10511. @example
  10512. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  10513. @end example
  10514. @item
  10515. Inverted threshold to zero, using gray color as threshold:
  10516. @example
  10517. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  10518. @end example
  10519. @end itemize
  10520. @section thumbnail
  10521. Select the most representative frame in a given sequence of consecutive frames.
  10522. The filter accepts the following options:
  10523. @table @option
  10524. @item n
  10525. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  10526. will pick one of them, and then handle the next batch of @var{n} frames until
  10527. the end. Default is @code{100}.
  10528. @end table
  10529. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  10530. value will result in a higher memory usage, so a high value is not recommended.
  10531. @subsection Examples
  10532. @itemize
  10533. @item
  10534. Extract one picture each 50 frames:
  10535. @example
  10536. thumbnail=50
  10537. @end example
  10538. @item
  10539. Complete example of a thumbnail creation with @command{ffmpeg}:
  10540. @example
  10541. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  10542. @end example
  10543. @end itemize
  10544. @section tile
  10545. Tile several successive frames together.
  10546. The filter accepts the following options:
  10547. @table @option
  10548. @item layout
  10549. Set the grid size (i.e. the number of lines and columns). For the syntax of
  10550. this option, check the
  10551. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10552. @item nb_frames
  10553. Set the maximum number of frames to render in the given area. It must be less
  10554. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  10555. the area will be used.
  10556. @item margin
  10557. Set the outer border margin in pixels.
  10558. @item padding
  10559. Set the inner border thickness (i.e. the number of pixels between frames). For
  10560. more advanced padding options (such as having different values for the edges),
  10561. refer to the pad video filter.
  10562. @item color
  10563. Specify the color of the unused area. For the syntax of this option, check the
  10564. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  10565. is "black".
  10566. @end table
  10567. @subsection Examples
  10568. @itemize
  10569. @item
  10570. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  10571. @example
  10572. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  10573. @end example
  10574. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  10575. duplicating each output frame to accommodate the originally detected frame
  10576. rate.
  10577. @item
  10578. Display @code{5} pictures in an area of @code{3x2} frames,
  10579. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  10580. mixed flat and named options:
  10581. @example
  10582. tile=3x2:nb_frames=5:padding=7:margin=2
  10583. @end example
  10584. @end itemize
  10585. @section tinterlace
  10586. Perform various types of temporal field interlacing.
  10587. Frames are counted starting from 1, so the first input frame is
  10588. considered odd.
  10589. The filter accepts the following options:
  10590. @table @option
  10591. @item mode
  10592. Specify the mode of the interlacing. This option can also be specified
  10593. as a value alone. See below for a list of values for this option.
  10594. Available values are:
  10595. @table @samp
  10596. @item merge, 0
  10597. Move odd frames into the upper field, even into the lower field,
  10598. generating a double height frame at half frame rate.
  10599. @example
  10600. ------> time
  10601. Input:
  10602. Frame 1 Frame 2 Frame 3 Frame 4
  10603. 11111 22222 33333 44444
  10604. 11111 22222 33333 44444
  10605. 11111 22222 33333 44444
  10606. 11111 22222 33333 44444
  10607. Output:
  10608. 11111 33333
  10609. 22222 44444
  10610. 11111 33333
  10611. 22222 44444
  10612. 11111 33333
  10613. 22222 44444
  10614. 11111 33333
  10615. 22222 44444
  10616. @end example
  10617. @item drop_even, 1
  10618. Only output odd frames, even frames are dropped, generating a frame with
  10619. unchanged height at half frame rate.
  10620. @example
  10621. ------> time
  10622. Input:
  10623. Frame 1 Frame 2 Frame 3 Frame 4
  10624. 11111 22222 33333 44444
  10625. 11111 22222 33333 44444
  10626. 11111 22222 33333 44444
  10627. 11111 22222 33333 44444
  10628. Output:
  10629. 11111 33333
  10630. 11111 33333
  10631. 11111 33333
  10632. 11111 33333
  10633. @end example
  10634. @item drop_odd, 2
  10635. Only output even frames, odd frames are dropped, generating a frame with
  10636. unchanged height at half frame rate.
  10637. @example
  10638. ------> time
  10639. Input:
  10640. Frame 1 Frame 2 Frame 3 Frame 4
  10641. 11111 22222 33333 44444
  10642. 11111 22222 33333 44444
  10643. 11111 22222 33333 44444
  10644. 11111 22222 33333 44444
  10645. Output:
  10646. 22222 44444
  10647. 22222 44444
  10648. 22222 44444
  10649. 22222 44444
  10650. @end example
  10651. @item pad, 3
  10652. Expand each frame to full height, but pad alternate lines with black,
  10653. generating a frame with double height at the same input frame rate.
  10654. @example
  10655. ------> time
  10656. Input:
  10657. Frame 1 Frame 2 Frame 3 Frame 4
  10658. 11111 22222 33333 44444
  10659. 11111 22222 33333 44444
  10660. 11111 22222 33333 44444
  10661. 11111 22222 33333 44444
  10662. Output:
  10663. 11111 ..... 33333 .....
  10664. ..... 22222 ..... 44444
  10665. 11111 ..... 33333 .....
  10666. ..... 22222 ..... 44444
  10667. 11111 ..... 33333 .....
  10668. ..... 22222 ..... 44444
  10669. 11111 ..... 33333 .....
  10670. ..... 22222 ..... 44444
  10671. @end example
  10672. @item interleave_top, 4
  10673. Interleave the upper field from odd frames with the lower field from
  10674. even frames, generating a frame with unchanged height at half frame rate.
  10675. @example
  10676. ------> time
  10677. Input:
  10678. Frame 1 Frame 2 Frame 3 Frame 4
  10679. 11111<- 22222 33333<- 44444
  10680. 11111 22222<- 33333 44444<-
  10681. 11111<- 22222 33333<- 44444
  10682. 11111 22222<- 33333 44444<-
  10683. Output:
  10684. 11111 33333
  10685. 22222 44444
  10686. 11111 33333
  10687. 22222 44444
  10688. @end example
  10689. @item interleave_bottom, 5
  10690. Interleave the lower field from odd frames with the upper field from
  10691. even frames, generating a frame with unchanged height at half frame rate.
  10692. @example
  10693. ------> time
  10694. Input:
  10695. Frame 1 Frame 2 Frame 3 Frame 4
  10696. 11111 22222<- 33333 44444<-
  10697. 11111<- 22222 33333<- 44444
  10698. 11111 22222<- 33333 44444<-
  10699. 11111<- 22222 33333<- 44444
  10700. Output:
  10701. 22222 44444
  10702. 11111 33333
  10703. 22222 44444
  10704. 11111 33333
  10705. @end example
  10706. @item interlacex2, 6
  10707. Double frame rate with unchanged height. Frames are inserted each
  10708. containing the second temporal field from the previous input frame and
  10709. the first temporal field from the next input frame. This mode relies on
  10710. the top_field_first flag. Useful for interlaced video displays with no
  10711. field synchronisation.
  10712. @example
  10713. ------> time
  10714. Input:
  10715. Frame 1 Frame 2 Frame 3 Frame 4
  10716. 11111 22222 33333 44444
  10717. 11111 22222 33333 44444
  10718. 11111 22222 33333 44444
  10719. 11111 22222 33333 44444
  10720. Output:
  10721. 11111 22222 22222 33333 33333 44444 44444
  10722. 11111 11111 22222 22222 33333 33333 44444
  10723. 11111 22222 22222 33333 33333 44444 44444
  10724. 11111 11111 22222 22222 33333 33333 44444
  10725. @end example
  10726. @item mergex2, 7
  10727. Move odd frames into the upper field, even into the lower field,
  10728. generating a double height frame at same frame rate.
  10729. @example
  10730. ------> time
  10731. Input:
  10732. Frame 1 Frame 2 Frame 3 Frame 4
  10733. 11111 22222 33333 44444
  10734. 11111 22222 33333 44444
  10735. 11111 22222 33333 44444
  10736. 11111 22222 33333 44444
  10737. Output:
  10738. 11111 33333 33333 55555
  10739. 22222 22222 44444 44444
  10740. 11111 33333 33333 55555
  10741. 22222 22222 44444 44444
  10742. 11111 33333 33333 55555
  10743. 22222 22222 44444 44444
  10744. 11111 33333 33333 55555
  10745. 22222 22222 44444 44444
  10746. @end example
  10747. @end table
  10748. Numeric values are deprecated but are accepted for backward
  10749. compatibility reasons.
  10750. Default mode is @code{merge}.
  10751. @item flags
  10752. Specify flags influencing the filter process.
  10753. Available value for @var{flags} is:
  10754. @table @option
  10755. @item low_pass_filter, vlfp
  10756. Enable linear vertical low-pass filtering in the filter.
  10757. Vertical low-pass filtering is required when creating an interlaced
  10758. destination from a progressive source which contains high-frequency
  10759. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  10760. patterning.
  10761. @item complex_filter, cvlfp
  10762. Enable complex vertical low-pass filtering.
  10763. This will slightly less reduce interlace 'twitter' and Moire
  10764. patterning but better retain detail and subjective sharpness impression.
  10765. @end table
  10766. Vertical low-pass filtering can only be enabled for @option{mode}
  10767. @var{interleave_top} and @var{interleave_bottom}.
  10768. @end table
  10769. @section transpose
  10770. Transpose rows with columns in the input video and optionally flip it.
  10771. It accepts the following parameters:
  10772. @table @option
  10773. @item dir
  10774. Specify the transposition direction.
  10775. Can assume the following values:
  10776. @table @samp
  10777. @item 0, 4, cclock_flip
  10778. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  10779. @example
  10780. L.R L.l
  10781. . . -> . .
  10782. l.r R.r
  10783. @end example
  10784. @item 1, 5, clock
  10785. Rotate by 90 degrees clockwise, that is:
  10786. @example
  10787. L.R l.L
  10788. . . -> . .
  10789. l.r r.R
  10790. @end example
  10791. @item 2, 6, cclock
  10792. Rotate by 90 degrees counterclockwise, that is:
  10793. @example
  10794. L.R R.r
  10795. . . -> . .
  10796. l.r L.l
  10797. @end example
  10798. @item 3, 7, clock_flip
  10799. Rotate by 90 degrees clockwise and vertically flip, that is:
  10800. @example
  10801. L.R r.R
  10802. . . -> . .
  10803. l.r l.L
  10804. @end example
  10805. @end table
  10806. For values between 4-7, the transposition is only done if the input
  10807. video geometry is portrait and not landscape. These values are
  10808. deprecated, the @code{passthrough} option should be used instead.
  10809. Numerical values are deprecated, and should be dropped in favor of
  10810. symbolic constants.
  10811. @item passthrough
  10812. Do not apply the transposition if the input geometry matches the one
  10813. specified by the specified value. It accepts the following values:
  10814. @table @samp
  10815. @item none
  10816. Always apply transposition.
  10817. @item portrait
  10818. Preserve portrait geometry (when @var{height} >= @var{width}).
  10819. @item landscape
  10820. Preserve landscape geometry (when @var{width} >= @var{height}).
  10821. @end table
  10822. Default value is @code{none}.
  10823. @end table
  10824. For example to rotate by 90 degrees clockwise and preserve portrait
  10825. layout:
  10826. @example
  10827. transpose=dir=1:passthrough=portrait
  10828. @end example
  10829. The command above can also be specified as:
  10830. @example
  10831. transpose=1:portrait
  10832. @end example
  10833. @section trim
  10834. Trim the input so that the output contains one continuous subpart of the input.
  10835. It accepts the following parameters:
  10836. @table @option
  10837. @item start
  10838. Specify the time of the start of the kept section, i.e. the frame with the
  10839. timestamp @var{start} will be the first frame in the output.
  10840. @item end
  10841. Specify the time of the first frame that will be dropped, i.e. the frame
  10842. immediately preceding the one with the timestamp @var{end} will be the last
  10843. frame in the output.
  10844. @item start_pts
  10845. This is the same as @var{start}, except this option sets the start timestamp
  10846. in timebase units instead of seconds.
  10847. @item end_pts
  10848. This is the same as @var{end}, except this option sets the end timestamp
  10849. in timebase units instead of seconds.
  10850. @item duration
  10851. The maximum duration of the output in seconds.
  10852. @item start_frame
  10853. The number of the first frame that should be passed to the output.
  10854. @item end_frame
  10855. The number of the first frame that should be dropped.
  10856. @end table
  10857. @option{start}, @option{end}, and @option{duration} are expressed as time
  10858. duration specifications; see
  10859. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  10860. for the accepted syntax.
  10861. Note that the first two sets of the start/end options and the @option{duration}
  10862. option look at the frame timestamp, while the _frame variants simply count the
  10863. frames that pass through the filter. Also note that this filter does not modify
  10864. the timestamps. If you wish for the output timestamps to start at zero, insert a
  10865. setpts filter after the trim filter.
  10866. If multiple start or end options are set, this filter tries to be greedy and
  10867. keep all the frames that match at least one of the specified constraints. To keep
  10868. only the part that matches all the constraints at once, chain multiple trim
  10869. filters.
  10870. The defaults are such that all the input is kept. So it is possible to set e.g.
  10871. just the end values to keep everything before the specified time.
  10872. Examples:
  10873. @itemize
  10874. @item
  10875. Drop everything except the second minute of input:
  10876. @example
  10877. ffmpeg -i INPUT -vf trim=60:120
  10878. @end example
  10879. @item
  10880. Keep only the first second:
  10881. @example
  10882. ffmpeg -i INPUT -vf trim=duration=1
  10883. @end example
  10884. @end itemize
  10885. @anchor{unsharp}
  10886. @section unsharp
  10887. Sharpen or blur the input video.
  10888. It accepts the following parameters:
  10889. @table @option
  10890. @item luma_msize_x, lx
  10891. Set the luma matrix horizontal size. It must be an odd integer between
  10892. 3 and 23. The default value is 5.
  10893. @item luma_msize_y, ly
  10894. Set the luma matrix vertical size. It must be an odd integer between 3
  10895. and 23. The default value is 5.
  10896. @item luma_amount, la
  10897. Set the luma effect strength. It must be a floating point number, reasonable
  10898. values lay between -1.5 and 1.5.
  10899. Negative values will blur the input video, while positive values will
  10900. sharpen it, a value of zero will disable the effect.
  10901. Default value is 1.0.
  10902. @item chroma_msize_x, cx
  10903. Set the chroma matrix horizontal size. It must be an odd integer
  10904. between 3 and 23. The default value is 5.
  10905. @item chroma_msize_y, cy
  10906. Set the chroma matrix vertical size. It must be an odd integer
  10907. between 3 and 23. The default value is 5.
  10908. @item chroma_amount, ca
  10909. Set the chroma effect strength. It must be a floating point number, reasonable
  10910. values lay between -1.5 and 1.5.
  10911. Negative values will blur the input video, while positive values will
  10912. sharpen it, a value of zero will disable the effect.
  10913. Default value is 0.0.
  10914. @item opencl
  10915. If set to 1, specify using OpenCL capabilities, only available if
  10916. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  10917. @end table
  10918. All parameters are optional and default to the equivalent of the
  10919. string '5:5:1.0:5:5:0.0'.
  10920. @subsection Examples
  10921. @itemize
  10922. @item
  10923. Apply strong luma sharpen effect:
  10924. @example
  10925. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  10926. @end example
  10927. @item
  10928. Apply a strong blur of both luma and chroma parameters:
  10929. @example
  10930. unsharp=7:7:-2:7:7:-2
  10931. @end example
  10932. @end itemize
  10933. @section uspp
  10934. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  10935. the image at several (or - in the case of @option{quality} level @code{8} - all)
  10936. shifts and average the results.
  10937. The way this differs from the behavior of spp is that uspp actually encodes &
  10938. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  10939. DCT similar to MJPEG.
  10940. The filter accepts the following options:
  10941. @table @option
  10942. @item quality
  10943. Set quality. This option defines the number of levels for averaging. It accepts
  10944. an integer in the range 0-8. If set to @code{0}, the filter will have no
  10945. effect. A value of @code{8} means the higher quality. For each increment of
  10946. that value the speed drops by a factor of approximately 2. Default value is
  10947. @code{3}.
  10948. @item qp
  10949. Force a constant quantization parameter. If not set, the filter will use the QP
  10950. from the video stream (if available).
  10951. @end table
  10952. @section vaguedenoiser
  10953. Apply a wavelet based denoiser.
  10954. It transforms each frame from the video input into the wavelet domain,
  10955. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  10956. the obtained coefficients. It does an inverse wavelet transform after.
  10957. Due to wavelet properties, it should give a nice smoothed result, and
  10958. reduced noise, without blurring picture features.
  10959. This filter accepts the following options:
  10960. @table @option
  10961. @item threshold
  10962. The filtering strength. The higher, the more filtered the video will be.
  10963. Hard thresholding can use a higher threshold than soft thresholding
  10964. before the video looks overfiltered.
  10965. @item method
  10966. The filtering method the filter will use.
  10967. It accepts the following values:
  10968. @table @samp
  10969. @item hard
  10970. All values under the threshold will be zeroed.
  10971. @item soft
  10972. All values under the threshold will be zeroed. All values above will be
  10973. reduced by the threshold.
  10974. @item garrote
  10975. Scales or nullifies coefficients - intermediary between (more) soft and
  10976. (less) hard thresholding.
  10977. @end table
  10978. @item nsteps
  10979. Number of times, the wavelet will decompose the picture. Picture can't
  10980. be decomposed beyond a particular point (typically, 8 for a 640x480
  10981. frame - as 2^9 = 512 > 480)
  10982. @item percent
  10983. Partial of full denoising (limited coefficients shrinking), from 0 to 100.
  10984. @item planes
  10985. A list of the planes to process. By default all planes are processed.
  10986. @end table
  10987. @section vectorscope
  10988. Display 2 color component values in the two dimensional graph (which is called
  10989. a vectorscope).
  10990. This filter accepts the following options:
  10991. @table @option
  10992. @item mode, m
  10993. Set vectorscope mode.
  10994. It accepts the following values:
  10995. @table @samp
  10996. @item gray
  10997. Gray values are displayed on graph, higher brightness means more pixels have
  10998. same component color value on location in graph. This is the default mode.
  10999. @item color
  11000. Gray values are displayed on graph. Surrounding pixels values which are not
  11001. present in video frame are drawn in gradient of 2 color components which are
  11002. set by option @code{x} and @code{y}. The 3rd color component is static.
  11003. @item color2
  11004. Actual color components values present in video frame are displayed on graph.
  11005. @item color3
  11006. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  11007. on graph increases value of another color component, which is luminance by
  11008. default values of @code{x} and @code{y}.
  11009. @item color4
  11010. Actual colors present in video frame are displayed on graph. If two different
  11011. colors map to same position on graph then color with higher value of component
  11012. not present in graph is picked.
  11013. @item color5
  11014. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  11015. component picked from radial gradient.
  11016. @end table
  11017. @item x
  11018. Set which color component will be represented on X-axis. Default is @code{1}.
  11019. @item y
  11020. Set which color component will be represented on Y-axis. Default is @code{2}.
  11021. @item intensity, i
  11022. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  11023. of color component which represents frequency of (X, Y) location in graph.
  11024. @item envelope, e
  11025. @table @samp
  11026. @item none
  11027. No envelope, this is default.
  11028. @item instant
  11029. Instant envelope, even darkest single pixel will be clearly highlighted.
  11030. @item peak
  11031. Hold maximum and minimum values presented in graph over time. This way you
  11032. can still spot out of range values without constantly looking at vectorscope.
  11033. @item peak+instant
  11034. Peak and instant envelope combined together.
  11035. @end table
  11036. @item graticule, g
  11037. Set what kind of graticule to draw.
  11038. @table @samp
  11039. @item none
  11040. @item green
  11041. @item color
  11042. @end table
  11043. @item opacity, o
  11044. Set graticule opacity.
  11045. @item flags, f
  11046. Set graticule flags.
  11047. @table @samp
  11048. @item white
  11049. Draw graticule for white point.
  11050. @item black
  11051. Draw graticule for black point.
  11052. @item name
  11053. Draw color points short names.
  11054. @end table
  11055. @item bgopacity, b
  11056. Set background opacity.
  11057. @item lthreshold, l
  11058. Set low threshold for color component not represented on X or Y axis.
  11059. Values lower than this value will be ignored. Default is 0.
  11060. Note this value is multiplied with actual max possible value one pixel component
  11061. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  11062. is 0.1 * 255 = 25.
  11063. @item hthreshold, h
  11064. Set high threshold for color component not represented on X or Y axis.
  11065. Values higher than this value will be ignored. Default is 1.
  11066. Note this value is multiplied with actual max possible value one pixel component
  11067. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  11068. is 0.9 * 255 = 230.
  11069. @item colorspace, c
  11070. Set what kind of colorspace to use when drawing graticule.
  11071. @table @samp
  11072. @item auto
  11073. @item 601
  11074. @item 709
  11075. @end table
  11076. Default is auto.
  11077. @end table
  11078. @anchor{vidstabdetect}
  11079. @section vidstabdetect
  11080. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  11081. @ref{vidstabtransform} for pass 2.
  11082. This filter generates a file with relative translation and rotation
  11083. transform information about subsequent frames, which is then used by
  11084. the @ref{vidstabtransform} filter.
  11085. To enable compilation of this filter you need to configure FFmpeg with
  11086. @code{--enable-libvidstab}.
  11087. This filter accepts the following options:
  11088. @table @option
  11089. @item result
  11090. Set the path to the file used to write the transforms information.
  11091. Default value is @file{transforms.trf}.
  11092. @item shakiness
  11093. Set how shaky the video is and how quick the camera is. It accepts an
  11094. integer in the range 1-10, a value of 1 means little shakiness, a
  11095. value of 10 means strong shakiness. Default value is 5.
  11096. @item accuracy
  11097. Set the accuracy of the detection process. It must be a value in the
  11098. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  11099. accuracy. Default value is 15.
  11100. @item stepsize
  11101. Set stepsize of the search process. The region around minimum is
  11102. scanned with 1 pixel resolution. Default value is 6.
  11103. @item mincontrast
  11104. Set minimum contrast. Below this value a local measurement field is
  11105. discarded. Must be a floating point value in the range 0-1. Default
  11106. value is 0.3.
  11107. @item tripod
  11108. Set reference frame number for tripod mode.
  11109. If enabled, the motion of the frames is compared to a reference frame
  11110. in the filtered stream, identified by the specified number. The idea
  11111. is to compensate all movements in a more-or-less static scene and keep
  11112. the camera view absolutely still.
  11113. If set to 0, it is disabled. The frames are counted starting from 1.
  11114. @item show
  11115. Show fields and transforms in the resulting frames. It accepts an
  11116. integer in the range 0-2. Default value is 0, which disables any
  11117. visualization.
  11118. @end table
  11119. @subsection Examples
  11120. @itemize
  11121. @item
  11122. Use default values:
  11123. @example
  11124. vidstabdetect
  11125. @end example
  11126. @item
  11127. Analyze strongly shaky movie and put the results in file
  11128. @file{mytransforms.trf}:
  11129. @example
  11130. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  11131. @end example
  11132. @item
  11133. Visualize the result of internal transformations in the resulting
  11134. video:
  11135. @example
  11136. vidstabdetect=show=1
  11137. @end example
  11138. @item
  11139. Analyze a video with medium shakiness using @command{ffmpeg}:
  11140. @example
  11141. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  11142. @end example
  11143. @end itemize
  11144. @anchor{vidstabtransform}
  11145. @section vidstabtransform
  11146. Video stabilization/deshaking: pass 2 of 2,
  11147. see @ref{vidstabdetect} for pass 1.
  11148. Read a file with transform information for each frame and
  11149. apply/compensate them. Together with the @ref{vidstabdetect}
  11150. filter this can be used to deshake videos. See also
  11151. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  11152. the @ref{unsharp} filter, see below.
  11153. To enable compilation of this filter you need to configure FFmpeg with
  11154. @code{--enable-libvidstab}.
  11155. @subsection Options
  11156. @table @option
  11157. @item input
  11158. Set path to the file used to read the transforms. Default value is
  11159. @file{transforms.trf}.
  11160. @item smoothing
  11161. Set the number of frames (value*2 + 1) used for lowpass filtering the
  11162. camera movements. Default value is 10.
  11163. For example a number of 10 means that 21 frames are used (10 in the
  11164. past and 10 in the future) to smoothen the motion in the video. A
  11165. larger value leads to a smoother video, but limits the acceleration of
  11166. the camera (pan/tilt movements). 0 is a special case where a static
  11167. camera is simulated.
  11168. @item optalgo
  11169. Set the camera path optimization algorithm.
  11170. Accepted values are:
  11171. @table @samp
  11172. @item gauss
  11173. gaussian kernel low-pass filter on camera motion (default)
  11174. @item avg
  11175. averaging on transformations
  11176. @end table
  11177. @item maxshift
  11178. Set maximal number of pixels to translate frames. Default value is -1,
  11179. meaning no limit.
  11180. @item maxangle
  11181. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  11182. value is -1, meaning no limit.
  11183. @item crop
  11184. Specify how to deal with borders that may be visible due to movement
  11185. compensation.
  11186. Available values are:
  11187. @table @samp
  11188. @item keep
  11189. keep image information from previous frame (default)
  11190. @item black
  11191. fill the border black
  11192. @end table
  11193. @item invert
  11194. Invert transforms if set to 1. Default value is 0.
  11195. @item relative
  11196. Consider transforms as relative to previous frame if set to 1,
  11197. absolute if set to 0. Default value is 0.
  11198. @item zoom
  11199. Set percentage to zoom. A positive value will result in a zoom-in
  11200. effect, a negative value in a zoom-out effect. Default value is 0 (no
  11201. zoom).
  11202. @item optzoom
  11203. Set optimal zooming to avoid borders.
  11204. Accepted values are:
  11205. @table @samp
  11206. @item 0
  11207. disabled
  11208. @item 1
  11209. optimal static zoom value is determined (only very strong movements
  11210. will lead to visible borders) (default)
  11211. @item 2
  11212. optimal adaptive zoom value is determined (no borders will be
  11213. visible), see @option{zoomspeed}
  11214. @end table
  11215. Note that the value given at zoom is added to the one calculated here.
  11216. @item zoomspeed
  11217. Set percent to zoom maximally each frame (enabled when
  11218. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  11219. 0.25.
  11220. @item interpol
  11221. Specify type of interpolation.
  11222. Available values are:
  11223. @table @samp
  11224. @item no
  11225. no interpolation
  11226. @item linear
  11227. linear only horizontal
  11228. @item bilinear
  11229. linear in both directions (default)
  11230. @item bicubic
  11231. cubic in both directions (slow)
  11232. @end table
  11233. @item tripod
  11234. Enable virtual tripod mode if set to 1, which is equivalent to
  11235. @code{relative=0:smoothing=0}. Default value is 0.
  11236. Use also @code{tripod} option of @ref{vidstabdetect}.
  11237. @item debug
  11238. Increase log verbosity if set to 1. Also the detected global motions
  11239. are written to the temporary file @file{global_motions.trf}. Default
  11240. value is 0.
  11241. @end table
  11242. @subsection Examples
  11243. @itemize
  11244. @item
  11245. Use @command{ffmpeg} for a typical stabilization with default values:
  11246. @example
  11247. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  11248. @end example
  11249. Note the use of the @ref{unsharp} filter which is always recommended.
  11250. @item
  11251. Zoom in a bit more and load transform data from a given file:
  11252. @example
  11253. vidstabtransform=zoom=5:input="mytransforms.trf"
  11254. @end example
  11255. @item
  11256. Smoothen the video even more:
  11257. @example
  11258. vidstabtransform=smoothing=30
  11259. @end example
  11260. @end itemize
  11261. @section vflip
  11262. Flip the input video vertically.
  11263. For example, to vertically flip a video with @command{ffmpeg}:
  11264. @example
  11265. ffmpeg -i in.avi -vf "vflip" out.avi
  11266. @end example
  11267. @anchor{vignette}
  11268. @section vignette
  11269. Make or reverse a natural vignetting effect.
  11270. The filter accepts the following options:
  11271. @table @option
  11272. @item angle, a
  11273. Set lens angle expression as a number of radians.
  11274. The value is clipped in the @code{[0,PI/2]} range.
  11275. Default value: @code{"PI/5"}
  11276. @item x0
  11277. @item y0
  11278. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  11279. by default.
  11280. @item mode
  11281. Set forward/backward mode.
  11282. Available modes are:
  11283. @table @samp
  11284. @item forward
  11285. The larger the distance from the central point, the darker the image becomes.
  11286. @item backward
  11287. The larger the distance from the central point, the brighter the image becomes.
  11288. This can be used to reverse a vignette effect, though there is no automatic
  11289. detection to extract the lens @option{angle} and other settings (yet). It can
  11290. also be used to create a burning effect.
  11291. @end table
  11292. Default value is @samp{forward}.
  11293. @item eval
  11294. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  11295. It accepts the following values:
  11296. @table @samp
  11297. @item init
  11298. Evaluate expressions only once during the filter initialization.
  11299. @item frame
  11300. Evaluate expressions for each incoming frame. This is way slower than the
  11301. @samp{init} mode since it requires all the scalers to be re-computed, but it
  11302. allows advanced dynamic expressions.
  11303. @end table
  11304. Default value is @samp{init}.
  11305. @item dither
  11306. Set dithering to reduce the circular banding effects. Default is @code{1}
  11307. (enabled).
  11308. @item aspect
  11309. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  11310. Setting this value to the SAR of the input will make a rectangular vignetting
  11311. following the dimensions of the video.
  11312. Default is @code{1/1}.
  11313. @end table
  11314. @subsection Expressions
  11315. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  11316. following parameters.
  11317. @table @option
  11318. @item w
  11319. @item h
  11320. input width and height
  11321. @item n
  11322. the number of input frame, starting from 0
  11323. @item pts
  11324. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  11325. @var{TB} units, NAN if undefined
  11326. @item r
  11327. frame rate of the input video, NAN if the input frame rate is unknown
  11328. @item t
  11329. the PTS (Presentation TimeStamp) of the filtered video frame,
  11330. expressed in seconds, NAN if undefined
  11331. @item tb
  11332. time base of the input video
  11333. @end table
  11334. @subsection Examples
  11335. @itemize
  11336. @item
  11337. Apply simple strong vignetting effect:
  11338. @example
  11339. vignette=PI/4
  11340. @end example
  11341. @item
  11342. Make a flickering vignetting:
  11343. @example
  11344. vignette='PI/4+random(1)*PI/50':eval=frame
  11345. @end example
  11346. @end itemize
  11347. @section vstack
  11348. Stack input videos vertically.
  11349. All streams must be of same pixel format and of same width.
  11350. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  11351. to create same output.
  11352. The filter accept the following option:
  11353. @table @option
  11354. @item inputs
  11355. Set number of input streams. Default is 2.
  11356. @item shortest
  11357. If set to 1, force the output to terminate when the shortest input
  11358. terminates. Default value is 0.
  11359. @end table
  11360. @section w3fdif
  11361. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  11362. Deinterlacing Filter").
  11363. Based on the process described by Martin Weston for BBC R&D, and
  11364. implemented based on the de-interlace algorithm written by Jim
  11365. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  11366. uses filter coefficients calculated by BBC R&D.
  11367. There are two sets of filter coefficients, so called "simple":
  11368. and "complex". Which set of filter coefficients is used can
  11369. be set by passing an optional parameter:
  11370. @table @option
  11371. @item filter
  11372. Set the interlacing filter coefficients. Accepts one of the following values:
  11373. @table @samp
  11374. @item simple
  11375. Simple filter coefficient set.
  11376. @item complex
  11377. More-complex filter coefficient set.
  11378. @end table
  11379. Default value is @samp{complex}.
  11380. @item deint
  11381. Specify which frames to deinterlace. Accept one of the following values:
  11382. @table @samp
  11383. @item all
  11384. Deinterlace all frames,
  11385. @item interlaced
  11386. Only deinterlace frames marked as interlaced.
  11387. @end table
  11388. Default value is @samp{all}.
  11389. @end table
  11390. @section waveform
  11391. Video waveform monitor.
  11392. The waveform monitor plots color component intensity. By default luminance
  11393. only. Each column of the waveform corresponds to a column of pixels in the
  11394. source video.
  11395. It accepts the following options:
  11396. @table @option
  11397. @item mode, m
  11398. Can be either @code{row}, or @code{column}. Default is @code{column}.
  11399. In row mode, the graph on the left side represents color component value 0 and
  11400. the right side represents value = 255. In column mode, the top side represents
  11401. color component value = 0 and bottom side represents value = 255.
  11402. @item intensity, i
  11403. Set intensity. Smaller values are useful to find out how many values of the same
  11404. luminance are distributed across input rows/columns.
  11405. Default value is @code{0.04}. Allowed range is [0, 1].
  11406. @item mirror, r
  11407. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  11408. In mirrored mode, higher values will be represented on the left
  11409. side for @code{row} mode and at the top for @code{column} mode. Default is
  11410. @code{1} (mirrored).
  11411. @item display, d
  11412. Set display mode.
  11413. It accepts the following values:
  11414. @table @samp
  11415. @item overlay
  11416. Presents information identical to that in the @code{parade}, except
  11417. that the graphs representing color components are superimposed directly
  11418. over one another.
  11419. This display mode makes it easier to spot relative differences or similarities
  11420. in overlapping areas of the color components that are supposed to be identical,
  11421. such as neutral whites, grays, or blacks.
  11422. @item stack
  11423. Display separate graph for the color components side by side in
  11424. @code{row} mode or one below the other in @code{column} mode.
  11425. @item parade
  11426. Display separate graph for the color components side by side in
  11427. @code{column} mode or one below the other in @code{row} mode.
  11428. Using this display mode makes it easy to spot color casts in the highlights
  11429. and shadows of an image, by comparing the contours of the top and the bottom
  11430. graphs of each waveform. Since whites, grays, and blacks are characterized
  11431. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  11432. should display three waveforms of roughly equal width/height. If not, the
  11433. correction is easy to perform by making level adjustments the three waveforms.
  11434. @end table
  11435. Default is @code{stack}.
  11436. @item components, c
  11437. Set which color components to display. Default is 1, which means only luminance
  11438. or red color component if input is in RGB colorspace. If is set for example to
  11439. 7 it will display all 3 (if) available color components.
  11440. @item envelope, e
  11441. @table @samp
  11442. @item none
  11443. No envelope, this is default.
  11444. @item instant
  11445. Instant envelope, minimum and maximum values presented in graph will be easily
  11446. visible even with small @code{step} value.
  11447. @item peak
  11448. Hold minimum and maximum values presented in graph across time. This way you
  11449. can still spot out of range values without constantly looking at waveforms.
  11450. @item peak+instant
  11451. Peak and instant envelope combined together.
  11452. @end table
  11453. @item filter, f
  11454. @table @samp
  11455. @item lowpass
  11456. No filtering, this is default.
  11457. @item flat
  11458. Luma and chroma combined together.
  11459. @item aflat
  11460. Similar as above, but shows difference between blue and red chroma.
  11461. @item chroma
  11462. Displays only chroma.
  11463. @item color
  11464. Displays actual color value on waveform.
  11465. @item acolor
  11466. Similar as above, but with luma showing frequency of chroma values.
  11467. @end table
  11468. @item graticule, g
  11469. Set which graticule to display.
  11470. @table @samp
  11471. @item none
  11472. Do not display graticule.
  11473. @item green
  11474. Display green graticule showing legal broadcast ranges.
  11475. @end table
  11476. @item opacity, o
  11477. Set graticule opacity.
  11478. @item flags, fl
  11479. Set graticule flags.
  11480. @table @samp
  11481. @item numbers
  11482. Draw numbers above lines. By default enabled.
  11483. @item dots
  11484. Draw dots instead of lines.
  11485. @end table
  11486. @item scale, s
  11487. Set scale used for displaying graticule.
  11488. @table @samp
  11489. @item digital
  11490. @item millivolts
  11491. @item ire
  11492. @end table
  11493. Default is digital.
  11494. @item bgopacity, b
  11495. Set background opacity.
  11496. @end table
  11497. @section weave, doubleweave
  11498. The @code{weave} takes a field-based video input and join
  11499. each two sequential fields into single frame, producing a new double
  11500. height clip with half the frame rate and half the frame count.
  11501. The @code{doubleweave} works same as @code{weave} but without
  11502. halving frame rate and frame count.
  11503. It accepts the following option:
  11504. @table @option
  11505. @item first_field
  11506. Set first field. Available values are:
  11507. @table @samp
  11508. @item top, t
  11509. Set the frame as top-field-first.
  11510. @item bottom, b
  11511. Set the frame as bottom-field-first.
  11512. @end table
  11513. @end table
  11514. @subsection Examples
  11515. @itemize
  11516. @item
  11517. Interlace video using @ref{select} and @ref{separatefields} filter:
  11518. @example
  11519. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  11520. @end example
  11521. @end itemize
  11522. @section xbr
  11523. Apply the xBR high-quality magnification filter which is designed for pixel
  11524. art. It follows a set of edge-detection rules, see
  11525. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  11526. It accepts the following option:
  11527. @table @option
  11528. @item n
  11529. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  11530. @code{3xBR} and @code{4} for @code{4xBR}.
  11531. Default is @code{3}.
  11532. @end table
  11533. @anchor{yadif}
  11534. @section yadif
  11535. Deinterlace the input video ("yadif" means "yet another deinterlacing
  11536. filter").
  11537. It accepts the following parameters:
  11538. @table @option
  11539. @item mode
  11540. The interlacing mode to adopt. It accepts one of the following values:
  11541. @table @option
  11542. @item 0, send_frame
  11543. Output one frame for each frame.
  11544. @item 1, send_field
  11545. Output one frame for each field.
  11546. @item 2, send_frame_nospatial
  11547. Like @code{send_frame}, but it skips the spatial interlacing check.
  11548. @item 3, send_field_nospatial
  11549. Like @code{send_field}, but it skips the spatial interlacing check.
  11550. @end table
  11551. The default value is @code{send_frame}.
  11552. @item parity
  11553. The picture field parity assumed for the input interlaced video. It accepts one
  11554. of the following values:
  11555. @table @option
  11556. @item 0, tff
  11557. Assume the top field is first.
  11558. @item 1, bff
  11559. Assume the bottom field is first.
  11560. @item -1, auto
  11561. Enable automatic detection of field parity.
  11562. @end table
  11563. The default value is @code{auto}.
  11564. If the interlacing is unknown or the decoder does not export this information,
  11565. top field first will be assumed.
  11566. @item deint
  11567. Specify which frames to deinterlace. Accept one of the following
  11568. values:
  11569. @table @option
  11570. @item 0, all
  11571. Deinterlace all frames.
  11572. @item 1, interlaced
  11573. Only deinterlace frames marked as interlaced.
  11574. @end table
  11575. The default value is @code{all}.
  11576. @end table
  11577. @section zoompan
  11578. Apply Zoom & Pan effect.
  11579. This filter accepts the following options:
  11580. @table @option
  11581. @item zoom, z
  11582. Set the zoom expression. Default is 1.
  11583. @item x
  11584. @item y
  11585. Set the x and y expression. Default is 0.
  11586. @item d
  11587. Set the duration expression in number of frames.
  11588. This sets for how many number of frames effect will last for
  11589. single input image.
  11590. @item s
  11591. Set the output image size, default is 'hd720'.
  11592. @item fps
  11593. Set the output frame rate, default is '25'.
  11594. @end table
  11595. Each expression can contain the following constants:
  11596. @table @option
  11597. @item in_w, iw
  11598. Input width.
  11599. @item in_h, ih
  11600. Input height.
  11601. @item out_w, ow
  11602. Output width.
  11603. @item out_h, oh
  11604. Output height.
  11605. @item in
  11606. Input frame count.
  11607. @item on
  11608. Output frame count.
  11609. @item x
  11610. @item y
  11611. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  11612. for current input frame.
  11613. @item px
  11614. @item py
  11615. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  11616. not yet such frame (first input frame).
  11617. @item zoom
  11618. Last calculated zoom from 'z' expression for current input frame.
  11619. @item pzoom
  11620. Last calculated zoom of last output frame of previous input frame.
  11621. @item duration
  11622. Number of output frames for current input frame. Calculated from 'd' expression
  11623. for each input frame.
  11624. @item pduration
  11625. number of output frames created for previous input frame
  11626. @item a
  11627. Rational number: input width / input height
  11628. @item sar
  11629. sample aspect ratio
  11630. @item dar
  11631. display aspect ratio
  11632. @end table
  11633. @subsection Examples
  11634. @itemize
  11635. @item
  11636. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  11637. @example
  11638. 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
  11639. @end example
  11640. @item
  11641. Zoom-in up to 1.5 and pan always at center of picture:
  11642. @example
  11643. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  11644. @end example
  11645. @item
  11646. Same as above but without pausing:
  11647. @example
  11648. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  11649. @end example
  11650. @end itemize
  11651. @section zscale
  11652. Scale (resize) the input video, using the z.lib library:
  11653. https://github.com/sekrit-twc/zimg.
  11654. The zscale filter forces the output display aspect ratio to be the same
  11655. as the input, by changing the output sample aspect ratio.
  11656. If the input image format is different from the format requested by
  11657. the next filter, the zscale filter will convert the input to the
  11658. requested format.
  11659. @subsection Options
  11660. The filter accepts the following options.
  11661. @table @option
  11662. @item width, w
  11663. @item height, h
  11664. Set the output video dimension expression. Default value is the input
  11665. dimension.
  11666. If the @var{width} or @var{w} is 0, the input width is used for the output.
  11667. If the @var{height} or @var{h} is 0, the input height is used for the output.
  11668. If one of the values is -1, the zscale filter will use a value that
  11669. maintains the aspect ratio of the input image, calculated from the
  11670. other specified dimension. If both of them are -1, the input size is
  11671. used
  11672. If one of the values is -n with n > 1, the zscale filter will also use a value
  11673. that maintains the aspect ratio of the input image, calculated from the other
  11674. specified dimension. After that it will, however, make sure that the calculated
  11675. dimension is divisible by n and adjust the value if necessary.
  11676. See below for the list of accepted constants for use in the dimension
  11677. expression.
  11678. @item size, s
  11679. Set the video size. For the syntax of this option, check the
  11680. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11681. @item dither, d
  11682. Set the dither type.
  11683. Possible values are:
  11684. @table @var
  11685. @item none
  11686. @item ordered
  11687. @item random
  11688. @item error_diffusion
  11689. @end table
  11690. Default is none.
  11691. @item filter, f
  11692. Set the resize filter type.
  11693. Possible values are:
  11694. @table @var
  11695. @item point
  11696. @item bilinear
  11697. @item bicubic
  11698. @item spline16
  11699. @item spline36
  11700. @item lanczos
  11701. @end table
  11702. Default is bilinear.
  11703. @item range, r
  11704. Set the color range.
  11705. Possible values are:
  11706. @table @var
  11707. @item input
  11708. @item limited
  11709. @item full
  11710. @end table
  11711. Default is same as input.
  11712. @item primaries, p
  11713. Set the color primaries.
  11714. Possible values are:
  11715. @table @var
  11716. @item input
  11717. @item 709
  11718. @item unspecified
  11719. @item 170m
  11720. @item 240m
  11721. @item 2020
  11722. @end table
  11723. Default is same as input.
  11724. @item transfer, t
  11725. Set the transfer characteristics.
  11726. Possible values are:
  11727. @table @var
  11728. @item input
  11729. @item 709
  11730. @item unspecified
  11731. @item 601
  11732. @item linear
  11733. @item 2020_10
  11734. @item 2020_12
  11735. @item smpte2084
  11736. @item iec61966-2-1
  11737. @item arib-std-b67
  11738. @end table
  11739. Default is same as input.
  11740. @item matrix, m
  11741. Set the colorspace matrix.
  11742. Possible value are:
  11743. @table @var
  11744. @item input
  11745. @item 709
  11746. @item unspecified
  11747. @item 470bg
  11748. @item 170m
  11749. @item 2020_ncl
  11750. @item 2020_cl
  11751. @end table
  11752. Default is same as input.
  11753. @item rangein, rin
  11754. Set the input color range.
  11755. Possible values are:
  11756. @table @var
  11757. @item input
  11758. @item limited
  11759. @item full
  11760. @end table
  11761. Default is same as input.
  11762. @item primariesin, pin
  11763. Set the input color primaries.
  11764. Possible values are:
  11765. @table @var
  11766. @item input
  11767. @item 709
  11768. @item unspecified
  11769. @item 170m
  11770. @item 240m
  11771. @item 2020
  11772. @end table
  11773. Default is same as input.
  11774. @item transferin, tin
  11775. Set the input transfer characteristics.
  11776. Possible values are:
  11777. @table @var
  11778. @item input
  11779. @item 709
  11780. @item unspecified
  11781. @item 601
  11782. @item linear
  11783. @item 2020_10
  11784. @item 2020_12
  11785. @end table
  11786. Default is same as input.
  11787. @item matrixin, min
  11788. Set the input colorspace matrix.
  11789. Possible value are:
  11790. @table @var
  11791. @item input
  11792. @item 709
  11793. @item unspecified
  11794. @item 470bg
  11795. @item 170m
  11796. @item 2020_ncl
  11797. @item 2020_cl
  11798. @end table
  11799. @item chromal, c
  11800. Set the output chroma location.
  11801. Possible values are:
  11802. @table @var
  11803. @item input
  11804. @item left
  11805. @item center
  11806. @item topleft
  11807. @item top
  11808. @item bottomleft
  11809. @item bottom
  11810. @end table
  11811. @item chromalin, cin
  11812. Set the input chroma location.
  11813. Possible values are:
  11814. @table @var
  11815. @item input
  11816. @item left
  11817. @item center
  11818. @item topleft
  11819. @item top
  11820. @item bottomleft
  11821. @item bottom
  11822. @end table
  11823. @item npl
  11824. Set the nominal peak luminance.
  11825. @end table
  11826. The values of the @option{w} and @option{h} options are expressions
  11827. containing the following constants:
  11828. @table @var
  11829. @item in_w
  11830. @item in_h
  11831. The input width and height
  11832. @item iw
  11833. @item ih
  11834. These are the same as @var{in_w} and @var{in_h}.
  11835. @item out_w
  11836. @item out_h
  11837. The output (scaled) width and height
  11838. @item ow
  11839. @item oh
  11840. These are the same as @var{out_w} and @var{out_h}
  11841. @item a
  11842. The same as @var{iw} / @var{ih}
  11843. @item sar
  11844. input sample aspect ratio
  11845. @item dar
  11846. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  11847. @item hsub
  11848. @item vsub
  11849. horizontal and vertical input chroma subsample values. For example for the
  11850. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11851. @item ohsub
  11852. @item ovsub
  11853. horizontal and vertical output chroma subsample values. For example for the
  11854. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  11855. @end table
  11856. @table @option
  11857. @end table
  11858. @c man end VIDEO FILTERS
  11859. @chapter Video Sources
  11860. @c man begin VIDEO SOURCES
  11861. Below is a description of the currently available video sources.
  11862. @section buffer
  11863. Buffer video frames, and make them available to the filter chain.
  11864. This source is mainly intended for a programmatic use, in particular
  11865. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  11866. It accepts the following parameters:
  11867. @table @option
  11868. @item video_size
  11869. Specify the size (width and height) of the buffered video frames. For the
  11870. syntax of this option, check the
  11871. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11872. @item width
  11873. The input video width.
  11874. @item height
  11875. The input video height.
  11876. @item pix_fmt
  11877. A string representing the pixel format of the buffered video frames.
  11878. It may be a number corresponding to a pixel format, or a pixel format
  11879. name.
  11880. @item time_base
  11881. Specify the timebase assumed by the timestamps of the buffered frames.
  11882. @item frame_rate
  11883. Specify the frame rate expected for the video stream.
  11884. @item pixel_aspect, sar
  11885. The sample (pixel) aspect ratio of the input video.
  11886. @item sws_param
  11887. Specify the optional parameters to be used for the scale filter which
  11888. is automatically inserted when an input change is detected in the
  11889. input size or format.
  11890. @item hw_frames_ctx
  11891. When using a hardware pixel format, this should be a reference to an
  11892. AVHWFramesContext describing input frames.
  11893. @end table
  11894. For example:
  11895. @example
  11896. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  11897. @end example
  11898. will instruct the source to accept video frames with size 320x240 and
  11899. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  11900. square pixels (1:1 sample aspect ratio).
  11901. Since the pixel format with name "yuv410p" corresponds to the number 6
  11902. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  11903. this example corresponds to:
  11904. @example
  11905. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  11906. @end example
  11907. Alternatively, the options can be specified as a flat string, but this
  11908. syntax is deprecated:
  11909. @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}]
  11910. @section cellauto
  11911. Create a pattern generated by an elementary cellular automaton.
  11912. The initial state of the cellular automaton can be defined through the
  11913. @option{filename} and @option{pattern} options. If such options are
  11914. not specified an initial state is created randomly.
  11915. At each new frame a new row in the video is filled with the result of
  11916. the cellular automaton next generation. The behavior when the whole
  11917. frame is filled is defined by the @option{scroll} option.
  11918. This source accepts the following options:
  11919. @table @option
  11920. @item filename, f
  11921. Read the initial cellular automaton state, i.e. the starting row, from
  11922. the specified file.
  11923. In the file, each non-whitespace character is considered an alive
  11924. cell, a newline will terminate the row, and further characters in the
  11925. file will be ignored.
  11926. @item pattern, p
  11927. Read the initial cellular automaton state, i.e. the starting row, from
  11928. the specified string.
  11929. Each non-whitespace character in the string is considered an alive
  11930. cell, a newline will terminate the row, and further characters in the
  11931. string will be ignored.
  11932. @item rate, r
  11933. Set the video rate, that is the number of frames generated per second.
  11934. Default is 25.
  11935. @item random_fill_ratio, ratio
  11936. Set the random fill ratio for the initial cellular automaton row. It
  11937. is a floating point number value ranging from 0 to 1, defaults to
  11938. 1/PHI.
  11939. This option is ignored when a file or a pattern is specified.
  11940. @item random_seed, seed
  11941. Set the seed for filling randomly the initial row, must be an integer
  11942. included between 0 and UINT32_MAX. If not specified, or if explicitly
  11943. set to -1, the filter will try to use a good random seed on a best
  11944. effort basis.
  11945. @item rule
  11946. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  11947. Default value is 110.
  11948. @item size, s
  11949. Set the size of the output video. For the syntax of this option, check the
  11950. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11951. If @option{filename} or @option{pattern} is specified, the size is set
  11952. by default to the width of the specified initial state row, and the
  11953. height is set to @var{width} * PHI.
  11954. If @option{size} is set, it must contain the width of the specified
  11955. pattern string, and the specified pattern will be centered in the
  11956. larger row.
  11957. If a filename or a pattern string is not specified, the size value
  11958. defaults to "320x518" (used for a randomly generated initial state).
  11959. @item scroll
  11960. If set to 1, scroll the output upward when all the rows in the output
  11961. have been already filled. If set to 0, the new generated row will be
  11962. written over the top row just after the bottom row is filled.
  11963. Defaults to 1.
  11964. @item start_full, full
  11965. If set to 1, completely fill the output with generated rows before
  11966. outputting the first frame.
  11967. This is the default behavior, for disabling set the value to 0.
  11968. @item stitch
  11969. If set to 1, stitch the left and right row edges together.
  11970. This is the default behavior, for disabling set the value to 0.
  11971. @end table
  11972. @subsection Examples
  11973. @itemize
  11974. @item
  11975. Read the initial state from @file{pattern}, and specify an output of
  11976. size 200x400.
  11977. @example
  11978. cellauto=f=pattern:s=200x400
  11979. @end example
  11980. @item
  11981. Generate a random initial row with a width of 200 cells, with a fill
  11982. ratio of 2/3:
  11983. @example
  11984. cellauto=ratio=2/3:s=200x200
  11985. @end example
  11986. @item
  11987. Create a pattern generated by rule 18 starting by a single alive cell
  11988. centered on an initial row with width 100:
  11989. @example
  11990. cellauto=p=@@:s=100x400:full=0:rule=18
  11991. @end example
  11992. @item
  11993. Specify a more elaborated initial pattern:
  11994. @example
  11995. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  11996. @end example
  11997. @end itemize
  11998. @anchor{coreimagesrc}
  11999. @section coreimagesrc
  12000. Video source generated on GPU using Apple's CoreImage API on OSX.
  12001. This video source is a specialized version of the @ref{coreimage} video filter.
  12002. Use a core image generator at the beginning of the applied filterchain to
  12003. generate the content.
  12004. The coreimagesrc video source accepts the following options:
  12005. @table @option
  12006. @item list_generators
  12007. List all available generators along with all their respective options as well as
  12008. possible minimum and maximum values along with the default values.
  12009. @example
  12010. list_generators=true
  12011. @end example
  12012. @item size, s
  12013. Specify the size of the sourced video. For the syntax of this option, check the
  12014. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12015. The default value is @code{320x240}.
  12016. @item rate, r
  12017. Specify the frame rate of the sourced video, as the number of frames
  12018. generated per second. It has to be a string in the format
  12019. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12020. number or a valid video frame rate abbreviation. The default value is
  12021. "25".
  12022. @item sar
  12023. Set the sample aspect ratio of the sourced video.
  12024. @item duration, d
  12025. Set the duration of the sourced video. See
  12026. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12027. for the accepted syntax.
  12028. If not specified, or the expressed duration is negative, the video is
  12029. supposed to be generated forever.
  12030. @end table
  12031. Additionally, all options of the @ref{coreimage} video filter are accepted.
  12032. A complete filterchain can be used for further processing of the
  12033. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  12034. and examples for details.
  12035. @subsection Examples
  12036. @itemize
  12037. @item
  12038. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  12039. given as complete and escaped command-line for Apple's standard bash shell:
  12040. @example
  12041. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  12042. @end example
  12043. This example is equivalent to the QRCode example of @ref{coreimage} without the
  12044. need for a nullsrc video source.
  12045. @end itemize
  12046. @section mandelbrot
  12047. Generate a Mandelbrot set fractal, and progressively zoom towards the
  12048. point specified with @var{start_x} and @var{start_y}.
  12049. This source accepts the following options:
  12050. @table @option
  12051. @item end_pts
  12052. Set the terminal pts value. Default value is 400.
  12053. @item end_scale
  12054. Set the terminal scale value.
  12055. Must be a floating point value. Default value is 0.3.
  12056. @item inner
  12057. Set the inner coloring mode, that is the algorithm used to draw the
  12058. Mandelbrot fractal internal region.
  12059. It shall assume one of the following values:
  12060. @table @option
  12061. @item black
  12062. Set black mode.
  12063. @item convergence
  12064. Show time until convergence.
  12065. @item mincol
  12066. Set color based on point closest to the origin of the iterations.
  12067. @item period
  12068. Set period mode.
  12069. @end table
  12070. Default value is @var{mincol}.
  12071. @item bailout
  12072. Set the bailout value. Default value is 10.0.
  12073. @item maxiter
  12074. Set the maximum of iterations performed by the rendering
  12075. algorithm. Default value is 7189.
  12076. @item outer
  12077. Set outer coloring mode.
  12078. It shall assume one of following values:
  12079. @table @option
  12080. @item iteration_count
  12081. Set iteration cound mode.
  12082. @item normalized_iteration_count
  12083. set normalized iteration count mode.
  12084. @end table
  12085. Default value is @var{normalized_iteration_count}.
  12086. @item rate, r
  12087. Set frame rate, expressed as number of frames per second. Default
  12088. value is "25".
  12089. @item size, s
  12090. Set frame size. For the syntax of this option, check the "Video
  12091. size" section in the ffmpeg-utils manual. Default value is "640x480".
  12092. @item start_scale
  12093. Set the initial scale value. Default value is 3.0.
  12094. @item start_x
  12095. Set the initial x position. Must be a floating point value between
  12096. -100 and 100. Default value is -0.743643887037158704752191506114774.
  12097. @item start_y
  12098. Set the initial y position. Must be a floating point value between
  12099. -100 and 100. Default value is -0.131825904205311970493132056385139.
  12100. @end table
  12101. @section mptestsrc
  12102. Generate various test patterns, as generated by the MPlayer test filter.
  12103. The size of the generated video is fixed, and is 256x256.
  12104. This source is useful in particular for testing encoding features.
  12105. This source accepts the following options:
  12106. @table @option
  12107. @item rate, r
  12108. Specify the frame rate of the sourced video, as the number of frames
  12109. generated per second. It has to be a string in the format
  12110. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12111. number or a valid video frame rate abbreviation. The default value is
  12112. "25".
  12113. @item duration, d
  12114. Set the duration of the sourced video. See
  12115. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12116. for the accepted syntax.
  12117. If not specified, or the expressed duration is negative, the video is
  12118. supposed to be generated forever.
  12119. @item test, t
  12120. Set the number or the name of the test to perform. Supported tests are:
  12121. @table @option
  12122. @item dc_luma
  12123. @item dc_chroma
  12124. @item freq_luma
  12125. @item freq_chroma
  12126. @item amp_luma
  12127. @item amp_chroma
  12128. @item cbp
  12129. @item mv
  12130. @item ring1
  12131. @item ring2
  12132. @item all
  12133. @end table
  12134. Default value is "all", which will cycle through the list of all tests.
  12135. @end table
  12136. Some examples:
  12137. @example
  12138. mptestsrc=t=dc_luma
  12139. @end example
  12140. will generate a "dc_luma" test pattern.
  12141. @section frei0r_src
  12142. Provide a frei0r source.
  12143. To enable compilation of this filter you need to install the frei0r
  12144. header and configure FFmpeg with @code{--enable-frei0r}.
  12145. This source accepts the following parameters:
  12146. @table @option
  12147. @item size
  12148. The size of the video to generate. For the syntax of this option, check the
  12149. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12150. @item framerate
  12151. The framerate of the generated video. It may be a string of the form
  12152. @var{num}/@var{den} or a frame rate abbreviation.
  12153. @item filter_name
  12154. The name to the frei0r source to load. For more information regarding frei0r and
  12155. how to set the parameters, read the @ref{frei0r} section in the video filters
  12156. documentation.
  12157. @item filter_params
  12158. A '|'-separated list of parameters to pass to the frei0r source.
  12159. @end table
  12160. For example, to generate a frei0r partik0l source with size 200x200
  12161. and frame rate 10 which is overlaid on the overlay filter main input:
  12162. @example
  12163. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  12164. @end example
  12165. @section life
  12166. Generate a life pattern.
  12167. This source is based on a generalization of John Conway's life game.
  12168. The sourced input represents a life grid, each pixel represents a cell
  12169. which can be in one of two possible states, alive or dead. Every cell
  12170. interacts with its eight neighbours, which are the cells that are
  12171. horizontally, vertically, or diagonally adjacent.
  12172. At each interaction the grid evolves according to the adopted rule,
  12173. which specifies the number of neighbor alive cells which will make a
  12174. cell stay alive or born. The @option{rule} option allows one to specify
  12175. the rule to adopt.
  12176. This source accepts the following options:
  12177. @table @option
  12178. @item filename, f
  12179. Set the file from which to read the initial grid state. In the file,
  12180. each non-whitespace character is considered an alive cell, and newline
  12181. is used to delimit the end of each row.
  12182. If this option is not specified, the initial grid is generated
  12183. randomly.
  12184. @item rate, r
  12185. Set the video rate, that is the number of frames generated per second.
  12186. Default is 25.
  12187. @item random_fill_ratio, ratio
  12188. Set the random fill ratio for the initial random grid. It is a
  12189. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  12190. It is ignored when a file is specified.
  12191. @item random_seed, seed
  12192. Set the seed for filling the initial random grid, must be an integer
  12193. included between 0 and UINT32_MAX. If not specified, or if explicitly
  12194. set to -1, the filter will try to use a good random seed on a best
  12195. effort basis.
  12196. @item rule
  12197. Set the life rule.
  12198. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  12199. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  12200. @var{NS} specifies the number of alive neighbor cells which make a
  12201. live cell stay alive, and @var{NB} the number of alive neighbor cells
  12202. which make a dead cell to become alive (i.e. to "born").
  12203. "s" and "b" can be used in place of "S" and "B", respectively.
  12204. Alternatively a rule can be specified by an 18-bits integer. The 9
  12205. high order bits are used to encode the next cell state if it is alive
  12206. for each number of neighbor alive cells, the low order bits specify
  12207. the rule for "borning" new cells. Higher order bits encode for an
  12208. higher number of neighbor cells.
  12209. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  12210. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  12211. Default value is "S23/B3", which is the original Conway's game of life
  12212. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  12213. cells, and will born a new cell if there are three alive cells around
  12214. a dead cell.
  12215. @item size, s
  12216. Set the size of the output video. For the syntax of this option, check the
  12217. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12218. If @option{filename} is specified, the size is set by default to the
  12219. same size of the input file. If @option{size} is set, it must contain
  12220. the size specified in the input file, and the initial grid defined in
  12221. that file is centered in the larger resulting area.
  12222. If a filename is not specified, the size value defaults to "320x240"
  12223. (used for a randomly generated initial grid).
  12224. @item stitch
  12225. If set to 1, stitch the left and right grid edges together, and the
  12226. top and bottom edges also. Defaults to 1.
  12227. @item mold
  12228. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  12229. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  12230. value from 0 to 255.
  12231. @item life_color
  12232. Set the color of living (or new born) cells.
  12233. @item death_color
  12234. Set the color of dead cells. If @option{mold} is set, this is the first color
  12235. used to represent a dead cell.
  12236. @item mold_color
  12237. Set mold color, for definitely dead and moldy cells.
  12238. For the syntax of these 3 color options, check the "Color" section in the
  12239. ffmpeg-utils manual.
  12240. @end table
  12241. @subsection Examples
  12242. @itemize
  12243. @item
  12244. Read a grid from @file{pattern}, and center it on a grid of size
  12245. 300x300 pixels:
  12246. @example
  12247. life=f=pattern:s=300x300
  12248. @end example
  12249. @item
  12250. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  12251. @example
  12252. life=ratio=2/3:s=200x200
  12253. @end example
  12254. @item
  12255. Specify a custom rule for evolving a randomly generated grid:
  12256. @example
  12257. life=rule=S14/B34
  12258. @end example
  12259. @item
  12260. Full example with slow death effect (mold) using @command{ffplay}:
  12261. @example
  12262. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  12263. @end example
  12264. @end itemize
  12265. @anchor{allrgb}
  12266. @anchor{allyuv}
  12267. @anchor{color}
  12268. @anchor{haldclutsrc}
  12269. @anchor{nullsrc}
  12270. @anchor{rgbtestsrc}
  12271. @anchor{smptebars}
  12272. @anchor{smptehdbars}
  12273. @anchor{testsrc}
  12274. @anchor{testsrc2}
  12275. @anchor{yuvtestsrc}
  12276. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  12277. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  12278. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  12279. The @code{color} source provides an uniformly colored input.
  12280. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  12281. @ref{haldclut} filter.
  12282. The @code{nullsrc} source returns unprocessed video frames. It is
  12283. mainly useful to be employed in analysis / debugging tools, or as the
  12284. source for filters which ignore the input data.
  12285. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  12286. detecting RGB vs BGR issues. You should see a red, green and blue
  12287. stripe from top to bottom.
  12288. The @code{smptebars} source generates a color bars pattern, based on
  12289. the SMPTE Engineering Guideline EG 1-1990.
  12290. The @code{smptehdbars} source generates a color bars pattern, based on
  12291. the SMPTE RP 219-2002.
  12292. The @code{testsrc} source generates a test video pattern, showing a
  12293. color pattern, a scrolling gradient and a timestamp. This is mainly
  12294. intended for testing purposes.
  12295. The @code{testsrc2} source is similar to testsrc, but supports more
  12296. pixel formats instead of just @code{rgb24}. This allows using it as an
  12297. input for other tests without requiring a format conversion.
  12298. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  12299. see a y, cb and cr stripe from top to bottom.
  12300. The sources accept the following parameters:
  12301. @table @option
  12302. @item color, c
  12303. Specify the color of the source, only available in the @code{color}
  12304. source. For the syntax of this option, check the "Color" section in the
  12305. ffmpeg-utils manual.
  12306. @item level
  12307. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  12308. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  12309. pixels to be used as identity matrix for 3D lookup tables. Each component is
  12310. coded on a @code{1/(N*N)} scale.
  12311. @item size, s
  12312. Specify the size of the sourced video. For the syntax of this option, check the
  12313. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12314. The default value is @code{320x240}.
  12315. This option is not available with the @code{haldclutsrc} filter.
  12316. @item rate, r
  12317. Specify the frame rate of the sourced video, as the number of frames
  12318. generated per second. It has to be a string in the format
  12319. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12320. number or a valid video frame rate abbreviation. The default value is
  12321. "25".
  12322. @item sar
  12323. Set the sample aspect ratio of the sourced video.
  12324. @item duration, d
  12325. Set the duration of the sourced video. See
  12326. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12327. for the accepted syntax.
  12328. If not specified, or the expressed duration is negative, the video is
  12329. supposed to be generated forever.
  12330. @item decimals, n
  12331. Set the number of decimals to show in the timestamp, only available in the
  12332. @code{testsrc} source.
  12333. The displayed timestamp value will correspond to the original
  12334. timestamp value multiplied by the power of 10 of the specified
  12335. value. Default value is 0.
  12336. @end table
  12337. For example the following:
  12338. @example
  12339. testsrc=duration=5.3:size=qcif:rate=10
  12340. @end example
  12341. will generate a video with a duration of 5.3 seconds, with size
  12342. 176x144 and a frame rate of 10 frames per second.
  12343. The following graph description will generate a red source
  12344. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  12345. frames per second.
  12346. @example
  12347. color=c=red@@0.2:s=qcif:r=10
  12348. @end example
  12349. If the input content is to be ignored, @code{nullsrc} can be used. The
  12350. following command generates noise in the luminance plane by employing
  12351. the @code{geq} filter:
  12352. @example
  12353. nullsrc=s=256x256, geq=random(1)*255:128:128
  12354. @end example
  12355. @subsection Commands
  12356. The @code{color} source supports the following commands:
  12357. @table @option
  12358. @item c, color
  12359. Set the color of the created image. Accepts the same syntax of the
  12360. corresponding @option{color} option.
  12361. @end table
  12362. @c man end VIDEO SOURCES
  12363. @chapter Video Sinks
  12364. @c man begin VIDEO SINKS
  12365. Below is a description of the currently available video sinks.
  12366. @section buffersink
  12367. Buffer video frames, and make them available to the end of the filter
  12368. graph.
  12369. This sink is mainly intended for programmatic use, in particular
  12370. through the interface defined in @file{libavfilter/buffersink.h}
  12371. or the options system.
  12372. It accepts a pointer to an AVBufferSinkContext structure, which
  12373. defines the incoming buffers' formats, to be passed as the opaque
  12374. parameter to @code{avfilter_init_filter} for initialization.
  12375. @section nullsink
  12376. Null video sink: do absolutely nothing with the input video. It is
  12377. mainly useful as a template and for use in analysis / debugging
  12378. tools.
  12379. @c man end VIDEO SINKS
  12380. @chapter Multimedia Filters
  12381. @c man begin MULTIMEDIA FILTERS
  12382. Below is a description of the currently available multimedia filters.
  12383. @section abitscope
  12384. Convert input audio to a video output, displaying the audio bit scope.
  12385. The filter accepts the following options:
  12386. @table @option
  12387. @item rate, r
  12388. Set frame rate, expressed as number of frames per second. Default
  12389. value is "25".
  12390. @item size, s
  12391. Specify the video size for the output. For the syntax of this option, check the
  12392. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12393. Default value is @code{1024x256}.
  12394. @item colors
  12395. Specify list of colors separated by space or by '|' which will be used to
  12396. draw channels. Unrecognized or missing colors will be replaced
  12397. by white color.
  12398. @end table
  12399. @section ahistogram
  12400. Convert input audio to a video output, displaying the volume histogram.
  12401. The filter accepts the following options:
  12402. @table @option
  12403. @item dmode
  12404. Specify how histogram is calculated.
  12405. It accepts the following values:
  12406. @table @samp
  12407. @item single
  12408. Use single histogram for all channels.
  12409. @item separate
  12410. Use separate histogram for each channel.
  12411. @end table
  12412. Default is @code{single}.
  12413. @item rate, r
  12414. Set frame rate, expressed as number of frames per second. Default
  12415. value is "25".
  12416. @item size, s
  12417. Specify the video size for the output. For the syntax of this option, check the
  12418. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12419. Default value is @code{hd720}.
  12420. @item scale
  12421. Set display scale.
  12422. It accepts the following values:
  12423. @table @samp
  12424. @item log
  12425. logarithmic
  12426. @item sqrt
  12427. square root
  12428. @item cbrt
  12429. cubic root
  12430. @item lin
  12431. linear
  12432. @item rlog
  12433. reverse logarithmic
  12434. @end table
  12435. Default is @code{log}.
  12436. @item ascale
  12437. Set amplitude scale.
  12438. It accepts the following values:
  12439. @table @samp
  12440. @item log
  12441. logarithmic
  12442. @item lin
  12443. linear
  12444. @end table
  12445. Default is @code{log}.
  12446. @item acount
  12447. Set how much frames to accumulate in histogram.
  12448. Defauls is 1. Setting this to -1 accumulates all frames.
  12449. @item rheight
  12450. Set histogram ratio of window height.
  12451. @item slide
  12452. Set sonogram sliding.
  12453. It accepts the following values:
  12454. @table @samp
  12455. @item replace
  12456. replace old rows with new ones.
  12457. @item scroll
  12458. scroll from top to bottom.
  12459. @end table
  12460. Default is @code{replace}.
  12461. @end table
  12462. @section aphasemeter
  12463. Convert input audio to a video output, displaying the audio phase.
  12464. The filter accepts the following options:
  12465. @table @option
  12466. @item rate, r
  12467. Set the output frame rate. Default value is @code{25}.
  12468. @item size, s
  12469. Set the video size for the output. For the syntax of this option, check the
  12470. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12471. Default value is @code{800x400}.
  12472. @item rc
  12473. @item gc
  12474. @item bc
  12475. Specify the red, green, blue contrast. Default values are @code{2},
  12476. @code{7} and @code{1}.
  12477. Allowed range is @code{[0, 255]}.
  12478. @item mpc
  12479. Set color which will be used for drawing median phase. If color is
  12480. @code{none} which is default, no median phase value will be drawn.
  12481. @item video
  12482. Enable video output. Default is enabled.
  12483. @end table
  12484. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  12485. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  12486. The @code{-1} means left and right channels are completely out of phase and
  12487. @code{1} means channels are in phase.
  12488. @section avectorscope
  12489. Convert input audio to a video output, representing the audio vector
  12490. scope.
  12491. The filter is used to measure the difference between channels of stereo
  12492. audio stream. A monoaural signal, consisting of identical left and right
  12493. signal, results in straight vertical line. Any stereo separation is visible
  12494. as a deviation from this line, creating a Lissajous figure.
  12495. If the straight (or deviation from it) but horizontal line appears this
  12496. indicates that the left and right channels are out of phase.
  12497. The filter accepts the following options:
  12498. @table @option
  12499. @item mode, m
  12500. Set the vectorscope mode.
  12501. Available values are:
  12502. @table @samp
  12503. @item lissajous
  12504. Lissajous rotated by 45 degrees.
  12505. @item lissajous_xy
  12506. Same as above but not rotated.
  12507. @item polar
  12508. Shape resembling half of circle.
  12509. @end table
  12510. Default value is @samp{lissajous}.
  12511. @item size, s
  12512. Set the video size for the output. For the syntax of this option, check the
  12513. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12514. Default value is @code{400x400}.
  12515. @item rate, r
  12516. Set the output frame rate. Default value is @code{25}.
  12517. @item rc
  12518. @item gc
  12519. @item bc
  12520. @item ac
  12521. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  12522. @code{160}, @code{80} and @code{255}.
  12523. Allowed range is @code{[0, 255]}.
  12524. @item rf
  12525. @item gf
  12526. @item bf
  12527. @item af
  12528. Specify the red, green, blue and alpha fade. Default values are @code{15},
  12529. @code{10}, @code{5} and @code{5}.
  12530. Allowed range is @code{[0, 255]}.
  12531. @item zoom
  12532. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  12533. @item draw
  12534. Set the vectorscope drawing mode.
  12535. Available values are:
  12536. @table @samp
  12537. @item dot
  12538. Draw dot for each sample.
  12539. @item line
  12540. Draw line between previous and current sample.
  12541. @end table
  12542. Default value is @samp{dot}.
  12543. @item scale
  12544. Specify amplitude scale of audio samples.
  12545. Available values are:
  12546. @table @samp
  12547. @item lin
  12548. Linear.
  12549. @item sqrt
  12550. Square root.
  12551. @item cbrt
  12552. Cubic root.
  12553. @item log
  12554. Logarithmic.
  12555. @end table
  12556. @end table
  12557. @subsection Examples
  12558. @itemize
  12559. @item
  12560. Complete example using @command{ffplay}:
  12561. @example
  12562. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  12563. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  12564. @end example
  12565. @end itemize
  12566. @section bench, abench
  12567. Benchmark part of a filtergraph.
  12568. The filter accepts the following options:
  12569. @table @option
  12570. @item action
  12571. Start or stop a timer.
  12572. Available values are:
  12573. @table @samp
  12574. @item start
  12575. Get the current time, set it as frame metadata (using the key
  12576. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  12577. @item stop
  12578. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  12579. the input frame metadata to get the time difference. Time difference, average,
  12580. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  12581. @code{min}) are then printed. The timestamps are expressed in seconds.
  12582. @end table
  12583. @end table
  12584. @subsection Examples
  12585. @itemize
  12586. @item
  12587. Benchmark @ref{selectivecolor} filter:
  12588. @example
  12589. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  12590. @end example
  12591. @end itemize
  12592. @section concat
  12593. Concatenate audio and video streams, joining them together one after the
  12594. other.
  12595. The filter works on segments of synchronized video and audio streams. All
  12596. segments must have the same number of streams of each type, and that will
  12597. also be the number of streams at output.
  12598. The filter accepts the following options:
  12599. @table @option
  12600. @item n
  12601. Set the number of segments. Default is 2.
  12602. @item v
  12603. Set the number of output video streams, that is also the number of video
  12604. streams in each segment. Default is 1.
  12605. @item a
  12606. Set the number of output audio streams, that is also the number of audio
  12607. streams in each segment. Default is 0.
  12608. @item unsafe
  12609. Activate unsafe mode: do not fail if segments have a different format.
  12610. @end table
  12611. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  12612. @var{a} audio outputs.
  12613. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  12614. segment, in the same order as the outputs, then the inputs for the second
  12615. segment, etc.
  12616. Related streams do not always have exactly the same duration, for various
  12617. reasons including codec frame size or sloppy authoring. For that reason,
  12618. related synchronized streams (e.g. a video and its audio track) should be
  12619. concatenated at once. The concat filter will use the duration of the longest
  12620. stream in each segment (except the last one), and if necessary pad shorter
  12621. audio streams with silence.
  12622. For this filter to work correctly, all segments must start at timestamp 0.
  12623. All corresponding streams must have the same parameters in all segments; the
  12624. filtering system will automatically select a common pixel format for video
  12625. streams, and a common sample format, sample rate and channel layout for
  12626. audio streams, but other settings, such as resolution, must be converted
  12627. explicitly by the user.
  12628. Different frame rates are acceptable but will result in variable frame rate
  12629. at output; be sure to configure the output file to handle it.
  12630. @subsection Examples
  12631. @itemize
  12632. @item
  12633. Concatenate an opening, an episode and an ending, all in bilingual version
  12634. (video in stream 0, audio in streams 1 and 2):
  12635. @example
  12636. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  12637. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  12638. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  12639. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  12640. @end example
  12641. @item
  12642. Concatenate two parts, handling audio and video separately, using the
  12643. (a)movie sources, and adjusting the resolution:
  12644. @example
  12645. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  12646. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  12647. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  12648. @end example
  12649. Note that a desync will happen at the stitch if the audio and video streams
  12650. do not have exactly the same duration in the first file.
  12651. @end itemize
  12652. @section drawgraph, adrawgraph
  12653. Draw a graph using input video or audio metadata.
  12654. It accepts the following parameters:
  12655. @table @option
  12656. @item m1
  12657. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  12658. @item fg1
  12659. Set 1st foreground color expression.
  12660. @item m2
  12661. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  12662. @item fg2
  12663. Set 2nd foreground color expression.
  12664. @item m3
  12665. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  12666. @item fg3
  12667. Set 3rd foreground color expression.
  12668. @item m4
  12669. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  12670. @item fg4
  12671. Set 4th foreground color expression.
  12672. @item min
  12673. Set minimal value of metadata value.
  12674. @item max
  12675. Set maximal value of metadata value.
  12676. @item bg
  12677. Set graph background color. Default is white.
  12678. @item mode
  12679. Set graph mode.
  12680. Available values for mode is:
  12681. @table @samp
  12682. @item bar
  12683. @item dot
  12684. @item line
  12685. @end table
  12686. Default is @code{line}.
  12687. @item slide
  12688. Set slide mode.
  12689. Available values for slide is:
  12690. @table @samp
  12691. @item frame
  12692. Draw new frame when right border is reached.
  12693. @item replace
  12694. Replace old columns with new ones.
  12695. @item scroll
  12696. Scroll from right to left.
  12697. @item rscroll
  12698. Scroll from left to right.
  12699. @item picture
  12700. Draw single picture.
  12701. @end table
  12702. Default is @code{frame}.
  12703. @item size
  12704. Set size of graph video. For the syntax of this option, check the
  12705. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12706. The default value is @code{900x256}.
  12707. The foreground color expressions can use the following variables:
  12708. @table @option
  12709. @item MIN
  12710. Minimal value of metadata value.
  12711. @item MAX
  12712. Maximal value of metadata value.
  12713. @item VAL
  12714. Current metadata key value.
  12715. @end table
  12716. The color is defined as 0xAABBGGRR.
  12717. @end table
  12718. Example using metadata from @ref{signalstats} filter:
  12719. @example
  12720. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  12721. @end example
  12722. Example using metadata from @ref{ebur128} filter:
  12723. @example
  12724. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  12725. @end example
  12726. @anchor{ebur128}
  12727. @section ebur128
  12728. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  12729. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  12730. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  12731. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  12732. The filter also has a video output (see the @var{video} option) with a real
  12733. time graph to observe the loudness evolution. The graphic contains the logged
  12734. message mentioned above, so it is not printed anymore when this option is set,
  12735. unless the verbose logging is set. The main graphing area contains the
  12736. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  12737. the momentary loudness (400 milliseconds).
  12738. More information about the Loudness Recommendation EBU R128 on
  12739. @url{http://tech.ebu.ch/loudness}.
  12740. The filter accepts the following options:
  12741. @table @option
  12742. @item video
  12743. Activate the video output. The audio stream is passed unchanged whether this
  12744. option is set or no. The video stream will be the first output stream if
  12745. activated. Default is @code{0}.
  12746. @item size
  12747. Set the video size. This option is for video only. For the syntax of this
  12748. option, check the
  12749. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12750. Default and minimum resolution is @code{640x480}.
  12751. @item meter
  12752. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  12753. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  12754. other integer value between this range is allowed.
  12755. @item metadata
  12756. Set metadata injection. If set to @code{1}, the audio input will be segmented
  12757. into 100ms output frames, each of them containing various loudness information
  12758. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  12759. Default is @code{0}.
  12760. @item framelog
  12761. Force the frame logging level.
  12762. Available values are:
  12763. @table @samp
  12764. @item info
  12765. information logging level
  12766. @item verbose
  12767. verbose logging level
  12768. @end table
  12769. By default, the logging level is set to @var{info}. If the @option{video} or
  12770. the @option{metadata} options are set, it switches to @var{verbose}.
  12771. @item peak
  12772. Set peak mode(s).
  12773. Available modes can be cumulated (the option is a @code{flag} type). Possible
  12774. values are:
  12775. @table @samp
  12776. @item none
  12777. Disable any peak mode (default).
  12778. @item sample
  12779. Enable sample-peak mode.
  12780. Simple peak mode looking for the higher sample value. It logs a message
  12781. for sample-peak (identified by @code{SPK}).
  12782. @item true
  12783. Enable true-peak mode.
  12784. If enabled, the peak lookup is done on an over-sampled version of the input
  12785. stream for better peak accuracy. It logs a message for true-peak.
  12786. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  12787. This mode requires a build with @code{libswresample}.
  12788. @end table
  12789. @item dualmono
  12790. Treat mono input files as "dual mono". If a mono file is intended for playback
  12791. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  12792. If set to @code{true}, this option will compensate for this effect.
  12793. Multi-channel input files are not affected by this option.
  12794. @item panlaw
  12795. Set a specific pan law to be used for the measurement of dual mono files.
  12796. This parameter is optional, and has a default value of -3.01dB.
  12797. @end table
  12798. @subsection Examples
  12799. @itemize
  12800. @item
  12801. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  12802. @example
  12803. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  12804. @end example
  12805. @item
  12806. Run an analysis with @command{ffmpeg}:
  12807. @example
  12808. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  12809. @end example
  12810. @end itemize
  12811. @section interleave, ainterleave
  12812. Temporally interleave frames from several inputs.
  12813. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  12814. These filters read frames from several inputs and send the oldest
  12815. queued frame to the output.
  12816. Input streams must have well defined, monotonically increasing frame
  12817. timestamp values.
  12818. In order to submit one frame to output, these filters need to enqueue
  12819. at least one frame for each input, so they cannot work in case one
  12820. input is not yet terminated and will not receive incoming frames.
  12821. For example consider the case when one input is a @code{select} filter
  12822. which always drops input frames. The @code{interleave} filter will keep
  12823. reading from that input, but it will never be able to send new frames
  12824. to output until the input sends an end-of-stream signal.
  12825. Also, depending on inputs synchronization, the filters will drop
  12826. frames in case one input receives more frames than the other ones, and
  12827. the queue is already filled.
  12828. These filters accept the following options:
  12829. @table @option
  12830. @item nb_inputs, n
  12831. Set the number of different inputs, it is 2 by default.
  12832. @end table
  12833. @subsection Examples
  12834. @itemize
  12835. @item
  12836. Interleave frames belonging to different streams using @command{ffmpeg}:
  12837. @example
  12838. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  12839. @end example
  12840. @item
  12841. Add flickering blur effect:
  12842. @example
  12843. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  12844. @end example
  12845. @end itemize
  12846. @section metadata, ametadata
  12847. Manipulate frame metadata.
  12848. This filter accepts the following options:
  12849. @table @option
  12850. @item mode
  12851. Set mode of operation of the filter.
  12852. Can be one of the following:
  12853. @table @samp
  12854. @item select
  12855. If both @code{value} and @code{key} is set, select frames
  12856. which have such metadata. If only @code{key} is set, select
  12857. every frame that has such key in metadata.
  12858. @item add
  12859. Add new metadata @code{key} and @code{value}. If key is already available
  12860. do nothing.
  12861. @item modify
  12862. Modify value of already present key.
  12863. @item delete
  12864. If @code{value} is set, delete only keys that have such value.
  12865. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  12866. the frame.
  12867. @item print
  12868. Print key and its value if metadata was found. If @code{key} is not set print all
  12869. metadata values available in frame.
  12870. @end table
  12871. @item key
  12872. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  12873. @item value
  12874. Set metadata value which will be used. This option is mandatory for
  12875. @code{modify} and @code{add} mode.
  12876. @item function
  12877. Which function to use when comparing metadata value and @code{value}.
  12878. Can be one of following:
  12879. @table @samp
  12880. @item same_str
  12881. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  12882. @item starts_with
  12883. Values are interpreted as strings, returns true if metadata value starts with
  12884. the @code{value} option string.
  12885. @item less
  12886. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  12887. @item equal
  12888. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  12889. @item greater
  12890. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  12891. @item expr
  12892. Values are interpreted as floats, returns true if expression from option @code{expr}
  12893. evaluates to true.
  12894. @end table
  12895. @item expr
  12896. Set expression which is used when @code{function} is set to @code{expr}.
  12897. The expression is evaluated through the eval API and can contain the following
  12898. constants:
  12899. @table @option
  12900. @item VALUE1
  12901. Float representation of @code{value} from metadata key.
  12902. @item VALUE2
  12903. Float representation of @code{value} as supplied by user in @code{value} option.
  12904. @end table
  12905. @item file
  12906. If specified in @code{print} mode, output is written to the named file. Instead of
  12907. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  12908. for standard output. If @code{file} option is not set, output is written to the log
  12909. with AV_LOG_INFO loglevel.
  12910. @end table
  12911. @subsection Examples
  12912. @itemize
  12913. @item
  12914. Print all metadata values for frames with key @code{lavfi.singnalstats.YDIF} with values
  12915. between 0 and 1.
  12916. @example
  12917. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  12918. @end example
  12919. @item
  12920. Print silencedetect output to file @file{metadata.txt}.
  12921. @example
  12922. silencedetect,ametadata=mode=print:file=metadata.txt
  12923. @end example
  12924. @item
  12925. Direct all metadata to a pipe with file descriptor 4.
  12926. @example
  12927. metadata=mode=print:file='pipe\:4'
  12928. @end example
  12929. @end itemize
  12930. @section perms, aperms
  12931. Set read/write permissions for the output frames.
  12932. These filters are mainly aimed at developers to test direct path in the
  12933. following filter in the filtergraph.
  12934. The filters accept the following options:
  12935. @table @option
  12936. @item mode
  12937. Select the permissions mode.
  12938. It accepts the following values:
  12939. @table @samp
  12940. @item none
  12941. Do nothing. This is the default.
  12942. @item ro
  12943. Set all the output frames read-only.
  12944. @item rw
  12945. Set all the output frames directly writable.
  12946. @item toggle
  12947. Make the frame read-only if writable, and writable if read-only.
  12948. @item random
  12949. Set each output frame read-only or writable randomly.
  12950. @end table
  12951. @item seed
  12952. Set the seed for the @var{random} mode, must be an integer included between
  12953. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  12954. @code{-1}, the filter will try to use a good random seed on a best effort
  12955. basis.
  12956. @end table
  12957. Note: in case of auto-inserted filter between the permission filter and the
  12958. following one, the permission might not be received as expected in that
  12959. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  12960. perms/aperms filter can avoid this problem.
  12961. @section realtime, arealtime
  12962. Slow down filtering to match real time approximatively.
  12963. These filters will pause the filtering for a variable amount of time to
  12964. match the output rate with the input timestamps.
  12965. They are similar to the @option{re} option to @code{ffmpeg}.
  12966. They accept the following options:
  12967. @table @option
  12968. @item limit
  12969. Time limit for the pauses. Any pause longer than that will be considered
  12970. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  12971. @end table
  12972. @anchor{select}
  12973. @section select, aselect
  12974. Select frames to pass in output.
  12975. This filter accepts the following options:
  12976. @table @option
  12977. @item expr, e
  12978. Set expression, which is evaluated for each input frame.
  12979. If the expression is evaluated to zero, the frame is discarded.
  12980. If the evaluation result is negative or NaN, the frame is sent to the
  12981. first output; otherwise it is sent to the output with index
  12982. @code{ceil(val)-1}, assuming that the input index starts from 0.
  12983. For example a value of @code{1.2} corresponds to the output with index
  12984. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  12985. @item outputs, n
  12986. Set the number of outputs. The output to which to send the selected
  12987. frame is based on the result of the evaluation. Default value is 1.
  12988. @end table
  12989. The expression can contain the following constants:
  12990. @table @option
  12991. @item n
  12992. The (sequential) number of the filtered frame, starting from 0.
  12993. @item selected_n
  12994. The (sequential) number of the selected frame, starting from 0.
  12995. @item prev_selected_n
  12996. The sequential number of the last selected frame. It's NAN if undefined.
  12997. @item TB
  12998. The timebase of the input timestamps.
  12999. @item pts
  13000. The PTS (Presentation TimeStamp) of the filtered video frame,
  13001. expressed in @var{TB} units. It's NAN if undefined.
  13002. @item t
  13003. The PTS of the filtered video frame,
  13004. expressed in seconds. It's NAN if undefined.
  13005. @item prev_pts
  13006. The PTS of the previously filtered video frame. It's NAN if undefined.
  13007. @item prev_selected_pts
  13008. The PTS of the last previously filtered video frame. It's NAN if undefined.
  13009. @item prev_selected_t
  13010. The PTS of the last previously selected video frame. It's NAN if undefined.
  13011. @item start_pts
  13012. The PTS of the first video frame in the video. It's NAN if undefined.
  13013. @item start_t
  13014. The time of the first video frame in the video. It's NAN if undefined.
  13015. @item pict_type @emph{(video only)}
  13016. The type of the filtered frame. It can assume one of the following
  13017. values:
  13018. @table @option
  13019. @item I
  13020. @item P
  13021. @item B
  13022. @item S
  13023. @item SI
  13024. @item SP
  13025. @item BI
  13026. @end table
  13027. @item interlace_type @emph{(video only)}
  13028. The frame interlace type. It can assume one of the following values:
  13029. @table @option
  13030. @item PROGRESSIVE
  13031. The frame is progressive (not interlaced).
  13032. @item TOPFIRST
  13033. The frame is top-field-first.
  13034. @item BOTTOMFIRST
  13035. The frame is bottom-field-first.
  13036. @end table
  13037. @item consumed_sample_n @emph{(audio only)}
  13038. the number of selected samples before the current frame
  13039. @item samples_n @emph{(audio only)}
  13040. the number of samples in the current frame
  13041. @item sample_rate @emph{(audio only)}
  13042. the input sample rate
  13043. @item key
  13044. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  13045. @item pos
  13046. the position in the file of the filtered frame, -1 if the information
  13047. is not available (e.g. for synthetic video)
  13048. @item scene @emph{(video only)}
  13049. value between 0 and 1 to indicate a new scene; a low value reflects a low
  13050. probability for the current frame to introduce a new scene, while a higher
  13051. value means the current frame is more likely to be one (see the example below)
  13052. @item concatdec_select
  13053. The concat demuxer can select only part of a concat input file by setting an
  13054. inpoint and an outpoint, but the output packets may not be entirely contained
  13055. in the selected interval. By using this variable, it is possible to skip frames
  13056. generated by the concat demuxer which are not exactly contained in the selected
  13057. interval.
  13058. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  13059. and the @var{lavf.concat.duration} packet metadata values which are also
  13060. present in the decoded frames.
  13061. The @var{concatdec_select} variable is -1 if the frame pts is at least
  13062. start_time and either the duration metadata is missing or the frame pts is less
  13063. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  13064. missing.
  13065. That basically means that an input frame is selected if its pts is within the
  13066. interval set by the concat demuxer.
  13067. @end table
  13068. The default value of the select expression is "1".
  13069. @subsection Examples
  13070. @itemize
  13071. @item
  13072. Select all frames in input:
  13073. @example
  13074. select
  13075. @end example
  13076. The example above is the same as:
  13077. @example
  13078. select=1
  13079. @end example
  13080. @item
  13081. Skip all frames:
  13082. @example
  13083. select=0
  13084. @end example
  13085. @item
  13086. Select only I-frames:
  13087. @example
  13088. select='eq(pict_type\,I)'
  13089. @end example
  13090. @item
  13091. Select one frame every 100:
  13092. @example
  13093. select='not(mod(n\,100))'
  13094. @end example
  13095. @item
  13096. Select only frames contained in the 10-20 time interval:
  13097. @example
  13098. select=between(t\,10\,20)
  13099. @end example
  13100. @item
  13101. Select only I-frames contained in the 10-20 time interval:
  13102. @example
  13103. select=between(t\,10\,20)*eq(pict_type\,I)
  13104. @end example
  13105. @item
  13106. Select frames with a minimum distance of 10 seconds:
  13107. @example
  13108. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  13109. @end example
  13110. @item
  13111. Use aselect to select only audio frames with samples number > 100:
  13112. @example
  13113. aselect='gt(samples_n\,100)'
  13114. @end example
  13115. @item
  13116. Create a mosaic of the first scenes:
  13117. @example
  13118. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  13119. @end example
  13120. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  13121. choice.
  13122. @item
  13123. Send even and odd frames to separate outputs, and compose them:
  13124. @example
  13125. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  13126. @end example
  13127. @item
  13128. Select useful frames from an ffconcat file which is using inpoints and
  13129. outpoints but where the source files are not intra frame only.
  13130. @example
  13131. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  13132. @end example
  13133. @end itemize
  13134. @section sendcmd, asendcmd
  13135. Send commands to filters in the filtergraph.
  13136. These filters read commands to be sent to other filters in the
  13137. filtergraph.
  13138. @code{sendcmd} must be inserted between two video filters,
  13139. @code{asendcmd} must be inserted between two audio filters, but apart
  13140. from that they act the same way.
  13141. The specification of commands can be provided in the filter arguments
  13142. with the @var{commands} option, or in a file specified by the
  13143. @var{filename} option.
  13144. These filters accept the following options:
  13145. @table @option
  13146. @item commands, c
  13147. Set the commands to be read and sent to the other filters.
  13148. @item filename, f
  13149. Set the filename of the commands to be read and sent to the other
  13150. filters.
  13151. @end table
  13152. @subsection Commands syntax
  13153. A commands description consists of a sequence of interval
  13154. specifications, comprising a list of commands to be executed when a
  13155. particular event related to that interval occurs. The occurring event
  13156. is typically the current frame time entering or leaving a given time
  13157. interval.
  13158. An interval is specified by the following syntax:
  13159. @example
  13160. @var{START}[-@var{END}] @var{COMMANDS};
  13161. @end example
  13162. The time interval is specified by the @var{START} and @var{END} times.
  13163. @var{END} is optional and defaults to the maximum time.
  13164. The current frame time is considered within the specified interval if
  13165. it is included in the interval [@var{START}, @var{END}), that is when
  13166. the time is greater or equal to @var{START} and is lesser than
  13167. @var{END}.
  13168. @var{COMMANDS} consists of a sequence of one or more command
  13169. specifications, separated by ",", relating to that interval. The
  13170. syntax of a command specification is given by:
  13171. @example
  13172. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  13173. @end example
  13174. @var{FLAGS} is optional and specifies the type of events relating to
  13175. the time interval which enable sending the specified command, and must
  13176. be a non-null sequence of identifier flags separated by "+" or "|" and
  13177. enclosed between "[" and "]".
  13178. The following flags are recognized:
  13179. @table @option
  13180. @item enter
  13181. The command is sent when the current frame timestamp enters the
  13182. specified interval. In other words, the command is sent when the
  13183. previous frame timestamp was not in the given interval, and the
  13184. current is.
  13185. @item leave
  13186. The command is sent when the current frame timestamp leaves the
  13187. specified interval. In other words, the command is sent when the
  13188. previous frame timestamp was in the given interval, and the
  13189. current is not.
  13190. @end table
  13191. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  13192. assumed.
  13193. @var{TARGET} specifies the target of the command, usually the name of
  13194. the filter class or a specific filter instance name.
  13195. @var{COMMAND} specifies the name of the command for the target filter.
  13196. @var{ARG} is optional and specifies the optional list of argument for
  13197. the given @var{COMMAND}.
  13198. Between one interval specification and another, whitespaces, or
  13199. sequences of characters starting with @code{#} until the end of line,
  13200. are ignored and can be used to annotate comments.
  13201. A simplified BNF description of the commands specification syntax
  13202. follows:
  13203. @example
  13204. @var{COMMAND_FLAG} ::= "enter" | "leave"
  13205. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  13206. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  13207. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  13208. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  13209. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  13210. @end example
  13211. @subsection Examples
  13212. @itemize
  13213. @item
  13214. Specify audio tempo change at second 4:
  13215. @example
  13216. asendcmd=c='4.0 atempo tempo 1.5',atempo
  13217. @end example
  13218. @item
  13219. Target a specific filter instance:
  13220. @example
  13221. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  13222. @end example
  13223. @item
  13224. Specify a list of drawtext and hue commands in a file.
  13225. @example
  13226. # show text in the interval 5-10
  13227. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  13228. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  13229. # desaturate the image in the interval 15-20
  13230. 15.0-20.0 [enter] hue s 0,
  13231. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  13232. [leave] hue s 1,
  13233. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  13234. # apply an exponential saturation fade-out effect, starting from time 25
  13235. 25 [enter] hue s exp(25-t)
  13236. @end example
  13237. A filtergraph allowing to read and process the above command list
  13238. stored in a file @file{test.cmd}, can be specified with:
  13239. @example
  13240. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  13241. @end example
  13242. @end itemize
  13243. @anchor{setpts}
  13244. @section setpts, asetpts
  13245. Change the PTS (presentation timestamp) of the input frames.
  13246. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  13247. This filter accepts the following options:
  13248. @table @option
  13249. @item expr
  13250. The expression which is evaluated for each frame to construct its timestamp.
  13251. @end table
  13252. The expression is evaluated through the eval API and can contain the following
  13253. constants:
  13254. @table @option
  13255. @item FRAME_RATE
  13256. frame rate, only defined for constant frame-rate video
  13257. @item PTS
  13258. The presentation timestamp in input
  13259. @item N
  13260. The count of the input frame for video or the number of consumed samples,
  13261. not including the current frame for audio, starting from 0.
  13262. @item NB_CONSUMED_SAMPLES
  13263. The number of consumed samples, not including the current frame (only
  13264. audio)
  13265. @item NB_SAMPLES, S
  13266. The number of samples in the current frame (only audio)
  13267. @item SAMPLE_RATE, SR
  13268. The audio sample rate.
  13269. @item STARTPTS
  13270. The PTS of the first frame.
  13271. @item STARTT
  13272. the time in seconds of the first frame
  13273. @item INTERLACED
  13274. State whether the current frame is interlaced.
  13275. @item T
  13276. the time in seconds of the current frame
  13277. @item POS
  13278. original position in the file of the frame, or undefined if undefined
  13279. for the current frame
  13280. @item PREV_INPTS
  13281. The previous input PTS.
  13282. @item PREV_INT
  13283. previous input time in seconds
  13284. @item PREV_OUTPTS
  13285. The previous output PTS.
  13286. @item PREV_OUTT
  13287. previous output time in seconds
  13288. @item RTCTIME
  13289. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  13290. instead.
  13291. @item RTCSTART
  13292. The wallclock (RTC) time at the start of the movie in microseconds.
  13293. @item TB
  13294. The timebase of the input timestamps.
  13295. @end table
  13296. @subsection Examples
  13297. @itemize
  13298. @item
  13299. Start counting PTS from zero
  13300. @example
  13301. setpts=PTS-STARTPTS
  13302. @end example
  13303. @item
  13304. Apply fast motion effect:
  13305. @example
  13306. setpts=0.5*PTS
  13307. @end example
  13308. @item
  13309. Apply slow motion effect:
  13310. @example
  13311. setpts=2.0*PTS
  13312. @end example
  13313. @item
  13314. Set fixed rate of 25 frames per second:
  13315. @example
  13316. setpts=N/(25*TB)
  13317. @end example
  13318. @item
  13319. Set fixed rate 25 fps with some jitter:
  13320. @example
  13321. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  13322. @end example
  13323. @item
  13324. Apply an offset of 10 seconds to the input PTS:
  13325. @example
  13326. setpts=PTS+10/TB
  13327. @end example
  13328. @item
  13329. Generate timestamps from a "live source" and rebase onto the current timebase:
  13330. @example
  13331. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  13332. @end example
  13333. @item
  13334. Generate timestamps by counting samples:
  13335. @example
  13336. asetpts=N/SR/TB
  13337. @end example
  13338. @end itemize
  13339. @section settb, asettb
  13340. Set the timebase to use for the output frames timestamps.
  13341. It is mainly useful for testing timebase configuration.
  13342. It accepts the following parameters:
  13343. @table @option
  13344. @item expr, tb
  13345. The expression which is evaluated into the output timebase.
  13346. @end table
  13347. The value for @option{tb} is an arithmetic expression representing a
  13348. rational. The expression can contain the constants "AVTB" (the default
  13349. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  13350. audio only). Default value is "intb".
  13351. @subsection Examples
  13352. @itemize
  13353. @item
  13354. Set the timebase to 1/25:
  13355. @example
  13356. settb=expr=1/25
  13357. @end example
  13358. @item
  13359. Set the timebase to 1/10:
  13360. @example
  13361. settb=expr=0.1
  13362. @end example
  13363. @item
  13364. Set the timebase to 1001/1000:
  13365. @example
  13366. settb=1+0.001
  13367. @end example
  13368. @item
  13369. Set the timebase to 2*intb:
  13370. @example
  13371. settb=2*intb
  13372. @end example
  13373. @item
  13374. Set the default timebase value:
  13375. @example
  13376. settb=AVTB
  13377. @end example
  13378. @end itemize
  13379. @section showcqt
  13380. Convert input audio to a video output representing frequency spectrum
  13381. logarithmically using Brown-Puckette constant Q transform algorithm with
  13382. direct frequency domain coefficient calculation (but the transform itself
  13383. is not really constant Q, instead the Q factor is actually variable/clamped),
  13384. with musical tone scale, from E0 to D#10.
  13385. The filter accepts the following options:
  13386. @table @option
  13387. @item size, s
  13388. Specify the video size for the output. It must be even. For the syntax of this option,
  13389. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13390. Default value is @code{1920x1080}.
  13391. @item fps, rate, r
  13392. Set the output frame rate. Default value is @code{25}.
  13393. @item bar_h
  13394. Set the bargraph height. It must be even. Default value is @code{-1} which
  13395. computes the bargraph height automatically.
  13396. @item axis_h
  13397. Set the axis height. It must be even. Default value is @code{-1} which computes
  13398. the axis height automatically.
  13399. @item sono_h
  13400. Set the sonogram height. It must be even. Default value is @code{-1} which
  13401. computes the sonogram height automatically.
  13402. @item fullhd
  13403. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  13404. instead. Default value is @code{1}.
  13405. @item sono_v, volume
  13406. Specify the sonogram volume expression. It can contain variables:
  13407. @table @option
  13408. @item bar_v
  13409. the @var{bar_v} evaluated expression
  13410. @item frequency, freq, f
  13411. the frequency where it is evaluated
  13412. @item timeclamp, tc
  13413. the value of @var{timeclamp} option
  13414. @end table
  13415. and functions:
  13416. @table @option
  13417. @item a_weighting(f)
  13418. A-weighting of equal loudness
  13419. @item b_weighting(f)
  13420. B-weighting of equal loudness
  13421. @item c_weighting(f)
  13422. C-weighting of equal loudness.
  13423. @end table
  13424. Default value is @code{16}.
  13425. @item bar_v, volume2
  13426. Specify the bargraph volume expression. It can contain variables:
  13427. @table @option
  13428. @item sono_v
  13429. the @var{sono_v} evaluated expression
  13430. @item frequency, freq, f
  13431. the frequency where it is evaluated
  13432. @item timeclamp, tc
  13433. the value of @var{timeclamp} option
  13434. @end table
  13435. and functions:
  13436. @table @option
  13437. @item a_weighting(f)
  13438. A-weighting of equal loudness
  13439. @item b_weighting(f)
  13440. B-weighting of equal loudness
  13441. @item c_weighting(f)
  13442. C-weighting of equal loudness.
  13443. @end table
  13444. Default value is @code{sono_v}.
  13445. @item sono_g, gamma
  13446. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  13447. higher gamma makes the spectrum having more range. Default value is @code{3}.
  13448. Acceptable range is @code{[1, 7]}.
  13449. @item bar_g, gamma2
  13450. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  13451. @code{[1, 7]}.
  13452. @item bar_t
  13453. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  13454. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  13455. @item timeclamp, tc
  13456. Specify the transform timeclamp. At low frequency, there is trade-off between
  13457. accuracy in time domain and frequency domain. If timeclamp is lower,
  13458. event in time domain is represented more accurately (such as fast bass drum),
  13459. otherwise event in frequency domain is represented more accurately
  13460. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  13461. @item attack
  13462. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  13463. limits future samples by applying asymmetric windowing in time domain, useful
  13464. when low latency is required. Accepted range is @code{[0, 1]}.
  13465. @item basefreq
  13466. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  13467. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  13468. @item endfreq
  13469. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  13470. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  13471. @item coeffclamp
  13472. This option is deprecated and ignored.
  13473. @item tlength
  13474. Specify the transform length in time domain. Use this option to control accuracy
  13475. trade-off between time domain and frequency domain at every frequency sample.
  13476. It can contain variables:
  13477. @table @option
  13478. @item frequency, freq, f
  13479. the frequency where it is evaluated
  13480. @item timeclamp, tc
  13481. the value of @var{timeclamp} option.
  13482. @end table
  13483. Default value is @code{384*tc/(384+tc*f)}.
  13484. @item count
  13485. Specify the transform count for every video frame. Default value is @code{6}.
  13486. Acceptable range is @code{[1, 30]}.
  13487. @item fcount
  13488. Specify the transform count for every single pixel. Default value is @code{0},
  13489. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  13490. @item fontfile
  13491. Specify font file for use with freetype to draw the axis. If not specified,
  13492. use embedded font. Note that drawing with font file or embedded font is not
  13493. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  13494. option instead.
  13495. @item font
  13496. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  13497. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  13498. @item fontcolor
  13499. Specify font color expression. This is arithmetic expression that should return
  13500. integer value 0xRRGGBB. It can contain variables:
  13501. @table @option
  13502. @item frequency, freq, f
  13503. the frequency where it is evaluated
  13504. @item timeclamp, tc
  13505. the value of @var{timeclamp} option
  13506. @end table
  13507. and functions:
  13508. @table @option
  13509. @item midi(f)
  13510. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  13511. @item r(x), g(x), b(x)
  13512. red, green, and blue value of intensity x.
  13513. @end table
  13514. Default value is @code{st(0, (midi(f)-59.5)/12);
  13515. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  13516. r(1-ld(1)) + b(ld(1))}.
  13517. @item axisfile
  13518. Specify image file to draw the axis. This option override @var{fontfile} and
  13519. @var{fontcolor} option.
  13520. @item axis, text
  13521. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  13522. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  13523. Default value is @code{1}.
  13524. @item csp
  13525. Set colorspace. The accepted values are:
  13526. @table @samp
  13527. @item unspecified
  13528. Unspecified (default)
  13529. @item bt709
  13530. BT.709
  13531. @item fcc
  13532. FCC
  13533. @item bt470bg
  13534. BT.470BG or BT.601-6 625
  13535. @item smpte170m
  13536. SMPTE-170M or BT.601-6 525
  13537. @item smpte240m
  13538. SMPTE-240M
  13539. @item bt2020ncl
  13540. BT.2020 with non-constant luminance
  13541. @end table
  13542. @item cscheme
  13543. Set spectrogram color scheme. This is list of floating point values with format
  13544. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  13545. The default is @code{1|0.5|0|0|0.5|1}.
  13546. @end table
  13547. @subsection Examples
  13548. @itemize
  13549. @item
  13550. Playing audio while showing the spectrum:
  13551. @example
  13552. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  13553. @end example
  13554. @item
  13555. Same as above, but with frame rate 30 fps:
  13556. @example
  13557. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  13558. @end example
  13559. @item
  13560. Playing at 1280x720:
  13561. @example
  13562. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  13563. @end example
  13564. @item
  13565. Disable sonogram display:
  13566. @example
  13567. sono_h=0
  13568. @end example
  13569. @item
  13570. A1 and its harmonics: A1, A2, (near)E3, A3:
  13571. @example
  13572. 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),
  13573. asplit[a][out1]; [a] showcqt [out0]'
  13574. @end example
  13575. @item
  13576. Same as above, but with more accuracy in frequency domain:
  13577. @example
  13578. 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),
  13579. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  13580. @end example
  13581. @item
  13582. Custom volume:
  13583. @example
  13584. bar_v=10:sono_v=bar_v*a_weighting(f)
  13585. @end example
  13586. @item
  13587. Custom gamma, now spectrum is linear to the amplitude.
  13588. @example
  13589. bar_g=2:sono_g=2
  13590. @end example
  13591. @item
  13592. Custom tlength equation:
  13593. @example
  13594. 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)))'
  13595. @end example
  13596. @item
  13597. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  13598. @example
  13599. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  13600. @end example
  13601. @item
  13602. Custom font using fontconfig:
  13603. @example
  13604. font='Courier New,Monospace,mono|bold'
  13605. @end example
  13606. @item
  13607. Custom frequency range with custom axis using image file:
  13608. @example
  13609. axisfile=myaxis.png:basefreq=40:endfreq=10000
  13610. @end example
  13611. @end itemize
  13612. @section showfreqs
  13613. Convert input audio to video output representing the audio power spectrum.
  13614. Audio amplitude is on Y-axis while frequency is on X-axis.
  13615. The filter accepts the following options:
  13616. @table @option
  13617. @item size, s
  13618. Specify size of video. For the syntax of this option, check the
  13619. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13620. Default is @code{1024x512}.
  13621. @item mode
  13622. Set display mode.
  13623. This set how each frequency bin will be represented.
  13624. It accepts the following values:
  13625. @table @samp
  13626. @item line
  13627. @item bar
  13628. @item dot
  13629. @end table
  13630. Default is @code{bar}.
  13631. @item ascale
  13632. Set amplitude scale.
  13633. It accepts the following values:
  13634. @table @samp
  13635. @item lin
  13636. Linear scale.
  13637. @item sqrt
  13638. Square root scale.
  13639. @item cbrt
  13640. Cubic root scale.
  13641. @item log
  13642. Logarithmic scale.
  13643. @end table
  13644. Default is @code{log}.
  13645. @item fscale
  13646. Set frequency scale.
  13647. It accepts the following values:
  13648. @table @samp
  13649. @item lin
  13650. Linear scale.
  13651. @item log
  13652. Logarithmic scale.
  13653. @item rlog
  13654. Reverse logarithmic scale.
  13655. @end table
  13656. Default is @code{lin}.
  13657. @item win_size
  13658. Set window size.
  13659. It accepts the following values:
  13660. @table @samp
  13661. @item w16
  13662. @item w32
  13663. @item w64
  13664. @item w128
  13665. @item w256
  13666. @item w512
  13667. @item w1024
  13668. @item w2048
  13669. @item w4096
  13670. @item w8192
  13671. @item w16384
  13672. @item w32768
  13673. @item w65536
  13674. @end table
  13675. Default is @code{w2048}
  13676. @item win_func
  13677. Set windowing function.
  13678. It accepts the following values:
  13679. @table @samp
  13680. @item rect
  13681. @item bartlett
  13682. @item hanning
  13683. @item hamming
  13684. @item blackman
  13685. @item welch
  13686. @item flattop
  13687. @item bharris
  13688. @item bnuttall
  13689. @item bhann
  13690. @item sine
  13691. @item nuttall
  13692. @item lanczos
  13693. @item gauss
  13694. @item tukey
  13695. @item dolph
  13696. @item cauchy
  13697. @item parzen
  13698. @item poisson
  13699. @end table
  13700. Default is @code{hanning}.
  13701. @item overlap
  13702. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  13703. which means optimal overlap for selected window function will be picked.
  13704. @item averaging
  13705. Set time averaging. Setting this to 0 will display current maximal peaks.
  13706. Default is @code{1}, which means time averaging is disabled.
  13707. @item colors
  13708. Specify list of colors separated by space or by '|' which will be used to
  13709. draw channel frequencies. Unrecognized or missing colors will be replaced
  13710. by white color.
  13711. @item cmode
  13712. Set channel display mode.
  13713. It accepts the following values:
  13714. @table @samp
  13715. @item combined
  13716. @item separate
  13717. @end table
  13718. Default is @code{combined}.
  13719. @item minamp
  13720. Set minimum amplitude used in @code{log} amplitude scaler.
  13721. @end table
  13722. @anchor{showspectrum}
  13723. @section showspectrum
  13724. Convert input audio to a video output, representing the audio frequency
  13725. spectrum.
  13726. The filter accepts the following options:
  13727. @table @option
  13728. @item size, s
  13729. Specify the video size for the output. For the syntax of this option, check the
  13730. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13731. Default value is @code{640x512}.
  13732. @item slide
  13733. Specify how the spectrum should slide along the window.
  13734. It accepts the following values:
  13735. @table @samp
  13736. @item replace
  13737. the samples start again on the left when they reach the right
  13738. @item scroll
  13739. the samples scroll from right to left
  13740. @item fullframe
  13741. frames are only produced when the samples reach the right
  13742. @item rscroll
  13743. the samples scroll from left to right
  13744. @end table
  13745. Default value is @code{replace}.
  13746. @item mode
  13747. Specify display mode.
  13748. It accepts the following values:
  13749. @table @samp
  13750. @item combined
  13751. all channels are displayed in the same row
  13752. @item separate
  13753. all channels are displayed in separate rows
  13754. @end table
  13755. Default value is @samp{combined}.
  13756. @item color
  13757. Specify display color mode.
  13758. It accepts the following values:
  13759. @table @samp
  13760. @item channel
  13761. each channel is displayed in a separate color
  13762. @item intensity
  13763. each channel is displayed using the same color scheme
  13764. @item rainbow
  13765. each channel is displayed using the rainbow color scheme
  13766. @item moreland
  13767. each channel is displayed using the moreland color scheme
  13768. @item nebulae
  13769. each channel is displayed using the nebulae color scheme
  13770. @item fire
  13771. each channel is displayed using the fire color scheme
  13772. @item fiery
  13773. each channel is displayed using the fiery color scheme
  13774. @item fruit
  13775. each channel is displayed using the fruit color scheme
  13776. @item cool
  13777. each channel is displayed using the cool color scheme
  13778. @end table
  13779. Default value is @samp{channel}.
  13780. @item scale
  13781. Specify scale used for calculating intensity color values.
  13782. It accepts the following values:
  13783. @table @samp
  13784. @item lin
  13785. linear
  13786. @item sqrt
  13787. square root, default
  13788. @item cbrt
  13789. cubic root
  13790. @item log
  13791. logarithmic
  13792. @item 4thrt
  13793. 4th root
  13794. @item 5thrt
  13795. 5th root
  13796. @end table
  13797. Default value is @samp{sqrt}.
  13798. @item saturation
  13799. Set saturation modifier for displayed colors. Negative values provide
  13800. alternative color scheme. @code{0} is no saturation at all.
  13801. Saturation must be in [-10.0, 10.0] range.
  13802. Default value is @code{1}.
  13803. @item win_func
  13804. Set window function.
  13805. It accepts the following values:
  13806. @table @samp
  13807. @item rect
  13808. @item bartlett
  13809. @item hann
  13810. @item hanning
  13811. @item hamming
  13812. @item blackman
  13813. @item welch
  13814. @item flattop
  13815. @item bharris
  13816. @item bnuttall
  13817. @item bhann
  13818. @item sine
  13819. @item nuttall
  13820. @item lanczos
  13821. @item gauss
  13822. @item tukey
  13823. @item dolph
  13824. @item cauchy
  13825. @item parzen
  13826. @item poisson
  13827. @end table
  13828. Default value is @code{hann}.
  13829. @item orientation
  13830. Set orientation of time vs frequency axis. Can be @code{vertical} or
  13831. @code{horizontal}. Default is @code{vertical}.
  13832. @item overlap
  13833. Set ratio of overlap window. Default value is @code{0}.
  13834. When value is @code{1} overlap is set to recommended size for specific
  13835. window function currently used.
  13836. @item gain
  13837. Set scale gain for calculating intensity color values.
  13838. Default value is @code{1}.
  13839. @item data
  13840. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  13841. @item rotation
  13842. Set color rotation, must be in [-1.0, 1.0] range.
  13843. Default value is @code{0}.
  13844. @end table
  13845. The usage is very similar to the showwaves filter; see the examples in that
  13846. section.
  13847. @subsection Examples
  13848. @itemize
  13849. @item
  13850. Large window with logarithmic color scaling:
  13851. @example
  13852. showspectrum=s=1280x480:scale=log
  13853. @end example
  13854. @item
  13855. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  13856. @example
  13857. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  13858. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  13859. @end example
  13860. @end itemize
  13861. @section showspectrumpic
  13862. Convert input audio to a single video frame, representing the audio frequency
  13863. spectrum.
  13864. The filter accepts the following options:
  13865. @table @option
  13866. @item size, s
  13867. Specify the video size for the output. For the syntax of this option, check the
  13868. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13869. Default value is @code{4096x2048}.
  13870. @item mode
  13871. Specify display mode.
  13872. It accepts the following values:
  13873. @table @samp
  13874. @item combined
  13875. all channels are displayed in the same row
  13876. @item separate
  13877. all channels are displayed in separate rows
  13878. @end table
  13879. Default value is @samp{combined}.
  13880. @item color
  13881. Specify display color mode.
  13882. It accepts the following values:
  13883. @table @samp
  13884. @item channel
  13885. each channel is displayed in a separate color
  13886. @item intensity
  13887. each channel is displayed using the same color scheme
  13888. @item rainbow
  13889. each channel is displayed using the rainbow color scheme
  13890. @item moreland
  13891. each channel is displayed using the moreland color scheme
  13892. @item nebulae
  13893. each channel is displayed using the nebulae color scheme
  13894. @item fire
  13895. each channel is displayed using the fire color scheme
  13896. @item fiery
  13897. each channel is displayed using the fiery color scheme
  13898. @item fruit
  13899. each channel is displayed using the fruit color scheme
  13900. @item cool
  13901. each channel is displayed using the cool color scheme
  13902. @end table
  13903. Default value is @samp{intensity}.
  13904. @item scale
  13905. Specify scale used for calculating intensity color values.
  13906. It accepts the following values:
  13907. @table @samp
  13908. @item lin
  13909. linear
  13910. @item sqrt
  13911. square root, default
  13912. @item cbrt
  13913. cubic root
  13914. @item log
  13915. logarithmic
  13916. @item 4thrt
  13917. 4th root
  13918. @item 5thrt
  13919. 5th root
  13920. @end table
  13921. Default value is @samp{log}.
  13922. @item saturation
  13923. Set saturation modifier for displayed colors. Negative values provide
  13924. alternative color scheme. @code{0} is no saturation at all.
  13925. Saturation must be in [-10.0, 10.0] range.
  13926. Default value is @code{1}.
  13927. @item win_func
  13928. Set window function.
  13929. It accepts the following values:
  13930. @table @samp
  13931. @item rect
  13932. @item bartlett
  13933. @item hann
  13934. @item hanning
  13935. @item hamming
  13936. @item blackman
  13937. @item welch
  13938. @item flattop
  13939. @item bharris
  13940. @item bnuttall
  13941. @item bhann
  13942. @item sine
  13943. @item nuttall
  13944. @item lanczos
  13945. @item gauss
  13946. @item tukey
  13947. @item dolph
  13948. @item cauchy
  13949. @item parzen
  13950. @item poisson
  13951. @end table
  13952. Default value is @code{hann}.
  13953. @item orientation
  13954. Set orientation of time vs frequency axis. Can be @code{vertical} or
  13955. @code{horizontal}. Default is @code{vertical}.
  13956. @item gain
  13957. Set scale gain for calculating intensity color values.
  13958. Default value is @code{1}.
  13959. @item legend
  13960. Draw time and frequency axes and legends. Default is enabled.
  13961. @item rotation
  13962. Set color rotation, must be in [-1.0, 1.0] range.
  13963. Default value is @code{0}.
  13964. @end table
  13965. @subsection Examples
  13966. @itemize
  13967. @item
  13968. Extract an audio spectrogram of a whole audio track
  13969. in a 1024x1024 picture using @command{ffmpeg}:
  13970. @example
  13971. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  13972. @end example
  13973. @end itemize
  13974. @section showvolume
  13975. Convert input audio volume to a video output.
  13976. The filter accepts the following options:
  13977. @table @option
  13978. @item rate, r
  13979. Set video rate.
  13980. @item b
  13981. Set border width, allowed range is [0, 5]. Default is 1.
  13982. @item w
  13983. Set channel width, allowed range is [80, 8192]. Default is 400.
  13984. @item h
  13985. Set channel height, allowed range is [1, 900]. Default is 20.
  13986. @item f
  13987. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  13988. @item c
  13989. Set volume color expression.
  13990. The expression can use the following variables:
  13991. @table @option
  13992. @item VOLUME
  13993. Current max volume of channel in dB.
  13994. @item PEAK
  13995. Current peak.
  13996. @item CHANNEL
  13997. Current channel number, starting from 0.
  13998. @end table
  13999. @item t
  14000. If set, displays channel names. Default is enabled.
  14001. @item v
  14002. If set, displays volume values. Default is enabled.
  14003. @item o
  14004. Set orientation, can be @code{horizontal} or @code{vertical},
  14005. default is @code{horizontal}.
  14006. @item s
  14007. Set step size, allowed range s [0, 5]. Default is 0, which means
  14008. step is disabled.
  14009. @end table
  14010. @section showwaves
  14011. Convert input audio to a video output, representing the samples waves.
  14012. The filter accepts the following options:
  14013. @table @option
  14014. @item size, s
  14015. Specify the video size for the output. For the syntax of this option, check the
  14016. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14017. Default value is @code{600x240}.
  14018. @item mode
  14019. Set display mode.
  14020. Available values are:
  14021. @table @samp
  14022. @item point
  14023. Draw a point for each sample.
  14024. @item line
  14025. Draw a vertical line for each sample.
  14026. @item p2p
  14027. Draw a point for each sample and a line between them.
  14028. @item cline
  14029. Draw a centered vertical line for each sample.
  14030. @end table
  14031. Default value is @code{point}.
  14032. @item n
  14033. Set the number of samples which are printed on the same column. A
  14034. larger value will decrease the frame rate. Must be a positive
  14035. integer. This option can be set only if the value for @var{rate}
  14036. is not explicitly specified.
  14037. @item rate, r
  14038. Set the (approximate) output frame rate. This is done by setting the
  14039. option @var{n}. Default value is "25".
  14040. @item split_channels
  14041. Set if channels should be drawn separately or overlap. Default value is 0.
  14042. @item colors
  14043. Set colors separated by '|' which are going to be used for drawing of each channel.
  14044. @item scale
  14045. Set amplitude scale.
  14046. Available values are:
  14047. @table @samp
  14048. @item lin
  14049. Linear.
  14050. @item log
  14051. Logarithmic.
  14052. @item sqrt
  14053. Square root.
  14054. @item cbrt
  14055. Cubic root.
  14056. @end table
  14057. Default is linear.
  14058. @end table
  14059. @subsection Examples
  14060. @itemize
  14061. @item
  14062. Output the input file audio and the corresponding video representation
  14063. at the same time:
  14064. @example
  14065. amovie=a.mp3,asplit[out0],showwaves[out1]
  14066. @end example
  14067. @item
  14068. Create a synthetic signal and show it with showwaves, forcing a
  14069. frame rate of 30 frames per second:
  14070. @example
  14071. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  14072. @end example
  14073. @end itemize
  14074. @section showwavespic
  14075. Convert input audio to a single video frame, representing the samples waves.
  14076. The filter accepts the following options:
  14077. @table @option
  14078. @item size, s
  14079. Specify the video size for the output. For the syntax of this option, check the
  14080. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14081. Default value is @code{600x240}.
  14082. @item split_channels
  14083. Set if channels should be drawn separately or overlap. Default value is 0.
  14084. @item colors
  14085. Set colors separated by '|' which are going to be used for drawing of each channel.
  14086. @item scale
  14087. Set amplitude scale.
  14088. Available values are:
  14089. @table @samp
  14090. @item lin
  14091. Linear.
  14092. @item log
  14093. Logarithmic.
  14094. @item sqrt
  14095. Square root.
  14096. @item cbrt
  14097. Cubic root.
  14098. @end table
  14099. Default is linear.
  14100. @end table
  14101. @subsection Examples
  14102. @itemize
  14103. @item
  14104. Extract a channel split representation of the wave form of a whole audio track
  14105. in a 1024x800 picture using @command{ffmpeg}:
  14106. @example
  14107. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  14108. @end example
  14109. @end itemize
  14110. @section sidedata, asidedata
  14111. Delete frame side data, or select frames based on it.
  14112. This filter accepts the following options:
  14113. @table @option
  14114. @item mode
  14115. Set mode of operation of the filter.
  14116. Can be one of the following:
  14117. @table @samp
  14118. @item select
  14119. Select every frame with side data of @code{type}.
  14120. @item delete
  14121. Delete side data of @code{type}. If @code{type} is not set, delete all side
  14122. data in the frame.
  14123. @end table
  14124. @item type
  14125. Set side data type used with all modes. Must be set for @code{select} mode. For
  14126. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  14127. in @file{libavutil/frame.h}. For example, to choose
  14128. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  14129. @end table
  14130. @section spectrumsynth
  14131. Sythesize audio from 2 input video spectrums, first input stream represents
  14132. magnitude across time and second represents phase across time.
  14133. The filter will transform from frequency domain as displayed in videos back
  14134. to time domain as presented in audio output.
  14135. This filter is primarily created for reversing processed @ref{showspectrum}
  14136. filter outputs, but can synthesize sound from other spectrograms too.
  14137. But in such case results are going to be poor if the phase data is not
  14138. available, because in such cases phase data need to be recreated, usually
  14139. its just recreated from random noise.
  14140. For best results use gray only output (@code{channel} color mode in
  14141. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  14142. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  14143. @code{data} option. Inputs videos should generally use @code{fullframe}
  14144. slide mode as that saves resources needed for decoding video.
  14145. The filter accepts the following options:
  14146. @table @option
  14147. @item sample_rate
  14148. Specify sample rate of output audio, the sample rate of audio from which
  14149. spectrum was generated may differ.
  14150. @item channels
  14151. Set number of channels represented in input video spectrums.
  14152. @item scale
  14153. Set scale which was used when generating magnitude input spectrum.
  14154. Can be @code{lin} or @code{log}. Default is @code{log}.
  14155. @item slide
  14156. Set slide which was used when generating inputs spectrums.
  14157. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  14158. Default is @code{fullframe}.
  14159. @item win_func
  14160. Set window function used for resynthesis.
  14161. @item overlap
  14162. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14163. which means optimal overlap for selected window function will be picked.
  14164. @item orientation
  14165. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  14166. Default is @code{vertical}.
  14167. @end table
  14168. @subsection Examples
  14169. @itemize
  14170. @item
  14171. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  14172. then resynthesize videos back to audio with spectrumsynth:
  14173. @example
  14174. 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
  14175. 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
  14176. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  14177. @end example
  14178. @end itemize
  14179. @section split, asplit
  14180. Split input into several identical outputs.
  14181. @code{asplit} works with audio input, @code{split} with video.
  14182. The filter accepts a single parameter which specifies the number of outputs. If
  14183. unspecified, it defaults to 2.
  14184. @subsection Examples
  14185. @itemize
  14186. @item
  14187. Create two separate outputs from the same input:
  14188. @example
  14189. [in] split [out0][out1]
  14190. @end example
  14191. @item
  14192. To create 3 or more outputs, you need to specify the number of
  14193. outputs, like in:
  14194. @example
  14195. [in] asplit=3 [out0][out1][out2]
  14196. @end example
  14197. @item
  14198. Create two separate outputs from the same input, one cropped and
  14199. one padded:
  14200. @example
  14201. [in] split [splitout1][splitout2];
  14202. [splitout1] crop=100:100:0:0 [cropout];
  14203. [splitout2] pad=200:200:100:100 [padout];
  14204. @end example
  14205. @item
  14206. Create 5 copies of the input audio with @command{ffmpeg}:
  14207. @example
  14208. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  14209. @end example
  14210. @end itemize
  14211. @section zmq, azmq
  14212. Receive commands sent through a libzmq client, and forward them to
  14213. filters in the filtergraph.
  14214. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  14215. must be inserted between two video filters, @code{azmq} between two
  14216. audio filters.
  14217. To enable these filters you need to install the libzmq library and
  14218. headers and configure FFmpeg with @code{--enable-libzmq}.
  14219. For more information about libzmq see:
  14220. @url{http://www.zeromq.org/}
  14221. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  14222. receives messages sent through a network interface defined by the
  14223. @option{bind_address} option.
  14224. The received message must be in the form:
  14225. @example
  14226. @var{TARGET} @var{COMMAND} [@var{ARG}]
  14227. @end example
  14228. @var{TARGET} specifies the target of the command, usually the name of
  14229. the filter class or a specific filter instance name.
  14230. @var{COMMAND} specifies the name of the command for the target filter.
  14231. @var{ARG} is optional and specifies the optional argument list for the
  14232. given @var{COMMAND}.
  14233. Upon reception, the message is processed and the corresponding command
  14234. is injected into the filtergraph. Depending on the result, the filter
  14235. will send a reply to the client, adopting the format:
  14236. @example
  14237. @var{ERROR_CODE} @var{ERROR_REASON}
  14238. @var{MESSAGE}
  14239. @end example
  14240. @var{MESSAGE} is optional.
  14241. @subsection Examples
  14242. Look at @file{tools/zmqsend} for an example of a zmq client which can
  14243. be used to send commands processed by these filters.
  14244. Consider the following filtergraph generated by @command{ffplay}
  14245. @example
  14246. ffplay -dumpgraph 1 -f lavfi "
  14247. color=s=100x100:c=red [l];
  14248. color=s=100x100:c=blue [r];
  14249. nullsrc=s=200x100, zmq [bg];
  14250. [bg][l] overlay [bg+l];
  14251. [bg+l][r] overlay=x=100 "
  14252. @end example
  14253. To change the color of the left side of the video, the following
  14254. command can be used:
  14255. @example
  14256. echo Parsed_color_0 c yellow | tools/zmqsend
  14257. @end example
  14258. To change the right side:
  14259. @example
  14260. echo Parsed_color_1 c pink | tools/zmqsend
  14261. @end example
  14262. @c man end MULTIMEDIA FILTERS
  14263. @chapter Multimedia Sources
  14264. @c man begin MULTIMEDIA SOURCES
  14265. Below is a description of the currently available multimedia sources.
  14266. @section amovie
  14267. This is the same as @ref{movie} source, except it selects an audio
  14268. stream by default.
  14269. @anchor{movie}
  14270. @section movie
  14271. Read audio and/or video stream(s) from a movie container.
  14272. It accepts the following parameters:
  14273. @table @option
  14274. @item filename
  14275. The name of the resource to read (not necessarily a file; it can also be a
  14276. device or a stream accessed through some protocol).
  14277. @item format_name, f
  14278. Specifies the format assumed for the movie to read, and can be either
  14279. the name of a container or an input device. If not specified, the
  14280. format is guessed from @var{movie_name} or by probing.
  14281. @item seek_point, sp
  14282. Specifies the seek point in seconds. The frames will be output
  14283. starting from this seek point. The parameter is evaluated with
  14284. @code{av_strtod}, so the numerical value may be suffixed by an IS
  14285. postfix. The default value is "0".
  14286. @item streams, s
  14287. Specifies the streams to read. Several streams can be specified,
  14288. separated by "+". The source will then have as many outputs, in the
  14289. same order. The syntax is explained in the ``Stream specifiers''
  14290. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  14291. respectively the default (best suited) video and audio stream. Default
  14292. is "dv", or "da" if the filter is called as "amovie".
  14293. @item stream_index, si
  14294. Specifies the index of the video stream to read. If the value is -1,
  14295. the most suitable video stream will be automatically selected. The default
  14296. value is "-1". Deprecated. If the filter is called "amovie", it will select
  14297. audio instead of video.
  14298. @item loop
  14299. Specifies how many times to read the stream in sequence.
  14300. If the value is 0, the stream will be looped infinitely.
  14301. Default value is "1".
  14302. Note that when the movie is looped the source timestamps are not
  14303. changed, so it will generate non monotonically increasing timestamps.
  14304. @item discontinuity
  14305. Specifies the time difference between frames above which the point is
  14306. considered a timestamp discontinuity which is removed by adjusting the later
  14307. timestamps.
  14308. @end table
  14309. It allows overlaying a second video on top of the main input of
  14310. a filtergraph, as shown in this graph:
  14311. @example
  14312. input -----------> deltapts0 --> overlay --> output
  14313. ^
  14314. |
  14315. movie --> scale--> deltapts1 -------+
  14316. @end example
  14317. @subsection Examples
  14318. @itemize
  14319. @item
  14320. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  14321. on top of the input labelled "in":
  14322. @example
  14323. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  14324. [in] setpts=PTS-STARTPTS [main];
  14325. [main][over] overlay=16:16 [out]
  14326. @end example
  14327. @item
  14328. Read from a video4linux2 device, and overlay it on top of the input
  14329. labelled "in":
  14330. @example
  14331. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  14332. [in] setpts=PTS-STARTPTS [main];
  14333. [main][over] overlay=16:16 [out]
  14334. @end example
  14335. @item
  14336. Read the first video stream and the audio stream with id 0x81 from
  14337. dvd.vob; the video is connected to the pad named "video" and the audio is
  14338. connected to the pad named "audio":
  14339. @example
  14340. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  14341. @end example
  14342. @end itemize
  14343. @subsection Commands
  14344. Both movie and amovie support the following commands:
  14345. @table @option
  14346. @item seek
  14347. Perform seek using "av_seek_frame".
  14348. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  14349. @itemize
  14350. @item
  14351. @var{stream_index}: If stream_index is -1, a default
  14352. stream is selected, and @var{timestamp} is automatically converted
  14353. from AV_TIME_BASE units to the stream specific time_base.
  14354. @item
  14355. @var{timestamp}: Timestamp in AVStream.time_base units
  14356. or, if no stream is specified, in AV_TIME_BASE units.
  14357. @item
  14358. @var{flags}: Flags which select direction and seeking mode.
  14359. @end itemize
  14360. @item get_duration
  14361. Get movie duration in AV_TIME_BASE units.
  14362. @end table
  14363. @c man end MULTIMEDIA SOURCES