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.

17399 lines
465KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program.
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  173. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  174. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  175. @var{FILTER} ::= [@var{LINKLABELS}] @var{NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  176. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  177. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  178. @end example
  179. @section Notes on filtergraph escaping
  180. Filtergraph description composition entails several levels of
  181. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  182. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  183. information about the employed escaping procedure.
  184. A first level escaping affects the content of each filter option
  185. value, which may contain the special character @code{:} used to
  186. separate values, or one of the escaping characters @code{\'}.
  187. A second level escaping affects the whole filter description, which
  188. may contain the escaping characters @code{\'} or the special
  189. characters @code{[],;} used by the filtergraph description.
  190. Finally, when you specify a filtergraph on a shell commandline, you
  191. need to perform a third level escaping for the shell special
  192. characters contained within it.
  193. For example, consider the following string to be embedded in
  194. the @ref{drawtext} filter description @option{text} value:
  195. @example
  196. this is a 'string': may contain one, or more, special characters
  197. @end example
  198. This string contains the @code{'} special escaping character, and the
  199. @code{:} special character, so it needs to be escaped in this way:
  200. @example
  201. text=this is a \'string\'\: may contain one, or more, special characters
  202. @end example
  203. A second level of escaping is required when embedding the filter
  204. description in a filtergraph description, in order to escape all the
  205. filtergraph special characters. Thus the example above becomes:
  206. @example
  207. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  208. @end example
  209. (note that in addition to the @code{\'} escaping special characters,
  210. also @code{,} needs to be escaped).
  211. Finally an additional level of escaping is needed when writing the
  212. filtergraph description in a shell command, which depends on the
  213. escaping rules of the adopted shell. For example, assuming that
  214. @code{\} is special and needs to be escaped with another @code{\}, the
  215. previous string will finally result in:
  216. @example
  217. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  218. @end example
  219. @chapter Timeline editing
  220. Some filters support a generic @option{enable} option. For the filters
  221. supporting timeline editing, this option can be set to an expression which is
  222. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  223. the filter will be enabled, otherwise the frame will be sent unchanged to the
  224. next filter in the filtergraph.
  225. The expression accepts the following values:
  226. @table @samp
  227. @item t
  228. timestamp expressed in seconds, NAN if the input timestamp is unknown
  229. @item n
  230. sequential number of the input frame, starting from 0
  231. @item pos
  232. the position in the file of the input frame, NAN if unknown
  233. @item w
  234. @item h
  235. width and height of the input frame if video
  236. @end table
  237. Additionally, these filters support an @option{enable} command that can be used
  238. to re-define the expression.
  239. Like any other filtering option, the @option{enable} option follows the same
  240. rules.
  241. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  242. minutes, and a @ref{curves} filter starting at 3 seconds:
  243. @example
  244. smartblur = enable='between(t,10,3*60)',
  245. curves = enable='gte(t,3)' : preset=cross_process
  246. @end example
  247. @c man end FILTERGRAPH DESCRIPTION
  248. @chapter Audio Filters
  249. @c man begin AUDIO FILTERS
  250. When you configure your FFmpeg build, you can disable any of the
  251. existing filters using @code{--disable-filters}.
  252. The configure output will show the audio filters included in your
  253. build.
  254. Below is a description of the currently available audio filters.
  255. @section acompressor
  256. A compressor is mainly used to reduce the dynamic range of a signal.
  257. Especially modern music is mostly compressed at a high ratio to
  258. improve the overall loudness. It's done to get the highest attention
  259. of a listener, "fatten" the sound and bring more "power" to the track.
  260. If a signal is compressed too much it may sound dull or "dead"
  261. afterwards or it may start to "pump" (which could be a powerful effect
  262. but can also destroy a track completely).
  263. The right compression is the key to reach a professional sound and is
  264. the high art of mixing and mastering. Because of its complex settings
  265. it may take a long time to get the right feeling for this kind of effect.
  266. Compression is done by detecting the volume above a chosen level
  267. @code{threshold} and dividing it by the factor set with @code{ratio}.
  268. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  269. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  270. the signal would cause distortion of the waveform the reduction can be
  271. levelled over the time. This is done by setting "Attack" and "Release".
  272. @code{attack} determines how long the signal has to rise above the threshold
  273. before any reduction will occur and @code{release} sets the time the signal
  274. has to fall below the threshold to reduce the reduction again. Shorter signals
  275. than the chosen attack time will be left untouched.
  276. The overall reduction of the signal can be made up afterwards with the
  277. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  278. raising the makeup to this level results in a signal twice as loud than the
  279. source. To gain a softer entry in the compression the @code{knee} flattens the
  280. hard edge at the threshold in the range of the chosen decibels.
  281. The filter accepts the following options:
  282. @table @option
  283. @item level_in
  284. Set input gain. Default is 1. Range is between 0.015625 and 64.
  285. @item threshold
  286. If a signal of second stream rises above this level it will affect the gain
  287. reduction of the first stream.
  288. By default it is 0.125. Range is between 0.00097563 and 1.
  289. @item ratio
  290. Set a ratio by which the signal is reduced. 1:2 means that if the level
  291. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  292. Default is 2. Range is between 1 and 20.
  293. @item attack
  294. Amount of milliseconds the signal has to rise above the threshold before gain
  295. reduction starts. Default is 20. Range is between 0.01 and 2000.
  296. @item release
  297. Amount of milliseconds the signal has to fall below the threshold before
  298. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  299. @item makeup
  300. Set the amount by how much signal will be amplified after processing.
  301. Default is 2. Range is from 1 and 64.
  302. @item knee
  303. Curve the sharp knee around the threshold to enter gain reduction more softly.
  304. Default is 2.82843. Range is between 1 and 8.
  305. @item link
  306. Choose if the @code{average} level between all channels of input stream
  307. or the louder(@code{maximum}) channel of input stream affects the
  308. reduction. Default is @code{average}.
  309. @item detection
  310. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  311. of @code{rms}. Default is @code{rms} which is mostly smoother.
  312. @item mix
  313. How much to use compressed signal in output. Default is 1.
  314. Range is between 0 and 1.
  315. @end table
  316. @section acrossfade
  317. Apply cross fade from one input audio stream to another input audio stream.
  318. The cross fade is applied for specified duration near the end of first stream.
  319. The filter accepts the following options:
  320. @table @option
  321. @item nb_samples, ns
  322. Specify the number of samples for which the cross fade effect has to last.
  323. At the end of the cross fade effect the first input audio will be completely
  324. silent. Default is 44100.
  325. @item duration, d
  326. Specify the duration of the cross fade effect. See
  327. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  328. for the accepted syntax.
  329. By default the duration is determined by @var{nb_samples}.
  330. If set this option is used instead of @var{nb_samples}.
  331. @item overlap, o
  332. Should first stream end overlap with second stream start. Default is enabled.
  333. @item curve1
  334. Set curve for cross fade transition for first stream.
  335. @item curve2
  336. Set curve for cross fade transition for second stream.
  337. For description of available curve types see @ref{afade} filter description.
  338. @end table
  339. @subsection Examples
  340. @itemize
  341. @item
  342. Cross fade from one input to another:
  343. @example
  344. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  345. @end example
  346. @item
  347. Cross fade from one input to another but without overlapping:
  348. @example
  349. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  350. @end example
  351. @end itemize
  352. @section acrusher
  353. Reduce audio bit resolution.
  354. This filter is bit crusher with enhanced functionality. A bit crusher
  355. is used to audibly reduce number of bits an audio signal is sampled
  356. with. This doesn't change the bit depth at all, it just produces the
  357. effect. Material reduced in bit depth sounds more harsh and "digital".
  358. This filter is able to even round to continous values instead of discrete
  359. bit depths.
  360. Additionally it has a D/C offset which results in different crushing of
  361. the lower and the upper half of the signal.
  362. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  363. Another feature of this filter is the logarithmic mode.
  364. This setting switches from linear distances between bits to logarithmic ones.
  365. The result is a much more "natural" sounding crusher which doesn't gate low
  366. signals for example. The human ear has a logarithmic perception, too
  367. so this kind of crushing is much more pleasant.
  368. Logarithmic crushing is also able to get anti-aliased.
  369. The filter accepts the following options:
  370. @table @option
  371. @item level_in
  372. Set level in.
  373. @item level_out
  374. Set level out.
  375. @item bits
  376. Set bit reduction.
  377. @item mix
  378. Set mixing ammount.
  379. @item mode
  380. Can be linear: @code{lin} or logarithmic: @code{log}.
  381. @item dc
  382. Set DC.
  383. @item aa
  384. Set anti-aliasing.
  385. @item samples
  386. Set sample reduction.
  387. @item lfo
  388. Enable LFO. By default disabled.
  389. @item lforange
  390. Set LFO range.
  391. @item lforate
  392. Set LFO rate.
  393. @end table
  394. @section adelay
  395. Delay one or more audio channels.
  396. Samples in delayed channel are filled with silence.
  397. The filter accepts the following option:
  398. @table @option
  399. @item delays
  400. Set list of delays in milliseconds for each channel separated by '|'.
  401. At least one delay greater than 0 should be provided.
  402. Unused delays will be silently ignored. If number of given delays is
  403. smaller than number of channels all remaining channels will not be delayed.
  404. If you want to delay exact number of samples, append 'S' to number.
  405. @end table
  406. @subsection Examples
  407. @itemize
  408. @item
  409. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  410. the second channel (and any other channels that may be present) unchanged.
  411. @example
  412. adelay=1500|0|500
  413. @end example
  414. @item
  415. Delay second channel by 500 samples, the third channel by 700 samples and leave
  416. the first channel (and any other channels that may be present) unchanged.
  417. @example
  418. adelay=0|500S|700S
  419. @end example
  420. @end itemize
  421. @section aecho
  422. Apply echoing to the input audio.
  423. Echoes are reflected sound and can occur naturally amongst mountains
  424. (and sometimes large buildings) when talking or shouting; digital echo
  425. effects emulate this behaviour and are often used to help fill out the
  426. sound of a single instrument or vocal. The time difference between the
  427. original signal and the reflection is the @code{delay}, and the
  428. loudness of the reflected signal is the @code{decay}.
  429. Multiple echoes can have different delays and decays.
  430. A description of the accepted parameters follows.
  431. @table @option
  432. @item in_gain
  433. Set input gain of reflected signal. Default is @code{0.6}.
  434. @item out_gain
  435. Set output gain of reflected signal. Default is @code{0.3}.
  436. @item delays
  437. Set list of time intervals in milliseconds between original signal and reflections
  438. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  439. Default is @code{1000}.
  440. @item decays
  441. Set list of loudnesses of reflected signals separated by '|'.
  442. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  443. Default is @code{0.5}.
  444. @end table
  445. @subsection Examples
  446. @itemize
  447. @item
  448. Make it sound as if there are twice as many instruments as are actually playing:
  449. @example
  450. aecho=0.8:0.88:60:0.4
  451. @end example
  452. @item
  453. If delay is very short, then it sound like a (metallic) robot playing music:
  454. @example
  455. aecho=0.8:0.88:6:0.4
  456. @end example
  457. @item
  458. A longer delay will sound like an open air concert in the mountains:
  459. @example
  460. aecho=0.8:0.9:1000:0.3
  461. @end example
  462. @item
  463. Same as above but with one more mountain:
  464. @example
  465. aecho=0.8:0.9:1000|1800:0.3|0.25
  466. @end example
  467. @end itemize
  468. @section aemphasis
  469. Audio emphasis filter creates or restores material directly taken from LPs or
  470. emphased CDs with different filter curves. E.g. to store music on vinyl the
  471. signal has to be altered by a filter first to even out the disadvantages of
  472. this recording medium.
  473. Once the material is played back the inverse filter has to be applied to
  474. restore the distortion of the frequency response.
  475. The filter accepts the following options:
  476. @table @option
  477. @item level_in
  478. Set input gain.
  479. @item level_out
  480. Set output gain.
  481. @item mode
  482. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  483. use @code{production} mode. Default is @code{reproduction} mode.
  484. @item type
  485. Set filter type. Selects medium. Can be one of the following:
  486. @table @option
  487. @item col
  488. select Columbia.
  489. @item emi
  490. select EMI.
  491. @item bsi
  492. select BSI (78RPM).
  493. @item riaa
  494. select RIAA.
  495. @item cd
  496. select Compact Disc (CD).
  497. @item 50fm
  498. select 50µs (FM).
  499. @item 75fm
  500. select 75µs (FM).
  501. @item 50kf
  502. select 50µs (FM-KF).
  503. @item 75kf
  504. select 75µs (FM-KF).
  505. @end table
  506. @end table
  507. @section aeval
  508. Modify an audio signal according to the specified expressions.
  509. This filter accepts one or more expressions (one for each channel),
  510. which are evaluated and used to modify a corresponding audio signal.
  511. It accepts the following parameters:
  512. @table @option
  513. @item exprs
  514. Set the '|'-separated expressions list for each separate channel. If
  515. the number of input channels is greater than the number of
  516. expressions, the last specified expression is used for the remaining
  517. output channels.
  518. @item channel_layout, c
  519. Set output channel layout. If not specified, the channel layout is
  520. specified by the number of expressions. If set to @samp{same}, it will
  521. use by default the same input channel layout.
  522. @end table
  523. Each expression in @var{exprs} can contain the following constants and functions:
  524. @table @option
  525. @item ch
  526. channel number of the current expression
  527. @item n
  528. number of the evaluated sample, starting from 0
  529. @item s
  530. sample rate
  531. @item t
  532. time of the evaluated sample expressed in seconds
  533. @item nb_in_channels
  534. @item nb_out_channels
  535. input and output number of channels
  536. @item val(CH)
  537. the value of input channel with number @var{CH}
  538. @end table
  539. Note: this filter is slow. For faster processing you should use a
  540. dedicated filter.
  541. @subsection Examples
  542. @itemize
  543. @item
  544. Half volume:
  545. @example
  546. aeval=val(ch)/2:c=same
  547. @end example
  548. @item
  549. Invert phase of the second channel:
  550. @example
  551. aeval=val(0)|-val(1)
  552. @end example
  553. @end itemize
  554. @anchor{afade}
  555. @section afade
  556. Apply fade-in/out effect to input audio.
  557. A description of the accepted parameters follows.
  558. @table @option
  559. @item type, t
  560. Specify the effect type, can be either @code{in} for fade-in, or
  561. @code{out} for a fade-out effect. Default is @code{in}.
  562. @item start_sample, ss
  563. Specify the number of the start sample for starting to apply the fade
  564. effect. Default is 0.
  565. @item nb_samples, ns
  566. Specify the number of samples for which the fade effect has to last. At
  567. the end of the fade-in effect the output audio will have the same
  568. volume as the input audio, at the end of the fade-out transition
  569. the output audio will be silence. Default is 44100.
  570. @item start_time, st
  571. Specify the start time of the fade effect. Default is 0.
  572. The value must be specified as a time duration; see
  573. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  574. for the accepted syntax.
  575. If set this option is used instead of @var{start_sample}.
  576. @item duration, d
  577. Specify the duration of the fade effect. See
  578. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  579. for the accepted syntax.
  580. At the end of the fade-in effect the output audio will have the same
  581. volume as the input audio, at the end of the fade-out transition
  582. the output audio will be silence.
  583. By default the duration is determined by @var{nb_samples}.
  584. If set this option is used instead of @var{nb_samples}.
  585. @item curve
  586. Set curve for fade transition.
  587. It accepts the following values:
  588. @table @option
  589. @item tri
  590. select triangular, linear slope (default)
  591. @item qsin
  592. select quarter of sine wave
  593. @item hsin
  594. select half of sine wave
  595. @item esin
  596. select exponential sine wave
  597. @item log
  598. select logarithmic
  599. @item ipar
  600. select inverted parabola
  601. @item qua
  602. select quadratic
  603. @item cub
  604. select cubic
  605. @item squ
  606. select square root
  607. @item cbr
  608. select cubic root
  609. @item par
  610. select parabola
  611. @item exp
  612. select exponential
  613. @item iqsin
  614. select inverted quarter of sine wave
  615. @item ihsin
  616. select inverted half of sine wave
  617. @item dese
  618. select double-exponential seat
  619. @item desi
  620. select double-exponential sigmoid
  621. @end table
  622. @end table
  623. @subsection Examples
  624. @itemize
  625. @item
  626. Fade in first 15 seconds of audio:
  627. @example
  628. afade=t=in:ss=0:d=15
  629. @end example
  630. @item
  631. Fade out last 25 seconds of a 900 seconds audio:
  632. @example
  633. afade=t=out:st=875:d=25
  634. @end example
  635. @end itemize
  636. @section afftfilt
  637. Apply arbitrary expressions to samples in frequency domain.
  638. @table @option
  639. @item real
  640. Set frequency domain real expression for each separate channel separated
  641. by '|'. Default is "1".
  642. If the number of input channels is greater than the number of
  643. expressions, the last specified expression is used for the remaining
  644. output channels.
  645. @item imag
  646. Set frequency domain imaginary expression for each separate channel
  647. separated by '|'. If not set, @var{real} option is used.
  648. Each expression in @var{real} and @var{imag} can contain the following
  649. constants:
  650. @table @option
  651. @item sr
  652. sample rate
  653. @item b
  654. current frequency bin number
  655. @item nb
  656. number of available bins
  657. @item ch
  658. channel number of the current expression
  659. @item chs
  660. number of channels
  661. @item pts
  662. current frame pts
  663. @end table
  664. @item win_size
  665. Set window size.
  666. It accepts the following values:
  667. @table @samp
  668. @item w16
  669. @item w32
  670. @item w64
  671. @item w128
  672. @item w256
  673. @item w512
  674. @item w1024
  675. @item w2048
  676. @item w4096
  677. @item w8192
  678. @item w16384
  679. @item w32768
  680. @item w65536
  681. @end table
  682. Default is @code{w4096}
  683. @item win_func
  684. Set window function. Default is @code{hann}.
  685. @item overlap
  686. Set window overlap. If set to 1, the recommended overlap for selected
  687. window function will be picked. Default is @code{0.75}.
  688. @end table
  689. @subsection Examples
  690. @itemize
  691. @item
  692. Leave almost only low frequencies in audio:
  693. @example
  694. afftfilt="1-clip((b/nb)*b,0,1)"
  695. @end example
  696. @end itemize
  697. @anchor{aformat}
  698. @section aformat
  699. Set output format constraints for the input audio. The framework will
  700. negotiate the most appropriate format to minimize conversions.
  701. It accepts the following parameters:
  702. @table @option
  703. @item sample_fmts
  704. A '|'-separated list of requested sample formats.
  705. @item sample_rates
  706. A '|'-separated list of requested sample rates.
  707. @item channel_layouts
  708. A '|'-separated list of requested channel layouts.
  709. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  710. for the required syntax.
  711. @end table
  712. If a parameter is omitted, all values are allowed.
  713. Force the output to either unsigned 8-bit or signed 16-bit stereo
  714. @example
  715. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  716. @end example
  717. @section agate
  718. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  719. processing reduces disturbing noise between useful signals.
  720. Gating is done by detecting the volume below a chosen level @var{threshold}
  721. and divide it by the factor set with @var{ratio}. The bottom of the noise
  722. floor is set via @var{range}. Because an exact manipulation of the signal
  723. would cause distortion of the waveform the reduction can be levelled over
  724. time. This is done by setting @var{attack} and @var{release}.
  725. @var{attack} determines how long the signal has to fall below the threshold
  726. before any reduction will occur and @var{release} sets the time the signal
  727. has to raise above the threshold to reduce the reduction again.
  728. Shorter signals than the chosen attack time will be left untouched.
  729. @table @option
  730. @item level_in
  731. Set input level before filtering.
  732. Default is 1. Allowed range is from 0.015625 to 64.
  733. @item range
  734. Set the level of gain reduction when the signal is below the threshold.
  735. Default is 0.06125. Allowed range is from 0 to 1.
  736. @item threshold
  737. If a signal rises above this level the gain reduction is released.
  738. Default is 0.125. Allowed range is from 0 to 1.
  739. @item ratio
  740. Set a ratio about which the signal is reduced.
  741. Default is 2. Allowed range is from 1 to 9000.
  742. @item attack
  743. Amount of milliseconds the signal has to rise above the threshold before gain
  744. reduction stops.
  745. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  746. @item release
  747. Amount of milliseconds the signal has to fall below the threshold before the
  748. reduction is increased again. Default is 250 milliseconds.
  749. Allowed range is from 0.01 to 9000.
  750. @item makeup
  751. Set amount of amplification of signal after processing.
  752. Default is 1. Allowed range is from 1 to 64.
  753. @item knee
  754. Curve the sharp knee around the threshold to enter gain reduction more softly.
  755. Default is 2.828427125. Allowed range is from 1 to 8.
  756. @item detection
  757. Choose if exact signal should be taken for detection or an RMS like one.
  758. Default is rms. Can be peak or rms.
  759. @item link
  760. Choose if the average level between all channels or the louder channel affects
  761. the reduction.
  762. Default is average. Can be average or maximum.
  763. @end table
  764. @section alimiter
  765. The limiter prevents input signal from raising over a desired threshold.
  766. This limiter uses lookahead technology to prevent your signal from distorting.
  767. It means that there is a small delay after signal is processed. Keep in mind
  768. that the delay it produces is the attack time you set.
  769. The filter accepts the following options:
  770. @table @option
  771. @item level_in
  772. Set input gain. Default is 1.
  773. @item level_out
  774. Set output gain. Default is 1.
  775. @item limit
  776. Don't let signals above this level pass the limiter. Default is 1.
  777. @item attack
  778. The limiter will reach its attenuation level in this amount of time in
  779. milliseconds. Default is 5 milliseconds.
  780. @item release
  781. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  782. Default is 50 milliseconds.
  783. @item asc
  784. When gain reduction is always needed ASC takes care of releasing to an
  785. average reduction level rather than reaching a reduction of 0 in the release
  786. time.
  787. @item asc_level
  788. Select how much the release time is affected by ASC, 0 means nearly no changes
  789. in release time while 1 produces higher release times.
  790. @item level
  791. Auto level output signal. Default is enabled.
  792. This normalizes audio back to 0dB if enabled.
  793. @end table
  794. Depending on picked setting it is recommended to upsample input 2x or 4x times
  795. with @ref{aresample} before applying this filter.
  796. @section allpass
  797. Apply a two-pole all-pass filter with central frequency (in Hz)
  798. @var{frequency}, and filter-width @var{width}.
  799. An all-pass filter changes the audio's frequency to phase relationship
  800. without changing its frequency to amplitude relationship.
  801. The filter accepts the following options:
  802. @table @option
  803. @item frequency, f
  804. Set frequency in Hz.
  805. @item width_type
  806. Set method to specify band-width of filter.
  807. @table @option
  808. @item h
  809. Hz
  810. @item q
  811. Q-Factor
  812. @item o
  813. octave
  814. @item s
  815. slope
  816. @end table
  817. @item width, w
  818. Specify the band-width of a filter in width_type units.
  819. @end table
  820. @section aloop
  821. Loop audio samples.
  822. The filter accepts the following options:
  823. @table @option
  824. @item loop
  825. Set the number of loops.
  826. @item size
  827. Set maximal number of samples.
  828. @item start
  829. Set first sample of loop.
  830. @end table
  831. @anchor{amerge}
  832. @section amerge
  833. Merge two or more audio streams into a single multi-channel stream.
  834. The filter accepts the following options:
  835. @table @option
  836. @item inputs
  837. Set the number of inputs. Default is 2.
  838. @end table
  839. If the channel layouts of the inputs are disjoint, and therefore compatible,
  840. the channel layout of the output will be set accordingly and the channels
  841. will be reordered as necessary. If the channel layouts of the inputs are not
  842. disjoint, the output will have all the channels of the first input then all
  843. the channels of the second input, in that order, and the channel layout of
  844. the output will be the default value corresponding to the total number of
  845. channels.
  846. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  847. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  848. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  849. first input, b1 is the first channel of the second input).
  850. On the other hand, if both input are in stereo, the output channels will be
  851. in the default order: a1, a2, b1, b2, and the channel layout will be
  852. arbitrarily set to 4.0, which may or may not be the expected value.
  853. All inputs must have the same sample rate, and format.
  854. If inputs do not have the same duration, the output will stop with the
  855. shortest.
  856. @subsection Examples
  857. @itemize
  858. @item
  859. Merge two mono files into a stereo stream:
  860. @example
  861. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  862. @end example
  863. @item
  864. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  865. @example
  866. 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
  867. @end example
  868. @end itemize
  869. @section amix
  870. Mixes multiple audio inputs into a single output.
  871. Note that this filter only supports float samples (the @var{amerge}
  872. and @var{pan} audio filters support many formats). If the @var{amix}
  873. input has integer samples then @ref{aresample} will be automatically
  874. inserted to perform the conversion to float samples.
  875. For example
  876. @example
  877. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  878. @end example
  879. will mix 3 input audio streams to a single output with the same duration as the
  880. first input and a dropout transition time of 3 seconds.
  881. It accepts the following parameters:
  882. @table @option
  883. @item inputs
  884. The number of inputs. If unspecified, it defaults to 2.
  885. @item duration
  886. How to determine the end-of-stream.
  887. @table @option
  888. @item longest
  889. The duration of the longest input. (default)
  890. @item shortest
  891. The duration of the shortest input.
  892. @item first
  893. The duration of the first input.
  894. @end table
  895. @item dropout_transition
  896. The transition time, in seconds, for volume renormalization when an input
  897. stream ends. The default value is 2 seconds.
  898. @end table
  899. @section anequalizer
  900. High-order parametric multiband equalizer for each channel.
  901. It accepts the following parameters:
  902. @table @option
  903. @item params
  904. This option string is in format:
  905. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  906. Each equalizer band is separated by '|'.
  907. @table @option
  908. @item chn
  909. Set channel number to which equalization will be applied.
  910. If input doesn't have that channel the entry is ignored.
  911. @item cf
  912. Set central frequency for band.
  913. If input doesn't have that frequency the entry is ignored.
  914. @item w
  915. Set band width in hertz.
  916. @item g
  917. Set band gain in dB.
  918. @item f
  919. Set filter type for band, optional, can be:
  920. @table @samp
  921. @item 0
  922. Butterworth, this is default.
  923. @item 1
  924. Chebyshev type 1.
  925. @item 2
  926. Chebyshev type 2.
  927. @end table
  928. @end table
  929. @item curves
  930. With this option activated frequency response of anequalizer is displayed
  931. in video stream.
  932. @item size
  933. Set video stream size. Only useful if curves option is activated.
  934. @item mgain
  935. Set max gain that will be displayed. Only useful if curves option is activated.
  936. Setting this to reasonable value allows to display gain which is derived from
  937. neighbour bands which are too close to each other and thus produce higher gain
  938. when both are activated.
  939. @item fscale
  940. Set frequency scale used to draw frequency response in video output.
  941. Can be linear or logarithmic. Default is logarithmic.
  942. @item colors
  943. Set color for each channel curve which is going to be displayed in video stream.
  944. This is list of color names separated by space or by '|'.
  945. Unrecognised or missing colors will be replaced by white color.
  946. @end table
  947. @subsection Examples
  948. @itemize
  949. @item
  950. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  951. for first 2 channels using Chebyshev type 1 filter:
  952. @example
  953. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  954. @end example
  955. @end itemize
  956. @subsection Commands
  957. This filter supports the following commands:
  958. @table @option
  959. @item change
  960. Alter existing filter parameters.
  961. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  962. @var{fN} is existing filter number, starting from 0, if no such filter is available
  963. error is returned.
  964. @var{freq} set new frequency parameter.
  965. @var{width} set new width parameter in herz.
  966. @var{gain} set new gain parameter in dB.
  967. Full filter invocation with asendcmd may look like this:
  968. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  969. @end table
  970. @section anull
  971. Pass the audio source unchanged to the output.
  972. @section apad
  973. Pad the end of an audio stream with silence.
  974. This can be used together with @command{ffmpeg} @option{-shortest} to
  975. extend audio streams to the same length as the video stream.
  976. A description of the accepted options follows.
  977. @table @option
  978. @item packet_size
  979. Set silence packet size. Default value is 4096.
  980. @item pad_len
  981. Set the number of samples of silence to add to the end. After the
  982. value is reached, the stream is terminated. This option is mutually
  983. exclusive with @option{whole_len}.
  984. @item whole_len
  985. Set the minimum total number of samples in the output audio stream. If
  986. the value is longer than the input audio length, silence is added to
  987. the end, until the value is reached. This option is mutually exclusive
  988. with @option{pad_len}.
  989. @end table
  990. If neither the @option{pad_len} nor the @option{whole_len} option is
  991. set, the filter will add silence to the end of the input stream
  992. indefinitely.
  993. @subsection Examples
  994. @itemize
  995. @item
  996. Add 1024 samples of silence to the end of the input:
  997. @example
  998. apad=pad_len=1024
  999. @end example
  1000. @item
  1001. Make sure the audio output will contain at least 10000 samples, pad
  1002. the input with silence if required:
  1003. @example
  1004. apad=whole_len=10000
  1005. @end example
  1006. @item
  1007. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1008. video stream will always result the shortest and will be converted
  1009. until the end in the output file when using the @option{shortest}
  1010. option:
  1011. @example
  1012. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1013. @end example
  1014. @end itemize
  1015. @section aphaser
  1016. Add a phasing effect to the input audio.
  1017. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1018. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1019. A description of the accepted parameters follows.
  1020. @table @option
  1021. @item in_gain
  1022. Set input gain. Default is 0.4.
  1023. @item out_gain
  1024. Set output gain. Default is 0.74
  1025. @item delay
  1026. Set delay in milliseconds. Default is 3.0.
  1027. @item decay
  1028. Set decay. Default is 0.4.
  1029. @item speed
  1030. Set modulation speed in Hz. Default is 0.5.
  1031. @item type
  1032. Set modulation type. Default is triangular.
  1033. It accepts the following values:
  1034. @table @samp
  1035. @item triangular, t
  1036. @item sinusoidal, s
  1037. @end table
  1038. @end table
  1039. @section apulsator
  1040. Audio pulsator is something between an autopanner and a tremolo.
  1041. But it can produce funny stereo effects as well. Pulsator changes the volume
  1042. of the left and right channel based on a LFO (low frequency oscillator) with
  1043. different waveforms and shifted phases.
  1044. This filter have the ability to define an offset between left and right
  1045. channel. An offset of 0 means that both LFO shapes match each other.
  1046. The left and right channel are altered equally - a conventional tremolo.
  1047. An offset of 50% means that the shape of the right channel is exactly shifted
  1048. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1049. an autopanner. At 1 both curves match again. Every setting in between moves the
  1050. phase shift gapless between all stages and produces some "bypassing" sounds with
  1051. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1052. the 0.5) the faster the signal passes from the left to the right speaker.
  1053. The filter accepts the following options:
  1054. @table @option
  1055. @item level_in
  1056. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1057. @item level_out
  1058. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1059. @item mode
  1060. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1061. sawup or sawdown. Default is sine.
  1062. @item amount
  1063. Set modulation. Define how much of original signal is affected by the LFO.
  1064. @item offset_l
  1065. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1066. @item offset_r
  1067. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1068. @item width
  1069. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1070. @item timing
  1071. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1072. @item bpm
  1073. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1074. is set to bpm.
  1075. @item ms
  1076. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1077. is set to ms.
  1078. @item hz
  1079. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1080. if timing is set to hz.
  1081. @end table
  1082. @anchor{aresample}
  1083. @section aresample
  1084. Resample the input audio to the specified parameters, using the
  1085. libswresample library. If none are specified then the filter will
  1086. automatically convert between its input and output.
  1087. This filter is also able to stretch/squeeze the audio data to make it match
  1088. the timestamps or to inject silence / cut out audio to make it match the
  1089. timestamps, do a combination of both or do neither.
  1090. The filter accepts the syntax
  1091. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1092. expresses a sample rate and @var{resampler_options} is a list of
  1093. @var{key}=@var{value} pairs, separated by ":". See the
  1094. ffmpeg-resampler manual for the complete list of supported options.
  1095. @subsection Examples
  1096. @itemize
  1097. @item
  1098. Resample the input audio to 44100Hz:
  1099. @example
  1100. aresample=44100
  1101. @end example
  1102. @item
  1103. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1104. samples per second compensation:
  1105. @example
  1106. aresample=async=1000
  1107. @end example
  1108. @end itemize
  1109. @section areverse
  1110. Reverse an audio clip.
  1111. Warning: This filter requires memory to buffer the entire clip, so trimming
  1112. is suggested.
  1113. @subsection Examples
  1114. @itemize
  1115. @item
  1116. Take the first 5 seconds of a clip, and reverse it.
  1117. @example
  1118. atrim=end=5,areverse
  1119. @end example
  1120. @end itemize
  1121. @section asetnsamples
  1122. Set the number of samples per each output audio frame.
  1123. The last output packet may contain a different number of samples, as
  1124. the filter will flush all the remaining samples when the input audio
  1125. signal its end.
  1126. The filter accepts the following options:
  1127. @table @option
  1128. @item nb_out_samples, n
  1129. Set the number of frames per each output audio frame. The number is
  1130. intended as the number of samples @emph{per each channel}.
  1131. Default value is 1024.
  1132. @item pad, p
  1133. If set to 1, the filter will pad the last audio frame with zeroes, so
  1134. that the last frame will contain the same number of samples as the
  1135. previous ones. Default value is 1.
  1136. @end table
  1137. For example, to set the number of per-frame samples to 1234 and
  1138. disable padding for the last frame, use:
  1139. @example
  1140. asetnsamples=n=1234:p=0
  1141. @end example
  1142. @section asetrate
  1143. Set the sample rate without altering the PCM data.
  1144. This will result in a change of speed and pitch.
  1145. The filter accepts the following options:
  1146. @table @option
  1147. @item sample_rate, r
  1148. Set the output sample rate. Default is 44100 Hz.
  1149. @end table
  1150. @section ashowinfo
  1151. Show a line containing various information for each input audio frame.
  1152. The input audio is not modified.
  1153. The shown line contains a sequence of key/value pairs of the form
  1154. @var{key}:@var{value}.
  1155. The following values are shown in the output:
  1156. @table @option
  1157. @item n
  1158. The (sequential) number of the input frame, starting from 0.
  1159. @item pts
  1160. The presentation timestamp of the input frame, in time base units; the time base
  1161. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1162. @item pts_time
  1163. The presentation timestamp of the input frame in seconds.
  1164. @item pos
  1165. position of the frame in the input stream, -1 if this information in
  1166. unavailable and/or meaningless (for example in case of synthetic audio)
  1167. @item fmt
  1168. The sample format.
  1169. @item chlayout
  1170. The channel layout.
  1171. @item rate
  1172. The sample rate for the audio frame.
  1173. @item nb_samples
  1174. The number of samples (per channel) in the frame.
  1175. @item checksum
  1176. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1177. audio, the data is treated as if all the planes were concatenated.
  1178. @item plane_checksums
  1179. A list of Adler-32 checksums for each data plane.
  1180. @end table
  1181. @anchor{astats}
  1182. @section astats
  1183. Display time domain statistical information about the audio channels.
  1184. Statistics are calculated and displayed for each audio channel and,
  1185. where applicable, an overall figure is also given.
  1186. It accepts the following option:
  1187. @table @option
  1188. @item length
  1189. Short window length in seconds, used for peak and trough RMS measurement.
  1190. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  1191. @item metadata
  1192. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1193. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1194. disabled.
  1195. Available keys for each channel are:
  1196. DC_offset
  1197. Min_level
  1198. Max_level
  1199. Min_difference
  1200. Max_difference
  1201. Mean_difference
  1202. Peak_level
  1203. RMS_peak
  1204. RMS_trough
  1205. Crest_factor
  1206. Flat_factor
  1207. Peak_count
  1208. Bit_depth
  1209. and for Overall:
  1210. DC_offset
  1211. Min_level
  1212. Max_level
  1213. Min_difference
  1214. Max_difference
  1215. Mean_difference
  1216. Peak_level
  1217. RMS_level
  1218. RMS_peak
  1219. RMS_trough
  1220. Flat_factor
  1221. Peak_count
  1222. Bit_depth
  1223. Number_of_samples
  1224. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1225. this @code{lavfi.astats.Overall.Peak_count}.
  1226. For description what each key means read below.
  1227. @item reset
  1228. Set number of frame after which stats are going to be recalculated.
  1229. Default is disabled.
  1230. @end table
  1231. A description of each shown parameter follows:
  1232. @table @option
  1233. @item DC offset
  1234. Mean amplitude displacement from zero.
  1235. @item Min level
  1236. Minimal sample level.
  1237. @item Max level
  1238. Maximal sample level.
  1239. @item Min difference
  1240. Minimal difference between two consecutive samples.
  1241. @item Max difference
  1242. Maximal difference between two consecutive samples.
  1243. @item Mean difference
  1244. Mean difference between two consecutive samples.
  1245. The average of each difference between two consecutive samples.
  1246. @item Peak level dB
  1247. @item RMS level dB
  1248. Standard peak and RMS level measured in dBFS.
  1249. @item RMS peak dB
  1250. @item RMS trough dB
  1251. Peak and trough values for RMS level measured over a short window.
  1252. @item Crest factor
  1253. Standard ratio of peak to RMS level (note: not in dB).
  1254. @item Flat factor
  1255. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1256. (i.e. either @var{Min level} or @var{Max level}).
  1257. @item Peak count
  1258. Number of occasions (not the number of samples) that the signal attained either
  1259. @var{Min level} or @var{Max level}.
  1260. @item Bit depth
  1261. Overall bit depth of audio. Number of bits used for each sample.
  1262. @end table
  1263. @section asyncts
  1264. Synchronize audio data with timestamps by squeezing/stretching it and/or
  1265. dropping samples/adding silence when needed.
  1266. This filter is not built by default, please use @ref{aresample} to do squeezing/stretching.
  1267. It accepts the following parameters:
  1268. @table @option
  1269. @item compensate
  1270. Enable stretching/squeezing the data to make it match the timestamps. Disabled
  1271. by default. When disabled, time gaps are covered with silence.
  1272. @item min_delta
  1273. The minimum difference between timestamps and audio data (in seconds) to trigger
  1274. adding/dropping samples. The default value is 0.1. If you get an imperfect
  1275. sync with this filter, try setting this parameter to 0.
  1276. @item max_comp
  1277. The maximum compensation in samples per second. Only relevant with compensate=1.
  1278. The default value is 500.
  1279. @item first_pts
  1280. Assume that the first PTS should be this value. The time base is 1 / sample
  1281. rate. This allows for padding/trimming at the start of the stream. By default,
  1282. no assumption is made about the first frame's expected PTS, so no padding or
  1283. trimming is done. For example, this could be set to 0 to pad the beginning with
  1284. silence if an audio stream starts after the video stream or to trim any samples
  1285. with a negative PTS due to encoder delay.
  1286. @end table
  1287. @section atempo
  1288. Adjust audio tempo.
  1289. The filter accepts exactly one parameter, the audio tempo. If not
  1290. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1291. be in the [0.5, 2.0] range.
  1292. @subsection Examples
  1293. @itemize
  1294. @item
  1295. Slow down audio to 80% tempo:
  1296. @example
  1297. atempo=0.8
  1298. @end example
  1299. @item
  1300. To speed up audio to 125% tempo:
  1301. @example
  1302. atempo=1.25
  1303. @end example
  1304. @end itemize
  1305. @section atrim
  1306. Trim the input so that the output contains one continuous subpart of the input.
  1307. It accepts the following parameters:
  1308. @table @option
  1309. @item start
  1310. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1311. sample with the timestamp @var{start} will be the first sample in the output.
  1312. @item end
  1313. Specify time of the first audio sample that will be dropped, i.e. the
  1314. audio sample immediately preceding the one with the timestamp @var{end} will be
  1315. the last sample in the output.
  1316. @item start_pts
  1317. Same as @var{start}, except this option sets the start timestamp in samples
  1318. instead of seconds.
  1319. @item end_pts
  1320. Same as @var{end}, except this option sets the end timestamp in samples instead
  1321. of seconds.
  1322. @item duration
  1323. The maximum duration of the output in seconds.
  1324. @item start_sample
  1325. The number of the first sample that should be output.
  1326. @item end_sample
  1327. The number of the first sample that should be dropped.
  1328. @end table
  1329. @option{start}, @option{end}, and @option{duration} are expressed as time
  1330. duration specifications; see
  1331. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1332. Note that the first two sets of the start/end options and the @option{duration}
  1333. option look at the frame timestamp, while the _sample options simply count the
  1334. samples that pass through the filter. So start/end_pts and start/end_sample will
  1335. give different results when the timestamps are wrong, inexact or do not start at
  1336. zero. Also note that this filter does not modify the timestamps. If you wish
  1337. to have the output timestamps start at zero, insert the asetpts filter after the
  1338. atrim filter.
  1339. If multiple start or end options are set, this filter tries to be greedy and
  1340. keep all samples that match at least one of the specified constraints. To keep
  1341. only the part that matches all the constraints at once, chain multiple atrim
  1342. filters.
  1343. The defaults are such that all the input is kept. So it is possible to set e.g.
  1344. just the end values to keep everything before the specified time.
  1345. Examples:
  1346. @itemize
  1347. @item
  1348. Drop everything except the second minute of input:
  1349. @example
  1350. ffmpeg -i INPUT -af atrim=60:120
  1351. @end example
  1352. @item
  1353. Keep only the first 1000 samples:
  1354. @example
  1355. ffmpeg -i INPUT -af atrim=end_sample=1000
  1356. @end example
  1357. @end itemize
  1358. @section bandpass
  1359. Apply a two-pole Butterworth band-pass filter with central
  1360. frequency @var{frequency}, and (3dB-point) band-width width.
  1361. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1362. instead of the default: constant 0dB peak gain.
  1363. The filter roll off at 6dB per octave (20dB per decade).
  1364. The filter accepts the following options:
  1365. @table @option
  1366. @item frequency, f
  1367. Set the filter's central frequency. Default is @code{3000}.
  1368. @item csg
  1369. Constant skirt gain if set to 1. Defaults to 0.
  1370. @item width_type
  1371. Set method to specify band-width of filter.
  1372. @table @option
  1373. @item h
  1374. Hz
  1375. @item q
  1376. Q-Factor
  1377. @item o
  1378. octave
  1379. @item s
  1380. slope
  1381. @end table
  1382. @item width, w
  1383. Specify the band-width of a filter in width_type units.
  1384. @end table
  1385. @section bandreject
  1386. Apply a two-pole Butterworth band-reject filter with central
  1387. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1388. The filter roll off at 6dB per octave (20dB per decade).
  1389. The filter accepts the following options:
  1390. @table @option
  1391. @item frequency, f
  1392. Set the filter's central frequency. Default is @code{3000}.
  1393. @item width_type
  1394. Set method to specify band-width of filter.
  1395. @table @option
  1396. @item h
  1397. Hz
  1398. @item q
  1399. Q-Factor
  1400. @item o
  1401. octave
  1402. @item s
  1403. slope
  1404. @end table
  1405. @item width, w
  1406. Specify the band-width of a filter in width_type units.
  1407. @end table
  1408. @section bass
  1409. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1410. shelving filter with a response similar to that of a standard
  1411. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1412. The filter accepts the following options:
  1413. @table @option
  1414. @item gain, g
  1415. Give the gain at 0 Hz. Its useful range is about -20
  1416. (for a large cut) to +20 (for a large boost).
  1417. Beware of clipping when using a positive gain.
  1418. @item frequency, f
  1419. Set the filter's central frequency and so can be used
  1420. to extend or reduce the frequency range to be boosted or cut.
  1421. The default value is @code{100} Hz.
  1422. @item width_type
  1423. Set method to specify band-width of filter.
  1424. @table @option
  1425. @item h
  1426. Hz
  1427. @item q
  1428. Q-Factor
  1429. @item o
  1430. octave
  1431. @item s
  1432. slope
  1433. @end table
  1434. @item width, w
  1435. Determine how steep is the filter's shelf transition.
  1436. @end table
  1437. @section biquad
  1438. Apply a biquad IIR filter with the given coefficients.
  1439. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1440. are the numerator and denominator coefficients respectively.
  1441. @section bs2b
  1442. Bauer stereo to binaural transformation, which improves headphone listening of
  1443. stereo audio records.
  1444. It accepts the following parameters:
  1445. @table @option
  1446. @item profile
  1447. Pre-defined crossfeed level.
  1448. @table @option
  1449. @item default
  1450. Default level (fcut=700, feed=50).
  1451. @item cmoy
  1452. Chu Moy circuit (fcut=700, feed=60).
  1453. @item jmeier
  1454. Jan Meier circuit (fcut=650, feed=95).
  1455. @end table
  1456. @item fcut
  1457. Cut frequency (in Hz).
  1458. @item feed
  1459. Feed level (in Hz).
  1460. @end table
  1461. @section channelmap
  1462. Remap input channels to new locations.
  1463. It accepts the following parameters:
  1464. @table @option
  1465. @item channel_layout
  1466. The channel layout of the output stream.
  1467. @item map
  1468. Map channels from input to output. The argument is a '|'-separated list of
  1469. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1470. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1471. channel (e.g. FL for front left) or its index in the input channel layout.
  1472. @var{out_channel} is the name of the output channel or its index in the output
  1473. channel layout. If @var{out_channel} is not given then it is implicitly an
  1474. index, starting with zero and increasing by one for each mapping.
  1475. @end table
  1476. If no mapping is present, the filter will implicitly map input channels to
  1477. output channels, preserving indices.
  1478. For example, assuming a 5.1+downmix input MOV file,
  1479. @example
  1480. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1481. @end example
  1482. will create an output WAV file tagged as stereo from the downmix channels of
  1483. the input.
  1484. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1485. @example
  1486. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1487. @end example
  1488. @section channelsplit
  1489. Split each channel from an input audio stream into a separate output stream.
  1490. It accepts the following parameters:
  1491. @table @option
  1492. @item channel_layout
  1493. The channel layout of the input stream. The default is "stereo".
  1494. @end table
  1495. For example, assuming a stereo input MP3 file,
  1496. @example
  1497. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1498. @end example
  1499. will create an output Matroska file with two audio streams, one containing only
  1500. the left channel and the other the right channel.
  1501. Split a 5.1 WAV file into per-channel files:
  1502. @example
  1503. ffmpeg -i in.wav -filter_complex
  1504. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1505. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1506. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1507. side_right.wav
  1508. @end example
  1509. @section chorus
  1510. Add a chorus effect to the audio.
  1511. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1512. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1513. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1514. The modulation depth defines the range the modulated delay is played before or after
  1515. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1516. sound tuned around the original one, like in a chorus where some vocals are slightly
  1517. off key.
  1518. It accepts the following parameters:
  1519. @table @option
  1520. @item in_gain
  1521. Set input gain. Default is 0.4.
  1522. @item out_gain
  1523. Set output gain. Default is 0.4.
  1524. @item delays
  1525. Set delays. A typical delay is around 40ms to 60ms.
  1526. @item decays
  1527. Set decays.
  1528. @item speeds
  1529. Set speeds.
  1530. @item depths
  1531. Set depths.
  1532. @end table
  1533. @subsection Examples
  1534. @itemize
  1535. @item
  1536. A single delay:
  1537. @example
  1538. chorus=0.7:0.9:55:0.4:0.25:2
  1539. @end example
  1540. @item
  1541. Two delays:
  1542. @example
  1543. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1544. @end example
  1545. @item
  1546. Fuller sounding chorus with three delays:
  1547. @example
  1548. 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
  1549. @end example
  1550. @end itemize
  1551. @section compand
  1552. Compress or expand the audio's dynamic range.
  1553. It accepts the following parameters:
  1554. @table @option
  1555. @item attacks
  1556. @item decays
  1557. A list of times in seconds for each channel over which the instantaneous level
  1558. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1559. increase of volume and @var{decays} refers to decrease of volume. For most
  1560. situations, the attack time (response to the audio getting louder) should be
  1561. shorter than the decay time, because the human ear is more sensitive to sudden
  1562. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1563. a typical value for decay is 0.8 seconds.
  1564. If specified number of attacks & decays is lower than number of channels, the last
  1565. set attack/decay will be used for all remaining channels.
  1566. @item points
  1567. A list of points for the transfer function, specified in dB relative to the
  1568. maximum possible signal amplitude. Each key points list must be defined using
  1569. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1570. @code{x0/y0 x1/y1 x2/y2 ....}
  1571. The input values must be in strictly increasing order but the transfer function
  1572. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1573. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1574. function are @code{-70/-70|-60/-20}.
  1575. @item soft-knee
  1576. Set the curve radius in dB for all joints. It defaults to 0.01.
  1577. @item gain
  1578. Set the additional gain in dB to be applied at all points on the transfer
  1579. function. This allows for easy adjustment of the overall gain.
  1580. It defaults to 0.
  1581. @item volume
  1582. Set an initial volume, in dB, to be assumed for each channel when filtering
  1583. starts. This permits the user to supply a nominal level initially, so that, for
  1584. example, a very large gain is not applied to initial signal levels before the
  1585. companding has begun to operate. A typical value for audio which is initially
  1586. quiet is -90 dB. It defaults to 0.
  1587. @item delay
  1588. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1589. delayed before being fed to the volume adjuster. Specifying a delay
  1590. approximately equal to the attack/decay times allows the filter to effectively
  1591. operate in predictive rather than reactive mode. It defaults to 0.
  1592. @end table
  1593. @subsection Examples
  1594. @itemize
  1595. @item
  1596. Make music with both quiet and loud passages suitable for listening to in a
  1597. noisy environment:
  1598. @example
  1599. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1600. @end example
  1601. Another example for audio with whisper and explosion parts:
  1602. @example
  1603. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1604. @end example
  1605. @item
  1606. A noise gate for when the noise is at a lower level than the signal:
  1607. @example
  1608. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1609. @end example
  1610. @item
  1611. Here is another noise gate, this time for when the noise is at a higher level
  1612. than the signal (making it, in some ways, similar to squelch):
  1613. @example
  1614. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1615. @end example
  1616. @item
  1617. 2:1 compression starting at -6dB:
  1618. @example
  1619. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1620. @end example
  1621. @item
  1622. 2:1 compression starting at -9dB:
  1623. @example
  1624. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1625. @end example
  1626. @item
  1627. 2:1 compression starting at -12dB:
  1628. @example
  1629. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1630. @end example
  1631. @item
  1632. 2:1 compression starting at -18dB:
  1633. @example
  1634. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1635. @end example
  1636. @item
  1637. 3:1 compression starting at -15dB:
  1638. @example
  1639. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1640. @end example
  1641. @item
  1642. Compressor/Gate:
  1643. @example
  1644. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1645. @end example
  1646. @item
  1647. Expander:
  1648. @example
  1649. 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
  1650. @end example
  1651. @item
  1652. Hard limiter at -6dB:
  1653. @example
  1654. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1655. @end example
  1656. @item
  1657. Hard limiter at -12dB:
  1658. @example
  1659. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1660. @end example
  1661. @item
  1662. Hard noise gate at -35 dB:
  1663. @example
  1664. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1665. @end example
  1666. @item
  1667. Soft limiter:
  1668. @example
  1669. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1670. @end example
  1671. @end itemize
  1672. @section compensationdelay
  1673. Compensation Delay Line is a metric based delay to compensate differing
  1674. positions of microphones or speakers.
  1675. For example, you have recorded guitar with two microphones placed in
  1676. different location. Because the front of sound wave has fixed speed in
  1677. normal conditions, the phasing of microphones can vary and depends on
  1678. their location and interposition. The best sound mix can be achieved when
  1679. these microphones are in phase (synchronized). Note that distance of
  1680. ~30 cm between microphones makes one microphone to capture signal in
  1681. antiphase to another microphone. That makes the final mix sounding moody.
  1682. This filter helps to solve phasing problems by adding different delays
  1683. to each microphone track and make them synchronized.
  1684. The best result can be reached when you take one track as base and
  1685. synchronize other tracks one by one with it.
  1686. Remember that synchronization/delay tolerance depends on sample rate, too.
  1687. Higher sample rates will give more tolerance.
  1688. It accepts the following parameters:
  1689. @table @option
  1690. @item mm
  1691. Set millimeters distance. This is compensation distance for fine tuning.
  1692. Default is 0.
  1693. @item cm
  1694. Set cm distance. This is compensation distance for tightening distance setup.
  1695. Default is 0.
  1696. @item m
  1697. Set meters distance. This is compensation distance for hard distance setup.
  1698. Default is 0.
  1699. @item dry
  1700. Set dry amount. Amount of unprocessed (dry) signal.
  1701. Default is 0.
  1702. @item wet
  1703. Set wet amount. Amount of processed (wet) signal.
  1704. Default is 1.
  1705. @item temp
  1706. Set temperature degree in Celsius. This is the temperature of the environment.
  1707. Default is 20.
  1708. @end table
  1709. @section crystalizer
  1710. Simple algorithm to expand audio dynamic range.
  1711. The filter accepts the following options:
  1712. @table @option
  1713. @item i
  1714. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  1715. (unchanged sound) to 10.0 (maximum effect).
  1716. @item c
  1717. Enable clipping. By default is enabled.
  1718. @end table
  1719. @section dcshift
  1720. Apply a DC shift to the audio.
  1721. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1722. in the recording chain) from the audio. The effect of a DC offset is reduced
  1723. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1724. a signal has a DC offset.
  1725. @table @option
  1726. @item shift
  1727. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1728. the audio.
  1729. @item limitergain
  1730. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1731. used to prevent clipping.
  1732. @end table
  1733. @section dynaudnorm
  1734. Dynamic Audio Normalizer.
  1735. This filter applies a certain amount of gain to the input audio in order
  1736. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1737. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1738. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1739. This allows for applying extra gain to the "quiet" sections of the audio
  1740. while avoiding distortions or clipping the "loud" sections. In other words:
  1741. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1742. sections, in the sense that the volume of each section is brought to the
  1743. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1744. this goal *without* applying "dynamic range compressing". It will retain 100%
  1745. of the dynamic range *within* each section of the audio file.
  1746. @table @option
  1747. @item f
  1748. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1749. Default is 500 milliseconds.
  1750. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1751. referred to as frames. This is required, because a peak magnitude has no
  1752. meaning for just a single sample value. Instead, we need to determine the
  1753. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1754. normalizer would simply use the peak magnitude of the complete file, the
  1755. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1756. frame. The length of a frame is specified in milliseconds. By default, the
  1757. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1758. been found to give good results with most files.
  1759. Note that the exact frame length, in number of samples, will be determined
  1760. automatically, based on the sampling rate of the individual input audio file.
  1761. @item g
  1762. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1763. number. Default is 31.
  1764. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1765. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1766. is specified in frames, centered around the current frame. For the sake of
  1767. simplicity, this must be an odd number. Consequently, the default value of 31
  1768. takes into account the current frame, as well as the 15 preceding frames and
  1769. the 15 subsequent frames. Using a larger window results in a stronger
  1770. smoothing effect and thus in less gain variation, i.e. slower gain
  1771. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1772. effect and thus in more gain variation, i.e. faster gain adaptation.
  1773. In other words, the more you increase this value, the more the Dynamic Audio
  1774. Normalizer will behave like a "traditional" normalization filter. On the
  1775. contrary, the more you decrease this value, the more the Dynamic Audio
  1776. Normalizer will behave like a dynamic range compressor.
  1777. @item p
  1778. Set the target peak value. This specifies the highest permissible magnitude
  1779. level for the normalized audio input. This filter will try to approach the
  1780. target peak magnitude as closely as possible, but at the same time it also
  1781. makes sure that the normalized signal will never exceed the peak magnitude.
  1782. A frame's maximum local gain factor is imposed directly by the target peak
  1783. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1784. It is not recommended to go above this value.
  1785. @item m
  1786. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1787. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1788. factor for each input frame, i.e. the maximum gain factor that does not
  1789. result in clipping or distortion. The maximum gain factor is determined by
  1790. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1791. additionally bounds the frame's maximum gain factor by a predetermined
  1792. (global) maximum gain factor. This is done in order to avoid excessive gain
  1793. factors in "silent" or almost silent frames. By default, the maximum gain
  1794. factor is 10.0, For most inputs the default value should be sufficient and
  1795. it usually is not recommended to increase this value. Though, for input
  1796. with an extremely low overall volume level, it may be necessary to allow even
  1797. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1798. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1799. Instead, a "sigmoid" threshold function will be applied. This way, the
  1800. gain factors will smoothly approach the threshold value, but never exceed that
  1801. value.
  1802. @item r
  1803. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1804. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1805. This means that the maximum local gain factor for each frame is defined
  1806. (only) by the frame's highest magnitude sample. This way, the samples can
  1807. be amplified as much as possible without exceeding the maximum signal
  1808. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1809. Normalizer can also take into account the frame's root mean square,
  1810. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1811. determine the power of a time-varying signal. It is therefore considered
  1812. that the RMS is a better approximation of the "perceived loudness" than
  1813. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1814. frames to a constant RMS value, a uniform "perceived loudness" can be
  1815. established. If a target RMS value has been specified, a frame's local gain
  1816. factor is defined as the factor that would result in exactly that RMS value.
  1817. Note, however, that the maximum local gain factor is still restricted by the
  1818. frame's highest magnitude sample, in order to prevent clipping.
  1819. @item n
  1820. Enable channels coupling. By default is enabled.
  1821. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1822. amount. This means the same gain factor will be applied to all channels, i.e.
  1823. the maximum possible gain factor is determined by the "loudest" channel.
  1824. However, in some recordings, it may happen that the volume of the different
  1825. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1826. In this case, this option can be used to disable the channel coupling. This way,
  1827. the gain factor will be determined independently for each channel, depending
  1828. only on the individual channel's highest magnitude sample. This allows for
  1829. harmonizing the volume of the different channels.
  1830. @item c
  1831. Enable DC bias correction. By default is disabled.
  1832. An audio signal (in the time domain) is a sequence of sample values.
  1833. In the Dynamic Audio Normalizer these sample values are represented in the
  1834. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1835. audio signal, or "waveform", should be centered around the zero point.
  1836. That means if we calculate the mean value of all samples in a file, or in a
  1837. single frame, then the result should be 0.0 or at least very close to that
  1838. value. If, however, there is a significant deviation of the mean value from
  1839. 0.0, in either positive or negative direction, this is referred to as a
  1840. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1841. Audio Normalizer provides optional DC bias correction.
  1842. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1843. the mean value, or "DC correction" offset, of each input frame and subtract
  1844. that value from all of the frame's sample values which ensures those samples
  1845. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1846. boundaries, the DC correction offset values will be interpolated smoothly
  1847. between neighbouring frames.
  1848. @item b
  1849. Enable alternative boundary mode. By default is disabled.
  1850. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1851. around each frame. This includes the preceding frames as well as the
  1852. subsequent frames. However, for the "boundary" frames, located at the very
  1853. beginning and at the very end of the audio file, not all neighbouring
  1854. frames are available. In particular, for the first few frames in the audio
  1855. file, the preceding frames are not known. And, similarly, for the last few
  1856. frames in the audio file, the subsequent frames are not known. Thus, the
  1857. question arises which gain factors should be assumed for the missing frames
  1858. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1859. to deal with this situation. The default boundary mode assumes a gain factor
  1860. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1861. "fade out" at the beginning and at the end of the input, respectively.
  1862. @item s
  1863. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1864. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1865. compression. This means that signal peaks will not be pruned and thus the
  1866. full dynamic range will be retained within each local neighbourhood. However,
  1867. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1868. normalization algorithm with a more "traditional" compression.
  1869. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1870. (thresholding) function. If (and only if) the compression feature is enabled,
  1871. all input frames will be processed by a soft knee thresholding function prior
  1872. to the actual normalization process. Put simply, the thresholding function is
  1873. going to prune all samples whose magnitude exceeds a certain threshold value.
  1874. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1875. value. Instead, the threshold value will be adjusted for each individual
  1876. frame.
  1877. In general, smaller parameters result in stronger compression, and vice versa.
  1878. Values below 3.0 are not recommended, because audible distortion may appear.
  1879. @end table
  1880. @section earwax
  1881. Make audio easier to listen to on headphones.
  1882. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1883. so that when listened to on headphones the stereo image is moved from
  1884. inside your head (standard for headphones) to outside and in front of
  1885. the listener (standard for speakers).
  1886. Ported from SoX.
  1887. @section equalizer
  1888. Apply a two-pole peaking equalisation (EQ) filter. With this
  1889. filter, the signal-level at and around a selected frequency can
  1890. be increased or decreased, whilst (unlike bandpass and bandreject
  1891. filters) that at all other frequencies is unchanged.
  1892. In order to produce complex equalisation curves, this filter can
  1893. be given several times, each with a different central frequency.
  1894. The filter accepts the following options:
  1895. @table @option
  1896. @item frequency, f
  1897. Set the filter's central frequency in Hz.
  1898. @item width_type
  1899. Set method to specify band-width of filter.
  1900. @table @option
  1901. @item h
  1902. Hz
  1903. @item q
  1904. Q-Factor
  1905. @item o
  1906. octave
  1907. @item s
  1908. slope
  1909. @end table
  1910. @item width, w
  1911. Specify the band-width of a filter in width_type units.
  1912. @item gain, g
  1913. Set the required gain or attenuation in dB.
  1914. Beware of clipping when using a positive gain.
  1915. @end table
  1916. @subsection Examples
  1917. @itemize
  1918. @item
  1919. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  1920. @example
  1921. equalizer=f=1000:width_type=h:width=200:g=-10
  1922. @end example
  1923. @item
  1924. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  1925. @example
  1926. equalizer=f=1000:width_type=q:width=1:g=2,equalizer=f=100:width_type=q:width=2:g=-5
  1927. @end example
  1928. @end itemize
  1929. @section extrastereo
  1930. Linearly increases the difference between left and right channels which
  1931. adds some sort of "live" effect to playback.
  1932. The filter accepts the following options:
  1933. @table @option
  1934. @item m
  1935. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  1936. (average of both channels), with 1.0 sound will be unchanged, with
  1937. -1.0 left and right channels will be swapped.
  1938. @item c
  1939. Enable clipping. By default is enabled.
  1940. @end table
  1941. @section firequalizer
  1942. Apply FIR Equalization using arbitrary frequency response.
  1943. The filter accepts the following option:
  1944. @table @option
  1945. @item gain
  1946. Set gain curve equation (in dB). The expression can contain variables:
  1947. @table @option
  1948. @item f
  1949. the evaluated frequency
  1950. @item sr
  1951. sample rate
  1952. @item ch
  1953. channel number, set to 0 when multichannels evaluation is disabled
  1954. @item chid
  1955. channel id, see libavutil/channel_layout.h, set to the first channel id when
  1956. multichannels evaluation is disabled
  1957. @item chs
  1958. number of channels
  1959. @item chlayout
  1960. channel_layout, see libavutil/channel_layout.h
  1961. @end table
  1962. and functions:
  1963. @table @option
  1964. @item gain_interpolate(f)
  1965. interpolate gain on frequency f based on gain_entry
  1966. @end table
  1967. This option is also available as command. Default is @code{gain_interpolate(f)}.
  1968. @item gain_entry
  1969. Set gain entry for gain_interpolate function. The expression can
  1970. contain functions:
  1971. @table @option
  1972. @item entry(f, g)
  1973. store gain entry at frequency f with value g
  1974. @end table
  1975. This option is also available as command.
  1976. @item delay
  1977. Set filter delay in seconds. Higher value means more accurate.
  1978. Default is @code{0.01}.
  1979. @item accuracy
  1980. Set filter accuracy in Hz. Lower value means more accurate.
  1981. Default is @code{5}.
  1982. @item wfunc
  1983. Set window function. Acceptable values are:
  1984. @table @option
  1985. @item rectangular
  1986. rectangular window, useful when gain curve is already smooth
  1987. @item hann
  1988. hann window (default)
  1989. @item hamming
  1990. hamming window
  1991. @item blackman
  1992. blackman window
  1993. @item nuttall3
  1994. 3-terms continuous 1st derivative nuttall window
  1995. @item mnuttall3
  1996. minimum 3-terms discontinuous nuttall window
  1997. @item nuttall
  1998. 4-terms continuous 1st derivative nuttall window
  1999. @item bnuttall
  2000. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2001. @item bharris
  2002. blackman-harris window
  2003. @end table
  2004. @item fixed
  2005. If enabled, use fixed number of audio samples. This improves speed when
  2006. filtering with large delay. Default is disabled.
  2007. @item multi
  2008. Enable multichannels evaluation on gain. Default is disabled.
  2009. @item zero_phase
  2010. Enable zero phase mode by substracting timestamp to compensate delay.
  2011. Default is disabled.
  2012. @end table
  2013. @subsection Examples
  2014. @itemize
  2015. @item
  2016. lowpass at 1000 Hz:
  2017. @example
  2018. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2019. @end example
  2020. @item
  2021. lowpass at 1000 Hz with gain_entry:
  2022. @example
  2023. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2024. @end example
  2025. @item
  2026. custom equalization:
  2027. @example
  2028. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2029. @end example
  2030. @item
  2031. higher delay with zero phase to compensate delay:
  2032. @example
  2033. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2034. @end example
  2035. @item
  2036. lowpass on left channel, highpass on right channel:
  2037. @example
  2038. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2039. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2040. @end example
  2041. @end itemize
  2042. @section flanger
  2043. Apply a flanging effect to the audio.
  2044. The filter accepts the following options:
  2045. @table @option
  2046. @item delay
  2047. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2048. @item depth
  2049. Set added swep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2050. @item regen
  2051. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2052. Default value is 0.
  2053. @item width
  2054. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2055. Default value is 71.
  2056. @item speed
  2057. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2058. @item shape
  2059. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2060. Default value is @var{sinusoidal}.
  2061. @item phase
  2062. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2063. Default value is 25.
  2064. @item interp
  2065. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2066. Default is @var{linear}.
  2067. @end table
  2068. @section hdcd
  2069. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2070. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2071. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2072. of HDCD, and detects the Transient Filter flag.
  2073. @example
  2074. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2075. @end example
  2076. When using the filter with wav, note the default encoding for wav is 16-bit,
  2077. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2078. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2079. @example
  2080. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2081. ffmpeg -i HDCD16.wav -af hdcd -acodec pcm_s24le OUT24.wav
  2082. @end example
  2083. The filter accepts the following options:
  2084. @table @option
  2085. @item disable_autoconvert
  2086. Disable any automatic format conversion or resampling in the filter graph.
  2087. @item process_stereo
  2088. Process the stereo channels together. If target_gain does not match between
  2089. channels, consider it invalid and use the last valid target_gain.
  2090. @item cdt_ms
  2091. Set the code detect timer period in ms.
  2092. @item force_pe
  2093. Always extend peaks above -3dBFS even if PE isn't signaled.
  2094. @item analyze_mode
  2095. Replace audio with a solid tone and adjust the amplitude to signal some
  2096. specific aspect of the decoding process. The output file can be loaded in
  2097. an audio editor alongside the original to aid analysis.
  2098. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2099. Modes are:
  2100. @table @samp
  2101. @item 0, off
  2102. Disabled
  2103. @item 1, lle
  2104. Gain adjustment level at each sample
  2105. @item 2, pe
  2106. Samples where peak extend occurs
  2107. @item 3, cdt
  2108. Samples where the code detect timer is active
  2109. @item 4, tgm
  2110. Samples where the target gain does not match between channels
  2111. @end table
  2112. @end table
  2113. @section highpass
  2114. Apply a high-pass filter with 3dB point frequency.
  2115. The filter can be either single-pole, or double-pole (the default).
  2116. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2117. The filter accepts the following options:
  2118. @table @option
  2119. @item frequency, f
  2120. Set frequency in Hz. Default is 3000.
  2121. @item poles, p
  2122. Set number of poles. Default is 2.
  2123. @item width_type
  2124. Set method to specify band-width of filter.
  2125. @table @option
  2126. @item h
  2127. Hz
  2128. @item q
  2129. Q-Factor
  2130. @item o
  2131. octave
  2132. @item s
  2133. slope
  2134. @end table
  2135. @item width, w
  2136. Specify the band-width of a filter in width_type units.
  2137. Applies only to double-pole filter.
  2138. The default is 0.707q and gives a Butterworth response.
  2139. @end table
  2140. @section join
  2141. Join multiple input streams into one multi-channel stream.
  2142. It accepts the following parameters:
  2143. @table @option
  2144. @item inputs
  2145. The number of input streams. It defaults to 2.
  2146. @item channel_layout
  2147. The desired output channel layout. It defaults to stereo.
  2148. @item map
  2149. Map channels from inputs to output. The argument is a '|'-separated list of
  2150. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2151. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2152. can be either the name of the input channel (e.g. FL for front left) or its
  2153. index in the specified input stream. @var{out_channel} is the name of the output
  2154. channel.
  2155. @end table
  2156. The filter will attempt to guess the mappings when they are not specified
  2157. explicitly. It does so by first trying to find an unused matching input channel
  2158. and if that fails it picks the first unused input channel.
  2159. Join 3 inputs (with properly set channel layouts):
  2160. @example
  2161. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2162. @end example
  2163. Build a 5.1 output from 6 single-channel streams:
  2164. @example
  2165. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2166. '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'
  2167. out
  2168. @end example
  2169. @section ladspa
  2170. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2171. To enable compilation of this filter you need to configure FFmpeg with
  2172. @code{--enable-ladspa}.
  2173. @table @option
  2174. @item file, f
  2175. Specifies the name of LADSPA plugin library to load. If the environment
  2176. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2177. each one of the directories specified by the colon separated list in
  2178. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2179. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2180. @file{/usr/lib/ladspa/}.
  2181. @item plugin, p
  2182. Specifies the plugin within the library. Some libraries contain only
  2183. one plugin, but others contain many of them. If this is not set filter
  2184. will list all available plugins within the specified library.
  2185. @item controls, c
  2186. Set the '|' separated list of controls which are zero or more floating point
  2187. values that determine the behavior of the loaded plugin (for example delay,
  2188. threshold or gain).
  2189. Controls need to be defined using the following syntax:
  2190. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2191. @var{valuei} is the value set on the @var{i}-th control.
  2192. Alternatively they can be also defined using the following syntax:
  2193. @var{value0}|@var{value1}|@var{value2}|..., where
  2194. @var{valuei} is the value set on the @var{i}-th control.
  2195. If @option{controls} is set to @code{help}, all available controls and
  2196. their valid ranges are printed.
  2197. @item sample_rate, s
  2198. Specify the sample rate, default to 44100. Only used if plugin have
  2199. zero inputs.
  2200. @item nb_samples, n
  2201. Set the number of samples per channel per each output frame, default
  2202. is 1024. Only used if plugin have zero inputs.
  2203. @item duration, d
  2204. Set the minimum duration of the sourced audio. See
  2205. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2206. for the accepted syntax.
  2207. Note that the resulting duration may be greater than the specified duration,
  2208. as the generated audio is always cut at the end of a complete frame.
  2209. If not specified, or the expressed duration is negative, the audio is
  2210. supposed to be generated forever.
  2211. Only used if plugin have zero inputs.
  2212. @end table
  2213. @subsection Examples
  2214. @itemize
  2215. @item
  2216. List all available plugins within amp (LADSPA example plugin) library:
  2217. @example
  2218. ladspa=file=amp
  2219. @end example
  2220. @item
  2221. List all available controls and their valid ranges for @code{vcf_notch}
  2222. plugin from @code{VCF} library:
  2223. @example
  2224. ladspa=f=vcf:p=vcf_notch:c=help
  2225. @end example
  2226. @item
  2227. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2228. plugin library:
  2229. @example
  2230. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2231. @end example
  2232. @item
  2233. Add reverberation to the audio using TAP-plugins
  2234. (Tom's Audio Processing plugins):
  2235. @example
  2236. ladspa=file=tap_reverb:tap_reverb
  2237. @end example
  2238. @item
  2239. Generate white noise, with 0.2 amplitude:
  2240. @example
  2241. ladspa=file=cmt:noise_source_white:c=c0=.2
  2242. @end example
  2243. @item
  2244. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2245. @code{C* Audio Plugin Suite} (CAPS) library:
  2246. @example
  2247. ladspa=file=caps:Click:c=c1=20'
  2248. @end example
  2249. @item
  2250. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2251. @example
  2252. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2253. @end example
  2254. @item
  2255. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2256. @code{SWH Plugins} collection:
  2257. @example
  2258. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2259. @end example
  2260. @item
  2261. Attenuate low frequencies using Multiband EQ from Steve Harris
  2262. @code{SWH Plugins} collection:
  2263. @example
  2264. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2265. @end example
  2266. @end itemize
  2267. @subsection Commands
  2268. This filter supports the following commands:
  2269. @table @option
  2270. @item cN
  2271. Modify the @var{N}-th control value.
  2272. If the specified value is not valid, it is ignored and prior one is kept.
  2273. @end table
  2274. @section loudnorm
  2275. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2276. Support for both single pass (livestreams, files) and double pass (files) modes.
  2277. This algorithm can target IL, LRA, and maximum true peak.
  2278. To enable compilation of this filter you need to configure FFmpeg with
  2279. @code{--enable-libebur128}.
  2280. The filter accepts the following options:
  2281. @table @option
  2282. @item I, i
  2283. Set integrated loudness target.
  2284. Range is -70.0 - -5.0. Default value is -24.0.
  2285. @item LRA, lra
  2286. Set loudness range target.
  2287. Range is 1.0 - 20.0. Default value is 7.0.
  2288. @item TP, tp
  2289. Set maximum true peak.
  2290. Range is -9.0 - +0.0. Default value is -2.0.
  2291. @item measured_I, measured_i
  2292. Measured IL of input file.
  2293. Range is -99.0 - +0.0.
  2294. @item measured_LRA, measured_lra
  2295. Measured LRA of input file.
  2296. Range is 0.0 - 99.0.
  2297. @item measured_TP, measured_tp
  2298. Measured true peak of input file.
  2299. Range is -99.0 - +99.0.
  2300. @item measured_thresh
  2301. Measured threshold of input file.
  2302. Range is -99.0 - +0.0.
  2303. @item offset
  2304. Set offset gain. Gain is applied before the true-peak limiter.
  2305. Range is -99.0 - +99.0. Default is +0.0.
  2306. @item linear
  2307. Normalize linearly if possible.
  2308. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2309. to be specified in order to use this mode.
  2310. Options are true or false. Default is true.
  2311. @item dual_mono
  2312. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2313. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2314. If set to @code{true}, this option will compensate for this effect.
  2315. Multi-channel input files are not affected by this option.
  2316. Options are true or false. Default is false.
  2317. @item print_format
  2318. Set print format for stats. Options are summary, json, or none.
  2319. Default value is none.
  2320. @end table
  2321. @section lowpass
  2322. Apply a low-pass filter with 3dB point frequency.
  2323. The filter can be either single-pole or double-pole (the default).
  2324. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2325. The filter accepts the following options:
  2326. @table @option
  2327. @item frequency, f
  2328. Set frequency in Hz. Default is 500.
  2329. @item poles, p
  2330. Set number of poles. Default is 2.
  2331. @item width_type
  2332. Set method to specify band-width of filter.
  2333. @table @option
  2334. @item h
  2335. Hz
  2336. @item q
  2337. Q-Factor
  2338. @item o
  2339. octave
  2340. @item s
  2341. slope
  2342. @end table
  2343. @item width, w
  2344. Specify the band-width of a filter in width_type units.
  2345. Applies only to double-pole filter.
  2346. The default is 0.707q and gives a Butterworth response.
  2347. @end table
  2348. @anchor{pan}
  2349. @section pan
  2350. Mix channels with specific gain levels. The filter accepts the output
  2351. channel layout followed by a set of channels definitions.
  2352. This filter is also designed to efficiently remap the channels of an audio
  2353. stream.
  2354. The filter accepts parameters of the form:
  2355. "@var{l}|@var{outdef}|@var{outdef}|..."
  2356. @table @option
  2357. @item l
  2358. output channel layout or number of channels
  2359. @item outdef
  2360. output channel specification, of the form:
  2361. "@var{out_name}=[@var{gain}*]@var{in_name}[+[@var{gain}*]@var{in_name}...]"
  2362. @item out_name
  2363. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2364. number (c0, c1, etc.)
  2365. @item gain
  2366. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2367. @item in_name
  2368. input channel to use, see out_name for details; it is not possible to mix
  2369. named and numbered input channels
  2370. @end table
  2371. If the `=' in a channel specification is replaced by `<', then the gains for
  2372. that specification will be renormalized so that the total is 1, thus
  2373. avoiding clipping noise.
  2374. @subsection Mixing examples
  2375. For example, if you want to down-mix from stereo to mono, but with a bigger
  2376. factor for the left channel:
  2377. @example
  2378. pan=1c|c0=0.9*c0+0.1*c1
  2379. @end example
  2380. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2381. 7-channels surround:
  2382. @example
  2383. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2384. @end example
  2385. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2386. that should be preferred (see "-ac" option) unless you have very specific
  2387. needs.
  2388. @subsection Remapping examples
  2389. The channel remapping will be effective if, and only if:
  2390. @itemize
  2391. @item gain coefficients are zeroes or ones,
  2392. @item only one input per channel output,
  2393. @end itemize
  2394. If all these conditions are satisfied, the filter will notify the user ("Pure
  2395. channel mapping detected"), and use an optimized and lossless method to do the
  2396. remapping.
  2397. For example, if you have a 5.1 source and want a stereo audio stream by
  2398. dropping the extra channels:
  2399. @example
  2400. pan="stereo| c0=FL | c1=FR"
  2401. @end example
  2402. Given the same source, you can also switch front left and front right channels
  2403. and keep the input channel layout:
  2404. @example
  2405. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2406. @end example
  2407. If the input is a stereo audio stream, you can mute the front left channel (and
  2408. still keep the stereo channel layout) with:
  2409. @example
  2410. pan="stereo|c1=c1"
  2411. @end example
  2412. Still with a stereo audio stream input, you can copy the right channel in both
  2413. front left and right:
  2414. @example
  2415. pan="stereo| c0=FR | c1=FR"
  2416. @end example
  2417. @section replaygain
  2418. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2419. outputs it unchanged.
  2420. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2421. @section resample
  2422. Convert the audio sample format, sample rate and channel layout. It is
  2423. not meant to be used directly.
  2424. @section rubberband
  2425. Apply time-stretching and pitch-shifting with librubberband.
  2426. The filter accepts the following options:
  2427. @table @option
  2428. @item tempo
  2429. Set tempo scale factor.
  2430. @item pitch
  2431. Set pitch scale factor.
  2432. @item transients
  2433. Set transients detector.
  2434. Possible values are:
  2435. @table @var
  2436. @item crisp
  2437. @item mixed
  2438. @item smooth
  2439. @end table
  2440. @item detector
  2441. Set detector.
  2442. Possible values are:
  2443. @table @var
  2444. @item compound
  2445. @item percussive
  2446. @item soft
  2447. @end table
  2448. @item phase
  2449. Set phase.
  2450. Possible values are:
  2451. @table @var
  2452. @item laminar
  2453. @item independent
  2454. @end table
  2455. @item window
  2456. Set processing window size.
  2457. Possible values are:
  2458. @table @var
  2459. @item standard
  2460. @item short
  2461. @item long
  2462. @end table
  2463. @item smoothing
  2464. Set smoothing.
  2465. Possible values are:
  2466. @table @var
  2467. @item off
  2468. @item on
  2469. @end table
  2470. @item formant
  2471. Enable formant preservation when shift pitching.
  2472. Possible values are:
  2473. @table @var
  2474. @item shifted
  2475. @item preserved
  2476. @end table
  2477. @item pitchq
  2478. Set pitch quality.
  2479. Possible values are:
  2480. @table @var
  2481. @item quality
  2482. @item speed
  2483. @item consistency
  2484. @end table
  2485. @item channels
  2486. Set channels.
  2487. Possible values are:
  2488. @table @var
  2489. @item apart
  2490. @item together
  2491. @end table
  2492. @end table
  2493. @section sidechaincompress
  2494. This filter acts like normal compressor but has the ability to compress
  2495. detected signal using second input signal.
  2496. It needs two input streams and returns one output stream.
  2497. First input stream will be processed depending on second stream signal.
  2498. The filtered signal then can be filtered with other filters in later stages of
  2499. processing. See @ref{pan} and @ref{amerge} filter.
  2500. The filter accepts the following options:
  2501. @table @option
  2502. @item level_in
  2503. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2504. @item threshold
  2505. If a signal of second stream raises above this level it will affect the gain
  2506. reduction of first stream.
  2507. By default is 0.125. Range is between 0.00097563 and 1.
  2508. @item ratio
  2509. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2510. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2511. Default is 2. Range is between 1 and 20.
  2512. @item attack
  2513. Amount of milliseconds the signal has to rise above the threshold before gain
  2514. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2515. @item release
  2516. Amount of milliseconds the signal has to fall below the threshold before
  2517. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2518. @item makeup
  2519. Set the amount by how much signal will be amplified after processing.
  2520. Default is 2. Range is from 1 and 64.
  2521. @item knee
  2522. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2523. Default is 2.82843. Range is between 1 and 8.
  2524. @item link
  2525. Choose if the @code{average} level between all channels of side-chain stream
  2526. or the louder(@code{maximum}) channel of side-chain stream affects the
  2527. reduction. Default is @code{average}.
  2528. @item detection
  2529. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2530. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2531. @item level_sc
  2532. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2533. @item mix
  2534. How much to use compressed signal in output. Default is 1.
  2535. Range is between 0 and 1.
  2536. @end table
  2537. @subsection Examples
  2538. @itemize
  2539. @item
  2540. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2541. depending on the signal of 2nd input and later compressed signal to be
  2542. merged with 2nd input:
  2543. @example
  2544. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2545. @end example
  2546. @end itemize
  2547. @section sidechaingate
  2548. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2549. filter the detected signal before sending it to the gain reduction stage.
  2550. Normally a gate uses the full range signal to detect a level above the
  2551. threshold.
  2552. For example: If you cut all lower frequencies from your sidechain signal
  2553. the gate will decrease the volume of your track only if not enough highs
  2554. appear. With this technique you are able to reduce the resonation of a
  2555. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2556. guitar.
  2557. It needs two input streams and returns one output stream.
  2558. First input stream will be processed depending on second stream signal.
  2559. The filter accepts the following options:
  2560. @table @option
  2561. @item level_in
  2562. Set input level before filtering.
  2563. Default is 1. Allowed range is from 0.015625 to 64.
  2564. @item range
  2565. Set the level of gain reduction when the signal is below the threshold.
  2566. Default is 0.06125. Allowed range is from 0 to 1.
  2567. @item threshold
  2568. If a signal rises above this level the gain reduction is released.
  2569. Default is 0.125. Allowed range is from 0 to 1.
  2570. @item ratio
  2571. Set a ratio about which the signal is reduced.
  2572. Default is 2. Allowed range is from 1 to 9000.
  2573. @item attack
  2574. Amount of milliseconds the signal has to rise above the threshold before gain
  2575. reduction stops.
  2576. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2577. @item release
  2578. Amount of milliseconds the signal has to fall below the threshold before the
  2579. reduction is increased again. Default is 250 milliseconds.
  2580. Allowed range is from 0.01 to 9000.
  2581. @item makeup
  2582. Set amount of amplification of signal after processing.
  2583. Default is 1. Allowed range is from 1 to 64.
  2584. @item knee
  2585. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2586. Default is 2.828427125. Allowed range is from 1 to 8.
  2587. @item detection
  2588. Choose if exact signal should be taken for detection or an RMS like one.
  2589. Default is rms. Can be peak or rms.
  2590. @item link
  2591. Choose if the average level between all channels or the louder channel affects
  2592. the reduction.
  2593. Default is average. Can be average or maximum.
  2594. @item level_sc
  2595. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2596. @end table
  2597. @section silencedetect
  2598. Detect silence in an audio stream.
  2599. This filter logs a message when it detects that the input audio volume is less
  2600. or equal to a noise tolerance value for a duration greater or equal to the
  2601. minimum detected noise duration.
  2602. The printed times and duration are expressed in seconds.
  2603. The filter accepts the following options:
  2604. @table @option
  2605. @item duration, d
  2606. Set silence duration until notification (default is 2 seconds).
  2607. @item noise, n
  2608. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2609. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2610. @end table
  2611. @subsection Examples
  2612. @itemize
  2613. @item
  2614. Detect 5 seconds of silence with -50dB noise tolerance:
  2615. @example
  2616. silencedetect=n=-50dB:d=5
  2617. @end example
  2618. @item
  2619. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2620. tolerance in @file{silence.mp3}:
  2621. @example
  2622. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2623. @end example
  2624. @end itemize
  2625. @section silenceremove
  2626. Remove silence from the beginning, middle or end of the audio.
  2627. The filter accepts the following options:
  2628. @table @option
  2629. @item start_periods
  2630. This value is used to indicate if audio should be trimmed at beginning of
  2631. the audio. A value of zero indicates no silence should be trimmed from the
  2632. beginning. When specifying a non-zero value, it trims audio up until it
  2633. finds non-silence. Normally, when trimming silence from beginning of audio
  2634. the @var{start_periods} will be @code{1} but it can be increased to higher
  2635. values to trim all audio up to specific count of non-silence periods.
  2636. Default value is @code{0}.
  2637. @item start_duration
  2638. Specify the amount of time that non-silence must be detected before it stops
  2639. trimming audio. By increasing the duration, bursts of noises can be treated
  2640. as silence and trimmed off. Default value is @code{0}.
  2641. @item start_threshold
  2642. This indicates what sample value should be treated as silence. For digital
  2643. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2644. you may wish to increase the value to account for background noise.
  2645. Can be specified in dB (in case "dB" is appended to the specified value)
  2646. or amplitude ratio. Default value is @code{0}.
  2647. @item stop_periods
  2648. Set the count for trimming silence from the end of audio.
  2649. To remove silence from the middle of a file, specify a @var{stop_periods}
  2650. that is negative. This value is then treated as a positive value and is
  2651. used to indicate the effect should restart processing as specified by
  2652. @var{start_periods}, making it suitable for removing periods of silence
  2653. in the middle of the audio.
  2654. Default value is @code{0}.
  2655. @item stop_duration
  2656. Specify a duration of silence that must exist before audio is not copied any
  2657. more. By specifying a higher duration, silence that is wanted can be left in
  2658. the audio.
  2659. Default value is @code{0}.
  2660. @item stop_threshold
  2661. This is the same as @option{start_threshold} but for trimming silence from
  2662. the end of audio.
  2663. Can be specified in dB (in case "dB" is appended to the specified value)
  2664. or amplitude ratio. Default value is @code{0}.
  2665. @item leave_silence
  2666. This indicate that @var{stop_duration} length of audio should be left intact
  2667. at the beginning of each period of silence.
  2668. For example, if you want to remove long pauses between words but do not want
  2669. to remove the pauses completely. Default value is @code{0}.
  2670. @item detection
  2671. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  2672. and works better with digital silence which is exactly 0.
  2673. Default value is @code{rms}.
  2674. @item window
  2675. Set ratio used to calculate size of window for detecting silence.
  2676. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  2677. @end table
  2678. @subsection Examples
  2679. @itemize
  2680. @item
  2681. The following example shows how this filter can be used to start a recording
  2682. that does not contain the delay at the start which usually occurs between
  2683. pressing the record button and the start of the performance:
  2684. @example
  2685. silenceremove=1:5:0.02
  2686. @end example
  2687. @item
  2688. Trim all silence encountered from beginning to end where there is more than 1
  2689. second of silence in audio:
  2690. @example
  2691. silenceremove=0:0:0:-1:1:-90dB
  2692. @end example
  2693. @end itemize
  2694. @section sofalizer
  2695. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  2696. loudspeakers around the user for binaural listening via headphones (audio
  2697. formats up to 9 channels supported).
  2698. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  2699. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  2700. Austrian Academy of Sciences.
  2701. To enable compilation of this filter you need to configure FFmpeg with
  2702. @code{--enable-netcdf}.
  2703. The filter accepts the following options:
  2704. @table @option
  2705. @item sofa
  2706. Set the SOFA file used for rendering.
  2707. @item gain
  2708. Set gain applied to audio. Value is in dB. Default is 0.
  2709. @item rotation
  2710. Set rotation of virtual loudspeakers in deg. Default is 0.
  2711. @item elevation
  2712. Set elevation of virtual speakers in deg. Default is 0.
  2713. @item radius
  2714. Set distance in meters between loudspeakers and the listener with near-field
  2715. HRTFs. Default is 1.
  2716. @item type
  2717. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2718. processing audio in time domain which is slow.
  2719. @var{freq} is processing audio in frequency domain which is fast.
  2720. Default is @var{freq}.
  2721. @item speakers
  2722. Set custom positions of virtual loudspeakers. Syntax for this option is:
  2723. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  2724. Each virtual loudspeaker is described with short channel name following with
  2725. azimuth and elevation in degreees.
  2726. Each virtual loudspeaker description is separated by '|'.
  2727. For example to override front left and front right channel positions use:
  2728. 'speakers=FL 45 15|FR 345 15'.
  2729. Descriptions with unrecognised channel names are ignored.
  2730. @end table
  2731. @subsection Examples
  2732. @itemize
  2733. @item
  2734. Using ClubFritz6 sofa file:
  2735. @example
  2736. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  2737. @end example
  2738. @item
  2739. Using ClubFritz12 sofa file and bigger radius with small rotation:
  2740. @example
  2741. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  2742. @end example
  2743. @item
  2744. Similar as above but with custom speaker positions for front left, front right, rear left and rear right
  2745. and also with custom gain:
  2746. @example
  2747. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|RL 135|RR 225:gain=28"
  2748. @end example
  2749. @end itemize
  2750. @section stereotools
  2751. This filter has some handy utilities to manage stereo signals, for converting
  2752. M/S stereo recordings to L/R signal while having control over the parameters
  2753. or spreading the stereo image of master track.
  2754. The filter accepts the following options:
  2755. @table @option
  2756. @item level_in
  2757. Set input level before filtering for both channels. Defaults is 1.
  2758. Allowed range is from 0.015625 to 64.
  2759. @item level_out
  2760. Set output level after filtering for both channels. Defaults is 1.
  2761. Allowed range is from 0.015625 to 64.
  2762. @item balance_in
  2763. Set input balance between both channels. Default is 0.
  2764. Allowed range is from -1 to 1.
  2765. @item balance_out
  2766. Set output balance between both channels. Default is 0.
  2767. Allowed range is from -1 to 1.
  2768. @item softclip
  2769. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  2770. clipping. Disabled by default.
  2771. @item mutel
  2772. Mute the left channel. Disabled by default.
  2773. @item muter
  2774. Mute the right channel. Disabled by default.
  2775. @item phasel
  2776. Change the phase of the left channel. Disabled by default.
  2777. @item phaser
  2778. Change the phase of the right channel. Disabled by default.
  2779. @item mode
  2780. Set stereo mode. Available values are:
  2781. @table @samp
  2782. @item lr>lr
  2783. Left/Right to Left/Right, this is default.
  2784. @item lr>ms
  2785. Left/Right to Mid/Side.
  2786. @item ms>lr
  2787. Mid/Side to Left/Right.
  2788. @item lr>ll
  2789. Left/Right to Left/Left.
  2790. @item lr>rr
  2791. Left/Right to Right/Right.
  2792. @item lr>l+r
  2793. Left/Right to Left + Right.
  2794. @item lr>rl
  2795. Left/Right to Right/Left.
  2796. @end table
  2797. @item slev
  2798. Set level of side signal. Default is 1.
  2799. Allowed range is from 0.015625 to 64.
  2800. @item sbal
  2801. Set balance of side signal. Default is 0.
  2802. Allowed range is from -1 to 1.
  2803. @item mlev
  2804. Set level of the middle signal. Default is 1.
  2805. Allowed range is from 0.015625 to 64.
  2806. @item mpan
  2807. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  2808. @item base
  2809. Set stereo base between mono and inversed channels. Default is 0.
  2810. Allowed range is from -1 to 1.
  2811. @item delay
  2812. Set delay in milliseconds how much to delay left from right channel and
  2813. vice versa. Default is 0. Allowed range is from -20 to 20.
  2814. @item sclevel
  2815. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  2816. @item phase
  2817. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  2818. @end table
  2819. @subsection Examples
  2820. @itemize
  2821. @item
  2822. Apply karaoke like effect:
  2823. @example
  2824. stereotools=mlev=0.015625
  2825. @end example
  2826. @item
  2827. Convert M/S signal to L/R:
  2828. @example
  2829. "stereotools=mode=ms>lr"
  2830. @end example
  2831. @end itemize
  2832. @section stereowiden
  2833. This filter enhance the stereo effect by suppressing signal common to both
  2834. channels and by delaying the signal of left into right and vice versa,
  2835. thereby widening the stereo effect.
  2836. The filter accepts the following options:
  2837. @table @option
  2838. @item delay
  2839. Time in milliseconds of the delay of left signal into right and vice versa.
  2840. Default is 20 milliseconds.
  2841. @item feedback
  2842. Amount of gain in delayed signal into right and vice versa. Gives a delay
  2843. effect of left signal in right output and vice versa which gives widening
  2844. effect. Default is 0.3.
  2845. @item crossfeed
  2846. Cross feed of left into right with inverted phase. This helps in suppressing
  2847. the mono. If the value is 1 it will cancel all the signal common to both
  2848. channels. Default is 0.3.
  2849. @item drymix
  2850. Set level of input signal of original channel. Default is 0.8.
  2851. @end table
  2852. @section treble
  2853. Boost or cut treble (upper) frequencies of the audio using a two-pole
  2854. shelving filter with a response similar to that of a standard
  2855. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  2856. The filter accepts the following options:
  2857. @table @option
  2858. @item gain, g
  2859. Give the gain at whichever is the lower of ~22 kHz and the
  2860. Nyquist frequency. Its useful range is about -20 (for a large cut)
  2861. to +20 (for a large boost). Beware of clipping when using a positive gain.
  2862. @item frequency, f
  2863. Set the filter's central frequency and so can be used
  2864. to extend or reduce the frequency range to be boosted or cut.
  2865. The default value is @code{3000} Hz.
  2866. @item width_type
  2867. Set method to specify band-width of filter.
  2868. @table @option
  2869. @item h
  2870. Hz
  2871. @item q
  2872. Q-Factor
  2873. @item o
  2874. octave
  2875. @item s
  2876. slope
  2877. @end table
  2878. @item width, w
  2879. Determine how steep is the filter's shelf transition.
  2880. @end table
  2881. @section tremolo
  2882. Sinusoidal amplitude modulation.
  2883. The filter accepts the following options:
  2884. @table @option
  2885. @item f
  2886. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  2887. (20 Hz or lower) will result in a tremolo effect.
  2888. This filter may also be used as a ring modulator by specifying
  2889. a modulation frequency higher than 20 Hz.
  2890. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2891. @item d
  2892. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2893. Default value is 0.5.
  2894. @end table
  2895. @section vibrato
  2896. Sinusoidal phase modulation.
  2897. The filter accepts the following options:
  2898. @table @option
  2899. @item f
  2900. Modulation frequency in Hertz.
  2901. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  2902. @item d
  2903. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  2904. Default value is 0.5.
  2905. @end table
  2906. @section volume
  2907. Adjust the input audio volume.
  2908. It accepts the following parameters:
  2909. @table @option
  2910. @item volume
  2911. Set audio volume expression.
  2912. Output values are clipped to the maximum value.
  2913. The output audio volume is given by the relation:
  2914. @example
  2915. @var{output_volume} = @var{volume} * @var{input_volume}
  2916. @end example
  2917. The default value for @var{volume} is "1.0".
  2918. @item precision
  2919. This parameter represents the mathematical precision.
  2920. It determines which input sample formats will be allowed, which affects the
  2921. precision of the volume scaling.
  2922. @table @option
  2923. @item fixed
  2924. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  2925. @item float
  2926. 32-bit floating-point; this limits input sample format to FLT. (default)
  2927. @item double
  2928. 64-bit floating-point; this limits input sample format to DBL.
  2929. @end table
  2930. @item replaygain
  2931. Choose the behaviour on encountering ReplayGain side data in input frames.
  2932. @table @option
  2933. @item drop
  2934. Remove ReplayGain side data, ignoring its contents (the default).
  2935. @item ignore
  2936. Ignore ReplayGain side data, but leave it in the frame.
  2937. @item track
  2938. Prefer the track gain, if present.
  2939. @item album
  2940. Prefer the album gain, if present.
  2941. @end table
  2942. @item replaygain_preamp
  2943. Pre-amplification gain in dB to apply to the selected replaygain gain.
  2944. Default value for @var{replaygain_preamp} is 0.0.
  2945. @item eval
  2946. Set when the volume expression is evaluated.
  2947. It accepts the following values:
  2948. @table @samp
  2949. @item once
  2950. only evaluate expression once during the filter initialization, or
  2951. when the @samp{volume} command is sent
  2952. @item frame
  2953. evaluate expression for each incoming frame
  2954. @end table
  2955. Default value is @samp{once}.
  2956. @end table
  2957. The volume expression can contain the following parameters.
  2958. @table @option
  2959. @item n
  2960. frame number (starting at zero)
  2961. @item nb_channels
  2962. number of channels
  2963. @item nb_consumed_samples
  2964. number of samples consumed by the filter
  2965. @item nb_samples
  2966. number of samples in the current frame
  2967. @item pos
  2968. original frame position in the file
  2969. @item pts
  2970. frame PTS
  2971. @item sample_rate
  2972. sample rate
  2973. @item startpts
  2974. PTS at start of stream
  2975. @item startt
  2976. time at start of stream
  2977. @item t
  2978. frame time
  2979. @item tb
  2980. timestamp timebase
  2981. @item volume
  2982. last set volume value
  2983. @end table
  2984. Note that when @option{eval} is set to @samp{once} only the
  2985. @var{sample_rate} and @var{tb} variables are available, all other
  2986. variables will evaluate to NAN.
  2987. @subsection Commands
  2988. This filter supports the following commands:
  2989. @table @option
  2990. @item volume
  2991. Modify the volume expression.
  2992. The command accepts the same syntax of the corresponding option.
  2993. If the specified expression is not valid, it is kept at its current
  2994. value.
  2995. @item replaygain_noclip
  2996. Prevent clipping by limiting the gain applied.
  2997. Default value for @var{replaygain_noclip} is 1.
  2998. @end table
  2999. @subsection Examples
  3000. @itemize
  3001. @item
  3002. Halve the input audio volume:
  3003. @example
  3004. volume=volume=0.5
  3005. volume=volume=1/2
  3006. volume=volume=-6.0206dB
  3007. @end example
  3008. In all the above example the named key for @option{volume} can be
  3009. omitted, for example like in:
  3010. @example
  3011. volume=0.5
  3012. @end example
  3013. @item
  3014. Increase input audio power by 6 decibels using fixed-point precision:
  3015. @example
  3016. volume=volume=6dB:precision=fixed
  3017. @end example
  3018. @item
  3019. Fade volume after time 10 with an annihilation period of 5 seconds:
  3020. @example
  3021. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3022. @end example
  3023. @end itemize
  3024. @section volumedetect
  3025. Detect the volume of the input video.
  3026. The filter has no parameters. The input is not modified. Statistics about
  3027. the volume will be printed in the log when the input stream end is reached.
  3028. In particular it will show the mean volume (root mean square), maximum
  3029. volume (on a per-sample basis), and the beginning of a histogram of the
  3030. registered volume values (from the maximum value to a cumulated 1/1000 of
  3031. the samples).
  3032. All volumes are in decibels relative to the maximum PCM value.
  3033. @subsection Examples
  3034. Here is an excerpt of the output:
  3035. @example
  3036. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3037. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3038. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3039. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3040. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3041. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3042. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3043. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3044. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3045. @end example
  3046. It means that:
  3047. @itemize
  3048. @item
  3049. The mean square energy is approximately -27 dB, or 10^-2.7.
  3050. @item
  3051. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3052. @item
  3053. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3054. @end itemize
  3055. In other words, raising the volume by +4 dB does not cause any clipping,
  3056. raising it by +5 dB causes clipping for 6 samples, etc.
  3057. @c man end AUDIO FILTERS
  3058. @chapter Audio Sources
  3059. @c man begin AUDIO SOURCES
  3060. Below is a description of the currently available audio sources.
  3061. @section abuffer
  3062. Buffer audio frames, and make them available to the filter chain.
  3063. This source is mainly intended for a programmatic use, in particular
  3064. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3065. It accepts the following parameters:
  3066. @table @option
  3067. @item time_base
  3068. The timebase which will be used for timestamps of submitted frames. It must be
  3069. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3070. @item sample_rate
  3071. The sample rate of the incoming audio buffers.
  3072. @item sample_fmt
  3073. The sample format of the incoming audio buffers.
  3074. Either a sample format name or its corresponding integer representation from
  3075. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3076. @item channel_layout
  3077. The channel layout of the incoming audio buffers.
  3078. Either a channel layout name from channel_layout_map in
  3079. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3080. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3081. @item channels
  3082. The number of channels of the incoming audio buffers.
  3083. If both @var{channels} and @var{channel_layout} are specified, then they
  3084. must be consistent.
  3085. @end table
  3086. @subsection Examples
  3087. @example
  3088. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3089. @end example
  3090. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3091. Since the sample format with name "s16p" corresponds to the number
  3092. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3093. equivalent to:
  3094. @example
  3095. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3096. @end example
  3097. @section aevalsrc
  3098. Generate an audio signal specified by an expression.
  3099. This source accepts in input one or more expressions (one for each
  3100. channel), which are evaluated and used to generate a corresponding
  3101. audio signal.
  3102. This source accepts the following options:
  3103. @table @option
  3104. @item exprs
  3105. Set the '|'-separated expressions list for each separate channel. In case the
  3106. @option{channel_layout} option is not specified, the selected channel layout
  3107. depends on the number of provided expressions. Otherwise the last
  3108. specified expression is applied to the remaining output channels.
  3109. @item channel_layout, c
  3110. Set the channel layout. The number of channels in the specified layout
  3111. must be equal to the number of specified expressions.
  3112. @item duration, d
  3113. Set the minimum duration of the sourced audio. See
  3114. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3115. for the accepted syntax.
  3116. Note that the resulting duration may be greater than the specified
  3117. duration, as the generated audio is always cut at the end of a
  3118. complete frame.
  3119. If not specified, or the expressed duration is negative, the audio is
  3120. supposed to be generated forever.
  3121. @item nb_samples, n
  3122. Set the number of samples per channel per each output frame,
  3123. default to 1024.
  3124. @item sample_rate, s
  3125. Specify the sample rate, default to 44100.
  3126. @end table
  3127. Each expression in @var{exprs} can contain the following constants:
  3128. @table @option
  3129. @item n
  3130. number of the evaluated sample, starting from 0
  3131. @item t
  3132. time of the evaluated sample expressed in seconds, starting from 0
  3133. @item s
  3134. sample rate
  3135. @end table
  3136. @subsection Examples
  3137. @itemize
  3138. @item
  3139. Generate silence:
  3140. @example
  3141. aevalsrc=0
  3142. @end example
  3143. @item
  3144. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3145. 8000 Hz:
  3146. @example
  3147. aevalsrc="sin(440*2*PI*t):s=8000"
  3148. @end example
  3149. @item
  3150. Generate a two channels signal, specify the channel layout (Front
  3151. Center + Back Center) explicitly:
  3152. @example
  3153. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3154. @end example
  3155. @item
  3156. Generate white noise:
  3157. @example
  3158. aevalsrc="-2+random(0)"
  3159. @end example
  3160. @item
  3161. Generate an amplitude modulated signal:
  3162. @example
  3163. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3164. @end example
  3165. @item
  3166. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3167. @example
  3168. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3169. @end example
  3170. @end itemize
  3171. @section anullsrc
  3172. The null audio source, return unprocessed audio frames. It is mainly useful
  3173. as a template and to be employed in analysis / debugging tools, or as
  3174. the source for filters which ignore the input data (for example the sox
  3175. synth filter).
  3176. This source accepts the following options:
  3177. @table @option
  3178. @item channel_layout, cl
  3179. Specifies the channel layout, and can be either an integer or a string
  3180. representing a channel layout. The default value of @var{channel_layout}
  3181. is "stereo".
  3182. Check the channel_layout_map definition in
  3183. @file{libavutil/channel_layout.c} for the mapping between strings and
  3184. channel layout values.
  3185. @item sample_rate, r
  3186. Specifies the sample rate, and defaults to 44100.
  3187. @item nb_samples, n
  3188. Set the number of samples per requested frames.
  3189. @end table
  3190. @subsection Examples
  3191. @itemize
  3192. @item
  3193. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3194. @example
  3195. anullsrc=r=48000:cl=4
  3196. @end example
  3197. @item
  3198. Do the same operation with a more obvious syntax:
  3199. @example
  3200. anullsrc=r=48000:cl=mono
  3201. @end example
  3202. @end itemize
  3203. All the parameters need to be explicitly defined.
  3204. @section flite
  3205. Synthesize a voice utterance using the libflite library.
  3206. To enable compilation of this filter you need to configure FFmpeg with
  3207. @code{--enable-libflite}.
  3208. Note that the flite library is not thread-safe.
  3209. The filter accepts the following options:
  3210. @table @option
  3211. @item list_voices
  3212. If set to 1, list the names of the available voices and exit
  3213. immediately. Default value is 0.
  3214. @item nb_samples, n
  3215. Set the maximum number of samples per frame. Default value is 512.
  3216. @item textfile
  3217. Set the filename containing the text to speak.
  3218. @item text
  3219. Set the text to speak.
  3220. @item voice, v
  3221. Set the voice to use for the speech synthesis. Default value is
  3222. @code{kal}. See also the @var{list_voices} option.
  3223. @end table
  3224. @subsection Examples
  3225. @itemize
  3226. @item
  3227. Read from file @file{speech.txt}, and synthesize the text using the
  3228. standard flite voice:
  3229. @example
  3230. flite=textfile=speech.txt
  3231. @end example
  3232. @item
  3233. Read the specified text selecting the @code{slt} voice:
  3234. @example
  3235. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3236. @end example
  3237. @item
  3238. Input text to ffmpeg:
  3239. @example
  3240. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3241. @end example
  3242. @item
  3243. Make @file{ffplay} speak the specified text, using @code{flite} and
  3244. the @code{lavfi} device:
  3245. @example
  3246. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3247. @end example
  3248. @end itemize
  3249. For more information about libflite, check:
  3250. @url{http://www.speech.cs.cmu.edu/flite/}
  3251. @section anoisesrc
  3252. Generate a noise audio signal.
  3253. The filter accepts the following options:
  3254. @table @option
  3255. @item sample_rate, r
  3256. Specify the sample rate. Default value is 48000 Hz.
  3257. @item amplitude, a
  3258. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3259. is 1.0.
  3260. @item duration, d
  3261. Specify the duration of the generated audio stream. Not specifying this option
  3262. results in noise with an infinite length.
  3263. @item color, colour, c
  3264. Specify the color of noise. Available noise colors are white, pink, and brown.
  3265. Default color is white.
  3266. @item seed, s
  3267. Specify a value used to seed the PRNG.
  3268. @item nb_samples, n
  3269. Set the number of samples per each output frame, default is 1024.
  3270. @end table
  3271. @subsection Examples
  3272. @itemize
  3273. @item
  3274. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3275. @example
  3276. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3277. @end example
  3278. @end itemize
  3279. @section sine
  3280. Generate an audio signal made of a sine wave with amplitude 1/8.
  3281. The audio signal is bit-exact.
  3282. The filter accepts the following options:
  3283. @table @option
  3284. @item frequency, f
  3285. Set the carrier frequency. Default is 440 Hz.
  3286. @item beep_factor, b
  3287. Enable a periodic beep every second with frequency @var{beep_factor} times
  3288. the carrier frequency. Default is 0, meaning the beep is disabled.
  3289. @item sample_rate, r
  3290. Specify the sample rate, default is 44100.
  3291. @item duration, d
  3292. Specify the duration of the generated audio stream.
  3293. @item samples_per_frame
  3294. Set the number of samples per output frame.
  3295. The expression can contain the following constants:
  3296. @table @option
  3297. @item n
  3298. The (sequential) number of the output audio frame, starting from 0.
  3299. @item pts
  3300. The PTS (Presentation TimeStamp) of the output audio frame,
  3301. expressed in @var{TB} units.
  3302. @item t
  3303. The PTS of the output audio frame, expressed in seconds.
  3304. @item TB
  3305. The timebase of the output audio frames.
  3306. @end table
  3307. Default is @code{1024}.
  3308. @end table
  3309. @subsection Examples
  3310. @itemize
  3311. @item
  3312. Generate a simple 440 Hz sine wave:
  3313. @example
  3314. sine
  3315. @end example
  3316. @item
  3317. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3318. @example
  3319. sine=220:4:d=5
  3320. sine=f=220:b=4:d=5
  3321. sine=frequency=220:beep_factor=4:duration=5
  3322. @end example
  3323. @item
  3324. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3325. pattern:
  3326. @example
  3327. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3328. @end example
  3329. @end itemize
  3330. @c man end AUDIO SOURCES
  3331. @chapter Audio Sinks
  3332. @c man begin AUDIO SINKS
  3333. Below is a description of the currently available audio sinks.
  3334. @section abuffersink
  3335. Buffer audio frames, and make them available to the end of filter chain.
  3336. This sink is mainly intended for programmatic use, in particular
  3337. through the interface defined in @file{libavfilter/buffersink.h}
  3338. or the options system.
  3339. It accepts a pointer to an AVABufferSinkContext structure, which
  3340. defines the incoming buffers' formats, to be passed as the opaque
  3341. parameter to @code{avfilter_init_filter} for initialization.
  3342. @section anullsink
  3343. Null audio sink; do absolutely nothing with the input audio. It is
  3344. mainly useful as a template and for use in analysis / debugging
  3345. tools.
  3346. @c man end AUDIO SINKS
  3347. @chapter Video Filters
  3348. @c man begin VIDEO FILTERS
  3349. When you configure your FFmpeg build, you can disable any of the
  3350. existing filters using @code{--disable-filters}.
  3351. The configure output will show the video filters included in your
  3352. build.
  3353. Below is a description of the currently available video filters.
  3354. @section alphaextract
  3355. Extract the alpha component from the input as a grayscale video. This
  3356. is especially useful with the @var{alphamerge} filter.
  3357. @section alphamerge
  3358. Add or replace the alpha component of the primary input with the
  3359. grayscale value of a second input. This is intended for use with
  3360. @var{alphaextract} to allow the transmission or storage of frame
  3361. sequences that have alpha in a format that doesn't support an alpha
  3362. channel.
  3363. For example, to reconstruct full frames from a normal YUV-encoded video
  3364. and a separate video created with @var{alphaextract}, you might use:
  3365. @example
  3366. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3367. @end example
  3368. Since this filter is designed for reconstruction, it operates on frame
  3369. sequences without considering timestamps, and terminates when either
  3370. input reaches end of stream. This will cause problems if your encoding
  3371. pipeline drops frames. If you're trying to apply an image as an
  3372. overlay to a video stream, consider the @var{overlay} filter instead.
  3373. @section ass
  3374. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3375. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3376. Substation Alpha) subtitles files.
  3377. This filter accepts the following option in addition to the common options from
  3378. the @ref{subtitles} filter:
  3379. @table @option
  3380. @item shaping
  3381. Set the shaping engine
  3382. Available values are:
  3383. @table @samp
  3384. @item auto
  3385. The default libass shaping engine, which is the best available.
  3386. @item simple
  3387. Fast, font-agnostic shaper that can do only substitutions
  3388. @item complex
  3389. Slower shaper using OpenType for substitutions and positioning
  3390. @end table
  3391. The default is @code{auto}.
  3392. @end table
  3393. @section atadenoise
  3394. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3395. The filter accepts the following options:
  3396. @table @option
  3397. @item 0a
  3398. Set threshold A for 1st plane. Default is 0.02.
  3399. Valid range is 0 to 0.3.
  3400. @item 0b
  3401. Set threshold B for 1st plane. Default is 0.04.
  3402. Valid range is 0 to 5.
  3403. @item 1a
  3404. Set threshold A for 2nd plane. Default is 0.02.
  3405. Valid range is 0 to 0.3.
  3406. @item 1b
  3407. Set threshold B for 2nd plane. Default is 0.04.
  3408. Valid range is 0 to 5.
  3409. @item 2a
  3410. Set threshold A for 3rd plane. Default is 0.02.
  3411. Valid range is 0 to 0.3.
  3412. @item 2b
  3413. Set threshold B for 3rd plane. Default is 0.04.
  3414. Valid range is 0 to 5.
  3415. Threshold A is designed to react on abrupt changes in the input signal and
  3416. threshold B is designed to react on continuous changes in the input signal.
  3417. @item s
  3418. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3419. number in range [5, 129].
  3420. @end table
  3421. @section bbox
  3422. Compute the bounding box for the non-black pixels in the input frame
  3423. luminance plane.
  3424. This filter computes the bounding box containing all the pixels with a
  3425. luminance value greater than the minimum allowed value.
  3426. The parameters describing the bounding box are printed on the filter
  3427. log.
  3428. The filter accepts the following option:
  3429. @table @option
  3430. @item min_val
  3431. Set the minimal luminance value. Default is @code{16}.
  3432. @end table
  3433. @section bitplanenoise
  3434. Show and measure bit plane noise.
  3435. The filter accepts the following options:
  3436. @table @option
  3437. @item bitplane
  3438. Set which plane to analyze. Default is @code{1}.
  3439. @item filter
  3440. Filter out noisy pixels from @code{bitplane} set above.
  3441. Default is disabled.
  3442. @end table
  3443. @section blackdetect
  3444. Detect video intervals that are (almost) completely black. Can be
  3445. useful to detect chapter transitions, commercials, or invalid
  3446. recordings. Output lines contains the time for the start, end and
  3447. duration of the detected black interval expressed in seconds.
  3448. In order to display the output lines, you need to set the loglevel at
  3449. least to the AV_LOG_INFO value.
  3450. The filter accepts the following options:
  3451. @table @option
  3452. @item black_min_duration, d
  3453. Set the minimum detected black duration expressed in seconds. It must
  3454. be a non-negative floating point number.
  3455. Default value is 2.0.
  3456. @item picture_black_ratio_th, pic_th
  3457. Set the threshold for considering a picture "black".
  3458. Express the minimum value for the ratio:
  3459. @example
  3460. @var{nb_black_pixels} / @var{nb_pixels}
  3461. @end example
  3462. for which a picture is considered black.
  3463. Default value is 0.98.
  3464. @item pixel_black_th, pix_th
  3465. Set the threshold for considering a pixel "black".
  3466. The threshold expresses the maximum pixel luminance value for which a
  3467. pixel is considered "black". The provided value is scaled according to
  3468. the following equation:
  3469. @example
  3470. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  3471. @end example
  3472. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  3473. the input video format, the range is [0-255] for YUV full-range
  3474. formats and [16-235] for YUV non full-range formats.
  3475. Default value is 0.10.
  3476. @end table
  3477. The following example sets the maximum pixel threshold to the minimum
  3478. value, and detects only black intervals of 2 or more seconds:
  3479. @example
  3480. blackdetect=d=2:pix_th=0.00
  3481. @end example
  3482. @section blackframe
  3483. Detect frames that are (almost) completely black. Can be useful to
  3484. detect chapter transitions or commercials. Output lines consist of
  3485. the frame number of the detected frame, the percentage of blackness,
  3486. the position in the file if known or -1 and the timestamp in seconds.
  3487. In order to display the output lines, you need to set the loglevel at
  3488. least to the AV_LOG_INFO value.
  3489. It accepts the following parameters:
  3490. @table @option
  3491. @item amount
  3492. The percentage of the pixels that have to be below the threshold; it defaults to
  3493. @code{98}.
  3494. @item threshold, thresh
  3495. The threshold below which a pixel value is considered black; it defaults to
  3496. @code{32}.
  3497. @end table
  3498. @section blend, tblend
  3499. Blend two video frames into each other.
  3500. The @code{blend} filter takes two input streams and outputs one
  3501. stream, the first input is the "top" layer and second input is
  3502. "bottom" layer. Output terminates when shortest input terminates.
  3503. The @code{tblend} (time blend) filter takes two consecutive frames
  3504. from one single stream, and outputs the result obtained by blending
  3505. the new frame on top of the old frame.
  3506. A description of the accepted options follows.
  3507. @table @option
  3508. @item c0_mode
  3509. @item c1_mode
  3510. @item c2_mode
  3511. @item c3_mode
  3512. @item all_mode
  3513. Set blend mode for specific pixel component or all pixel components in case
  3514. of @var{all_mode}. Default value is @code{normal}.
  3515. Available values for component modes are:
  3516. @table @samp
  3517. @item addition
  3518. @item addition128
  3519. @item and
  3520. @item average
  3521. @item burn
  3522. @item darken
  3523. @item difference
  3524. @item difference128
  3525. @item divide
  3526. @item dodge
  3527. @item freeze
  3528. @item exclusion
  3529. @item glow
  3530. @item hardlight
  3531. @item hardmix
  3532. @item heat
  3533. @item lighten
  3534. @item linearlight
  3535. @item multiply
  3536. @item multiply128
  3537. @item negation
  3538. @item normal
  3539. @item or
  3540. @item overlay
  3541. @item phoenix
  3542. @item pinlight
  3543. @item reflect
  3544. @item screen
  3545. @item softlight
  3546. @item subtract
  3547. @item vividlight
  3548. @item xor
  3549. @end table
  3550. @item c0_opacity
  3551. @item c1_opacity
  3552. @item c2_opacity
  3553. @item c3_opacity
  3554. @item all_opacity
  3555. Set blend opacity for specific pixel component or all pixel components in case
  3556. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  3557. @item c0_expr
  3558. @item c1_expr
  3559. @item c2_expr
  3560. @item c3_expr
  3561. @item all_expr
  3562. Set blend expression for specific pixel component or all pixel components in case
  3563. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3564. The expressions can use the following variables:
  3565. @table @option
  3566. @item N
  3567. The sequential number of the filtered frame, starting from @code{0}.
  3568. @item X
  3569. @item Y
  3570. the coordinates of the current sample
  3571. @item W
  3572. @item H
  3573. the width and height of currently filtered plane
  3574. @item SW
  3575. @item SH
  3576. Width and height scale depending on the currently filtered plane. It is the
  3577. ratio between the corresponding luma plane number of pixels and the current
  3578. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3579. @code{0.5,0.5} for chroma planes.
  3580. @item T
  3581. Time of the current frame, expressed in seconds.
  3582. @item TOP, A
  3583. Value of pixel component at current location for first video frame (top layer).
  3584. @item BOTTOM, B
  3585. Value of pixel component at current location for second video frame (bottom layer).
  3586. @end table
  3587. @item shortest
  3588. Force termination when the shortest input terminates. Default is
  3589. @code{0}. This option is only defined for the @code{blend} filter.
  3590. @item repeatlast
  3591. Continue applying the last bottom frame after the end of the stream. A value of
  3592. @code{0} disable the filter after the last frame of the bottom layer is reached.
  3593. Default is @code{1}. This option is only defined for the @code{blend} filter.
  3594. @end table
  3595. @subsection Examples
  3596. @itemize
  3597. @item
  3598. Apply transition from bottom layer to top layer in first 10 seconds:
  3599. @example
  3600. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3601. @end example
  3602. @item
  3603. Apply 1x1 checkerboard effect:
  3604. @example
  3605. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  3606. @end example
  3607. @item
  3608. Apply uncover left effect:
  3609. @example
  3610. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  3611. @end example
  3612. @item
  3613. Apply uncover down effect:
  3614. @example
  3615. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  3616. @end example
  3617. @item
  3618. Apply uncover up-left effect:
  3619. @example
  3620. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  3621. @end example
  3622. @item
  3623. Split diagonally video and shows top and bottom layer on each side:
  3624. @example
  3625. blend=all_expr=if(gt(X,Y*(W/H)),A,B)
  3626. @end example
  3627. @item
  3628. Display differences between the current and the previous frame:
  3629. @example
  3630. tblend=all_mode=difference128
  3631. @end example
  3632. @end itemize
  3633. @section boxblur
  3634. Apply a boxblur algorithm to the input video.
  3635. It accepts the following parameters:
  3636. @table @option
  3637. @item luma_radius, lr
  3638. @item luma_power, lp
  3639. @item chroma_radius, cr
  3640. @item chroma_power, cp
  3641. @item alpha_radius, ar
  3642. @item alpha_power, ap
  3643. @end table
  3644. A description of the accepted options follows.
  3645. @table @option
  3646. @item luma_radius, lr
  3647. @item chroma_radius, cr
  3648. @item alpha_radius, ar
  3649. Set an expression for the box radius in pixels used for blurring the
  3650. corresponding input plane.
  3651. The radius value must be a non-negative number, and must not be
  3652. greater than the value of the expression @code{min(w,h)/2} for the
  3653. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  3654. planes.
  3655. Default value for @option{luma_radius} is "2". If not specified,
  3656. @option{chroma_radius} and @option{alpha_radius} default to the
  3657. corresponding value set for @option{luma_radius}.
  3658. The expressions can contain the following constants:
  3659. @table @option
  3660. @item w
  3661. @item h
  3662. The input width and height in pixels.
  3663. @item cw
  3664. @item ch
  3665. The input chroma image width and height in pixels.
  3666. @item hsub
  3667. @item vsub
  3668. The horizontal and vertical chroma subsample values. For example, for the
  3669. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  3670. @end table
  3671. @item luma_power, lp
  3672. @item chroma_power, cp
  3673. @item alpha_power, ap
  3674. Specify how many times the boxblur filter is applied to the
  3675. corresponding plane.
  3676. Default value for @option{luma_power} is 2. If not specified,
  3677. @option{chroma_power} and @option{alpha_power} default to the
  3678. corresponding value set for @option{luma_power}.
  3679. A value of 0 will disable the effect.
  3680. @end table
  3681. @subsection Examples
  3682. @itemize
  3683. @item
  3684. Apply a boxblur filter with the luma, chroma, and alpha radii
  3685. set to 2:
  3686. @example
  3687. boxblur=luma_radius=2:luma_power=1
  3688. boxblur=2:1
  3689. @end example
  3690. @item
  3691. Set the luma radius to 2, and alpha and chroma radius to 0:
  3692. @example
  3693. boxblur=2:1:cr=0:ar=0
  3694. @end example
  3695. @item
  3696. Set the luma and chroma radii to a fraction of the video dimension:
  3697. @example
  3698. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  3699. @end example
  3700. @end itemize
  3701. @section bwdif
  3702. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  3703. Deinterlacing Filter").
  3704. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  3705. interpolation algorithms.
  3706. It accepts the following parameters:
  3707. @table @option
  3708. @item mode
  3709. The interlacing mode to adopt. It accepts one of the following values:
  3710. @table @option
  3711. @item 0, send_frame
  3712. Output one frame for each frame.
  3713. @item 1, send_field
  3714. Output one frame for each field.
  3715. @end table
  3716. The default value is @code{send_field}.
  3717. @item parity
  3718. The picture field parity assumed for the input interlaced video. It accepts one
  3719. of the following values:
  3720. @table @option
  3721. @item 0, tff
  3722. Assume the top field is first.
  3723. @item 1, bff
  3724. Assume the bottom field is first.
  3725. @item -1, auto
  3726. Enable automatic detection of field parity.
  3727. @end table
  3728. The default value is @code{auto}.
  3729. If the interlacing is unknown or the decoder does not export this information,
  3730. top field first will be assumed.
  3731. @item deint
  3732. Specify which frames to deinterlace. Accept one of the following
  3733. values:
  3734. @table @option
  3735. @item 0, all
  3736. Deinterlace all frames.
  3737. @item 1, interlaced
  3738. Only deinterlace frames marked as interlaced.
  3739. @end table
  3740. The default value is @code{all}.
  3741. @end table
  3742. @section chromakey
  3743. YUV colorspace color/chroma keying.
  3744. The filter accepts the following options:
  3745. @table @option
  3746. @item color
  3747. The color which will be replaced with transparency.
  3748. @item similarity
  3749. Similarity percentage with the key color.
  3750. 0.01 matches only the exact key color, while 1.0 matches everything.
  3751. @item blend
  3752. Blend percentage.
  3753. 0.0 makes pixels either fully transparent, or not transparent at all.
  3754. Higher values result in semi-transparent pixels, with a higher transparency
  3755. the more similar the pixels color is to the key color.
  3756. @item yuv
  3757. Signals that the color passed is already in YUV instead of RGB.
  3758. Litteral colors like "green" or "red" don't make sense with this enabled anymore.
  3759. This can be used to pass exact YUV values as hexadecimal numbers.
  3760. @end table
  3761. @subsection Examples
  3762. @itemize
  3763. @item
  3764. Make every green pixel in the input image transparent:
  3765. @example
  3766. ffmpeg -i input.png -vf chromakey=green out.png
  3767. @end example
  3768. @item
  3769. Overlay a greenscreen-video on top of a static black background.
  3770. @example
  3771. 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
  3772. @end example
  3773. @end itemize
  3774. @section ciescope
  3775. Display CIE color diagram with pixels overlaid onto it.
  3776. The filter accepts the following options:
  3777. @table @option
  3778. @item system
  3779. Set color system.
  3780. @table @samp
  3781. @item ntsc, 470m
  3782. @item ebu, 470bg
  3783. @item smpte
  3784. @item 240m
  3785. @item apple
  3786. @item widergb
  3787. @item cie1931
  3788. @item rec709, hdtv
  3789. @item uhdtv, rec2020
  3790. @end table
  3791. @item cie
  3792. Set CIE system.
  3793. @table @samp
  3794. @item xyy
  3795. @item ucs
  3796. @item luv
  3797. @end table
  3798. @item gamuts
  3799. Set what gamuts to draw.
  3800. See @code{system} option for available values.
  3801. @item size, s
  3802. Set ciescope size, by default set to 512.
  3803. @item intensity, i
  3804. Set intensity used to map input pixel values to CIE diagram.
  3805. @item contrast
  3806. Set contrast used to draw tongue colors that are out of active color system gamut.
  3807. @item corrgamma
  3808. Correct gamma displayed on scope, by default enabled.
  3809. @item showwhite
  3810. Show white point on CIE diagram, by default disabled.
  3811. @item gamma
  3812. Set input gamma. Used only with XYZ input color space.
  3813. @end table
  3814. @section codecview
  3815. Visualize information exported by some codecs.
  3816. Some codecs can export information through frames using side-data or other
  3817. means. For example, some MPEG based codecs export motion vectors through the
  3818. @var{export_mvs} flag in the codec @option{flags2} option.
  3819. The filter accepts the following option:
  3820. @table @option
  3821. @item mv
  3822. Set motion vectors to visualize.
  3823. Available flags for @var{mv} are:
  3824. @table @samp
  3825. @item pf
  3826. forward predicted MVs of P-frames
  3827. @item bf
  3828. forward predicted MVs of B-frames
  3829. @item bb
  3830. backward predicted MVs of B-frames
  3831. @end table
  3832. @item qp
  3833. Display quantization parameters using the chroma planes.
  3834. @item mv_type, mvt
  3835. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  3836. Available flags for @var{mv_type} are:
  3837. @table @samp
  3838. @item fp
  3839. forward predicted MVs
  3840. @item bp
  3841. backward predicted MVs
  3842. @end table
  3843. @item frame_type, ft
  3844. Set frame type to visualize motion vectors of.
  3845. Available flags for @var{frame_type} are:
  3846. @table @samp
  3847. @item if
  3848. intra-coded frames (I-frames)
  3849. @item pf
  3850. predicted frames (P-frames)
  3851. @item bf
  3852. bi-directionally predicted frames (B-frames)
  3853. @end table
  3854. @end table
  3855. @subsection Examples
  3856. @itemize
  3857. @item
  3858. Visualize forward predicted MVs of all frames using @command{ffplay}:
  3859. @example
  3860. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  3861. @end example
  3862. @item
  3863. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  3864. @example
  3865. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  3866. @end example
  3867. @end itemize
  3868. @section colorbalance
  3869. Modify intensity of primary colors (red, green and blue) of input frames.
  3870. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  3871. regions for the red-cyan, green-magenta or blue-yellow balance.
  3872. A positive adjustment value shifts the balance towards the primary color, a negative
  3873. value towards the complementary color.
  3874. The filter accepts the following options:
  3875. @table @option
  3876. @item rs
  3877. @item gs
  3878. @item bs
  3879. Adjust red, green and blue shadows (darkest pixels).
  3880. @item rm
  3881. @item gm
  3882. @item bm
  3883. Adjust red, green and blue midtones (medium pixels).
  3884. @item rh
  3885. @item gh
  3886. @item bh
  3887. Adjust red, green and blue highlights (brightest pixels).
  3888. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3889. @end table
  3890. @subsection Examples
  3891. @itemize
  3892. @item
  3893. Add red color cast to shadows:
  3894. @example
  3895. colorbalance=rs=.3
  3896. @end example
  3897. @end itemize
  3898. @section colorkey
  3899. RGB colorspace color keying.
  3900. The filter accepts the following options:
  3901. @table @option
  3902. @item color
  3903. The color which will be replaced with transparency.
  3904. @item similarity
  3905. Similarity percentage with the key color.
  3906. 0.01 matches only the exact key color, while 1.0 matches everything.
  3907. @item blend
  3908. Blend percentage.
  3909. 0.0 makes pixels either fully transparent, or not transparent at all.
  3910. Higher values result in semi-transparent pixels, with a higher transparency
  3911. the more similar the pixels color is to the key color.
  3912. @end table
  3913. @subsection Examples
  3914. @itemize
  3915. @item
  3916. Make every green pixel in the input image transparent:
  3917. @example
  3918. ffmpeg -i input.png -vf colorkey=green out.png
  3919. @end example
  3920. @item
  3921. Overlay a greenscreen-video on top of a static background image.
  3922. @example
  3923. 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
  3924. @end example
  3925. @end itemize
  3926. @section colorlevels
  3927. Adjust video input frames using levels.
  3928. The filter accepts the following options:
  3929. @table @option
  3930. @item rimin
  3931. @item gimin
  3932. @item bimin
  3933. @item aimin
  3934. Adjust red, green, blue and alpha input black point.
  3935. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  3936. @item rimax
  3937. @item gimax
  3938. @item bimax
  3939. @item aimax
  3940. Adjust red, green, blue and alpha input white point.
  3941. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  3942. Input levels are used to lighten highlights (bright tones), darken shadows
  3943. (dark tones), change the balance of bright and dark tones.
  3944. @item romin
  3945. @item gomin
  3946. @item bomin
  3947. @item aomin
  3948. Adjust red, green, blue and alpha output black point.
  3949. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  3950. @item romax
  3951. @item gomax
  3952. @item bomax
  3953. @item aomax
  3954. Adjust red, green, blue and alpha output white point.
  3955. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  3956. Output levels allows manual selection of a constrained output level range.
  3957. @end table
  3958. @subsection Examples
  3959. @itemize
  3960. @item
  3961. Make video output darker:
  3962. @example
  3963. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  3964. @end example
  3965. @item
  3966. Increase contrast:
  3967. @example
  3968. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  3969. @end example
  3970. @item
  3971. Make video output lighter:
  3972. @example
  3973. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  3974. @end example
  3975. @item
  3976. Increase brightness:
  3977. @example
  3978. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  3979. @end example
  3980. @end itemize
  3981. @section colorchannelmixer
  3982. Adjust video input frames by re-mixing color channels.
  3983. This filter modifies a color channel by adding the values associated to
  3984. the other channels of the same pixels. For example if the value to
  3985. modify is red, the output value will be:
  3986. @example
  3987. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  3988. @end example
  3989. The filter accepts the following options:
  3990. @table @option
  3991. @item rr
  3992. @item rg
  3993. @item rb
  3994. @item ra
  3995. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  3996. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  3997. @item gr
  3998. @item gg
  3999. @item gb
  4000. @item ga
  4001. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4002. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4003. @item br
  4004. @item bg
  4005. @item bb
  4006. @item ba
  4007. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4008. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4009. @item ar
  4010. @item ag
  4011. @item ab
  4012. @item aa
  4013. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4014. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4015. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4016. @end table
  4017. @subsection Examples
  4018. @itemize
  4019. @item
  4020. Convert source to grayscale:
  4021. @example
  4022. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4023. @end example
  4024. @item
  4025. Simulate sepia tones:
  4026. @example
  4027. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4028. @end example
  4029. @end itemize
  4030. @section colormatrix
  4031. Convert color matrix.
  4032. The filter accepts the following options:
  4033. @table @option
  4034. @item src
  4035. @item dst
  4036. Specify the source and destination color matrix. Both values must be
  4037. specified.
  4038. The accepted values are:
  4039. @table @samp
  4040. @item bt709
  4041. BT.709
  4042. @item bt601
  4043. BT.601
  4044. @item smpte240m
  4045. SMPTE-240M
  4046. @item fcc
  4047. FCC
  4048. @item bt2020
  4049. BT.2020
  4050. @end table
  4051. @end table
  4052. For example to convert from BT.601 to SMPTE-240M, use the command:
  4053. @example
  4054. colormatrix=bt601:smpte240m
  4055. @end example
  4056. @section colorspace
  4057. Convert colorspace, transfer characteristics or color primaries.
  4058. The filter accepts the following options:
  4059. @table @option
  4060. @item all
  4061. Specify all color properties at once.
  4062. The accepted values are:
  4063. @table @samp
  4064. @item bt470m
  4065. BT.470M
  4066. @item bt470bg
  4067. BT.470BG
  4068. @item bt601-6-525
  4069. BT.601-6 525
  4070. @item bt601-6-625
  4071. BT.601-6 625
  4072. @item bt709
  4073. BT.709
  4074. @item smpte170m
  4075. SMPTE-170M
  4076. @item smpte240m
  4077. SMPTE-240M
  4078. @item bt2020
  4079. BT.2020
  4080. @end table
  4081. @item space
  4082. Specify output colorspace.
  4083. The accepted values are:
  4084. @table @samp
  4085. @item bt709
  4086. BT.709
  4087. @item fcc
  4088. FCC
  4089. @item bt470bg
  4090. BT.470BG or BT.601-6 625
  4091. @item smpte170m
  4092. SMPTE-170M or BT.601-6 525
  4093. @item smpte240m
  4094. SMPTE-240M
  4095. @item bt2020ncl
  4096. BT.2020 with non-constant luminance
  4097. @end table
  4098. @item trc
  4099. Specify output transfer characteristics.
  4100. The accepted values are:
  4101. @table @samp
  4102. @item bt709
  4103. BT.709
  4104. @item gamma22
  4105. Constant gamma of 2.2
  4106. @item gamma28
  4107. Constant gamma of 2.8
  4108. @item smpte170m
  4109. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4110. @item smpte240m
  4111. SMPTE-240M
  4112. @item bt2020-10
  4113. BT.2020 for 10-bits content
  4114. @item bt2020-12
  4115. BT.2020 for 12-bits content
  4116. @end table
  4117. @item primaries
  4118. Specify output color primaries.
  4119. The accepted values are:
  4120. @table @samp
  4121. @item bt709
  4122. BT.709
  4123. @item bt470m
  4124. BT.470M
  4125. @item bt470bg
  4126. BT.470BG or BT.601-6 625
  4127. @item smpte170m
  4128. SMPTE-170M or BT.601-6 525
  4129. @item smpte240m
  4130. SMPTE-240M
  4131. @item bt2020
  4132. BT.2020
  4133. @end table
  4134. @item range
  4135. Specify output color range.
  4136. The accepted values are:
  4137. @table @samp
  4138. @item mpeg
  4139. MPEG (restricted) range
  4140. @item jpeg
  4141. JPEG (full) range
  4142. @end table
  4143. @item format
  4144. Specify output color format.
  4145. The accepted values are:
  4146. @table @samp
  4147. @item yuv420p
  4148. YUV 4:2:0 planar 8-bits
  4149. @item yuv420p10
  4150. YUV 4:2:0 planar 10-bits
  4151. @item yuv420p12
  4152. YUV 4:2:0 planar 12-bits
  4153. @item yuv422p
  4154. YUV 4:2:2 planar 8-bits
  4155. @item yuv422p10
  4156. YUV 4:2:2 planar 10-bits
  4157. @item yuv422p12
  4158. YUV 4:2:2 planar 12-bits
  4159. @item yuv444p
  4160. YUV 4:4:4 planar 8-bits
  4161. @item yuv444p10
  4162. YUV 4:4:4 planar 10-bits
  4163. @item yuv444p12
  4164. YUV 4:4:4 planar 12-bits
  4165. @end table
  4166. @item fast
  4167. Do a fast conversion, which skips gamma/primary correction. This will take
  4168. significantly less CPU, but will be mathematically incorrect. To get output
  4169. compatible with that produced by the colormatrix filter, use fast=1.
  4170. @item dither
  4171. Specify dithering mode.
  4172. The accepted values are:
  4173. @table @samp
  4174. @item none
  4175. No dithering
  4176. @item fsb
  4177. Floyd-Steinberg dithering
  4178. @end table
  4179. @item wpadapt
  4180. Whitepoint adaptation mode.
  4181. The accepted values are:
  4182. @table @samp
  4183. @item bradford
  4184. Bradford whitepoint adaptation
  4185. @item vonkries
  4186. von Kries whitepoint adaptation
  4187. @item identity
  4188. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4189. @end table
  4190. @end table
  4191. The filter converts the transfer characteristics, color space and color
  4192. primaries to the specified user values. The output value, if not specified,
  4193. is set to a default value based on the "all" property. If that property is
  4194. also not specified, the filter will log an error. The output color range and
  4195. format default to the same value as the input color range and format. The
  4196. input transfer characteristics, color space, color primaries and color range
  4197. should be set on the input data. If any of these are missing, the filter will
  4198. log an error and no conversion will take place.
  4199. For example to convert the input to SMPTE-240M, use the command:
  4200. @example
  4201. colorspace=smpte240m
  4202. @end example
  4203. @section convolution
  4204. Apply convolution 3x3 or 5x5 filter.
  4205. The filter accepts the following options:
  4206. @table @option
  4207. @item 0m
  4208. @item 1m
  4209. @item 2m
  4210. @item 3m
  4211. Set matrix for each plane.
  4212. Matrix is sequence of 9 or 25 signed integers.
  4213. @item 0rdiv
  4214. @item 1rdiv
  4215. @item 2rdiv
  4216. @item 3rdiv
  4217. Set multiplier for calculated value for each plane.
  4218. @item 0bias
  4219. @item 1bias
  4220. @item 2bias
  4221. @item 3bias
  4222. Set bias for each plane. This value is added to the result of the multiplication.
  4223. Useful for making the overall image brighter or darker. Default is 0.0.
  4224. @end table
  4225. @subsection Examples
  4226. @itemize
  4227. @item
  4228. Apply sharpen:
  4229. @example
  4230. 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"
  4231. @end example
  4232. @item
  4233. Apply blur:
  4234. @example
  4235. 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"
  4236. @end example
  4237. @item
  4238. Apply edge enhance:
  4239. @example
  4240. 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"
  4241. @end example
  4242. @item
  4243. Apply edge detect:
  4244. @example
  4245. 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"
  4246. @end example
  4247. @item
  4248. Apply emboss:
  4249. @example
  4250. 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"
  4251. @end example
  4252. @end itemize
  4253. @section copy
  4254. Copy the input source unchanged to the output. This is mainly useful for
  4255. testing purposes.
  4256. @anchor{coreimage}
  4257. @section coreimage
  4258. Video filtering on GPU using Apple's CoreImage API on OSX.
  4259. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4260. processed by video hardware. However, software-based OpenGL implementations
  4261. exist which means there is no guarantee for hardware processing. It depends on
  4262. the respective OSX.
  4263. There are many filters and image generators provided by Apple that come with a
  4264. large variety of options. The filter has to be referenced by its name along
  4265. with its options.
  4266. The coreimage filter accepts the following options:
  4267. @table @option
  4268. @item list_filters
  4269. List all available filters and generators along with all their respective
  4270. options as well as possible minimum and maximum values along with the default
  4271. values.
  4272. @example
  4273. list_filters=true
  4274. @end example
  4275. @item filter
  4276. Specify all filters by their respective name and options.
  4277. Use @var{list_filters} to determine all valid filter names and options.
  4278. Numerical options are specified by a float value and are automatically clamped
  4279. to their respective value range. Vector and color options have to be specified
  4280. by a list of space separated float values. Character escaping has to be done.
  4281. A special option name @code{default} is available to use default options for a
  4282. filter.
  4283. It is required to specify either @code{default} or at least one of the filter options.
  4284. All omitted options are used with their default values.
  4285. The syntax of the filter string is as follows:
  4286. @example
  4287. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  4288. @end example
  4289. @item output_rect
  4290. Specify a rectangle where the output of the filter chain is copied into the
  4291. input image. It is given by a list of space separated float values:
  4292. @example
  4293. output_rect=x\ y\ width\ height
  4294. @end example
  4295. If not given, the output rectangle equals the dimensions of the input image.
  4296. The output rectangle is automatically cropped at the borders of the input
  4297. image. Negative values are valid for each component.
  4298. @example
  4299. output_rect=25\ 25\ 100\ 100
  4300. @end example
  4301. @end table
  4302. Several filters can be chained for successive processing without GPU-HOST
  4303. transfers allowing for fast processing of complex filter chains.
  4304. Currently, only filters with zero (generators) or exactly one (filters) input
  4305. image and one output image are supported. Also, transition filters are not yet
  4306. usable as intended.
  4307. Some filters generate output images with additional padding depending on the
  4308. respective filter kernel. The padding is automatically removed to ensure the
  4309. filter output has the same size as the input image.
  4310. For image generators, the size of the output image is determined by the
  4311. previous output image of the filter chain or the input image of the whole
  4312. filterchain, respectively. The generators do not use the pixel information of
  4313. this image to generate their output. However, the generated output is
  4314. blended onto this image, resulting in partial or complete coverage of the
  4315. output image.
  4316. The @ref{coreimagesrc} video source can be used for generating input images
  4317. which are directly fed into the filter chain. By using it, providing input
  4318. images by another video source or an input video is not required.
  4319. @subsection Examples
  4320. @itemize
  4321. @item
  4322. List all filters available:
  4323. @example
  4324. coreimage=list_filters=true
  4325. @end example
  4326. @item
  4327. Use the CIBoxBlur filter with default options to blur an image:
  4328. @example
  4329. coreimage=filter=CIBoxBlur@@default
  4330. @end example
  4331. @item
  4332. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  4333. its center at 100x100 and a radius of 50 pixels:
  4334. @example
  4335. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  4336. @end example
  4337. @item
  4338. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  4339. given as complete and escaped command-line for Apple's standard bash shell:
  4340. @example
  4341. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  4342. @end example
  4343. @end itemize
  4344. @section crop
  4345. Crop the input video to given dimensions.
  4346. It accepts the following parameters:
  4347. @table @option
  4348. @item w, out_w
  4349. The width of the output video. It defaults to @code{iw}.
  4350. This expression is evaluated only once during the filter
  4351. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  4352. @item h, out_h
  4353. The height of the output video. It defaults to @code{ih}.
  4354. This expression is evaluated only once during the filter
  4355. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  4356. @item x
  4357. The horizontal position, in the input video, of the left edge of the output
  4358. video. It defaults to @code{(in_w-out_w)/2}.
  4359. This expression is evaluated per-frame.
  4360. @item y
  4361. The vertical position, in the input video, of the top edge of the output video.
  4362. It defaults to @code{(in_h-out_h)/2}.
  4363. This expression is evaluated per-frame.
  4364. @item keep_aspect
  4365. If set to 1 will force the output display aspect ratio
  4366. to be the same of the input, by changing the output sample aspect
  4367. ratio. It defaults to 0.
  4368. @item exact
  4369. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  4370. width/height/x/y as specified and will not be rounded to nearest smaller value.
  4371. It defaults to 0.
  4372. @end table
  4373. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  4374. expressions containing the following constants:
  4375. @table @option
  4376. @item x
  4377. @item y
  4378. The computed values for @var{x} and @var{y}. They are evaluated for
  4379. each new frame.
  4380. @item in_w
  4381. @item in_h
  4382. The input width and height.
  4383. @item iw
  4384. @item ih
  4385. These are the same as @var{in_w} and @var{in_h}.
  4386. @item out_w
  4387. @item out_h
  4388. The output (cropped) width and height.
  4389. @item ow
  4390. @item oh
  4391. These are the same as @var{out_w} and @var{out_h}.
  4392. @item a
  4393. same as @var{iw} / @var{ih}
  4394. @item sar
  4395. input sample aspect ratio
  4396. @item dar
  4397. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4398. @item hsub
  4399. @item vsub
  4400. horizontal and vertical chroma subsample values. For example for the
  4401. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4402. @item n
  4403. The number of the input frame, starting from 0.
  4404. @item pos
  4405. the position in the file of the input frame, NAN if unknown
  4406. @item t
  4407. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  4408. @end table
  4409. The expression for @var{out_w} may depend on the value of @var{out_h},
  4410. and the expression for @var{out_h} may depend on @var{out_w}, but they
  4411. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  4412. evaluated after @var{out_w} and @var{out_h}.
  4413. The @var{x} and @var{y} parameters specify the expressions for the
  4414. position of the top-left corner of the output (non-cropped) area. They
  4415. are evaluated for each frame. If the evaluated value is not valid, it
  4416. is approximated to the nearest valid value.
  4417. The expression for @var{x} may depend on @var{y}, and the expression
  4418. for @var{y} may depend on @var{x}.
  4419. @subsection Examples
  4420. @itemize
  4421. @item
  4422. Crop area with size 100x100 at position (12,34).
  4423. @example
  4424. crop=100:100:12:34
  4425. @end example
  4426. Using named options, the example above becomes:
  4427. @example
  4428. crop=w=100:h=100:x=12:y=34
  4429. @end example
  4430. @item
  4431. Crop the central input area with size 100x100:
  4432. @example
  4433. crop=100:100
  4434. @end example
  4435. @item
  4436. Crop the central input area with size 2/3 of the input video:
  4437. @example
  4438. crop=2/3*in_w:2/3*in_h
  4439. @end example
  4440. @item
  4441. Crop the input video central square:
  4442. @example
  4443. crop=out_w=in_h
  4444. crop=in_h
  4445. @end example
  4446. @item
  4447. Delimit the rectangle with the top-left corner placed at position
  4448. 100:100 and the right-bottom corner corresponding to the right-bottom
  4449. corner of the input image.
  4450. @example
  4451. crop=in_w-100:in_h-100:100:100
  4452. @end example
  4453. @item
  4454. Crop 10 pixels from the left and right borders, and 20 pixels from
  4455. the top and bottom borders
  4456. @example
  4457. crop=in_w-2*10:in_h-2*20
  4458. @end example
  4459. @item
  4460. Keep only the bottom right quarter of the input image:
  4461. @example
  4462. crop=in_w/2:in_h/2:in_w/2:in_h/2
  4463. @end example
  4464. @item
  4465. Crop height for getting Greek harmony:
  4466. @example
  4467. crop=in_w:1/PHI*in_w
  4468. @end example
  4469. @item
  4470. Apply trembling effect:
  4471. @example
  4472. 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)
  4473. @end example
  4474. @item
  4475. Apply erratic camera effect depending on timestamp:
  4476. @example
  4477. 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)"
  4478. @end example
  4479. @item
  4480. Set x depending on the value of y:
  4481. @example
  4482. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  4483. @end example
  4484. @end itemize
  4485. @subsection Commands
  4486. This filter supports the following commands:
  4487. @table @option
  4488. @item w, out_w
  4489. @item h, out_h
  4490. @item x
  4491. @item y
  4492. Set width/height of the output video and the horizontal/vertical position
  4493. in the input video.
  4494. The command accepts the same syntax of the corresponding option.
  4495. If the specified expression is not valid, it is kept at its current
  4496. value.
  4497. @end table
  4498. @section cropdetect
  4499. Auto-detect the crop size.
  4500. It calculates the necessary cropping parameters and prints the
  4501. recommended parameters via the logging system. The detected dimensions
  4502. correspond to the non-black area of the input video.
  4503. It accepts the following parameters:
  4504. @table @option
  4505. @item limit
  4506. Set higher black value threshold, which can be optionally specified
  4507. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  4508. value greater to the set value is considered non-black. It defaults to 24.
  4509. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  4510. on the bitdepth of the pixel format.
  4511. @item round
  4512. The value which the width/height should be divisible by. It defaults to
  4513. 16. The offset is automatically adjusted to center the video. Use 2 to
  4514. get only even dimensions (needed for 4:2:2 video). 16 is best when
  4515. encoding to most video codecs.
  4516. @item reset_count, reset
  4517. Set the counter that determines after how many frames cropdetect will
  4518. reset the previously detected largest video area and start over to
  4519. detect the current optimal crop area. Default value is 0.
  4520. This can be useful when channel logos distort the video area. 0
  4521. indicates 'never reset', and returns the largest area encountered during
  4522. playback.
  4523. @end table
  4524. @anchor{curves}
  4525. @section curves
  4526. Apply color adjustments using curves.
  4527. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  4528. component (red, green and blue) has its values defined by @var{N} key points
  4529. tied from each other using a smooth curve. The x-axis represents the pixel
  4530. values from the input frame, and the y-axis the new pixel values to be set for
  4531. the output frame.
  4532. By default, a component curve is defined by the two points @var{(0;0)} and
  4533. @var{(1;1)}. This creates a straight line where each original pixel value is
  4534. "adjusted" to its own value, which means no change to the image.
  4535. The filter allows you to redefine these two points and add some more. A new
  4536. curve (using a natural cubic spline interpolation) will be define to pass
  4537. smoothly through all these new coordinates. The new defined points needs to be
  4538. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  4539. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  4540. the vector spaces, the values will be clipped accordingly.
  4541. The filter accepts the following options:
  4542. @table @option
  4543. @item preset
  4544. Select one of the available color presets. This option can be used in addition
  4545. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  4546. options takes priority on the preset values.
  4547. Available presets are:
  4548. @table @samp
  4549. @item none
  4550. @item color_negative
  4551. @item cross_process
  4552. @item darker
  4553. @item increase_contrast
  4554. @item lighter
  4555. @item linear_contrast
  4556. @item medium_contrast
  4557. @item negative
  4558. @item strong_contrast
  4559. @item vintage
  4560. @end table
  4561. Default is @code{none}.
  4562. @item master, m
  4563. Set the master key points. These points will define a second pass mapping. It
  4564. is sometimes called a "luminance" or "value" mapping. It can be used with
  4565. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  4566. post-processing LUT.
  4567. @item red, r
  4568. Set the key points for the red component.
  4569. @item green, g
  4570. Set the key points for the green component.
  4571. @item blue, b
  4572. Set the key points for the blue component.
  4573. @item all
  4574. Set the key points for all components (not including master).
  4575. Can be used in addition to the other key points component
  4576. options. In this case, the unset component(s) will fallback on this
  4577. @option{all} setting.
  4578. @item psfile
  4579. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  4580. @item plot
  4581. Save Gnuplot script of the curves in specified file.
  4582. @end table
  4583. To avoid some filtergraph syntax conflicts, each key points list need to be
  4584. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  4585. @subsection Examples
  4586. @itemize
  4587. @item
  4588. Increase slightly the middle level of blue:
  4589. @example
  4590. curves=blue='0/0 0.5/0.58 1/1'
  4591. @end example
  4592. @item
  4593. Vintage effect:
  4594. @example
  4595. 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'
  4596. @end example
  4597. Here we obtain the following coordinates for each components:
  4598. @table @var
  4599. @item red
  4600. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  4601. @item green
  4602. @code{(0;0) (0.50;0.48) (1;1)}
  4603. @item blue
  4604. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  4605. @end table
  4606. @item
  4607. The previous example can also be achieved with the associated built-in preset:
  4608. @example
  4609. curves=preset=vintage
  4610. @end example
  4611. @item
  4612. Or simply:
  4613. @example
  4614. curves=vintage
  4615. @end example
  4616. @item
  4617. Use a Photoshop preset and redefine the points of the green component:
  4618. @example
  4619. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  4620. @end example
  4621. @item
  4622. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  4623. and @command{gnuplot}:
  4624. @example
  4625. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  4626. gnuplot -p /tmp/curves.plt
  4627. @end example
  4628. @end itemize
  4629. @section datascope
  4630. Video data analysis filter.
  4631. This filter shows hexadecimal pixel values of part of video.
  4632. The filter accepts the following options:
  4633. @table @option
  4634. @item size, s
  4635. Set output video size.
  4636. @item x
  4637. Set x offset from where to pick pixels.
  4638. @item y
  4639. Set y offset from where to pick pixels.
  4640. @item mode
  4641. Set scope mode, can be one of the following:
  4642. @table @samp
  4643. @item mono
  4644. Draw hexadecimal pixel values with white color on black background.
  4645. @item color
  4646. Draw hexadecimal pixel values with input video pixel color on black
  4647. background.
  4648. @item color2
  4649. Draw hexadecimal pixel values on color background picked from input video,
  4650. the text color is picked in such way so its always visible.
  4651. @end table
  4652. @item axis
  4653. Draw rows and columns numbers on left and top of video.
  4654. @end table
  4655. @section dctdnoiz
  4656. Denoise frames using 2D DCT (frequency domain filtering).
  4657. This filter is not designed for real time.
  4658. The filter accepts the following options:
  4659. @table @option
  4660. @item sigma, s
  4661. Set the noise sigma constant.
  4662. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  4663. coefficient (absolute value) below this threshold with be dropped.
  4664. If you need a more advanced filtering, see @option{expr}.
  4665. Default is @code{0}.
  4666. @item overlap
  4667. Set number overlapping pixels for each block. Since the filter can be slow, you
  4668. may want to reduce this value, at the cost of a less effective filter and the
  4669. risk of various artefacts.
  4670. If the overlapping value doesn't permit processing the whole input width or
  4671. height, a warning will be displayed and according borders won't be denoised.
  4672. Default value is @var{blocksize}-1, which is the best possible setting.
  4673. @item expr, e
  4674. Set the coefficient factor expression.
  4675. For each coefficient of a DCT block, this expression will be evaluated as a
  4676. multiplier value for the coefficient.
  4677. If this is option is set, the @option{sigma} option will be ignored.
  4678. The absolute value of the coefficient can be accessed through the @var{c}
  4679. variable.
  4680. @item n
  4681. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  4682. @var{blocksize}, which is the width and height of the processed blocks.
  4683. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  4684. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  4685. on the speed processing. Also, a larger block size does not necessarily means a
  4686. better de-noising.
  4687. @end table
  4688. @subsection Examples
  4689. Apply a denoise with a @option{sigma} of @code{4.5}:
  4690. @example
  4691. dctdnoiz=4.5
  4692. @end example
  4693. The same operation can be achieved using the expression system:
  4694. @example
  4695. dctdnoiz=e='gte(c, 4.5*3)'
  4696. @end example
  4697. Violent denoise using a block size of @code{16x16}:
  4698. @example
  4699. dctdnoiz=15:n=4
  4700. @end example
  4701. @section deband
  4702. Remove banding artifacts from input video.
  4703. It works by replacing banded pixels with average value of referenced pixels.
  4704. The filter accepts the following options:
  4705. @table @option
  4706. @item 1thr
  4707. @item 2thr
  4708. @item 3thr
  4709. @item 4thr
  4710. Set banding detection threshold for each plane. Default is 0.02.
  4711. Valid range is 0.00003 to 0.5.
  4712. If difference between current pixel and reference pixel is less than threshold,
  4713. it will be considered as banded.
  4714. @item range, r
  4715. Banding detection range in pixels. Default is 16. If positive, random number
  4716. in range 0 to set value will be used. If negative, exact absolute value
  4717. will be used.
  4718. The range defines square of four pixels around current pixel.
  4719. @item direction, d
  4720. Set direction in radians from which four pixel will be compared. If positive,
  4721. random direction from 0 to set direction will be picked. If negative, exact of
  4722. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  4723. will pick only pixels on same row and -PI/2 will pick only pixels on same
  4724. column.
  4725. @item blur
  4726. If enabled, current pixel is compared with average value of all four
  4727. surrounding pixels. The default is enabled. If disabled current pixel is
  4728. compared with all four surrounding pixels. The pixel is considered banded
  4729. if only all four differences with surrounding pixels are less than threshold.
  4730. @end table
  4731. @anchor{decimate}
  4732. @section decimate
  4733. Drop duplicated frames at regular intervals.
  4734. The filter accepts the following options:
  4735. @table @option
  4736. @item cycle
  4737. Set the number of frames from which one will be dropped. Setting this to
  4738. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  4739. Default is @code{5}.
  4740. @item dupthresh
  4741. Set the threshold for duplicate detection. If the difference metric for a frame
  4742. is less than or equal to this value, then it is declared as duplicate. Default
  4743. is @code{1.1}
  4744. @item scthresh
  4745. Set scene change threshold. Default is @code{15}.
  4746. @item blockx
  4747. @item blocky
  4748. Set the size of the x and y-axis blocks used during metric calculations.
  4749. Larger blocks give better noise suppression, but also give worse detection of
  4750. small movements. Must be a power of two. Default is @code{32}.
  4751. @item ppsrc
  4752. Mark main input as a pre-processed input and activate clean source input
  4753. stream. This allows the input to be pre-processed with various filters to help
  4754. the metrics calculation while keeping the frame selection lossless. When set to
  4755. @code{1}, the first stream is for the pre-processed input, and the second
  4756. stream is the clean source from where the kept frames are chosen. Default is
  4757. @code{0}.
  4758. @item chroma
  4759. Set whether or not chroma is considered in the metric calculations. Default is
  4760. @code{1}.
  4761. @end table
  4762. @section deflate
  4763. Apply deflate effect to the video.
  4764. This filter replaces the pixel by the local(3x3) average by taking into account
  4765. only values lower than the pixel.
  4766. It accepts the following options:
  4767. @table @option
  4768. @item threshold0
  4769. @item threshold1
  4770. @item threshold2
  4771. @item threshold3
  4772. Limit the maximum change for each plane, default is 65535.
  4773. If 0, plane will remain unchanged.
  4774. @end table
  4775. @section dejudder
  4776. Remove judder produced by partially interlaced telecined content.
  4777. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  4778. source was partially telecined content then the output of @code{pullup,dejudder}
  4779. will have a variable frame rate. May change the recorded frame rate of the
  4780. container. Aside from that change, this filter will not affect constant frame
  4781. rate video.
  4782. The option available in this filter is:
  4783. @table @option
  4784. @item cycle
  4785. Specify the length of the window over which the judder repeats.
  4786. Accepts any integer greater than 1. Useful values are:
  4787. @table @samp
  4788. @item 4
  4789. If the original was telecined from 24 to 30 fps (Film to NTSC).
  4790. @item 5
  4791. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  4792. @item 20
  4793. If a mixture of the two.
  4794. @end table
  4795. The default is @samp{4}.
  4796. @end table
  4797. @section delogo
  4798. Suppress a TV station logo by a simple interpolation of the surrounding
  4799. pixels. Just set a rectangle covering the logo and watch it disappear
  4800. (and sometimes something even uglier appear - your mileage may vary).
  4801. It accepts the following parameters:
  4802. @table @option
  4803. @item x
  4804. @item y
  4805. Specify the top left corner coordinates of the logo. They must be
  4806. specified.
  4807. @item w
  4808. @item h
  4809. Specify the width and height of the logo to clear. They must be
  4810. specified.
  4811. @item band, t
  4812. Specify the thickness of the fuzzy edge of the rectangle (added to
  4813. @var{w} and @var{h}). The default value is 1. This option is
  4814. deprecated, setting higher values should no longer be necessary and
  4815. is not recommended.
  4816. @item show
  4817. When set to 1, a green rectangle is drawn on the screen to simplify
  4818. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  4819. The default value is 0.
  4820. The rectangle is drawn on the outermost pixels which will be (partly)
  4821. replaced with interpolated values. The values of the next pixels
  4822. immediately outside this rectangle in each direction will be used to
  4823. compute the interpolated pixel values inside the rectangle.
  4824. @end table
  4825. @subsection Examples
  4826. @itemize
  4827. @item
  4828. Set a rectangle covering the area with top left corner coordinates 0,0
  4829. and size 100x77, and a band of size 10:
  4830. @example
  4831. delogo=x=0:y=0:w=100:h=77:band=10
  4832. @end example
  4833. @end itemize
  4834. @section deshake
  4835. Attempt to fix small changes in horizontal and/or vertical shift. This
  4836. filter helps remove camera shake from hand-holding a camera, bumping a
  4837. tripod, moving on a vehicle, etc.
  4838. The filter accepts the following options:
  4839. @table @option
  4840. @item x
  4841. @item y
  4842. @item w
  4843. @item h
  4844. Specify a rectangular area where to limit the search for motion
  4845. vectors.
  4846. If desired the search for motion vectors can be limited to a
  4847. rectangular area of the frame defined by its top left corner, width
  4848. and height. These parameters have the same meaning as the drawbox
  4849. filter which can be used to visualise the position of the bounding
  4850. box.
  4851. This is useful when simultaneous movement of subjects within the frame
  4852. might be confused for camera motion by the motion vector search.
  4853. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  4854. then the full frame is used. This allows later options to be set
  4855. without specifying the bounding box for the motion vector search.
  4856. Default - search the whole frame.
  4857. @item rx
  4858. @item ry
  4859. Specify the maximum extent of movement in x and y directions in the
  4860. range 0-64 pixels. Default 16.
  4861. @item edge
  4862. Specify how to generate pixels to fill blanks at the edge of the
  4863. frame. Available values are:
  4864. @table @samp
  4865. @item blank, 0
  4866. Fill zeroes at blank locations
  4867. @item original, 1
  4868. Original image at blank locations
  4869. @item clamp, 2
  4870. Extruded edge value at blank locations
  4871. @item mirror, 3
  4872. Mirrored edge at blank locations
  4873. @end table
  4874. Default value is @samp{mirror}.
  4875. @item blocksize
  4876. Specify the blocksize to use for motion search. Range 4-128 pixels,
  4877. default 8.
  4878. @item contrast
  4879. Specify the contrast threshold for blocks. Only blocks with more than
  4880. the specified contrast (difference between darkest and lightest
  4881. pixels) will be considered. Range 1-255, default 125.
  4882. @item search
  4883. Specify the search strategy. Available values are:
  4884. @table @samp
  4885. @item exhaustive, 0
  4886. Set exhaustive search
  4887. @item less, 1
  4888. Set less exhaustive search.
  4889. @end table
  4890. Default value is @samp{exhaustive}.
  4891. @item filename
  4892. If set then a detailed log of the motion search is written to the
  4893. specified file.
  4894. @item opencl
  4895. If set to 1, specify using OpenCL capabilities, only available if
  4896. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  4897. @end table
  4898. @section detelecine
  4899. Apply an exact inverse of the telecine operation. It requires a predefined
  4900. pattern specified using the pattern option which must be the same as that passed
  4901. to the telecine filter.
  4902. This filter accepts the following options:
  4903. @table @option
  4904. @item first_field
  4905. @table @samp
  4906. @item top, t
  4907. top field first
  4908. @item bottom, b
  4909. bottom field first
  4910. The default value is @code{top}.
  4911. @end table
  4912. @item pattern
  4913. A string of numbers representing the pulldown pattern you wish to apply.
  4914. The default value is @code{23}.
  4915. @item start_frame
  4916. A number representing position of the first frame with respect to the telecine
  4917. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  4918. @end table
  4919. @section dilation
  4920. Apply dilation effect to the video.
  4921. This filter replaces the pixel by the local(3x3) maximum.
  4922. It accepts the following options:
  4923. @table @option
  4924. @item threshold0
  4925. @item threshold1
  4926. @item threshold2
  4927. @item threshold3
  4928. Limit the maximum change for each plane, default is 65535.
  4929. If 0, plane will remain unchanged.
  4930. @item coordinates
  4931. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  4932. pixels are used.
  4933. Flags to local 3x3 coordinates maps like this:
  4934. 1 2 3
  4935. 4 5
  4936. 6 7 8
  4937. @end table
  4938. @section displace
  4939. Displace pixels as indicated by second and third input stream.
  4940. It takes three input streams and outputs one stream, the first input is the
  4941. source, and second and third input are displacement maps.
  4942. The second input specifies how much to displace pixels along the
  4943. x-axis, while the third input specifies how much to displace pixels
  4944. along the y-axis.
  4945. If one of displacement map streams terminates, last frame from that
  4946. displacement map will be used.
  4947. Note that once generated, displacements maps can be reused over and over again.
  4948. A description of the accepted options follows.
  4949. @table @option
  4950. @item edge
  4951. Set displace behavior for pixels that are out of range.
  4952. Available values are:
  4953. @table @samp
  4954. @item blank
  4955. Missing pixels are replaced by black pixels.
  4956. @item smear
  4957. Adjacent pixels will spread out to replace missing pixels.
  4958. @item wrap
  4959. Out of range pixels are wrapped so they point to pixels of other side.
  4960. @end table
  4961. Default is @samp{smear}.
  4962. @end table
  4963. @subsection Examples
  4964. @itemize
  4965. @item
  4966. Add ripple effect to rgb input of video size hd720:
  4967. @example
  4968. 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
  4969. @end example
  4970. @item
  4971. Add wave effect to rgb input of video size hd720:
  4972. @example
  4973. 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
  4974. @end example
  4975. @end itemize
  4976. @section drawbox
  4977. Draw a colored box on the input image.
  4978. It accepts the following parameters:
  4979. @table @option
  4980. @item x
  4981. @item y
  4982. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  4983. @item width, w
  4984. @item height, h
  4985. The expressions which specify the width and height of the box; if 0 they are interpreted as
  4986. the input width and height. It defaults to 0.
  4987. @item color, c
  4988. Specify the color of the box to write. For the general syntax of this option,
  4989. check the "Color" section in the ffmpeg-utils manual. If the special
  4990. value @code{invert} is used, the box edge color is the same as the
  4991. video with inverted luma.
  4992. @item thickness, t
  4993. The expression which sets the thickness of the box edge. Default value is @code{3}.
  4994. See below for the list of accepted constants.
  4995. @end table
  4996. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  4997. following constants:
  4998. @table @option
  4999. @item dar
  5000. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5001. @item hsub
  5002. @item vsub
  5003. horizontal and vertical chroma subsample values. For example for the
  5004. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5005. @item in_h, ih
  5006. @item in_w, iw
  5007. The input width and height.
  5008. @item sar
  5009. The input sample aspect ratio.
  5010. @item x
  5011. @item y
  5012. The x and y offset coordinates where the box is drawn.
  5013. @item w
  5014. @item h
  5015. The width and height of the drawn box.
  5016. @item t
  5017. The thickness of the drawn box.
  5018. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5019. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5020. @end table
  5021. @subsection Examples
  5022. @itemize
  5023. @item
  5024. Draw a black box around the edge of the input image:
  5025. @example
  5026. drawbox
  5027. @end example
  5028. @item
  5029. Draw a box with color red and an opacity of 50%:
  5030. @example
  5031. drawbox=10:20:200:60:red@@0.5
  5032. @end example
  5033. The previous example can be specified as:
  5034. @example
  5035. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5036. @end example
  5037. @item
  5038. Fill the box with pink color:
  5039. @example
  5040. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  5041. @end example
  5042. @item
  5043. Draw a 2-pixel red 2.40:1 mask:
  5044. @example
  5045. 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
  5046. @end example
  5047. @end itemize
  5048. @section drawgrid
  5049. Draw a grid on the input image.
  5050. It accepts the following parameters:
  5051. @table @option
  5052. @item x
  5053. @item y
  5054. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5055. @item width, w
  5056. @item height, h
  5057. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5058. input width and height, respectively, minus @code{thickness}, so image gets
  5059. framed. Default to 0.
  5060. @item color, c
  5061. Specify the color of the grid. For the general syntax of this option,
  5062. check the "Color" section in the ffmpeg-utils manual. If the special
  5063. value @code{invert} is used, the grid color is the same as the
  5064. video with inverted luma.
  5065. @item thickness, t
  5066. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5067. See below for the list of accepted constants.
  5068. @end table
  5069. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5070. following constants:
  5071. @table @option
  5072. @item dar
  5073. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5074. @item hsub
  5075. @item vsub
  5076. horizontal and vertical chroma subsample values. For example for the
  5077. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5078. @item in_h, ih
  5079. @item in_w, iw
  5080. The input grid cell width and height.
  5081. @item sar
  5082. The input sample aspect ratio.
  5083. @item x
  5084. @item y
  5085. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5086. @item w
  5087. @item h
  5088. The width and height of the drawn cell.
  5089. @item t
  5090. The thickness of the drawn cell.
  5091. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5092. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5093. @end table
  5094. @subsection Examples
  5095. @itemize
  5096. @item
  5097. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5098. @example
  5099. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5100. @end example
  5101. @item
  5102. Draw a white 3x3 grid with an opacity of 50%:
  5103. @example
  5104. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5105. @end example
  5106. @end itemize
  5107. @anchor{drawtext}
  5108. @section drawtext
  5109. Draw a text string or text from a specified file on top of a video, using the
  5110. libfreetype library.
  5111. To enable compilation of this filter, you need to configure FFmpeg with
  5112. @code{--enable-libfreetype}.
  5113. To enable default font fallback and the @var{font} option you need to
  5114. configure FFmpeg with @code{--enable-libfontconfig}.
  5115. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5116. @code{--enable-libfribidi}.
  5117. @subsection Syntax
  5118. It accepts the following parameters:
  5119. @table @option
  5120. @item box
  5121. Used to draw a box around text using the background color.
  5122. The value must be either 1 (enable) or 0 (disable).
  5123. The default value of @var{box} is 0.
  5124. @item boxborderw
  5125. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5126. The default value of @var{boxborderw} is 0.
  5127. @item boxcolor
  5128. The color to be used for drawing box around text. For the syntax of this
  5129. option, check the "Color" section in the ffmpeg-utils manual.
  5130. The default value of @var{boxcolor} is "white".
  5131. @item borderw
  5132. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5133. The default value of @var{borderw} is 0.
  5134. @item bordercolor
  5135. Set the color to be used for drawing border around text. For the syntax of this
  5136. option, check the "Color" section in the ffmpeg-utils manual.
  5137. The default value of @var{bordercolor} is "black".
  5138. @item expansion
  5139. Select how the @var{text} is expanded. Can be either @code{none},
  5140. @code{strftime} (deprecated) or
  5141. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5142. below for details.
  5143. @item fix_bounds
  5144. If true, check and fix text coords to avoid clipping.
  5145. @item fontcolor
  5146. The color to be used for drawing fonts. For the syntax of this option, check
  5147. the "Color" section in the ffmpeg-utils manual.
  5148. The default value of @var{fontcolor} is "black".
  5149. @item fontcolor_expr
  5150. String which is expanded the same way as @var{text} to obtain dynamic
  5151. @var{fontcolor} value. By default this option has empty value and is not
  5152. processed. When this option is set, it overrides @var{fontcolor} option.
  5153. @item font
  5154. The font family to be used for drawing text. By default Sans.
  5155. @item fontfile
  5156. The font file to be used for drawing text. The path must be included.
  5157. This parameter is mandatory if the fontconfig support is disabled.
  5158. @item draw
  5159. This option does not exist, please see the timeline system
  5160. @item alpha
  5161. Draw the text applying alpha blending. The value can
  5162. be either a number between 0.0 and 1.0
  5163. The expression accepts the same variables @var{x, y} do.
  5164. The default value is 1.
  5165. Please see fontcolor_expr
  5166. @item fontsize
  5167. The font size to be used for drawing text.
  5168. The default value of @var{fontsize} is 16.
  5169. @item text_shaping
  5170. If set to 1, attempt to shape the text (for example, reverse the order of
  5171. right-to-left text and join Arabic characters) before drawing it.
  5172. Otherwise, just draw the text exactly as given.
  5173. By default 1 (if supported).
  5174. @item ft_load_flags
  5175. The flags to be used for loading the fonts.
  5176. The flags map the corresponding flags supported by libfreetype, and are
  5177. a combination of the following values:
  5178. @table @var
  5179. @item default
  5180. @item no_scale
  5181. @item no_hinting
  5182. @item render
  5183. @item no_bitmap
  5184. @item vertical_layout
  5185. @item force_autohint
  5186. @item crop_bitmap
  5187. @item pedantic
  5188. @item ignore_global_advance_width
  5189. @item no_recurse
  5190. @item ignore_transform
  5191. @item monochrome
  5192. @item linear_design
  5193. @item no_autohint
  5194. @end table
  5195. Default value is "default".
  5196. For more information consult the documentation for the FT_LOAD_*
  5197. libfreetype flags.
  5198. @item shadowcolor
  5199. The color to be used for drawing a shadow behind the drawn text. For the
  5200. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  5201. The default value of @var{shadowcolor} is "black".
  5202. @item shadowx
  5203. @item shadowy
  5204. The x and y offsets for the text shadow position with respect to the
  5205. position of the text. They can be either positive or negative
  5206. values. The default value for both is "0".
  5207. @item start_number
  5208. The starting frame number for the n/frame_num variable. The default value
  5209. is "0".
  5210. @item tabsize
  5211. The size in number of spaces to use for rendering the tab.
  5212. Default value is 4.
  5213. @item timecode
  5214. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5215. format. It can be used with or without text parameter. @var{timecode_rate}
  5216. option must be specified.
  5217. @item timecode_rate, rate, r
  5218. Set the timecode frame rate (timecode only).
  5219. @item text
  5220. The text string to be drawn. The text must be a sequence of UTF-8
  5221. encoded characters.
  5222. This parameter is mandatory if no file is specified with the parameter
  5223. @var{textfile}.
  5224. @item textfile
  5225. A text file containing text to be drawn. The text must be a sequence
  5226. of UTF-8 encoded characters.
  5227. This parameter is mandatory if no text string is specified with the
  5228. parameter @var{text}.
  5229. If both @var{text} and @var{textfile} are specified, an error is thrown.
  5230. @item reload
  5231. If set to 1, the @var{textfile} will be reloaded before each frame.
  5232. Be sure to update it atomically, or it may be read partially, or even fail.
  5233. @item x
  5234. @item y
  5235. The expressions which specify the offsets where text will be drawn
  5236. within the video frame. They are relative to the top/left border of the
  5237. output image.
  5238. The default value of @var{x} and @var{y} is "0".
  5239. See below for the list of accepted constants and functions.
  5240. @end table
  5241. The parameters for @var{x} and @var{y} are expressions containing the
  5242. following constants and functions:
  5243. @table @option
  5244. @item dar
  5245. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  5246. @item hsub
  5247. @item vsub
  5248. horizontal and vertical chroma subsample values. For example for the
  5249. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5250. @item line_h, lh
  5251. the height of each text line
  5252. @item main_h, h, H
  5253. the input height
  5254. @item main_w, w, W
  5255. the input width
  5256. @item max_glyph_a, ascent
  5257. the maximum distance from the baseline to the highest/upper grid
  5258. coordinate used to place a glyph outline point, for all the rendered
  5259. glyphs.
  5260. It is a positive value, due to the grid's orientation with the Y axis
  5261. upwards.
  5262. @item max_glyph_d, descent
  5263. the maximum distance from the baseline to the lowest grid coordinate
  5264. used to place a glyph outline point, for all the rendered glyphs.
  5265. This is a negative value, due to the grid's orientation, with the Y axis
  5266. upwards.
  5267. @item max_glyph_h
  5268. maximum glyph height, that is the maximum height for all the glyphs
  5269. contained in the rendered text, it is equivalent to @var{ascent} -
  5270. @var{descent}.
  5271. @item max_glyph_w
  5272. maximum glyph width, that is the maximum width for all the glyphs
  5273. contained in the rendered text
  5274. @item n
  5275. the number of input frame, starting from 0
  5276. @item rand(min, max)
  5277. return a random number included between @var{min} and @var{max}
  5278. @item sar
  5279. The input sample aspect ratio.
  5280. @item t
  5281. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5282. @item text_h, th
  5283. the height of the rendered text
  5284. @item text_w, tw
  5285. the width of the rendered text
  5286. @item x
  5287. @item y
  5288. the x and y offset coordinates where the text is drawn.
  5289. These parameters allow the @var{x} and @var{y} expressions to refer
  5290. each other, so you can for example specify @code{y=x/dar}.
  5291. @end table
  5292. @anchor{drawtext_expansion}
  5293. @subsection Text expansion
  5294. If @option{expansion} is set to @code{strftime},
  5295. the filter recognizes strftime() sequences in the provided text and
  5296. expands them accordingly. Check the documentation of strftime(). This
  5297. feature is deprecated.
  5298. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  5299. If @option{expansion} is set to @code{normal} (which is the default),
  5300. the following expansion mechanism is used.
  5301. The backslash character @samp{\}, followed by any character, always expands to
  5302. the second character.
  5303. Sequence of the form @code{%@{...@}} are expanded. The text between the
  5304. braces is a function name, possibly followed by arguments separated by ':'.
  5305. If the arguments contain special characters or delimiters (':' or '@}'),
  5306. they should be escaped.
  5307. Note that they probably must also be escaped as the value for the
  5308. @option{text} option in the filter argument string and as the filter
  5309. argument in the filtergraph description, and possibly also for the shell,
  5310. that makes up to four levels of escaping; using a text file avoids these
  5311. problems.
  5312. The following functions are available:
  5313. @table @command
  5314. @item expr, e
  5315. The expression evaluation result.
  5316. It must take one argument specifying the expression to be evaluated,
  5317. which accepts the same constants and functions as the @var{x} and
  5318. @var{y} values. Note that not all constants should be used, for
  5319. example the text size is not known when evaluating the expression, so
  5320. the constants @var{text_w} and @var{text_h} will have an undefined
  5321. value.
  5322. @item expr_int_format, eif
  5323. Evaluate the expression's value and output as formatted integer.
  5324. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  5325. The second argument specifies the output format. Allowed values are @samp{x},
  5326. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  5327. @code{printf} function.
  5328. The third parameter is optional and sets the number of positions taken by the output.
  5329. It can be used to add padding with zeros from the left.
  5330. @item gmtime
  5331. The time at which the filter is running, expressed in UTC.
  5332. It can accept an argument: a strftime() format string.
  5333. @item localtime
  5334. The time at which the filter is running, expressed in the local time zone.
  5335. It can accept an argument: a strftime() format string.
  5336. @item metadata
  5337. Frame metadata. Takes one or two arguments.
  5338. The first argument is mandatory and specifies the metadata key.
  5339. The second argument is optional and specifies a default value, used when the
  5340. metadata key is not found or empty.
  5341. @item n, frame_num
  5342. The frame number, starting from 0.
  5343. @item pict_type
  5344. A 1 character description of the current picture type.
  5345. @item pts
  5346. The timestamp of the current frame.
  5347. It can take up to three arguments.
  5348. The first argument is the format of the timestamp; it defaults to @code{flt}
  5349. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  5350. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  5351. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  5352. @code{localtime} stands for the timestamp of the frame formatted as
  5353. local time zone time.
  5354. The second argument is an offset added to the timestamp.
  5355. If the format is set to @code{localtime} or @code{gmtime},
  5356. a third argument may be supplied: a strftime() format string.
  5357. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  5358. @end table
  5359. @subsection Examples
  5360. @itemize
  5361. @item
  5362. Draw "Test Text" with font FreeSerif, using the default values for the
  5363. optional parameters.
  5364. @example
  5365. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  5366. @end example
  5367. @item
  5368. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  5369. and y=50 (counting from the top-left corner of the screen), text is
  5370. yellow with a red box around it. Both the text and the box have an
  5371. opacity of 20%.
  5372. @example
  5373. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  5374. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  5375. @end example
  5376. Note that the double quotes are not necessary if spaces are not used
  5377. within the parameter list.
  5378. @item
  5379. Show the text at the center of the video frame:
  5380. @example
  5381. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  5382. @end example
  5383. @item
  5384. Show the text at a random position, switching to a new position every 30 seconds:
  5385. @example
  5386. 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)"
  5387. @end example
  5388. @item
  5389. Show a text line sliding from right to left in the last row of the video
  5390. frame. The file @file{LONG_LINE} is assumed to contain a single line
  5391. with no newlines.
  5392. @example
  5393. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  5394. @end example
  5395. @item
  5396. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  5397. @example
  5398. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  5399. @end example
  5400. @item
  5401. Draw a single green letter "g", at the center of the input video.
  5402. The glyph baseline is placed at half screen height.
  5403. @example
  5404. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  5405. @end example
  5406. @item
  5407. Show text for 1 second every 3 seconds:
  5408. @example
  5409. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  5410. @end example
  5411. @item
  5412. Use fontconfig to set the font. Note that the colons need to be escaped.
  5413. @example
  5414. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  5415. @end example
  5416. @item
  5417. Print the date of a real-time encoding (see strftime(3)):
  5418. @example
  5419. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  5420. @end example
  5421. @item
  5422. Show text fading in and out (appearing/disappearing):
  5423. @example
  5424. #!/bin/sh
  5425. DS=1.0 # display start
  5426. DE=10.0 # display end
  5427. FID=1.5 # fade in duration
  5428. FOD=5 # fade out duration
  5429. 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 @}"
  5430. @end example
  5431. @end itemize
  5432. For more information about libfreetype, check:
  5433. @url{http://www.freetype.org/}.
  5434. For more information about fontconfig, check:
  5435. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  5436. For more information about libfribidi, check:
  5437. @url{http://fribidi.org/}.
  5438. @section edgedetect
  5439. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  5440. The filter accepts the following options:
  5441. @table @option
  5442. @item low
  5443. @item high
  5444. Set low and high threshold values used by the Canny thresholding
  5445. algorithm.
  5446. The high threshold selects the "strong" edge pixels, which are then
  5447. connected through 8-connectivity with the "weak" edge pixels selected
  5448. by the low threshold.
  5449. @var{low} and @var{high} threshold values must be chosen in the range
  5450. [0,1], and @var{low} should be lesser or equal to @var{high}.
  5451. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  5452. is @code{50/255}.
  5453. @item mode
  5454. Define the drawing mode.
  5455. @table @samp
  5456. @item wires
  5457. Draw white/gray wires on black background.
  5458. @item colormix
  5459. Mix the colors to create a paint/cartoon effect.
  5460. @end table
  5461. Default value is @var{wires}.
  5462. @end table
  5463. @subsection Examples
  5464. @itemize
  5465. @item
  5466. Standard edge detection with custom values for the hysteresis thresholding:
  5467. @example
  5468. edgedetect=low=0.1:high=0.4
  5469. @end example
  5470. @item
  5471. Painting effect without thresholding:
  5472. @example
  5473. edgedetect=mode=colormix:high=0
  5474. @end example
  5475. @end itemize
  5476. @section eq
  5477. Set brightness, contrast, saturation and approximate gamma adjustment.
  5478. The filter accepts the following options:
  5479. @table @option
  5480. @item contrast
  5481. Set the contrast expression. The value must be a float value in range
  5482. @code{-2.0} to @code{2.0}. The default value is "1".
  5483. @item brightness
  5484. Set the brightness expression. The value must be a float value in
  5485. range @code{-1.0} to @code{1.0}. The default value is "0".
  5486. @item saturation
  5487. Set the saturation expression. The value must be a float in
  5488. range @code{0.0} to @code{3.0}. The default value is "1".
  5489. @item gamma
  5490. Set the gamma expression. The value must be a float in range
  5491. @code{0.1} to @code{10.0}. The default value is "1".
  5492. @item gamma_r
  5493. Set the gamma expression for red. The value must be a float in
  5494. range @code{0.1} to @code{10.0}. The default value is "1".
  5495. @item gamma_g
  5496. Set the gamma expression for green. The value must be a float in range
  5497. @code{0.1} to @code{10.0}. The default value is "1".
  5498. @item gamma_b
  5499. Set the gamma expression for blue. The value must be a float in range
  5500. @code{0.1} to @code{10.0}. The default value is "1".
  5501. @item gamma_weight
  5502. Set the gamma weight expression. It can be used to reduce the effect
  5503. of a high gamma value on bright image areas, e.g. keep them from
  5504. getting overamplified and just plain white. The value must be a float
  5505. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  5506. gamma correction all the way down while @code{1.0} leaves it at its
  5507. full strength. Default is "1".
  5508. @item eval
  5509. Set when the expressions for brightness, contrast, saturation and
  5510. gamma expressions are evaluated.
  5511. It accepts the following values:
  5512. @table @samp
  5513. @item init
  5514. only evaluate expressions once during the filter initialization or
  5515. when a command is processed
  5516. @item frame
  5517. evaluate expressions for each incoming frame
  5518. @end table
  5519. Default value is @samp{init}.
  5520. @end table
  5521. The expressions accept the following parameters:
  5522. @table @option
  5523. @item n
  5524. frame count of the input frame starting from 0
  5525. @item pos
  5526. byte position of the corresponding packet in the input file, NAN if
  5527. unspecified
  5528. @item r
  5529. frame rate of the input video, NAN if the input frame rate is unknown
  5530. @item t
  5531. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5532. @end table
  5533. @subsection Commands
  5534. The filter supports the following commands:
  5535. @table @option
  5536. @item contrast
  5537. Set the contrast expression.
  5538. @item brightness
  5539. Set the brightness expression.
  5540. @item saturation
  5541. Set the saturation expression.
  5542. @item gamma
  5543. Set the gamma expression.
  5544. @item gamma_r
  5545. Set the gamma_r expression.
  5546. @item gamma_g
  5547. Set gamma_g expression.
  5548. @item gamma_b
  5549. Set gamma_b expression.
  5550. @item gamma_weight
  5551. Set gamma_weight expression.
  5552. The command accepts the same syntax of the corresponding option.
  5553. If the specified expression is not valid, it is kept at its current
  5554. value.
  5555. @end table
  5556. @section erosion
  5557. Apply erosion effect to the video.
  5558. This filter replaces the pixel by the local(3x3) minimum.
  5559. It accepts the following options:
  5560. @table @option
  5561. @item threshold0
  5562. @item threshold1
  5563. @item threshold2
  5564. @item threshold3
  5565. Limit the maximum change for each plane, default is 65535.
  5566. If 0, plane will remain unchanged.
  5567. @item coordinates
  5568. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5569. pixels are used.
  5570. Flags to local 3x3 coordinates maps like this:
  5571. 1 2 3
  5572. 4 5
  5573. 6 7 8
  5574. @end table
  5575. @section extractplanes
  5576. Extract color channel components from input video stream into
  5577. separate grayscale video streams.
  5578. The filter accepts the following option:
  5579. @table @option
  5580. @item planes
  5581. Set plane(s) to extract.
  5582. Available values for planes are:
  5583. @table @samp
  5584. @item y
  5585. @item u
  5586. @item v
  5587. @item a
  5588. @item r
  5589. @item g
  5590. @item b
  5591. @end table
  5592. Choosing planes not available in the input will result in an error.
  5593. That means you cannot select @code{r}, @code{g}, @code{b} planes
  5594. with @code{y}, @code{u}, @code{v} planes at same time.
  5595. @end table
  5596. @subsection Examples
  5597. @itemize
  5598. @item
  5599. Extract luma, u and v color channel component from input video frame
  5600. into 3 grayscale outputs:
  5601. @example
  5602. 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
  5603. @end example
  5604. @end itemize
  5605. @section elbg
  5606. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  5607. For each input image, the filter will compute the optimal mapping from
  5608. the input to the output given the codebook length, that is the number
  5609. of distinct output colors.
  5610. This filter accepts the following options.
  5611. @table @option
  5612. @item codebook_length, l
  5613. Set codebook length. The value must be a positive integer, and
  5614. represents the number of distinct output colors. Default value is 256.
  5615. @item nb_steps, n
  5616. Set the maximum number of iterations to apply for computing the optimal
  5617. mapping. The higher the value the better the result and the higher the
  5618. computation time. Default value is 1.
  5619. @item seed, s
  5620. Set a random seed, must be an integer included between 0 and
  5621. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  5622. will try to use a good random seed on a best effort basis.
  5623. @item pal8
  5624. Set pal8 output pixel format. This option does not work with codebook
  5625. length greater than 256.
  5626. @end table
  5627. @section fade
  5628. Apply a fade-in/out effect to the input video.
  5629. It accepts the following parameters:
  5630. @table @option
  5631. @item type, t
  5632. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  5633. effect.
  5634. Default is @code{in}.
  5635. @item start_frame, s
  5636. Specify the number of the frame to start applying the fade
  5637. effect at. Default is 0.
  5638. @item nb_frames, n
  5639. The number of frames that the fade effect lasts. At the end of the
  5640. fade-in effect, the output video will have the same intensity as the input video.
  5641. At the end of the fade-out transition, the output video will be filled with the
  5642. selected @option{color}.
  5643. Default is 25.
  5644. @item alpha
  5645. If set to 1, fade only alpha channel, if one exists on the input.
  5646. Default value is 0.
  5647. @item start_time, st
  5648. Specify the timestamp (in seconds) of the frame to start to apply the fade
  5649. effect. If both start_frame and start_time are specified, the fade will start at
  5650. whichever comes last. Default is 0.
  5651. @item duration, d
  5652. The number of seconds for which the fade effect has to last. At the end of the
  5653. fade-in effect the output video will have the same intensity as the input video,
  5654. at the end of the fade-out transition the output video will be filled with the
  5655. selected @option{color}.
  5656. If both duration and nb_frames are specified, duration is used. Default is 0
  5657. (nb_frames is used by default).
  5658. @item color, c
  5659. Specify the color of the fade. Default is "black".
  5660. @end table
  5661. @subsection Examples
  5662. @itemize
  5663. @item
  5664. Fade in the first 30 frames of video:
  5665. @example
  5666. fade=in:0:30
  5667. @end example
  5668. The command above is equivalent to:
  5669. @example
  5670. fade=t=in:s=0:n=30
  5671. @end example
  5672. @item
  5673. Fade out the last 45 frames of a 200-frame video:
  5674. @example
  5675. fade=out:155:45
  5676. fade=type=out:start_frame=155:nb_frames=45
  5677. @end example
  5678. @item
  5679. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  5680. @example
  5681. fade=in:0:25, fade=out:975:25
  5682. @end example
  5683. @item
  5684. Make the first 5 frames yellow, then fade in from frame 5-24:
  5685. @example
  5686. fade=in:5:20:color=yellow
  5687. @end example
  5688. @item
  5689. Fade in alpha over first 25 frames of video:
  5690. @example
  5691. fade=in:0:25:alpha=1
  5692. @end example
  5693. @item
  5694. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  5695. @example
  5696. fade=t=in:st=5.5:d=0.5
  5697. @end example
  5698. @end itemize
  5699. @section fftfilt
  5700. Apply arbitrary expressions to samples in frequency domain
  5701. @table @option
  5702. @item dc_Y
  5703. Adjust the dc value (gain) of the luma plane of the image. The filter
  5704. accepts an integer value in range @code{0} to @code{1000}. The default
  5705. value is set to @code{0}.
  5706. @item dc_U
  5707. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  5708. filter accepts an integer value in range @code{0} to @code{1000}. The
  5709. default value is set to @code{0}.
  5710. @item dc_V
  5711. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  5712. filter accepts an integer value in range @code{0} to @code{1000}. The
  5713. default value is set to @code{0}.
  5714. @item weight_Y
  5715. Set the frequency domain weight expression for the luma plane.
  5716. @item weight_U
  5717. Set the frequency domain weight expression for the 1st chroma plane.
  5718. @item weight_V
  5719. Set the frequency domain weight expression for the 2nd chroma plane.
  5720. The filter accepts the following variables:
  5721. @item X
  5722. @item Y
  5723. The coordinates of the current sample.
  5724. @item W
  5725. @item H
  5726. The width and height of the image.
  5727. @end table
  5728. @subsection Examples
  5729. @itemize
  5730. @item
  5731. High-pass:
  5732. @example
  5733. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  5734. @end example
  5735. @item
  5736. Low-pass:
  5737. @example
  5738. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  5739. @end example
  5740. @item
  5741. Sharpen:
  5742. @example
  5743. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  5744. @end example
  5745. @item
  5746. Blur:
  5747. @example
  5748. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  5749. @end example
  5750. @end itemize
  5751. @section field
  5752. Extract a single field from an interlaced image using stride
  5753. arithmetic to avoid wasting CPU time. The output frames are marked as
  5754. non-interlaced.
  5755. The filter accepts the following options:
  5756. @table @option
  5757. @item type
  5758. Specify whether to extract the top (if the value is @code{0} or
  5759. @code{top}) or the bottom field (if the value is @code{1} or
  5760. @code{bottom}).
  5761. @end table
  5762. @section fieldhint
  5763. Create new frames by copying the top and bottom fields from surrounding frames
  5764. supplied as numbers by the hint file.
  5765. @table @option
  5766. @item hint
  5767. Set file containing hints: absolute/relative frame numbers.
  5768. There must be one line for each frame in a clip. Each line must contain two
  5769. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  5770. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  5771. is current frame number for @code{absolute} mode or out of [-1, 1] range
  5772. for @code{relative} mode. First number tells from which frame to pick up top
  5773. field and second number tells from which frame to pick up bottom field.
  5774. If optionally followed by @code{+} output frame will be marked as interlaced,
  5775. else if followed by @code{-} output frame will be marked as progressive, else
  5776. it will be marked same as input frame.
  5777. If line starts with @code{#} or @code{;} that line is skipped.
  5778. @item mode
  5779. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  5780. @end table
  5781. Example of first several lines of @code{hint} file for @code{relative} mode:
  5782. @example
  5783. 0,0 - # first frame
  5784. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  5785. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  5786. 1,0 -
  5787. 0,0 -
  5788. 0,0 -
  5789. 1,0 -
  5790. 1,0 -
  5791. 1,0 -
  5792. 0,0 -
  5793. 0,0 -
  5794. 1,0 -
  5795. 1,0 -
  5796. 1,0 -
  5797. 0,0 -
  5798. @end example
  5799. @section fieldmatch
  5800. Field matching filter for inverse telecine. It is meant to reconstruct the
  5801. progressive frames from a telecined stream. The filter does not drop duplicated
  5802. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  5803. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  5804. The separation of the field matching and the decimation is notably motivated by
  5805. the possibility of inserting a de-interlacing filter fallback between the two.
  5806. If the source has mixed telecined and real interlaced content,
  5807. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  5808. But these remaining combed frames will be marked as interlaced, and thus can be
  5809. de-interlaced by a later filter such as @ref{yadif} before decimation.
  5810. In addition to the various configuration options, @code{fieldmatch} can take an
  5811. optional second stream, activated through the @option{ppsrc} option. If
  5812. enabled, the frames reconstruction will be based on the fields and frames from
  5813. this second stream. This allows the first input to be pre-processed in order to
  5814. help the various algorithms of the filter, while keeping the output lossless
  5815. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  5816. or brightness/contrast adjustments can help.
  5817. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  5818. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  5819. which @code{fieldmatch} is based on. While the semantic and usage are very
  5820. close, some behaviour and options names can differ.
  5821. The @ref{decimate} filter currently only works for constant frame rate input.
  5822. If your input has mixed telecined (30fps) and progressive content with a lower
  5823. framerate like 24fps use the following filterchain to produce the necessary cfr
  5824. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  5825. The filter accepts the following options:
  5826. @table @option
  5827. @item order
  5828. Specify the assumed field order of the input stream. Available values are:
  5829. @table @samp
  5830. @item auto
  5831. Auto detect parity (use FFmpeg's internal parity value).
  5832. @item bff
  5833. Assume bottom field first.
  5834. @item tff
  5835. Assume top field first.
  5836. @end table
  5837. Note that it is sometimes recommended not to trust the parity announced by the
  5838. stream.
  5839. Default value is @var{auto}.
  5840. @item mode
  5841. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  5842. sense that it won't risk creating jerkiness due to duplicate frames when
  5843. possible, but if there are bad edits or blended fields it will end up
  5844. outputting combed frames when a good match might actually exist. On the other
  5845. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  5846. but will almost always find a good frame if there is one. The other values are
  5847. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  5848. jerkiness and creating duplicate frames versus finding good matches in sections
  5849. with bad edits, orphaned fields, blended fields, etc.
  5850. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  5851. Available values are:
  5852. @table @samp
  5853. @item pc
  5854. 2-way matching (p/c)
  5855. @item pc_n
  5856. 2-way matching, and trying 3rd match if still combed (p/c + n)
  5857. @item pc_u
  5858. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  5859. @item pc_n_ub
  5860. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  5861. still combed (p/c + n + u/b)
  5862. @item pcn
  5863. 3-way matching (p/c/n)
  5864. @item pcn_ub
  5865. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  5866. detected as combed (p/c/n + u/b)
  5867. @end table
  5868. The parenthesis at the end indicate the matches that would be used for that
  5869. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  5870. @var{top}).
  5871. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  5872. the slowest.
  5873. Default value is @var{pc_n}.
  5874. @item ppsrc
  5875. Mark the main input stream as a pre-processed input, and enable the secondary
  5876. input stream as the clean source to pick the fields from. See the filter
  5877. introduction for more details. It is similar to the @option{clip2} feature from
  5878. VFM/TFM.
  5879. Default value is @code{0} (disabled).
  5880. @item field
  5881. Set the field to match from. It is recommended to set this to the same value as
  5882. @option{order} unless you experience matching failures with that setting. In
  5883. certain circumstances changing the field that is used to match from can have a
  5884. large impact on matching performance. Available values are:
  5885. @table @samp
  5886. @item auto
  5887. Automatic (same value as @option{order}).
  5888. @item bottom
  5889. Match from the bottom field.
  5890. @item top
  5891. Match from the top field.
  5892. @end table
  5893. Default value is @var{auto}.
  5894. @item mchroma
  5895. Set whether or not chroma is included during the match comparisons. In most
  5896. cases it is recommended to leave this enabled. You should set this to @code{0}
  5897. only if your clip has bad chroma problems such as heavy rainbowing or other
  5898. artifacts. Setting this to @code{0} could also be used to speed things up at
  5899. the cost of some accuracy.
  5900. Default value is @code{1}.
  5901. @item y0
  5902. @item y1
  5903. These define an exclusion band which excludes the lines between @option{y0} and
  5904. @option{y1} from being included in the field matching decision. An exclusion
  5905. band can be used to ignore subtitles, a logo, or other things that may
  5906. interfere with the matching. @option{y0} sets the starting scan line and
  5907. @option{y1} sets the ending line; all lines in between @option{y0} and
  5908. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  5909. @option{y0} and @option{y1} to the same value will disable the feature.
  5910. @option{y0} and @option{y1} defaults to @code{0}.
  5911. @item scthresh
  5912. Set the scene change detection threshold as a percentage of maximum change on
  5913. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  5914. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  5915. @option{scthresh} is @code{[0.0, 100.0]}.
  5916. Default value is @code{12.0}.
  5917. @item combmatch
  5918. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  5919. account the combed scores of matches when deciding what match to use as the
  5920. final match. Available values are:
  5921. @table @samp
  5922. @item none
  5923. No final matching based on combed scores.
  5924. @item sc
  5925. Combed scores are only used when a scene change is detected.
  5926. @item full
  5927. Use combed scores all the time.
  5928. @end table
  5929. Default is @var{sc}.
  5930. @item combdbg
  5931. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  5932. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  5933. Available values are:
  5934. @table @samp
  5935. @item none
  5936. No forced calculation.
  5937. @item pcn
  5938. Force p/c/n calculations.
  5939. @item pcnub
  5940. Force p/c/n/u/b calculations.
  5941. @end table
  5942. Default value is @var{none}.
  5943. @item cthresh
  5944. This is the area combing threshold used for combed frame detection. This
  5945. essentially controls how "strong" or "visible" combing must be to be detected.
  5946. Larger values mean combing must be more visible and smaller values mean combing
  5947. can be less visible or strong and still be detected. Valid settings are from
  5948. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  5949. be detected as combed). This is basically a pixel difference value. A good
  5950. range is @code{[8, 12]}.
  5951. Default value is @code{9}.
  5952. @item chroma
  5953. Sets whether or not chroma is considered in the combed frame decision. Only
  5954. disable this if your source has chroma problems (rainbowing, etc.) that are
  5955. causing problems for the combed frame detection with chroma enabled. Actually,
  5956. using @option{chroma}=@var{0} is usually more reliable, except for the case
  5957. where there is chroma only combing in the source.
  5958. Default value is @code{0}.
  5959. @item blockx
  5960. @item blocky
  5961. Respectively set the x-axis and y-axis size of the window used during combed
  5962. frame detection. This has to do with the size of the area in which
  5963. @option{combpel} pixels are required to be detected as combed for a frame to be
  5964. declared combed. See the @option{combpel} parameter description for more info.
  5965. Possible values are any number that is a power of 2 starting at 4 and going up
  5966. to 512.
  5967. Default value is @code{16}.
  5968. @item combpel
  5969. The number of combed pixels inside any of the @option{blocky} by
  5970. @option{blockx} size blocks on the frame for the frame to be detected as
  5971. combed. While @option{cthresh} controls how "visible" the combing must be, this
  5972. setting controls "how much" combing there must be in any localized area (a
  5973. window defined by the @option{blockx} and @option{blocky} settings) on the
  5974. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  5975. which point no frames will ever be detected as combed). This setting is known
  5976. as @option{MI} in TFM/VFM vocabulary.
  5977. Default value is @code{80}.
  5978. @end table
  5979. @anchor{p/c/n/u/b meaning}
  5980. @subsection p/c/n/u/b meaning
  5981. @subsubsection p/c/n
  5982. We assume the following telecined stream:
  5983. @example
  5984. Top fields: 1 2 2 3 4
  5985. Bottom fields: 1 2 3 4 4
  5986. @end example
  5987. The numbers correspond to the progressive frame the fields relate to. Here, the
  5988. first two frames are progressive, the 3rd and 4th are combed, and so on.
  5989. When @code{fieldmatch} is configured to run a matching from bottom
  5990. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  5991. @example
  5992. Input stream:
  5993. T 1 2 2 3 4
  5994. B 1 2 3 4 4 <-- matching reference
  5995. Matches: c c n n c
  5996. Output stream:
  5997. T 1 2 3 4 4
  5998. B 1 2 3 4 4
  5999. @end example
  6000. As a result of the field matching, we can see that some frames get duplicated.
  6001. To perform a complete inverse telecine, you need to rely on a decimation filter
  6002. after this operation. See for instance the @ref{decimate} filter.
  6003. The same operation now matching from top fields (@option{field}=@var{top})
  6004. looks like this:
  6005. @example
  6006. Input stream:
  6007. T 1 2 2 3 4 <-- matching reference
  6008. B 1 2 3 4 4
  6009. Matches: c c p p c
  6010. Output stream:
  6011. T 1 2 2 3 4
  6012. B 1 2 2 3 4
  6013. @end example
  6014. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6015. basically, they refer to the frame and field of the opposite parity:
  6016. @itemize
  6017. @item @var{p} matches the field of the opposite parity in the previous frame
  6018. @item @var{c} matches the field of the opposite parity in the current frame
  6019. @item @var{n} matches the field of the opposite parity in the next frame
  6020. @end itemize
  6021. @subsubsection u/b
  6022. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6023. from the opposite parity flag. In the following examples, we assume that we are
  6024. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6025. 'x' is placed above and below each matched fields.
  6026. With bottom matching (@option{field}=@var{bottom}):
  6027. @example
  6028. Match: c p n b u
  6029. x x x x x
  6030. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6031. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6032. x x x x x
  6033. Output frames:
  6034. 2 1 2 2 2
  6035. 2 2 2 1 3
  6036. @end example
  6037. With top matching (@option{field}=@var{top}):
  6038. @example
  6039. Match: c p n b u
  6040. x x x x x
  6041. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6042. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6043. x x x x x
  6044. Output frames:
  6045. 2 2 2 1 2
  6046. 2 1 3 2 2
  6047. @end example
  6048. @subsection Examples
  6049. Simple IVTC of a top field first telecined stream:
  6050. @example
  6051. fieldmatch=order=tff:combmatch=none, decimate
  6052. @end example
  6053. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6054. @example
  6055. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6056. @end example
  6057. @section fieldorder
  6058. Transform the field order of the input video.
  6059. It accepts the following parameters:
  6060. @table @option
  6061. @item order
  6062. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6063. for bottom field first.
  6064. @end table
  6065. The default value is @samp{tff}.
  6066. The transformation is done by shifting the picture content up or down
  6067. by one line, and filling the remaining line with appropriate picture content.
  6068. This method is consistent with most broadcast field order converters.
  6069. If the input video is not flagged as being interlaced, or it is already
  6070. flagged as being of the required output field order, then this filter does
  6071. not alter the incoming video.
  6072. It is very useful when converting to or from PAL DV material,
  6073. which is bottom field first.
  6074. For example:
  6075. @example
  6076. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6077. @end example
  6078. @section fifo, afifo
  6079. Buffer input images and send them when they are requested.
  6080. It is mainly useful when auto-inserted by the libavfilter
  6081. framework.
  6082. It does not take parameters.
  6083. @section find_rect
  6084. Find a rectangular object
  6085. It accepts the following options:
  6086. @table @option
  6087. @item object
  6088. Filepath of the object image, needs to be in gray8.
  6089. @item threshold
  6090. Detection threshold, default is 0.5.
  6091. @item mipmaps
  6092. Number of mipmaps, default is 3.
  6093. @item xmin, ymin, xmax, ymax
  6094. Specifies the rectangle in which to search.
  6095. @end table
  6096. @subsection Examples
  6097. @itemize
  6098. @item
  6099. Generate a representative palette of a given video using @command{ffmpeg}:
  6100. @example
  6101. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6102. @end example
  6103. @end itemize
  6104. @section cover_rect
  6105. Cover a rectangular object
  6106. It accepts the following options:
  6107. @table @option
  6108. @item cover
  6109. Filepath of the optional cover image, needs to be in yuv420.
  6110. @item mode
  6111. Set covering mode.
  6112. It accepts the following values:
  6113. @table @samp
  6114. @item cover
  6115. cover it by the supplied image
  6116. @item blur
  6117. cover it by interpolating the surrounding pixels
  6118. @end table
  6119. Default value is @var{blur}.
  6120. @end table
  6121. @subsection Examples
  6122. @itemize
  6123. @item
  6124. Generate a representative palette of a given video using @command{ffmpeg}:
  6125. @example
  6126. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6127. @end example
  6128. @end itemize
  6129. @anchor{format}
  6130. @section format
  6131. Convert the input video to one of the specified pixel formats.
  6132. Libavfilter will try to pick one that is suitable as input to
  6133. the next filter.
  6134. It accepts the following parameters:
  6135. @table @option
  6136. @item pix_fmts
  6137. A '|'-separated list of pixel format names, such as
  6138. "pix_fmts=yuv420p|monow|rgb24".
  6139. @end table
  6140. @subsection Examples
  6141. @itemize
  6142. @item
  6143. Convert the input video to the @var{yuv420p} format
  6144. @example
  6145. format=pix_fmts=yuv420p
  6146. @end example
  6147. Convert the input video to any of the formats in the list
  6148. @example
  6149. format=pix_fmts=yuv420p|yuv444p|yuv410p
  6150. @end example
  6151. @end itemize
  6152. @anchor{fps}
  6153. @section fps
  6154. Convert the video to specified constant frame rate by duplicating or dropping
  6155. frames as necessary.
  6156. It accepts the following parameters:
  6157. @table @option
  6158. @item fps
  6159. The desired output frame rate. The default is @code{25}.
  6160. @item round
  6161. Rounding method.
  6162. Possible values are:
  6163. @table @option
  6164. @item zero
  6165. zero round towards 0
  6166. @item inf
  6167. round away from 0
  6168. @item down
  6169. round towards -infinity
  6170. @item up
  6171. round towards +infinity
  6172. @item near
  6173. round to nearest
  6174. @end table
  6175. The default is @code{near}.
  6176. @item start_time
  6177. Assume the first PTS should be the given value, in seconds. This allows for
  6178. padding/trimming at the start of stream. By default, no assumption is made
  6179. about the first frame's expected PTS, so no padding or trimming is done.
  6180. For example, this could be set to 0 to pad the beginning with duplicates of
  6181. the first frame if a video stream starts after the audio stream or to trim any
  6182. frames with a negative PTS.
  6183. @end table
  6184. Alternatively, the options can be specified as a flat string:
  6185. @var{fps}[:@var{round}].
  6186. See also the @ref{setpts} filter.
  6187. @subsection Examples
  6188. @itemize
  6189. @item
  6190. A typical usage in order to set the fps to 25:
  6191. @example
  6192. fps=fps=25
  6193. @end example
  6194. @item
  6195. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  6196. @example
  6197. fps=fps=film:round=near
  6198. @end example
  6199. @end itemize
  6200. @section framepack
  6201. Pack two different video streams into a stereoscopic video, setting proper
  6202. metadata on supported codecs. The two views should have the same size and
  6203. framerate and processing will stop when the shorter video ends. Please note
  6204. that you may conveniently adjust view properties with the @ref{scale} and
  6205. @ref{fps} filters.
  6206. It accepts the following parameters:
  6207. @table @option
  6208. @item format
  6209. The desired packing format. Supported values are:
  6210. @table @option
  6211. @item sbs
  6212. The views are next to each other (default).
  6213. @item tab
  6214. The views are on top of each other.
  6215. @item lines
  6216. The views are packed by line.
  6217. @item columns
  6218. The views are packed by column.
  6219. @item frameseq
  6220. The views are temporally interleaved.
  6221. @end table
  6222. @end table
  6223. Some examples:
  6224. @example
  6225. # Convert left and right views into a frame-sequential video
  6226. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  6227. # Convert views into a side-by-side video with the same output resolution as the input
  6228. 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
  6229. @end example
  6230. @section framerate
  6231. Change the frame rate by interpolating new video output frames from the source
  6232. frames.
  6233. This filter is not designed to function correctly with interlaced media. If
  6234. you wish to change the frame rate of interlaced media then you are required
  6235. to deinterlace before this filter and re-interlace after this filter.
  6236. A description of the accepted options follows.
  6237. @table @option
  6238. @item fps
  6239. Specify the output frames per second. This option can also be specified
  6240. as a value alone. The default is @code{50}.
  6241. @item interp_start
  6242. Specify the start of a range where the output frame will be created as a
  6243. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6244. the default is @code{15}.
  6245. @item interp_end
  6246. Specify the end of a range where the output frame will be created as a
  6247. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6248. the default is @code{240}.
  6249. @item scene
  6250. Specify the level at which a scene change is detected as a value between
  6251. 0 and 100 to indicate a new scene; a low value reflects a low
  6252. probability for the current frame to introduce a new scene, while a higher
  6253. value means the current frame is more likely to be one.
  6254. The default is @code{7}.
  6255. @item flags
  6256. Specify flags influencing the filter process.
  6257. Available value for @var{flags} is:
  6258. @table @option
  6259. @item scene_change_detect, scd
  6260. Enable scene change detection using the value of the option @var{scene}.
  6261. This flag is enabled by default.
  6262. @end table
  6263. @end table
  6264. @section framestep
  6265. Select one frame every N-th frame.
  6266. This filter accepts the following option:
  6267. @table @option
  6268. @item step
  6269. Select frame after every @code{step} frames.
  6270. Allowed values are positive integers higher than 0. Default value is @code{1}.
  6271. @end table
  6272. @anchor{frei0r}
  6273. @section frei0r
  6274. Apply a frei0r effect to the input video.
  6275. To enable the compilation of this filter, you need to install the frei0r
  6276. header and configure FFmpeg with @code{--enable-frei0r}.
  6277. It accepts the following parameters:
  6278. @table @option
  6279. @item filter_name
  6280. The name of the frei0r effect to load. If the environment variable
  6281. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  6282. directories specified by the colon-separated list in @env{FREIOR_PATH}.
  6283. Otherwise, the standard frei0r paths are searched, in this order:
  6284. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  6285. @file{/usr/lib/frei0r-1/}.
  6286. @item filter_params
  6287. A '|'-separated list of parameters to pass to the frei0r effect.
  6288. @end table
  6289. A frei0r effect parameter can be a boolean (its value is either
  6290. "y" or "n"), a double, a color (specified as
  6291. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  6292. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  6293. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  6294. @var{X} and @var{Y} are floating point numbers) and/or a string.
  6295. The number and types of parameters depend on the loaded effect. If an
  6296. effect parameter is not specified, the default value is set.
  6297. @subsection Examples
  6298. @itemize
  6299. @item
  6300. Apply the distort0r effect, setting the first two double parameters:
  6301. @example
  6302. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  6303. @end example
  6304. @item
  6305. Apply the colordistance effect, taking a color as the first parameter:
  6306. @example
  6307. frei0r=colordistance:0.2/0.3/0.4
  6308. frei0r=colordistance:violet
  6309. frei0r=colordistance:0x112233
  6310. @end example
  6311. @item
  6312. Apply the perspective effect, specifying the top left and top right image
  6313. positions:
  6314. @example
  6315. frei0r=perspective:0.2/0.2|0.8/0.2
  6316. @end example
  6317. @end itemize
  6318. For more information, see
  6319. @url{http://frei0r.dyne.org}
  6320. @section fspp
  6321. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  6322. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  6323. processing filter, one of them is performed once per block, not per pixel.
  6324. This allows for much higher speed.
  6325. The filter accepts the following options:
  6326. @table @option
  6327. @item quality
  6328. Set quality. This option defines the number of levels for averaging. It accepts
  6329. an integer in the range 4-5. Default value is @code{4}.
  6330. @item qp
  6331. Force a constant quantization parameter. It accepts an integer in range 0-63.
  6332. If not set, the filter will use the QP from the video stream (if available).
  6333. @item strength
  6334. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  6335. more details but also more artifacts, while higher values make the image smoother
  6336. but also blurrier. Default value is @code{0} − PSNR optimal.
  6337. @item use_bframe_qp
  6338. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  6339. option may cause flicker since the B-Frames have often larger QP. Default is
  6340. @code{0} (not enabled).
  6341. @end table
  6342. @section geq
  6343. The filter accepts the following options:
  6344. @table @option
  6345. @item lum_expr, lum
  6346. Set the luminance expression.
  6347. @item cb_expr, cb
  6348. Set the chrominance blue expression.
  6349. @item cr_expr, cr
  6350. Set the chrominance red expression.
  6351. @item alpha_expr, a
  6352. Set the alpha expression.
  6353. @item red_expr, r
  6354. Set the red expression.
  6355. @item green_expr, g
  6356. Set the green expression.
  6357. @item blue_expr, b
  6358. Set the blue expression.
  6359. @end table
  6360. The colorspace is selected according to the specified options. If one
  6361. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  6362. options is specified, the filter will automatically select a YCbCr
  6363. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  6364. @option{blue_expr} options is specified, it will select an RGB
  6365. colorspace.
  6366. If one of the chrominance expression is not defined, it falls back on the other
  6367. one. If no alpha expression is specified it will evaluate to opaque value.
  6368. If none of chrominance expressions are specified, they will evaluate
  6369. to the luminance expression.
  6370. The expressions can use the following variables and functions:
  6371. @table @option
  6372. @item N
  6373. The sequential number of the filtered frame, starting from @code{0}.
  6374. @item X
  6375. @item Y
  6376. The coordinates of the current sample.
  6377. @item W
  6378. @item H
  6379. The width and height of the image.
  6380. @item SW
  6381. @item SH
  6382. Width and height scale depending on the currently filtered plane. It is the
  6383. ratio between the corresponding luma plane number of pixels and the current
  6384. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  6385. @code{0.5,0.5} for chroma planes.
  6386. @item T
  6387. Time of the current frame, expressed in seconds.
  6388. @item p(x, y)
  6389. Return the value of the pixel at location (@var{x},@var{y}) of the current
  6390. plane.
  6391. @item lum(x, y)
  6392. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  6393. plane.
  6394. @item cb(x, y)
  6395. Return the value of the pixel at location (@var{x},@var{y}) of the
  6396. blue-difference chroma plane. Return 0 if there is no such plane.
  6397. @item cr(x, y)
  6398. Return the value of the pixel at location (@var{x},@var{y}) of the
  6399. red-difference chroma plane. Return 0 if there is no such plane.
  6400. @item r(x, y)
  6401. @item g(x, y)
  6402. @item b(x, y)
  6403. Return the value of the pixel at location (@var{x},@var{y}) of the
  6404. red/green/blue component. Return 0 if there is no such component.
  6405. @item alpha(x, y)
  6406. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  6407. plane. Return 0 if there is no such plane.
  6408. @end table
  6409. For functions, if @var{x} and @var{y} are outside the area, the value will be
  6410. automatically clipped to the closer edge.
  6411. @subsection Examples
  6412. @itemize
  6413. @item
  6414. Flip the image horizontally:
  6415. @example
  6416. geq=p(W-X\,Y)
  6417. @end example
  6418. @item
  6419. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  6420. wavelength of 100 pixels:
  6421. @example
  6422. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  6423. @end example
  6424. @item
  6425. Generate a fancy enigmatic moving light:
  6426. @example
  6427. 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
  6428. @end example
  6429. @item
  6430. Generate a quick emboss effect:
  6431. @example
  6432. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  6433. @end example
  6434. @item
  6435. Modify RGB components depending on pixel position:
  6436. @example
  6437. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  6438. @end example
  6439. @item
  6440. Create a radial gradient that is the same size as the input (also see
  6441. the @ref{vignette} filter):
  6442. @example
  6443. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  6444. @end example
  6445. @end itemize
  6446. @section gradfun
  6447. Fix the banding artifacts that are sometimes introduced into nearly flat
  6448. regions by truncation to 8-bit color depth.
  6449. Interpolate the gradients that should go where the bands are, and
  6450. dither them.
  6451. It is designed for playback only. Do not use it prior to
  6452. lossy compression, because compression tends to lose the dither and
  6453. bring back the bands.
  6454. It accepts the following parameters:
  6455. @table @option
  6456. @item strength
  6457. The maximum amount by which the filter will change any one pixel. This is also
  6458. the threshold for detecting nearly flat regions. Acceptable values range from
  6459. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  6460. valid range.
  6461. @item radius
  6462. The neighborhood to fit the gradient to. A larger radius makes for smoother
  6463. gradients, but also prevents the filter from modifying the pixels near detailed
  6464. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  6465. values will be clipped to the valid range.
  6466. @end table
  6467. Alternatively, the options can be specified as a flat string:
  6468. @var{strength}[:@var{radius}]
  6469. @subsection Examples
  6470. @itemize
  6471. @item
  6472. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  6473. @example
  6474. gradfun=3.5:8
  6475. @end example
  6476. @item
  6477. Specify radius, omitting the strength (which will fall-back to the default
  6478. value):
  6479. @example
  6480. gradfun=radius=8
  6481. @end example
  6482. @end itemize
  6483. @anchor{haldclut}
  6484. @section haldclut
  6485. Apply a Hald CLUT to a video stream.
  6486. First input is the video stream to process, and second one is the Hald CLUT.
  6487. The Hald CLUT input can be a simple picture or a complete video stream.
  6488. The filter accepts the following options:
  6489. @table @option
  6490. @item shortest
  6491. Force termination when the shortest input terminates. Default is @code{0}.
  6492. @item repeatlast
  6493. Continue applying the last CLUT after the end of the stream. A value of
  6494. @code{0} disable the filter after the last frame of the CLUT is reached.
  6495. Default is @code{1}.
  6496. @end table
  6497. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  6498. filters share the same internals).
  6499. More information about the Hald CLUT can be found on Eskil Steenberg's website
  6500. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  6501. @subsection Workflow examples
  6502. @subsubsection Hald CLUT video stream
  6503. Generate an identity Hald CLUT stream altered with various effects:
  6504. @example
  6505. 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
  6506. @end example
  6507. Note: make sure you use a lossless codec.
  6508. Then use it with @code{haldclut} to apply it on some random stream:
  6509. @example
  6510. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  6511. @end example
  6512. The Hald CLUT will be applied to the 10 first seconds (duration of
  6513. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  6514. to the remaining frames of the @code{mandelbrot} stream.
  6515. @subsubsection Hald CLUT with preview
  6516. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  6517. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  6518. biggest possible square starting at the top left of the picture. The remaining
  6519. padding pixels (bottom or right) will be ignored. This area can be used to add
  6520. a preview of the Hald CLUT.
  6521. Typically, the following generated Hald CLUT will be supported by the
  6522. @code{haldclut} filter:
  6523. @example
  6524. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  6525. pad=iw+320 [padded_clut];
  6526. smptebars=s=320x256, split [a][b];
  6527. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  6528. [main][b] overlay=W-320" -frames:v 1 clut.png
  6529. @end example
  6530. It contains the original and a preview of the effect of the CLUT: SMPTE color
  6531. bars are displayed on the right-top, and below the same color bars processed by
  6532. the color changes.
  6533. Then, the effect of this Hald CLUT can be visualized with:
  6534. @example
  6535. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  6536. @end example
  6537. @section hflip
  6538. Flip the input video horizontally.
  6539. For example, to horizontally flip the input video with @command{ffmpeg}:
  6540. @example
  6541. ffmpeg -i in.avi -vf "hflip" out.avi
  6542. @end example
  6543. @section histeq
  6544. This filter applies a global color histogram equalization on a
  6545. per-frame basis.
  6546. It can be used to correct video that has a compressed range of pixel
  6547. intensities. The filter redistributes the pixel intensities to
  6548. equalize their distribution across the intensity range. It may be
  6549. viewed as an "automatically adjusting contrast filter". This filter is
  6550. useful only for correcting degraded or poorly captured source
  6551. video.
  6552. The filter accepts the following options:
  6553. @table @option
  6554. @item strength
  6555. Determine the amount of equalization to be applied. As the strength
  6556. is reduced, the distribution of pixel intensities more-and-more
  6557. approaches that of the input frame. The value must be a float number
  6558. in the range [0,1] and defaults to 0.200.
  6559. @item intensity
  6560. Set the maximum intensity that can generated and scale the output
  6561. values appropriately. The strength should be set as desired and then
  6562. the intensity can be limited if needed to avoid washing-out. The value
  6563. must be a float number in the range [0,1] and defaults to 0.210.
  6564. @item antibanding
  6565. Set the antibanding level. If enabled the filter will randomly vary
  6566. the luminance of output pixels by a small amount to avoid banding of
  6567. the histogram. Possible values are @code{none}, @code{weak} or
  6568. @code{strong}. It defaults to @code{none}.
  6569. @end table
  6570. @section histogram
  6571. Compute and draw a color distribution histogram for the input video.
  6572. The computed histogram is a representation of the color component
  6573. distribution in an image.
  6574. Standard histogram displays the color components distribution in an image.
  6575. Displays color graph for each color component. Shows distribution of
  6576. the Y, U, V, A or R, G, B components, depending on input format, in the
  6577. current frame. Below each graph a color component scale meter is shown.
  6578. The filter accepts the following options:
  6579. @table @option
  6580. @item level_height
  6581. Set height of level. Default value is @code{200}.
  6582. Allowed range is [50, 2048].
  6583. @item scale_height
  6584. Set height of color scale. Default value is @code{12}.
  6585. Allowed range is [0, 40].
  6586. @item display_mode
  6587. Set display mode.
  6588. It accepts the following values:
  6589. @table @samp
  6590. @item parade
  6591. Per color component graphs are placed below each other.
  6592. @item overlay
  6593. Presents information identical to that in the @code{parade}, except
  6594. that the graphs representing color components are superimposed directly
  6595. over one another.
  6596. @end table
  6597. Default is @code{parade}.
  6598. @item levels_mode
  6599. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  6600. Default is @code{linear}.
  6601. @item components
  6602. Set what color components to display.
  6603. Default is @code{7}.
  6604. @item fgopacity
  6605. Set foreground opacity. Default is @code{0.7}.
  6606. @item bgopacity
  6607. Set background opacity. Default is @code{0.5}.
  6608. @end table
  6609. @subsection Examples
  6610. @itemize
  6611. @item
  6612. Calculate and draw histogram:
  6613. @example
  6614. ffplay -i input -vf histogram
  6615. @end example
  6616. @end itemize
  6617. @anchor{hqdn3d}
  6618. @section hqdn3d
  6619. This is a high precision/quality 3d denoise filter. It aims to reduce
  6620. image noise, producing smooth images and making still images really
  6621. still. It should enhance compressibility.
  6622. It accepts the following optional parameters:
  6623. @table @option
  6624. @item luma_spatial
  6625. A non-negative floating point number which specifies spatial luma strength.
  6626. It defaults to 4.0.
  6627. @item chroma_spatial
  6628. A non-negative floating point number which specifies spatial chroma strength.
  6629. It defaults to 3.0*@var{luma_spatial}/4.0.
  6630. @item luma_tmp
  6631. A floating point number which specifies luma temporal strength. It defaults to
  6632. 6.0*@var{luma_spatial}/4.0.
  6633. @item chroma_tmp
  6634. A floating point number which specifies chroma temporal strength. It defaults to
  6635. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  6636. @end table
  6637. @anchor{hwupload_cuda}
  6638. @section hwupload_cuda
  6639. Upload system memory frames to a CUDA device.
  6640. It accepts the following optional parameters:
  6641. @table @option
  6642. @item device
  6643. The number of the CUDA device to use
  6644. @end table
  6645. @section hqx
  6646. Apply a high-quality magnification filter designed for pixel art. This filter
  6647. was originally created by Maxim Stepin.
  6648. It accepts the following option:
  6649. @table @option
  6650. @item n
  6651. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  6652. @code{hq3x} and @code{4} for @code{hq4x}.
  6653. Default is @code{3}.
  6654. @end table
  6655. @section hstack
  6656. Stack input videos horizontally.
  6657. All streams must be of same pixel format and of same height.
  6658. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  6659. to create same output.
  6660. The filter accept the following option:
  6661. @table @option
  6662. @item inputs
  6663. Set number of input streams. Default is 2.
  6664. @item shortest
  6665. If set to 1, force the output to terminate when the shortest input
  6666. terminates. Default value is 0.
  6667. @end table
  6668. @section hue
  6669. Modify the hue and/or the saturation of the input.
  6670. It accepts the following parameters:
  6671. @table @option
  6672. @item h
  6673. Specify the hue angle as a number of degrees. It accepts an expression,
  6674. and defaults to "0".
  6675. @item s
  6676. Specify the saturation in the [-10,10] range. It accepts an expression and
  6677. defaults to "1".
  6678. @item H
  6679. Specify the hue angle as a number of radians. It accepts an
  6680. expression, and defaults to "0".
  6681. @item b
  6682. Specify the brightness in the [-10,10] range. It accepts an expression and
  6683. defaults to "0".
  6684. @end table
  6685. @option{h} and @option{H} are mutually exclusive, and can't be
  6686. specified at the same time.
  6687. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  6688. expressions containing the following constants:
  6689. @table @option
  6690. @item n
  6691. frame count of the input frame starting from 0
  6692. @item pts
  6693. presentation timestamp of the input frame expressed in time base units
  6694. @item r
  6695. frame rate of the input video, NAN if the input frame rate is unknown
  6696. @item t
  6697. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6698. @item tb
  6699. time base of the input video
  6700. @end table
  6701. @subsection Examples
  6702. @itemize
  6703. @item
  6704. Set the hue to 90 degrees and the saturation to 1.0:
  6705. @example
  6706. hue=h=90:s=1
  6707. @end example
  6708. @item
  6709. Same command but expressing the hue in radians:
  6710. @example
  6711. hue=H=PI/2:s=1
  6712. @end example
  6713. @item
  6714. Rotate hue and make the saturation swing between 0
  6715. and 2 over a period of 1 second:
  6716. @example
  6717. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  6718. @end example
  6719. @item
  6720. Apply a 3 seconds saturation fade-in effect starting at 0:
  6721. @example
  6722. hue="s=min(t/3\,1)"
  6723. @end example
  6724. The general fade-in expression can be written as:
  6725. @example
  6726. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  6727. @end example
  6728. @item
  6729. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  6730. @example
  6731. hue="s=max(0\, min(1\, (8-t)/3))"
  6732. @end example
  6733. The general fade-out expression can be written as:
  6734. @example
  6735. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  6736. @end example
  6737. @end itemize
  6738. @subsection Commands
  6739. This filter supports the following commands:
  6740. @table @option
  6741. @item b
  6742. @item s
  6743. @item h
  6744. @item H
  6745. Modify the hue and/or the saturation and/or brightness of the input video.
  6746. The command accepts the same syntax of the corresponding option.
  6747. If the specified expression is not valid, it is kept at its current
  6748. value.
  6749. @end table
  6750. @section hysteresis
  6751. Grow first stream into second stream by connecting components.
  6752. This allows to build more robust edge masks.
  6753. This filter accepts the following options:
  6754. @table @option
  6755. @item planes
  6756. Set which planes will be processed as bitmap, unprocessed planes will be
  6757. copied from first stream.
  6758. By default value 0xf, all planes will be processed.
  6759. @item threshold
  6760. Set threshold which is used in filtering. If pixel component value is higher than
  6761. this value filter algorithm for connecting components is activated.
  6762. By default value is 0.
  6763. @end table
  6764. @section idet
  6765. Detect video interlacing type.
  6766. This filter tries to detect if the input frames as interlaced, progressive,
  6767. top or bottom field first. It will also try and detect fields that are
  6768. repeated between adjacent frames (a sign of telecine).
  6769. Single frame detection considers only immediately adjacent frames when classifying each frame.
  6770. Multiple frame detection incorporates the classification history of previous frames.
  6771. The filter will log these metadata values:
  6772. @table @option
  6773. @item single.current_frame
  6774. Detected type of current frame using single-frame detection. One of:
  6775. ``tff'' (top field first), ``bff'' (bottom field first),
  6776. ``progressive'', or ``undetermined''
  6777. @item single.tff
  6778. Cumulative number of frames detected as top field first using single-frame detection.
  6779. @item multiple.tff
  6780. Cumulative number of frames detected as top field first using multiple-frame detection.
  6781. @item single.bff
  6782. Cumulative number of frames detected as bottom field first using single-frame detection.
  6783. @item multiple.current_frame
  6784. Detected type of current frame using multiple-frame detection. One of:
  6785. ``tff'' (top field first), ``bff'' (bottom field first),
  6786. ``progressive'', or ``undetermined''
  6787. @item multiple.bff
  6788. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  6789. @item single.progressive
  6790. Cumulative number of frames detected as progressive using single-frame detection.
  6791. @item multiple.progressive
  6792. Cumulative number of frames detected as progressive using multiple-frame detection.
  6793. @item single.undetermined
  6794. Cumulative number of frames that could not be classified using single-frame detection.
  6795. @item multiple.undetermined
  6796. Cumulative number of frames that could not be classified using multiple-frame detection.
  6797. @item repeated.current_frame
  6798. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  6799. @item repeated.neither
  6800. Cumulative number of frames with no repeated field.
  6801. @item repeated.top
  6802. Cumulative number of frames with the top field repeated from the previous frame's top field.
  6803. @item repeated.bottom
  6804. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  6805. @end table
  6806. The filter accepts the following options:
  6807. @table @option
  6808. @item intl_thres
  6809. Set interlacing threshold.
  6810. @item prog_thres
  6811. Set progressive threshold.
  6812. @item rep_thres
  6813. Threshold for repeated field detection.
  6814. @item half_life
  6815. Number of frames after which a given frame's contribution to the
  6816. statistics is halved (i.e., it contributes only 0.5 to it's
  6817. classification). The default of 0 means that all frames seen are given
  6818. full weight of 1.0 forever.
  6819. @item analyze_interlaced_flag
  6820. When this is not 0 then idet will use the specified number of frames to determine
  6821. if the interlaced flag is accurate, it will not count undetermined frames.
  6822. If the flag is found to be accurate it will be used without any further
  6823. computations, if it is found to be inaccurate it will be cleared without any
  6824. further computations. This allows inserting the idet filter as a low computational
  6825. method to clean up the interlaced flag
  6826. @end table
  6827. @section il
  6828. Deinterleave or interleave fields.
  6829. This filter allows one to process interlaced images fields without
  6830. deinterlacing them. Deinterleaving splits the input frame into 2
  6831. fields (so called half pictures). Odd lines are moved to the top
  6832. half of the output image, even lines to the bottom half.
  6833. You can process (filter) them independently and then re-interleave them.
  6834. The filter accepts the following options:
  6835. @table @option
  6836. @item luma_mode, l
  6837. @item chroma_mode, c
  6838. @item alpha_mode, a
  6839. Available values for @var{luma_mode}, @var{chroma_mode} and
  6840. @var{alpha_mode} are:
  6841. @table @samp
  6842. @item none
  6843. Do nothing.
  6844. @item deinterleave, d
  6845. Deinterleave fields, placing one above the other.
  6846. @item interleave, i
  6847. Interleave fields. Reverse the effect of deinterleaving.
  6848. @end table
  6849. Default value is @code{none}.
  6850. @item luma_swap, ls
  6851. @item chroma_swap, cs
  6852. @item alpha_swap, as
  6853. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  6854. @end table
  6855. @section inflate
  6856. Apply inflate effect to the video.
  6857. This filter replaces the pixel by the local(3x3) average by taking into account
  6858. only values higher than the pixel.
  6859. It accepts the following options:
  6860. @table @option
  6861. @item threshold0
  6862. @item threshold1
  6863. @item threshold2
  6864. @item threshold3
  6865. Limit the maximum change for each plane, default is 65535.
  6866. If 0, plane will remain unchanged.
  6867. @end table
  6868. @section interlace
  6869. Simple interlacing filter from progressive contents. This interleaves upper (or
  6870. lower) lines from odd frames with lower (or upper) lines from even frames,
  6871. halving the frame rate and preserving image height.
  6872. @example
  6873. Original Original New Frame
  6874. Frame 'j' Frame 'j+1' (tff)
  6875. ========== =========== ==================
  6876. Line 0 --------------------> Frame 'j' Line 0
  6877. Line 1 Line 1 ----> Frame 'j+1' Line 1
  6878. Line 2 ---------------------> Frame 'j' Line 2
  6879. Line 3 Line 3 ----> Frame 'j+1' Line 3
  6880. ... ... ...
  6881. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  6882. @end example
  6883. It accepts the following optional parameters:
  6884. @table @option
  6885. @item scan
  6886. This determines whether the interlaced frame is taken from the even
  6887. (tff - default) or odd (bff) lines of the progressive frame.
  6888. @item lowpass
  6889. Enable (default) or disable the vertical lowpass filter to avoid twitter
  6890. interlacing and reduce moire patterns.
  6891. @end table
  6892. @section kerndeint
  6893. Deinterlace input video by applying Donald Graft's adaptive kernel
  6894. deinterling. Work on interlaced parts of a video to produce
  6895. progressive frames.
  6896. The description of the accepted parameters follows.
  6897. @table @option
  6898. @item thresh
  6899. Set the threshold which affects the filter's tolerance when
  6900. determining if a pixel line must be processed. It must be an integer
  6901. in the range [0,255] and defaults to 10. A value of 0 will result in
  6902. applying the process on every pixels.
  6903. @item map
  6904. Paint pixels exceeding the threshold value to white if set to 1.
  6905. Default is 0.
  6906. @item order
  6907. Set the fields order. Swap fields if set to 1, leave fields alone if
  6908. 0. Default is 0.
  6909. @item sharp
  6910. Enable additional sharpening if set to 1. Default is 0.
  6911. @item twoway
  6912. Enable twoway sharpening if set to 1. Default is 0.
  6913. @end table
  6914. @subsection Examples
  6915. @itemize
  6916. @item
  6917. Apply default values:
  6918. @example
  6919. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  6920. @end example
  6921. @item
  6922. Enable additional sharpening:
  6923. @example
  6924. kerndeint=sharp=1
  6925. @end example
  6926. @item
  6927. Paint processed pixels in white:
  6928. @example
  6929. kerndeint=map=1
  6930. @end example
  6931. @end itemize
  6932. @section lenscorrection
  6933. Correct radial lens distortion
  6934. This filter can be used to correct for radial distortion as can result from the use
  6935. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  6936. one can use tools available for example as part of opencv or simply trial-and-error.
  6937. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  6938. and extract the k1 and k2 coefficients from the resulting matrix.
  6939. Note that effectively the same filter is available in the open-source tools Krita and
  6940. Digikam from the KDE project.
  6941. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  6942. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  6943. brightness distribution, so you may want to use both filters together in certain
  6944. cases, though you will have to take care of ordering, i.e. whether vignetting should
  6945. be applied before or after lens correction.
  6946. @subsection Options
  6947. The filter accepts the following options:
  6948. @table @option
  6949. @item cx
  6950. Relative x-coordinate of the focal point of the image, and thereby the center of the
  6951. distortion. This value has a range [0,1] and is expressed as fractions of the image
  6952. width.
  6953. @item cy
  6954. Relative y-coordinate of the focal point of the image, and thereby the center of the
  6955. distortion. This value has a range [0,1] and is expressed as fractions of the image
  6956. height.
  6957. @item k1
  6958. Coefficient of the quadratic correction term. 0.5 means no correction.
  6959. @item k2
  6960. Coefficient of the double quadratic correction term. 0.5 means no correction.
  6961. @end table
  6962. The formula that generates the correction is:
  6963. @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)
  6964. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  6965. distances from the focal point in the source and target images, respectively.
  6966. @section loop
  6967. Loop video frames.
  6968. The filter accepts the following options:
  6969. @table @option
  6970. @item loop
  6971. Set the number of loops.
  6972. @item size
  6973. Set maximal size in number of frames.
  6974. @item start
  6975. Set first frame of loop.
  6976. @end table
  6977. @anchor{lut3d}
  6978. @section lut3d
  6979. Apply a 3D LUT to an input video.
  6980. The filter accepts the following options:
  6981. @table @option
  6982. @item file
  6983. Set the 3D LUT file name.
  6984. Currently supported formats:
  6985. @table @samp
  6986. @item 3dl
  6987. AfterEffects
  6988. @item cube
  6989. Iridas
  6990. @item dat
  6991. DaVinci
  6992. @item m3d
  6993. Pandora
  6994. @end table
  6995. @item interp
  6996. Select interpolation mode.
  6997. Available values are:
  6998. @table @samp
  6999. @item nearest
  7000. Use values from the nearest defined point.
  7001. @item trilinear
  7002. Interpolate values using the 8 points defining a cube.
  7003. @item tetrahedral
  7004. Interpolate values using a tetrahedron.
  7005. @end table
  7006. @end table
  7007. @section lut, lutrgb, lutyuv
  7008. Compute a look-up table for binding each pixel component input value
  7009. to an output value, and apply it to the input video.
  7010. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  7011. to an RGB input video.
  7012. These filters accept the following parameters:
  7013. @table @option
  7014. @item c0
  7015. set first pixel component expression
  7016. @item c1
  7017. set second pixel component expression
  7018. @item c2
  7019. set third pixel component expression
  7020. @item c3
  7021. set fourth pixel component expression, corresponds to the alpha component
  7022. @item r
  7023. set red component expression
  7024. @item g
  7025. set green component expression
  7026. @item b
  7027. set blue component expression
  7028. @item a
  7029. alpha component expression
  7030. @item y
  7031. set Y/luminance component expression
  7032. @item u
  7033. set U/Cb component expression
  7034. @item v
  7035. set V/Cr component expression
  7036. @end table
  7037. Each of them specifies the expression to use for computing the lookup table for
  7038. the corresponding pixel component values.
  7039. The exact component associated to each of the @var{c*} options depends on the
  7040. format in input.
  7041. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  7042. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  7043. The expressions can contain the following constants and functions:
  7044. @table @option
  7045. @item w
  7046. @item h
  7047. The input width and height.
  7048. @item val
  7049. The input value for the pixel component.
  7050. @item clipval
  7051. The input value, clipped to the @var{minval}-@var{maxval} range.
  7052. @item maxval
  7053. The maximum value for the pixel component.
  7054. @item minval
  7055. The minimum value for the pixel component.
  7056. @item negval
  7057. The negated value for the pixel component value, clipped to the
  7058. @var{minval}-@var{maxval} range; it corresponds to the expression
  7059. "maxval-clipval+minval".
  7060. @item clip(val)
  7061. The computed value in @var{val}, clipped to the
  7062. @var{minval}-@var{maxval} range.
  7063. @item gammaval(gamma)
  7064. The computed gamma correction value of the pixel component value,
  7065. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  7066. expression
  7067. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  7068. @end table
  7069. All expressions default to "val".
  7070. @subsection Examples
  7071. @itemize
  7072. @item
  7073. Negate input video:
  7074. @example
  7075. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  7076. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  7077. @end example
  7078. The above is the same as:
  7079. @example
  7080. lutrgb="r=negval:g=negval:b=negval"
  7081. lutyuv="y=negval:u=negval:v=negval"
  7082. @end example
  7083. @item
  7084. Negate luminance:
  7085. @example
  7086. lutyuv=y=negval
  7087. @end example
  7088. @item
  7089. Remove chroma components, turning the video into a graytone image:
  7090. @example
  7091. lutyuv="u=128:v=128"
  7092. @end example
  7093. @item
  7094. Apply a luma burning effect:
  7095. @example
  7096. lutyuv="y=2*val"
  7097. @end example
  7098. @item
  7099. Remove green and blue components:
  7100. @example
  7101. lutrgb="g=0:b=0"
  7102. @end example
  7103. @item
  7104. Set a constant alpha channel value on input:
  7105. @example
  7106. format=rgba,lutrgb=a="maxval-minval/2"
  7107. @end example
  7108. @item
  7109. Correct luminance gamma by a factor of 0.5:
  7110. @example
  7111. lutyuv=y=gammaval(0.5)
  7112. @end example
  7113. @item
  7114. Discard least significant bits of luma:
  7115. @example
  7116. lutyuv=y='bitand(val, 128+64+32)'
  7117. @end example
  7118. @item
  7119. Technicolor like effect:
  7120. @example
  7121. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  7122. @end example
  7123. @end itemize
  7124. @section maskedclamp
  7125. Clamp the first input stream with the second input and third input stream.
  7126. Returns the value of first stream to be between second input
  7127. stream - @code{undershoot} and third input stream + @code{overshoot}.
  7128. This filter accepts the following options:
  7129. @table @option
  7130. @item undershoot
  7131. Default value is @code{0}.
  7132. @item overshoot
  7133. Default value is @code{0}.
  7134. @item planes
  7135. Set which planes will be processed as bitmap, unprocessed planes will be
  7136. copied from first stream.
  7137. By default value 0xf, all planes will be processed.
  7138. @end table
  7139. @section maskedmerge
  7140. Merge the first input stream with the second input stream using per pixel
  7141. weights in the third input stream.
  7142. A value of 0 in the third stream pixel component means that pixel component
  7143. from first stream is returned unchanged, while maximum value (eg. 255 for
  7144. 8-bit videos) means that pixel component from second stream is returned
  7145. unchanged. Intermediate values define the amount of merging between both
  7146. input stream's pixel components.
  7147. This filter accepts the following options:
  7148. @table @option
  7149. @item planes
  7150. Set which planes will be processed as bitmap, unprocessed planes will be
  7151. copied from first stream.
  7152. By default value 0xf, all planes will be processed.
  7153. @end table
  7154. @section mcdeint
  7155. Apply motion-compensation deinterlacing.
  7156. It needs one field per frame as input and must thus be used together
  7157. with yadif=1/3 or equivalent.
  7158. This filter accepts the following options:
  7159. @table @option
  7160. @item mode
  7161. Set the deinterlacing mode.
  7162. It accepts one of the following values:
  7163. @table @samp
  7164. @item fast
  7165. @item medium
  7166. @item slow
  7167. use iterative motion estimation
  7168. @item extra_slow
  7169. like @samp{slow}, but use multiple reference frames.
  7170. @end table
  7171. Default value is @samp{fast}.
  7172. @item parity
  7173. Set the picture field parity assumed for the input video. It must be
  7174. one of the following values:
  7175. @table @samp
  7176. @item 0, tff
  7177. assume top field first
  7178. @item 1, bff
  7179. assume bottom field first
  7180. @end table
  7181. Default value is @samp{bff}.
  7182. @item qp
  7183. Set per-block quantization parameter (QP) used by the internal
  7184. encoder.
  7185. Higher values should result in a smoother motion vector field but less
  7186. optimal individual vectors. Default value is 1.
  7187. @end table
  7188. @section mergeplanes
  7189. Merge color channel components from several video streams.
  7190. The filter accepts up to 4 input streams, and merge selected input
  7191. planes to the output video.
  7192. This filter accepts the following options:
  7193. @table @option
  7194. @item mapping
  7195. Set input to output plane mapping. Default is @code{0}.
  7196. The mappings is specified as a bitmap. It should be specified as a
  7197. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  7198. mapping for the first plane of the output stream. 'A' sets the number of
  7199. the input stream to use (from 0 to 3), and 'a' the plane number of the
  7200. corresponding input to use (from 0 to 3). The rest of the mappings is
  7201. similar, 'Bb' describes the mapping for the output stream second
  7202. plane, 'Cc' describes the mapping for the output stream third plane and
  7203. 'Dd' describes the mapping for the output stream fourth plane.
  7204. @item format
  7205. Set output pixel format. Default is @code{yuva444p}.
  7206. @end table
  7207. @subsection Examples
  7208. @itemize
  7209. @item
  7210. Merge three gray video streams of same width and height into single video stream:
  7211. @example
  7212. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  7213. @end example
  7214. @item
  7215. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  7216. @example
  7217. [a0][a1]mergeplanes=0x00010210:yuva444p
  7218. @end example
  7219. @item
  7220. Swap Y and A plane in yuva444p stream:
  7221. @example
  7222. format=yuva444p,mergeplanes=0x03010200:yuva444p
  7223. @end example
  7224. @item
  7225. Swap U and V plane in yuv420p stream:
  7226. @example
  7227. format=yuv420p,mergeplanes=0x000201:yuv420p
  7228. @end example
  7229. @item
  7230. Cast a rgb24 clip to yuv444p:
  7231. @example
  7232. format=rgb24,mergeplanes=0x000102:yuv444p
  7233. @end example
  7234. @end itemize
  7235. @section mpdecimate
  7236. Drop frames that do not differ greatly from the previous frame in
  7237. order to reduce frame rate.
  7238. The main use of this filter is for very-low-bitrate encoding
  7239. (e.g. streaming over dialup modem), but it could in theory be used for
  7240. fixing movies that were inverse-telecined incorrectly.
  7241. A description of the accepted options follows.
  7242. @table @option
  7243. @item max
  7244. Set the maximum number of consecutive frames which can be dropped (if
  7245. positive), or the minimum interval between dropped frames (if
  7246. negative). If the value is 0, the frame is dropped unregarding the
  7247. number of previous sequentially dropped frames.
  7248. Default value is 0.
  7249. @item hi
  7250. @item lo
  7251. @item frac
  7252. Set the dropping threshold values.
  7253. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  7254. represent actual pixel value differences, so a threshold of 64
  7255. corresponds to 1 unit of difference for each pixel, or the same spread
  7256. out differently over the block.
  7257. A frame is a candidate for dropping if no 8x8 blocks differ by more
  7258. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  7259. meaning the whole image) differ by more than a threshold of @option{lo}.
  7260. Default value for @option{hi} is 64*12, default value for @option{lo} is
  7261. 64*5, and default value for @option{frac} is 0.33.
  7262. @end table
  7263. @section negate
  7264. Negate input video.
  7265. It accepts an integer in input; if non-zero it negates the
  7266. alpha component (if available). The default value in input is 0.
  7267. @section nnedi
  7268. Deinterlace video using neural network edge directed interpolation.
  7269. This filter accepts the following options:
  7270. @table @option
  7271. @item weights
  7272. Mandatory option, without binary file filter can not work.
  7273. Currently file can be found here:
  7274. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  7275. @item deint
  7276. Set which frames to deinterlace, by default it is @code{all}.
  7277. Can be @code{all} or @code{interlaced}.
  7278. @item field
  7279. Set mode of operation.
  7280. Can be one of the following:
  7281. @table @samp
  7282. @item af
  7283. Use frame flags, both fields.
  7284. @item a
  7285. Use frame flags, single field.
  7286. @item t
  7287. Use top field only.
  7288. @item b
  7289. Use bottom field only.
  7290. @item tf
  7291. Use both fields, top first.
  7292. @item bf
  7293. Use both fields, bottom first.
  7294. @end table
  7295. @item planes
  7296. Set which planes to process, by default filter process all frames.
  7297. @item nsize
  7298. Set size of local neighborhood around each pixel, used by the predictor neural
  7299. network.
  7300. Can be one of the following:
  7301. @table @samp
  7302. @item s8x6
  7303. @item s16x6
  7304. @item s32x6
  7305. @item s48x6
  7306. @item s8x4
  7307. @item s16x4
  7308. @item s32x4
  7309. @end table
  7310. @item nns
  7311. Set the number of neurons in predicctor neural network.
  7312. Can be one of the following:
  7313. @table @samp
  7314. @item n16
  7315. @item n32
  7316. @item n64
  7317. @item n128
  7318. @item n256
  7319. @end table
  7320. @item qual
  7321. Controls the number of different neural network predictions that are blended
  7322. together to compute the final output value. Can be @code{fast}, default or
  7323. @code{slow}.
  7324. @item etype
  7325. Set which set of weights to use in the predictor.
  7326. Can be one of the following:
  7327. @table @samp
  7328. @item a
  7329. weights trained to minimize absolute error
  7330. @item s
  7331. weights trained to minimize squared error
  7332. @end table
  7333. @item pscrn
  7334. Controls whether or not the prescreener neural network is used to decide
  7335. which pixels should be processed by the predictor neural network and which
  7336. can be handled by simple cubic interpolation.
  7337. The prescreener is trained to know whether cubic interpolation will be
  7338. sufficient for a pixel or whether it should be predicted by the predictor nn.
  7339. The computational complexity of the prescreener nn is much less than that of
  7340. the predictor nn. Since most pixels can be handled by cubic interpolation,
  7341. using the prescreener generally results in much faster processing.
  7342. The prescreener is pretty accurate, so the difference between using it and not
  7343. using it is almost always unnoticeable.
  7344. Can be one of the following:
  7345. @table @samp
  7346. @item none
  7347. @item original
  7348. @item new
  7349. @end table
  7350. Default is @code{new}.
  7351. @item fapprox
  7352. Set various debugging flags.
  7353. @end table
  7354. @section noformat
  7355. Force libavfilter not to use any of the specified pixel formats for the
  7356. input to the next filter.
  7357. It accepts the following parameters:
  7358. @table @option
  7359. @item pix_fmts
  7360. A '|'-separated list of pixel format names, such as
  7361. apix_fmts=yuv420p|monow|rgb24".
  7362. @end table
  7363. @subsection Examples
  7364. @itemize
  7365. @item
  7366. Force libavfilter to use a format different from @var{yuv420p} for the
  7367. input to the vflip filter:
  7368. @example
  7369. noformat=pix_fmts=yuv420p,vflip
  7370. @end example
  7371. @item
  7372. Convert the input video to any of the formats not contained in the list:
  7373. @example
  7374. noformat=yuv420p|yuv444p|yuv410p
  7375. @end example
  7376. @end itemize
  7377. @section noise
  7378. Add noise on video input frame.
  7379. The filter accepts the following options:
  7380. @table @option
  7381. @item all_seed
  7382. @item c0_seed
  7383. @item c1_seed
  7384. @item c2_seed
  7385. @item c3_seed
  7386. Set noise seed for specific pixel component or all pixel components in case
  7387. of @var{all_seed}. Default value is @code{123457}.
  7388. @item all_strength, alls
  7389. @item c0_strength, c0s
  7390. @item c1_strength, c1s
  7391. @item c2_strength, c2s
  7392. @item c3_strength, c3s
  7393. Set noise strength for specific pixel component or all pixel components in case
  7394. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  7395. @item all_flags, allf
  7396. @item c0_flags, c0f
  7397. @item c1_flags, c1f
  7398. @item c2_flags, c2f
  7399. @item c3_flags, c3f
  7400. Set pixel component flags or set flags for all components if @var{all_flags}.
  7401. Available values for component flags are:
  7402. @table @samp
  7403. @item a
  7404. averaged temporal noise (smoother)
  7405. @item p
  7406. mix random noise with a (semi)regular pattern
  7407. @item t
  7408. temporal noise (noise pattern changes between frames)
  7409. @item u
  7410. uniform noise (gaussian otherwise)
  7411. @end table
  7412. @end table
  7413. @subsection Examples
  7414. Add temporal and uniform noise to input video:
  7415. @example
  7416. noise=alls=20:allf=t+u
  7417. @end example
  7418. @section null
  7419. Pass the video source unchanged to the output.
  7420. @section ocr
  7421. Optical Character Recognition
  7422. This filter uses Tesseract for optical character recognition.
  7423. It accepts the following options:
  7424. @table @option
  7425. @item datapath
  7426. Set datapath to tesseract data. Default is to use whatever was
  7427. set at installation.
  7428. @item language
  7429. Set language, default is "eng".
  7430. @item whitelist
  7431. Set character whitelist.
  7432. @item blacklist
  7433. Set character blacklist.
  7434. @end table
  7435. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  7436. @section ocv
  7437. Apply a video transform using libopencv.
  7438. To enable this filter, install the libopencv library and headers and
  7439. configure FFmpeg with @code{--enable-libopencv}.
  7440. It accepts the following parameters:
  7441. @table @option
  7442. @item filter_name
  7443. The name of the libopencv filter to apply.
  7444. @item filter_params
  7445. The parameters to pass to the libopencv filter. If not specified, the default
  7446. values are assumed.
  7447. @end table
  7448. Refer to the official libopencv documentation for more precise
  7449. information:
  7450. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  7451. Several libopencv filters are supported; see the following subsections.
  7452. @anchor{dilate}
  7453. @subsection dilate
  7454. Dilate an image by using a specific structuring element.
  7455. It corresponds to the libopencv function @code{cvDilate}.
  7456. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  7457. @var{struct_el} represents a structuring element, and has the syntax:
  7458. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  7459. @var{cols} and @var{rows} represent the number of columns and rows of
  7460. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  7461. point, and @var{shape} the shape for the structuring element. @var{shape}
  7462. must be "rect", "cross", "ellipse", or "custom".
  7463. If the value for @var{shape} is "custom", it must be followed by a
  7464. string of the form "=@var{filename}". The file with name
  7465. @var{filename} is assumed to represent a binary image, with each
  7466. printable character corresponding to a bright pixel. When a custom
  7467. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  7468. or columns and rows of the read file are assumed instead.
  7469. The default value for @var{struct_el} is "3x3+0x0/rect".
  7470. @var{nb_iterations} specifies the number of times the transform is
  7471. applied to the image, and defaults to 1.
  7472. Some examples:
  7473. @example
  7474. # Use the default values
  7475. ocv=dilate
  7476. # Dilate using a structuring element with a 5x5 cross, iterating two times
  7477. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  7478. # Read the shape from the file diamond.shape, iterating two times.
  7479. # The file diamond.shape may contain a pattern of characters like this
  7480. # *
  7481. # ***
  7482. # *****
  7483. # ***
  7484. # *
  7485. # The specified columns and rows are ignored
  7486. # but the anchor point coordinates are not
  7487. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  7488. @end example
  7489. @subsection erode
  7490. Erode an image by using a specific structuring element.
  7491. It corresponds to the libopencv function @code{cvErode}.
  7492. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  7493. with the same syntax and semantics as the @ref{dilate} filter.
  7494. @subsection smooth
  7495. Smooth the input video.
  7496. The filter takes the following parameters:
  7497. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  7498. @var{type} is the type of smooth filter to apply, and must be one of
  7499. the following values: "blur", "blur_no_scale", "median", "gaussian",
  7500. or "bilateral". The default value is "gaussian".
  7501. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  7502. depend on the smooth type. @var{param1} and
  7503. @var{param2} accept integer positive values or 0. @var{param3} and
  7504. @var{param4} accept floating point values.
  7505. The default value for @var{param1} is 3. The default value for the
  7506. other parameters is 0.
  7507. These parameters correspond to the parameters assigned to the
  7508. libopencv function @code{cvSmooth}.
  7509. @anchor{overlay}
  7510. @section overlay
  7511. Overlay one video on top of another.
  7512. It takes two inputs and has one output. The first input is the "main"
  7513. video on which the second input is overlaid.
  7514. It accepts the following parameters:
  7515. A description of the accepted options follows.
  7516. @table @option
  7517. @item x
  7518. @item y
  7519. Set the expression for the x and y coordinates of the overlaid video
  7520. on the main video. Default value is "0" for both expressions. In case
  7521. the expression is invalid, it is set to a huge value (meaning that the
  7522. overlay will not be displayed within the output visible area).
  7523. @item eof_action
  7524. The action to take when EOF is encountered on the secondary input; it accepts
  7525. one of the following values:
  7526. @table @option
  7527. @item repeat
  7528. Repeat the last frame (the default).
  7529. @item endall
  7530. End both streams.
  7531. @item pass
  7532. Pass the main input through.
  7533. @end table
  7534. @item eval
  7535. Set when the expressions for @option{x}, and @option{y} are evaluated.
  7536. It accepts the following values:
  7537. @table @samp
  7538. @item init
  7539. only evaluate expressions once during the filter initialization or
  7540. when a command is processed
  7541. @item frame
  7542. evaluate expressions for each incoming frame
  7543. @end table
  7544. Default value is @samp{frame}.
  7545. @item shortest
  7546. If set to 1, force the output to terminate when the shortest input
  7547. terminates. Default value is 0.
  7548. @item format
  7549. Set the format for the output video.
  7550. It accepts the following values:
  7551. @table @samp
  7552. @item yuv420
  7553. force YUV420 output
  7554. @item yuv422
  7555. force YUV422 output
  7556. @item yuv444
  7557. force YUV444 output
  7558. @item rgb
  7559. force RGB output
  7560. @end table
  7561. Default value is @samp{yuv420}.
  7562. @item rgb @emph{(deprecated)}
  7563. If set to 1, force the filter to accept inputs in the RGB
  7564. color space. Default value is 0. This option is deprecated, use
  7565. @option{format} instead.
  7566. @item repeatlast
  7567. If set to 1, force the filter to draw the last overlay frame over the
  7568. main input until the end of the stream. A value of 0 disables this
  7569. behavior. Default value is 1.
  7570. @end table
  7571. The @option{x}, and @option{y} expressions can contain the following
  7572. parameters.
  7573. @table @option
  7574. @item main_w, W
  7575. @item main_h, H
  7576. The main input width and height.
  7577. @item overlay_w, w
  7578. @item overlay_h, h
  7579. The overlay input width and height.
  7580. @item x
  7581. @item y
  7582. The computed values for @var{x} and @var{y}. They are evaluated for
  7583. each new frame.
  7584. @item hsub
  7585. @item vsub
  7586. horizontal and vertical chroma subsample values of the output
  7587. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  7588. @var{vsub} is 1.
  7589. @item n
  7590. the number of input frame, starting from 0
  7591. @item pos
  7592. the position in the file of the input frame, NAN if unknown
  7593. @item t
  7594. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  7595. @end table
  7596. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  7597. when evaluation is done @emph{per frame}, and will evaluate to NAN
  7598. when @option{eval} is set to @samp{init}.
  7599. Be aware that frames are taken from each input video in timestamp
  7600. order, hence, if their initial timestamps differ, it is a good idea
  7601. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  7602. have them begin in the same zero timestamp, as the example for
  7603. the @var{movie} filter does.
  7604. You can chain together more overlays but you should test the
  7605. efficiency of such approach.
  7606. @subsection Commands
  7607. This filter supports the following commands:
  7608. @table @option
  7609. @item x
  7610. @item y
  7611. Modify the x and y of the overlay input.
  7612. The command accepts the same syntax of the corresponding option.
  7613. If the specified expression is not valid, it is kept at its current
  7614. value.
  7615. @end table
  7616. @subsection Examples
  7617. @itemize
  7618. @item
  7619. Draw the overlay at 10 pixels from the bottom right corner of the main
  7620. video:
  7621. @example
  7622. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  7623. @end example
  7624. Using named options the example above becomes:
  7625. @example
  7626. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  7627. @end example
  7628. @item
  7629. Insert a transparent PNG logo in the bottom left corner of the input,
  7630. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  7631. @example
  7632. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  7633. @end example
  7634. @item
  7635. Insert 2 different transparent PNG logos (second logo on bottom
  7636. right corner) using the @command{ffmpeg} tool:
  7637. @example
  7638. 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
  7639. @end example
  7640. @item
  7641. Add a transparent color layer on top of the main video; @code{WxH}
  7642. must specify the size of the main input to the overlay filter:
  7643. @example
  7644. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  7645. @end example
  7646. @item
  7647. Play an original video and a filtered version (here with the deshake
  7648. filter) side by side using the @command{ffplay} tool:
  7649. @example
  7650. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  7651. @end example
  7652. The above command is the same as:
  7653. @example
  7654. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  7655. @end example
  7656. @item
  7657. Make a sliding overlay appearing from the left to the right top part of the
  7658. screen starting since time 2:
  7659. @example
  7660. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  7661. @end example
  7662. @item
  7663. Compose output by putting two input videos side to side:
  7664. @example
  7665. ffmpeg -i left.avi -i right.avi -filter_complex "
  7666. nullsrc=size=200x100 [background];
  7667. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  7668. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  7669. [background][left] overlay=shortest=1 [background+left];
  7670. [background+left][right] overlay=shortest=1:x=100 [left+right]
  7671. "
  7672. @end example
  7673. @item
  7674. Mask 10-20 seconds of a video by applying the delogo filter to a section
  7675. @example
  7676. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  7677. -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]'
  7678. masked.avi
  7679. @end example
  7680. @item
  7681. Chain several overlays in cascade:
  7682. @example
  7683. nullsrc=s=200x200 [bg];
  7684. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  7685. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  7686. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  7687. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  7688. [in3] null, [mid2] overlay=100:100 [out0]
  7689. @end example
  7690. @end itemize
  7691. @section owdenoise
  7692. Apply Overcomplete Wavelet denoiser.
  7693. The filter accepts the following options:
  7694. @table @option
  7695. @item depth
  7696. Set depth.
  7697. Larger depth values will denoise lower frequency components more, but
  7698. slow down filtering.
  7699. Must be an int in the range 8-16, default is @code{8}.
  7700. @item luma_strength, ls
  7701. Set luma strength.
  7702. Must be a double value in the range 0-1000, default is @code{1.0}.
  7703. @item chroma_strength, cs
  7704. Set chroma strength.
  7705. Must be a double value in the range 0-1000, default is @code{1.0}.
  7706. @end table
  7707. @anchor{pad}
  7708. @section pad
  7709. Add paddings to the input image, and place the original input at the
  7710. provided @var{x}, @var{y} coordinates.
  7711. It accepts the following parameters:
  7712. @table @option
  7713. @item width, w
  7714. @item height, h
  7715. Specify an expression for the size of the output image with the
  7716. paddings added. If the value for @var{width} or @var{height} is 0, the
  7717. corresponding input size is used for the output.
  7718. The @var{width} expression can reference the value set by the
  7719. @var{height} expression, and vice versa.
  7720. The default value of @var{width} and @var{height} is 0.
  7721. @item x
  7722. @item y
  7723. Specify the offsets to place the input image at within the padded area,
  7724. with respect to the top/left border of the output image.
  7725. The @var{x} expression can reference the value set by the @var{y}
  7726. expression, and vice versa.
  7727. The default value of @var{x} and @var{y} is 0.
  7728. @item color
  7729. Specify the color of the padded area. For the syntax of this option,
  7730. check the "Color" section in the ffmpeg-utils manual.
  7731. The default value of @var{color} is "black".
  7732. @end table
  7733. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  7734. options are expressions containing the following constants:
  7735. @table @option
  7736. @item in_w
  7737. @item in_h
  7738. The input video width and height.
  7739. @item iw
  7740. @item ih
  7741. These are the same as @var{in_w} and @var{in_h}.
  7742. @item out_w
  7743. @item out_h
  7744. The output width and height (the size of the padded area), as
  7745. specified by the @var{width} and @var{height} expressions.
  7746. @item ow
  7747. @item oh
  7748. These are the same as @var{out_w} and @var{out_h}.
  7749. @item x
  7750. @item y
  7751. The x and y offsets as specified by the @var{x} and @var{y}
  7752. expressions, or NAN if not yet specified.
  7753. @item a
  7754. same as @var{iw} / @var{ih}
  7755. @item sar
  7756. input sample aspect ratio
  7757. @item dar
  7758. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  7759. @item hsub
  7760. @item vsub
  7761. The horizontal and vertical chroma subsample values. For example for the
  7762. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  7763. @end table
  7764. @subsection Examples
  7765. @itemize
  7766. @item
  7767. Add paddings with the color "violet" to the input video. The output video
  7768. size is 640x480, and the top-left corner of the input video is placed at
  7769. column 0, row 40
  7770. @example
  7771. pad=640:480:0:40:violet
  7772. @end example
  7773. The example above is equivalent to the following command:
  7774. @example
  7775. pad=width=640:height=480:x=0:y=40:color=violet
  7776. @end example
  7777. @item
  7778. Pad the input to get an output with dimensions increased by 3/2,
  7779. and put the input video at the center of the padded area:
  7780. @example
  7781. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  7782. @end example
  7783. @item
  7784. Pad the input to get a squared output with size equal to the maximum
  7785. value between the input width and height, and put the input video at
  7786. the center of the padded area:
  7787. @example
  7788. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  7789. @end example
  7790. @item
  7791. Pad the input to get a final w/h ratio of 16:9:
  7792. @example
  7793. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  7794. @end example
  7795. @item
  7796. In case of anamorphic video, in order to set the output display aspect
  7797. correctly, it is necessary to use @var{sar} in the expression,
  7798. according to the relation:
  7799. @example
  7800. (ih * X / ih) * sar = output_dar
  7801. X = output_dar / sar
  7802. @end example
  7803. Thus the previous example needs to be modified to:
  7804. @example
  7805. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  7806. @end example
  7807. @item
  7808. Double the output size and put the input video in the bottom-right
  7809. corner of the output padded area:
  7810. @example
  7811. pad="2*iw:2*ih:ow-iw:oh-ih"
  7812. @end example
  7813. @end itemize
  7814. @anchor{palettegen}
  7815. @section palettegen
  7816. Generate one palette for a whole video stream.
  7817. It accepts the following options:
  7818. @table @option
  7819. @item max_colors
  7820. Set the maximum number of colors to quantize in the palette.
  7821. Note: the palette will still contain 256 colors; the unused palette entries
  7822. will be black.
  7823. @item reserve_transparent
  7824. Create a palette of 255 colors maximum and reserve the last one for
  7825. transparency. Reserving the transparency color is useful for GIF optimization.
  7826. If not set, the maximum of colors in the palette will be 256. You probably want
  7827. to disable this option for a standalone image.
  7828. Set by default.
  7829. @item stats_mode
  7830. Set statistics mode.
  7831. It accepts the following values:
  7832. @table @samp
  7833. @item full
  7834. Compute full frame histograms.
  7835. @item diff
  7836. Compute histograms only for the part that differs from previous frame. This
  7837. might be relevant to give more importance to the moving part of your input if
  7838. the background is static.
  7839. @end table
  7840. Default value is @var{full}.
  7841. @end table
  7842. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  7843. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  7844. color quantization of the palette. This information is also visible at
  7845. @var{info} logging level.
  7846. @subsection Examples
  7847. @itemize
  7848. @item
  7849. Generate a representative palette of a given video using @command{ffmpeg}:
  7850. @example
  7851. ffmpeg -i input.mkv -vf palettegen palette.png
  7852. @end example
  7853. @end itemize
  7854. @section paletteuse
  7855. Use a palette to downsample an input video stream.
  7856. The filter takes two inputs: one video stream and a palette. The palette must
  7857. be a 256 pixels image.
  7858. It accepts the following options:
  7859. @table @option
  7860. @item dither
  7861. Select dithering mode. Available algorithms are:
  7862. @table @samp
  7863. @item bayer
  7864. Ordered 8x8 bayer dithering (deterministic)
  7865. @item heckbert
  7866. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  7867. Note: this dithering is sometimes considered "wrong" and is included as a
  7868. reference.
  7869. @item floyd_steinberg
  7870. Floyd and Steingberg dithering (error diffusion)
  7871. @item sierra2
  7872. Frankie Sierra dithering v2 (error diffusion)
  7873. @item sierra2_4a
  7874. Frankie Sierra dithering v2 "Lite" (error diffusion)
  7875. @end table
  7876. Default is @var{sierra2_4a}.
  7877. @item bayer_scale
  7878. When @var{bayer} dithering is selected, this option defines the scale of the
  7879. pattern (how much the crosshatch pattern is visible). A low value means more
  7880. visible pattern for less banding, and higher value means less visible pattern
  7881. at the cost of more banding.
  7882. The option must be an integer value in the range [0,5]. Default is @var{2}.
  7883. @item diff_mode
  7884. If set, define the zone to process
  7885. @table @samp
  7886. @item rectangle
  7887. Only the changing rectangle will be reprocessed. This is similar to GIF
  7888. cropping/offsetting compression mechanism. This option can be useful for speed
  7889. if only a part of the image is changing, and has use cases such as limiting the
  7890. scope of the error diffusal @option{dither} to the rectangle that bounds the
  7891. moving scene (it leads to more deterministic output if the scene doesn't change
  7892. much, and as a result less moving noise and better GIF compression).
  7893. @end table
  7894. Default is @var{none}.
  7895. @end table
  7896. @subsection Examples
  7897. @itemize
  7898. @item
  7899. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  7900. using @command{ffmpeg}:
  7901. @example
  7902. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  7903. @end example
  7904. @end itemize
  7905. @section perspective
  7906. Correct perspective of video not recorded perpendicular to the screen.
  7907. A description of the accepted parameters follows.
  7908. @table @option
  7909. @item x0
  7910. @item y0
  7911. @item x1
  7912. @item y1
  7913. @item x2
  7914. @item y2
  7915. @item x3
  7916. @item y3
  7917. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  7918. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  7919. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  7920. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  7921. then the corners of the source will be sent to the specified coordinates.
  7922. The expressions can use the following variables:
  7923. @table @option
  7924. @item W
  7925. @item H
  7926. the width and height of video frame.
  7927. @item in
  7928. Input frame count.
  7929. @item on
  7930. Output frame count.
  7931. @end table
  7932. @item interpolation
  7933. Set interpolation for perspective correction.
  7934. It accepts the following values:
  7935. @table @samp
  7936. @item linear
  7937. @item cubic
  7938. @end table
  7939. Default value is @samp{linear}.
  7940. @item sense
  7941. Set interpretation of coordinate options.
  7942. It accepts the following values:
  7943. @table @samp
  7944. @item 0, source
  7945. Send point in the source specified by the given coordinates to
  7946. the corners of the destination.
  7947. @item 1, destination
  7948. Send the corners of the source to the point in the destination specified
  7949. by the given coordinates.
  7950. Default value is @samp{source}.
  7951. @end table
  7952. @item eval
  7953. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  7954. It accepts the following values:
  7955. @table @samp
  7956. @item init
  7957. only evaluate expressions once during the filter initialization or
  7958. when a command is processed
  7959. @item frame
  7960. evaluate expressions for each incoming frame
  7961. @end table
  7962. Default value is @samp{init}.
  7963. @end table
  7964. @section phase
  7965. Delay interlaced video by one field time so that the field order changes.
  7966. The intended use is to fix PAL movies that have been captured with the
  7967. opposite field order to the film-to-video transfer.
  7968. A description of the accepted parameters follows.
  7969. @table @option
  7970. @item mode
  7971. Set phase mode.
  7972. It accepts the following values:
  7973. @table @samp
  7974. @item t
  7975. Capture field order top-first, transfer bottom-first.
  7976. Filter will delay the bottom field.
  7977. @item b
  7978. Capture field order bottom-first, transfer top-first.
  7979. Filter will delay the top field.
  7980. @item p
  7981. Capture and transfer with the same field order. This mode only exists
  7982. for the documentation of the other options to refer to, but if you
  7983. actually select it, the filter will faithfully do nothing.
  7984. @item a
  7985. Capture field order determined automatically by field flags, transfer
  7986. opposite.
  7987. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  7988. basis using field flags. If no field information is available,
  7989. then this works just like @samp{u}.
  7990. @item u
  7991. Capture unknown or varying, transfer opposite.
  7992. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  7993. analyzing the images and selecting the alternative that produces best
  7994. match between the fields.
  7995. @item T
  7996. Capture top-first, transfer unknown or varying.
  7997. Filter selects among @samp{t} and @samp{p} using image analysis.
  7998. @item B
  7999. Capture bottom-first, transfer unknown or varying.
  8000. Filter selects among @samp{b} and @samp{p} using image analysis.
  8001. @item A
  8002. Capture determined by field flags, transfer unknown or varying.
  8003. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  8004. image analysis. If no field information is available, then this works just
  8005. like @samp{U}. This is the default mode.
  8006. @item U
  8007. Both capture and transfer unknown or varying.
  8008. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  8009. @end table
  8010. @end table
  8011. @section pixdesctest
  8012. Pixel format descriptor test filter, mainly useful for internal
  8013. testing. The output video should be equal to the input video.
  8014. For example:
  8015. @example
  8016. format=monow, pixdesctest
  8017. @end example
  8018. can be used to test the monowhite pixel format descriptor definition.
  8019. @section pp
  8020. Enable the specified chain of postprocessing subfilters using libpostproc. This
  8021. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  8022. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  8023. Each subfilter and some options have a short and a long name that can be used
  8024. interchangeably, i.e. dr/dering are the same.
  8025. The filters accept the following options:
  8026. @table @option
  8027. @item subfilters
  8028. Set postprocessing subfilters string.
  8029. @end table
  8030. All subfilters share common options to determine their scope:
  8031. @table @option
  8032. @item a/autoq
  8033. Honor the quality commands for this subfilter.
  8034. @item c/chrom
  8035. Do chrominance filtering, too (default).
  8036. @item y/nochrom
  8037. Do luminance filtering only (no chrominance).
  8038. @item n/noluma
  8039. Do chrominance filtering only (no luminance).
  8040. @end table
  8041. These options can be appended after the subfilter name, separated by a '|'.
  8042. Available subfilters are:
  8043. @table @option
  8044. @item hb/hdeblock[|difference[|flatness]]
  8045. Horizontal deblocking filter
  8046. @table @option
  8047. @item difference
  8048. Difference factor where higher values mean more deblocking (default: @code{32}).
  8049. @item flatness
  8050. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8051. @end table
  8052. @item vb/vdeblock[|difference[|flatness]]
  8053. Vertical deblocking filter
  8054. @table @option
  8055. @item difference
  8056. Difference factor where higher values mean more deblocking (default: @code{32}).
  8057. @item flatness
  8058. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8059. @end table
  8060. @item ha/hadeblock[|difference[|flatness]]
  8061. Accurate horizontal deblocking filter
  8062. @table @option
  8063. @item difference
  8064. Difference factor where higher values mean more deblocking (default: @code{32}).
  8065. @item flatness
  8066. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8067. @end table
  8068. @item va/vadeblock[|difference[|flatness]]
  8069. Accurate vertical deblocking filter
  8070. @table @option
  8071. @item difference
  8072. Difference factor where higher values mean more deblocking (default: @code{32}).
  8073. @item flatness
  8074. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8075. @end table
  8076. @end table
  8077. The horizontal and vertical deblocking filters share the difference and
  8078. flatness values so you cannot set different horizontal and vertical
  8079. thresholds.
  8080. @table @option
  8081. @item h1/x1hdeblock
  8082. Experimental horizontal deblocking filter
  8083. @item v1/x1vdeblock
  8084. Experimental vertical deblocking filter
  8085. @item dr/dering
  8086. Deringing filter
  8087. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  8088. @table @option
  8089. @item threshold1
  8090. larger -> stronger filtering
  8091. @item threshold2
  8092. larger -> stronger filtering
  8093. @item threshold3
  8094. larger -> stronger filtering
  8095. @end table
  8096. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  8097. @table @option
  8098. @item f/fullyrange
  8099. Stretch luminance to @code{0-255}.
  8100. @end table
  8101. @item lb/linblenddeint
  8102. Linear blend deinterlacing filter that deinterlaces the given block by
  8103. filtering all lines with a @code{(1 2 1)} filter.
  8104. @item li/linipoldeint
  8105. Linear interpolating deinterlacing filter that deinterlaces the given block by
  8106. linearly interpolating every second line.
  8107. @item ci/cubicipoldeint
  8108. Cubic interpolating deinterlacing filter deinterlaces the given block by
  8109. cubically interpolating every second line.
  8110. @item md/mediandeint
  8111. Median deinterlacing filter that deinterlaces the given block by applying a
  8112. median filter to every second line.
  8113. @item fd/ffmpegdeint
  8114. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  8115. second line with a @code{(-1 4 2 4 -1)} filter.
  8116. @item l5/lowpass5
  8117. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  8118. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  8119. @item fq/forceQuant[|quantizer]
  8120. Overrides the quantizer table from the input with the constant quantizer you
  8121. specify.
  8122. @table @option
  8123. @item quantizer
  8124. Quantizer to use
  8125. @end table
  8126. @item de/default
  8127. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  8128. @item fa/fast
  8129. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  8130. @item ac
  8131. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  8132. @end table
  8133. @subsection Examples
  8134. @itemize
  8135. @item
  8136. Apply horizontal and vertical deblocking, deringing and automatic
  8137. brightness/contrast:
  8138. @example
  8139. pp=hb/vb/dr/al
  8140. @end example
  8141. @item
  8142. Apply default filters without brightness/contrast correction:
  8143. @example
  8144. pp=de/-al
  8145. @end example
  8146. @item
  8147. Apply default filters and temporal denoiser:
  8148. @example
  8149. pp=default/tmpnoise|1|2|3
  8150. @end example
  8151. @item
  8152. Apply deblocking on luminance only, and switch vertical deblocking on or off
  8153. automatically depending on available CPU time:
  8154. @example
  8155. pp=hb|y/vb|a
  8156. @end example
  8157. @end itemize
  8158. @section pp7
  8159. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  8160. similar to spp = 6 with 7 point DCT, where only the center sample is
  8161. used after IDCT.
  8162. The filter accepts the following options:
  8163. @table @option
  8164. @item qp
  8165. Force a constant quantization parameter. It accepts an integer in range
  8166. 0 to 63. If not set, the filter will use the QP from the video stream
  8167. (if available).
  8168. @item mode
  8169. Set thresholding mode. Available modes are:
  8170. @table @samp
  8171. @item hard
  8172. Set hard thresholding.
  8173. @item soft
  8174. Set soft thresholding (better de-ringing effect, but likely blurrier).
  8175. @item medium
  8176. Set medium thresholding (good results, default).
  8177. @end table
  8178. @end table
  8179. @section psnr
  8180. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  8181. Ratio) between two input videos.
  8182. This filter takes in input two input videos, the first input is
  8183. considered the "main" source and is passed unchanged to the
  8184. output. The second input is used as a "reference" video for computing
  8185. the PSNR.
  8186. Both video inputs must have the same resolution and pixel format for
  8187. this filter to work correctly. Also it assumes that both inputs
  8188. have the same number of frames, which are compared one by one.
  8189. The obtained average PSNR is printed through the logging system.
  8190. The filter stores the accumulated MSE (mean squared error) of each
  8191. frame, and at the end of the processing it is averaged across all frames
  8192. equally, and the following formula is applied to obtain the PSNR:
  8193. @example
  8194. PSNR = 10*log10(MAX^2/MSE)
  8195. @end example
  8196. Where MAX is the average of the maximum values of each component of the
  8197. image.
  8198. The description of the accepted parameters follows.
  8199. @table @option
  8200. @item stats_file, f
  8201. If specified the filter will use the named file to save the PSNR of
  8202. each individual frame. When filename equals "-" the data is sent to
  8203. standard output.
  8204. @item stats_version
  8205. Specifies which version of the stats file format to use. Details of
  8206. each format are written below.
  8207. Default value is 1.
  8208. @end table
  8209. The file printed if @var{stats_file} is selected, contains a sequence of
  8210. key/value pairs of the form @var{key}:@var{value} for each compared
  8211. couple of frames.
  8212. If a @var{stats_version} greater than 1 is specified, a header line precedes
  8213. the list of per-frame-pair stats, with key value pairs following the frame
  8214. format with the following parameters:
  8215. @table @option
  8216. @item psnr_log_version
  8217. The version of the log file format. Will match @var{stats_version}.
  8218. @item fields
  8219. A comma separated list of the per-frame-pair parameters included in
  8220. the log.
  8221. @end table
  8222. A description of each shown per-frame-pair parameter follows:
  8223. @table @option
  8224. @item n
  8225. sequential number of the input frame, starting from 1
  8226. @item mse_avg
  8227. Mean Square Error pixel-by-pixel average difference of the compared
  8228. frames, averaged over all the image components.
  8229. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  8230. Mean Square Error pixel-by-pixel average difference of the compared
  8231. frames for the component specified by the suffix.
  8232. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  8233. Peak Signal to Noise ratio of the compared frames for the component
  8234. specified by the suffix.
  8235. @end table
  8236. For example:
  8237. @example
  8238. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  8239. [main][ref] psnr="stats_file=stats.log" [out]
  8240. @end example
  8241. On this example the input file being processed is compared with the
  8242. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  8243. is stored in @file{stats.log}.
  8244. @anchor{pullup}
  8245. @section pullup
  8246. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  8247. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  8248. content.
  8249. The pullup filter is designed to take advantage of future context in making
  8250. its decisions. This filter is stateless in the sense that it does not lock
  8251. onto a pattern to follow, but it instead looks forward to the following
  8252. fields in order to identify matches and rebuild progressive frames.
  8253. To produce content with an even framerate, insert the fps filter after
  8254. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  8255. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  8256. The filter accepts the following options:
  8257. @table @option
  8258. @item jl
  8259. @item jr
  8260. @item jt
  8261. @item jb
  8262. These options set the amount of "junk" to ignore at the left, right, top, and
  8263. bottom of the image, respectively. Left and right are in units of 8 pixels,
  8264. while top and bottom are in units of 2 lines.
  8265. The default is 8 pixels on each side.
  8266. @item sb
  8267. Set the strict breaks. Setting this option to 1 will reduce the chances of
  8268. filter generating an occasional mismatched frame, but it may also cause an
  8269. excessive number of frames to be dropped during high motion sequences.
  8270. Conversely, setting it to -1 will make filter match fields more easily.
  8271. This may help processing of video where there is slight blurring between
  8272. the fields, but may also cause there to be interlaced frames in the output.
  8273. Default value is @code{0}.
  8274. @item mp
  8275. Set the metric plane to use. It accepts the following values:
  8276. @table @samp
  8277. @item l
  8278. Use luma plane.
  8279. @item u
  8280. Use chroma blue plane.
  8281. @item v
  8282. Use chroma red plane.
  8283. @end table
  8284. This option may be set to use chroma plane instead of the default luma plane
  8285. for doing filter's computations. This may improve accuracy on very clean
  8286. source material, but more likely will decrease accuracy, especially if there
  8287. is chroma noise (rainbow effect) or any grayscale video.
  8288. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  8289. load and make pullup usable in realtime on slow machines.
  8290. @end table
  8291. For best results (without duplicated frames in the output file) it is
  8292. necessary to change the output frame rate. For example, to inverse
  8293. telecine NTSC input:
  8294. @example
  8295. ffmpeg -i input -vf pullup -r 24000/1001 ...
  8296. @end example
  8297. @section qp
  8298. Change video quantization parameters (QP).
  8299. The filter accepts the following option:
  8300. @table @option
  8301. @item qp
  8302. Set expression for quantization parameter.
  8303. @end table
  8304. The expression is evaluated through the eval API and can contain, among others,
  8305. the following constants:
  8306. @table @var
  8307. @item known
  8308. 1 if index is not 129, 0 otherwise.
  8309. @item qp
  8310. Sequentional index starting from -129 to 128.
  8311. @end table
  8312. @subsection Examples
  8313. @itemize
  8314. @item
  8315. Some equation like:
  8316. @example
  8317. qp=2+2*sin(PI*qp)
  8318. @end example
  8319. @end itemize
  8320. @section random
  8321. Flush video frames from internal cache of frames into a random order.
  8322. No frame is discarded.
  8323. Inspired by @ref{frei0r} nervous filter.
  8324. @table @option
  8325. @item frames
  8326. Set size in number of frames of internal cache, in range from @code{2} to
  8327. @code{512}. Default is @code{30}.
  8328. @item seed
  8329. Set seed for random number generator, must be an integer included between
  8330. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  8331. less than @code{0}, the filter will try to use a good random seed on a
  8332. best effort basis.
  8333. @end table
  8334. @section readvitc
  8335. Read vertical interval timecode (VITC) information from the top lines of a
  8336. video frame.
  8337. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  8338. timecode value, if a valid timecode has been detected. Further metadata key
  8339. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  8340. timecode data has been found or not.
  8341. This filter accepts the following options:
  8342. @table @option
  8343. @item scan_max
  8344. Set the maximum number of lines to scan for VITC data. If the value is set to
  8345. @code{-1} the full video frame is scanned. Default is @code{45}.
  8346. @item thr_b
  8347. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  8348. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  8349. @item thr_w
  8350. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  8351. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  8352. @end table
  8353. @subsection Examples
  8354. @itemize
  8355. @item
  8356. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  8357. draw @code{--:--:--:--} as a placeholder:
  8358. @example
  8359. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  8360. @end example
  8361. @end itemize
  8362. @section remap
  8363. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  8364. Destination pixel at position (X, Y) will be picked from source (x, y) position
  8365. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  8366. value for pixel will be used for destination pixel.
  8367. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  8368. will have Xmap/Ymap video stream dimensions.
  8369. Xmap and Ymap input video streams are 16bit depth, single channel.
  8370. @section removegrain
  8371. The removegrain filter is a spatial denoiser for progressive video.
  8372. @table @option
  8373. @item m0
  8374. Set mode for the first plane.
  8375. @item m1
  8376. Set mode for the second plane.
  8377. @item m2
  8378. Set mode for the third plane.
  8379. @item m3
  8380. Set mode for the fourth plane.
  8381. @end table
  8382. Range of mode is from 0 to 24. Description of each mode follows:
  8383. @table @var
  8384. @item 0
  8385. Leave input plane unchanged. Default.
  8386. @item 1
  8387. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  8388. @item 2
  8389. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  8390. @item 3
  8391. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  8392. @item 4
  8393. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  8394. This is equivalent to a median filter.
  8395. @item 5
  8396. Line-sensitive clipping giving the minimal change.
  8397. @item 6
  8398. Line-sensitive clipping, intermediate.
  8399. @item 7
  8400. Line-sensitive clipping, intermediate.
  8401. @item 8
  8402. Line-sensitive clipping, intermediate.
  8403. @item 9
  8404. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  8405. @item 10
  8406. Replaces the target pixel with the closest neighbour.
  8407. @item 11
  8408. [1 2 1] horizontal and vertical kernel blur.
  8409. @item 12
  8410. Same as mode 11.
  8411. @item 13
  8412. Bob mode, interpolates top field from the line where the neighbours
  8413. pixels are the closest.
  8414. @item 14
  8415. Bob mode, interpolates bottom field from the line where the neighbours
  8416. pixels are the closest.
  8417. @item 15
  8418. Bob mode, interpolates top field. Same as 13 but with a more complicated
  8419. interpolation formula.
  8420. @item 16
  8421. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  8422. interpolation formula.
  8423. @item 17
  8424. Clips the pixel with the minimum and maximum of respectively the maximum and
  8425. minimum of each pair of opposite neighbour pixels.
  8426. @item 18
  8427. Line-sensitive clipping using opposite neighbours whose greatest distance from
  8428. the current pixel is minimal.
  8429. @item 19
  8430. Replaces the pixel with the average of its 8 neighbours.
  8431. @item 20
  8432. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  8433. @item 21
  8434. Clips pixels using the averages of opposite neighbour.
  8435. @item 22
  8436. Same as mode 21 but simpler and faster.
  8437. @item 23
  8438. Small edge and halo removal, but reputed useless.
  8439. @item 24
  8440. Similar as 23.
  8441. @end table
  8442. @section removelogo
  8443. Suppress a TV station logo, using an image file to determine which
  8444. pixels comprise the logo. It works by filling in the pixels that
  8445. comprise the logo with neighboring pixels.
  8446. The filter accepts the following options:
  8447. @table @option
  8448. @item filename, f
  8449. Set the filter bitmap file, which can be any image format supported by
  8450. libavformat. The width and height of the image file must match those of the
  8451. video stream being processed.
  8452. @end table
  8453. Pixels in the provided bitmap image with a value of zero are not
  8454. considered part of the logo, non-zero pixels are considered part of
  8455. the logo. If you use white (255) for the logo and black (0) for the
  8456. rest, you will be safe. For making the filter bitmap, it is
  8457. recommended to take a screen capture of a black frame with the logo
  8458. visible, and then using a threshold filter followed by the erode
  8459. filter once or twice.
  8460. If needed, little splotches can be fixed manually. Remember that if
  8461. logo pixels are not covered, the filter quality will be much
  8462. reduced. Marking too many pixels as part of the logo does not hurt as
  8463. much, but it will increase the amount of blurring needed to cover over
  8464. the image and will destroy more information than necessary, and extra
  8465. pixels will slow things down on a large logo.
  8466. @section repeatfields
  8467. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  8468. fields based on its value.
  8469. @section reverse
  8470. Reverse a video clip.
  8471. Warning: This filter requires memory to buffer the entire clip, so trimming
  8472. is suggested.
  8473. @subsection Examples
  8474. @itemize
  8475. @item
  8476. Take the first 5 seconds of a clip, and reverse it.
  8477. @example
  8478. trim=end=5,reverse
  8479. @end example
  8480. @end itemize
  8481. @section rotate
  8482. Rotate video by an arbitrary angle expressed in radians.
  8483. The filter accepts the following options:
  8484. A description of the optional parameters follows.
  8485. @table @option
  8486. @item angle, a
  8487. Set an expression for the angle by which to rotate the input video
  8488. clockwise, expressed as a number of radians. A negative value will
  8489. result in a counter-clockwise rotation. By default it is set to "0".
  8490. This expression is evaluated for each frame.
  8491. @item out_w, ow
  8492. Set the output width expression, default value is "iw".
  8493. This expression is evaluated just once during configuration.
  8494. @item out_h, oh
  8495. Set the output height expression, default value is "ih".
  8496. This expression is evaluated just once during configuration.
  8497. @item bilinear
  8498. Enable bilinear interpolation if set to 1, a value of 0 disables
  8499. it. Default value is 1.
  8500. @item fillcolor, c
  8501. Set the color used to fill the output area not covered by the rotated
  8502. image. For the general syntax of this option, check the "Color" section in the
  8503. ffmpeg-utils manual. If the special value "none" is selected then no
  8504. background is printed (useful for example if the background is never shown).
  8505. Default value is "black".
  8506. @end table
  8507. The expressions for the angle and the output size can contain the
  8508. following constants and functions:
  8509. @table @option
  8510. @item n
  8511. sequential number of the input frame, starting from 0. It is always NAN
  8512. before the first frame is filtered.
  8513. @item t
  8514. time in seconds of the input frame, it is set to 0 when the filter is
  8515. configured. It is always NAN before the first frame is filtered.
  8516. @item hsub
  8517. @item vsub
  8518. horizontal and vertical chroma subsample values. For example for the
  8519. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8520. @item in_w, iw
  8521. @item in_h, ih
  8522. the input video width and height
  8523. @item out_w, ow
  8524. @item out_h, oh
  8525. the output width and height, that is the size of the padded area as
  8526. specified by the @var{width} and @var{height} expressions
  8527. @item rotw(a)
  8528. @item roth(a)
  8529. the minimal width/height required for completely containing the input
  8530. video rotated by @var{a} radians.
  8531. These are only available when computing the @option{out_w} and
  8532. @option{out_h} expressions.
  8533. @end table
  8534. @subsection Examples
  8535. @itemize
  8536. @item
  8537. Rotate the input by PI/6 radians clockwise:
  8538. @example
  8539. rotate=PI/6
  8540. @end example
  8541. @item
  8542. Rotate the input by PI/6 radians counter-clockwise:
  8543. @example
  8544. rotate=-PI/6
  8545. @end example
  8546. @item
  8547. Rotate the input by 45 degrees clockwise:
  8548. @example
  8549. rotate=45*PI/180
  8550. @end example
  8551. @item
  8552. Apply a constant rotation with period T, starting from an angle of PI/3:
  8553. @example
  8554. rotate=PI/3+2*PI*t/T
  8555. @end example
  8556. @item
  8557. Make the input video rotation oscillating with a period of T
  8558. seconds and an amplitude of A radians:
  8559. @example
  8560. rotate=A*sin(2*PI/T*t)
  8561. @end example
  8562. @item
  8563. Rotate the video, output size is chosen so that the whole rotating
  8564. input video is always completely contained in the output:
  8565. @example
  8566. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  8567. @end example
  8568. @item
  8569. Rotate the video, reduce the output size so that no background is ever
  8570. shown:
  8571. @example
  8572. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  8573. @end example
  8574. @end itemize
  8575. @subsection Commands
  8576. The filter supports the following commands:
  8577. @table @option
  8578. @item a, angle
  8579. Set the angle expression.
  8580. The command accepts the same syntax of the corresponding option.
  8581. If the specified expression is not valid, it is kept at its current
  8582. value.
  8583. @end table
  8584. @section sab
  8585. Apply Shape Adaptive Blur.
  8586. The filter accepts the following options:
  8587. @table @option
  8588. @item luma_radius, lr
  8589. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  8590. value is 1.0. A greater value will result in a more blurred image, and
  8591. in slower processing.
  8592. @item luma_pre_filter_radius, lpfr
  8593. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  8594. value is 1.0.
  8595. @item luma_strength, ls
  8596. Set luma maximum difference between pixels to still be considered, must
  8597. be a value in the 0.1-100.0 range, default value is 1.0.
  8598. @item chroma_radius, cr
  8599. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  8600. greater value will result in a more blurred image, and in slower
  8601. processing.
  8602. @item chroma_pre_filter_radius, cpfr
  8603. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  8604. @item chroma_strength, cs
  8605. Set chroma maximum difference between pixels to still be considered,
  8606. must be a value in the -0.9-100.0 range.
  8607. @end table
  8608. Each chroma option value, if not explicitly specified, is set to the
  8609. corresponding luma option value.
  8610. @anchor{scale}
  8611. @section scale
  8612. Scale (resize) the input video, using the libswscale library.
  8613. The scale filter forces the output display aspect ratio to be the same
  8614. of the input, by changing the output sample aspect ratio.
  8615. If the input image format is different from the format requested by
  8616. the next filter, the scale filter will convert the input to the
  8617. requested format.
  8618. @subsection Options
  8619. The filter accepts the following options, or any of the options
  8620. supported by the libswscale scaler.
  8621. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  8622. the complete list of scaler options.
  8623. @table @option
  8624. @item width, w
  8625. @item height, h
  8626. Set the output video dimension expression. Default value is the input
  8627. dimension.
  8628. If the value is 0, the input width is used for the output.
  8629. If one of the values is -1, the scale filter will use a value that
  8630. maintains the aspect ratio of the input image, calculated from the
  8631. other specified dimension. If both of them are -1, the input size is
  8632. used
  8633. If one of the values is -n with n > 1, the scale filter will also use a value
  8634. that maintains the aspect ratio of the input image, calculated from the other
  8635. specified dimension. After that it will, however, make sure that the calculated
  8636. dimension is divisible by n and adjust the value if necessary.
  8637. See below for the list of accepted constants for use in the dimension
  8638. expression.
  8639. @item eval
  8640. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  8641. @table @samp
  8642. @item init
  8643. Only evaluate expressions once during the filter initialization or when a command is processed.
  8644. @item frame
  8645. Evaluate expressions for each incoming frame.
  8646. @end table
  8647. Default value is @samp{init}.
  8648. @item interl
  8649. Set the interlacing mode. It accepts the following values:
  8650. @table @samp
  8651. @item 1
  8652. Force interlaced aware scaling.
  8653. @item 0
  8654. Do not apply interlaced scaling.
  8655. @item -1
  8656. Select interlaced aware scaling depending on whether the source frames
  8657. are flagged as interlaced or not.
  8658. @end table
  8659. Default value is @samp{0}.
  8660. @item flags
  8661. Set libswscale scaling flags. See
  8662. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  8663. complete list of values. If not explicitly specified the filter applies
  8664. the default flags.
  8665. @item param0, param1
  8666. Set libswscale input parameters for scaling algorithms that need them. See
  8667. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  8668. complete documentation. If not explicitly specified the filter applies
  8669. empty parameters.
  8670. @item size, s
  8671. Set the video size. For the syntax of this option, check the
  8672. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  8673. @item in_color_matrix
  8674. @item out_color_matrix
  8675. Set in/output YCbCr color space type.
  8676. This allows the autodetected value to be overridden as well as allows forcing
  8677. a specific value used for the output and encoder.
  8678. If not specified, the color space type depends on the pixel format.
  8679. Possible values:
  8680. @table @samp
  8681. @item auto
  8682. Choose automatically.
  8683. @item bt709
  8684. Format conforming to International Telecommunication Union (ITU)
  8685. Recommendation BT.709.
  8686. @item fcc
  8687. Set color space conforming to the United States Federal Communications
  8688. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  8689. @item bt601
  8690. Set color space conforming to:
  8691. @itemize
  8692. @item
  8693. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  8694. @item
  8695. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  8696. @item
  8697. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  8698. @end itemize
  8699. @item smpte240m
  8700. Set color space conforming to SMPTE ST 240:1999.
  8701. @end table
  8702. @item in_range
  8703. @item out_range
  8704. Set in/output YCbCr sample range.
  8705. This allows the autodetected value to be overridden as well as allows forcing
  8706. a specific value used for the output and encoder. If not specified, the
  8707. range depends on the pixel format. Possible values:
  8708. @table @samp
  8709. @item auto
  8710. Choose automatically.
  8711. @item jpeg/full/pc
  8712. Set full range (0-255 in case of 8-bit luma).
  8713. @item mpeg/tv
  8714. Set "MPEG" range (16-235 in case of 8-bit luma).
  8715. @end table
  8716. @item force_original_aspect_ratio
  8717. Enable decreasing or increasing output video width or height if necessary to
  8718. keep the original aspect ratio. Possible values:
  8719. @table @samp
  8720. @item disable
  8721. Scale the video as specified and disable this feature.
  8722. @item decrease
  8723. The output video dimensions will automatically be decreased if needed.
  8724. @item increase
  8725. The output video dimensions will automatically be increased if needed.
  8726. @end table
  8727. One useful instance of this option is that when you know a specific device's
  8728. maximum allowed resolution, you can use this to limit the output video to
  8729. that, while retaining the aspect ratio. For example, device A allows
  8730. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  8731. decrease) and specifying 1280x720 to the command line makes the output
  8732. 1280x533.
  8733. Please note that this is a different thing than specifying -1 for @option{w}
  8734. or @option{h}, you still need to specify the output resolution for this option
  8735. to work.
  8736. @end table
  8737. The values of the @option{w} and @option{h} options are expressions
  8738. containing the following constants:
  8739. @table @var
  8740. @item in_w
  8741. @item in_h
  8742. The input width and height
  8743. @item iw
  8744. @item ih
  8745. These are the same as @var{in_w} and @var{in_h}.
  8746. @item out_w
  8747. @item out_h
  8748. The output (scaled) width and height
  8749. @item ow
  8750. @item oh
  8751. These are the same as @var{out_w} and @var{out_h}
  8752. @item a
  8753. The same as @var{iw} / @var{ih}
  8754. @item sar
  8755. input sample aspect ratio
  8756. @item dar
  8757. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  8758. @item hsub
  8759. @item vsub
  8760. horizontal and vertical input chroma subsample values. For example for the
  8761. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8762. @item ohsub
  8763. @item ovsub
  8764. horizontal and vertical output chroma subsample values. For example for the
  8765. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8766. @end table
  8767. @subsection Examples
  8768. @itemize
  8769. @item
  8770. Scale the input video to a size of 200x100
  8771. @example
  8772. scale=w=200:h=100
  8773. @end example
  8774. This is equivalent to:
  8775. @example
  8776. scale=200:100
  8777. @end example
  8778. or:
  8779. @example
  8780. scale=200x100
  8781. @end example
  8782. @item
  8783. Specify a size abbreviation for the output size:
  8784. @example
  8785. scale=qcif
  8786. @end example
  8787. which can also be written as:
  8788. @example
  8789. scale=size=qcif
  8790. @end example
  8791. @item
  8792. Scale the input to 2x:
  8793. @example
  8794. scale=w=2*iw:h=2*ih
  8795. @end example
  8796. @item
  8797. The above is the same as:
  8798. @example
  8799. scale=2*in_w:2*in_h
  8800. @end example
  8801. @item
  8802. Scale the input to 2x with forced interlaced scaling:
  8803. @example
  8804. scale=2*iw:2*ih:interl=1
  8805. @end example
  8806. @item
  8807. Scale the input to half size:
  8808. @example
  8809. scale=w=iw/2:h=ih/2
  8810. @end example
  8811. @item
  8812. Increase the width, and set the height to the same size:
  8813. @example
  8814. scale=3/2*iw:ow
  8815. @end example
  8816. @item
  8817. Seek Greek harmony:
  8818. @example
  8819. scale=iw:1/PHI*iw
  8820. scale=ih*PHI:ih
  8821. @end example
  8822. @item
  8823. Increase the height, and set the width to 3/2 of the height:
  8824. @example
  8825. scale=w=3/2*oh:h=3/5*ih
  8826. @end example
  8827. @item
  8828. Increase the size, making the size a multiple of the chroma
  8829. subsample values:
  8830. @example
  8831. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  8832. @end example
  8833. @item
  8834. Increase the width to a maximum of 500 pixels,
  8835. keeping the same aspect ratio as the input:
  8836. @example
  8837. scale=w='min(500\, iw*3/2):h=-1'
  8838. @end example
  8839. @end itemize
  8840. @subsection Commands
  8841. This filter supports the following commands:
  8842. @table @option
  8843. @item width, w
  8844. @item height, h
  8845. Set the output video dimension expression.
  8846. The command accepts the same syntax of the corresponding option.
  8847. If the specified expression is not valid, it is kept at its current
  8848. value.
  8849. @end table
  8850. @section scale_npp
  8851. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  8852. format conversion on CUDA video frames. Setting the output width and height
  8853. works in the same way as for the @var{scale} filter.
  8854. The following additional options are accepted:
  8855. @table @option
  8856. @item format
  8857. The pixel format of the output CUDA frames. If set to the string "same" (the
  8858. default), the input format will be kept. Note that automatic format negotiation
  8859. and conversion is not yet supported for hardware frames
  8860. @item interp_algo
  8861. The interpolation algorithm used for resizing. One of the following:
  8862. @table @option
  8863. @item nn
  8864. Nearest neighbour.
  8865. @item linear
  8866. @item cubic
  8867. @item cubic2p_bspline
  8868. 2-parameter cubic (B=1, C=0)
  8869. @item cubic2p_catmullrom
  8870. 2-parameter cubic (B=0, C=1/2)
  8871. @item cubic2p_b05c03
  8872. 2-parameter cubic (B=1/2, C=3/10)
  8873. @item super
  8874. Supersampling
  8875. @item lanczos
  8876. @end table
  8877. @end table
  8878. @section scale2ref
  8879. Scale (resize) the input video, based on a reference video.
  8880. See the scale filter for available options, scale2ref supports the same but
  8881. uses the reference video instead of the main input as basis.
  8882. @subsection Examples
  8883. @itemize
  8884. @item
  8885. Scale a subtitle stream to match the main video in size before overlaying
  8886. @example
  8887. 'scale2ref[b][a];[a][b]overlay'
  8888. @end example
  8889. @end itemize
  8890. @anchor{selectivecolor}
  8891. @section selectivecolor
  8892. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  8893. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  8894. by the "purity" of the color (that is, how saturated it already is).
  8895. This filter is similar to the Adobe Photoshop Selective Color tool.
  8896. The filter accepts the following options:
  8897. @table @option
  8898. @item correction_method
  8899. Select color correction method.
  8900. Available values are:
  8901. @table @samp
  8902. @item absolute
  8903. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  8904. component value).
  8905. @item relative
  8906. Specified adjustments are relative to the original component value.
  8907. @end table
  8908. Default is @code{absolute}.
  8909. @item reds
  8910. Adjustments for red pixels (pixels where the red component is the maximum)
  8911. @item yellows
  8912. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  8913. @item greens
  8914. Adjustments for green pixels (pixels where the green component is the maximum)
  8915. @item cyans
  8916. Adjustments for cyan pixels (pixels where the red component is the minimum)
  8917. @item blues
  8918. Adjustments for blue pixels (pixels where the blue component is the maximum)
  8919. @item magentas
  8920. Adjustments for magenta pixels (pixels where the green component is the minimum)
  8921. @item whites
  8922. Adjustments for white pixels (pixels where all components are greater than 128)
  8923. @item neutrals
  8924. Adjustments for all pixels except pure black and pure white
  8925. @item blacks
  8926. Adjustments for black pixels (pixels where all components are lesser than 128)
  8927. @item psfile
  8928. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  8929. @end table
  8930. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  8931. 4 space separated floating point adjustment values in the [-1,1] range,
  8932. respectively to adjust the amount of cyan, magenta, yellow and black for the
  8933. pixels of its range.
  8934. @subsection Examples
  8935. @itemize
  8936. @item
  8937. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  8938. increase magenta by 27% in blue areas:
  8939. @example
  8940. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  8941. @end example
  8942. @item
  8943. Use a Photoshop selective color preset:
  8944. @example
  8945. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  8946. @end example
  8947. @end itemize
  8948. @section separatefields
  8949. The @code{separatefields} takes a frame-based video input and splits
  8950. each frame into its components fields, producing a new half height clip
  8951. with twice the frame rate and twice the frame count.
  8952. This filter use field-dominance information in frame to decide which
  8953. of each pair of fields to place first in the output.
  8954. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  8955. @section setdar, setsar
  8956. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  8957. output video.
  8958. This is done by changing the specified Sample (aka Pixel) Aspect
  8959. Ratio, according to the following equation:
  8960. @example
  8961. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  8962. @end example
  8963. Keep in mind that the @code{setdar} filter does not modify the pixel
  8964. dimensions of the video frame. Also, the display aspect ratio set by
  8965. this filter may be changed by later filters in the filterchain,
  8966. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  8967. applied.
  8968. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  8969. the filter output video.
  8970. Note that as a consequence of the application of this filter, the
  8971. output display aspect ratio will change according to the equation
  8972. above.
  8973. Keep in mind that the sample aspect ratio set by the @code{setsar}
  8974. filter may be changed by later filters in the filterchain, e.g. if
  8975. another "setsar" or a "setdar" filter is applied.
  8976. It accepts the following parameters:
  8977. @table @option
  8978. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  8979. Set the aspect ratio used by the filter.
  8980. The parameter can be a floating point number string, an expression, or
  8981. a string of the form @var{num}:@var{den}, where @var{num} and
  8982. @var{den} are the numerator and denominator of the aspect ratio. If
  8983. the parameter is not specified, it is assumed the value "0".
  8984. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  8985. should be escaped.
  8986. @item max
  8987. Set the maximum integer value to use for expressing numerator and
  8988. denominator when reducing the expressed aspect ratio to a rational.
  8989. Default value is @code{100}.
  8990. @end table
  8991. The parameter @var{sar} is an expression containing
  8992. the following constants:
  8993. @table @option
  8994. @item E, PI, PHI
  8995. These are approximated values for the mathematical constants e
  8996. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  8997. @item w, h
  8998. The input width and height.
  8999. @item a
  9000. These are the same as @var{w} / @var{h}.
  9001. @item sar
  9002. The input sample aspect ratio.
  9003. @item dar
  9004. The input display aspect ratio. It is the same as
  9005. (@var{w} / @var{h}) * @var{sar}.
  9006. @item hsub, vsub
  9007. Horizontal and vertical chroma subsample values. For example, for the
  9008. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9009. @end table
  9010. @subsection Examples
  9011. @itemize
  9012. @item
  9013. To change the display aspect ratio to 16:9, specify one of the following:
  9014. @example
  9015. setdar=dar=1.77777
  9016. setdar=dar=16/9
  9017. @end example
  9018. @item
  9019. To change the sample aspect ratio to 10:11, specify:
  9020. @example
  9021. setsar=sar=10/11
  9022. @end example
  9023. @item
  9024. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  9025. 1000 in the aspect ratio reduction, use the command:
  9026. @example
  9027. setdar=ratio=16/9:max=1000
  9028. @end example
  9029. @end itemize
  9030. @anchor{setfield}
  9031. @section setfield
  9032. Force field for the output video frame.
  9033. The @code{setfield} filter marks the interlace type field for the
  9034. output frames. It does not change the input frame, but only sets the
  9035. corresponding property, which affects how the frame is treated by
  9036. following filters (e.g. @code{fieldorder} or @code{yadif}).
  9037. The filter accepts the following options:
  9038. @table @option
  9039. @item mode
  9040. Available values are:
  9041. @table @samp
  9042. @item auto
  9043. Keep the same field property.
  9044. @item bff
  9045. Mark the frame as bottom-field-first.
  9046. @item tff
  9047. Mark the frame as top-field-first.
  9048. @item prog
  9049. Mark the frame as progressive.
  9050. @end table
  9051. @end table
  9052. @section showinfo
  9053. Show a line containing various information for each input video frame.
  9054. The input video is not modified.
  9055. The shown line contains a sequence of key/value pairs of the form
  9056. @var{key}:@var{value}.
  9057. The following values are shown in the output:
  9058. @table @option
  9059. @item n
  9060. The (sequential) number of the input frame, starting from 0.
  9061. @item pts
  9062. The Presentation TimeStamp of the input frame, expressed as a number of
  9063. time base units. The time base unit depends on the filter input pad.
  9064. @item pts_time
  9065. The Presentation TimeStamp of the input frame, expressed as a number of
  9066. seconds.
  9067. @item pos
  9068. The position of the frame in the input stream, or -1 if this information is
  9069. unavailable and/or meaningless (for example in case of synthetic video).
  9070. @item fmt
  9071. The pixel format name.
  9072. @item sar
  9073. The sample aspect ratio of the input frame, expressed in the form
  9074. @var{num}/@var{den}.
  9075. @item s
  9076. The size of the input frame. For the syntax of this option, check the
  9077. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9078. @item i
  9079. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  9080. for bottom field first).
  9081. @item iskey
  9082. This is 1 if the frame is a key frame, 0 otherwise.
  9083. @item type
  9084. The picture type of the input frame ("I" for an I-frame, "P" for a
  9085. P-frame, "B" for a B-frame, or "?" for an unknown type).
  9086. Also refer to the documentation of the @code{AVPictureType} enum and of
  9087. the @code{av_get_picture_type_char} function defined in
  9088. @file{libavutil/avutil.h}.
  9089. @item checksum
  9090. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  9091. @item plane_checksum
  9092. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  9093. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  9094. @end table
  9095. @section showpalette
  9096. Displays the 256 colors palette of each frame. This filter is only relevant for
  9097. @var{pal8} pixel format frames.
  9098. It accepts the following option:
  9099. @table @option
  9100. @item s
  9101. Set the size of the box used to represent one palette color entry. Default is
  9102. @code{30} (for a @code{30x30} pixel box).
  9103. @end table
  9104. @section shuffleframes
  9105. Reorder and/or duplicate video frames.
  9106. It accepts the following parameters:
  9107. @table @option
  9108. @item mapping
  9109. Set the destination indexes of input frames.
  9110. This is space or '|' separated list of indexes that maps input frames to output
  9111. frames. Number of indexes also sets maximal value that each index may have.
  9112. @end table
  9113. The first frame has the index 0. The default is to keep the input unchanged.
  9114. Swap second and third frame of every three frames of the input:
  9115. @example
  9116. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  9117. @end example
  9118. @section shuffleplanes
  9119. Reorder and/or duplicate video planes.
  9120. It accepts the following parameters:
  9121. @table @option
  9122. @item map0
  9123. The index of the input plane to be used as the first output plane.
  9124. @item map1
  9125. The index of the input plane to be used as the second output plane.
  9126. @item map2
  9127. The index of the input plane to be used as the third output plane.
  9128. @item map3
  9129. The index of the input plane to be used as the fourth output plane.
  9130. @end table
  9131. The first plane has the index 0. The default is to keep the input unchanged.
  9132. Swap the second and third planes of the input:
  9133. @example
  9134. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  9135. @end example
  9136. @anchor{signalstats}
  9137. @section signalstats
  9138. Evaluate various visual metrics that assist in determining issues associated
  9139. with the digitization of analog video media.
  9140. By default the filter will log these metadata values:
  9141. @table @option
  9142. @item YMIN
  9143. Display the minimal Y value contained within the input frame. Expressed in
  9144. range of [0-255].
  9145. @item YLOW
  9146. Display the Y value at the 10% percentile within the input frame. Expressed in
  9147. range of [0-255].
  9148. @item YAVG
  9149. Display the average Y value within the input frame. Expressed in range of
  9150. [0-255].
  9151. @item YHIGH
  9152. Display the Y value at the 90% percentile within the input frame. Expressed in
  9153. range of [0-255].
  9154. @item YMAX
  9155. Display the maximum Y value contained within the input frame. Expressed in
  9156. range of [0-255].
  9157. @item UMIN
  9158. Display the minimal U value contained within the input frame. Expressed in
  9159. range of [0-255].
  9160. @item ULOW
  9161. Display the U value at the 10% percentile within the input frame. Expressed in
  9162. range of [0-255].
  9163. @item UAVG
  9164. Display the average U value within the input frame. Expressed in range of
  9165. [0-255].
  9166. @item UHIGH
  9167. Display the U value at the 90% percentile within the input frame. Expressed in
  9168. range of [0-255].
  9169. @item UMAX
  9170. Display the maximum U value contained within the input frame. Expressed in
  9171. range of [0-255].
  9172. @item VMIN
  9173. Display the minimal V value contained within the input frame. Expressed in
  9174. range of [0-255].
  9175. @item VLOW
  9176. Display the V value at the 10% percentile within the input frame. Expressed in
  9177. range of [0-255].
  9178. @item VAVG
  9179. Display the average V value within the input frame. Expressed in range of
  9180. [0-255].
  9181. @item VHIGH
  9182. Display the V value at the 90% percentile within the input frame. Expressed in
  9183. range of [0-255].
  9184. @item VMAX
  9185. Display the maximum V value contained within the input frame. Expressed in
  9186. range of [0-255].
  9187. @item SATMIN
  9188. Display the minimal saturation value contained within the input frame.
  9189. Expressed in range of [0-~181.02].
  9190. @item SATLOW
  9191. Display the saturation value at the 10% percentile within the input frame.
  9192. Expressed in range of [0-~181.02].
  9193. @item SATAVG
  9194. Display the average saturation value within the input frame. Expressed in range
  9195. of [0-~181.02].
  9196. @item SATHIGH
  9197. Display the saturation value at the 90% percentile within the input frame.
  9198. Expressed in range of [0-~181.02].
  9199. @item SATMAX
  9200. Display the maximum saturation value contained within the input frame.
  9201. Expressed in range of [0-~181.02].
  9202. @item HUEMED
  9203. Display the median value for hue within the input frame. Expressed in range of
  9204. [0-360].
  9205. @item HUEAVG
  9206. Display the average value for hue within the input frame. Expressed in range of
  9207. [0-360].
  9208. @item YDIF
  9209. Display the average of sample value difference between all values of the Y
  9210. plane in the current frame and corresponding values of the previous input frame.
  9211. Expressed in range of [0-255].
  9212. @item UDIF
  9213. Display the average of sample value difference between all values of the U
  9214. plane in the current frame and corresponding values of the previous input frame.
  9215. Expressed in range of [0-255].
  9216. @item VDIF
  9217. Display the average of sample value difference between all values of the V
  9218. plane in the current frame and corresponding values of the previous input frame.
  9219. Expressed in range of [0-255].
  9220. @item YBITDEPTH
  9221. Display bit depth of Y plane in current frame.
  9222. Expressed in range of [0-16].
  9223. @item UBITDEPTH
  9224. Display bit depth of U plane in current frame.
  9225. Expressed in range of [0-16].
  9226. @item VBITDEPTH
  9227. Display bit depth of V plane in current frame.
  9228. Expressed in range of [0-16].
  9229. @end table
  9230. The filter accepts the following options:
  9231. @table @option
  9232. @item stat
  9233. @item out
  9234. @option{stat} specify an additional form of image analysis.
  9235. @option{out} output video with the specified type of pixel highlighted.
  9236. Both options accept the following values:
  9237. @table @samp
  9238. @item tout
  9239. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  9240. unlike the neighboring pixels of the same field. Examples of temporal outliers
  9241. include the results of video dropouts, head clogs, or tape tracking issues.
  9242. @item vrep
  9243. Identify @var{vertical line repetition}. Vertical line repetition includes
  9244. similar rows of pixels within a frame. In born-digital video vertical line
  9245. repetition is common, but this pattern is uncommon in video digitized from an
  9246. analog source. When it occurs in video that results from the digitization of an
  9247. analog source it can indicate concealment from a dropout compensator.
  9248. @item brng
  9249. Identify pixels that fall outside of legal broadcast range.
  9250. @end table
  9251. @item color, c
  9252. Set the highlight color for the @option{out} option. The default color is
  9253. yellow.
  9254. @end table
  9255. @subsection Examples
  9256. @itemize
  9257. @item
  9258. Output data of various video metrics:
  9259. @example
  9260. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  9261. @end example
  9262. @item
  9263. Output specific data about the minimum and maximum values of the Y plane per frame:
  9264. @example
  9265. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  9266. @end example
  9267. @item
  9268. Playback video while highlighting pixels that are outside of broadcast range in red.
  9269. @example
  9270. ffplay example.mov -vf signalstats="out=brng:color=red"
  9271. @end example
  9272. @item
  9273. Playback video with signalstats metadata drawn over the frame.
  9274. @example
  9275. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  9276. @end example
  9277. The contents of signalstat_drawtext.txt used in the command are:
  9278. @example
  9279. time %@{pts:hms@}
  9280. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  9281. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  9282. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  9283. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  9284. @end example
  9285. @end itemize
  9286. @anchor{smartblur}
  9287. @section smartblur
  9288. Blur the input video without impacting the outlines.
  9289. It accepts the following options:
  9290. @table @option
  9291. @item luma_radius, lr
  9292. Set the luma radius. The option value must be a float number in
  9293. the range [0.1,5.0] that specifies the variance of the gaussian filter
  9294. used to blur the image (slower if larger). Default value is 1.0.
  9295. @item luma_strength, ls
  9296. Set the luma strength. The option value must be a float number
  9297. in the range [-1.0,1.0] that configures the blurring. A value included
  9298. in [0.0,1.0] will blur the image whereas a value included in
  9299. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  9300. @item luma_threshold, lt
  9301. Set the luma threshold used as a coefficient to determine
  9302. whether a pixel should be blurred or not. The option value must be an
  9303. integer in the range [-30,30]. A value of 0 will filter all the image,
  9304. a value included in [0,30] will filter flat areas and a value included
  9305. in [-30,0] will filter edges. Default value is 0.
  9306. @item chroma_radius, cr
  9307. Set the chroma radius. The option value must be a float number in
  9308. the range [0.1,5.0] that specifies the variance of the gaussian filter
  9309. used to blur the image (slower if larger). Default value is 1.0.
  9310. @item chroma_strength, cs
  9311. Set the chroma strength. The option value must be a float number
  9312. in the range [-1.0,1.0] that configures the blurring. A value included
  9313. in [0.0,1.0] will blur the image whereas a value included in
  9314. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  9315. @item chroma_threshold, ct
  9316. Set the chroma threshold used as a coefficient to determine
  9317. whether a pixel should be blurred or not. The option value must be an
  9318. integer in the range [-30,30]. A value of 0 will filter all the image,
  9319. a value included in [0,30] will filter flat areas and a value included
  9320. in [-30,0] will filter edges. Default value is 0.
  9321. @end table
  9322. If a chroma option is not explicitly set, the corresponding luma value
  9323. is set.
  9324. @section ssim
  9325. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  9326. This filter takes in input two input videos, the first input is
  9327. considered the "main" source and is passed unchanged to the
  9328. output. The second input is used as a "reference" video for computing
  9329. the SSIM.
  9330. Both video inputs must have the same resolution and pixel format for
  9331. this filter to work correctly. Also it assumes that both inputs
  9332. have the same number of frames, which are compared one by one.
  9333. The filter stores the calculated SSIM of each frame.
  9334. The description of the accepted parameters follows.
  9335. @table @option
  9336. @item stats_file, f
  9337. If specified the filter will use the named file to save the SSIM of
  9338. each individual frame. When filename equals "-" the data is sent to
  9339. standard output.
  9340. @end table
  9341. The file printed if @var{stats_file} is selected, contains a sequence of
  9342. key/value pairs of the form @var{key}:@var{value} for each compared
  9343. couple of frames.
  9344. A description of each shown parameter follows:
  9345. @table @option
  9346. @item n
  9347. sequential number of the input frame, starting from 1
  9348. @item Y, U, V, R, G, B
  9349. SSIM of the compared frames for the component specified by the suffix.
  9350. @item All
  9351. SSIM of the compared frames for the whole frame.
  9352. @item dB
  9353. Same as above but in dB representation.
  9354. @end table
  9355. For example:
  9356. @example
  9357. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9358. [main][ref] ssim="stats_file=stats.log" [out]
  9359. @end example
  9360. On this example the input file being processed is compared with the
  9361. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  9362. is stored in @file{stats.log}.
  9363. Another example with both psnr and ssim at same time:
  9364. @example
  9365. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  9366. @end example
  9367. @section stereo3d
  9368. Convert between different stereoscopic image formats.
  9369. The filters accept the following options:
  9370. @table @option
  9371. @item in
  9372. Set stereoscopic image format of input.
  9373. Available values for input image formats are:
  9374. @table @samp
  9375. @item sbsl
  9376. side by side parallel (left eye left, right eye right)
  9377. @item sbsr
  9378. side by side crosseye (right eye left, left eye right)
  9379. @item sbs2l
  9380. side by side parallel with half width resolution
  9381. (left eye left, right eye right)
  9382. @item sbs2r
  9383. side by side crosseye with half width resolution
  9384. (right eye left, left eye right)
  9385. @item abl
  9386. above-below (left eye above, right eye below)
  9387. @item abr
  9388. above-below (right eye above, left eye below)
  9389. @item ab2l
  9390. above-below with half height resolution
  9391. (left eye above, right eye below)
  9392. @item ab2r
  9393. above-below with half height resolution
  9394. (right eye above, left eye below)
  9395. @item al
  9396. alternating frames (left eye first, right eye second)
  9397. @item ar
  9398. alternating frames (right eye first, left eye second)
  9399. @item irl
  9400. interleaved rows (left eye has top row, right eye starts on next row)
  9401. @item irr
  9402. interleaved rows (right eye has top row, left eye starts on next row)
  9403. @item icl
  9404. interleaved columns, left eye first
  9405. @item icr
  9406. interleaved columns, right eye first
  9407. Default value is @samp{sbsl}.
  9408. @end table
  9409. @item out
  9410. Set stereoscopic image format of output.
  9411. @table @samp
  9412. @item sbsl
  9413. side by side parallel (left eye left, right eye right)
  9414. @item sbsr
  9415. side by side crosseye (right eye left, left eye right)
  9416. @item sbs2l
  9417. side by side parallel with half width resolution
  9418. (left eye left, right eye right)
  9419. @item sbs2r
  9420. side by side crosseye with half width resolution
  9421. (right eye left, left eye right)
  9422. @item abl
  9423. above-below (left eye above, right eye below)
  9424. @item abr
  9425. above-below (right eye above, left eye below)
  9426. @item ab2l
  9427. above-below with half height resolution
  9428. (left eye above, right eye below)
  9429. @item ab2r
  9430. above-below with half height resolution
  9431. (right eye above, left eye below)
  9432. @item al
  9433. alternating frames (left eye first, right eye second)
  9434. @item ar
  9435. alternating frames (right eye first, left eye second)
  9436. @item irl
  9437. interleaved rows (left eye has top row, right eye starts on next row)
  9438. @item irr
  9439. interleaved rows (right eye has top row, left eye starts on next row)
  9440. @item arbg
  9441. anaglyph red/blue gray
  9442. (red filter on left eye, blue filter on right eye)
  9443. @item argg
  9444. anaglyph red/green gray
  9445. (red filter on left eye, green filter on right eye)
  9446. @item arcg
  9447. anaglyph red/cyan gray
  9448. (red filter on left eye, cyan filter on right eye)
  9449. @item arch
  9450. anaglyph red/cyan half colored
  9451. (red filter on left eye, cyan filter on right eye)
  9452. @item arcc
  9453. anaglyph red/cyan color
  9454. (red filter on left eye, cyan filter on right eye)
  9455. @item arcd
  9456. anaglyph red/cyan color optimized with the least squares projection of dubois
  9457. (red filter on left eye, cyan filter on right eye)
  9458. @item agmg
  9459. anaglyph green/magenta gray
  9460. (green filter on left eye, magenta filter on right eye)
  9461. @item agmh
  9462. anaglyph green/magenta half colored
  9463. (green filter on left eye, magenta filter on right eye)
  9464. @item agmc
  9465. anaglyph green/magenta colored
  9466. (green filter on left eye, magenta filter on right eye)
  9467. @item agmd
  9468. anaglyph green/magenta color optimized with the least squares projection of dubois
  9469. (green filter on left eye, magenta filter on right eye)
  9470. @item aybg
  9471. anaglyph yellow/blue gray
  9472. (yellow filter on left eye, blue filter on right eye)
  9473. @item aybh
  9474. anaglyph yellow/blue half colored
  9475. (yellow filter on left eye, blue filter on right eye)
  9476. @item aybc
  9477. anaglyph yellow/blue colored
  9478. (yellow filter on left eye, blue filter on right eye)
  9479. @item aybd
  9480. anaglyph yellow/blue color optimized with the least squares projection of dubois
  9481. (yellow filter on left eye, blue filter on right eye)
  9482. @item ml
  9483. mono output (left eye only)
  9484. @item mr
  9485. mono output (right eye only)
  9486. @item chl
  9487. checkerboard, left eye first
  9488. @item chr
  9489. checkerboard, right eye first
  9490. @item icl
  9491. interleaved columns, left eye first
  9492. @item icr
  9493. interleaved columns, right eye first
  9494. @item hdmi
  9495. HDMI frame pack
  9496. @end table
  9497. Default value is @samp{arcd}.
  9498. @end table
  9499. @subsection Examples
  9500. @itemize
  9501. @item
  9502. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  9503. @example
  9504. stereo3d=sbsl:aybd
  9505. @end example
  9506. @item
  9507. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  9508. @example
  9509. stereo3d=abl:sbsr
  9510. @end example
  9511. @end itemize
  9512. @section streamselect, astreamselect
  9513. Select video or audio streams.
  9514. The filter accepts the following options:
  9515. @table @option
  9516. @item inputs
  9517. Set number of inputs. Default is 2.
  9518. @item map
  9519. Set input indexes to remap to outputs.
  9520. @end table
  9521. @subsection Commands
  9522. The @code{streamselect} and @code{astreamselect} filter supports the following
  9523. commands:
  9524. @table @option
  9525. @item map
  9526. Set input indexes to remap to outputs.
  9527. @end table
  9528. @subsection Examples
  9529. @itemize
  9530. @item
  9531. Select first 5 seconds 1st stream and rest of time 2nd stream:
  9532. @example
  9533. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  9534. @end example
  9535. @item
  9536. Same as above, but for audio:
  9537. @example
  9538. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  9539. @end example
  9540. @end itemize
  9541. @anchor{spp}
  9542. @section spp
  9543. Apply a simple postprocessing filter that compresses and decompresses the image
  9544. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  9545. and average the results.
  9546. The filter accepts the following options:
  9547. @table @option
  9548. @item quality
  9549. Set quality. This option defines the number of levels for averaging. It accepts
  9550. an integer in the range 0-6. If set to @code{0}, the filter will have no
  9551. effect. A value of @code{6} means the higher quality. For each increment of
  9552. that value the speed drops by a factor of approximately 2. Default value is
  9553. @code{3}.
  9554. @item qp
  9555. Force a constant quantization parameter. If not set, the filter will use the QP
  9556. from the video stream (if available).
  9557. @item mode
  9558. Set thresholding mode. Available modes are:
  9559. @table @samp
  9560. @item hard
  9561. Set hard thresholding (default).
  9562. @item soft
  9563. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9564. @end table
  9565. @item use_bframe_qp
  9566. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  9567. option may cause flicker since the B-Frames have often larger QP. Default is
  9568. @code{0} (not enabled).
  9569. @end table
  9570. @anchor{subtitles}
  9571. @section subtitles
  9572. Draw subtitles on top of input video using the libass library.
  9573. To enable compilation of this filter you need to configure FFmpeg with
  9574. @code{--enable-libass}. This filter also requires a build with libavcodec and
  9575. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  9576. Alpha) subtitles format.
  9577. The filter accepts the following options:
  9578. @table @option
  9579. @item filename, f
  9580. Set the filename of the subtitle file to read. It must be specified.
  9581. @item original_size
  9582. Specify the size of the original video, the video for which the ASS file
  9583. was composed. For the syntax of this option, check the
  9584. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9585. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  9586. correctly scale the fonts if the aspect ratio has been changed.
  9587. @item fontsdir
  9588. Set a directory path containing fonts that can be used by the filter.
  9589. These fonts will be used in addition to whatever the font provider uses.
  9590. @item charenc
  9591. Set subtitles input character encoding. @code{subtitles} filter only. Only
  9592. useful if not UTF-8.
  9593. @item stream_index, si
  9594. Set subtitles stream index. @code{subtitles} filter only.
  9595. @item force_style
  9596. Override default style or script info parameters of the subtitles. It accepts a
  9597. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  9598. @end table
  9599. If the first key is not specified, it is assumed that the first value
  9600. specifies the @option{filename}.
  9601. For example, to render the file @file{sub.srt} on top of the input
  9602. video, use the command:
  9603. @example
  9604. subtitles=sub.srt
  9605. @end example
  9606. which is equivalent to:
  9607. @example
  9608. subtitles=filename=sub.srt
  9609. @end example
  9610. To render the default subtitles stream from file @file{video.mkv}, use:
  9611. @example
  9612. subtitles=video.mkv
  9613. @end example
  9614. To render the second subtitles stream from that file, use:
  9615. @example
  9616. subtitles=video.mkv:si=1
  9617. @end example
  9618. To make the subtitles stream from @file{sub.srt} appear in transparent green
  9619. @code{DejaVu Serif}, use:
  9620. @example
  9621. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  9622. @end example
  9623. @section super2xsai
  9624. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  9625. Interpolate) pixel art scaling algorithm.
  9626. Useful for enlarging pixel art images without reducing sharpness.
  9627. @section swaprect
  9628. Swap two rectangular objects in video.
  9629. This filter accepts the following options:
  9630. @table @option
  9631. @item w
  9632. Set object width.
  9633. @item h
  9634. Set object height.
  9635. @item x1
  9636. Set 1st rect x coordinate.
  9637. @item y1
  9638. Set 1st rect y coordinate.
  9639. @item x2
  9640. Set 2nd rect x coordinate.
  9641. @item y2
  9642. Set 2nd rect y coordinate.
  9643. All expressions are evaluated once for each frame.
  9644. @end table
  9645. The all options are expressions containing the following constants:
  9646. @table @option
  9647. @item w
  9648. @item h
  9649. The input width and height.
  9650. @item a
  9651. same as @var{w} / @var{h}
  9652. @item sar
  9653. input sample aspect ratio
  9654. @item dar
  9655. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  9656. @item n
  9657. The number of the input frame, starting from 0.
  9658. @item t
  9659. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  9660. @item pos
  9661. the position in the file of the input frame, NAN if unknown
  9662. @end table
  9663. @section swapuv
  9664. Swap U & V plane.
  9665. @section telecine
  9666. Apply telecine process to the video.
  9667. This filter accepts the following options:
  9668. @table @option
  9669. @item first_field
  9670. @table @samp
  9671. @item top, t
  9672. top field first
  9673. @item bottom, b
  9674. bottom field first
  9675. The default value is @code{top}.
  9676. @end table
  9677. @item pattern
  9678. A string of numbers representing the pulldown pattern you wish to apply.
  9679. The default value is @code{23}.
  9680. @end table
  9681. @example
  9682. Some typical patterns:
  9683. NTSC output (30i):
  9684. 27.5p: 32222
  9685. 24p: 23 (classic)
  9686. 24p: 2332 (preferred)
  9687. 20p: 33
  9688. 18p: 334
  9689. 16p: 3444
  9690. PAL output (25i):
  9691. 27.5p: 12222
  9692. 24p: 222222222223 ("Euro pulldown")
  9693. 16.67p: 33
  9694. 16p: 33333334
  9695. @end example
  9696. @section thumbnail
  9697. Select the most representative frame in a given sequence of consecutive frames.
  9698. The filter accepts the following options:
  9699. @table @option
  9700. @item n
  9701. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  9702. will pick one of them, and then handle the next batch of @var{n} frames until
  9703. the end. Default is @code{100}.
  9704. @end table
  9705. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  9706. value will result in a higher memory usage, so a high value is not recommended.
  9707. @subsection Examples
  9708. @itemize
  9709. @item
  9710. Extract one picture each 50 frames:
  9711. @example
  9712. thumbnail=50
  9713. @end example
  9714. @item
  9715. Complete example of a thumbnail creation with @command{ffmpeg}:
  9716. @example
  9717. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  9718. @end example
  9719. @end itemize
  9720. @section tile
  9721. Tile several successive frames together.
  9722. The filter accepts the following options:
  9723. @table @option
  9724. @item layout
  9725. Set the grid size (i.e. the number of lines and columns). For the syntax of
  9726. this option, check the
  9727. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9728. @item nb_frames
  9729. Set the maximum number of frames to render in the given area. It must be less
  9730. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  9731. the area will be used.
  9732. @item margin
  9733. Set the outer border margin in pixels.
  9734. @item padding
  9735. Set the inner border thickness (i.e. the number of pixels between frames). For
  9736. more advanced padding options (such as having different values for the edges),
  9737. refer to the pad video filter.
  9738. @item color
  9739. Specify the color of the unused area. For the syntax of this option, check the
  9740. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  9741. is "black".
  9742. @end table
  9743. @subsection Examples
  9744. @itemize
  9745. @item
  9746. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  9747. @example
  9748. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  9749. @end example
  9750. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  9751. duplicating each output frame to accommodate the originally detected frame
  9752. rate.
  9753. @item
  9754. Display @code{5} pictures in an area of @code{3x2} frames,
  9755. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  9756. mixed flat and named options:
  9757. @example
  9758. tile=3x2:nb_frames=5:padding=7:margin=2
  9759. @end example
  9760. @end itemize
  9761. @section tinterlace
  9762. Perform various types of temporal field interlacing.
  9763. Frames are counted starting from 1, so the first input frame is
  9764. considered odd.
  9765. The filter accepts the following options:
  9766. @table @option
  9767. @item mode
  9768. Specify the mode of the interlacing. This option can also be specified
  9769. as a value alone. See below for a list of values for this option.
  9770. Available values are:
  9771. @table @samp
  9772. @item merge, 0
  9773. Move odd frames into the upper field, even into the lower field,
  9774. generating a double height frame at half frame rate.
  9775. @example
  9776. ------> time
  9777. Input:
  9778. Frame 1 Frame 2 Frame 3 Frame 4
  9779. 11111 22222 33333 44444
  9780. 11111 22222 33333 44444
  9781. 11111 22222 33333 44444
  9782. 11111 22222 33333 44444
  9783. Output:
  9784. 11111 33333
  9785. 22222 44444
  9786. 11111 33333
  9787. 22222 44444
  9788. 11111 33333
  9789. 22222 44444
  9790. 11111 33333
  9791. 22222 44444
  9792. @end example
  9793. @item drop_even, 1
  9794. Only output odd frames, even frames are dropped, generating a frame with
  9795. unchanged height at half frame rate.
  9796. @example
  9797. ------> time
  9798. Input:
  9799. Frame 1 Frame 2 Frame 3 Frame 4
  9800. 11111 22222 33333 44444
  9801. 11111 22222 33333 44444
  9802. 11111 22222 33333 44444
  9803. 11111 22222 33333 44444
  9804. Output:
  9805. 11111 33333
  9806. 11111 33333
  9807. 11111 33333
  9808. 11111 33333
  9809. @end example
  9810. @item drop_odd, 2
  9811. Only output even frames, odd frames are dropped, generating a frame with
  9812. unchanged height at half frame rate.
  9813. @example
  9814. ------> time
  9815. Input:
  9816. Frame 1 Frame 2 Frame 3 Frame 4
  9817. 11111 22222 33333 44444
  9818. 11111 22222 33333 44444
  9819. 11111 22222 33333 44444
  9820. 11111 22222 33333 44444
  9821. Output:
  9822. 22222 44444
  9823. 22222 44444
  9824. 22222 44444
  9825. 22222 44444
  9826. @end example
  9827. @item pad, 3
  9828. Expand each frame to full height, but pad alternate lines with black,
  9829. generating a frame with double height at the same input frame rate.
  9830. @example
  9831. ------> time
  9832. Input:
  9833. Frame 1 Frame 2 Frame 3 Frame 4
  9834. 11111 22222 33333 44444
  9835. 11111 22222 33333 44444
  9836. 11111 22222 33333 44444
  9837. 11111 22222 33333 44444
  9838. Output:
  9839. 11111 ..... 33333 .....
  9840. ..... 22222 ..... 44444
  9841. 11111 ..... 33333 .....
  9842. ..... 22222 ..... 44444
  9843. 11111 ..... 33333 .....
  9844. ..... 22222 ..... 44444
  9845. 11111 ..... 33333 .....
  9846. ..... 22222 ..... 44444
  9847. @end example
  9848. @item interleave_top, 4
  9849. Interleave the upper field from odd frames with the lower field from
  9850. even frames, generating a frame with unchanged height at half frame rate.
  9851. @example
  9852. ------> time
  9853. Input:
  9854. Frame 1 Frame 2 Frame 3 Frame 4
  9855. 11111<- 22222 33333<- 44444
  9856. 11111 22222<- 33333 44444<-
  9857. 11111<- 22222 33333<- 44444
  9858. 11111 22222<- 33333 44444<-
  9859. Output:
  9860. 11111 33333
  9861. 22222 44444
  9862. 11111 33333
  9863. 22222 44444
  9864. @end example
  9865. @item interleave_bottom, 5
  9866. Interleave the lower field from odd frames with the upper field from
  9867. even frames, generating a frame with unchanged height at half frame rate.
  9868. @example
  9869. ------> time
  9870. Input:
  9871. Frame 1 Frame 2 Frame 3 Frame 4
  9872. 11111 22222<- 33333 44444<-
  9873. 11111<- 22222 33333<- 44444
  9874. 11111 22222<- 33333 44444<-
  9875. 11111<- 22222 33333<- 44444
  9876. Output:
  9877. 22222 44444
  9878. 11111 33333
  9879. 22222 44444
  9880. 11111 33333
  9881. @end example
  9882. @item interlacex2, 6
  9883. Double frame rate with unchanged height. Frames are inserted each
  9884. containing the second temporal field from the previous input frame and
  9885. the first temporal field from the next input frame. This mode relies on
  9886. the top_field_first flag. Useful for interlaced video displays with no
  9887. field synchronisation.
  9888. @example
  9889. ------> time
  9890. Input:
  9891. Frame 1 Frame 2 Frame 3 Frame 4
  9892. 11111 22222 33333 44444
  9893. 11111 22222 33333 44444
  9894. 11111 22222 33333 44444
  9895. 11111 22222 33333 44444
  9896. Output:
  9897. 11111 22222 22222 33333 33333 44444 44444
  9898. 11111 11111 22222 22222 33333 33333 44444
  9899. 11111 22222 22222 33333 33333 44444 44444
  9900. 11111 11111 22222 22222 33333 33333 44444
  9901. @end example
  9902. @item mergex2, 7
  9903. Move odd frames into the upper field, even into the lower field,
  9904. generating a double height frame at same frame rate.
  9905. @example
  9906. ------> time
  9907. Input:
  9908. Frame 1 Frame 2 Frame 3 Frame 4
  9909. 11111 22222 33333 44444
  9910. 11111 22222 33333 44444
  9911. 11111 22222 33333 44444
  9912. 11111 22222 33333 44444
  9913. Output:
  9914. 11111 33333 33333 55555
  9915. 22222 22222 44444 44444
  9916. 11111 33333 33333 55555
  9917. 22222 22222 44444 44444
  9918. 11111 33333 33333 55555
  9919. 22222 22222 44444 44444
  9920. 11111 33333 33333 55555
  9921. 22222 22222 44444 44444
  9922. @end example
  9923. @end table
  9924. Numeric values are deprecated but are accepted for backward
  9925. compatibility reasons.
  9926. Default mode is @code{merge}.
  9927. @item flags
  9928. Specify flags influencing the filter process.
  9929. Available value for @var{flags} is:
  9930. @table @option
  9931. @item low_pass_filter, vlfp
  9932. Enable vertical low-pass filtering in the filter.
  9933. Vertical low-pass filtering is required when creating an interlaced
  9934. destination from a progressive source which contains high-frequency
  9935. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  9936. patterning.
  9937. Vertical low-pass filtering can only be enabled for @option{mode}
  9938. @var{interleave_top} and @var{interleave_bottom}.
  9939. @end table
  9940. @end table
  9941. @section transpose
  9942. Transpose rows with columns in the input video and optionally flip it.
  9943. It accepts the following parameters:
  9944. @table @option
  9945. @item dir
  9946. Specify the transposition direction.
  9947. Can assume the following values:
  9948. @table @samp
  9949. @item 0, 4, cclock_flip
  9950. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  9951. @example
  9952. L.R L.l
  9953. . . -> . .
  9954. l.r R.r
  9955. @end example
  9956. @item 1, 5, clock
  9957. Rotate by 90 degrees clockwise, that is:
  9958. @example
  9959. L.R l.L
  9960. . . -> . .
  9961. l.r r.R
  9962. @end example
  9963. @item 2, 6, cclock
  9964. Rotate by 90 degrees counterclockwise, that is:
  9965. @example
  9966. L.R R.r
  9967. . . -> . .
  9968. l.r L.l
  9969. @end example
  9970. @item 3, 7, clock_flip
  9971. Rotate by 90 degrees clockwise and vertically flip, that is:
  9972. @example
  9973. L.R r.R
  9974. . . -> . .
  9975. l.r l.L
  9976. @end example
  9977. @end table
  9978. For values between 4-7, the transposition is only done if the input
  9979. video geometry is portrait and not landscape. These values are
  9980. deprecated, the @code{passthrough} option should be used instead.
  9981. Numerical values are deprecated, and should be dropped in favor of
  9982. symbolic constants.
  9983. @item passthrough
  9984. Do not apply the transposition if the input geometry matches the one
  9985. specified by the specified value. It accepts the following values:
  9986. @table @samp
  9987. @item none
  9988. Always apply transposition.
  9989. @item portrait
  9990. Preserve portrait geometry (when @var{height} >= @var{width}).
  9991. @item landscape
  9992. Preserve landscape geometry (when @var{width} >= @var{height}).
  9993. @end table
  9994. Default value is @code{none}.
  9995. @end table
  9996. For example to rotate by 90 degrees clockwise and preserve portrait
  9997. layout:
  9998. @example
  9999. transpose=dir=1:passthrough=portrait
  10000. @end example
  10001. The command above can also be specified as:
  10002. @example
  10003. transpose=1:portrait
  10004. @end example
  10005. @section trim
  10006. Trim the input so that the output contains one continuous subpart of the input.
  10007. It accepts the following parameters:
  10008. @table @option
  10009. @item start
  10010. Specify the time of the start of the kept section, i.e. the frame with the
  10011. timestamp @var{start} will be the first frame in the output.
  10012. @item end
  10013. Specify the time of the first frame that will be dropped, i.e. the frame
  10014. immediately preceding the one with the timestamp @var{end} will be the last
  10015. frame in the output.
  10016. @item start_pts
  10017. This is the same as @var{start}, except this option sets the start timestamp
  10018. in timebase units instead of seconds.
  10019. @item end_pts
  10020. This is the same as @var{end}, except this option sets the end timestamp
  10021. in timebase units instead of seconds.
  10022. @item duration
  10023. The maximum duration of the output in seconds.
  10024. @item start_frame
  10025. The number of the first frame that should be passed to the output.
  10026. @item end_frame
  10027. The number of the first frame that should be dropped.
  10028. @end table
  10029. @option{start}, @option{end}, and @option{duration} are expressed as time
  10030. duration specifications; see
  10031. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  10032. for the accepted syntax.
  10033. Note that the first two sets of the start/end options and the @option{duration}
  10034. option look at the frame timestamp, while the _frame variants simply count the
  10035. frames that pass through the filter. Also note that this filter does not modify
  10036. the timestamps. If you wish for the output timestamps to start at zero, insert a
  10037. setpts filter after the trim filter.
  10038. If multiple start or end options are set, this filter tries to be greedy and
  10039. keep all the frames that match at least one of the specified constraints. To keep
  10040. only the part that matches all the constraints at once, chain multiple trim
  10041. filters.
  10042. The defaults are such that all the input is kept. So it is possible to set e.g.
  10043. just the end values to keep everything before the specified time.
  10044. Examples:
  10045. @itemize
  10046. @item
  10047. Drop everything except the second minute of input:
  10048. @example
  10049. ffmpeg -i INPUT -vf trim=60:120
  10050. @end example
  10051. @item
  10052. Keep only the first second:
  10053. @example
  10054. ffmpeg -i INPUT -vf trim=duration=1
  10055. @end example
  10056. @end itemize
  10057. @anchor{unsharp}
  10058. @section unsharp
  10059. Sharpen or blur the input video.
  10060. It accepts the following parameters:
  10061. @table @option
  10062. @item luma_msize_x, lx
  10063. Set the luma matrix horizontal size. It must be an odd integer between
  10064. 3 and 63. The default value is 5.
  10065. @item luma_msize_y, ly
  10066. Set the luma matrix vertical size. It must be an odd integer between 3
  10067. and 63. The default value is 5.
  10068. @item luma_amount, la
  10069. Set the luma effect strength. It must be a floating point number, reasonable
  10070. values lay between -1.5 and 1.5.
  10071. Negative values will blur the input video, while positive values will
  10072. sharpen it, a value of zero will disable the effect.
  10073. Default value is 1.0.
  10074. @item chroma_msize_x, cx
  10075. Set the chroma matrix horizontal size. It must be an odd integer
  10076. between 3 and 63. The default value is 5.
  10077. @item chroma_msize_y, cy
  10078. Set the chroma matrix vertical size. It must be an odd integer
  10079. between 3 and 63. The default value is 5.
  10080. @item chroma_amount, ca
  10081. Set the chroma effect strength. It must be a floating point number, reasonable
  10082. values lay between -1.5 and 1.5.
  10083. Negative values will blur the input video, while positive values will
  10084. sharpen it, a value of zero will disable the effect.
  10085. Default value is 0.0.
  10086. @item opencl
  10087. If set to 1, specify using OpenCL capabilities, only available if
  10088. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  10089. @end table
  10090. All parameters are optional and default to the equivalent of the
  10091. string '5:5:1.0:5:5:0.0'.
  10092. @subsection Examples
  10093. @itemize
  10094. @item
  10095. Apply strong luma sharpen effect:
  10096. @example
  10097. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  10098. @end example
  10099. @item
  10100. Apply a strong blur of both luma and chroma parameters:
  10101. @example
  10102. unsharp=7:7:-2:7:7:-2
  10103. @end example
  10104. @end itemize
  10105. @section uspp
  10106. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  10107. the image at several (or - in the case of @option{quality} level @code{8} - all)
  10108. shifts and average the results.
  10109. The way this differs from the behavior of spp is that uspp actually encodes &
  10110. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  10111. DCT similar to MJPEG.
  10112. The filter accepts the following options:
  10113. @table @option
  10114. @item quality
  10115. Set quality. This option defines the number of levels for averaging. It accepts
  10116. an integer in the range 0-8. If set to @code{0}, the filter will have no
  10117. effect. A value of @code{8} means the higher quality. For each increment of
  10118. that value the speed drops by a factor of approximately 2. Default value is
  10119. @code{3}.
  10120. @item qp
  10121. Force a constant quantization parameter. If not set, the filter will use the QP
  10122. from the video stream (if available).
  10123. @end table
  10124. @section vectorscope
  10125. Display 2 color component values in the two dimensional graph (which is called
  10126. a vectorscope).
  10127. This filter accepts the following options:
  10128. @table @option
  10129. @item mode, m
  10130. Set vectorscope mode.
  10131. It accepts the following values:
  10132. @table @samp
  10133. @item gray
  10134. Gray values are displayed on graph, higher brightness means more pixels have
  10135. same component color value on location in graph. This is the default mode.
  10136. @item color
  10137. Gray values are displayed on graph. Surrounding pixels values which are not
  10138. present in video frame are drawn in gradient of 2 color components which are
  10139. set by option @code{x} and @code{y}. The 3rd color component is static.
  10140. @item color2
  10141. Actual color components values present in video frame are displayed on graph.
  10142. @item color3
  10143. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  10144. on graph increases value of another color component, which is luminance by
  10145. default values of @code{x} and @code{y}.
  10146. @item color4
  10147. Actual colors present in video frame are displayed on graph. If two different
  10148. colors map to same position on graph then color with higher value of component
  10149. not present in graph is picked.
  10150. @item color5
  10151. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  10152. component picked from radial gradient.
  10153. @end table
  10154. @item x
  10155. Set which color component will be represented on X-axis. Default is @code{1}.
  10156. @item y
  10157. Set which color component will be represented on Y-axis. Default is @code{2}.
  10158. @item intensity, i
  10159. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  10160. of color component which represents frequency of (X, Y) location in graph.
  10161. @item envelope, e
  10162. @table @samp
  10163. @item none
  10164. No envelope, this is default.
  10165. @item instant
  10166. Instant envelope, even darkest single pixel will be clearly highlighted.
  10167. @item peak
  10168. Hold maximum and minimum values presented in graph over time. This way you
  10169. can still spot out of range values without constantly looking at vectorscope.
  10170. @item peak+instant
  10171. Peak and instant envelope combined together.
  10172. @end table
  10173. @item graticule, g
  10174. Set what kind of graticule to draw.
  10175. @table @samp
  10176. @item none
  10177. @item green
  10178. @item color
  10179. @end table
  10180. @item opacity, o
  10181. Set graticule opacity.
  10182. @item flags, f
  10183. Set graticule flags.
  10184. @table @samp
  10185. @item white
  10186. Draw graticule for white point.
  10187. @item black
  10188. Draw graticule for black point.
  10189. @item name
  10190. Draw color points short names.
  10191. @end table
  10192. @item bgopacity, b
  10193. Set background opacity.
  10194. @item lthreshold, l
  10195. Set low threshold for color component not represented on X or Y axis.
  10196. Values lower than this value will be ignored. Default is 0.
  10197. Note this value is multiplied with actual max possible value one pixel component
  10198. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  10199. is 0.1 * 255 = 25.
  10200. @item hthreshold, h
  10201. Set high threshold for color component not represented on X or Y axis.
  10202. Values higher than this value will be ignored. Default is 1.
  10203. Note this value is multiplied with actual max possible value one pixel component
  10204. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  10205. is 0.9 * 255 = 230.
  10206. @item colorspace, c
  10207. Set what kind of colorspace to use when drawing graticule.
  10208. @table @samp
  10209. @item auto
  10210. @item 601
  10211. @item 709
  10212. @end table
  10213. Default is auto.
  10214. @end table
  10215. @anchor{vidstabdetect}
  10216. @section vidstabdetect
  10217. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  10218. @ref{vidstabtransform} for pass 2.
  10219. This filter generates a file with relative translation and rotation
  10220. transform information about subsequent frames, which is then used by
  10221. the @ref{vidstabtransform} filter.
  10222. To enable compilation of this filter you need to configure FFmpeg with
  10223. @code{--enable-libvidstab}.
  10224. This filter accepts the following options:
  10225. @table @option
  10226. @item result
  10227. Set the path to the file used to write the transforms information.
  10228. Default value is @file{transforms.trf}.
  10229. @item shakiness
  10230. Set how shaky the video is and how quick the camera is. It accepts an
  10231. integer in the range 1-10, a value of 1 means little shakiness, a
  10232. value of 10 means strong shakiness. Default value is 5.
  10233. @item accuracy
  10234. Set the accuracy of the detection process. It must be a value in the
  10235. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  10236. accuracy. Default value is 15.
  10237. @item stepsize
  10238. Set stepsize of the search process. The region around minimum is
  10239. scanned with 1 pixel resolution. Default value is 6.
  10240. @item mincontrast
  10241. Set minimum contrast. Below this value a local measurement field is
  10242. discarded. Must be a floating point value in the range 0-1. Default
  10243. value is 0.3.
  10244. @item tripod
  10245. Set reference frame number for tripod mode.
  10246. If enabled, the motion of the frames is compared to a reference frame
  10247. in the filtered stream, identified by the specified number. The idea
  10248. is to compensate all movements in a more-or-less static scene and keep
  10249. the camera view absolutely still.
  10250. If set to 0, it is disabled. The frames are counted starting from 1.
  10251. @item show
  10252. Show fields and transforms in the resulting frames. It accepts an
  10253. integer in the range 0-2. Default value is 0, which disables any
  10254. visualization.
  10255. @end table
  10256. @subsection Examples
  10257. @itemize
  10258. @item
  10259. Use default values:
  10260. @example
  10261. vidstabdetect
  10262. @end example
  10263. @item
  10264. Analyze strongly shaky movie and put the results in file
  10265. @file{mytransforms.trf}:
  10266. @example
  10267. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  10268. @end example
  10269. @item
  10270. Visualize the result of internal transformations in the resulting
  10271. video:
  10272. @example
  10273. vidstabdetect=show=1
  10274. @end example
  10275. @item
  10276. Analyze a video with medium shakiness using @command{ffmpeg}:
  10277. @example
  10278. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  10279. @end example
  10280. @end itemize
  10281. @anchor{vidstabtransform}
  10282. @section vidstabtransform
  10283. Video stabilization/deshaking: pass 2 of 2,
  10284. see @ref{vidstabdetect} for pass 1.
  10285. Read a file with transform information for each frame and
  10286. apply/compensate them. Together with the @ref{vidstabdetect}
  10287. filter this can be used to deshake videos. See also
  10288. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  10289. the @ref{unsharp} filter, see below.
  10290. To enable compilation of this filter you need to configure FFmpeg with
  10291. @code{--enable-libvidstab}.
  10292. @subsection Options
  10293. @table @option
  10294. @item input
  10295. Set path to the file used to read the transforms. Default value is
  10296. @file{transforms.trf}.
  10297. @item smoothing
  10298. Set the number of frames (value*2 + 1) used for lowpass filtering the
  10299. camera movements. Default value is 10.
  10300. For example a number of 10 means that 21 frames are used (10 in the
  10301. past and 10 in the future) to smoothen the motion in the video. A
  10302. larger value leads to a smoother video, but limits the acceleration of
  10303. the camera (pan/tilt movements). 0 is a special case where a static
  10304. camera is simulated.
  10305. @item optalgo
  10306. Set the camera path optimization algorithm.
  10307. Accepted values are:
  10308. @table @samp
  10309. @item gauss
  10310. gaussian kernel low-pass filter on camera motion (default)
  10311. @item avg
  10312. averaging on transformations
  10313. @end table
  10314. @item maxshift
  10315. Set maximal number of pixels to translate frames. Default value is -1,
  10316. meaning no limit.
  10317. @item maxangle
  10318. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  10319. value is -1, meaning no limit.
  10320. @item crop
  10321. Specify how to deal with borders that may be visible due to movement
  10322. compensation.
  10323. Available values are:
  10324. @table @samp
  10325. @item keep
  10326. keep image information from previous frame (default)
  10327. @item black
  10328. fill the border black
  10329. @end table
  10330. @item invert
  10331. Invert transforms if set to 1. Default value is 0.
  10332. @item relative
  10333. Consider transforms as relative to previous frame if set to 1,
  10334. absolute if set to 0. Default value is 0.
  10335. @item zoom
  10336. Set percentage to zoom. A positive value will result in a zoom-in
  10337. effect, a negative value in a zoom-out effect. Default value is 0 (no
  10338. zoom).
  10339. @item optzoom
  10340. Set optimal zooming to avoid borders.
  10341. Accepted values are:
  10342. @table @samp
  10343. @item 0
  10344. disabled
  10345. @item 1
  10346. optimal static zoom value is determined (only very strong movements
  10347. will lead to visible borders) (default)
  10348. @item 2
  10349. optimal adaptive zoom value is determined (no borders will be
  10350. visible), see @option{zoomspeed}
  10351. @end table
  10352. Note that the value given at zoom is added to the one calculated here.
  10353. @item zoomspeed
  10354. Set percent to zoom maximally each frame (enabled when
  10355. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  10356. 0.25.
  10357. @item interpol
  10358. Specify type of interpolation.
  10359. Available values are:
  10360. @table @samp
  10361. @item no
  10362. no interpolation
  10363. @item linear
  10364. linear only horizontal
  10365. @item bilinear
  10366. linear in both directions (default)
  10367. @item bicubic
  10368. cubic in both directions (slow)
  10369. @end table
  10370. @item tripod
  10371. Enable virtual tripod mode if set to 1, which is equivalent to
  10372. @code{relative=0:smoothing=0}. Default value is 0.
  10373. Use also @code{tripod} option of @ref{vidstabdetect}.
  10374. @item debug
  10375. Increase log verbosity if set to 1. Also the detected global motions
  10376. are written to the temporary file @file{global_motions.trf}. Default
  10377. value is 0.
  10378. @end table
  10379. @subsection Examples
  10380. @itemize
  10381. @item
  10382. Use @command{ffmpeg} for a typical stabilization with default values:
  10383. @example
  10384. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  10385. @end example
  10386. Note the use of the @ref{unsharp} filter which is always recommended.
  10387. @item
  10388. Zoom in a bit more and load transform data from a given file:
  10389. @example
  10390. vidstabtransform=zoom=5:input="mytransforms.trf"
  10391. @end example
  10392. @item
  10393. Smoothen the video even more:
  10394. @example
  10395. vidstabtransform=smoothing=30
  10396. @end example
  10397. @end itemize
  10398. @section vflip
  10399. Flip the input video vertically.
  10400. For example, to vertically flip a video with @command{ffmpeg}:
  10401. @example
  10402. ffmpeg -i in.avi -vf "vflip" out.avi
  10403. @end example
  10404. @anchor{vignette}
  10405. @section vignette
  10406. Make or reverse a natural vignetting effect.
  10407. The filter accepts the following options:
  10408. @table @option
  10409. @item angle, a
  10410. Set lens angle expression as a number of radians.
  10411. The value is clipped in the @code{[0,PI/2]} range.
  10412. Default value: @code{"PI/5"}
  10413. @item x0
  10414. @item y0
  10415. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  10416. by default.
  10417. @item mode
  10418. Set forward/backward mode.
  10419. Available modes are:
  10420. @table @samp
  10421. @item forward
  10422. The larger the distance from the central point, the darker the image becomes.
  10423. @item backward
  10424. The larger the distance from the central point, the brighter the image becomes.
  10425. This can be used to reverse a vignette effect, though there is no automatic
  10426. detection to extract the lens @option{angle} and other settings (yet). It can
  10427. also be used to create a burning effect.
  10428. @end table
  10429. Default value is @samp{forward}.
  10430. @item eval
  10431. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  10432. It accepts the following values:
  10433. @table @samp
  10434. @item init
  10435. Evaluate expressions only once during the filter initialization.
  10436. @item frame
  10437. Evaluate expressions for each incoming frame. This is way slower than the
  10438. @samp{init} mode since it requires all the scalers to be re-computed, but it
  10439. allows advanced dynamic expressions.
  10440. @end table
  10441. Default value is @samp{init}.
  10442. @item dither
  10443. Set dithering to reduce the circular banding effects. Default is @code{1}
  10444. (enabled).
  10445. @item aspect
  10446. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  10447. Setting this value to the SAR of the input will make a rectangular vignetting
  10448. following the dimensions of the video.
  10449. Default is @code{1/1}.
  10450. @end table
  10451. @subsection Expressions
  10452. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  10453. following parameters.
  10454. @table @option
  10455. @item w
  10456. @item h
  10457. input width and height
  10458. @item n
  10459. the number of input frame, starting from 0
  10460. @item pts
  10461. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  10462. @var{TB} units, NAN if undefined
  10463. @item r
  10464. frame rate of the input video, NAN if the input frame rate is unknown
  10465. @item t
  10466. the PTS (Presentation TimeStamp) of the filtered video frame,
  10467. expressed in seconds, NAN if undefined
  10468. @item tb
  10469. time base of the input video
  10470. @end table
  10471. @subsection Examples
  10472. @itemize
  10473. @item
  10474. Apply simple strong vignetting effect:
  10475. @example
  10476. vignette=PI/4
  10477. @end example
  10478. @item
  10479. Make a flickering vignetting:
  10480. @example
  10481. vignette='PI/4+random(1)*PI/50':eval=frame
  10482. @end example
  10483. @end itemize
  10484. @section vstack
  10485. Stack input videos vertically.
  10486. All streams must be of same pixel format and of same width.
  10487. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  10488. to create same output.
  10489. The filter accept the following option:
  10490. @table @option
  10491. @item inputs
  10492. Set number of input streams. Default is 2.
  10493. @item shortest
  10494. If set to 1, force the output to terminate when the shortest input
  10495. terminates. Default value is 0.
  10496. @end table
  10497. @section w3fdif
  10498. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  10499. Deinterlacing Filter").
  10500. Based on the process described by Martin Weston for BBC R&D, and
  10501. implemented based on the de-interlace algorithm written by Jim
  10502. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  10503. uses filter coefficients calculated by BBC R&D.
  10504. There are two sets of filter coefficients, so called "simple":
  10505. and "complex". Which set of filter coefficients is used can
  10506. be set by passing an optional parameter:
  10507. @table @option
  10508. @item filter
  10509. Set the interlacing filter coefficients. Accepts one of the following values:
  10510. @table @samp
  10511. @item simple
  10512. Simple filter coefficient set.
  10513. @item complex
  10514. More-complex filter coefficient set.
  10515. @end table
  10516. Default value is @samp{complex}.
  10517. @item deint
  10518. Specify which frames to deinterlace. Accept one of the following values:
  10519. @table @samp
  10520. @item all
  10521. Deinterlace all frames,
  10522. @item interlaced
  10523. Only deinterlace frames marked as interlaced.
  10524. @end table
  10525. Default value is @samp{all}.
  10526. @end table
  10527. @section waveform
  10528. Video waveform monitor.
  10529. The waveform monitor plots color component intensity. By default luminance
  10530. only. Each column of the waveform corresponds to a column of pixels in the
  10531. source video.
  10532. It accepts the following options:
  10533. @table @option
  10534. @item mode, m
  10535. Can be either @code{row}, or @code{column}. Default is @code{column}.
  10536. In row mode, the graph on the left side represents color component value 0 and
  10537. the right side represents value = 255. In column mode, the top side represents
  10538. color component value = 0 and bottom side represents value = 255.
  10539. @item intensity, i
  10540. Set intensity. Smaller values are useful to find out how many values of the same
  10541. luminance are distributed across input rows/columns.
  10542. Default value is @code{0.04}. Allowed range is [0, 1].
  10543. @item mirror, r
  10544. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  10545. In mirrored mode, higher values will be represented on the left
  10546. side for @code{row} mode and at the top for @code{column} mode. Default is
  10547. @code{1} (mirrored).
  10548. @item display, d
  10549. Set display mode.
  10550. It accepts the following values:
  10551. @table @samp
  10552. @item overlay
  10553. Presents information identical to that in the @code{parade}, except
  10554. that the graphs representing color components are superimposed directly
  10555. over one another.
  10556. This display mode makes it easier to spot relative differences or similarities
  10557. in overlapping areas of the color components that are supposed to be identical,
  10558. such as neutral whites, grays, or blacks.
  10559. @item stack
  10560. Display separate graph for the color components side by side in
  10561. @code{row} mode or one below the other in @code{column} mode.
  10562. @item parade
  10563. Display separate graph for the color components side by side in
  10564. @code{column} mode or one below the other in @code{row} mode.
  10565. Using this display mode makes it easy to spot color casts in the highlights
  10566. and shadows of an image, by comparing the contours of the top and the bottom
  10567. graphs of each waveform. Since whites, grays, and blacks are characterized
  10568. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  10569. should display three waveforms of roughly equal width/height. If not, the
  10570. correction is easy to perform by making level adjustments the three waveforms.
  10571. @end table
  10572. Default is @code{stack}.
  10573. @item components, c
  10574. Set which color components to display. Default is 1, which means only luminance
  10575. or red color component if input is in RGB colorspace. If is set for example to
  10576. 7 it will display all 3 (if) available color components.
  10577. @item envelope, e
  10578. @table @samp
  10579. @item none
  10580. No envelope, this is default.
  10581. @item instant
  10582. Instant envelope, minimum and maximum values presented in graph will be easily
  10583. visible even with small @code{step} value.
  10584. @item peak
  10585. Hold minimum and maximum values presented in graph across time. This way you
  10586. can still spot out of range values without constantly looking at waveforms.
  10587. @item peak+instant
  10588. Peak and instant envelope combined together.
  10589. @end table
  10590. @item filter, f
  10591. @table @samp
  10592. @item lowpass
  10593. No filtering, this is default.
  10594. @item flat
  10595. Luma and chroma combined together.
  10596. @item aflat
  10597. Similar as above, but shows difference between blue and red chroma.
  10598. @item chroma
  10599. Displays only chroma.
  10600. @item color
  10601. Displays actual color value on waveform.
  10602. @item acolor
  10603. Similar as above, but with luma showing frequency of chroma values.
  10604. @end table
  10605. @item graticule, g
  10606. Set which graticule to display.
  10607. @table @samp
  10608. @item none
  10609. Do not display graticule.
  10610. @item green
  10611. Display green graticule showing legal broadcast ranges.
  10612. @end table
  10613. @item opacity, o
  10614. Set graticule opacity.
  10615. @item flags, fl
  10616. Set graticule flags.
  10617. @table @samp
  10618. @item numbers
  10619. Draw numbers above lines. By default enabled.
  10620. @item dots
  10621. Draw dots instead of lines.
  10622. @end table
  10623. @item scale, s
  10624. Set scale used for displaying graticule.
  10625. @table @samp
  10626. @item digital
  10627. @item millivolts
  10628. @item ire
  10629. @end table
  10630. Default is digital.
  10631. @end table
  10632. @section xbr
  10633. Apply the xBR high-quality magnification filter which is designed for pixel
  10634. art. It follows a set of edge-detection rules, see
  10635. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  10636. It accepts the following option:
  10637. @table @option
  10638. @item n
  10639. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  10640. @code{3xBR} and @code{4} for @code{4xBR}.
  10641. Default is @code{3}.
  10642. @end table
  10643. @anchor{yadif}
  10644. @section yadif
  10645. Deinterlace the input video ("yadif" means "yet another deinterlacing
  10646. filter").
  10647. It accepts the following parameters:
  10648. @table @option
  10649. @item mode
  10650. The interlacing mode to adopt. It accepts one of the following values:
  10651. @table @option
  10652. @item 0, send_frame
  10653. Output one frame for each frame.
  10654. @item 1, send_field
  10655. Output one frame for each field.
  10656. @item 2, send_frame_nospatial
  10657. Like @code{send_frame}, but it skips the spatial interlacing check.
  10658. @item 3, send_field_nospatial
  10659. Like @code{send_field}, but it skips the spatial interlacing check.
  10660. @end table
  10661. The default value is @code{send_frame}.
  10662. @item parity
  10663. The picture field parity assumed for the input interlaced video. It accepts one
  10664. of the following values:
  10665. @table @option
  10666. @item 0, tff
  10667. Assume the top field is first.
  10668. @item 1, bff
  10669. Assume the bottom field is first.
  10670. @item -1, auto
  10671. Enable automatic detection of field parity.
  10672. @end table
  10673. The default value is @code{auto}.
  10674. If the interlacing is unknown or the decoder does not export this information,
  10675. top field first will be assumed.
  10676. @item deint
  10677. Specify which frames to deinterlace. Accept one of the following
  10678. values:
  10679. @table @option
  10680. @item 0, all
  10681. Deinterlace all frames.
  10682. @item 1, interlaced
  10683. Only deinterlace frames marked as interlaced.
  10684. @end table
  10685. The default value is @code{all}.
  10686. @end table
  10687. @section zoompan
  10688. Apply Zoom & Pan effect.
  10689. This filter accepts the following options:
  10690. @table @option
  10691. @item zoom, z
  10692. Set the zoom expression. Default is 1.
  10693. @item x
  10694. @item y
  10695. Set the x and y expression. Default is 0.
  10696. @item d
  10697. Set the duration expression in number of frames.
  10698. This sets for how many number of frames effect will last for
  10699. single input image.
  10700. @item s
  10701. Set the output image size, default is 'hd720'.
  10702. @item fps
  10703. Set the output frame rate, default is '25'.
  10704. @end table
  10705. Each expression can contain the following constants:
  10706. @table @option
  10707. @item in_w, iw
  10708. Input width.
  10709. @item in_h, ih
  10710. Input height.
  10711. @item out_w, ow
  10712. Output width.
  10713. @item out_h, oh
  10714. Output height.
  10715. @item in
  10716. Input frame count.
  10717. @item on
  10718. Output frame count.
  10719. @item x
  10720. @item y
  10721. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  10722. for current input frame.
  10723. @item px
  10724. @item py
  10725. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  10726. not yet such frame (first input frame).
  10727. @item zoom
  10728. Last calculated zoom from 'z' expression for current input frame.
  10729. @item pzoom
  10730. Last calculated zoom of last output frame of previous input frame.
  10731. @item duration
  10732. Number of output frames for current input frame. Calculated from 'd' expression
  10733. for each input frame.
  10734. @item pduration
  10735. number of output frames created for previous input frame
  10736. @item a
  10737. Rational number: input width / input height
  10738. @item sar
  10739. sample aspect ratio
  10740. @item dar
  10741. display aspect ratio
  10742. @end table
  10743. @subsection Examples
  10744. @itemize
  10745. @item
  10746. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  10747. @example
  10748. 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
  10749. @end example
  10750. @item
  10751. Zoom-in up to 1.5 and pan always at center of picture:
  10752. @example
  10753. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  10754. @end example
  10755. @item
  10756. Same as above but without pausing:
  10757. @example
  10758. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  10759. @end example
  10760. @end itemize
  10761. @section zscale
  10762. Scale (resize) the input video, using the z.lib library:
  10763. https://github.com/sekrit-twc/zimg.
  10764. The zscale filter forces the output display aspect ratio to be the same
  10765. as the input, by changing the output sample aspect ratio.
  10766. If the input image format is different from the format requested by
  10767. the next filter, the zscale filter will convert the input to the
  10768. requested format.
  10769. @subsection Options
  10770. The filter accepts the following options.
  10771. @table @option
  10772. @item width, w
  10773. @item height, h
  10774. Set the output video dimension expression. Default value is the input
  10775. dimension.
  10776. If the @var{width} or @var{w} is 0, the input width is used for the output.
  10777. If the @var{height} or @var{h} is 0, the input height is used for the output.
  10778. If one of the values is -1, the zscale filter will use a value that
  10779. maintains the aspect ratio of the input image, calculated from the
  10780. other specified dimension. If both of them are -1, the input size is
  10781. used
  10782. If one of the values is -n with n > 1, the zscale filter will also use a value
  10783. that maintains the aspect ratio of the input image, calculated from the other
  10784. specified dimension. After that it will, however, make sure that the calculated
  10785. dimension is divisible by n and adjust the value if necessary.
  10786. See below for the list of accepted constants for use in the dimension
  10787. expression.
  10788. @item size, s
  10789. Set the video size. For the syntax of this option, check the
  10790. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10791. @item dither, d
  10792. Set the dither type.
  10793. Possible values are:
  10794. @table @var
  10795. @item none
  10796. @item ordered
  10797. @item random
  10798. @item error_diffusion
  10799. @end table
  10800. Default is none.
  10801. @item filter, f
  10802. Set the resize filter type.
  10803. Possible values are:
  10804. @table @var
  10805. @item point
  10806. @item bilinear
  10807. @item bicubic
  10808. @item spline16
  10809. @item spline36
  10810. @item lanczos
  10811. @end table
  10812. Default is bilinear.
  10813. @item range, r
  10814. Set the color range.
  10815. Possible values are:
  10816. @table @var
  10817. @item input
  10818. @item limited
  10819. @item full
  10820. @end table
  10821. Default is same as input.
  10822. @item primaries, p
  10823. Set the color primaries.
  10824. Possible values are:
  10825. @table @var
  10826. @item input
  10827. @item 709
  10828. @item unspecified
  10829. @item 170m
  10830. @item 240m
  10831. @item 2020
  10832. @end table
  10833. Default is same as input.
  10834. @item transfer, t
  10835. Set the transfer characteristics.
  10836. Possible values are:
  10837. @table @var
  10838. @item input
  10839. @item 709
  10840. @item unspecified
  10841. @item 601
  10842. @item linear
  10843. @item 2020_10
  10844. @item 2020_12
  10845. @end table
  10846. Default is same as input.
  10847. @item matrix, m
  10848. Set the colorspace matrix.
  10849. Possible value are:
  10850. @table @var
  10851. @item input
  10852. @item 709
  10853. @item unspecified
  10854. @item 470bg
  10855. @item 170m
  10856. @item 2020_ncl
  10857. @item 2020_cl
  10858. @end table
  10859. Default is same as input.
  10860. @item rangein, rin
  10861. Set the input color range.
  10862. Possible values are:
  10863. @table @var
  10864. @item input
  10865. @item limited
  10866. @item full
  10867. @end table
  10868. Default is same as input.
  10869. @item primariesin, pin
  10870. Set the input color primaries.
  10871. Possible values are:
  10872. @table @var
  10873. @item input
  10874. @item 709
  10875. @item unspecified
  10876. @item 170m
  10877. @item 240m
  10878. @item 2020
  10879. @end table
  10880. Default is same as input.
  10881. @item transferin, tin
  10882. Set the input transfer characteristics.
  10883. Possible values are:
  10884. @table @var
  10885. @item input
  10886. @item 709
  10887. @item unspecified
  10888. @item 601
  10889. @item linear
  10890. @item 2020_10
  10891. @item 2020_12
  10892. @end table
  10893. Default is same as input.
  10894. @item matrixin, min
  10895. Set the input colorspace matrix.
  10896. Possible value are:
  10897. @table @var
  10898. @item input
  10899. @item 709
  10900. @item unspecified
  10901. @item 470bg
  10902. @item 170m
  10903. @item 2020_ncl
  10904. @item 2020_cl
  10905. @end table
  10906. @end table
  10907. The values of the @option{w} and @option{h} options are expressions
  10908. containing the following constants:
  10909. @table @var
  10910. @item in_w
  10911. @item in_h
  10912. The input width and height
  10913. @item iw
  10914. @item ih
  10915. These are the same as @var{in_w} and @var{in_h}.
  10916. @item out_w
  10917. @item out_h
  10918. The output (scaled) width and height
  10919. @item ow
  10920. @item oh
  10921. These are the same as @var{out_w} and @var{out_h}
  10922. @item a
  10923. The same as @var{iw} / @var{ih}
  10924. @item sar
  10925. input sample aspect ratio
  10926. @item dar
  10927. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  10928. @item hsub
  10929. @item vsub
  10930. horizontal and vertical input chroma subsample values. For example for the
  10931. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10932. @item ohsub
  10933. @item ovsub
  10934. horizontal and vertical output chroma subsample values. For example for the
  10935. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10936. @end table
  10937. @table @option
  10938. @end table
  10939. @c man end VIDEO FILTERS
  10940. @chapter Video Sources
  10941. @c man begin VIDEO SOURCES
  10942. Below is a description of the currently available video sources.
  10943. @section buffer
  10944. Buffer video frames, and make them available to the filter chain.
  10945. This source is mainly intended for a programmatic use, in particular
  10946. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  10947. It accepts the following parameters:
  10948. @table @option
  10949. @item video_size
  10950. Specify the size (width and height) of the buffered video frames. For the
  10951. syntax of this option, check the
  10952. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10953. @item width
  10954. The input video width.
  10955. @item height
  10956. The input video height.
  10957. @item pix_fmt
  10958. A string representing the pixel format of the buffered video frames.
  10959. It may be a number corresponding to a pixel format, or a pixel format
  10960. name.
  10961. @item time_base
  10962. Specify the timebase assumed by the timestamps of the buffered frames.
  10963. @item frame_rate
  10964. Specify the frame rate expected for the video stream.
  10965. @item pixel_aspect, sar
  10966. The sample (pixel) aspect ratio of the input video.
  10967. @item sws_param
  10968. Specify the optional parameters to be used for the scale filter which
  10969. is automatically inserted when an input change is detected in the
  10970. input size or format.
  10971. @item hw_frames_ctx
  10972. When using a hardware pixel format, this should be a reference to an
  10973. AVHWFramesContext describing input frames.
  10974. @end table
  10975. For example:
  10976. @example
  10977. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  10978. @end example
  10979. will instruct the source to accept video frames with size 320x240 and
  10980. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  10981. square pixels (1:1 sample aspect ratio).
  10982. Since the pixel format with name "yuv410p" corresponds to the number 6
  10983. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  10984. this example corresponds to:
  10985. @example
  10986. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  10987. @end example
  10988. Alternatively, the options can be specified as a flat string, but this
  10989. syntax is deprecated:
  10990. @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}]
  10991. @section cellauto
  10992. Create a pattern generated by an elementary cellular automaton.
  10993. The initial state of the cellular automaton can be defined through the
  10994. @option{filename}, and @option{pattern} options. If such options are
  10995. not specified an initial state is created randomly.
  10996. At each new frame a new row in the video is filled with the result of
  10997. the cellular automaton next generation. The behavior when the whole
  10998. frame is filled is defined by the @option{scroll} option.
  10999. This source accepts the following options:
  11000. @table @option
  11001. @item filename, f
  11002. Read the initial cellular automaton state, i.e. the starting row, from
  11003. the specified file.
  11004. In the file, each non-whitespace character is considered an alive
  11005. cell, a newline will terminate the row, and further characters in the
  11006. file will be ignored.
  11007. @item pattern, p
  11008. Read the initial cellular automaton state, i.e. the starting row, from
  11009. the specified string.
  11010. Each non-whitespace character in the string is considered an alive
  11011. cell, a newline will terminate the row, and further characters in the
  11012. string will be ignored.
  11013. @item rate, r
  11014. Set the video rate, that is the number of frames generated per second.
  11015. Default is 25.
  11016. @item random_fill_ratio, ratio
  11017. Set the random fill ratio for the initial cellular automaton row. It
  11018. is a floating point number value ranging from 0 to 1, defaults to
  11019. 1/PHI.
  11020. This option is ignored when a file or a pattern is specified.
  11021. @item random_seed, seed
  11022. Set the seed for filling randomly the initial row, must be an integer
  11023. included between 0 and UINT32_MAX. If not specified, or if explicitly
  11024. set to -1, the filter will try to use a good random seed on a best
  11025. effort basis.
  11026. @item rule
  11027. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  11028. Default value is 110.
  11029. @item size, s
  11030. Set the size of the output video. For the syntax of this option, check the
  11031. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11032. If @option{filename} or @option{pattern} is specified, the size is set
  11033. by default to the width of the specified initial state row, and the
  11034. height is set to @var{width} * PHI.
  11035. If @option{size} is set, it must contain the width of the specified
  11036. pattern string, and the specified pattern will be centered in the
  11037. larger row.
  11038. If a filename or a pattern string is not specified, the size value
  11039. defaults to "320x518" (used for a randomly generated initial state).
  11040. @item scroll
  11041. If set to 1, scroll the output upward when all the rows in the output
  11042. have been already filled. If set to 0, the new generated row will be
  11043. written over the top row just after the bottom row is filled.
  11044. Defaults to 1.
  11045. @item start_full, full
  11046. If set to 1, completely fill the output with generated rows before
  11047. outputting the first frame.
  11048. This is the default behavior, for disabling set the value to 0.
  11049. @item stitch
  11050. If set to 1, stitch the left and right row edges together.
  11051. This is the default behavior, for disabling set the value to 0.
  11052. @end table
  11053. @subsection Examples
  11054. @itemize
  11055. @item
  11056. Read the initial state from @file{pattern}, and specify an output of
  11057. size 200x400.
  11058. @example
  11059. cellauto=f=pattern:s=200x400
  11060. @end example
  11061. @item
  11062. Generate a random initial row with a width of 200 cells, with a fill
  11063. ratio of 2/3:
  11064. @example
  11065. cellauto=ratio=2/3:s=200x200
  11066. @end example
  11067. @item
  11068. Create a pattern generated by rule 18 starting by a single alive cell
  11069. centered on an initial row with width 100:
  11070. @example
  11071. cellauto=p=@@:s=100x400:full=0:rule=18
  11072. @end example
  11073. @item
  11074. Specify a more elaborated initial pattern:
  11075. @example
  11076. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  11077. @end example
  11078. @end itemize
  11079. @anchor{coreimagesrc}
  11080. @section coreimagesrc
  11081. Video source generated on GPU using Apple's CoreImage API on OSX.
  11082. This video source is a specialized version of the @ref{coreimage} video filter.
  11083. Use a core image generator at the beginning of the applied filterchain to
  11084. generate the content.
  11085. The coreimagesrc video source accepts the following options:
  11086. @table @option
  11087. @item list_generators
  11088. List all available generators along with all their respective options as well as
  11089. possible minimum and maximum values along with the default values.
  11090. @example
  11091. list_generators=true
  11092. @end example
  11093. @item size, s
  11094. Specify the size of the sourced video. For the syntax of this option, check the
  11095. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11096. The default value is @code{320x240}.
  11097. @item rate, r
  11098. Specify the frame rate of the sourced video, as the number of frames
  11099. generated per second. It has to be a string in the format
  11100. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11101. number or a valid video frame rate abbreviation. The default value is
  11102. "25".
  11103. @item sar
  11104. Set the sample aspect ratio of the sourced video.
  11105. @item duration, d
  11106. Set the duration of the sourced video. See
  11107. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11108. for the accepted syntax.
  11109. If not specified, or the expressed duration is negative, the video is
  11110. supposed to be generated forever.
  11111. @end table
  11112. Additionally, all options of the @ref{coreimage} video filter are accepted.
  11113. A complete filterchain can be used for further processing of the
  11114. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  11115. and examples for details.
  11116. @subsection Examples
  11117. @itemize
  11118. @item
  11119. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  11120. given as complete and escaped command-line for Apple's standard bash shell:
  11121. @example
  11122. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  11123. @end example
  11124. This example is equivalent to the QRCode example of @ref{coreimage} without the
  11125. need for a nullsrc video source.
  11126. @end itemize
  11127. @section mandelbrot
  11128. Generate a Mandelbrot set fractal, and progressively zoom towards the
  11129. point specified with @var{start_x} and @var{start_y}.
  11130. This source accepts the following options:
  11131. @table @option
  11132. @item end_pts
  11133. Set the terminal pts value. Default value is 400.
  11134. @item end_scale
  11135. Set the terminal scale value.
  11136. Must be a floating point value. Default value is 0.3.
  11137. @item inner
  11138. Set the inner coloring mode, that is the algorithm used to draw the
  11139. Mandelbrot fractal internal region.
  11140. It shall assume one of the following values:
  11141. @table @option
  11142. @item black
  11143. Set black mode.
  11144. @item convergence
  11145. Show time until convergence.
  11146. @item mincol
  11147. Set color based on point closest to the origin of the iterations.
  11148. @item period
  11149. Set period mode.
  11150. @end table
  11151. Default value is @var{mincol}.
  11152. @item bailout
  11153. Set the bailout value. Default value is 10.0.
  11154. @item maxiter
  11155. Set the maximum of iterations performed by the rendering
  11156. algorithm. Default value is 7189.
  11157. @item outer
  11158. Set outer coloring mode.
  11159. It shall assume one of following values:
  11160. @table @option
  11161. @item iteration_count
  11162. Set iteration cound mode.
  11163. @item normalized_iteration_count
  11164. set normalized iteration count mode.
  11165. @end table
  11166. Default value is @var{normalized_iteration_count}.
  11167. @item rate, r
  11168. Set frame rate, expressed as number of frames per second. Default
  11169. value is "25".
  11170. @item size, s
  11171. Set frame size. For the syntax of this option, check the "Video
  11172. size" section in the ffmpeg-utils manual. Default value is "640x480".
  11173. @item start_scale
  11174. Set the initial scale value. Default value is 3.0.
  11175. @item start_x
  11176. Set the initial x position. Must be a floating point value between
  11177. -100 and 100. Default value is -0.743643887037158704752191506114774.
  11178. @item start_y
  11179. Set the initial y position. Must be a floating point value between
  11180. -100 and 100. Default value is -0.131825904205311970493132056385139.
  11181. @end table
  11182. @section mptestsrc
  11183. Generate various test patterns, as generated by the MPlayer test filter.
  11184. The size of the generated video is fixed, and is 256x256.
  11185. This source is useful in particular for testing encoding features.
  11186. This source accepts the following options:
  11187. @table @option
  11188. @item rate, r
  11189. Specify the frame rate of the sourced video, as the number of frames
  11190. generated per second. It has to be a string in the format
  11191. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11192. number or a valid video frame rate abbreviation. The default value is
  11193. "25".
  11194. @item duration, d
  11195. Set the duration of the sourced video. See
  11196. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11197. for the accepted syntax.
  11198. If not specified, or the expressed duration is negative, the video is
  11199. supposed to be generated forever.
  11200. @item test, t
  11201. Set the number or the name of the test to perform. Supported tests are:
  11202. @table @option
  11203. @item dc_luma
  11204. @item dc_chroma
  11205. @item freq_luma
  11206. @item freq_chroma
  11207. @item amp_luma
  11208. @item amp_chroma
  11209. @item cbp
  11210. @item mv
  11211. @item ring1
  11212. @item ring2
  11213. @item all
  11214. @end table
  11215. Default value is "all", which will cycle through the list of all tests.
  11216. @end table
  11217. Some examples:
  11218. @example
  11219. mptestsrc=t=dc_luma
  11220. @end example
  11221. will generate a "dc_luma" test pattern.
  11222. @section frei0r_src
  11223. Provide a frei0r source.
  11224. To enable compilation of this filter you need to install the frei0r
  11225. header and configure FFmpeg with @code{--enable-frei0r}.
  11226. This source accepts the following parameters:
  11227. @table @option
  11228. @item size
  11229. The size of the video to generate. For the syntax of this option, check the
  11230. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11231. @item framerate
  11232. The framerate of the generated video. It may be a string of the form
  11233. @var{num}/@var{den} or a frame rate abbreviation.
  11234. @item filter_name
  11235. The name to the frei0r source to load. For more information regarding frei0r and
  11236. how to set the parameters, read the @ref{frei0r} section in the video filters
  11237. documentation.
  11238. @item filter_params
  11239. A '|'-separated list of parameters to pass to the frei0r source.
  11240. @end table
  11241. For example, to generate a frei0r partik0l source with size 200x200
  11242. and frame rate 10 which is overlaid on the overlay filter main input:
  11243. @example
  11244. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  11245. @end example
  11246. @section life
  11247. Generate a life pattern.
  11248. This source is based on a generalization of John Conway's life game.
  11249. The sourced input represents a life grid, each pixel represents a cell
  11250. which can be in one of two possible states, alive or dead. Every cell
  11251. interacts with its eight neighbours, which are the cells that are
  11252. horizontally, vertically, or diagonally adjacent.
  11253. At each interaction the grid evolves according to the adopted rule,
  11254. which specifies the number of neighbor alive cells which will make a
  11255. cell stay alive or born. The @option{rule} option allows one to specify
  11256. the rule to adopt.
  11257. This source accepts the following options:
  11258. @table @option
  11259. @item filename, f
  11260. Set the file from which to read the initial grid state. In the file,
  11261. each non-whitespace character is considered an alive cell, and newline
  11262. is used to delimit the end of each row.
  11263. If this option is not specified, the initial grid is generated
  11264. randomly.
  11265. @item rate, r
  11266. Set the video rate, that is the number of frames generated per second.
  11267. Default is 25.
  11268. @item random_fill_ratio, ratio
  11269. Set the random fill ratio for the initial random grid. It is a
  11270. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  11271. It is ignored when a file is specified.
  11272. @item random_seed, seed
  11273. Set the seed for filling the initial random grid, must be an integer
  11274. included between 0 and UINT32_MAX. If not specified, or if explicitly
  11275. set to -1, the filter will try to use a good random seed on a best
  11276. effort basis.
  11277. @item rule
  11278. Set the life rule.
  11279. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  11280. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  11281. @var{NS} specifies the number of alive neighbor cells which make a
  11282. live cell stay alive, and @var{NB} the number of alive neighbor cells
  11283. which make a dead cell to become alive (i.e. to "born").
  11284. "s" and "b" can be used in place of "S" and "B", respectively.
  11285. Alternatively a rule can be specified by an 18-bits integer. The 9
  11286. high order bits are used to encode the next cell state if it is alive
  11287. for each number of neighbor alive cells, the low order bits specify
  11288. the rule for "borning" new cells. Higher order bits encode for an
  11289. higher number of neighbor cells.
  11290. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  11291. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  11292. Default value is "S23/B3", which is the original Conway's game of life
  11293. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  11294. cells, and will born a new cell if there are three alive cells around
  11295. a dead cell.
  11296. @item size, s
  11297. Set the size of the output video. For the syntax of this option, check the
  11298. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11299. If @option{filename} is specified, the size is set by default to the
  11300. same size of the input file. If @option{size} is set, it must contain
  11301. the size specified in the input file, and the initial grid defined in
  11302. that file is centered in the larger resulting area.
  11303. If a filename is not specified, the size value defaults to "320x240"
  11304. (used for a randomly generated initial grid).
  11305. @item stitch
  11306. If set to 1, stitch the left and right grid edges together, and the
  11307. top and bottom edges also. Defaults to 1.
  11308. @item mold
  11309. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  11310. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  11311. value from 0 to 255.
  11312. @item life_color
  11313. Set the color of living (or new born) cells.
  11314. @item death_color
  11315. Set the color of dead cells. If @option{mold} is set, this is the first color
  11316. used to represent a dead cell.
  11317. @item mold_color
  11318. Set mold color, for definitely dead and moldy cells.
  11319. For the syntax of these 3 color options, check the "Color" section in the
  11320. ffmpeg-utils manual.
  11321. @end table
  11322. @subsection Examples
  11323. @itemize
  11324. @item
  11325. Read a grid from @file{pattern}, and center it on a grid of size
  11326. 300x300 pixels:
  11327. @example
  11328. life=f=pattern:s=300x300
  11329. @end example
  11330. @item
  11331. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  11332. @example
  11333. life=ratio=2/3:s=200x200
  11334. @end example
  11335. @item
  11336. Specify a custom rule for evolving a randomly generated grid:
  11337. @example
  11338. life=rule=S14/B34
  11339. @end example
  11340. @item
  11341. Full example with slow death effect (mold) using @command{ffplay}:
  11342. @example
  11343. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  11344. @end example
  11345. @end itemize
  11346. @anchor{allrgb}
  11347. @anchor{allyuv}
  11348. @anchor{color}
  11349. @anchor{haldclutsrc}
  11350. @anchor{nullsrc}
  11351. @anchor{rgbtestsrc}
  11352. @anchor{smptebars}
  11353. @anchor{smptehdbars}
  11354. @anchor{testsrc}
  11355. @anchor{testsrc2}
  11356. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2
  11357. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  11358. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  11359. The @code{color} source provides an uniformly colored input.
  11360. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  11361. @ref{haldclut} filter.
  11362. The @code{nullsrc} source returns unprocessed video frames. It is
  11363. mainly useful to be employed in analysis / debugging tools, or as the
  11364. source for filters which ignore the input data.
  11365. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  11366. detecting RGB vs BGR issues. You should see a red, green and blue
  11367. stripe from top to bottom.
  11368. The @code{smptebars} source generates a color bars pattern, based on
  11369. the SMPTE Engineering Guideline EG 1-1990.
  11370. The @code{smptehdbars} source generates a color bars pattern, based on
  11371. the SMPTE RP 219-2002.
  11372. The @code{testsrc} source generates a test video pattern, showing a
  11373. color pattern, a scrolling gradient and a timestamp. This is mainly
  11374. intended for testing purposes.
  11375. The @code{testsrc2} source is similar to testsrc, but supports more
  11376. pixel formats instead of just @code{rgb24}. This allows using it as an
  11377. input for other tests without requiring a format conversion.
  11378. The sources accept the following parameters:
  11379. @table @option
  11380. @item color, c
  11381. Specify the color of the source, only available in the @code{color}
  11382. source. For the syntax of this option, check the "Color" section in the
  11383. ffmpeg-utils manual.
  11384. @item level
  11385. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  11386. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  11387. pixels to be used as identity matrix for 3D lookup tables. Each component is
  11388. coded on a @code{1/(N*N)} scale.
  11389. @item size, s
  11390. Specify the size of the sourced video. For the syntax of this option, check the
  11391. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11392. The default value is @code{320x240}.
  11393. This option is not available with the @code{haldclutsrc} filter.
  11394. @item rate, r
  11395. Specify the frame rate of the sourced video, as the number of frames
  11396. generated per second. It has to be a string in the format
  11397. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  11398. number or a valid video frame rate abbreviation. The default value is
  11399. "25".
  11400. @item sar
  11401. Set the sample aspect ratio of the sourced video.
  11402. @item duration, d
  11403. Set the duration of the sourced video. See
  11404. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11405. for the accepted syntax.
  11406. If not specified, or the expressed duration is negative, the video is
  11407. supposed to be generated forever.
  11408. @item decimals, n
  11409. Set the number of decimals to show in the timestamp, only available in the
  11410. @code{testsrc} source.
  11411. The displayed timestamp value will correspond to the original
  11412. timestamp value multiplied by the power of 10 of the specified
  11413. value. Default value is 0.
  11414. @end table
  11415. For example the following:
  11416. @example
  11417. testsrc=duration=5.3:size=qcif:rate=10
  11418. @end example
  11419. will generate a video with a duration of 5.3 seconds, with size
  11420. 176x144 and a frame rate of 10 frames per second.
  11421. The following graph description will generate a red source
  11422. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  11423. frames per second.
  11424. @example
  11425. color=c=red@@0.2:s=qcif:r=10
  11426. @end example
  11427. If the input content is to be ignored, @code{nullsrc} can be used. The
  11428. following command generates noise in the luminance plane by employing
  11429. the @code{geq} filter:
  11430. @example
  11431. nullsrc=s=256x256, geq=random(1)*255:128:128
  11432. @end example
  11433. @subsection Commands
  11434. The @code{color} source supports the following commands:
  11435. @table @option
  11436. @item c, color
  11437. Set the color of the created image. Accepts the same syntax of the
  11438. corresponding @option{color} option.
  11439. @end table
  11440. @c man end VIDEO SOURCES
  11441. @chapter Video Sinks
  11442. @c man begin VIDEO SINKS
  11443. Below is a description of the currently available video sinks.
  11444. @section buffersink
  11445. Buffer video frames, and make them available to the end of the filter
  11446. graph.
  11447. This sink is mainly intended for programmatic use, in particular
  11448. through the interface defined in @file{libavfilter/buffersink.h}
  11449. or the options system.
  11450. It accepts a pointer to an AVBufferSinkContext structure, which
  11451. defines the incoming buffers' formats, to be passed as the opaque
  11452. parameter to @code{avfilter_init_filter} for initialization.
  11453. @section nullsink
  11454. Null video sink: do absolutely nothing with the input video. It is
  11455. mainly useful as a template and for use in analysis / debugging
  11456. tools.
  11457. @c man end VIDEO SINKS
  11458. @chapter Multimedia Filters
  11459. @c man begin MULTIMEDIA FILTERS
  11460. Below is a description of the currently available multimedia filters.
  11461. @section ahistogram
  11462. Convert input audio to a video output, displaying the volume histogram.
  11463. The filter accepts the following options:
  11464. @table @option
  11465. @item dmode
  11466. Specify how histogram is calculated.
  11467. It accepts the following values:
  11468. @table @samp
  11469. @item single
  11470. Use single histogram for all channels.
  11471. @item separate
  11472. Use separate histogram for each channel.
  11473. @end table
  11474. Default is @code{single}.
  11475. @item rate, r
  11476. Set frame rate, expressed as number of frames per second. Default
  11477. value is "25".
  11478. @item size, s
  11479. Specify the video size for the output. For the syntax of this option, check the
  11480. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11481. Default value is @code{hd720}.
  11482. @item scale
  11483. Set display scale.
  11484. It accepts the following values:
  11485. @table @samp
  11486. @item log
  11487. logarithmic
  11488. @item sqrt
  11489. square root
  11490. @item cbrt
  11491. cubic root
  11492. @item lin
  11493. linear
  11494. @item rlog
  11495. reverse logarithmic
  11496. @end table
  11497. Default is @code{log}.
  11498. @item ascale
  11499. Set amplitude scale.
  11500. It accepts the following values:
  11501. @table @samp
  11502. @item log
  11503. logarithmic
  11504. @item lin
  11505. linear
  11506. @end table
  11507. Default is @code{log}.
  11508. @item acount
  11509. Set how much frames to accumulate in histogram.
  11510. Defauls is 1. Setting this to -1 accumulates all frames.
  11511. @item rheight
  11512. Set histogram ratio of window height.
  11513. @item slide
  11514. Set sonogram sliding.
  11515. It accepts the following values:
  11516. @table @samp
  11517. @item replace
  11518. replace old rows with new ones.
  11519. @item scroll
  11520. scroll from top to bottom.
  11521. @end table
  11522. Default is @code{replace}.
  11523. @end table
  11524. @section aphasemeter
  11525. Convert input audio to a video output, displaying the audio phase.
  11526. The filter accepts the following options:
  11527. @table @option
  11528. @item rate, r
  11529. Set the output frame rate. Default value is @code{25}.
  11530. @item size, s
  11531. Set the video size for the output. For the syntax of this option, check the
  11532. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11533. Default value is @code{800x400}.
  11534. @item rc
  11535. @item gc
  11536. @item bc
  11537. Specify the red, green, blue contrast. Default values are @code{2},
  11538. @code{7} and @code{1}.
  11539. Allowed range is @code{[0, 255]}.
  11540. @item mpc
  11541. Set color which will be used for drawing median phase. If color is
  11542. @code{none} which is default, no median phase value will be drawn.
  11543. @end table
  11544. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  11545. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  11546. The @code{-1} means left and right channels are completely out of phase and
  11547. @code{1} means channels are in phase.
  11548. @section avectorscope
  11549. Convert input audio to a video output, representing the audio vector
  11550. scope.
  11551. The filter is used to measure the difference between channels of stereo
  11552. audio stream. A monoaural signal, consisting of identical left and right
  11553. signal, results in straight vertical line. Any stereo separation is visible
  11554. as a deviation from this line, creating a Lissajous figure.
  11555. If the straight (or deviation from it) but horizontal line appears this
  11556. indicates that the left and right channels are out of phase.
  11557. The filter accepts the following options:
  11558. @table @option
  11559. @item mode, m
  11560. Set the vectorscope mode.
  11561. Available values are:
  11562. @table @samp
  11563. @item lissajous
  11564. Lissajous rotated by 45 degrees.
  11565. @item lissajous_xy
  11566. Same as above but not rotated.
  11567. @item polar
  11568. Shape resembling half of circle.
  11569. @end table
  11570. Default value is @samp{lissajous}.
  11571. @item size, s
  11572. Set the video size for the output. For the syntax of this option, check the
  11573. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11574. Default value is @code{400x400}.
  11575. @item rate, r
  11576. Set the output frame rate. Default value is @code{25}.
  11577. @item rc
  11578. @item gc
  11579. @item bc
  11580. @item ac
  11581. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  11582. @code{160}, @code{80} and @code{255}.
  11583. Allowed range is @code{[0, 255]}.
  11584. @item rf
  11585. @item gf
  11586. @item bf
  11587. @item af
  11588. Specify the red, green, blue and alpha fade. Default values are @code{15},
  11589. @code{10}, @code{5} and @code{5}.
  11590. Allowed range is @code{[0, 255]}.
  11591. @item zoom
  11592. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
  11593. @item draw
  11594. Set the vectorscope drawing mode.
  11595. Available values are:
  11596. @table @samp
  11597. @item dot
  11598. Draw dot for each sample.
  11599. @item line
  11600. Draw line between previous and current sample.
  11601. @end table
  11602. Default value is @samp{dot}.
  11603. @item scale
  11604. Specify amplitude scale of audio samples.
  11605. Available values are:
  11606. @table @samp
  11607. @item lin
  11608. Linear.
  11609. @item sqrt
  11610. Square root.
  11611. @item cbrt
  11612. Cubic root.
  11613. @item log
  11614. Logarithmic.
  11615. @end table
  11616. @end table
  11617. @subsection Examples
  11618. @itemize
  11619. @item
  11620. Complete example using @command{ffplay}:
  11621. @example
  11622. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  11623. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  11624. @end example
  11625. @end itemize
  11626. @section bench, abench
  11627. Benchmark part of a filtergraph.
  11628. The filter accepts the following options:
  11629. @table @option
  11630. @item action
  11631. Start or stop a timer.
  11632. Available values are:
  11633. @table @samp
  11634. @item start
  11635. Get the current time, set it as frame metadata (using the key
  11636. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  11637. @item stop
  11638. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  11639. the input frame metadata to get the time difference. Time difference, average,
  11640. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  11641. @code{min}) are then printed. The timestamps are expressed in seconds.
  11642. @end table
  11643. @end table
  11644. @subsection Examples
  11645. @itemize
  11646. @item
  11647. Benchmark @ref{selectivecolor} filter:
  11648. @example
  11649. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  11650. @end example
  11651. @end itemize
  11652. @section concat
  11653. Concatenate audio and video streams, joining them together one after the
  11654. other.
  11655. The filter works on segments of synchronized video and audio streams. All
  11656. segments must have the same number of streams of each type, and that will
  11657. also be the number of streams at output.
  11658. The filter accepts the following options:
  11659. @table @option
  11660. @item n
  11661. Set the number of segments. Default is 2.
  11662. @item v
  11663. Set the number of output video streams, that is also the number of video
  11664. streams in each segment. Default is 1.
  11665. @item a
  11666. Set the number of output audio streams, that is also the number of audio
  11667. streams in each segment. Default is 0.
  11668. @item unsafe
  11669. Activate unsafe mode: do not fail if segments have a different format.
  11670. @end table
  11671. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  11672. @var{a} audio outputs.
  11673. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  11674. segment, in the same order as the outputs, then the inputs for the second
  11675. segment, etc.
  11676. Related streams do not always have exactly the same duration, for various
  11677. reasons including codec frame size or sloppy authoring. For that reason,
  11678. related synchronized streams (e.g. a video and its audio track) should be
  11679. concatenated at once. The concat filter will use the duration of the longest
  11680. stream in each segment (except the last one), and if necessary pad shorter
  11681. audio streams with silence.
  11682. For this filter to work correctly, all segments must start at timestamp 0.
  11683. All corresponding streams must have the same parameters in all segments; the
  11684. filtering system will automatically select a common pixel format for video
  11685. streams, and a common sample format, sample rate and channel layout for
  11686. audio streams, but other settings, such as resolution, must be converted
  11687. explicitly by the user.
  11688. Different frame rates are acceptable but will result in variable frame rate
  11689. at output; be sure to configure the output file to handle it.
  11690. @subsection Examples
  11691. @itemize
  11692. @item
  11693. Concatenate an opening, an episode and an ending, all in bilingual version
  11694. (video in stream 0, audio in streams 1 and 2):
  11695. @example
  11696. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  11697. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  11698. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  11699. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  11700. @end example
  11701. @item
  11702. Concatenate two parts, handling audio and video separately, using the
  11703. (a)movie sources, and adjusting the resolution:
  11704. @example
  11705. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  11706. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  11707. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  11708. @end example
  11709. Note that a desync will happen at the stitch if the audio and video streams
  11710. do not have exactly the same duration in the first file.
  11711. @end itemize
  11712. @section drawgraph, adrawgraph
  11713. Draw a graph using input video or audio metadata.
  11714. It accepts the following parameters:
  11715. @table @option
  11716. @item m1
  11717. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  11718. @item fg1
  11719. Set 1st foreground color expression.
  11720. @item m2
  11721. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  11722. @item fg2
  11723. Set 2nd foreground color expression.
  11724. @item m3
  11725. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  11726. @item fg3
  11727. Set 3rd foreground color expression.
  11728. @item m4
  11729. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  11730. @item fg4
  11731. Set 4th foreground color expression.
  11732. @item min
  11733. Set minimal value of metadata value.
  11734. @item max
  11735. Set maximal value of metadata value.
  11736. @item bg
  11737. Set graph background color. Default is white.
  11738. @item mode
  11739. Set graph mode.
  11740. Available values for mode is:
  11741. @table @samp
  11742. @item bar
  11743. @item dot
  11744. @item line
  11745. @end table
  11746. Default is @code{line}.
  11747. @item slide
  11748. Set slide mode.
  11749. Available values for slide is:
  11750. @table @samp
  11751. @item frame
  11752. Draw new frame when right border is reached.
  11753. @item replace
  11754. Replace old columns with new ones.
  11755. @item scroll
  11756. Scroll from right to left.
  11757. @item rscroll
  11758. Scroll from left to right.
  11759. @item picture
  11760. Draw single picture.
  11761. @end table
  11762. Default is @code{frame}.
  11763. @item size
  11764. Set size of graph video. For the syntax of this option, check the
  11765. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11766. The default value is @code{900x256}.
  11767. The foreground color expressions can use the following variables:
  11768. @table @option
  11769. @item MIN
  11770. Minimal value of metadata value.
  11771. @item MAX
  11772. Maximal value of metadata value.
  11773. @item VAL
  11774. Current metadata key value.
  11775. @end table
  11776. The color is defined as 0xAABBGGRR.
  11777. @end table
  11778. Example using metadata from @ref{signalstats} filter:
  11779. @example
  11780. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  11781. @end example
  11782. Example using metadata from @ref{ebur128} filter:
  11783. @example
  11784. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  11785. @end example
  11786. @anchor{ebur128}
  11787. @section ebur128
  11788. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  11789. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  11790. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  11791. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  11792. The filter also has a video output (see the @var{video} option) with a real
  11793. time graph to observe the loudness evolution. The graphic contains the logged
  11794. message mentioned above, so it is not printed anymore when this option is set,
  11795. unless the verbose logging is set. The main graphing area contains the
  11796. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  11797. the momentary loudness (400 milliseconds).
  11798. More information about the Loudness Recommendation EBU R128 on
  11799. @url{http://tech.ebu.ch/loudness}.
  11800. The filter accepts the following options:
  11801. @table @option
  11802. @item video
  11803. Activate the video output. The audio stream is passed unchanged whether this
  11804. option is set or no. The video stream will be the first output stream if
  11805. activated. Default is @code{0}.
  11806. @item size
  11807. Set the video size. This option is for video only. For the syntax of this
  11808. option, check the
  11809. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11810. Default and minimum resolution is @code{640x480}.
  11811. @item meter
  11812. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  11813. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  11814. other integer value between this range is allowed.
  11815. @item metadata
  11816. Set metadata injection. If set to @code{1}, the audio input will be segmented
  11817. into 100ms output frames, each of them containing various loudness information
  11818. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  11819. Default is @code{0}.
  11820. @item framelog
  11821. Force the frame logging level.
  11822. Available values are:
  11823. @table @samp
  11824. @item info
  11825. information logging level
  11826. @item verbose
  11827. verbose logging level
  11828. @end table
  11829. By default, the logging level is set to @var{info}. If the @option{video} or
  11830. the @option{metadata} options are set, it switches to @var{verbose}.
  11831. @item peak
  11832. Set peak mode(s).
  11833. Available modes can be cumulated (the option is a @code{flag} type). Possible
  11834. values are:
  11835. @table @samp
  11836. @item none
  11837. Disable any peak mode (default).
  11838. @item sample
  11839. Enable sample-peak mode.
  11840. Simple peak mode looking for the higher sample value. It logs a message
  11841. for sample-peak (identified by @code{SPK}).
  11842. @item true
  11843. Enable true-peak mode.
  11844. If enabled, the peak lookup is done on an over-sampled version of the input
  11845. stream for better peak accuracy. It logs a message for true-peak.
  11846. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  11847. This mode requires a build with @code{libswresample}.
  11848. @end table
  11849. @item dualmono
  11850. Treat mono input files as "dual mono". If a mono file is intended for playback
  11851. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  11852. If set to @code{true}, this option will compensate for this effect.
  11853. Multi-channel input files are not affected by this option.
  11854. @item panlaw
  11855. Set a specific pan law to be used for the measurement of dual mono files.
  11856. This parameter is optional, and has a default value of -3.01dB.
  11857. @end table
  11858. @subsection Examples
  11859. @itemize
  11860. @item
  11861. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  11862. @example
  11863. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  11864. @end example
  11865. @item
  11866. Run an analysis with @command{ffmpeg}:
  11867. @example
  11868. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  11869. @end example
  11870. @end itemize
  11871. @section interleave, ainterleave
  11872. Temporally interleave frames from several inputs.
  11873. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  11874. These filters read frames from several inputs and send the oldest
  11875. queued frame to the output.
  11876. Input streams must have a well defined, monotonically increasing frame
  11877. timestamp values.
  11878. In order to submit one frame to output, these filters need to enqueue
  11879. at least one frame for each input, so they cannot work in case one
  11880. input is not yet terminated and will not receive incoming frames.
  11881. For example consider the case when one input is a @code{select} filter
  11882. which always drop input frames. The @code{interleave} filter will keep
  11883. reading from that input, but it will never be able to send new frames
  11884. to output until the input will send an end-of-stream signal.
  11885. Also, depending on inputs synchronization, the filters will drop
  11886. frames in case one input receives more frames than the other ones, and
  11887. the queue is already filled.
  11888. These filters accept the following options:
  11889. @table @option
  11890. @item nb_inputs, n
  11891. Set the number of different inputs, it is 2 by default.
  11892. @end table
  11893. @subsection Examples
  11894. @itemize
  11895. @item
  11896. Interleave frames belonging to different streams using @command{ffmpeg}:
  11897. @example
  11898. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  11899. @end example
  11900. @item
  11901. Add flickering blur effect:
  11902. @example
  11903. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  11904. @end example
  11905. @end itemize
  11906. @section metadata, ametadata
  11907. Manipulate frame metadata.
  11908. This filter accepts the following options:
  11909. @table @option
  11910. @item mode
  11911. Set mode of operation of the filter.
  11912. Can be one of the following:
  11913. @table @samp
  11914. @item select
  11915. If both @code{value} and @code{key} is set, select frames
  11916. which have such metadata. If only @code{key} is set, select
  11917. every frame that has such key in metadata.
  11918. @item add
  11919. Add new metadata @code{key} and @code{value}. If key is already available
  11920. do nothing.
  11921. @item modify
  11922. Modify value of already present key.
  11923. @item delete
  11924. If @code{value} is set, delete only keys that have such value.
  11925. Otherwise, delete key.
  11926. @item print
  11927. Print key and its value if metadata was found. If @code{key} is not set print all
  11928. metadata values available in frame.
  11929. @end table
  11930. @item key
  11931. Set key used with all modes. Must be set for all modes except @code{print}.
  11932. @item value
  11933. Set metadata value which will be used. This option is mandatory for
  11934. @code{modify} and @code{add} mode.
  11935. @item function
  11936. Which function to use when comparing metadata value and @code{value}.
  11937. Can be one of following:
  11938. @table @samp
  11939. @item same_str
  11940. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  11941. @item starts_with
  11942. Values are interpreted as strings, returns true if metadata value starts with
  11943. the @code{value} option string.
  11944. @item less
  11945. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  11946. @item equal
  11947. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  11948. @item greater
  11949. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  11950. @item expr
  11951. Values are interpreted as floats, returns true if expression from option @code{expr}
  11952. evaluates to true.
  11953. @end table
  11954. @item expr
  11955. Set expression which is used when @code{function} is set to @code{expr}.
  11956. The expression is evaluated through the eval API and can contain the following
  11957. constants:
  11958. @table @option
  11959. @item VALUE1
  11960. Float representation of @code{value} from metadata key.
  11961. @item VALUE2
  11962. Float representation of @code{value} as supplied by user in @code{value} option.
  11963. @item file
  11964. If specified in @code{print} mode, output is written to the named file. Instead of
  11965. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  11966. for standard output. If @code{file} option is not set, output is written to the log
  11967. with AV_LOG_INFO loglevel.
  11968. @end table
  11969. @end table
  11970. @subsection Examples
  11971. @itemize
  11972. @item
  11973. Print all metadata values for frames with key @code{lavfi.singnalstats.YDIF} with values
  11974. between 0 and 1.
  11975. @example
  11976. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  11977. @end example
  11978. @item
  11979. Print silencedetect output to file @file{metadata.txt}.
  11980. @example
  11981. silencedetect,ametadata=mode=print:file=metadata.txt
  11982. @end example
  11983. @item
  11984. Direct all metadata to a pipe with file descriptor 4.
  11985. @example
  11986. metadata=mode=print:file='pipe\:4'
  11987. @end example
  11988. @end itemize
  11989. @section perms, aperms
  11990. Set read/write permissions for the output frames.
  11991. These filters are mainly aimed at developers to test direct path in the
  11992. following filter in the filtergraph.
  11993. The filters accept the following options:
  11994. @table @option
  11995. @item mode
  11996. Select the permissions mode.
  11997. It accepts the following values:
  11998. @table @samp
  11999. @item none
  12000. Do nothing. This is the default.
  12001. @item ro
  12002. Set all the output frames read-only.
  12003. @item rw
  12004. Set all the output frames directly writable.
  12005. @item toggle
  12006. Make the frame read-only if writable, and writable if read-only.
  12007. @item random
  12008. Set each output frame read-only or writable randomly.
  12009. @end table
  12010. @item seed
  12011. Set the seed for the @var{random} mode, must be an integer included between
  12012. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  12013. @code{-1}, the filter will try to use a good random seed on a best effort
  12014. basis.
  12015. @end table
  12016. Note: in case of auto-inserted filter between the permission filter and the
  12017. following one, the permission might not be received as expected in that
  12018. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  12019. perms/aperms filter can avoid this problem.
  12020. @section realtime, arealtime
  12021. Slow down filtering to match real time approximatively.
  12022. These filters will pause the filtering for a variable amount of time to
  12023. match the output rate with the input timestamps.
  12024. They are similar to the @option{re} option to @code{ffmpeg}.
  12025. They accept the following options:
  12026. @table @option
  12027. @item limit
  12028. Time limit for the pauses. Any pause longer than that will be considered
  12029. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  12030. @end table
  12031. @section select, aselect
  12032. Select frames to pass in output.
  12033. This filter accepts the following options:
  12034. @table @option
  12035. @item expr, e
  12036. Set expression, which is evaluated for each input frame.
  12037. If the expression is evaluated to zero, the frame is discarded.
  12038. If the evaluation result is negative or NaN, the frame is sent to the
  12039. first output; otherwise it is sent to the output with index
  12040. @code{ceil(val)-1}, assuming that the input index starts from 0.
  12041. For example a value of @code{1.2} corresponds to the output with index
  12042. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  12043. @item outputs, n
  12044. Set the number of outputs. The output to which to send the selected
  12045. frame is based on the result of the evaluation. Default value is 1.
  12046. @end table
  12047. The expression can contain the following constants:
  12048. @table @option
  12049. @item n
  12050. The (sequential) number of the filtered frame, starting from 0.
  12051. @item selected_n
  12052. The (sequential) number of the selected frame, starting from 0.
  12053. @item prev_selected_n
  12054. The sequential number of the last selected frame. It's NAN if undefined.
  12055. @item TB
  12056. The timebase of the input timestamps.
  12057. @item pts
  12058. The PTS (Presentation TimeStamp) of the filtered video frame,
  12059. expressed in @var{TB} units. It's NAN if undefined.
  12060. @item t
  12061. The PTS of the filtered video frame,
  12062. expressed in seconds. It's NAN if undefined.
  12063. @item prev_pts
  12064. The PTS of the previously filtered video frame. It's NAN if undefined.
  12065. @item prev_selected_pts
  12066. The PTS of the last previously filtered video frame. It's NAN if undefined.
  12067. @item prev_selected_t
  12068. The PTS of the last previously selected video frame. It's NAN if undefined.
  12069. @item start_pts
  12070. The PTS of the first video frame in the video. It's NAN if undefined.
  12071. @item start_t
  12072. The time of the first video frame in the video. It's NAN if undefined.
  12073. @item pict_type @emph{(video only)}
  12074. The type of the filtered frame. It can assume one of the following
  12075. values:
  12076. @table @option
  12077. @item I
  12078. @item P
  12079. @item B
  12080. @item S
  12081. @item SI
  12082. @item SP
  12083. @item BI
  12084. @end table
  12085. @item interlace_type @emph{(video only)}
  12086. The frame interlace type. It can assume one of the following values:
  12087. @table @option
  12088. @item PROGRESSIVE
  12089. The frame is progressive (not interlaced).
  12090. @item TOPFIRST
  12091. The frame is top-field-first.
  12092. @item BOTTOMFIRST
  12093. The frame is bottom-field-first.
  12094. @end table
  12095. @item consumed_sample_n @emph{(audio only)}
  12096. the number of selected samples before the current frame
  12097. @item samples_n @emph{(audio only)}
  12098. the number of samples in the current frame
  12099. @item sample_rate @emph{(audio only)}
  12100. the input sample rate
  12101. @item key
  12102. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  12103. @item pos
  12104. the position in the file of the filtered frame, -1 if the information
  12105. is not available (e.g. for synthetic video)
  12106. @item scene @emph{(video only)}
  12107. value between 0 and 1 to indicate a new scene; a low value reflects a low
  12108. probability for the current frame to introduce a new scene, while a higher
  12109. value means the current frame is more likely to be one (see the example below)
  12110. @item concatdec_select
  12111. The concat demuxer can select only part of a concat input file by setting an
  12112. inpoint and an outpoint, but the output packets may not be entirely contained
  12113. in the selected interval. By using this variable, it is possible to skip frames
  12114. generated by the concat demuxer which are not exactly contained in the selected
  12115. interval.
  12116. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  12117. and the @var{lavf.concat.duration} packet metadata values which are also
  12118. present in the decoded frames.
  12119. The @var{concatdec_select} variable is -1 if the frame pts is at least
  12120. start_time and either the duration metadata is missing or the frame pts is less
  12121. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  12122. missing.
  12123. That basically means that an input frame is selected if its pts is within the
  12124. interval set by the concat demuxer.
  12125. @end table
  12126. The default value of the select expression is "1".
  12127. @subsection Examples
  12128. @itemize
  12129. @item
  12130. Select all frames in input:
  12131. @example
  12132. select
  12133. @end example
  12134. The example above is the same as:
  12135. @example
  12136. select=1
  12137. @end example
  12138. @item
  12139. Skip all frames:
  12140. @example
  12141. select=0
  12142. @end example
  12143. @item
  12144. Select only I-frames:
  12145. @example
  12146. select='eq(pict_type\,I)'
  12147. @end example
  12148. @item
  12149. Select one frame every 100:
  12150. @example
  12151. select='not(mod(n\,100))'
  12152. @end example
  12153. @item
  12154. Select only frames contained in the 10-20 time interval:
  12155. @example
  12156. select=between(t\,10\,20)
  12157. @end example
  12158. @item
  12159. Select only I-frames contained in the 10-20 time interval:
  12160. @example
  12161. select=between(t\,10\,20)*eq(pict_type\,I)
  12162. @end example
  12163. @item
  12164. Select frames with a minimum distance of 10 seconds:
  12165. @example
  12166. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  12167. @end example
  12168. @item
  12169. Use aselect to select only audio frames with samples number > 100:
  12170. @example
  12171. aselect='gt(samples_n\,100)'
  12172. @end example
  12173. @item
  12174. Create a mosaic of the first scenes:
  12175. @example
  12176. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  12177. @end example
  12178. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  12179. choice.
  12180. @item
  12181. Send even and odd frames to separate outputs, and compose them:
  12182. @example
  12183. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  12184. @end example
  12185. @item
  12186. Select useful frames from an ffconcat file which is using inpoints and
  12187. outpoints but where the source files are not intra frame only.
  12188. @example
  12189. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  12190. @end example
  12191. @end itemize
  12192. @section sendcmd, asendcmd
  12193. Send commands to filters in the filtergraph.
  12194. These filters read commands to be sent to other filters in the
  12195. filtergraph.
  12196. @code{sendcmd} must be inserted between two video filters,
  12197. @code{asendcmd} must be inserted between two audio filters, but apart
  12198. from that they act the same way.
  12199. The specification of commands can be provided in the filter arguments
  12200. with the @var{commands} option, or in a file specified by the
  12201. @var{filename} option.
  12202. These filters accept the following options:
  12203. @table @option
  12204. @item commands, c
  12205. Set the commands to be read and sent to the other filters.
  12206. @item filename, f
  12207. Set the filename of the commands to be read and sent to the other
  12208. filters.
  12209. @end table
  12210. @subsection Commands syntax
  12211. A commands description consists of a sequence of interval
  12212. specifications, comprising a list of commands to be executed when a
  12213. particular event related to that interval occurs. The occurring event
  12214. is typically the current frame time entering or leaving a given time
  12215. interval.
  12216. An interval is specified by the following syntax:
  12217. @example
  12218. @var{START}[-@var{END}] @var{COMMANDS};
  12219. @end example
  12220. The time interval is specified by the @var{START} and @var{END} times.
  12221. @var{END} is optional and defaults to the maximum time.
  12222. The current frame time is considered within the specified interval if
  12223. it is included in the interval [@var{START}, @var{END}), that is when
  12224. the time is greater or equal to @var{START} and is lesser than
  12225. @var{END}.
  12226. @var{COMMANDS} consists of a sequence of one or more command
  12227. specifications, separated by ",", relating to that interval. The
  12228. syntax of a command specification is given by:
  12229. @example
  12230. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  12231. @end example
  12232. @var{FLAGS} is optional and specifies the type of events relating to
  12233. the time interval which enable sending the specified command, and must
  12234. be a non-null sequence of identifier flags separated by "+" or "|" and
  12235. enclosed between "[" and "]".
  12236. The following flags are recognized:
  12237. @table @option
  12238. @item enter
  12239. The command is sent when the current frame timestamp enters the
  12240. specified interval. In other words, the command is sent when the
  12241. previous frame timestamp was not in the given interval, and the
  12242. current is.
  12243. @item leave
  12244. The command is sent when the current frame timestamp leaves the
  12245. specified interval. In other words, the command is sent when the
  12246. previous frame timestamp was in the given interval, and the
  12247. current is not.
  12248. @end table
  12249. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  12250. assumed.
  12251. @var{TARGET} specifies the target of the command, usually the name of
  12252. the filter class or a specific filter instance name.
  12253. @var{COMMAND} specifies the name of the command for the target filter.
  12254. @var{ARG} is optional and specifies the optional list of argument for
  12255. the given @var{COMMAND}.
  12256. Between one interval specification and another, whitespaces, or
  12257. sequences of characters starting with @code{#} until the end of line,
  12258. are ignored and can be used to annotate comments.
  12259. A simplified BNF description of the commands specification syntax
  12260. follows:
  12261. @example
  12262. @var{COMMAND_FLAG} ::= "enter" | "leave"
  12263. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  12264. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  12265. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  12266. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  12267. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  12268. @end example
  12269. @subsection Examples
  12270. @itemize
  12271. @item
  12272. Specify audio tempo change at second 4:
  12273. @example
  12274. asendcmd=c='4.0 atempo tempo 1.5',atempo
  12275. @end example
  12276. @item
  12277. Specify a list of drawtext and hue commands in a file.
  12278. @example
  12279. # show text in the interval 5-10
  12280. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  12281. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  12282. # desaturate the image in the interval 15-20
  12283. 15.0-20.0 [enter] hue s 0,
  12284. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  12285. [leave] hue s 1,
  12286. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  12287. # apply an exponential saturation fade-out effect, starting from time 25
  12288. 25 [enter] hue s exp(25-t)
  12289. @end example
  12290. A filtergraph allowing to read and process the above command list
  12291. stored in a file @file{test.cmd}, can be specified with:
  12292. @example
  12293. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  12294. @end example
  12295. @end itemize
  12296. @anchor{setpts}
  12297. @section setpts, asetpts
  12298. Change the PTS (presentation timestamp) of the input frames.
  12299. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  12300. This filter accepts the following options:
  12301. @table @option
  12302. @item expr
  12303. The expression which is evaluated for each frame to construct its timestamp.
  12304. @end table
  12305. The expression is evaluated through the eval API and can contain the following
  12306. constants:
  12307. @table @option
  12308. @item FRAME_RATE
  12309. frame rate, only defined for constant frame-rate video
  12310. @item PTS
  12311. The presentation timestamp in input
  12312. @item N
  12313. The count of the input frame for video or the number of consumed samples,
  12314. not including the current frame for audio, starting from 0.
  12315. @item NB_CONSUMED_SAMPLES
  12316. The number of consumed samples, not including the current frame (only
  12317. audio)
  12318. @item NB_SAMPLES, S
  12319. The number of samples in the current frame (only audio)
  12320. @item SAMPLE_RATE, SR
  12321. The audio sample rate.
  12322. @item STARTPTS
  12323. The PTS of the first frame.
  12324. @item STARTT
  12325. the time in seconds of the first frame
  12326. @item INTERLACED
  12327. State whether the current frame is interlaced.
  12328. @item T
  12329. the time in seconds of the current frame
  12330. @item POS
  12331. original position in the file of the frame, or undefined if undefined
  12332. for the current frame
  12333. @item PREV_INPTS
  12334. The previous input PTS.
  12335. @item PREV_INT
  12336. previous input time in seconds
  12337. @item PREV_OUTPTS
  12338. The previous output PTS.
  12339. @item PREV_OUTT
  12340. previous output time in seconds
  12341. @item RTCTIME
  12342. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  12343. instead.
  12344. @item RTCSTART
  12345. The wallclock (RTC) time at the start of the movie in microseconds.
  12346. @item TB
  12347. The timebase of the input timestamps.
  12348. @end table
  12349. @subsection Examples
  12350. @itemize
  12351. @item
  12352. Start counting PTS from zero
  12353. @example
  12354. setpts=PTS-STARTPTS
  12355. @end example
  12356. @item
  12357. Apply fast motion effect:
  12358. @example
  12359. setpts=0.5*PTS
  12360. @end example
  12361. @item
  12362. Apply slow motion effect:
  12363. @example
  12364. setpts=2.0*PTS
  12365. @end example
  12366. @item
  12367. Set fixed rate of 25 frames per second:
  12368. @example
  12369. setpts=N/(25*TB)
  12370. @end example
  12371. @item
  12372. Set fixed rate 25 fps with some jitter:
  12373. @example
  12374. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  12375. @end example
  12376. @item
  12377. Apply an offset of 10 seconds to the input PTS:
  12378. @example
  12379. setpts=PTS+10/TB
  12380. @end example
  12381. @item
  12382. Generate timestamps from a "live source" and rebase onto the current timebase:
  12383. @example
  12384. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  12385. @end example
  12386. @item
  12387. Generate timestamps by counting samples:
  12388. @example
  12389. asetpts=N/SR/TB
  12390. @end example
  12391. @end itemize
  12392. @section settb, asettb
  12393. Set the timebase to use for the output frames timestamps.
  12394. It is mainly useful for testing timebase configuration.
  12395. It accepts the following parameters:
  12396. @table @option
  12397. @item expr, tb
  12398. The expression which is evaluated into the output timebase.
  12399. @end table
  12400. The value for @option{tb} is an arithmetic expression representing a
  12401. rational. The expression can contain the constants "AVTB" (the default
  12402. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  12403. audio only). Default value is "intb".
  12404. @subsection Examples
  12405. @itemize
  12406. @item
  12407. Set the timebase to 1/25:
  12408. @example
  12409. settb=expr=1/25
  12410. @end example
  12411. @item
  12412. Set the timebase to 1/10:
  12413. @example
  12414. settb=expr=0.1
  12415. @end example
  12416. @item
  12417. Set the timebase to 1001/1000:
  12418. @example
  12419. settb=1+0.001
  12420. @end example
  12421. @item
  12422. Set the timebase to 2*intb:
  12423. @example
  12424. settb=2*intb
  12425. @end example
  12426. @item
  12427. Set the default timebase value:
  12428. @example
  12429. settb=AVTB
  12430. @end example
  12431. @end itemize
  12432. @section showcqt
  12433. Convert input audio to a video output representing frequency spectrum
  12434. logarithmically using Brown-Puckette constant Q transform algorithm with
  12435. direct frequency domain coefficient calculation (but the transform itself
  12436. is not really constant Q, instead the Q factor is actually variable/clamped),
  12437. with musical tone scale, from E0 to D#10.
  12438. The filter accepts the following options:
  12439. @table @option
  12440. @item size, s
  12441. Specify the video size for the output. It must be even. For the syntax of this option,
  12442. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12443. Default value is @code{1920x1080}.
  12444. @item fps, rate, r
  12445. Set the output frame rate. Default value is @code{25}.
  12446. @item bar_h
  12447. Set the bargraph height. It must be even. Default value is @code{-1} which
  12448. computes the bargraph height automatically.
  12449. @item axis_h
  12450. Set the axis height. It must be even. Default value is @code{-1} which computes
  12451. the axis height automatically.
  12452. @item sono_h
  12453. Set the sonogram height. It must be even. Default value is @code{-1} which
  12454. computes the sonogram height automatically.
  12455. @item fullhd
  12456. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  12457. instead. Default value is @code{1}.
  12458. @item sono_v, volume
  12459. Specify the sonogram volume expression. It can contain variables:
  12460. @table @option
  12461. @item bar_v
  12462. the @var{bar_v} evaluated expression
  12463. @item frequency, freq, f
  12464. the frequency where it is evaluated
  12465. @item timeclamp, tc
  12466. the value of @var{timeclamp} option
  12467. @end table
  12468. and functions:
  12469. @table @option
  12470. @item a_weighting(f)
  12471. A-weighting of equal loudness
  12472. @item b_weighting(f)
  12473. B-weighting of equal loudness
  12474. @item c_weighting(f)
  12475. C-weighting of equal loudness.
  12476. @end table
  12477. Default value is @code{16}.
  12478. @item bar_v, volume2
  12479. Specify the bargraph volume expression. It can contain variables:
  12480. @table @option
  12481. @item sono_v
  12482. the @var{sono_v} evaluated expression
  12483. @item frequency, freq, f
  12484. the frequency where it is evaluated
  12485. @item timeclamp, tc
  12486. the value of @var{timeclamp} option
  12487. @end table
  12488. and functions:
  12489. @table @option
  12490. @item a_weighting(f)
  12491. A-weighting of equal loudness
  12492. @item b_weighting(f)
  12493. B-weighting of equal loudness
  12494. @item c_weighting(f)
  12495. C-weighting of equal loudness.
  12496. @end table
  12497. Default value is @code{sono_v}.
  12498. @item sono_g, gamma
  12499. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  12500. higher gamma makes the spectrum having more range. Default value is @code{3}.
  12501. Acceptable range is @code{[1, 7]}.
  12502. @item bar_g, gamma2
  12503. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  12504. @code{[1, 7]}.
  12505. @item timeclamp, tc
  12506. Specify the transform timeclamp. At low frequency, there is trade-off between
  12507. accuracy in time domain and frequency domain. If timeclamp is lower,
  12508. event in time domain is represented more accurately (such as fast bass drum),
  12509. otherwise event in frequency domain is represented more accurately
  12510. (such as bass guitar). Acceptable range is @code{[0.1, 1]}. Default value is @code{0.17}.
  12511. @item basefreq
  12512. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  12513. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  12514. @item endfreq
  12515. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  12516. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  12517. @item coeffclamp
  12518. This option is deprecated and ignored.
  12519. @item tlength
  12520. Specify the transform length in time domain. Use this option to control accuracy
  12521. trade-off between time domain and frequency domain at every frequency sample.
  12522. It can contain variables:
  12523. @table @option
  12524. @item frequency, freq, f
  12525. the frequency where it is evaluated
  12526. @item timeclamp, tc
  12527. the value of @var{timeclamp} option.
  12528. @end table
  12529. Default value is @code{384*tc/(384+tc*f)}.
  12530. @item count
  12531. Specify the transform count for every video frame. Default value is @code{6}.
  12532. Acceptable range is @code{[1, 30]}.
  12533. @item fcount
  12534. Specify the transform count for every single pixel. Default value is @code{0},
  12535. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  12536. @item fontfile
  12537. Specify font file for use with freetype to draw the axis. If not specified,
  12538. use embedded font. Note that drawing with font file or embedded font is not
  12539. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  12540. option instead.
  12541. @item fontcolor
  12542. Specify font color expression. This is arithmetic expression that should return
  12543. integer value 0xRRGGBB. It can contain variables:
  12544. @table @option
  12545. @item frequency, freq, f
  12546. the frequency where it is evaluated
  12547. @item timeclamp, tc
  12548. the value of @var{timeclamp} option
  12549. @end table
  12550. and functions:
  12551. @table @option
  12552. @item midi(f)
  12553. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  12554. @item r(x), g(x), b(x)
  12555. red, green, and blue value of intensity x.
  12556. @end table
  12557. Default value is @code{st(0, (midi(f)-59.5)/12);
  12558. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  12559. r(1-ld(1)) + b(ld(1))}.
  12560. @item axisfile
  12561. Specify image file to draw the axis. This option override @var{fontfile} and
  12562. @var{fontcolor} option.
  12563. @item axis, text
  12564. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  12565. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  12566. Default value is @code{1}.
  12567. @end table
  12568. @subsection Examples
  12569. @itemize
  12570. @item
  12571. Playing audio while showing the spectrum:
  12572. @example
  12573. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  12574. @end example
  12575. @item
  12576. Same as above, but with frame rate 30 fps:
  12577. @example
  12578. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  12579. @end example
  12580. @item
  12581. Playing at 1280x720:
  12582. @example
  12583. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  12584. @end example
  12585. @item
  12586. Disable sonogram display:
  12587. @example
  12588. sono_h=0
  12589. @end example
  12590. @item
  12591. A1 and its harmonics: A1, A2, (near)E3, A3:
  12592. @example
  12593. 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),
  12594. asplit[a][out1]; [a] showcqt [out0]'
  12595. @end example
  12596. @item
  12597. Same as above, but with more accuracy in frequency domain:
  12598. @example
  12599. 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),
  12600. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  12601. @end example
  12602. @item
  12603. Custom volume:
  12604. @example
  12605. bar_v=10:sono_v=bar_v*a_weighting(f)
  12606. @end example
  12607. @item
  12608. Custom gamma, now spectrum is linear to the amplitude.
  12609. @example
  12610. bar_g=2:sono_g=2
  12611. @end example
  12612. @item
  12613. Custom tlength equation:
  12614. @example
  12615. 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)))'
  12616. @end example
  12617. @item
  12618. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  12619. @example
  12620. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  12621. @end example
  12622. @item
  12623. Custom frequency range with custom axis using image file:
  12624. @example
  12625. axisfile=myaxis.png:basefreq=40:endfreq=10000
  12626. @end example
  12627. @end itemize
  12628. @section showfreqs
  12629. Convert input audio to video output representing the audio power spectrum.
  12630. Audio amplitude is on Y-axis while frequency is on X-axis.
  12631. The filter accepts the following options:
  12632. @table @option
  12633. @item size, s
  12634. Specify size of video. For the syntax of this option, check the
  12635. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12636. Default is @code{1024x512}.
  12637. @item mode
  12638. Set display mode.
  12639. This set how each frequency bin will be represented.
  12640. It accepts the following values:
  12641. @table @samp
  12642. @item line
  12643. @item bar
  12644. @item dot
  12645. @end table
  12646. Default is @code{bar}.
  12647. @item ascale
  12648. Set amplitude scale.
  12649. It accepts the following values:
  12650. @table @samp
  12651. @item lin
  12652. Linear scale.
  12653. @item sqrt
  12654. Square root scale.
  12655. @item cbrt
  12656. Cubic root scale.
  12657. @item log
  12658. Logarithmic scale.
  12659. @end table
  12660. Default is @code{log}.
  12661. @item fscale
  12662. Set frequency scale.
  12663. It accepts the following values:
  12664. @table @samp
  12665. @item lin
  12666. Linear scale.
  12667. @item log
  12668. Logarithmic scale.
  12669. @item rlog
  12670. Reverse logarithmic scale.
  12671. @end table
  12672. Default is @code{lin}.
  12673. @item win_size
  12674. Set window size.
  12675. It accepts the following values:
  12676. @table @samp
  12677. @item w16
  12678. @item w32
  12679. @item w64
  12680. @item w128
  12681. @item w256
  12682. @item w512
  12683. @item w1024
  12684. @item w2048
  12685. @item w4096
  12686. @item w8192
  12687. @item w16384
  12688. @item w32768
  12689. @item w65536
  12690. @end table
  12691. Default is @code{w2048}
  12692. @item win_func
  12693. Set windowing function.
  12694. It accepts the following values:
  12695. @table @samp
  12696. @item rect
  12697. @item bartlett
  12698. @item hanning
  12699. @item hamming
  12700. @item blackman
  12701. @item welch
  12702. @item flattop
  12703. @item bharris
  12704. @item bnuttall
  12705. @item bhann
  12706. @item sine
  12707. @item nuttall
  12708. @item lanczos
  12709. @item gauss
  12710. @item tukey
  12711. @item dolph
  12712. @item cauchy
  12713. @item parzen
  12714. @item poisson
  12715. @end table
  12716. Default is @code{hanning}.
  12717. @item overlap
  12718. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  12719. which means optimal overlap for selected window function will be picked.
  12720. @item averaging
  12721. Set time averaging. Setting this to 0 will display current maximal peaks.
  12722. Default is @code{1}, which means time averaging is disabled.
  12723. @item colors
  12724. Specify list of colors separated by space or by '|' which will be used to
  12725. draw channel frequencies. Unrecognized or missing colors will be replaced
  12726. by white color.
  12727. @item cmode
  12728. Set channel display mode.
  12729. It accepts the following values:
  12730. @table @samp
  12731. @item combined
  12732. @item separate
  12733. @end table
  12734. Default is @code{combined}.
  12735. @item minamp
  12736. Set minimum amplitude used in @code{log} amplitude scaler.
  12737. @end table
  12738. @anchor{showspectrum}
  12739. @section showspectrum
  12740. Convert input audio to a video output, representing the audio frequency
  12741. spectrum.
  12742. The filter accepts the following options:
  12743. @table @option
  12744. @item size, s
  12745. Specify the video size for the output. For the syntax of this option, check the
  12746. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12747. Default value is @code{640x512}.
  12748. @item slide
  12749. Specify how the spectrum should slide along the window.
  12750. It accepts the following values:
  12751. @table @samp
  12752. @item replace
  12753. the samples start again on the left when they reach the right
  12754. @item scroll
  12755. the samples scroll from right to left
  12756. @item rscroll
  12757. the samples scroll from left to right
  12758. @item fullframe
  12759. frames are only produced when the samples reach the right
  12760. @end table
  12761. Default value is @code{replace}.
  12762. @item mode
  12763. Specify display mode.
  12764. It accepts the following values:
  12765. @table @samp
  12766. @item combined
  12767. all channels are displayed in the same row
  12768. @item separate
  12769. all channels are displayed in separate rows
  12770. @end table
  12771. Default value is @samp{combined}.
  12772. @item color
  12773. Specify display color mode.
  12774. It accepts the following values:
  12775. @table @samp
  12776. @item channel
  12777. each channel is displayed in a separate color
  12778. @item intensity
  12779. each channel is displayed using the same color scheme
  12780. @item rainbow
  12781. each channel is displayed using the rainbow color scheme
  12782. @item moreland
  12783. each channel is displayed using the moreland color scheme
  12784. @item nebulae
  12785. each channel is displayed using the nebulae color scheme
  12786. @item fire
  12787. each channel is displayed using the fire color scheme
  12788. @item fiery
  12789. each channel is displayed using the fiery color scheme
  12790. @item fruit
  12791. each channel is displayed using the fruit color scheme
  12792. @item cool
  12793. each channel is displayed using the cool color scheme
  12794. @end table
  12795. Default value is @samp{channel}.
  12796. @item scale
  12797. Specify scale used for calculating intensity color values.
  12798. It accepts the following values:
  12799. @table @samp
  12800. @item lin
  12801. linear
  12802. @item sqrt
  12803. square root, default
  12804. @item cbrt
  12805. cubic root
  12806. @item 4thrt
  12807. 4th root
  12808. @item 5thrt
  12809. 5th root
  12810. @item log
  12811. logarithmic
  12812. @end table
  12813. Default value is @samp{sqrt}.
  12814. @item saturation
  12815. Set saturation modifier for displayed colors. Negative values provide
  12816. alternative color scheme. @code{0} is no saturation at all.
  12817. Saturation must be in [-10.0, 10.0] range.
  12818. Default value is @code{1}.
  12819. @item win_func
  12820. Set window function.
  12821. It accepts the following values:
  12822. @table @samp
  12823. @item rect
  12824. @item bartlett
  12825. @item hann
  12826. @item hanning
  12827. @item hamming
  12828. @item blackman
  12829. @item welch
  12830. @item flattop
  12831. @item bharris
  12832. @item bnuttall
  12833. @item bhann
  12834. @item sine
  12835. @item nuttall
  12836. @item lanczos
  12837. @item gauss
  12838. @item tukey
  12839. @item dolph
  12840. @item cauchy
  12841. @item parzen
  12842. @item poisson
  12843. @end table
  12844. Default value is @code{hann}.
  12845. @item orientation
  12846. Set orientation of time vs frequency axis. Can be @code{vertical} or
  12847. @code{horizontal}. Default is @code{vertical}.
  12848. @item overlap
  12849. Set ratio of overlap window. Default value is @code{0}.
  12850. When value is @code{1} overlap is set to recommended size for specific
  12851. window function currently used.
  12852. @item gain
  12853. Set scale gain for calculating intensity color values.
  12854. Default value is @code{1}.
  12855. @item data
  12856. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  12857. @item rotation
  12858. Set color rotation, must be in [-1.0, 1.0] range.
  12859. Default value is @code{0}.
  12860. @end table
  12861. The usage is very similar to the showwaves filter; see the examples in that
  12862. section.
  12863. @subsection Examples
  12864. @itemize
  12865. @item
  12866. Large window with logarithmic color scaling:
  12867. @example
  12868. showspectrum=s=1280x480:scale=log
  12869. @end example
  12870. @item
  12871. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  12872. @example
  12873. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  12874. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  12875. @end example
  12876. @end itemize
  12877. @section showspectrumpic
  12878. Convert input audio to a single video frame, representing the audio frequency
  12879. spectrum.
  12880. The filter accepts the following options:
  12881. @table @option
  12882. @item size, s
  12883. Specify the video size for the output. For the syntax of this option, check the
  12884. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12885. Default value is @code{4096x2048}.
  12886. @item mode
  12887. Specify display mode.
  12888. It accepts the following values:
  12889. @table @samp
  12890. @item combined
  12891. all channels are displayed in the same row
  12892. @item separate
  12893. all channels are displayed in separate rows
  12894. @end table
  12895. Default value is @samp{combined}.
  12896. @item color
  12897. Specify display color mode.
  12898. It accepts the following values:
  12899. @table @samp
  12900. @item channel
  12901. each channel is displayed in a separate color
  12902. @item intensity
  12903. each channel is displayed using the same color scheme
  12904. @item rainbow
  12905. each channel is displayed using the rainbow color scheme
  12906. @item moreland
  12907. each channel is displayed using the moreland color scheme
  12908. @item nebulae
  12909. each channel is displayed using the nebulae color scheme
  12910. @item fire
  12911. each channel is displayed using the fire color scheme
  12912. @item fiery
  12913. each channel is displayed using the fiery color scheme
  12914. @item fruit
  12915. each channel is displayed using the fruit color scheme
  12916. @item cool
  12917. each channel is displayed using the cool color scheme
  12918. @end table
  12919. Default value is @samp{intensity}.
  12920. @item scale
  12921. Specify scale used for calculating intensity color values.
  12922. It accepts the following values:
  12923. @table @samp
  12924. @item lin
  12925. linear
  12926. @item sqrt
  12927. square root, default
  12928. @item cbrt
  12929. cubic root
  12930. @item 4thrt
  12931. 4th root
  12932. @item 5thrt
  12933. 5th root
  12934. @item log
  12935. logarithmic
  12936. @end table
  12937. Default value is @samp{log}.
  12938. @item saturation
  12939. Set saturation modifier for displayed colors. Negative values provide
  12940. alternative color scheme. @code{0} is no saturation at all.
  12941. Saturation must be in [-10.0, 10.0] range.
  12942. Default value is @code{1}.
  12943. @item win_func
  12944. Set window function.
  12945. It accepts the following values:
  12946. @table @samp
  12947. @item rect
  12948. @item bartlett
  12949. @item hann
  12950. @item hanning
  12951. @item hamming
  12952. @item blackman
  12953. @item welch
  12954. @item flattop
  12955. @item bharris
  12956. @item bnuttall
  12957. @item bhann
  12958. @item sine
  12959. @item nuttall
  12960. @item lanczos
  12961. @item gauss
  12962. @item tukey
  12963. @item dolph
  12964. @item cauchy
  12965. @item parzen
  12966. @item poisson
  12967. @end table
  12968. Default value is @code{hann}.
  12969. @item orientation
  12970. Set orientation of time vs frequency axis. Can be @code{vertical} or
  12971. @code{horizontal}. Default is @code{vertical}.
  12972. @item gain
  12973. Set scale gain for calculating intensity color values.
  12974. Default value is @code{1}.
  12975. @item legend
  12976. Draw time and frequency axes and legends. Default is enabled.
  12977. @item rotation
  12978. Set color rotation, must be in [-1.0, 1.0] range.
  12979. Default value is @code{0}.
  12980. @end table
  12981. @subsection Examples
  12982. @itemize
  12983. @item
  12984. Extract an audio spectrogram of a whole audio track
  12985. in a 1024x1024 picture using @command{ffmpeg}:
  12986. @example
  12987. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  12988. @end example
  12989. @end itemize
  12990. @section showvolume
  12991. Convert input audio volume to a video output.
  12992. The filter accepts the following options:
  12993. @table @option
  12994. @item rate, r
  12995. Set video rate.
  12996. @item b
  12997. Set border width, allowed range is [0, 5]. Default is 1.
  12998. @item w
  12999. Set channel width, allowed range is [80, 8192]. Default is 400.
  13000. @item h
  13001. Set channel height, allowed range is [1, 900]. Default is 20.
  13002. @item f
  13003. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  13004. @item c
  13005. Set volume color expression.
  13006. The expression can use the following variables:
  13007. @table @option
  13008. @item VOLUME
  13009. Current max volume of channel in dB.
  13010. @item PEAK
  13011. Current peak.
  13012. @item CHANNEL
  13013. Current channel number, starting from 0.
  13014. @end table
  13015. @item t
  13016. If set, displays channel names. Default is enabled.
  13017. @item v
  13018. If set, displays volume values. Default is enabled.
  13019. @item o
  13020. Set orientation, can be @code{horizontal} or @code{vertical},
  13021. default is @code{horizontal}.
  13022. @item s
  13023. Set step size, allowed range s [0, 5]. Default is 0, which means
  13024. step is disabled.
  13025. @end table
  13026. @section showwaves
  13027. Convert input audio to a video output, representing the samples waves.
  13028. The filter accepts the following options:
  13029. @table @option
  13030. @item size, s
  13031. Specify the video size for the output. For the syntax of this option, check the
  13032. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13033. Default value is @code{600x240}.
  13034. @item mode
  13035. Set display mode.
  13036. Available values are:
  13037. @table @samp
  13038. @item point
  13039. Draw a point for each sample.
  13040. @item line
  13041. Draw a vertical line for each sample.
  13042. @item p2p
  13043. Draw a point for each sample and a line between them.
  13044. @item cline
  13045. Draw a centered vertical line for each sample.
  13046. @end table
  13047. Default value is @code{point}.
  13048. @item n
  13049. Set the number of samples which are printed on the same column. A
  13050. larger value will decrease the frame rate. Must be a positive
  13051. integer. This option can be set only if the value for @var{rate}
  13052. is not explicitly specified.
  13053. @item rate, r
  13054. Set the (approximate) output frame rate. This is done by setting the
  13055. option @var{n}. Default value is "25".
  13056. @item split_channels
  13057. Set if channels should be drawn separately or overlap. Default value is 0.
  13058. @item colors
  13059. Set colors separated by '|' which are going to be used for drawing of each channel.
  13060. @item scale
  13061. Set amplitude scale.
  13062. Available values are:
  13063. @table @samp
  13064. @item lin
  13065. Linear.
  13066. @item log
  13067. Logarithmic.
  13068. @item sqrt
  13069. Square root.
  13070. @item cbrt
  13071. Cubic root.
  13072. @end table
  13073. Default is linear.
  13074. @end table
  13075. @subsection Examples
  13076. @itemize
  13077. @item
  13078. Output the input file audio and the corresponding video representation
  13079. at the same time:
  13080. @example
  13081. amovie=a.mp3,asplit[out0],showwaves[out1]
  13082. @end example
  13083. @item
  13084. Create a synthetic signal and show it with showwaves, forcing a
  13085. frame rate of 30 frames per second:
  13086. @example
  13087. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  13088. @end example
  13089. @end itemize
  13090. @section showwavespic
  13091. Convert input audio to a single video frame, representing the samples waves.
  13092. The filter accepts the following options:
  13093. @table @option
  13094. @item size, s
  13095. Specify the video size for the output. For the syntax of this option, check the
  13096. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13097. Default value is @code{600x240}.
  13098. @item split_channels
  13099. Set if channels should be drawn separately or overlap. Default value is 0.
  13100. @item colors
  13101. Set colors separated by '|' which are going to be used for drawing of each channel.
  13102. @item scale
  13103. Set amplitude scale. Can be linear @code{lin} or logarithmic @code{log}.
  13104. Default is linear.
  13105. @end table
  13106. @subsection Examples
  13107. @itemize
  13108. @item
  13109. Extract a channel split representation of the wave form of a whole audio track
  13110. in a 1024x800 picture using @command{ffmpeg}:
  13111. @example
  13112. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  13113. @end example
  13114. @end itemize
  13115. @section spectrumsynth
  13116. Sythesize audio from 2 input video spectrums, first input stream represents
  13117. magnitude across time and second represents phase across time.
  13118. The filter will transform from frequency domain as displayed in videos back
  13119. to time domain as presented in audio output.
  13120. This filter is primarly created for reversing processed @ref{showspectrum}
  13121. filter outputs, but can synthesize sound from other spectrograms too.
  13122. But in such case results are going to be poor if the phase data is not
  13123. available, because in such cases phase data need to be recreated, usually
  13124. its just recreated from random noise.
  13125. For best results use gray only output (@code{channel} color mode in
  13126. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  13127. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  13128. @code{data} option. Inputs videos should generally use @code{fullframe}
  13129. slide mode as that saves resources needed for decoding video.
  13130. The filter accepts the following options:
  13131. @table @option
  13132. @item sample_rate
  13133. Specify sample rate of output audio, the sample rate of audio from which
  13134. spectrum was generated may differ.
  13135. @item channels
  13136. Set number of channels represented in input video spectrums.
  13137. @item scale
  13138. Set scale which was used when generating magnitude input spectrum.
  13139. Can be @code{lin} or @code{log}. Default is @code{log}.
  13140. @item slide
  13141. Set slide which was used when generating inputs spectrums.
  13142. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  13143. Default is @code{fullframe}.
  13144. @item win_func
  13145. Set window function used for resynthesis.
  13146. @item overlap
  13147. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  13148. which means optimal overlap for selected window function will be picked.
  13149. @item orientation
  13150. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  13151. Default is @code{vertical}.
  13152. @end table
  13153. @subsection Examples
  13154. @itemize
  13155. @item
  13156. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  13157. then resynthesize videos back to audio with spectrumsynth:
  13158. @example
  13159. 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
  13160. 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
  13161. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  13162. @end example
  13163. @end itemize
  13164. @section split, asplit
  13165. Split input into several identical outputs.
  13166. @code{asplit} works with audio input, @code{split} with video.
  13167. The filter accepts a single parameter which specifies the number of outputs. If
  13168. unspecified, it defaults to 2.
  13169. @subsection Examples
  13170. @itemize
  13171. @item
  13172. Create two separate outputs from the same input:
  13173. @example
  13174. [in] split [out0][out1]
  13175. @end example
  13176. @item
  13177. To create 3 or more outputs, you need to specify the number of
  13178. outputs, like in:
  13179. @example
  13180. [in] asplit=3 [out0][out1][out2]
  13181. @end example
  13182. @item
  13183. Create two separate outputs from the same input, one cropped and
  13184. one padded:
  13185. @example
  13186. [in] split [splitout1][splitout2];
  13187. [splitout1] crop=100:100:0:0 [cropout];
  13188. [splitout2] pad=200:200:100:100 [padout];
  13189. @end example
  13190. @item
  13191. Create 5 copies of the input audio with @command{ffmpeg}:
  13192. @example
  13193. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  13194. @end example
  13195. @end itemize
  13196. @section zmq, azmq
  13197. Receive commands sent through a libzmq client, and forward them to
  13198. filters in the filtergraph.
  13199. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  13200. must be inserted between two video filters, @code{azmq} between two
  13201. audio filters.
  13202. To enable these filters you need to install the libzmq library and
  13203. headers and configure FFmpeg with @code{--enable-libzmq}.
  13204. For more information about libzmq see:
  13205. @url{http://www.zeromq.org/}
  13206. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  13207. receives messages sent through a network interface defined by the
  13208. @option{bind_address} option.
  13209. The received message must be in the form:
  13210. @example
  13211. @var{TARGET} @var{COMMAND} [@var{ARG}]
  13212. @end example
  13213. @var{TARGET} specifies the target of the command, usually the name of
  13214. the filter class or a specific filter instance name.
  13215. @var{COMMAND} specifies the name of the command for the target filter.
  13216. @var{ARG} is optional and specifies the optional argument list for the
  13217. given @var{COMMAND}.
  13218. Upon reception, the message is processed and the corresponding command
  13219. is injected into the filtergraph. Depending on the result, the filter
  13220. will send a reply to the client, adopting the format:
  13221. @example
  13222. @var{ERROR_CODE} @var{ERROR_REASON}
  13223. @var{MESSAGE}
  13224. @end example
  13225. @var{MESSAGE} is optional.
  13226. @subsection Examples
  13227. Look at @file{tools/zmqsend} for an example of a zmq client which can
  13228. be used to send commands processed by these filters.
  13229. Consider the following filtergraph generated by @command{ffplay}
  13230. @example
  13231. ffplay -dumpgraph 1 -f lavfi "
  13232. color=s=100x100:c=red [l];
  13233. color=s=100x100:c=blue [r];
  13234. nullsrc=s=200x100, zmq [bg];
  13235. [bg][l] overlay [bg+l];
  13236. [bg+l][r] overlay=x=100 "
  13237. @end example
  13238. To change the color of the left side of the video, the following
  13239. command can be used:
  13240. @example
  13241. echo Parsed_color_0 c yellow | tools/zmqsend
  13242. @end example
  13243. To change the right side:
  13244. @example
  13245. echo Parsed_color_1 c pink | tools/zmqsend
  13246. @end example
  13247. @c man end MULTIMEDIA FILTERS
  13248. @chapter Multimedia Sources
  13249. @c man begin MULTIMEDIA SOURCES
  13250. Below is a description of the currently available multimedia sources.
  13251. @section amovie
  13252. This is the same as @ref{movie} source, except it selects an audio
  13253. stream by default.
  13254. @anchor{movie}
  13255. @section movie
  13256. Read audio and/or video stream(s) from a movie container.
  13257. It accepts the following parameters:
  13258. @table @option
  13259. @item filename
  13260. The name of the resource to read (not necessarily a file; it can also be a
  13261. device or a stream accessed through some protocol).
  13262. @item format_name, f
  13263. Specifies the format assumed for the movie to read, and can be either
  13264. the name of a container or an input device. If not specified, the
  13265. format is guessed from @var{movie_name} or by probing.
  13266. @item seek_point, sp
  13267. Specifies the seek point in seconds. The frames will be output
  13268. starting from this seek point. The parameter is evaluated with
  13269. @code{av_strtod}, so the numerical value may be suffixed by an IS
  13270. postfix. The default value is "0".
  13271. @item streams, s
  13272. Specifies the streams to read. Several streams can be specified,
  13273. separated by "+". The source will then have as many outputs, in the
  13274. same order. The syntax is explained in the ``Stream specifiers''
  13275. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  13276. respectively the default (best suited) video and audio stream. Default
  13277. is "dv", or "da" if the filter is called as "amovie".
  13278. @item stream_index, si
  13279. Specifies the index of the video stream to read. If the value is -1,
  13280. the most suitable video stream will be automatically selected. The default
  13281. value is "-1". Deprecated. If the filter is called "amovie", it will select
  13282. audio instead of video.
  13283. @item loop
  13284. Specifies how many times to read the stream in sequence.
  13285. If the value is less than 1, the stream will be read again and again.
  13286. Default value is "1".
  13287. Note that when the movie is looped the source timestamps are not
  13288. changed, so it will generate non monotonically increasing timestamps.
  13289. @item discontinuity
  13290. Specifies the time difference between frames above which the point is
  13291. considered a timestamp discontinuity which is removed by adjusting the later
  13292. timestamps.
  13293. @end table
  13294. It allows overlaying a second video on top of the main input of
  13295. a filtergraph, as shown in this graph:
  13296. @example
  13297. input -----------> deltapts0 --> overlay --> output
  13298. ^
  13299. |
  13300. movie --> scale--> deltapts1 -------+
  13301. @end example
  13302. @subsection Examples
  13303. @itemize
  13304. @item
  13305. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  13306. on top of the input labelled "in":
  13307. @example
  13308. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  13309. [in] setpts=PTS-STARTPTS [main];
  13310. [main][over] overlay=16:16 [out]
  13311. @end example
  13312. @item
  13313. Read from a video4linux2 device, and overlay it on top of the input
  13314. labelled "in":
  13315. @example
  13316. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  13317. [in] setpts=PTS-STARTPTS [main];
  13318. [main][over] overlay=16:16 [out]
  13319. @end example
  13320. @item
  13321. Read the first video stream and the audio stream with id 0x81 from
  13322. dvd.vob; the video is connected to the pad named "video" and the audio is
  13323. connected to the pad named "audio":
  13324. @example
  13325. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  13326. @end example
  13327. @end itemize
  13328. @subsection Commands
  13329. Both movie and amovie support the following commands:
  13330. @table @option
  13331. @item seek
  13332. Perform seek using "av_seek_frame".
  13333. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  13334. @itemize
  13335. @item
  13336. @var{stream_index}: If stream_index is -1, a default
  13337. stream is selected, and @var{timestamp} is automatically converted
  13338. from AV_TIME_BASE units to the stream specific time_base.
  13339. @item
  13340. @var{timestamp}: Timestamp in AVStream.time_base units
  13341. or, if no stream is specified, in AV_TIME_BASE units.
  13342. @item
  13343. @var{flags}: Flags which select direction and seeking mode.
  13344. @end itemize
  13345. @item get_duration
  13346. Get movie duration in AV_TIME_BASE units.
  13347. @end table
  13348. @c man end MULTIMEDIA SOURCES