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.

20383 lines
540KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @section Notes on filtergraph escaping
  181. Filtergraph description composition entails several levels of
  182. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  183. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  184. information about the employed escaping procedure.
  185. A first level escaping affects the content of each filter option
  186. value, which may contain the special character @code{:} used to
  187. separate values, or one of the escaping characters @code{\'}.
  188. A second level escaping affects the whole filter description, which
  189. may contain the escaping characters @code{\'} or the special
  190. characters @code{[],;} used by the filtergraph description.
  191. Finally, when you specify a filtergraph on a shell commandline, you
  192. need to perform a third level escaping for the shell special
  193. characters contained within it.
  194. For example, consider the following string to be embedded in
  195. the @ref{drawtext} filter description @option{text} value:
  196. @example
  197. this is a 'string': may contain one, or more, special characters
  198. @end example
  199. This string contains the @code{'} special escaping character, and the
  200. @code{:} special character, so it needs to be escaped in this way:
  201. @example
  202. text=this is a \'string\'\: may contain one, or more, special characters
  203. @end example
  204. A second level of escaping is required when embedding the filter
  205. description in a filtergraph description, in order to escape all the
  206. filtergraph special characters. Thus the example above becomes:
  207. @example
  208. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  209. @end example
  210. (note that in addition to the @code{\'} escaping special characters,
  211. also @code{,} needs to be escaped).
  212. Finally an additional level of escaping is needed when writing the
  213. filtergraph description in a shell command, which depends on the
  214. escaping rules of the adopted shell. For example, assuming that
  215. @code{\} is special and needs to be escaped with another @code{\}, the
  216. previous string will finally result in:
  217. @example
  218. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  219. @end example
  220. @chapter Timeline editing
  221. Some filters support a generic @option{enable} option. For the filters
  222. supporting timeline editing, this option can be set to an expression which is
  223. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  224. the filter will be enabled, otherwise the frame will be sent unchanged to the
  225. next filter in the filtergraph.
  226. The expression accepts the following values:
  227. @table @samp
  228. @item t
  229. timestamp expressed in seconds, NAN if the input timestamp is unknown
  230. @item n
  231. sequential number of the input frame, starting from 0
  232. @item pos
  233. the position in the file of the input frame, NAN if unknown
  234. @item w
  235. @item h
  236. width and height of the input frame if video
  237. @end table
  238. Additionally, these filters support an @option{enable} command that can be used
  239. to re-define the expression.
  240. Like any other filtering option, the @option{enable} option follows the same
  241. rules.
  242. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  243. minutes, and a @ref{curves} filter starting at 3 seconds:
  244. @example
  245. smartblur = enable='between(t,10,3*60)',
  246. curves = enable='gte(t,3)' : preset=cross_process
  247. @end example
  248. See @code{ffmpeg -filters} to view which filters have timeline support.
  249. @c man end FILTERGRAPH DESCRIPTION
  250. @anchor{framesync}
  251. @chapter Options for filters with several inputs (framesync)
  252. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  253. Some filters with several inputs support a common set of options.
  254. These options can only be set by name, not with the short notation.
  255. @table @option
  256. @item eof_action
  257. The action to take when EOF is encountered on the secondary input; it accepts
  258. one of the following values:
  259. @table @option
  260. @item repeat
  261. Repeat the last frame (the default).
  262. @item endall
  263. End both streams.
  264. @item pass
  265. Pass the main input through.
  266. @end table
  267. @item shortest
  268. If set to 1, force the output to terminate when the shortest input
  269. terminates. Default value is 0.
  270. @item repeatlast
  271. If set to 1, force the filter to extend the last frame of secondary streams
  272. until the end of the primary stream. A value of 0 disables this behavior.
  273. Default value is 1.
  274. @end table
  275. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  276. @chapter Audio Filters
  277. @c man begin AUDIO FILTERS
  278. When you configure your FFmpeg build, you can disable any of the
  279. existing filters using @code{--disable-filters}.
  280. The configure output will show the audio filters included in your
  281. build.
  282. Below is a description of the currently available audio filters.
  283. @section acompressor
  284. A compressor is mainly used to reduce the dynamic range of a signal.
  285. Especially modern music is mostly compressed at a high ratio to
  286. improve the overall loudness. It's done to get the highest attention
  287. of a listener, "fatten" the sound and bring more "power" to the track.
  288. If a signal is compressed too much it may sound dull or "dead"
  289. afterwards or it may start to "pump" (which could be a powerful effect
  290. but can also destroy a track completely).
  291. The right compression is the key to reach a professional sound and is
  292. the high art of mixing and mastering. Because of its complex settings
  293. it may take a long time to get the right feeling for this kind of effect.
  294. Compression is done by detecting the volume above a chosen level
  295. @code{threshold} and dividing it by the factor set with @code{ratio}.
  296. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  297. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  298. the signal would cause distortion of the waveform the reduction can be
  299. levelled over the time. This is done by setting "Attack" and "Release".
  300. @code{attack} determines how long the signal has to rise above the threshold
  301. before any reduction will occur and @code{release} sets the time the signal
  302. has to fall below the threshold to reduce the reduction again. Shorter signals
  303. than the chosen attack time will be left untouched.
  304. The overall reduction of the signal can be made up afterwards with the
  305. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  306. raising the makeup to this level results in a signal twice as loud than the
  307. source. To gain a softer entry in the compression the @code{knee} flattens the
  308. hard edge at the threshold in the range of the chosen decibels.
  309. The filter accepts the following options:
  310. @table @option
  311. @item level_in
  312. Set input gain. Default is 1. Range is between 0.015625 and 64.
  313. @item threshold
  314. If a signal of stream rises above this level it will affect the gain
  315. reduction.
  316. By default it is 0.125. Range is between 0.00097563 and 1.
  317. @item ratio
  318. Set a ratio by which the signal is reduced. 1:2 means that if the level
  319. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  320. Default is 2. Range is between 1 and 20.
  321. @item attack
  322. Amount of milliseconds the signal has to rise above the threshold before gain
  323. reduction starts. Default is 20. Range is between 0.01 and 2000.
  324. @item release
  325. Amount of milliseconds the signal has to fall below the threshold before
  326. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  327. @item makeup
  328. Set the amount by how much signal will be amplified after processing.
  329. Default is 1. Range is from 1 to 64.
  330. @item knee
  331. Curve the sharp knee around the threshold to enter gain reduction more softly.
  332. Default is 2.82843. Range is between 1 and 8.
  333. @item link
  334. Choose if the @code{average} level between all channels of input stream
  335. or the louder(@code{maximum}) channel of input stream affects the
  336. reduction. Default is @code{average}.
  337. @item detection
  338. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  339. of @code{rms}. Default is @code{rms} which is mostly smoother.
  340. @item mix
  341. How much to use compressed signal in output. Default is 1.
  342. Range is between 0 and 1.
  343. @end table
  344. @section acontrast
  345. Simple audio dynamic range commpression/expansion filter.
  346. The filter accepts the following options:
  347. @table @option
  348. @item contrast
  349. Set contrast. Default is 33. Allowed range is between 0 and 100.
  350. @end table
  351. @section acopy
  352. Copy the input audio source unchanged to the output. This is mainly useful for
  353. testing purposes.
  354. @section acrossfade
  355. Apply cross fade from one input audio stream to another input audio stream.
  356. The cross fade is applied for specified duration near the end of first stream.
  357. The filter accepts the following options:
  358. @table @option
  359. @item nb_samples, ns
  360. Specify the number of samples for which the cross fade effect has to last.
  361. At the end of the cross fade effect the first input audio will be completely
  362. silent. Default is 44100.
  363. @item duration, d
  364. Specify the duration of the cross fade effect. See
  365. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  366. for the accepted syntax.
  367. By default the duration is determined by @var{nb_samples}.
  368. If set this option is used instead of @var{nb_samples}.
  369. @item overlap, o
  370. Should first stream end overlap with second stream start. Default is enabled.
  371. @item curve1
  372. Set curve for cross fade transition for first stream.
  373. @item curve2
  374. Set curve for cross fade transition for second stream.
  375. For description of available curve types see @ref{afade} filter description.
  376. @end table
  377. @subsection Examples
  378. @itemize
  379. @item
  380. Cross fade from one input to another:
  381. @example
  382. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  383. @end example
  384. @item
  385. Cross fade from one input to another but without overlapping:
  386. @example
  387. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  388. @end example
  389. @end itemize
  390. @section acrusher
  391. Reduce audio bit resolution.
  392. This filter is bit crusher with enhanced functionality. A bit crusher
  393. is used to audibly reduce number of bits an audio signal is sampled
  394. with. This doesn't change the bit depth at all, it just produces the
  395. effect. Material reduced in bit depth sounds more harsh and "digital".
  396. This filter is able to even round to continuous values instead of discrete
  397. bit depths.
  398. Additionally it has a D/C offset which results in different crushing of
  399. the lower and the upper half of the signal.
  400. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  401. Another feature of this filter is the logarithmic mode.
  402. This setting switches from linear distances between bits to logarithmic ones.
  403. The result is a much more "natural" sounding crusher which doesn't gate low
  404. signals for example. The human ear has a logarithmic perception, too
  405. so this kind of crushing is much more pleasant.
  406. Logarithmic crushing is also able to get anti-aliased.
  407. The filter accepts the following options:
  408. @table @option
  409. @item level_in
  410. Set level in.
  411. @item level_out
  412. Set level out.
  413. @item bits
  414. Set bit reduction.
  415. @item mix
  416. Set mixing amount.
  417. @item mode
  418. Can be linear: @code{lin} or logarithmic: @code{log}.
  419. @item dc
  420. Set DC.
  421. @item aa
  422. Set anti-aliasing.
  423. @item samples
  424. Set sample reduction.
  425. @item lfo
  426. Enable LFO. By default disabled.
  427. @item lforange
  428. Set LFO range.
  429. @item lforate
  430. Set LFO rate.
  431. @end table
  432. @section adelay
  433. Delay one or more audio channels.
  434. Samples in delayed channel are filled with silence.
  435. The filter accepts the following option:
  436. @table @option
  437. @item delays
  438. Set list of delays in milliseconds for each channel separated by '|'.
  439. Unused delays will be silently ignored. If number of given delays is
  440. smaller than number of channels all remaining channels will not be delayed.
  441. If you want to delay exact number of samples, append 'S' to number.
  442. @end table
  443. @subsection Examples
  444. @itemize
  445. @item
  446. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  447. the second channel (and any other channels that may be present) unchanged.
  448. @example
  449. adelay=1500|0|500
  450. @end example
  451. @item
  452. Delay second channel by 500 samples, the third channel by 700 samples and leave
  453. the first channel (and any other channels that may be present) unchanged.
  454. @example
  455. adelay=0|500S|700S
  456. @end example
  457. @end itemize
  458. @section aecho
  459. Apply echoing to the input audio.
  460. Echoes are reflected sound and can occur naturally amongst mountains
  461. (and sometimes large buildings) when talking or shouting; digital echo
  462. effects emulate this behaviour and are often used to help fill out the
  463. sound of a single instrument or vocal. The time difference between the
  464. original signal and the reflection is the @code{delay}, and the
  465. loudness of the reflected signal is the @code{decay}.
  466. Multiple echoes can have different delays and decays.
  467. A description of the accepted parameters follows.
  468. @table @option
  469. @item in_gain
  470. Set input gain of reflected signal. Default is @code{0.6}.
  471. @item out_gain
  472. Set output gain of reflected signal. Default is @code{0.3}.
  473. @item delays
  474. Set list of time intervals in milliseconds between original signal and reflections
  475. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  476. Default is @code{1000}.
  477. @item decays
  478. Set list of loudness of reflected signals separated by '|'.
  479. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  480. Default is @code{0.5}.
  481. @end table
  482. @subsection Examples
  483. @itemize
  484. @item
  485. Make it sound as if there are twice as many instruments as are actually playing:
  486. @example
  487. aecho=0.8:0.88:60:0.4
  488. @end example
  489. @item
  490. If delay is very short, then it sound like a (metallic) robot playing music:
  491. @example
  492. aecho=0.8:0.88:6:0.4
  493. @end example
  494. @item
  495. A longer delay will sound like an open air concert in the mountains:
  496. @example
  497. aecho=0.8:0.9:1000:0.3
  498. @end example
  499. @item
  500. Same as above but with one more mountain:
  501. @example
  502. aecho=0.8:0.9:1000|1800:0.3|0.25
  503. @end example
  504. @end itemize
  505. @section aemphasis
  506. Audio emphasis filter creates or restores material directly taken from LPs or
  507. emphased CDs with different filter curves. E.g. to store music on vinyl the
  508. signal has to be altered by a filter first to even out the disadvantages of
  509. this recording medium.
  510. Once the material is played back the inverse filter has to be applied to
  511. restore the distortion of the frequency response.
  512. The filter accepts the following options:
  513. @table @option
  514. @item level_in
  515. Set input gain.
  516. @item level_out
  517. Set output gain.
  518. @item mode
  519. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  520. use @code{production} mode. Default is @code{reproduction} mode.
  521. @item type
  522. Set filter type. Selects medium. Can be one of the following:
  523. @table @option
  524. @item col
  525. select Columbia.
  526. @item emi
  527. select EMI.
  528. @item bsi
  529. select BSI (78RPM).
  530. @item riaa
  531. select RIAA.
  532. @item cd
  533. select Compact Disc (CD).
  534. @item 50fm
  535. select 50µs (FM).
  536. @item 75fm
  537. select 75µs (FM).
  538. @item 50kf
  539. select 50µs (FM-KF).
  540. @item 75kf
  541. select 75µs (FM-KF).
  542. @end table
  543. @end table
  544. @section aeval
  545. Modify an audio signal according to the specified expressions.
  546. This filter accepts one or more expressions (one for each channel),
  547. which are evaluated and used to modify a corresponding audio signal.
  548. It accepts the following parameters:
  549. @table @option
  550. @item exprs
  551. Set the '|'-separated expressions list for each separate channel. If
  552. the number of input channels is greater than the number of
  553. expressions, the last specified expression is used for the remaining
  554. output channels.
  555. @item channel_layout, c
  556. Set output channel layout. If not specified, the channel layout is
  557. specified by the number of expressions. If set to @samp{same}, it will
  558. use by default the same input channel layout.
  559. @end table
  560. Each expression in @var{exprs} can contain the following constants and functions:
  561. @table @option
  562. @item ch
  563. channel number of the current expression
  564. @item n
  565. number of the evaluated sample, starting from 0
  566. @item s
  567. sample rate
  568. @item t
  569. time of the evaluated sample expressed in seconds
  570. @item nb_in_channels
  571. @item nb_out_channels
  572. input and output number of channels
  573. @item val(CH)
  574. the value of input channel with number @var{CH}
  575. @end table
  576. Note: this filter is slow. For faster processing you should use a
  577. dedicated filter.
  578. @subsection Examples
  579. @itemize
  580. @item
  581. Half volume:
  582. @example
  583. aeval=val(ch)/2:c=same
  584. @end example
  585. @item
  586. Invert phase of the second channel:
  587. @example
  588. aeval=val(0)|-val(1)
  589. @end example
  590. @end itemize
  591. @anchor{afade}
  592. @section afade
  593. Apply fade-in/out effect to input audio.
  594. A description of the accepted parameters follows.
  595. @table @option
  596. @item type, t
  597. Specify the effect type, can be either @code{in} for fade-in, or
  598. @code{out} for a fade-out effect. Default is @code{in}.
  599. @item start_sample, ss
  600. Specify the number of the start sample for starting to apply the fade
  601. effect. Default is 0.
  602. @item nb_samples, ns
  603. Specify the number of samples for which the fade effect has to last. At
  604. the end of the fade-in effect the output audio will have the same
  605. volume as the input audio, at the end of the fade-out transition
  606. the output audio will be silence. Default is 44100.
  607. @item start_time, st
  608. Specify the start time of the fade effect. Default is 0.
  609. The value must be specified as a time duration; see
  610. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  611. for the accepted syntax.
  612. If set this option is used instead of @var{start_sample}.
  613. @item duration, d
  614. Specify the duration of the fade effect. See
  615. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  616. for the accepted syntax.
  617. At the end of the fade-in effect the output audio will have the same
  618. volume as the input audio, at the end of the fade-out transition
  619. the output audio will be silence.
  620. By default the duration is determined by @var{nb_samples}.
  621. If set this option is used instead of @var{nb_samples}.
  622. @item curve
  623. Set curve for fade transition.
  624. It accepts the following values:
  625. @table @option
  626. @item tri
  627. select triangular, linear slope (default)
  628. @item qsin
  629. select quarter of sine wave
  630. @item hsin
  631. select half of sine wave
  632. @item esin
  633. select exponential sine wave
  634. @item log
  635. select logarithmic
  636. @item ipar
  637. select inverted parabola
  638. @item qua
  639. select quadratic
  640. @item cub
  641. select cubic
  642. @item squ
  643. select square root
  644. @item cbr
  645. select cubic root
  646. @item par
  647. select parabola
  648. @item exp
  649. select exponential
  650. @item iqsin
  651. select inverted quarter of sine wave
  652. @item ihsin
  653. select inverted half of sine wave
  654. @item dese
  655. select double-exponential seat
  656. @item desi
  657. select double-exponential sigmoid
  658. @end table
  659. @end table
  660. @subsection Examples
  661. @itemize
  662. @item
  663. Fade in first 15 seconds of audio:
  664. @example
  665. afade=t=in:ss=0:d=15
  666. @end example
  667. @item
  668. Fade out last 25 seconds of a 900 seconds audio:
  669. @example
  670. afade=t=out:st=875:d=25
  671. @end example
  672. @end itemize
  673. @section afftfilt
  674. Apply arbitrary expressions to samples in frequency domain.
  675. @table @option
  676. @item real
  677. Set frequency domain real expression for each separate channel separated
  678. by '|'. Default is "1".
  679. If the number of input channels is greater than the number of
  680. expressions, the last specified expression is used for the remaining
  681. output channels.
  682. @item imag
  683. Set frequency domain imaginary expression for each separate channel
  684. separated by '|'. If not set, @var{real} option is used.
  685. Each expression in @var{real} and @var{imag} can contain the following
  686. constants:
  687. @table @option
  688. @item sr
  689. sample rate
  690. @item b
  691. current frequency bin number
  692. @item nb
  693. number of available bins
  694. @item ch
  695. channel number of the current expression
  696. @item chs
  697. number of channels
  698. @item pts
  699. current frame pts
  700. @end table
  701. @item win_size
  702. Set window size.
  703. It accepts the following values:
  704. @table @samp
  705. @item w16
  706. @item w32
  707. @item w64
  708. @item w128
  709. @item w256
  710. @item w512
  711. @item w1024
  712. @item w2048
  713. @item w4096
  714. @item w8192
  715. @item w16384
  716. @item w32768
  717. @item w65536
  718. @end table
  719. Default is @code{w4096}
  720. @item win_func
  721. Set window function. Default is @code{hann}.
  722. @item overlap
  723. Set window overlap. If set to 1, the recommended overlap for selected
  724. window function will be picked. Default is @code{0.75}.
  725. @end table
  726. @subsection Examples
  727. @itemize
  728. @item
  729. Leave almost only low frequencies in audio:
  730. @example
  731. afftfilt="1-clip((b/nb)*b,0,1)"
  732. @end example
  733. @end itemize
  734. @anchor{afir}
  735. @section afir
  736. Apply an arbitrary Frequency Impulse Response filter.
  737. This filter is designed for applying long FIR filters,
  738. up to 30 seconds long.
  739. It can be used as component for digital crossover filters,
  740. room equalization, cross talk cancellation, wavefield synthesis,
  741. auralization, ambiophonics and ambisonics.
  742. This filter uses second stream as FIR coefficients.
  743. If second stream holds single channel, it will be used
  744. for all input channels in first stream, otherwise
  745. number of channels in second stream must be same as
  746. number of channels in first stream.
  747. It accepts the following parameters:
  748. @table @option
  749. @item dry
  750. Set dry gain. This sets input gain.
  751. @item wet
  752. Set wet gain. This sets final output gain.
  753. @item length
  754. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  755. @item again
  756. Enable applying gain measured from power of IR.
  757. @end table
  758. @subsection Examples
  759. @itemize
  760. @item
  761. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  762. @example
  763. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  764. @end example
  765. @end itemize
  766. @anchor{aformat}
  767. @section aformat
  768. Set output format constraints for the input audio. The framework will
  769. negotiate the most appropriate format to minimize conversions.
  770. It accepts the following parameters:
  771. @table @option
  772. @item sample_fmts
  773. A '|'-separated list of requested sample formats.
  774. @item sample_rates
  775. A '|'-separated list of requested sample rates.
  776. @item channel_layouts
  777. A '|'-separated list of requested channel layouts.
  778. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  779. for the required syntax.
  780. @end table
  781. If a parameter is omitted, all values are allowed.
  782. Force the output to either unsigned 8-bit or signed 16-bit stereo
  783. @example
  784. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  785. @end example
  786. @section agate
  787. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  788. processing reduces disturbing noise between useful signals.
  789. Gating is done by detecting the volume below a chosen level @var{threshold}
  790. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  791. floor is set via @var{range}. Because an exact manipulation of the signal
  792. would cause distortion of the waveform the reduction can be levelled over
  793. time. This is done by setting @var{attack} and @var{release}.
  794. @var{attack} determines how long the signal has to fall below the threshold
  795. before any reduction will occur and @var{release} sets the time the signal
  796. has to rise above the threshold to reduce the reduction again.
  797. Shorter signals than the chosen attack time will be left untouched.
  798. @table @option
  799. @item level_in
  800. Set input level before filtering.
  801. Default is 1. Allowed range is from 0.015625 to 64.
  802. @item range
  803. Set the level of gain reduction when the signal is below the threshold.
  804. Default is 0.06125. Allowed range is from 0 to 1.
  805. @item threshold
  806. If a signal rises above this level the gain reduction is released.
  807. Default is 0.125. Allowed range is from 0 to 1.
  808. @item ratio
  809. Set a ratio by which the signal is reduced.
  810. Default is 2. Allowed range is from 1 to 9000.
  811. @item attack
  812. Amount of milliseconds the signal has to rise above the threshold before gain
  813. reduction stops.
  814. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  815. @item release
  816. Amount of milliseconds the signal has to fall below the threshold before the
  817. reduction is increased again. Default is 250 milliseconds.
  818. Allowed range is from 0.01 to 9000.
  819. @item makeup
  820. Set amount of amplification of signal after processing.
  821. Default is 1. Allowed range is from 1 to 64.
  822. @item knee
  823. Curve the sharp knee around the threshold to enter gain reduction more softly.
  824. Default is 2.828427125. Allowed range is from 1 to 8.
  825. @item detection
  826. Choose if exact signal should be taken for detection or an RMS like one.
  827. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  828. @item link
  829. Choose if the average level between all channels or the louder channel affects
  830. the reduction.
  831. Default is @code{average}. Can be @code{average} or @code{maximum}.
  832. @end table
  833. @section aiir
  834. Apply an arbitrary Infinite Impulse Response filter.
  835. It accepts the following parameters:
  836. @table @option
  837. @item z
  838. Set numerator/zeros coefficients.
  839. @item p
  840. Set denominator/poles coefficients.
  841. @item k
  842. Set channels gains.
  843. @item dry_gain
  844. Set input gain.
  845. @item wet_gain
  846. Set output gain.
  847. @item f
  848. Set coefficients format.
  849. @table @samp
  850. @item tf
  851. transfer function
  852. @item zp
  853. Z-plane zeros/poles, cartesian (default)
  854. @item pr
  855. Z-plane zeros/poles, polar radians
  856. @item pd
  857. Z-plane zeros/poles, polar degrees
  858. @end table
  859. @item r
  860. Set kind of processing.
  861. Can be @code{d} - direct or @code{s} - serial cascading. Defauls is @code{s}.
  862. @item e
  863. Set filtering precision.
  864. @table @samp
  865. @item dbl
  866. double-precision floating-point (default)
  867. @item flt
  868. single-precision floating-point
  869. @item i32
  870. 32-bit integers
  871. @item i16
  872. 16-bit integers
  873. @end table
  874. @end table
  875. Coefficients in @code{tf} format are separated by spaces and are in ascending
  876. order.
  877. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  878. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  879. imaginary unit.
  880. Different coefficients and gains can be provided for every channel, in such case
  881. use '|' to separate coefficients or gains. Last provided coefficients will be
  882. used for all remaining channels.
  883. @subsection Examples
  884. @itemize
  885. @item
  886. Apply 2 pole elliptic notch at arround 5000Hz for 48000 Hz sample rate:
  887. @example
  888. aiir=k=1:z=7.957584807809675810E-1 -2.575128568908332300 3.674839853930788710 -2.57512875289799137 7.957586296317130880E-1:p=1 -2.86950072432325953 3.63022088054647218 -2.28075678147272232 6.361362326477423500E-1:f=tf:r=d
  889. @end example
  890. @item
  891. Same as above but in @code{zp} format:
  892. @example
  893. aiir=k=0.79575848078096756:z=0.80918701+0.58773007i 0.80918701-0.58773007i 0.80884700+0.58784055i 0.80884700-0.58784055i:p=0.63892345+0.59951235i 0.63892345-0.59951235i 0.79582691+0.44198673i 0.79582691-0.44198673i:f=zp:r=s
  894. @end example
  895. @end itemize
  896. @section alimiter
  897. The limiter prevents an input signal from rising over a desired threshold.
  898. This limiter uses lookahead technology to prevent your signal from distorting.
  899. It means that there is a small delay after the signal is processed. Keep in mind
  900. that the delay it produces is the attack time you set.
  901. The filter accepts the following options:
  902. @table @option
  903. @item level_in
  904. Set input gain. Default is 1.
  905. @item level_out
  906. Set output gain. Default is 1.
  907. @item limit
  908. Don't let signals above this level pass the limiter. Default is 1.
  909. @item attack
  910. The limiter will reach its attenuation level in this amount of time in
  911. milliseconds. Default is 5 milliseconds.
  912. @item release
  913. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  914. Default is 50 milliseconds.
  915. @item asc
  916. When gain reduction is always needed ASC takes care of releasing to an
  917. average reduction level rather than reaching a reduction of 0 in the release
  918. time.
  919. @item asc_level
  920. Select how much the release time is affected by ASC, 0 means nearly no changes
  921. in release time while 1 produces higher release times.
  922. @item level
  923. Auto level output signal. Default is enabled.
  924. This normalizes audio back to 0dB if enabled.
  925. @end table
  926. Depending on picked setting it is recommended to upsample input 2x or 4x times
  927. with @ref{aresample} before applying this filter.
  928. @section allpass
  929. Apply a two-pole all-pass filter with central frequency (in Hz)
  930. @var{frequency}, and filter-width @var{width}.
  931. An all-pass filter changes the audio's frequency to phase relationship
  932. without changing its frequency to amplitude relationship.
  933. The filter accepts the following options:
  934. @table @option
  935. @item frequency, f
  936. Set frequency in Hz.
  937. @item width_type, t
  938. Set method to specify band-width of filter.
  939. @table @option
  940. @item h
  941. Hz
  942. @item q
  943. Q-Factor
  944. @item o
  945. octave
  946. @item s
  947. slope
  948. @item k
  949. kHz
  950. @end table
  951. @item width, w
  952. Specify the band-width of a filter in width_type units.
  953. @item channels, c
  954. Specify which channels to filter, by default all available are filtered.
  955. @end table
  956. @subsection Commands
  957. This filter supports the following commands:
  958. @table @option
  959. @item frequency, f
  960. Change allpass frequency.
  961. Syntax for the command is : "@var{frequency}"
  962. @item width_type, t
  963. Change allpass width_type.
  964. Syntax for the command is : "@var{width_type}"
  965. @item width, w
  966. Change allpass width.
  967. Syntax for the command is : "@var{width}"
  968. @end table
  969. @section aloop
  970. Loop audio samples.
  971. The filter accepts the following options:
  972. @table @option
  973. @item loop
  974. Set the number of loops. Setting this value to -1 will result in infinite loops.
  975. Default is 0.
  976. @item size
  977. Set maximal number of samples. Default is 0.
  978. @item start
  979. Set first sample of loop. Default is 0.
  980. @end table
  981. @anchor{amerge}
  982. @section amerge
  983. Merge two or more audio streams into a single multi-channel stream.
  984. The filter accepts the following options:
  985. @table @option
  986. @item inputs
  987. Set the number of inputs. Default is 2.
  988. @end table
  989. If the channel layouts of the inputs are disjoint, and therefore compatible,
  990. the channel layout of the output will be set accordingly and the channels
  991. will be reordered as necessary. If the channel layouts of the inputs are not
  992. disjoint, the output will have all the channels of the first input then all
  993. the channels of the second input, in that order, and the channel layout of
  994. the output will be the default value corresponding to the total number of
  995. channels.
  996. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  997. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  998. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  999. first input, b1 is the first channel of the second input).
  1000. On the other hand, if both input are in stereo, the output channels will be
  1001. in the default order: a1, a2, b1, b2, and the channel layout will be
  1002. arbitrarily set to 4.0, which may or may not be the expected value.
  1003. All inputs must have the same sample rate, and format.
  1004. If inputs do not have the same duration, the output will stop with the
  1005. shortest.
  1006. @subsection Examples
  1007. @itemize
  1008. @item
  1009. Merge two mono files into a stereo stream:
  1010. @example
  1011. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1012. @end example
  1013. @item
  1014. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1015. @example
  1016. 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
  1017. @end example
  1018. @end itemize
  1019. @section amix
  1020. Mixes multiple audio inputs into a single output.
  1021. Note that this filter only supports float samples (the @var{amerge}
  1022. and @var{pan} audio filters support many formats). If the @var{amix}
  1023. input has integer samples then @ref{aresample} will be automatically
  1024. inserted to perform the conversion to float samples.
  1025. For example
  1026. @example
  1027. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1028. @end example
  1029. will mix 3 input audio streams to a single output with the same duration as the
  1030. first input and a dropout transition time of 3 seconds.
  1031. It accepts the following parameters:
  1032. @table @option
  1033. @item inputs
  1034. The number of inputs. If unspecified, it defaults to 2.
  1035. @item duration
  1036. How to determine the end-of-stream.
  1037. @table @option
  1038. @item longest
  1039. The duration of the longest input. (default)
  1040. @item shortest
  1041. The duration of the shortest input.
  1042. @item first
  1043. The duration of the first input.
  1044. @end table
  1045. @item dropout_transition
  1046. The transition time, in seconds, for volume renormalization when an input
  1047. stream ends. The default value is 2 seconds.
  1048. @end table
  1049. @section anequalizer
  1050. High-order parametric multiband equalizer for each channel.
  1051. It accepts the following parameters:
  1052. @table @option
  1053. @item params
  1054. This option string is in format:
  1055. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1056. Each equalizer band is separated by '|'.
  1057. @table @option
  1058. @item chn
  1059. Set channel number to which equalization will be applied.
  1060. If input doesn't have that channel the entry is ignored.
  1061. @item f
  1062. Set central frequency for band.
  1063. If input doesn't have that frequency the entry is ignored.
  1064. @item w
  1065. Set band width in hertz.
  1066. @item g
  1067. Set band gain in dB.
  1068. @item t
  1069. Set filter type for band, optional, can be:
  1070. @table @samp
  1071. @item 0
  1072. Butterworth, this is default.
  1073. @item 1
  1074. Chebyshev type 1.
  1075. @item 2
  1076. Chebyshev type 2.
  1077. @end table
  1078. @end table
  1079. @item curves
  1080. With this option activated frequency response of anequalizer is displayed
  1081. in video stream.
  1082. @item size
  1083. Set video stream size. Only useful if curves option is activated.
  1084. @item mgain
  1085. Set max gain that will be displayed. Only useful if curves option is activated.
  1086. Setting this to a reasonable value makes it possible to display gain which is derived from
  1087. neighbour bands which are too close to each other and thus produce higher gain
  1088. when both are activated.
  1089. @item fscale
  1090. Set frequency scale used to draw frequency response in video output.
  1091. Can be linear or logarithmic. Default is logarithmic.
  1092. @item colors
  1093. Set color for each channel curve which is going to be displayed in video stream.
  1094. This is list of color names separated by space or by '|'.
  1095. Unrecognised or missing colors will be replaced by white color.
  1096. @end table
  1097. @subsection Examples
  1098. @itemize
  1099. @item
  1100. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1101. for first 2 channels using Chebyshev type 1 filter:
  1102. @example
  1103. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1104. @end example
  1105. @end itemize
  1106. @subsection Commands
  1107. This filter supports the following commands:
  1108. @table @option
  1109. @item change
  1110. Alter existing filter parameters.
  1111. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1112. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1113. error is returned.
  1114. @var{freq} set new frequency parameter.
  1115. @var{width} set new width parameter in herz.
  1116. @var{gain} set new gain parameter in dB.
  1117. Full filter invocation with asendcmd may look like this:
  1118. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1119. @end table
  1120. @section anull
  1121. Pass the audio source unchanged to the output.
  1122. @section apad
  1123. Pad the end of an audio stream with silence.
  1124. This can be used together with @command{ffmpeg} @option{-shortest} to
  1125. extend audio streams to the same length as the video stream.
  1126. A description of the accepted options follows.
  1127. @table @option
  1128. @item packet_size
  1129. Set silence packet size. Default value is 4096.
  1130. @item pad_len
  1131. Set the number of samples of silence to add to the end. After the
  1132. value is reached, the stream is terminated. This option is mutually
  1133. exclusive with @option{whole_len}.
  1134. @item whole_len
  1135. Set the minimum total number of samples in the output audio stream. If
  1136. the value is longer than the input audio length, silence is added to
  1137. the end, until the value is reached. This option is mutually exclusive
  1138. with @option{pad_len}.
  1139. @end table
  1140. If neither the @option{pad_len} nor the @option{whole_len} option is
  1141. set, the filter will add silence to the end of the input stream
  1142. indefinitely.
  1143. @subsection Examples
  1144. @itemize
  1145. @item
  1146. Add 1024 samples of silence to the end of the input:
  1147. @example
  1148. apad=pad_len=1024
  1149. @end example
  1150. @item
  1151. Make sure the audio output will contain at least 10000 samples, pad
  1152. the input with silence if required:
  1153. @example
  1154. apad=whole_len=10000
  1155. @end example
  1156. @item
  1157. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1158. video stream will always result the shortest and will be converted
  1159. until the end in the output file when using the @option{shortest}
  1160. option:
  1161. @example
  1162. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1163. @end example
  1164. @end itemize
  1165. @section aphaser
  1166. Add a phasing effect to the input audio.
  1167. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1168. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1169. A description of the accepted parameters follows.
  1170. @table @option
  1171. @item in_gain
  1172. Set input gain. Default is 0.4.
  1173. @item out_gain
  1174. Set output gain. Default is 0.74
  1175. @item delay
  1176. Set delay in milliseconds. Default is 3.0.
  1177. @item decay
  1178. Set decay. Default is 0.4.
  1179. @item speed
  1180. Set modulation speed in Hz. Default is 0.5.
  1181. @item type
  1182. Set modulation type. Default is triangular.
  1183. It accepts the following values:
  1184. @table @samp
  1185. @item triangular, t
  1186. @item sinusoidal, s
  1187. @end table
  1188. @end table
  1189. @section apulsator
  1190. Audio pulsator is something between an autopanner and a tremolo.
  1191. But it can produce funny stereo effects as well. Pulsator changes the volume
  1192. of the left and right channel based on a LFO (low frequency oscillator) with
  1193. different waveforms and shifted phases.
  1194. This filter have the ability to define an offset between left and right
  1195. channel. An offset of 0 means that both LFO shapes match each other.
  1196. The left and right channel are altered equally - a conventional tremolo.
  1197. An offset of 50% means that the shape of the right channel is exactly shifted
  1198. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1199. an autopanner. At 1 both curves match again. Every setting in between moves the
  1200. phase shift gapless between all stages and produces some "bypassing" sounds with
  1201. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1202. the 0.5) the faster the signal passes from the left to the right speaker.
  1203. The filter accepts the following options:
  1204. @table @option
  1205. @item level_in
  1206. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1207. @item level_out
  1208. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1209. @item mode
  1210. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1211. sawup or sawdown. Default is sine.
  1212. @item amount
  1213. Set modulation. Define how much of original signal is affected by the LFO.
  1214. @item offset_l
  1215. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1216. @item offset_r
  1217. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1218. @item width
  1219. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1220. @item timing
  1221. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1222. @item bpm
  1223. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1224. is set to bpm.
  1225. @item ms
  1226. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1227. is set to ms.
  1228. @item hz
  1229. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1230. if timing is set to hz.
  1231. @end table
  1232. @anchor{aresample}
  1233. @section aresample
  1234. Resample the input audio to the specified parameters, using the
  1235. libswresample library. If none are specified then the filter will
  1236. automatically convert between its input and output.
  1237. This filter is also able to stretch/squeeze the audio data to make it match
  1238. the timestamps or to inject silence / cut out audio to make it match the
  1239. timestamps, do a combination of both or do neither.
  1240. The filter accepts the syntax
  1241. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1242. expresses a sample rate and @var{resampler_options} is a list of
  1243. @var{key}=@var{value} pairs, separated by ":". See the
  1244. @ref{Resampler Options,,"Resampler Options" section in the
  1245. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1246. for the complete list of supported options.
  1247. @subsection Examples
  1248. @itemize
  1249. @item
  1250. Resample the input audio to 44100Hz:
  1251. @example
  1252. aresample=44100
  1253. @end example
  1254. @item
  1255. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1256. samples per second compensation:
  1257. @example
  1258. aresample=async=1000
  1259. @end example
  1260. @end itemize
  1261. @section areverse
  1262. Reverse an audio clip.
  1263. Warning: This filter requires memory to buffer the entire clip, so trimming
  1264. is suggested.
  1265. @subsection Examples
  1266. @itemize
  1267. @item
  1268. Take the first 5 seconds of a clip, and reverse it.
  1269. @example
  1270. atrim=end=5,areverse
  1271. @end example
  1272. @end itemize
  1273. @section asetnsamples
  1274. Set the number of samples per each output audio frame.
  1275. The last output packet may contain a different number of samples, as
  1276. the filter will flush all the remaining samples when the input audio
  1277. signals its end.
  1278. The filter accepts the following options:
  1279. @table @option
  1280. @item nb_out_samples, n
  1281. Set the number of frames per each output audio frame. The number is
  1282. intended as the number of samples @emph{per each channel}.
  1283. Default value is 1024.
  1284. @item pad, p
  1285. If set to 1, the filter will pad the last audio frame with zeroes, so
  1286. that the last frame will contain the same number of samples as the
  1287. previous ones. Default value is 1.
  1288. @end table
  1289. For example, to set the number of per-frame samples to 1234 and
  1290. disable padding for the last frame, use:
  1291. @example
  1292. asetnsamples=n=1234:p=0
  1293. @end example
  1294. @section asetrate
  1295. Set the sample rate without altering the PCM data.
  1296. This will result in a change of speed and pitch.
  1297. The filter accepts the following options:
  1298. @table @option
  1299. @item sample_rate, r
  1300. Set the output sample rate. Default is 44100 Hz.
  1301. @end table
  1302. @section ashowinfo
  1303. Show a line containing various information for each input audio frame.
  1304. The input audio is not modified.
  1305. The shown line contains a sequence of key/value pairs of the form
  1306. @var{key}:@var{value}.
  1307. The following values are shown in the output:
  1308. @table @option
  1309. @item n
  1310. The (sequential) number of the input frame, starting from 0.
  1311. @item pts
  1312. The presentation timestamp of the input frame, in time base units; the time base
  1313. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1314. @item pts_time
  1315. The presentation timestamp of the input frame in seconds.
  1316. @item pos
  1317. position of the frame in the input stream, -1 if this information in
  1318. unavailable and/or meaningless (for example in case of synthetic audio)
  1319. @item fmt
  1320. The sample format.
  1321. @item chlayout
  1322. The channel layout.
  1323. @item rate
  1324. The sample rate for the audio frame.
  1325. @item nb_samples
  1326. The number of samples (per channel) in the frame.
  1327. @item checksum
  1328. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1329. audio, the data is treated as if all the planes were concatenated.
  1330. @item plane_checksums
  1331. A list of Adler-32 checksums for each data plane.
  1332. @end table
  1333. @anchor{astats}
  1334. @section astats
  1335. Display time domain statistical information about the audio channels.
  1336. Statistics are calculated and displayed for each audio channel and,
  1337. where applicable, an overall figure is also given.
  1338. It accepts the following option:
  1339. @table @option
  1340. @item length
  1341. Short window length in seconds, used for peak and trough RMS measurement.
  1342. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  1343. @item metadata
  1344. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1345. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1346. disabled.
  1347. Available keys for each channel are:
  1348. DC_offset
  1349. Min_level
  1350. Max_level
  1351. Min_difference
  1352. Max_difference
  1353. Mean_difference
  1354. RMS_difference
  1355. Peak_level
  1356. RMS_peak
  1357. RMS_trough
  1358. Crest_factor
  1359. Flat_factor
  1360. Peak_count
  1361. Bit_depth
  1362. Dynamic_range
  1363. and for Overall:
  1364. DC_offset
  1365. Min_level
  1366. Max_level
  1367. Min_difference
  1368. Max_difference
  1369. Mean_difference
  1370. RMS_difference
  1371. Peak_level
  1372. RMS_level
  1373. RMS_peak
  1374. RMS_trough
  1375. Flat_factor
  1376. Peak_count
  1377. Bit_depth
  1378. Number_of_samples
  1379. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1380. this @code{lavfi.astats.Overall.Peak_count}.
  1381. For description what each key means read below.
  1382. @item reset
  1383. Set number of frame after which stats are going to be recalculated.
  1384. Default is disabled.
  1385. @end table
  1386. A description of each shown parameter follows:
  1387. @table @option
  1388. @item DC offset
  1389. Mean amplitude displacement from zero.
  1390. @item Min level
  1391. Minimal sample level.
  1392. @item Max level
  1393. Maximal sample level.
  1394. @item Min difference
  1395. Minimal difference between two consecutive samples.
  1396. @item Max difference
  1397. Maximal difference between two consecutive samples.
  1398. @item Mean difference
  1399. Mean difference between two consecutive samples.
  1400. The average of each difference between two consecutive samples.
  1401. @item RMS difference
  1402. Root Mean Square difference between two consecutive samples.
  1403. @item Peak level dB
  1404. @item RMS level dB
  1405. Standard peak and RMS level measured in dBFS.
  1406. @item RMS peak dB
  1407. @item RMS trough dB
  1408. Peak and trough values for RMS level measured over a short window.
  1409. @item Crest factor
  1410. Standard ratio of peak to RMS level (note: not in dB).
  1411. @item Flat factor
  1412. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1413. (i.e. either @var{Min level} or @var{Max level}).
  1414. @item Peak count
  1415. Number of occasions (not the number of samples) that the signal attained either
  1416. @var{Min level} or @var{Max level}.
  1417. @item Bit depth
  1418. Overall bit depth of audio. Number of bits used for each sample.
  1419. @item Dynamic range
  1420. Measured dynamic range of audio in dB.
  1421. @end table
  1422. @section atempo
  1423. Adjust audio tempo.
  1424. The filter accepts exactly one parameter, the audio tempo. If not
  1425. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1426. be in the [0.5, 2.0] range.
  1427. @subsection Examples
  1428. @itemize
  1429. @item
  1430. Slow down audio to 80% tempo:
  1431. @example
  1432. atempo=0.8
  1433. @end example
  1434. @item
  1435. To speed up audio to 125% tempo:
  1436. @example
  1437. atempo=1.25
  1438. @end example
  1439. @end itemize
  1440. @section atrim
  1441. Trim the input so that the output contains one continuous subpart of the input.
  1442. It accepts the following parameters:
  1443. @table @option
  1444. @item start
  1445. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1446. sample with the timestamp @var{start} will be the first sample in the output.
  1447. @item end
  1448. Specify time of the first audio sample that will be dropped, i.e. the
  1449. audio sample immediately preceding the one with the timestamp @var{end} will be
  1450. the last sample in the output.
  1451. @item start_pts
  1452. Same as @var{start}, except this option sets the start timestamp in samples
  1453. instead of seconds.
  1454. @item end_pts
  1455. Same as @var{end}, except this option sets the end timestamp in samples instead
  1456. of seconds.
  1457. @item duration
  1458. The maximum duration of the output in seconds.
  1459. @item start_sample
  1460. The number of the first sample that should be output.
  1461. @item end_sample
  1462. The number of the first sample that should be dropped.
  1463. @end table
  1464. @option{start}, @option{end}, and @option{duration} are expressed as time
  1465. duration specifications; see
  1466. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1467. Note that the first two sets of the start/end options and the @option{duration}
  1468. option look at the frame timestamp, while the _sample options simply count the
  1469. samples that pass through the filter. So start/end_pts and start/end_sample will
  1470. give different results when the timestamps are wrong, inexact or do not start at
  1471. zero. Also note that this filter does not modify the timestamps. If you wish
  1472. to have the output timestamps start at zero, insert the asetpts filter after the
  1473. atrim filter.
  1474. If multiple start or end options are set, this filter tries to be greedy and
  1475. keep all samples that match at least one of the specified constraints. To keep
  1476. only the part that matches all the constraints at once, chain multiple atrim
  1477. filters.
  1478. The defaults are such that all the input is kept. So it is possible to set e.g.
  1479. just the end values to keep everything before the specified time.
  1480. Examples:
  1481. @itemize
  1482. @item
  1483. Drop everything except the second minute of input:
  1484. @example
  1485. ffmpeg -i INPUT -af atrim=60:120
  1486. @end example
  1487. @item
  1488. Keep only the first 1000 samples:
  1489. @example
  1490. ffmpeg -i INPUT -af atrim=end_sample=1000
  1491. @end example
  1492. @end itemize
  1493. @section bandpass
  1494. Apply a two-pole Butterworth band-pass filter with central
  1495. frequency @var{frequency}, and (3dB-point) band-width width.
  1496. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1497. instead of the default: constant 0dB peak gain.
  1498. The filter roll off at 6dB per octave (20dB per decade).
  1499. The filter accepts the following options:
  1500. @table @option
  1501. @item frequency, f
  1502. Set the filter's central frequency. Default is @code{3000}.
  1503. @item csg
  1504. Constant skirt gain if set to 1. Defaults to 0.
  1505. @item width_type, t
  1506. Set method to specify band-width of filter.
  1507. @table @option
  1508. @item h
  1509. Hz
  1510. @item q
  1511. Q-Factor
  1512. @item o
  1513. octave
  1514. @item s
  1515. slope
  1516. @item k
  1517. kHz
  1518. @end table
  1519. @item width, w
  1520. Specify the band-width of a filter in width_type units.
  1521. @item channels, c
  1522. Specify which channels to filter, by default all available are filtered.
  1523. @end table
  1524. @subsection Commands
  1525. This filter supports the following commands:
  1526. @table @option
  1527. @item frequency, f
  1528. Change bandpass frequency.
  1529. Syntax for the command is : "@var{frequency}"
  1530. @item width_type, t
  1531. Change bandpass width_type.
  1532. Syntax for the command is : "@var{width_type}"
  1533. @item width, w
  1534. Change bandpass width.
  1535. Syntax for the command is : "@var{width}"
  1536. @end table
  1537. @section bandreject
  1538. Apply a two-pole Butterworth band-reject filter with central
  1539. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1540. The filter roll off at 6dB per octave (20dB per decade).
  1541. The filter accepts the following options:
  1542. @table @option
  1543. @item frequency, f
  1544. Set the filter's central frequency. Default is @code{3000}.
  1545. @item width_type, t
  1546. Set method to specify band-width of filter.
  1547. @table @option
  1548. @item h
  1549. Hz
  1550. @item q
  1551. Q-Factor
  1552. @item o
  1553. octave
  1554. @item s
  1555. slope
  1556. @item k
  1557. kHz
  1558. @end table
  1559. @item width, w
  1560. Specify the band-width of a filter in width_type units.
  1561. @item channels, c
  1562. Specify which channels to filter, by default all available are filtered.
  1563. @end table
  1564. @subsection Commands
  1565. This filter supports the following commands:
  1566. @table @option
  1567. @item frequency, f
  1568. Change bandreject frequency.
  1569. Syntax for the command is : "@var{frequency}"
  1570. @item width_type, t
  1571. Change bandreject width_type.
  1572. Syntax for the command is : "@var{width_type}"
  1573. @item width, w
  1574. Change bandreject width.
  1575. Syntax for the command is : "@var{width}"
  1576. @end table
  1577. @section bass
  1578. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1579. shelving filter with a response similar to that of a standard
  1580. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1581. The filter accepts the following options:
  1582. @table @option
  1583. @item gain, g
  1584. Give the gain at 0 Hz. Its useful range is about -20
  1585. (for a large cut) to +20 (for a large boost).
  1586. Beware of clipping when using a positive gain.
  1587. @item frequency, f
  1588. Set the filter's central frequency and so can be used
  1589. to extend or reduce the frequency range to be boosted or cut.
  1590. The default value is @code{100} Hz.
  1591. @item width_type, t
  1592. Set method to specify band-width of filter.
  1593. @table @option
  1594. @item h
  1595. Hz
  1596. @item q
  1597. Q-Factor
  1598. @item o
  1599. octave
  1600. @item s
  1601. slope
  1602. @item k
  1603. kHz
  1604. @end table
  1605. @item width, w
  1606. Determine how steep is the filter's shelf transition.
  1607. @item channels, c
  1608. Specify which channels to filter, by default all available are filtered.
  1609. @end table
  1610. @subsection Commands
  1611. This filter supports the following commands:
  1612. @table @option
  1613. @item frequency, f
  1614. Change bass frequency.
  1615. Syntax for the command is : "@var{frequency}"
  1616. @item width_type, t
  1617. Change bass width_type.
  1618. Syntax for the command is : "@var{width_type}"
  1619. @item width, w
  1620. Change bass width.
  1621. Syntax for the command is : "@var{width}"
  1622. @item gain, g
  1623. Change bass gain.
  1624. Syntax for the command is : "@var{gain}"
  1625. @end table
  1626. @section biquad
  1627. Apply a biquad IIR filter with the given coefficients.
  1628. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1629. are the numerator and denominator coefficients respectively.
  1630. and @var{channels}, @var{c} specify which channels to filter, by default all
  1631. available are filtered.
  1632. @subsection Commands
  1633. This filter supports the following commands:
  1634. @table @option
  1635. @item a0
  1636. @item a1
  1637. @item a2
  1638. @item b0
  1639. @item b1
  1640. @item b2
  1641. Change biquad parameter.
  1642. Syntax for the command is : "@var{value}"
  1643. @end table
  1644. @section bs2b
  1645. Bauer stereo to binaural transformation, which improves headphone listening of
  1646. stereo audio records.
  1647. To enable compilation of this filter you need to configure FFmpeg with
  1648. @code{--enable-libbs2b}.
  1649. It accepts the following parameters:
  1650. @table @option
  1651. @item profile
  1652. Pre-defined crossfeed level.
  1653. @table @option
  1654. @item default
  1655. Default level (fcut=700, feed=50).
  1656. @item cmoy
  1657. Chu Moy circuit (fcut=700, feed=60).
  1658. @item jmeier
  1659. Jan Meier circuit (fcut=650, feed=95).
  1660. @end table
  1661. @item fcut
  1662. Cut frequency (in Hz).
  1663. @item feed
  1664. Feed level (in Hz).
  1665. @end table
  1666. @section channelmap
  1667. Remap input channels to new locations.
  1668. It accepts the following parameters:
  1669. @table @option
  1670. @item map
  1671. Map channels from input to output. The argument is a '|'-separated list of
  1672. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1673. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1674. channel (e.g. FL for front left) or its index in the input channel layout.
  1675. @var{out_channel} is the name of the output channel or its index in the output
  1676. channel layout. If @var{out_channel} is not given then it is implicitly an
  1677. index, starting with zero and increasing by one for each mapping.
  1678. @item channel_layout
  1679. The channel layout of the output stream.
  1680. @end table
  1681. If no mapping is present, the filter will implicitly map input channels to
  1682. output channels, preserving indices.
  1683. For example, assuming a 5.1+downmix input MOV file,
  1684. @example
  1685. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1686. @end example
  1687. will create an output WAV file tagged as stereo from the downmix channels of
  1688. the input.
  1689. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1690. @example
  1691. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1692. @end example
  1693. @section channelsplit
  1694. Split each channel from an input audio stream into a separate output stream.
  1695. It accepts the following parameters:
  1696. @table @option
  1697. @item channel_layout
  1698. The channel layout of the input stream. The default is "stereo".
  1699. @end table
  1700. For example, assuming a stereo input MP3 file,
  1701. @example
  1702. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1703. @end example
  1704. will create an output Matroska file with two audio streams, one containing only
  1705. the left channel and the other the right channel.
  1706. Split a 5.1 WAV file into per-channel files:
  1707. @example
  1708. ffmpeg -i in.wav -filter_complex
  1709. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1710. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1711. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1712. side_right.wav
  1713. @end example
  1714. @section chorus
  1715. Add a chorus effect to the audio.
  1716. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1717. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1718. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1719. The modulation depth defines the range the modulated delay is played before or after
  1720. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1721. sound tuned around the original one, like in a chorus where some vocals are slightly
  1722. off key.
  1723. It accepts the following parameters:
  1724. @table @option
  1725. @item in_gain
  1726. Set input gain. Default is 0.4.
  1727. @item out_gain
  1728. Set output gain. Default is 0.4.
  1729. @item delays
  1730. Set delays. A typical delay is around 40ms to 60ms.
  1731. @item decays
  1732. Set decays.
  1733. @item speeds
  1734. Set speeds.
  1735. @item depths
  1736. Set depths.
  1737. @end table
  1738. @subsection Examples
  1739. @itemize
  1740. @item
  1741. A single delay:
  1742. @example
  1743. chorus=0.7:0.9:55:0.4:0.25:2
  1744. @end example
  1745. @item
  1746. Two delays:
  1747. @example
  1748. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1749. @end example
  1750. @item
  1751. Fuller sounding chorus with three delays:
  1752. @example
  1753. 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
  1754. @end example
  1755. @end itemize
  1756. @section compand
  1757. Compress or expand the audio's dynamic range.
  1758. It accepts the following parameters:
  1759. @table @option
  1760. @item attacks
  1761. @item decays
  1762. A list of times in seconds for each channel over which the instantaneous level
  1763. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1764. increase of volume and @var{decays} refers to decrease of volume. For most
  1765. situations, the attack time (response to the audio getting louder) should be
  1766. shorter than the decay time, because the human ear is more sensitive to sudden
  1767. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1768. a typical value for decay is 0.8 seconds.
  1769. If specified number of attacks & decays is lower than number of channels, the last
  1770. set attack/decay will be used for all remaining channels.
  1771. @item points
  1772. A list of points for the transfer function, specified in dB relative to the
  1773. maximum possible signal amplitude. Each key points list must be defined using
  1774. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1775. @code{x0/y0 x1/y1 x2/y2 ....}
  1776. The input values must be in strictly increasing order but the transfer function
  1777. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1778. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1779. function are @code{-70/-70|-60/-20|1/0}.
  1780. @item soft-knee
  1781. Set the curve radius in dB for all joints. It defaults to 0.01.
  1782. @item gain
  1783. Set the additional gain in dB to be applied at all points on the transfer
  1784. function. This allows for easy adjustment of the overall gain.
  1785. It defaults to 0.
  1786. @item volume
  1787. Set an initial volume, in dB, to be assumed for each channel when filtering
  1788. starts. This permits the user to supply a nominal level initially, so that, for
  1789. example, a very large gain is not applied to initial signal levels before the
  1790. companding has begun to operate. A typical value for audio which is initially
  1791. quiet is -90 dB. It defaults to 0.
  1792. @item delay
  1793. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1794. delayed before being fed to the volume adjuster. Specifying a delay
  1795. approximately equal to the attack/decay times allows the filter to effectively
  1796. operate in predictive rather than reactive mode. It defaults to 0.
  1797. @end table
  1798. @subsection Examples
  1799. @itemize
  1800. @item
  1801. Make music with both quiet and loud passages suitable for listening to in a
  1802. noisy environment:
  1803. @example
  1804. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1805. @end example
  1806. Another example for audio with whisper and explosion parts:
  1807. @example
  1808. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1809. @end example
  1810. @item
  1811. A noise gate for when the noise is at a lower level than the signal:
  1812. @example
  1813. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1814. @end example
  1815. @item
  1816. Here is another noise gate, this time for when the noise is at a higher level
  1817. than the signal (making it, in some ways, similar to squelch):
  1818. @example
  1819. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1820. @end example
  1821. @item
  1822. 2:1 compression starting at -6dB:
  1823. @example
  1824. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1825. @end example
  1826. @item
  1827. 2:1 compression starting at -9dB:
  1828. @example
  1829. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1830. @end example
  1831. @item
  1832. 2:1 compression starting at -12dB:
  1833. @example
  1834. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1835. @end example
  1836. @item
  1837. 2:1 compression starting at -18dB:
  1838. @example
  1839. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1840. @end example
  1841. @item
  1842. 3:1 compression starting at -15dB:
  1843. @example
  1844. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1845. @end example
  1846. @item
  1847. Compressor/Gate:
  1848. @example
  1849. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1850. @end example
  1851. @item
  1852. Expander:
  1853. @example
  1854. 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
  1855. @end example
  1856. @item
  1857. Hard limiter at -6dB:
  1858. @example
  1859. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1860. @end example
  1861. @item
  1862. Hard limiter at -12dB:
  1863. @example
  1864. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1865. @end example
  1866. @item
  1867. Hard noise gate at -35 dB:
  1868. @example
  1869. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1870. @end example
  1871. @item
  1872. Soft limiter:
  1873. @example
  1874. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1875. @end example
  1876. @end itemize
  1877. @section compensationdelay
  1878. Compensation Delay Line is a metric based delay to compensate differing
  1879. positions of microphones or speakers.
  1880. For example, you have recorded guitar with two microphones placed in
  1881. different location. Because the front of sound wave has fixed speed in
  1882. normal conditions, the phasing of microphones can vary and depends on
  1883. their location and interposition. The best sound mix can be achieved when
  1884. these microphones are in phase (synchronized). Note that distance of
  1885. ~30 cm between microphones makes one microphone to capture signal in
  1886. antiphase to another microphone. That makes the final mix sounding moody.
  1887. This filter helps to solve phasing problems by adding different delays
  1888. to each microphone track and make them synchronized.
  1889. The best result can be reached when you take one track as base and
  1890. synchronize other tracks one by one with it.
  1891. Remember that synchronization/delay tolerance depends on sample rate, too.
  1892. Higher sample rates will give more tolerance.
  1893. It accepts the following parameters:
  1894. @table @option
  1895. @item mm
  1896. Set millimeters distance. This is compensation distance for fine tuning.
  1897. Default is 0.
  1898. @item cm
  1899. Set cm distance. This is compensation distance for tightening distance setup.
  1900. Default is 0.
  1901. @item m
  1902. Set meters distance. This is compensation distance for hard distance setup.
  1903. Default is 0.
  1904. @item dry
  1905. Set dry amount. Amount of unprocessed (dry) signal.
  1906. Default is 0.
  1907. @item wet
  1908. Set wet amount. Amount of processed (wet) signal.
  1909. Default is 1.
  1910. @item temp
  1911. Set temperature degree in Celsius. This is the temperature of the environment.
  1912. Default is 20.
  1913. @end table
  1914. @section crossfeed
  1915. Apply headphone crossfeed filter.
  1916. Crossfeed is the process of blending the left and right channels of stereo
  1917. audio recording.
  1918. It is mainly used to reduce extreme stereo separation of low frequencies.
  1919. The intent is to produce more speaker like sound to the listener.
  1920. The filter accepts the following options:
  1921. @table @option
  1922. @item strength
  1923. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  1924. This sets gain of low shelf filter for side part of stereo image.
  1925. Default is -6dB. Max allowed is -30db when strength is set to 1.
  1926. @item range
  1927. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  1928. This sets cut off frequency of low shelf filter. Default is cut off near
  1929. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  1930. @item level_in
  1931. Set input gain. Default is 0.9.
  1932. @item level_out
  1933. Set output gain. Default is 1.
  1934. @end table
  1935. @section crystalizer
  1936. Simple algorithm to expand audio dynamic range.
  1937. The filter accepts the following options:
  1938. @table @option
  1939. @item i
  1940. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  1941. (unchanged sound) to 10.0 (maximum effect).
  1942. @item c
  1943. Enable clipping. By default is enabled.
  1944. @end table
  1945. @section dcshift
  1946. Apply a DC shift to the audio.
  1947. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1948. in the recording chain) from the audio. The effect of a DC offset is reduced
  1949. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1950. a signal has a DC offset.
  1951. @table @option
  1952. @item shift
  1953. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1954. the audio.
  1955. @item limitergain
  1956. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1957. used to prevent clipping.
  1958. @end table
  1959. @section dynaudnorm
  1960. Dynamic Audio Normalizer.
  1961. This filter applies a certain amount of gain to the input audio in order
  1962. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1963. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1964. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1965. This allows for applying extra gain to the "quiet" sections of the audio
  1966. while avoiding distortions or clipping the "loud" sections. In other words:
  1967. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1968. sections, in the sense that the volume of each section is brought to the
  1969. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1970. this goal *without* applying "dynamic range compressing". It will retain 100%
  1971. of the dynamic range *within* each section of the audio file.
  1972. @table @option
  1973. @item f
  1974. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1975. Default is 500 milliseconds.
  1976. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1977. referred to as frames. This is required, because a peak magnitude has no
  1978. meaning for just a single sample value. Instead, we need to determine the
  1979. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1980. normalizer would simply use the peak magnitude of the complete file, the
  1981. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1982. frame. The length of a frame is specified in milliseconds. By default, the
  1983. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1984. been found to give good results with most files.
  1985. Note that the exact frame length, in number of samples, will be determined
  1986. automatically, based on the sampling rate of the individual input audio file.
  1987. @item g
  1988. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1989. number. Default is 31.
  1990. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1991. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1992. is specified in frames, centered around the current frame. For the sake of
  1993. simplicity, this must be an odd number. Consequently, the default value of 31
  1994. takes into account the current frame, as well as the 15 preceding frames and
  1995. the 15 subsequent frames. Using a larger window results in a stronger
  1996. smoothing effect and thus in less gain variation, i.e. slower gain
  1997. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1998. effect and thus in more gain variation, i.e. faster gain adaptation.
  1999. In other words, the more you increase this value, the more the Dynamic Audio
  2000. Normalizer will behave like a "traditional" normalization filter. On the
  2001. contrary, the more you decrease this value, the more the Dynamic Audio
  2002. Normalizer will behave like a dynamic range compressor.
  2003. @item p
  2004. Set the target peak value. This specifies the highest permissible magnitude
  2005. level for the normalized audio input. This filter will try to approach the
  2006. target peak magnitude as closely as possible, but at the same time it also
  2007. makes sure that the normalized signal will never exceed the peak magnitude.
  2008. A frame's maximum local gain factor is imposed directly by the target peak
  2009. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2010. It is not recommended to go above this value.
  2011. @item m
  2012. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2013. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2014. factor for each input frame, i.e. the maximum gain factor that does not
  2015. result in clipping or distortion. The maximum gain factor is determined by
  2016. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2017. additionally bounds the frame's maximum gain factor by a predetermined
  2018. (global) maximum gain factor. This is done in order to avoid excessive gain
  2019. factors in "silent" or almost silent frames. By default, the maximum gain
  2020. factor is 10.0, For most inputs the default value should be sufficient and
  2021. it usually is not recommended to increase this value. Though, for input
  2022. with an extremely low overall volume level, it may be necessary to allow even
  2023. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2024. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2025. Instead, a "sigmoid" threshold function will be applied. This way, the
  2026. gain factors will smoothly approach the threshold value, but never exceed that
  2027. value.
  2028. @item r
  2029. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2030. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2031. This means that the maximum local gain factor for each frame is defined
  2032. (only) by the frame's highest magnitude sample. This way, the samples can
  2033. be amplified as much as possible without exceeding the maximum signal
  2034. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2035. Normalizer can also take into account the frame's root mean square,
  2036. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2037. determine the power of a time-varying signal. It is therefore considered
  2038. that the RMS is a better approximation of the "perceived loudness" than
  2039. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2040. frames to a constant RMS value, a uniform "perceived loudness" can be
  2041. established. If a target RMS value has been specified, a frame's local gain
  2042. factor is defined as the factor that would result in exactly that RMS value.
  2043. Note, however, that the maximum local gain factor is still restricted by the
  2044. frame's highest magnitude sample, in order to prevent clipping.
  2045. @item n
  2046. Enable channels coupling. By default is enabled.
  2047. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2048. amount. This means the same gain factor will be applied to all channels, i.e.
  2049. the maximum possible gain factor is determined by the "loudest" channel.
  2050. However, in some recordings, it may happen that the volume of the different
  2051. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2052. In this case, this option can be used to disable the channel coupling. This way,
  2053. the gain factor will be determined independently for each channel, depending
  2054. only on the individual channel's highest magnitude sample. This allows for
  2055. harmonizing the volume of the different channels.
  2056. @item c
  2057. Enable DC bias correction. By default is disabled.
  2058. An audio signal (in the time domain) is a sequence of sample values.
  2059. In the Dynamic Audio Normalizer these sample values are represented in the
  2060. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2061. audio signal, or "waveform", should be centered around the zero point.
  2062. That means if we calculate the mean value of all samples in a file, or in a
  2063. single frame, then the result should be 0.0 or at least very close to that
  2064. value. If, however, there is a significant deviation of the mean value from
  2065. 0.0, in either positive or negative direction, this is referred to as a
  2066. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2067. Audio Normalizer provides optional DC bias correction.
  2068. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2069. the mean value, or "DC correction" offset, of each input frame and subtract
  2070. that value from all of the frame's sample values which ensures those samples
  2071. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2072. boundaries, the DC correction offset values will be interpolated smoothly
  2073. between neighbouring frames.
  2074. @item b
  2075. Enable alternative boundary mode. By default is disabled.
  2076. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2077. around each frame. This includes the preceding frames as well as the
  2078. subsequent frames. However, for the "boundary" frames, located at the very
  2079. beginning and at the very end of the audio file, not all neighbouring
  2080. frames are available. In particular, for the first few frames in the audio
  2081. file, the preceding frames are not known. And, similarly, for the last few
  2082. frames in the audio file, the subsequent frames are not known. Thus, the
  2083. question arises which gain factors should be assumed for the missing frames
  2084. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2085. to deal with this situation. The default boundary mode assumes a gain factor
  2086. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2087. "fade out" at the beginning and at the end of the input, respectively.
  2088. @item s
  2089. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2090. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2091. compression. This means that signal peaks will not be pruned and thus the
  2092. full dynamic range will be retained within each local neighbourhood. However,
  2093. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2094. normalization algorithm with a more "traditional" compression.
  2095. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2096. (thresholding) function. If (and only if) the compression feature is enabled,
  2097. all input frames will be processed by a soft knee thresholding function prior
  2098. to the actual normalization process. Put simply, the thresholding function is
  2099. going to prune all samples whose magnitude exceeds a certain threshold value.
  2100. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2101. value. Instead, the threshold value will be adjusted for each individual
  2102. frame.
  2103. In general, smaller parameters result in stronger compression, and vice versa.
  2104. Values below 3.0 are not recommended, because audible distortion may appear.
  2105. @end table
  2106. @section earwax
  2107. Make audio easier to listen to on headphones.
  2108. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2109. so that when listened to on headphones the stereo image is moved from
  2110. inside your head (standard for headphones) to outside and in front of
  2111. the listener (standard for speakers).
  2112. Ported from SoX.
  2113. @section equalizer
  2114. Apply a two-pole peaking equalisation (EQ) filter. With this
  2115. filter, the signal-level at and around a selected frequency can
  2116. be increased or decreased, whilst (unlike bandpass and bandreject
  2117. filters) that at all other frequencies is unchanged.
  2118. In order to produce complex equalisation curves, this filter can
  2119. be given several times, each with a different central frequency.
  2120. The filter accepts the following options:
  2121. @table @option
  2122. @item frequency, f
  2123. Set the filter's central frequency in Hz.
  2124. @item width_type, t
  2125. Set method to specify band-width of filter.
  2126. @table @option
  2127. @item h
  2128. Hz
  2129. @item q
  2130. Q-Factor
  2131. @item o
  2132. octave
  2133. @item s
  2134. slope
  2135. @item k
  2136. kHz
  2137. @end table
  2138. @item width, w
  2139. Specify the band-width of a filter in width_type units.
  2140. @item gain, g
  2141. Set the required gain or attenuation in dB.
  2142. Beware of clipping when using a positive gain.
  2143. @item channels, c
  2144. Specify which channels to filter, by default all available are filtered.
  2145. @end table
  2146. @subsection Examples
  2147. @itemize
  2148. @item
  2149. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2150. @example
  2151. equalizer=f=1000:t=h:width=200:g=-10
  2152. @end example
  2153. @item
  2154. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2155. @example
  2156. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2157. @end example
  2158. @end itemize
  2159. @subsection Commands
  2160. This filter supports the following commands:
  2161. @table @option
  2162. @item frequency, f
  2163. Change equalizer frequency.
  2164. Syntax for the command is : "@var{frequency}"
  2165. @item width_type, t
  2166. Change equalizer width_type.
  2167. Syntax for the command is : "@var{width_type}"
  2168. @item width, w
  2169. Change equalizer width.
  2170. Syntax for the command is : "@var{width}"
  2171. @item gain, g
  2172. Change equalizer gain.
  2173. Syntax for the command is : "@var{gain}"
  2174. @end table
  2175. @section extrastereo
  2176. Linearly increases the difference between left and right channels which
  2177. adds some sort of "live" effect to playback.
  2178. The filter accepts the following options:
  2179. @table @option
  2180. @item m
  2181. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2182. (average of both channels), with 1.0 sound will be unchanged, with
  2183. -1.0 left and right channels will be swapped.
  2184. @item c
  2185. Enable clipping. By default is enabled.
  2186. @end table
  2187. @section firequalizer
  2188. Apply FIR Equalization using arbitrary frequency response.
  2189. The filter accepts the following option:
  2190. @table @option
  2191. @item gain
  2192. Set gain curve equation (in dB). The expression can contain variables:
  2193. @table @option
  2194. @item f
  2195. the evaluated frequency
  2196. @item sr
  2197. sample rate
  2198. @item ch
  2199. channel number, set to 0 when multichannels evaluation is disabled
  2200. @item chid
  2201. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2202. multichannels evaluation is disabled
  2203. @item chs
  2204. number of channels
  2205. @item chlayout
  2206. channel_layout, see libavutil/channel_layout.h
  2207. @end table
  2208. and functions:
  2209. @table @option
  2210. @item gain_interpolate(f)
  2211. interpolate gain on frequency f based on gain_entry
  2212. @item cubic_interpolate(f)
  2213. same as gain_interpolate, but smoother
  2214. @end table
  2215. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2216. @item gain_entry
  2217. Set gain entry for gain_interpolate function. The expression can
  2218. contain functions:
  2219. @table @option
  2220. @item entry(f, g)
  2221. store gain entry at frequency f with value g
  2222. @end table
  2223. This option is also available as command.
  2224. @item delay
  2225. Set filter delay in seconds. Higher value means more accurate.
  2226. Default is @code{0.01}.
  2227. @item accuracy
  2228. Set filter accuracy in Hz. Lower value means more accurate.
  2229. Default is @code{5}.
  2230. @item wfunc
  2231. Set window function. Acceptable values are:
  2232. @table @option
  2233. @item rectangular
  2234. rectangular window, useful when gain curve is already smooth
  2235. @item hann
  2236. hann window (default)
  2237. @item hamming
  2238. hamming window
  2239. @item blackman
  2240. blackman window
  2241. @item nuttall3
  2242. 3-terms continuous 1st derivative nuttall window
  2243. @item mnuttall3
  2244. minimum 3-terms discontinuous nuttall window
  2245. @item nuttall
  2246. 4-terms continuous 1st derivative nuttall window
  2247. @item bnuttall
  2248. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2249. @item bharris
  2250. blackman-harris window
  2251. @item tukey
  2252. tukey window
  2253. @end table
  2254. @item fixed
  2255. If enabled, use fixed number of audio samples. This improves speed when
  2256. filtering with large delay. Default is disabled.
  2257. @item multi
  2258. Enable multichannels evaluation on gain. Default is disabled.
  2259. @item zero_phase
  2260. Enable zero phase mode by subtracting timestamp to compensate delay.
  2261. Default is disabled.
  2262. @item scale
  2263. Set scale used by gain. Acceptable values are:
  2264. @table @option
  2265. @item linlin
  2266. linear frequency, linear gain
  2267. @item linlog
  2268. linear frequency, logarithmic (in dB) gain (default)
  2269. @item loglin
  2270. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2271. @item loglog
  2272. logarithmic frequency, logarithmic gain
  2273. @end table
  2274. @item dumpfile
  2275. Set file for dumping, suitable for gnuplot.
  2276. @item dumpscale
  2277. Set scale for dumpfile. Acceptable values are same with scale option.
  2278. Default is linlog.
  2279. @item fft2
  2280. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2281. Default is disabled.
  2282. @item min_phase
  2283. Enable minimum phase impulse response. Default is disabled.
  2284. @end table
  2285. @subsection Examples
  2286. @itemize
  2287. @item
  2288. lowpass at 1000 Hz:
  2289. @example
  2290. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2291. @end example
  2292. @item
  2293. lowpass at 1000 Hz with gain_entry:
  2294. @example
  2295. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2296. @end example
  2297. @item
  2298. custom equalization:
  2299. @example
  2300. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2301. @end example
  2302. @item
  2303. higher delay with zero phase to compensate delay:
  2304. @example
  2305. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2306. @end example
  2307. @item
  2308. lowpass on left channel, highpass on right channel:
  2309. @example
  2310. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2311. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2312. @end example
  2313. @end itemize
  2314. @section flanger
  2315. Apply a flanging effect to the audio.
  2316. The filter accepts the following options:
  2317. @table @option
  2318. @item delay
  2319. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2320. @item depth
  2321. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2322. @item regen
  2323. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2324. Default value is 0.
  2325. @item width
  2326. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2327. Default value is 71.
  2328. @item speed
  2329. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2330. @item shape
  2331. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2332. Default value is @var{sinusoidal}.
  2333. @item phase
  2334. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2335. Default value is 25.
  2336. @item interp
  2337. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2338. Default is @var{linear}.
  2339. @end table
  2340. @section haas
  2341. Apply Haas effect to audio.
  2342. Note that this makes most sense to apply on mono signals.
  2343. With this filter applied to mono signals it give some directionality and
  2344. stretches its stereo image.
  2345. The filter accepts the following options:
  2346. @table @option
  2347. @item level_in
  2348. Set input level. By default is @var{1}, or 0dB
  2349. @item level_out
  2350. Set output level. By default is @var{1}, or 0dB.
  2351. @item side_gain
  2352. Set gain applied to side part of signal. By default is @var{1}.
  2353. @item middle_source
  2354. Set kind of middle source. Can be one of the following:
  2355. @table @samp
  2356. @item left
  2357. Pick left channel.
  2358. @item right
  2359. Pick right channel.
  2360. @item mid
  2361. Pick middle part signal of stereo image.
  2362. @item side
  2363. Pick side part signal of stereo image.
  2364. @end table
  2365. @item middle_phase
  2366. Change middle phase. By default is disabled.
  2367. @item left_delay
  2368. Set left channel delay. By default is @var{2.05} milliseconds.
  2369. @item left_balance
  2370. Set left channel balance. By default is @var{-1}.
  2371. @item left_gain
  2372. Set left channel gain. By default is @var{1}.
  2373. @item left_phase
  2374. Change left phase. By default is disabled.
  2375. @item right_delay
  2376. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2377. @item right_balance
  2378. Set right channel balance. By default is @var{1}.
  2379. @item right_gain
  2380. Set right channel gain. By default is @var{1}.
  2381. @item right_phase
  2382. Change right phase. By default is enabled.
  2383. @end table
  2384. @section hdcd
  2385. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2386. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2387. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2388. of HDCD, and detects the Transient Filter flag.
  2389. @example
  2390. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2391. @end example
  2392. When using the filter with wav, note the default encoding for wav is 16-bit,
  2393. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2394. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2395. @example
  2396. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2397. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2398. @end example
  2399. The filter accepts the following options:
  2400. @table @option
  2401. @item disable_autoconvert
  2402. Disable any automatic format conversion or resampling in the filter graph.
  2403. @item process_stereo
  2404. Process the stereo channels together. If target_gain does not match between
  2405. channels, consider it invalid and use the last valid target_gain.
  2406. @item cdt_ms
  2407. Set the code detect timer period in ms.
  2408. @item force_pe
  2409. Always extend peaks above -3dBFS even if PE isn't signaled.
  2410. @item analyze_mode
  2411. Replace audio with a solid tone and adjust the amplitude to signal some
  2412. specific aspect of the decoding process. The output file can be loaded in
  2413. an audio editor alongside the original to aid analysis.
  2414. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2415. Modes are:
  2416. @table @samp
  2417. @item 0, off
  2418. Disabled
  2419. @item 1, lle
  2420. Gain adjustment level at each sample
  2421. @item 2, pe
  2422. Samples where peak extend occurs
  2423. @item 3, cdt
  2424. Samples where the code detect timer is active
  2425. @item 4, tgm
  2426. Samples where the target gain does not match between channels
  2427. @end table
  2428. @end table
  2429. @section headphone
  2430. Apply head-related transfer functions (HRTFs) to create virtual
  2431. loudspeakers around the user for binaural listening via headphones.
  2432. The HRIRs are provided via additional streams, for each channel
  2433. one stereo input stream is needed.
  2434. The filter accepts the following options:
  2435. @table @option
  2436. @item map
  2437. Set mapping of input streams for convolution.
  2438. The argument is a '|'-separated list of channel names in order as they
  2439. are given as additional stream inputs for filter.
  2440. This also specify number of input streams. Number of input streams
  2441. must be not less than number of channels in first stream plus one.
  2442. @item gain
  2443. Set gain applied to audio. Value is in dB. Default is 0.
  2444. @item type
  2445. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2446. processing audio in time domain which is slow.
  2447. @var{freq} is processing audio in frequency domain which is fast.
  2448. Default is @var{freq}.
  2449. @item lfe
  2450. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2451. @end table
  2452. @subsection Examples
  2453. @itemize
  2454. @item
  2455. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2456. each amovie filter use stereo file with IR coefficients as input.
  2457. The files give coefficients for each position of virtual loudspeaker:
  2458. @example
  2459. ffmpeg -i input.wav -lavfi-complex "amovie=azi_270_ele_0_DFC.wav[sr],amovie=azi_90_ele_0_DFC.wav[sl],amovie=azi_225_ele_0_DFC.wav[br],amovie=azi_135_ele_0_DFC.wav[bl],amovie=azi_0_ele_0_DFC.wav,asplit[fc][lfe],amovie=azi_35_ele_0_DFC.wav[fl],amovie=azi_325_ele_0_DFC.wav[fr],[a:0][fl][fr][fc][lfe][bl][br][sl][sr]headphone=FL|FR|FC|LFE|BL|BR|SL|SR"
  2460. output.wav
  2461. @end example
  2462. @end itemize
  2463. @section highpass
  2464. Apply a high-pass filter with 3dB point frequency.
  2465. The filter can be either single-pole, or double-pole (the default).
  2466. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2467. The filter accepts the following options:
  2468. @table @option
  2469. @item frequency, f
  2470. Set frequency in Hz. Default is 3000.
  2471. @item poles, p
  2472. Set number of poles. Default is 2.
  2473. @item width_type, t
  2474. Set method to specify band-width of filter.
  2475. @table @option
  2476. @item h
  2477. Hz
  2478. @item q
  2479. Q-Factor
  2480. @item o
  2481. octave
  2482. @item s
  2483. slope
  2484. @item k
  2485. kHz
  2486. @end table
  2487. @item width, w
  2488. Specify the band-width of a filter in width_type units.
  2489. Applies only to double-pole filter.
  2490. The default is 0.707q and gives a Butterworth response.
  2491. @item channels, c
  2492. Specify which channels to filter, by default all available are filtered.
  2493. @end table
  2494. @subsection Commands
  2495. This filter supports the following commands:
  2496. @table @option
  2497. @item frequency, f
  2498. Change highpass frequency.
  2499. Syntax for the command is : "@var{frequency}"
  2500. @item width_type, t
  2501. Change highpass width_type.
  2502. Syntax for the command is : "@var{width_type}"
  2503. @item width, w
  2504. Change highpass width.
  2505. Syntax for the command is : "@var{width}"
  2506. @end table
  2507. @section join
  2508. Join multiple input streams into one multi-channel stream.
  2509. It accepts the following parameters:
  2510. @table @option
  2511. @item inputs
  2512. The number of input streams. It defaults to 2.
  2513. @item channel_layout
  2514. The desired output channel layout. It defaults to stereo.
  2515. @item map
  2516. Map channels from inputs to output. The argument is a '|'-separated list of
  2517. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2518. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2519. can be either the name of the input channel (e.g. FL for front left) or its
  2520. index in the specified input stream. @var{out_channel} is the name of the output
  2521. channel.
  2522. @end table
  2523. The filter will attempt to guess the mappings when they are not specified
  2524. explicitly. It does so by first trying to find an unused matching input channel
  2525. and if that fails it picks the first unused input channel.
  2526. Join 3 inputs (with properly set channel layouts):
  2527. @example
  2528. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2529. @end example
  2530. Build a 5.1 output from 6 single-channel streams:
  2531. @example
  2532. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2533. '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'
  2534. out
  2535. @end example
  2536. @section ladspa
  2537. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2538. To enable compilation of this filter you need to configure FFmpeg with
  2539. @code{--enable-ladspa}.
  2540. @table @option
  2541. @item file, f
  2542. Specifies the name of LADSPA plugin library to load. If the environment
  2543. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2544. each one of the directories specified by the colon separated list in
  2545. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2546. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2547. @file{/usr/lib/ladspa/}.
  2548. @item plugin, p
  2549. Specifies the plugin within the library. Some libraries contain only
  2550. one plugin, but others contain many of them. If this is not set filter
  2551. will list all available plugins within the specified library.
  2552. @item controls, c
  2553. Set the '|' separated list of controls which are zero or more floating point
  2554. values that determine the behavior of the loaded plugin (for example delay,
  2555. threshold or gain).
  2556. Controls need to be defined using the following syntax:
  2557. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2558. @var{valuei} is the value set on the @var{i}-th control.
  2559. Alternatively they can be also defined using the following syntax:
  2560. @var{value0}|@var{value1}|@var{value2}|..., where
  2561. @var{valuei} is the value set on the @var{i}-th control.
  2562. If @option{controls} is set to @code{help}, all available controls and
  2563. their valid ranges are printed.
  2564. @item sample_rate, s
  2565. Specify the sample rate, default to 44100. Only used if plugin have
  2566. zero inputs.
  2567. @item nb_samples, n
  2568. Set the number of samples per channel per each output frame, default
  2569. is 1024. Only used if plugin have zero inputs.
  2570. @item duration, d
  2571. Set the minimum duration of the sourced audio. See
  2572. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2573. for the accepted syntax.
  2574. Note that the resulting duration may be greater than the specified duration,
  2575. as the generated audio is always cut at the end of a complete frame.
  2576. If not specified, or the expressed duration is negative, the audio is
  2577. supposed to be generated forever.
  2578. Only used if plugin have zero inputs.
  2579. @end table
  2580. @subsection Examples
  2581. @itemize
  2582. @item
  2583. List all available plugins within amp (LADSPA example plugin) library:
  2584. @example
  2585. ladspa=file=amp
  2586. @end example
  2587. @item
  2588. List all available controls and their valid ranges for @code{vcf_notch}
  2589. plugin from @code{VCF} library:
  2590. @example
  2591. ladspa=f=vcf:p=vcf_notch:c=help
  2592. @end example
  2593. @item
  2594. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2595. plugin library:
  2596. @example
  2597. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2598. @end example
  2599. @item
  2600. Add reverberation to the audio using TAP-plugins
  2601. (Tom's Audio Processing plugins):
  2602. @example
  2603. ladspa=file=tap_reverb:tap_reverb
  2604. @end example
  2605. @item
  2606. Generate white noise, with 0.2 amplitude:
  2607. @example
  2608. ladspa=file=cmt:noise_source_white:c=c0=.2
  2609. @end example
  2610. @item
  2611. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2612. @code{C* Audio Plugin Suite} (CAPS) library:
  2613. @example
  2614. ladspa=file=caps:Click:c=c1=20'
  2615. @end example
  2616. @item
  2617. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2618. @example
  2619. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2620. @end example
  2621. @item
  2622. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2623. @code{SWH Plugins} collection:
  2624. @example
  2625. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2626. @end example
  2627. @item
  2628. Attenuate low frequencies using Multiband EQ from Steve Harris
  2629. @code{SWH Plugins} collection:
  2630. @example
  2631. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2632. @end example
  2633. @item
  2634. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2635. (CAPS) library:
  2636. @example
  2637. ladspa=caps:Narrower
  2638. @end example
  2639. @item
  2640. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2641. @example
  2642. ladspa=caps:White:.2
  2643. @end example
  2644. @item
  2645. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2646. @example
  2647. ladspa=caps:Fractal:c=c1=1
  2648. @end example
  2649. @item
  2650. Dynamic volume normalization using @code{VLevel} plugin:
  2651. @example
  2652. ladspa=vlevel-ladspa:vlevel_mono
  2653. @end example
  2654. @end itemize
  2655. @subsection Commands
  2656. This filter supports the following commands:
  2657. @table @option
  2658. @item cN
  2659. Modify the @var{N}-th control value.
  2660. If the specified value is not valid, it is ignored and prior one is kept.
  2661. @end table
  2662. @section loudnorm
  2663. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2664. Support for both single pass (livestreams, files) and double pass (files) modes.
  2665. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  2666. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  2667. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  2668. The filter accepts the following options:
  2669. @table @option
  2670. @item I, i
  2671. Set integrated loudness target.
  2672. Range is -70.0 - -5.0. Default value is -24.0.
  2673. @item LRA, lra
  2674. Set loudness range target.
  2675. Range is 1.0 - 20.0. Default value is 7.0.
  2676. @item TP, tp
  2677. Set maximum true peak.
  2678. Range is -9.0 - +0.0. Default value is -2.0.
  2679. @item measured_I, measured_i
  2680. Measured IL of input file.
  2681. Range is -99.0 - +0.0.
  2682. @item measured_LRA, measured_lra
  2683. Measured LRA of input file.
  2684. Range is 0.0 - 99.0.
  2685. @item measured_TP, measured_tp
  2686. Measured true peak of input file.
  2687. Range is -99.0 - +99.0.
  2688. @item measured_thresh
  2689. Measured threshold of input file.
  2690. Range is -99.0 - +0.0.
  2691. @item offset
  2692. Set offset gain. Gain is applied before the true-peak limiter.
  2693. Range is -99.0 - +99.0. Default is +0.0.
  2694. @item linear
  2695. Normalize linearly if possible.
  2696. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2697. to be specified in order to use this mode.
  2698. Options are true or false. Default is true.
  2699. @item dual_mono
  2700. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2701. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2702. If set to @code{true}, this option will compensate for this effect.
  2703. Multi-channel input files are not affected by this option.
  2704. Options are true or false. Default is false.
  2705. @item print_format
  2706. Set print format for stats. Options are summary, json, or none.
  2707. Default value is none.
  2708. @end table
  2709. @section lowpass
  2710. Apply a low-pass filter with 3dB point frequency.
  2711. The filter can be either single-pole or double-pole (the default).
  2712. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2713. The filter accepts the following options:
  2714. @table @option
  2715. @item frequency, f
  2716. Set frequency in Hz. Default is 500.
  2717. @item poles, p
  2718. Set number of poles. Default is 2.
  2719. @item width_type, t
  2720. Set method to specify band-width of filter.
  2721. @table @option
  2722. @item h
  2723. Hz
  2724. @item q
  2725. Q-Factor
  2726. @item o
  2727. octave
  2728. @item s
  2729. slope
  2730. @item k
  2731. kHz
  2732. @end table
  2733. @item width, w
  2734. Specify the band-width of a filter in width_type units.
  2735. Applies only to double-pole filter.
  2736. The default is 0.707q and gives a Butterworth response.
  2737. @item channels, c
  2738. Specify which channels to filter, by default all available are filtered.
  2739. @end table
  2740. @subsection Examples
  2741. @itemize
  2742. @item
  2743. Lowpass only LFE channel, it LFE is not present it does nothing:
  2744. @example
  2745. lowpass=c=LFE
  2746. @end example
  2747. @end itemize
  2748. @subsection Commands
  2749. This filter supports the following commands:
  2750. @table @option
  2751. @item frequency, f
  2752. Change lowpass frequency.
  2753. Syntax for the command is : "@var{frequency}"
  2754. @item width_type, t
  2755. Change lowpass width_type.
  2756. Syntax for the command is : "@var{width_type}"
  2757. @item width, w
  2758. Change lowpass width.
  2759. Syntax for the command is : "@var{width}"
  2760. @end table
  2761. @section lv2
  2762. Load a LV2 (LADSPA Version 2) plugin.
  2763. To enable compilation of this filter you need to configure FFmpeg with
  2764. @code{--enable-lv2}.
  2765. @table @option
  2766. @item plugin, p
  2767. Specifies the plugin URI. You may need to escape ':'.
  2768. @item controls, c
  2769. Set the '|' separated list of controls which are zero or more floating point
  2770. values that determine the behavior of the loaded plugin (for example delay,
  2771. threshold or gain).
  2772. If @option{controls} is set to @code{help}, all available controls and
  2773. their valid ranges are printed.
  2774. @item sample_rate, s
  2775. Specify the sample rate, default to 44100. Only used if plugin have
  2776. zero inputs.
  2777. @item nb_samples, n
  2778. Set the number of samples per channel per each output frame, default
  2779. is 1024. Only used if plugin have zero inputs.
  2780. @item duration, d
  2781. Set the minimum duration of the sourced audio. See
  2782. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2783. for the accepted syntax.
  2784. Note that the resulting duration may be greater than the specified duration,
  2785. as the generated audio is always cut at the end of a complete frame.
  2786. If not specified, or the expressed duration is negative, the audio is
  2787. supposed to be generated forever.
  2788. Only used if plugin have zero inputs.
  2789. @end table
  2790. @subsection Examples
  2791. @itemize
  2792. @item
  2793. Apply bass enhancer plugin from Calf:
  2794. @example
  2795. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  2796. @end example
  2797. @item
  2798. Apply bass vinyl plugin from Calf:
  2799. @example
  2800. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  2801. @end example
  2802. @item
  2803. Apply bit crusher plugin from ArtyFX:
  2804. @example
  2805. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  2806. @end example
  2807. @end itemize
  2808. @section mcompand
  2809. Multiband Compress or expand the audio's dynamic range.
  2810. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  2811. This is akin to the crossover of a loudspeaker, and results in flat frequency
  2812. response when absent compander action.
  2813. It accepts the following parameters:
  2814. @table @option
  2815. @item args
  2816. This option syntax is:
  2817. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  2818. For explanation of each item refer to compand filter documentation.
  2819. @end table
  2820. @anchor{pan}
  2821. @section pan
  2822. Mix channels with specific gain levels. The filter accepts the output
  2823. channel layout followed by a set of channels definitions.
  2824. This filter is also designed to efficiently remap the channels of an audio
  2825. stream.
  2826. The filter accepts parameters of the form:
  2827. "@var{l}|@var{outdef}|@var{outdef}|..."
  2828. @table @option
  2829. @item l
  2830. output channel layout or number of channels
  2831. @item outdef
  2832. output channel specification, of the form:
  2833. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  2834. @item out_name
  2835. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2836. number (c0, c1, etc.)
  2837. @item gain
  2838. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2839. @item in_name
  2840. input channel to use, see out_name for details; it is not possible to mix
  2841. named and numbered input channels
  2842. @end table
  2843. If the `=' in a channel specification is replaced by `<', then the gains for
  2844. that specification will be renormalized so that the total is 1, thus
  2845. avoiding clipping noise.
  2846. @subsection Mixing examples
  2847. For example, if you want to down-mix from stereo to mono, but with a bigger
  2848. factor for the left channel:
  2849. @example
  2850. pan=1c|c0=0.9*c0+0.1*c1
  2851. @end example
  2852. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2853. 7-channels surround:
  2854. @example
  2855. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2856. @end example
  2857. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2858. that should be preferred (see "-ac" option) unless you have very specific
  2859. needs.
  2860. @subsection Remapping examples
  2861. The channel remapping will be effective if, and only if:
  2862. @itemize
  2863. @item gain coefficients are zeroes or ones,
  2864. @item only one input per channel output,
  2865. @end itemize
  2866. If all these conditions are satisfied, the filter will notify the user ("Pure
  2867. channel mapping detected"), and use an optimized and lossless method to do the
  2868. remapping.
  2869. For example, if you have a 5.1 source and want a stereo audio stream by
  2870. dropping the extra channels:
  2871. @example
  2872. pan="stereo| c0=FL | c1=FR"
  2873. @end example
  2874. Given the same source, you can also switch front left and front right channels
  2875. and keep the input channel layout:
  2876. @example
  2877. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2878. @end example
  2879. If the input is a stereo audio stream, you can mute the front left channel (and
  2880. still keep the stereo channel layout) with:
  2881. @example
  2882. pan="stereo|c1=c1"
  2883. @end example
  2884. Still with a stereo audio stream input, you can copy the right channel in both
  2885. front left and right:
  2886. @example
  2887. pan="stereo| c0=FR | c1=FR"
  2888. @end example
  2889. @section replaygain
  2890. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2891. outputs it unchanged.
  2892. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2893. @section resample
  2894. Convert the audio sample format, sample rate and channel layout. It is
  2895. not meant to be used directly.
  2896. @section rubberband
  2897. Apply time-stretching and pitch-shifting with librubberband.
  2898. The filter accepts the following options:
  2899. @table @option
  2900. @item tempo
  2901. Set tempo scale factor.
  2902. @item pitch
  2903. Set pitch scale factor.
  2904. @item transients
  2905. Set transients detector.
  2906. Possible values are:
  2907. @table @var
  2908. @item crisp
  2909. @item mixed
  2910. @item smooth
  2911. @end table
  2912. @item detector
  2913. Set detector.
  2914. Possible values are:
  2915. @table @var
  2916. @item compound
  2917. @item percussive
  2918. @item soft
  2919. @end table
  2920. @item phase
  2921. Set phase.
  2922. Possible values are:
  2923. @table @var
  2924. @item laminar
  2925. @item independent
  2926. @end table
  2927. @item window
  2928. Set processing window size.
  2929. Possible values are:
  2930. @table @var
  2931. @item standard
  2932. @item short
  2933. @item long
  2934. @end table
  2935. @item smoothing
  2936. Set smoothing.
  2937. Possible values are:
  2938. @table @var
  2939. @item off
  2940. @item on
  2941. @end table
  2942. @item formant
  2943. Enable formant preservation when shift pitching.
  2944. Possible values are:
  2945. @table @var
  2946. @item shifted
  2947. @item preserved
  2948. @end table
  2949. @item pitchq
  2950. Set pitch quality.
  2951. Possible values are:
  2952. @table @var
  2953. @item quality
  2954. @item speed
  2955. @item consistency
  2956. @end table
  2957. @item channels
  2958. Set channels.
  2959. Possible values are:
  2960. @table @var
  2961. @item apart
  2962. @item together
  2963. @end table
  2964. @end table
  2965. @section sidechaincompress
  2966. This filter acts like normal compressor but has the ability to compress
  2967. detected signal using second input signal.
  2968. It needs two input streams and returns one output stream.
  2969. First input stream will be processed depending on second stream signal.
  2970. The filtered signal then can be filtered with other filters in later stages of
  2971. processing. See @ref{pan} and @ref{amerge} filter.
  2972. The filter accepts the following options:
  2973. @table @option
  2974. @item level_in
  2975. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2976. @item threshold
  2977. If a signal of second stream raises above this level it will affect the gain
  2978. reduction of first stream.
  2979. By default is 0.125. Range is between 0.00097563 and 1.
  2980. @item ratio
  2981. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2982. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2983. Default is 2. Range is between 1 and 20.
  2984. @item attack
  2985. Amount of milliseconds the signal has to rise above the threshold before gain
  2986. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2987. @item release
  2988. Amount of milliseconds the signal has to fall below the threshold before
  2989. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2990. @item makeup
  2991. Set the amount by how much signal will be amplified after processing.
  2992. Default is 1. Range is from 1 to 64.
  2993. @item knee
  2994. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2995. Default is 2.82843. Range is between 1 and 8.
  2996. @item link
  2997. Choose if the @code{average} level between all channels of side-chain stream
  2998. or the louder(@code{maximum}) channel of side-chain stream affects the
  2999. reduction. Default is @code{average}.
  3000. @item detection
  3001. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3002. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3003. @item level_sc
  3004. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3005. @item mix
  3006. How much to use compressed signal in output. Default is 1.
  3007. Range is between 0 and 1.
  3008. @end table
  3009. @subsection Examples
  3010. @itemize
  3011. @item
  3012. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3013. depending on the signal of 2nd input and later compressed signal to be
  3014. merged with 2nd input:
  3015. @example
  3016. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3017. @end example
  3018. @end itemize
  3019. @section sidechaingate
  3020. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3021. filter the detected signal before sending it to the gain reduction stage.
  3022. Normally a gate uses the full range signal to detect a level above the
  3023. threshold.
  3024. For example: If you cut all lower frequencies from your sidechain signal
  3025. the gate will decrease the volume of your track only if not enough highs
  3026. appear. With this technique you are able to reduce the resonation of a
  3027. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3028. guitar.
  3029. It needs two input streams and returns one output stream.
  3030. First input stream will be processed depending on second stream signal.
  3031. The filter accepts the following options:
  3032. @table @option
  3033. @item level_in
  3034. Set input level before filtering.
  3035. Default is 1. Allowed range is from 0.015625 to 64.
  3036. @item range
  3037. Set the level of gain reduction when the signal is below the threshold.
  3038. Default is 0.06125. Allowed range is from 0 to 1.
  3039. @item threshold
  3040. If a signal rises above this level the gain reduction is released.
  3041. Default is 0.125. Allowed range is from 0 to 1.
  3042. @item ratio
  3043. Set a ratio about which the signal is reduced.
  3044. Default is 2. Allowed range is from 1 to 9000.
  3045. @item attack
  3046. Amount of milliseconds the signal has to rise above the threshold before gain
  3047. reduction stops.
  3048. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3049. @item release
  3050. Amount of milliseconds the signal has to fall below the threshold before the
  3051. reduction is increased again. Default is 250 milliseconds.
  3052. Allowed range is from 0.01 to 9000.
  3053. @item makeup
  3054. Set amount of amplification of signal after processing.
  3055. Default is 1. Allowed range is from 1 to 64.
  3056. @item knee
  3057. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3058. Default is 2.828427125. Allowed range is from 1 to 8.
  3059. @item detection
  3060. Choose if exact signal should be taken for detection or an RMS like one.
  3061. Default is rms. Can be peak or rms.
  3062. @item link
  3063. Choose if the average level between all channels or the louder channel affects
  3064. the reduction.
  3065. Default is average. Can be average or maximum.
  3066. @item level_sc
  3067. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3068. @end table
  3069. @section silencedetect
  3070. Detect silence in an audio stream.
  3071. This filter logs a message when it detects that the input audio volume is less
  3072. or equal to a noise tolerance value for a duration greater or equal to the
  3073. minimum detected noise duration.
  3074. The printed times and duration are expressed in seconds.
  3075. The filter accepts the following options:
  3076. @table @option
  3077. @item duration, d
  3078. Set silence duration until notification (default is 2 seconds).
  3079. @item noise, n
  3080. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3081. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3082. @end table
  3083. @subsection Examples
  3084. @itemize
  3085. @item
  3086. Detect 5 seconds of silence with -50dB noise tolerance:
  3087. @example
  3088. silencedetect=n=-50dB:d=5
  3089. @end example
  3090. @item
  3091. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3092. tolerance in @file{silence.mp3}:
  3093. @example
  3094. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3095. @end example
  3096. @end itemize
  3097. @section silenceremove
  3098. Remove silence from the beginning, middle or end of the audio.
  3099. The filter accepts the following options:
  3100. @table @option
  3101. @item start_periods
  3102. This value is used to indicate if audio should be trimmed at beginning of
  3103. the audio. A value of zero indicates no silence should be trimmed from the
  3104. beginning. When specifying a non-zero value, it trims audio up until it
  3105. finds non-silence. Normally, when trimming silence from beginning of audio
  3106. the @var{start_periods} will be @code{1} but it can be increased to higher
  3107. values to trim all audio up to specific count of non-silence periods.
  3108. Default value is @code{0}.
  3109. @item start_duration
  3110. Specify the amount of time that non-silence must be detected before it stops
  3111. trimming audio. By increasing the duration, bursts of noises can be treated
  3112. as silence and trimmed off. Default value is @code{0}.
  3113. @item start_threshold
  3114. This indicates what sample value should be treated as silence. For digital
  3115. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3116. you may wish to increase the value to account for background noise.
  3117. Can be specified in dB (in case "dB" is appended to the specified value)
  3118. or amplitude ratio. Default value is @code{0}.
  3119. @item stop_periods
  3120. Set the count for trimming silence from the end of audio.
  3121. To remove silence from the middle of a file, specify a @var{stop_periods}
  3122. that is negative. This value is then treated as a positive value and is
  3123. used to indicate the effect should restart processing as specified by
  3124. @var{start_periods}, making it suitable for removing periods of silence
  3125. in the middle of the audio.
  3126. Default value is @code{0}.
  3127. @item stop_duration
  3128. Specify a duration of silence that must exist before audio is not copied any
  3129. more. By specifying a higher duration, silence that is wanted can be left in
  3130. the audio.
  3131. Default value is @code{0}.
  3132. @item stop_threshold
  3133. This is the same as @option{start_threshold} but for trimming silence from
  3134. the end of audio.
  3135. Can be specified in dB (in case "dB" is appended to the specified value)
  3136. or amplitude ratio. Default value is @code{0}.
  3137. @item leave_silence
  3138. This indicates that @var{stop_duration} length of audio should be left intact
  3139. at the beginning of each period of silence.
  3140. For example, if you want to remove long pauses between words but do not want
  3141. to remove the pauses completely. Default value is @code{0}.
  3142. @item detection
  3143. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3144. and works better with digital silence which is exactly 0.
  3145. Default value is @code{rms}.
  3146. @item window
  3147. Set ratio used to calculate size of window for detecting silence.
  3148. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3149. @end table
  3150. @subsection Examples
  3151. @itemize
  3152. @item
  3153. The following example shows how this filter can be used to start a recording
  3154. that does not contain the delay at the start which usually occurs between
  3155. pressing the record button and the start of the performance:
  3156. @example
  3157. silenceremove=1:5:0.02
  3158. @end example
  3159. @item
  3160. Trim all silence encountered from beginning to end where there is more than 1
  3161. second of silence in audio:
  3162. @example
  3163. silenceremove=0:0:0:-1:1:-90dB
  3164. @end example
  3165. @end itemize
  3166. @section sofalizer
  3167. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3168. loudspeakers around the user for binaural listening via headphones (audio
  3169. formats up to 9 channels supported).
  3170. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3171. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3172. Austrian Academy of Sciences.
  3173. To enable compilation of this filter you need to configure FFmpeg with
  3174. @code{--enable-libmysofa}.
  3175. The filter accepts the following options:
  3176. @table @option
  3177. @item sofa
  3178. Set the SOFA file used for rendering.
  3179. @item gain
  3180. Set gain applied to audio. Value is in dB. Default is 0.
  3181. @item rotation
  3182. Set rotation of virtual loudspeakers in deg. Default is 0.
  3183. @item elevation
  3184. Set elevation of virtual speakers in deg. Default is 0.
  3185. @item radius
  3186. Set distance in meters between loudspeakers and the listener with near-field
  3187. HRTFs. Default is 1.
  3188. @item type
  3189. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3190. processing audio in time domain which is slow.
  3191. @var{freq} is processing audio in frequency domain which is fast.
  3192. Default is @var{freq}.
  3193. @item speakers
  3194. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3195. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3196. Each virtual loudspeaker is described with short channel name following with
  3197. azimuth and elevation in degrees.
  3198. Each virtual loudspeaker description is separated by '|'.
  3199. For example to override front left and front right channel positions use:
  3200. 'speakers=FL 45 15|FR 345 15'.
  3201. Descriptions with unrecognised channel names are ignored.
  3202. @item lfegain
  3203. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3204. @end table
  3205. @subsection Examples
  3206. @itemize
  3207. @item
  3208. Using ClubFritz6 sofa file:
  3209. @example
  3210. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3211. @end example
  3212. @item
  3213. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3214. @example
  3215. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3216. @end example
  3217. @item
  3218. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3219. and also with custom gain:
  3220. @example
  3221. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3222. @end example
  3223. @end itemize
  3224. @section stereotools
  3225. This filter has some handy utilities to manage stereo signals, for converting
  3226. M/S stereo recordings to L/R signal while having control over the parameters
  3227. or spreading the stereo image of master track.
  3228. The filter accepts the following options:
  3229. @table @option
  3230. @item level_in
  3231. Set input level before filtering for both channels. Defaults is 1.
  3232. Allowed range is from 0.015625 to 64.
  3233. @item level_out
  3234. Set output level after filtering for both channels. Defaults is 1.
  3235. Allowed range is from 0.015625 to 64.
  3236. @item balance_in
  3237. Set input balance between both channels. Default is 0.
  3238. Allowed range is from -1 to 1.
  3239. @item balance_out
  3240. Set output balance between both channels. Default is 0.
  3241. Allowed range is from -1 to 1.
  3242. @item softclip
  3243. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3244. clipping. Disabled by default.
  3245. @item mutel
  3246. Mute the left channel. Disabled by default.
  3247. @item muter
  3248. Mute the right channel. Disabled by default.
  3249. @item phasel
  3250. Change the phase of the left channel. Disabled by default.
  3251. @item phaser
  3252. Change the phase of the right channel. Disabled by default.
  3253. @item mode
  3254. Set stereo mode. Available values are:
  3255. @table @samp
  3256. @item lr>lr
  3257. Left/Right to Left/Right, this is default.
  3258. @item lr>ms
  3259. Left/Right to Mid/Side.
  3260. @item ms>lr
  3261. Mid/Side to Left/Right.
  3262. @item lr>ll
  3263. Left/Right to Left/Left.
  3264. @item lr>rr
  3265. Left/Right to Right/Right.
  3266. @item lr>l+r
  3267. Left/Right to Left + Right.
  3268. @item lr>rl
  3269. Left/Right to Right/Left.
  3270. @item ms>ll
  3271. Mid/Side to Left/Left.
  3272. @item ms>rr
  3273. Mid/Side to Right/Right.
  3274. @end table
  3275. @item slev
  3276. Set level of side signal. Default is 1.
  3277. Allowed range is from 0.015625 to 64.
  3278. @item sbal
  3279. Set balance of side signal. Default is 0.
  3280. Allowed range is from -1 to 1.
  3281. @item mlev
  3282. Set level of the middle signal. Default is 1.
  3283. Allowed range is from 0.015625 to 64.
  3284. @item mpan
  3285. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3286. @item base
  3287. Set stereo base between mono and inversed channels. Default is 0.
  3288. Allowed range is from -1 to 1.
  3289. @item delay
  3290. Set delay in milliseconds how much to delay left from right channel and
  3291. vice versa. Default is 0. Allowed range is from -20 to 20.
  3292. @item sclevel
  3293. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3294. @item phase
  3295. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3296. @item bmode_in, bmode_out
  3297. Set balance mode for balance_in/balance_out option.
  3298. Can be one of the following:
  3299. @table @samp
  3300. @item balance
  3301. Classic balance mode. Attenuate one channel at time.
  3302. Gain is raised up to 1.
  3303. @item amplitude
  3304. Similar as classic mode above but gain is raised up to 2.
  3305. @item power
  3306. Equal power distribution, from -6dB to +6dB range.
  3307. @end table
  3308. @end table
  3309. @subsection Examples
  3310. @itemize
  3311. @item
  3312. Apply karaoke like effect:
  3313. @example
  3314. stereotools=mlev=0.015625
  3315. @end example
  3316. @item
  3317. Convert M/S signal to L/R:
  3318. @example
  3319. "stereotools=mode=ms>lr"
  3320. @end example
  3321. @end itemize
  3322. @section stereowiden
  3323. This filter enhance the stereo effect by suppressing signal common to both
  3324. channels and by delaying the signal of left into right and vice versa,
  3325. thereby widening the stereo effect.
  3326. The filter accepts the following options:
  3327. @table @option
  3328. @item delay
  3329. Time in milliseconds of the delay of left signal into right and vice versa.
  3330. Default is 20 milliseconds.
  3331. @item feedback
  3332. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3333. effect of left signal in right output and vice versa which gives widening
  3334. effect. Default is 0.3.
  3335. @item crossfeed
  3336. Cross feed of left into right with inverted phase. This helps in suppressing
  3337. the mono. If the value is 1 it will cancel all the signal common to both
  3338. channels. Default is 0.3.
  3339. @item drymix
  3340. Set level of input signal of original channel. Default is 0.8.
  3341. @end table
  3342. @section superequalizer
  3343. Apply 18 band equalizer.
  3344. The filter accepts the following options:
  3345. @table @option
  3346. @item 1b
  3347. Set 65Hz band gain.
  3348. @item 2b
  3349. Set 92Hz band gain.
  3350. @item 3b
  3351. Set 131Hz band gain.
  3352. @item 4b
  3353. Set 185Hz band gain.
  3354. @item 5b
  3355. Set 262Hz band gain.
  3356. @item 6b
  3357. Set 370Hz band gain.
  3358. @item 7b
  3359. Set 523Hz band gain.
  3360. @item 8b
  3361. Set 740Hz band gain.
  3362. @item 9b
  3363. Set 1047Hz band gain.
  3364. @item 10b
  3365. Set 1480Hz band gain.
  3366. @item 11b
  3367. Set 2093Hz band gain.
  3368. @item 12b
  3369. Set 2960Hz band gain.
  3370. @item 13b
  3371. Set 4186Hz band gain.
  3372. @item 14b
  3373. Set 5920Hz band gain.
  3374. @item 15b
  3375. Set 8372Hz band gain.
  3376. @item 16b
  3377. Set 11840Hz band gain.
  3378. @item 17b
  3379. Set 16744Hz band gain.
  3380. @item 18b
  3381. Set 20000Hz band gain.
  3382. @end table
  3383. @section surround
  3384. Apply audio surround upmix filter.
  3385. This filter allows to produce multichannel output from audio stream.
  3386. The filter accepts the following options:
  3387. @table @option
  3388. @item chl_out
  3389. Set output channel layout. By default, this is @var{5.1}.
  3390. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3391. for the required syntax.
  3392. @item chl_in
  3393. Set input channel layout. By default, this is @var{stereo}.
  3394. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3395. for the required syntax.
  3396. @item level_in
  3397. Set input volume level. By default, this is @var{1}.
  3398. @item level_out
  3399. Set output volume level. By default, this is @var{1}.
  3400. @item lfe
  3401. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3402. @item lfe_low
  3403. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3404. @item lfe_high
  3405. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3406. @item fc_in
  3407. Set front center input volume. By default, this is @var{1}.
  3408. @item fc_out
  3409. Set front center output volume. By default, this is @var{1}.
  3410. @item lfe_in
  3411. Set LFE input volume. By default, this is @var{1}.
  3412. @item lfe_out
  3413. Set LFE output volume. By default, this is @var{1}.
  3414. @end table
  3415. @section treble
  3416. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3417. shelving filter with a response similar to that of a standard
  3418. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3419. The filter accepts the following options:
  3420. @table @option
  3421. @item gain, g
  3422. Give the gain at whichever is the lower of ~22 kHz and the
  3423. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3424. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3425. @item frequency, f
  3426. Set the filter's central frequency and so can be used
  3427. to extend or reduce the frequency range to be boosted or cut.
  3428. The default value is @code{3000} Hz.
  3429. @item width_type, t
  3430. Set method to specify band-width of filter.
  3431. @table @option
  3432. @item h
  3433. Hz
  3434. @item q
  3435. Q-Factor
  3436. @item o
  3437. octave
  3438. @item s
  3439. slope
  3440. @item k
  3441. kHz
  3442. @end table
  3443. @item width, w
  3444. Determine how steep is the filter's shelf transition.
  3445. @item channels, c
  3446. Specify which channels to filter, by default all available are filtered.
  3447. @end table
  3448. @subsection Commands
  3449. This filter supports the following commands:
  3450. @table @option
  3451. @item frequency, f
  3452. Change treble frequency.
  3453. Syntax for the command is : "@var{frequency}"
  3454. @item width_type, t
  3455. Change treble width_type.
  3456. Syntax for the command is : "@var{width_type}"
  3457. @item width, w
  3458. Change treble width.
  3459. Syntax for the command is : "@var{width}"
  3460. @item gain, g
  3461. Change treble gain.
  3462. Syntax for the command is : "@var{gain}"
  3463. @end table
  3464. @section tremolo
  3465. Sinusoidal amplitude modulation.
  3466. The filter accepts the following options:
  3467. @table @option
  3468. @item f
  3469. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3470. (20 Hz or lower) will result in a tremolo effect.
  3471. This filter may also be used as a ring modulator by specifying
  3472. a modulation frequency higher than 20 Hz.
  3473. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3474. @item d
  3475. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3476. Default value is 0.5.
  3477. @end table
  3478. @section vibrato
  3479. Sinusoidal phase modulation.
  3480. The filter accepts the following options:
  3481. @table @option
  3482. @item f
  3483. Modulation frequency in Hertz.
  3484. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3485. @item d
  3486. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3487. Default value is 0.5.
  3488. @end table
  3489. @section volume
  3490. Adjust the input audio volume.
  3491. It accepts the following parameters:
  3492. @table @option
  3493. @item volume
  3494. Set audio volume expression.
  3495. Output values are clipped to the maximum value.
  3496. The output audio volume is given by the relation:
  3497. @example
  3498. @var{output_volume} = @var{volume} * @var{input_volume}
  3499. @end example
  3500. The default value for @var{volume} is "1.0".
  3501. @item precision
  3502. This parameter represents the mathematical precision.
  3503. It determines which input sample formats will be allowed, which affects the
  3504. precision of the volume scaling.
  3505. @table @option
  3506. @item fixed
  3507. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3508. @item float
  3509. 32-bit floating-point; this limits input sample format to FLT. (default)
  3510. @item double
  3511. 64-bit floating-point; this limits input sample format to DBL.
  3512. @end table
  3513. @item replaygain
  3514. Choose the behaviour on encountering ReplayGain side data in input frames.
  3515. @table @option
  3516. @item drop
  3517. Remove ReplayGain side data, ignoring its contents (the default).
  3518. @item ignore
  3519. Ignore ReplayGain side data, but leave it in the frame.
  3520. @item track
  3521. Prefer the track gain, if present.
  3522. @item album
  3523. Prefer the album gain, if present.
  3524. @end table
  3525. @item replaygain_preamp
  3526. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3527. Default value for @var{replaygain_preamp} is 0.0.
  3528. @item eval
  3529. Set when the volume expression is evaluated.
  3530. It accepts the following values:
  3531. @table @samp
  3532. @item once
  3533. only evaluate expression once during the filter initialization, or
  3534. when the @samp{volume} command is sent
  3535. @item frame
  3536. evaluate expression for each incoming frame
  3537. @end table
  3538. Default value is @samp{once}.
  3539. @end table
  3540. The volume expression can contain the following parameters.
  3541. @table @option
  3542. @item n
  3543. frame number (starting at zero)
  3544. @item nb_channels
  3545. number of channels
  3546. @item nb_consumed_samples
  3547. number of samples consumed by the filter
  3548. @item nb_samples
  3549. number of samples in the current frame
  3550. @item pos
  3551. original frame position in the file
  3552. @item pts
  3553. frame PTS
  3554. @item sample_rate
  3555. sample rate
  3556. @item startpts
  3557. PTS at start of stream
  3558. @item startt
  3559. time at start of stream
  3560. @item t
  3561. frame time
  3562. @item tb
  3563. timestamp timebase
  3564. @item volume
  3565. last set volume value
  3566. @end table
  3567. Note that when @option{eval} is set to @samp{once} only the
  3568. @var{sample_rate} and @var{tb} variables are available, all other
  3569. variables will evaluate to NAN.
  3570. @subsection Commands
  3571. This filter supports the following commands:
  3572. @table @option
  3573. @item volume
  3574. Modify the volume expression.
  3575. The command accepts the same syntax of the corresponding option.
  3576. If the specified expression is not valid, it is kept at its current
  3577. value.
  3578. @item replaygain_noclip
  3579. Prevent clipping by limiting the gain applied.
  3580. Default value for @var{replaygain_noclip} is 1.
  3581. @end table
  3582. @subsection Examples
  3583. @itemize
  3584. @item
  3585. Halve the input audio volume:
  3586. @example
  3587. volume=volume=0.5
  3588. volume=volume=1/2
  3589. volume=volume=-6.0206dB
  3590. @end example
  3591. In all the above example the named key for @option{volume} can be
  3592. omitted, for example like in:
  3593. @example
  3594. volume=0.5
  3595. @end example
  3596. @item
  3597. Increase input audio power by 6 decibels using fixed-point precision:
  3598. @example
  3599. volume=volume=6dB:precision=fixed
  3600. @end example
  3601. @item
  3602. Fade volume after time 10 with an annihilation period of 5 seconds:
  3603. @example
  3604. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3605. @end example
  3606. @end itemize
  3607. @section volumedetect
  3608. Detect the volume of the input video.
  3609. The filter has no parameters. The input is not modified. Statistics about
  3610. the volume will be printed in the log when the input stream end is reached.
  3611. In particular it will show the mean volume (root mean square), maximum
  3612. volume (on a per-sample basis), and the beginning of a histogram of the
  3613. registered volume values (from the maximum value to a cumulated 1/1000 of
  3614. the samples).
  3615. All volumes are in decibels relative to the maximum PCM value.
  3616. @subsection Examples
  3617. Here is an excerpt of the output:
  3618. @example
  3619. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3620. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3621. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3622. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3623. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3624. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3625. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3626. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3627. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3628. @end example
  3629. It means that:
  3630. @itemize
  3631. @item
  3632. The mean square energy is approximately -27 dB, or 10^-2.7.
  3633. @item
  3634. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3635. @item
  3636. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3637. @end itemize
  3638. In other words, raising the volume by +4 dB does not cause any clipping,
  3639. raising it by +5 dB causes clipping for 6 samples, etc.
  3640. @c man end AUDIO FILTERS
  3641. @chapter Audio Sources
  3642. @c man begin AUDIO SOURCES
  3643. Below is a description of the currently available audio sources.
  3644. @section abuffer
  3645. Buffer audio frames, and make them available to the filter chain.
  3646. This source is mainly intended for a programmatic use, in particular
  3647. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3648. It accepts the following parameters:
  3649. @table @option
  3650. @item time_base
  3651. The timebase which will be used for timestamps of submitted frames. It must be
  3652. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3653. @item sample_rate
  3654. The sample rate of the incoming audio buffers.
  3655. @item sample_fmt
  3656. The sample format of the incoming audio buffers.
  3657. Either a sample format name or its corresponding integer representation from
  3658. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3659. @item channel_layout
  3660. The channel layout of the incoming audio buffers.
  3661. Either a channel layout name from channel_layout_map in
  3662. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3663. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3664. @item channels
  3665. The number of channels of the incoming audio buffers.
  3666. If both @var{channels} and @var{channel_layout} are specified, then they
  3667. must be consistent.
  3668. @end table
  3669. @subsection Examples
  3670. @example
  3671. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3672. @end example
  3673. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3674. Since the sample format with name "s16p" corresponds to the number
  3675. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3676. equivalent to:
  3677. @example
  3678. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3679. @end example
  3680. @section aevalsrc
  3681. Generate an audio signal specified by an expression.
  3682. This source accepts in input one or more expressions (one for each
  3683. channel), which are evaluated and used to generate a corresponding
  3684. audio signal.
  3685. This source accepts the following options:
  3686. @table @option
  3687. @item exprs
  3688. Set the '|'-separated expressions list for each separate channel. In case the
  3689. @option{channel_layout} option is not specified, the selected channel layout
  3690. depends on the number of provided expressions. Otherwise the last
  3691. specified expression is applied to the remaining output channels.
  3692. @item channel_layout, c
  3693. Set the channel layout. The number of channels in the specified layout
  3694. must be equal to the number of specified expressions.
  3695. @item duration, d
  3696. Set the minimum duration of the sourced audio. See
  3697. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3698. for the accepted syntax.
  3699. Note that the resulting duration may be greater than the specified
  3700. duration, as the generated audio is always cut at the end of a
  3701. complete frame.
  3702. If not specified, or the expressed duration is negative, the audio is
  3703. supposed to be generated forever.
  3704. @item nb_samples, n
  3705. Set the number of samples per channel per each output frame,
  3706. default to 1024.
  3707. @item sample_rate, s
  3708. Specify the sample rate, default to 44100.
  3709. @end table
  3710. Each expression in @var{exprs} can contain the following constants:
  3711. @table @option
  3712. @item n
  3713. number of the evaluated sample, starting from 0
  3714. @item t
  3715. time of the evaluated sample expressed in seconds, starting from 0
  3716. @item s
  3717. sample rate
  3718. @end table
  3719. @subsection Examples
  3720. @itemize
  3721. @item
  3722. Generate silence:
  3723. @example
  3724. aevalsrc=0
  3725. @end example
  3726. @item
  3727. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3728. 8000 Hz:
  3729. @example
  3730. aevalsrc="sin(440*2*PI*t):s=8000"
  3731. @end example
  3732. @item
  3733. Generate a two channels signal, specify the channel layout (Front
  3734. Center + Back Center) explicitly:
  3735. @example
  3736. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3737. @end example
  3738. @item
  3739. Generate white noise:
  3740. @example
  3741. aevalsrc="-2+random(0)"
  3742. @end example
  3743. @item
  3744. Generate an amplitude modulated signal:
  3745. @example
  3746. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3747. @end example
  3748. @item
  3749. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3750. @example
  3751. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3752. @end example
  3753. @end itemize
  3754. @section anullsrc
  3755. The null audio source, return unprocessed audio frames. It is mainly useful
  3756. as a template and to be employed in analysis / debugging tools, or as
  3757. the source for filters which ignore the input data (for example the sox
  3758. synth filter).
  3759. This source accepts the following options:
  3760. @table @option
  3761. @item channel_layout, cl
  3762. Specifies the channel layout, and can be either an integer or a string
  3763. representing a channel layout. The default value of @var{channel_layout}
  3764. is "stereo".
  3765. Check the channel_layout_map definition in
  3766. @file{libavutil/channel_layout.c} for the mapping between strings and
  3767. channel layout values.
  3768. @item sample_rate, r
  3769. Specifies the sample rate, and defaults to 44100.
  3770. @item nb_samples, n
  3771. Set the number of samples per requested frames.
  3772. @end table
  3773. @subsection Examples
  3774. @itemize
  3775. @item
  3776. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3777. @example
  3778. anullsrc=r=48000:cl=4
  3779. @end example
  3780. @item
  3781. Do the same operation with a more obvious syntax:
  3782. @example
  3783. anullsrc=r=48000:cl=mono
  3784. @end example
  3785. @end itemize
  3786. All the parameters need to be explicitly defined.
  3787. @section flite
  3788. Synthesize a voice utterance using the libflite library.
  3789. To enable compilation of this filter you need to configure FFmpeg with
  3790. @code{--enable-libflite}.
  3791. Note that versions of the flite library prior to 2.0 are not thread-safe.
  3792. The filter accepts the following options:
  3793. @table @option
  3794. @item list_voices
  3795. If set to 1, list the names of the available voices and exit
  3796. immediately. Default value is 0.
  3797. @item nb_samples, n
  3798. Set the maximum number of samples per frame. Default value is 512.
  3799. @item textfile
  3800. Set the filename containing the text to speak.
  3801. @item text
  3802. Set the text to speak.
  3803. @item voice, v
  3804. Set the voice to use for the speech synthesis. Default value is
  3805. @code{kal}. See also the @var{list_voices} option.
  3806. @end table
  3807. @subsection Examples
  3808. @itemize
  3809. @item
  3810. Read from file @file{speech.txt}, and synthesize the text using the
  3811. standard flite voice:
  3812. @example
  3813. flite=textfile=speech.txt
  3814. @end example
  3815. @item
  3816. Read the specified text selecting the @code{slt} voice:
  3817. @example
  3818. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3819. @end example
  3820. @item
  3821. Input text to ffmpeg:
  3822. @example
  3823. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3824. @end example
  3825. @item
  3826. Make @file{ffplay} speak the specified text, using @code{flite} and
  3827. the @code{lavfi} device:
  3828. @example
  3829. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3830. @end example
  3831. @end itemize
  3832. For more information about libflite, check:
  3833. @url{http://www.festvox.org/flite/}
  3834. @section anoisesrc
  3835. Generate a noise audio signal.
  3836. The filter accepts the following options:
  3837. @table @option
  3838. @item sample_rate, r
  3839. Specify the sample rate. Default value is 48000 Hz.
  3840. @item amplitude, a
  3841. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3842. is 1.0.
  3843. @item duration, d
  3844. Specify the duration of the generated audio stream. Not specifying this option
  3845. results in noise with an infinite length.
  3846. @item color, colour, c
  3847. Specify the color of noise. Available noise colors are white, pink, brown,
  3848. blue and violet. Default color is white.
  3849. @item seed, s
  3850. Specify a value used to seed the PRNG.
  3851. @item nb_samples, n
  3852. Set the number of samples per each output frame, default is 1024.
  3853. @end table
  3854. @subsection Examples
  3855. @itemize
  3856. @item
  3857. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3858. @example
  3859. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3860. @end example
  3861. @end itemize
  3862. @section hilbert
  3863. Generate odd-tap Hilbert transform FIR coefficients.
  3864. The resulting stream can be used with @ref{afir} filter for phase-shifting
  3865. the signal by 90 degrees.
  3866. This is used in many matrix coding schemes and for analytic signal generation.
  3867. The process is often written as a multiplication by i (or j), the imaginary unit.
  3868. The filter accepts the following options:
  3869. @table @option
  3870. @item sample_rate, s
  3871. Set sample rate, default is 44100.
  3872. @item taps, t
  3873. Set length of FIR filter, default is 22051.
  3874. @item nb_samples, n
  3875. Set number of samples per each frame.
  3876. @item win_func, w
  3877. Set window function to be used when generating FIR coefficients.
  3878. @end table
  3879. @section sine
  3880. Generate an audio signal made of a sine wave with amplitude 1/8.
  3881. The audio signal is bit-exact.
  3882. The filter accepts the following options:
  3883. @table @option
  3884. @item frequency, f
  3885. Set the carrier frequency. Default is 440 Hz.
  3886. @item beep_factor, b
  3887. Enable a periodic beep every second with frequency @var{beep_factor} times
  3888. the carrier frequency. Default is 0, meaning the beep is disabled.
  3889. @item sample_rate, r
  3890. Specify the sample rate, default is 44100.
  3891. @item duration, d
  3892. Specify the duration of the generated audio stream.
  3893. @item samples_per_frame
  3894. Set the number of samples per output frame.
  3895. The expression can contain the following constants:
  3896. @table @option
  3897. @item n
  3898. The (sequential) number of the output audio frame, starting from 0.
  3899. @item pts
  3900. The PTS (Presentation TimeStamp) of the output audio frame,
  3901. expressed in @var{TB} units.
  3902. @item t
  3903. The PTS of the output audio frame, expressed in seconds.
  3904. @item TB
  3905. The timebase of the output audio frames.
  3906. @end table
  3907. Default is @code{1024}.
  3908. @end table
  3909. @subsection Examples
  3910. @itemize
  3911. @item
  3912. Generate a simple 440 Hz sine wave:
  3913. @example
  3914. sine
  3915. @end example
  3916. @item
  3917. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3918. @example
  3919. sine=220:4:d=5
  3920. sine=f=220:b=4:d=5
  3921. sine=frequency=220:beep_factor=4:duration=5
  3922. @end example
  3923. @item
  3924. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3925. pattern:
  3926. @example
  3927. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3928. @end example
  3929. @end itemize
  3930. @c man end AUDIO SOURCES
  3931. @chapter Audio Sinks
  3932. @c man begin AUDIO SINKS
  3933. Below is a description of the currently available audio sinks.
  3934. @section abuffersink
  3935. Buffer audio frames, and make them available to the end of filter chain.
  3936. This sink is mainly intended for programmatic use, in particular
  3937. through the interface defined in @file{libavfilter/buffersink.h}
  3938. or the options system.
  3939. It accepts a pointer to an AVABufferSinkContext structure, which
  3940. defines the incoming buffers' formats, to be passed as the opaque
  3941. parameter to @code{avfilter_init_filter} for initialization.
  3942. @section anullsink
  3943. Null audio sink; do absolutely nothing with the input audio. It is
  3944. mainly useful as a template and for use in analysis / debugging
  3945. tools.
  3946. @c man end AUDIO SINKS
  3947. @chapter Video Filters
  3948. @c man begin VIDEO FILTERS
  3949. When you configure your FFmpeg build, you can disable any of the
  3950. existing filters using @code{--disable-filters}.
  3951. The configure output will show the video filters included in your
  3952. build.
  3953. Below is a description of the currently available video filters.
  3954. @section alphaextract
  3955. Extract the alpha component from the input as a grayscale video. This
  3956. is especially useful with the @var{alphamerge} filter.
  3957. @section alphamerge
  3958. Add or replace the alpha component of the primary input with the
  3959. grayscale value of a second input. This is intended for use with
  3960. @var{alphaextract} to allow the transmission or storage of frame
  3961. sequences that have alpha in a format that doesn't support an alpha
  3962. channel.
  3963. For example, to reconstruct full frames from a normal YUV-encoded video
  3964. and a separate video created with @var{alphaextract}, you might use:
  3965. @example
  3966. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3967. @end example
  3968. Since this filter is designed for reconstruction, it operates on frame
  3969. sequences without considering timestamps, and terminates when either
  3970. input reaches end of stream. This will cause problems if your encoding
  3971. pipeline drops frames. If you're trying to apply an image as an
  3972. overlay to a video stream, consider the @var{overlay} filter instead.
  3973. @section ass
  3974. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3975. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3976. Substation Alpha) subtitles files.
  3977. This filter accepts the following option in addition to the common options from
  3978. the @ref{subtitles} filter:
  3979. @table @option
  3980. @item shaping
  3981. Set the shaping engine
  3982. Available values are:
  3983. @table @samp
  3984. @item auto
  3985. The default libass shaping engine, which is the best available.
  3986. @item simple
  3987. Fast, font-agnostic shaper that can do only substitutions
  3988. @item complex
  3989. Slower shaper using OpenType for substitutions and positioning
  3990. @end table
  3991. The default is @code{auto}.
  3992. @end table
  3993. @section atadenoise
  3994. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3995. The filter accepts the following options:
  3996. @table @option
  3997. @item 0a
  3998. Set threshold A for 1st plane. Default is 0.02.
  3999. Valid range is 0 to 0.3.
  4000. @item 0b
  4001. Set threshold B for 1st plane. Default is 0.04.
  4002. Valid range is 0 to 5.
  4003. @item 1a
  4004. Set threshold A for 2nd plane. Default is 0.02.
  4005. Valid range is 0 to 0.3.
  4006. @item 1b
  4007. Set threshold B for 2nd plane. Default is 0.04.
  4008. Valid range is 0 to 5.
  4009. @item 2a
  4010. Set threshold A for 3rd plane. Default is 0.02.
  4011. Valid range is 0 to 0.3.
  4012. @item 2b
  4013. Set threshold B for 3rd plane. Default is 0.04.
  4014. Valid range is 0 to 5.
  4015. Threshold A is designed to react on abrupt changes in the input signal and
  4016. threshold B is designed to react on continuous changes in the input signal.
  4017. @item s
  4018. Set number of frames filter will use for averaging. Default is 33. Must be odd
  4019. number in range [5, 129].
  4020. @item p
  4021. Set what planes of frame filter will use for averaging. Default is all.
  4022. @end table
  4023. @section avgblur
  4024. Apply average blur filter.
  4025. The filter accepts the following options:
  4026. @table @option
  4027. @item sizeX
  4028. Set horizontal kernel size.
  4029. @item planes
  4030. Set which planes to filter. By default all planes are filtered.
  4031. @item sizeY
  4032. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  4033. Default is @code{0}.
  4034. @end table
  4035. @section bbox
  4036. Compute the bounding box for the non-black pixels in the input frame
  4037. luminance plane.
  4038. This filter computes the bounding box containing all the pixels with a
  4039. luminance value greater than the minimum allowed value.
  4040. The parameters describing the bounding box are printed on the filter
  4041. log.
  4042. The filter accepts the following option:
  4043. @table @option
  4044. @item min_val
  4045. Set the minimal luminance value. Default is @code{16}.
  4046. @end table
  4047. @section bitplanenoise
  4048. Show and measure bit plane noise.
  4049. The filter accepts the following options:
  4050. @table @option
  4051. @item bitplane
  4052. Set which plane to analyze. Default is @code{1}.
  4053. @item filter
  4054. Filter out noisy pixels from @code{bitplane} set above.
  4055. Default is disabled.
  4056. @end table
  4057. @section blackdetect
  4058. Detect video intervals that are (almost) completely black. Can be
  4059. useful to detect chapter transitions, commercials, or invalid
  4060. recordings. Output lines contains the time for the start, end and
  4061. duration of the detected black interval expressed in seconds.
  4062. In order to display the output lines, you need to set the loglevel at
  4063. least to the AV_LOG_INFO value.
  4064. The filter accepts the following options:
  4065. @table @option
  4066. @item black_min_duration, d
  4067. Set the minimum detected black duration expressed in seconds. It must
  4068. be a non-negative floating point number.
  4069. Default value is 2.0.
  4070. @item picture_black_ratio_th, pic_th
  4071. Set the threshold for considering a picture "black".
  4072. Express the minimum value for the ratio:
  4073. @example
  4074. @var{nb_black_pixels} / @var{nb_pixels}
  4075. @end example
  4076. for which a picture is considered black.
  4077. Default value is 0.98.
  4078. @item pixel_black_th, pix_th
  4079. Set the threshold for considering a pixel "black".
  4080. The threshold expresses the maximum pixel luminance value for which a
  4081. pixel is considered "black". The provided value is scaled according to
  4082. the following equation:
  4083. @example
  4084. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4085. @end example
  4086. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4087. the input video format, the range is [0-255] for YUV full-range
  4088. formats and [16-235] for YUV non full-range formats.
  4089. Default value is 0.10.
  4090. @end table
  4091. The following example sets the maximum pixel threshold to the minimum
  4092. value, and detects only black intervals of 2 or more seconds:
  4093. @example
  4094. blackdetect=d=2:pix_th=0.00
  4095. @end example
  4096. @section blackframe
  4097. Detect frames that are (almost) completely black. Can be useful to
  4098. detect chapter transitions or commercials. Output lines consist of
  4099. the frame number of the detected frame, the percentage of blackness,
  4100. the position in the file if known or -1 and the timestamp in seconds.
  4101. In order to display the output lines, you need to set the loglevel at
  4102. least to the AV_LOG_INFO value.
  4103. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4104. The value represents the percentage of pixels in the picture that
  4105. are below the threshold value.
  4106. It accepts the following parameters:
  4107. @table @option
  4108. @item amount
  4109. The percentage of the pixels that have to be below the threshold; it defaults to
  4110. @code{98}.
  4111. @item threshold, thresh
  4112. The threshold below which a pixel value is considered black; it defaults to
  4113. @code{32}.
  4114. @end table
  4115. @section blend, tblend
  4116. Blend two video frames into each other.
  4117. The @code{blend} filter takes two input streams and outputs one
  4118. stream, the first input is the "top" layer and second input is
  4119. "bottom" layer. By default, the output terminates when the longest input terminates.
  4120. The @code{tblend} (time blend) filter takes two consecutive frames
  4121. from one single stream, and outputs the result obtained by blending
  4122. the new frame on top of the old frame.
  4123. A description of the accepted options follows.
  4124. @table @option
  4125. @item c0_mode
  4126. @item c1_mode
  4127. @item c2_mode
  4128. @item c3_mode
  4129. @item all_mode
  4130. Set blend mode for specific pixel component or all pixel components in case
  4131. of @var{all_mode}. Default value is @code{normal}.
  4132. Available values for component modes are:
  4133. @table @samp
  4134. @item addition
  4135. @item grainmerge
  4136. @item and
  4137. @item average
  4138. @item burn
  4139. @item darken
  4140. @item difference
  4141. @item grainextract
  4142. @item divide
  4143. @item dodge
  4144. @item freeze
  4145. @item exclusion
  4146. @item extremity
  4147. @item glow
  4148. @item hardlight
  4149. @item hardmix
  4150. @item heat
  4151. @item lighten
  4152. @item linearlight
  4153. @item multiply
  4154. @item multiply128
  4155. @item negation
  4156. @item normal
  4157. @item or
  4158. @item overlay
  4159. @item phoenix
  4160. @item pinlight
  4161. @item reflect
  4162. @item screen
  4163. @item softlight
  4164. @item subtract
  4165. @item vividlight
  4166. @item xor
  4167. @end table
  4168. @item c0_opacity
  4169. @item c1_opacity
  4170. @item c2_opacity
  4171. @item c3_opacity
  4172. @item all_opacity
  4173. Set blend opacity for specific pixel component or all pixel components in case
  4174. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4175. @item c0_expr
  4176. @item c1_expr
  4177. @item c2_expr
  4178. @item c3_expr
  4179. @item all_expr
  4180. Set blend expression for specific pixel component or all pixel components in case
  4181. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4182. The expressions can use the following variables:
  4183. @table @option
  4184. @item N
  4185. The sequential number of the filtered frame, starting from @code{0}.
  4186. @item X
  4187. @item Y
  4188. the coordinates of the current sample
  4189. @item W
  4190. @item H
  4191. the width and height of currently filtered plane
  4192. @item SW
  4193. @item SH
  4194. Width and height scale depending on the currently filtered plane. It is the
  4195. ratio between the corresponding luma plane number of pixels and the current
  4196. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  4197. @code{0.5,0.5} for chroma planes.
  4198. @item T
  4199. Time of the current frame, expressed in seconds.
  4200. @item TOP, A
  4201. Value of pixel component at current location for first video frame (top layer).
  4202. @item BOTTOM, B
  4203. Value of pixel component at current location for second video frame (bottom layer).
  4204. @end table
  4205. @end table
  4206. The @code{blend} filter also supports the @ref{framesync} options.
  4207. @subsection Examples
  4208. @itemize
  4209. @item
  4210. Apply transition from bottom layer to top layer in first 10 seconds:
  4211. @example
  4212. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4213. @end example
  4214. @item
  4215. Apply linear horizontal transition from top layer to bottom layer:
  4216. @example
  4217. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4218. @end example
  4219. @item
  4220. Apply 1x1 checkerboard effect:
  4221. @example
  4222. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4223. @end example
  4224. @item
  4225. Apply uncover left effect:
  4226. @example
  4227. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4228. @end example
  4229. @item
  4230. Apply uncover down effect:
  4231. @example
  4232. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4233. @end example
  4234. @item
  4235. Apply uncover up-left effect:
  4236. @example
  4237. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4238. @end example
  4239. @item
  4240. Split diagonally video and shows top and bottom layer on each side:
  4241. @example
  4242. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4243. @end example
  4244. @item
  4245. Display differences between the current and the previous frame:
  4246. @example
  4247. tblend=all_mode=grainextract
  4248. @end example
  4249. @end itemize
  4250. @section boxblur
  4251. Apply a boxblur algorithm to the input video.
  4252. It accepts the following parameters:
  4253. @table @option
  4254. @item luma_radius, lr
  4255. @item luma_power, lp
  4256. @item chroma_radius, cr
  4257. @item chroma_power, cp
  4258. @item alpha_radius, ar
  4259. @item alpha_power, ap
  4260. @end table
  4261. A description of the accepted options follows.
  4262. @table @option
  4263. @item luma_radius, lr
  4264. @item chroma_radius, cr
  4265. @item alpha_radius, ar
  4266. Set an expression for the box radius in pixels used for blurring the
  4267. corresponding input plane.
  4268. The radius value must be a non-negative number, and must not be
  4269. greater than the value of the expression @code{min(w,h)/2} for the
  4270. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4271. planes.
  4272. Default value for @option{luma_radius} is "2". If not specified,
  4273. @option{chroma_radius} and @option{alpha_radius} default to the
  4274. corresponding value set for @option{luma_radius}.
  4275. The expressions can contain the following constants:
  4276. @table @option
  4277. @item w
  4278. @item h
  4279. The input width and height in pixels.
  4280. @item cw
  4281. @item ch
  4282. The input chroma image width and height in pixels.
  4283. @item hsub
  4284. @item vsub
  4285. The horizontal and vertical chroma subsample values. For example, for the
  4286. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4287. @end table
  4288. @item luma_power, lp
  4289. @item chroma_power, cp
  4290. @item alpha_power, ap
  4291. Specify how many times the boxblur filter is applied to the
  4292. corresponding plane.
  4293. Default value for @option{luma_power} is 2. If not specified,
  4294. @option{chroma_power} and @option{alpha_power} default to the
  4295. corresponding value set for @option{luma_power}.
  4296. A value of 0 will disable the effect.
  4297. @end table
  4298. @subsection Examples
  4299. @itemize
  4300. @item
  4301. Apply a boxblur filter with the luma, chroma, and alpha radii
  4302. set to 2:
  4303. @example
  4304. boxblur=luma_radius=2:luma_power=1
  4305. boxblur=2:1
  4306. @end example
  4307. @item
  4308. Set the luma radius to 2, and alpha and chroma radius to 0:
  4309. @example
  4310. boxblur=2:1:cr=0:ar=0
  4311. @end example
  4312. @item
  4313. Set the luma and chroma radii to a fraction of the video dimension:
  4314. @example
  4315. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4316. @end example
  4317. @end itemize
  4318. @section bwdif
  4319. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4320. Deinterlacing Filter").
  4321. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4322. interpolation algorithms.
  4323. It accepts the following parameters:
  4324. @table @option
  4325. @item mode
  4326. The interlacing mode to adopt. It accepts one of the following values:
  4327. @table @option
  4328. @item 0, send_frame
  4329. Output one frame for each frame.
  4330. @item 1, send_field
  4331. Output one frame for each field.
  4332. @end table
  4333. The default value is @code{send_field}.
  4334. @item parity
  4335. The picture field parity assumed for the input interlaced video. It accepts one
  4336. of the following values:
  4337. @table @option
  4338. @item 0, tff
  4339. Assume the top field is first.
  4340. @item 1, bff
  4341. Assume the bottom field is first.
  4342. @item -1, auto
  4343. Enable automatic detection of field parity.
  4344. @end table
  4345. The default value is @code{auto}.
  4346. If the interlacing is unknown or the decoder does not export this information,
  4347. top field first will be assumed.
  4348. @item deint
  4349. Specify which frames to deinterlace. Accept one of the following
  4350. values:
  4351. @table @option
  4352. @item 0, all
  4353. Deinterlace all frames.
  4354. @item 1, interlaced
  4355. Only deinterlace frames marked as interlaced.
  4356. @end table
  4357. The default value is @code{all}.
  4358. @end table
  4359. @section chromakey
  4360. YUV colorspace color/chroma keying.
  4361. The filter accepts the following options:
  4362. @table @option
  4363. @item color
  4364. The color which will be replaced with transparency.
  4365. @item similarity
  4366. Similarity percentage with the key color.
  4367. 0.01 matches only the exact key color, while 1.0 matches everything.
  4368. @item blend
  4369. Blend percentage.
  4370. 0.0 makes pixels either fully transparent, or not transparent at all.
  4371. Higher values result in semi-transparent pixels, with a higher transparency
  4372. the more similar the pixels color is to the key color.
  4373. @item yuv
  4374. Signals that the color passed is already in YUV instead of RGB.
  4375. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4376. This can be used to pass exact YUV values as hexadecimal numbers.
  4377. @end table
  4378. @subsection Examples
  4379. @itemize
  4380. @item
  4381. Make every green pixel in the input image transparent:
  4382. @example
  4383. ffmpeg -i input.png -vf chromakey=green out.png
  4384. @end example
  4385. @item
  4386. Overlay a greenscreen-video on top of a static black background.
  4387. @example
  4388. 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
  4389. @end example
  4390. @end itemize
  4391. @section ciescope
  4392. Display CIE color diagram with pixels overlaid onto it.
  4393. The filter accepts the following options:
  4394. @table @option
  4395. @item system
  4396. Set color system.
  4397. @table @samp
  4398. @item ntsc, 470m
  4399. @item ebu, 470bg
  4400. @item smpte
  4401. @item 240m
  4402. @item apple
  4403. @item widergb
  4404. @item cie1931
  4405. @item rec709, hdtv
  4406. @item uhdtv, rec2020
  4407. @end table
  4408. @item cie
  4409. Set CIE system.
  4410. @table @samp
  4411. @item xyy
  4412. @item ucs
  4413. @item luv
  4414. @end table
  4415. @item gamuts
  4416. Set what gamuts to draw.
  4417. See @code{system} option for available values.
  4418. @item size, s
  4419. Set ciescope size, by default set to 512.
  4420. @item intensity, i
  4421. Set intensity used to map input pixel values to CIE diagram.
  4422. @item contrast
  4423. Set contrast used to draw tongue colors that are out of active color system gamut.
  4424. @item corrgamma
  4425. Correct gamma displayed on scope, by default enabled.
  4426. @item showwhite
  4427. Show white point on CIE diagram, by default disabled.
  4428. @item gamma
  4429. Set input gamma. Used only with XYZ input color space.
  4430. @end table
  4431. @section codecview
  4432. Visualize information exported by some codecs.
  4433. Some codecs can export information through frames using side-data or other
  4434. means. For example, some MPEG based codecs export motion vectors through the
  4435. @var{export_mvs} flag in the codec @option{flags2} option.
  4436. The filter accepts the following option:
  4437. @table @option
  4438. @item mv
  4439. Set motion vectors to visualize.
  4440. Available flags for @var{mv} are:
  4441. @table @samp
  4442. @item pf
  4443. forward predicted MVs of P-frames
  4444. @item bf
  4445. forward predicted MVs of B-frames
  4446. @item bb
  4447. backward predicted MVs of B-frames
  4448. @end table
  4449. @item qp
  4450. Display quantization parameters using the chroma planes.
  4451. @item mv_type, mvt
  4452. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4453. Available flags for @var{mv_type} are:
  4454. @table @samp
  4455. @item fp
  4456. forward predicted MVs
  4457. @item bp
  4458. backward predicted MVs
  4459. @end table
  4460. @item frame_type, ft
  4461. Set frame type to visualize motion vectors of.
  4462. Available flags for @var{frame_type} are:
  4463. @table @samp
  4464. @item if
  4465. intra-coded frames (I-frames)
  4466. @item pf
  4467. predicted frames (P-frames)
  4468. @item bf
  4469. bi-directionally predicted frames (B-frames)
  4470. @end table
  4471. @end table
  4472. @subsection Examples
  4473. @itemize
  4474. @item
  4475. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4476. @example
  4477. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4478. @end example
  4479. @item
  4480. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4481. @example
  4482. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4483. @end example
  4484. @end itemize
  4485. @section colorbalance
  4486. Modify intensity of primary colors (red, green and blue) of input frames.
  4487. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4488. regions for the red-cyan, green-magenta or blue-yellow balance.
  4489. A positive adjustment value shifts the balance towards the primary color, a negative
  4490. value towards the complementary color.
  4491. The filter accepts the following options:
  4492. @table @option
  4493. @item rs
  4494. @item gs
  4495. @item bs
  4496. Adjust red, green and blue shadows (darkest pixels).
  4497. @item rm
  4498. @item gm
  4499. @item bm
  4500. Adjust red, green and blue midtones (medium pixels).
  4501. @item rh
  4502. @item gh
  4503. @item bh
  4504. Adjust red, green and blue highlights (brightest pixels).
  4505. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4506. @end table
  4507. @subsection Examples
  4508. @itemize
  4509. @item
  4510. Add red color cast to shadows:
  4511. @example
  4512. colorbalance=rs=.3
  4513. @end example
  4514. @end itemize
  4515. @section colorkey
  4516. RGB colorspace color keying.
  4517. The filter accepts the following options:
  4518. @table @option
  4519. @item color
  4520. The color which will be replaced with transparency.
  4521. @item similarity
  4522. Similarity percentage with the key color.
  4523. 0.01 matches only the exact key color, while 1.0 matches everything.
  4524. @item blend
  4525. Blend percentage.
  4526. 0.0 makes pixels either fully transparent, or not transparent at all.
  4527. Higher values result in semi-transparent pixels, with a higher transparency
  4528. the more similar the pixels color is to the key color.
  4529. @end table
  4530. @subsection Examples
  4531. @itemize
  4532. @item
  4533. Make every green pixel in the input image transparent:
  4534. @example
  4535. ffmpeg -i input.png -vf colorkey=green out.png
  4536. @end example
  4537. @item
  4538. Overlay a greenscreen-video on top of a static background image.
  4539. @example
  4540. 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
  4541. @end example
  4542. @end itemize
  4543. @section colorlevels
  4544. Adjust video input frames using levels.
  4545. The filter accepts the following options:
  4546. @table @option
  4547. @item rimin
  4548. @item gimin
  4549. @item bimin
  4550. @item aimin
  4551. Adjust red, green, blue and alpha input black point.
  4552. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4553. @item rimax
  4554. @item gimax
  4555. @item bimax
  4556. @item aimax
  4557. Adjust red, green, blue and alpha input white point.
  4558. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  4559. Input levels are used to lighten highlights (bright tones), darken shadows
  4560. (dark tones), change the balance of bright and dark tones.
  4561. @item romin
  4562. @item gomin
  4563. @item bomin
  4564. @item aomin
  4565. Adjust red, green, blue and alpha output black point.
  4566. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  4567. @item romax
  4568. @item gomax
  4569. @item bomax
  4570. @item aomax
  4571. Adjust red, green, blue and alpha output white point.
  4572. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  4573. Output levels allows manual selection of a constrained output level range.
  4574. @end table
  4575. @subsection Examples
  4576. @itemize
  4577. @item
  4578. Make video output darker:
  4579. @example
  4580. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4581. @end example
  4582. @item
  4583. Increase contrast:
  4584. @example
  4585. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4586. @end example
  4587. @item
  4588. Make video output lighter:
  4589. @example
  4590. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4591. @end example
  4592. @item
  4593. Increase brightness:
  4594. @example
  4595. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4596. @end example
  4597. @end itemize
  4598. @section colorchannelmixer
  4599. Adjust video input frames by re-mixing color channels.
  4600. This filter modifies a color channel by adding the values associated to
  4601. the other channels of the same pixels. For example if the value to
  4602. modify is red, the output value will be:
  4603. @example
  4604. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4605. @end example
  4606. The filter accepts the following options:
  4607. @table @option
  4608. @item rr
  4609. @item rg
  4610. @item rb
  4611. @item ra
  4612. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4613. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4614. @item gr
  4615. @item gg
  4616. @item gb
  4617. @item ga
  4618. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4619. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4620. @item br
  4621. @item bg
  4622. @item bb
  4623. @item ba
  4624. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4625. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4626. @item ar
  4627. @item ag
  4628. @item ab
  4629. @item aa
  4630. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4631. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4632. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4633. @end table
  4634. @subsection Examples
  4635. @itemize
  4636. @item
  4637. Convert source to grayscale:
  4638. @example
  4639. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4640. @end example
  4641. @item
  4642. Simulate sepia tones:
  4643. @example
  4644. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4645. @end example
  4646. @end itemize
  4647. @section colormatrix
  4648. Convert color matrix.
  4649. The filter accepts the following options:
  4650. @table @option
  4651. @item src
  4652. @item dst
  4653. Specify the source and destination color matrix. Both values must be
  4654. specified.
  4655. The accepted values are:
  4656. @table @samp
  4657. @item bt709
  4658. BT.709
  4659. @item fcc
  4660. FCC
  4661. @item bt601
  4662. BT.601
  4663. @item bt470
  4664. BT.470
  4665. @item bt470bg
  4666. BT.470BG
  4667. @item smpte170m
  4668. SMPTE-170M
  4669. @item smpte240m
  4670. SMPTE-240M
  4671. @item bt2020
  4672. BT.2020
  4673. @end table
  4674. @end table
  4675. For example to convert from BT.601 to SMPTE-240M, use the command:
  4676. @example
  4677. colormatrix=bt601:smpte240m
  4678. @end example
  4679. @section colorspace
  4680. Convert colorspace, transfer characteristics or color primaries.
  4681. Input video needs to have an even size.
  4682. The filter accepts the following options:
  4683. @table @option
  4684. @anchor{all}
  4685. @item all
  4686. Specify all color properties at once.
  4687. The accepted values are:
  4688. @table @samp
  4689. @item bt470m
  4690. BT.470M
  4691. @item bt470bg
  4692. BT.470BG
  4693. @item bt601-6-525
  4694. BT.601-6 525
  4695. @item bt601-6-625
  4696. BT.601-6 625
  4697. @item bt709
  4698. BT.709
  4699. @item smpte170m
  4700. SMPTE-170M
  4701. @item smpte240m
  4702. SMPTE-240M
  4703. @item bt2020
  4704. BT.2020
  4705. @end table
  4706. @anchor{space}
  4707. @item space
  4708. Specify output colorspace.
  4709. The accepted values are:
  4710. @table @samp
  4711. @item bt709
  4712. BT.709
  4713. @item fcc
  4714. FCC
  4715. @item bt470bg
  4716. BT.470BG or BT.601-6 625
  4717. @item smpte170m
  4718. SMPTE-170M or BT.601-6 525
  4719. @item smpte240m
  4720. SMPTE-240M
  4721. @item ycgco
  4722. YCgCo
  4723. @item bt2020ncl
  4724. BT.2020 with non-constant luminance
  4725. @end table
  4726. @anchor{trc}
  4727. @item trc
  4728. Specify output transfer characteristics.
  4729. The accepted values are:
  4730. @table @samp
  4731. @item bt709
  4732. BT.709
  4733. @item bt470m
  4734. BT.470M
  4735. @item bt470bg
  4736. BT.470BG
  4737. @item gamma22
  4738. Constant gamma of 2.2
  4739. @item gamma28
  4740. Constant gamma of 2.8
  4741. @item smpte170m
  4742. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4743. @item smpte240m
  4744. SMPTE-240M
  4745. @item srgb
  4746. SRGB
  4747. @item iec61966-2-1
  4748. iec61966-2-1
  4749. @item iec61966-2-4
  4750. iec61966-2-4
  4751. @item xvycc
  4752. xvycc
  4753. @item bt2020-10
  4754. BT.2020 for 10-bits content
  4755. @item bt2020-12
  4756. BT.2020 for 12-bits content
  4757. @end table
  4758. @anchor{primaries}
  4759. @item primaries
  4760. Specify output color primaries.
  4761. The accepted values are:
  4762. @table @samp
  4763. @item bt709
  4764. BT.709
  4765. @item bt470m
  4766. BT.470M
  4767. @item bt470bg
  4768. BT.470BG or BT.601-6 625
  4769. @item smpte170m
  4770. SMPTE-170M or BT.601-6 525
  4771. @item smpte240m
  4772. SMPTE-240M
  4773. @item film
  4774. film
  4775. @item smpte431
  4776. SMPTE-431
  4777. @item smpte432
  4778. SMPTE-432
  4779. @item bt2020
  4780. BT.2020
  4781. @item jedec-p22
  4782. JEDEC P22 phosphors
  4783. @end table
  4784. @anchor{range}
  4785. @item range
  4786. Specify output color range.
  4787. The accepted values are:
  4788. @table @samp
  4789. @item tv
  4790. TV (restricted) range
  4791. @item mpeg
  4792. MPEG (restricted) range
  4793. @item pc
  4794. PC (full) range
  4795. @item jpeg
  4796. JPEG (full) range
  4797. @end table
  4798. @item format
  4799. Specify output color format.
  4800. The accepted values are:
  4801. @table @samp
  4802. @item yuv420p
  4803. YUV 4:2:0 planar 8-bits
  4804. @item yuv420p10
  4805. YUV 4:2:0 planar 10-bits
  4806. @item yuv420p12
  4807. YUV 4:2:0 planar 12-bits
  4808. @item yuv422p
  4809. YUV 4:2:2 planar 8-bits
  4810. @item yuv422p10
  4811. YUV 4:2:2 planar 10-bits
  4812. @item yuv422p12
  4813. YUV 4:2:2 planar 12-bits
  4814. @item yuv444p
  4815. YUV 4:4:4 planar 8-bits
  4816. @item yuv444p10
  4817. YUV 4:4:4 planar 10-bits
  4818. @item yuv444p12
  4819. YUV 4:4:4 planar 12-bits
  4820. @end table
  4821. @item fast
  4822. Do a fast conversion, which skips gamma/primary correction. This will take
  4823. significantly less CPU, but will be mathematically incorrect. To get output
  4824. compatible with that produced by the colormatrix filter, use fast=1.
  4825. @item dither
  4826. Specify dithering mode.
  4827. The accepted values are:
  4828. @table @samp
  4829. @item none
  4830. No dithering
  4831. @item fsb
  4832. Floyd-Steinberg dithering
  4833. @end table
  4834. @item wpadapt
  4835. Whitepoint adaptation mode.
  4836. The accepted values are:
  4837. @table @samp
  4838. @item bradford
  4839. Bradford whitepoint adaptation
  4840. @item vonkries
  4841. von Kries whitepoint adaptation
  4842. @item identity
  4843. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4844. @end table
  4845. @item iall
  4846. Override all input properties at once. Same accepted values as @ref{all}.
  4847. @item ispace
  4848. Override input colorspace. Same accepted values as @ref{space}.
  4849. @item iprimaries
  4850. Override input color primaries. Same accepted values as @ref{primaries}.
  4851. @item itrc
  4852. Override input transfer characteristics. Same accepted values as @ref{trc}.
  4853. @item irange
  4854. Override input color range. Same accepted values as @ref{range}.
  4855. @end table
  4856. The filter converts the transfer characteristics, color space and color
  4857. primaries to the specified user values. The output value, if not specified,
  4858. is set to a default value based on the "all" property. If that property is
  4859. also not specified, the filter will log an error. The output color range and
  4860. format default to the same value as the input color range and format. The
  4861. input transfer characteristics, color space, color primaries and color range
  4862. should be set on the input data. If any of these are missing, the filter will
  4863. log an error and no conversion will take place.
  4864. For example to convert the input to SMPTE-240M, use the command:
  4865. @example
  4866. colorspace=smpte240m
  4867. @end example
  4868. @section convolution
  4869. Apply convolution 3x3, 5x5 or 7x7 filter.
  4870. The filter accepts the following options:
  4871. @table @option
  4872. @item 0m
  4873. @item 1m
  4874. @item 2m
  4875. @item 3m
  4876. Set matrix for each plane.
  4877. Matrix is sequence of 9, 25 or 49 signed integers.
  4878. @item 0rdiv
  4879. @item 1rdiv
  4880. @item 2rdiv
  4881. @item 3rdiv
  4882. Set multiplier for calculated value for each plane.
  4883. @item 0bias
  4884. @item 1bias
  4885. @item 2bias
  4886. @item 3bias
  4887. Set bias for each plane. This value is added to the result of the multiplication.
  4888. Useful for making the overall image brighter or darker. Default is 0.0.
  4889. @end table
  4890. @subsection Examples
  4891. @itemize
  4892. @item
  4893. Apply sharpen:
  4894. @example
  4895. 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"
  4896. @end example
  4897. @item
  4898. Apply blur:
  4899. @example
  4900. 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"
  4901. @end example
  4902. @item
  4903. Apply edge enhance:
  4904. @example
  4905. 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"
  4906. @end example
  4907. @item
  4908. Apply edge detect:
  4909. @example
  4910. 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"
  4911. @end example
  4912. @item
  4913. Apply laplacian edge detector which includes diagonals:
  4914. @example
  4915. convolution="1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:5:5:5:1:0:128:128:0"
  4916. @end example
  4917. @item
  4918. Apply emboss:
  4919. @example
  4920. 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"
  4921. @end example
  4922. @end itemize
  4923. @section convolve
  4924. Apply 2D convolution of video stream in frequency domain using second stream
  4925. as impulse.
  4926. The filter accepts the following options:
  4927. @table @option
  4928. @item planes
  4929. Set which planes to process.
  4930. @item impulse
  4931. Set which impulse video frames will be processed, can be @var{first}
  4932. or @var{all}. Default is @var{all}.
  4933. @end table
  4934. The @code{convolve} filter also supports the @ref{framesync} options.
  4935. @section copy
  4936. Copy the input video source unchanged to the output. This is mainly useful for
  4937. testing purposes.
  4938. @anchor{coreimage}
  4939. @section coreimage
  4940. Video filtering on GPU using Apple's CoreImage API on OSX.
  4941. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4942. processed by video hardware. However, software-based OpenGL implementations
  4943. exist which means there is no guarantee for hardware processing. It depends on
  4944. the respective OSX.
  4945. There are many filters and image generators provided by Apple that come with a
  4946. large variety of options. The filter has to be referenced by its name along
  4947. with its options.
  4948. The coreimage filter accepts the following options:
  4949. @table @option
  4950. @item list_filters
  4951. List all available filters and generators along with all their respective
  4952. options as well as possible minimum and maximum values along with the default
  4953. values.
  4954. @example
  4955. list_filters=true
  4956. @end example
  4957. @item filter
  4958. Specify all filters by their respective name and options.
  4959. Use @var{list_filters} to determine all valid filter names and options.
  4960. Numerical options are specified by a float value and are automatically clamped
  4961. to their respective value range. Vector and color options have to be specified
  4962. by a list of space separated float values. Character escaping has to be done.
  4963. A special option name @code{default} is available to use default options for a
  4964. filter.
  4965. It is required to specify either @code{default} or at least one of the filter options.
  4966. All omitted options are used with their default values.
  4967. The syntax of the filter string is as follows:
  4968. @example
  4969. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  4970. @end example
  4971. @item output_rect
  4972. Specify a rectangle where the output of the filter chain is copied into the
  4973. input image. It is given by a list of space separated float values:
  4974. @example
  4975. output_rect=x\ y\ width\ height
  4976. @end example
  4977. If not given, the output rectangle equals the dimensions of the input image.
  4978. The output rectangle is automatically cropped at the borders of the input
  4979. image. Negative values are valid for each component.
  4980. @example
  4981. output_rect=25\ 25\ 100\ 100
  4982. @end example
  4983. @end table
  4984. Several filters can be chained for successive processing without GPU-HOST
  4985. transfers allowing for fast processing of complex filter chains.
  4986. Currently, only filters with zero (generators) or exactly one (filters) input
  4987. image and one output image are supported. Also, transition filters are not yet
  4988. usable as intended.
  4989. Some filters generate output images with additional padding depending on the
  4990. respective filter kernel. The padding is automatically removed to ensure the
  4991. filter output has the same size as the input image.
  4992. For image generators, the size of the output image is determined by the
  4993. previous output image of the filter chain or the input image of the whole
  4994. filterchain, respectively. The generators do not use the pixel information of
  4995. this image to generate their output. However, the generated output is
  4996. blended onto this image, resulting in partial or complete coverage of the
  4997. output image.
  4998. The @ref{coreimagesrc} video source can be used for generating input images
  4999. which are directly fed into the filter chain. By using it, providing input
  5000. images by another video source or an input video is not required.
  5001. @subsection Examples
  5002. @itemize
  5003. @item
  5004. List all filters available:
  5005. @example
  5006. coreimage=list_filters=true
  5007. @end example
  5008. @item
  5009. Use the CIBoxBlur filter with default options to blur an image:
  5010. @example
  5011. coreimage=filter=CIBoxBlur@@default
  5012. @end example
  5013. @item
  5014. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5015. its center at 100x100 and a radius of 50 pixels:
  5016. @example
  5017. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5018. @end example
  5019. @item
  5020. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5021. given as complete and escaped command-line for Apple's standard bash shell:
  5022. @example
  5023. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5024. @end example
  5025. @end itemize
  5026. @section crop
  5027. Crop the input video to given dimensions.
  5028. It accepts the following parameters:
  5029. @table @option
  5030. @item w, out_w
  5031. The width of the output video. It defaults to @code{iw}.
  5032. This expression is evaluated only once during the filter
  5033. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5034. @item h, out_h
  5035. The height of the output video. It defaults to @code{ih}.
  5036. This expression is evaluated only once during the filter
  5037. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5038. @item x
  5039. The horizontal position, in the input video, of the left edge of the output
  5040. video. It defaults to @code{(in_w-out_w)/2}.
  5041. This expression is evaluated per-frame.
  5042. @item y
  5043. The vertical position, in the input video, of the top edge of the output video.
  5044. It defaults to @code{(in_h-out_h)/2}.
  5045. This expression is evaluated per-frame.
  5046. @item keep_aspect
  5047. If set to 1 will force the output display aspect ratio
  5048. to be the same of the input, by changing the output sample aspect
  5049. ratio. It defaults to 0.
  5050. @item exact
  5051. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5052. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5053. It defaults to 0.
  5054. @end table
  5055. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5056. expressions containing the following constants:
  5057. @table @option
  5058. @item x
  5059. @item y
  5060. The computed values for @var{x} and @var{y}. They are evaluated for
  5061. each new frame.
  5062. @item in_w
  5063. @item in_h
  5064. The input width and height.
  5065. @item iw
  5066. @item ih
  5067. These are the same as @var{in_w} and @var{in_h}.
  5068. @item out_w
  5069. @item out_h
  5070. The output (cropped) width and height.
  5071. @item ow
  5072. @item oh
  5073. These are the same as @var{out_w} and @var{out_h}.
  5074. @item a
  5075. same as @var{iw} / @var{ih}
  5076. @item sar
  5077. input sample aspect ratio
  5078. @item dar
  5079. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5080. @item hsub
  5081. @item vsub
  5082. horizontal and vertical chroma subsample values. For example for the
  5083. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5084. @item n
  5085. The number of the input frame, starting from 0.
  5086. @item pos
  5087. the position in the file of the input frame, NAN if unknown
  5088. @item t
  5089. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5090. @end table
  5091. The expression for @var{out_w} may depend on the value of @var{out_h},
  5092. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5093. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5094. evaluated after @var{out_w} and @var{out_h}.
  5095. The @var{x} and @var{y} parameters specify the expressions for the
  5096. position of the top-left corner of the output (non-cropped) area. They
  5097. are evaluated for each frame. If the evaluated value is not valid, it
  5098. is approximated to the nearest valid value.
  5099. The expression for @var{x} may depend on @var{y}, and the expression
  5100. for @var{y} may depend on @var{x}.
  5101. @subsection Examples
  5102. @itemize
  5103. @item
  5104. Crop area with size 100x100 at position (12,34).
  5105. @example
  5106. crop=100:100:12:34
  5107. @end example
  5108. Using named options, the example above becomes:
  5109. @example
  5110. crop=w=100:h=100:x=12:y=34
  5111. @end example
  5112. @item
  5113. Crop the central input area with size 100x100:
  5114. @example
  5115. crop=100:100
  5116. @end example
  5117. @item
  5118. Crop the central input area with size 2/3 of the input video:
  5119. @example
  5120. crop=2/3*in_w:2/3*in_h
  5121. @end example
  5122. @item
  5123. Crop the input video central square:
  5124. @example
  5125. crop=out_w=in_h
  5126. crop=in_h
  5127. @end example
  5128. @item
  5129. Delimit the rectangle with the top-left corner placed at position
  5130. 100:100 and the right-bottom corner corresponding to the right-bottom
  5131. corner of the input image.
  5132. @example
  5133. crop=in_w-100:in_h-100:100:100
  5134. @end example
  5135. @item
  5136. Crop 10 pixels from the left and right borders, and 20 pixels from
  5137. the top and bottom borders
  5138. @example
  5139. crop=in_w-2*10:in_h-2*20
  5140. @end example
  5141. @item
  5142. Keep only the bottom right quarter of the input image:
  5143. @example
  5144. crop=in_w/2:in_h/2:in_w/2:in_h/2
  5145. @end example
  5146. @item
  5147. Crop height for getting Greek harmony:
  5148. @example
  5149. crop=in_w:1/PHI*in_w
  5150. @end example
  5151. @item
  5152. Apply trembling effect:
  5153. @example
  5154. 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)
  5155. @end example
  5156. @item
  5157. Apply erratic camera effect depending on timestamp:
  5158. @example
  5159. 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)"
  5160. @end example
  5161. @item
  5162. Set x depending on the value of y:
  5163. @example
  5164. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  5165. @end example
  5166. @end itemize
  5167. @subsection Commands
  5168. This filter supports the following commands:
  5169. @table @option
  5170. @item w, out_w
  5171. @item h, out_h
  5172. @item x
  5173. @item y
  5174. Set width/height of the output video and the horizontal/vertical position
  5175. in the input video.
  5176. The command accepts the same syntax of the corresponding option.
  5177. If the specified expression is not valid, it is kept at its current
  5178. value.
  5179. @end table
  5180. @section cropdetect
  5181. Auto-detect the crop size.
  5182. It calculates the necessary cropping parameters and prints the
  5183. recommended parameters via the logging system. The detected dimensions
  5184. correspond to the non-black area of the input video.
  5185. It accepts the following parameters:
  5186. @table @option
  5187. @item limit
  5188. Set higher black value threshold, which can be optionally specified
  5189. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  5190. value greater to the set value is considered non-black. It defaults to 24.
  5191. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  5192. on the bitdepth of the pixel format.
  5193. @item round
  5194. The value which the width/height should be divisible by. It defaults to
  5195. 16. The offset is automatically adjusted to center the video. Use 2 to
  5196. get only even dimensions (needed for 4:2:2 video). 16 is best when
  5197. encoding to most video codecs.
  5198. @item reset_count, reset
  5199. Set the counter that determines after how many frames cropdetect will
  5200. reset the previously detected largest video area and start over to
  5201. detect the current optimal crop area. Default value is 0.
  5202. This can be useful when channel logos distort the video area. 0
  5203. indicates 'never reset', and returns the largest area encountered during
  5204. playback.
  5205. @end table
  5206. @anchor{curves}
  5207. @section curves
  5208. Apply color adjustments using curves.
  5209. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  5210. component (red, green and blue) has its values defined by @var{N} key points
  5211. tied from each other using a smooth curve. The x-axis represents the pixel
  5212. values from the input frame, and the y-axis the new pixel values to be set for
  5213. the output frame.
  5214. By default, a component curve is defined by the two points @var{(0;0)} and
  5215. @var{(1;1)}. This creates a straight line where each original pixel value is
  5216. "adjusted" to its own value, which means no change to the image.
  5217. The filter allows you to redefine these two points and add some more. A new
  5218. curve (using a natural cubic spline interpolation) will be define to pass
  5219. smoothly through all these new coordinates. The new defined points needs to be
  5220. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  5221. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  5222. the vector spaces, the values will be clipped accordingly.
  5223. The filter accepts the following options:
  5224. @table @option
  5225. @item preset
  5226. Select one of the available color presets. This option can be used in addition
  5227. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  5228. options takes priority on the preset values.
  5229. Available presets are:
  5230. @table @samp
  5231. @item none
  5232. @item color_negative
  5233. @item cross_process
  5234. @item darker
  5235. @item increase_contrast
  5236. @item lighter
  5237. @item linear_contrast
  5238. @item medium_contrast
  5239. @item negative
  5240. @item strong_contrast
  5241. @item vintage
  5242. @end table
  5243. Default is @code{none}.
  5244. @item master, m
  5245. Set the master key points. These points will define a second pass mapping. It
  5246. is sometimes called a "luminance" or "value" mapping. It can be used with
  5247. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  5248. post-processing LUT.
  5249. @item red, r
  5250. Set the key points for the red component.
  5251. @item green, g
  5252. Set the key points for the green component.
  5253. @item blue, b
  5254. Set the key points for the blue component.
  5255. @item all
  5256. Set the key points for all components (not including master).
  5257. Can be used in addition to the other key points component
  5258. options. In this case, the unset component(s) will fallback on this
  5259. @option{all} setting.
  5260. @item psfile
  5261. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  5262. @item plot
  5263. Save Gnuplot script of the curves in specified file.
  5264. @end table
  5265. To avoid some filtergraph syntax conflicts, each key points list need to be
  5266. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  5267. @subsection Examples
  5268. @itemize
  5269. @item
  5270. Increase slightly the middle level of blue:
  5271. @example
  5272. curves=blue='0/0 0.5/0.58 1/1'
  5273. @end example
  5274. @item
  5275. Vintage effect:
  5276. @example
  5277. 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'
  5278. @end example
  5279. Here we obtain the following coordinates for each components:
  5280. @table @var
  5281. @item red
  5282. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  5283. @item green
  5284. @code{(0;0) (0.50;0.48) (1;1)}
  5285. @item blue
  5286. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  5287. @end table
  5288. @item
  5289. The previous example can also be achieved with the associated built-in preset:
  5290. @example
  5291. curves=preset=vintage
  5292. @end example
  5293. @item
  5294. Or simply:
  5295. @example
  5296. curves=vintage
  5297. @end example
  5298. @item
  5299. Use a Photoshop preset and redefine the points of the green component:
  5300. @example
  5301. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  5302. @end example
  5303. @item
  5304. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  5305. and @command{gnuplot}:
  5306. @example
  5307. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  5308. gnuplot -p /tmp/curves.plt
  5309. @end example
  5310. @end itemize
  5311. @section datascope
  5312. Video data analysis filter.
  5313. This filter shows hexadecimal pixel values of part of video.
  5314. The filter accepts the following options:
  5315. @table @option
  5316. @item size, s
  5317. Set output video size.
  5318. @item x
  5319. Set x offset from where to pick pixels.
  5320. @item y
  5321. Set y offset from where to pick pixels.
  5322. @item mode
  5323. Set scope mode, can be one of the following:
  5324. @table @samp
  5325. @item mono
  5326. Draw hexadecimal pixel values with white color on black background.
  5327. @item color
  5328. Draw hexadecimal pixel values with input video pixel color on black
  5329. background.
  5330. @item color2
  5331. Draw hexadecimal pixel values on color background picked from input video,
  5332. the text color is picked in such way so its always visible.
  5333. @end table
  5334. @item axis
  5335. Draw rows and columns numbers on left and top of video.
  5336. @item opacity
  5337. Set background opacity.
  5338. @end table
  5339. @section dctdnoiz
  5340. Denoise frames using 2D DCT (frequency domain filtering).
  5341. This filter is not designed for real time.
  5342. The filter accepts the following options:
  5343. @table @option
  5344. @item sigma, s
  5345. Set the noise sigma constant.
  5346. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  5347. coefficient (absolute value) below this threshold with be dropped.
  5348. If you need a more advanced filtering, see @option{expr}.
  5349. Default is @code{0}.
  5350. @item overlap
  5351. Set number overlapping pixels for each block. Since the filter can be slow, you
  5352. may want to reduce this value, at the cost of a less effective filter and the
  5353. risk of various artefacts.
  5354. If the overlapping value doesn't permit processing the whole input width or
  5355. height, a warning will be displayed and according borders won't be denoised.
  5356. Default value is @var{blocksize}-1, which is the best possible setting.
  5357. @item expr, e
  5358. Set the coefficient factor expression.
  5359. For each coefficient of a DCT block, this expression will be evaluated as a
  5360. multiplier value for the coefficient.
  5361. If this is option is set, the @option{sigma} option will be ignored.
  5362. The absolute value of the coefficient can be accessed through the @var{c}
  5363. variable.
  5364. @item n
  5365. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  5366. @var{blocksize}, which is the width and height of the processed blocks.
  5367. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  5368. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5369. on the speed processing. Also, a larger block size does not necessarily means a
  5370. better de-noising.
  5371. @end table
  5372. @subsection Examples
  5373. Apply a denoise with a @option{sigma} of @code{4.5}:
  5374. @example
  5375. dctdnoiz=4.5
  5376. @end example
  5377. The same operation can be achieved using the expression system:
  5378. @example
  5379. dctdnoiz=e='gte(c, 4.5*3)'
  5380. @end example
  5381. Violent denoise using a block size of @code{16x16}:
  5382. @example
  5383. dctdnoiz=15:n=4
  5384. @end example
  5385. @section deband
  5386. Remove banding artifacts from input video.
  5387. It works by replacing banded pixels with average value of referenced pixels.
  5388. The filter accepts the following options:
  5389. @table @option
  5390. @item 1thr
  5391. @item 2thr
  5392. @item 3thr
  5393. @item 4thr
  5394. Set banding detection threshold for each plane. Default is 0.02.
  5395. Valid range is 0.00003 to 0.5.
  5396. If difference between current pixel and reference pixel is less than threshold,
  5397. it will be considered as banded.
  5398. @item range, r
  5399. Banding detection range in pixels. Default is 16. If positive, random number
  5400. in range 0 to set value will be used. If negative, exact absolute value
  5401. will be used.
  5402. The range defines square of four pixels around current pixel.
  5403. @item direction, d
  5404. Set direction in radians from which four pixel will be compared. If positive,
  5405. random direction from 0 to set direction will be picked. If negative, exact of
  5406. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5407. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5408. column.
  5409. @item blur, b
  5410. If enabled, current pixel is compared with average value of all four
  5411. surrounding pixels. The default is enabled. If disabled current pixel is
  5412. compared with all four surrounding pixels. The pixel is considered banded
  5413. if only all four differences with surrounding pixels are less than threshold.
  5414. @item coupling, c
  5415. If enabled, current pixel is changed if and only if all pixel components are banded,
  5416. e.g. banding detection threshold is triggered for all color components.
  5417. The default is disabled.
  5418. @end table
  5419. @anchor{decimate}
  5420. @section decimate
  5421. Drop duplicated frames at regular intervals.
  5422. The filter accepts the following options:
  5423. @table @option
  5424. @item cycle
  5425. Set the number of frames from which one will be dropped. Setting this to
  5426. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  5427. Default is @code{5}.
  5428. @item dupthresh
  5429. Set the threshold for duplicate detection. If the difference metric for a frame
  5430. is less than or equal to this value, then it is declared as duplicate. Default
  5431. is @code{1.1}
  5432. @item scthresh
  5433. Set scene change threshold. Default is @code{15}.
  5434. @item blockx
  5435. @item blocky
  5436. Set the size of the x and y-axis blocks used during metric calculations.
  5437. Larger blocks give better noise suppression, but also give worse detection of
  5438. small movements. Must be a power of two. Default is @code{32}.
  5439. @item ppsrc
  5440. Mark main input as a pre-processed input and activate clean source input
  5441. stream. This allows the input to be pre-processed with various filters to help
  5442. the metrics calculation while keeping the frame selection lossless. When set to
  5443. @code{1}, the first stream is for the pre-processed input, and the second
  5444. stream is the clean source from where the kept frames are chosen. Default is
  5445. @code{0}.
  5446. @item chroma
  5447. Set whether or not chroma is considered in the metric calculations. Default is
  5448. @code{1}.
  5449. @end table
  5450. @section deconvolve
  5451. Apply 2D deconvolution of video stream in frequency domain using second stream
  5452. as impulse.
  5453. The filter accepts the following options:
  5454. @table @option
  5455. @item planes
  5456. Set which planes to process.
  5457. @item impulse
  5458. Set which impulse video frames will be processed, can be @var{first}
  5459. or @var{all}. Default is @var{all}.
  5460. @item noise
  5461. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  5462. and height are not same and not power of 2 or if stream prior to convolving
  5463. had noise.
  5464. @end table
  5465. The @code{deconvolve} filter also supports the @ref{framesync} options.
  5466. @section deflate
  5467. Apply deflate effect to the video.
  5468. This filter replaces the pixel by the local(3x3) average by taking into account
  5469. only values lower than the pixel.
  5470. It accepts the following options:
  5471. @table @option
  5472. @item threshold0
  5473. @item threshold1
  5474. @item threshold2
  5475. @item threshold3
  5476. Limit the maximum change for each plane, default is 65535.
  5477. If 0, plane will remain unchanged.
  5478. @end table
  5479. @section deflicker
  5480. Remove temporal frame luminance variations.
  5481. It accepts the following options:
  5482. @table @option
  5483. @item size, s
  5484. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  5485. @item mode, m
  5486. Set averaging mode to smooth temporal luminance variations.
  5487. Available values are:
  5488. @table @samp
  5489. @item am
  5490. Arithmetic mean
  5491. @item gm
  5492. Geometric mean
  5493. @item hm
  5494. Harmonic mean
  5495. @item qm
  5496. Quadratic mean
  5497. @item cm
  5498. Cubic mean
  5499. @item pm
  5500. Power mean
  5501. @item median
  5502. Median
  5503. @end table
  5504. @item bypass
  5505. Do not actually modify frame. Useful when one only wants metadata.
  5506. @end table
  5507. @section dejudder
  5508. Remove judder produced by partially interlaced telecined content.
  5509. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  5510. source was partially telecined content then the output of @code{pullup,dejudder}
  5511. will have a variable frame rate. May change the recorded frame rate of the
  5512. container. Aside from that change, this filter will not affect constant frame
  5513. rate video.
  5514. The option available in this filter is:
  5515. @table @option
  5516. @item cycle
  5517. Specify the length of the window over which the judder repeats.
  5518. Accepts any integer greater than 1. Useful values are:
  5519. @table @samp
  5520. @item 4
  5521. If the original was telecined from 24 to 30 fps (Film to NTSC).
  5522. @item 5
  5523. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  5524. @item 20
  5525. If a mixture of the two.
  5526. @end table
  5527. The default is @samp{4}.
  5528. @end table
  5529. @section delogo
  5530. Suppress a TV station logo by a simple interpolation of the surrounding
  5531. pixels. Just set a rectangle covering the logo and watch it disappear
  5532. (and sometimes something even uglier appear - your mileage may vary).
  5533. It accepts the following parameters:
  5534. @table @option
  5535. @item x
  5536. @item y
  5537. Specify the top left corner coordinates of the logo. They must be
  5538. specified.
  5539. @item w
  5540. @item h
  5541. Specify the width and height of the logo to clear. They must be
  5542. specified.
  5543. @item band, t
  5544. Specify the thickness of the fuzzy edge of the rectangle (added to
  5545. @var{w} and @var{h}). The default value is 1. This option is
  5546. deprecated, setting higher values should no longer be necessary and
  5547. is not recommended.
  5548. @item show
  5549. When set to 1, a green rectangle is drawn on the screen to simplify
  5550. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  5551. The default value is 0.
  5552. The rectangle is drawn on the outermost pixels which will be (partly)
  5553. replaced with interpolated values. The values of the next pixels
  5554. immediately outside this rectangle in each direction will be used to
  5555. compute the interpolated pixel values inside the rectangle.
  5556. @end table
  5557. @subsection Examples
  5558. @itemize
  5559. @item
  5560. Set a rectangle covering the area with top left corner coordinates 0,0
  5561. and size 100x77, and a band of size 10:
  5562. @example
  5563. delogo=x=0:y=0:w=100:h=77:band=10
  5564. @end example
  5565. @end itemize
  5566. @section deshake
  5567. Attempt to fix small changes in horizontal and/or vertical shift. This
  5568. filter helps remove camera shake from hand-holding a camera, bumping a
  5569. tripod, moving on a vehicle, etc.
  5570. The filter accepts the following options:
  5571. @table @option
  5572. @item x
  5573. @item y
  5574. @item w
  5575. @item h
  5576. Specify a rectangular area where to limit the search for motion
  5577. vectors.
  5578. If desired the search for motion vectors can be limited to a
  5579. rectangular area of the frame defined by its top left corner, width
  5580. and height. These parameters have the same meaning as the drawbox
  5581. filter which can be used to visualise the position of the bounding
  5582. box.
  5583. This is useful when simultaneous movement of subjects within the frame
  5584. might be confused for camera motion by the motion vector search.
  5585. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  5586. then the full frame is used. This allows later options to be set
  5587. without specifying the bounding box for the motion vector search.
  5588. Default - search the whole frame.
  5589. @item rx
  5590. @item ry
  5591. Specify the maximum extent of movement in x and y directions in the
  5592. range 0-64 pixels. Default 16.
  5593. @item edge
  5594. Specify how to generate pixels to fill blanks at the edge of the
  5595. frame. Available values are:
  5596. @table @samp
  5597. @item blank, 0
  5598. Fill zeroes at blank locations
  5599. @item original, 1
  5600. Original image at blank locations
  5601. @item clamp, 2
  5602. Extruded edge value at blank locations
  5603. @item mirror, 3
  5604. Mirrored edge at blank locations
  5605. @end table
  5606. Default value is @samp{mirror}.
  5607. @item blocksize
  5608. Specify the blocksize to use for motion search. Range 4-128 pixels,
  5609. default 8.
  5610. @item contrast
  5611. Specify the contrast threshold for blocks. Only blocks with more than
  5612. the specified contrast (difference between darkest and lightest
  5613. pixels) will be considered. Range 1-255, default 125.
  5614. @item search
  5615. Specify the search strategy. Available values are:
  5616. @table @samp
  5617. @item exhaustive, 0
  5618. Set exhaustive search
  5619. @item less, 1
  5620. Set less exhaustive search.
  5621. @end table
  5622. Default value is @samp{exhaustive}.
  5623. @item filename
  5624. If set then a detailed log of the motion search is written to the
  5625. specified file.
  5626. @end table
  5627. @section despill
  5628. Remove unwanted contamination of foreground colors, caused by reflected color of
  5629. greenscreen or bluescreen.
  5630. This filter accepts the following options:
  5631. @table @option
  5632. @item type
  5633. Set what type of despill to use.
  5634. @item mix
  5635. Set how spillmap will be generated.
  5636. @item expand
  5637. Set how much to get rid of still remaining spill.
  5638. @item red
  5639. Controls amount of red in spill area.
  5640. @item green
  5641. Controls amount of green in spill area.
  5642. Should be -1 for greenscreen.
  5643. @item blue
  5644. Controls amount of blue in spill area.
  5645. Should be -1 for bluescreen.
  5646. @item brightness
  5647. Controls brightness of spill area, preserving colors.
  5648. @item alpha
  5649. Modify alpha from generated spillmap.
  5650. @end table
  5651. @section detelecine
  5652. Apply an exact inverse of the telecine operation. It requires a predefined
  5653. pattern specified using the pattern option which must be the same as that passed
  5654. to the telecine filter.
  5655. This filter accepts the following options:
  5656. @table @option
  5657. @item first_field
  5658. @table @samp
  5659. @item top, t
  5660. top field first
  5661. @item bottom, b
  5662. bottom field first
  5663. The default value is @code{top}.
  5664. @end table
  5665. @item pattern
  5666. A string of numbers representing the pulldown pattern you wish to apply.
  5667. The default value is @code{23}.
  5668. @item start_frame
  5669. A number representing position of the first frame with respect to the telecine
  5670. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  5671. @end table
  5672. @section dilation
  5673. Apply dilation effect to the video.
  5674. This filter replaces the pixel by the local(3x3) maximum.
  5675. It accepts the following options:
  5676. @table @option
  5677. @item threshold0
  5678. @item threshold1
  5679. @item threshold2
  5680. @item threshold3
  5681. Limit the maximum change for each plane, default is 65535.
  5682. If 0, plane will remain unchanged.
  5683. @item coordinates
  5684. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5685. pixels are used.
  5686. Flags to local 3x3 coordinates maps like this:
  5687. 1 2 3
  5688. 4 5
  5689. 6 7 8
  5690. @end table
  5691. @section displace
  5692. Displace pixels as indicated by second and third input stream.
  5693. It takes three input streams and outputs one stream, the first input is the
  5694. source, and second and third input are displacement maps.
  5695. The second input specifies how much to displace pixels along the
  5696. x-axis, while the third input specifies how much to displace pixels
  5697. along the y-axis.
  5698. If one of displacement map streams terminates, last frame from that
  5699. displacement map will be used.
  5700. Note that once generated, displacements maps can be reused over and over again.
  5701. A description of the accepted options follows.
  5702. @table @option
  5703. @item edge
  5704. Set displace behavior for pixels that are out of range.
  5705. Available values are:
  5706. @table @samp
  5707. @item blank
  5708. Missing pixels are replaced by black pixels.
  5709. @item smear
  5710. Adjacent pixels will spread out to replace missing pixels.
  5711. @item wrap
  5712. Out of range pixels are wrapped so they point to pixels of other side.
  5713. @item mirror
  5714. Out of range pixels will be replaced with mirrored pixels.
  5715. @end table
  5716. Default is @samp{smear}.
  5717. @end table
  5718. @subsection Examples
  5719. @itemize
  5720. @item
  5721. Add ripple effect to rgb input of video size hd720:
  5722. @example
  5723. 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
  5724. @end example
  5725. @item
  5726. Add wave effect to rgb input of video size hd720:
  5727. @example
  5728. 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
  5729. @end example
  5730. @end itemize
  5731. @section drawbox
  5732. Draw a colored box on the input image.
  5733. It accepts the following parameters:
  5734. @table @option
  5735. @item x
  5736. @item y
  5737. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5738. @item width, w
  5739. @item height, h
  5740. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5741. the input width and height. It defaults to 0.
  5742. @item color, c
  5743. Specify the color of the box to write. For the general syntax of this option,
  5744. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  5745. value @code{invert} is used, the box edge color is the same as the
  5746. video with inverted luma.
  5747. @item thickness, t
  5748. The expression which sets the thickness of the box edge.
  5749. A value of @code{fill} will create a filled box. Default value is @code{3}.
  5750. See below for the list of accepted constants.
  5751. @item replace
  5752. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  5753. will overwrite the video's color and alpha pixels.
  5754. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  5755. @end table
  5756. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5757. following constants:
  5758. @table @option
  5759. @item dar
  5760. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5761. @item hsub
  5762. @item vsub
  5763. horizontal and vertical chroma subsample values. For example for the
  5764. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5765. @item in_h, ih
  5766. @item in_w, iw
  5767. The input width and height.
  5768. @item sar
  5769. The input sample aspect ratio.
  5770. @item x
  5771. @item y
  5772. The x and y offset coordinates where the box is drawn.
  5773. @item w
  5774. @item h
  5775. The width and height of the drawn box.
  5776. @item t
  5777. The thickness of the drawn box.
  5778. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5779. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5780. @end table
  5781. @subsection Examples
  5782. @itemize
  5783. @item
  5784. Draw a black box around the edge of the input image:
  5785. @example
  5786. drawbox
  5787. @end example
  5788. @item
  5789. Draw a box with color red and an opacity of 50%:
  5790. @example
  5791. drawbox=10:20:200:60:red@@0.5
  5792. @end example
  5793. The previous example can be specified as:
  5794. @example
  5795. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5796. @end example
  5797. @item
  5798. Fill the box with pink color:
  5799. @example
  5800. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  5801. @end example
  5802. @item
  5803. Draw a 2-pixel red 2.40:1 mask:
  5804. @example
  5805. 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
  5806. @end example
  5807. @end itemize
  5808. @section drawgrid
  5809. Draw a grid on the input image.
  5810. It accepts the following parameters:
  5811. @table @option
  5812. @item x
  5813. @item y
  5814. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5815. @item width, w
  5816. @item height, h
  5817. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5818. input width and height, respectively, minus @code{thickness}, so image gets
  5819. framed. Default to 0.
  5820. @item color, c
  5821. Specify the color of the grid. For the general syntax of this option,
  5822. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  5823. value @code{invert} is used, the grid color is the same as the
  5824. video with inverted luma.
  5825. @item thickness, t
  5826. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5827. See below for the list of accepted constants.
  5828. @item replace
  5829. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  5830. will overwrite the video's color and alpha pixels.
  5831. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  5832. @end table
  5833. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5834. following constants:
  5835. @table @option
  5836. @item dar
  5837. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5838. @item hsub
  5839. @item vsub
  5840. horizontal and vertical chroma subsample values. For example for the
  5841. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5842. @item in_h, ih
  5843. @item in_w, iw
  5844. The input grid cell width and height.
  5845. @item sar
  5846. The input sample aspect ratio.
  5847. @item x
  5848. @item y
  5849. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5850. @item w
  5851. @item h
  5852. The width and height of the drawn cell.
  5853. @item t
  5854. The thickness of the drawn cell.
  5855. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5856. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5857. @end table
  5858. @subsection Examples
  5859. @itemize
  5860. @item
  5861. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5862. @example
  5863. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5864. @end example
  5865. @item
  5866. Draw a white 3x3 grid with an opacity of 50%:
  5867. @example
  5868. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5869. @end example
  5870. @end itemize
  5871. @anchor{drawtext}
  5872. @section drawtext
  5873. Draw a text string or text from a specified file on top of a video, using the
  5874. libfreetype library.
  5875. To enable compilation of this filter, you need to configure FFmpeg with
  5876. @code{--enable-libfreetype}.
  5877. To enable default font fallback and the @var{font} option you need to
  5878. configure FFmpeg with @code{--enable-libfontconfig}.
  5879. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5880. @code{--enable-libfribidi}.
  5881. @subsection Syntax
  5882. It accepts the following parameters:
  5883. @table @option
  5884. @item box
  5885. Used to draw a box around text using the background color.
  5886. The value must be either 1 (enable) or 0 (disable).
  5887. The default value of @var{box} is 0.
  5888. @item boxborderw
  5889. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5890. The default value of @var{boxborderw} is 0.
  5891. @item boxcolor
  5892. The color to be used for drawing box around text. For the syntax of this
  5893. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  5894. The default value of @var{boxcolor} is "white".
  5895. @item line_spacing
  5896. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  5897. The default value of @var{line_spacing} is 0.
  5898. @item borderw
  5899. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5900. The default value of @var{borderw} is 0.
  5901. @item bordercolor
  5902. Set the color to be used for drawing border around text. For the syntax of this
  5903. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  5904. The default value of @var{bordercolor} is "black".
  5905. @item expansion
  5906. Select how the @var{text} is expanded. Can be either @code{none},
  5907. @code{strftime} (deprecated) or
  5908. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5909. below for details.
  5910. @item basetime
  5911. Set a start time for the count. Value is in microseconds. Only applied
  5912. in the deprecated strftime expansion mode. To emulate in normal expansion
  5913. mode use the @code{pts} function, supplying the start time (in seconds)
  5914. as the second argument.
  5915. @item fix_bounds
  5916. If true, check and fix text coords to avoid clipping.
  5917. @item fontcolor
  5918. The color to be used for drawing fonts. For the syntax of this option, check
  5919. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  5920. The default value of @var{fontcolor} is "black".
  5921. @item fontcolor_expr
  5922. String which is expanded the same way as @var{text} to obtain dynamic
  5923. @var{fontcolor} value. By default this option has empty value and is not
  5924. processed. When this option is set, it overrides @var{fontcolor} option.
  5925. @item font
  5926. The font family to be used for drawing text. By default Sans.
  5927. @item fontfile
  5928. The font file to be used for drawing text. The path must be included.
  5929. This parameter is mandatory if the fontconfig support is disabled.
  5930. @item alpha
  5931. Draw the text applying alpha blending. The value can
  5932. be a number between 0.0 and 1.0.
  5933. The expression accepts the same variables @var{x, y} as well.
  5934. The default value is 1.
  5935. Please see @var{fontcolor_expr}.
  5936. @item fontsize
  5937. The font size to be used for drawing text.
  5938. The default value of @var{fontsize} is 16.
  5939. @item text_shaping
  5940. If set to 1, attempt to shape the text (for example, reverse the order of
  5941. right-to-left text and join Arabic characters) before drawing it.
  5942. Otherwise, just draw the text exactly as given.
  5943. By default 1 (if supported).
  5944. @item ft_load_flags
  5945. The flags to be used for loading the fonts.
  5946. The flags map the corresponding flags supported by libfreetype, and are
  5947. a combination of the following values:
  5948. @table @var
  5949. @item default
  5950. @item no_scale
  5951. @item no_hinting
  5952. @item render
  5953. @item no_bitmap
  5954. @item vertical_layout
  5955. @item force_autohint
  5956. @item crop_bitmap
  5957. @item pedantic
  5958. @item ignore_global_advance_width
  5959. @item no_recurse
  5960. @item ignore_transform
  5961. @item monochrome
  5962. @item linear_design
  5963. @item no_autohint
  5964. @end table
  5965. Default value is "default".
  5966. For more information consult the documentation for the FT_LOAD_*
  5967. libfreetype flags.
  5968. @item shadowcolor
  5969. The color to be used for drawing a shadow behind the drawn text. For the
  5970. syntax of this option, check the @ref{color syntax,,"Color" section in the
  5971. ffmpeg-utils manual,ffmpeg-utils}.
  5972. The default value of @var{shadowcolor} is "black".
  5973. @item shadowx
  5974. @item shadowy
  5975. The x and y offsets for the text shadow position with respect to the
  5976. position of the text. They can be either positive or negative
  5977. values. The default value for both is "0".
  5978. @item start_number
  5979. The starting frame number for the n/frame_num variable. The default value
  5980. is "0".
  5981. @item tabsize
  5982. The size in number of spaces to use for rendering the tab.
  5983. Default value is 4.
  5984. @item timecode
  5985. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5986. format. It can be used with or without text parameter. @var{timecode_rate}
  5987. option must be specified.
  5988. @item timecode_rate, rate, r
  5989. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  5990. integer. Minimum value is "1".
  5991. Drop-frame timecode is supported for frame rates 30 & 60.
  5992. @item tc24hmax
  5993. If set to 1, the output of the timecode option will wrap around at 24 hours.
  5994. Default is 0 (disabled).
  5995. @item text
  5996. The text string to be drawn. The text must be a sequence of UTF-8
  5997. encoded characters.
  5998. This parameter is mandatory if no file is specified with the parameter
  5999. @var{textfile}.
  6000. @item textfile
  6001. A text file containing text to be drawn. The text must be a sequence
  6002. of UTF-8 encoded characters.
  6003. This parameter is mandatory if no text string is specified with the
  6004. parameter @var{text}.
  6005. If both @var{text} and @var{textfile} are specified, an error is thrown.
  6006. @item reload
  6007. If set to 1, the @var{textfile} will be reloaded before each frame.
  6008. Be sure to update it atomically, or it may be read partially, or even fail.
  6009. @item x
  6010. @item y
  6011. The expressions which specify the offsets where text will be drawn
  6012. within the video frame. They are relative to the top/left border of the
  6013. output image.
  6014. The default value of @var{x} and @var{y} is "0".
  6015. See below for the list of accepted constants and functions.
  6016. @end table
  6017. The parameters for @var{x} and @var{y} are expressions containing the
  6018. following constants and functions:
  6019. @table @option
  6020. @item dar
  6021. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  6022. @item hsub
  6023. @item vsub
  6024. horizontal and vertical chroma subsample values. For example for the
  6025. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6026. @item line_h, lh
  6027. the height of each text line
  6028. @item main_h, h, H
  6029. the input height
  6030. @item main_w, w, W
  6031. the input width
  6032. @item max_glyph_a, ascent
  6033. the maximum distance from the baseline to the highest/upper grid
  6034. coordinate used to place a glyph outline point, for all the rendered
  6035. glyphs.
  6036. It is a positive value, due to the grid's orientation with the Y axis
  6037. upwards.
  6038. @item max_glyph_d, descent
  6039. the maximum distance from the baseline to the lowest grid coordinate
  6040. used to place a glyph outline point, for all the rendered glyphs.
  6041. This is a negative value, due to the grid's orientation, with the Y axis
  6042. upwards.
  6043. @item max_glyph_h
  6044. maximum glyph height, that is the maximum height for all the glyphs
  6045. contained in the rendered text, it is equivalent to @var{ascent} -
  6046. @var{descent}.
  6047. @item max_glyph_w
  6048. maximum glyph width, that is the maximum width for all the glyphs
  6049. contained in the rendered text
  6050. @item n
  6051. the number of input frame, starting from 0
  6052. @item rand(min, max)
  6053. return a random number included between @var{min} and @var{max}
  6054. @item sar
  6055. The input sample aspect ratio.
  6056. @item t
  6057. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6058. @item text_h, th
  6059. the height of the rendered text
  6060. @item text_w, tw
  6061. the width of the rendered text
  6062. @item x
  6063. @item y
  6064. the x and y offset coordinates where the text is drawn.
  6065. These parameters allow the @var{x} and @var{y} expressions to refer
  6066. each other, so you can for example specify @code{y=x/dar}.
  6067. @end table
  6068. @anchor{drawtext_expansion}
  6069. @subsection Text expansion
  6070. If @option{expansion} is set to @code{strftime},
  6071. the filter recognizes strftime() sequences in the provided text and
  6072. expands them accordingly. Check the documentation of strftime(). This
  6073. feature is deprecated.
  6074. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  6075. If @option{expansion} is set to @code{normal} (which is the default),
  6076. the following expansion mechanism is used.
  6077. The backslash character @samp{\}, followed by any character, always expands to
  6078. the second character.
  6079. Sequences of the form @code{%@{...@}} are expanded. The text between the
  6080. braces is a function name, possibly followed by arguments separated by ':'.
  6081. If the arguments contain special characters or delimiters (':' or '@}'),
  6082. they should be escaped.
  6083. Note that they probably must also be escaped as the value for the
  6084. @option{text} option in the filter argument string and as the filter
  6085. argument in the filtergraph description, and possibly also for the shell,
  6086. that makes up to four levels of escaping; using a text file avoids these
  6087. problems.
  6088. The following functions are available:
  6089. @table @command
  6090. @item expr, e
  6091. The expression evaluation result.
  6092. It must take one argument specifying the expression to be evaluated,
  6093. which accepts the same constants and functions as the @var{x} and
  6094. @var{y} values. Note that not all constants should be used, for
  6095. example the text size is not known when evaluating the expression, so
  6096. the constants @var{text_w} and @var{text_h} will have an undefined
  6097. value.
  6098. @item expr_int_format, eif
  6099. Evaluate the expression's value and output as formatted integer.
  6100. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  6101. The second argument specifies the output format. Allowed values are @samp{x},
  6102. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  6103. @code{printf} function.
  6104. The third parameter is optional and sets the number of positions taken by the output.
  6105. It can be used to add padding with zeros from the left.
  6106. @item gmtime
  6107. The time at which the filter is running, expressed in UTC.
  6108. It can accept an argument: a strftime() format string.
  6109. @item localtime
  6110. The time at which the filter is running, expressed in the local time zone.
  6111. It can accept an argument: a strftime() format string.
  6112. @item metadata
  6113. Frame metadata. Takes one or two arguments.
  6114. The first argument is mandatory and specifies the metadata key.
  6115. The second argument is optional and specifies a default value, used when the
  6116. metadata key is not found or empty.
  6117. @item n, frame_num
  6118. The frame number, starting from 0.
  6119. @item pict_type
  6120. A 1 character description of the current picture type.
  6121. @item pts
  6122. The timestamp of the current frame.
  6123. It can take up to three arguments.
  6124. The first argument is the format of the timestamp; it defaults to @code{flt}
  6125. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  6126. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  6127. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  6128. @code{localtime} stands for the timestamp of the frame formatted as
  6129. local time zone time.
  6130. The second argument is an offset added to the timestamp.
  6131. If the format is set to @code{localtime} or @code{gmtime},
  6132. a third argument may be supplied: a strftime() format string.
  6133. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  6134. @end table
  6135. @subsection Examples
  6136. @itemize
  6137. @item
  6138. Draw "Test Text" with font FreeSerif, using the default values for the
  6139. optional parameters.
  6140. @example
  6141. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  6142. @end example
  6143. @item
  6144. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  6145. and y=50 (counting from the top-left corner of the screen), text is
  6146. yellow with a red box around it. Both the text and the box have an
  6147. opacity of 20%.
  6148. @example
  6149. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  6150. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  6151. @end example
  6152. Note that the double quotes are not necessary if spaces are not used
  6153. within the parameter list.
  6154. @item
  6155. Show the text at the center of the video frame:
  6156. @example
  6157. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  6158. @end example
  6159. @item
  6160. Show the text at a random position, switching to a new position every 30 seconds:
  6161. @example
  6162. 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)"
  6163. @end example
  6164. @item
  6165. Show a text line sliding from right to left in the last row of the video
  6166. frame. The file @file{LONG_LINE} is assumed to contain a single line
  6167. with no newlines.
  6168. @example
  6169. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  6170. @end example
  6171. @item
  6172. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  6173. @example
  6174. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  6175. @end example
  6176. @item
  6177. Draw a single green letter "g", at the center of the input video.
  6178. The glyph baseline is placed at half screen height.
  6179. @example
  6180. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  6181. @end example
  6182. @item
  6183. Show text for 1 second every 3 seconds:
  6184. @example
  6185. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  6186. @end example
  6187. @item
  6188. Use fontconfig to set the font. Note that the colons need to be escaped.
  6189. @example
  6190. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  6191. @end example
  6192. @item
  6193. Print the date of a real-time encoding (see strftime(3)):
  6194. @example
  6195. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  6196. @end example
  6197. @item
  6198. Show text fading in and out (appearing/disappearing):
  6199. @example
  6200. #!/bin/sh
  6201. DS=1.0 # display start
  6202. DE=10.0 # display end
  6203. FID=1.5 # fade in duration
  6204. FOD=5 # fade out duration
  6205. 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 @}"
  6206. @end example
  6207. @item
  6208. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  6209. and the @option{fontsize} value are included in the @option{y} offset.
  6210. @example
  6211. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  6212. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  6213. @end example
  6214. @end itemize
  6215. For more information about libfreetype, check:
  6216. @url{http://www.freetype.org/}.
  6217. For more information about fontconfig, check:
  6218. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  6219. For more information about libfribidi, check:
  6220. @url{http://fribidi.org/}.
  6221. @section edgedetect
  6222. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  6223. The filter accepts the following options:
  6224. @table @option
  6225. @item low
  6226. @item high
  6227. Set low and high threshold values used by the Canny thresholding
  6228. algorithm.
  6229. The high threshold selects the "strong" edge pixels, which are then
  6230. connected through 8-connectivity with the "weak" edge pixels selected
  6231. by the low threshold.
  6232. @var{low} and @var{high} threshold values must be chosen in the range
  6233. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6234. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6235. is @code{50/255}.
  6236. @item mode
  6237. Define the drawing mode.
  6238. @table @samp
  6239. @item wires
  6240. Draw white/gray wires on black background.
  6241. @item colormix
  6242. Mix the colors to create a paint/cartoon effect.
  6243. @end table
  6244. Default value is @var{wires}.
  6245. @end table
  6246. @subsection Examples
  6247. @itemize
  6248. @item
  6249. Standard edge detection with custom values for the hysteresis thresholding:
  6250. @example
  6251. edgedetect=low=0.1:high=0.4
  6252. @end example
  6253. @item
  6254. Painting effect without thresholding:
  6255. @example
  6256. edgedetect=mode=colormix:high=0
  6257. @end example
  6258. @end itemize
  6259. @section eq
  6260. Set brightness, contrast, saturation and approximate gamma adjustment.
  6261. The filter accepts the following options:
  6262. @table @option
  6263. @item contrast
  6264. Set the contrast expression. The value must be a float value in range
  6265. @code{-2.0} to @code{2.0}. The default value is "1".
  6266. @item brightness
  6267. Set the brightness expression. The value must be a float value in
  6268. range @code{-1.0} to @code{1.0}. The default value is "0".
  6269. @item saturation
  6270. Set the saturation expression. The value must be a float in
  6271. range @code{0.0} to @code{3.0}. The default value is "1".
  6272. @item gamma
  6273. Set the gamma expression. The value must be a float in range
  6274. @code{0.1} to @code{10.0}. The default value is "1".
  6275. @item gamma_r
  6276. Set the gamma expression for red. The value must be a float in
  6277. range @code{0.1} to @code{10.0}. The default value is "1".
  6278. @item gamma_g
  6279. Set the gamma expression for green. The value must be a float in range
  6280. @code{0.1} to @code{10.0}. The default value is "1".
  6281. @item gamma_b
  6282. Set the gamma expression for blue. The value must be a float in range
  6283. @code{0.1} to @code{10.0}. The default value is "1".
  6284. @item gamma_weight
  6285. Set the gamma weight expression. It can be used to reduce the effect
  6286. of a high gamma value on bright image areas, e.g. keep them from
  6287. getting overamplified and just plain white. The value must be a float
  6288. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  6289. gamma correction all the way down while @code{1.0} leaves it at its
  6290. full strength. Default is "1".
  6291. @item eval
  6292. Set when the expressions for brightness, contrast, saturation and
  6293. gamma expressions are evaluated.
  6294. It accepts the following values:
  6295. @table @samp
  6296. @item init
  6297. only evaluate expressions once during the filter initialization or
  6298. when a command is processed
  6299. @item frame
  6300. evaluate expressions for each incoming frame
  6301. @end table
  6302. Default value is @samp{init}.
  6303. @end table
  6304. The expressions accept the following parameters:
  6305. @table @option
  6306. @item n
  6307. frame count of the input frame starting from 0
  6308. @item pos
  6309. byte position of the corresponding packet in the input file, NAN if
  6310. unspecified
  6311. @item r
  6312. frame rate of the input video, NAN if the input frame rate is unknown
  6313. @item t
  6314. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6315. @end table
  6316. @subsection Commands
  6317. The filter supports the following commands:
  6318. @table @option
  6319. @item contrast
  6320. Set the contrast expression.
  6321. @item brightness
  6322. Set the brightness expression.
  6323. @item saturation
  6324. Set the saturation expression.
  6325. @item gamma
  6326. Set the gamma expression.
  6327. @item gamma_r
  6328. Set the gamma_r expression.
  6329. @item gamma_g
  6330. Set gamma_g expression.
  6331. @item gamma_b
  6332. Set gamma_b expression.
  6333. @item gamma_weight
  6334. Set gamma_weight expression.
  6335. The command accepts the same syntax of the corresponding option.
  6336. If the specified expression is not valid, it is kept at its current
  6337. value.
  6338. @end table
  6339. @section erosion
  6340. Apply erosion effect to the video.
  6341. This filter replaces the pixel by the local(3x3) minimum.
  6342. It accepts the following options:
  6343. @table @option
  6344. @item threshold0
  6345. @item threshold1
  6346. @item threshold2
  6347. @item threshold3
  6348. Limit the maximum change for each plane, default is 65535.
  6349. If 0, plane will remain unchanged.
  6350. @item coordinates
  6351. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6352. pixels are used.
  6353. Flags to local 3x3 coordinates maps like this:
  6354. 1 2 3
  6355. 4 5
  6356. 6 7 8
  6357. @end table
  6358. @section extractplanes
  6359. Extract color channel components from input video stream into
  6360. separate grayscale video streams.
  6361. The filter accepts the following option:
  6362. @table @option
  6363. @item planes
  6364. Set plane(s) to extract.
  6365. Available values for planes are:
  6366. @table @samp
  6367. @item y
  6368. @item u
  6369. @item v
  6370. @item a
  6371. @item r
  6372. @item g
  6373. @item b
  6374. @end table
  6375. Choosing planes not available in the input will result in an error.
  6376. That means you cannot select @code{r}, @code{g}, @code{b} planes
  6377. with @code{y}, @code{u}, @code{v} planes at same time.
  6378. @end table
  6379. @subsection Examples
  6380. @itemize
  6381. @item
  6382. Extract luma, u and v color channel component from input video frame
  6383. into 3 grayscale outputs:
  6384. @example
  6385. 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
  6386. @end example
  6387. @end itemize
  6388. @section elbg
  6389. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  6390. For each input image, the filter will compute the optimal mapping from
  6391. the input to the output given the codebook length, that is the number
  6392. of distinct output colors.
  6393. This filter accepts the following options.
  6394. @table @option
  6395. @item codebook_length, l
  6396. Set codebook length. The value must be a positive integer, and
  6397. represents the number of distinct output colors. Default value is 256.
  6398. @item nb_steps, n
  6399. Set the maximum number of iterations to apply for computing the optimal
  6400. mapping. The higher the value the better the result and the higher the
  6401. computation time. Default value is 1.
  6402. @item seed, s
  6403. Set a random seed, must be an integer included between 0 and
  6404. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  6405. will try to use a good random seed on a best effort basis.
  6406. @item pal8
  6407. Set pal8 output pixel format. This option does not work with codebook
  6408. length greater than 256.
  6409. @end table
  6410. @section entropy
  6411. Measure graylevel entropy in histogram of color channels of video frames.
  6412. It accepts the following parameters:
  6413. @table @option
  6414. @item mode
  6415. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  6416. @var{diff} mode measures entropy of histogram delta values, absolute differences
  6417. between neighbour histogram values.
  6418. @end table
  6419. @section fade
  6420. Apply a fade-in/out effect to the input video.
  6421. It accepts the following parameters:
  6422. @table @option
  6423. @item type, t
  6424. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  6425. effect.
  6426. Default is @code{in}.
  6427. @item start_frame, s
  6428. Specify the number of the frame to start applying the fade
  6429. effect at. Default is 0.
  6430. @item nb_frames, n
  6431. The number of frames that the fade effect lasts. At the end of the
  6432. fade-in effect, the output video will have the same intensity as the input video.
  6433. At the end of the fade-out transition, the output video will be filled with the
  6434. selected @option{color}.
  6435. Default is 25.
  6436. @item alpha
  6437. If set to 1, fade only alpha channel, if one exists on the input.
  6438. Default value is 0.
  6439. @item start_time, st
  6440. Specify the timestamp (in seconds) of the frame to start to apply the fade
  6441. effect. If both start_frame and start_time are specified, the fade will start at
  6442. whichever comes last. Default is 0.
  6443. @item duration, d
  6444. The number of seconds for which the fade effect has to last. At the end of the
  6445. fade-in effect the output video will have the same intensity as the input video,
  6446. at the end of the fade-out transition the output video will be filled with the
  6447. selected @option{color}.
  6448. If both duration and nb_frames are specified, duration is used. Default is 0
  6449. (nb_frames is used by default).
  6450. @item color, c
  6451. Specify the color of the fade. Default is "black".
  6452. @end table
  6453. @subsection Examples
  6454. @itemize
  6455. @item
  6456. Fade in the first 30 frames of video:
  6457. @example
  6458. fade=in:0:30
  6459. @end example
  6460. The command above is equivalent to:
  6461. @example
  6462. fade=t=in:s=0:n=30
  6463. @end example
  6464. @item
  6465. Fade out the last 45 frames of a 200-frame video:
  6466. @example
  6467. fade=out:155:45
  6468. fade=type=out:start_frame=155:nb_frames=45
  6469. @end example
  6470. @item
  6471. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  6472. @example
  6473. fade=in:0:25, fade=out:975:25
  6474. @end example
  6475. @item
  6476. Make the first 5 frames yellow, then fade in from frame 5-24:
  6477. @example
  6478. fade=in:5:20:color=yellow
  6479. @end example
  6480. @item
  6481. Fade in alpha over first 25 frames of video:
  6482. @example
  6483. fade=in:0:25:alpha=1
  6484. @end example
  6485. @item
  6486. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  6487. @example
  6488. fade=t=in:st=5.5:d=0.5
  6489. @end example
  6490. @end itemize
  6491. @section fftfilt
  6492. Apply arbitrary expressions to samples in frequency domain
  6493. @table @option
  6494. @item dc_Y
  6495. Adjust the dc value (gain) of the luma plane of the image. The filter
  6496. accepts an integer value in range @code{0} to @code{1000}. The default
  6497. value is set to @code{0}.
  6498. @item dc_U
  6499. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  6500. filter accepts an integer value in range @code{0} to @code{1000}. The
  6501. default value is set to @code{0}.
  6502. @item dc_V
  6503. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  6504. filter accepts an integer value in range @code{0} to @code{1000}. The
  6505. default value is set to @code{0}.
  6506. @item weight_Y
  6507. Set the frequency domain weight expression for the luma plane.
  6508. @item weight_U
  6509. Set the frequency domain weight expression for the 1st chroma plane.
  6510. @item weight_V
  6511. Set the frequency domain weight expression for the 2nd chroma plane.
  6512. @item eval
  6513. Set when the expressions are evaluated.
  6514. It accepts the following values:
  6515. @table @samp
  6516. @item init
  6517. Only evaluate expressions once during the filter initialization.
  6518. @item frame
  6519. Evaluate expressions for each incoming frame.
  6520. @end table
  6521. Default value is @samp{init}.
  6522. The filter accepts the following variables:
  6523. @item X
  6524. @item Y
  6525. The coordinates of the current sample.
  6526. @item W
  6527. @item H
  6528. The width and height of the image.
  6529. @item N
  6530. The number of input frame, starting from 0.
  6531. @end table
  6532. @subsection Examples
  6533. @itemize
  6534. @item
  6535. High-pass:
  6536. @example
  6537. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  6538. @end example
  6539. @item
  6540. Low-pass:
  6541. @example
  6542. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  6543. @end example
  6544. @item
  6545. Sharpen:
  6546. @example
  6547. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  6548. @end example
  6549. @item
  6550. Blur:
  6551. @example
  6552. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  6553. @end example
  6554. @end itemize
  6555. @section field
  6556. Extract a single field from an interlaced image using stride
  6557. arithmetic to avoid wasting CPU time. The output frames are marked as
  6558. non-interlaced.
  6559. The filter accepts the following options:
  6560. @table @option
  6561. @item type
  6562. Specify whether to extract the top (if the value is @code{0} or
  6563. @code{top}) or the bottom field (if the value is @code{1} or
  6564. @code{bottom}).
  6565. @end table
  6566. @section fieldhint
  6567. Create new frames by copying the top and bottom fields from surrounding frames
  6568. supplied as numbers by the hint file.
  6569. @table @option
  6570. @item hint
  6571. Set file containing hints: absolute/relative frame numbers.
  6572. There must be one line for each frame in a clip. Each line must contain two
  6573. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  6574. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  6575. is current frame number for @code{absolute} mode or out of [-1, 1] range
  6576. for @code{relative} mode. First number tells from which frame to pick up top
  6577. field and second number tells from which frame to pick up bottom field.
  6578. If optionally followed by @code{+} output frame will be marked as interlaced,
  6579. else if followed by @code{-} output frame will be marked as progressive, else
  6580. it will be marked same as input frame.
  6581. If line starts with @code{#} or @code{;} that line is skipped.
  6582. @item mode
  6583. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  6584. @end table
  6585. Example of first several lines of @code{hint} file for @code{relative} mode:
  6586. @example
  6587. 0,0 - # first frame
  6588. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  6589. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  6590. 1,0 -
  6591. 0,0 -
  6592. 0,0 -
  6593. 1,0 -
  6594. 1,0 -
  6595. 1,0 -
  6596. 0,0 -
  6597. 0,0 -
  6598. 1,0 -
  6599. 1,0 -
  6600. 1,0 -
  6601. 0,0 -
  6602. @end example
  6603. @section fieldmatch
  6604. Field matching filter for inverse telecine. It is meant to reconstruct the
  6605. progressive frames from a telecined stream. The filter does not drop duplicated
  6606. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  6607. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  6608. The separation of the field matching and the decimation is notably motivated by
  6609. the possibility of inserting a de-interlacing filter fallback between the two.
  6610. If the source has mixed telecined and real interlaced content,
  6611. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  6612. But these remaining combed frames will be marked as interlaced, and thus can be
  6613. de-interlaced by a later filter such as @ref{yadif} before decimation.
  6614. In addition to the various configuration options, @code{fieldmatch} can take an
  6615. optional second stream, activated through the @option{ppsrc} option. If
  6616. enabled, the frames reconstruction will be based on the fields and frames from
  6617. this second stream. This allows the first input to be pre-processed in order to
  6618. help the various algorithms of the filter, while keeping the output lossless
  6619. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  6620. or brightness/contrast adjustments can help.
  6621. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  6622. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  6623. which @code{fieldmatch} is based on. While the semantic and usage are very
  6624. close, some behaviour and options names can differ.
  6625. The @ref{decimate} filter currently only works for constant frame rate input.
  6626. If your input has mixed telecined (30fps) and progressive content with a lower
  6627. framerate like 24fps use the following filterchain to produce the necessary cfr
  6628. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  6629. The filter accepts the following options:
  6630. @table @option
  6631. @item order
  6632. Specify the assumed field order of the input stream. Available values are:
  6633. @table @samp
  6634. @item auto
  6635. Auto detect parity (use FFmpeg's internal parity value).
  6636. @item bff
  6637. Assume bottom field first.
  6638. @item tff
  6639. Assume top field first.
  6640. @end table
  6641. Note that it is sometimes recommended not to trust the parity announced by the
  6642. stream.
  6643. Default value is @var{auto}.
  6644. @item mode
  6645. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  6646. sense that it won't risk creating jerkiness due to duplicate frames when
  6647. possible, but if there are bad edits or blended fields it will end up
  6648. outputting combed frames when a good match might actually exist. On the other
  6649. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  6650. but will almost always find a good frame if there is one. The other values are
  6651. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  6652. jerkiness and creating duplicate frames versus finding good matches in sections
  6653. with bad edits, orphaned fields, blended fields, etc.
  6654. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  6655. Available values are:
  6656. @table @samp
  6657. @item pc
  6658. 2-way matching (p/c)
  6659. @item pc_n
  6660. 2-way matching, and trying 3rd match if still combed (p/c + n)
  6661. @item pc_u
  6662. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  6663. @item pc_n_ub
  6664. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  6665. still combed (p/c + n + u/b)
  6666. @item pcn
  6667. 3-way matching (p/c/n)
  6668. @item pcn_ub
  6669. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  6670. detected as combed (p/c/n + u/b)
  6671. @end table
  6672. The parenthesis at the end indicate the matches that would be used for that
  6673. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  6674. @var{top}).
  6675. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  6676. the slowest.
  6677. Default value is @var{pc_n}.
  6678. @item ppsrc
  6679. Mark the main input stream as a pre-processed input, and enable the secondary
  6680. input stream as the clean source to pick the fields from. See the filter
  6681. introduction for more details. It is similar to the @option{clip2} feature from
  6682. VFM/TFM.
  6683. Default value is @code{0} (disabled).
  6684. @item field
  6685. Set the field to match from. It is recommended to set this to the same value as
  6686. @option{order} unless you experience matching failures with that setting. In
  6687. certain circumstances changing the field that is used to match from can have a
  6688. large impact on matching performance. Available values are:
  6689. @table @samp
  6690. @item auto
  6691. Automatic (same value as @option{order}).
  6692. @item bottom
  6693. Match from the bottom field.
  6694. @item top
  6695. Match from the top field.
  6696. @end table
  6697. Default value is @var{auto}.
  6698. @item mchroma
  6699. Set whether or not chroma is included during the match comparisons. In most
  6700. cases it is recommended to leave this enabled. You should set this to @code{0}
  6701. only if your clip has bad chroma problems such as heavy rainbowing or other
  6702. artifacts. Setting this to @code{0} could also be used to speed things up at
  6703. the cost of some accuracy.
  6704. Default value is @code{1}.
  6705. @item y0
  6706. @item y1
  6707. These define an exclusion band which excludes the lines between @option{y0} and
  6708. @option{y1} from being included in the field matching decision. An exclusion
  6709. band can be used to ignore subtitles, a logo, or other things that may
  6710. interfere with the matching. @option{y0} sets the starting scan line and
  6711. @option{y1} sets the ending line; all lines in between @option{y0} and
  6712. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6713. @option{y0} and @option{y1} to the same value will disable the feature.
  6714. @option{y0} and @option{y1} defaults to @code{0}.
  6715. @item scthresh
  6716. Set the scene change detection threshold as a percentage of maximum change on
  6717. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6718. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6719. @option{scthresh} is @code{[0.0, 100.0]}.
  6720. Default value is @code{12.0}.
  6721. @item combmatch
  6722. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6723. account the combed scores of matches when deciding what match to use as the
  6724. final match. Available values are:
  6725. @table @samp
  6726. @item none
  6727. No final matching based on combed scores.
  6728. @item sc
  6729. Combed scores are only used when a scene change is detected.
  6730. @item full
  6731. Use combed scores all the time.
  6732. @end table
  6733. Default is @var{sc}.
  6734. @item combdbg
  6735. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  6736. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  6737. Available values are:
  6738. @table @samp
  6739. @item none
  6740. No forced calculation.
  6741. @item pcn
  6742. Force p/c/n calculations.
  6743. @item pcnub
  6744. Force p/c/n/u/b calculations.
  6745. @end table
  6746. Default value is @var{none}.
  6747. @item cthresh
  6748. This is the area combing threshold used for combed frame detection. This
  6749. essentially controls how "strong" or "visible" combing must be to be detected.
  6750. Larger values mean combing must be more visible and smaller values mean combing
  6751. can be less visible or strong and still be detected. Valid settings are from
  6752. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6753. be detected as combed). This is basically a pixel difference value. A good
  6754. range is @code{[8, 12]}.
  6755. Default value is @code{9}.
  6756. @item chroma
  6757. Sets whether or not chroma is considered in the combed frame decision. Only
  6758. disable this if your source has chroma problems (rainbowing, etc.) that are
  6759. causing problems for the combed frame detection with chroma enabled. Actually,
  6760. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6761. where there is chroma only combing in the source.
  6762. Default value is @code{0}.
  6763. @item blockx
  6764. @item blocky
  6765. Respectively set the x-axis and y-axis size of the window used during combed
  6766. frame detection. This has to do with the size of the area in which
  6767. @option{combpel} pixels are required to be detected as combed for a frame to be
  6768. declared combed. See the @option{combpel} parameter description for more info.
  6769. Possible values are any number that is a power of 2 starting at 4 and going up
  6770. to 512.
  6771. Default value is @code{16}.
  6772. @item combpel
  6773. The number of combed pixels inside any of the @option{blocky} by
  6774. @option{blockx} size blocks on the frame for the frame to be detected as
  6775. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6776. setting controls "how much" combing there must be in any localized area (a
  6777. window defined by the @option{blockx} and @option{blocky} settings) on the
  6778. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6779. which point no frames will ever be detected as combed). This setting is known
  6780. as @option{MI} in TFM/VFM vocabulary.
  6781. Default value is @code{80}.
  6782. @end table
  6783. @anchor{p/c/n/u/b meaning}
  6784. @subsection p/c/n/u/b meaning
  6785. @subsubsection p/c/n
  6786. We assume the following telecined stream:
  6787. @example
  6788. Top fields: 1 2 2 3 4
  6789. Bottom fields: 1 2 3 4 4
  6790. @end example
  6791. The numbers correspond to the progressive frame the fields relate to. Here, the
  6792. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6793. When @code{fieldmatch} is configured to run a matching from bottom
  6794. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6795. @example
  6796. Input stream:
  6797. T 1 2 2 3 4
  6798. B 1 2 3 4 4 <-- matching reference
  6799. Matches: c c n n c
  6800. Output stream:
  6801. T 1 2 3 4 4
  6802. B 1 2 3 4 4
  6803. @end example
  6804. As a result of the field matching, we can see that some frames get duplicated.
  6805. To perform a complete inverse telecine, you need to rely on a decimation filter
  6806. after this operation. See for instance the @ref{decimate} filter.
  6807. The same operation now matching from top fields (@option{field}=@var{top})
  6808. looks like this:
  6809. @example
  6810. Input stream:
  6811. T 1 2 2 3 4 <-- matching reference
  6812. B 1 2 3 4 4
  6813. Matches: c c p p c
  6814. Output stream:
  6815. T 1 2 2 3 4
  6816. B 1 2 2 3 4
  6817. @end example
  6818. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6819. basically, they refer to the frame and field of the opposite parity:
  6820. @itemize
  6821. @item @var{p} matches the field of the opposite parity in the previous frame
  6822. @item @var{c} matches the field of the opposite parity in the current frame
  6823. @item @var{n} matches the field of the opposite parity in the next frame
  6824. @end itemize
  6825. @subsubsection u/b
  6826. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6827. from the opposite parity flag. In the following examples, we assume that we are
  6828. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6829. 'x' is placed above and below each matched fields.
  6830. With bottom matching (@option{field}=@var{bottom}):
  6831. @example
  6832. Match: c p n b u
  6833. x x x x x
  6834. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6835. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6836. x x x x x
  6837. Output frames:
  6838. 2 1 2 2 2
  6839. 2 2 2 1 3
  6840. @end example
  6841. With top matching (@option{field}=@var{top}):
  6842. @example
  6843. Match: c p n b u
  6844. x x x x x
  6845. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6846. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6847. x x x x x
  6848. Output frames:
  6849. 2 2 2 1 2
  6850. 2 1 3 2 2
  6851. @end example
  6852. @subsection Examples
  6853. Simple IVTC of a top field first telecined stream:
  6854. @example
  6855. fieldmatch=order=tff:combmatch=none, decimate
  6856. @end example
  6857. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6858. @example
  6859. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6860. @end example
  6861. @section fieldorder
  6862. Transform the field order of the input video.
  6863. It accepts the following parameters:
  6864. @table @option
  6865. @item order
  6866. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6867. for bottom field first.
  6868. @end table
  6869. The default value is @samp{tff}.
  6870. The transformation is done by shifting the picture content up or down
  6871. by one line, and filling the remaining line with appropriate picture content.
  6872. This method is consistent with most broadcast field order converters.
  6873. If the input video is not flagged as being interlaced, or it is already
  6874. flagged as being of the required output field order, then this filter does
  6875. not alter the incoming video.
  6876. It is very useful when converting to or from PAL DV material,
  6877. which is bottom field first.
  6878. For example:
  6879. @example
  6880. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6881. @end example
  6882. @section fifo, afifo
  6883. Buffer input images and send them when they are requested.
  6884. It is mainly useful when auto-inserted by the libavfilter
  6885. framework.
  6886. It does not take parameters.
  6887. @section fillborders
  6888. Fill borders of the input video, without changing video stream dimensions.
  6889. Sometimes video can have garbage at the four edges and you may not want to
  6890. crop video input to keep size multiple of some number.
  6891. This filter accepts the following options:
  6892. @table @option
  6893. @item left
  6894. Number of pixels to fill from left border.
  6895. @item right
  6896. Number of pixels to fill from right border.
  6897. @item top
  6898. Number of pixels to fill from top border.
  6899. @item bottom
  6900. Number of pixels to fill from bottom border.
  6901. @item mode
  6902. Set fill mode.
  6903. It accepts the following values:
  6904. @table @samp
  6905. @item smear
  6906. fill pixels using outermost pixels
  6907. @item mirror
  6908. fill pixels using mirroring
  6909. @item fixed
  6910. fill pixels with constant value
  6911. @end table
  6912. Default is @var{smear}.
  6913. @item color
  6914. Set color for pixels in fixed mode. Default is @var{black}.
  6915. @end table
  6916. @section find_rect
  6917. Find a rectangular object
  6918. It accepts the following options:
  6919. @table @option
  6920. @item object
  6921. Filepath of the object image, needs to be in gray8.
  6922. @item threshold
  6923. Detection threshold, default is 0.5.
  6924. @item mipmaps
  6925. Number of mipmaps, default is 3.
  6926. @item xmin, ymin, xmax, ymax
  6927. Specifies the rectangle in which to search.
  6928. @end table
  6929. @subsection Examples
  6930. @itemize
  6931. @item
  6932. Generate a representative palette of a given video using @command{ffmpeg}:
  6933. @example
  6934. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6935. @end example
  6936. @end itemize
  6937. @section cover_rect
  6938. Cover a rectangular object
  6939. It accepts the following options:
  6940. @table @option
  6941. @item cover
  6942. Filepath of the optional cover image, needs to be in yuv420.
  6943. @item mode
  6944. Set covering mode.
  6945. It accepts the following values:
  6946. @table @samp
  6947. @item cover
  6948. cover it by the supplied image
  6949. @item blur
  6950. cover it by interpolating the surrounding pixels
  6951. @end table
  6952. Default value is @var{blur}.
  6953. @end table
  6954. @subsection Examples
  6955. @itemize
  6956. @item
  6957. Generate a representative palette of a given video using @command{ffmpeg}:
  6958. @example
  6959. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6960. @end example
  6961. @end itemize
  6962. @section floodfill
  6963. Flood area with values of same pixel components with another values.
  6964. It accepts the following options:
  6965. @table @option
  6966. @item x
  6967. Set pixel x coordinate.
  6968. @item y
  6969. Set pixel y coordinate.
  6970. @item s0
  6971. Set source #0 component value.
  6972. @item s1
  6973. Set source #1 component value.
  6974. @item s2
  6975. Set source #2 component value.
  6976. @item s3
  6977. Set source #3 component value.
  6978. @item d0
  6979. Set destination #0 component value.
  6980. @item d1
  6981. Set destination #1 component value.
  6982. @item d2
  6983. Set destination #2 component value.
  6984. @item d3
  6985. Set destination #3 component value.
  6986. @end table
  6987. @anchor{format}
  6988. @section format
  6989. Convert the input video to one of the specified pixel formats.
  6990. Libavfilter will try to pick one that is suitable as input to
  6991. the next filter.
  6992. It accepts the following parameters:
  6993. @table @option
  6994. @item pix_fmts
  6995. A '|'-separated list of pixel format names, such as
  6996. "pix_fmts=yuv420p|monow|rgb24".
  6997. @end table
  6998. @subsection Examples
  6999. @itemize
  7000. @item
  7001. Convert the input video to the @var{yuv420p} format
  7002. @example
  7003. format=pix_fmts=yuv420p
  7004. @end example
  7005. Convert the input video to any of the formats in the list
  7006. @example
  7007. format=pix_fmts=yuv420p|yuv444p|yuv410p
  7008. @end example
  7009. @end itemize
  7010. @anchor{fps}
  7011. @section fps
  7012. Convert the video to specified constant frame rate by duplicating or dropping
  7013. frames as necessary.
  7014. It accepts the following parameters:
  7015. @table @option
  7016. @item fps
  7017. The desired output frame rate. The default is @code{25}.
  7018. @item start_time
  7019. Assume the first PTS should be the given value, in seconds. This allows for
  7020. padding/trimming at the start of stream. By default, no assumption is made
  7021. about the first frame's expected PTS, so no padding or trimming is done.
  7022. For example, this could be set to 0 to pad the beginning with duplicates of
  7023. the first frame if a video stream starts after the audio stream or to trim any
  7024. frames with a negative PTS.
  7025. @item round
  7026. Timestamp (PTS) rounding method.
  7027. Possible values are:
  7028. @table @option
  7029. @item zero
  7030. round towards 0
  7031. @item inf
  7032. round away from 0
  7033. @item down
  7034. round towards -infinity
  7035. @item up
  7036. round towards +infinity
  7037. @item near
  7038. round to nearest
  7039. @end table
  7040. The default is @code{near}.
  7041. @item eof_action
  7042. Action performed when reading the last frame.
  7043. Possible values are:
  7044. @table @option
  7045. @item round
  7046. Use same timestamp rounding method as used for other frames.
  7047. @item pass
  7048. Pass through last frame if input duration has not been reached yet.
  7049. @end table
  7050. The default is @code{round}.
  7051. @end table
  7052. Alternatively, the options can be specified as a flat string:
  7053. @var{fps}[:@var{start_time}[:@var{round}]].
  7054. See also the @ref{setpts} filter.
  7055. @subsection Examples
  7056. @itemize
  7057. @item
  7058. A typical usage in order to set the fps to 25:
  7059. @example
  7060. fps=fps=25
  7061. @end example
  7062. @item
  7063. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  7064. @example
  7065. fps=fps=film:round=near
  7066. @end example
  7067. @end itemize
  7068. @section framepack
  7069. Pack two different video streams into a stereoscopic video, setting proper
  7070. metadata on supported codecs. The two views should have the same size and
  7071. framerate and processing will stop when the shorter video ends. Please note
  7072. that you may conveniently adjust view properties with the @ref{scale} and
  7073. @ref{fps} filters.
  7074. It accepts the following parameters:
  7075. @table @option
  7076. @item format
  7077. The desired packing format. Supported values are:
  7078. @table @option
  7079. @item sbs
  7080. The views are next to each other (default).
  7081. @item tab
  7082. The views are on top of each other.
  7083. @item lines
  7084. The views are packed by line.
  7085. @item columns
  7086. The views are packed by column.
  7087. @item frameseq
  7088. The views are temporally interleaved.
  7089. @end table
  7090. @end table
  7091. Some examples:
  7092. @example
  7093. # Convert left and right views into a frame-sequential video
  7094. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  7095. # Convert views into a side-by-side video with the same output resolution as the input
  7096. 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
  7097. @end example
  7098. @section framerate
  7099. Change the frame rate by interpolating new video output frames from the source
  7100. frames.
  7101. This filter is not designed to function correctly with interlaced media. If
  7102. you wish to change the frame rate of interlaced media then you are required
  7103. to deinterlace before this filter and re-interlace after this filter.
  7104. A description of the accepted options follows.
  7105. @table @option
  7106. @item fps
  7107. Specify the output frames per second. This option can also be specified
  7108. as a value alone. The default is @code{50}.
  7109. @item interp_start
  7110. Specify the start of a range where the output frame will be created as a
  7111. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7112. the default is @code{15}.
  7113. @item interp_end
  7114. Specify the end of a range where the output frame will be created as a
  7115. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7116. the default is @code{240}.
  7117. @item scene
  7118. Specify the level at which a scene change is detected as a value between
  7119. 0 and 100 to indicate a new scene; a low value reflects a low
  7120. probability for the current frame to introduce a new scene, while a higher
  7121. value means the current frame is more likely to be one.
  7122. The default is @code{8.2}.
  7123. @item flags
  7124. Specify flags influencing the filter process.
  7125. Available value for @var{flags} is:
  7126. @table @option
  7127. @item scene_change_detect, scd
  7128. Enable scene change detection using the value of the option @var{scene}.
  7129. This flag is enabled by default.
  7130. @end table
  7131. @end table
  7132. @section framestep
  7133. Select one frame every N-th frame.
  7134. This filter accepts the following option:
  7135. @table @option
  7136. @item step
  7137. Select frame after every @code{step} frames.
  7138. Allowed values are positive integers higher than 0. Default value is @code{1}.
  7139. @end table
  7140. @anchor{frei0r}
  7141. @section frei0r
  7142. Apply a frei0r effect to the input video.
  7143. To enable the compilation of this filter, you need to install the frei0r
  7144. header and configure FFmpeg with @code{--enable-frei0r}.
  7145. It accepts the following parameters:
  7146. @table @option
  7147. @item filter_name
  7148. The name of the frei0r effect to load. If the environment variable
  7149. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  7150. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  7151. Otherwise, the standard frei0r paths are searched, in this order:
  7152. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  7153. @file{/usr/lib/frei0r-1/}.
  7154. @item filter_params
  7155. A '|'-separated list of parameters to pass to the frei0r effect.
  7156. @end table
  7157. A frei0r effect parameter can be a boolean (its value is either
  7158. "y" or "n"), a double, a color (specified as
  7159. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  7160. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  7161. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  7162. a position (specified as @var{X}/@var{Y}, where
  7163. @var{X} and @var{Y} are floating point numbers) and/or a string.
  7164. The number and types of parameters depend on the loaded effect. If an
  7165. effect parameter is not specified, the default value is set.
  7166. @subsection Examples
  7167. @itemize
  7168. @item
  7169. Apply the distort0r effect, setting the first two double parameters:
  7170. @example
  7171. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  7172. @end example
  7173. @item
  7174. Apply the colordistance effect, taking a color as the first parameter:
  7175. @example
  7176. frei0r=colordistance:0.2/0.3/0.4
  7177. frei0r=colordistance:violet
  7178. frei0r=colordistance:0x112233
  7179. @end example
  7180. @item
  7181. Apply the perspective effect, specifying the top left and top right image
  7182. positions:
  7183. @example
  7184. frei0r=perspective:0.2/0.2|0.8/0.2
  7185. @end example
  7186. @end itemize
  7187. For more information, see
  7188. @url{http://frei0r.dyne.org}
  7189. @section fspp
  7190. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  7191. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  7192. processing filter, one of them is performed once per block, not per pixel.
  7193. This allows for much higher speed.
  7194. The filter accepts the following options:
  7195. @table @option
  7196. @item quality
  7197. Set quality. This option defines the number of levels for averaging. It accepts
  7198. an integer in the range 4-5. Default value is @code{4}.
  7199. @item qp
  7200. Force a constant quantization parameter. It accepts an integer in range 0-63.
  7201. If not set, the filter will use the QP from the video stream (if available).
  7202. @item strength
  7203. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  7204. more details but also more artifacts, while higher values make the image smoother
  7205. but also blurrier. Default value is @code{0} − PSNR optimal.
  7206. @item use_bframe_qp
  7207. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  7208. option may cause flicker since the B-Frames have often larger QP. Default is
  7209. @code{0} (not enabled).
  7210. @end table
  7211. @section gblur
  7212. Apply Gaussian blur filter.
  7213. The filter accepts the following options:
  7214. @table @option
  7215. @item sigma
  7216. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  7217. @item steps
  7218. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  7219. @item planes
  7220. Set which planes to filter. By default all planes are filtered.
  7221. @item sigmaV
  7222. Set vertical sigma, if negative it will be same as @code{sigma}.
  7223. Default is @code{-1}.
  7224. @end table
  7225. @section geq
  7226. The filter accepts the following options:
  7227. @table @option
  7228. @item lum_expr, lum
  7229. Set the luminance expression.
  7230. @item cb_expr, cb
  7231. Set the chrominance blue expression.
  7232. @item cr_expr, cr
  7233. Set the chrominance red expression.
  7234. @item alpha_expr, a
  7235. Set the alpha expression.
  7236. @item red_expr, r
  7237. Set the red expression.
  7238. @item green_expr, g
  7239. Set the green expression.
  7240. @item blue_expr, b
  7241. Set the blue expression.
  7242. @end table
  7243. The colorspace is selected according to the specified options. If one
  7244. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  7245. options is specified, the filter will automatically select a YCbCr
  7246. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  7247. @option{blue_expr} options is specified, it will select an RGB
  7248. colorspace.
  7249. If one of the chrominance expression is not defined, it falls back on the other
  7250. one. If no alpha expression is specified it will evaluate to opaque value.
  7251. If none of chrominance expressions are specified, they will evaluate
  7252. to the luminance expression.
  7253. The expressions can use the following variables and functions:
  7254. @table @option
  7255. @item N
  7256. The sequential number of the filtered frame, starting from @code{0}.
  7257. @item X
  7258. @item Y
  7259. The coordinates of the current sample.
  7260. @item W
  7261. @item H
  7262. The width and height of the image.
  7263. @item SW
  7264. @item SH
  7265. Width and height scale depending on the currently filtered plane. It is the
  7266. ratio between the corresponding luma plane number of pixels and the current
  7267. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  7268. @code{0.5,0.5} for chroma planes.
  7269. @item T
  7270. Time of the current frame, expressed in seconds.
  7271. @item p(x, y)
  7272. Return the value of the pixel at location (@var{x},@var{y}) of the current
  7273. plane.
  7274. @item lum(x, y)
  7275. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  7276. plane.
  7277. @item cb(x, y)
  7278. Return the value of the pixel at location (@var{x},@var{y}) of the
  7279. blue-difference chroma plane. Return 0 if there is no such plane.
  7280. @item cr(x, y)
  7281. Return the value of the pixel at location (@var{x},@var{y}) of the
  7282. red-difference chroma plane. Return 0 if there is no such plane.
  7283. @item r(x, y)
  7284. @item g(x, y)
  7285. @item b(x, y)
  7286. Return the value of the pixel at location (@var{x},@var{y}) of the
  7287. red/green/blue component. Return 0 if there is no such component.
  7288. @item alpha(x, y)
  7289. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  7290. plane. Return 0 if there is no such plane.
  7291. @end table
  7292. For functions, if @var{x} and @var{y} are outside the area, the value will be
  7293. automatically clipped to the closer edge.
  7294. @subsection Examples
  7295. @itemize
  7296. @item
  7297. Flip the image horizontally:
  7298. @example
  7299. geq=p(W-X\,Y)
  7300. @end example
  7301. @item
  7302. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  7303. wavelength of 100 pixels:
  7304. @example
  7305. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  7306. @end example
  7307. @item
  7308. Generate a fancy enigmatic moving light:
  7309. @example
  7310. 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
  7311. @end example
  7312. @item
  7313. Generate a quick emboss effect:
  7314. @example
  7315. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  7316. @end example
  7317. @item
  7318. Modify RGB components depending on pixel position:
  7319. @example
  7320. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  7321. @end example
  7322. @item
  7323. Create a radial gradient that is the same size as the input (also see
  7324. the @ref{vignette} filter):
  7325. @example
  7326. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  7327. @end example
  7328. @end itemize
  7329. @section gradfun
  7330. Fix the banding artifacts that are sometimes introduced into nearly flat
  7331. regions by truncation to 8-bit color depth.
  7332. Interpolate the gradients that should go where the bands are, and
  7333. dither them.
  7334. It is designed for playback only. Do not use it prior to
  7335. lossy compression, because compression tends to lose the dither and
  7336. bring back the bands.
  7337. It accepts the following parameters:
  7338. @table @option
  7339. @item strength
  7340. The maximum amount by which the filter will change any one pixel. This is also
  7341. the threshold for detecting nearly flat regions. Acceptable values range from
  7342. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  7343. valid range.
  7344. @item radius
  7345. The neighborhood to fit the gradient to. A larger radius makes for smoother
  7346. gradients, but also prevents the filter from modifying the pixels near detailed
  7347. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  7348. values will be clipped to the valid range.
  7349. @end table
  7350. Alternatively, the options can be specified as a flat string:
  7351. @var{strength}[:@var{radius}]
  7352. @subsection Examples
  7353. @itemize
  7354. @item
  7355. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  7356. @example
  7357. gradfun=3.5:8
  7358. @end example
  7359. @item
  7360. Specify radius, omitting the strength (which will fall-back to the default
  7361. value):
  7362. @example
  7363. gradfun=radius=8
  7364. @end example
  7365. @end itemize
  7366. @anchor{haldclut}
  7367. @section haldclut
  7368. Apply a Hald CLUT to a video stream.
  7369. First input is the video stream to process, and second one is the Hald CLUT.
  7370. The Hald CLUT input can be a simple picture or a complete video stream.
  7371. The filter accepts the following options:
  7372. @table @option
  7373. @item shortest
  7374. Force termination when the shortest input terminates. Default is @code{0}.
  7375. @item repeatlast
  7376. Continue applying the last CLUT after the end of the stream. A value of
  7377. @code{0} disable the filter after the last frame of the CLUT is reached.
  7378. Default is @code{1}.
  7379. @end table
  7380. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  7381. filters share the same internals).
  7382. More information about the Hald CLUT can be found on Eskil Steenberg's website
  7383. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  7384. @subsection Workflow examples
  7385. @subsubsection Hald CLUT video stream
  7386. Generate an identity Hald CLUT stream altered with various effects:
  7387. @example
  7388. 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
  7389. @end example
  7390. Note: make sure you use a lossless codec.
  7391. Then use it with @code{haldclut} to apply it on some random stream:
  7392. @example
  7393. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  7394. @end example
  7395. The Hald CLUT will be applied to the 10 first seconds (duration of
  7396. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  7397. to the remaining frames of the @code{mandelbrot} stream.
  7398. @subsubsection Hald CLUT with preview
  7399. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  7400. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  7401. biggest possible square starting at the top left of the picture. The remaining
  7402. padding pixels (bottom or right) will be ignored. This area can be used to add
  7403. a preview of the Hald CLUT.
  7404. Typically, the following generated Hald CLUT will be supported by the
  7405. @code{haldclut} filter:
  7406. @example
  7407. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  7408. pad=iw+320 [padded_clut];
  7409. smptebars=s=320x256, split [a][b];
  7410. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  7411. [main][b] overlay=W-320" -frames:v 1 clut.png
  7412. @end example
  7413. It contains the original and a preview of the effect of the CLUT: SMPTE color
  7414. bars are displayed on the right-top, and below the same color bars processed by
  7415. the color changes.
  7416. Then, the effect of this Hald CLUT can be visualized with:
  7417. @example
  7418. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  7419. @end example
  7420. @section hflip
  7421. Flip the input video horizontally.
  7422. For example, to horizontally flip the input video with @command{ffmpeg}:
  7423. @example
  7424. ffmpeg -i in.avi -vf "hflip" out.avi
  7425. @end example
  7426. @section histeq
  7427. This filter applies a global color histogram equalization on a
  7428. per-frame basis.
  7429. It can be used to correct video that has a compressed range of pixel
  7430. intensities. The filter redistributes the pixel intensities to
  7431. equalize their distribution across the intensity range. It may be
  7432. viewed as an "automatically adjusting contrast filter". This filter is
  7433. useful only for correcting degraded or poorly captured source
  7434. video.
  7435. The filter accepts the following options:
  7436. @table @option
  7437. @item strength
  7438. Determine the amount of equalization to be applied. As the strength
  7439. is reduced, the distribution of pixel intensities more-and-more
  7440. approaches that of the input frame. The value must be a float number
  7441. in the range [0,1] and defaults to 0.200.
  7442. @item intensity
  7443. Set the maximum intensity that can generated and scale the output
  7444. values appropriately. The strength should be set as desired and then
  7445. the intensity can be limited if needed to avoid washing-out. The value
  7446. must be a float number in the range [0,1] and defaults to 0.210.
  7447. @item antibanding
  7448. Set the antibanding level. If enabled the filter will randomly vary
  7449. the luminance of output pixels by a small amount to avoid banding of
  7450. the histogram. Possible values are @code{none}, @code{weak} or
  7451. @code{strong}. It defaults to @code{none}.
  7452. @end table
  7453. @section histogram
  7454. Compute and draw a color distribution histogram for the input video.
  7455. The computed histogram is a representation of the color component
  7456. distribution in an image.
  7457. Standard histogram displays the color components distribution in an image.
  7458. Displays color graph for each color component. Shows distribution of
  7459. the Y, U, V, A or R, G, B components, depending on input format, in the
  7460. current frame. Below each graph a color component scale meter is shown.
  7461. The filter accepts the following options:
  7462. @table @option
  7463. @item level_height
  7464. Set height of level. Default value is @code{200}.
  7465. Allowed range is [50, 2048].
  7466. @item scale_height
  7467. Set height of color scale. Default value is @code{12}.
  7468. Allowed range is [0, 40].
  7469. @item display_mode
  7470. Set display mode.
  7471. It accepts the following values:
  7472. @table @samp
  7473. @item stack
  7474. Per color component graphs are placed below each other.
  7475. @item parade
  7476. Per color component graphs are placed side by side.
  7477. @item overlay
  7478. Presents information identical to that in the @code{parade}, except
  7479. that the graphs representing color components are superimposed directly
  7480. over one another.
  7481. @end table
  7482. Default is @code{stack}.
  7483. @item levels_mode
  7484. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  7485. Default is @code{linear}.
  7486. @item components
  7487. Set what color components to display.
  7488. Default is @code{7}.
  7489. @item fgopacity
  7490. Set foreground opacity. Default is @code{0.7}.
  7491. @item bgopacity
  7492. Set background opacity. Default is @code{0.5}.
  7493. @end table
  7494. @subsection Examples
  7495. @itemize
  7496. @item
  7497. Calculate and draw histogram:
  7498. @example
  7499. ffplay -i input -vf histogram
  7500. @end example
  7501. @end itemize
  7502. @anchor{hqdn3d}
  7503. @section hqdn3d
  7504. This is a high precision/quality 3d denoise filter. It aims to reduce
  7505. image noise, producing smooth images and making still images really
  7506. still. It should enhance compressibility.
  7507. It accepts the following optional parameters:
  7508. @table @option
  7509. @item luma_spatial
  7510. A non-negative floating point number which specifies spatial luma strength.
  7511. It defaults to 4.0.
  7512. @item chroma_spatial
  7513. A non-negative floating point number which specifies spatial chroma strength.
  7514. It defaults to 3.0*@var{luma_spatial}/4.0.
  7515. @item luma_tmp
  7516. A floating point number which specifies luma temporal strength. It defaults to
  7517. 6.0*@var{luma_spatial}/4.0.
  7518. @item chroma_tmp
  7519. A floating point number which specifies chroma temporal strength. It defaults to
  7520. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  7521. @end table
  7522. @section hwdownload
  7523. Download hardware frames to system memory.
  7524. The input must be in hardware frames, and the output a non-hardware format.
  7525. Not all formats will be supported on the output - it may be necessary to insert
  7526. an additional @option{format} filter immediately following in the graph to get
  7527. the output in a supported format.
  7528. @section hwmap
  7529. Map hardware frames to system memory or to another device.
  7530. This filter has several different modes of operation; which one is used depends
  7531. on the input and output formats:
  7532. @itemize
  7533. @item
  7534. Hardware frame input, normal frame output
  7535. Map the input frames to system memory and pass them to the output. If the
  7536. original hardware frame is later required (for example, after overlaying
  7537. something else on part of it), the @option{hwmap} filter can be used again
  7538. in the next mode to retrieve it.
  7539. @item
  7540. Normal frame input, hardware frame output
  7541. If the input is actually a software-mapped hardware frame, then unmap it -
  7542. that is, return the original hardware frame.
  7543. Otherwise, a device must be provided. Create new hardware surfaces on that
  7544. device for the output, then map them back to the software format at the input
  7545. and give those frames to the preceding filter. This will then act like the
  7546. @option{hwupload} filter, but may be able to avoid an additional copy when
  7547. the input is already in a compatible format.
  7548. @item
  7549. Hardware frame input and output
  7550. A device must be supplied for the output, either directly or with the
  7551. @option{derive_device} option. The input and output devices must be of
  7552. different types and compatible - the exact meaning of this is
  7553. system-dependent, but typically it means that they must refer to the same
  7554. underlying hardware context (for example, refer to the same graphics card).
  7555. If the input frames were originally created on the output device, then unmap
  7556. to retrieve the original frames.
  7557. Otherwise, map the frames to the output device - create new hardware frames
  7558. on the output corresponding to the frames on the input.
  7559. @end itemize
  7560. The following additional parameters are accepted:
  7561. @table @option
  7562. @item mode
  7563. Set the frame mapping mode. Some combination of:
  7564. @table @var
  7565. @item read
  7566. The mapped frame should be readable.
  7567. @item write
  7568. The mapped frame should be writeable.
  7569. @item overwrite
  7570. The mapping will always overwrite the entire frame.
  7571. This may improve performance in some cases, as the original contents of the
  7572. frame need not be loaded.
  7573. @item direct
  7574. The mapping must not involve any copying.
  7575. Indirect mappings to copies of frames are created in some cases where either
  7576. direct mapping is not possible or it would have unexpected properties.
  7577. Setting this flag ensures that the mapping is direct and will fail if that is
  7578. not possible.
  7579. @end table
  7580. Defaults to @var{read+write} if not specified.
  7581. @item derive_device @var{type}
  7582. Rather than using the device supplied at initialisation, instead derive a new
  7583. device of type @var{type} from the device the input frames exist on.
  7584. @item reverse
  7585. In a hardware to hardware mapping, map in reverse - create frames in the sink
  7586. and map them back to the source. This may be necessary in some cases where
  7587. a mapping in one direction is required but only the opposite direction is
  7588. supported by the devices being used.
  7589. This option is dangerous - it may break the preceding filter in undefined
  7590. ways if there are any additional constraints on that filter's output.
  7591. Do not use it without fully understanding the implications of its use.
  7592. @end table
  7593. @section hwupload
  7594. Upload system memory frames to hardware surfaces.
  7595. The device to upload to must be supplied when the filter is initialised. If
  7596. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  7597. option.
  7598. @anchor{hwupload_cuda}
  7599. @section hwupload_cuda
  7600. Upload system memory frames to a CUDA device.
  7601. It accepts the following optional parameters:
  7602. @table @option
  7603. @item device
  7604. The number of the CUDA device to use
  7605. @end table
  7606. @section hqx
  7607. Apply a high-quality magnification filter designed for pixel art. This filter
  7608. was originally created by Maxim Stepin.
  7609. It accepts the following option:
  7610. @table @option
  7611. @item n
  7612. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  7613. @code{hq3x} and @code{4} for @code{hq4x}.
  7614. Default is @code{3}.
  7615. @end table
  7616. @section hstack
  7617. Stack input videos horizontally.
  7618. All streams must be of same pixel format and of same height.
  7619. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  7620. to create same output.
  7621. The filter accept the following option:
  7622. @table @option
  7623. @item inputs
  7624. Set number of input streams. Default is 2.
  7625. @item shortest
  7626. If set to 1, force the output to terminate when the shortest input
  7627. terminates. Default value is 0.
  7628. @end table
  7629. @section hue
  7630. Modify the hue and/or the saturation of the input.
  7631. It accepts the following parameters:
  7632. @table @option
  7633. @item h
  7634. Specify the hue angle as a number of degrees. It accepts an expression,
  7635. and defaults to "0".
  7636. @item s
  7637. Specify the saturation in the [-10,10] range. It accepts an expression and
  7638. defaults to "1".
  7639. @item H
  7640. Specify the hue angle as a number of radians. It accepts an
  7641. expression, and defaults to "0".
  7642. @item b
  7643. Specify the brightness in the [-10,10] range. It accepts an expression and
  7644. defaults to "0".
  7645. @end table
  7646. @option{h} and @option{H} are mutually exclusive, and can't be
  7647. specified at the same time.
  7648. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  7649. expressions containing the following constants:
  7650. @table @option
  7651. @item n
  7652. frame count of the input frame starting from 0
  7653. @item pts
  7654. presentation timestamp of the input frame expressed in time base units
  7655. @item r
  7656. frame rate of the input video, NAN if the input frame rate is unknown
  7657. @item t
  7658. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7659. @item tb
  7660. time base of the input video
  7661. @end table
  7662. @subsection Examples
  7663. @itemize
  7664. @item
  7665. Set the hue to 90 degrees and the saturation to 1.0:
  7666. @example
  7667. hue=h=90:s=1
  7668. @end example
  7669. @item
  7670. Same command but expressing the hue in radians:
  7671. @example
  7672. hue=H=PI/2:s=1
  7673. @end example
  7674. @item
  7675. Rotate hue and make the saturation swing between 0
  7676. and 2 over a period of 1 second:
  7677. @example
  7678. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  7679. @end example
  7680. @item
  7681. Apply a 3 seconds saturation fade-in effect starting at 0:
  7682. @example
  7683. hue="s=min(t/3\,1)"
  7684. @end example
  7685. The general fade-in expression can be written as:
  7686. @example
  7687. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  7688. @end example
  7689. @item
  7690. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  7691. @example
  7692. hue="s=max(0\, min(1\, (8-t)/3))"
  7693. @end example
  7694. The general fade-out expression can be written as:
  7695. @example
  7696. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  7697. @end example
  7698. @end itemize
  7699. @subsection Commands
  7700. This filter supports the following commands:
  7701. @table @option
  7702. @item b
  7703. @item s
  7704. @item h
  7705. @item H
  7706. Modify the hue and/or the saturation and/or brightness of the input video.
  7707. The command accepts the same syntax of the corresponding option.
  7708. If the specified expression is not valid, it is kept at its current
  7709. value.
  7710. @end table
  7711. @section hysteresis
  7712. Grow first stream into second stream by connecting components.
  7713. This makes it possible to build more robust edge masks.
  7714. This filter accepts the following options:
  7715. @table @option
  7716. @item planes
  7717. Set which planes will be processed as bitmap, unprocessed planes will be
  7718. copied from first stream.
  7719. By default value 0xf, all planes will be processed.
  7720. @item threshold
  7721. Set threshold which is used in filtering. If pixel component value is higher than
  7722. this value filter algorithm for connecting components is activated.
  7723. By default value is 0.
  7724. @end table
  7725. @section idet
  7726. Detect video interlacing type.
  7727. This filter tries to detect if the input frames are interlaced, progressive,
  7728. top or bottom field first. It will also try to detect fields that are
  7729. repeated between adjacent frames (a sign of telecine).
  7730. Single frame detection considers only immediately adjacent frames when classifying each frame.
  7731. Multiple frame detection incorporates the classification history of previous frames.
  7732. The filter will log these metadata values:
  7733. @table @option
  7734. @item single.current_frame
  7735. Detected type of current frame using single-frame detection. One of:
  7736. ``tff'' (top field first), ``bff'' (bottom field first),
  7737. ``progressive'', or ``undetermined''
  7738. @item single.tff
  7739. Cumulative number of frames detected as top field first using single-frame detection.
  7740. @item multiple.tff
  7741. Cumulative number of frames detected as top field first using multiple-frame detection.
  7742. @item single.bff
  7743. Cumulative number of frames detected as bottom field first using single-frame detection.
  7744. @item multiple.current_frame
  7745. Detected type of current frame using multiple-frame detection. One of:
  7746. ``tff'' (top field first), ``bff'' (bottom field first),
  7747. ``progressive'', or ``undetermined''
  7748. @item multiple.bff
  7749. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  7750. @item single.progressive
  7751. Cumulative number of frames detected as progressive using single-frame detection.
  7752. @item multiple.progressive
  7753. Cumulative number of frames detected as progressive using multiple-frame detection.
  7754. @item single.undetermined
  7755. Cumulative number of frames that could not be classified using single-frame detection.
  7756. @item multiple.undetermined
  7757. Cumulative number of frames that could not be classified using multiple-frame detection.
  7758. @item repeated.current_frame
  7759. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  7760. @item repeated.neither
  7761. Cumulative number of frames with no repeated field.
  7762. @item repeated.top
  7763. Cumulative number of frames with the top field repeated from the previous frame's top field.
  7764. @item repeated.bottom
  7765. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  7766. @end table
  7767. The filter accepts the following options:
  7768. @table @option
  7769. @item intl_thres
  7770. Set interlacing threshold.
  7771. @item prog_thres
  7772. Set progressive threshold.
  7773. @item rep_thres
  7774. Threshold for repeated field detection.
  7775. @item half_life
  7776. Number of frames after which a given frame's contribution to the
  7777. statistics is halved (i.e., it contributes only 0.5 to its
  7778. classification). The default of 0 means that all frames seen are given
  7779. full weight of 1.0 forever.
  7780. @item analyze_interlaced_flag
  7781. When this is not 0 then idet will use the specified number of frames to determine
  7782. if the interlaced flag is accurate, it will not count undetermined frames.
  7783. If the flag is found to be accurate it will be used without any further
  7784. computations, if it is found to be inaccurate it will be cleared without any
  7785. further computations. This allows inserting the idet filter as a low computational
  7786. method to clean up the interlaced flag
  7787. @end table
  7788. @section il
  7789. Deinterleave or interleave fields.
  7790. This filter allows one to process interlaced images fields without
  7791. deinterlacing them. Deinterleaving splits the input frame into 2
  7792. fields (so called half pictures). Odd lines are moved to the top
  7793. half of the output image, even lines to the bottom half.
  7794. You can process (filter) them independently and then re-interleave them.
  7795. The filter accepts the following options:
  7796. @table @option
  7797. @item luma_mode, l
  7798. @item chroma_mode, c
  7799. @item alpha_mode, a
  7800. Available values for @var{luma_mode}, @var{chroma_mode} and
  7801. @var{alpha_mode} are:
  7802. @table @samp
  7803. @item none
  7804. Do nothing.
  7805. @item deinterleave, d
  7806. Deinterleave fields, placing one above the other.
  7807. @item interleave, i
  7808. Interleave fields. Reverse the effect of deinterleaving.
  7809. @end table
  7810. Default value is @code{none}.
  7811. @item luma_swap, ls
  7812. @item chroma_swap, cs
  7813. @item alpha_swap, as
  7814. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  7815. @end table
  7816. @section inflate
  7817. Apply inflate effect to the video.
  7818. This filter replaces the pixel by the local(3x3) average by taking into account
  7819. only values higher than the pixel.
  7820. It accepts the following options:
  7821. @table @option
  7822. @item threshold0
  7823. @item threshold1
  7824. @item threshold2
  7825. @item threshold3
  7826. Limit the maximum change for each plane, default is 65535.
  7827. If 0, plane will remain unchanged.
  7828. @end table
  7829. @section interlace
  7830. Simple interlacing filter from progressive contents. This interleaves upper (or
  7831. lower) lines from odd frames with lower (or upper) lines from even frames,
  7832. halving the frame rate and preserving image height.
  7833. @example
  7834. Original Original New Frame
  7835. Frame 'j' Frame 'j+1' (tff)
  7836. ========== =========== ==================
  7837. Line 0 --------------------> Frame 'j' Line 0
  7838. Line 1 Line 1 ----> Frame 'j+1' Line 1
  7839. Line 2 ---------------------> Frame 'j' Line 2
  7840. Line 3 Line 3 ----> Frame 'j+1' Line 3
  7841. ... ... ...
  7842. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  7843. @end example
  7844. It accepts the following optional parameters:
  7845. @table @option
  7846. @item scan
  7847. This determines whether the interlaced frame is taken from the even
  7848. (tff - default) or odd (bff) lines of the progressive frame.
  7849. @item lowpass
  7850. Vertical lowpass filter to avoid twitter interlacing and
  7851. reduce moire patterns.
  7852. @table @samp
  7853. @item 0, off
  7854. Disable vertical lowpass filter
  7855. @item 1, linear
  7856. Enable linear filter (default)
  7857. @item 2, complex
  7858. Enable complex filter. This will slightly less reduce twitter and moire
  7859. but better retain detail and subjective sharpness impression.
  7860. @end table
  7861. @end table
  7862. @section kerndeint
  7863. Deinterlace input video by applying Donald Graft's adaptive kernel
  7864. deinterling. Work on interlaced parts of a video to produce
  7865. progressive frames.
  7866. The description of the accepted parameters follows.
  7867. @table @option
  7868. @item thresh
  7869. Set the threshold which affects the filter's tolerance when
  7870. determining if a pixel line must be processed. It must be an integer
  7871. in the range [0,255] and defaults to 10. A value of 0 will result in
  7872. applying the process on every pixels.
  7873. @item map
  7874. Paint pixels exceeding the threshold value to white if set to 1.
  7875. Default is 0.
  7876. @item order
  7877. Set the fields order. Swap fields if set to 1, leave fields alone if
  7878. 0. Default is 0.
  7879. @item sharp
  7880. Enable additional sharpening if set to 1. Default is 0.
  7881. @item twoway
  7882. Enable twoway sharpening if set to 1. Default is 0.
  7883. @end table
  7884. @subsection Examples
  7885. @itemize
  7886. @item
  7887. Apply default values:
  7888. @example
  7889. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  7890. @end example
  7891. @item
  7892. Enable additional sharpening:
  7893. @example
  7894. kerndeint=sharp=1
  7895. @end example
  7896. @item
  7897. Paint processed pixels in white:
  7898. @example
  7899. kerndeint=map=1
  7900. @end example
  7901. @end itemize
  7902. @section lenscorrection
  7903. Correct radial lens distortion
  7904. This filter can be used to correct for radial distortion as can result from the use
  7905. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  7906. one can use tools available for example as part of opencv or simply trial-and-error.
  7907. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  7908. and extract the k1 and k2 coefficients from the resulting matrix.
  7909. Note that effectively the same filter is available in the open-source tools Krita and
  7910. Digikam from the KDE project.
  7911. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  7912. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  7913. brightness distribution, so you may want to use both filters together in certain
  7914. cases, though you will have to take care of ordering, i.e. whether vignetting should
  7915. be applied before or after lens correction.
  7916. @subsection Options
  7917. The filter accepts the following options:
  7918. @table @option
  7919. @item cx
  7920. Relative x-coordinate of the focal point of the image, and thereby the center of the
  7921. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7922. width.
  7923. @item cy
  7924. Relative y-coordinate of the focal point of the image, and thereby the center of the
  7925. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7926. height.
  7927. @item k1
  7928. Coefficient of the quadratic correction term. 0.5 means no correction.
  7929. @item k2
  7930. Coefficient of the double quadratic correction term. 0.5 means no correction.
  7931. @end table
  7932. The formula that generates the correction is:
  7933. @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)
  7934. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  7935. distances from the focal point in the source and target images, respectively.
  7936. @section libvmaf
  7937. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  7938. score between two input videos.
  7939. The obtained VMAF score is printed through the logging system.
  7940. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  7941. After installing the library it can be enabled using:
  7942. @code{./configure --enable-libvmaf}.
  7943. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  7944. The filter has following options:
  7945. @table @option
  7946. @item model_path
  7947. Set the model path which is to be used for SVM.
  7948. Default value: @code{"vmaf_v0.6.1.pkl"}
  7949. @item log_path
  7950. Set the file path to be used to store logs.
  7951. @item log_fmt
  7952. Set the format of the log file (xml or json).
  7953. @item enable_transform
  7954. Enables transform for computing vmaf.
  7955. @item phone_model
  7956. Invokes the phone model which will generate VMAF scores higher than in the
  7957. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  7958. @item psnr
  7959. Enables computing psnr along with vmaf.
  7960. @item ssim
  7961. Enables computing ssim along with vmaf.
  7962. @item ms_ssim
  7963. Enables computing ms_ssim along with vmaf.
  7964. @item pool
  7965. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  7966. @end table
  7967. This filter also supports the @ref{framesync} options.
  7968. On the below examples the input file @file{main.mpg} being processed is
  7969. compared with the reference file @file{ref.mpg}.
  7970. @example
  7971. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  7972. @end example
  7973. Example with options:
  7974. @example
  7975. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
  7976. @end example
  7977. @section limiter
  7978. Limits the pixel components values to the specified range [min, max].
  7979. The filter accepts the following options:
  7980. @table @option
  7981. @item min
  7982. Lower bound. Defaults to the lowest allowed value for the input.
  7983. @item max
  7984. Upper bound. Defaults to the highest allowed value for the input.
  7985. @item planes
  7986. Specify which planes will be processed. Defaults to all available.
  7987. @end table
  7988. @section loop
  7989. Loop video frames.
  7990. The filter accepts the following options:
  7991. @table @option
  7992. @item loop
  7993. Set the number of loops. Setting this value to -1 will result in infinite loops.
  7994. Default is 0.
  7995. @item size
  7996. Set maximal size in number of frames. Default is 0.
  7997. @item start
  7998. Set first frame of loop. Default is 0.
  7999. @end table
  8000. @anchor{lut3d}
  8001. @section lut3d
  8002. Apply a 3D LUT to an input video.
  8003. The filter accepts the following options:
  8004. @table @option
  8005. @item file
  8006. Set the 3D LUT file name.
  8007. Currently supported formats:
  8008. @table @samp
  8009. @item 3dl
  8010. AfterEffects
  8011. @item cube
  8012. Iridas
  8013. @item dat
  8014. DaVinci
  8015. @item m3d
  8016. Pandora
  8017. @end table
  8018. @item interp
  8019. Select interpolation mode.
  8020. Available values are:
  8021. @table @samp
  8022. @item nearest
  8023. Use values from the nearest defined point.
  8024. @item trilinear
  8025. Interpolate values using the 8 points defining a cube.
  8026. @item tetrahedral
  8027. Interpolate values using a tetrahedron.
  8028. @end table
  8029. @end table
  8030. This filter also supports the @ref{framesync} options.
  8031. @section lumakey
  8032. Turn certain luma values into transparency.
  8033. The filter accepts the following options:
  8034. @table @option
  8035. @item threshold
  8036. Set the luma which will be used as base for transparency.
  8037. Default value is @code{0}.
  8038. @item tolerance
  8039. Set the range of luma values to be keyed out.
  8040. Default value is @code{0}.
  8041. @item softness
  8042. Set the range of softness. Default value is @code{0}.
  8043. Use this to control gradual transition from zero to full transparency.
  8044. @end table
  8045. @section lut, lutrgb, lutyuv
  8046. Compute a look-up table for binding each pixel component input value
  8047. to an output value, and apply it to the input video.
  8048. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  8049. to an RGB input video.
  8050. These filters accept the following parameters:
  8051. @table @option
  8052. @item c0
  8053. set first pixel component expression
  8054. @item c1
  8055. set second pixel component expression
  8056. @item c2
  8057. set third pixel component expression
  8058. @item c3
  8059. set fourth pixel component expression, corresponds to the alpha component
  8060. @item r
  8061. set red component expression
  8062. @item g
  8063. set green component expression
  8064. @item b
  8065. set blue component expression
  8066. @item a
  8067. alpha component expression
  8068. @item y
  8069. set Y/luminance component expression
  8070. @item u
  8071. set U/Cb component expression
  8072. @item v
  8073. set V/Cr component expression
  8074. @end table
  8075. Each of them specifies the expression to use for computing the lookup table for
  8076. the corresponding pixel component values.
  8077. The exact component associated to each of the @var{c*} options depends on the
  8078. format in input.
  8079. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  8080. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  8081. The expressions can contain the following constants and functions:
  8082. @table @option
  8083. @item w
  8084. @item h
  8085. The input width and height.
  8086. @item val
  8087. The input value for the pixel component.
  8088. @item clipval
  8089. The input value, clipped to the @var{minval}-@var{maxval} range.
  8090. @item maxval
  8091. The maximum value for the pixel component.
  8092. @item minval
  8093. The minimum value for the pixel component.
  8094. @item negval
  8095. The negated value for the pixel component value, clipped to the
  8096. @var{minval}-@var{maxval} range; it corresponds to the expression
  8097. "maxval-clipval+minval".
  8098. @item clip(val)
  8099. The computed value in @var{val}, clipped to the
  8100. @var{minval}-@var{maxval} range.
  8101. @item gammaval(gamma)
  8102. The computed gamma correction value of the pixel component value,
  8103. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  8104. expression
  8105. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  8106. @end table
  8107. All expressions default to "val".
  8108. @subsection Examples
  8109. @itemize
  8110. @item
  8111. Negate input video:
  8112. @example
  8113. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  8114. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  8115. @end example
  8116. The above is the same as:
  8117. @example
  8118. lutrgb="r=negval:g=negval:b=negval"
  8119. lutyuv="y=negval:u=negval:v=negval"
  8120. @end example
  8121. @item
  8122. Negate luminance:
  8123. @example
  8124. lutyuv=y=negval
  8125. @end example
  8126. @item
  8127. Remove chroma components, turning the video into a graytone image:
  8128. @example
  8129. lutyuv="u=128:v=128"
  8130. @end example
  8131. @item
  8132. Apply a luma burning effect:
  8133. @example
  8134. lutyuv="y=2*val"
  8135. @end example
  8136. @item
  8137. Remove green and blue components:
  8138. @example
  8139. lutrgb="g=0:b=0"
  8140. @end example
  8141. @item
  8142. Set a constant alpha channel value on input:
  8143. @example
  8144. format=rgba,lutrgb=a="maxval-minval/2"
  8145. @end example
  8146. @item
  8147. Correct luminance gamma by a factor of 0.5:
  8148. @example
  8149. lutyuv=y=gammaval(0.5)
  8150. @end example
  8151. @item
  8152. Discard least significant bits of luma:
  8153. @example
  8154. lutyuv=y='bitand(val, 128+64+32)'
  8155. @end example
  8156. @item
  8157. Technicolor like effect:
  8158. @example
  8159. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  8160. @end example
  8161. @end itemize
  8162. @section lut2, tlut2
  8163. The @code{lut2} filter takes two input streams and outputs one
  8164. stream.
  8165. The @code{tlut2} (time lut2) filter takes two consecutive frames
  8166. from one single stream.
  8167. This filter accepts the following parameters:
  8168. @table @option
  8169. @item c0
  8170. set first pixel component expression
  8171. @item c1
  8172. set second pixel component expression
  8173. @item c2
  8174. set third pixel component expression
  8175. @item c3
  8176. set fourth pixel component expression, corresponds to the alpha component
  8177. @end table
  8178. Each of them specifies the expression to use for computing the lookup table for
  8179. the corresponding pixel component values.
  8180. The exact component associated to each of the @var{c*} options depends on the
  8181. format in inputs.
  8182. The expressions can contain the following constants:
  8183. @table @option
  8184. @item w
  8185. @item h
  8186. The input width and height.
  8187. @item x
  8188. The first input value for the pixel component.
  8189. @item y
  8190. The second input value for the pixel component.
  8191. @item bdx
  8192. The first input video bit depth.
  8193. @item bdy
  8194. The second input video bit depth.
  8195. @end table
  8196. All expressions default to "x".
  8197. @subsection Examples
  8198. @itemize
  8199. @item
  8200. Highlight differences between two RGB video streams:
  8201. @example
  8202. lut2='ifnot(x-y,0,pow(2,bdx)-1):ifnot(x-y,0,pow(2,bdx)-1):ifnot(x-y,0,pow(2,bdx)-1)'
  8203. @end example
  8204. @item
  8205. Highlight differences between two YUV video streams:
  8206. @example
  8207. lut2='ifnot(x-y,0,pow(2,bdx)-1):ifnot(x-y,pow(2,bdx-1),pow(2,bdx)-1):ifnot(x-y,pow(2,bdx-1),pow(2,bdx)-1)'
  8208. @end example
  8209. @item
  8210. Show max difference between two video streams:
  8211. @example
  8212. lut2='if(lt(x,y),0,if(gt(x,y),pow(2,bdx)-1,pow(2,bdx-1))):if(lt(x,y),0,if(gt(x,y),pow(2,bdx)-1,pow(2,bdx-1))):if(lt(x,y),0,if(gt(x,y),pow(2,bdx)-1,pow(2,bdx-1)))'
  8213. @end example
  8214. @end itemize
  8215. @section maskedclamp
  8216. Clamp the first input stream with the second input and third input stream.
  8217. Returns the value of first stream to be between second input
  8218. stream - @code{undershoot} and third input stream + @code{overshoot}.
  8219. This filter accepts the following options:
  8220. @table @option
  8221. @item undershoot
  8222. Default value is @code{0}.
  8223. @item overshoot
  8224. Default value is @code{0}.
  8225. @item planes
  8226. Set which planes will be processed as bitmap, unprocessed planes will be
  8227. copied from first stream.
  8228. By default value 0xf, all planes will be processed.
  8229. @end table
  8230. @section maskedmerge
  8231. Merge the first input stream with the second input stream using per pixel
  8232. weights in the third input stream.
  8233. A value of 0 in the third stream pixel component means that pixel component
  8234. from first stream is returned unchanged, while maximum value (eg. 255 for
  8235. 8-bit videos) means that pixel component from second stream is returned
  8236. unchanged. Intermediate values define the amount of merging between both
  8237. input stream's pixel components.
  8238. This filter accepts the following options:
  8239. @table @option
  8240. @item planes
  8241. Set which planes will be processed as bitmap, unprocessed planes will be
  8242. copied from first stream.
  8243. By default value 0xf, all planes will be processed.
  8244. @end table
  8245. @section mcdeint
  8246. Apply motion-compensation deinterlacing.
  8247. It needs one field per frame as input and must thus be used together
  8248. with yadif=1/3 or equivalent.
  8249. This filter accepts the following options:
  8250. @table @option
  8251. @item mode
  8252. Set the deinterlacing mode.
  8253. It accepts one of the following values:
  8254. @table @samp
  8255. @item fast
  8256. @item medium
  8257. @item slow
  8258. use iterative motion estimation
  8259. @item extra_slow
  8260. like @samp{slow}, but use multiple reference frames.
  8261. @end table
  8262. Default value is @samp{fast}.
  8263. @item parity
  8264. Set the picture field parity assumed for the input video. It must be
  8265. one of the following values:
  8266. @table @samp
  8267. @item 0, tff
  8268. assume top field first
  8269. @item 1, bff
  8270. assume bottom field first
  8271. @end table
  8272. Default value is @samp{bff}.
  8273. @item qp
  8274. Set per-block quantization parameter (QP) used by the internal
  8275. encoder.
  8276. Higher values should result in a smoother motion vector field but less
  8277. optimal individual vectors. Default value is 1.
  8278. @end table
  8279. @section mergeplanes
  8280. Merge color channel components from several video streams.
  8281. The filter accepts up to 4 input streams, and merge selected input
  8282. planes to the output video.
  8283. This filter accepts the following options:
  8284. @table @option
  8285. @item mapping
  8286. Set input to output plane mapping. Default is @code{0}.
  8287. The mappings is specified as a bitmap. It should be specified as a
  8288. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  8289. mapping for the first plane of the output stream. 'A' sets the number of
  8290. the input stream to use (from 0 to 3), and 'a' the plane number of the
  8291. corresponding input to use (from 0 to 3). The rest of the mappings is
  8292. similar, 'Bb' describes the mapping for the output stream second
  8293. plane, 'Cc' describes the mapping for the output stream third plane and
  8294. 'Dd' describes the mapping for the output stream fourth plane.
  8295. @item format
  8296. Set output pixel format. Default is @code{yuva444p}.
  8297. @end table
  8298. @subsection Examples
  8299. @itemize
  8300. @item
  8301. Merge three gray video streams of same width and height into single video stream:
  8302. @example
  8303. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  8304. @end example
  8305. @item
  8306. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  8307. @example
  8308. [a0][a1]mergeplanes=0x00010210:yuva444p
  8309. @end example
  8310. @item
  8311. Swap Y and A plane in yuva444p stream:
  8312. @example
  8313. format=yuva444p,mergeplanes=0x03010200:yuva444p
  8314. @end example
  8315. @item
  8316. Swap U and V plane in yuv420p stream:
  8317. @example
  8318. format=yuv420p,mergeplanes=0x000201:yuv420p
  8319. @end example
  8320. @item
  8321. Cast a rgb24 clip to yuv444p:
  8322. @example
  8323. format=rgb24,mergeplanes=0x000102:yuv444p
  8324. @end example
  8325. @end itemize
  8326. @section mestimate
  8327. Estimate and export motion vectors using block matching algorithms.
  8328. Motion vectors are stored in frame side data to be used by other filters.
  8329. This filter accepts the following options:
  8330. @table @option
  8331. @item method
  8332. Specify the motion estimation method. Accepts one of the following values:
  8333. @table @samp
  8334. @item esa
  8335. Exhaustive search algorithm.
  8336. @item tss
  8337. Three step search algorithm.
  8338. @item tdls
  8339. Two dimensional logarithmic search algorithm.
  8340. @item ntss
  8341. New three step search algorithm.
  8342. @item fss
  8343. Four step search algorithm.
  8344. @item ds
  8345. Diamond search algorithm.
  8346. @item hexbs
  8347. Hexagon-based search algorithm.
  8348. @item epzs
  8349. Enhanced predictive zonal search algorithm.
  8350. @item umh
  8351. Uneven multi-hexagon search algorithm.
  8352. @end table
  8353. Default value is @samp{esa}.
  8354. @item mb_size
  8355. Macroblock size. Default @code{16}.
  8356. @item search_param
  8357. Search parameter. Default @code{7}.
  8358. @end table
  8359. @section midequalizer
  8360. Apply Midway Image Equalization effect using two video streams.
  8361. Midway Image Equalization adjusts a pair of images to have the same
  8362. histogram, while maintaining their dynamics as much as possible. It's
  8363. useful for e.g. matching exposures from a pair of stereo cameras.
  8364. This filter has two inputs and one output, which must be of same pixel format, but
  8365. may be of different sizes. The output of filter is first input adjusted with
  8366. midway histogram of both inputs.
  8367. This filter accepts the following option:
  8368. @table @option
  8369. @item planes
  8370. Set which planes to process. Default is @code{15}, which is all available planes.
  8371. @end table
  8372. @section minterpolate
  8373. Convert the video to specified frame rate using motion interpolation.
  8374. This filter accepts the following options:
  8375. @table @option
  8376. @item fps
  8377. Specify the output frame rate. This can be rational e.g. @code{60000/1001}. Frames are dropped if @var{fps} is lower than source fps. Default @code{60}.
  8378. @item mi_mode
  8379. Motion interpolation mode. Following values are accepted:
  8380. @table @samp
  8381. @item dup
  8382. Duplicate previous or next frame for interpolating new ones.
  8383. @item blend
  8384. Blend source frames. Interpolated frame is mean of previous and next frames.
  8385. @item mci
  8386. Motion compensated interpolation. Following options are effective when this mode is selected:
  8387. @table @samp
  8388. @item mc_mode
  8389. Motion compensation mode. Following values are accepted:
  8390. @table @samp
  8391. @item obmc
  8392. Overlapped block motion compensation.
  8393. @item aobmc
  8394. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  8395. @end table
  8396. Default mode is @samp{obmc}.
  8397. @item me_mode
  8398. Motion estimation mode. Following values are accepted:
  8399. @table @samp
  8400. @item bidir
  8401. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  8402. @item bilat
  8403. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  8404. @end table
  8405. Default mode is @samp{bilat}.
  8406. @item me
  8407. The algorithm to be used for motion estimation. Following values are accepted:
  8408. @table @samp
  8409. @item esa
  8410. Exhaustive search algorithm.
  8411. @item tss
  8412. Three step search algorithm.
  8413. @item tdls
  8414. Two dimensional logarithmic search algorithm.
  8415. @item ntss
  8416. New three step search algorithm.
  8417. @item fss
  8418. Four step search algorithm.
  8419. @item ds
  8420. Diamond search algorithm.
  8421. @item hexbs
  8422. Hexagon-based search algorithm.
  8423. @item epzs
  8424. Enhanced predictive zonal search algorithm.
  8425. @item umh
  8426. Uneven multi-hexagon search algorithm.
  8427. @end table
  8428. Default algorithm is @samp{epzs}.
  8429. @item mb_size
  8430. Macroblock size. Default @code{16}.
  8431. @item search_param
  8432. Motion estimation search parameter. Default @code{32}.
  8433. @item vsbmc
  8434. Enable variable-size block motion compensation. Motion estimation is applied with smaller block sizes at object boundaries in order to make the them less blur. Default is @code{0} (disabled).
  8435. @end table
  8436. @end table
  8437. @item scd
  8438. Scene change detection method. Scene change leads motion vectors to be in random direction. Scene change detection replace interpolated frames by duplicate ones. May not be needed for other modes. Following values are accepted:
  8439. @table @samp
  8440. @item none
  8441. Disable scene change detection.
  8442. @item fdiff
  8443. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  8444. @end table
  8445. Default method is @samp{fdiff}.
  8446. @item scd_threshold
  8447. Scene change detection threshold. Default is @code{5.0}.
  8448. @end table
  8449. @section mix
  8450. Mix several video input streams into one video stream.
  8451. A description of the accepted options follows.
  8452. @table @option
  8453. @item nb_inputs
  8454. The number of inputs. If unspecified, it defaults to 2.
  8455. @item weights
  8456. Specify weight of each input video stream as sequence.
  8457. Each weight is separated by space.
  8458. @item duration
  8459. Specify how end of stream is determined.
  8460. @table @samp
  8461. @item longest
  8462. The duration of the longest input. (default)
  8463. @item shortest
  8464. The duration of the shortest input.
  8465. @item first
  8466. The duration of the first input.
  8467. @end table
  8468. @end table
  8469. @section mpdecimate
  8470. Drop frames that do not differ greatly from the previous frame in
  8471. order to reduce frame rate.
  8472. The main use of this filter is for very-low-bitrate encoding
  8473. (e.g. streaming over dialup modem), but it could in theory be used for
  8474. fixing movies that were inverse-telecined incorrectly.
  8475. A description of the accepted options follows.
  8476. @table @option
  8477. @item max
  8478. Set the maximum number of consecutive frames which can be dropped (if
  8479. positive), or the minimum interval between dropped frames (if
  8480. negative). If the value is 0, the frame is dropped disregarding the
  8481. number of previous sequentially dropped frames.
  8482. Default value is 0.
  8483. @item hi
  8484. @item lo
  8485. @item frac
  8486. Set the dropping threshold values.
  8487. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  8488. represent actual pixel value differences, so a threshold of 64
  8489. corresponds to 1 unit of difference for each pixel, or the same spread
  8490. out differently over the block.
  8491. A frame is a candidate for dropping if no 8x8 blocks differ by more
  8492. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  8493. meaning the whole image) differ by more than a threshold of @option{lo}.
  8494. Default value for @option{hi} is 64*12, default value for @option{lo} is
  8495. 64*5, and default value for @option{frac} is 0.33.
  8496. @end table
  8497. @section negate
  8498. Negate input video.
  8499. It accepts an integer in input; if non-zero it negates the
  8500. alpha component (if available). The default value in input is 0.
  8501. @section nlmeans
  8502. Denoise frames using Non-Local Means algorithm.
  8503. Each pixel is adjusted by looking for other pixels with similar contexts. This
  8504. context similarity is defined by comparing their surrounding patches of size
  8505. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  8506. around the pixel.
  8507. Note that the research area defines centers for patches, which means some
  8508. patches will be made of pixels outside that research area.
  8509. The filter accepts the following options.
  8510. @table @option
  8511. @item s
  8512. Set denoising strength.
  8513. @item p
  8514. Set patch size.
  8515. @item pc
  8516. Same as @option{p} but for chroma planes.
  8517. The default value is @var{0} and means automatic.
  8518. @item r
  8519. Set research size.
  8520. @item rc
  8521. Same as @option{r} but for chroma planes.
  8522. The default value is @var{0} and means automatic.
  8523. @end table
  8524. @section nnedi
  8525. Deinterlace video using neural network edge directed interpolation.
  8526. This filter accepts the following options:
  8527. @table @option
  8528. @item weights
  8529. Mandatory option, without binary file filter can not work.
  8530. Currently file can be found here:
  8531. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  8532. @item deint
  8533. Set which frames to deinterlace, by default it is @code{all}.
  8534. Can be @code{all} or @code{interlaced}.
  8535. @item field
  8536. Set mode of operation.
  8537. Can be one of the following:
  8538. @table @samp
  8539. @item af
  8540. Use frame flags, both fields.
  8541. @item a
  8542. Use frame flags, single field.
  8543. @item t
  8544. Use top field only.
  8545. @item b
  8546. Use bottom field only.
  8547. @item tf
  8548. Use both fields, top first.
  8549. @item bf
  8550. Use both fields, bottom first.
  8551. @end table
  8552. @item planes
  8553. Set which planes to process, by default filter process all frames.
  8554. @item nsize
  8555. Set size of local neighborhood around each pixel, used by the predictor neural
  8556. network.
  8557. Can be one of the following:
  8558. @table @samp
  8559. @item s8x6
  8560. @item s16x6
  8561. @item s32x6
  8562. @item s48x6
  8563. @item s8x4
  8564. @item s16x4
  8565. @item s32x4
  8566. @end table
  8567. @item nns
  8568. Set the number of neurons in predictor neural network.
  8569. Can be one of the following:
  8570. @table @samp
  8571. @item n16
  8572. @item n32
  8573. @item n64
  8574. @item n128
  8575. @item n256
  8576. @end table
  8577. @item qual
  8578. Controls the number of different neural network predictions that are blended
  8579. together to compute the final output value. Can be @code{fast}, default or
  8580. @code{slow}.
  8581. @item etype
  8582. Set which set of weights to use in the predictor.
  8583. Can be one of the following:
  8584. @table @samp
  8585. @item a
  8586. weights trained to minimize absolute error
  8587. @item s
  8588. weights trained to minimize squared error
  8589. @end table
  8590. @item pscrn
  8591. Controls whether or not the prescreener neural network is used to decide
  8592. which pixels should be processed by the predictor neural network and which
  8593. can be handled by simple cubic interpolation.
  8594. The prescreener is trained to know whether cubic interpolation will be
  8595. sufficient for a pixel or whether it should be predicted by the predictor nn.
  8596. The computational complexity of the prescreener nn is much less than that of
  8597. the predictor nn. Since most pixels can be handled by cubic interpolation,
  8598. using the prescreener generally results in much faster processing.
  8599. The prescreener is pretty accurate, so the difference between using it and not
  8600. using it is almost always unnoticeable.
  8601. Can be one of the following:
  8602. @table @samp
  8603. @item none
  8604. @item original
  8605. @item new
  8606. @end table
  8607. Default is @code{new}.
  8608. @item fapprox
  8609. Set various debugging flags.
  8610. @end table
  8611. @section noformat
  8612. Force libavfilter not to use any of the specified pixel formats for the
  8613. input to the next filter.
  8614. It accepts the following parameters:
  8615. @table @option
  8616. @item pix_fmts
  8617. A '|'-separated list of pixel format names, such as
  8618. pix_fmts=yuv420p|monow|rgb24".
  8619. @end table
  8620. @subsection Examples
  8621. @itemize
  8622. @item
  8623. Force libavfilter to use a format different from @var{yuv420p} for the
  8624. input to the vflip filter:
  8625. @example
  8626. noformat=pix_fmts=yuv420p,vflip
  8627. @end example
  8628. @item
  8629. Convert the input video to any of the formats not contained in the list:
  8630. @example
  8631. noformat=yuv420p|yuv444p|yuv410p
  8632. @end example
  8633. @end itemize
  8634. @section noise
  8635. Add noise on video input frame.
  8636. The filter accepts the following options:
  8637. @table @option
  8638. @item all_seed
  8639. @item c0_seed
  8640. @item c1_seed
  8641. @item c2_seed
  8642. @item c3_seed
  8643. Set noise seed for specific pixel component or all pixel components in case
  8644. of @var{all_seed}. Default value is @code{123457}.
  8645. @item all_strength, alls
  8646. @item c0_strength, c0s
  8647. @item c1_strength, c1s
  8648. @item c2_strength, c2s
  8649. @item c3_strength, c3s
  8650. Set noise strength for specific pixel component or all pixel components in case
  8651. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  8652. @item all_flags, allf
  8653. @item c0_flags, c0f
  8654. @item c1_flags, c1f
  8655. @item c2_flags, c2f
  8656. @item c3_flags, c3f
  8657. Set pixel component flags or set flags for all components if @var{all_flags}.
  8658. Available values for component flags are:
  8659. @table @samp
  8660. @item a
  8661. averaged temporal noise (smoother)
  8662. @item p
  8663. mix random noise with a (semi)regular pattern
  8664. @item t
  8665. temporal noise (noise pattern changes between frames)
  8666. @item u
  8667. uniform noise (gaussian otherwise)
  8668. @end table
  8669. @end table
  8670. @subsection Examples
  8671. Add temporal and uniform noise to input video:
  8672. @example
  8673. noise=alls=20:allf=t+u
  8674. @end example
  8675. @section normalize
  8676. Normalize RGB video (aka histogram stretching, contrast stretching).
  8677. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  8678. For each channel of each frame, the filter computes the input range and maps
  8679. it linearly to the user-specified output range. The output range defaults
  8680. to the full dynamic range from pure black to pure white.
  8681. Temporal smoothing can be used on the input range to reduce flickering (rapid
  8682. changes in brightness) caused when small dark or bright objects enter or leave
  8683. the scene. This is similar to the auto-exposure (automatic gain control) on a
  8684. video camera, and, like a video camera, it may cause a period of over- or
  8685. under-exposure of the video.
  8686. The R,G,B channels can be normalized independently, which may cause some
  8687. color shifting, or linked together as a single channel, which prevents
  8688. color shifting. Linked normalization preserves hue. Independent normalization
  8689. does not, so it can be used to remove some color casts. Independent and linked
  8690. normalization can be combined in any ratio.
  8691. The normalize filter accepts the following options:
  8692. @table @option
  8693. @item blackpt
  8694. @item whitept
  8695. Colors which define the output range. The minimum input value is mapped to
  8696. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  8697. The defaults are black and white respectively. Specifying white for
  8698. @var{blackpt} and black for @var{whitept} will give color-inverted,
  8699. normalized video. Shades of grey can be used to reduce the dynamic range
  8700. (contrast). Specifying saturated colors here can create some interesting
  8701. effects.
  8702. @item smoothing
  8703. The number of previous frames to use for temporal smoothing. The input range
  8704. of each channel is smoothed using a rolling average over the current frame
  8705. and the @var{smoothing} previous frames. The default is 0 (no temporal
  8706. smoothing).
  8707. @item independence
  8708. Controls the ratio of independent (color shifting) channel normalization to
  8709. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  8710. independent. Defaults to 1.0 (fully independent).
  8711. @item strength
  8712. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  8713. expensive no-op. Defaults to 1.0 (full strength).
  8714. @end table
  8715. @subsection Examples
  8716. Stretch video contrast to use the full dynamic range, with no temporal
  8717. smoothing; may flicker depending on the source content:
  8718. @example
  8719. normalize=blackpt=black:whitept=white:smoothing=0
  8720. @end example
  8721. As above, but with 50 frames of temporal smoothing; flicker should be
  8722. reduced, depending on the source content:
  8723. @example
  8724. normalize=blackpt=black:whitept=white:smoothing=50
  8725. @end example
  8726. As above, but with hue-preserving linked channel normalization:
  8727. @example
  8728. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  8729. @end example
  8730. As above, but with half strength:
  8731. @example
  8732. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  8733. @end example
  8734. Map the darkest input color to red, the brightest input color to cyan:
  8735. @example
  8736. normalize=blackpt=red:whitept=cyan
  8737. @end example
  8738. @section null
  8739. Pass the video source unchanged to the output.
  8740. @section ocr
  8741. Optical Character Recognition
  8742. This filter uses Tesseract for optical character recognition.
  8743. It accepts the following options:
  8744. @table @option
  8745. @item datapath
  8746. Set datapath to tesseract data. Default is to use whatever was
  8747. set at installation.
  8748. @item language
  8749. Set language, default is "eng".
  8750. @item whitelist
  8751. Set character whitelist.
  8752. @item blacklist
  8753. Set character blacklist.
  8754. @end table
  8755. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  8756. @section ocv
  8757. Apply a video transform using libopencv.
  8758. To enable this filter, install the libopencv library and headers and
  8759. configure FFmpeg with @code{--enable-libopencv}.
  8760. It accepts the following parameters:
  8761. @table @option
  8762. @item filter_name
  8763. The name of the libopencv filter to apply.
  8764. @item filter_params
  8765. The parameters to pass to the libopencv filter. If not specified, the default
  8766. values are assumed.
  8767. @end table
  8768. Refer to the official libopencv documentation for more precise
  8769. information:
  8770. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  8771. Several libopencv filters are supported; see the following subsections.
  8772. @anchor{dilate}
  8773. @subsection dilate
  8774. Dilate an image by using a specific structuring element.
  8775. It corresponds to the libopencv function @code{cvDilate}.
  8776. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  8777. @var{struct_el} represents a structuring element, and has the syntax:
  8778. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  8779. @var{cols} and @var{rows} represent the number of columns and rows of
  8780. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  8781. point, and @var{shape} the shape for the structuring element. @var{shape}
  8782. must be "rect", "cross", "ellipse", or "custom".
  8783. If the value for @var{shape} is "custom", it must be followed by a
  8784. string of the form "=@var{filename}". The file with name
  8785. @var{filename} is assumed to represent a binary image, with each
  8786. printable character corresponding to a bright pixel. When a custom
  8787. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  8788. or columns and rows of the read file are assumed instead.
  8789. The default value for @var{struct_el} is "3x3+0x0/rect".
  8790. @var{nb_iterations} specifies the number of times the transform is
  8791. applied to the image, and defaults to 1.
  8792. Some examples:
  8793. @example
  8794. # Use the default values
  8795. ocv=dilate
  8796. # Dilate using a structuring element with a 5x5 cross, iterating two times
  8797. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  8798. # Read the shape from the file diamond.shape, iterating two times.
  8799. # The file diamond.shape may contain a pattern of characters like this
  8800. # *
  8801. # ***
  8802. # *****
  8803. # ***
  8804. # *
  8805. # The specified columns and rows are ignored
  8806. # but the anchor point coordinates are not
  8807. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  8808. @end example
  8809. @subsection erode
  8810. Erode an image by using a specific structuring element.
  8811. It corresponds to the libopencv function @code{cvErode}.
  8812. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  8813. with the same syntax and semantics as the @ref{dilate} filter.
  8814. @subsection smooth
  8815. Smooth the input video.
  8816. The filter takes the following parameters:
  8817. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  8818. @var{type} is the type of smooth filter to apply, and must be one of
  8819. the following values: "blur", "blur_no_scale", "median", "gaussian",
  8820. or "bilateral". The default value is "gaussian".
  8821. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  8822. depend on the smooth type. @var{param1} and
  8823. @var{param2} accept integer positive values or 0. @var{param3} and
  8824. @var{param4} accept floating point values.
  8825. The default value for @var{param1} is 3. The default value for the
  8826. other parameters is 0.
  8827. These parameters correspond to the parameters assigned to the
  8828. libopencv function @code{cvSmooth}.
  8829. @section oscilloscope
  8830. 2D Video Oscilloscope.
  8831. Useful to measure spatial impulse, step responses, chroma delays, etc.
  8832. It accepts the following parameters:
  8833. @table @option
  8834. @item x
  8835. Set scope center x position.
  8836. @item y
  8837. Set scope center y position.
  8838. @item s
  8839. Set scope size, relative to frame diagonal.
  8840. @item t
  8841. Set scope tilt/rotation.
  8842. @item o
  8843. Set trace opacity.
  8844. @item tx
  8845. Set trace center x position.
  8846. @item ty
  8847. Set trace center y position.
  8848. @item tw
  8849. Set trace width, relative to width of frame.
  8850. @item th
  8851. Set trace height, relative to height of frame.
  8852. @item c
  8853. Set which components to trace. By default it traces first three components.
  8854. @item g
  8855. Draw trace grid. By default is enabled.
  8856. @item st
  8857. Draw some statistics. By default is enabled.
  8858. @item sc
  8859. Draw scope. By default is enabled.
  8860. @end table
  8861. @subsection Examples
  8862. @itemize
  8863. @item
  8864. Inspect full first row of video frame.
  8865. @example
  8866. oscilloscope=x=0.5:y=0:s=1
  8867. @end example
  8868. @item
  8869. Inspect full last row of video frame.
  8870. @example
  8871. oscilloscope=x=0.5:y=1:s=1
  8872. @end example
  8873. @item
  8874. Inspect full 5th line of video frame of height 1080.
  8875. @example
  8876. oscilloscope=x=0.5:y=5/1080:s=1
  8877. @end example
  8878. @item
  8879. Inspect full last column of video frame.
  8880. @example
  8881. oscilloscope=x=1:y=0.5:s=1:t=1
  8882. @end example
  8883. @end itemize
  8884. @anchor{overlay}
  8885. @section overlay
  8886. Overlay one video on top of another.
  8887. It takes two inputs and has one output. The first input is the "main"
  8888. video on which the second input is overlaid.
  8889. It accepts the following parameters:
  8890. A description of the accepted options follows.
  8891. @table @option
  8892. @item x
  8893. @item y
  8894. Set the expression for the x and y coordinates of the overlaid video
  8895. on the main video. Default value is "0" for both expressions. In case
  8896. the expression is invalid, it is set to a huge value (meaning that the
  8897. overlay will not be displayed within the output visible area).
  8898. @item eof_action
  8899. See @ref{framesync}.
  8900. @item eval
  8901. Set when the expressions for @option{x}, and @option{y} are evaluated.
  8902. It accepts the following values:
  8903. @table @samp
  8904. @item init
  8905. only evaluate expressions once during the filter initialization or
  8906. when a command is processed
  8907. @item frame
  8908. evaluate expressions for each incoming frame
  8909. @end table
  8910. Default value is @samp{frame}.
  8911. @item shortest
  8912. See @ref{framesync}.
  8913. @item format
  8914. Set the format for the output video.
  8915. It accepts the following values:
  8916. @table @samp
  8917. @item yuv420
  8918. force YUV420 output
  8919. @item yuv422
  8920. force YUV422 output
  8921. @item yuv444
  8922. force YUV444 output
  8923. @item rgb
  8924. force packed RGB output
  8925. @item gbrp
  8926. force planar RGB output
  8927. @item auto
  8928. automatically pick format
  8929. @end table
  8930. Default value is @samp{yuv420}.
  8931. @item repeatlast
  8932. See @ref{framesync}.
  8933. @item alpha
  8934. Set format of alpha of the overlaid video, it can be @var{straight} or
  8935. @var{premultiplied}. Default is @var{straight}.
  8936. @end table
  8937. The @option{x}, and @option{y} expressions can contain the following
  8938. parameters.
  8939. @table @option
  8940. @item main_w, W
  8941. @item main_h, H
  8942. The main input width and height.
  8943. @item overlay_w, w
  8944. @item overlay_h, h
  8945. The overlay input width and height.
  8946. @item x
  8947. @item y
  8948. The computed values for @var{x} and @var{y}. They are evaluated for
  8949. each new frame.
  8950. @item hsub
  8951. @item vsub
  8952. horizontal and vertical chroma subsample values of the output
  8953. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  8954. @var{vsub} is 1.
  8955. @item n
  8956. the number of input frame, starting from 0
  8957. @item pos
  8958. the position in the file of the input frame, NAN if unknown
  8959. @item t
  8960. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  8961. @end table
  8962. This filter also supports the @ref{framesync} options.
  8963. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  8964. when evaluation is done @emph{per frame}, and will evaluate to NAN
  8965. when @option{eval} is set to @samp{init}.
  8966. Be aware that frames are taken from each input video in timestamp
  8967. order, hence, if their initial timestamps differ, it is a good idea
  8968. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  8969. have them begin in the same zero timestamp, as the example for
  8970. the @var{movie} filter does.
  8971. You can chain together more overlays but you should test the
  8972. efficiency of such approach.
  8973. @subsection Commands
  8974. This filter supports the following commands:
  8975. @table @option
  8976. @item x
  8977. @item y
  8978. Modify the x and y of the overlay input.
  8979. The command accepts the same syntax of the corresponding option.
  8980. If the specified expression is not valid, it is kept at its current
  8981. value.
  8982. @end table
  8983. @subsection Examples
  8984. @itemize
  8985. @item
  8986. Draw the overlay at 10 pixels from the bottom right corner of the main
  8987. video:
  8988. @example
  8989. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  8990. @end example
  8991. Using named options the example above becomes:
  8992. @example
  8993. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  8994. @end example
  8995. @item
  8996. Insert a transparent PNG logo in the bottom left corner of the input,
  8997. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  8998. @example
  8999. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  9000. @end example
  9001. @item
  9002. Insert 2 different transparent PNG logos (second logo on bottom
  9003. right corner) using the @command{ffmpeg} tool:
  9004. @example
  9005. 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
  9006. @end example
  9007. @item
  9008. Add a transparent color layer on top of the main video; @code{WxH}
  9009. must specify the size of the main input to the overlay filter:
  9010. @example
  9011. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  9012. @end example
  9013. @item
  9014. Play an original video and a filtered version (here with the deshake
  9015. filter) side by side using the @command{ffplay} tool:
  9016. @example
  9017. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  9018. @end example
  9019. The above command is the same as:
  9020. @example
  9021. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  9022. @end example
  9023. @item
  9024. Make a sliding overlay appearing from the left to the right top part of the
  9025. screen starting since time 2:
  9026. @example
  9027. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  9028. @end example
  9029. @item
  9030. Compose output by putting two input videos side to side:
  9031. @example
  9032. ffmpeg -i left.avi -i right.avi -filter_complex "
  9033. nullsrc=size=200x100 [background];
  9034. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  9035. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  9036. [background][left] overlay=shortest=1 [background+left];
  9037. [background+left][right] overlay=shortest=1:x=100 [left+right]
  9038. "
  9039. @end example
  9040. @item
  9041. Mask 10-20 seconds of a video by applying the delogo filter to a section
  9042. @example
  9043. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  9044. -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]'
  9045. masked.avi
  9046. @end example
  9047. @item
  9048. Chain several overlays in cascade:
  9049. @example
  9050. nullsrc=s=200x200 [bg];
  9051. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  9052. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  9053. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  9054. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  9055. [in3] null, [mid2] overlay=100:100 [out0]
  9056. @end example
  9057. @end itemize
  9058. @section owdenoise
  9059. Apply Overcomplete Wavelet denoiser.
  9060. The filter accepts the following options:
  9061. @table @option
  9062. @item depth
  9063. Set depth.
  9064. Larger depth values will denoise lower frequency components more, but
  9065. slow down filtering.
  9066. Must be an int in the range 8-16, default is @code{8}.
  9067. @item luma_strength, ls
  9068. Set luma strength.
  9069. Must be a double value in the range 0-1000, default is @code{1.0}.
  9070. @item chroma_strength, cs
  9071. Set chroma strength.
  9072. Must be a double value in the range 0-1000, default is @code{1.0}.
  9073. @end table
  9074. @anchor{pad}
  9075. @section pad
  9076. Add paddings to the input image, and place the original input at the
  9077. provided @var{x}, @var{y} coordinates.
  9078. It accepts the following parameters:
  9079. @table @option
  9080. @item width, w
  9081. @item height, h
  9082. Specify an expression for the size of the output image with the
  9083. paddings added. If the value for @var{width} or @var{height} is 0, the
  9084. corresponding input size is used for the output.
  9085. The @var{width} expression can reference the value set by the
  9086. @var{height} expression, and vice versa.
  9087. The default value of @var{width} and @var{height} is 0.
  9088. @item x
  9089. @item y
  9090. Specify the offsets to place the input image at within the padded area,
  9091. with respect to the top/left border of the output image.
  9092. The @var{x} expression can reference the value set by the @var{y}
  9093. expression, and vice versa.
  9094. The default value of @var{x} and @var{y} is 0.
  9095. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  9096. so the input image is centered on the padded area.
  9097. @item color
  9098. Specify the color of the padded area. For the syntax of this option,
  9099. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  9100. manual,ffmpeg-utils}.
  9101. The default value of @var{color} is "black".
  9102. @item eval
  9103. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  9104. It accepts the following values:
  9105. @table @samp
  9106. @item init
  9107. Only evaluate expressions once during the filter initialization or when
  9108. a command is processed.
  9109. @item frame
  9110. Evaluate expressions for each incoming frame.
  9111. @end table
  9112. Default value is @samp{init}.
  9113. @item aspect
  9114. Pad to aspect instead to a resolution.
  9115. @end table
  9116. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  9117. options are expressions containing the following constants:
  9118. @table @option
  9119. @item in_w
  9120. @item in_h
  9121. The input video width and height.
  9122. @item iw
  9123. @item ih
  9124. These are the same as @var{in_w} and @var{in_h}.
  9125. @item out_w
  9126. @item out_h
  9127. The output width and height (the size of the padded area), as
  9128. specified by the @var{width} and @var{height} expressions.
  9129. @item ow
  9130. @item oh
  9131. These are the same as @var{out_w} and @var{out_h}.
  9132. @item x
  9133. @item y
  9134. The x and y offsets as specified by the @var{x} and @var{y}
  9135. expressions, or NAN if not yet specified.
  9136. @item a
  9137. same as @var{iw} / @var{ih}
  9138. @item sar
  9139. input sample aspect ratio
  9140. @item dar
  9141. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  9142. @item hsub
  9143. @item vsub
  9144. The horizontal and vertical chroma subsample values. For example for the
  9145. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9146. @end table
  9147. @subsection Examples
  9148. @itemize
  9149. @item
  9150. Add paddings with the color "violet" to the input video. The output video
  9151. size is 640x480, and the top-left corner of the input video is placed at
  9152. column 0, row 40
  9153. @example
  9154. pad=640:480:0:40:violet
  9155. @end example
  9156. The example above is equivalent to the following command:
  9157. @example
  9158. pad=width=640:height=480:x=0:y=40:color=violet
  9159. @end example
  9160. @item
  9161. Pad the input to get an output with dimensions increased by 3/2,
  9162. and put the input video at the center of the padded area:
  9163. @example
  9164. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  9165. @end example
  9166. @item
  9167. Pad the input to get a squared output with size equal to the maximum
  9168. value between the input width and height, and put the input video at
  9169. the center of the padded area:
  9170. @example
  9171. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  9172. @end example
  9173. @item
  9174. Pad the input to get a final w/h ratio of 16:9:
  9175. @example
  9176. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  9177. @end example
  9178. @item
  9179. In case of anamorphic video, in order to set the output display aspect
  9180. correctly, it is necessary to use @var{sar} in the expression,
  9181. according to the relation:
  9182. @example
  9183. (ih * X / ih) * sar = output_dar
  9184. X = output_dar / sar
  9185. @end example
  9186. Thus the previous example needs to be modified to:
  9187. @example
  9188. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  9189. @end example
  9190. @item
  9191. Double the output size and put the input video in the bottom-right
  9192. corner of the output padded area:
  9193. @example
  9194. pad="2*iw:2*ih:ow-iw:oh-ih"
  9195. @end example
  9196. @end itemize
  9197. @anchor{palettegen}
  9198. @section palettegen
  9199. Generate one palette for a whole video stream.
  9200. It accepts the following options:
  9201. @table @option
  9202. @item max_colors
  9203. Set the maximum number of colors to quantize in the palette.
  9204. Note: the palette will still contain 256 colors; the unused palette entries
  9205. will be black.
  9206. @item reserve_transparent
  9207. Create a palette of 255 colors maximum and reserve the last one for
  9208. transparency. Reserving the transparency color is useful for GIF optimization.
  9209. If not set, the maximum of colors in the palette will be 256. You probably want
  9210. to disable this option for a standalone image.
  9211. Set by default.
  9212. @item transparency_color
  9213. Set the color that will be used as background for transparency.
  9214. @item stats_mode
  9215. Set statistics mode.
  9216. It accepts the following values:
  9217. @table @samp
  9218. @item full
  9219. Compute full frame histograms.
  9220. @item diff
  9221. Compute histograms only for the part that differs from previous frame. This
  9222. might be relevant to give more importance to the moving part of your input if
  9223. the background is static.
  9224. @item single
  9225. Compute new histogram for each frame.
  9226. @end table
  9227. Default value is @var{full}.
  9228. @end table
  9229. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  9230. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  9231. color quantization of the palette. This information is also visible at
  9232. @var{info} logging level.
  9233. @subsection Examples
  9234. @itemize
  9235. @item
  9236. Generate a representative palette of a given video using @command{ffmpeg}:
  9237. @example
  9238. ffmpeg -i input.mkv -vf palettegen palette.png
  9239. @end example
  9240. @end itemize
  9241. @section paletteuse
  9242. Use a palette to downsample an input video stream.
  9243. The filter takes two inputs: one video stream and a palette. The palette must
  9244. be a 256 pixels image.
  9245. It accepts the following options:
  9246. @table @option
  9247. @item dither
  9248. Select dithering mode. Available algorithms are:
  9249. @table @samp
  9250. @item bayer
  9251. Ordered 8x8 bayer dithering (deterministic)
  9252. @item heckbert
  9253. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  9254. Note: this dithering is sometimes considered "wrong" and is included as a
  9255. reference.
  9256. @item floyd_steinberg
  9257. Floyd and Steingberg dithering (error diffusion)
  9258. @item sierra2
  9259. Frankie Sierra dithering v2 (error diffusion)
  9260. @item sierra2_4a
  9261. Frankie Sierra dithering v2 "Lite" (error diffusion)
  9262. @end table
  9263. Default is @var{sierra2_4a}.
  9264. @item bayer_scale
  9265. When @var{bayer} dithering is selected, this option defines the scale of the
  9266. pattern (how much the crosshatch pattern is visible). A low value means more
  9267. visible pattern for less banding, and higher value means less visible pattern
  9268. at the cost of more banding.
  9269. The option must be an integer value in the range [0,5]. Default is @var{2}.
  9270. @item diff_mode
  9271. If set, define the zone to process
  9272. @table @samp
  9273. @item rectangle
  9274. Only the changing rectangle will be reprocessed. This is similar to GIF
  9275. cropping/offsetting compression mechanism. This option can be useful for speed
  9276. if only a part of the image is changing, and has use cases such as limiting the
  9277. scope of the error diffusal @option{dither} to the rectangle that bounds the
  9278. moving scene (it leads to more deterministic output if the scene doesn't change
  9279. much, and as a result less moving noise and better GIF compression).
  9280. @end table
  9281. Default is @var{none}.
  9282. @item new
  9283. Take new palette for each output frame.
  9284. @item alpha_threshold
  9285. Sets the alpha threshold for transparency. Alpha values above this threshold
  9286. will be treated as completely opaque, and values below this threshold will be
  9287. treated as completely transparent.
  9288. The option must be an integer value in the range [0,255]. Default is @var{128}.
  9289. @end table
  9290. @subsection Examples
  9291. @itemize
  9292. @item
  9293. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  9294. using @command{ffmpeg}:
  9295. @example
  9296. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  9297. @end example
  9298. @end itemize
  9299. @section perspective
  9300. Correct perspective of video not recorded perpendicular to the screen.
  9301. A description of the accepted parameters follows.
  9302. @table @option
  9303. @item x0
  9304. @item y0
  9305. @item x1
  9306. @item y1
  9307. @item x2
  9308. @item y2
  9309. @item x3
  9310. @item y3
  9311. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  9312. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  9313. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  9314. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  9315. then the corners of the source will be sent to the specified coordinates.
  9316. The expressions can use the following variables:
  9317. @table @option
  9318. @item W
  9319. @item H
  9320. the width and height of video frame.
  9321. @item in
  9322. Input frame count.
  9323. @item on
  9324. Output frame count.
  9325. @end table
  9326. @item interpolation
  9327. Set interpolation for perspective correction.
  9328. It accepts the following values:
  9329. @table @samp
  9330. @item linear
  9331. @item cubic
  9332. @end table
  9333. Default value is @samp{linear}.
  9334. @item sense
  9335. Set interpretation of coordinate options.
  9336. It accepts the following values:
  9337. @table @samp
  9338. @item 0, source
  9339. Send point in the source specified by the given coordinates to
  9340. the corners of the destination.
  9341. @item 1, destination
  9342. Send the corners of the source to the point in the destination specified
  9343. by the given coordinates.
  9344. Default value is @samp{source}.
  9345. @end table
  9346. @item eval
  9347. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  9348. It accepts the following values:
  9349. @table @samp
  9350. @item init
  9351. only evaluate expressions once during the filter initialization or
  9352. when a command is processed
  9353. @item frame
  9354. evaluate expressions for each incoming frame
  9355. @end table
  9356. Default value is @samp{init}.
  9357. @end table
  9358. @section phase
  9359. Delay interlaced video by one field time so that the field order changes.
  9360. The intended use is to fix PAL movies that have been captured with the
  9361. opposite field order to the film-to-video transfer.
  9362. A description of the accepted parameters follows.
  9363. @table @option
  9364. @item mode
  9365. Set phase mode.
  9366. It accepts the following values:
  9367. @table @samp
  9368. @item t
  9369. Capture field order top-first, transfer bottom-first.
  9370. Filter will delay the bottom field.
  9371. @item b
  9372. Capture field order bottom-first, transfer top-first.
  9373. Filter will delay the top field.
  9374. @item p
  9375. Capture and transfer with the same field order. This mode only exists
  9376. for the documentation of the other options to refer to, but if you
  9377. actually select it, the filter will faithfully do nothing.
  9378. @item a
  9379. Capture field order determined automatically by field flags, transfer
  9380. opposite.
  9381. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  9382. basis using field flags. If no field information is available,
  9383. then this works just like @samp{u}.
  9384. @item u
  9385. Capture unknown or varying, transfer opposite.
  9386. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  9387. analyzing the images and selecting the alternative that produces best
  9388. match between the fields.
  9389. @item T
  9390. Capture top-first, transfer unknown or varying.
  9391. Filter selects among @samp{t} and @samp{p} using image analysis.
  9392. @item B
  9393. Capture bottom-first, transfer unknown or varying.
  9394. Filter selects among @samp{b} and @samp{p} using image analysis.
  9395. @item A
  9396. Capture determined by field flags, transfer unknown or varying.
  9397. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  9398. image analysis. If no field information is available, then this works just
  9399. like @samp{U}. This is the default mode.
  9400. @item U
  9401. Both capture and transfer unknown or varying.
  9402. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  9403. @end table
  9404. @end table
  9405. @section pixdesctest
  9406. Pixel format descriptor test filter, mainly useful for internal
  9407. testing. The output video should be equal to the input video.
  9408. For example:
  9409. @example
  9410. format=monow, pixdesctest
  9411. @end example
  9412. can be used to test the monowhite pixel format descriptor definition.
  9413. @section pixscope
  9414. Display sample values of color channels. Mainly useful for checking color
  9415. and levels. Minimum supported resolution is 640x480.
  9416. The filters accept the following options:
  9417. @table @option
  9418. @item x
  9419. Set scope X position, relative offset on X axis.
  9420. @item y
  9421. Set scope Y position, relative offset on Y axis.
  9422. @item w
  9423. Set scope width.
  9424. @item h
  9425. Set scope height.
  9426. @item o
  9427. Set window opacity. This window also holds statistics about pixel area.
  9428. @item wx
  9429. Set window X position, relative offset on X axis.
  9430. @item wy
  9431. Set window Y position, relative offset on Y axis.
  9432. @end table
  9433. @section pp
  9434. Enable the specified chain of postprocessing subfilters using libpostproc. This
  9435. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  9436. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  9437. Each subfilter and some options have a short and a long name that can be used
  9438. interchangeably, i.e. dr/dering are the same.
  9439. The filters accept the following options:
  9440. @table @option
  9441. @item subfilters
  9442. Set postprocessing subfilters string.
  9443. @end table
  9444. All subfilters share common options to determine their scope:
  9445. @table @option
  9446. @item a/autoq
  9447. Honor the quality commands for this subfilter.
  9448. @item c/chrom
  9449. Do chrominance filtering, too (default).
  9450. @item y/nochrom
  9451. Do luminance filtering only (no chrominance).
  9452. @item n/noluma
  9453. Do chrominance filtering only (no luminance).
  9454. @end table
  9455. These options can be appended after the subfilter name, separated by a '|'.
  9456. Available subfilters are:
  9457. @table @option
  9458. @item hb/hdeblock[|difference[|flatness]]
  9459. Horizontal deblocking filter
  9460. @table @option
  9461. @item difference
  9462. Difference factor where higher values mean more deblocking (default: @code{32}).
  9463. @item flatness
  9464. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9465. @end table
  9466. @item vb/vdeblock[|difference[|flatness]]
  9467. Vertical deblocking filter
  9468. @table @option
  9469. @item difference
  9470. Difference factor where higher values mean more deblocking (default: @code{32}).
  9471. @item flatness
  9472. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9473. @end table
  9474. @item ha/hadeblock[|difference[|flatness]]
  9475. Accurate horizontal deblocking filter
  9476. @table @option
  9477. @item difference
  9478. Difference factor where higher values mean more deblocking (default: @code{32}).
  9479. @item flatness
  9480. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9481. @end table
  9482. @item va/vadeblock[|difference[|flatness]]
  9483. Accurate vertical deblocking filter
  9484. @table @option
  9485. @item difference
  9486. Difference factor where higher values mean more deblocking (default: @code{32}).
  9487. @item flatness
  9488. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9489. @end table
  9490. @end table
  9491. The horizontal and vertical deblocking filters share the difference and
  9492. flatness values so you cannot set different horizontal and vertical
  9493. thresholds.
  9494. @table @option
  9495. @item h1/x1hdeblock
  9496. Experimental horizontal deblocking filter
  9497. @item v1/x1vdeblock
  9498. Experimental vertical deblocking filter
  9499. @item dr/dering
  9500. Deringing filter
  9501. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  9502. @table @option
  9503. @item threshold1
  9504. larger -> stronger filtering
  9505. @item threshold2
  9506. larger -> stronger filtering
  9507. @item threshold3
  9508. larger -> stronger filtering
  9509. @end table
  9510. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  9511. @table @option
  9512. @item f/fullyrange
  9513. Stretch luminance to @code{0-255}.
  9514. @end table
  9515. @item lb/linblenddeint
  9516. Linear blend deinterlacing filter that deinterlaces the given block by
  9517. filtering all lines with a @code{(1 2 1)} filter.
  9518. @item li/linipoldeint
  9519. Linear interpolating deinterlacing filter that deinterlaces the given block by
  9520. linearly interpolating every second line.
  9521. @item ci/cubicipoldeint
  9522. Cubic interpolating deinterlacing filter deinterlaces the given block by
  9523. cubically interpolating every second line.
  9524. @item md/mediandeint
  9525. Median deinterlacing filter that deinterlaces the given block by applying a
  9526. median filter to every second line.
  9527. @item fd/ffmpegdeint
  9528. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  9529. second line with a @code{(-1 4 2 4 -1)} filter.
  9530. @item l5/lowpass5
  9531. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  9532. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  9533. @item fq/forceQuant[|quantizer]
  9534. Overrides the quantizer table from the input with the constant quantizer you
  9535. specify.
  9536. @table @option
  9537. @item quantizer
  9538. Quantizer to use
  9539. @end table
  9540. @item de/default
  9541. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  9542. @item fa/fast
  9543. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  9544. @item ac
  9545. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  9546. @end table
  9547. @subsection Examples
  9548. @itemize
  9549. @item
  9550. Apply horizontal and vertical deblocking, deringing and automatic
  9551. brightness/contrast:
  9552. @example
  9553. pp=hb/vb/dr/al
  9554. @end example
  9555. @item
  9556. Apply default filters without brightness/contrast correction:
  9557. @example
  9558. pp=de/-al
  9559. @end example
  9560. @item
  9561. Apply default filters and temporal denoiser:
  9562. @example
  9563. pp=default/tmpnoise|1|2|3
  9564. @end example
  9565. @item
  9566. Apply deblocking on luminance only, and switch vertical deblocking on or off
  9567. automatically depending on available CPU time:
  9568. @example
  9569. pp=hb|y/vb|a
  9570. @end example
  9571. @end itemize
  9572. @section pp7
  9573. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  9574. similar to spp = 6 with 7 point DCT, where only the center sample is
  9575. used after IDCT.
  9576. The filter accepts the following options:
  9577. @table @option
  9578. @item qp
  9579. Force a constant quantization parameter. It accepts an integer in range
  9580. 0 to 63. If not set, the filter will use the QP from the video stream
  9581. (if available).
  9582. @item mode
  9583. Set thresholding mode. Available modes are:
  9584. @table @samp
  9585. @item hard
  9586. Set hard thresholding.
  9587. @item soft
  9588. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9589. @item medium
  9590. Set medium thresholding (good results, default).
  9591. @end table
  9592. @end table
  9593. @section premultiply
  9594. Apply alpha premultiply effect to input video stream using first plane
  9595. of second stream as alpha.
  9596. Both streams must have same dimensions and same pixel format.
  9597. The filter accepts the following option:
  9598. @table @option
  9599. @item planes
  9600. Set which planes will be processed, unprocessed planes will be copied.
  9601. By default value 0xf, all planes will be processed.
  9602. @item inplace
  9603. Do not require 2nd input for processing, instead use alpha plane from input stream.
  9604. @end table
  9605. @section prewitt
  9606. Apply prewitt operator to input video stream.
  9607. The filter accepts the following option:
  9608. @table @option
  9609. @item planes
  9610. Set which planes will be processed, unprocessed planes will be copied.
  9611. By default value 0xf, all planes will be processed.
  9612. @item scale
  9613. Set value which will be multiplied with filtered result.
  9614. @item delta
  9615. Set value which will be added to filtered result.
  9616. @end table
  9617. @anchor{program_opencl}
  9618. @section program_opencl
  9619. Filter video using an OpenCL program.
  9620. @table @option
  9621. @item source
  9622. OpenCL program source file.
  9623. @item kernel
  9624. Kernel name in program.
  9625. @item inputs
  9626. Number of inputs to the filter. Defaults to 1.
  9627. @item size, s
  9628. Size of output frames. Defaults to the same as the first input.
  9629. @end table
  9630. The program source file must contain a kernel function with the given name,
  9631. which will be run once for each plane of the output. Each run on a plane
  9632. gets enqueued as a separate 2D global NDRange with one work-item for each
  9633. pixel to be generated. The global ID offset for each work-item is therefore
  9634. the coordinates of a pixel in the destination image.
  9635. The kernel function needs to take the following arguments:
  9636. @itemize
  9637. @item
  9638. Destination image, @var{__write_only image2d_t}.
  9639. This image will become the output; the kernel should write all of it.
  9640. @item
  9641. Frame index, @var{unsigned int}.
  9642. This is a counter starting from zero and increasing by one for each frame.
  9643. @item
  9644. Source images, @var{__read_only image2d_t}.
  9645. These are the most recent images on each input. The kernel may read from
  9646. them to generate the output, but they can't be written to.
  9647. @end itemize
  9648. Example programs:
  9649. @itemize
  9650. @item
  9651. Copy the input to the output (output must be the same size as the input).
  9652. @verbatim
  9653. __kernel void copy(__write_only image2d_t destination,
  9654. unsigned int index,
  9655. __read_only image2d_t source)
  9656. {
  9657. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  9658. int2 location = (int2)(get_global_id(0), get_global_id(1));
  9659. float4 value = read_imagef(source, sampler, location);
  9660. write_imagef(destination, location, value);
  9661. }
  9662. @end verbatim
  9663. @item
  9664. Apply a simple transformation, rotating the input by an amount increasing
  9665. with the index counter. Pixel values are linearly interpolated by the
  9666. sampler, and the output need not have the same dimensions as the input.
  9667. @verbatim
  9668. __kernel void rotate_image(__write_only image2d_t dst,
  9669. unsigned int index,
  9670. __read_only image2d_t src)
  9671. {
  9672. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  9673. CLK_FILTER_LINEAR);
  9674. float angle = (float)index / 100.0f;
  9675. float2 dst_dim = convert_float2(get_image_dim(dst));
  9676. float2 src_dim = convert_float2(get_image_dim(src));
  9677. float2 dst_cen = dst_dim / 2.0f;
  9678. float2 src_cen = src_dim / 2.0f;
  9679. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  9680. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  9681. float2 src_pos = {
  9682. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  9683. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  9684. };
  9685. src_pos = src_pos * src_dim / dst_dim;
  9686. float2 src_loc = src_pos + src_cen;
  9687. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  9688. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  9689. write_imagef(dst, dst_loc, 0.5f);
  9690. else
  9691. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  9692. }
  9693. @end verbatim
  9694. @item
  9695. Blend two inputs together, with the amount of each input used varying
  9696. with the index counter.
  9697. @verbatim
  9698. __kernel void blend_images(__write_only image2d_t dst,
  9699. unsigned int index,
  9700. __read_only image2d_t src1,
  9701. __read_only image2d_t src2)
  9702. {
  9703. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  9704. CLK_FILTER_LINEAR);
  9705. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  9706. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  9707. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  9708. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  9709. float4 val1 = read_imagef(src1, sampler, src1_loc);
  9710. float4 val2 = read_imagef(src2, sampler, src2_loc);
  9711. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  9712. }
  9713. @end verbatim
  9714. @end itemize
  9715. @section pseudocolor
  9716. Alter frame colors in video with pseudocolors.
  9717. This filter accept the following options:
  9718. @table @option
  9719. @item c0
  9720. set pixel first component expression
  9721. @item c1
  9722. set pixel second component expression
  9723. @item c2
  9724. set pixel third component expression
  9725. @item c3
  9726. set pixel fourth component expression, corresponds to the alpha component
  9727. @item i
  9728. set component to use as base for altering colors
  9729. @end table
  9730. Each of them specifies the expression to use for computing the lookup table for
  9731. the corresponding pixel component values.
  9732. The expressions can contain the following constants and functions:
  9733. @table @option
  9734. @item w
  9735. @item h
  9736. The input width and height.
  9737. @item val
  9738. The input value for the pixel component.
  9739. @item ymin, umin, vmin, amin
  9740. The minimum allowed component value.
  9741. @item ymax, umax, vmax, amax
  9742. The maximum allowed component value.
  9743. @end table
  9744. All expressions default to "val".
  9745. @subsection Examples
  9746. @itemize
  9747. @item
  9748. Change too high luma values to gradient:
  9749. @example
  9750. pseudocolor="'if(between(val,ymax,amax),lerp(ymin,ymax,(val-ymax)/(amax-ymax)),-1):if(between(val,ymax,amax),lerp(umax,umin,(val-ymax)/(amax-ymax)),-1):if(between(val,ymax,amax),lerp(vmin,vmax,(val-ymax)/(amax-ymax)),-1):-1'"
  9751. @end example
  9752. @end itemize
  9753. @section psnr
  9754. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  9755. Ratio) between two input videos.
  9756. This filter takes in input two input videos, the first input is
  9757. considered the "main" source and is passed unchanged to the
  9758. output. The second input is used as a "reference" video for computing
  9759. the PSNR.
  9760. Both video inputs must have the same resolution and pixel format for
  9761. this filter to work correctly. Also it assumes that both inputs
  9762. have the same number of frames, which are compared one by one.
  9763. The obtained average PSNR is printed through the logging system.
  9764. The filter stores the accumulated MSE (mean squared error) of each
  9765. frame, and at the end of the processing it is averaged across all frames
  9766. equally, and the following formula is applied to obtain the PSNR:
  9767. @example
  9768. PSNR = 10*log10(MAX^2/MSE)
  9769. @end example
  9770. Where MAX is the average of the maximum values of each component of the
  9771. image.
  9772. The description of the accepted parameters follows.
  9773. @table @option
  9774. @item stats_file, f
  9775. If specified the filter will use the named file to save the PSNR of
  9776. each individual frame. When filename equals "-" the data is sent to
  9777. standard output.
  9778. @item stats_version
  9779. Specifies which version of the stats file format to use. Details of
  9780. each format are written below.
  9781. Default value is 1.
  9782. @item stats_add_max
  9783. Determines whether the max value is output to the stats log.
  9784. Default value is 0.
  9785. Requires stats_version >= 2. If this is set and stats_version < 2,
  9786. the filter will return an error.
  9787. @end table
  9788. This filter also supports the @ref{framesync} options.
  9789. The file printed if @var{stats_file} is selected, contains a sequence of
  9790. key/value pairs of the form @var{key}:@var{value} for each compared
  9791. couple of frames.
  9792. If a @var{stats_version} greater than 1 is specified, a header line precedes
  9793. the list of per-frame-pair stats, with key value pairs following the frame
  9794. format with the following parameters:
  9795. @table @option
  9796. @item psnr_log_version
  9797. The version of the log file format. Will match @var{stats_version}.
  9798. @item fields
  9799. A comma separated list of the per-frame-pair parameters included in
  9800. the log.
  9801. @end table
  9802. A description of each shown per-frame-pair parameter follows:
  9803. @table @option
  9804. @item n
  9805. sequential number of the input frame, starting from 1
  9806. @item mse_avg
  9807. Mean Square Error pixel-by-pixel average difference of the compared
  9808. frames, averaged over all the image components.
  9809. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  9810. Mean Square Error pixel-by-pixel average difference of the compared
  9811. frames for the component specified by the suffix.
  9812. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  9813. Peak Signal to Noise ratio of the compared frames for the component
  9814. specified by the suffix.
  9815. @item max_avg, max_y, max_u, max_v
  9816. Maximum allowed value for each channel, and average over all
  9817. channels.
  9818. @end table
  9819. For example:
  9820. @example
  9821. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9822. [main][ref] psnr="stats_file=stats.log" [out]
  9823. @end example
  9824. On this example the input file being processed is compared with the
  9825. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  9826. is stored in @file{stats.log}.
  9827. @anchor{pullup}
  9828. @section pullup
  9829. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  9830. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  9831. content.
  9832. The pullup filter is designed to take advantage of future context in making
  9833. its decisions. This filter is stateless in the sense that it does not lock
  9834. onto a pattern to follow, but it instead looks forward to the following
  9835. fields in order to identify matches and rebuild progressive frames.
  9836. To produce content with an even framerate, insert the fps filter after
  9837. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  9838. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  9839. The filter accepts the following options:
  9840. @table @option
  9841. @item jl
  9842. @item jr
  9843. @item jt
  9844. @item jb
  9845. These options set the amount of "junk" to ignore at the left, right, top, and
  9846. bottom of the image, respectively. Left and right are in units of 8 pixels,
  9847. while top and bottom are in units of 2 lines.
  9848. The default is 8 pixels on each side.
  9849. @item sb
  9850. Set the strict breaks. Setting this option to 1 will reduce the chances of
  9851. filter generating an occasional mismatched frame, but it may also cause an
  9852. excessive number of frames to be dropped during high motion sequences.
  9853. Conversely, setting it to -1 will make filter match fields more easily.
  9854. This may help processing of video where there is slight blurring between
  9855. the fields, but may also cause there to be interlaced frames in the output.
  9856. Default value is @code{0}.
  9857. @item mp
  9858. Set the metric plane to use. It accepts the following values:
  9859. @table @samp
  9860. @item l
  9861. Use luma plane.
  9862. @item u
  9863. Use chroma blue plane.
  9864. @item v
  9865. Use chroma red plane.
  9866. @end table
  9867. This option may be set to use chroma plane instead of the default luma plane
  9868. for doing filter's computations. This may improve accuracy on very clean
  9869. source material, but more likely will decrease accuracy, especially if there
  9870. is chroma noise (rainbow effect) or any grayscale video.
  9871. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  9872. load and make pullup usable in realtime on slow machines.
  9873. @end table
  9874. For best results (without duplicated frames in the output file) it is
  9875. necessary to change the output frame rate. For example, to inverse
  9876. telecine NTSC input:
  9877. @example
  9878. ffmpeg -i input -vf pullup -r 24000/1001 ...
  9879. @end example
  9880. @section qp
  9881. Change video quantization parameters (QP).
  9882. The filter accepts the following option:
  9883. @table @option
  9884. @item qp
  9885. Set expression for quantization parameter.
  9886. @end table
  9887. The expression is evaluated through the eval API and can contain, among others,
  9888. the following constants:
  9889. @table @var
  9890. @item known
  9891. 1 if index is not 129, 0 otherwise.
  9892. @item qp
  9893. Sequential index starting from -129 to 128.
  9894. @end table
  9895. @subsection Examples
  9896. @itemize
  9897. @item
  9898. Some equation like:
  9899. @example
  9900. qp=2+2*sin(PI*qp)
  9901. @end example
  9902. @end itemize
  9903. @section random
  9904. Flush video frames from internal cache of frames into a random order.
  9905. No frame is discarded.
  9906. Inspired by @ref{frei0r} nervous filter.
  9907. @table @option
  9908. @item frames
  9909. Set size in number of frames of internal cache, in range from @code{2} to
  9910. @code{512}. Default is @code{30}.
  9911. @item seed
  9912. Set seed for random number generator, must be an integer included between
  9913. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  9914. less than @code{0}, the filter will try to use a good random seed on a
  9915. best effort basis.
  9916. @end table
  9917. @section readeia608
  9918. Read closed captioning (EIA-608) information from the top lines of a video frame.
  9919. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  9920. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  9921. with EIA-608 data (starting from 0). A description of each metadata value follows:
  9922. @table @option
  9923. @item lavfi.readeia608.X.cc
  9924. The two bytes stored as EIA-608 data (printed in hexadecimal).
  9925. @item lavfi.readeia608.X.line
  9926. The number of the line on which the EIA-608 data was identified and read.
  9927. @end table
  9928. This filter accepts the following options:
  9929. @table @option
  9930. @item scan_min
  9931. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  9932. @item scan_max
  9933. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  9934. @item mac
  9935. Set minimal acceptable amplitude change for sync codes detection.
  9936. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  9937. @item spw
  9938. Set the ratio of width reserved for sync code detection.
  9939. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  9940. @item mhd
  9941. Set the max peaks height difference for sync code detection.
  9942. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9943. @item mpd
  9944. Set max peaks period difference for sync code detection.
  9945. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9946. @item msd
  9947. Set the first two max start code bits differences.
  9948. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  9949. @item bhd
  9950. Set the minimum ratio of bits height compared to 3rd start code bit.
  9951. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  9952. @item th_w
  9953. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  9954. @item th_b
  9955. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  9956. @item chp
  9957. Enable checking the parity bit. In the event of a parity error, the filter will output
  9958. @code{0x00} for that character. Default is false.
  9959. @end table
  9960. @subsection Examples
  9961. @itemize
  9962. @item
  9963. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  9964. @example
  9965. ffprobe -f lavfi -i movie=captioned_video.mov,readeia608 -show_entries frame=pkt_pts_time:frame_tags=lavfi.readeia608.0.cc,lavfi.readeia608.1.cc -of csv
  9966. @end example
  9967. @end itemize
  9968. @section readvitc
  9969. Read vertical interval timecode (VITC) information from the top lines of a
  9970. video frame.
  9971. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  9972. timecode value, if a valid timecode has been detected. Further metadata key
  9973. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  9974. timecode data has been found or not.
  9975. This filter accepts the following options:
  9976. @table @option
  9977. @item scan_max
  9978. Set the maximum number of lines to scan for VITC data. If the value is set to
  9979. @code{-1} the full video frame is scanned. Default is @code{45}.
  9980. @item thr_b
  9981. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  9982. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  9983. @item thr_w
  9984. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  9985. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  9986. @end table
  9987. @subsection Examples
  9988. @itemize
  9989. @item
  9990. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  9991. draw @code{--:--:--:--} as a placeholder:
  9992. @example
  9993. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  9994. @end example
  9995. @end itemize
  9996. @section remap
  9997. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  9998. Destination pixel at position (X, Y) will be picked from source (x, y) position
  9999. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  10000. value for pixel will be used for destination pixel.
  10001. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  10002. will have Xmap/Ymap video stream dimensions.
  10003. Xmap and Ymap input video streams are 16bit depth, single channel.
  10004. @section removegrain
  10005. The removegrain filter is a spatial denoiser for progressive video.
  10006. @table @option
  10007. @item m0
  10008. Set mode for the first plane.
  10009. @item m1
  10010. Set mode for the second plane.
  10011. @item m2
  10012. Set mode for the third plane.
  10013. @item m3
  10014. Set mode for the fourth plane.
  10015. @end table
  10016. Range of mode is from 0 to 24. Description of each mode follows:
  10017. @table @var
  10018. @item 0
  10019. Leave input plane unchanged. Default.
  10020. @item 1
  10021. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  10022. @item 2
  10023. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  10024. @item 3
  10025. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  10026. @item 4
  10027. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  10028. This is equivalent to a median filter.
  10029. @item 5
  10030. Line-sensitive clipping giving the minimal change.
  10031. @item 6
  10032. Line-sensitive clipping, intermediate.
  10033. @item 7
  10034. Line-sensitive clipping, intermediate.
  10035. @item 8
  10036. Line-sensitive clipping, intermediate.
  10037. @item 9
  10038. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  10039. @item 10
  10040. Replaces the target pixel with the closest neighbour.
  10041. @item 11
  10042. [1 2 1] horizontal and vertical kernel blur.
  10043. @item 12
  10044. Same as mode 11.
  10045. @item 13
  10046. Bob mode, interpolates top field from the line where the neighbours
  10047. pixels are the closest.
  10048. @item 14
  10049. Bob mode, interpolates bottom field from the line where the neighbours
  10050. pixels are the closest.
  10051. @item 15
  10052. Bob mode, interpolates top field. Same as 13 but with a more complicated
  10053. interpolation formula.
  10054. @item 16
  10055. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  10056. interpolation formula.
  10057. @item 17
  10058. Clips the pixel with the minimum and maximum of respectively the maximum and
  10059. minimum of each pair of opposite neighbour pixels.
  10060. @item 18
  10061. Line-sensitive clipping using opposite neighbours whose greatest distance from
  10062. the current pixel is minimal.
  10063. @item 19
  10064. Replaces the pixel with the average of its 8 neighbours.
  10065. @item 20
  10066. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  10067. @item 21
  10068. Clips pixels using the averages of opposite neighbour.
  10069. @item 22
  10070. Same as mode 21 but simpler and faster.
  10071. @item 23
  10072. Small edge and halo removal, but reputed useless.
  10073. @item 24
  10074. Similar as 23.
  10075. @end table
  10076. @section removelogo
  10077. Suppress a TV station logo, using an image file to determine which
  10078. pixels comprise the logo. It works by filling in the pixels that
  10079. comprise the logo with neighboring pixels.
  10080. The filter accepts the following options:
  10081. @table @option
  10082. @item filename, f
  10083. Set the filter bitmap file, which can be any image format supported by
  10084. libavformat. The width and height of the image file must match those of the
  10085. video stream being processed.
  10086. @end table
  10087. Pixels in the provided bitmap image with a value of zero are not
  10088. considered part of the logo, non-zero pixels are considered part of
  10089. the logo. If you use white (255) for the logo and black (0) for the
  10090. rest, you will be safe. For making the filter bitmap, it is
  10091. recommended to take a screen capture of a black frame with the logo
  10092. visible, and then using a threshold filter followed by the erode
  10093. filter once or twice.
  10094. If needed, little splotches can be fixed manually. Remember that if
  10095. logo pixels are not covered, the filter quality will be much
  10096. reduced. Marking too many pixels as part of the logo does not hurt as
  10097. much, but it will increase the amount of blurring needed to cover over
  10098. the image and will destroy more information than necessary, and extra
  10099. pixels will slow things down on a large logo.
  10100. @section repeatfields
  10101. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  10102. fields based on its value.
  10103. @section reverse
  10104. Reverse a video clip.
  10105. Warning: This filter requires memory to buffer the entire clip, so trimming
  10106. is suggested.
  10107. @subsection Examples
  10108. @itemize
  10109. @item
  10110. Take the first 5 seconds of a clip, and reverse it.
  10111. @example
  10112. trim=end=5,reverse
  10113. @end example
  10114. @end itemize
  10115. @section roberts
  10116. Apply roberts cross operator to input video stream.
  10117. The filter accepts the following option:
  10118. @table @option
  10119. @item planes
  10120. Set which planes will be processed, unprocessed planes will be copied.
  10121. By default value 0xf, all planes will be processed.
  10122. @item scale
  10123. Set value which will be multiplied with filtered result.
  10124. @item delta
  10125. Set value which will be added to filtered result.
  10126. @end table
  10127. @section rotate
  10128. Rotate video by an arbitrary angle expressed in radians.
  10129. The filter accepts the following options:
  10130. A description of the optional parameters follows.
  10131. @table @option
  10132. @item angle, a
  10133. Set an expression for the angle by which to rotate the input video
  10134. clockwise, expressed as a number of radians. A negative value will
  10135. result in a counter-clockwise rotation. By default it is set to "0".
  10136. This expression is evaluated for each frame.
  10137. @item out_w, ow
  10138. Set the output width expression, default value is "iw".
  10139. This expression is evaluated just once during configuration.
  10140. @item out_h, oh
  10141. Set the output height expression, default value is "ih".
  10142. This expression is evaluated just once during configuration.
  10143. @item bilinear
  10144. Enable bilinear interpolation if set to 1, a value of 0 disables
  10145. it. Default value is 1.
  10146. @item fillcolor, c
  10147. Set the color used to fill the output area not covered by the rotated
  10148. image. For the general syntax of this option, check the
  10149. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10150. If the special value "none" is selected then no
  10151. background is printed (useful for example if the background is never shown).
  10152. Default value is "black".
  10153. @end table
  10154. The expressions for the angle and the output size can contain the
  10155. following constants and functions:
  10156. @table @option
  10157. @item n
  10158. sequential number of the input frame, starting from 0. It is always NAN
  10159. before the first frame is filtered.
  10160. @item t
  10161. time in seconds of the input frame, it is set to 0 when the filter is
  10162. configured. It is always NAN before the first frame is filtered.
  10163. @item hsub
  10164. @item vsub
  10165. horizontal and vertical chroma subsample values. For example for the
  10166. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10167. @item in_w, iw
  10168. @item in_h, ih
  10169. the input video width and height
  10170. @item out_w, ow
  10171. @item out_h, oh
  10172. the output width and height, that is the size of the padded area as
  10173. specified by the @var{width} and @var{height} expressions
  10174. @item rotw(a)
  10175. @item roth(a)
  10176. the minimal width/height required for completely containing the input
  10177. video rotated by @var{a} radians.
  10178. These are only available when computing the @option{out_w} and
  10179. @option{out_h} expressions.
  10180. @end table
  10181. @subsection Examples
  10182. @itemize
  10183. @item
  10184. Rotate the input by PI/6 radians clockwise:
  10185. @example
  10186. rotate=PI/6
  10187. @end example
  10188. @item
  10189. Rotate the input by PI/6 radians counter-clockwise:
  10190. @example
  10191. rotate=-PI/6
  10192. @end example
  10193. @item
  10194. Rotate the input by 45 degrees clockwise:
  10195. @example
  10196. rotate=45*PI/180
  10197. @end example
  10198. @item
  10199. Apply a constant rotation with period T, starting from an angle of PI/3:
  10200. @example
  10201. rotate=PI/3+2*PI*t/T
  10202. @end example
  10203. @item
  10204. Make the input video rotation oscillating with a period of T
  10205. seconds and an amplitude of A radians:
  10206. @example
  10207. rotate=A*sin(2*PI/T*t)
  10208. @end example
  10209. @item
  10210. Rotate the video, output size is chosen so that the whole rotating
  10211. input video is always completely contained in the output:
  10212. @example
  10213. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  10214. @end example
  10215. @item
  10216. Rotate the video, reduce the output size so that no background is ever
  10217. shown:
  10218. @example
  10219. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  10220. @end example
  10221. @end itemize
  10222. @subsection Commands
  10223. The filter supports the following commands:
  10224. @table @option
  10225. @item a, angle
  10226. Set the angle expression.
  10227. The command accepts the same syntax of the corresponding option.
  10228. If the specified expression is not valid, it is kept at its current
  10229. value.
  10230. @end table
  10231. @section sab
  10232. Apply Shape Adaptive Blur.
  10233. The filter accepts the following options:
  10234. @table @option
  10235. @item luma_radius, lr
  10236. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  10237. value is 1.0. A greater value will result in a more blurred image, and
  10238. in slower processing.
  10239. @item luma_pre_filter_radius, lpfr
  10240. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  10241. value is 1.0.
  10242. @item luma_strength, ls
  10243. Set luma maximum difference between pixels to still be considered, must
  10244. be a value in the 0.1-100.0 range, default value is 1.0.
  10245. @item chroma_radius, cr
  10246. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  10247. greater value will result in a more blurred image, and in slower
  10248. processing.
  10249. @item chroma_pre_filter_radius, cpfr
  10250. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  10251. @item chroma_strength, cs
  10252. Set chroma maximum difference between pixels to still be considered,
  10253. must be a value in the -0.9-100.0 range.
  10254. @end table
  10255. Each chroma option value, if not explicitly specified, is set to the
  10256. corresponding luma option value.
  10257. @anchor{scale}
  10258. @section scale
  10259. Scale (resize) the input video, using the libswscale library.
  10260. The scale filter forces the output display aspect ratio to be the same
  10261. of the input, by changing the output sample aspect ratio.
  10262. If the input image format is different from the format requested by
  10263. the next filter, the scale filter will convert the input to the
  10264. requested format.
  10265. @subsection Options
  10266. The filter accepts the following options, or any of the options
  10267. supported by the libswscale scaler.
  10268. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  10269. the complete list of scaler options.
  10270. @table @option
  10271. @item width, w
  10272. @item height, h
  10273. Set the output video dimension expression. Default value is the input
  10274. dimension.
  10275. If the @var{width} or @var{w} value is 0, the input width is used for
  10276. the output. If the @var{height} or @var{h} value is 0, the input height
  10277. is used for the output.
  10278. If one and only one of the values is -n with n >= 1, the scale filter
  10279. will use a value that maintains the aspect ratio of the input image,
  10280. calculated from the other specified dimension. After that it will,
  10281. however, make sure that the calculated dimension is divisible by n and
  10282. adjust the value if necessary.
  10283. If both values are -n with n >= 1, the behavior will be identical to
  10284. both values being set to 0 as previously detailed.
  10285. See below for the list of accepted constants for use in the dimension
  10286. expression.
  10287. @item eval
  10288. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  10289. @table @samp
  10290. @item init
  10291. Only evaluate expressions once during the filter initialization or when a command is processed.
  10292. @item frame
  10293. Evaluate expressions for each incoming frame.
  10294. @end table
  10295. Default value is @samp{init}.
  10296. @item interl
  10297. Set the interlacing mode. It accepts the following values:
  10298. @table @samp
  10299. @item 1
  10300. Force interlaced aware scaling.
  10301. @item 0
  10302. Do not apply interlaced scaling.
  10303. @item -1
  10304. Select interlaced aware scaling depending on whether the source frames
  10305. are flagged as interlaced or not.
  10306. @end table
  10307. Default value is @samp{0}.
  10308. @item flags
  10309. Set libswscale scaling flags. See
  10310. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10311. complete list of values. If not explicitly specified the filter applies
  10312. the default flags.
  10313. @item param0, param1
  10314. Set libswscale input parameters for scaling algorithms that need them. See
  10315. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10316. complete documentation. If not explicitly specified the filter applies
  10317. empty parameters.
  10318. @item size, s
  10319. Set the video size. For the syntax of this option, check the
  10320. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10321. @item in_color_matrix
  10322. @item out_color_matrix
  10323. Set in/output YCbCr color space type.
  10324. This allows the autodetected value to be overridden as well as allows forcing
  10325. a specific value used for the output and encoder.
  10326. If not specified, the color space type depends on the pixel format.
  10327. Possible values:
  10328. @table @samp
  10329. @item auto
  10330. Choose automatically.
  10331. @item bt709
  10332. Format conforming to International Telecommunication Union (ITU)
  10333. Recommendation BT.709.
  10334. @item fcc
  10335. Set color space conforming to the United States Federal Communications
  10336. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  10337. @item bt601
  10338. Set color space conforming to:
  10339. @itemize
  10340. @item
  10341. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  10342. @item
  10343. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  10344. @item
  10345. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  10346. @end itemize
  10347. @item smpte240m
  10348. Set color space conforming to SMPTE ST 240:1999.
  10349. @end table
  10350. @item in_range
  10351. @item out_range
  10352. Set in/output YCbCr sample range.
  10353. This allows the autodetected value to be overridden as well as allows forcing
  10354. a specific value used for the output and encoder. If not specified, the
  10355. range depends on the pixel format. Possible values:
  10356. @table @samp
  10357. @item auto/unknown
  10358. Choose automatically.
  10359. @item jpeg/full/pc
  10360. Set full range (0-255 in case of 8-bit luma).
  10361. @item mpeg/limited/tv
  10362. Set "MPEG" range (16-235 in case of 8-bit luma).
  10363. @end table
  10364. @item force_original_aspect_ratio
  10365. Enable decreasing or increasing output video width or height if necessary to
  10366. keep the original aspect ratio. Possible values:
  10367. @table @samp
  10368. @item disable
  10369. Scale the video as specified and disable this feature.
  10370. @item decrease
  10371. The output video dimensions will automatically be decreased if needed.
  10372. @item increase
  10373. The output video dimensions will automatically be increased if needed.
  10374. @end table
  10375. One useful instance of this option is that when you know a specific device's
  10376. maximum allowed resolution, you can use this to limit the output video to
  10377. that, while retaining the aspect ratio. For example, device A allows
  10378. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  10379. decrease) and specifying 1280x720 to the command line makes the output
  10380. 1280x533.
  10381. Please note that this is a different thing than specifying -1 for @option{w}
  10382. or @option{h}, you still need to specify the output resolution for this option
  10383. to work.
  10384. @end table
  10385. The values of the @option{w} and @option{h} options are expressions
  10386. containing the following constants:
  10387. @table @var
  10388. @item in_w
  10389. @item in_h
  10390. The input width and height
  10391. @item iw
  10392. @item ih
  10393. These are the same as @var{in_w} and @var{in_h}.
  10394. @item out_w
  10395. @item out_h
  10396. The output (scaled) width and height
  10397. @item ow
  10398. @item oh
  10399. These are the same as @var{out_w} and @var{out_h}
  10400. @item a
  10401. The same as @var{iw} / @var{ih}
  10402. @item sar
  10403. input sample aspect ratio
  10404. @item dar
  10405. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  10406. @item hsub
  10407. @item vsub
  10408. horizontal and vertical input chroma subsample values. For example for the
  10409. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10410. @item ohsub
  10411. @item ovsub
  10412. horizontal and vertical output chroma subsample values. For example for the
  10413. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10414. @end table
  10415. @subsection Examples
  10416. @itemize
  10417. @item
  10418. Scale the input video to a size of 200x100
  10419. @example
  10420. scale=w=200:h=100
  10421. @end example
  10422. This is equivalent to:
  10423. @example
  10424. scale=200:100
  10425. @end example
  10426. or:
  10427. @example
  10428. scale=200x100
  10429. @end example
  10430. @item
  10431. Specify a size abbreviation for the output size:
  10432. @example
  10433. scale=qcif
  10434. @end example
  10435. which can also be written as:
  10436. @example
  10437. scale=size=qcif
  10438. @end example
  10439. @item
  10440. Scale the input to 2x:
  10441. @example
  10442. scale=w=2*iw:h=2*ih
  10443. @end example
  10444. @item
  10445. The above is the same as:
  10446. @example
  10447. scale=2*in_w:2*in_h
  10448. @end example
  10449. @item
  10450. Scale the input to 2x with forced interlaced scaling:
  10451. @example
  10452. scale=2*iw:2*ih:interl=1
  10453. @end example
  10454. @item
  10455. Scale the input to half size:
  10456. @example
  10457. scale=w=iw/2:h=ih/2
  10458. @end example
  10459. @item
  10460. Increase the width, and set the height to the same size:
  10461. @example
  10462. scale=3/2*iw:ow
  10463. @end example
  10464. @item
  10465. Seek Greek harmony:
  10466. @example
  10467. scale=iw:1/PHI*iw
  10468. scale=ih*PHI:ih
  10469. @end example
  10470. @item
  10471. Increase the height, and set the width to 3/2 of the height:
  10472. @example
  10473. scale=w=3/2*oh:h=3/5*ih
  10474. @end example
  10475. @item
  10476. Increase the size, making the size a multiple of the chroma
  10477. subsample values:
  10478. @example
  10479. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  10480. @end example
  10481. @item
  10482. Increase the width to a maximum of 500 pixels,
  10483. keeping the same aspect ratio as the input:
  10484. @example
  10485. scale=w='min(500\, iw*3/2):h=-1'
  10486. @end example
  10487. @item
  10488. Make pixels square by combining scale and setsar:
  10489. @example
  10490. scale='trunc(ih*dar):ih',setsar=1/1
  10491. @end example
  10492. @item
  10493. Make pixels square by combining scale and setsar,
  10494. making sure the resulting resolution is even (required by some codecs):
  10495. @example
  10496. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  10497. @end example
  10498. @end itemize
  10499. @subsection Commands
  10500. This filter supports the following commands:
  10501. @table @option
  10502. @item width, w
  10503. @item height, h
  10504. Set the output video dimension expression.
  10505. The command accepts the same syntax of the corresponding option.
  10506. If the specified expression is not valid, it is kept at its current
  10507. value.
  10508. @end table
  10509. @section scale_npp
  10510. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  10511. format conversion on CUDA video frames. Setting the output width and height
  10512. works in the same way as for the @var{scale} filter.
  10513. The following additional options are accepted:
  10514. @table @option
  10515. @item format
  10516. The pixel format of the output CUDA frames. If set to the string "same" (the
  10517. default), the input format will be kept. Note that automatic format negotiation
  10518. and conversion is not yet supported for hardware frames
  10519. @item interp_algo
  10520. The interpolation algorithm used for resizing. One of the following:
  10521. @table @option
  10522. @item nn
  10523. Nearest neighbour.
  10524. @item linear
  10525. @item cubic
  10526. @item cubic2p_bspline
  10527. 2-parameter cubic (B=1, C=0)
  10528. @item cubic2p_catmullrom
  10529. 2-parameter cubic (B=0, C=1/2)
  10530. @item cubic2p_b05c03
  10531. 2-parameter cubic (B=1/2, C=3/10)
  10532. @item super
  10533. Supersampling
  10534. @item lanczos
  10535. @end table
  10536. @end table
  10537. @section scale2ref
  10538. Scale (resize) the input video, based on a reference video.
  10539. See the scale filter for available options, scale2ref supports the same but
  10540. uses the reference video instead of the main input as basis. scale2ref also
  10541. supports the following additional constants for the @option{w} and
  10542. @option{h} options:
  10543. @table @var
  10544. @item main_w
  10545. @item main_h
  10546. The main input video's width and height
  10547. @item main_a
  10548. The same as @var{main_w} / @var{main_h}
  10549. @item main_sar
  10550. The main input video's sample aspect ratio
  10551. @item main_dar, mdar
  10552. The main input video's display aspect ratio. Calculated from
  10553. @code{(main_w / main_h) * main_sar}.
  10554. @item main_hsub
  10555. @item main_vsub
  10556. The main input video's horizontal and vertical chroma subsample values.
  10557. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  10558. is 1.
  10559. @end table
  10560. @subsection Examples
  10561. @itemize
  10562. @item
  10563. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  10564. @example
  10565. 'scale2ref[b][a];[a][b]overlay'
  10566. @end example
  10567. @end itemize
  10568. @anchor{selectivecolor}
  10569. @section selectivecolor
  10570. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  10571. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  10572. by the "purity" of the color (that is, how saturated it already is).
  10573. This filter is similar to the Adobe Photoshop Selective Color tool.
  10574. The filter accepts the following options:
  10575. @table @option
  10576. @item correction_method
  10577. Select color correction method.
  10578. Available values are:
  10579. @table @samp
  10580. @item absolute
  10581. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  10582. component value).
  10583. @item relative
  10584. Specified adjustments are relative to the original component value.
  10585. @end table
  10586. Default is @code{absolute}.
  10587. @item reds
  10588. Adjustments for red pixels (pixels where the red component is the maximum)
  10589. @item yellows
  10590. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  10591. @item greens
  10592. Adjustments for green pixels (pixels where the green component is the maximum)
  10593. @item cyans
  10594. Adjustments for cyan pixels (pixels where the red component is the minimum)
  10595. @item blues
  10596. Adjustments for blue pixels (pixels where the blue component is the maximum)
  10597. @item magentas
  10598. Adjustments for magenta pixels (pixels where the green component is the minimum)
  10599. @item whites
  10600. Adjustments for white pixels (pixels where all components are greater than 128)
  10601. @item neutrals
  10602. Adjustments for all pixels except pure black and pure white
  10603. @item blacks
  10604. Adjustments for black pixels (pixels where all components are lesser than 128)
  10605. @item psfile
  10606. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  10607. @end table
  10608. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  10609. 4 space separated floating point adjustment values in the [-1,1] range,
  10610. respectively to adjust the amount of cyan, magenta, yellow and black for the
  10611. pixels of its range.
  10612. @subsection Examples
  10613. @itemize
  10614. @item
  10615. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  10616. increase magenta by 27% in blue areas:
  10617. @example
  10618. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  10619. @end example
  10620. @item
  10621. Use a Photoshop selective color preset:
  10622. @example
  10623. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  10624. @end example
  10625. @end itemize
  10626. @anchor{separatefields}
  10627. @section separatefields
  10628. The @code{separatefields} takes a frame-based video input and splits
  10629. each frame into its components fields, producing a new half height clip
  10630. with twice the frame rate and twice the frame count.
  10631. This filter use field-dominance information in frame to decide which
  10632. of each pair of fields to place first in the output.
  10633. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  10634. @section setdar, setsar
  10635. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  10636. output video.
  10637. This is done by changing the specified Sample (aka Pixel) Aspect
  10638. Ratio, according to the following equation:
  10639. @example
  10640. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  10641. @end example
  10642. Keep in mind that the @code{setdar} filter does not modify the pixel
  10643. dimensions of the video frame. Also, the display aspect ratio set by
  10644. this filter may be changed by later filters in the filterchain,
  10645. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  10646. applied.
  10647. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  10648. the filter output video.
  10649. Note that as a consequence of the application of this filter, the
  10650. output display aspect ratio will change according to the equation
  10651. above.
  10652. Keep in mind that the sample aspect ratio set by the @code{setsar}
  10653. filter may be changed by later filters in the filterchain, e.g. if
  10654. another "setsar" or a "setdar" filter is applied.
  10655. It accepts the following parameters:
  10656. @table @option
  10657. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  10658. Set the aspect ratio used by the filter.
  10659. The parameter can be a floating point number string, an expression, or
  10660. a string of the form @var{num}:@var{den}, where @var{num} and
  10661. @var{den} are the numerator and denominator of the aspect ratio. If
  10662. the parameter is not specified, it is assumed the value "0".
  10663. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  10664. should be escaped.
  10665. @item max
  10666. Set the maximum integer value to use for expressing numerator and
  10667. denominator when reducing the expressed aspect ratio to a rational.
  10668. Default value is @code{100}.
  10669. @end table
  10670. The parameter @var{sar} is an expression containing
  10671. the following constants:
  10672. @table @option
  10673. @item E, PI, PHI
  10674. These are approximated values for the mathematical constants e
  10675. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  10676. @item w, h
  10677. The input width and height.
  10678. @item a
  10679. These are the same as @var{w} / @var{h}.
  10680. @item sar
  10681. The input sample aspect ratio.
  10682. @item dar
  10683. The input display aspect ratio. It is the same as
  10684. (@var{w} / @var{h}) * @var{sar}.
  10685. @item hsub, vsub
  10686. Horizontal and vertical chroma subsample values. For example, for the
  10687. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10688. @end table
  10689. @subsection Examples
  10690. @itemize
  10691. @item
  10692. To change the display aspect ratio to 16:9, specify one of the following:
  10693. @example
  10694. setdar=dar=1.77777
  10695. setdar=dar=16/9
  10696. @end example
  10697. @item
  10698. To change the sample aspect ratio to 10:11, specify:
  10699. @example
  10700. setsar=sar=10/11
  10701. @end example
  10702. @item
  10703. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  10704. 1000 in the aspect ratio reduction, use the command:
  10705. @example
  10706. setdar=ratio=16/9:max=1000
  10707. @end example
  10708. @end itemize
  10709. @anchor{setfield}
  10710. @section setfield
  10711. Force field for the output video frame.
  10712. The @code{setfield} filter marks the interlace type field for the
  10713. output frames. It does not change the input frame, but only sets the
  10714. corresponding property, which affects how the frame is treated by
  10715. following filters (e.g. @code{fieldorder} or @code{yadif}).
  10716. The filter accepts the following options:
  10717. @table @option
  10718. @item mode
  10719. Available values are:
  10720. @table @samp
  10721. @item auto
  10722. Keep the same field property.
  10723. @item bff
  10724. Mark the frame as bottom-field-first.
  10725. @item tff
  10726. Mark the frame as top-field-first.
  10727. @item prog
  10728. Mark the frame as progressive.
  10729. @end table
  10730. @end table
  10731. @section showinfo
  10732. Show a line containing various information for each input video frame.
  10733. The input video is not modified.
  10734. The shown line contains a sequence of key/value pairs of the form
  10735. @var{key}:@var{value}.
  10736. The following values are shown in the output:
  10737. @table @option
  10738. @item n
  10739. The (sequential) number of the input frame, starting from 0.
  10740. @item pts
  10741. The Presentation TimeStamp of the input frame, expressed as a number of
  10742. time base units. The time base unit depends on the filter input pad.
  10743. @item pts_time
  10744. The Presentation TimeStamp of the input frame, expressed as a number of
  10745. seconds.
  10746. @item pos
  10747. The position of the frame in the input stream, or -1 if this information is
  10748. unavailable and/or meaningless (for example in case of synthetic video).
  10749. @item fmt
  10750. The pixel format name.
  10751. @item sar
  10752. The sample aspect ratio of the input frame, expressed in the form
  10753. @var{num}/@var{den}.
  10754. @item s
  10755. The size of the input frame. For the syntax of this option, check the
  10756. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10757. @item i
  10758. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  10759. for bottom field first).
  10760. @item iskey
  10761. This is 1 if the frame is a key frame, 0 otherwise.
  10762. @item type
  10763. The picture type of the input frame ("I" for an I-frame, "P" for a
  10764. P-frame, "B" for a B-frame, or "?" for an unknown type).
  10765. Also refer to the documentation of the @code{AVPictureType} enum and of
  10766. the @code{av_get_picture_type_char} function defined in
  10767. @file{libavutil/avutil.h}.
  10768. @item checksum
  10769. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  10770. @item plane_checksum
  10771. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  10772. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  10773. @end table
  10774. @section showpalette
  10775. Displays the 256 colors palette of each frame. This filter is only relevant for
  10776. @var{pal8} pixel format frames.
  10777. It accepts the following option:
  10778. @table @option
  10779. @item s
  10780. Set the size of the box used to represent one palette color entry. Default is
  10781. @code{30} (for a @code{30x30} pixel box).
  10782. @end table
  10783. @section shuffleframes
  10784. Reorder and/or duplicate and/or drop video frames.
  10785. It accepts the following parameters:
  10786. @table @option
  10787. @item mapping
  10788. Set the destination indexes of input frames.
  10789. This is space or '|' separated list of indexes that maps input frames to output
  10790. frames. Number of indexes also sets maximal value that each index may have.
  10791. '-1' index have special meaning and that is to drop frame.
  10792. @end table
  10793. The first frame has the index 0. The default is to keep the input unchanged.
  10794. @subsection Examples
  10795. @itemize
  10796. @item
  10797. Swap second and third frame of every three frames of the input:
  10798. @example
  10799. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  10800. @end example
  10801. @item
  10802. Swap 10th and 1st frame of every ten frames of the input:
  10803. @example
  10804. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  10805. @end example
  10806. @end itemize
  10807. @section shuffleplanes
  10808. Reorder and/or duplicate video planes.
  10809. It accepts the following parameters:
  10810. @table @option
  10811. @item map0
  10812. The index of the input plane to be used as the first output plane.
  10813. @item map1
  10814. The index of the input plane to be used as the second output plane.
  10815. @item map2
  10816. The index of the input plane to be used as the third output plane.
  10817. @item map3
  10818. The index of the input plane to be used as the fourth output plane.
  10819. @end table
  10820. The first plane has the index 0. The default is to keep the input unchanged.
  10821. @subsection Examples
  10822. @itemize
  10823. @item
  10824. Swap the second and third planes of the input:
  10825. @example
  10826. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  10827. @end example
  10828. @end itemize
  10829. @anchor{signalstats}
  10830. @section signalstats
  10831. Evaluate various visual metrics that assist in determining issues associated
  10832. with the digitization of analog video media.
  10833. By default the filter will log these metadata values:
  10834. @table @option
  10835. @item YMIN
  10836. Display the minimal Y value contained within the input frame. Expressed in
  10837. range of [0-255].
  10838. @item YLOW
  10839. Display the Y value at the 10% percentile within the input frame. Expressed in
  10840. range of [0-255].
  10841. @item YAVG
  10842. Display the average Y value within the input frame. Expressed in range of
  10843. [0-255].
  10844. @item YHIGH
  10845. Display the Y value at the 90% percentile within the input frame. Expressed in
  10846. range of [0-255].
  10847. @item YMAX
  10848. Display the maximum Y value contained within the input frame. Expressed in
  10849. range of [0-255].
  10850. @item UMIN
  10851. Display the minimal U value contained within the input frame. Expressed in
  10852. range of [0-255].
  10853. @item ULOW
  10854. Display the U value at the 10% percentile within the input frame. Expressed in
  10855. range of [0-255].
  10856. @item UAVG
  10857. Display the average U value within the input frame. Expressed in range of
  10858. [0-255].
  10859. @item UHIGH
  10860. Display the U value at the 90% percentile within the input frame. Expressed in
  10861. range of [0-255].
  10862. @item UMAX
  10863. Display the maximum U value contained within the input frame. Expressed in
  10864. range of [0-255].
  10865. @item VMIN
  10866. Display the minimal V value contained within the input frame. Expressed in
  10867. range of [0-255].
  10868. @item VLOW
  10869. Display the V value at the 10% percentile within the input frame. Expressed in
  10870. range of [0-255].
  10871. @item VAVG
  10872. Display the average V value within the input frame. Expressed in range of
  10873. [0-255].
  10874. @item VHIGH
  10875. Display the V value at the 90% percentile within the input frame. Expressed in
  10876. range of [0-255].
  10877. @item VMAX
  10878. Display the maximum V value contained within the input frame. Expressed in
  10879. range of [0-255].
  10880. @item SATMIN
  10881. Display the minimal saturation value contained within the input frame.
  10882. Expressed in range of [0-~181.02].
  10883. @item SATLOW
  10884. Display the saturation value at the 10% percentile within the input frame.
  10885. Expressed in range of [0-~181.02].
  10886. @item SATAVG
  10887. Display the average saturation value within the input frame. Expressed in range
  10888. of [0-~181.02].
  10889. @item SATHIGH
  10890. Display the saturation value at the 90% percentile within the input frame.
  10891. Expressed in range of [0-~181.02].
  10892. @item SATMAX
  10893. Display the maximum saturation value contained within the input frame.
  10894. Expressed in range of [0-~181.02].
  10895. @item HUEMED
  10896. Display the median value for hue within the input frame. Expressed in range of
  10897. [0-360].
  10898. @item HUEAVG
  10899. Display the average value for hue within the input frame. Expressed in range of
  10900. [0-360].
  10901. @item YDIF
  10902. Display the average of sample value difference between all values of the Y
  10903. plane in the current frame and corresponding values of the previous input frame.
  10904. Expressed in range of [0-255].
  10905. @item UDIF
  10906. Display the average of sample value difference between all values of the U
  10907. plane in the current frame and corresponding values of the previous input frame.
  10908. Expressed in range of [0-255].
  10909. @item VDIF
  10910. Display the average of sample value difference between all values of the V
  10911. plane in the current frame and corresponding values of the previous input frame.
  10912. Expressed in range of [0-255].
  10913. @item YBITDEPTH
  10914. Display bit depth of Y plane in current frame.
  10915. Expressed in range of [0-16].
  10916. @item UBITDEPTH
  10917. Display bit depth of U plane in current frame.
  10918. Expressed in range of [0-16].
  10919. @item VBITDEPTH
  10920. Display bit depth of V plane in current frame.
  10921. Expressed in range of [0-16].
  10922. @end table
  10923. The filter accepts the following options:
  10924. @table @option
  10925. @item stat
  10926. @item out
  10927. @option{stat} specify an additional form of image analysis.
  10928. @option{out} output video with the specified type of pixel highlighted.
  10929. Both options accept the following values:
  10930. @table @samp
  10931. @item tout
  10932. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  10933. unlike the neighboring pixels of the same field. Examples of temporal outliers
  10934. include the results of video dropouts, head clogs, or tape tracking issues.
  10935. @item vrep
  10936. Identify @var{vertical line repetition}. Vertical line repetition includes
  10937. similar rows of pixels within a frame. In born-digital video vertical line
  10938. repetition is common, but this pattern is uncommon in video digitized from an
  10939. analog source. When it occurs in video that results from the digitization of an
  10940. analog source it can indicate concealment from a dropout compensator.
  10941. @item brng
  10942. Identify pixels that fall outside of legal broadcast range.
  10943. @end table
  10944. @item color, c
  10945. Set the highlight color for the @option{out} option. The default color is
  10946. yellow.
  10947. @end table
  10948. @subsection Examples
  10949. @itemize
  10950. @item
  10951. Output data of various video metrics:
  10952. @example
  10953. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  10954. @end example
  10955. @item
  10956. Output specific data about the minimum and maximum values of the Y plane per frame:
  10957. @example
  10958. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  10959. @end example
  10960. @item
  10961. Playback video while highlighting pixels that are outside of broadcast range in red.
  10962. @example
  10963. ffplay example.mov -vf signalstats="out=brng:color=red"
  10964. @end example
  10965. @item
  10966. Playback video with signalstats metadata drawn over the frame.
  10967. @example
  10968. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  10969. @end example
  10970. The contents of signalstat_drawtext.txt used in the command are:
  10971. @example
  10972. time %@{pts:hms@}
  10973. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  10974. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  10975. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  10976. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  10977. @end example
  10978. @end itemize
  10979. @anchor{signature}
  10980. @section signature
  10981. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  10982. input. In this case the matching between the inputs can be calculated additionally.
  10983. The filter always passes through the first input. The signature of each stream can
  10984. be written into a file.
  10985. It accepts the following options:
  10986. @table @option
  10987. @item detectmode
  10988. Enable or disable the matching process.
  10989. Available values are:
  10990. @table @samp
  10991. @item off
  10992. Disable the calculation of a matching (default).
  10993. @item full
  10994. Calculate the matching for the whole video and output whether the whole video
  10995. matches or only parts.
  10996. @item fast
  10997. Calculate only until a matching is found or the video ends. Should be faster in
  10998. some cases.
  10999. @end table
  11000. @item nb_inputs
  11001. Set the number of inputs. The option value must be a non negative integer.
  11002. Default value is 1.
  11003. @item filename
  11004. Set the path to which the output is written. If there is more than one input,
  11005. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  11006. integer), that will be replaced with the input number. If no filename is
  11007. specified, no output will be written. This is the default.
  11008. @item format
  11009. Choose the output format.
  11010. Available values are:
  11011. @table @samp
  11012. @item binary
  11013. Use the specified binary representation (default).
  11014. @item xml
  11015. Use the specified xml representation.
  11016. @end table
  11017. @item th_d
  11018. Set threshold to detect one word as similar. The option value must be an integer
  11019. greater than zero. The default value is 9000.
  11020. @item th_dc
  11021. Set threshold to detect all words as similar. The option value must be an integer
  11022. greater than zero. The default value is 60000.
  11023. @item th_xh
  11024. Set threshold to detect frames as similar. The option value must be an integer
  11025. greater than zero. The default value is 116.
  11026. @item th_di
  11027. Set the minimum length of a sequence in frames to recognize it as matching
  11028. sequence. The option value must be a non negative integer value.
  11029. The default value is 0.
  11030. @item th_it
  11031. Set the minimum relation, that matching frames to all frames must have.
  11032. The option value must be a double value between 0 and 1. The default value is 0.5.
  11033. @end table
  11034. @subsection Examples
  11035. @itemize
  11036. @item
  11037. To calculate the signature of an input video and store it in signature.bin:
  11038. @example
  11039. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  11040. @end example
  11041. @item
  11042. To detect whether two videos match and store the signatures in XML format in
  11043. signature0.xml and signature1.xml:
  11044. @example
  11045. ffmpeg -i input1.mkv -i input2.mkv -filter_complex "[0:v][1:v] signature=nb_inputs=2:detectmode=full:format=xml:filename=signature%d.xml" -map :v -f null -
  11046. @end example
  11047. @end itemize
  11048. @anchor{smartblur}
  11049. @section smartblur
  11050. Blur the input video without impacting the outlines.
  11051. It accepts the following options:
  11052. @table @option
  11053. @item luma_radius, lr
  11054. Set the luma radius. The option value must be a float number in
  11055. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11056. used to blur the image (slower if larger). Default value is 1.0.
  11057. @item luma_strength, ls
  11058. Set the luma strength. The option value must be a float number
  11059. in the range [-1.0,1.0] that configures the blurring. A value included
  11060. in [0.0,1.0] will blur the image whereas a value included in
  11061. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  11062. @item luma_threshold, lt
  11063. Set the luma threshold used as a coefficient to determine
  11064. whether a pixel should be blurred or not. The option value must be an
  11065. integer in the range [-30,30]. A value of 0 will filter all the image,
  11066. a value included in [0,30] will filter flat areas and a value included
  11067. in [-30,0] will filter edges. Default value is 0.
  11068. @item chroma_radius, cr
  11069. Set the chroma radius. The option value must be a float number in
  11070. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11071. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  11072. @item chroma_strength, cs
  11073. Set the chroma strength. The option value must be a float number
  11074. in the range [-1.0,1.0] that configures the blurring. A value included
  11075. in [0.0,1.0] will blur the image whereas a value included in
  11076. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  11077. @item chroma_threshold, ct
  11078. Set the chroma threshold used as a coefficient to determine
  11079. whether a pixel should be blurred or not. The option value must be an
  11080. integer in the range [-30,30]. A value of 0 will filter all the image,
  11081. a value included in [0,30] will filter flat areas and a value included
  11082. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  11083. @end table
  11084. If a chroma option is not explicitly set, the corresponding luma value
  11085. is set.
  11086. @section ssim
  11087. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  11088. This filter takes in input two input videos, the first input is
  11089. considered the "main" source and is passed unchanged to the
  11090. output. The second input is used as a "reference" video for computing
  11091. the SSIM.
  11092. Both video inputs must have the same resolution and pixel format for
  11093. this filter to work correctly. Also it assumes that both inputs
  11094. have the same number of frames, which are compared one by one.
  11095. The filter stores the calculated SSIM of each frame.
  11096. The description of the accepted parameters follows.
  11097. @table @option
  11098. @item stats_file, f
  11099. If specified the filter will use the named file to save the SSIM of
  11100. each individual frame. When filename equals "-" the data is sent to
  11101. standard output.
  11102. @end table
  11103. The file printed if @var{stats_file} is selected, contains a sequence of
  11104. key/value pairs of the form @var{key}:@var{value} for each compared
  11105. couple of frames.
  11106. A description of each shown parameter follows:
  11107. @table @option
  11108. @item n
  11109. sequential number of the input frame, starting from 1
  11110. @item Y, U, V, R, G, B
  11111. SSIM of the compared frames for the component specified by the suffix.
  11112. @item All
  11113. SSIM of the compared frames for the whole frame.
  11114. @item dB
  11115. Same as above but in dB representation.
  11116. @end table
  11117. This filter also supports the @ref{framesync} options.
  11118. For example:
  11119. @example
  11120. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11121. [main][ref] ssim="stats_file=stats.log" [out]
  11122. @end example
  11123. On this example the input file being processed is compared with the
  11124. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  11125. is stored in @file{stats.log}.
  11126. Another example with both psnr and ssim at same time:
  11127. @example
  11128. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  11129. @end example
  11130. @section stereo3d
  11131. Convert between different stereoscopic image formats.
  11132. The filters accept the following options:
  11133. @table @option
  11134. @item in
  11135. Set stereoscopic image format of input.
  11136. Available values for input image formats are:
  11137. @table @samp
  11138. @item sbsl
  11139. side by side parallel (left eye left, right eye right)
  11140. @item sbsr
  11141. side by side crosseye (right eye left, left eye right)
  11142. @item sbs2l
  11143. side by side parallel with half width resolution
  11144. (left eye left, right eye right)
  11145. @item sbs2r
  11146. side by side crosseye with half width resolution
  11147. (right eye left, left eye right)
  11148. @item abl
  11149. above-below (left eye above, right eye below)
  11150. @item abr
  11151. above-below (right eye above, left eye below)
  11152. @item ab2l
  11153. above-below with half height resolution
  11154. (left eye above, right eye below)
  11155. @item ab2r
  11156. above-below with half height resolution
  11157. (right eye above, left eye below)
  11158. @item al
  11159. alternating frames (left eye first, right eye second)
  11160. @item ar
  11161. alternating frames (right eye first, left eye second)
  11162. @item irl
  11163. interleaved rows (left eye has top row, right eye starts on next row)
  11164. @item irr
  11165. interleaved rows (right eye has top row, left eye starts on next row)
  11166. @item icl
  11167. interleaved columns, left eye first
  11168. @item icr
  11169. interleaved columns, right eye first
  11170. Default value is @samp{sbsl}.
  11171. @end table
  11172. @item out
  11173. Set stereoscopic image format of output.
  11174. @table @samp
  11175. @item sbsl
  11176. side by side parallel (left eye left, right eye right)
  11177. @item sbsr
  11178. side by side crosseye (right eye left, left eye right)
  11179. @item sbs2l
  11180. side by side parallel with half width resolution
  11181. (left eye left, right eye right)
  11182. @item sbs2r
  11183. side by side crosseye with half width resolution
  11184. (right eye left, left eye right)
  11185. @item abl
  11186. above-below (left eye above, right eye below)
  11187. @item abr
  11188. above-below (right eye above, left eye below)
  11189. @item ab2l
  11190. above-below with half height resolution
  11191. (left eye above, right eye below)
  11192. @item ab2r
  11193. above-below with half height resolution
  11194. (right eye above, left eye below)
  11195. @item al
  11196. alternating frames (left eye first, right eye second)
  11197. @item ar
  11198. alternating frames (right eye first, left eye second)
  11199. @item irl
  11200. interleaved rows (left eye has top row, right eye starts on next row)
  11201. @item irr
  11202. interleaved rows (right eye has top row, left eye starts on next row)
  11203. @item arbg
  11204. anaglyph red/blue gray
  11205. (red filter on left eye, blue filter on right eye)
  11206. @item argg
  11207. anaglyph red/green gray
  11208. (red filter on left eye, green filter on right eye)
  11209. @item arcg
  11210. anaglyph red/cyan gray
  11211. (red filter on left eye, cyan filter on right eye)
  11212. @item arch
  11213. anaglyph red/cyan half colored
  11214. (red filter on left eye, cyan filter on right eye)
  11215. @item arcc
  11216. anaglyph red/cyan color
  11217. (red filter on left eye, cyan filter on right eye)
  11218. @item arcd
  11219. anaglyph red/cyan color optimized with the least squares projection of dubois
  11220. (red filter on left eye, cyan filter on right eye)
  11221. @item agmg
  11222. anaglyph green/magenta gray
  11223. (green filter on left eye, magenta filter on right eye)
  11224. @item agmh
  11225. anaglyph green/magenta half colored
  11226. (green filter on left eye, magenta filter on right eye)
  11227. @item agmc
  11228. anaglyph green/magenta colored
  11229. (green filter on left eye, magenta filter on right eye)
  11230. @item agmd
  11231. anaglyph green/magenta color optimized with the least squares projection of dubois
  11232. (green filter on left eye, magenta filter on right eye)
  11233. @item aybg
  11234. anaglyph yellow/blue gray
  11235. (yellow filter on left eye, blue filter on right eye)
  11236. @item aybh
  11237. anaglyph yellow/blue half colored
  11238. (yellow filter on left eye, blue filter on right eye)
  11239. @item aybc
  11240. anaglyph yellow/blue colored
  11241. (yellow filter on left eye, blue filter on right eye)
  11242. @item aybd
  11243. anaglyph yellow/blue color optimized with the least squares projection of dubois
  11244. (yellow filter on left eye, blue filter on right eye)
  11245. @item ml
  11246. mono output (left eye only)
  11247. @item mr
  11248. mono output (right eye only)
  11249. @item chl
  11250. checkerboard, left eye first
  11251. @item chr
  11252. checkerboard, right eye first
  11253. @item icl
  11254. interleaved columns, left eye first
  11255. @item icr
  11256. interleaved columns, right eye first
  11257. @item hdmi
  11258. HDMI frame pack
  11259. @end table
  11260. Default value is @samp{arcd}.
  11261. @end table
  11262. @subsection Examples
  11263. @itemize
  11264. @item
  11265. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  11266. @example
  11267. stereo3d=sbsl:aybd
  11268. @end example
  11269. @item
  11270. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  11271. @example
  11272. stereo3d=abl:sbsr
  11273. @end example
  11274. @end itemize
  11275. @section streamselect, astreamselect
  11276. Select video or audio streams.
  11277. The filter accepts the following options:
  11278. @table @option
  11279. @item inputs
  11280. Set number of inputs. Default is 2.
  11281. @item map
  11282. Set input indexes to remap to outputs.
  11283. @end table
  11284. @subsection Commands
  11285. The @code{streamselect} and @code{astreamselect} filter supports the following
  11286. commands:
  11287. @table @option
  11288. @item map
  11289. Set input indexes to remap to outputs.
  11290. @end table
  11291. @subsection Examples
  11292. @itemize
  11293. @item
  11294. Select first 5 seconds 1st stream and rest of time 2nd stream:
  11295. @example
  11296. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  11297. @end example
  11298. @item
  11299. Same as above, but for audio:
  11300. @example
  11301. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  11302. @end example
  11303. @end itemize
  11304. @section sobel
  11305. Apply sobel operator to input video stream.
  11306. The filter accepts the following option:
  11307. @table @option
  11308. @item planes
  11309. Set which planes will be processed, unprocessed planes will be copied.
  11310. By default value 0xf, all planes will be processed.
  11311. @item scale
  11312. Set value which will be multiplied with filtered result.
  11313. @item delta
  11314. Set value which will be added to filtered result.
  11315. @end table
  11316. @anchor{spp}
  11317. @section spp
  11318. Apply a simple postprocessing filter that compresses and decompresses the image
  11319. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  11320. and average the results.
  11321. The filter accepts the following options:
  11322. @table @option
  11323. @item quality
  11324. Set quality. This option defines the number of levels for averaging. It accepts
  11325. an integer in the range 0-6. If set to @code{0}, the filter will have no
  11326. effect. A value of @code{6} means the higher quality. For each increment of
  11327. that value the speed drops by a factor of approximately 2. Default value is
  11328. @code{3}.
  11329. @item qp
  11330. Force a constant quantization parameter. If not set, the filter will use the QP
  11331. from the video stream (if available).
  11332. @item mode
  11333. Set thresholding mode. Available modes are:
  11334. @table @samp
  11335. @item hard
  11336. Set hard thresholding (default).
  11337. @item soft
  11338. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11339. @end table
  11340. @item use_bframe_qp
  11341. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  11342. option may cause flicker since the B-Frames have often larger QP. Default is
  11343. @code{0} (not enabled).
  11344. @end table
  11345. @anchor{subtitles}
  11346. @section subtitles
  11347. Draw subtitles on top of input video using the libass library.
  11348. To enable compilation of this filter you need to configure FFmpeg with
  11349. @code{--enable-libass}. This filter also requires a build with libavcodec and
  11350. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  11351. Alpha) subtitles format.
  11352. The filter accepts the following options:
  11353. @table @option
  11354. @item filename, f
  11355. Set the filename of the subtitle file to read. It must be specified.
  11356. @item original_size
  11357. Specify the size of the original video, the video for which the ASS file
  11358. was composed. For the syntax of this option, check the
  11359. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11360. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  11361. correctly scale the fonts if the aspect ratio has been changed.
  11362. @item fontsdir
  11363. Set a directory path containing fonts that can be used by the filter.
  11364. These fonts will be used in addition to whatever the font provider uses.
  11365. @item alpha
  11366. Process alpha channel, by default alpha channel is untouched.
  11367. @item charenc
  11368. Set subtitles input character encoding. @code{subtitles} filter only. Only
  11369. useful if not UTF-8.
  11370. @item stream_index, si
  11371. Set subtitles stream index. @code{subtitles} filter only.
  11372. @item force_style
  11373. Override default style or script info parameters of the subtitles. It accepts a
  11374. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  11375. @end table
  11376. If the first key is not specified, it is assumed that the first value
  11377. specifies the @option{filename}.
  11378. For example, to render the file @file{sub.srt} on top of the input
  11379. video, use the command:
  11380. @example
  11381. subtitles=sub.srt
  11382. @end example
  11383. which is equivalent to:
  11384. @example
  11385. subtitles=filename=sub.srt
  11386. @end example
  11387. To render the default subtitles stream from file @file{video.mkv}, use:
  11388. @example
  11389. subtitles=video.mkv
  11390. @end example
  11391. To render the second subtitles stream from that file, use:
  11392. @example
  11393. subtitles=video.mkv:si=1
  11394. @end example
  11395. To make the subtitles stream from @file{sub.srt} appear in transparent green
  11396. @code{DejaVu Serif}, use:
  11397. @example
  11398. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  11399. @end example
  11400. @section super2xsai
  11401. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  11402. Interpolate) pixel art scaling algorithm.
  11403. Useful for enlarging pixel art images without reducing sharpness.
  11404. @section swaprect
  11405. Swap two rectangular objects in video.
  11406. This filter accepts the following options:
  11407. @table @option
  11408. @item w
  11409. Set object width.
  11410. @item h
  11411. Set object height.
  11412. @item x1
  11413. Set 1st rect x coordinate.
  11414. @item y1
  11415. Set 1st rect y coordinate.
  11416. @item x2
  11417. Set 2nd rect x coordinate.
  11418. @item y2
  11419. Set 2nd rect y coordinate.
  11420. All expressions are evaluated once for each frame.
  11421. @end table
  11422. The all options are expressions containing the following constants:
  11423. @table @option
  11424. @item w
  11425. @item h
  11426. The input width and height.
  11427. @item a
  11428. same as @var{w} / @var{h}
  11429. @item sar
  11430. input sample aspect ratio
  11431. @item dar
  11432. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  11433. @item n
  11434. The number of the input frame, starting from 0.
  11435. @item t
  11436. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  11437. @item pos
  11438. the position in the file of the input frame, NAN if unknown
  11439. @end table
  11440. @section swapuv
  11441. Swap U & V plane.
  11442. @section telecine
  11443. Apply telecine process to the video.
  11444. This filter accepts the following options:
  11445. @table @option
  11446. @item first_field
  11447. @table @samp
  11448. @item top, t
  11449. top field first
  11450. @item bottom, b
  11451. bottom field first
  11452. The default value is @code{top}.
  11453. @end table
  11454. @item pattern
  11455. A string of numbers representing the pulldown pattern you wish to apply.
  11456. The default value is @code{23}.
  11457. @end table
  11458. @example
  11459. Some typical patterns:
  11460. NTSC output (30i):
  11461. 27.5p: 32222
  11462. 24p: 23 (classic)
  11463. 24p: 2332 (preferred)
  11464. 20p: 33
  11465. 18p: 334
  11466. 16p: 3444
  11467. PAL output (25i):
  11468. 27.5p: 12222
  11469. 24p: 222222222223 ("Euro pulldown")
  11470. 16.67p: 33
  11471. 16p: 33333334
  11472. @end example
  11473. @section threshold
  11474. Apply threshold effect to video stream.
  11475. This filter needs four video streams to perform thresholding.
  11476. First stream is stream we are filtering.
  11477. Second stream is holding threshold values, third stream is holding min values,
  11478. and last, fourth stream is holding max values.
  11479. The filter accepts the following option:
  11480. @table @option
  11481. @item planes
  11482. Set which planes will be processed, unprocessed planes will be copied.
  11483. By default value 0xf, all planes will be processed.
  11484. @end table
  11485. For example if first stream pixel's component value is less then threshold value
  11486. of pixel component from 2nd threshold stream, third stream value will picked,
  11487. otherwise fourth stream pixel component value will be picked.
  11488. Using color source filter one can perform various types of thresholding:
  11489. @subsection Examples
  11490. @itemize
  11491. @item
  11492. Binary threshold, using gray color as threshold:
  11493. @example
  11494. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  11495. @end example
  11496. @item
  11497. Inverted binary threshold, using gray color as threshold:
  11498. @example
  11499. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  11500. @end example
  11501. @item
  11502. Truncate binary threshold, using gray color as threshold:
  11503. @example
  11504. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  11505. @end example
  11506. @item
  11507. Threshold to zero, using gray color as threshold:
  11508. @example
  11509. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  11510. @end example
  11511. @item
  11512. Inverted threshold to zero, using gray color as threshold:
  11513. @example
  11514. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  11515. @end example
  11516. @end itemize
  11517. @section thumbnail
  11518. Select the most representative frame in a given sequence of consecutive frames.
  11519. The filter accepts the following options:
  11520. @table @option
  11521. @item n
  11522. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  11523. will pick one of them, and then handle the next batch of @var{n} frames until
  11524. the end. Default is @code{100}.
  11525. @end table
  11526. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  11527. value will result in a higher memory usage, so a high value is not recommended.
  11528. @subsection Examples
  11529. @itemize
  11530. @item
  11531. Extract one picture each 50 frames:
  11532. @example
  11533. thumbnail=50
  11534. @end example
  11535. @item
  11536. Complete example of a thumbnail creation with @command{ffmpeg}:
  11537. @example
  11538. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  11539. @end example
  11540. @end itemize
  11541. @section tile
  11542. Tile several successive frames together.
  11543. The filter accepts the following options:
  11544. @table @option
  11545. @item layout
  11546. Set the grid size (i.e. the number of lines and columns). For the syntax of
  11547. this option, check the
  11548. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11549. @item nb_frames
  11550. Set the maximum number of frames to render in the given area. It must be less
  11551. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  11552. the area will be used.
  11553. @item margin
  11554. Set the outer border margin in pixels.
  11555. @item padding
  11556. Set the inner border thickness (i.e. the number of pixels between frames). For
  11557. more advanced padding options (such as having different values for the edges),
  11558. refer to the pad video filter.
  11559. @item color
  11560. Specify the color of the unused area. For the syntax of this option, check the
  11561. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11562. The default value of @var{color} is "black".
  11563. @item overlap
  11564. Set the number of frames to overlap when tiling several successive frames together.
  11565. The value must be between @code{0} and @var{nb_frames - 1}.
  11566. @item init_padding
  11567. Set the number of frames to initially be empty before displaying first output frame.
  11568. This controls how soon will one get first output frame.
  11569. The value must be between @code{0} and @var{nb_frames - 1}.
  11570. @end table
  11571. @subsection Examples
  11572. @itemize
  11573. @item
  11574. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  11575. @example
  11576. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  11577. @end example
  11578. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  11579. duplicating each output frame to accommodate the originally detected frame
  11580. rate.
  11581. @item
  11582. Display @code{5} pictures in an area of @code{3x2} frames,
  11583. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  11584. mixed flat and named options:
  11585. @example
  11586. tile=3x2:nb_frames=5:padding=7:margin=2
  11587. @end example
  11588. @end itemize
  11589. @section tinterlace
  11590. Perform various types of temporal field interlacing.
  11591. Frames are counted starting from 1, so the first input frame is
  11592. considered odd.
  11593. The filter accepts the following options:
  11594. @table @option
  11595. @item mode
  11596. Specify the mode of the interlacing. This option can also be specified
  11597. as a value alone. See below for a list of values for this option.
  11598. Available values are:
  11599. @table @samp
  11600. @item merge, 0
  11601. Move odd frames into the upper field, even into the lower field,
  11602. generating a double height frame at half frame rate.
  11603. @example
  11604. ------> time
  11605. Input:
  11606. Frame 1 Frame 2 Frame 3 Frame 4
  11607. 11111 22222 33333 44444
  11608. 11111 22222 33333 44444
  11609. 11111 22222 33333 44444
  11610. 11111 22222 33333 44444
  11611. Output:
  11612. 11111 33333
  11613. 22222 44444
  11614. 11111 33333
  11615. 22222 44444
  11616. 11111 33333
  11617. 22222 44444
  11618. 11111 33333
  11619. 22222 44444
  11620. @end example
  11621. @item drop_even, 1
  11622. Only output odd frames, even frames are dropped, generating a frame with
  11623. unchanged height at half frame rate.
  11624. @example
  11625. ------> time
  11626. Input:
  11627. Frame 1 Frame 2 Frame 3 Frame 4
  11628. 11111 22222 33333 44444
  11629. 11111 22222 33333 44444
  11630. 11111 22222 33333 44444
  11631. 11111 22222 33333 44444
  11632. Output:
  11633. 11111 33333
  11634. 11111 33333
  11635. 11111 33333
  11636. 11111 33333
  11637. @end example
  11638. @item drop_odd, 2
  11639. Only output even frames, odd frames are dropped, generating a frame with
  11640. unchanged height at half frame rate.
  11641. @example
  11642. ------> time
  11643. Input:
  11644. Frame 1 Frame 2 Frame 3 Frame 4
  11645. 11111 22222 33333 44444
  11646. 11111 22222 33333 44444
  11647. 11111 22222 33333 44444
  11648. 11111 22222 33333 44444
  11649. Output:
  11650. 22222 44444
  11651. 22222 44444
  11652. 22222 44444
  11653. 22222 44444
  11654. @end example
  11655. @item pad, 3
  11656. Expand each frame to full height, but pad alternate lines with black,
  11657. generating a frame with double height at the same input frame rate.
  11658. @example
  11659. ------> time
  11660. Input:
  11661. Frame 1 Frame 2 Frame 3 Frame 4
  11662. 11111 22222 33333 44444
  11663. 11111 22222 33333 44444
  11664. 11111 22222 33333 44444
  11665. 11111 22222 33333 44444
  11666. Output:
  11667. 11111 ..... 33333 .....
  11668. ..... 22222 ..... 44444
  11669. 11111 ..... 33333 .....
  11670. ..... 22222 ..... 44444
  11671. 11111 ..... 33333 .....
  11672. ..... 22222 ..... 44444
  11673. 11111 ..... 33333 .....
  11674. ..... 22222 ..... 44444
  11675. @end example
  11676. @item interleave_top, 4
  11677. Interleave the upper field from odd frames with the lower field from
  11678. even frames, generating a frame with unchanged height at half frame rate.
  11679. @example
  11680. ------> time
  11681. Input:
  11682. Frame 1 Frame 2 Frame 3 Frame 4
  11683. 11111<- 22222 33333<- 44444
  11684. 11111 22222<- 33333 44444<-
  11685. 11111<- 22222 33333<- 44444
  11686. 11111 22222<- 33333 44444<-
  11687. Output:
  11688. 11111 33333
  11689. 22222 44444
  11690. 11111 33333
  11691. 22222 44444
  11692. @end example
  11693. @item interleave_bottom, 5
  11694. Interleave the lower field from odd frames with the upper field from
  11695. even frames, generating a frame with unchanged height at half frame rate.
  11696. @example
  11697. ------> time
  11698. Input:
  11699. Frame 1 Frame 2 Frame 3 Frame 4
  11700. 11111 22222<- 33333 44444<-
  11701. 11111<- 22222 33333<- 44444
  11702. 11111 22222<- 33333 44444<-
  11703. 11111<- 22222 33333<- 44444
  11704. Output:
  11705. 22222 44444
  11706. 11111 33333
  11707. 22222 44444
  11708. 11111 33333
  11709. @end example
  11710. @item interlacex2, 6
  11711. Double frame rate with unchanged height. Frames are inserted each
  11712. containing the second temporal field from the previous input frame and
  11713. the first temporal field from the next input frame. This mode relies on
  11714. the top_field_first flag. Useful for interlaced video displays with no
  11715. field synchronisation.
  11716. @example
  11717. ------> time
  11718. Input:
  11719. Frame 1 Frame 2 Frame 3 Frame 4
  11720. 11111 22222 33333 44444
  11721. 11111 22222 33333 44444
  11722. 11111 22222 33333 44444
  11723. 11111 22222 33333 44444
  11724. Output:
  11725. 11111 22222 22222 33333 33333 44444 44444
  11726. 11111 11111 22222 22222 33333 33333 44444
  11727. 11111 22222 22222 33333 33333 44444 44444
  11728. 11111 11111 22222 22222 33333 33333 44444
  11729. @end example
  11730. @item mergex2, 7
  11731. Move odd frames into the upper field, even into the lower field,
  11732. generating a double height frame at same frame rate.
  11733. @example
  11734. ------> time
  11735. Input:
  11736. Frame 1 Frame 2 Frame 3 Frame 4
  11737. 11111 22222 33333 44444
  11738. 11111 22222 33333 44444
  11739. 11111 22222 33333 44444
  11740. 11111 22222 33333 44444
  11741. Output:
  11742. 11111 33333 33333 55555
  11743. 22222 22222 44444 44444
  11744. 11111 33333 33333 55555
  11745. 22222 22222 44444 44444
  11746. 11111 33333 33333 55555
  11747. 22222 22222 44444 44444
  11748. 11111 33333 33333 55555
  11749. 22222 22222 44444 44444
  11750. @end example
  11751. @end table
  11752. Numeric values are deprecated but are accepted for backward
  11753. compatibility reasons.
  11754. Default mode is @code{merge}.
  11755. @item flags
  11756. Specify flags influencing the filter process.
  11757. Available value for @var{flags} is:
  11758. @table @option
  11759. @item low_pass_filter, vlfp
  11760. Enable linear vertical low-pass filtering in the filter.
  11761. Vertical low-pass filtering is required when creating an interlaced
  11762. destination from a progressive source which contains high-frequency
  11763. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  11764. patterning.
  11765. @item complex_filter, cvlfp
  11766. Enable complex vertical low-pass filtering.
  11767. This will slightly less reduce interlace 'twitter' and Moire
  11768. patterning but better retain detail and subjective sharpness impression.
  11769. @end table
  11770. Vertical low-pass filtering can only be enabled for @option{mode}
  11771. @var{interleave_top} and @var{interleave_bottom}.
  11772. @end table
  11773. @section tonemap
  11774. Tone map colors from different dynamic ranges.
  11775. This filter expects data in single precision floating point, as it needs to
  11776. operate on (and can output) out-of-range values. Another filter, such as
  11777. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  11778. The tonemapping algorithms implemented only work on linear light, so input
  11779. data should be linearized beforehand (and possibly correctly tagged).
  11780. @example
  11781. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  11782. @end example
  11783. @subsection Options
  11784. The filter accepts the following options.
  11785. @table @option
  11786. @item tonemap
  11787. Set the tone map algorithm to use.
  11788. Possible values are:
  11789. @table @var
  11790. @item none
  11791. Do not apply any tone map, only desaturate overbright pixels.
  11792. @item clip
  11793. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  11794. in-range values, while distorting out-of-range values.
  11795. @item linear
  11796. Stretch the entire reference gamut to a linear multiple of the display.
  11797. @item gamma
  11798. Fit a logarithmic transfer between the tone curves.
  11799. @item reinhard
  11800. Preserve overall image brightness with a simple curve, using nonlinear
  11801. contrast, which results in flattening details and degrading color accuracy.
  11802. @item hable
  11803. Preserve both dark and bright details better than @var{reinhard}, at the cost
  11804. of slightly darkening everything. Use it when detail preservation is more
  11805. important than color and brightness accuracy.
  11806. @item mobius
  11807. Smoothly map out-of-range values, while retaining contrast and colors for
  11808. in-range material as much as possible. Use it when color accuracy is more
  11809. important than detail preservation.
  11810. @end table
  11811. Default is none.
  11812. @item param
  11813. Tune the tone mapping algorithm.
  11814. This affects the following algorithms:
  11815. @table @var
  11816. @item none
  11817. Ignored.
  11818. @item linear
  11819. Specifies the scale factor to use while stretching.
  11820. Default to 1.0.
  11821. @item gamma
  11822. Specifies the exponent of the function.
  11823. Default to 1.8.
  11824. @item clip
  11825. Specify an extra linear coefficient to multiply into the signal before clipping.
  11826. Default to 1.0.
  11827. @item reinhard
  11828. Specify the local contrast coefficient at the display peak.
  11829. Default to 0.5, which means that in-gamut values will be about half as bright
  11830. as when clipping.
  11831. @item hable
  11832. Ignored.
  11833. @item mobius
  11834. Specify the transition point from linear to mobius transform. Every value
  11835. below this point is guaranteed to be mapped 1:1. The higher the value, the
  11836. more accurate the result will be, at the cost of losing bright details.
  11837. Default to 0.3, which due to the steep initial slope still preserves in-range
  11838. colors fairly accurately.
  11839. @end table
  11840. @item desat
  11841. Apply desaturation for highlights that exceed this level of brightness. The
  11842. higher the parameter, the more color information will be preserved. This
  11843. setting helps prevent unnaturally blown-out colors for super-highlights, by
  11844. (smoothly) turning into white instead. This makes images feel more natural,
  11845. at the cost of reducing information about out-of-range colors.
  11846. The default of 2.0 is somewhat conservative and will mostly just apply to
  11847. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  11848. This option works only if the input frame has a supported color tag.
  11849. @item peak
  11850. Override signal/nominal/reference peak with this value. Useful when the
  11851. embedded peak information in display metadata is not reliable or when tone
  11852. mapping from a lower range to a higher range.
  11853. @end table
  11854. @section transpose
  11855. Transpose rows with columns in the input video and optionally flip it.
  11856. It accepts the following parameters:
  11857. @table @option
  11858. @item dir
  11859. Specify the transposition direction.
  11860. Can assume the following values:
  11861. @table @samp
  11862. @item 0, 4, cclock_flip
  11863. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  11864. @example
  11865. L.R L.l
  11866. . . -> . .
  11867. l.r R.r
  11868. @end example
  11869. @item 1, 5, clock
  11870. Rotate by 90 degrees clockwise, that is:
  11871. @example
  11872. L.R l.L
  11873. . . -> . .
  11874. l.r r.R
  11875. @end example
  11876. @item 2, 6, cclock
  11877. Rotate by 90 degrees counterclockwise, that is:
  11878. @example
  11879. L.R R.r
  11880. . . -> . .
  11881. l.r L.l
  11882. @end example
  11883. @item 3, 7, clock_flip
  11884. Rotate by 90 degrees clockwise and vertically flip, that is:
  11885. @example
  11886. L.R r.R
  11887. . . -> . .
  11888. l.r l.L
  11889. @end example
  11890. @end table
  11891. For values between 4-7, the transposition is only done if the input
  11892. video geometry is portrait and not landscape. These values are
  11893. deprecated, the @code{passthrough} option should be used instead.
  11894. Numerical values are deprecated, and should be dropped in favor of
  11895. symbolic constants.
  11896. @item passthrough
  11897. Do not apply the transposition if the input geometry matches the one
  11898. specified by the specified value. It accepts the following values:
  11899. @table @samp
  11900. @item none
  11901. Always apply transposition.
  11902. @item portrait
  11903. Preserve portrait geometry (when @var{height} >= @var{width}).
  11904. @item landscape
  11905. Preserve landscape geometry (when @var{width} >= @var{height}).
  11906. @end table
  11907. Default value is @code{none}.
  11908. @end table
  11909. For example to rotate by 90 degrees clockwise and preserve portrait
  11910. layout:
  11911. @example
  11912. transpose=dir=1:passthrough=portrait
  11913. @end example
  11914. The command above can also be specified as:
  11915. @example
  11916. transpose=1:portrait
  11917. @end example
  11918. @section trim
  11919. Trim the input so that the output contains one continuous subpart of the input.
  11920. It accepts the following parameters:
  11921. @table @option
  11922. @item start
  11923. Specify the time of the start of the kept section, i.e. the frame with the
  11924. timestamp @var{start} will be the first frame in the output.
  11925. @item end
  11926. Specify the time of the first frame that will be dropped, i.e. the frame
  11927. immediately preceding the one with the timestamp @var{end} will be the last
  11928. frame in the output.
  11929. @item start_pts
  11930. This is the same as @var{start}, except this option sets the start timestamp
  11931. in timebase units instead of seconds.
  11932. @item end_pts
  11933. This is the same as @var{end}, except this option sets the end timestamp
  11934. in timebase units instead of seconds.
  11935. @item duration
  11936. The maximum duration of the output in seconds.
  11937. @item start_frame
  11938. The number of the first frame that should be passed to the output.
  11939. @item end_frame
  11940. The number of the first frame that should be dropped.
  11941. @end table
  11942. @option{start}, @option{end}, and @option{duration} are expressed as time
  11943. duration specifications; see
  11944. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11945. for the accepted syntax.
  11946. Note that the first two sets of the start/end options and the @option{duration}
  11947. option look at the frame timestamp, while the _frame variants simply count the
  11948. frames that pass through the filter. Also note that this filter does not modify
  11949. the timestamps. If you wish for the output timestamps to start at zero, insert a
  11950. setpts filter after the trim filter.
  11951. If multiple start or end options are set, this filter tries to be greedy and
  11952. keep all the frames that match at least one of the specified constraints. To keep
  11953. only the part that matches all the constraints at once, chain multiple trim
  11954. filters.
  11955. The defaults are such that all the input is kept. So it is possible to set e.g.
  11956. just the end values to keep everything before the specified time.
  11957. Examples:
  11958. @itemize
  11959. @item
  11960. Drop everything except the second minute of input:
  11961. @example
  11962. ffmpeg -i INPUT -vf trim=60:120
  11963. @end example
  11964. @item
  11965. Keep only the first second:
  11966. @example
  11967. ffmpeg -i INPUT -vf trim=duration=1
  11968. @end example
  11969. @end itemize
  11970. @section unpremultiply
  11971. Apply alpha unpremultiply effect to input video stream using first plane
  11972. of second stream as alpha.
  11973. Both streams must have same dimensions and same pixel format.
  11974. The filter accepts the following option:
  11975. @table @option
  11976. @item planes
  11977. Set which planes will be processed, unprocessed planes will be copied.
  11978. By default value 0xf, all planes will be processed.
  11979. If the format has 1 or 2 components, then luma is bit 0.
  11980. If the format has 3 or 4 components:
  11981. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  11982. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  11983. If present, the alpha channel is always the last bit.
  11984. @item inplace
  11985. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11986. @end table
  11987. @anchor{unsharp}
  11988. @section unsharp
  11989. Sharpen or blur the input video.
  11990. It accepts the following parameters:
  11991. @table @option
  11992. @item luma_msize_x, lx
  11993. Set the luma matrix horizontal size. It must be an odd integer between
  11994. 3 and 23. The default value is 5.
  11995. @item luma_msize_y, ly
  11996. Set the luma matrix vertical size. It must be an odd integer between 3
  11997. and 23. The default value is 5.
  11998. @item luma_amount, la
  11999. Set the luma effect strength. It must be a floating point number, reasonable
  12000. values lay between -1.5 and 1.5.
  12001. Negative values will blur the input video, while positive values will
  12002. sharpen it, a value of zero will disable the effect.
  12003. Default value is 1.0.
  12004. @item chroma_msize_x, cx
  12005. Set the chroma matrix horizontal size. It must be an odd integer
  12006. between 3 and 23. The default value is 5.
  12007. @item chroma_msize_y, cy
  12008. Set the chroma matrix vertical size. It must be an odd integer
  12009. between 3 and 23. The default value is 5.
  12010. @item chroma_amount, ca
  12011. Set the chroma effect strength. It must be a floating point number, reasonable
  12012. values lay between -1.5 and 1.5.
  12013. Negative values will blur the input video, while positive values will
  12014. sharpen it, a value of zero will disable the effect.
  12015. Default value is 0.0.
  12016. @end table
  12017. All parameters are optional and default to the equivalent of the
  12018. string '5:5:1.0:5:5:0.0'.
  12019. @subsection Examples
  12020. @itemize
  12021. @item
  12022. Apply strong luma sharpen effect:
  12023. @example
  12024. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  12025. @end example
  12026. @item
  12027. Apply a strong blur of both luma and chroma parameters:
  12028. @example
  12029. unsharp=7:7:-2:7:7:-2
  12030. @end example
  12031. @end itemize
  12032. @section uspp
  12033. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  12034. the image at several (or - in the case of @option{quality} level @code{8} - all)
  12035. shifts and average the results.
  12036. The way this differs from the behavior of spp is that uspp actually encodes &
  12037. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  12038. DCT similar to MJPEG.
  12039. The filter accepts the following options:
  12040. @table @option
  12041. @item quality
  12042. Set quality. This option defines the number of levels for averaging. It accepts
  12043. an integer in the range 0-8. If set to @code{0}, the filter will have no
  12044. effect. A value of @code{8} means the higher quality. For each increment of
  12045. that value the speed drops by a factor of approximately 2. Default value is
  12046. @code{3}.
  12047. @item qp
  12048. Force a constant quantization parameter. If not set, the filter will use the QP
  12049. from the video stream (if available).
  12050. @end table
  12051. @section vaguedenoiser
  12052. Apply a wavelet based denoiser.
  12053. It transforms each frame from the video input into the wavelet domain,
  12054. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  12055. the obtained coefficients. It does an inverse wavelet transform after.
  12056. Due to wavelet properties, it should give a nice smoothed result, and
  12057. reduced noise, without blurring picture features.
  12058. This filter accepts the following options:
  12059. @table @option
  12060. @item threshold
  12061. The filtering strength. The higher, the more filtered the video will be.
  12062. Hard thresholding can use a higher threshold than soft thresholding
  12063. before the video looks overfiltered. Default value is 2.
  12064. @item method
  12065. The filtering method the filter will use.
  12066. It accepts the following values:
  12067. @table @samp
  12068. @item hard
  12069. All values under the threshold will be zeroed.
  12070. @item soft
  12071. All values under the threshold will be zeroed. All values above will be
  12072. reduced by the threshold.
  12073. @item garrote
  12074. Scales or nullifies coefficients - intermediary between (more) soft and
  12075. (less) hard thresholding.
  12076. @end table
  12077. Default is garrote.
  12078. @item nsteps
  12079. Number of times, the wavelet will decompose the picture. Picture can't
  12080. be decomposed beyond a particular point (typically, 8 for a 640x480
  12081. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  12082. @item percent
  12083. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  12084. @item planes
  12085. A list of the planes to process. By default all planes are processed.
  12086. @end table
  12087. @section vectorscope
  12088. Display 2 color component values in the two dimensional graph (which is called
  12089. a vectorscope).
  12090. This filter accepts the following options:
  12091. @table @option
  12092. @item mode, m
  12093. Set vectorscope mode.
  12094. It accepts the following values:
  12095. @table @samp
  12096. @item gray
  12097. Gray values are displayed on graph, higher brightness means more pixels have
  12098. same component color value on location in graph. This is the default mode.
  12099. @item color
  12100. Gray values are displayed on graph. Surrounding pixels values which are not
  12101. present in video frame are drawn in gradient of 2 color components which are
  12102. set by option @code{x} and @code{y}. The 3rd color component is static.
  12103. @item color2
  12104. Actual color components values present in video frame are displayed on graph.
  12105. @item color3
  12106. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  12107. on graph increases value of another color component, which is luminance by
  12108. default values of @code{x} and @code{y}.
  12109. @item color4
  12110. Actual colors present in video frame are displayed on graph. If two different
  12111. colors map to same position on graph then color with higher value of component
  12112. not present in graph is picked.
  12113. @item color5
  12114. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  12115. component picked from radial gradient.
  12116. @end table
  12117. @item x
  12118. Set which color component will be represented on X-axis. Default is @code{1}.
  12119. @item y
  12120. Set which color component will be represented on Y-axis. Default is @code{2}.
  12121. @item intensity, i
  12122. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  12123. of color component which represents frequency of (X, Y) location in graph.
  12124. @item envelope, e
  12125. @table @samp
  12126. @item none
  12127. No envelope, this is default.
  12128. @item instant
  12129. Instant envelope, even darkest single pixel will be clearly highlighted.
  12130. @item peak
  12131. Hold maximum and minimum values presented in graph over time. This way you
  12132. can still spot out of range values without constantly looking at vectorscope.
  12133. @item peak+instant
  12134. Peak and instant envelope combined together.
  12135. @end table
  12136. @item graticule, g
  12137. Set what kind of graticule to draw.
  12138. @table @samp
  12139. @item none
  12140. @item green
  12141. @item color
  12142. @end table
  12143. @item opacity, o
  12144. Set graticule opacity.
  12145. @item flags, f
  12146. Set graticule flags.
  12147. @table @samp
  12148. @item white
  12149. Draw graticule for white point.
  12150. @item black
  12151. Draw graticule for black point.
  12152. @item name
  12153. Draw color points short names.
  12154. @end table
  12155. @item bgopacity, b
  12156. Set background opacity.
  12157. @item lthreshold, l
  12158. Set low threshold for color component not represented on X or Y axis.
  12159. Values lower than this value will be ignored. Default is 0.
  12160. Note this value is multiplied with actual max possible value one pixel component
  12161. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  12162. is 0.1 * 255 = 25.
  12163. @item hthreshold, h
  12164. Set high threshold for color component not represented on X or Y axis.
  12165. Values higher than this value will be ignored. Default is 1.
  12166. Note this value is multiplied with actual max possible value one pixel component
  12167. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  12168. is 0.9 * 255 = 230.
  12169. @item colorspace, c
  12170. Set what kind of colorspace to use when drawing graticule.
  12171. @table @samp
  12172. @item auto
  12173. @item 601
  12174. @item 709
  12175. @end table
  12176. Default is auto.
  12177. @end table
  12178. @anchor{vidstabdetect}
  12179. @section vidstabdetect
  12180. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  12181. @ref{vidstabtransform} for pass 2.
  12182. This filter generates a file with relative translation and rotation
  12183. transform information about subsequent frames, which is then used by
  12184. the @ref{vidstabtransform} filter.
  12185. To enable compilation of this filter you need to configure FFmpeg with
  12186. @code{--enable-libvidstab}.
  12187. This filter accepts the following options:
  12188. @table @option
  12189. @item result
  12190. Set the path to the file used to write the transforms information.
  12191. Default value is @file{transforms.trf}.
  12192. @item shakiness
  12193. Set how shaky the video is and how quick the camera is. It accepts an
  12194. integer in the range 1-10, a value of 1 means little shakiness, a
  12195. value of 10 means strong shakiness. Default value is 5.
  12196. @item accuracy
  12197. Set the accuracy of the detection process. It must be a value in the
  12198. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  12199. accuracy. Default value is 15.
  12200. @item stepsize
  12201. Set stepsize of the search process. The region around minimum is
  12202. scanned with 1 pixel resolution. Default value is 6.
  12203. @item mincontrast
  12204. Set minimum contrast. Below this value a local measurement field is
  12205. discarded. Must be a floating point value in the range 0-1. Default
  12206. value is 0.3.
  12207. @item tripod
  12208. Set reference frame number for tripod mode.
  12209. If enabled, the motion of the frames is compared to a reference frame
  12210. in the filtered stream, identified by the specified number. The idea
  12211. is to compensate all movements in a more-or-less static scene and keep
  12212. the camera view absolutely still.
  12213. If set to 0, it is disabled. The frames are counted starting from 1.
  12214. @item show
  12215. Show fields and transforms in the resulting frames. It accepts an
  12216. integer in the range 0-2. Default value is 0, which disables any
  12217. visualization.
  12218. @end table
  12219. @subsection Examples
  12220. @itemize
  12221. @item
  12222. Use default values:
  12223. @example
  12224. vidstabdetect
  12225. @end example
  12226. @item
  12227. Analyze strongly shaky movie and put the results in file
  12228. @file{mytransforms.trf}:
  12229. @example
  12230. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  12231. @end example
  12232. @item
  12233. Visualize the result of internal transformations in the resulting
  12234. video:
  12235. @example
  12236. vidstabdetect=show=1
  12237. @end example
  12238. @item
  12239. Analyze a video with medium shakiness using @command{ffmpeg}:
  12240. @example
  12241. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  12242. @end example
  12243. @end itemize
  12244. @anchor{vidstabtransform}
  12245. @section vidstabtransform
  12246. Video stabilization/deshaking: pass 2 of 2,
  12247. see @ref{vidstabdetect} for pass 1.
  12248. Read a file with transform information for each frame and
  12249. apply/compensate them. Together with the @ref{vidstabdetect}
  12250. filter this can be used to deshake videos. See also
  12251. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  12252. the @ref{unsharp} filter, see below.
  12253. To enable compilation of this filter you need to configure FFmpeg with
  12254. @code{--enable-libvidstab}.
  12255. @subsection Options
  12256. @table @option
  12257. @item input
  12258. Set path to the file used to read the transforms. Default value is
  12259. @file{transforms.trf}.
  12260. @item smoothing
  12261. Set the number of frames (value*2 + 1) used for lowpass filtering the
  12262. camera movements. Default value is 10.
  12263. For example a number of 10 means that 21 frames are used (10 in the
  12264. past and 10 in the future) to smoothen the motion in the video. A
  12265. larger value leads to a smoother video, but limits the acceleration of
  12266. the camera (pan/tilt movements). 0 is a special case where a static
  12267. camera is simulated.
  12268. @item optalgo
  12269. Set the camera path optimization algorithm.
  12270. Accepted values are:
  12271. @table @samp
  12272. @item gauss
  12273. gaussian kernel low-pass filter on camera motion (default)
  12274. @item avg
  12275. averaging on transformations
  12276. @end table
  12277. @item maxshift
  12278. Set maximal number of pixels to translate frames. Default value is -1,
  12279. meaning no limit.
  12280. @item maxangle
  12281. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  12282. value is -1, meaning no limit.
  12283. @item crop
  12284. Specify how to deal with borders that may be visible due to movement
  12285. compensation.
  12286. Available values are:
  12287. @table @samp
  12288. @item keep
  12289. keep image information from previous frame (default)
  12290. @item black
  12291. fill the border black
  12292. @end table
  12293. @item invert
  12294. Invert transforms if set to 1. Default value is 0.
  12295. @item relative
  12296. Consider transforms as relative to previous frame if set to 1,
  12297. absolute if set to 0. Default value is 0.
  12298. @item zoom
  12299. Set percentage to zoom. A positive value will result in a zoom-in
  12300. effect, a negative value in a zoom-out effect. Default value is 0 (no
  12301. zoom).
  12302. @item optzoom
  12303. Set optimal zooming to avoid borders.
  12304. Accepted values are:
  12305. @table @samp
  12306. @item 0
  12307. disabled
  12308. @item 1
  12309. optimal static zoom value is determined (only very strong movements
  12310. will lead to visible borders) (default)
  12311. @item 2
  12312. optimal adaptive zoom value is determined (no borders will be
  12313. visible), see @option{zoomspeed}
  12314. @end table
  12315. Note that the value given at zoom is added to the one calculated here.
  12316. @item zoomspeed
  12317. Set percent to zoom maximally each frame (enabled when
  12318. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  12319. 0.25.
  12320. @item interpol
  12321. Specify type of interpolation.
  12322. Available values are:
  12323. @table @samp
  12324. @item no
  12325. no interpolation
  12326. @item linear
  12327. linear only horizontal
  12328. @item bilinear
  12329. linear in both directions (default)
  12330. @item bicubic
  12331. cubic in both directions (slow)
  12332. @end table
  12333. @item tripod
  12334. Enable virtual tripod mode if set to 1, which is equivalent to
  12335. @code{relative=0:smoothing=0}. Default value is 0.
  12336. Use also @code{tripod} option of @ref{vidstabdetect}.
  12337. @item debug
  12338. Increase log verbosity if set to 1. Also the detected global motions
  12339. are written to the temporary file @file{global_motions.trf}. Default
  12340. value is 0.
  12341. @end table
  12342. @subsection Examples
  12343. @itemize
  12344. @item
  12345. Use @command{ffmpeg} for a typical stabilization with default values:
  12346. @example
  12347. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  12348. @end example
  12349. Note the use of the @ref{unsharp} filter which is always recommended.
  12350. @item
  12351. Zoom in a bit more and load transform data from a given file:
  12352. @example
  12353. vidstabtransform=zoom=5:input="mytransforms.trf"
  12354. @end example
  12355. @item
  12356. Smoothen the video even more:
  12357. @example
  12358. vidstabtransform=smoothing=30
  12359. @end example
  12360. @end itemize
  12361. @section vflip
  12362. Flip the input video vertically.
  12363. For example, to vertically flip a video with @command{ffmpeg}:
  12364. @example
  12365. ffmpeg -i in.avi -vf "vflip" out.avi
  12366. @end example
  12367. @anchor{vignette}
  12368. @section vignette
  12369. Make or reverse a natural vignetting effect.
  12370. The filter accepts the following options:
  12371. @table @option
  12372. @item angle, a
  12373. Set lens angle expression as a number of radians.
  12374. The value is clipped in the @code{[0,PI/2]} range.
  12375. Default value: @code{"PI/5"}
  12376. @item x0
  12377. @item y0
  12378. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  12379. by default.
  12380. @item mode
  12381. Set forward/backward mode.
  12382. Available modes are:
  12383. @table @samp
  12384. @item forward
  12385. The larger the distance from the central point, the darker the image becomes.
  12386. @item backward
  12387. The larger the distance from the central point, the brighter the image becomes.
  12388. This can be used to reverse a vignette effect, though there is no automatic
  12389. detection to extract the lens @option{angle} and other settings (yet). It can
  12390. also be used to create a burning effect.
  12391. @end table
  12392. Default value is @samp{forward}.
  12393. @item eval
  12394. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  12395. It accepts the following values:
  12396. @table @samp
  12397. @item init
  12398. Evaluate expressions only once during the filter initialization.
  12399. @item frame
  12400. Evaluate expressions for each incoming frame. This is way slower than the
  12401. @samp{init} mode since it requires all the scalers to be re-computed, but it
  12402. allows advanced dynamic expressions.
  12403. @end table
  12404. Default value is @samp{init}.
  12405. @item dither
  12406. Set dithering to reduce the circular banding effects. Default is @code{1}
  12407. (enabled).
  12408. @item aspect
  12409. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  12410. Setting this value to the SAR of the input will make a rectangular vignetting
  12411. following the dimensions of the video.
  12412. Default is @code{1/1}.
  12413. @end table
  12414. @subsection Expressions
  12415. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  12416. following parameters.
  12417. @table @option
  12418. @item w
  12419. @item h
  12420. input width and height
  12421. @item n
  12422. the number of input frame, starting from 0
  12423. @item pts
  12424. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  12425. @var{TB} units, NAN if undefined
  12426. @item r
  12427. frame rate of the input video, NAN if the input frame rate is unknown
  12428. @item t
  12429. the PTS (Presentation TimeStamp) of the filtered video frame,
  12430. expressed in seconds, NAN if undefined
  12431. @item tb
  12432. time base of the input video
  12433. @end table
  12434. @subsection Examples
  12435. @itemize
  12436. @item
  12437. Apply simple strong vignetting effect:
  12438. @example
  12439. vignette=PI/4
  12440. @end example
  12441. @item
  12442. Make a flickering vignetting:
  12443. @example
  12444. vignette='PI/4+random(1)*PI/50':eval=frame
  12445. @end example
  12446. @end itemize
  12447. @section vmafmotion
  12448. Obtain the average vmaf motion score of a video.
  12449. It is one of the component filters of VMAF.
  12450. The obtained average motion score is printed through the logging system.
  12451. In the below example the input file @file{ref.mpg} is being processed and score
  12452. is computed.
  12453. @example
  12454. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  12455. @end example
  12456. @section vstack
  12457. Stack input videos vertically.
  12458. All streams must be of same pixel format and of same width.
  12459. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  12460. to create same output.
  12461. The filter accept the following option:
  12462. @table @option
  12463. @item inputs
  12464. Set number of input streams. Default is 2.
  12465. @item shortest
  12466. If set to 1, force the output to terminate when the shortest input
  12467. terminates. Default value is 0.
  12468. @end table
  12469. @section w3fdif
  12470. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  12471. Deinterlacing Filter").
  12472. Based on the process described by Martin Weston for BBC R&D, and
  12473. implemented based on the de-interlace algorithm written by Jim
  12474. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  12475. uses filter coefficients calculated by BBC R&D.
  12476. There are two sets of filter coefficients, so called "simple":
  12477. and "complex". Which set of filter coefficients is used can
  12478. be set by passing an optional parameter:
  12479. @table @option
  12480. @item filter
  12481. Set the interlacing filter coefficients. Accepts one of the following values:
  12482. @table @samp
  12483. @item simple
  12484. Simple filter coefficient set.
  12485. @item complex
  12486. More-complex filter coefficient set.
  12487. @end table
  12488. Default value is @samp{complex}.
  12489. @item deint
  12490. Specify which frames to deinterlace. Accept one of the following values:
  12491. @table @samp
  12492. @item all
  12493. Deinterlace all frames,
  12494. @item interlaced
  12495. Only deinterlace frames marked as interlaced.
  12496. @end table
  12497. Default value is @samp{all}.
  12498. @end table
  12499. @section waveform
  12500. Video waveform monitor.
  12501. The waveform monitor plots color component intensity. By default luminance
  12502. only. Each column of the waveform corresponds to a column of pixels in the
  12503. source video.
  12504. It accepts the following options:
  12505. @table @option
  12506. @item mode, m
  12507. Can be either @code{row}, or @code{column}. Default is @code{column}.
  12508. In row mode, the graph on the left side represents color component value 0 and
  12509. the right side represents value = 255. In column mode, the top side represents
  12510. color component value = 0 and bottom side represents value = 255.
  12511. @item intensity, i
  12512. Set intensity. Smaller values are useful to find out how many values of the same
  12513. luminance are distributed across input rows/columns.
  12514. Default value is @code{0.04}. Allowed range is [0, 1].
  12515. @item mirror, r
  12516. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  12517. In mirrored mode, higher values will be represented on the left
  12518. side for @code{row} mode and at the top for @code{column} mode. Default is
  12519. @code{1} (mirrored).
  12520. @item display, d
  12521. Set display mode.
  12522. It accepts the following values:
  12523. @table @samp
  12524. @item overlay
  12525. Presents information identical to that in the @code{parade}, except
  12526. that the graphs representing color components are superimposed directly
  12527. over one another.
  12528. This display mode makes it easier to spot relative differences or similarities
  12529. in overlapping areas of the color components that are supposed to be identical,
  12530. such as neutral whites, grays, or blacks.
  12531. @item stack
  12532. Display separate graph for the color components side by side in
  12533. @code{row} mode or one below the other in @code{column} mode.
  12534. @item parade
  12535. Display separate graph for the color components side by side in
  12536. @code{column} mode or one below the other in @code{row} mode.
  12537. Using this display mode makes it easy to spot color casts in the highlights
  12538. and shadows of an image, by comparing the contours of the top and the bottom
  12539. graphs of each waveform. Since whites, grays, and blacks are characterized
  12540. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  12541. should display three waveforms of roughly equal width/height. If not, the
  12542. correction is easy to perform by making level adjustments the three waveforms.
  12543. @end table
  12544. Default is @code{stack}.
  12545. @item components, c
  12546. Set which color components to display. Default is 1, which means only luminance
  12547. or red color component if input is in RGB colorspace. If is set for example to
  12548. 7 it will display all 3 (if) available color components.
  12549. @item envelope, e
  12550. @table @samp
  12551. @item none
  12552. No envelope, this is default.
  12553. @item instant
  12554. Instant envelope, minimum and maximum values presented in graph will be easily
  12555. visible even with small @code{step} value.
  12556. @item peak
  12557. Hold minimum and maximum values presented in graph across time. This way you
  12558. can still spot out of range values without constantly looking at waveforms.
  12559. @item peak+instant
  12560. Peak and instant envelope combined together.
  12561. @end table
  12562. @item filter, f
  12563. @table @samp
  12564. @item lowpass
  12565. No filtering, this is default.
  12566. @item flat
  12567. Luma and chroma combined together.
  12568. @item aflat
  12569. Similar as above, but shows difference between blue and red chroma.
  12570. @item chroma
  12571. Displays only chroma.
  12572. @item color
  12573. Displays actual color value on waveform.
  12574. @item acolor
  12575. Similar as above, but with luma showing frequency of chroma values.
  12576. @end table
  12577. @item graticule, g
  12578. Set which graticule to display.
  12579. @table @samp
  12580. @item none
  12581. Do not display graticule.
  12582. @item green
  12583. Display green graticule showing legal broadcast ranges.
  12584. @end table
  12585. @item opacity, o
  12586. Set graticule opacity.
  12587. @item flags, fl
  12588. Set graticule flags.
  12589. @table @samp
  12590. @item numbers
  12591. Draw numbers above lines. By default enabled.
  12592. @item dots
  12593. Draw dots instead of lines.
  12594. @end table
  12595. @item scale, s
  12596. Set scale used for displaying graticule.
  12597. @table @samp
  12598. @item digital
  12599. @item millivolts
  12600. @item ire
  12601. @end table
  12602. Default is digital.
  12603. @item bgopacity, b
  12604. Set background opacity.
  12605. @end table
  12606. @section weave, doubleweave
  12607. The @code{weave} takes a field-based video input and join
  12608. each two sequential fields into single frame, producing a new double
  12609. height clip with half the frame rate and half the frame count.
  12610. The @code{doubleweave} works same as @code{weave} but without
  12611. halving frame rate and frame count.
  12612. It accepts the following option:
  12613. @table @option
  12614. @item first_field
  12615. Set first field. Available values are:
  12616. @table @samp
  12617. @item top, t
  12618. Set the frame as top-field-first.
  12619. @item bottom, b
  12620. Set the frame as bottom-field-first.
  12621. @end table
  12622. @end table
  12623. @subsection Examples
  12624. @itemize
  12625. @item
  12626. Interlace video using @ref{select} and @ref{separatefields} filter:
  12627. @example
  12628. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  12629. @end example
  12630. @end itemize
  12631. @section xbr
  12632. Apply the xBR high-quality magnification filter which is designed for pixel
  12633. art. It follows a set of edge-detection rules, see
  12634. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  12635. It accepts the following option:
  12636. @table @option
  12637. @item n
  12638. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  12639. @code{3xBR} and @code{4} for @code{4xBR}.
  12640. Default is @code{3}.
  12641. @end table
  12642. @anchor{yadif}
  12643. @section yadif
  12644. Deinterlace the input video ("yadif" means "yet another deinterlacing
  12645. filter").
  12646. It accepts the following parameters:
  12647. @table @option
  12648. @item mode
  12649. The interlacing mode to adopt. It accepts one of the following values:
  12650. @table @option
  12651. @item 0, send_frame
  12652. Output one frame for each frame.
  12653. @item 1, send_field
  12654. Output one frame for each field.
  12655. @item 2, send_frame_nospatial
  12656. Like @code{send_frame}, but it skips the spatial interlacing check.
  12657. @item 3, send_field_nospatial
  12658. Like @code{send_field}, but it skips the spatial interlacing check.
  12659. @end table
  12660. The default value is @code{send_frame}.
  12661. @item parity
  12662. The picture field parity assumed for the input interlaced video. It accepts one
  12663. of the following values:
  12664. @table @option
  12665. @item 0, tff
  12666. Assume the top field is first.
  12667. @item 1, bff
  12668. Assume the bottom field is first.
  12669. @item -1, auto
  12670. Enable automatic detection of field parity.
  12671. @end table
  12672. The default value is @code{auto}.
  12673. If the interlacing is unknown or the decoder does not export this information,
  12674. top field first will be assumed.
  12675. @item deint
  12676. Specify which frames to deinterlace. Accept one of the following
  12677. values:
  12678. @table @option
  12679. @item 0, all
  12680. Deinterlace all frames.
  12681. @item 1, interlaced
  12682. Only deinterlace frames marked as interlaced.
  12683. @end table
  12684. The default value is @code{all}.
  12685. @end table
  12686. @section zoompan
  12687. Apply Zoom & Pan effect.
  12688. This filter accepts the following options:
  12689. @table @option
  12690. @item zoom, z
  12691. Set the zoom expression. Default is 1.
  12692. @item x
  12693. @item y
  12694. Set the x and y expression. Default is 0.
  12695. @item d
  12696. Set the duration expression in number of frames.
  12697. This sets for how many number of frames effect will last for
  12698. single input image.
  12699. @item s
  12700. Set the output image size, default is 'hd720'.
  12701. @item fps
  12702. Set the output frame rate, default is '25'.
  12703. @end table
  12704. Each expression can contain the following constants:
  12705. @table @option
  12706. @item in_w, iw
  12707. Input width.
  12708. @item in_h, ih
  12709. Input height.
  12710. @item out_w, ow
  12711. Output width.
  12712. @item out_h, oh
  12713. Output height.
  12714. @item in
  12715. Input frame count.
  12716. @item on
  12717. Output frame count.
  12718. @item x
  12719. @item y
  12720. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  12721. for current input frame.
  12722. @item px
  12723. @item py
  12724. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  12725. not yet such frame (first input frame).
  12726. @item zoom
  12727. Last calculated zoom from 'z' expression for current input frame.
  12728. @item pzoom
  12729. Last calculated zoom of last output frame of previous input frame.
  12730. @item duration
  12731. Number of output frames for current input frame. Calculated from 'd' expression
  12732. for each input frame.
  12733. @item pduration
  12734. number of output frames created for previous input frame
  12735. @item a
  12736. Rational number: input width / input height
  12737. @item sar
  12738. sample aspect ratio
  12739. @item dar
  12740. display aspect ratio
  12741. @end table
  12742. @subsection Examples
  12743. @itemize
  12744. @item
  12745. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  12746. @example
  12747. 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
  12748. @end example
  12749. @item
  12750. Zoom-in up to 1.5 and pan always at center of picture:
  12751. @example
  12752. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12753. @end example
  12754. @item
  12755. Same as above but without pausing:
  12756. @example
  12757. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12758. @end example
  12759. @end itemize
  12760. @anchor{zscale}
  12761. @section zscale
  12762. Scale (resize) the input video, using the z.lib library:
  12763. https://github.com/sekrit-twc/zimg.
  12764. The zscale filter forces the output display aspect ratio to be the same
  12765. as the input, by changing the output sample aspect ratio.
  12766. If the input image format is different from the format requested by
  12767. the next filter, the zscale filter will convert the input to the
  12768. requested format.
  12769. @subsection Options
  12770. The filter accepts the following options.
  12771. @table @option
  12772. @item width, w
  12773. @item height, h
  12774. Set the output video dimension expression. Default value is the input
  12775. dimension.
  12776. If the @var{width} or @var{w} value is 0, the input width is used for
  12777. the output. If the @var{height} or @var{h} value is 0, the input height
  12778. is used for the output.
  12779. If one and only one of the values is -n with n >= 1, the zscale filter
  12780. will use a value that maintains the aspect ratio of the input image,
  12781. calculated from the other specified dimension. After that it will,
  12782. however, make sure that the calculated dimension is divisible by n and
  12783. adjust the value if necessary.
  12784. If both values are -n with n >= 1, the behavior will be identical to
  12785. both values being set to 0 as previously detailed.
  12786. See below for the list of accepted constants for use in the dimension
  12787. expression.
  12788. @item size, s
  12789. Set the video size. For the syntax of this option, check the
  12790. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12791. @item dither, d
  12792. Set the dither type.
  12793. Possible values are:
  12794. @table @var
  12795. @item none
  12796. @item ordered
  12797. @item random
  12798. @item error_diffusion
  12799. @end table
  12800. Default is none.
  12801. @item filter, f
  12802. Set the resize filter type.
  12803. Possible values are:
  12804. @table @var
  12805. @item point
  12806. @item bilinear
  12807. @item bicubic
  12808. @item spline16
  12809. @item spline36
  12810. @item lanczos
  12811. @end table
  12812. Default is bilinear.
  12813. @item range, r
  12814. Set the color range.
  12815. Possible values are:
  12816. @table @var
  12817. @item input
  12818. @item limited
  12819. @item full
  12820. @end table
  12821. Default is same as input.
  12822. @item primaries, p
  12823. Set the color primaries.
  12824. Possible values are:
  12825. @table @var
  12826. @item input
  12827. @item 709
  12828. @item unspecified
  12829. @item 170m
  12830. @item 240m
  12831. @item 2020
  12832. @end table
  12833. Default is same as input.
  12834. @item transfer, t
  12835. Set the transfer characteristics.
  12836. Possible values are:
  12837. @table @var
  12838. @item input
  12839. @item 709
  12840. @item unspecified
  12841. @item 601
  12842. @item linear
  12843. @item 2020_10
  12844. @item 2020_12
  12845. @item smpte2084
  12846. @item iec61966-2-1
  12847. @item arib-std-b67
  12848. @end table
  12849. Default is same as input.
  12850. @item matrix, m
  12851. Set the colorspace matrix.
  12852. Possible value are:
  12853. @table @var
  12854. @item input
  12855. @item 709
  12856. @item unspecified
  12857. @item 470bg
  12858. @item 170m
  12859. @item 2020_ncl
  12860. @item 2020_cl
  12861. @end table
  12862. Default is same as input.
  12863. @item rangein, rin
  12864. Set the input color range.
  12865. Possible values are:
  12866. @table @var
  12867. @item input
  12868. @item limited
  12869. @item full
  12870. @end table
  12871. Default is same as input.
  12872. @item primariesin, pin
  12873. Set the input color primaries.
  12874. Possible values are:
  12875. @table @var
  12876. @item input
  12877. @item 709
  12878. @item unspecified
  12879. @item 170m
  12880. @item 240m
  12881. @item 2020
  12882. @end table
  12883. Default is same as input.
  12884. @item transferin, tin
  12885. Set the input transfer characteristics.
  12886. Possible values are:
  12887. @table @var
  12888. @item input
  12889. @item 709
  12890. @item unspecified
  12891. @item 601
  12892. @item linear
  12893. @item 2020_10
  12894. @item 2020_12
  12895. @end table
  12896. Default is same as input.
  12897. @item matrixin, min
  12898. Set the input colorspace matrix.
  12899. Possible value are:
  12900. @table @var
  12901. @item input
  12902. @item 709
  12903. @item unspecified
  12904. @item 470bg
  12905. @item 170m
  12906. @item 2020_ncl
  12907. @item 2020_cl
  12908. @end table
  12909. @item chromal, c
  12910. Set the output chroma location.
  12911. Possible values are:
  12912. @table @var
  12913. @item input
  12914. @item left
  12915. @item center
  12916. @item topleft
  12917. @item top
  12918. @item bottomleft
  12919. @item bottom
  12920. @end table
  12921. @item chromalin, cin
  12922. Set the input chroma location.
  12923. Possible values are:
  12924. @table @var
  12925. @item input
  12926. @item left
  12927. @item center
  12928. @item topleft
  12929. @item top
  12930. @item bottomleft
  12931. @item bottom
  12932. @end table
  12933. @item npl
  12934. Set the nominal peak luminance.
  12935. @end table
  12936. The values of the @option{w} and @option{h} options are expressions
  12937. containing the following constants:
  12938. @table @var
  12939. @item in_w
  12940. @item in_h
  12941. The input width and height
  12942. @item iw
  12943. @item ih
  12944. These are the same as @var{in_w} and @var{in_h}.
  12945. @item out_w
  12946. @item out_h
  12947. The output (scaled) width and height
  12948. @item ow
  12949. @item oh
  12950. These are the same as @var{out_w} and @var{out_h}
  12951. @item a
  12952. The same as @var{iw} / @var{ih}
  12953. @item sar
  12954. input sample aspect ratio
  12955. @item dar
  12956. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12957. @item hsub
  12958. @item vsub
  12959. horizontal and vertical input chroma subsample values. For example for the
  12960. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12961. @item ohsub
  12962. @item ovsub
  12963. horizontal and vertical output chroma subsample values. For example for the
  12964. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12965. @end table
  12966. @table @option
  12967. @end table
  12968. @c man end VIDEO FILTERS
  12969. @chapter Video Sources
  12970. @c man begin VIDEO SOURCES
  12971. Below is a description of the currently available video sources.
  12972. @section buffer
  12973. Buffer video frames, and make them available to the filter chain.
  12974. This source is mainly intended for a programmatic use, in particular
  12975. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  12976. It accepts the following parameters:
  12977. @table @option
  12978. @item video_size
  12979. Specify the size (width and height) of the buffered video frames. For the
  12980. syntax of this option, check the
  12981. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12982. @item width
  12983. The input video width.
  12984. @item height
  12985. The input video height.
  12986. @item pix_fmt
  12987. A string representing the pixel format of the buffered video frames.
  12988. It may be a number corresponding to a pixel format, or a pixel format
  12989. name.
  12990. @item time_base
  12991. Specify the timebase assumed by the timestamps of the buffered frames.
  12992. @item frame_rate
  12993. Specify the frame rate expected for the video stream.
  12994. @item pixel_aspect, sar
  12995. The sample (pixel) aspect ratio of the input video.
  12996. @item sws_param
  12997. Specify the optional parameters to be used for the scale filter which
  12998. is automatically inserted when an input change is detected in the
  12999. input size or format.
  13000. @item hw_frames_ctx
  13001. When using a hardware pixel format, this should be a reference to an
  13002. AVHWFramesContext describing input frames.
  13003. @end table
  13004. For example:
  13005. @example
  13006. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  13007. @end example
  13008. will instruct the source to accept video frames with size 320x240 and
  13009. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  13010. square pixels (1:1 sample aspect ratio).
  13011. Since the pixel format with name "yuv410p" corresponds to the number 6
  13012. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  13013. this example corresponds to:
  13014. @example
  13015. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  13016. @end example
  13017. Alternatively, the options can be specified as a flat string, but this
  13018. syntax is deprecated:
  13019. @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}]
  13020. @section cellauto
  13021. Create a pattern generated by an elementary cellular automaton.
  13022. The initial state of the cellular automaton can be defined through the
  13023. @option{filename} and @option{pattern} options. If such options are
  13024. not specified an initial state is created randomly.
  13025. At each new frame a new row in the video is filled with the result of
  13026. the cellular automaton next generation. The behavior when the whole
  13027. frame is filled is defined by the @option{scroll} option.
  13028. This source accepts the following options:
  13029. @table @option
  13030. @item filename, f
  13031. Read the initial cellular automaton state, i.e. the starting row, from
  13032. the specified file.
  13033. In the file, each non-whitespace character is considered an alive
  13034. cell, a newline will terminate the row, and further characters in the
  13035. file will be ignored.
  13036. @item pattern, p
  13037. Read the initial cellular automaton state, i.e. the starting row, from
  13038. the specified string.
  13039. Each non-whitespace character in the string is considered an alive
  13040. cell, a newline will terminate the row, and further characters in the
  13041. string will be ignored.
  13042. @item rate, r
  13043. Set the video rate, that is the number of frames generated per second.
  13044. Default is 25.
  13045. @item random_fill_ratio, ratio
  13046. Set the random fill ratio for the initial cellular automaton row. It
  13047. is a floating point number value ranging from 0 to 1, defaults to
  13048. 1/PHI.
  13049. This option is ignored when a file or a pattern is specified.
  13050. @item random_seed, seed
  13051. Set the seed for filling randomly the initial row, must be an integer
  13052. included between 0 and UINT32_MAX. If not specified, or if explicitly
  13053. set to -1, the filter will try to use a good random seed on a best
  13054. effort basis.
  13055. @item rule
  13056. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  13057. Default value is 110.
  13058. @item size, s
  13059. Set the size of the output video. For the syntax of this option, check the
  13060. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13061. If @option{filename} or @option{pattern} is specified, the size is set
  13062. by default to the width of the specified initial state row, and the
  13063. height is set to @var{width} * PHI.
  13064. If @option{size} is set, it must contain the width of the specified
  13065. pattern string, and the specified pattern will be centered in the
  13066. larger row.
  13067. If a filename or a pattern string is not specified, the size value
  13068. defaults to "320x518" (used for a randomly generated initial state).
  13069. @item scroll
  13070. If set to 1, scroll the output upward when all the rows in the output
  13071. have been already filled. If set to 0, the new generated row will be
  13072. written over the top row just after the bottom row is filled.
  13073. Defaults to 1.
  13074. @item start_full, full
  13075. If set to 1, completely fill the output with generated rows before
  13076. outputting the first frame.
  13077. This is the default behavior, for disabling set the value to 0.
  13078. @item stitch
  13079. If set to 1, stitch the left and right row edges together.
  13080. This is the default behavior, for disabling set the value to 0.
  13081. @end table
  13082. @subsection Examples
  13083. @itemize
  13084. @item
  13085. Read the initial state from @file{pattern}, and specify an output of
  13086. size 200x400.
  13087. @example
  13088. cellauto=f=pattern:s=200x400
  13089. @end example
  13090. @item
  13091. Generate a random initial row with a width of 200 cells, with a fill
  13092. ratio of 2/3:
  13093. @example
  13094. cellauto=ratio=2/3:s=200x200
  13095. @end example
  13096. @item
  13097. Create a pattern generated by rule 18 starting by a single alive cell
  13098. centered on an initial row with width 100:
  13099. @example
  13100. cellauto=p=@@:s=100x400:full=0:rule=18
  13101. @end example
  13102. @item
  13103. Specify a more elaborated initial pattern:
  13104. @example
  13105. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  13106. @end example
  13107. @end itemize
  13108. @anchor{coreimagesrc}
  13109. @section coreimagesrc
  13110. Video source generated on GPU using Apple's CoreImage API on OSX.
  13111. This video source is a specialized version of the @ref{coreimage} video filter.
  13112. Use a core image generator at the beginning of the applied filterchain to
  13113. generate the content.
  13114. The coreimagesrc video source accepts the following options:
  13115. @table @option
  13116. @item list_generators
  13117. List all available generators along with all their respective options as well as
  13118. possible minimum and maximum values along with the default values.
  13119. @example
  13120. list_generators=true
  13121. @end example
  13122. @item size, s
  13123. Specify the size of the sourced video. For the syntax of this option, check the
  13124. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13125. The default value is @code{320x240}.
  13126. @item rate, r
  13127. Specify the frame rate of the sourced video, as the number of frames
  13128. generated per second. It has to be a string in the format
  13129. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13130. number or a valid video frame rate abbreviation. The default value is
  13131. "25".
  13132. @item sar
  13133. Set the sample aspect ratio of the sourced video.
  13134. @item duration, d
  13135. Set the duration of the sourced video. See
  13136. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13137. for the accepted syntax.
  13138. If not specified, or the expressed duration is negative, the video is
  13139. supposed to be generated forever.
  13140. @end table
  13141. Additionally, all options of the @ref{coreimage} video filter are accepted.
  13142. A complete filterchain can be used for further processing of the
  13143. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  13144. and examples for details.
  13145. @subsection Examples
  13146. @itemize
  13147. @item
  13148. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  13149. given as complete and escaped command-line for Apple's standard bash shell:
  13150. @example
  13151. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  13152. @end example
  13153. This example is equivalent to the QRCode example of @ref{coreimage} without the
  13154. need for a nullsrc video source.
  13155. @end itemize
  13156. @section mandelbrot
  13157. Generate a Mandelbrot set fractal, and progressively zoom towards the
  13158. point specified with @var{start_x} and @var{start_y}.
  13159. This source accepts the following options:
  13160. @table @option
  13161. @item end_pts
  13162. Set the terminal pts value. Default value is 400.
  13163. @item end_scale
  13164. Set the terminal scale value.
  13165. Must be a floating point value. Default value is 0.3.
  13166. @item inner
  13167. Set the inner coloring mode, that is the algorithm used to draw the
  13168. Mandelbrot fractal internal region.
  13169. It shall assume one of the following values:
  13170. @table @option
  13171. @item black
  13172. Set black mode.
  13173. @item convergence
  13174. Show time until convergence.
  13175. @item mincol
  13176. Set color based on point closest to the origin of the iterations.
  13177. @item period
  13178. Set period mode.
  13179. @end table
  13180. Default value is @var{mincol}.
  13181. @item bailout
  13182. Set the bailout value. Default value is 10.0.
  13183. @item maxiter
  13184. Set the maximum of iterations performed by the rendering
  13185. algorithm. Default value is 7189.
  13186. @item outer
  13187. Set outer coloring mode.
  13188. It shall assume one of following values:
  13189. @table @option
  13190. @item iteration_count
  13191. Set iteration cound mode.
  13192. @item normalized_iteration_count
  13193. set normalized iteration count mode.
  13194. @end table
  13195. Default value is @var{normalized_iteration_count}.
  13196. @item rate, r
  13197. Set frame rate, expressed as number of frames per second. Default
  13198. value is "25".
  13199. @item size, s
  13200. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  13201. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  13202. @item start_scale
  13203. Set the initial scale value. Default value is 3.0.
  13204. @item start_x
  13205. Set the initial x position. Must be a floating point value between
  13206. -100 and 100. Default value is -0.743643887037158704752191506114774.
  13207. @item start_y
  13208. Set the initial y position. Must be a floating point value between
  13209. -100 and 100. Default value is -0.131825904205311970493132056385139.
  13210. @end table
  13211. @section mptestsrc
  13212. Generate various test patterns, as generated by the MPlayer test filter.
  13213. The size of the generated video is fixed, and is 256x256.
  13214. This source is useful in particular for testing encoding features.
  13215. This source accepts the following options:
  13216. @table @option
  13217. @item rate, r
  13218. Specify the frame rate of the sourced video, as the number of frames
  13219. generated per second. It has to be a string in the format
  13220. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13221. number or a valid video frame rate abbreviation. The default value is
  13222. "25".
  13223. @item duration, d
  13224. Set the duration of the sourced video. See
  13225. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13226. for the accepted syntax.
  13227. If not specified, or the expressed duration is negative, the video is
  13228. supposed to be generated forever.
  13229. @item test, t
  13230. Set the number or the name of the test to perform. Supported tests are:
  13231. @table @option
  13232. @item dc_luma
  13233. @item dc_chroma
  13234. @item freq_luma
  13235. @item freq_chroma
  13236. @item amp_luma
  13237. @item amp_chroma
  13238. @item cbp
  13239. @item mv
  13240. @item ring1
  13241. @item ring2
  13242. @item all
  13243. @end table
  13244. Default value is "all", which will cycle through the list of all tests.
  13245. @end table
  13246. Some examples:
  13247. @example
  13248. mptestsrc=t=dc_luma
  13249. @end example
  13250. will generate a "dc_luma" test pattern.
  13251. @section frei0r_src
  13252. Provide a frei0r source.
  13253. To enable compilation of this filter you need to install the frei0r
  13254. header and configure FFmpeg with @code{--enable-frei0r}.
  13255. This source accepts the following parameters:
  13256. @table @option
  13257. @item size
  13258. The size of the video to generate. For the syntax of this option, check the
  13259. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13260. @item framerate
  13261. The framerate of the generated video. It may be a string of the form
  13262. @var{num}/@var{den} or a frame rate abbreviation.
  13263. @item filter_name
  13264. The name to the frei0r source to load. For more information regarding frei0r and
  13265. how to set the parameters, read the @ref{frei0r} section in the video filters
  13266. documentation.
  13267. @item filter_params
  13268. A '|'-separated list of parameters to pass to the frei0r source.
  13269. @end table
  13270. For example, to generate a frei0r partik0l source with size 200x200
  13271. and frame rate 10 which is overlaid on the overlay filter main input:
  13272. @example
  13273. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  13274. @end example
  13275. @section life
  13276. Generate a life pattern.
  13277. This source is based on a generalization of John Conway's life game.
  13278. The sourced input represents a life grid, each pixel represents a cell
  13279. which can be in one of two possible states, alive or dead. Every cell
  13280. interacts with its eight neighbours, which are the cells that are
  13281. horizontally, vertically, or diagonally adjacent.
  13282. At each interaction the grid evolves according to the adopted rule,
  13283. which specifies the number of neighbor alive cells which will make a
  13284. cell stay alive or born. The @option{rule} option allows one to specify
  13285. the rule to adopt.
  13286. This source accepts the following options:
  13287. @table @option
  13288. @item filename, f
  13289. Set the file from which to read the initial grid state. In the file,
  13290. each non-whitespace character is considered an alive cell, and newline
  13291. is used to delimit the end of each row.
  13292. If this option is not specified, the initial grid is generated
  13293. randomly.
  13294. @item rate, r
  13295. Set the video rate, that is the number of frames generated per second.
  13296. Default is 25.
  13297. @item random_fill_ratio, ratio
  13298. Set the random fill ratio for the initial random grid. It is a
  13299. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  13300. It is ignored when a file is specified.
  13301. @item random_seed, seed
  13302. Set the seed for filling the initial random grid, must be an integer
  13303. included between 0 and UINT32_MAX. If not specified, or if explicitly
  13304. set to -1, the filter will try to use a good random seed on a best
  13305. effort basis.
  13306. @item rule
  13307. Set the life rule.
  13308. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  13309. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  13310. @var{NS} specifies the number of alive neighbor cells which make a
  13311. live cell stay alive, and @var{NB} the number of alive neighbor cells
  13312. which make a dead cell to become alive (i.e. to "born").
  13313. "s" and "b" can be used in place of "S" and "B", respectively.
  13314. Alternatively a rule can be specified by an 18-bits integer. The 9
  13315. high order bits are used to encode the next cell state if it is alive
  13316. for each number of neighbor alive cells, the low order bits specify
  13317. the rule for "borning" new cells. Higher order bits encode for an
  13318. higher number of neighbor cells.
  13319. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  13320. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  13321. Default value is "S23/B3", which is the original Conway's game of life
  13322. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  13323. cells, and will born a new cell if there are three alive cells around
  13324. a dead cell.
  13325. @item size, s
  13326. Set the size of the output video. For the syntax of this option, check the
  13327. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13328. If @option{filename} is specified, the size is set by default to the
  13329. same size of the input file. If @option{size} is set, it must contain
  13330. the size specified in the input file, and the initial grid defined in
  13331. that file is centered in the larger resulting area.
  13332. If a filename is not specified, the size value defaults to "320x240"
  13333. (used for a randomly generated initial grid).
  13334. @item stitch
  13335. If set to 1, stitch the left and right grid edges together, and the
  13336. top and bottom edges also. Defaults to 1.
  13337. @item mold
  13338. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  13339. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  13340. value from 0 to 255.
  13341. @item life_color
  13342. Set the color of living (or new born) cells.
  13343. @item death_color
  13344. Set the color of dead cells. If @option{mold} is set, this is the first color
  13345. used to represent a dead cell.
  13346. @item mold_color
  13347. Set mold color, for definitely dead and moldy cells.
  13348. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  13349. ffmpeg-utils manual,ffmpeg-utils}.
  13350. @end table
  13351. @subsection Examples
  13352. @itemize
  13353. @item
  13354. Read a grid from @file{pattern}, and center it on a grid of size
  13355. 300x300 pixels:
  13356. @example
  13357. life=f=pattern:s=300x300
  13358. @end example
  13359. @item
  13360. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  13361. @example
  13362. life=ratio=2/3:s=200x200
  13363. @end example
  13364. @item
  13365. Specify a custom rule for evolving a randomly generated grid:
  13366. @example
  13367. life=rule=S14/B34
  13368. @end example
  13369. @item
  13370. Full example with slow death effect (mold) using @command{ffplay}:
  13371. @example
  13372. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  13373. @end example
  13374. @end itemize
  13375. @anchor{allrgb}
  13376. @anchor{allyuv}
  13377. @anchor{color}
  13378. @anchor{haldclutsrc}
  13379. @anchor{nullsrc}
  13380. @anchor{rgbtestsrc}
  13381. @anchor{smptebars}
  13382. @anchor{smptehdbars}
  13383. @anchor{testsrc}
  13384. @anchor{testsrc2}
  13385. @anchor{yuvtestsrc}
  13386. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  13387. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  13388. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  13389. The @code{color} source provides an uniformly colored input.
  13390. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  13391. @ref{haldclut} filter.
  13392. The @code{nullsrc} source returns unprocessed video frames. It is
  13393. mainly useful to be employed in analysis / debugging tools, or as the
  13394. source for filters which ignore the input data.
  13395. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  13396. detecting RGB vs BGR issues. You should see a red, green and blue
  13397. stripe from top to bottom.
  13398. The @code{smptebars} source generates a color bars pattern, based on
  13399. the SMPTE Engineering Guideline EG 1-1990.
  13400. The @code{smptehdbars} source generates a color bars pattern, based on
  13401. the SMPTE RP 219-2002.
  13402. The @code{testsrc} source generates a test video pattern, showing a
  13403. color pattern, a scrolling gradient and a timestamp. This is mainly
  13404. intended for testing purposes.
  13405. The @code{testsrc2} source is similar to testsrc, but supports more
  13406. pixel formats instead of just @code{rgb24}. This allows using it as an
  13407. input for other tests without requiring a format conversion.
  13408. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  13409. see a y, cb and cr stripe from top to bottom.
  13410. The sources accept the following parameters:
  13411. @table @option
  13412. @item level
  13413. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  13414. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  13415. pixels to be used as identity matrix for 3D lookup tables. Each component is
  13416. coded on a @code{1/(N*N)} scale.
  13417. @item color, c
  13418. Specify the color of the source, only available in the @code{color}
  13419. source. For the syntax of this option, check the
  13420. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13421. @item size, s
  13422. Specify the size of the sourced video. For the syntax of this option, check the
  13423. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13424. The default value is @code{320x240}.
  13425. This option is not available with the @code{allrgb}, @code{allyuv}, and
  13426. @code{haldclutsrc} filters.
  13427. @item rate, r
  13428. Specify the frame rate of the sourced video, as the number of frames
  13429. generated per second. It has to be a string in the format
  13430. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13431. number or a valid video frame rate abbreviation. The default value is
  13432. "25".
  13433. @item duration, d
  13434. Set the duration of the sourced video. See
  13435. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13436. for the accepted syntax.
  13437. If not specified, or the expressed duration is negative, the video is
  13438. supposed to be generated forever.
  13439. @item sar
  13440. Set the sample aspect ratio of the sourced video.
  13441. @item alpha
  13442. Specify the alpha (opacity) of the background, only available in the
  13443. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  13444. 255 (fully opaque, the default).
  13445. @item decimals, n
  13446. Set the number of decimals to show in the timestamp, only available in the
  13447. @code{testsrc} source.
  13448. The displayed timestamp value will correspond to the original
  13449. timestamp value multiplied by the power of 10 of the specified
  13450. value. Default value is 0.
  13451. @end table
  13452. @subsection Examples
  13453. @itemize
  13454. @item
  13455. Generate a video with a duration of 5.3 seconds, with size
  13456. 176x144 and a frame rate of 10 frames per second:
  13457. @example
  13458. testsrc=duration=5.3:size=qcif:rate=10
  13459. @end example
  13460. @item
  13461. The following graph description will generate a red source
  13462. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  13463. frames per second:
  13464. @example
  13465. color=c=red@@0.2:s=qcif:r=10
  13466. @end example
  13467. @item
  13468. If the input content is to be ignored, @code{nullsrc} can be used. The
  13469. following command generates noise in the luminance plane by employing
  13470. the @code{geq} filter:
  13471. @example
  13472. nullsrc=s=256x256, geq=random(1)*255:128:128
  13473. @end example
  13474. @end itemize
  13475. @subsection Commands
  13476. The @code{color} source supports the following commands:
  13477. @table @option
  13478. @item c, color
  13479. Set the color of the created image. Accepts the same syntax of the
  13480. corresponding @option{color} option.
  13481. @end table
  13482. @section openclsrc
  13483. Generate video using an OpenCL program.
  13484. @table @option
  13485. @item source
  13486. OpenCL program source file.
  13487. @item kernel
  13488. Kernel name in program.
  13489. @item size, s
  13490. Size of frames to generate. This must be set.
  13491. @item format
  13492. Pixel format to use for the generated frames. This must be set.
  13493. @item rate, r
  13494. Number of frames generated every second. Default value is '25'.
  13495. @end table
  13496. For details of how the program loading works, see the @ref{program_opencl}
  13497. filter.
  13498. Example programs:
  13499. @itemize
  13500. @item
  13501. Generate a colour ramp by setting pixel values from the position of the pixel
  13502. in the output image. (Note that this will work with all pixel formats, but
  13503. the generated output will not be the same.)
  13504. @verbatim
  13505. __kernel void ramp(__write_only image2d_t dst,
  13506. unsigned int index)
  13507. {
  13508. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  13509. float4 val;
  13510. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  13511. write_imagef(dst, loc, val);
  13512. }
  13513. @end verbatim
  13514. @item
  13515. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  13516. @verbatim
  13517. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  13518. unsigned int index)
  13519. {
  13520. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  13521. float4 value = 0.0f;
  13522. int x = loc.x + index;
  13523. int y = loc.y + index;
  13524. while (x > 0 || y > 0) {
  13525. if (x % 3 == 1 && y % 3 == 1) {
  13526. value = 1.0f;
  13527. break;
  13528. }
  13529. x /= 3;
  13530. y /= 3;
  13531. }
  13532. write_imagef(dst, loc, value);
  13533. }
  13534. @end verbatim
  13535. @end itemize
  13536. @c man end VIDEO SOURCES
  13537. @chapter Video Sinks
  13538. @c man begin VIDEO SINKS
  13539. Below is a description of the currently available video sinks.
  13540. @section buffersink
  13541. Buffer video frames, and make them available to the end of the filter
  13542. graph.
  13543. This sink is mainly intended for programmatic use, in particular
  13544. through the interface defined in @file{libavfilter/buffersink.h}
  13545. or the options system.
  13546. It accepts a pointer to an AVBufferSinkContext structure, which
  13547. defines the incoming buffers' formats, to be passed as the opaque
  13548. parameter to @code{avfilter_init_filter} for initialization.
  13549. @section nullsink
  13550. Null video sink: do absolutely nothing with the input video. It is
  13551. mainly useful as a template and for use in analysis / debugging
  13552. tools.
  13553. @c man end VIDEO SINKS
  13554. @chapter Multimedia Filters
  13555. @c man begin MULTIMEDIA FILTERS
  13556. Below is a description of the currently available multimedia filters.
  13557. @section abitscope
  13558. Convert input audio to a video output, displaying the audio bit scope.
  13559. The filter accepts the following options:
  13560. @table @option
  13561. @item rate, r
  13562. Set frame rate, expressed as number of frames per second. Default
  13563. value is "25".
  13564. @item size, s
  13565. Specify the video size for the output. For the syntax of this option, check the
  13566. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13567. Default value is @code{1024x256}.
  13568. @item colors
  13569. Specify list of colors separated by space or by '|' which will be used to
  13570. draw channels. Unrecognized or missing colors will be replaced
  13571. by white color.
  13572. @end table
  13573. @section ahistogram
  13574. Convert input audio to a video output, displaying the volume histogram.
  13575. The filter accepts the following options:
  13576. @table @option
  13577. @item dmode
  13578. Specify how histogram is calculated.
  13579. It accepts the following values:
  13580. @table @samp
  13581. @item single
  13582. Use single histogram for all channels.
  13583. @item separate
  13584. Use separate histogram for each channel.
  13585. @end table
  13586. Default is @code{single}.
  13587. @item rate, r
  13588. Set frame rate, expressed as number of frames per second. Default
  13589. value is "25".
  13590. @item size, s
  13591. Specify the video size for the output. For the syntax of this option, check the
  13592. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13593. Default value is @code{hd720}.
  13594. @item scale
  13595. Set display scale.
  13596. It accepts the following values:
  13597. @table @samp
  13598. @item log
  13599. logarithmic
  13600. @item sqrt
  13601. square root
  13602. @item cbrt
  13603. cubic root
  13604. @item lin
  13605. linear
  13606. @item rlog
  13607. reverse logarithmic
  13608. @end table
  13609. Default is @code{log}.
  13610. @item ascale
  13611. Set amplitude scale.
  13612. It accepts the following values:
  13613. @table @samp
  13614. @item log
  13615. logarithmic
  13616. @item lin
  13617. linear
  13618. @end table
  13619. Default is @code{log}.
  13620. @item acount
  13621. Set how much frames to accumulate in histogram.
  13622. Defauls is 1. Setting this to -1 accumulates all frames.
  13623. @item rheight
  13624. Set histogram ratio of window height.
  13625. @item slide
  13626. Set sonogram sliding.
  13627. It accepts the following values:
  13628. @table @samp
  13629. @item replace
  13630. replace old rows with new ones.
  13631. @item scroll
  13632. scroll from top to bottom.
  13633. @end table
  13634. Default is @code{replace}.
  13635. @end table
  13636. @section aphasemeter
  13637. Convert input audio to a video output, displaying the audio phase.
  13638. The filter accepts the following options:
  13639. @table @option
  13640. @item rate, r
  13641. Set the output frame rate. Default value is @code{25}.
  13642. @item size, s
  13643. Set the video size for the output. For the syntax of this option, check the
  13644. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13645. Default value is @code{800x400}.
  13646. @item rc
  13647. @item gc
  13648. @item bc
  13649. Specify the red, green, blue contrast. Default values are @code{2},
  13650. @code{7} and @code{1}.
  13651. Allowed range is @code{[0, 255]}.
  13652. @item mpc
  13653. Set color which will be used for drawing median phase. If color is
  13654. @code{none} which is default, no median phase value will be drawn.
  13655. @item video
  13656. Enable video output. Default is enabled.
  13657. @end table
  13658. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  13659. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  13660. The @code{-1} means left and right channels are completely out of phase and
  13661. @code{1} means channels are in phase.
  13662. @section avectorscope
  13663. Convert input audio to a video output, representing the audio vector
  13664. scope.
  13665. The filter is used to measure the difference between channels of stereo
  13666. audio stream. A monoaural signal, consisting of identical left and right
  13667. signal, results in straight vertical line. Any stereo separation is visible
  13668. as a deviation from this line, creating a Lissajous figure.
  13669. If the straight (or deviation from it) but horizontal line appears this
  13670. indicates that the left and right channels are out of phase.
  13671. The filter accepts the following options:
  13672. @table @option
  13673. @item mode, m
  13674. Set the vectorscope mode.
  13675. Available values are:
  13676. @table @samp
  13677. @item lissajous
  13678. Lissajous rotated by 45 degrees.
  13679. @item lissajous_xy
  13680. Same as above but not rotated.
  13681. @item polar
  13682. Shape resembling half of circle.
  13683. @end table
  13684. Default value is @samp{lissajous}.
  13685. @item size, s
  13686. Set the video size for the output. For the syntax of this option, check the
  13687. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13688. Default value is @code{400x400}.
  13689. @item rate, r
  13690. Set the output frame rate. Default value is @code{25}.
  13691. @item rc
  13692. @item gc
  13693. @item bc
  13694. @item ac
  13695. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  13696. @code{160}, @code{80} and @code{255}.
  13697. Allowed range is @code{[0, 255]}.
  13698. @item rf
  13699. @item gf
  13700. @item bf
  13701. @item af
  13702. Specify the red, green, blue and alpha fade. Default values are @code{15},
  13703. @code{10}, @code{5} and @code{5}.
  13704. Allowed range is @code{[0, 255]}.
  13705. @item zoom
  13706. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  13707. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  13708. @item draw
  13709. Set the vectorscope drawing mode.
  13710. Available values are:
  13711. @table @samp
  13712. @item dot
  13713. Draw dot for each sample.
  13714. @item line
  13715. Draw line between previous and current sample.
  13716. @end table
  13717. Default value is @samp{dot}.
  13718. @item scale
  13719. Specify amplitude scale of audio samples.
  13720. Available values are:
  13721. @table @samp
  13722. @item lin
  13723. Linear.
  13724. @item sqrt
  13725. Square root.
  13726. @item cbrt
  13727. Cubic root.
  13728. @item log
  13729. Logarithmic.
  13730. @end table
  13731. @item swap
  13732. Swap left channel axis with right channel axis.
  13733. @item mirror
  13734. Mirror axis.
  13735. @table @samp
  13736. @item none
  13737. No mirror.
  13738. @item x
  13739. Mirror only x axis.
  13740. @item y
  13741. Mirror only y axis.
  13742. @item xy
  13743. Mirror both axis.
  13744. @end table
  13745. @end table
  13746. @subsection Examples
  13747. @itemize
  13748. @item
  13749. Complete example using @command{ffplay}:
  13750. @example
  13751. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  13752. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  13753. @end example
  13754. @end itemize
  13755. @section bench, abench
  13756. Benchmark part of a filtergraph.
  13757. The filter accepts the following options:
  13758. @table @option
  13759. @item action
  13760. Start or stop a timer.
  13761. Available values are:
  13762. @table @samp
  13763. @item start
  13764. Get the current time, set it as frame metadata (using the key
  13765. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  13766. @item stop
  13767. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  13768. the input frame metadata to get the time difference. Time difference, average,
  13769. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  13770. @code{min}) are then printed. The timestamps are expressed in seconds.
  13771. @end table
  13772. @end table
  13773. @subsection Examples
  13774. @itemize
  13775. @item
  13776. Benchmark @ref{selectivecolor} filter:
  13777. @example
  13778. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  13779. @end example
  13780. @end itemize
  13781. @section concat
  13782. Concatenate audio and video streams, joining them together one after the
  13783. other.
  13784. The filter works on segments of synchronized video and audio streams. All
  13785. segments must have the same number of streams of each type, and that will
  13786. also be the number of streams at output.
  13787. The filter accepts the following options:
  13788. @table @option
  13789. @item n
  13790. Set the number of segments. Default is 2.
  13791. @item v
  13792. Set the number of output video streams, that is also the number of video
  13793. streams in each segment. Default is 1.
  13794. @item a
  13795. Set the number of output audio streams, that is also the number of audio
  13796. streams in each segment. Default is 0.
  13797. @item unsafe
  13798. Activate unsafe mode: do not fail if segments have a different format.
  13799. @end table
  13800. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  13801. @var{a} audio outputs.
  13802. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  13803. segment, in the same order as the outputs, then the inputs for the second
  13804. segment, etc.
  13805. Related streams do not always have exactly the same duration, for various
  13806. reasons including codec frame size or sloppy authoring. For that reason,
  13807. related synchronized streams (e.g. a video and its audio track) should be
  13808. concatenated at once. The concat filter will use the duration of the longest
  13809. stream in each segment (except the last one), and if necessary pad shorter
  13810. audio streams with silence.
  13811. For this filter to work correctly, all segments must start at timestamp 0.
  13812. All corresponding streams must have the same parameters in all segments; the
  13813. filtering system will automatically select a common pixel format for video
  13814. streams, and a common sample format, sample rate and channel layout for
  13815. audio streams, but other settings, such as resolution, must be converted
  13816. explicitly by the user.
  13817. Different frame rates are acceptable but will result in variable frame rate
  13818. at output; be sure to configure the output file to handle it.
  13819. @subsection Examples
  13820. @itemize
  13821. @item
  13822. Concatenate an opening, an episode and an ending, all in bilingual version
  13823. (video in stream 0, audio in streams 1 and 2):
  13824. @example
  13825. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  13826. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  13827. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  13828. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  13829. @end example
  13830. @item
  13831. Concatenate two parts, handling audio and video separately, using the
  13832. (a)movie sources, and adjusting the resolution:
  13833. @example
  13834. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  13835. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  13836. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  13837. @end example
  13838. Note that a desync will happen at the stitch if the audio and video streams
  13839. do not have exactly the same duration in the first file.
  13840. @end itemize
  13841. @section drawgraph, adrawgraph
  13842. Draw a graph using input video or audio metadata.
  13843. It accepts the following parameters:
  13844. @table @option
  13845. @item m1
  13846. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  13847. @item fg1
  13848. Set 1st foreground color expression.
  13849. @item m2
  13850. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  13851. @item fg2
  13852. Set 2nd foreground color expression.
  13853. @item m3
  13854. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  13855. @item fg3
  13856. Set 3rd foreground color expression.
  13857. @item m4
  13858. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  13859. @item fg4
  13860. Set 4th foreground color expression.
  13861. @item min
  13862. Set minimal value of metadata value.
  13863. @item max
  13864. Set maximal value of metadata value.
  13865. @item bg
  13866. Set graph background color. Default is white.
  13867. @item mode
  13868. Set graph mode.
  13869. Available values for mode is:
  13870. @table @samp
  13871. @item bar
  13872. @item dot
  13873. @item line
  13874. @end table
  13875. Default is @code{line}.
  13876. @item slide
  13877. Set slide mode.
  13878. Available values for slide is:
  13879. @table @samp
  13880. @item frame
  13881. Draw new frame when right border is reached.
  13882. @item replace
  13883. Replace old columns with new ones.
  13884. @item scroll
  13885. Scroll from right to left.
  13886. @item rscroll
  13887. Scroll from left to right.
  13888. @item picture
  13889. Draw single picture.
  13890. @end table
  13891. Default is @code{frame}.
  13892. @item size
  13893. Set size of graph video. For the syntax of this option, check the
  13894. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13895. The default value is @code{900x256}.
  13896. The foreground color expressions can use the following variables:
  13897. @table @option
  13898. @item MIN
  13899. Minimal value of metadata value.
  13900. @item MAX
  13901. Maximal value of metadata value.
  13902. @item VAL
  13903. Current metadata key value.
  13904. @end table
  13905. The color is defined as 0xAABBGGRR.
  13906. @end table
  13907. Example using metadata from @ref{signalstats} filter:
  13908. @example
  13909. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  13910. @end example
  13911. Example using metadata from @ref{ebur128} filter:
  13912. @example
  13913. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  13914. @end example
  13915. @anchor{ebur128}
  13916. @section ebur128
  13917. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  13918. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  13919. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  13920. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  13921. The filter also has a video output (see the @var{video} option) with a real
  13922. time graph to observe the loudness evolution. The graphic contains the logged
  13923. message mentioned above, so it is not printed anymore when this option is set,
  13924. unless the verbose logging is set. The main graphing area contains the
  13925. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  13926. the momentary loudness (400 milliseconds).
  13927. More information about the Loudness Recommendation EBU R128 on
  13928. @url{http://tech.ebu.ch/loudness}.
  13929. The filter accepts the following options:
  13930. @table @option
  13931. @item video
  13932. Activate the video output. The audio stream is passed unchanged whether this
  13933. option is set or no. The video stream will be the first output stream if
  13934. activated. Default is @code{0}.
  13935. @item size
  13936. Set the video size. This option is for video only. For the syntax of this
  13937. option, check the
  13938. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13939. Default and minimum resolution is @code{640x480}.
  13940. @item meter
  13941. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  13942. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  13943. other integer value between this range is allowed.
  13944. @item metadata
  13945. Set metadata injection. If set to @code{1}, the audio input will be segmented
  13946. into 100ms output frames, each of them containing various loudness information
  13947. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  13948. Default is @code{0}.
  13949. @item framelog
  13950. Force the frame logging level.
  13951. Available values are:
  13952. @table @samp
  13953. @item info
  13954. information logging level
  13955. @item verbose
  13956. verbose logging level
  13957. @end table
  13958. By default, the logging level is set to @var{info}. If the @option{video} or
  13959. the @option{metadata} options are set, it switches to @var{verbose}.
  13960. @item peak
  13961. Set peak mode(s).
  13962. Available modes can be cumulated (the option is a @code{flag} type). Possible
  13963. values are:
  13964. @table @samp
  13965. @item none
  13966. Disable any peak mode (default).
  13967. @item sample
  13968. Enable sample-peak mode.
  13969. Simple peak mode looking for the higher sample value. It logs a message
  13970. for sample-peak (identified by @code{SPK}).
  13971. @item true
  13972. Enable true-peak mode.
  13973. If enabled, the peak lookup is done on an over-sampled version of the input
  13974. stream for better peak accuracy. It logs a message for true-peak.
  13975. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  13976. This mode requires a build with @code{libswresample}.
  13977. @end table
  13978. @item dualmono
  13979. Treat mono input files as "dual mono". If a mono file is intended for playback
  13980. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  13981. If set to @code{true}, this option will compensate for this effect.
  13982. Multi-channel input files are not affected by this option.
  13983. @item panlaw
  13984. Set a specific pan law to be used for the measurement of dual mono files.
  13985. This parameter is optional, and has a default value of -3.01dB.
  13986. @end table
  13987. @subsection Examples
  13988. @itemize
  13989. @item
  13990. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  13991. @example
  13992. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  13993. @end example
  13994. @item
  13995. Run an analysis with @command{ffmpeg}:
  13996. @example
  13997. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  13998. @end example
  13999. @end itemize
  14000. @section interleave, ainterleave
  14001. Temporally interleave frames from several inputs.
  14002. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  14003. These filters read frames from several inputs and send the oldest
  14004. queued frame to the output.
  14005. Input streams must have well defined, monotonically increasing frame
  14006. timestamp values.
  14007. In order to submit one frame to output, these filters need to enqueue
  14008. at least one frame for each input, so they cannot work in case one
  14009. input is not yet terminated and will not receive incoming frames.
  14010. For example consider the case when one input is a @code{select} filter
  14011. which always drops input frames. The @code{interleave} filter will keep
  14012. reading from that input, but it will never be able to send new frames
  14013. to output until the input sends an end-of-stream signal.
  14014. Also, depending on inputs synchronization, the filters will drop
  14015. frames in case one input receives more frames than the other ones, and
  14016. the queue is already filled.
  14017. These filters accept the following options:
  14018. @table @option
  14019. @item nb_inputs, n
  14020. Set the number of different inputs, it is 2 by default.
  14021. @end table
  14022. @subsection Examples
  14023. @itemize
  14024. @item
  14025. Interleave frames belonging to different streams using @command{ffmpeg}:
  14026. @example
  14027. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  14028. @end example
  14029. @item
  14030. Add flickering blur effect:
  14031. @example
  14032. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  14033. @end example
  14034. @end itemize
  14035. @section metadata, ametadata
  14036. Manipulate frame metadata.
  14037. This filter accepts the following options:
  14038. @table @option
  14039. @item mode
  14040. Set mode of operation of the filter.
  14041. Can be one of the following:
  14042. @table @samp
  14043. @item select
  14044. If both @code{value} and @code{key} is set, select frames
  14045. which have such metadata. If only @code{key} is set, select
  14046. every frame that has such key in metadata.
  14047. @item add
  14048. Add new metadata @code{key} and @code{value}. If key is already available
  14049. do nothing.
  14050. @item modify
  14051. Modify value of already present key.
  14052. @item delete
  14053. If @code{value} is set, delete only keys that have such value.
  14054. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  14055. the frame.
  14056. @item print
  14057. Print key and its value if metadata was found. If @code{key} is not set print all
  14058. metadata values available in frame.
  14059. @end table
  14060. @item key
  14061. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  14062. @item value
  14063. Set metadata value which will be used. This option is mandatory for
  14064. @code{modify} and @code{add} mode.
  14065. @item function
  14066. Which function to use when comparing metadata value and @code{value}.
  14067. Can be one of following:
  14068. @table @samp
  14069. @item same_str
  14070. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  14071. @item starts_with
  14072. Values are interpreted as strings, returns true if metadata value starts with
  14073. the @code{value} option string.
  14074. @item less
  14075. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  14076. @item equal
  14077. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  14078. @item greater
  14079. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  14080. @item expr
  14081. Values are interpreted as floats, returns true if expression from option @code{expr}
  14082. evaluates to true.
  14083. @end table
  14084. @item expr
  14085. Set expression which is used when @code{function} is set to @code{expr}.
  14086. The expression is evaluated through the eval API and can contain the following
  14087. constants:
  14088. @table @option
  14089. @item VALUE1
  14090. Float representation of @code{value} from metadata key.
  14091. @item VALUE2
  14092. Float representation of @code{value} as supplied by user in @code{value} option.
  14093. @end table
  14094. @item file
  14095. If specified in @code{print} mode, output is written to the named file. Instead of
  14096. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  14097. for standard output. If @code{file} option is not set, output is written to the log
  14098. with AV_LOG_INFO loglevel.
  14099. @end table
  14100. @subsection Examples
  14101. @itemize
  14102. @item
  14103. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  14104. between 0 and 1.
  14105. @example
  14106. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  14107. @end example
  14108. @item
  14109. Print silencedetect output to file @file{metadata.txt}.
  14110. @example
  14111. silencedetect,ametadata=mode=print:file=metadata.txt
  14112. @end example
  14113. @item
  14114. Direct all metadata to a pipe with file descriptor 4.
  14115. @example
  14116. metadata=mode=print:file='pipe\:4'
  14117. @end example
  14118. @end itemize
  14119. @section perms, aperms
  14120. Set read/write permissions for the output frames.
  14121. These filters are mainly aimed at developers to test direct path in the
  14122. following filter in the filtergraph.
  14123. The filters accept the following options:
  14124. @table @option
  14125. @item mode
  14126. Select the permissions mode.
  14127. It accepts the following values:
  14128. @table @samp
  14129. @item none
  14130. Do nothing. This is the default.
  14131. @item ro
  14132. Set all the output frames read-only.
  14133. @item rw
  14134. Set all the output frames directly writable.
  14135. @item toggle
  14136. Make the frame read-only if writable, and writable if read-only.
  14137. @item random
  14138. Set each output frame read-only or writable randomly.
  14139. @end table
  14140. @item seed
  14141. Set the seed for the @var{random} mode, must be an integer included between
  14142. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  14143. @code{-1}, the filter will try to use a good random seed on a best effort
  14144. basis.
  14145. @end table
  14146. Note: in case of auto-inserted filter between the permission filter and the
  14147. following one, the permission might not be received as expected in that
  14148. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  14149. perms/aperms filter can avoid this problem.
  14150. @section realtime, arealtime
  14151. Slow down filtering to match real time approximately.
  14152. These filters will pause the filtering for a variable amount of time to
  14153. match the output rate with the input timestamps.
  14154. They are similar to the @option{re} option to @code{ffmpeg}.
  14155. They accept the following options:
  14156. @table @option
  14157. @item limit
  14158. Time limit for the pauses. Any pause longer than that will be considered
  14159. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  14160. @end table
  14161. @anchor{select}
  14162. @section select, aselect
  14163. Select frames to pass in output.
  14164. This filter accepts the following options:
  14165. @table @option
  14166. @item expr, e
  14167. Set expression, which is evaluated for each input frame.
  14168. If the expression is evaluated to zero, the frame is discarded.
  14169. If the evaluation result is negative or NaN, the frame is sent to the
  14170. first output; otherwise it is sent to the output with index
  14171. @code{ceil(val)-1}, assuming that the input index starts from 0.
  14172. For example a value of @code{1.2} corresponds to the output with index
  14173. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  14174. @item outputs, n
  14175. Set the number of outputs. The output to which to send the selected
  14176. frame is based on the result of the evaluation. Default value is 1.
  14177. @end table
  14178. The expression can contain the following constants:
  14179. @table @option
  14180. @item n
  14181. The (sequential) number of the filtered frame, starting from 0.
  14182. @item selected_n
  14183. The (sequential) number of the selected frame, starting from 0.
  14184. @item prev_selected_n
  14185. The sequential number of the last selected frame. It's NAN if undefined.
  14186. @item TB
  14187. The timebase of the input timestamps.
  14188. @item pts
  14189. The PTS (Presentation TimeStamp) of the filtered video frame,
  14190. expressed in @var{TB} units. It's NAN if undefined.
  14191. @item t
  14192. The PTS of the filtered video frame,
  14193. expressed in seconds. It's NAN if undefined.
  14194. @item prev_pts
  14195. The PTS of the previously filtered video frame. It's NAN if undefined.
  14196. @item prev_selected_pts
  14197. The PTS of the last previously filtered video frame. It's NAN if undefined.
  14198. @item prev_selected_t
  14199. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  14200. @item start_pts
  14201. The PTS of the first video frame in the video. It's NAN if undefined.
  14202. @item start_t
  14203. The time of the first video frame in the video. It's NAN if undefined.
  14204. @item pict_type @emph{(video only)}
  14205. The type of the filtered frame. It can assume one of the following
  14206. values:
  14207. @table @option
  14208. @item I
  14209. @item P
  14210. @item B
  14211. @item S
  14212. @item SI
  14213. @item SP
  14214. @item BI
  14215. @end table
  14216. @item interlace_type @emph{(video only)}
  14217. The frame interlace type. It can assume one of the following values:
  14218. @table @option
  14219. @item PROGRESSIVE
  14220. The frame is progressive (not interlaced).
  14221. @item TOPFIRST
  14222. The frame is top-field-first.
  14223. @item BOTTOMFIRST
  14224. The frame is bottom-field-first.
  14225. @end table
  14226. @item consumed_sample_n @emph{(audio only)}
  14227. the number of selected samples before the current frame
  14228. @item samples_n @emph{(audio only)}
  14229. the number of samples in the current frame
  14230. @item sample_rate @emph{(audio only)}
  14231. the input sample rate
  14232. @item key
  14233. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  14234. @item pos
  14235. the position in the file of the filtered frame, -1 if the information
  14236. is not available (e.g. for synthetic video)
  14237. @item scene @emph{(video only)}
  14238. value between 0 and 1 to indicate a new scene; a low value reflects a low
  14239. probability for the current frame to introduce a new scene, while a higher
  14240. value means the current frame is more likely to be one (see the example below)
  14241. @item concatdec_select
  14242. The concat demuxer can select only part of a concat input file by setting an
  14243. inpoint and an outpoint, but the output packets may not be entirely contained
  14244. in the selected interval. By using this variable, it is possible to skip frames
  14245. generated by the concat demuxer which are not exactly contained in the selected
  14246. interval.
  14247. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  14248. and the @var{lavf.concat.duration} packet metadata values which are also
  14249. present in the decoded frames.
  14250. The @var{concatdec_select} variable is -1 if the frame pts is at least
  14251. start_time and either the duration metadata is missing or the frame pts is less
  14252. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  14253. missing.
  14254. That basically means that an input frame is selected if its pts is within the
  14255. interval set by the concat demuxer.
  14256. @end table
  14257. The default value of the select expression is "1".
  14258. @subsection Examples
  14259. @itemize
  14260. @item
  14261. Select all frames in input:
  14262. @example
  14263. select
  14264. @end example
  14265. The example above is the same as:
  14266. @example
  14267. select=1
  14268. @end example
  14269. @item
  14270. Skip all frames:
  14271. @example
  14272. select=0
  14273. @end example
  14274. @item
  14275. Select only I-frames:
  14276. @example
  14277. select='eq(pict_type\,I)'
  14278. @end example
  14279. @item
  14280. Select one frame every 100:
  14281. @example
  14282. select='not(mod(n\,100))'
  14283. @end example
  14284. @item
  14285. Select only frames contained in the 10-20 time interval:
  14286. @example
  14287. select=between(t\,10\,20)
  14288. @end example
  14289. @item
  14290. Select only I-frames contained in the 10-20 time interval:
  14291. @example
  14292. select=between(t\,10\,20)*eq(pict_type\,I)
  14293. @end example
  14294. @item
  14295. Select frames with a minimum distance of 10 seconds:
  14296. @example
  14297. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  14298. @end example
  14299. @item
  14300. Use aselect to select only audio frames with samples number > 100:
  14301. @example
  14302. aselect='gt(samples_n\,100)'
  14303. @end example
  14304. @item
  14305. Create a mosaic of the first scenes:
  14306. @example
  14307. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  14308. @end example
  14309. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  14310. choice.
  14311. @item
  14312. Send even and odd frames to separate outputs, and compose them:
  14313. @example
  14314. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  14315. @end example
  14316. @item
  14317. Select useful frames from an ffconcat file which is using inpoints and
  14318. outpoints but where the source files are not intra frame only.
  14319. @example
  14320. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  14321. @end example
  14322. @end itemize
  14323. @section sendcmd, asendcmd
  14324. Send commands to filters in the filtergraph.
  14325. These filters read commands to be sent to other filters in the
  14326. filtergraph.
  14327. @code{sendcmd} must be inserted between two video filters,
  14328. @code{asendcmd} must be inserted between two audio filters, but apart
  14329. from that they act the same way.
  14330. The specification of commands can be provided in the filter arguments
  14331. with the @var{commands} option, or in a file specified by the
  14332. @var{filename} option.
  14333. These filters accept the following options:
  14334. @table @option
  14335. @item commands, c
  14336. Set the commands to be read and sent to the other filters.
  14337. @item filename, f
  14338. Set the filename of the commands to be read and sent to the other
  14339. filters.
  14340. @end table
  14341. @subsection Commands syntax
  14342. A commands description consists of a sequence of interval
  14343. specifications, comprising a list of commands to be executed when a
  14344. particular event related to that interval occurs. The occurring event
  14345. is typically the current frame time entering or leaving a given time
  14346. interval.
  14347. An interval is specified by the following syntax:
  14348. @example
  14349. @var{START}[-@var{END}] @var{COMMANDS};
  14350. @end example
  14351. The time interval is specified by the @var{START} and @var{END} times.
  14352. @var{END} is optional and defaults to the maximum time.
  14353. The current frame time is considered within the specified interval if
  14354. it is included in the interval [@var{START}, @var{END}), that is when
  14355. the time is greater or equal to @var{START} and is lesser than
  14356. @var{END}.
  14357. @var{COMMANDS} consists of a sequence of one or more command
  14358. specifications, separated by ",", relating to that interval. The
  14359. syntax of a command specification is given by:
  14360. @example
  14361. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  14362. @end example
  14363. @var{FLAGS} is optional and specifies the type of events relating to
  14364. the time interval which enable sending the specified command, and must
  14365. be a non-null sequence of identifier flags separated by "+" or "|" and
  14366. enclosed between "[" and "]".
  14367. The following flags are recognized:
  14368. @table @option
  14369. @item enter
  14370. The command is sent when the current frame timestamp enters the
  14371. specified interval. In other words, the command is sent when the
  14372. previous frame timestamp was not in the given interval, and the
  14373. current is.
  14374. @item leave
  14375. The command is sent when the current frame timestamp leaves the
  14376. specified interval. In other words, the command is sent when the
  14377. previous frame timestamp was in the given interval, and the
  14378. current is not.
  14379. @end table
  14380. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  14381. assumed.
  14382. @var{TARGET} specifies the target of the command, usually the name of
  14383. the filter class or a specific filter instance name.
  14384. @var{COMMAND} specifies the name of the command for the target filter.
  14385. @var{ARG} is optional and specifies the optional list of argument for
  14386. the given @var{COMMAND}.
  14387. Between one interval specification and another, whitespaces, or
  14388. sequences of characters starting with @code{#} until the end of line,
  14389. are ignored and can be used to annotate comments.
  14390. A simplified BNF description of the commands specification syntax
  14391. follows:
  14392. @example
  14393. @var{COMMAND_FLAG} ::= "enter" | "leave"
  14394. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  14395. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  14396. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  14397. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  14398. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  14399. @end example
  14400. @subsection Examples
  14401. @itemize
  14402. @item
  14403. Specify audio tempo change at second 4:
  14404. @example
  14405. asendcmd=c='4.0 atempo tempo 1.5',atempo
  14406. @end example
  14407. @item
  14408. Target a specific filter instance:
  14409. @example
  14410. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  14411. @end example
  14412. @item
  14413. Specify a list of drawtext and hue commands in a file.
  14414. @example
  14415. # show text in the interval 5-10
  14416. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  14417. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  14418. # desaturate the image in the interval 15-20
  14419. 15.0-20.0 [enter] hue s 0,
  14420. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  14421. [leave] hue s 1,
  14422. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  14423. # apply an exponential saturation fade-out effect, starting from time 25
  14424. 25 [enter] hue s exp(25-t)
  14425. @end example
  14426. A filtergraph allowing to read and process the above command list
  14427. stored in a file @file{test.cmd}, can be specified with:
  14428. @example
  14429. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  14430. @end example
  14431. @end itemize
  14432. @anchor{setpts}
  14433. @section setpts, asetpts
  14434. Change the PTS (presentation timestamp) of the input frames.
  14435. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  14436. This filter accepts the following options:
  14437. @table @option
  14438. @item expr
  14439. The expression which is evaluated for each frame to construct its timestamp.
  14440. @end table
  14441. The expression is evaluated through the eval API and can contain the following
  14442. constants:
  14443. @table @option
  14444. @item FRAME_RATE
  14445. frame rate, only defined for constant frame-rate video
  14446. @item PTS
  14447. The presentation timestamp in input
  14448. @item N
  14449. The count of the input frame for video or the number of consumed samples,
  14450. not including the current frame for audio, starting from 0.
  14451. @item NB_CONSUMED_SAMPLES
  14452. The number of consumed samples, not including the current frame (only
  14453. audio)
  14454. @item NB_SAMPLES, S
  14455. The number of samples in the current frame (only audio)
  14456. @item SAMPLE_RATE, SR
  14457. The audio sample rate.
  14458. @item STARTPTS
  14459. The PTS of the first frame.
  14460. @item STARTT
  14461. the time in seconds of the first frame
  14462. @item INTERLACED
  14463. State whether the current frame is interlaced.
  14464. @item T
  14465. the time in seconds of the current frame
  14466. @item POS
  14467. original position in the file of the frame, or undefined if undefined
  14468. for the current frame
  14469. @item PREV_INPTS
  14470. The previous input PTS.
  14471. @item PREV_INT
  14472. previous input time in seconds
  14473. @item PREV_OUTPTS
  14474. The previous output PTS.
  14475. @item PREV_OUTT
  14476. previous output time in seconds
  14477. @item RTCTIME
  14478. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  14479. instead.
  14480. @item RTCSTART
  14481. The wallclock (RTC) time at the start of the movie in microseconds.
  14482. @item TB
  14483. The timebase of the input timestamps.
  14484. @end table
  14485. @subsection Examples
  14486. @itemize
  14487. @item
  14488. Start counting PTS from zero
  14489. @example
  14490. setpts=PTS-STARTPTS
  14491. @end example
  14492. @item
  14493. Apply fast motion effect:
  14494. @example
  14495. setpts=0.5*PTS
  14496. @end example
  14497. @item
  14498. Apply slow motion effect:
  14499. @example
  14500. setpts=2.0*PTS
  14501. @end example
  14502. @item
  14503. Set fixed rate of 25 frames per second:
  14504. @example
  14505. setpts=N/(25*TB)
  14506. @end example
  14507. @item
  14508. Set fixed rate 25 fps with some jitter:
  14509. @example
  14510. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  14511. @end example
  14512. @item
  14513. Apply an offset of 10 seconds to the input PTS:
  14514. @example
  14515. setpts=PTS+10/TB
  14516. @end example
  14517. @item
  14518. Generate timestamps from a "live source" and rebase onto the current timebase:
  14519. @example
  14520. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  14521. @end example
  14522. @item
  14523. Generate timestamps by counting samples:
  14524. @example
  14525. asetpts=N/SR/TB
  14526. @end example
  14527. @end itemize
  14528. @section setrange
  14529. Force color range for the output video frame.
  14530. The @code{setrange} filter marks the color range property for the
  14531. output frames. It does not change the input frame, but only sets the
  14532. corresponding property, which affects how the frame is treated by
  14533. following filters.
  14534. The filter accepts the following options:
  14535. @table @option
  14536. @item range
  14537. Available values are:
  14538. @table @samp
  14539. @item auto
  14540. Keep the same color range property.
  14541. @item unspecified, unknown
  14542. Set the color range as unspecified.
  14543. @item limited, tv, mpeg
  14544. Set the color range as limited.
  14545. @item full, pc, jpeg
  14546. Set the color range as full.
  14547. @end table
  14548. @end table
  14549. @section settb, asettb
  14550. Set the timebase to use for the output frames timestamps.
  14551. It is mainly useful for testing timebase configuration.
  14552. It accepts the following parameters:
  14553. @table @option
  14554. @item expr, tb
  14555. The expression which is evaluated into the output timebase.
  14556. @end table
  14557. The value for @option{tb} is an arithmetic expression representing a
  14558. rational. The expression can contain the constants "AVTB" (the default
  14559. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  14560. audio only). Default value is "intb".
  14561. @subsection Examples
  14562. @itemize
  14563. @item
  14564. Set the timebase to 1/25:
  14565. @example
  14566. settb=expr=1/25
  14567. @end example
  14568. @item
  14569. Set the timebase to 1/10:
  14570. @example
  14571. settb=expr=0.1
  14572. @end example
  14573. @item
  14574. Set the timebase to 1001/1000:
  14575. @example
  14576. settb=1+0.001
  14577. @end example
  14578. @item
  14579. Set the timebase to 2*intb:
  14580. @example
  14581. settb=2*intb
  14582. @end example
  14583. @item
  14584. Set the default timebase value:
  14585. @example
  14586. settb=AVTB
  14587. @end example
  14588. @end itemize
  14589. @section showcqt
  14590. Convert input audio to a video output representing frequency spectrum
  14591. logarithmically using Brown-Puckette constant Q transform algorithm with
  14592. direct frequency domain coefficient calculation (but the transform itself
  14593. is not really constant Q, instead the Q factor is actually variable/clamped),
  14594. with musical tone scale, from E0 to D#10.
  14595. The filter accepts the following options:
  14596. @table @option
  14597. @item size, s
  14598. Specify the video size for the output. It must be even. For the syntax of this option,
  14599. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14600. Default value is @code{1920x1080}.
  14601. @item fps, rate, r
  14602. Set the output frame rate. Default value is @code{25}.
  14603. @item bar_h
  14604. Set the bargraph height. It must be even. Default value is @code{-1} which
  14605. computes the bargraph height automatically.
  14606. @item axis_h
  14607. Set the axis height. It must be even. Default value is @code{-1} which computes
  14608. the axis height automatically.
  14609. @item sono_h
  14610. Set the sonogram height. It must be even. Default value is @code{-1} which
  14611. computes the sonogram height automatically.
  14612. @item fullhd
  14613. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  14614. instead. Default value is @code{1}.
  14615. @item sono_v, volume
  14616. Specify the sonogram volume expression. It can contain variables:
  14617. @table @option
  14618. @item bar_v
  14619. the @var{bar_v} evaluated expression
  14620. @item frequency, freq, f
  14621. the frequency where it is evaluated
  14622. @item timeclamp, tc
  14623. the value of @var{timeclamp} option
  14624. @end table
  14625. and functions:
  14626. @table @option
  14627. @item a_weighting(f)
  14628. A-weighting of equal loudness
  14629. @item b_weighting(f)
  14630. B-weighting of equal loudness
  14631. @item c_weighting(f)
  14632. C-weighting of equal loudness.
  14633. @end table
  14634. Default value is @code{16}.
  14635. @item bar_v, volume2
  14636. Specify the bargraph volume expression. It can contain variables:
  14637. @table @option
  14638. @item sono_v
  14639. the @var{sono_v} evaluated expression
  14640. @item frequency, freq, f
  14641. the frequency where it is evaluated
  14642. @item timeclamp, tc
  14643. the value of @var{timeclamp} option
  14644. @end table
  14645. and functions:
  14646. @table @option
  14647. @item a_weighting(f)
  14648. A-weighting of equal loudness
  14649. @item b_weighting(f)
  14650. B-weighting of equal loudness
  14651. @item c_weighting(f)
  14652. C-weighting of equal loudness.
  14653. @end table
  14654. Default value is @code{sono_v}.
  14655. @item sono_g, gamma
  14656. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  14657. higher gamma makes the spectrum having more range. Default value is @code{3}.
  14658. Acceptable range is @code{[1, 7]}.
  14659. @item bar_g, gamma2
  14660. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  14661. @code{[1, 7]}.
  14662. @item bar_t
  14663. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  14664. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  14665. @item timeclamp, tc
  14666. Specify the transform timeclamp. At low frequency, there is trade-off between
  14667. accuracy in time domain and frequency domain. If timeclamp is lower,
  14668. event in time domain is represented more accurately (such as fast bass drum),
  14669. otherwise event in frequency domain is represented more accurately
  14670. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  14671. @item attack
  14672. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  14673. limits future samples by applying asymmetric windowing in time domain, useful
  14674. when low latency is required. Accepted range is @code{[0, 1]}.
  14675. @item basefreq
  14676. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  14677. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  14678. @item endfreq
  14679. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  14680. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  14681. @item coeffclamp
  14682. This option is deprecated and ignored.
  14683. @item tlength
  14684. Specify the transform length in time domain. Use this option to control accuracy
  14685. trade-off between time domain and frequency domain at every frequency sample.
  14686. It can contain variables:
  14687. @table @option
  14688. @item frequency, freq, f
  14689. the frequency where it is evaluated
  14690. @item timeclamp, tc
  14691. the value of @var{timeclamp} option.
  14692. @end table
  14693. Default value is @code{384*tc/(384+tc*f)}.
  14694. @item count
  14695. Specify the transform count for every video frame. Default value is @code{6}.
  14696. Acceptable range is @code{[1, 30]}.
  14697. @item fcount
  14698. Specify the transform count for every single pixel. Default value is @code{0},
  14699. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  14700. @item fontfile
  14701. Specify font file for use with freetype to draw the axis. If not specified,
  14702. use embedded font. Note that drawing with font file or embedded font is not
  14703. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  14704. option instead.
  14705. @item font
  14706. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  14707. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  14708. @item fontcolor
  14709. Specify font color expression. This is arithmetic expression that should return
  14710. integer value 0xRRGGBB. It can contain variables:
  14711. @table @option
  14712. @item frequency, freq, f
  14713. the frequency where it is evaluated
  14714. @item timeclamp, tc
  14715. the value of @var{timeclamp} option
  14716. @end table
  14717. and functions:
  14718. @table @option
  14719. @item midi(f)
  14720. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  14721. @item r(x), g(x), b(x)
  14722. red, green, and blue value of intensity x.
  14723. @end table
  14724. Default value is @code{st(0, (midi(f)-59.5)/12);
  14725. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  14726. r(1-ld(1)) + b(ld(1))}.
  14727. @item axisfile
  14728. Specify image file to draw the axis. This option override @var{fontfile} and
  14729. @var{fontcolor} option.
  14730. @item axis, text
  14731. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  14732. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  14733. Default value is @code{1}.
  14734. @item csp
  14735. Set colorspace. The accepted values are:
  14736. @table @samp
  14737. @item unspecified
  14738. Unspecified (default)
  14739. @item bt709
  14740. BT.709
  14741. @item fcc
  14742. FCC
  14743. @item bt470bg
  14744. BT.470BG or BT.601-6 625
  14745. @item smpte170m
  14746. SMPTE-170M or BT.601-6 525
  14747. @item smpte240m
  14748. SMPTE-240M
  14749. @item bt2020ncl
  14750. BT.2020 with non-constant luminance
  14751. @end table
  14752. @item cscheme
  14753. Set spectrogram color scheme. This is list of floating point values with format
  14754. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  14755. The default is @code{1|0.5|0|0|0.5|1}.
  14756. @end table
  14757. @subsection Examples
  14758. @itemize
  14759. @item
  14760. Playing audio while showing the spectrum:
  14761. @example
  14762. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  14763. @end example
  14764. @item
  14765. Same as above, but with frame rate 30 fps:
  14766. @example
  14767. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  14768. @end example
  14769. @item
  14770. Playing at 1280x720:
  14771. @example
  14772. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  14773. @end example
  14774. @item
  14775. Disable sonogram display:
  14776. @example
  14777. sono_h=0
  14778. @end example
  14779. @item
  14780. A1 and its harmonics: A1, A2, (near)E3, A3:
  14781. @example
  14782. 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),
  14783. asplit[a][out1]; [a] showcqt [out0]'
  14784. @end example
  14785. @item
  14786. Same as above, but with more accuracy in frequency domain:
  14787. @example
  14788. 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),
  14789. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  14790. @end example
  14791. @item
  14792. Custom volume:
  14793. @example
  14794. bar_v=10:sono_v=bar_v*a_weighting(f)
  14795. @end example
  14796. @item
  14797. Custom gamma, now spectrum is linear to the amplitude.
  14798. @example
  14799. bar_g=2:sono_g=2
  14800. @end example
  14801. @item
  14802. Custom tlength equation:
  14803. @example
  14804. 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)))'
  14805. @end example
  14806. @item
  14807. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  14808. @example
  14809. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  14810. @end example
  14811. @item
  14812. Custom font using fontconfig:
  14813. @example
  14814. font='Courier New,Monospace,mono|bold'
  14815. @end example
  14816. @item
  14817. Custom frequency range with custom axis using image file:
  14818. @example
  14819. axisfile=myaxis.png:basefreq=40:endfreq=10000
  14820. @end example
  14821. @end itemize
  14822. @section showfreqs
  14823. Convert input audio to video output representing the audio power spectrum.
  14824. Audio amplitude is on Y-axis while frequency is on X-axis.
  14825. The filter accepts the following options:
  14826. @table @option
  14827. @item size, s
  14828. Specify size of video. For the syntax of this option, check the
  14829. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14830. Default is @code{1024x512}.
  14831. @item mode
  14832. Set display mode.
  14833. This set how each frequency bin will be represented.
  14834. It accepts the following values:
  14835. @table @samp
  14836. @item line
  14837. @item bar
  14838. @item dot
  14839. @end table
  14840. Default is @code{bar}.
  14841. @item ascale
  14842. Set amplitude scale.
  14843. It accepts the following values:
  14844. @table @samp
  14845. @item lin
  14846. Linear scale.
  14847. @item sqrt
  14848. Square root scale.
  14849. @item cbrt
  14850. Cubic root scale.
  14851. @item log
  14852. Logarithmic scale.
  14853. @end table
  14854. Default is @code{log}.
  14855. @item fscale
  14856. Set frequency scale.
  14857. It accepts the following values:
  14858. @table @samp
  14859. @item lin
  14860. Linear scale.
  14861. @item log
  14862. Logarithmic scale.
  14863. @item rlog
  14864. Reverse logarithmic scale.
  14865. @end table
  14866. Default is @code{lin}.
  14867. @item win_size
  14868. Set window size.
  14869. It accepts the following values:
  14870. @table @samp
  14871. @item w16
  14872. @item w32
  14873. @item w64
  14874. @item w128
  14875. @item w256
  14876. @item w512
  14877. @item w1024
  14878. @item w2048
  14879. @item w4096
  14880. @item w8192
  14881. @item w16384
  14882. @item w32768
  14883. @item w65536
  14884. @end table
  14885. Default is @code{w2048}
  14886. @item win_func
  14887. Set windowing function.
  14888. It accepts the following values:
  14889. @table @samp
  14890. @item rect
  14891. @item bartlett
  14892. @item hanning
  14893. @item hamming
  14894. @item blackman
  14895. @item welch
  14896. @item flattop
  14897. @item bharris
  14898. @item bnuttall
  14899. @item bhann
  14900. @item sine
  14901. @item nuttall
  14902. @item lanczos
  14903. @item gauss
  14904. @item tukey
  14905. @item dolph
  14906. @item cauchy
  14907. @item parzen
  14908. @item poisson
  14909. @end table
  14910. Default is @code{hanning}.
  14911. @item overlap
  14912. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14913. which means optimal overlap for selected window function will be picked.
  14914. @item averaging
  14915. Set time averaging. Setting this to 0 will display current maximal peaks.
  14916. Default is @code{1}, which means time averaging is disabled.
  14917. @item colors
  14918. Specify list of colors separated by space or by '|' which will be used to
  14919. draw channel frequencies. Unrecognized or missing colors will be replaced
  14920. by white color.
  14921. @item cmode
  14922. Set channel display mode.
  14923. It accepts the following values:
  14924. @table @samp
  14925. @item combined
  14926. @item separate
  14927. @end table
  14928. Default is @code{combined}.
  14929. @item minamp
  14930. Set minimum amplitude used in @code{log} amplitude scaler.
  14931. @end table
  14932. @anchor{showspectrum}
  14933. @section showspectrum
  14934. Convert input audio to a video output, representing the audio frequency
  14935. spectrum.
  14936. The filter accepts the following options:
  14937. @table @option
  14938. @item size, s
  14939. Specify the video size for the output. For the syntax of this option, check the
  14940. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14941. Default value is @code{640x512}.
  14942. @item slide
  14943. Specify how the spectrum should slide along the window.
  14944. It accepts the following values:
  14945. @table @samp
  14946. @item replace
  14947. the samples start again on the left when they reach the right
  14948. @item scroll
  14949. the samples scroll from right to left
  14950. @item fullframe
  14951. frames are only produced when the samples reach the right
  14952. @item rscroll
  14953. the samples scroll from left to right
  14954. @end table
  14955. Default value is @code{replace}.
  14956. @item mode
  14957. Specify display mode.
  14958. It accepts the following values:
  14959. @table @samp
  14960. @item combined
  14961. all channels are displayed in the same row
  14962. @item separate
  14963. all channels are displayed in separate rows
  14964. @end table
  14965. Default value is @samp{combined}.
  14966. @item color
  14967. Specify display color mode.
  14968. It accepts the following values:
  14969. @table @samp
  14970. @item channel
  14971. each channel is displayed in a separate color
  14972. @item intensity
  14973. each channel is displayed using the same color scheme
  14974. @item rainbow
  14975. each channel is displayed using the rainbow color scheme
  14976. @item moreland
  14977. each channel is displayed using the moreland color scheme
  14978. @item nebulae
  14979. each channel is displayed using the nebulae color scheme
  14980. @item fire
  14981. each channel is displayed using the fire color scheme
  14982. @item fiery
  14983. each channel is displayed using the fiery color scheme
  14984. @item fruit
  14985. each channel is displayed using the fruit color scheme
  14986. @item cool
  14987. each channel is displayed using the cool color scheme
  14988. @end table
  14989. Default value is @samp{channel}.
  14990. @item scale
  14991. Specify scale used for calculating intensity color values.
  14992. It accepts the following values:
  14993. @table @samp
  14994. @item lin
  14995. linear
  14996. @item sqrt
  14997. square root, default
  14998. @item cbrt
  14999. cubic root
  15000. @item log
  15001. logarithmic
  15002. @item 4thrt
  15003. 4th root
  15004. @item 5thrt
  15005. 5th root
  15006. @end table
  15007. Default value is @samp{sqrt}.
  15008. @item saturation
  15009. Set saturation modifier for displayed colors. Negative values provide
  15010. alternative color scheme. @code{0} is no saturation at all.
  15011. Saturation must be in [-10.0, 10.0] range.
  15012. Default value is @code{1}.
  15013. @item win_func
  15014. Set window function.
  15015. It accepts the following values:
  15016. @table @samp
  15017. @item rect
  15018. @item bartlett
  15019. @item hann
  15020. @item hanning
  15021. @item hamming
  15022. @item blackman
  15023. @item welch
  15024. @item flattop
  15025. @item bharris
  15026. @item bnuttall
  15027. @item bhann
  15028. @item sine
  15029. @item nuttall
  15030. @item lanczos
  15031. @item gauss
  15032. @item tukey
  15033. @item dolph
  15034. @item cauchy
  15035. @item parzen
  15036. @item poisson
  15037. @end table
  15038. Default value is @code{hann}.
  15039. @item orientation
  15040. Set orientation of time vs frequency axis. Can be @code{vertical} or
  15041. @code{horizontal}. Default is @code{vertical}.
  15042. @item overlap
  15043. Set ratio of overlap window. Default value is @code{0}.
  15044. When value is @code{1} overlap is set to recommended size for specific
  15045. window function currently used.
  15046. @item gain
  15047. Set scale gain for calculating intensity color values.
  15048. Default value is @code{1}.
  15049. @item data
  15050. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  15051. @item rotation
  15052. Set color rotation, must be in [-1.0, 1.0] range.
  15053. Default value is @code{0}.
  15054. @end table
  15055. The usage is very similar to the showwaves filter; see the examples in that
  15056. section.
  15057. @subsection Examples
  15058. @itemize
  15059. @item
  15060. Large window with logarithmic color scaling:
  15061. @example
  15062. showspectrum=s=1280x480:scale=log
  15063. @end example
  15064. @item
  15065. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  15066. @example
  15067. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  15068. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  15069. @end example
  15070. @end itemize
  15071. @section showspectrumpic
  15072. Convert input audio to a single video frame, representing the audio frequency
  15073. spectrum.
  15074. The filter accepts the following options:
  15075. @table @option
  15076. @item size, s
  15077. Specify the video size for the output. For the syntax of this option, check the
  15078. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15079. Default value is @code{4096x2048}.
  15080. @item mode
  15081. Specify display mode.
  15082. It accepts the following values:
  15083. @table @samp
  15084. @item combined
  15085. all channels are displayed in the same row
  15086. @item separate
  15087. all channels are displayed in separate rows
  15088. @end table
  15089. Default value is @samp{combined}.
  15090. @item color
  15091. Specify display color mode.
  15092. It accepts the following values:
  15093. @table @samp
  15094. @item channel
  15095. each channel is displayed in a separate color
  15096. @item intensity
  15097. each channel is displayed using the same color scheme
  15098. @item rainbow
  15099. each channel is displayed using the rainbow color scheme
  15100. @item moreland
  15101. each channel is displayed using the moreland color scheme
  15102. @item nebulae
  15103. each channel is displayed using the nebulae color scheme
  15104. @item fire
  15105. each channel is displayed using the fire color scheme
  15106. @item fiery
  15107. each channel is displayed using the fiery color scheme
  15108. @item fruit
  15109. each channel is displayed using the fruit color scheme
  15110. @item cool
  15111. each channel is displayed using the cool color scheme
  15112. @end table
  15113. Default value is @samp{intensity}.
  15114. @item scale
  15115. Specify scale used for calculating intensity color values.
  15116. It accepts the following values:
  15117. @table @samp
  15118. @item lin
  15119. linear
  15120. @item sqrt
  15121. square root, default
  15122. @item cbrt
  15123. cubic root
  15124. @item log
  15125. logarithmic
  15126. @item 4thrt
  15127. 4th root
  15128. @item 5thrt
  15129. 5th root
  15130. @end table
  15131. Default value is @samp{log}.
  15132. @item saturation
  15133. Set saturation modifier for displayed colors. Negative values provide
  15134. alternative color scheme. @code{0} is no saturation at all.
  15135. Saturation must be in [-10.0, 10.0] range.
  15136. Default value is @code{1}.
  15137. @item win_func
  15138. Set window function.
  15139. It accepts the following values:
  15140. @table @samp
  15141. @item rect
  15142. @item bartlett
  15143. @item hann
  15144. @item hanning
  15145. @item hamming
  15146. @item blackman
  15147. @item welch
  15148. @item flattop
  15149. @item bharris
  15150. @item bnuttall
  15151. @item bhann
  15152. @item sine
  15153. @item nuttall
  15154. @item lanczos
  15155. @item gauss
  15156. @item tukey
  15157. @item dolph
  15158. @item cauchy
  15159. @item parzen
  15160. @item poisson
  15161. @end table
  15162. Default value is @code{hann}.
  15163. @item orientation
  15164. Set orientation of time vs frequency axis. Can be @code{vertical} or
  15165. @code{horizontal}. Default is @code{vertical}.
  15166. @item gain
  15167. Set scale gain for calculating intensity color values.
  15168. Default value is @code{1}.
  15169. @item legend
  15170. Draw time and frequency axes and legends. Default is enabled.
  15171. @item rotation
  15172. Set color rotation, must be in [-1.0, 1.0] range.
  15173. Default value is @code{0}.
  15174. @end table
  15175. @subsection Examples
  15176. @itemize
  15177. @item
  15178. Extract an audio spectrogram of a whole audio track
  15179. in a 1024x1024 picture using @command{ffmpeg}:
  15180. @example
  15181. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  15182. @end example
  15183. @end itemize
  15184. @section showvolume
  15185. Convert input audio volume to a video output.
  15186. The filter accepts the following options:
  15187. @table @option
  15188. @item rate, r
  15189. Set video rate.
  15190. @item b
  15191. Set border width, allowed range is [0, 5]. Default is 1.
  15192. @item w
  15193. Set channel width, allowed range is [80, 8192]. Default is 400.
  15194. @item h
  15195. Set channel height, allowed range is [1, 900]. Default is 20.
  15196. @item f
  15197. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  15198. @item c
  15199. Set volume color expression.
  15200. The expression can use the following variables:
  15201. @table @option
  15202. @item VOLUME
  15203. Current max volume of channel in dB.
  15204. @item PEAK
  15205. Current peak.
  15206. @item CHANNEL
  15207. Current channel number, starting from 0.
  15208. @end table
  15209. @item t
  15210. If set, displays channel names. Default is enabled.
  15211. @item v
  15212. If set, displays volume values. Default is enabled.
  15213. @item o
  15214. Set orientation, can be @code{horizontal} or @code{vertical},
  15215. default is @code{horizontal}.
  15216. @item s
  15217. Set step size, allowed range s [0, 5]. Default is 0, which means
  15218. step is disabled.
  15219. @end table
  15220. @section showwaves
  15221. Convert input audio to a video output, representing the samples waves.
  15222. The filter accepts the following options:
  15223. @table @option
  15224. @item size, s
  15225. Specify the video size for the output. For the syntax of this option, check the
  15226. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15227. Default value is @code{600x240}.
  15228. @item mode
  15229. Set display mode.
  15230. Available values are:
  15231. @table @samp
  15232. @item point
  15233. Draw a point for each sample.
  15234. @item line
  15235. Draw a vertical line for each sample.
  15236. @item p2p
  15237. Draw a point for each sample and a line between them.
  15238. @item cline
  15239. Draw a centered vertical line for each sample.
  15240. @end table
  15241. Default value is @code{point}.
  15242. @item n
  15243. Set the number of samples which are printed on the same column. A
  15244. larger value will decrease the frame rate. Must be a positive
  15245. integer. This option can be set only if the value for @var{rate}
  15246. is not explicitly specified.
  15247. @item rate, r
  15248. Set the (approximate) output frame rate. This is done by setting the
  15249. option @var{n}. Default value is "25".
  15250. @item split_channels
  15251. Set if channels should be drawn separately or overlap. Default value is 0.
  15252. @item colors
  15253. Set colors separated by '|' which are going to be used for drawing of each channel.
  15254. @item scale
  15255. Set amplitude scale.
  15256. Available values are:
  15257. @table @samp
  15258. @item lin
  15259. Linear.
  15260. @item log
  15261. Logarithmic.
  15262. @item sqrt
  15263. Square root.
  15264. @item cbrt
  15265. Cubic root.
  15266. @end table
  15267. Default is linear.
  15268. @end table
  15269. @subsection Examples
  15270. @itemize
  15271. @item
  15272. Output the input file audio and the corresponding video representation
  15273. at the same time:
  15274. @example
  15275. amovie=a.mp3,asplit[out0],showwaves[out1]
  15276. @end example
  15277. @item
  15278. Create a synthetic signal and show it with showwaves, forcing a
  15279. frame rate of 30 frames per second:
  15280. @example
  15281. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  15282. @end example
  15283. @end itemize
  15284. @section showwavespic
  15285. Convert input audio to a single video frame, representing the samples waves.
  15286. The filter accepts the following options:
  15287. @table @option
  15288. @item size, s
  15289. Specify the video size for the output. For the syntax of this option, check the
  15290. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15291. Default value is @code{600x240}.
  15292. @item split_channels
  15293. Set if channels should be drawn separately or overlap. Default value is 0.
  15294. @item colors
  15295. Set colors separated by '|' which are going to be used for drawing of each channel.
  15296. @item scale
  15297. Set amplitude scale.
  15298. Available values are:
  15299. @table @samp
  15300. @item lin
  15301. Linear.
  15302. @item log
  15303. Logarithmic.
  15304. @item sqrt
  15305. Square root.
  15306. @item cbrt
  15307. Cubic root.
  15308. @end table
  15309. Default is linear.
  15310. @end table
  15311. @subsection Examples
  15312. @itemize
  15313. @item
  15314. Extract a channel split representation of the wave form of a whole audio track
  15315. in a 1024x800 picture using @command{ffmpeg}:
  15316. @example
  15317. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  15318. @end example
  15319. @end itemize
  15320. @section sidedata, asidedata
  15321. Delete frame side data, or select frames based on it.
  15322. This filter accepts the following options:
  15323. @table @option
  15324. @item mode
  15325. Set mode of operation of the filter.
  15326. Can be one of the following:
  15327. @table @samp
  15328. @item select
  15329. Select every frame with side data of @code{type}.
  15330. @item delete
  15331. Delete side data of @code{type}. If @code{type} is not set, delete all side
  15332. data in the frame.
  15333. @end table
  15334. @item type
  15335. Set side data type used with all modes. Must be set for @code{select} mode. For
  15336. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  15337. in @file{libavutil/frame.h}. For example, to choose
  15338. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  15339. @end table
  15340. @section spectrumsynth
  15341. Sythesize audio from 2 input video spectrums, first input stream represents
  15342. magnitude across time and second represents phase across time.
  15343. The filter will transform from frequency domain as displayed in videos back
  15344. to time domain as presented in audio output.
  15345. This filter is primarily created for reversing processed @ref{showspectrum}
  15346. filter outputs, but can synthesize sound from other spectrograms too.
  15347. But in such case results are going to be poor if the phase data is not
  15348. available, because in such cases phase data need to be recreated, usually
  15349. its just recreated from random noise.
  15350. For best results use gray only output (@code{channel} color mode in
  15351. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  15352. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  15353. @code{data} option. Inputs videos should generally use @code{fullframe}
  15354. slide mode as that saves resources needed for decoding video.
  15355. The filter accepts the following options:
  15356. @table @option
  15357. @item sample_rate
  15358. Specify sample rate of output audio, the sample rate of audio from which
  15359. spectrum was generated may differ.
  15360. @item channels
  15361. Set number of channels represented in input video spectrums.
  15362. @item scale
  15363. Set scale which was used when generating magnitude input spectrum.
  15364. Can be @code{lin} or @code{log}. Default is @code{log}.
  15365. @item slide
  15366. Set slide which was used when generating inputs spectrums.
  15367. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  15368. Default is @code{fullframe}.
  15369. @item win_func
  15370. Set window function used for resynthesis.
  15371. @item overlap
  15372. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  15373. which means optimal overlap for selected window function will be picked.
  15374. @item orientation
  15375. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  15376. Default is @code{vertical}.
  15377. @end table
  15378. @subsection Examples
  15379. @itemize
  15380. @item
  15381. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  15382. then resynthesize videos back to audio with spectrumsynth:
  15383. @example
  15384. 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
  15385. 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
  15386. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  15387. @end example
  15388. @end itemize
  15389. @section split, asplit
  15390. Split input into several identical outputs.
  15391. @code{asplit} works with audio input, @code{split} with video.
  15392. The filter accepts a single parameter which specifies the number of outputs. If
  15393. unspecified, it defaults to 2.
  15394. @subsection Examples
  15395. @itemize
  15396. @item
  15397. Create two separate outputs from the same input:
  15398. @example
  15399. [in] split [out0][out1]
  15400. @end example
  15401. @item
  15402. To create 3 or more outputs, you need to specify the number of
  15403. outputs, like in:
  15404. @example
  15405. [in] asplit=3 [out0][out1][out2]
  15406. @end example
  15407. @item
  15408. Create two separate outputs from the same input, one cropped and
  15409. one padded:
  15410. @example
  15411. [in] split [splitout1][splitout2];
  15412. [splitout1] crop=100:100:0:0 [cropout];
  15413. [splitout2] pad=200:200:100:100 [padout];
  15414. @end example
  15415. @item
  15416. Create 5 copies of the input audio with @command{ffmpeg}:
  15417. @example
  15418. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  15419. @end example
  15420. @end itemize
  15421. @section zmq, azmq
  15422. Receive commands sent through a libzmq client, and forward them to
  15423. filters in the filtergraph.
  15424. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  15425. must be inserted between two video filters, @code{azmq} between two
  15426. audio filters.
  15427. To enable these filters you need to install the libzmq library and
  15428. headers and configure FFmpeg with @code{--enable-libzmq}.
  15429. For more information about libzmq see:
  15430. @url{http://www.zeromq.org/}
  15431. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  15432. receives messages sent through a network interface defined by the
  15433. @option{bind_address} option.
  15434. The received message must be in the form:
  15435. @example
  15436. @var{TARGET} @var{COMMAND} [@var{ARG}]
  15437. @end example
  15438. @var{TARGET} specifies the target of the command, usually the name of
  15439. the filter class or a specific filter instance name.
  15440. @var{COMMAND} specifies the name of the command for the target filter.
  15441. @var{ARG} is optional and specifies the optional argument list for the
  15442. given @var{COMMAND}.
  15443. Upon reception, the message is processed and the corresponding command
  15444. is injected into the filtergraph. Depending on the result, the filter
  15445. will send a reply to the client, adopting the format:
  15446. @example
  15447. @var{ERROR_CODE} @var{ERROR_REASON}
  15448. @var{MESSAGE}
  15449. @end example
  15450. @var{MESSAGE} is optional.
  15451. @subsection Examples
  15452. Look at @file{tools/zmqsend} for an example of a zmq client which can
  15453. be used to send commands processed by these filters.
  15454. Consider the following filtergraph generated by @command{ffplay}
  15455. @example
  15456. ffplay -dumpgraph 1 -f lavfi "
  15457. color=s=100x100:c=red [l];
  15458. color=s=100x100:c=blue [r];
  15459. nullsrc=s=200x100, zmq [bg];
  15460. [bg][l] overlay [bg+l];
  15461. [bg+l][r] overlay=x=100 "
  15462. @end example
  15463. To change the color of the left side of the video, the following
  15464. command can be used:
  15465. @example
  15466. echo Parsed_color_0 c yellow | tools/zmqsend
  15467. @end example
  15468. To change the right side:
  15469. @example
  15470. echo Parsed_color_1 c pink | tools/zmqsend
  15471. @end example
  15472. @c man end MULTIMEDIA FILTERS
  15473. @chapter Multimedia Sources
  15474. @c man begin MULTIMEDIA SOURCES
  15475. Below is a description of the currently available multimedia sources.
  15476. @section amovie
  15477. This is the same as @ref{movie} source, except it selects an audio
  15478. stream by default.
  15479. @anchor{movie}
  15480. @section movie
  15481. Read audio and/or video stream(s) from a movie container.
  15482. It accepts the following parameters:
  15483. @table @option
  15484. @item filename
  15485. The name of the resource to read (not necessarily a file; it can also be a
  15486. device or a stream accessed through some protocol).
  15487. @item format_name, f
  15488. Specifies the format assumed for the movie to read, and can be either
  15489. the name of a container or an input device. If not specified, the
  15490. format is guessed from @var{movie_name} or by probing.
  15491. @item seek_point, sp
  15492. Specifies the seek point in seconds. The frames will be output
  15493. starting from this seek point. The parameter is evaluated with
  15494. @code{av_strtod}, so the numerical value may be suffixed by an IS
  15495. postfix. The default value is "0".
  15496. @item streams, s
  15497. Specifies the streams to read. Several streams can be specified,
  15498. separated by "+". The source will then have as many outputs, in the
  15499. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  15500. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  15501. respectively the default (best suited) video and audio stream. Default
  15502. is "dv", or "da" if the filter is called as "amovie".
  15503. @item stream_index, si
  15504. Specifies the index of the video stream to read. If the value is -1,
  15505. the most suitable video stream will be automatically selected. The default
  15506. value is "-1". Deprecated. If the filter is called "amovie", it will select
  15507. audio instead of video.
  15508. @item loop
  15509. Specifies how many times to read the stream in sequence.
  15510. If the value is 0, the stream will be looped infinitely.
  15511. Default value is "1".
  15512. Note that when the movie is looped the source timestamps are not
  15513. changed, so it will generate non monotonically increasing timestamps.
  15514. @item discontinuity
  15515. Specifies the time difference between frames above which the point is
  15516. considered a timestamp discontinuity which is removed by adjusting the later
  15517. timestamps.
  15518. @end table
  15519. It allows overlaying a second video on top of the main input of
  15520. a filtergraph, as shown in this graph:
  15521. @example
  15522. input -----------> deltapts0 --> overlay --> output
  15523. ^
  15524. |
  15525. movie --> scale--> deltapts1 -------+
  15526. @end example
  15527. @subsection Examples
  15528. @itemize
  15529. @item
  15530. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  15531. on top of the input labelled "in":
  15532. @example
  15533. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  15534. [in] setpts=PTS-STARTPTS [main];
  15535. [main][over] overlay=16:16 [out]
  15536. @end example
  15537. @item
  15538. Read from a video4linux2 device, and overlay it on top of the input
  15539. labelled "in":
  15540. @example
  15541. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  15542. [in] setpts=PTS-STARTPTS [main];
  15543. [main][over] overlay=16:16 [out]
  15544. @end example
  15545. @item
  15546. Read the first video stream and the audio stream with id 0x81 from
  15547. dvd.vob; the video is connected to the pad named "video" and the audio is
  15548. connected to the pad named "audio":
  15549. @example
  15550. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  15551. @end example
  15552. @end itemize
  15553. @subsection Commands
  15554. Both movie and amovie support the following commands:
  15555. @table @option
  15556. @item seek
  15557. Perform seek using "av_seek_frame".
  15558. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  15559. @itemize
  15560. @item
  15561. @var{stream_index}: If stream_index is -1, a default
  15562. stream is selected, and @var{timestamp} is automatically converted
  15563. from AV_TIME_BASE units to the stream specific time_base.
  15564. @item
  15565. @var{timestamp}: Timestamp in AVStream.time_base units
  15566. or, if no stream is specified, in AV_TIME_BASE units.
  15567. @item
  15568. @var{flags}: Flags which select direction and seeking mode.
  15569. @end itemize
  15570. @item get_duration
  15571. Get movie duration in AV_TIME_BASE units.
  15572. @end table
  15573. @c man end MULTIMEDIA SOURCES