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.

20457 lines
541KB

  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,
  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. @subsection Examples
  1684. @itemize
  1685. @item
  1686. For example, assuming a 5.1+downmix input MOV file,
  1687. @example
  1688. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1689. @end example
  1690. will create an output WAV file tagged as stereo from the downmix channels of
  1691. the input.
  1692. @item
  1693. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1694. @example
  1695. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1696. @end example
  1697. @end itemize
  1698. @section channelsplit
  1699. Split each channel from an input audio stream into a separate output stream.
  1700. It accepts the following parameters:
  1701. @table @option
  1702. @item channel_layout
  1703. The channel layout of the input stream. The default is "stereo".
  1704. @item channels
  1705. A channel layout describing the channels to be extracted as separate output streams
  1706. or "all" to extract each input channel as a separate stream. The default is "all".
  1707. Choosing channels not present in channel layout in the input will result in an error.
  1708. @end table
  1709. @subsection Examples
  1710. @itemize
  1711. @item
  1712. For example, assuming a stereo input MP3 file,
  1713. @example
  1714. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1715. @end example
  1716. will create an output Matroska file with two audio streams, one containing only
  1717. the left channel and the other the right channel.
  1718. @item
  1719. Split a 5.1 WAV file into per-channel files:
  1720. @example
  1721. ffmpeg -i in.wav -filter_complex
  1722. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1723. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1724. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1725. side_right.wav
  1726. @end example
  1727. @item
  1728. Extract only LFE from a 5.1 WAV file:
  1729. @example
  1730. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  1731. -map '[LFE]' lfe.wav
  1732. @end example
  1733. @end itemize
  1734. @section chorus
  1735. Add a chorus effect to the audio.
  1736. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1737. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1738. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1739. The modulation depth defines the range the modulated delay is played before or after
  1740. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1741. sound tuned around the original one, like in a chorus where some vocals are slightly
  1742. off key.
  1743. It accepts the following parameters:
  1744. @table @option
  1745. @item in_gain
  1746. Set input gain. Default is 0.4.
  1747. @item out_gain
  1748. Set output gain. Default is 0.4.
  1749. @item delays
  1750. Set delays. A typical delay is around 40ms to 60ms.
  1751. @item decays
  1752. Set decays.
  1753. @item speeds
  1754. Set speeds.
  1755. @item depths
  1756. Set depths.
  1757. @end table
  1758. @subsection Examples
  1759. @itemize
  1760. @item
  1761. A single delay:
  1762. @example
  1763. chorus=0.7:0.9:55:0.4:0.25:2
  1764. @end example
  1765. @item
  1766. Two delays:
  1767. @example
  1768. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1769. @end example
  1770. @item
  1771. Fuller sounding chorus with three delays:
  1772. @example
  1773. 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
  1774. @end example
  1775. @end itemize
  1776. @section compand
  1777. Compress or expand the audio's dynamic range.
  1778. It accepts the following parameters:
  1779. @table @option
  1780. @item attacks
  1781. @item decays
  1782. A list of times in seconds for each channel over which the instantaneous level
  1783. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1784. increase of volume and @var{decays} refers to decrease of volume. For most
  1785. situations, the attack time (response to the audio getting louder) should be
  1786. shorter than the decay time, because the human ear is more sensitive to sudden
  1787. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1788. a typical value for decay is 0.8 seconds.
  1789. If specified number of attacks & decays is lower than number of channels, the last
  1790. set attack/decay will be used for all remaining channels.
  1791. @item points
  1792. A list of points for the transfer function, specified in dB relative to the
  1793. maximum possible signal amplitude. Each key points list must be defined using
  1794. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1795. @code{x0/y0 x1/y1 x2/y2 ....}
  1796. The input values must be in strictly increasing order but the transfer function
  1797. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1798. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1799. function are @code{-70/-70|-60/-20|1/0}.
  1800. @item soft-knee
  1801. Set the curve radius in dB for all joints. It defaults to 0.01.
  1802. @item gain
  1803. Set the additional gain in dB to be applied at all points on the transfer
  1804. function. This allows for easy adjustment of the overall gain.
  1805. It defaults to 0.
  1806. @item volume
  1807. Set an initial volume, in dB, to be assumed for each channel when filtering
  1808. starts. This permits the user to supply a nominal level initially, so that, for
  1809. example, a very large gain is not applied to initial signal levels before the
  1810. companding has begun to operate. A typical value for audio which is initially
  1811. quiet is -90 dB. It defaults to 0.
  1812. @item delay
  1813. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1814. delayed before being fed to the volume adjuster. Specifying a delay
  1815. approximately equal to the attack/decay times allows the filter to effectively
  1816. operate in predictive rather than reactive mode. It defaults to 0.
  1817. @end table
  1818. @subsection Examples
  1819. @itemize
  1820. @item
  1821. Make music with both quiet and loud passages suitable for listening to in a
  1822. noisy environment:
  1823. @example
  1824. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1825. @end example
  1826. Another example for audio with whisper and explosion parts:
  1827. @example
  1828. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1829. @end example
  1830. @item
  1831. A noise gate for when the noise is at a lower level than the signal:
  1832. @example
  1833. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1834. @end example
  1835. @item
  1836. Here is another noise gate, this time for when the noise is at a higher level
  1837. than the signal (making it, in some ways, similar to squelch):
  1838. @example
  1839. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1840. @end example
  1841. @item
  1842. 2:1 compression starting at -6dB:
  1843. @example
  1844. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1845. @end example
  1846. @item
  1847. 2:1 compression starting at -9dB:
  1848. @example
  1849. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1850. @end example
  1851. @item
  1852. 2:1 compression starting at -12dB:
  1853. @example
  1854. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1855. @end example
  1856. @item
  1857. 2:1 compression starting at -18dB:
  1858. @example
  1859. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1860. @end example
  1861. @item
  1862. 3:1 compression starting at -15dB:
  1863. @example
  1864. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1865. @end example
  1866. @item
  1867. Compressor/Gate:
  1868. @example
  1869. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1870. @end example
  1871. @item
  1872. Expander:
  1873. @example
  1874. 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
  1875. @end example
  1876. @item
  1877. Hard limiter at -6dB:
  1878. @example
  1879. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1880. @end example
  1881. @item
  1882. Hard limiter at -12dB:
  1883. @example
  1884. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1885. @end example
  1886. @item
  1887. Hard noise gate at -35 dB:
  1888. @example
  1889. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1890. @end example
  1891. @item
  1892. Soft limiter:
  1893. @example
  1894. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1895. @end example
  1896. @end itemize
  1897. @section compensationdelay
  1898. Compensation Delay Line is a metric based delay to compensate differing
  1899. positions of microphones or speakers.
  1900. For example, you have recorded guitar with two microphones placed in
  1901. different location. Because the front of sound wave has fixed speed in
  1902. normal conditions, the phasing of microphones can vary and depends on
  1903. their location and interposition. The best sound mix can be achieved when
  1904. these microphones are in phase (synchronized). Note that distance of
  1905. ~30 cm between microphones makes one microphone to capture signal in
  1906. antiphase to another microphone. That makes the final mix sounding moody.
  1907. This filter helps to solve phasing problems by adding different delays
  1908. to each microphone track and make them synchronized.
  1909. The best result can be reached when you take one track as base and
  1910. synchronize other tracks one by one with it.
  1911. Remember that synchronization/delay tolerance depends on sample rate, too.
  1912. Higher sample rates will give more tolerance.
  1913. It accepts the following parameters:
  1914. @table @option
  1915. @item mm
  1916. Set millimeters distance. This is compensation distance for fine tuning.
  1917. Default is 0.
  1918. @item cm
  1919. Set cm distance. This is compensation distance for tightening distance setup.
  1920. Default is 0.
  1921. @item m
  1922. Set meters distance. This is compensation distance for hard distance setup.
  1923. Default is 0.
  1924. @item dry
  1925. Set dry amount. Amount of unprocessed (dry) signal.
  1926. Default is 0.
  1927. @item wet
  1928. Set wet amount. Amount of processed (wet) signal.
  1929. Default is 1.
  1930. @item temp
  1931. Set temperature degree in Celsius. This is the temperature of the environment.
  1932. Default is 20.
  1933. @end table
  1934. @section crossfeed
  1935. Apply headphone crossfeed filter.
  1936. Crossfeed is the process of blending the left and right channels of stereo
  1937. audio recording.
  1938. It is mainly used to reduce extreme stereo separation of low frequencies.
  1939. The intent is to produce more speaker like sound to the listener.
  1940. The filter accepts the following options:
  1941. @table @option
  1942. @item strength
  1943. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  1944. This sets gain of low shelf filter for side part of stereo image.
  1945. Default is -6dB. Max allowed is -30db when strength is set to 1.
  1946. @item range
  1947. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  1948. This sets cut off frequency of low shelf filter. Default is cut off near
  1949. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  1950. @item level_in
  1951. Set input gain. Default is 0.9.
  1952. @item level_out
  1953. Set output gain. Default is 1.
  1954. @end table
  1955. @section crystalizer
  1956. Simple algorithm to expand audio dynamic range.
  1957. The filter accepts the following options:
  1958. @table @option
  1959. @item i
  1960. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  1961. (unchanged sound) to 10.0 (maximum effect).
  1962. @item c
  1963. Enable clipping. By default is enabled.
  1964. @end table
  1965. @section dcshift
  1966. Apply a DC shift to the audio.
  1967. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1968. in the recording chain) from the audio. The effect of a DC offset is reduced
  1969. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1970. a signal has a DC offset.
  1971. @table @option
  1972. @item shift
  1973. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1974. the audio.
  1975. @item limitergain
  1976. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1977. used to prevent clipping.
  1978. @end table
  1979. @section drmeter
  1980. Measure audio dynamic range.
  1981. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  1982. is found in transition material. And anything less that 8 have very poor dynamics
  1983. and is very compressed.
  1984. The filter accepts the following options:
  1985. @table @option
  1986. @item length
  1987. Set window length in seconds used to split audio into segments of equal length.
  1988. Default is 3 seconds.
  1989. @end table
  1990. @section dynaudnorm
  1991. Dynamic Audio Normalizer.
  1992. This filter applies a certain amount of gain to the input audio in order
  1993. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1994. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1995. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1996. This allows for applying extra gain to the "quiet" sections of the audio
  1997. while avoiding distortions or clipping the "loud" sections. In other words:
  1998. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1999. sections, in the sense that the volume of each section is brought to the
  2000. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2001. this goal *without* applying "dynamic range compressing". It will retain 100%
  2002. of the dynamic range *within* each section of the audio file.
  2003. @table @option
  2004. @item f
  2005. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2006. Default is 500 milliseconds.
  2007. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2008. referred to as frames. This is required, because a peak magnitude has no
  2009. meaning for just a single sample value. Instead, we need to determine the
  2010. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2011. normalizer would simply use the peak magnitude of the complete file, the
  2012. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2013. frame. The length of a frame is specified in milliseconds. By default, the
  2014. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2015. been found to give good results with most files.
  2016. Note that the exact frame length, in number of samples, will be determined
  2017. automatically, based on the sampling rate of the individual input audio file.
  2018. @item g
  2019. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2020. number. Default is 31.
  2021. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2022. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2023. is specified in frames, centered around the current frame. For the sake of
  2024. simplicity, this must be an odd number. Consequently, the default value of 31
  2025. takes into account the current frame, as well as the 15 preceding frames and
  2026. the 15 subsequent frames. Using a larger window results in a stronger
  2027. smoothing effect and thus in less gain variation, i.e. slower gain
  2028. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2029. effect and thus in more gain variation, i.e. faster gain adaptation.
  2030. In other words, the more you increase this value, the more the Dynamic Audio
  2031. Normalizer will behave like a "traditional" normalization filter. On the
  2032. contrary, the more you decrease this value, the more the Dynamic Audio
  2033. Normalizer will behave like a dynamic range compressor.
  2034. @item p
  2035. Set the target peak value. This specifies the highest permissible magnitude
  2036. level for the normalized audio input. This filter will try to approach the
  2037. target peak magnitude as closely as possible, but at the same time it also
  2038. makes sure that the normalized signal will never exceed the peak magnitude.
  2039. A frame's maximum local gain factor is imposed directly by the target peak
  2040. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2041. It is not recommended to go above this value.
  2042. @item m
  2043. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2044. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2045. factor for each input frame, i.e. the maximum gain factor that does not
  2046. result in clipping or distortion. The maximum gain factor is determined by
  2047. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2048. additionally bounds the frame's maximum gain factor by a predetermined
  2049. (global) maximum gain factor. This is done in order to avoid excessive gain
  2050. factors in "silent" or almost silent frames. By default, the maximum gain
  2051. factor is 10.0, For most inputs the default value should be sufficient and
  2052. it usually is not recommended to increase this value. Though, for input
  2053. with an extremely low overall volume level, it may be necessary to allow even
  2054. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2055. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2056. Instead, a "sigmoid" threshold function will be applied. This way, the
  2057. gain factors will smoothly approach the threshold value, but never exceed that
  2058. value.
  2059. @item r
  2060. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2061. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2062. This means that the maximum local gain factor for each frame is defined
  2063. (only) by the frame's highest magnitude sample. This way, the samples can
  2064. be amplified as much as possible without exceeding the maximum signal
  2065. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2066. Normalizer can also take into account the frame's root mean square,
  2067. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2068. determine the power of a time-varying signal. It is therefore considered
  2069. that the RMS is a better approximation of the "perceived loudness" than
  2070. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2071. frames to a constant RMS value, a uniform "perceived loudness" can be
  2072. established. If a target RMS value has been specified, a frame's local gain
  2073. factor is defined as the factor that would result in exactly that RMS value.
  2074. Note, however, that the maximum local gain factor is still restricted by the
  2075. frame's highest magnitude sample, in order to prevent clipping.
  2076. @item n
  2077. Enable channels coupling. By default is enabled.
  2078. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2079. amount. This means the same gain factor will be applied to all channels, i.e.
  2080. the maximum possible gain factor is determined by the "loudest" channel.
  2081. However, in some recordings, it may happen that the volume of the different
  2082. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2083. In this case, this option can be used to disable the channel coupling. This way,
  2084. the gain factor will be determined independently for each channel, depending
  2085. only on the individual channel's highest magnitude sample. This allows for
  2086. harmonizing the volume of the different channels.
  2087. @item c
  2088. Enable DC bias correction. By default is disabled.
  2089. An audio signal (in the time domain) is a sequence of sample values.
  2090. In the Dynamic Audio Normalizer these sample values are represented in the
  2091. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2092. audio signal, or "waveform", should be centered around the zero point.
  2093. That means if we calculate the mean value of all samples in a file, or in a
  2094. single frame, then the result should be 0.0 or at least very close to that
  2095. value. If, however, there is a significant deviation of the mean value from
  2096. 0.0, in either positive or negative direction, this is referred to as a
  2097. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2098. Audio Normalizer provides optional DC bias correction.
  2099. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2100. the mean value, or "DC correction" offset, of each input frame and subtract
  2101. that value from all of the frame's sample values which ensures those samples
  2102. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2103. boundaries, the DC correction offset values will be interpolated smoothly
  2104. between neighbouring frames.
  2105. @item b
  2106. Enable alternative boundary mode. By default is disabled.
  2107. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2108. around each frame. This includes the preceding frames as well as the
  2109. subsequent frames. However, for the "boundary" frames, located at the very
  2110. beginning and at the very end of the audio file, not all neighbouring
  2111. frames are available. In particular, for the first few frames in the audio
  2112. file, the preceding frames are not known. And, similarly, for the last few
  2113. frames in the audio file, the subsequent frames are not known. Thus, the
  2114. question arises which gain factors should be assumed for the missing frames
  2115. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2116. to deal with this situation. The default boundary mode assumes a gain factor
  2117. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2118. "fade out" at the beginning and at the end of the input, respectively.
  2119. @item s
  2120. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2121. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2122. compression. This means that signal peaks will not be pruned and thus the
  2123. full dynamic range will be retained within each local neighbourhood. However,
  2124. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2125. normalization algorithm with a more "traditional" compression.
  2126. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2127. (thresholding) function. If (and only if) the compression feature is enabled,
  2128. all input frames will be processed by a soft knee thresholding function prior
  2129. to the actual normalization process. Put simply, the thresholding function is
  2130. going to prune all samples whose magnitude exceeds a certain threshold value.
  2131. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2132. value. Instead, the threshold value will be adjusted for each individual
  2133. frame.
  2134. In general, smaller parameters result in stronger compression, and vice versa.
  2135. Values below 3.0 are not recommended, because audible distortion may appear.
  2136. @end table
  2137. @section earwax
  2138. Make audio easier to listen to on headphones.
  2139. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2140. so that when listened to on headphones the stereo image is moved from
  2141. inside your head (standard for headphones) to outside and in front of
  2142. the listener (standard for speakers).
  2143. Ported from SoX.
  2144. @section equalizer
  2145. Apply a two-pole peaking equalisation (EQ) filter. With this
  2146. filter, the signal-level at and around a selected frequency can
  2147. be increased or decreased, whilst (unlike bandpass and bandreject
  2148. filters) that at all other frequencies is unchanged.
  2149. In order to produce complex equalisation curves, this filter can
  2150. be given several times, each with a different central frequency.
  2151. The filter accepts the following options:
  2152. @table @option
  2153. @item frequency, f
  2154. Set the filter's central frequency in Hz.
  2155. @item width_type, t
  2156. Set method to specify band-width of filter.
  2157. @table @option
  2158. @item h
  2159. Hz
  2160. @item q
  2161. Q-Factor
  2162. @item o
  2163. octave
  2164. @item s
  2165. slope
  2166. @item k
  2167. kHz
  2168. @end table
  2169. @item width, w
  2170. Specify the band-width of a filter in width_type units.
  2171. @item gain, g
  2172. Set the required gain or attenuation in dB.
  2173. Beware of clipping when using a positive gain.
  2174. @item channels, c
  2175. Specify which channels to filter, by default all available are filtered.
  2176. @end table
  2177. @subsection Examples
  2178. @itemize
  2179. @item
  2180. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2181. @example
  2182. equalizer=f=1000:t=h:width=200:g=-10
  2183. @end example
  2184. @item
  2185. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2186. @example
  2187. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2188. @end example
  2189. @end itemize
  2190. @subsection Commands
  2191. This filter supports the following commands:
  2192. @table @option
  2193. @item frequency, f
  2194. Change equalizer frequency.
  2195. Syntax for the command is : "@var{frequency}"
  2196. @item width_type, t
  2197. Change equalizer width_type.
  2198. Syntax for the command is : "@var{width_type}"
  2199. @item width, w
  2200. Change equalizer width.
  2201. Syntax for the command is : "@var{width}"
  2202. @item gain, g
  2203. Change equalizer gain.
  2204. Syntax for the command is : "@var{gain}"
  2205. @end table
  2206. @section extrastereo
  2207. Linearly increases the difference between left and right channels which
  2208. adds some sort of "live" effect to playback.
  2209. The filter accepts the following options:
  2210. @table @option
  2211. @item m
  2212. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2213. (average of both channels), with 1.0 sound will be unchanged, with
  2214. -1.0 left and right channels will be swapped.
  2215. @item c
  2216. Enable clipping. By default is enabled.
  2217. @end table
  2218. @section firequalizer
  2219. Apply FIR Equalization using arbitrary frequency response.
  2220. The filter accepts the following option:
  2221. @table @option
  2222. @item gain
  2223. Set gain curve equation (in dB). The expression can contain variables:
  2224. @table @option
  2225. @item f
  2226. the evaluated frequency
  2227. @item sr
  2228. sample rate
  2229. @item ch
  2230. channel number, set to 0 when multichannels evaluation is disabled
  2231. @item chid
  2232. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2233. multichannels evaluation is disabled
  2234. @item chs
  2235. number of channels
  2236. @item chlayout
  2237. channel_layout, see libavutil/channel_layout.h
  2238. @end table
  2239. and functions:
  2240. @table @option
  2241. @item gain_interpolate(f)
  2242. interpolate gain on frequency f based on gain_entry
  2243. @item cubic_interpolate(f)
  2244. same as gain_interpolate, but smoother
  2245. @end table
  2246. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2247. @item gain_entry
  2248. Set gain entry for gain_interpolate function. The expression can
  2249. contain functions:
  2250. @table @option
  2251. @item entry(f, g)
  2252. store gain entry at frequency f with value g
  2253. @end table
  2254. This option is also available as command.
  2255. @item delay
  2256. Set filter delay in seconds. Higher value means more accurate.
  2257. Default is @code{0.01}.
  2258. @item accuracy
  2259. Set filter accuracy in Hz. Lower value means more accurate.
  2260. Default is @code{5}.
  2261. @item wfunc
  2262. Set window function. Acceptable values are:
  2263. @table @option
  2264. @item rectangular
  2265. rectangular window, useful when gain curve is already smooth
  2266. @item hann
  2267. hann window (default)
  2268. @item hamming
  2269. hamming window
  2270. @item blackman
  2271. blackman window
  2272. @item nuttall3
  2273. 3-terms continuous 1st derivative nuttall window
  2274. @item mnuttall3
  2275. minimum 3-terms discontinuous nuttall window
  2276. @item nuttall
  2277. 4-terms continuous 1st derivative nuttall window
  2278. @item bnuttall
  2279. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2280. @item bharris
  2281. blackman-harris window
  2282. @item tukey
  2283. tukey window
  2284. @end table
  2285. @item fixed
  2286. If enabled, use fixed number of audio samples. This improves speed when
  2287. filtering with large delay. Default is disabled.
  2288. @item multi
  2289. Enable multichannels evaluation on gain. Default is disabled.
  2290. @item zero_phase
  2291. Enable zero phase mode by subtracting timestamp to compensate delay.
  2292. Default is disabled.
  2293. @item scale
  2294. Set scale used by gain. Acceptable values are:
  2295. @table @option
  2296. @item linlin
  2297. linear frequency, linear gain
  2298. @item linlog
  2299. linear frequency, logarithmic (in dB) gain (default)
  2300. @item loglin
  2301. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2302. @item loglog
  2303. logarithmic frequency, logarithmic gain
  2304. @end table
  2305. @item dumpfile
  2306. Set file for dumping, suitable for gnuplot.
  2307. @item dumpscale
  2308. Set scale for dumpfile. Acceptable values are same with scale option.
  2309. Default is linlog.
  2310. @item fft2
  2311. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2312. Default is disabled.
  2313. @item min_phase
  2314. Enable minimum phase impulse response. Default is disabled.
  2315. @end table
  2316. @subsection Examples
  2317. @itemize
  2318. @item
  2319. lowpass at 1000 Hz:
  2320. @example
  2321. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2322. @end example
  2323. @item
  2324. lowpass at 1000 Hz with gain_entry:
  2325. @example
  2326. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2327. @end example
  2328. @item
  2329. custom equalization:
  2330. @example
  2331. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2332. @end example
  2333. @item
  2334. higher delay with zero phase to compensate delay:
  2335. @example
  2336. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2337. @end example
  2338. @item
  2339. lowpass on left channel, highpass on right channel:
  2340. @example
  2341. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2342. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2343. @end example
  2344. @end itemize
  2345. @section flanger
  2346. Apply a flanging effect to the audio.
  2347. The filter accepts the following options:
  2348. @table @option
  2349. @item delay
  2350. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2351. @item depth
  2352. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2353. @item regen
  2354. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2355. Default value is 0.
  2356. @item width
  2357. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2358. Default value is 71.
  2359. @item speed
  2360. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2361. @item shape
  2362. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2363. Default value is @var{sinusoidal}.
  2364. @item phase
  2365. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2366. Default value is 25.
  2367. @item interp
  2368. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2369. Default is @var{linear}.
  2370. @end table
  2371. @section haas
  2372. Apply Haas effect to audio.
  2373. Note that this makes most sense to apply on mono signals.
  2374. With this filter applied to mono signals it give some directionality and
  2375. stretches its stereo image.
  2376. The filter accepts the following options:
  2377. @table @option
  2378. @item level_in
  2379. Set input level. By default is @var{1}, or 0dB
  2380. @item level_out
  2381. Set output level. By default is @var{1}, or 0dB.
  2382. @item side_gain
  2383. Set gain applied to side part of signal. By default is @var{1}.
  2384. @item middle_source
  2385. Set kind of middle source. Can be one of the following:
  2386. @table @samp
  2387. @item left
  2388. Pick left channel.
  2389. @item right
  2390. Pick right channel.
  2391. @item mid
  2392. Pick middle part signal of stereo image.
  2393. @item side
  2394. Pick side part signal of stereo image.
  2395. @end table
  2396. @item middle_phase
  2397. Change middle phase. By default is disabled.
  2398. @item left_delay
  2399. Set left channel delay. By default is @var{2.05} milliseconds.
  2400. @item left_balance
  2401. Set left channel balance. By default is @var{-1}.
  2402. @item left_gain
  2403. Set left channel gain. By default is @var{1}.
  2404. @item left_phase
  2405. Change left phase. By default is disabled.
  2406. @item right_delay
  2407. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2408. @item right_balance
  2409. Set right channel balance. By default is @var{1}.
  2410. @item right_gain
  2411. Set right channel gain. By default is @var{1}.
  2412. @item right_phase
  2413. Change right phase. By default is enabled.
  2414. @end table
  2415. @section hdcd
  2416. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2417. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2418. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2419. of HDCD, and detects the Transient Filter flag.
  2420. @example
  2421. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2422. @end example
  2423. When using the filter with wav, note the default encoding for wav is 16-bit,
  2424. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2425. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2426. @example
  2427. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2428. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2429. @end example
  2430. The filter accepts the following options:
  2431. @table @option
  2432. @item disable_autoconvert
  2433. Disable any automatic format conversion or resampling in the filter graph.
  2434. @item process_stereo
  2435. Process the stereo channels together. If target_gain does not match between
  2436. channels, consider it invalid and use the last valid target_gain.
  2437. @item cdt_ms
  2438. Set the code detect timer period in ms.
  2439. @item force_pe
  2440. Always extend peaks above -3dBFS even if PE isn't signaled.
  2441. @item analyze_mode
  2442. Replace audio with a solid tone and adjust the amplitude to signal some
  2443. specific aspect of the decoding process. The output file can be loaded in
  2444. an audio editor alongside the original to aid analysis.
  2445. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2446. Modes are:
  2447. @table @samp
  2448. @item 0, off
  2449. Disabled
  2450. @item 1, lle
  2451. Gain adjustment level at each sample
  2452. @item 2, pe
  2453. Samples where peak extend occurs
  2454. @item 3, cdt
  2455. Samples where the code detect timer is active
  2456. @item 4, tgm
  2457. Samples where the target gain does not match between channels
  2458. @end table
  2459. @end table
  2460. @section headphone
  2461. Apply head-related transfer functions (HRTFs) to create virtual
  2462. loudspeakers around the user for binaural listening via headphones.
  2463. The HRIRs are provided via additional streams, for each channel
  2464. one stereo input stream is needed.
  2465. The filter accepts the following options:
  2466. @table @option
  2467. @item map
  2468. Set mapping of input streams for convolution.
  2469. The argument is a '|'-separated list of channel names in order as they
  2470. are given as additional stream inputs for filter.
  2471. This also specify number of input streams. Number of input streams
  2472. must be not less than number of channels in first stream plus one.
  2473. @item gain
  2474. Set gain applied to audio. Value is in dB. Default is 0.
  2475. @item type
  2476. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2477. processing audio in time domain which is slow.
  2478. @var{freq} is processing audio in frequency domain which is fast.
  2479. Default is @var{freq}.
  2480. @item lfe
  2481. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2482. @end table
  2483. @subsection Examples
  2484. @itemize
  2485. @item
  2486. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2487. each amovie filter use stereo file with IR coefficients as input.
  2488. The files give coefficients for each position of virtual loudspeaker:
  2489. @example
  2490. 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"
  2491. output.wav
  2492. @end example
  2493. @end itemize
  2494. @section highpass
  2495. Apply a high-pass filter with 3dB point frequency.
  2496. The filter can be either single-pole, or double-pole (the default).
  2497. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2498. The filter accepts the following options:
  2499. @table @option
  2500. @item frequency, f
  2501. Set frequency in Hz. Default is 3000.
  2502. @item poles, p
  2503. Set number of poles. Default is 2.
  2504. @item width_type, t
  2505. Set method to specify band-width of filter.
  2506. @table @option
  2507. @item h
  2508. Hz
  2509. @item q
  2510. Q-Factor
  2511. @item o
  2512. octave
  2513. @item s
  2514. slope
  2515. @item k
  2516. kHz
  2517. @end table
  2518. @item width, w
  2519. Specify the band-width of a filter in width_type units.
  2520. Applies only to double-pole filter.
  2521. The default is 0.707q and gives a Butterworth response.
  2522. @item channels, c
  2523. Specify which channels to filter, by default all available are filtered.
  2524. @end table
  2525. @subsection Commands
  2526. This filter supports the following commands:
  2527. @table @option
  2528. @item frequency, f
  2529. Change highpass frequency.
  2530. Syntax for the command is : "@var{frequency}"
  2531. @item width_type, t
  2532. Change highpass width_type.
  2533. Syntax for the command is : "@var{width_type}"
  2534. @item width, w
  2535. Change highpass width.
  2536. Syntax for the command is : "@var{width}"
  2537. @end table
  2538. @section join
  2539. Join multiple input streams into one multi-channel stream.
  2540. It accepts the following parameters:
  2541. @table @option
  2542. @item inputs
  2543. The number of input streams. It defaults to 2.
  2544. @item channel_layout
  2545. The desired output channel layout. It defaults to stereo.
  2546. @item map
  2547. Map channels from inputs to output. The argument is a '|'-separated list of
  2548. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2549. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2550. can be either the name of the input channel (e.g. FL for front left) or its
  2551. index in the specified input stream. @var{out_channel} is the name of the output
  2552. channel.
  2553. @end table
  2554. The filter will attempt to guess the mappings when they are not specified
  2555. explicitly. It does so by first trying to find an unused matching input channel
  2556. and if that fails it picks the first unused input channel.
  2557. Join 3 inputs (with properly set channel layouts):
  2558. @example
  2559. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2560. @end example
  2561. Build a 5.1 output from 6 single-channel streams:
  2562. @example
  2563. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2564. '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'
  2565. out
  2566. @end example
  2567. @section ladspa
  2568. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2569. To enable compilation of this filter you need to configure FFmpeg with
  2570. @code{--enable-ladspa}.
  2571. @table @option
  2572. @item file, f
  2573. Specifies the name of LADSPA plugin library to load. If the environment
  2574. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2575. each one of the directories specified by the colon separated list in
  2576. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2577. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2578. @file{/usr/lib/ladspa/}.
  2579. @item plugin, p
  2580. Specifies the plugin within the library. Some libraries contain only
  2581. one plugin, but others contain many of them. If this is not set filter
  2582. will list all available plugins within the specified library.
  2583. @item controls, c
  2584. Set the '|' separated list of controls which are zero or more floating point
  2585. values that determine the behavior of the loaded plugin (for example delay,
  2586. threshold or gain).
  2587. Controls need to be defined using the following syntax:
  2588. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2589. @var{valuei} is the value set on the @var{i}-th control.
  2590. Alternatively they can be also defined using the following syntax:
  2591. @var{value0}|@var{value1}|@var{value2}|..., where
  2592. @var{valuei} is the value set on the @var{i}-th control.
  2593. If @option{controls} is set to @code{help}, all available controls and
  2594. their valid ranges are printed.
  2595. @item sample_rate, s
  2596. Specify the sample rate, default to 44100. Only used if plugin have
  2597. zero inputs.
  2598. @item nb_samples, n
  2599. Set the number of samples per channel per each output frame, default
  2600. is 1024. Only used if plugin have zero inputs.
  2601. @item duration, d
  2602. Set the minimum duration of the sourced audio. See
  2603. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2604. for the accepted syntax.
  2605. Note that the resulting duration may be greater than the specified duration,
  2606. as the generated audio is always cut at the end of a complete frame.
  2607. If not specified, or the expressed duration is negative, the audio is
  2608. supposed to be generated forever.
  2609. Only used if plugin have zero inputs.
  2610. @end table
  2611. @subsection Examples
  2612. @itemize
  2613. @item
  2614. List all available plugins within amp (LADSPA example plugin) library:
  2615. @example
  2616. ladspa=file=amp
  2617. @end example
  2618. @item
  2619. List all available controls and their valid ranges for @code{vcf_notch}
  2620. plugin from @code{VCF} library:
  2621. @example
  2622. ladspa=f=vcf:p=vcf_notch:c=help
  2623. @end example
  2624. @item
  2625. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2626. plugin library:
  2627. @example
  2628. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2629. @end example
  2630. @item
  2631. Add reverberation to the audio using TAP-plugins
  2632. (Tom's Audio Processing plugins):
  2633. @example
  2634. ladspa=file=tap_reverb:tap_reverb
  2635. @end example
  2636. @item
  2637. Generate white noise, with 0.2 amplitude:
  2638. @example
  2639. ladspa=file=cmt:noise_source_white:c=c0=.2
  2640. @end example
  2641. @item
  2642. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2643. @code{C* Audio Plugin Suite} (CAPS) library:
  2644. @example
  2645. ladspa=file=caps:Click:c=c1=20'
  2646. @end example
  2647. @item
  2648. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2649. @example
  2650. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2651. @end example
  2652. @item
  2653. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2654. @code{SWH Plugins} collection:
  2655. @example
  2656. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2657. @end example
  2658. @item
  2659. Attenuate low frequencies using Multiband EQ from Steve Harris
  2660. @code{SWH Plugins} collection:
  2661. @example
  2662. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2663. @end example
  2664. @item
  2665. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2666. (CAPS) library:
  2667. @example
  2668. ladspa=caps:Narrower
  2669. @end example
  2670. @item
  2671. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2672. @example
  2673. ladspa=caps:White:.2
  2674. @end example
  2675. @item
  2676. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2677. @example
  2678. ladspa=caps:Fractal:c=c1=1
  2679. @end example
  2680. @item
  2681. Dynamic volume normalization using @code{VLevel} plugin:
  2682. @example
  2683. ladspa=vlevel-ladspa:vlevel_mono
  2684. @end example
  2685. @end itemize
  2686. @subsection Commands
  2687. This filter supports the following commands:
  2688. @table @option
  2689. @item cN
  2690. Modify the @var{N}-th control value.
  2691. If the specified value is not valid, it is ignored and prior one is kept.
  2692. @end table
  2693. @section loudnorm
  2694. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2695. Support for both single pass (livestreams, files) and double pass (files) modes.
  2696. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  2697. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  2698. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  2699. The filter accepts the following options:
  2700. @table @option
  2701. @item I, i
  2702. Set integrated loudness target.
  2703. Range is -70.0 - -5.0. Default value is -24.0.
  2704. @item LRA, lra
  2705. Set loudness range target.
  2706. Range is 1.0 - 20.0. Default value is 7.0.
  2707. @item TP, tp
  2708. Set maximum true peak.
  2709. Range is -9.0 - +0.0. Default value is -2.0.
  2710. @item measured_I, measured_i
  2711. Measured IL of input file.
  2712. Range is -99.0 - +0.0.
  2713. @item measured_LRA, measured_lra
  2714. Measured LRA of input file.
  2715. Range is 0.0 - 99.0.
  2716. @item measured_TP, measured_tp
  2717. Measured true peak of input file.
  2718. Range is -99.0 - +99.0.
  2719. @item measured_thresh
  2720. Measured threshold of input file.
  2721. Range is -99.0 - +0.0.
  2722. @item offset
  2723. Set offset gain. Gain is applied before the true-peak limiter.
  2724. Range is -99.0 - +99.0. Default is +0.0.
  2725. @item linear
  2726. Normalize linearly if possible.
  2727. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2728. to be specified in order to use this mode.
  2729. Options are true or false. Default is true.
  2730. @item dual_mono
  2731. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2732. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2733. If set to @code{true}, this option will compensate for this effect.
  2734. Multi-channel input files are not affected by this option.
  2735. Options are true or false. Default is false.
  2736. @item print_format
  2737. Set print format for stats. Options are summary, json, or none.
  2738. Default value is none.
  2739. @end table
  2740. @section lowpass
  2741. Apply a low-pass filter with 3dB point frequency.
  2742. The filter can be either single-pole or double-pole (the default).
  2743. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2744. The filter accepts the following options:
  2745. @table @option
  2746. @item frequency, f
  2747. Set frequency in Hz. Default is 500.
  2748. @item poles, p
  2749. Set number of poles. Default is 2.
  2750. @item width_type, t
  2751. Set method to specify band-width of filter.
  2752. @table @option
  2753. @item h
  2754. Hz
  2755. @item q
  2756. Q-Factor
  2757. @item o
  2758. octave
  2759. @item s
  2760. slope
  2761. @item k
  2762. kHz
  2763. @end table
  2764. @item width, w
  2765. Specify the band-width of a filter in width_type units.
  2766. Applies only to double-pole filter.
  2767. The default is 0.707q and gives a Butterworth response.
  2768. @item channels, c
  2769. Specify which channels to filter, by default all available are filtered.
  2770. @end table
  2771. @subsection Examples
  2772. @itemize
  2773. @item
  2774. Lowpass only LFE channel, it LFE is not present it does nothing:
  2775. @example
  2776. lowpass=c=LFE
  2777. @end example
  2778. @end itemize
  2779. @subsection Commands
  2780. This filter supports the following commands:
  2781. @table @option
  2782. @item frequency, f
  2783. Change lowpass frequency.
  2784. Syntax for the command is : "@var{frequency}"
  2785. @item width_type, t
  2786. Change lowpass width_type.
  2787. Syntax for the command is : "@var{width_type}"
  2788. @item width, w
  2789. Change lowpass width.
  2790. Syntax for the command is : "@var{width}"
  2791. @end table
  2792. @section lv2
  2793. Load a LV2 (LADSPA Version 2) plugin.
  2794. To enable compilation of this filter you need to configure FFmpeg with
  2795. @code{--enable-lv2}.
  2796. @table @option
  2797. @item plugin, p
  2798. Specifies the plugin URI. You may need to escape ':'.
  2799. @item controls, c
  2800. Set the '|' separated list of controls which are zero or more floating point
  2801. values that determine the behavior of the loaded plugin (for example delay,
  2802. threshold or gain).
  2803. If @option{controls} is set to @code{help}, all available controls and
  2804. their valid ranges are printed.
  2805. @item sample_rate, s
  2806. Specify the sample rate, default to 44100. Only used if plugin have
  2807. zero inputs.
  2808. @item nb_samples, n
  2809. Set the number of samples per channel per each output frame, default
  2810. is 1024. Only used if plugin have zero inputs.
  2811. @item duration, d
  2812. Set the minimum duration of the sourced audio. See
  2813. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2814. for the accepted syntax.
  2815. Note that the resulting duration may be greater than the specified duration,
  2816. as the generated audio is always cut at the end of a complete frame.
  2817. If not specified, or the expressed duration is negative, the audio is
  2818. supposed to be generated forever.
  2819. Only used if plugin have zero inputs.
  2820. @end table
  2821. @subsection Examples
  2822. @itemize
  2823. @item
  2824. Apply bass enhancer plugin from Calf:
  2825. @example
  2826. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  2827. @end example
  2828. @item
  2829. Apply vinyl plugin from Calf:
  2830. @example
  2831. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  2832. @end example
  2833. @item
  2834. Apply bit crusher plugin from ArtyFX:
  2835. @example
  2836. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  2837. @end example
  2838. @end itemize
  2839. @section mcompand
  2840. Multiband Compress or expand the audio's dynamic range.
  2841. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  2842. This is akin to the crossover of a loudspeaker, and results in flat frequency
  2843. response when absent compander action.
  2844. It accepts the following parameters:
  2845. @table @option
  2846. @item args
  2847. This option syntax is:
  2848. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  2849. For explanation of each item refer to compand filter documentation.
  2850. @end table
  2851. @anchor{pan}
  2852. @section pan
  2853. Mix channels with specific gain levels. The filter accepts the output
  2854. channel layout followed by a set of channels definitions.
  2855. This filter is also designed to efficiently remap the channels of an audio
  2856. stream.
  2857. The filter accepts parameters of the form:
  2858. "@var{l}|@var{outdef}|@var{outdef}|..."
  2859. @table @option
  2860. @item l
  2861. output channel layout or number of channels
  2862. @item outdef
  2863. output channel specification, of the form:
  2864. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  2865. @item out_name
  2866. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2867. number (c0, c1, etc.)
  2868. @item gain
  2869. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2870. @item in_name
  2871. input channel to use, see out_name for details; it is not possible to mix
  2872. named and numbered input channels
  2873. @end table
  2874. If the `=' in a channel specification is replaced by `<', then the gains for
  2875. that specification will be renormalized so that the total is 1, thus
  2876. avoiding clipping noise.
  2877. @subsection Mixing examples
  2878. For example, if you want to down-mix from stereo to mono, but with a bigger
  2879. factor for the left channel:
  2880. @example
  2881. pan=1c|c0=0.9*c0+0.1*c1
  2882. @end example
  2883. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2884. 7-channels surround:
  2885. @example
  2886. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2887. @end example
  2888. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2889. that should be preferred (see "-ac" option) unless you have very specific
  2890. needs.
  2891. @subsection Remapping examples
  2892. The channel remapping will be effective if, and only if:
  2893. @itemize
  2894. @item gain coefficients are zeroes or ones,
  2895. @item only one input per channel output,
  2896. @end itemize
  2897. If all these conditions are satisfied, the filter will notify the user ("Pure
  2898. channel mapping detected"), and use an optimized and lossless method to do the
  2899. remapping.
  2900. For example, if you have a 5.1 source and want a stereo audio stream by
  2901. dropping the extra channels:
  2902. @example
  2903. pan="stereo| c0=FL | c1=FR"
  2904. @end example
  2905. Given the same source, you can also switch front left and front right channels
  2906. and keep the input channel layout:
  2907. @example
  2908. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2909. @end example
  2910. If the input is a stereo audio stream, you can mute the front left channel (and
  2911. still keep the stereo channel layout) with:
  2912. @example
  2913. pan="stereo|c1=c1"
  2914. @end example
  2915. Still with a stereo audio stream input, you can copy the right channel in both
  2916. front left and right:
  2917. @example
  2918. pan="stereo| c0=FR | c1=FR"
  2919. @end example
  2920. @section replaygain
  2921. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2922. outputs it unchanged.
  2923. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2924. @section resample
  2925. Convert the audio sample format, sample rate and channel layout. It is
  2926. not meant to be used directly.
  2927. @section rubberband
  2928. Apply time-stretching and pitch-shifting with librubberband.
  2929. The filter accepts the following options:
  2930. @table @option
  2931. @item tempo
  2932. Set tempo scale factor.
  2933. @item pitch
  2934. Set pitch scale factor.
  2935. @item transients
  2936. Set transients detector.
  2937. Possible values are:
  2938. @table @var
  2939. @item crisp
  2940. @item mixed
  2941. @item smooth
  2942. @end table
  2943. @item detector
  2944. Set detector.
  2945. Possible values are:
  2946. @table @var
  2947. @item compound
  2948. @item percussive
  2949. @item soft
  2950. @end table
  2951. @item phase
  2952. Set phase.
  2953. Possible values are:
  2954. @table @var
  2955. @item laminar
  2956. @item independent
  2957. @end table
  2958. @item window
  2959. Set processing window size.
  2960. Possible values are:
  2961. @table @var
  2962. @item standard
  2963. @item short
  2964. @item long
  2965. @end table
  2966. @item smoothing
  2967. Set smoothing.
  2968. Possible values are:
  2969. @table @var
  2970. @item off
  2971. @item on
  2972. @end table
  2973. @item formant
  2974. Enable formant preservation when shift pitching.
  2975. Possible values are:
  2976. @table @var
  2977. @item shifted
  2978. @item preserved
  2979. @end table
  2980. @item pitchq
  2981. Set pitch quality.
  2982. Possible values are:
  2983. @table @var
  2984. @item quality
  2985. @item speed
  2986. @item consistency
  2987. @end table
  2988. @item channels
  2989. Set channels.
  2990. Possible values are:
  2991. @table @var
  2992. @item apart
  2993. @item together
  2994. @end table
  2995. @end table
  2996. @section sidechaincompress
  2997. This filter acts like normal compressor but has the ability to compress
  2998. detected signal using second input signal.
  2999. It needs two input streams and returns one output stream.
  3000. First input stream will be processed depending on second stream signal.
  3001. The filtered signal then can be filtered with other filters in later stages of
  3002. processing. See @ref{pan} and @ref{amerge} filter.
  3003. The filter accepts the following options:
  3004. @table @option
  3005. @item level_in
  3006. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3007. @item threshold
  3008. If a signal of second stream raises above this level it will affect the gain
  3009. reduction of first stream.
  3010. By default is 0.125. Range is between 0.00097563 and 1.
  3011. @item ratio
  3012. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3013. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3014. Default is 2. Range is between 1 and 20.
  3015. @item attack
  3016. Amount of milliseconds the signal has to rise above the threshold before gain
  3017. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3018. @item release
  3019. Amount of milliseconds the signal has to fall below the threshold before
  3020. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3021. @item makeup
  3022. Set the amount by how much signal will be amplified after processing.
  3023. Default is 1. Range is from 1 to 64.
  3024. @item knee
  3025. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3026. Default is 2.82843. Range is between 1 and 8.
  3027. @item link
  3028. Choose if the @code{average} level between all channels of side-chain stream
  3029. or the louder(@code{maximum}) channel of side-chain stream affects the
  3030. reduction. Default is @code{average}.
  3031. @item detection
  3032. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3033. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3034. @item level_sc
  3035. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3036. @item mix
  3037. How much to use compressed signal in output. Default is 1.
  3038. Range is between 0 and 1.
  3039. @end table
  3040. @subsection Examples
  3041. @itemize
  3042. @item
  3043. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3044. depending on the signal of 2nd input and later compressed signal to be
  3045. merged with 2nd input:
  3046. @example
  3047. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3048. @end example
  3049. @end itemize
  3050. @section sidechaingate
  3051. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3052. filter the detected signal before sending it to the gain reduction stage.
  3053. Normally a gate uses the full range signal to detect a level above the
  3054. threshold.
  3055. For example: If you cut all lower frequencies from your sidechain signal
  3056. the gate will decrease the volume of your track only if not enough highs
  3057. appear. With this technique you are able to reduce the resonation of a
  3058. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3059. guitar.
  3060. It needs two input streams and returns one output stream.
  3061. First input stream will be processed depending on second stream signal.
  3062. The filter accepts the following options:
  3063. @table @option
  3064. @item level_in
  3065. Set input level before filtering.
  3066. Default is 1. Allowed range is from 0.015625 to 64.
  3067. @item range
  3068. Set the level of gain reduction when the signal is below the threshold.
  3069. Default is 0.06125. Allowed range is from 0 to 1.
  3070. @item threshold
  3071. If a signal rises above this level the gain reduction is released.
  3072. Default is 0.125. Allowed range is from 0 to 1.
  3073. @item ratio
  3074. Set a ratio about which the signal is reduced.
  3075. Default is 2. Allowed range is from 1 to 9000.
  3076. @item attack
  3077. Amount of milliseconds the signal has to rise above the threshold before gain
  3078. reduction stops.
  3079. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3080. @item release
  3081. Amount of milliseconds the signal has to fall below the threshold before the
  3082. reduction is increased again. Default is 250 milliseconds.
  3083. Allowed range is from 0.01 to 9000.
  3084. @item makeup
  3085. Set amount of amplification of signal after processing.
  3086. Default is 1. Allowed range is from 1 to 64.
  3087. @item knee
  3088. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3089. Default is 2.828427125. Allowed range is from 1 to 8.
  3090. @item detection
  3091. Choose if exact signal should be taken for detection or an RMS like one.
  3092. Default is rms. Can be peak or rms.
  3093. @item link
  3094. Choose if the average level between all channels or the louder channel affects
  3095. the reduction.
  3096. Default is average. Can be average or maximum.
  3097. @item level_sc
  3098. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3099. @end table
  3100. @section silencedetect
  3101. Detect silence in an audio stream.
  3102. This filter logs a message when it detects that the input audio volume is less
  3103. or equal to a noise tolerance value for a duration greater or equal to the
  3104. minimum detected noise duration.
  3105. The printed times and duration are expressed in seconds.
  3106. The filter accepts the following options:
  3107. @table @option
  3108. @item duration, d
  3109. Set silence duration until notification (default is 2 seconds).
  3110. @item noise, n
  3111. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3112. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3113. @end table
  3114. @subsection Examples
  3115. @itemize
  3116. @item
  3117. Detect 5 seconds of silence with -50dB noise tolerance:
  3118. @example
  3119. silencedetect=n=-50dB:d=5
  3120. @end example
  3121. @item
  3122. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3123. tolerance in @file{silence.mp3}:
  3124. @example
  3125. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3126. @end example
  3127. @end itemize
  3128. @section silenceremove
  3129. Remove silence from the beginning, middle or end of the audio.
  3130. The filter accepts the following options:
  3131. @table @option
  3132. @item start_periods
  3133. This value is used to indicate if audio should be trimmed at beginning of
  3134. the audio. A value of zero indicates no silence should be trimmed from the
  3135. beginning. When specifying a non-zero value, it trims audio up until it
  3136. finds non-silence. Normally, when trimming silence from beginning of audio
  3137. the @var{start_periods} will be @code{1} but it can be increased to higher
  3138. values to trim all audio up to specific count of non-silence periods.
  3139. Default value is @code{0}.
  3140. @item start_duration
  3141. Specify the amount of time that non-silence must be detected before it stops
  3142. trimming audio. By increasing the duration, bursts of noises can be treated
  3143. as silence and trimmed off. Default value is @code{0}.
  3144. @item start_threshold
  3145. This indicates what sample value should be treated as silence. For digital
  3146. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3147. you may wish to increase the value to account for background noise.
  3148. Can be specified in dB (in case "dB" is appended to the specified value)
  3149. or amplitude ratio. Default value is @code{0}.
  3150. @item stop_periods
  3151. Set the count for trimming silence from the end of audio.
  3152. To remove silence from the middle of a file, specify a @var{stop_periods}
  3153. that is negative. This value is then treated as a positive value and is
  3154. used to indicate the effect should restart processing as specified by
  3155. @var{start_periods}, making it suitable for removing periods of silence
  3156. in the middle of the audio.
  3157. Default value is @code{0}.
  3158. @item stop_duration
  3159. Specify a duration of silence that must exist before audio is not copied any
  3160. more. By specifying a higher duration, silence that is wanted can be left in
  3161. the audio.
  3162. Default value is @code{0}.
  3163. @item stop_threshold
  3164. This is the same as @option{start_threshold} but for trimming silence from
  3165. the end of audio.
  3166. Can be specified in dB (in case "dB" is appended to the specified value)
  3167. or amplitude ratio. Default value is @code{0}.
  3168. @item leave_silence
  3169. This indicates that @var{stop_duration} length of audio should be left intact
  3170. at the beginning of each period of silence.
  3171. For example, if you want to remove long pauses between words but do not want
  3172. to remove the pauses completely. Default value is @code{0}.
  3173. @item detection
  3174. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3175. and works better with digital silence which is exactly 0.
  3176. Default value is @code{rms}.
  3177. @item window
  3178. Set ratio used to calculate size of window for detecting silence.
  3179. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3180. @end table
  3181. @subsection Examples
  3182. @itemize
  3183. @item
  3184. The following example shows how this filter can be used to start a recording
  3185. that does not contain the delay at the start which usually occurs between
  3186. pressing the record button and the start of the performance:
  3187. @example
  3188. silenceremove=1:5:0.02
  3189. @end example
  3190. @item
  3191. Trim all silence encountered from beginning to end where there is more than 1
  3192. second of silence in audio:
  3193. @example
  3194. silenceremove=0:0:0:-1:1:-90dB
  3195. @end example
  3196. @end itemize
  3197. @section sofalizer
  3198. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3199. loudspeakers around the user for binaural listening via headphones (audio
  3200. formats up to 9 channels supported).
  3201. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3202. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3203. Austrian Academy of Sciences.
  3204. To enable compilation of this filter you need to configure FFmpeg with
  3205. @code{--enable-libmysofa}.
  3206. The filter accepts the following options:
  3207. @table @option
  3208. @item sofa
  3209. Set the SOFA file used for rendering.
  3210. @item gain
  3211. Set gain applied to audio. Value is in dB. Default is 0.
  3212. @item rotation
  3213. Set rotation of virtual loudspeakers in deg. Default is 0.
  3214. @item elevation
  3215. Set elevation of virtual speakers in deg. Default is 0.
  3216. @item radius
  3217. Set distance in meters between loudspeakers and the listener with near-field
  3218. HRTFs. Default is 1.
  3219. @item type
  3220. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3221. processing audio in time domain which is slow.
  3222. @var{freq} is processing audio in frequency domain which is fast.
  3223. Default is @var{freq}.
  3224. @item speakers
  3225. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3226. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3227. Each virtual loudspeaker is described with short channel name following with
  3228. azimuth and elevation in degrees.
  3229. Each virtual loudspeaker description is separated by '|'.
  3230. For example to override front left and front right channel positions use:
  3231. 'speakers=FL 45 15|FR 345 15'.
  3232. Descriptions with unrecognised channel names are ignored.
  3233. @item lfegain
  3234. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3235. @end table
  3236. @subsection Examples
  3237. @itemize
  3238. @item
  3239. Using ClubFritz6 sofa file:
  3240. @example
  3241. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3242. @end example
  3243. @item
  3244. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3245. @example
  3246. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3247. @end example
  3248. @item
  3249. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3250. and also with custom gain:
  3251. @example
  3252. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3253. @end example
  3254. @end itemize
  3255. @section stereotools
  3256. This filter has some handy utilities to manage stereo signals, for converting
  3257. M/S stereo recordings to L/R signal while having control over the parameters
  3258. or spreading the stereo image of master track.
  3259. The filter accepts the following options:
  3260. @table @option
  3261. @item level_in
  3262. Set input level before filtering for both channels. Defaults is 1.
  3263. Allowed range is from 0.015625 to 64.
  3264. @item level_out
  3265. Set output level after filtering for both channels. Defaults is 1.
  3266. Allowed range is from 0.015625 to 64.
  3267. @item balance_in
  3268. Set input balance between both channels. Default is 0.
  3269. Allowed range is from -1 to 1.
  3270. @item balance_out
  3271. Set output balance between both channels. Default is 0.
  3272. Allowed range is from -1 to 1.
  3273. @item softclip
  3274. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3275. clipping. Disabled by default.
  3276. @item mutel
  3277. Mute the left channel. Disabled by default.
  3278. @item muter
  3279. Mute the right channel. Disabled by default.
  3280. @item phasel
  3281. Change the phase of the left channel. Disabled by default.
  3282. @item phaser
  3283. Change the phase of the right channel. Disabled by default.
  3284. @item mode
  3285. Set stereo mode. Available values are:
  3286. @table @samp
  3287. @item lr>lr
  3288. Left/Right to Left/Right, this is default.
  3289. @item lr>ms
  3290. Left/Right to Mid/Side.
  3291. @item ms>lr
  3292. Mid/Side to Left/Right.
  3293. @item lr>ll
  3294. Left/Right to Left/Left.
  3295. @item lr>rr
  3296. Left/Right to Right/Right.
  3297. @item lr>l+r
  3298. Left/Right to Left + Right.
  3299. @item lr>rl
  3300. Left/Right to Right/Left.
  3301. @item ms>ll
  3302. Mid/Side to Left/Left.
  3303. @item ms>rr
  3304. Mid/Side to Right/Right.
  3305. @end table
  3306. @item slev
  3307. Set level of side signal. Default is 1.
  3308. Allowed range is from 0.015625 to 64.
  3309. @item sbal
  3310. Set balance of side signal. Default is 0.
  3311. Allowed range is from -1 to 1.
  3312. @item mlev
  3313. Set level of the middle signal. Default is 1.
  3314. Allowed range is from 0.015625 to 64.
  3315. @item mpan
  3316. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3317. @item base
  3318. Set stereo base between mono and inversed channels. Default is 0.
  3319. Allowed range is from -1 to 1.
  3320. @item delay
  3321. Set delay in milliseconds how much to delay left from right channel and
  3322. vice versa. Default is 0. Allowed range is from -20 to 20.
  3323. @item sclevel
  3324. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3325. @item phase
  3326. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3327. @item bmode_in, bmode_out
  3328. Set balance mode for balance_in/balance_out option.
  3329. Can be one of the following:
  3330. @table @samp
  3331. @item balance
  3332. Classic balance mode. Attenuate one channel at time.
  3333. Gain is raised up to 1.
  3334. @item amplitude
  3335. Similar as classic mode above but gain is raised up to 2.
  3336. @item power
  3337. Equal power distribution, from -6dB to +6dB range.
  3338. @end table
  3339. @end table
  3340. @subsection Examples
  3341. @itemize
  3342. @item
  3343. Apply karaoke like effect:
  3344. @example
  3345. stereotools=mlev=0.015625
  3346. @end example
  3347. @item
  3348. Convert M/S signal to L/R:
  3349. @example
  3350. "stereotools=mode=ms>lr"
  3351. @end example
  3352. @end itemize
  3353. @section stereowiden
  3354. This filter enhance the stereo effect by suppressing signal common to both
  3355. channels and by delaying the signal of left into right and vice versa,
  3356. thereby widening the stereo effect.
  3357. The filter accepts the following options:
  3358. @table @option
  3359. @item delay
  3360. Time in milliseconds of the delay of left signal into right and vice versa.
  3361. Default is 20 milliseconds.
  3362. @item feedback
  3363. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3364. effect of left signal in right output and vice versa which gives widening
  3365. effect. Default is 0.3.
  3366. @item crossfeed
  3367. Cross feed of left into right with inverted phase. This helps in suppressing
  3368. the mono. If the value is 1 it will cancel all the signal common to both
  3369. channels. Default is 0.3.
  3370. @item drymix
  3371. Set level of input signal of original channel. Default is 0.8.
  3372. @end table
  3373. @section superequalizer
  3374. Apply 18 band equalizer.
  3375. The filter accepts the following options:
  3376. @table @option
  3377. @item 1b
  3378. Set 65Hz band gain.
  3379. @item 2b
  3380. Set 92Hz band gain.
  3381. @item 3b
  3382. Set 131Hz band gain.
  3383. @item 4b
  3384. Set 185Hz band gain.
  3385. @item 5b
  3386. Set 262Hz band gain.
  3387. @item 6b
  3388. Set 370Hz band gain.
  3389. @item 7b
  3390. Set 523Hz band gain.
  3391. @item 8b
  3392. Set 740Hz band gain.
  3393. @item 9b
  3394. Set 1047Hz band gain.
  3395. @item 10b
  3396. Set 1480Hz band gain.
  3397. @item 11b
  3398. Set 2093Hz band gain.
  3399. @item 12b
  3400. Set 2960Hz band gain.
  3401. @item 13b
  3402. Set 4186Hz band gain.
  3403. @item 14b
  3404. Set 5920Hz band gain.
  3405. @item 15b
  3406. Set 8372Hz band gain.
  3407. @item 16b
  3408. Set 11840Hz band gain.
  3409. @item 17b
  3410. Set 16744Hz band gain.
  3411. @item 18b
  3412. Set 20000Hz band gain.
  3413. @end table
  3414. @section surround
  3415. Apply audio surround upmix filter.
  3416. This filter allows to produce multichannel output from audio stream.
  3417. The filter accepts the following options:
  3418. @table @option
  3419. @item chl_out
  3420. Set output channel layout. By default, this is @var{5.1}.
  3421. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3422. for the required syntax.
  3423. @item chl_in
  3424. Set input channel layout. By default, this is @var{stereo}.
  3425. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3426. for the required syntax.
  3427. @item level_in
  3428. Set input volume level. By default, this is @var{1}.
  3429. @item level_out
  3430. Set output volume level. By default, this is @var{1}.
  3431. @item lfe
  3432. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3433. @item lfe_low
  3434. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3435. @item lfe_high
  3436. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3437. @item fc_in
  3438. Set front center input volume. By default, this is @var{1}.
  3439. @item fc_out
  3440. Set front center output volume. By default, this is @var{1}.
  3441. @item lfe_in
  3442. Set LFE input volume. By default, this is @var{1}.
  3443. @item lfe_out
  3444. Set LFE output volume. By default, this is @var{1}.
  3445. @end table
  3446. @section treble
  3447. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3448. shelving filter with a response similar to that of a standard
  3449. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3450. The filter accepts the following options:
  3451. @table @option
  3452. @item gain, g
  3453. Give the gain at whichever is the lower of ~22 kHz and the
  3454. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3455. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3456. @item frequency, f
  3457. Set the filter's central frequency and so can be used
  3458. to extend or reduce the frequency range to be boosted or cut.
  3459. The default value is @code{3000} Hz.
  3460. @item width_type, t
  3461. Set method to specify band-width of filter.
  3462. @table @option
  3463. @item h
  3464. Hz
  3465. @item q
  3466. Q-Factor
  3467. @item o
  3468. octave
  3469. @item s
  3470. slope
  3471. @item k
  3472. kHz
  3473. @end table
  3474. @item width, w
  3475. Determine how steep is the filter's shelf transition.
  3476. @item channels, c
  3477. Specify which channels to filter, by default all available are filtered.
  3478. @end table
  3479. @subsection Commands
  3480. This filter supports the following commands:
  3481. @table @option
  3482. @item frequency, f
  3483. Change treble frequency.
  3484. Syntax for the command is : "@var{frequency}"
  3485. @item width_type, t
  3486. Change treble width_type.
  3487. Syntax for the command is : "@var{width_type}"
  3488. @item width, w
  3489. Change treble width.
  3490. Syntax for the command is : "@var{width}"
  3491. @item gain, g
  3492. Change treble gain.
  3493. Syntax for the command is : "@var{gain}"
  3494. @end table
  3495. @section tremolo
  3496. Sinusoidal amplitude modulation.
  3497. The filter accepts the following options:
  3498. @table @option
  3499. @item f
  3500. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3501. (20 Hz or lower) will result in a tremolo effect.
  3502. This filter may also be used as a ring modulator by specifying
  3503. a modulation frequency higher than 20 Hz.
  3504. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3505. @item d
  3506. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3507. Default value is 0.5.
  3508. @end table
  3509. @section vibrato
  3510. Sinusoidal phase modulation.
  3511. The filter accepts the following options:
  3512. @table @option
  3513. @item f
  3514. Modulation frequency in Hertz.
  3515. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3516. @item d
  3517. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3518. Default value is 0.5.
  3519. @end table
  3520. @section volume
  3521. Adjust the input audio volume.
  3522. It accepts the following parameters:
  3523. @table @option
  3524. @item volume
  3525. Set audio volume expression.
  3526. Output values are clipped to the maximum value.
  3527. The output audio volume is given by the relation:
  3528. @example
  3529. @var{output_volume} = @var{volume} * @var{input_volume}
  3530. @end example
  3531. The default value for @var{volume} is "1.0".
  3532. @item precision
  3533. This parameter represents the mathematical precision.
  3534. It determines which input sample formats will be allowed, which affects the
  3535. precision of the volume scaling.
  3536. @table @option
  3537. @item fixed
  3538. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3539. @item float
  3540. 32-bit floating-point; this limits input sample format to FLT. (default)
  3541. @item double
  3542. 64-bit floating-point; this limits input sample format to DBL.
  3543. @end table
  3544. @item replaygain
  3545. Choose the behaviour on encountering ReplayGain side data in input frames.
  3546. @table @option
  3547. @item drop
  3548. Remove ReplayGain side data, ignoring its contents (the default).
  3549. @item ignore
  3550. Ignore ReplayGain side data, but leave it in the frame.
  3551. @item track
  3552. Prefer the track gain, if present.
  3553. @item album
  3554. Prefer the album gain, if present.
  3555. @end table
  3556. @item replaygain_preamp
  3557. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3558. Default value for @var{replaygain_preamp} is 0.0.
  3559. @item eval
  3560. Set when the volume expression is evaluated.
  3561. It accepts the following values:
  3562. @table @samp
  3563. @item once
  3564. only evaluate expression once during the filter initialization, or
  3565. when the @samp{volume} command is sent
  3566. @item frame
  3567. evaluate expression for each incoming frame
  3568. @end table
  3569. Default value is @samp{once}.
  3570. @end table
  3571. The volume expression can contain the following parameters.
  3572. @table @option
  3573. @item n
  3574. frame number (starting at zero)
  3575. @item nb_channels
  3576. number of channels
  3577. @item nb_consumed_samples
  3578. number of samples consumed by the filter
  3579. @item nb_samples
  3580. number of samples in the current frame
  3581. @item pos
  3582. original frame position in the file
  3583. @item pts
  3584. frame PTS
  3585. @item sample_rate
  3586. sample rate
  3587. @item startpts
  3588. PTS at start of stream
  3589. @item startt
  3590. time at start of stream
  3591. @item t
  3592. frame time
  3593. @item tb
  3594. timestamp timebase
  3595. @item volume
  3596. last set volume value
  3597. @end table
  3598. Note that when @option{eval} is set to @samp{once} only the
  3599. @var{sample_rate} and @var{tb} variables are available, all other
  3600. variables will evaluate to NAN.
  3601. @subsection Commands
  3602. This filter supports the following commands:
  3603. @table @option
  3604. @item volume
  3605. Modify the volume expression.
  3606. The command accepts the same syntax of the corresponding option.
  3607. If the specified expression is not valid, it is kept at its current
  3608. value.
  3609. @item replaygain_noclip
  3610. Prevent clipping by limiting the gain applied.
  3611. Default value for @var{replaygain_noclip} is 1.
  3612. @end table
  3613. @subsection Examples
  3614. @itemize
  3615. @item
  3616. Halve the input audio volume:
  3617. @example
  3618. volume=volume=0.5
  3619. volume=volume=1/2
  3620. volume=volume=-6.0206dB
  3621. @end example
  3622. In all the above example the named key for @option{volume} can be
  3623. omitted, for example like in:
  3624. @example
  3625. volume=0.5
  3626. @end example
  3627. @item
  3628. Increase input audio power by 6 decibels using fixed-point precision:
  3629. @example
  3630. volume=volume=6dB:precision=fixed
  3631. @end example
  3632. @item
  3633. Fade volume after time 10 with an annihilation period of 5 seconds:
  3634. @example
  3635. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3636. @end example
  3637. @end itemize
  3638. @section volumedetect
  3639. Detect the volume of the input video.
  3640. The filter has no parameters. The input is not modified. Statistics about
  3641. the volume will be printed in the log when the input stream end is reached.
  3642. In particular it will show the mean volume (root mean square), maximum
  3643. volume (on a per-sample basis), and the beginning of a histogram of the
  3644. registered volume values (from the maximum value to a cumulated 1/1000 of
  3645. the samples).
  3646. All volumes are in decibels relative to the maximum PCM value.
  3647. @subsection Examples
  3648. Here is an excerpt of the output:
  3649. @example
  3650. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3651. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3652. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3653. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3654. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3655. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3656. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3657. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3658. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3659. @end example
  3660. It means that:
  3661. @itemize
  3662. @item
  3663. The mean square energy is approximately -27 dB, or 10^-2.7.
  3664. @item
  3665. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3666. @item
  3667. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3668. @end itemize
  3669. In other words, raising the volume by +4 dB does not cause any clipping,
  3670. raising it by +5 dB causes clipping for 6 samples, etc.
  3671. @c man end AUDIO FILTERS
  3672. @chapter Audio Sources
  3673. @c man begin AUDIO SOURCES
  3674. Below is a description of the currently available audio sources.
  3675. @section abuffer
  3676. Buffer audio frames, and make them available to the filter chain.
  3677. This source is mainly intended for a programmatic use, in particular
  3678. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3679. It accepts the following parameters:
  3680. @table @option
  3681. @item time_base
  3682. The timebase which will be used for timestamps of submitted frames. It must be
  3683. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3684. @item sample_rate
  3685. The sample rate of the incoming audio buffers.
  3686. @item sample_fmt
  3687. The sample format of the incoming audio buffers.
  3688. Either a sample format name or its corresponding integer representation from
  3689. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3690. @item channel_layout
  3691. The channel layout of the incoming audio buffers.
  3692. Either a channel layout name from channel_layout_map in
  3693. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3694. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3695. @item channels
  3696. The number of channels of the incoming audio buffers.
  3697. If both @var{channels} and @var{channel_layout} are specified, then they
  3698. must be consistent.
  3699. @end table
  3700. @subsection Examples
  3701. @example
  3702. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3703. @end example
  3704. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3705. Since the sample format with name "s16p" corresponds to the number
  3706. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3707. equivalent to:
  3708. @example
  3709. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3710. @end example
  3711. @section aevalsrc
  3712. Generate an audio signal specified by an expression.
  3713. This source accepts in input one or more expressions (one for each
  3714. channel), which are evaluated and used to generate a corresponding
  3715. audio signal.
  3716. This source accepts the following options:
  3717. @table @option
  3718. @item exprs
  3719. Set the '|'-separated expressions list for each separate channel. In case the
  3720. @option{channel_layout} option is not specified, the selected channel layout
  3721. depends on the number of provided expressions. Otherwise the last
  3722. specified expression is applied to the remaining output channels.
  3723. @item channel_layout, c
  3724. Set the channel layout. The number of channels in the specified layout
  3725. must be equal to the number of specified expressions.
  3726. @item duration, d
  3727. Set the minimum duration of the sourced audio. See
  3728. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3729. for the accepted syntax.
  3730. Note that the resulting duration may be greater than the specified
  3731. duration, as the generated audio is always cut at the end of a
  3732. complete frame.
  3733. If not specified, or the expressed duration is negative, the audio is
  3734. supposed to be generated forever.
  3735. @item nb_samples, n
  3736. Set the number of samples per channel per each output frame,
  3737. default to 1024.
  3738. @item sample_rate, s
  3739. Specify the sample rate, default to 44100.
  3740. @end table
  3741. Each expression in @var{exprs} can contain the following constants:
  3742. @table @option
  3743. @item n
  3744. number of the evaluated sample, starting from 0
  3745. @item t
  3746. time of the evaluated sample expressed in seconds, starting from 0
  3747. @item s
  3748. sample rate
  3749. @end table
  3750. @subsection Examples
  3751. @itemize
  3752. @item
  3753. Generate silence:
  3754. @example
  3755. aevalsrc=0
  3756. @end example
  3757. @item
  3758. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3759. 8000 Hz:
  3760. @example
  3761. aevalsrc="sin(440*2*PI*t):s=8000"
  3762. @end example
  3763. @item
  3764. Generate a two channels signal, specify the channel layout (Front
  3765. Center + Back Center) explicitly:
  3766. @example
  3767. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3768. @end example
  3769. @item
  3770. Generate white noise:
  3771. @example
  3772. aevalsrc="-2+random(0)"
  3773. @end example
  3774. @item
  3775. Generate an amplitude modulated signal:
  3776. @example
  3777. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3778. @end example
  3779. @item
  3780. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3781. @example
  3782. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3783. @end example
  3784. @end itemize
  3785. @section anullsrc
  3786. The null audio source, return unprocessed audio frames. It is mainly useful
  3787. as a template and to be employed in analysis / debugging tools, or as
  3788. the source for filters which ignore the input data (for example the sox
  3789. synth filter).
  3790. This source accepts the following options:
  3791. @table @option
  3792. @item channel_layout, cl
  3793. Specifies the channel layout, and can be either an integer or a string
  3794. representing a channel layout. The default value of @var{channel_layout}
  3795. is "stereo".
  3796. Check the channel_layout_map definition in
  3797. @file{libavutil/channel_layout.c} for the mapping between strings and
  3798. channel layout values.
  3799. @item sample_rate, r
  3800. Specifies the sample rate, and defaults to 44100.
  3801. @item nb_samples, n
  3802. Set the number of samples per requested frames.
  3803. @end table
  3804. @subsection Examples
  3805. @itemize
  3806. @item
  3807. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3808. @example
  3809. anullsrc=r=48000:cl=4
  3810. @end example
  3811. @item
  3812. Do the same operation with a more obvious syntax:
  3813. @example
  3814. anullsrc=r=48000:cl=mono
  3815. @end example
  3816. @end itemize
  3817. All the parameters need to be explicitly defined.
  3818. @section flite
  3819. Synthesize a voice utterance using the libflite library.
  3820. To enable compilation of this filter you need to configure FFmpeg with
  3821. @code{--enable-libflite}.
  3822. Note that versions of the flite library prior to 2.0 are not thread-safe.
  3823. The filter accepts the following options:
  3824. @table @option
  3825. @item list_voices
  3826. If set to 1, list the names of the available voices and exit
  3827. immediately. Default value is 0.
  3828. @item nb_samples, n
  3829. Set the maximum number of samples per frame. Default value is 512.
  3830. @item textfile
  3831. Set the filename containing the text to speak.
  3832. @item text
  3833. Set the text to speak.
  3834. @item voice, v
  3835. Set the voice to use for the speech synthesis. Default value is
  3836. @code{kal}. See also the @var{list_voices} option.
  3837. @end table
  3838. @subsection Examples
  3839. @itemize
  3840. @item
  3841. Read from file @file{speech.txt}, and synthesize the text using the
  3842. standard flite voice:
  3843. @example
  3844. flite=textfile=speech.txt
  3845. @end example
  3846. @item
  3847. Read the specified text selecting the @code{slt} voice:
  3848. @example
  3849. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3850. @end example
  3851. @item
  3852. Input text to ffmpeg:
  3853. @example
  3854. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3855. @end example
  3856. @item
  3857. Make @file{ffplay} speak the specified text, using @code{flite} and
  3858. the @code{lavfi} device:
  3859. @example
  3860. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3861. @end example
  3862. @end itemize
  3863. For more information about libflite, check:
  3864. @url{http://www.festvox.org/flite/}
  3865. @section anoisesrc
  3866. Generate a noise audio signal.
  3867. The filter accepts the following options:
  3868. @table @option
  3869. @item sample_rate, r
  3870. Specify the sample rate. Default value is 48000 Hz.
  3871. @item amplitude, a
  3872. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3873. is 1.0.
  3874. @item duration, d
  3875. Specify the duration of the generated audio stream. Not specifying this option
  3876. results in noise with an infinite length.
  3877. @item color, colour, c
  3878. Specify the color of noise. Available noise colors are white, pink, brown,
  3879. blue and violet. Default color is white.
  3880. @item seed, s
  3881. Specify a value used to seed the PRNG.
  3882. @item nb_samples, n
  3883. Set the number of samples per each output frame, default is 1024.
  3884. @end table
  3885. @subsection Examples
  3886. @itemize
  3887. @item
  3888. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3889. @example
  3890. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3891. @end example
  3892. @end itemize
  3893. @section hilbert
  3894. Generate odd-tap Hilbert transform FIR coefficients.
  3895. The resulting stream can be used with @ref{afir} filter for phase-shifting
  3896. the signal by 90 degrees.
  3897. This is used in many matrix coding schemes and for analytic signal generation.
  3898. The process is often written as a multiplication by i (or j), the imaginary unit.
  3899. The filter accepts the following options:
  3900. @table @option
  3901. @item sample_rate, s
  3902. Set sample rate, default is 44100.
  3903. @item taps, t
  3904. Set length of FIR filter, default is 22051.
  3905. @item nb_samples, n
  3906. Set number of samples per each frame.
  3907. @item win_func, w
  3908. Set window function to be used when generating FIR coefficients.
  3909. @end table
  3910. @section sine
  3911. Generate an audio signal made of a sine wave with amplitude 1/8.
  3912. The audio signal is bit-exact.
  3913. The filter accepts the following options:
  3914. @table @option
  3915. @item frequency, f
  3916. Set the carrier frequency. Default is 440 Hz.
  3917. @item beep_factor, b
  3918. Enable a periodic beep every second with frequency @var{beep_factor} times
  3919. the carrier frequency. Default is 0, meaning the beep is disabled.
  3920. @item sample_rate, r
  3921. Specify the sample rate, default is 44100.
  3922. @item duration, d
  3923. Specify the duration of the generated audio stream.
  3924. @item samples_per_frame
  3925. Set the number of samples per output frame.
  3926. The expression can contain the following constants:
  3927. @table @option
  3928. @item n
  3929. The (sequential) number of the output audio frame, starting from 0.
  3930. @item pts
  3931. The PTS (Presentation TimeStamp) of the output audio frame,
  3932. expressed in @var{TB} units.
  3933. @item t
  3934. The PTS of the output audio frame, expressed in seconds.
  3935. @item TB
  3936. The timebase of the output audio frames.
  3937. @end table
  3938. Default is @code{1024}.
  3939. @end table
  3940. @subsection Examples
  3941. @itemize
  3942. @item
  3943. Generate a simple 440 Hz sine wave:
  3944. @example
  3945. sine
  3946. @end example
  3947. @item
  3948. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3949. @example
  3950. sine=220:4:d=5
  3951. sine=f=220:b=4:d=5
  3952. sine=frequency=220:beep_factor=4:duration=5
  3953. @end example
  3954. @item
  3955. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3956. pattern:
  3957. @example
  3958. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3959. @end example
  3960. @end itemize
  3961. @c man end AUDIO SOURCES
  3962. @chapter Audio Sinks
  3963. @c man begin AUDIO SINKS
  3964. Below is a description of the currently available audio sinks.
  3965. @section abuffersink
  3966. Buffer audio frames, and make them available to the end of filter chain.
  3967. This sink is mainly intended for programmatic use, in particular
  3968. through the interface defined in @file{libavfilter/buffersink.h}
  3969. or the options system.
  3970. It accepts a pointer to an AVABufferSinkContext structure, which
  3971. defines the incoming buffers' formats, to be passed as the opaque
  3972. parameter to @code{avfilter_init_filter} for initialization.
  3973. @section anullsink
  3974. Null audio sink; do absolutely nothing with the input audio. It is
  3975. mainly useful as a template and for use in analysis / debugging
  3976. tools.
  3977. @c man end AUDIO SINKS
  3978. @chapter Video Filters
  3979. @c man begin VIDEO FILTERS
  3980. When you configure your FFmpeg build, you can disable any of the
  3981. existing filters using @code{--disable-filters}.
  3982. The configure output will show the video filters included in your
  3983. build.
  3984. Below is a description of the currently available video filters.
  3985. @section alphaextract
  3986. Extract the alpha component from the input as a grayscale video. This
  3987. is especially useful with the @var{alphamerge} filter.
  3988. @section alphamerge
  3989. Add or replace the alpha component of the primary input with the
  3990. grayscale value of a second input. This is intended for use with
  3991. @var{alphaextract} to allow the transmission or storage of frame
  3992. sequences that have alpha in a format that doesn't support an alpha
  3993. channel.
  3994. For example, to reconstruct full frames from a normal YUV-encoded video
  3995. and a separate video created with @var{alphaextract}, you might use:
  3996. @example
  3997. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3998. @end example
  3999. Since this filter is designed for reconstruction, it operates on frame
  4000. sequences without considering timestamps, and terminates when either
  4001. input reaches end of stream. This will cause problems if your encoding
  4002. pipeline drops frames. If you're trying to apply an image as an
  4003. overlay to a video stream, consider the @var{overlay} filter instead.
  4004. @section ass
  4005. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4006. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4007. Substation Alpha) subtitles files.
  4008. This filter accepts the following option in addition to the common options from
  4009. the @ref{subtitles} filter:
  4010. @table @option
  4011. @item shaping
  4012. Set the shaping engine
  4013. Available values are:
  4014. @table @samp
  4015. @item auto
  4016. The default libass shaping engine, which is the best available.
  4017. @item simple
  4018. Fast, font-agnostic shaper that can do only substitutions
  4019. @item complex
  4020. Slower shaper using OpenType for substitutions and positioning
  4021. @end table
  4022. The default is @code{auto}.
  4023. @end table
  4024. @section atadenoise
  4025. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4026. The filter accepts the following options:
  4027. @table @option
  4028. @item 0a
  4029. Set threshold A for 1st plane. Default is 0.02.
  4030. Valid range is 0 to 0.3.
  4031. @item 0b
  4032. Set threshold B for 1st plane. Default is 0.04.
  4033. Valid range is 0 to 5.
  4034. @item 1a
  4035. Set threshold A for 2nd plane. Default is 0.02.
  4036. Valid range is 0 to 0.3.
  4037. @item 1b
  4038. Set threshold B for 2nd plane. Default is 0.04.
  4039. Valid range is 0 to 5.
  4040. @item 2a
  4041. Set threshold A for 3rd plane. Default is 0.02.
  4042. Valid range is 0 to 0.3.
  4043. @item 2b
  4044. Set threshold B for 3rd plane. Default is 0.04.
  4045. Valid range is 0 to 5.
  4046. Threshold A is designed to react on abrupt changes in the input signal and
  4047. threshold B is designed to react on continuous changes in the input signal.
  4048. @item s
  4049. Set number of frames filter will use for averaging. Default is 33. Must be odd
  4050. number in range [5, 129].
  4051. @item p
  4052. Set what planes of frame filter will use for averaging. Default is all.
  4053. @end table
  4054. @section avgblur
  4055. Apply average blur filter.
  4056. The filter accepts the following options:
  4057. @table @option
  4058. @item sizeX
  4059. Set horizontal kernel size.
  4060. @item planes
  4061. Set which planes to filter. By default all planes are filtered.
  4062. @item sizeY
  4063. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  4064. Default is @code{0}.
  4065. @end table
  4066. @section bbox
  4067. Compute the bounding box for the non-black pixels in the input frame
  4068. luminance plane.
  4069. This filter computes the bounding box containing all the pixels with a
  4070. luminance value greater than the minimum allowed value.
  4071. The parameters describing the bounding box are printed on the filter
  4072. log.
  4073. The filter accepts the following option:
  4074. @table @option
  4075. @item min_val
  4076. Set the minimal luminance value. Default is @code{16}.
  4077. @end table
  4078. @section bitplanenoise
  4079. Show and measure bit plane noise.
  4080. The filter accepts the following options:
  4081. @table @option
  4082. @item bitplane
  4083. Set which plane to analyze. Default is @code{1}.
  4084. @item filter
  4085. Filter out noisy pixels from @code{bitplane} set above.
  4086. Default is disabled.
  4087. @end table
  4088. @section blackdetect
  4089. Detect video intervals that are (almost) completely black. Can be
  4090. useful to detect chapter transitions, commercials, or invalid
  4091. recordings. Output lines contains the time for the start, end and
  4092. duration of the detected black interval expressed in seconds.
  4093. In order to display the output lines, you need to set the loglevel at
  4094. least to the AV_LOG_INFO value.
  4095. The filter accepts the following options:
  4096. @table @option
  4097. @item black_min_duration, d
  4098. Set the minimum detected black duration expressed in seconds. It must
  4099. be a non-negative floating point number.
  4100. Default value is 2.0.
  4101. @item picture_black_ratio_th, pic_th
  4102. Set the threshold for considering a picture "black".
  4103. Express the minimum value for the ratio:
  4104. @example
  4105. @var{nb_black_pixels} / @var{nb_pixels}
  4106. @end example
  4107. for which a picture is considered black.
  4108. Default value is 0.98.
  4109. @item pixel_black_th, pix_th
  4110. Set the threshold for considering a pixel "black".
  4111. The threshold expresses the maximum pixel luminance value for which a
  4112. pixel is considered "black". The provided value is scaled according to
  4113. the following equation:
  4114. @example
  4115. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4116. @end example
  4117. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4118. the input video format, the range is [0-255] for YUV full-range
  4119. formats and [16-235] for YUV non full-range formats.
  4120. Default value is 0.10.
  4121. @end table
  4122. The following example sets the maximum pixel threshold to the minimum
  4123. value, and detects only black intervals of 2 or more seconds:
  4124. @example
  4125. blackdetect=d=2:pix_th=0.00
  4126. @end example
  4127. @section blackframe
  4128. Detect frames that are (almost) completely black. Can be useful to
  4129. detect chapter transitions or commercials. Output lines consist of
  4130. the frame number of the detected frame, the percentage of blackness,
  4131. the position in the file if known or -1 and the timestamp in seconds.
  4132. In order to display the output lines, you need to set the loglevel at
  4133. least to the AV_LOG_INFO value.
  4134. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4135. The value represents the percentage of pixels in the picture that
  4136. are below the threshold value.
  4137. It accepts the following parameters:
  4138. @table @option
  4139. @item amount
  4140. The percentage of the pixels that have to be below the threshold; it defaults to
  4141. @code{98}.
  4142. @item threshold, thresh
  4143. The threshold below which a pixel value is considered black; it defaults to
  4144. @code{32}.
  4145. @end table
  4146. @section blend, tblend
  4147. Blend two video frames into each other.
  4148. The @code{blend} filter takes two input streams and outputs one
  4149. stream, the first input is the "top" layer and second input is
  4150. "bottom" layer. By default, the output terminates when the longest input terminates.
  4151. The @code{tblend} (time blend) filter takes two consecutive frames
  4152. from one single stream, and outputs the result obtained by blending
  4153. the new frame on top of the old frame.
  4154. A description of the accepted options follows.
  4155. @table @option
  4156. @item c0_mode
  4157. @item c1_mode
  4158. @item c2_mode
  4159. @item c3_mode
  4160. @item all_mode
  4161. Set blend mode for specific pixel component or all pixel components in case
  4162. of @var{all_mode}. Default value is @code{normal}.
  4163. Available values for component modes are:
  4164. @table @samp
  4165. @item addition
  4166. @item grainmerge
  4167. @item and
  4168. @item average
  4169. @item burn
  4170. @item darken
  4171. @item difference
  4172. @item grainextract
  4173. @item divide
  4174. @item dodge
  4175. @item freeze
  4176. @item exclusion
  4177. @item extremity
  4178. @item glow
  4179. @item hardlight
  4180. @item hardmix
  4181. @item heat
  4182. @item lighten
  4183. @item linearlight
  4184. @item multiply
  4185. @item multiply128
  4186. @item negation
  4187. @item normal
  4188. @item or
  4189. @item overlay
  4190. @item phoenix
  4191. @item pinlight
  4192. @item reflect
  4193. @item screen
  4194. @item softlight
  4195. @item subtract
  4196. @item vividlight
  4197. @item xor
  4198. @end table
  4199. @item c0_opacity
  4200. @item c1_opacity
  4201. @item c2_opacity
  4202. @item c3_opacity
  4203. @item all_opacity
  4204. Set blend opacity for specific pixel component or all pixel components in case
  4205. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4206. @item c0_expr
  4207. @item c1_expr
  4208. @item c2_expr
  4209. @item c3_expr
  4210. @item all_expr
  4211. Set blend expression for specific pixel component or all pixel components in case
  4212. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4213. The expressions can use the following variables:
  4214. @table @option
  4215. @item N
  4216. The sequential number of the filtered frame, starting from @code{0}.
  4217. @item X
  4218. @item Y
  4219. the coordinates of the current sample
  4220. @item W
  4221. @item H
  4222. the width and height of currently filtered plane
  4223. @item SW
  4224. @item SH
  4225. Width and height scale depending on the currently filtered plane. It is the
  4226. ratio between the corresponding luma plane number of pixels and the current
  4227. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  4228. @code{0.5,0.5} for chroma planes.
  4229. @item T
  4230. Time of the current frame, expressed in seconds.
  4231. @item TOP, A
  4232. Value of pixel component at current location for first video frame (top layer).
  4233. @item BOTTOM, B
  4234. Value of pixel component at current location for second video frame (bottom layer).
  4235. @end table
  4236. @end table
  4237. The @code{blend} filter also supports the @ref{framesync} options.
  4238. @subsection Examples
  4239. @itemize
  4240. @item
  4241. Apply transition from bottom layer to top layer in first 10 seconds:
  4242. @example
  4243. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4244. @end example
  4245. @item
  4246. Apply linear horizontal transition from top layer to bottom layer:
  4247. @example
  4248. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4249. @end example
  4250. @item
  4251. Apply 1x1 checkerboard effect:
  4252. @example
  4253. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4254. @end example
  4255. @item
  4256. Apply uncover left effect:
  4257. @example
  4258. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4259. @end example
  4260. @item
  4261. Apply uncover down effect:
  4262. @example
  4263. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4264. @end example
  4265. @item
  4266. Apply uncover up-left effect:
  4267. @example
  4268. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4269. @end example
  4270. @item
  4271. Split diagonally video and shows top and bottom layer on each side:
  4272. @example
  4273. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4274. @end example
  4275. @item
  4276. Display differences between the current and the previous frame:
  4277. @example
  4278. tblend=all_mode=grainextract
  4279. @end example
  4280. @end itemize
  4281. @section boxblur
  4282. Apply a boxblur algorithm to the input video.
  4283. It accepts the following parameters:
  4284. @table @option
  4285. @item luma_radius, lr
  4286. @item luma_power, lp
  4287. @item chroma_radius, cr
  4288. @item chroma_power, cp
  4289. @item alpha_radius, ar
  4290. @item alpha_power, ap
  4291. @end table
  4292. A description of the accepted options follows.
  4293. @table @option
  4294. @item luma_radius, lr
  4295. @item chroma_radius, cr
  4296. @item alpha_radius, ar
  4297. Set an expression for the box radius in pixels used for blurring the
  4298. corresponding input plane.
  4299. The radius value must be a non-negative number, and must not be
  4300. greater than the value of the expression @code{min(w,h)/2} for the
  4301. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4302. planes.
  4303. Default value for @option{luma_radius} is "2". If not specified,
  4304. @option{chroma_radius} and @option{alpha_radius} default to the
  4305. corresponding value set for @option{luma_radius}.
  4306. The expressions can contain the following constants:
  4307. @table @option
  4308. @item w
  4309. @item h
  4310. The input width and height in pixels.
  4311. @item cw
  4312. @item ch
  4313. The input chroma image width and height in pixels.
  4314. @item hsub
  4315. @item vsub
  4316. The horizontal and vertical chroma subsample values. For example, for the
  4317. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4318. @end table
  4319. @item luma_power, lp
  4320. @item chroma_power, cp
  4321. @item alpha_power, ap
  4322. Specify how many times the boxblur filter is applied to the
  4323. corresponding plane.
  4324. Default value for @option{luma_power} is 2. If not specified,
  4325. @option{chroma_power} and @option{alpha_power} default to the
  4326. corresponding value set for @option{luma_power}.
  4327. A value of 0 will disable the effect.
  4328. @end table
  4329. @subsection Examples
  4330. @itemize
  4331. @item
  4332. Apply a boxblur filter with the luma, chroma, and alpha radii
  4333. set to 2:
  4334. @example
  4335. boxblur=luma_radius=2:luma_power=1
  4336. boxblur=2:1
  4337. @end example
  4338. @item
  4339. Set the luma radius to 2, and alpha and chroma radius to 0:
  4340. @example
  4341. boxblur=2:1:cr=0:ar=0
  4342. @end example
  4343. @item
  4344. Set the luma and chroma radii to a fraction of the video dimension:
  4345. @example
  4346. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4347. @end example
  4348. @end itemize
  4349. @section bwdif
  4350. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4351. Deinterlacing Filter").
  4352. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4353. interpolation algorithms.
  4354. It accepts the following parameters:
  4355. @table @option
  4356. @item mode
  4357. The interlacing mode to adopt. It accepts one of the following values:
  4358. @table @option
  4359. @item 0, send_frame
  4360. Output one frame for each frame.
  4361. @item 1, send_field
  4362. Output one frame for each field.
  4363. @end table
  4364. The default value is @code{send_field}.
  4365. @item parity
  4366. The picture field parity assumed for the input interlaced video. It accepts one
  4367. of the following values:
  4368. @table @option
  4369. @item 0, tff
  4370. Assume the top field is first.
  4371. @item 1, bff
  4372. Assume the bottom field is first.
  4373. @item -1, auto
  4374. Enable automatic detection of field parity.
  4375. @end table
  4376. The default value is @code{auto}.
  4377. If the interlacing is unknown or the decoder does not export this information,
  4378. top field first will be assumed.
  4379. @item deint
  4380. Specify which frames to deinterlace. Accept one of the following
  4381. values:
  4382. @table @option
  4383. @item 0, all
  4384. Deinterlace all frames.
  4385. @item 1, interlaced
  4386. Only deinterlace frames marked as interlaced.
  4387. @end table
  4388. The default value is @code{all}.
  4389. @end table
  4390. @section chromakey
  4391. YUV colorspace color/chroma keying.
  4392. The filter accepts the following options:
  4393. @table @option
  4394. @item color
  4395. The color which will be replaced with transparency.
  4396. @item similarity
  4397. Similarity percentage with the key color.
  4398. 0.01 matches only the exact key color, while 1.0 matches everything.
  4399. @item blend
  4400. Blend percentage.
  4401. 0.0 makes pixels either fully transparent, or not transparent at all.
  4402. Higher values result in semi-transparent pixels, with a higher transparency
  4403. the more similar the pixels color is to the key color.
  4404. @item yuv
  4405. Signals that the color passed is already in YUV instead of RGB.
  4406. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4407. This can be used to pass exact YUV values as hexadecimal numbers.
  4408. @end table
  4409. @subsection Examples
  4410. @itemize
  4411. @item
  4412. Make every green pixel in the input image transparent:
  4413. @example
  4414. ffmpeg -i input.png -vf chromakey=green out.png
  4415. @end example
  4416. @item
  4417. Overlay a greenscreen-video on top of a static black background.
  4418. @example
  4419. 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
  4420. @end example
  4421. @end itemize
  4422. @section ciescope
  4423. Display CIE color diagram with pixels overlaid onto it.
  4424. The filter accepts the following options:
  4425. @table @option
  4426. @item system
  4427. Set color system.
  4428. @table @samp
  4429. @item ntsc, 470m
  4430. @item ebu, 470bg
  4431. @item smpte
  4432. @item 240m
  4433. @item apple
  4434. @item widergb
  4435. @item cie1931
  4436. @item rec709, hdtv
  4437. @item uhdtv, rec2020
  4438. @end table
  4439. @item cie
  4440. Set CIE system.
  4441. @table @samp
  4442. @item xyy
  4443. @item ucs
  4444. @item luv
  4445. @end table
  4446. @item gamuts
  4447. Set what gamuts to draw.
  4448. See @code{system} option for available values.
  4449. @item size, s
  4450. Set ciescope size, by default set to 512.
  4451. @item intensity, i
  4452. Set intensity used to map input pixel values to CIE diagram.
  4453. @item contrast
  4454. Set contrast used to draw tongue colors that are out of active color system gamut.
  4455. @item corrgamma
  4456. Correct gamma displayed on scope, by default enabled.
  4457. @item showwhite
  4458. Show white point on CIE diagram, by default disabled.
  4459. @item gamma
  4460. Set input gamma. Used only with XYZ input color space.
  4461. @end table
  4462. @section codecview
  4463. Visualize information exported by some codecs.
  4464. Some codecs can export information through frames using side-data or other
  4465. means. For example, some MPEG based codecs export motion vectors through the
  4466. @var{export_mvs} flag in the codec @option{flags2} option.
  4467. The filter accepts the following option:
  4468. @table @option
  4469. @item mv
  4470. Set motion vectors to visualize.
  4471. Available flags for @var{mv} are:
  4472. @table @samp
  4473. @item pf
  4474. forward predicted MVs of P-frames
  4475. @item bf
  4476. forward predicted MVs of B-frames
  4477. @item bb
  4478. backward predicted MVs of B-frames
  4479. @end table
  4480. @item qp
  4481. Display quantization parameters using the chroma planes.
  4482. @item mv_type, mvt
  4483. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4484. Available flags for @var{mv_type} are:
  4485. @table @samp
  4486. @item fp
  4487. forward predicted MVs
  4488. @item bp
  4489. backward predicted MVs
  4490. @end table
  4491. @item frame_type, ft
  4492. Set frame type to visualize motion vectors of.
  4493. Available flags for @var{frame_type} are:
  4494. @table @samp
  4495. @item if
  4496. intra-coded frames (I-frames)
  4497. @item pf
  4498. predicted frames (P-frames)
  4499. @item bf
  4500. bi-directionally predicted frames (B-frames)
  4501. @end table
  4502. @end table
  4503. @subsection Examples
  4504. @itemize
  4505. @item
  4506. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4507. @example
  4508. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4509. @end example
  4510. @item
  4511. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4512. @example
  4513. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4514. @end example
  4515. @end itemize
  4516. @section colorbalance
  4517. Modify intensity of primary colors (red, green and blue) of input frames.
  4518. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4519. regions for the red-cyan, green-magenta or blue-yellow balance.
  4520. A positive adjustment value shifts the balance towards the primary color, a negative
  4521. value towards the complementary color.
  4522. The filter accepts the following options:
  4523. @table @option
  4524. @item rs
  4525. @item gs
  4526. @item bs
  4527. Adjust red, green and blue shadows (darkest pixels).
  4528. @item rm
  4529. @item gm
  4530. @item bm
  4531. Adjust red, green and blue midtones (medium pixels).
  4532. @item rh
  4533. @item gh
  4534. @item bh
  4535. Adjust red, green and blue highlights (brightest pixels).
  4536. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4537. @end table
  4538. @subsection Examples
  4539. @itemize
  4540. @item
  4541. Add red color cast to shadows:
  4542. @example
  4543. colorbalance=rs=.3
  4544. @end example
  4545. @end itemize
  4546. @section colorkey
  4547. RGB colorspace color keying.
  4548. The filter accepts the following options:
  4549. @table @option
  4550. @item color
  4551. The color which will be replaced with transparency.
  4552. @item similarity
  4553. Similarity percentage with the key color.
  4554. 0.01 matches only the exact key color, while 1.0 matches everything.
  4555. @item blend
  4556. Blend percentage.
  4557. 0.0 makes pixels either fully transparent, or not transparent at all.
  4558. Higher values result in semi-transparent pixels, with a higher transparency
  4559. the more similar the pixels color is to the key color.
  4560. @end table
  4561. @subsection Examples
  4562. @itemize
  4563. @item
  4564. Make every green pixel in the input image transparent:
  4565. @example
  4566. ffmpeg -i input.png -vf colorkey=green out.png
  4567. @end example
  4568. @item
  4569. Overlay a greenscreen-video on top of a static background image.
  4570. @example
  4571. 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
  4572. @end example
  4573. @end itemize
  4574. @section colorlevels
  4575. Adjust video input frames using levels.
  4576. The filter accepts the following options:
  4577. @table @option
  4578. @item rimin
  4579. @item gimin
  4580. @item bimin
  4581. @item aimin
  4582. Adjust red, green, blue and alpha input black point.
  4583. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4584. @item rimax
  4585. @item gimax
  4586. @item bimax
  4587. @item aimax
  4588. Adjust red, green, blue and alpha input white point.
  4589. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  4590. Input levels are used to lighten highlights (bright tones), darken shadows
  4591. (dark tones), change the balance of bright and dark tones.
  4592. @item romin
  4593. @item gomin
  4594. @item bomin
  4595. @item aomin
  4596. Adjust red, green, blue and alpha output black point.
  4597. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  4598. @item romax
  4599. @item gomax
  4600. @item bomax
  4601. @item aomax
  4602. Adjust red, green, blue and alpha output white point.
  4603. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  4604. Output levels allows manual selection of a constrained output level range.
  4605. @end table
  4606. @subsection Examples
  4607. @itemize
  4608. @item
  4609. Make video output darker:
  4610. @example
  4611. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4612. @end example
  4613. @item
  4614. Increase contrast:
  4615. @example
  4616. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4617. @end example
  4618. @item
  4619. Make video output lighter:
  4620. @example
  4621. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4622. @end example
  4623. @item
  4624. Increase brightness:
  4625. @example
  4626. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4627. @end example
  4628. @end itemize
  4629. @section colorchannelmixer
  4630. Adjust video input frames by re-mixing color channels.
  4631. This filter modifies a color channel by adding the values associated to
  4632. the other channels of the same pixels. For example if the value to
  4633. modify is red, the output value will be:
  4634. @example
  4635. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4636. @end example
  4637. The filter accepts the following options:
  4638. @table @option
  4639. @item rr
  4640. @item rg
  4641. @item rb
  4642. @item ra
  4643. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4644. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4645. @item gr
  4646. @item gg
  4647. @item gb
  4648. @item ga
  4649. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4650. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4651. @item br
  4652. @item bg
  4653. @item bb
  4654. @item ba
  4655. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4656. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4657. @item ar
  4658. @item ag
  4659. @item ab
  4660. @item aa
  4661. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4662. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4663. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4664. @end table
  4665. @subsection Examples
  4666. @itemize
  4667. @item
  4668. Convert source to grayscale:
  4669. @example
  4670. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4671. @end example
  4672. @item
  4673. Simulate sepia tones:
  4674. @example
  4675. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4676. @end example
  4677. @end itemize
  4678. @section colormatrix
  4679. Convert color matrix.
  4680. The filter accepts the following options:
  4681. @table @option
  4682. @item src
  4683. @item dst
  4684. Specify the source and destination color matrix. Both values must be
  4685. specified.
  4686. The accepted values are:
  4687. @table @samp
  4688. @item bt709
  4689. BT.709
  4690. @item fcc
  4691. FCC
  4692. @item bt601
  4693. BT.601
  4694. @item bt470
  4695. BT.470
  4696. @item bt470bg
  4697. BT.470BG
  4698. @item smpte170m
  4699. SMPTE-170M
  4700. @item smpte240m
  4701. SMPTE-240M
  4702. @item bt2020
  4703. BT.2020
  4704. @end table
  4705. @end table
  4706. For example to convert from BT.601 to SMPTE-240M, use the command:
  4707. @example
  4708. colormatrix=bt601:smpte240m
  4709. @end example
  4710. @section colorspace
  4711. Convert colorspace, transfer characteristics or color primaries.
  4712. Input video needs to have an even size.
  4713. The filter accepts the following options:
  4714. @table @option
  4715. @anchor{all}
  4716. @item all
  4717. Specify all color properties at once.
  4718. The accepted values are:
  4719. @table @samp
  4720. @item bt470m
  4721. BT.470M
  4722. @item bt470bg
  4723. BT.470BG
  4724. @item bt601-6-525
  4725. BT.601-6 525
  4726. @item bt601-6-625
  4727. BT.601-6 625
  4728. @item bt709
  4729. BT.709
  4730. @item smpte170m
  4731. SMPTE-170M
  4732. @item smpte240m
  4733. SMPTE-240M
  4734. @item bt2020
  4735. BT.2020
  4736. @end table
  4737. @anchor{space}
  4738. @item space
  4739. Specify output colorspace.
  4740. The accepted values are:
  4741. @table @samp
  4742. @item bt709
  4743. BT.709
  4744. @item fcc
  4745. FCC
  4746. @item bt470bg
  4747. BT.470BG or BT.601-6 625
  4748. @item smpte170m
  4749. SMPTE-170M or BT.601-6 525
  4750. @item smpte240m
  4751. SMPTE-240M
  4752. @item ycgco
  4753. YCgCo
  4754. @item bt2020ncl
  4755. BT.2020 with non-constant luminance
  4756. @end table
  4757. @anchor{trc}
  4758. @item trc
  4759. Specify output transfer characteristics.
  4760. The accepted values are:
  4761. @table @samp
  4762. @item bt709
  4763. BT.709
  4764. @item bt470m
  4765. BT.470M
  4766. @item bt470bg
  4767. BT.470BG
  4768. @item gamma22
  4769. Constant gamma of 2.2
  4770. @item gamma28
  4771. Constant gamma of 2.8
  4772. @item smpte170m
  4773. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4774. @item smpte240m
  4775. SMPTE-240M
  4776. @item srgb
  4777. SRGB
  4778. @item iec61966-2-1
  4779. iec61966-2-1
  4780. @item iec61966-2-4
  4781. iec61966-2-4
  4782. @item xvycc
  4783. xvycc
  4784. @item bt2020-10
  4785. BT.2020 for 10-bits content
  4786. @item bt2020-12
  4787. BT.2020 for 12-bits content
  4788. @end table
  4789. @anchor{primaries}
  4790. @item primaries
  4791. Specify output color primaries.
  4792. The accepted values are:
  4793. @table @samp
  4794. @item bt709
  4795. BT.709
  4796. @item bt470m
  4797. BT.470M
  4798. @item bt470bg
  4799. BT.470BG or BT.601-6 625
  4800. @item smpte170m
  4801. SMPTE-170M or BT.601-6 525
  4802. @item smpte240m
  4803. SMPTE-240M
  4804. @item film
  4805. film
  4806. @item smpte431
  4807. SMPTE-431
  4808. @item smpte432
  4809. SMPTE-432
  4810. @item bt2020
  4811. BT.2020
  4812. @item jedec-p22
  4813. JEDEC P22 phosphors
  4814. @end table
  4815. @anchor{range}
  4816. @item range
  4817. Specify output color range.
  4818. The accepted values are:
  4819. @table @samp
  4820. @item tv
  4821. TV (restricted) range
  4822. @item mpeg
  4823. MPEG (restricted) range
  4824. @item pc
  4825. PC (full) range
  4826. @item jpeg
  4827. JPEG (full) range
  4828. @end table
  4829. @item format
  4830. Specify output color format.
  4831. The accepted values are:
  4832. @table @samp
  4833. @item yuv420p
  4834. YUV 4:2:0 planar 8-bits
  4835. @item yuv420p10
  4836. YUV 4:2:0 planar 10-bits
  4837. @item yuv420p12
  4838. YUV 4:2:0 planar 12-bits
  4839. @item yuv422p
  4840. YUV 4:2:2 planar 8-bits
  4841. @item yuv422p10
  4842. YUV 4:2:2 planar 10-bits
  4843. @item yuv422p12
  4844. YUV 4:2:2 planar 12-bits
  4845. @item yuv444p
  4846. YUV 4:4:4 planar 8-bits
  4847. @item yuv444p10
  4848. YUV 4:4:4 planar 10-bits
  4849. @item yuv444p12
  4850. YUV 4:4:4 planar 12-bits
  4851. @end table
  4852. @item fast
  4853. Do a fast conversion, which skips gamma/primary correction. This will take
  4854. significantly less CPU, but will be mathematically incorrect. To get output
  4855. compatible with that produced by the colormatrix filter, use fast=1.
  4856. @item dither
  4857. Specify dithering mode.
  4858. The accepted values are:
  4859. @table @samp
  4860. @item none
  4861. No dithering
  4862. @item fsb
  4863. Floyd-Steinberg dithering
  4864. @end table
  4865. @item wpadapt
  4866. Whitepoint adaptation mode.
  4867. The accepted values are:
  4868. @table @samp
  4869. @item bradford
  4870. Bradford whitepoint adaptation
  4871. @item vonkries
  4872. von Kries whitepoint adaptation
  4873. @item identity
  4874. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4875. @end table
  4876. @item iall
  4877. Override all input properties at once. Same accepted values as @ref{all}.
  4878. @item ispace
  4879. Override input colorspace. Same accepted values as @ref{space}.
  4880. @item iprimaries
  4881. Override input color primaries. Same accepted values as @ref{primaries}.
  4882. @item itrc
  4883. Override input transfer characteristics. Same accepted values as @ref{trc}.
  4884. @item irange
  4885. Override input color range. Same accepted values as @ref{range}.
  4886. @end table
  4887. The filter converts the transfer characteristics, color space and color
  4888. primaries to the specified user values. The output value, if not specified,
  4889. is set to a default value based on the "all" property. If that property is
  4890. also not specified, the filter will log an error. The output color range and
  4891. format default to the same value as the input color range and format. The
  4892. input transfer characteristics, color space, color primaries and color range
  4893. should be set on the input data. If any of these are missing, the filter will
  4894. log an error and no conversion will take place.
  4895. For example to convert the input to SMPTE-240M, use the command:
  4896. @example
  4897. colorspace=smpte240m
  4898. @end example
  4899. @section convolution
  4900. Apply convolution 3x3, 5x5 or 7x7 filter.
  4901. The filter accepts the following options:
  4902. @table @option
  4903. @item 0m
  4904. @item 1m
  4905. @item 2m
  4906. @item 3m
  4907. Set matrix for each plane.
  4908. Matrix is sequence of 9, 25 or 49 signed integers.
  4909. @item 0rdiv
  4910. @item 1rdiv
  4911. @item 2rdiv
  4912. @item 3rdiv
  4913. Set multiplier for calculated value for each plane.
  4914. @item 0bias
  4915. @item 1bias
  4916. @item 2bias
  4917. @item 3bias
  4918. Set bias for each plane. This value is added to the result of the multiplication.
  4919. Useful for making the overall image brighter or darker. Default is 0.0.
  4920. @end table
  4921. @subsection Examples
  4922. @itemize
  4923. @item
  4924. Apply sharpen:
  4925. @example
  4926. 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"
  4927. @end example
  4928. @item
  4929. Apply blur:
  4930. @example
  4931. 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"
  4932. @end example
  4933. @item
  4934. Apply edge enhance:
  4935. @example
  4936. 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"
  4937. @end example
  4938. @item
  4939. Apply edge detect:
  4940. @example
  4941. 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"
  4942. @end example
  4943. @item
  4944. Apply laplacian edge detector which includes diagonals:
  4945. @example
  4946. 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"
  4947. @end example
  4948. @item
  4949. Apply emboss:
  4950. @example
  4951. 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"
  4952. @end example
  4953. @end itemize
  4954. @section convolve
  4955. Apply 2D convolution of video stream in frequency domain using second stream
  4956. as impulse.
  4957. The filter accepts the following options:
  4958. @table @option
  4959. @item planes
  4960. Set which planes to process.
  4961. @item impulse
  4962. Set which impulse video frames will be processed, can be @var{first}
  4963. or @var{all}. Default is @var{all}.
  4964. @end table
  4965. The @code{convolve} filter also supports the @ref{framesync} options.
  4966. @section copy
  4967. Copy the input video source unchanged to the output. This is mainly useful for
  4968. testing purposes.
  4969. @anchor{coreimage}
  4970. @section coreimage
  4971. Video filtering on GPU using Apple's CoreImage API on OSX.
  4972. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4973. processed by video hardware. However, software-based OpenGL implementations
  4974. exist which means there is no guarantee for hardware processing. It depends on
  4975. the respective OSX.
  4976. There are many filters and image generators provided by Apple that come with a
  4977. large variety of options. The filter has to be referenced by its name along
  4978. with its options.
  4979. The coreimage filter accepts the following options:
  4980. @table @option
  4981. @item list_filters
  4982. List all available filters and generators along with all their respective
  4983. options as well as possible minimum and maximum values along with the default
  4984. values.
  4985. @example
  4986. list_filters=true
  4987. @end example
  4988. @item filter
  4989. Specify all filters by their respective name and options.
  4990. Use @var{list_filters} to determine all valid filter names and options.
  4991. Numerical options are specified by a float value and are automatically clamped
  4992. to their respective value range. Vector and color options have to be specified
  4993. by a list of space separated float values. Character escaping has to be done.
  4994. A special option name @code{default} is available to use default options for a
  4995. filter.
  4996. It is required to specify either @code{default} or at least one of the filter options.
  4997. All omitted options are used with their default values.
  4998. The syntax of the filter string is as follows:
  4999. @example
  5000. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5001. @end example
  5002. @item output_rect
  5003. Specify a rectangle where the output of the filter chain is copied into the
  5004. input image. It is given by a list of space separated float values:
  5005. @example
  5006. output_rect=x\ y\ width\ height
  5007. @end example
  5008. If not given, the output rectangle equals the dimensions of the input image.
  5009. The output rectangle is automatically cropped at the borders of the input
  5010. image. Negative values are valid for each component.
  5011. @example
  5012. output_rect=25\ 25\ 100\ 100
  5013. @end example
  5014. @end table
  5015. Several filters can be chained for successive processing without GPU-HOST
  5016. transfers allowing for fast processing of complex filter chains.
  5017. Currently, only filters with zero (generators) or exactly one (filters) input
  5018. image and one output image are supported. Also, transition filters are not yet
  5019. usable as intended.
  5020. Some filters generate output images with additional padding depending on the
  5021. respective filter kernel. The padding is automatically removed to ensure the
  5022. filter output has the same size as the input image.
  5023. For image generators, the size of the output image is determined by the
  5024. previous output image of the filter chain or the input image of the whole
  5025. filterchain, respectively. The generators do not use the pixel information of
  5026. this image to generate their output. However, the generated output is
  5027. blended onto this image, resulting in partial or complete coverage of the
  5028. output image.
  5029. The @ref{coreimagesrc} video source can be used for generating input images
  5030. which are directly fed into the filter chain. By using it, providing input
  5031. images by another video source or an input video is not required.
  5032. @subsection Examples
  5033. @itemize
  5034. @item
  5035. List all filters available:
  5036. @example
  5037. coreimage=list_filters=true
  5038. @end example
  5039. @item
  5040. Use the CIBoxBlur filter with default options to blur an image:
  5041. @example
  5042. coreimage=filter=CIBoxBlur@@default
  5043. @end example
  5044. @item
  5045. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5046. its center at 100x100 and a radius of 50 pixels:
  5047. @example
  5048. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5049. @end example
  5050. @item
  5051. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5052. given as complete and escaped command-line for Apple's standard bash shell:
  5053. @example
  5054. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5055. @end example
  5056. @end itemize
  5057. @section crop
  5058. Crop the input video to given dimensions.
  5059. It accepts the following parameters:
  5060. @table @option
  5061. @item w, out_w
  5062. The width of the output video. It defaults to @code{iw}.
  5063. This expression is evaluated only once during the filter
  5064. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5065. @item h, out_h
  5066. The height of the output video. It defaults to @code{ih}.
  5067. This expression is evaluated only once during the filter
  5068. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5069. @item x
  5070. The horizontal position, in the input video, of the left edge of the output
  5071. video. It defaults to @code{(in_w-out_w)/2}.
  5072. This expression is evaluated per-frame.
  5073. @item y
  5074. The vertical position, in the input video, of the top edge of the output video.
  5075. It defaults to @code{(in_h-out_h)/2}.
  5076. This expression is evaluated per-frame.
  5077. @item keep_aspect
  5078. If set to 1 will force the output display aspect ratio
  5079. to be the same of the input, by changing the output sample aspect
  5080. ratio. It defaults to 0.
  5081. @item exact
  5082. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5083. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5084. It defaults to 0.
  5085. @end table
  5086. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5087. expressions containing the following constants:
  5088. @table @option
  5089. @item x
  5090. @item y
  5091. The computed values for @var{x} and @var{y}. They are evaluated for
  5092. each new frame.
  5093. @item in_w
  5094. @item in_h
  5095. The input width and height.
  5096. @item iw
  5097. @item ih
  5098. These are the same as @var{in_w} and @var{in_h}.
  5099. @item out_w
  5100. @item out_h
  5101. The output (cropped) width and height.
  5102. @item ow
  5103. @item oh
  5104. These are the same as @var{out_w} and @var{out_h}.
  5105. @item a
  5106. same as @var{iw} / @var{ih}
  5107. @item sar
  5108. input sample aspect ratio
  5109. @item dar
  5110. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5111. @item hsub
  5112. @item vsub
  5113. horizontal and vertical chroma subsample values. For example for the
  5114. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5115. @item n
  5116. The number of the input frame, starting from 0.
  5117. @item pos
  5118. the position in the file of the input frame, NAN if unknown
  5119. @item t
  5120. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5121. @end table
  5122. The expression for @var{out_w} may depend on the value of @var{out_h},
  5123. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5124. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5125. evaluated after @var{out_w} and @var{out_h}.
  5126. The @var{x} and @var{y} parameters specify the expressions for the
  5127. position of the top-left corner of the output (non-cropped) area. They
  5128. are evaluated for each frame. If the evaluated value is not valid, it
  5129. is approximated to the nearest valid value.
  5130. The expression for @var{x} may depend on @var{y}, and the expression
  5131. for @var{y} may depend on @var{x}.
  5132. @subsection Examples
  5133. @itemize
  5134. @item
  5135. Crop area with size 100x100 at position (12,34).
  5136. @example
  5137. crop=100:100:12:34
  5138. @end example
  5139. Using named options, the example above becomes:
  5140. @example
  5141. crop=w=100:h=100:x=12:y=34
  5142. @end example
  5143. @item
  5144. Crop the central input area with size 100x100:
  5145. @example
  5146. crop=100:100
  5147. @end example
  5148. @item
  5149. Crop the central input area with size 2/3 of the input video:
  5150. @example
  5151. crop=2/3*in_w:2/3*in_h
  5152. @end example
  5153. @item
  5154. Crop the input video central square:
  5155. @example
  5156. crop=out_w=in_h
  5157. crop=in_h
  5158. @end example
  5159. @item
  5160. Delimit the rectangle with the top-left corner placed at position
  5161. 100:100 and the right-bottom corner corresponding to the right-bottom
  5162. corner of the input image.
  5163. @example
  5164. crop=in_w-100:in_h-100:100:100
  5165. @end example
  5166. @item
  5167. Crop 10 pixels from the left and right borders, and 20 pixels from
  5168. the top and bottom borders
  5169. @example
  5170. crop=in_w-2*10:in_h-2*20
  5171. @end example
  5172. @item
  5173. Keep only the bottom right quarter of the input image:
  5174. @example
  5175. crop=in_w/2:in_h/2:in_w/2:in_h/2
  5176. @end example
  5177. @item
  5178. Crop height for getting Greek harmony:
  5179. @example
  5180. crop=in_w:1/PHI*in_w
  5181. @end example
  5182. @item
  5183. Apply trembling effect:
  5184. @example
  5185. 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)
  5186. @end example
  5187. @item
  5188. Apply erratic camera effect depending on timestamp:
  5189. @example
  5190. 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)"
  5191. @end example
  5192. @item
  5193. Set x depending on the value of y:
  5194. @example
  5195. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  5196. @end example
  5197. @end itemize
  5198. @subsection Commands
  5199. This filter supports the following commands:
  5200. @table @option
  5201. @item w, out_w
  5202. @item h, out_h
  5203. @item x
  5204. @item y
  5205. Set width/height of the output video and the horizontal/vertical position
  5206. in the input video.
  5207. The command accepts the same syntax of the corresponding option.
  5208. If the specified expression is not valid, it is kept at its current
  5209. value.
  5210. @end table
  5211. @section cropdetect
  5212. Auto-detect the crop size.
  5213. It calculates the necessary cropping parameters and prints the
  5214. recommended parameters via the logging system. The detected dimensions
  5215. correspond to the non-black area of the input video.
  5216. It accepts the following parameters:
  5217. @table @option
  5218. @item limit
  5219. Set higher black value threshold, which can be optionally specified
  5220. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  5221. value greater to the set value is considered non-black. It defaults to 24.
  5222. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  5223. on the bitdepth of the pixel format.
  5224. @item round
  5225. The value which the width/height should be divisible by. It defaults to
  5226. 16. The offset is automatically adjusted to center the video. Use 2 to
  5227. get only even dimensions (needed for 4:2:2 video). 16 is best when
  5228. encoding to most video codecs.
  5229. @item reset_count, reset
  5230. Set the counter that determines after how many frames cropdetect will
  5231. reset the previously detected largest video area and start over to
  5232. detect the current optimal crop area. Default value is 0.
  5233. This can be useful when channel logos distort the video area. 0
  5234. indicates 'never reset', and returns the largest area encountered during
  5235. playback.
  5236. @end table
  5237. @anchor{curves}
  5238. @section curves
  5239. Apply color adjustments using curves.
  5240. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  5241. component (red, green and blue) has its values defined by @var{N} key points
  5242. tied from each other using a smooth curve. The x-axis represents the pixel
  5243. values from the input frame, and the y-axis the new pixel values to be set for
  5244. the output frame.
  5245. By default, a component curve is defined by the two points @var{(0;0)} and
  5246. @var{(1;1)}. This creates a straight line where each original pixel value is
  5247. "adjusted" to its own value, which means no change to the image.
  5248. The filter allows you to redefine these two points and add some more. A new
  5249. curve (using a natural cubic spline interpolation) will be define to pass
  5250. smoothly through all these new coordinates. The new defined points needs to be
  5251. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  5252. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  5253. the vector spaces, the values will be clipped accordingly.
  5254. The filter accepts the following options:
  5255. @table @option
  5256. @item preset
  5257. Select one of the available color presets. This option can be used in addition
  5258. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  5259. options takes priority on the preset values.
  5260. Available presets are:
  5261. @table @samp
  5262. @item none
  5263. @item color_negative
  5264. @item cross_process
  5265. @item darker
  5266. @item increase_contrast
  5267. @item lighter
  5268. @item linear_contrast
  5269. @item medium_contrast
  5270. @item negative
  5271. @item strong_contrast
  5272. @item vintage
  5273. @end table
  5274. Default is @code{none}.
  5275. @item master, m
  5276. Set the master key points. These points will define a second pass mapping. It
  5277. is sometimes called a "luminance" or "value" mapping. It can be used with
  5278. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  5279. post-processing LUT.
  5280. @item red, r
  5281. Set the key points for the red component.
  5282. @item green, g
  5283. Set the key points for the green component.
  5284. @item blue, b
  5285. Set the key points for the blue component.
  5286. @item all
  5287. Set the key points for all components (not including master).
  5288. Can be used in addition to the other key points component
  5289. options. In this case, the unset component(s) will fallback on this
  5290. @option{all} setting.
  5291. @item psfile
  5292. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  5293. @item plot
  5294. Save Gnuplot script of the curves in specified file.
  5295. @end table
  5296. To avoid some filtergraph syntax conflicts, each key points list need to be
  5297. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  5298. @subsection Examples
  5299. @itemize
  5300. @item
  5301. Increase slightly the middle level of blue:
  5302. @example
  5303. curves=blue='0/0 0.5/0.58 1/1'
  5304. @end example
  5305. @item
  5306. Vintage effect:
  5307. @example
  5308. 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'
  5309. @end example
  5310. Here we obtain the following coordinates for each components:
  5311. @table @var
  5312. @item red
  5313. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  5314. @item green
  5315. @code{(0;0) (0.50;0.48) (1;1)}
  5316. @item blue
  5317. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  5318. @end table
  5319. @item
  5320. The previous example can also be achieved with the associated built-in preset:
  5321. @example
  5322. curves=preset=vintage
  5323. @end example
  5324. @item
  5325. Or simply:
  5326. @example
  5327. curves=vintage
  5328. @end example
  5329. @item
  5330. Use a Photoshop preset and redefine the points of the green component:
  5331. @example
  5332. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  5333. @end example
  5334. @item
  5335. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  5336. and @command{gnuplot}:
  5337. @example
  5338. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  5339. gnuplot -p /tmp/curves.plt
  5340. @end example
  5341. @end itemize
  5342. @section datascope
  5343. Video data analysis filter.
  5344. This filter shows hexadecimal pixel values of part of video.
  5345. The filter accepts the following options:
  5346. @table @option
  5347. @item size, s
  5348. Set output video size.
  5349. @item x
  5350. Set x offset from where to pick pixels.
  5351. @item y
  5352. Set y offset from where to pick pixels.
  5353. @item mode
  5354. Set scope mode, can be one of the following:
  5355. @table @samp
  5356. @item mono
  5357. Draw hexadecimal pixel values with white color on black background.
  5358. @item color
  5359. Draw hexadecimal pixel values with input video pixel color on black
  5360. background.
  5361. @item color2
  5362. Draw hexadecimal pixel values on color background picked from input video,
  5363. the text color is picked in such way so its always visible.
  5364. @end table
  5365. @item axis
  5366. Draw rows and columns numbers on left and top of video.
  5367. @item opacity
  5368. Set background opacity.
  5369. @end table
  5370. @section dctdnoiz
  5371. Denoise frames using 2D DCT (frequency domain filtering).
  5372. This filter is not designed for real time.
  5373. The filter accepts the following options:
  5374. @table @option
  5375. @item sigma, s
  5376. Set the noise sigma constant.
  5377. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  5378. coefficient (absolute value) below this threshold with be dropped.
  5379. If you need a more advanced filtering, see @option{expr}.
  5380. Default is @code{0}.
  5381. @item overlap
  5382. Set number overlapping pixels for each block. Since the filter can be slow, you
  5383. may want to reduce this value, at the cost of a less effective filter and the
  5384. risk of various artefacts.
  5385. If the overlapping value doesn't permit processing the whole input width or
  5386. height, a warning will be displayed and according borders won't be denoised.
  5387. Default value is @var{blocksize}-1, which is the best possible setting.
  5388. @item expr, e
  5389. Set the coefficient factor expression.
  5390. For each coefficient of a DCT block, this expression will be evaluated as a
  5391. multiplier value for the coefficient.
  5392. If this is option is set, the @option{sigma} option will be ignored.
  5393. The absolute value of the coefficient can be accessed through the @var{c}
  5394. variable.
  5395. @item n
  5396. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  5397. @var{blocksize}, which is the width and height of the processed blocks.
  5398. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  5399. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5400. on the speed processing. Also, a larger block size does not necessarily means a
  5401. better de-noising.
  5402. @end table
  5403. @subsection Examples
  5404. Apply a denoise with a @option{sigma} of @code{4.5}:
  5405. @example
  5406. dctdnoiz=4.5
  5407. @end example
  5408. The same operation can be achieved using the expression system:
  5409. @example
  5410. dctdnoiz=e='gte(c, 4.5*3)'
  5411. @end example
  5412. Violent denoise using a block size of @code{16x16}:
  5413. @example
  5414. dctdnoiz=15:n=4
  5415. @end example
  5416. @section deband
  5417. Remove banding artifacts from input video.
  5418. It works by replacing banded pixels with average value of referenced pixels.
  5419. The filter accepts the following options:
  5420. @table @option
  5421. @item 1thr
  5422. @item 2thr
  5423. @item 3thr
  5424. @item 4thr
  5425. Set banding detection threshold for each plane. Default is 0.02.
  5426. Valid range is 0.00003 to 0.5.
  5427. If difference between current pixel and reference pixel is less than threshold,
  5428. it will be considered as banded.
  5429. @item range, r
  5430. Banding detection range in pixels. Default is 16. If positive, random number
  5431. in range 0 to set value will be used. If negative, exact absolute value
  5432. will be used.
  5433. The range defines square of four pixels around current pixel.
  5434. @item direction, d
  5435. Set direction in radians from which four pixel will be compared. If positive,
  5436. random direction from 0 to set direction will be picked. If negative, exact of
  5437. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5438. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5439. column.
  5440. @item blur, b
  5441. If enabled, current pixel is compared with average value of all four
  5442. surrounding pixels. The default is enabled. If disabled current pixel is
  5443. compared with all four surrounding pixels. The pixel is considered banded
  5444. if only all four differences with surrounding pixels are less than threshold.
  5445. @item coupling, c
  5446. If enabled, current pixel is changed if and only if all pixel components are banded,
  5447. e.g. banding detection threshold is triggered for all color components.
  5448. The default is disabled.
  5449. @end table
  5450. @anchor{decimate}
  5451. @section decimate
  5452. Drop duplicated frames at regular intervals.
  5453. The filter accepts the following options:
  5454. @table @option
  5455. @item cycle
  5456. Set the number of frames from which one will be dropped. Setting this to
  5457. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  5458. Default is @code{5}.
  5459. @item dupthresh
  5460. Set the threshold for duplicate detection. If the difference metric for a frame
  5461. is less than or equal to this value, then it is declared as duplicate. Default
  5462. is @code{1.1}
  5463. @item scthresh
  5464. Set scene change threshold. Default is @code{15}.
  5465. @item blockx
  5466. @item blocky
  5467. Set the size of the x and y-axis blocks used during metric calculations.
  5468. Larger blocks give better noise suppression, but also give worse detection of
  5469. small movements. Must be a power of two. Default is @code{32}.
  5470. @item ppsrc
  5471. Mark main input as a pre-processed input and activate clean source input
  5472. stream. This allows the input to be pre-processed with various filters to help
  5473. the metrics calculation while keeping the frame selection lossless. When set to
  5474. @code{1}, the first stream is for the pre-processed input, and the second
  5475. stream is the clean source from where the kept frames are chosen. Default is
  5476. @code{0}.
  5477. @item chroma
  5478. Set whether or not chroma is considered in the metric calculations. Default is
  5479. @code{1}.
  5480. @end table
  5481. @section deconvolve
  5482. Apply 2D deconvolution of video stream in frequency domain using second stream
  5483. as impulse.
  5484. The filter accepts the following options:
  5485. @table @option
  5486. @item planes
  5487. Set which planes to process.
  5488. @item impulse
  5489. Set which impulse video frames will be processed, can be @var{first}
  5490. or @var{all}. Default is @var{all}.
  5491. @item noise
  5492. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  5493. and height are not same and not power of 2 or if stream prior to convolving
  5494. had noise.
  5495. @end table
  5496. The @code{deconvolve} filter also supports the @ref{framesync} options.
  5497. @section deflate
  5498. Apply deflate effect to the video.
  5499. This filter replaces the pixel by the local(3x3) average by taking into account
  5500. only values lower than the pixel.
  5501. It accepts the following options:
  5502. @table @option
  5503. @item threshold0
  5504. @item threshold1
  5505. @item threshold2
  5506. @item threshold3
  5507. Limit the maximum change for each plane, default is 65535.
  5508. If 0, plane will remain unchanged.
  5509. @end table
  5510. @section deflicker
  5511. Remove temporal frame luminance variations.
  5512. It accepts the following options:
  5513. @table @option
  5514. @item size, s
  5515. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  5516. @item mode, m
  5517. Set averaging mode to smooth temporal luminance variations.
  5518. Available values are:
  5519. @table @samp
  5520. @item am
  5521. Arithmetic mean
  5522. @item gm
  5523. Geometric mean
  5524. @item hm
  5525. Harmonic mean
  5526. @item qm
  5527. Quadratic mean
  5528. @item cm
  5529. Cubic mean
  5530. @item pm
  5531. Power mean
  5532. @item median
  5533. Median
  5534. @end table
  5535. @item bypass
  5536. Do not actually modify frame. Useful when one only wants metadata.
  5537. @end table
  5538. @section dejudder
  5539. Remove judder produced by partially interlaced telecined content.
  5540. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  5541. source was partially telecined content then the output of @code{pullup,dejudder}
  5542. will have a variable frame rate. May change the recorded frame rate of the
  5543. container. Aside from that change, this filter will not affect constant frame
  5544. rate video.
  5545. The option available in this filter is:
  5546. @table @option
  5547. @item cycle
  5548. Specify the length of the window over which the judder repeats.
  5549. Accepts any integer greater than 1. Useful values are:
  5550. @table @samp
  5551. @item 4
  5552. If the original was telecined from 24 to 30 fps (Film to NTSC).
  5553. @item 5
  5554. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  5555. @item 20
  5556. If a mixture of the two.
  5557. @end table
  5558. The default is @samp{4}.
  5559. @end table
  5560. @section delogo
  5561. Suppress a TV station logo by a simple interpolation of the surrounding
  5562. pixels. Just set a rectangle covering the logo and watch it disappear
  5563. (and sometimes something even uglier appear - your mileage may vary).
  5564. It accepts the following parameters:
  5565. @table @option
  5566. @item x
  5567. @item y
  5568. Specify the top left corner coordinates of the logo. They must be
  5569. specified.
  5570. @item w
  5571. @item h
  5572. Specify the width and height of the logo to clear. They must be
  5573. specified.
  5574. @item band, t
  5575. Specify the thickness of the fuzzy edge of the rectangle (added to
  5576. @var{w} and @var{h}). The default value is 1. This option is
  5577. deprecated, setting higher values should no longer be necessary and
  5578. is not recommended.
  5579. @item show
  5580. When set to 1, a green rectangle is drawn on the screen to simplify
  5581. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  5582. The default value is 0.
  5583. The rectangle is drawn on the outermost pixels which will be (partly)
  5584. replaced with interpolated values. The values of the next pixels
  5585. immediately outside this rectangle in each direction will be used to
  5586. compute the interpolated pixel values inside the rectangle.
  5587. @end table
  5588. @subsection Examples
  5589. @itemize
  5590. @item
  5591. Set a rectangle covering the area with top left corner coordinates 0,0
  5592. and size 100x77, and a band of size 10:
  5593. @example
  5594. delogo=x=0:y=0:w=100:h=77:band=10
  5595. @end example
  5596. @end itemize
  5597. @section deshake
  5598. Attempt to fix small changes in horizontal and/or vertical shift. This
  5599. filter helps remove camera shake from hand-holding a camera, bumping a
  5600. tripod, moving on a vehicle, etc.
  5601. The filter accepts the following options:
  5602. @table @option
  5603. @item x
  5604. @item y
  5605. @item w
  5606. @item h
  5607. Specify a rectangular area where to limit the search for motion
  5608. vectors.
  5609. If desired the search for motion vectors can be limited to a
  5610. rectangular area of the frame defined by its top left corner, width
  5611. and height. These parameters have the same meaning as the drawbox
  5612. filter which can be used to visualise the position of the bounding
  5613. box.
  5614. This is useful when simultaneous movement of subjects within the frame
  5615. might be confused for camera motion by the motion vector search.
  5616. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  5617. then the full frame is used. This allows later options to be set
  5618. without specifying the bounding box for the motion vector search.
  5619. Default - search the whole frame.
  5620. @item rx
  5621. @item ry
  5622. Specify the maximum extent of movement in x and y directions in the
  5623. range 0-64 pixels. Default 16.
  5624. @item edge
  5625. Specify how to generate pixels to fill blanks at the edge of the
  5626. frame. Available values are:
  5627. @table @samp
  5628. @item blank, 0
  5629. Fill zeroes at blank locations
  5630. @item original, 1
  5631. Original image at blank locations
  5632. @item clamp, 2
  5633. Extruded edge value at blank locations
  5634. @item mirror, 3
  5635. Mirrored edge at blank locations
  5636. @end table
  5637. Default value is @samp{mirror}.
  5638. @item blocksize
  5639. Specify the blocksize to use for motion search. Range 4-128 pixels,
  5640. default 8.
  5641. @item contrast
  5642. Specify the contrast threshold for blocks. Only blocks with more than
  5643. the specified contrast (difference between darkest and lightest
  5644. pixels) will be considered. Range 1-255, default 125.
  5645. @item search
  5646. Specify the search strategy. Available values are:
  5647. @table @samp
  5648. @item exhaustive, 0
  5649. Set exhaustive search
  5650. @item less, 1
  5651. Set less exhaustive search.
  5652. @end table
  5653. Default value is @samp{exhaustive}.
  5654. @item filename
  5655. If set then a detailed log of the motion search is written to the
  5656. specified file.
  5657. @end table
  5658. @section despill
  5659. Remove unwanted contamination of foreground colors, caused by reflected color of
  5660. greenscreen or bluescreen.
  5661. This filter accepts the following options:
  5662. @table @option
  5663. @item type
  5664. Set what type of despill to use.
  5665. @item mix
  5666. Set how spillmap will be generated.
  5667. @item expand
  5668. Set how much to get rid of still remaining spill.
  5669. @item red
  5670. Controls amount of red in spill area.
  5671. @item green
  5672. Controls amount of green in spill area.
  5673. Should be -1 for greenscreen.
  5674. @item blue
  5675. Controls amount of blue in spill area.
  5676. Should be -1 for bluescreen.
  5677. @item brightness
  5678. Controls brightness of spill area, preserving colors.
  5679. @item alpha
  5680. Modify alpha from generated spillmap.
  5681. @end table
  5682. @section detelecine
  5683. Apply an exact inverse of the telecine operation. It requires a predefined
  5684. pattern specified using the pattern option which must be the same as that passed
  5685. to the telecine filter.
  5686. This filter accepts the following options:
  5687. @table @option
  5688. @item first_field
  5689. @table @samp
  5690. @item top, t
  5691. top field first
  5692. @item bottom, b
  5693. bottom field first
  5694. The default value is @code{top}.
  5695. @end table
  5696. @item pattern
  5697. A string of numbers representing the pulldown pattern you wish to apply.
  5698. The default value is @code{23}.
  5699. @item start_frame
  5700. A number representing position of the first frame with respect to the telecine
  5701. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  5702. @end table
  5703. @section dilation
  5704. Apply dilation effect to the video.
  5705. This filter replaces the pixel by the local(3x3) maximum.
  5706. It accepts the following options:
  5707. @table @option
  5708. @item threshold0
  5709. @item threshold1
  5710. @item threshold2
  5711. @item threshold3
  5712. Limit the maximum change for each plane, default is 65535.
  5713. If 0, plane will remain unchanged.
  5714. @item coordinates
  5715. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5716. pixels are used.
  5717. Flags to local 3x3 coordinates maps like this:
  5718. 1 2 3
  5719. 4 5
  5720. 6 7 8
  5721. @end table
  5722. @section displace
  5723. Displace pixels as indicated by second and third input stream.
  5724. It takes three input streams and outputs one stream, the first input is the
  5725. source, and second and third input are displacement maps.
  5726. The second input specifies how much to displace pixels along the
  5727. x-axis, while the third input specifies how much to displace pixels
  5728. along the y-axis.
  5729. If one of displacement map streams terminates, last frame from that
  5730. displacement map will be used.
  5731. Note that once generated, displacements maps can be reused over and over again.
  5732. A description of the accepted options follows.
  5733. @table @option
  5734. @item edge
  5735. Set displace behavior for pixels that are out of range.
  5736. Available values are:
  5737. @table @samp
  5738. @item blank
  5739. Missing pixels are replaced by black pixels.
  5740. @item smear
  5741. Adjacent pixels will spread out to replace missing pixels.
  5742. @item wrap
  5743. Out of range pixels are wrapped so they point to pixels of other side.
  5744. @item mirror
  5745. Out of range pixels will be replaced with mirrored pixels.
  5746. @end table
  5747. Default is @samp{smear}.
  5748. @end table
  5749. @subsection Examples
  5750. @itemize
  5751. @item
  5752. Add ripple effect to rgb input of video size hd720:
  5753. @example
  5754. 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
  5755. @end example
  5756. @item
  5757. Add wave effect to rgb input of video size hd720:
  5758. @example
  5759. 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
  5760. @end example
  5761. @end itemize
  5762. @section drawbox
  5763. Draw a colored box on the input image.
  5764. It accepts the following parameters:
  5765. @table @option
  5766. @item x
  5767. @item y
  5768. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5769. @item width, w
  5770. @item height, h
  5771. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5772. the input width and height. It defaults to 0.
  5773. @item color, c
  5774. Specify the color of the box to write. For the general syntax of this option,
  5775. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  5776. value @code{invert} is used, the box edge color is the same as the
  5777. video with inverted luma.
  5778. @item thickness, t
  5779. The expression which sets the thickness of the box edge.
  5780. A value of @code{fill} will create a filled box. Default value is @code{3}.
  5781. See below for the list of accepted constants.
  5782. @item replace
  5783. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  5784. will overwrite the video's color and alpha pixels.
  5785. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  5786. @end table
  5787. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5788. following constants:
  5789. @table @option
  5790. @item dar
  5791. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5792. @item hsub
  5793. @item vsub
  5794. horizontal and vertical chroma subsample values. For example for the
  5795. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5796. @item in_h, ih
  5797. @item in_w, iw
  5798. The input width and height.
  5799. @item sar
  5800. The input sample aspect ratio.
  5801. @item x
  5802. @item y
  5803. The x and y offset coordinates where the box is drawn.
  5804. @item w
  5805. @item h
  5806. The width and height of the drawn box.
  5807. @item t
  5808. The thickness of the drawn box.
  5809. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5810. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5811. @end table
  5812. @subsection Examples
  5813. @itemize
  5814. @item
  5815. Draw a black box around the edge of the input image:
  5816. @example
  5817. drawbox
  5818. @end example
  5819. @item
  5820. Draw a box with color red and an opacity of 50%:
  5821. @example
  5822. drawbox=10:20:200:60:red@@0.5
  5823. @end example
  5824. The previous example can be specified as:
  5825. @example
  5826. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5827. @end example
  5828. @item
  5829. Fill the box with pink color:
  5830. @example
  5831. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  5832. @end example
  5833. @item
  5834. Draw a 2-pixel red 2.40:1 mask:
  5835. @example
  5836. 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
  5837. @end example
  5838. @end itemize
  5839. @section drawgrid
  5840. Draw a grid on the input image.
  5841. It accepts the following parameters:
  5842. @table @option
  5843. @item x
  5844. @item y
  5845. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5846. @item width, w
  5847. @item height, h
  5848. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5849. input width and height, respectively, minus @code{thickness}, so image gets
  5850. framed. Default to 0.
  5851. @item color, c
  5852. Specify the color of the grid. For the general syntax of this option,
  5853. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  5854. value @code{invert} is used, the grid color is the same as the
  5855. video with inverted luma.
  5856. @item thickness, t
  5857. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5858. See below for the list of accepted constants.
  5859. @item replace
  5860. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  5861. will overwrite the video's color and alpha pixels.
  5862. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  5863. @end table
  5864. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5865. following constants:
  5866. @table @option
  5867. @item dar
  5868. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5869. @item hsub
  5870. @item vsub
  5871. horizontal and vertical chroma subsample values. For example for the
  5872. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5873. @item in_h, ih
  5874. @item in_w, iw
  5875. The input grid cell width and height.
  5876. @item sar
  5877. The input sample aspect ratio.
  5878. @item x
  5879. @item y
  5880. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5881. @item w
  5882. @item h
  5883. The width and height of the drawn cell.
  5884. @item t
  5885. The thickness of the drawn cell.
  5886. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5887. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5888. @end table
  5889. @subsection Examples
  5890. @itemize
  5891. @item
  5892. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5893. @example
  5894. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5895. @end example
  5896. @item
  5897. Draw a white 3x3 grid with an opacity of 50%:
  5898. @example
  5899. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5900. @end example
  5901. @end itemize
  5902. @anchor{drawtext}
  5903. @section drawtext
  5904. Draw a text string or text from a specified file on top of a video, using the
  5905. libfreetype library.
  5906. To enable compilation of this filter, you need to configure FFmpeg with
  5907. @code{--enable-libfreetype}.
  5908. To enable default font fallback and the @var{font} option you need to
  5909. configure FFmpeg with @code{--enable-libfontconfig}.
  5910. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5911. @code{--enable-libfribidi}.
  5912. @subsection Syntax
  5913. It accepts the following parameters:
  5914. @table @option
  5915. @item box
  5916. Used to draw a box around text using the background color.
  5917. The value must be either 1 (enable) or 0 (disable).
  5918. The default value of @var{box} is 0.
  5919. @item boxborderw
  5920. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5921. The default value of @var{boxborderw} is 0.
  5922. @item boxcolor
  5923. The color to be used for drawing box around text. For the syntax of this
  5924. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  5925. The default value of @var{boxcolor} is "white".
  5926. @item line_spacing
  5927. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  5928. The default value of @var{line_spacing} is 0.
  5929. @item borderw
  5930. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5931. The default value of @var{borderw} is 0.
  5932. @item bordercolor
  5933. Set the color to be used for drawing border around text. For the syntax of this
  5934. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  5935. The default value of @var{bordercolor} is "black".
  5936. @item expansion
  5937. Select how the @var{text} is expanded. Can be either @code{none},
  5938. @code{strftime} (deprecated) or
  5939. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5940. below for details.
  5941. @item basetime
  5942. Set a start time for the count. Value is in microseconds. Only applied
  5943. in the deprecated strftime expansion mode. To emulate in normal expansion
  5944. mode use the @code{pts} function, supplying the start time (in seconds)
  5945. as the second argument.
  5946. @item fix_bounds
  5947. If true, check and fix text coords to avoid clipping.
  5948. @item fontcolor
  5949. The color to be used for drawing fonts. For the syntax of this option, check
  5950. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  5951. The default value of @var{fontcolor} is "black".
  5952. @item fontcolor_expr
  5953. String which is expanded the same way as @var{text} to obtain dynamic
  5954. @var{fontcolor} value. By default this option has empty value and is not
  5955. processed. When this option is set, it overrides @var{fontcolor} option.
  5956. @item font
  5957. The font family to be used for drawing text. By default Sans.
  5958. @item fontfile
  5959. The font file to be used for drawing text. The path must be included.
  5960. This parameter is mandatory if the fontconfig support is disabled.
  5961. @item alpha
  5962. Draw the text applying alpha blending. The value can
  5963. be a number between 0.0 and 1.0.
  5964. The expression accepts the same variables @var{x, y} as well.
  5965. The default value is 1.
  5966. Please see @var{fontcolor_expr}.
  5967. @item fontsize
  5968. The font size to be used for drawing text.
  5969. The default value of @var{fontsize} is 16.
  5970. @item text_shaping
  5971. If set to 1, attempt to shape the text (for example, reverse the order of
  5972. right-to-left text and join Arabic characters) before drawing it.
  5973. Otherwise, just draw the text exactly as given.
  5974. By default 1 (if supported).
  5975. @item ft_load_flags
  5976. The flags to be used for loading the fonts.
  5977. The flags map the corresponding flags supported by libfreetype, and are
  5978. a combination of the following values:
  5979. @table @var
  5980. @item default
  5981. @item no_scale
  5982. @item no_hinting
  5983. @item render
  5984. @item no_bitmap
  5985. @item vertical_layout
  5986. @item force_autohint
  5987. @item crop_bitmap
  5988. @item pedantic
  5989. @item ignore_global_advance_width
  5990. @item no_recurse
  5991. @item ignore_transform
  5992. @item monochrome
  5993. @item linear_design
  5994. @item no_autohint
  5995. @end table
  5996. Default value is "default".
  5997. For more information consult the documentation for the FT_LOAD_*
  5998. libfreetype flags.
  5999. @item shadowcolor
  6000. The color to be used for drawing a shadow behind the drawn text. For the
  6001. syntax of this option, check the @ref{color syntax,,"Color" section in the
  6002. ffmpeg-utils manual,ffmpeg-utils}.
  6003. The default value of @var{shadowcolor} is "black".
  6004. @item shadowx
  6005. @item shadowy
  6006. The x and y offsets for the text shadow position with respect to the
  6007. position of the text. They can be either positive or negative
  6008. values. The default value for both is "0".
  6009. @item start_number
  6010. The starting frame number for the n/frame_num variable. The default value
  6011. is "0".
  6012. @item tabsize
  6013. The size in number of spaces to use for rendering the tab.
  6014. Default value is 4.
  6015. @item timecode
  6016. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  6017. format. It can be used with or without text parameter. @var{timecode_rate}
  6018. option must be specified.
  6019. @item timecode_rate, rate, r
  6020. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  6021. integer. Minimum value is "1".
  6022. Drop-frame timecode is supported for frame rates 30 & 60.
  6023. @item tc24hmax
  6024. If set to 1, the output of the timecode option will wrap around at 24 hours.
  6025. Default is 0 (disabled).
  6026. @item text
  6027. The text string to be drawn. The text must be a sequence of UTF-8
  6028. encoded characters.
  6029. This parameter is mandatory if no file is specified with the parameter
  6030. @var{textfile}.
  6031. @item textfile
  6032. A text file containing text to be drawn. The text must be a sequence
  6033. of UTF-8 encoded characters.
  6034. This parameter is mandatory if no text string is specified with the
  6035. parameter @var{text}.
  6036. If both @var{text} and @var{textfile} are specified, an error is thrown.
  6037. @item reload
  6038. If set to 1, the @var{textfile} will be reloaded before each frame.
  6039. Be sure to update it atomically, or it may be read partially, or even fail.
  6040. @item x
  6041. @item y
  6042. The expressions which specify the offsets where text will be drawn
  6043. within the video frame. They are relative to the top/left border of the
  6044. output image.
  6045. The default value of @var{x} and @var{y} is "0".
  6046. See below for the list of accepted constants and functions.
  6047. @end table
  6048. The parameters for @var{x} and @var{y} are expressions containing the
  6049. following constants and functions:
  6050. @table @option
  6051. @item dar
  6052. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  6053. @item hsub
  6054. @item vsub
  6055. horizontal and vertical chroma subsample values. For example for the
  6056. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6057. @item line_h, lh
  6058. the height of each text line
  6059. @item main_h, h, H
  6060. the input height
  6061. @item main_w, w, W
  6062. the input width
  6063. @item max_glyph_a, ascent
  6064. the maximum distance from the baseline to the highest/upper grid
  6065. coordinate used to place a glyph outline point, for all the rendered
  6066. glyphs.
  6067. It is a positive value, due to the grid's orientation with the Y axis
  6068. upwards.
  6069. @item max_glyph_d, descent
  6070. the maximum distance from the baseline to the lowest grid coordinate
  6071. used to place a glyph outline point, for all the rendered glyphs.
  6072. This is a negative value, due to the grid's orientation, with the Y axis
  6073. upwards.
  6074. @item max_glyph_h
  6075. maximum glyph height, that is the maximum height for all the glyphs
  6076. contained in the rendered text, it is equivalent to @var{ascent} -
  6077. @var{descent}.
  6078. @item max_glyph_w
  6079. maximum glyph width, that is the maximum width for all the glyphs
  6080. contained in the rendered text
  6081. @item n
  6082. the number of input frame, starting from 0
  6083. @item rand(min, max)
  6084. return a random number included between @var{min} and @var{max}
  6085. @item sar
  6086. The input sample aspect ratio.
  6087. @item t
  6088. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6089. @item text_h, th
  6090. the height of the rendered text
  6091. @item text_w, tw
  6092. the width of the rendered text
  6093. @item x
  6094. @item y
  6095. the x and y offset coordinates where the text is drawn.
  6096. These parameters allow the @var{x} and @var{y} expressions to refer
  6097. each other, so you can for example specify @code{y=x/dar}.
  6098. @end table
  6099. @anchor{drawtext_expansion}
  6100. @subsection Text expansion
  6101. If @option{expansion} is set to @code{strftime},
  6102. the filter recognizes strftime() sequences in the provided text and
  6103. expands them accordingly. Check the documentation of strftime(). This
  6104. feature is deprecated.
  6105. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  6106. If @option{expansion} is set to @code{normal} (which is the default),
  6107. the following expansion mechanism is used.
  6108. The backslash character @samp{\}, followed by any character, always expands to
  6109. the second character.
  6110. Sequences of the form @code{%@{...@}} are expanded. The text between the
  6111. braces is a function name, possibly followed by arguments separated by ':'.
  6112. If the arguments contain special characters or delimiters (':' or '@}'),
  6113. they should be escaped.
  6114. Note that they probably must also be escaped as the value for the
  6115. @option{text} option in the filter argument string and as the filter
  6116. argument in the filtergraph description, and possibly also for the shell,
  6117. that makes up to four levels of escaping; using a text file avoids these
  6118. problems.
  6119. The following functions are available:
  6120. @table @command
  6121. @item expr, e
  6122. The expression evaluation result.
  6123. It must take one argument specifying the expression to be evaluated,
  6124. which accepts the same constants and functions as the @var{x} and
  6125. @var{y} values. Note that not all constants should be used, for
  6126. example the text size is not known when evaluating the expression, so
  6127. the constants @var{text_w} and @var{text_h} will have an undefined
  6128. value.
  6129. @item expr_int_format, eif
  6130. Evaluate the expression's value and output as formatted integer.
  6131. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  6132. The second argument specifies the output format. Allowed values are @samp{x},
  6133. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  6134. @code{printf} function.
  6135. The third parameter is optional and sets the number of positions taken by the output.
  6136. It can be used to add padding with zeros from the left.
  6137. @item gmtime
  6138. The time at which the filter is running, expressed in UTC.
  6139. It can accept an argument: a strftime() format string.
  6140. @item localtime
  6141. The time at which the filter is running, expressed in the local time zone.
  6142. It can accept an argument: a strftime() format string.
  6143. @item metadata
  6144. Frame metadata. Takes one or two arguments.
  6145. The first argument is mandatory and specifies the metadata key.
  6146. The second argument is optional and specifies a default value, used when the
  6147. metadata key is not found or empty.
  6148. @item n, frame_num
  6149. The frame number, starting from 0.
  6150. @item pict_type
  6151. A 1 character description of the current picture type.
  6152. @item pts
  6153. The timestamp of the current frame.
  6154. It can take up to three arguments.
  6155. The first argument is the format of the timestamp; it defaults to @code{flt}
  6156. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  6157. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  6158. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  6159. @code{localtime} stands for the timestamp of the frame formatted as
  6160. local time zone time.
  6161. The second argument is an offset added to the timestamp.
  6162. If the format is set to @code{localtime} or @code{gmtime},
  6163. a third argument may be supplied: a strftime() format string.
  6164. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  6165. @end table
  6166. @subsection Examples
  6167. @itemize
  6168. @item
  6169. Draw "Test Text" with font FreeSerif, using the default values for the
  6170. optional parameters.
  6171. @example
  6172. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  6173. @end example
  6174. @item
  6175. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  6176. and y=50 (counting from the top-left corner of the screen), text is
  6177. yellow with a red box around it. Both the text and the box have an
  6178. opacity of 20%.
  6179. @example
  6180. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  6181. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  6182. @end example
  6183. Note that the double quotes are not necessary if spaces are not used
  6184. within the parameter list.
  6185. @item
  6186. Show the text at the center of the video frame:
  6187. @example
  6188. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  6189. @end example
  6190. @item
  6191. Show the text at a random position, switching to a new position every 30 seconds:
  6192. @example
  6193. 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)"
  6194. @end example
  6195. @item
  6196. Show a text line sliding from right to left in the last row of the video
  6197. frame. The file @file{LONG_LINE} is assumed to contain a single line
  6198. with no newlines.
  6199. @example
  6200. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  6201. @end example
  6202. @item
  6203. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  6204. @example
  6205. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  6206. @end example
  6207. @item
  6208. Draw a single green letter "g", at the center of the input video.
  6209. The glyph baseline is placed at half screen height.
  6210. @example
  6211. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  6212. @end example
  6213. @item
  6214. Show text for 1 second every 3 seconds:
  6215. @example
  6216. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  6217. @end example
  6218. @item
  6219. Use fontconfig to set the font. Note that the colons need to be escaped.
  6220. @example
  6221. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  6222. @end example
  6223. @item
  6224. Print the date of a real-time encoding (see strftime(3)):
  6225. @example
  6226. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  6227. @end example
  6228. @item
  6229. Show text fading in and out (appearing/disappearing):
  6230. @example
  6231. #!/bin/sh
  6232. DS=1.0 # display start
  6233. DE=10.0 # display end
  6234. FID=1.5 # fade in duration
  6235. FOD=5 # fade out duration
  6236. 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 @}"
  6237. @end example
  6238. @item
  6239. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  6240. and the @option{fontsize} value are included in the @option{y} offset.
  6241. @example
  6242. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  6243. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  6244. @end example
  6245. @end itemize
  6246. For more information about libfreetype, check:
  6247. @url{http://www.freetype.org/}.
  6248. For more information about fontconfig, check:
  6249. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  6250. For more information about libfribidi, check:
  6251. @url{http://fribidi.org/}.
  6252. @section edgedetect
  6253. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  6254. The filter accepts the following options:
  6255. @table @option
  6256. @item low
  6257. @item high
  6258. Set low and high threshold values used by the Canny thresholding
  6259. algorithm.
  6260. The high threshold selects the "strong" edge pixels, which are then
  6261. connected through 8-connectivity with the "weak" edge pixels selected
  6262. by the low threshold.
  6263. @var{low} and @var{high} threshold values must be chosen in the range
  6264. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6265. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6266. is @code{50/255}.
  6267. @item mode
  6268. Define the drawing mode.
  6269. @table @samp
  6270. @item wires
  6271. Draw white/gray wires on black background.
  6272. @item colormix
  6273. Mix the colors to create a paint/cartoon effect.
  6274. @end table
  6275. Default value is @var{wires}.
  6276. @end table
  6277. @subsection Examples
  6278. @itemize
  6279. @item
  6280. Standard edge detection with custom values for the hysteresis thresholding:
  6281. @example
  6282. edgedetect=low=0.1:high=0.4
  6283. @end example
  6284. @item
  6285. Painting effect without thresholding:
  6286. @example
  6287. edgedetect=mode=colormix:high=0
  6288. @end example
  6289. @end itemize
  6290. @section eq
  6291. Set brightness, contrast, saturation and approximate gamma adjustment.
  6292. The filter accepts the following options:
  6293. @table @option
  6294. @item contrast
  6295. Set the contrast expression. The value must be a float value in range
  6296. @code{-2.0} to @code{2.0}. The default value is "1".
  6297. @item brightness
  6298. Set the brightness expression. The value must be a float value in
  6299. range @code{-1.0} to @code{1.0}. The default value is "0".
  6300. @item saturation
  6301. Set the saturation expression. The value must be a float in
  6302. range @code{0.0} to @code{3.0}. The default value is "1".
  6303. @item gamma
  6304. Set the gamma expression. The value must be a float in range
  6305. @code{0.1} to @code{10.0}. The default value is "1".
  6306. @item gamma_r
  6307. Set the gamma expression for red. The value must be a float in
  6308. range @code{0.1} to @code{10.0}. The default value is "1".
  6309. @item gamma_g
  6310. Set the gamma expression for green. The value must be a float in range
  6311. @code{0.1} to @code{10.0}. The default value is "1".
  6312. @item gamma_b
  6313. Set the gamma expression for blue. The value must be a float in range
  6314. @code{0.1} to @code{10.0}. The default value is "1".
  6315. @item gamma_weight
  6316. Set the gamma weight expression. It can be used to reduce the effect
  6317. of a high gamma value on bright image areas, e.g. keep them from
  6318. getting overamplified and just plain white. The value must be a float
  6319. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  6320. gamma correction all the way down while @code{1.0} leaves it at its
  6321. full strength. Default is "1".
  6322. @item eval
  6323. Set when the expressions for brightness, contrast, saturation and
  6324. gamma expressions are evaluated.
  6325. It accepts the following values:
  6326. @table @samp
  6327. @item init
  6328. only evaluate expressions once during the filter initialization or
  6329. when a command is processed
  6330. @item frame
  6331. evaluate expressions for each incoming frame
  6332. @end table
  6333. Default value is @samp{init}.
  6334. @end table
  6335. The expressions accept the following parameters:
  6336. @table @option
  6337. @item n
  6338. frame count of the input frame starting from 0
  6339. @item pos
  6340. byte position of the corresponding packet in the input file, NAN if
  6341. unspecified
  6342. @item r
  6343. frame rate of the input video, NAN if the input frame rate is unknown
  6344. @item t
  6345. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6346. @end table
  6347. @subsection Commands
  6348. The filter supports the following commands:
  6349. @table @option
  6350. @item contrast
  6351. Set the contrast expression.
  6352. @item brightness
  6353. Set the brightness expression.
  6354. @item saturation
  6355. Set the saturation expression.
  6356. @item gamma
  6357. Set the gamma expression.
  6358. @item gamma_r
  6359. Set the gamma_r expression.
  6360. @item gamma_g
  6361. Set gamma_g expression.
  6362. @item gamma_b
  6363. Set gamma_b expression.
  6364. @item gamma_weight
  6365. Set gamma_weight expression.
  6366. The command accepts the same syntax of the corresponding option.
  6367. If the specified expression is not valid, it is kept at its current
  6368. value.
  6369. @end table
  6370. @section erosion
  6371. Apply erosion effect to the video.
  6372. This filter replaces the pixel by the local(3x3) minimum.
  6373. It accepts the following options:
  6374. @table @option
  6375. @item threshold0
  6376. @item threshold1
  6377. @item threshold2
  6378. @item threshold3
  6379. Limit the maximum change for each plane, default is 65535.
  6380. If 0, plane will remain unchanged.
  6381. @item coordinates
  6382. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6383. pixels are used.
  6384. Flags to local 3x3 coordinates maps like this:
  6385. 1 2 3
  6386. 4 5
  6387. 6 7 8
  6388. @end table
  6389. @section extractplanes
  6390. Extract color channel components from input video stream into
  6391. separate grayscale video streams.
  6392. The filter accepts the following option:
  6393. @table @option
  6394. @item planes
  6395. Set plane(s) to extract.
  6396. Available values for planes are:
  6397. @table @samp
  6398. @item y
  6399. @item u
  6400. @item v
  6401. @item a
  6402. @item r
  6403. @item g
  6404. @item b
  6405. @end table
  6406. Choosing planes not available in the input will result in an error.
  6407. That means you cannot select @code{r}, @code{g}, @code{b} planes
  6408. with @code{y}, @code{u}, @code{v} planes at same time.
  6409. @end table
  6410. @subsection Examples
  6411. @itemize
  6412. @item
  6413. Extract luma, u and v color channel component from input video frame
  6414. into 3 grayscale outputs:
  6415. @example
  6416. 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
  6417. @end example
  6418. @end itemize
  6419. @section elbg
  6420. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  6421. For each input image, the filter will compute the optimal mapping from
  6422. the input to the output given the codebook length, that is the number
  6423. of distinct output colors.
  6424. This filter accepts the following options.
  6425. @table @option
  6426. @item codebook_length, l
  6427. Set codebook length. The value must be a positive integer, and
  6428. represents the number of distinct output colors. Default value is 256.
  6429. @item nb_steps, n
  6430. Set the maximum number of iterations to apply for computing the optimal
  6431. mapping. The higher the value the better the result and the higher the
  6432. computation time. Default value is 1.
  6433. @item seed, s
  6434. Set a random seed, must be an integer included between 0 and
  6435. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  6436. will try to use a good random seed on a best effort basis.
  6437. @item pal8
  6438. Set pal8 output pixel format. This option does not work with codebook
  6439. length greater than 256.
  6440. @end table
  6441. @section entropy
  6442. Measure graylevel entropy in histogram of color channels of video frames.
  6443. It accepts the following parameters:
  6444. @table @option
  6445. @item mode
  6446. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  6447. @var{diff} mode measures entropy of histogram delta values, absolute differences
  6448. between neighbour histogram values.
  6449. @end table
  6450. @section fade
  6451. Apply a fade-in/out effect to the input video.
  6452. It accepts the following parameters:
  6453. @table @option
  6454. @item type, t
  6455. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  6456. effect.
  6457. Default is @code{in}.
  6458. @item start_frame, s
  6459. Specify the number of the frame to start applying the fade
  6460. effect at. Default is 0.
  6461. @item nb_frames, n
  6462. The number of frames that the fade effect lasts. At the end of the
  6463. fade-in effect, the output video will have the same intensity as the input video.
  6464. At the end of the fade-out transition, the output video will be filled with the
  6465. selected @option{color}.
  6466. Default is 25.
  6467. @item alpha
  6468. If set to 1, fade only alpha channel, if one exists on the input.
  6469. Default value is 0.
  6470. @item start_time, st
  6471. Specify the timestamp (in seconds) of the frame to start to apply the fade
  6472. effect. If both start_frame and start_time are specified, the fade will start at
  6473. whichever comes last. Default is 0.
  6474. @item duration, d
  6475. The number of seconds for which the fade effect has to last. At the end of the
  6476. fade-in effect the output video will have the same intensity as the input video,
  6477. at the end of the fade-out transition the output video will be filled with the
  6478. selected @option{color}.
  6479. If both duration and nb_frames are specified, duration is used. Default is 0
  6480. (nb_frames is used by default).
  6481. @item color, c
  6482. Specify the color of the fade. Default is "black".
  6483. @end table
  6484. @subsection Examples
  6485. @itemize
  6486. @item
  6487. Fade in the first 30 frames of video:
  6488. @example
  6489. fade=in:0:30
  6490. @end example
  6491. The command above is equivalent to:
  6492. @example
  6493. fade=t=in:s=0:n=30
  6494. @end example
  6495. @item
  6496. Fade out the last 45 frames of a 200-frame video:
  6497. @example
  6498. fade=out:155:45
  6499. fade=type=out:start_frame=155:nb_frames=45
  6500. @end example
  6501. @item
  6502. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  6503. @example
  6504. fade=in:0:25, fade=out:975:25
  6505. @end example
  6506. @item
  6507. Make the first 5 frames yellow, then fade in from frame 5-24:
  6508. @example
  6509. fade=in:5:20:color=yellow
  6510. @end example
  6511. @item
  6512. Fade in alpha over first 25 frames of video:
  6513. @example
  6514. fade=in:0:25:alpha=1
  6515. @end example
  6516. @item
  6517. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  6518. @example
  6519. fade=t=in:st=5.5:d=0.5
  6520. @end example
  6521. @end itemize
  6522. @section fftfilt
  6523. Apply arbitrary expressions to samples in frequency domain
  6524. @table @option
  6525. @item dc_Y
  6526. Adjust the dc value (gain) of the luma plane of the image. The filter
  6527. accepts an integer value in range @code{0} to @code{1000}. The default
  6528. value is set to @code{0}.
  6529. @item dc_U
  6530. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  6531. filter accepts an integer value in range @code{0} to @code{1000}. The
  6532. default value is set to @code{0}.
  6533. @item dc_V
  6534. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  6535. filter accepts an integer value in range @code{0} to @code{1000}. The
  6536. default value is set to @code{0}.
  6537. @item weight_Y
  6538. Set the frequency domain weight expression for the luma plane.
  6539. @item weight_U
  6540. Set the frequency domain weight expression for the 1st chroma plane.
  6541. @item weight_V
  6542. Set the frequency domain weight expression for the 2nd chroma plane.
  6543. @item eval
  6544. Set when the expressions are evaluated.
  6545. It accepts the following values:
  6546. @table @samp
  6547. @item init
  6548. Only evaluate expressions once during the filter initialization.
  6549. @item frame
  6550. Evaluate expressions for each incoming frame.
  6551. @end table
  6552. Default value is @samp{init}.
  6553. The filter accepts the following variables:
  6554. @item X
  6555. @item Y
  6556. The coordinates of the current sample.
  6557. @item W
  6558. @item H
  6559. The width and height of the image.
  6560. @item N
  6561. The number of input frame, starting from 0.
  6562. @end table
  6563. @subsection Examples
  6564. @itemize
  6565. @item
  6566. High-pass:
  6567. @example
  6568. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  6569. @end example
  6570. @item
  6571. Low-pass:
  6572. @example
  6573. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  6574. @end example
  6575. @item
  6576. Sharpen:
  6577. @example
  6578. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  6579. @end example
  6580. @item
  6581. Blur:
  6582. @example
  6583. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  6584. @end example
  6585. @end itemize
  6586. @section field
  6587. Extract a single field from an interlaced image using stride
  6588. arithmetic to avoid wasting CPU time. The output frames are marked as
  6589. non-interlaced.
  6590. The filter accepts the following options:
  6591. @table @option
  6592. @item type
  6593. Specify whether to extract the top (if the value is @code{0} or
  6594. @code{top}) or the bottom field (if the value is @code{1} or
  6595. @code{bottom}).
  6596. @end table
  6597. @section fieldhint
  6598. Create new frames by copying the top and bottom fields from surrounding frames
  6599. supplied as numbers by the hint file.
  6600. @table @option
  6601. @item hint
  6602. Set file containing hints: absolute/relative frame numbers.
  6603. There must be one line for each frame in a clip. Each line must contain two
  6604. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  6605. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  6606. is current frame number for @code{absolute} mode or out of [-1, 1] range
  6607. for @code{relative} mode. First number tells from which frame to pick up top
  6608. field and second number tells from which frame to pick up bottom field.
  6609. If optionally followed by @code{+} output frame will be marked as interlaced,
  6610. else if followed by @code{-} output frame will be marked as progressive, else
  6611. it will be marked same as input frame.
  6612. If line starts with @code{#} or @code{;} that line is skipped.
  6613. @item mode
  6614. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  6615. @end table
  6616. Example of first several lines of @code{hint} file for @code{relative} mode:
  6617. @example
  6618. 0,0 - # first frame
  6619. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  6620. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  6621. 1,0 -
  6622. 0,0 -
  6623. 0,0 -
  6624. 1,0 -
  6625. 1,0 -
  6626. 1,0 -
  6627. 0,0 -
  6628. 0,0 -
  6629. 1,0 -
  6630. 1,0 -
  6631. 1,0 -
  6632. 0,0 -
  6633. @end example
  6634. @section fieldmatch
  6635. Field matching filter for inverse telecine. It is meant to reconstruct the
  6636. progressive frames from a telecined stream. The filter does not drop duplicated
  6637. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  6638. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  6639. The separation of the field matching and the decimation is notably motivated by
  6640. the possibility of inserting a de-interlacing filter fallback between the two.
  6641. If the source has mixed telecined and real interlaced content,
  6642. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  6643. But these remaining combed frames will be marked as interlaced, and thus can be
  6644. de-interlaced by a later filter such as @ref{yadif} before decimation.
  6645. In addition to the various configuration options, @code{fieldmatch} can take an
  6646. optional second stream, activated through the @option{ppsrc} option. If
  6647. enabled, the frames reconstruction will be based on the fields and frames from
  6648. this second stream. This allows the first input to be pre-processed in order to
  6649. help the various algorithms of the filter, while keeping the output lossless
  6650. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  6651. or brightness/contrast adjustments can help.
  6652. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  6653. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  6654. which @code{fieldmatch} is based on. While the semantic and usage are very
  6655. close, some behaviour and options names can differ.
  6656. The @ref{decimate} filter currently only works for constant frame rate input.
  6657. If your input has mixed telecined (30fps) and progressive content with a lower
  6658. framerate like 24fps use the following filterchain to produce the necessary cfr
  6659. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  6660. The filter accepts the following options:
  6661. @table @option
  6662. @item order
  6663. Specify the assumed field order of the input stream. Available values are:
  6664. @table @samp
  6665. @item auto
  6666. Auto detect parity (use FFmpeg's internal parity value).
  6667. @item bff
  6668. Assume bottom field first.
  6669. @item tff
  6670. Assume top field first.
  6671. @end table
  6672. Note that it is sometimes recommended not to trust the parity announced by the
  6673. stream.
  6674. Default value is @var{auto}.
  6675. @item mode
  6676. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  6677. sense that it won't risk creating jerkiness due to duplicate frames when
  6678. possible, but if there are bad edits or blended fields it will end up
  6679. outputting combed frames when a good match might actually exist. On the other
  6680. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  6681. but will almost always find a good frame if there is one. The other values are
  6682. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  6683. jerkiness and creating duplicate frames versus finding good matches in sections
  6684. with bad edits, orphaned fields, blended fields, etc.
  6685. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  6686. Available values are:
  6687. @table @samp
  6688. @item pc
  6689. 2-way matching (p/c)
  6690. @item pc_n
  6691. 2-way matching, and trying 3rd match if still combed (p/c + n)
  6692. @item pc_u
  6693. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  6694. @item pc_n_ub
  6695. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  6696. still combed (p/c + n + u/b)
  6697. @item pcn
  6698. 3-way matching (p/c/n)
  6699. @item pcn_ub
  6700. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  6701. detected as combed (p/c/n + u/b)
  6702. @end table
  6703. The parenthesis at the end indicate the matches that would be used for that
  6704. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  6705. @var{top}).
  6706. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  6707. the slowest.
  6708. Default value is @var{pc_n}.
  6709. @item ppsrc
  6710. Mark the main input stream as a pre-processed input, and enable the secondary
  6711. input stream as the clean source to pick the fields from. See the filter
  6712. introduction for more details. It is similar to the @option{clip2} feature from
  6713. VFM/TFM.
  6714. Default value is @code{0} (disabled).
  6715. @item field
  6716. Set the field to match from. It is recommended to set this to the same value as
  6717. @option{order} unless you experience matching failures with that setting. In
  6718. certain circumstances changing the field that is used to match from can have a
  6719. large impact on matching performance. Available values are:
  6720. @table @samp
  6721. @item auto
  6722. Automatic (same value as @option{order}).
  6723. @item bottom
  6724. Match from the bottom field.
  6725. @item top
  6726. Match from the top field.
  6727. @end table
  6728. Default value is @var{auto}.
  6729. @item mchroma
  6730. Set whether or not chroma is included during the match comparisons. In most
  6731. cases it is recommended to leave this enabled. You should set this to @code{0}
  6732. only if your clip has bad chroma problems such as heavy rainbowing or other
  6733. artifacts. Setting this to @code{0} could also be used to speed things up at
  6734. the cost of some accuracy.
  6735. Default value is @code{1}.
  6736. @item y0
  6737. @item y1
  6738. These define an exclusion band which excludes the lines between @option{y0} and
  6739. @option{y1} from being included in the field matching decision. An exclusion
  6740. band can be used to ignore subtitles, a logo, or other things that may
  6741. interfere with the matching. @option{y0} sets the starting scan line and
  6742. @option{y1} sets the ending line; all lines in between @option{y0} and
  6743. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6744. @option{y0} and @option{y1} to the same value will disable the feature.
  6745. @option{y0} and @option{y1} defaults to @code{0}.
  6746. @item scthresh
  6747. Set the scene change detection threshold as a percentage of maximum change on
  6748. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6749. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6750. @option{scthresh} is @code{[0.0, 100.0]}.
  6751. Default value is @code{12.0}.
  6752. @item combmatch
  6753. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6754. account the combed scores of matches when deciding what match to use as the
  6755. final match. Available values are:
  6756. @table @samp
  6757. @item none
  6758. No final matching based on combed scores.
  6759. @item sc
  6760. Combed scores are only used when a scene change is detected.
  6761. @item full
  6762. Use combed scores all the time.
  6763. @end table
  6764. Default is @var{sc}.
  6765. @item combdbg
  6766. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  6767. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  6768. Available values are:
  6769. @table @samp
  6770. @item none
  6771. No forced calculation.
  6772. @item pcn
  6773. Force p/c/n calculations.
  6774. @item pcnub
  6775. Force p/c/n/u/b calculations.
  6776. @end table
  6777. Default value is @var{none}.
  6778. @item cthresh
  6779. This is the area combing threshold used for combed frame detection. This
  6780. essentially controls how "strong" or "visible" combing must be to be detected.
  6781. Larger values mean combing must be more visible and smaller values mean combing
  6782. can be less visible or strong and still be detected. Valid settings are from
  6783. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6784. be detected as combed). This is basically a pixel difference value. A good
  6785. range is @code{[8, 12]}.
  6786. Default value is @code{9}.
  6787. @item chroma
  6788. Sets whether or not chroma is considered in the combed frame decision. Only
  6789. disable this if your source has chroma problems (rainbowing, etc.) that are
  6790. causing problems for the combed frame detection with chroma enabled. Actually,
  6791. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6792. where there is chroma only combing in the source.
  6793. Default value is @code{0}.
  6794. @item blockx
  6795. @item blocky
  6796. Respectively set the x-axis and y-axis size of the window used during combed
  6797. frame detection. This has to do with the size of the area in which
  6798. @option{combpel} pixels are required to be detected as combed for a frame to be
  6799. declared combed. See the @option{combpel} parameter description for more info.
  6800. Possible values are any number that is a power of 2 starting at 4 and going up
  6801. to 512.
  6802. Default value is @code{16}.
  6803. @item combpel
  6804. The number of combed pixels inside any of the @option{blocky} by
  6805. @option{blockx} size blocks on the frame for the frame to be detected as
  6806. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6807. setting controls "how much" combing there must be in any localized area (a
  6808. window defined by the @option{blockx} and @option{blocky} settings) on the
  6809. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6810. which point no frames will ever be detected as combed). This setting is known
  6811. as @option{MI} in TFM/VFM vocabulary.
  6812. Default value is @code{80}.
  6813. @end table
  6814. @anchor{p/c/n/u/b meaning}
  6815. @subsection p/c/n/u/b meaning
  6816. @subsubsection p/c/n
  6817. We assume the following telecined stream:
  6818. @example
  6819. Top fields: 1 2 2 3 4
  6820. Bottom fields: 1 2 3 4 4
  6821. @end example
  6822. The numbers correspond to the progressive frame the fields relate to. Here, the
  6823. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6824. When @code{fieldmatch} is configured to run a matching from bottom
  6825. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6826. @example
  6827. Input stream:
  6828. T 1 2 2 3 4
  6829. B 1 2 3 4 4 <-- matching reference
  6830. Matches: c c n n c
  6831. Output stream:
  6832. T 1 2 3 4 4
  6833. B 1 2 3 4 4
  6834. @end example
  6835. As a result of the field matching, we can see that some frames get duplicated.
  6836. To perform a complete inverse telecine, you need to rely on a decimation filter
  6837. after this operation. See for instance the @ref{decimate} filter.
  6838. The same operation now matching from top fields (@option{field}=@var{top})
  6839. looks like this:
  6840. @example
  6841. Input stream:
  6842. T 1 2 2 3 4 <-- matching reference
  6843. B 1 2 3 4 4
  6844. Matches: c c p p c
  6845. Output stream:
  6846. T 1 2 2 3 4
  6847. B 1 2 2 3 4
  6848. @end example
  6849. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6850. basically, they refer to the frame and field of the opposite parity:
  6851. @itemize
  6852. @item @var{p} matches the field of the opposite parity in the previous frame
  6853. @item @var{c} matches the field of the opposite parity in the current frame
  6854. @item @var{n} matches the field of the opposite parity in the next frame
  6855. @end itemize
  6856. @subsubsection u/b
  6857. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6858. from the opposite parity flag. In the following examples, we assume that we are
  6859. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6860. 'x' is placed above and below each matched fields.
  6861. With bottom matching (@option{field}=@var{bottom}):
  6862. @example
  6863. Match: c p n b u
  6864. x x x x x
  6865. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6866. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6867. x x x x x
  6868. Output frames:
  6869. 2 1 2 2 2
  6870. 2 2 2 1 3
  6871. @end example
  6872. With top matching (@option{field}=@var{top}):
  6873. @example
  6874. Match: c p n b u
  6875. x x x x x
  6876. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6877. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6878. x x x x x
  6879. Output frames:
  6880. 2 2 2 1 2
  6881. 2 1 3 2 2
  6882. @end example
  6883. @subsection Examples
  6884. Simple IVTC of a top field first telecined stream:
  6885. @example
  6886. fieldmatch=order=tff:combmatch=none, decimate
  6887. @end example
  6888. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6889. @example
  6890. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6891. @end example
  6892. @section fieldorder
  6893. Transform the field order of the input video.
  6894. It accepts the following parameters:
  6895. @table @option
  6896. @item order
  6897. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6898. for bottom field first.
  6899. @end table
  6900. The default value is @samp{tff}.
  6901. The transformation is done by shifting the picture content up or down
  6902. by one line, and filling the remaining line with appropriate picture content.
  6903. This method is consistent with most broadcast field order converters.
  6904. If the input video is not flagged as being interlaced, or it is already
  6905. flagged as being of the required output field order, then this filter does
  6906. not alter the incoming video.
  6907. It is very useful when converting to or from PAL DV material,
  6908. which is bottom field first.
  6909. For example:
  6910. @example
  6911. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6912. @end example
  6913. @section fifo, afifo
  6914. Buffer input images and send them when they are requested.
  6915. It is mainly useful when auto-inserted by the libavfilter
  6916. framework.
  6917. It does not take parameters.
  6918. @section fillborders
  6919. Fill borders of the input video, without changing video stream dimensions.
  6920. Sometimes video can have garbage at the four edges and you may not want to
  6921. crop video input to keep size multiple of some number.
  6922. This filter accepts the following options:
  6923. @table @option
  6924. @item left
  6925. Number of pixels to fill from left border.
  6926. @item right
  6927. Number of pixels to fill from right border.
  6928. @item top
  6929. Number of pixels to fill from top border.
  6930. @item bottom
  6931. Number of pixels to fill from bottom border.
  6932. @item mode
  6933. Set fill mode.
  6934. It accepts the following values:
  6935. @table @samp
  6936. @item smear
  6937. fill pixels using outermost pixels
  6938. @item mirror
  6939. fill pixels using mirroring
  6940. @item fixed
  6941. fill pixels with constant value
  6942. @end table
  6943. Default is @var{smear}.
  6944. @item color
  6945. Set color for pixels in fixed mode. Default is @var{black}.
  6946. @end table
  6947. @section find_rect
  6948. Find a rectangular object
  6949. It accepts the following options:
  6950. @table @option
  6951. @item object
  6952. Filepath of the object image, needs to be in gray8.
  6953. @item threshold
  6954. Detection threshold, default is 0.5.
  6955. @item mipmaps
  6956. Number of mipmaps, default is 3.
  6957. @item xmin, ymin, xmax, ymax
  6958. Specifies the rectangle in which to search.
  6959. @end table
  6960. @subsection Examples
  6961. @itemize
  6962. @item
  6963. Generate a representative palette of a given video using @command{ffmpeg}:
  6964. @example
  6965. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6966. @end example
  6967. @end itemize
  6968. @section cover_rect
  6969. Cover a rectangular object
  6970. It accepts the following options:
  6971. @table @option
  6972. @item cover
  6973. Filepath of the optional cover image, needs to be in yuv420.
  6974. @item mode
  6975. Set covering mode.
  6976. It accepts the following values:
  6977. @table @samp
  6978. @item cover
  6979. cover it by the supplied image
  6980. @item blur
  6981. cover it by interpolating the surrounding pixels
  6982. @end table
  6983. Default value is @var{blur}.
  6984. @end table
  6985. @subsection Examples
  6986. @itemize
  6987. @item
  6988. Generate a representative palette of a given video using @command{ffmpeg}:
  6989. @example
  6990. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6991. @end example
  6992. @end itemize
  6993. @section floodfill
  6994. Flood area with values of same pixel components with another values.
  6995. It accepts the following options:
  6996. @table @option
  6997. @item x
  6998. Set pixel x coordinate.
  6999. @item y
  7000. Set pixel y coordinate.
  7001. @item s0
  7002. Set source #0 component value.
  7003. @item s1
  7004. Set source #1 component value.
  7005. @item s2
  7006. Set source #2 component value.
  7007. @item s3
  7008. Set source #3 component value.
  7009. @item d0
  7010. Set destination #0 component value.
  7011. @item d1
  7012. Set destination #1 component value.
  7013. @item d2
  7014. Set destination #2 component value.
  7015. @item d3
  7016. Set destination #3 component value.
  7017. @end table
  7018. @anchor{format}
  7019. @section format
  7020. Convert the input video to one of the specified pixel formats.
  7021. Libavfilter will try to pick one that is suitable as input to
  7022. the next filter.
  7023. It accepts the following parameters:
  7024. @table @option
  7025. @item pix_fmts
  7026. A '|'-separated list of pixel format names, such as
  7027. "pix_fmts=yuv420p|monow|rgb24".
  7028. @end table
  7029. @subsection Examples
  7030. @itemize
  7031. @item
  7032. Convert the input video to the @var{yuv420p} format
  7033. @example
  7034. format=pix_fmts=yuv420p
  7035. @end example
  7036. Convert the input video to any of the formats in the list
  7037. @example
  7038. format=pix_fmts=yuv420p|yuv444p|yuv410p
  7039. @end example
  7040. @end itemize
  7041. @anchor{fps}
  7042. @section fps
  7043. Convert the video to specified constant frame rate by duplicating or dropping
  7044. frames as necessary.
  7045. It accepts the following parameters:
  7046. @table @option
  7047. @item fps
  7048. The desired output frame rate. The default is @code{25}.
  7049. @item start_time
  7050. Assume the first PTS should be the given value, in seconds. This allows for
  7051. padding/trimming at the start of stream. By default, no assumption is made
  7052. about the first frame's expected PTS, so no padding or trimming is done.
  7053. For example, this could be set to 0 to pad the beginning with duplicates of
  7054. the first frame if a video stream starts after the audio stream or to trim any
  7055. frames with a negative PTS.
  7056. @item round
  7057. Timestamp (PTS) rounding method.
  7058. Possible values are:
  7059. @table @option
  7060. @item zero
  7061. round towards 0
  7062. @item inf
  7063. round away from 0
  7064. @item down
  7065. round towards -infinity
  7066. @item up
  7067. round towards +infinity
  7068. @item near
  7069. round to nearest
  7070. @end table
  7071. The default is @code{near}.
  7072. @item eof_action
  7073. Action performed when reading the last frame.
  7074. Possible values are:
  7075. @table @option
  7076. @item round
  7077. Use same timestamp rounding method as used for other frames.
  7078. @item pass
  7079. Pass through last frame if input duration has not been reached yet.
  7080. @end table
  7081. The default is @code{round}.
  7082. @end table
  7083. Alternatively, the options can be specified as a flat string:
  7084. @var{fps}[:@var{start_time}[:@var{round}]].
  7085. See also the @ref{setpts} filter.
  7086. @subsection Examples
  7087. @itemize
  7088. @item
  7089. A typical usage in order to set the fps to 25:
  7090. @example
  7091. fps=fps=25
  7092. @end example
  7093. @item
  7094. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  7095. @example
  7096. fps=fps=film:round=near
  7097. @end example
  7098. @end itemize
  7099. @section framepack
  7100. Pack two different video streams into a stereoscopic video, setting proper
  7101. metadata on supported codecs. The two views should have the same size and
  7102. framerate and processing will stop when the shorter video ends. Please note
  7103. that you may conveniently adjust view properties with the @ref{scale} and
  7104. @ref{fps} filters.
  7105. It accepts the following parameters:
  7106. @table @option
  7107. @item format
  7108. The desired packing format. Supported values are:
  7109. @table @option
  7110. @item sbs
  7111. The views are next to each other (default).
  7112. @item tab
  7113. The views are on top of each other.
  7114. @item lines
  7115. The views are packed by line.
  7116. @item columns
  7117. The views are packed by column.
  7118. @item frameseq
  7119. The views are temporally interleaved.
  7120. @end table
  7121. @end table
  7122. Some examples:
  7123. @example
  7124. # Convert left and right views into a frame-sequential video
  7125. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  7126. # Convert views into a side-by-side video with the same output resolution as the input
  7127. 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
  7128. @end example
  7129. @section framerate
  7130. Change the frame rate by interpolating new video output frames from the source
  7131. frames.
  7132. This filter is not designed to function correctly with interlaced media. If
  7133. you wish to change the frame rate of interlaced media then you are required
  7134. to deinterlace before this filter and re-interlace after this filter.
  7135. A description of the accepted options follows.
  7136. @table @option
  7137. @item fps
  7138. Specify the output frames per second. This option can also be specified
  7139. as a value alone. The default is @code{50}.
  7140. @item interp_start
  7141. Specify the start of a range where the output frame will be created as a
  7142. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7143. the default is @code{15}.
  7144. @item interp_end
  7145. Specify the end of a range where the output frame will be created as a
  7146. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7147. the default is @code{240}.
  7148. @item scene
  7149. Specify the level at which a scene change is detected as a value between
  7150. 0 and 100 to indicate a new scene; a low value reflects a low
  7151. probability for the current frame to introduce a new scene, while a higher
  7152. value means the current frame is more likely to be one.
  7153. The default is @code{8.2}.
  7154. @item flags
  7155. Specify flags influencing the filter process.
  7156. Available value for @var{flags} is:
  7157. @table @option
  7158. @item scene_change_detect, scd
  7159. Enable scene change detection using the value of the option @var{scene}.
  7160. This flag is enabled by default.
  7161. @end table
  7162. @end table
  7163. @section framestep
  7164. Select one frame every N-th frame.
  7165. This filter accepts the following option:
  7166. @table @option
  7167. @item step
  7168. Select frame after every @code{step} frames.
  7169. Allowed values are positive integers higher than 0. Default value is @code{1}.
  7170. @end table
  7171. @anchor{frei0r}
  7172. @section frei0r
  7173. Apply a frei0r effect to the input video.
  7174. To enable the compilation of this filter, you need to install the frei0r
  7175. header and configure FFmpeg with @code{--enable-frei0r}.
  7176. It accepts the following parameters:
  7177. @table @option
  7178. @item filter_name
  7179. The name of the frei0r effect to load. If the environment variable
  7180. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  7181. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  7182. Otherwise, the standard frei0r paths are searched, in this order:
  7183. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  7184. @file{/usr/lib/frei0r-1/}.
  7185. @item filter_params
  7186. A '|'-separated list of parameters to pass to the frei0r effect.
  7187. @end table
  7188. A frei0r effect parameter can be a boolean (its value is either
  7189. "y" or "n"), a double, a color (specified as
  7190. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  7191. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  7192. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  7193. a position (specified as @var{X}/@var{Y}, where
  7194. @var{X} and @var{Y} are floating point numbers) and/or a string.
  7195. The number and types of parameters depend on the loaded effect. If an
  7196. effect parameter is not specified, the default value is set.
  7197. @subsection Examples
  7198. @itemize
  7199. @item
  7200. Apply the distort0r effect, setting the first two double parameters:
  7201. @example
  7202. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  7203. @end example
  7204. @item
  7205. Apply the colordistance effect, taking a color as the first parameter:
  7206. @example
  7207. frei0r=colordistance:0.2/0.3/0.4
  7208. frei0r=colordistance:violet
  7209. frei0r=colordistance:0x112233
  7210. @end example
  7211. @item
  7212. Apply the perspective effect, specifying the top left and top right image
  7213. positions:
  7214. @example
  7215. frei0r=perspective:0.2/0.2|0.8/0.2
  7216. @end example
  7217. @end itemize
  7218. For more information, see
  7219. @url{http://frei0r.dyne.org}
  7220. @section fspp
  7221. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  7222. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  7223. processing filter, one of them is performed once per block, not per pixel.
  7224. This allows for much higher speed.
  7225. The filter accepts the following options:
  7226. @table @option
  7227. @item quality
  7228. Set quality. This option defines the number of levels for averaging. It accepts
  7229. an integer in the range 4-5. Default value is @code{4}.
  7230. @item qp
  7231. Force a constant quantization parameter. It accepts an integer in range 0-63.
  7232. If not set, the filter will use the QP from the video stream (if available).
  7233. @item strength
  7234. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  7235. more details but also more artifacts, while higher values make the image smoother
  7236. but also blurrier. Default value is @code{0} − PSNR optimal.
  7237. @item use_bframe_qp
  7238. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  7239. option may cause flicker since the B-Frames have often larger QP. Default is
  7240. @code{0} (not enabled).
  7241. @end table
  7242. @section gblur
  7243. Apply Gaussian blur filter.
  7244. The filter accepts the following options:
  7245. @table @option
  7246. @item sigma
  7247. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  7248. @item steps
  7249. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  7250. @item planes
  7251. Set which planes to filter. By default all planes are filtered.
  7252. @item sigmaV
  7253. Set vertical sigma, if negative it will be same as @code{sigma}.
  7254. Default is @code{-1}.
  7255. @end table
  7256. @section geq
  7257. The filter accepts the following options:
  7258. @table @option
  7259. @item lum_expr, lum
  7260. Set the luminance expression.
  7261. @item cb_expr, cb
  7262. Set the chrominance blue expression.
  7263. @item cr_expr, cr
  7264. Set the chrominance red expression.
  7265. @item alpha_expr, a
  7266. Set the alpha expression.
  7267. @item red_expr, r
  7268. Set the red expression.
  7269. @item green_expr, g
  7270. Set the green expression.
  7271. @item blue_expr, b
  7272. Set the blue expression.
  7273. @end table
  7274. The colorspace is selected according to the specified options. If one
  7275. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  7276. options is specified, the filter will automatically select a YCbCr
  7277. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  7278. @option{blue_expr} options is specified, it will select an RGB
  7279. colorspace.
  7280. If one of the chrominance expression is not defined, it falls back on the other
  7281. one. If no alpha expression is specified it will evaluate to opaque value.
  7282. If none of chrominance expressions are specified, they will evaluate
  7283. to the luminance expression.
  7284. The expressions can use the following variables and functions:
  7285. @table @option
  7286. @item N
  7287. The sequential number of the filtered frame, starting from @code{0}.
  7288. @item X
  7289. @item Y
  7290. The coordinates of the current sample.
  7291. @item W
  7292. @item H
  7293. The width and height of the image.
  7294. @item SW
  7295. @item SH
  7296. Width and height scale depending on the currently filtered plane. It is the
  7297. ratio between the corresponding luma plane number of pixels and the current
  7298. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  7299. @code{0.5,0.5} for chroma planes.
  7300. @item T
  7301. Time of the current frame, expressed in seconds.
  7302. @item p(x, y)
  7303. Return the value of the pixel at location (@var{x},@var{y}) of the current
  7304. plane.
  7305. @item lum(x, y)
  7306. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  7307. plane.
  7308. @item cb(x, y)
  7309. Return the value of the pixel at location (@var{x},@var{y}) of the
  7310. blue-difference chroma plane. Return 0 if there is no such plane.
  7311. @item cr(x, y)
  7312. Return the value of the pixel at location (@var{x},@var{y}) of the
  7313. red-difference chroma plane. Return 0 if there is no such plane.
  7314. @item r(x, y)
  7315. @item g(x, y)
  7316. @item b(x, y)
  7317. Return the value of the pixel at location (@var{x},@var{y}) of the
  7318. red/green/blue component. Return 0 if there is no such component.
  7319. @item alpha(x, y)
  7320. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  7321. plane. Return 0 if there is no such plane.
  7322. @end table
  7323. For functions, if @var{x} and @var{y} are outside the area, the value will be
  7324. automatically clipped to the closer edge.
  7325. @subsection Examples
  7326. @itemize
  7327. @item
  7328. Flip the image horizontally:
  7329. @example
  7330. geq=p(W-X\,Y)
  7331. @end example
  7332. @item
  7333. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  7334. wavelength of 100 pixels:
  7335. @example
  7336. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  7337. @end example
  7338. @item
  7339. Generate a fancy enigmatic moving light:
  7340. @example
  7341. 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
  7342. @end example
  7343. @item
  7344. Generate a quick emboss effect:
  7345. @example
  7346. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  7347. @end example
  7348. @item
  7349. Modify RGB components depending on pixel position:
  7350. @example
  7351. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  7352. @end example
  7353. @item
  7354. Create a radial gradient that is the same size as the input (also see
  7355. the @ref{vignette} filter):
  7356. @example
  7357. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  7358. @end example
  7359. @end itemize
  7360. @section gradfun
  7361. Fix the banding artifacts that are sometimes introduced into nearly flat
  7362. regions by truncation to 8-bit color depth.
  7363. Interpolate the gradients that should go where the bands are, and
  7364. dither them.
  7365. It is designed for playback only. Do not use it prior to
  7366. lossy compression, because compression tends to lose the dither and
  7367. bring back the bands.
  7368. It accepts the following parameters:
  7369. @table @option
  7370. @item strength
  7371. The maximum amount by which the filter will change any one pixel. This is also
  7372. the threshold for detecting nearly flat regions. Acceptable values range from
  7373. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  7374. valid range.
  7375. @item radius
  7376. The neighborhood to fit the gradient to. A larger radius makes for smoother
  7377. gradients, but also prevents the filter from modifying the pixels near detailed
  7378. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  7379. values will be clipped to the valid range.
  7380. @end table
  7381. Alternatively, the options can be specified as a flat string:
  7382. @var{strength}[:@var{radius}]
  7383. @subsection Examples
  7384. @itemize
  7385. @item
  7386. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  7387. @example
  7388. gradfun=3.5:8
  7389. @end example
  7390. @item
  7391. Specify radius, omitting the strength (which will fall-back to the default
  7392. value):
  7393. @example
  7394. gradfun=radius=8
  7395. @end example
  7396. @end itemize
  7397. @anchor{haldclut}
  7398. @section haldclut
  7399. Apply a Hald CLUT to a video stream.
  7400. First input is the video stream to process, and second one is the Hald CLUT.
  7401. The Hald CLUT input can be a simple picture or a complete video stream.
  7402. The filter accepts the following options:
  7403. @table @option
  7404. @item shortest
  7405. Force termination when the shortest input terminates. Default is @code{0}.
  7406. @item repeatlast
  7407. Continue applying the last CLUT after the end of the stream. A value of
  7408. @code{0} disable the filter after the last frame of the CLUT is reached.
  7409. Default is @code{1}.
  7410. @end table
  7411. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  7412. filters share the same internals).
  7413. More information about the Hald CLUT can be found on Eskil Steenberg's website
  7414. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  7415. @subsection Workflow examples
  7416. @subsubsection Hald CLUT video stream
  7417. Generate an identity Hald CLUT stream altered with various effects:
  7418. @example
  7419. 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
  7420. @end example
  7421. Note: make sure you use a lossless codec.
  7422. Then use it with @code{haldclut} to apply it on some random stream:
  7423. @example
  7424. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  7425. @end example
  7426. The Hald CLUT will be applied to the 10 first seconds (duration of
  7427. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  7428. to the remaining frames of the @code{mandelbrot} stream.
  7429. @subsubsection Hald CLUT with preview
  7430. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  7431. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  7432. biggest possible square starting at the top left of the picture. The remaining
  7433. padding pixels (bottom or right) will be ignored. This area can be used to add
  7434. a preview of the Hald CLUT.
  7435. Typically, the following generated Hald CLUT will be supported by the
  7436. @code{haldclut} filter:
  7437. @example
  7438. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  7439. pad=iw+320 [padded_clut];
  7440. smptebars=s=320x256, split [a][b];
  7441. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  7442. [main][b] overlay=W-320" -frames:v 1 clut.png
  7443. @end example
  7444. It contains the original and a preview of the effect of the CLUT: SMPTE color
  7445. bars are displayed on the right-top, and below the same color bars processed by
  7446. the color changes.
  7447. Then, the effect of this Hald CLUT can be visualized with:
  7448. @example
  7449. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  7450. @end example
  7451. @section hflip
  7452. Flip the input video horizontally.
  7453. For example, to horizontally flip the input video with @command{ffmpeg}:
  7454. @example
  7455. ffmpeg -i in.avi -vf "hflip" out.avi
  7456. @end example
  7457. @section histeq
  7458. This filter applies a global color histogram equalization on a
  7459. per-frame basis.
  7460. It can be used to correct video that has a compressed range of pixel
  7461. intensities. The filter redistributes the pixel intensities to
  7462. equalize their distribution across the intensity range. It may be
  7463. viewed as an "automatically adjusting contrast filter". This filter is
  7464. useful only for correcting degraded or poorly captured source
  7465. video.
  7466. The filter accepts the following options:
  7467. @table @option
  7468. @item strength
  7469. Determine the amount of equalization to be applied. As the strength
  7470. is reduced, the distribution of pixel intensities more-and-more
  7471. approaches that of the input frame. The value must be a float number
  7472. in the range [0,1] and defaults to 0.200.
  7473. @item intensity
  7474. Set the maximum intensity that can generated and scale the output
  7475. values appropriately. The strength should be set as desired and then
  7476. the intensity can be limited if needed to avoid washing-out. The value
  7477. must be a float number in the range [0,1] and defaults to 0.210.
  7478. @item antibanding
  7479. Set the antibanding level. If enabled the filter will randomly vary
  7480. the luminance of output pixels by a small amount to avoid banding of
  7481. the histogram. Possible values are @code{none}, @code{weak} or
  7482. @code{strong}. It defaults to @code{none}.
  7483. @end table
  7484. @section histogram
  7485. Compute and draw a color distribution histogram for the input video.
  7486. The computed histogram is a representation of the color component
  7487. distribution in an image.
  7488. Standard histogram displays the color components distribution in an image.
  7489. Displays color graph for each color component. Shows distribution of
  7490. the Y, U, V, A or R, G, B components, depending on input format, in the
  7491. current frame. Below each graph a color component scale meter is shown.
  7492. The filter accepts the following options:
  7493. @table @option
  7494. @item level_height
  7495. Set height of level. Default value is @code{200}.
  7496. Allowed range is [50, 2048].
  7497. @item scale_height
  7498. Set height of color scale. Default value is @code{12}.
  7499. Allowed range is [0, 40].
  7500. @item display_mode
  7501. Set display mode.
  7502. It accepts the following values:
  7503. @table @samp
  7504. @item stack
  7505. Per color component graphs are placed below each other.
  7506. @item parade
  7507. Per color component graphs are placed side by side.
  7508. @item overlay
  7509. Presents information identical to that in the @code{parade}, except
  7510. that the graphs representing color components are superimposed directly
  7511. over one another.
  7512. @end table
  7513. Default is @code{stack}.
  7514. @item levels_mode
  7515. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  7516. Default is @code{linear}.
  7517. @item components
  7518. Set what color components to display.
  7519. Default is @code{7}.
  7520. @item fgopacity
  7521. Set foreground opacity. Default is @code{0.7}.
  7522. @item bgopacity
  7523. Set background opacity. Default is @code{0.5}.
  7524. @end table
  7525. @subsection Examples
  7526. @itemize
  7527. @item
  7528. Calculate and draw histogram:
  7529. @example
  7530. ffplay -i input -vf histogram
  7531. @end example
  7532. @end itemize
  7533. @anchor{hqdn3d}
  7534. @section hqdn3d
  7535. This is a high precision/quality 3d denoise filter. It aims to reduce
  7536. image noise, producing smooth images and making still images really
  7537. still. It should enhance compressibility.
  7538. It accepts the following optional parameters:
  7539. @table @option
  7540. @item luma_spatial
  7541. A non-negative floating point number which specifies spatial luma strength.
  7542. It defaults to 4.0.
  7543. @item chroma_spatial
  7544. A non-negative floating point number which specifies spatial chroma strength.
  7545. It defaults to 3.0*@var{luma_spatial}/4.0.
  7546. @item luma_tmp
  7547. A floating point number which specifies luma temporal strength. It defaults to
  7548. 6.0*@var{luma_spatial}/4.0.
  7549. @item chroma_tmp
  7550. A floating point number which specifies chroma temporal strength. It defaults to
  7551. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  7552. @end table
  7553. @section hwdownload
  7554. Download hardware frames to system memory.
  7555. The input must be in hardware frames, and the output a non-hardware format.
  7556. Not all formats will be supported on the output - it may be necessary to insert
  7557. an additional @option{format} filter immediately following in the graph to get
  7558. the output in a supported format.
  7559. @section hwmap
  7560. Map hardware frames to system memory or to another device.
  7561. This filter has several different modes of operation; which one is used depends
  7562. on the input and output formats:
  7563. @itemize
  7564. @item
  7565. Hardware frame input, normal frame output
  7566. Map the input frames to system memory and pass them to the output. If the
  7567. original hardware frame is later required (for example, after overlaying
  7568. something else on part of it), the @option{hwmap} filter can be used again
  7569. in the next mode to retrieve it.
  7570. @item
  7571. Normal frame input, hardware frame output
  7572. If the input is actually a software-mapped hardware frame, then unmap it -
  7573. that is, return the original hardware frame.
  7574. Otherwise, a device must be provided. Create new hardware surfaces on that
  7575. device for the output, then map them back to the software format at the input
  7576. and give those frames to the preceding filter. This will then act like the
  7577. @option{hwupload} filter, but may be able to avoid an additional copy when
  7578. the input is already in a compatible format.
  7579. @item
  7580. Hardware frame input and output
  7581. A device must be supplied for the output, either directly or with the
  7582. @option{derive_device} option. The input and output devices must be of
  7583. different types and compatible - the exact meaning of this is
  7584. system-dependent, but typically it means that they must refer to the same
  7585. underlying hardware context (for example, refer to the same graphics card).
  7586. If the input frames were originally created on the output device, then unmap
  7587. to retrieve the original frames.
  7588. Otherwise, map the frames to the output device - create new hardware frames
  7589. on the output corresponding to the frames on the input.
  7590. @end itemize
  7591. The following additional parameters are accepted:
  7592. @table @option
  7593. @item mode
  7594. Set the frame mapping mode. Some combination of:
  7595. @table @var
  7596. @item read
  7597. The mapped frame should be readable.
  7598. @item write
  7599. The mapped frame should be writeable.
  7600. @item overwrite
  7601. The mapping will always overwrite the entire frame.
  7602. This may improve performance in some cases, as the original contents of the
  7603. frame need not be loaded.
  7604. @item direct
  7605. The mapping must not involve any copying.
  7606. Indirect mappings to copies of frames are created in some cases where either
  7607. direct mapping is not possible or it would have unexpected properties.
  7608. Setting this flag ensures that the mapping is direct and will fail if that is
  7609. not possible.
  7610. @end table
  7611. Defaults to @var{read+write} if not specified.
  7612. @item derive_device @var{type}
  7613. Rather than using the device supplied at initialisation, instead derive a new
  7614. device of type @var{type} from the device the input frames exist on.
  7615. @item reverse
  7616. In a hardware to hardware mapping, map in reverse - create frames in the sink
  7617. and map them back to the source. This may be necessary in some cases where
  7618. a mapping in one direction is required but only the opposite direction is
  7619. supported by the devices being used.
  7620. This option is dangerous - it may break the preceding filter in undefined
  7621. ways if there are any additional constraints on that filter's output.
  7622. Do not use it without fully understanding the implications of its use.
  7623. @end table
  7624. @section hwupload
  7625. Upload system memory frames to hardware surfaces.
  7626. The device to upload to must be supplied when the filter is initialised. If
  7627. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  7628. option.
  7629. @anchor{hwupload_cuda}
  7630. @section hwupload_cuda
  7631. Upload system memory frames to a CUDA device.
  7632. It accepts the following optional parameters:
  7633. @table @option
  7634. @item device
  7635. The number of the CUDA device to use
  7636. @end table
  7637. @section hqx
  7638. Apply a high-quality magnification filter designed for pixel art. This filter
  7639. was originally created by Maxim Stepin.
  7640. It accepts the following option:
  7641. @table @option
  7642. @item n
  7643. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  7644. @code{hq3x} and @code{4} for @code{hq4x}.
  7645. Default is @code{3}.
  7646. @end table
  7647. @section hstack
  7648. Stack input videos horizontally.
  7649. All streams must be of same pixel format and of same height.
  7650. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  7651. to create same output.
  7652. The filter accept the following option:
  7653. @table @option
  7654. @item inputs
  7655. Set number of input streams. Default is 2.
  7656. @item shortest
  7657. If set to 1, force the output to terminate when the shortest input
  7658. terminates. Default value is 0.
  7659. @end table
  7660. @section hue
  7661. Modify the hue and/or the saturation of the input.
  7662. It accepts the following parameters:
  7663. @table @option
  7664. @item h
  7665. Specify the hue angle as a number of degrees. It accepts an expression,
  7666. and defaults to "0".
  7667. @item s
  7668. Specify the saturation in the [-10,10] range. It accepts an expression and
  7669. defaults to "1".
  7670. @item H
  7671. Specify the hue angle as a number of radians. It accepts an
  7672. expression, and defaults to "0".
  7673. @item b
  7674. Specify the brightness in the [-10,10] range. It accepts an expression and
  7675. defaults to "0".
  7676. @end table
  7677. @option{h} and @option{H} are mutually exclusive, and can't be
  7678. specified at the same time.
  7679. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  7680. expressions containing the following constants:
  7681. @table @option
  7682. @item n
  7683. frame count of the input frame starting from 0
  7684. @item pts
  7685. presentation timestamp of the input frame expressed in time base units
  7686. @item r
  7687. frame rate of the input video, NAN if the input frame rate is unknown
  7688. @item t
  7689. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7690. @item tb
  7691. time base of the input video
  7692. @end table
  7693. @subsection Examples
  7694. @itemize
  7695. @item
  7696. Set the hue to 90 degrees and the saturation to 1.0:
  7697. @example
  7698. hue=h=90:s=1
  7699. @end example
  7700. @item
  7701. Same command but expressing the hue in radians:
  7702. @example
  7703. hue=H=PI/2:s=1
  7704. @end example
  7705. @item
  7706. Rotate hue and make the saturation swing between 0
  7707. and 2 over a period of 1 second:
  7708. @example
  7709. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  7710. @end example
  7711. @item
  7712. Apply a 3 seconds saturation fade-in effect starting at 0:
  7713. @example
  7714. hue="s=min(t/3\,1)"
  7715. @end example
  7716. The general fade-in expression can be written as:
  7717. @example
  7718. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  7719. @end example
  7720. @item
  7721. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  7722. @example
  7723. hue="s=max(0\, min(1\, (8-t)/3))"
  7724. @end example
  7725. The general fade-out expression can be written as:
  7726. @example
  7727. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  7728. @end example
  7729. @end itemize
  7730. @subsection Commands
  7731. This filter supports the following commands:
  7732. @table @option
  7733. @item b
  7734. @item s
  7735. @item h
  7736. @item H
  7737. Modify the hue and/or the saturation and/or brightness of the input video.
  7738. The command accepts the same syntax of the corresponding option.
  7739. If the specified expression is not valid, it is kept at its current
  7740. value.
  7741. @end table
  7742. @section hysteresis
  7743. Grow first stream into second stream by connecting components.
  7744. This makes it possible to build more robust edge masks.
  7745. This filter accepts the following options:
  7746. @table @option
  7747. @item planes
  7748. Set which planes will be processed as bitmap, unprocessed planes will be
  7749. copied from first stream.
  7750. By default value 0xf, all planes will be processed.
  7751. @item threshold
  7752. Set threshold which is used in filtering. If pixel component value is higher than
  7753. this value filter algorithm for connecting components is activated.
  7754. By default value is 0.
  7755. @end table
  7756. @section idet
  7757. Detect video interlacing type.
  7758. This filter tries to detect if the input frames are interlaced, progressive,
  7759. top or bottom field first. It will also try to detect fields that are
  7760. repeated between adjacent frames (a sign of telecine).
  7761. Single frame detection considers only immediately adjacent frames when classifying each frame.
  7762. Multiple frame detection incorporates the classification history of previous frames.
  7763. The filter will log these metadata values:
  7764. @table @option
  7765. @item single.current_frame
  7766. Detected type of current frame using single-frame detection. One of:
  7767. ``tff'' (top field first), ``bff'' (bottom field first),
  7768. ``progressive'', or ``undetermined''
  7769. @item single.tff
  7770. Cumulative number of frames detected as top field first using single-frame detection.
  7771. @item multiple.tff
  7772. Cumulative number of frames detected as top field first using multiple-frame detection.
  7773. @item single.bff
  7774. Cumulative number of frames detected as bottom field first using single-frame detection.
  7775. @item multiple.current_frame
  7776. Detected type of current frame using multiple-frame detection. One of:
  7777. ``tff'' (top field first), ``bff'' (bottom field first),
  7778. ``progressive'', or ``undetermined''
  7779. @item multiple.bff
  7780. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  7781. @item single.progressive
  7782. Cumulative number of frames detected as progressive using single-frame detection.
  7783. @item multiple.progressive
  7784. Cumulative number of frames detected as progressive using multiple-frame detection.
  7785. @item single.undetermined
  7786. Cumulative number of frames that could not be classified using single-frame detection.
  7787. @item multiple.undetermined
  7788. Cumulative number of frames that could not be classified using multiple-frame detection.
  7789. @item repeated.current_frame
  7790. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  7791. @item repeated.neither
  7792. Cumulative number of frames with no repeated field.
  7793. @item repeated.top
  7794. Cumulative number of frames with the top field repeated from the previous frame's top field.
  7795. @item repeated.bottom
  7796. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  7797. @end table
  7798. The filter accepts the following options:
  7799. @table @option
  7800. @item intl_thres
  7801. Set interlacing threshold.
  7802. @item prog_thres
  7803. Set progressive threshold.
  7804. @item rep_thres
  7805. Threshold for repeated field detection.
  7806. @item half_life
  7807. Number of frames after which a given frame's contribution to the
  7808. statistics is halved (i.e., it contributes only 0.5 to its
  7809. classification). The default of 0 means that all frames seen are given
  7810. full weight of 1.0 forever.
  7811. @item analyze_interlaced_flag
  7812. When this is not 0 then idet will use the specified number of frames to determine
  7813. if the interlaced flag is accurate, it will not count undetermined frames.
  7814. If the flag is found to be accurate it will be used without any further
  7815. computations, if it is found to be inaccurate it will be cleared without any
  7816. further computations. This allows inserting the idet filter as a low computational
  7817. method to clean up the interlaced flag
  7818. @end table
  7819. @section il
  7820. Deinterleave or interleave fields.
  7821. This filter allows one to process interlaced images fields without
  7822. deinterlacing them. Deinterleaving splits the input frame into 2
  7823. fields (so called half pictures). Odd lines are moved to the top
  7824. half of the output image, even lines to the bottom half.
  7825. You can process (filter) them independently and then re-interleave them.
  7826. The filter accepts the following options:
  7827. @table @option
  7828. @item luma_mode, l
  7829. @item chroma_mode, c
  7830. @item alpha_mode, a
  7831. Available values for @var{luma_mode}, @var{chroma_mode} and
  7832. @var{alpha_mode} are:
  7833. @table @samp
  7834. @item none
  7835. Do nothing.
  7836. @item deinterleave, d
  7837. Deinterleave fields, placing one above the other.
  7838. @item interleave, i
  7839. Interleave fields. Reverse the effect of deinterleaving.
  7840. @end table
  7841. Default value is @code{none}.
  7842. @item luma_swap, ls
  7843. @item chroma_swap, cs
  7844. @item alpha_swap, as
  7845. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  7846. @end table
  7847. @section inflate
  7848. Apply inflate effect to the video.
  7849. This filter replaces the pixel by the local(3x3) average by taking into account
  7850. only values higher than the pixel.
  7851. It accepts the following options:
  7852. @table @option
  7853. @item threshold0
  7854. @item threshold1
  7855. @item threshold2
  7856. @item threshold3
  7857. Limit the maximum change for each plane, default is 65535.
  7858. If 0, plane will remain unchanged.
  7859. @end table
  7860. @section interlace
  7861. Simple interlacing filter from progressive contents. This interleaves upper (or
  7862. lower) lines from odd frames with lower (or upper) lines from even frames,
  7863. halving the frame rate and preserving image height.
  7864. @example
  7865. Original Original New Frame
  7866. Frame 'j' Frame 'j+1' (tff)
  7867. ========== =========== ==================
  7868. Line 0 --------------------> Frame 'j' Line 0
  7869. Line 1 Line 1 ----> Frame 'j+1' Line 1
  7870. Line 2 ---------------------> Frame 'j' Line 2
  7871. Line 3 Line 3 ----> Frame 'j+1' Line 3
  7872. ... ... ...
  7873. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  7874. @end example
  7875. It accepts the following optional parameters:
  7876. @table @option
  7877. @item scan
  7878. This determines whether the interlaced frame is taken from the even
  7879. (tff - default) or odd (bff) lines of the progressive frame.
  7880. @item lowpass
  7881. Vertical lowpass filter to avoid twitter interlacing and
  7882. reduce moire patterns.
  7883. @table @samp
  7884. @item 0, off
  7885. Disable vertical lowpass filter
  7886. @item 1, linear
  7887. Enable linear filter (default)
  7888. @item 2, complex
  7889. Enable complex filter. This will slightly less reduce twitter and moire
  7890. but better retain detail and subjective sharpness impression.
  7891. @end table
  7892. @end table
  7893. @section kerndeint
  7894. Deinterlace input video by applying Donald Graft's adaptive kernel
  7895. deinterling. Work on interlaced parts of a video to produce
  7896. progressive frames.
  7897. The description of the accepted parameters follows.
  7898. @table @option
  7899. @item thresh
  7900. Set the threshold which affects the filter's tolerance when
  7901. determining if a pixel line must be processed. It must be an integer
  7902. in the range [0,255] and defaults to 10. A value of 0 will result in
  7903. applying the process on every pixels.
  7904. @item map
  7905. Paint pixels exceeding the threshold value to white if set to 1.
  7906. Default is 0.
  7907. @item order
  7908. Set the fields order. Swap fields if set to 1, leave fields alone if
  7909. 0. Default is 0.
  7910. @item sharp
  7911. Enable additional sharpening if set to 1. Default is 0.
  7912. @item twoway
  7913. Enable twoway sharpening if set to 1. Default is 0.
  7914. @end table
  7915. @subsection Examples
  7916. @itemize
  7917. @item
  7918. Apply default values:
  7919. @example
  7920. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  7921. @end example
  7922. @item
  7923. Enable additional sharpening:
  7924. @example
  7925. kerndeint=sharp=1
  7926. @end example
  7927. @item
  7928. Paint processed pixels in white:
  7929. @example
  7930. kerndeint=map=1
  7931. @end example
  7932. @end itemize
  7933. @section lenscorrection
  7934. Correct radial lens distortion
  7935. This filter can be used to correct for radial distortion as can result from the use
  7936. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  7937. one can use tools available for example as part of opencv or simply trial-and-error.
  7938. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  7939. and extract the k1 and k2 coefficients from the resulting matrix.
  7940. Note that effectively the same filter is available in the open-source tools Krita and
  7941. Digikam from the KDE project.
  7942. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  7943. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  7944. brightness distribution, so you may want to use both filters together in certain
  7945. cases, though you will have to take care of ordering, i.e. whether vignetting should
  7946. be applied before or after lens correction.
  7947. @subsection Options
  7948. The filter accepts the following options:
  7949. @table @option
  7950. @item cx
  7951. Relative x-coordinate of the focal point of the image, and thereby the center of the
  7952. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7953. width.
  7954. @item cy
  7955. Relative y-coordinate of the focal point of the image, and thereby the center of the
  7956. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7957. height.
  7958. @item k1
  7959. Coefficient of the quadratic correction term. 0.5 means no correction.
  7960. @item k2
  7961. Coefficient of the double quadratic correction term. 0.5 means no correction.
  7962. @end table
  7963. The formula that generates the correction is:
  7964. @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)
  7965. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  7966. distances from the focal point in the source and target images, respectively.
  7967. @section libvmaf
  7968. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  7969. score between two input videos.
  7970. The obtained VMAF score is printed through the logging system.
  7971. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  7972. After installing the library it can be enabled using:
  7973. @code{./configure --enable-libvmaf}.
  7974. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  7975. The filter has following options:
  7976. @table @option
  7977. @item model_path
  7978. Set the model path which is to be used for SVM.
  7979. Default value: @code{"vmaf_v0.6.1.pkl"}
  7980. @item log_path
  7981. Set the file path to be used to store logs.
  7982. @item log_fmt
  7983. Set the format of the log file (xml or json).
  7984. @item enable_transform
  7985. Enables transform for computing vmaf.
  7986. @item phone_model
  7987. Invokes the phone model which will generate VMAF scores higher than in the
  7988. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  7989. @item psnr
  7990. Enables computing psnr along with vmaf.
  7991. @item ssim
  7992. Enables computing ssim along with vmaf.
  7993. @item ms_ssim
  7994. Enables computing ms_ssim along with vmaf.
  7995. @item pool
  7996. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  7997. @end table
  7998. This filter also supports the @ref{framesync} options.
  7999. On the below examples the input file @file{main.mpg} being processed is
  8000. compared with the reference file @file{ref.mpg}.
  8001. @example
  8002. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  8003. @end example
  8004. Example with options:
  8005. @example
  8006. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
  8007. @end example
  8008. @section limiter
  8009. Limits the pixel components values to the specified range [min, max].
  8010. The filter accepts the following options:
  8011. @table @option
  8012. @item min
  8013. Lower bound. Defaults to the lowest allowed value for the input.
  8014. @item max
  8015. Upper bound. Defaults to the highest allowed value for the input.
  8016. @item planes
  8017. Specify which planes will be processed. Defaults to all available.
  8018. @end table
  8019. @section loop
  8020. Loop video frames.
  8021. The filter accepts the following options:
  8022. @table @option
  8023. @item loop
  8024. Set the number of loops. Setting this value to -1 will result in infinite loops.
  8025. Default is 0.
  8026. @item size
  8027. Set maximal size in number of frames. Default is 0.
  8028. @item start
  8029. Set first frame of loop. Default is 0.
  8030. @end table
  8031. @anchor{lut3d}
  8032. @section lut3d
  8033. Apply a 3D LUT to an input video.
  8034. The filter accepts the following options:
  8035. @table @option
  8036. @item file
  8037. Set the 3D LUT file name.
  8038. Currently supported formats:
  8039. @table @samp
  8040. @item 3dl
  8041. AfterEffects
  8042. @item cube
  8043. Iridas
  8044. @item dat
  8045. DaVinci
  8046. @item m3d
  8047. Pandora
  8048. @end table
  8049. @item interp
  8050. Select interpolation mode.
  8051. Available values are:
  8052. @table @samp
  8053. @item nearest
  8054. Use values from the nearest defined point.
  8055. @item trilinear
  8056. Interpolate values using the 8 points defining a cube.
  8057. @item tetrahedral
  8058. Interpolate values using a tetrahedron.
  8059. @end table
  8060. @end table
  8061. This filter also supports the @ref{framesync} options.
  8062. @section lumakey
  8063. Turn certain luma values into transparency.
  8064. The filter accepts the following options:
  8065. @table @option
  8066. @item threshold
  8067. Set the luma which will be used as base for transparency.
  8068. Default value is @code{0}.
  8069. @item tolerance
  8070. Set the range of luma values to be keyed out.
  8071. Default value is @code{0}.
  8072. @item softness
  8073. Set the range of softness. Default value is @code{0}.
  8074. Use this to control gradual transition from zero to full transparency.
  8075. @end table
  8076. @section lut, lutrgb, lutyuv
  8077. Compute a look-up table for binding each pixel component input value
  8078. to an output value, and apply it to the input video.
  8079. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  8080. to an RGB input video.
  8081. These filters accept the following parameters:
  8082. @table @option
  8083. @item c0
  8084. set first pixel component expression
  8085. @item c1
  8086. set second pixel component expression
  8087. @item c2
  8088. set third pixel component expression
  8089. @item c3
  8090. set fourth pixel component expression, corresponds to the alpha component
  8091. @item r
  8092. set red component expression
  8093. @item g
  8094. set green component expression
  8095. @item b
  8096. set blue component expression
  8097. @item a
  8098. alpha component expression
  8099. @item y
  8100. set Y/luminance component expression
  8101. @item u
  8102. set U/Cb component expression
  8103. @item v
  8104. set V/Cr component expression
  8105. @end table
  8106. Each of them specifies the expression to use for computing the lookup table for
  8107. the corresponding pixel component values.
  8108. The exact component associated to each of the @var{c*} options depends on the
  8109. format in input.
  8110. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  8111. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  8112. The expressions can contain the following constants and functions:
  8113. @table @option
  8114. @item w
  8115. @item h
  8116. The input width and height.
  8117. @item val
  8118. The input value for the pixel component.
  8119. @item clipval
  8120. The input value, clipped to the @var{minval}-@var{maxval} range.
  8121. @item maxval
  8122. The maximum value for the pixel component.
  8123. @item minval
  8124. The minimum value for the pixel component.
  8125. @item negval
  8126. The negated value for the pixel component value, clipped to the
  8127. @var{minval}-@var{maxval} range; it corresponds to the expression
  8128. "maxval-clipval+minval".
  8129. @item clip(val)
  8130. The computed value in @var{val}, clipped to the
  8131. @var{minval}-@var{maxval} range.
  8132. @item gammaval(gamma)
  8133. The computed gamma correction value of the pixel component value,
  8134. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  8135. expression
  8136. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  8137. @end table
  8138. All expressions default to "val".
  8139. @subsection Examples
  8140. @itemize
  8141. @item
  8142. Negate input video:
  8143. @example
  8144. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  8145. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  8146. @end example
  8147. The above is the same as:
  8148. @example
  8149. lutrgb="r=negval:g=negval:b=negval"
  8150. lutyuv="y=negval:u=negval:v=negval"
  8151. @end example
  8152. @item
  8153. Negate luminance:
  8154. @example
  8155. lutyuv=y=negval
  8156. @end example
  8157. @item
  8158. Remove chroma components, turning the video into a graytone image:
  8159. @example
  8160. lutyuv="u=128:v=128"
  8161. @end example
  8162. @item
  8163. Apply a luma burning effect:
  8164. @example
  8165. lutyuv="y=2*val"
  8166. @end example
  8167. @item
  8168. Remove green and blue components:
  8169. @example
  8170. lutrgb="g=0:b=0"
  8171. @end example
  8172. @item
  8173. Set a constant alpha channel value on input:
  8174. @example
  8175. format=rgba,lutrgb=a="maxval-minval/2"
  8176. @end example
  8177. @item
  8178. Correct luminance gamma by a factor of 0.5:
  8179. @example
  8180. lutyuv=y=gammaval(0.5)
  8181. @end example
  8182. @item
  8183. Discard least significant bits of luma:
  8184. @example
  8185. lutyuv=y='bitand(val, 128+64+32)'
  8186. @end example
  8187. @item
  8188. Technicolor like effect:
  8189. @example
  8190. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  8191. @end example
  8192. @end itemize
  8193. @section lut2, tlut2
  8194. The @code{lut2} filter takes two input streams and outputs one
  8195. stream.
  8196. The @code{tlut2} (time lut2) filter takes two consecutive frames
  8197. from one single stream.
  8198. This filter accepts the following parameters:
  8199. @table @option
  8200. @item c0
  8201. set first pixel component expression
  8202. @item c1
  8203. set second pixel component expression
  8204. @item c2
  8205. set third pixel component expression
  8206. @item c3
  8207. set fourth pixel component expression, corresponds to the alpha component
  8208. @end table
  8209. Each of them specifies the expression to use for computing the lookup table for
  8210. the corresponding pixel component values.
  8211. The exact component associated to each of the @var{c*} options depends on the
  8212. format in inputs.
  8213. The expressions can contain the following constants:
  8214. @table @option
  8215. @item w
  8216. @item h
  8217. The input width and height.
  8218. @item x
  8219. The first input value for the pixel component.
  8220. @item y
  8221. The second input value for the pixel component.
  8222. @item bdx
  8223. The first input video bit depth.
  8224. @item bdy
  8225. The second input video bit depth.
  8226. @end table
  8227. All expressions default to "x".
  8228. @subsection Examples
  8229. @itemize
  8230. @item
  8231. Highlight differences between two RGB video streams:
  8232. @example
  8233. 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)'
  8234. @end example
  8235. @item
  8236. Highlight differences between two YUV video streams:
  8237. @example
  8238. 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)'
  8239. @end example
  8240. @item
  8241. Show max difference between two video streams:
  8242. @example
  8243. 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)))'
  8244. @end example
  8245. @end itemize
  8246. @section maskedclamp
  8247. Clamp the first input stream with the second input and third input stream.
  8248. Returns the value of first stream to be between second input
  8249. stream - @code{undershoot} and third input stream + @code{overshoot}.
  8250. This filter accepts the following options:
  8251. @table @option
  8252. @item undershoot
  8253. Default value is @code{0}.
  8254. @item overshoot
  8255. Default value is @code{0}.
  8256. @item planes
  8257. Set which planes will be processed as bitmap, unprocessed planes will be
  8258. copied from first stream.
  8259. By default value 0xf, all planes will be processed.
  8260. @end table
  8261. @section maskedmerge
  8262. Merge the first input stream with the second input stream using per pixel
  8263. weights in the third input stream.
  8264. A value of 0 in the third stream pixel component means that pixel component
  8265. from first stream is returned unchanged, while maximum value (eg. 255 for
  8266. 8-bit videos) means that pixel component from second stream is returned
  8267. unchanged. Intermediate values define the amount of merging between both
  8268. input stream's pixel components.
  8269. This filter accepts the following options:
  8270. @table @option
  8271. @item planes
  8272. Set which planes will be processed as bitmap, unprocessed planes will be
  8273. copied from first stream.
  8274. By default value 0xf, all planes will be processed.
  8275. @end table
  8276. @section mcdeint
  8277. Apply motion-compensation deinterlacing.
  8278. It needs one field per frame as input and must thus be used together
  8279. with yadif=1/3 or equivalent.
  8280. This filter accepts the following options:
  8281. @table @option
  8282. @item mode
  8283. Set the deinterlacing mode.
  8284. It accepts one of the following values:
  8285. @table @samp
  8286. @item fast
  8287. @item medium
  8288. @item slow
  8289. use iterative motion estimation
  8290. @item extra_slow
  8291. like @samp{slow}, but use multiple reference frames.
  8292. @end table
  8293. Default value is @samp{fast}.
  8294. @item parity
  8295. Set the picture field parity assumed for the input video. It must be
  8296. one of the following values:
  8297. @table @samp
  8298. @item 0, tff
  8299. assume top field first
  8300. @item 1, bff
  8301. assume bottom field first
  8302. @end table
  8303. Default value is @samp{bff}.
  8304. @item qp
  8305. Set per-block quantization parameter (QP) used by the internal
  8306. encoder.
  8307. Higher values should result in a smoother motion vector field but less
  8308. optimal individual vectors. Default value is 1.
  8309. @end table
  8310. @section mergeplanes
  8311. Merge color channel components from several video streams.
  8312. The filter accepts up to 4 input streams, and merge selected input
  8313. planes to the output video.
  8314. This filter accepts the following options:
  8315. @table @option
  8316. @item mapping
  8317. Set input to output plane mapping. Default is @code{0}.
  8318. The mappings is specified as a bitmap. It should be specified as a
  8319. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  8320. mapping for the first plane of the output stream. 'A' sets the number of
  8321. the input stream to use (from 0 to 3), and 'a' the plane number of the
  8322. corresponding input to use (from 0 to 3). The rest of the mappings is
  8323. similar, 'Bb' describes the mapping for the output stream second
  8324. plane, 'Cc' describes the mapping for the output stream third plane and
  8325. 'Dd' describes the mapping for the output stream fourth plane.
  8326. @item format
  8327. Set output pixel format. Default is @code{yuva444p}.
  8328. @end table
  8329. @subsection Examples
  8330. @itemize
  8331. @item
  8332. Merge three gray video streams of same width and height into single video stream:
  8333. @example
  8334. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  8335. @end example
  8336. @item
  8337. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  8338. @example
  8339. [a0][a1]mergeplanes=0x00010210:yuva444p
  8340. @end example
  8341. @item
  8342. Swap Y and A plane in yuva444p stream:
  8343. @example
  8344. format=yuva444p,mergeplanes=0x03010200:yuva444p
  8345. @end example
  8346. @item
  8347. Swap U and V plane in yuv420p stream:
  8348. @example
  8349. format=yuv420p,mergeplanes=0x000201:yuv420p
  8350. @end example
  8351. @item
  8352. Cast a rgb24 clip to yuv444p:
  8353. @example
  8354. format=rgb24,mergeplanes=0x000102:yuv444p
  8355. @end example
  8356. @end itemize
  8357. @section mestimate
  8358. Estimate and export motion vectors using block matching algorithms.
  8359. Motion vectors are stored in frame side data to be used by other filters.
  8360. This filter accepts the following options:
  8361. @table @option
  8362. @item method
  8363. Specify the motion estimation method. Accepts one of the following values:
  8364. @table @samp
  8365. @item esa
  8366. Exhaustive search algorithm.
  8367. @item tss
  8368. Three step search algorithm.
  8369. @item tdls
  8370. Two dimensional logarithmic search algorithm.
  8371. @item ntss
  8372. New three step search algorithm.
  8373. @item fss
  8374. Four step search algorithm.
  8375. @item ds
  8376. Diamond search algorithm.
  8377. @item hexbs
  8378. Hexagon-based search algorithm.
  8379. @item epzs
  8380. Enhanced predictive zonal search algorithm.
  8381. @item umh
  8382. Uneven multi-hexagon search algorithm.
  8383. @end table
  8384. Default value is @samp{esa}.
  8385. @item mb_size
  8386. Macroblock size. Default @code{16}.
  8387. @item search_param
  8388. Search parameter. Default @code{7}.
  8389. @end table
  8390. @section midequalizer
  8391. Apply Midway Image Equalization effect using two video streams.
  8392. Midway Image Equalization adjusts a pair of images to have the same
  8393. histogram, while maintaining their dynamics as much as possible. It's
  8394. useful for e.g. matching exposures from a pair of stereo cameras.
  8395. This filter has two inputs and one output, which must be of same pixel format, but
  8396. may be of different sizes. The output of filter is first input adjusted with
  8397. midway histogram of both inputs.
  8398. This filter accepts the following option:
  8399. @table @option
  8400. @item planes
  8401. Set which planes to process. Default is @code{15}, which is all available planes.
  8402. @end table
  8403. @section minterpolate
  8404. Convert the video to specified frame rate using motion interpolation.
  8405. This filter accepts the following options:
  8406. @table @option
  8407. @item fps
  8408. 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}.
  8409. @item mi_mode
  8410. Motion interpolation mode. Following values are accepted:
  8411. @table @samp
  8412. @item dup
  8413. Duplicate previous or next frame for interpolating new ones.
  8414. @item blend
  8415. Blend source frames. Interpolated frame is mean of previous and next frames.
  8416. @item mci
  8417. Motion compensated interpolation. Following options are effective when this mode is selected:
  8418. @table @samp
  8419. @item mc_mode
  8420. Motion compensation mode. Following values are accepted:
  8421. @table @samp
  8422. @item obmc
  8423. Overlapped block motion compensation.
  8424. @item aobmc
  8425. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  8426. @end table
  8427. Default mode is @samp{obmc}.
  8428. @item me_mode
  8429. Motion estimation mode. Following values are accepted:
  8430. @table @samp
  8431. @item bidir
  8432. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  8433. @item bilat
  8434. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  8435. @end table
  8436. Default mode is @samp{bilat}.
  8437. @item me
  8438. The algorithm to be used for motion estimation. Following values are accepted:
  8439. @table @samp
  8440. @item esa
  8441. Exhaustive search algorithm.
  8442. @item tss
  8443. Three step search algorithm.
  8444. @item tdls
  8445. Two dimensional logarithmic search algorithm.
  8446. @item ntss
  8447. New three step search algorithm.
  8448. @item fss
  8449. Four step search algorithm.
  8450. @item ds
  8451. Diamond search algorithm.
  8452. @item hexbs
  8453. Hexagon-based search algorithm.
  8454. @item epzs
  8455. Enhanced predictive zonal search algorithm.
  8456. @item umh
  8457. Uneven multi-hexagon search algorithm.
  8458. @end table
  8459. Default algorithm is @samp{epzs}.
  8460. @item mb_size
  8461. Macroblock size. Default @code{16}.
  8462. @item search_param
  8463. Motion estimation search parameter. Default @code{32}.
  8464. @item vsbmc
  8465. 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).
  8466. @end table
  8467. @end table
  8468. @item scd
  8469. 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:
  8470. @table @samp
  8471. @item none
  8472. Disable scene change detection.
  8473. @item fdiff
  8474. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  8475. @end table
  8476. Default method is @samp{fdiff}.
  8477. @item scd_threshold
  8478. Scene change detection threshold. Default is @code{5.0}.
  8479. @end table
  8480. @section mix
  8481. Mix several video input streams into one video stream.
  8482. A description of the accepted options follows.
  8483. @table @option
  8484. @item nb_inputs
  8485. The number of inputs. If unspecified, it defaults to 2.
  8486. @item weights
  8487. Specify weight of each input video stream as sequence.
  8488. Each weight is separated by space.
  8489. @item duration
  8490. Specify how end of stream is determined.
  8491. @table @samp
  8492. @item longest
  8493. The duration of the longest input. (default)
  8494. @item shortest
  8495. The duration of the shortest input.
  8496. @item first
  8497. The duration of the first input.
  8498. @end table
  8499. @end table
  8500. @section mpdecimate
  8501. Drop frames that do not differ greatly from the previous frame in
  8502. order to reduce frame rate.
  8503. The main use of this filter is for very-low-bitrate encoding
  8504. (e.g. streaming over dialup modem), but it could in theory be used for
  8505. fixing movies that were inverse-telecined incorrectly.
  8506. A description of the accepted options follows.
  8507. @table @option
  8508. @item max
  8509. Set the maximum number of consecutive frames which can be dropped (if
  8510. positive), or the minimum interval between dropped frames (if
  8511. negative). If the value is 0, the frame is dropped disregarding the
  8512. number of previous sequentially dropped frames.
  8513. Default value is 0.
  8514. @item hi
  8515. @item lo
  8516. @item frac
  8517. Set the dropping threshold values.
  8518. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  8519. represent actual pixel value differences, so a threshold of 64
  8520. corresponds to 1 unit of difference for each pixel, or the same spread
  8521. out differently over the block.
  8522. A frame is a candidate for dropping if no 8x8 blocks differ by more
  8523. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  8524. meaning the whole image) differ by more than a threshold of @option{lo}.
  8525. Default value for @option{hi} is 64*12, default value for @option{lo} is
  8526. 64*5, and default value for @option{frac} is 0.33.
  8527. @end table
  8528. @section negate
  8529. Negate input video.
  8530. It accepts an integer in input; if non-zero it negates the
  8531. alpha component (if available). The default value in input is 0.
  8532. @section nlmeans
  8533. Denoise frames using Non-Local Means algorithm.
  8534. Each pixel is adjusted by looking for other pixels with similar contexts. This
  8535. context similarity is defined by comparing their surrounding patches of size
  8536. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  8537. around the pixel.
  8538. Note that the research area defines centers for patches, which means some
  8539. patches will be made of pixels outside that research area.
  8540. The filter accepts the following options.
  8541. @table @option
  8542. @item s
  8543. Set denoising strength.
  8544. @item p
  8545. Set patch size.
  8546. @item pc
  8547. Same as @option{p} but for chroma planes.
  8548. The default value is @var{0} and means automatic.
  8549. @item r
  8550. Set research size.
  8551. @item rc
  8552. Same as @option{r} but for chroma planes.
  8553. The default value is @var{0} and means automatic.
  8554. @end table
  8555. @section nnedi
  8556. Deinterlace video using neural network edge directed interpolation.
  8557. This filter accepts the following options:
  8558. @table @option
  8559. @item weights
  8560. Mandatory option, without binary file filter can not work.
  8561. Currently file can be found here:
  8562. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  8563. @item deint
  8564. Set which frames to deinterlace, by default it is @code{all}.
  8565. Can be @code{all} or @code{interlaced}.
  8566. @item field
  8567. Set mode of operation.
  8568. Can be one of the following:
  8569. @table @samp
  8570. @item af
  8571. Use frame flags, both fields.
  8572. @item a
  8573. Use frame flags, single field.
  8574. @item t
  8575. Use top field only.
  8576. @item b
  8577. Use bottom field only.
  8578. @item tf
  8579. Use both fields, top first.
  8580. @item bf
  8581. Use both fields, bottom first.
  8582. @end table
  8583. @item planes
  8584. Set which planes to process, by default filter process all frames.
  8585. @item nsize
  8586. Set size of local neighborhood around each pixel, used by the predictor neural
  8587. network.
  8588. Can be one of the following:
  8589. @table @samp
  8590. @item s8x6
  8591. @item s16x6
  8592. @item s32x6
  8593. @item s48x6
  8594. @item s8x4
  8595. @item s16x4
  8596. @item s32x4
  8597. @end table
  8598. @item nns
  8599. Set the number of neurons in predictor neural network.
  8600. Can be one of the following:
  8601. @table @samp
  8602. @item n16
  8603. @item n32
  8604. @item n64
  8605. @item n128
  8606. @item n256
  8607. @end table
  8608. @item qual
  8609. Controls the number of different neural network predictions that are blended
  8610. together to compute the final output value. Can be @code{fast}, default or
  8611. @code{slow}.
  8612. @item etype
  8613. Set which set of weights to use in the predictor.
  8614. Can be one of the following:
  8615. @table @samp
  8616. @item a
  8617. weights trained to minimize absolute error
  8618. @item s
  8619. weights trained to minimize squared error
  8620. @end table
  8621. @item pscrn
  8622. Controls whether or not the prescreener neural network is used to decide
  8623. which pixels should be processed by the predictor neural network and which
  8624. can be handled by simple cubic interpolation.
  8625. The prescreener is trained to know whether cubic interpolation will be
  8626. sufficient for a pixel or whether it should be predicted by the predictor nn.
  8627. The computational complexity of the prescreener nn is much less than that of
  8628. the predictor nn. Since most pixels can be handled by cubic interpolation,
  8629. using the prescreener generally results in much faster processing.
  8630. The prescreener is pretty accurate, so the difference between using it and not
  8631. using it is almost always unnoticeable.
  8632. Can be one of the following:
  8633. @table @samp
  8634. @item none
  8635. @item original
  8636. @item new
  8637. @end table
  8638. Default is @code{new}.
  8639. @item fapprox
  8640. Set various debugging flags.
  8641. @end table
  8642. @section noformat
  8643. Force libavfilter not to use any of the specified pixel formats for the
  8644. input to the next filter.
  8645. It accepts the following parameters:
  8646. @table @option
  8647. @item pix_fmts
  8648. A '|'-separated list of pixel format names, such as
  8649. pix_fmts=yuv420p|monow|rgb24".
  8650. @end table
  8651. @subsection Examples
  8652. @itemize
  8653. @item
  8654. Force libavfilter to use a format different from @var{yuv420p} for the
  8655. input to the vflip filter:
  8656. @example
  8657. noformat=pix_fmts=yuv420p,vflip
  8658. @end example
  8659. @item
  8660. Convert the input video to any of the formats not contained in the list:
  8661. @example
  8662. noformat=yuv420p|yuv444p|yuv410p
  8663. @end example
  8664. @end itemize
  8665. @section noise
  8666. Add noise on video input frame.
  8667. The filter accepts the following options:
  8668. @table @option
  8669. @item all_seed
  8670. @item c0_seed
  8671. @item c1_seed
  8672. @item c2_seed
  8673. @item c3_seed
  8674. Set noise seed for specific pixel component or all pixel components in case
  8675. of @var{all_seed}. Default value is @code{123457}.
  8676. @item all_strength, alls
  8677. @item c0_strength, c0s
  8678. @item c1_strength, c1s
  8679. @item c2_strength, c2s
  8680. @item c3_strength, c3s
  8681. Set noise strength for specific pixel component or all pixel components in case
  8682. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  8683. @item all_flags, allf
  8684. @item c0_flags, c0f
  8685. @item c1_flags, c1f
  8686. @item c2_flags, c2f
  8687. @item c3_flags, c3f
  8688. Set pixel component flags or set flags for all components if @var{all_flags}.
  8689. Available values for component flags are:
  8690. @table @samp
  8691. @item a
  8692. averaged temporal noise (smoother)
  8693. @item p
  8694. mix random noise with a (semi)regular pattern
  8695. @item t
  8696. temporal noise (noise pattern changes between frames)
  8697. @item u
  8698. uniform noise (gaussian otherwise)
  8699. @end table
  8700. @end table
  8701. @subsection Examples
  8702. Add temporal and uniform noise to input video:
  8703. @example
  8704. noise=alls=20:allf=t+u
  8705. @end example
  8706. @section normalize
  8707. Normalize RGB video (aka histogram stretching, contrast stretching).
  8708. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  8709. For each channel of each frame, the filter computes the input range and maps
  8710. it linearly to the user-specified output range. The output range defaults
  8711. to the full dynamic range from pure black to pure white.
  8712. Temporal smoothing can be used on the input range to reduce flickering (rapid
  8713. changes in brightness) caused when small dark or bright objects enter or leave
  8714. the scene. This is similar to the auto-exposure (automatic gain control) on a
  8715. video camera, and, like a video camera, it may cause a period of over- or
  8716. under-exposure of the video.
  8717. The R,G,B channels can be normalized independently, which may cause some
  8718. color shifting, or linked together as a single channel, which prevents
  8719. color shifting. Linked normalization preserves hue. Independent normalization
  8720. does not, so it can be used to remove some color casts. Independent and linked
  8721. normalization can be combined in any ratio.
  8722. The normalize filter accepts the following options:
  8723. @table @option
  8724. @item blackpt
  8725. @item whitept
  8726. Colors which define the output range. The minimum input value is mapped to
  8727. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  8728. The defaults are black and white respectively. Specifying white for
  8729. @var{blackpt} and black for @var{whitept} will give color-inverted,
  8730. normalized video. Shades of grey can be used to reduce the dynamic range
  8731. (contrast). Specifying saturated colors here can create some interesting
  8732. effects.
  8733. @item smoothing
  8734. The number of previous frames to use for temporal smoothing. The input range
  8735. of each channel is smoothed using a rolling average over the current frame
  8736. and the @var{smoothing} previous frames. The default is 0 (no temporal
  8737. smoothing).
  8738. @item independence
  8739. Controls the ratio of independent (color shifting) channel normalization to
  8740. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  8741. independent. Defaults to 1.0 (fully independent).
  8742. @item strength
  8743. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  8744. expensive no-op. Defaults to 1.0 (full strength).
  8745. @end table
  8746. @subsection Examples
  8747. Stretch video contrast to use the full dynamic range, with no temporal
  8748. smoothing; may flicker depending on the source content:
  8749. @example
  8750. normalize=blackpt=black:whitept=white:smoothing=0
  8751. @end example
  8752. As above, but with 50 frames of temporal smoothing; flicker should be
  8753. reduced, depending on the source content:
  8754. @example
  8755. normalize=blackpt=black:whitept=white:smoothing=50
  8756. @end example
  8757. As above, but with hue-preserving linked channel normalization:
  8758. @example
  8759. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  8760. @end example
  8761. As above, but with half strength:
  8762. @example
  8763. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  8764. @end example
  8765. Map the darkest input color to red, the brightest input color to cyan:
  8766. @example
  8767. normalize=blackpt=red:whitept=cyan
  8768. @end example
  8769. @section null
  8770. Pass the video source unchanged to the output.
  8771. @section ocr
  8772. Optical Character Recognition
  8773. This filter uses Tesseract for optical character recognition.
  8774. It accepts the following options:
  8775. @table @option
  8776. @item datapath
  8777. Set datapath to tesseract data. Default is to use whatever was
  8778. set at installation.
  8779. @item language
  8780. Set language, default is "eng".
  8781. @item whitelist
  8782. Set character whitelist.
  8783. @item blacklist
  8784. Set character blacklist.
  8785. @end table
  8786. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  8787. @section ocv
  8788. Apply a video transform using libopencv.
  8789. To enable this filter, install the libopencv library and headers and
  8790. configure FFmpeg with @code{--enable-libopencv}.
  8791. It accepts the following parameters:
  8792. @table @option
  8793. @item filter_name
  8794. The name of the libopencv filter to apply.
  8795. @item filter_params
  8796. The parameters to pass to the libopencv filter. If not specified, the default
  8797. values are assumed.
  8798. @end table
  8799. Refer to the official libopencv documentation for more precise
  8800. information:
  8801. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  8802. Several libopencv filters are supported; see the following subsections.
  8803. @anchor{dilate}
  8804. @subsection dilate
  8805. Dilate an image by using a specific structuring element.
  8806. It corresponds to the libopencv function @code{cvDilate}.
  8807. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  8808. @var{struct_el} represents a structuring element, and has the syntax:
  8809. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  8810. @var{cols} and @var{rows} represent the number of columns and rows of
  8811. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  8812. point, and @var{shape} the shape for the structuring element. @var{shape}
  8813. must be "rect", "cross", "ellipse", or "custom".
  8814. If the value for @var{shape} is "custom", it must be followed by a
  8815. string of the form "=@var{filename}". The file with name
  8816. @var{filename} is assumed to represent a binary image, with each
  8817. printable character corresponding to a bright pixel. When a custom
  8818. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  8819. or columns and rows of the read file are assumed instead.
  8820. The default value for @var{struct_el} is "3x3+0x0/rect".
  8821. @var{nb_iterations} specifies the number of times the transform is
  8822. applied to the image, and defaults to 1.
  8823. Some examples:
  8824. @example
  8825. # Use the default values
  8826. ocv=dilate
  8827. # Dilate using a structuring element with a 5x5 cross, iterating two times
  8828. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  8829. # Read the shape from the file diamond.shape, iterating two times.
  8830. # The file diamond.shape may contain a pattern of characters like this
  8831. # *
  8832. # ***
  8833. # *****
  8834. # ***
  8835. # *
  8836. # The specified columns and rows are ignored
  8837. # but the anchor point coordinates are not
  8838. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  8839. @end example
  8840. @subsection erode
  8841. Erode an image by using a specific structuring element.
  8842. It corresponds to the libopencv function @code{cvErode}.
  8843. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  8844. with the same syntax and semantics as the @ref{dilate} filter.
  8845. @subsection smooth
  8846. Smooth the input video.
  8847. The filter takes the following parameters:
  8848. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  8849. @var{type} is the type of smooth filter to apply, and must be one of
  8850. the following values: "blur", "blur_no_scale", "median", "gaussian",
  8851. or "bilateral". The default value is "gaussian".
  8852. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  8853. depend on the smooth type. @var{param1} and
  8854. @var{param2} accept integer positive values or 0. @var{param3} and
  8855. @var{param4} accept floating point values.
  8856. The default value for @var{param1} is 3. The default value for the
  8857. other parameters is 0.
  8858. These parameters correspond to the parameters assigned to the
  8859. libopencv function @code{cvSmooth}.
  8860. @section oscilloscope
  8861. 2D Video Oscilloscope.
  8862. Useful to measure spatial impulse, step responses, chroma delays, etc.
  8863. It accepts the following parameters:
  8864. @table @option
  8865. @item x
  8866. Set scope center x position.
  8867. @item y
  8868. Set scope center y position.
  8869. @item s
  8870. Set scope size, relative to frame diagonal.
  8871. @item t
  8872. Set scope tilt/rotation.
  8873. @item o
  8874. Set trace opacity.
  8875. @item tx
  8876. Set trace center x position.
  8877. @item ty
  8878. Set trace center y position.
  8879. @item tw
  8880. Set trace width, relative to width of frame.
  8881. @item th
  8882. Set trace height, relative to height of frame.
  8883. @item c
  8884. Set which components to trace. By default it traces first three components.
  8885. @item g
  8886. Draw trace grid. By default is enabled.
  8887. @item st
  8888. Draw some statistics. By default is enabled.
  8889. @item sc
  8890. Draw scope. By default is enabled.
  8891. @end table
  8892. @subsection Examples
  8893. @itemize
  8894. @item
  8895. Inspect full first row of video frame.
  8896. @example
  8897. oscilloscope=x=0.5:y=0:s=1
  8898. @end example
  8899. @item
  8900. Inspect full last row of video frame.
  8901. @example
  8902. oscilloscope=x=0.5:y=1:s=1
  8903. @end example
  8904. @item
  8905. Inspect full 5th line of video frame of height 1080.
  8906. @example
  8907. oscilloscope=x=0.5:y=5/1080:s=1
  8908. @end example
  8909. @item
  8910. Inspect full last column of video frame.
  8911. @example
  8912. oscilloscope=x=1:y=0.5:s=1:t=1
  8913. @end example
  8914. @end itemize
  8915. @anchor{overlay}
  8916. @section overlay
  8917. Overlay one video on top of another.
  8918. It takes two inputs and has one output. The first input is the "main"
  8919. video on which the second input is overlaid.
  8920. It accepts the following parameters:
  8921. A description of the accepted options follows.
  8922. @table @option
  8923. @item x
  8924. @item y
  8925. Set the expression for the x and y coordinates of the overlaid video
  8926. on the main video. Default value is "0" for both expressions. In case
  8927. the expression is invalid, it is set to a huge value (meaning that the
  8928. overlay will not be displayed within the output visible area).
  8929. @item eof_action
  8930. See @ref{framesync}.
  8931. @item eval
  8932. Set when the expressions for @option{x}, and @option{y} are evaluated.
  8933. It accepts the following values:
  8934. @table @samp
  8935. @item init
  8936. only evaluate expressions once during the filter initialization or
  8937. when a command is processed
  8938. @item frame
  8939. evaluate expressions for each incoming frame
  8940. @end table
  8941. Default value is @samp{frame}.
  8942. @item shortest
  8943. See @ref{framesync}.
  8944. @item format
  8945. Set the format for the output video.
  8946. It accepts the following values:
  8947. @table @samp
  8948. @item yuv420
  8949. force YUV420 output
  8950. @item yuv422
  8951. force YUV422 output
  8952. @item yuv444
  8953. force YUV444 output
  8954. @item rgb
  8955. force packed RGB output
  8956. @item gbrp
  8957. force planar RGB output
  8958. @item auto
  8959. automatically pick format
  8960. @end table
  8961. Default value is @samp{yuv420}.
  8962. @item repeatlast
  8963. See @ref{framesync}.
  8964. @item alpha
  8965. Set format of alpha of the overlaid video, it can be @var{straight} or
  8966. @var{premultiplied}. Default is @var{straight}.
  8967. @end table
  8968. The @option{x}, and @option{y} expressions can contain the following
  8969. parameters.
  8970. @table @option
  8971. @item main_w, W
  8972. @item main_h, H
  8973. The main input width and height.
  8974. @item overlay_w, w
  8975. @item overlay_h, h
  8976. The overlay input width and height.
  8977. @item x
  8978. @item y
  8979. The computed values for @var{x} and @var{y}. They are evaluated for
  8980. each new frame.
  8981. @item hsub
  8982. @item vsub
  8983. horizontal and vertical chroma subsample values of the output
  8984. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  8985. @var{vsub} is 1.
  8986. @item n
  8987. the number of input frame, starting from 0
  8988. @item pos
  8989. the position in the file of the input frame, NAN if unknown
  8990. @item t
  8991. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  8992. @end table
  8993. This filter also supports the @ref{framesync} options.
  8994. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  8995. when evaluation is done @emph{per frame}, and will evaluate to NAN
  8996. when @option{eval} is set to @samp{init}.
  8997. Be aware that frames are taken from each input video in timestamp
  8998. order, hence, if their initial timestamps differ, it is a good idea
  8999. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  9000. have them begin in the same zero timestamp, as the example for
  9001. the @var{movie} filter does.
  9002. You can chain together more overlays but you should test the
  9003. efficiency of such approach.
  9004. @subsection Commands
  9005. This filter supports the following commands:
  9006. @table @option
  9007. @item x
  9008. @item y
  9009. Modify the x and y of the overlay input.
  9010. The command accepts the same syntax of the corresponding option.
  9011. If the specified expression is not valid, it is kept at its current
  9012. value.
  9013. @end table
  9014. @subsection Examples
  9015. @itemize
  9016. @item
  9017. Draw the overlay at 10 pixels from the bottom right corner of the main
  9018. video:
  9019. @example
  9020. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  9021. @end example
  9022. Using named options the example above becomes:
  9023. @example
  9024. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  9025. @end example
  9026. @item
  9027. Insert a transparent PNG logo in the bottom left corner of the input,
  9028. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  9029. @example
  9030. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  9031. @end example
  9032. @item
  9033. Insert 2 different transparent PNG logos (second logo on bottom
  9034. right corner) using the @command{ffmpeg} tool:
  9035. @example
  9036. 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
  9037. @end example
  9038. @item
  9039. Add a transparent color layer on top of the main video; @code{WxH}
  9040. must specify the size of the main input to the overlay filter:
  9041. @example
  9042. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  9043. @end example
  9044. @item
  9045. Play an original video and a filtered version (here with the deshake
  9046. filter) side by side using the @command{ffplay} tool:
  9047. @example
  9048. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  9049. @end example
  9050. The above command is the same as:
  9051. @example
  9052. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  9053. @end example
  9054. @item
  9055. Make a sliding overlay appearing from the left to the right top part of the
  9056. screen starting since time 2:
  9057. @example
  9058. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  9059. @end example
  9060. @item
  9061. Compose output by putting two input videos side to side:
  9062. @example
  9063. ffmpeg -i left.avi -i right.avi -filter_complex "
  9064. nullsrc=size=200x100 [background];
  9065. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  9066. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  9067. [background][left] overlay=shortest=1 [background+left];
  9068. [background+left][right] overlay=shortest=1:x=100 [left+right]
  9069. "
  9070. @end example
  9071. @item
  9072. Mask 10-20 seconds of a video by applying the delogo filter to a section
  9073. @example
  9074. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  9075. -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]'
  9076. masked.avi
  9077. @end example
  9078. @item
  9079. Chain several overlays in cascade:
  9080. @example
  9081. nullsrc=s=200x200 [bg];
  9082. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  9083. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  9084. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  9085. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  9086. [in3] null, [mid2] overlay=100:100 [out0]
  9087. @end example
  9088. @end itemize
  9089. @section owdenoise
  9090. Apply Overcomplete Wavelet denoiser.
  9091. The filter accepts the following options:
  9092. @table @option
  9093. @item depth
  9094. Set depth.
  9095. Larger depth values will denoise lower frequency components more, but
  9096. slow down filtering.
  9097. Must be an int in the range 8-16, default is @code{8}.
  9098. @item luma_strength, ls
  9099. Set luma strength.
  9100. Must be a double value in the range 0-1000, default is @code{1.0}.
  9101. @item chroma_strength, cs
  9102. Set chroma strength.
  9103. Must be a double value in the range 0-1000, default is @code{1.0}.
  9104. @end table
  9105. @anchor{pad}
  9106. @section pad
  9107. Add paddings to the input image, and place the original input at the
  9108. provided @var{x}, @var{y} coordinates.
  9109. It accepts the following parameters:
  9110. @table @option
  9111. @item width, w
  9112. @item height, h
  9113. Specify an expression for the size of the output image with the
  9114. paddings added. If the value for @var{width} or @var{height} is 0, the
  9115. corresponding input size is used for the output.
  9116. The @var{width} expression can reference the value set by the
  9117. @var{height} expression, and vice versa.
  9118. The default value of @var{width} and @var{height} is 0.
  9119. @item x
  9120. @item y
  9121. Specify the offsets to place the input image at within the padded area,
  9122. with respect to the top/left border of the output image.
  9123. The @var{x} expression can reference the value set by the @var{y}
  9124. expression, and vice versa.
  9125. The default value of @var{x} and @var{y} is 0.
  9126. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  9127. so the input image is centered on the padded area.
  9128. @item color
  9129. Specify the color of the padded area. For the syntax of this option,
  9130. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  9131. manual,ffmpeg-utils}.
  9132. The default value of @var{color} is "black".
  9133. @item eval
  9134. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  9135. It accepts the following values:
  9136. @table @samp
  9137. @item init
  9138. Only evaluate expressions once during the filter initialization or when
  9139. a command is processed.
  9140. @item frame
  9141. Evaluate expressions for each incoming frame.
  9142. @end table
  9143. Default value is @samp{init}.
  9144. @item aspect
  9145. Pad to aspect instead to a resolution.
  9146. @end table
  9147. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  9148. options are expressions containing the following constants:
  9149. @table @option
  9150. @item in_w
  9151. @item in_h
  9152. The input video width and height.
  9153. @item iw
  9154. @item ih
  9155. These are the same as @var{in_w} and @var{in_h}.
  9156. @item out_w
  9157. @item out_h
  9158. The output width and height (the size of the padded area), as
  9159. specified by the @var{width} and @var{height} expressions.
  9160. @item ow
  9161. @item oh
  9162. These are the same as @var{out_w} and @var{out_h}.
  9163. @item x
  9164. @item y
  9165. The x and y offsets as specified by the @var{x} and @var{y}
  9166. expressions, or NAN if not yet specified.
  9167. @item a
  9168. same as @var{iw} / @var{ih}
  9169. @item sar
  9170. input sample aspect ratio
  9171. @item dar
  9172. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  9173. @item hsub
  9174. @item vsub
  9175. The horizontal and vertical chroma subsample values. For example for the
  9176. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9177. @end table
  9178. @subsection Examples
  9179. @itemize
  9180. @item
  9181. Add paddings with the color "violet" to the input video. The output video
  9182. size is 640x480, and the top-left corner of the input video is placed at
  9183. column 0, row 40
  9184. @example
  9185. pad=640:480:0:40:violet
  9186. @end example
  9187. The example above is equivalent to the following command:
  9188. @example
  9189. pad=width=640:height=480:x=0:y=40:color=violet
  9190. @end example
  9191. @item
  9192. Pad the input to get an output with dimensions increased by 3/2,
  9193. and put the input video at the center of the padded area:
  9194. @example
  9195. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  9196. @end example
  9197. @item
  9198. Pad the input to get a squared output with size equal to the maximum
  9199. value between the input width and height, and put the input video at
  9200. the center of the padded area:
  9201. @example
  9202. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  9203. @end example
  9204. @item
  9205. Pad the input to get a final w/h ratio of 16:9:
  9206. @example
  9207. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  9208. @end example
  9209. @item
  9210. In case of anamorphic video, in order to set the output display aspect
  9211. correctly, it is necessary to use @var{sar} in the expression,
  9212. according to the relation:
  9213. @example
  9214. (ih * X / ih) * sar = output_dar
  9215. X = output_dar / sar
  9216. @end example
  9217. Thus the previous example needs to be modified to:
  9218. @example
  9219. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  9220. @end example
  9221. @item
  9222. Double the output size and put the input video in the bottom-right
  9223. corner of the output padded area:
  9224. @example
  9225. pad="2*iw:2*ih:ow-iw:oh-ih"
  9226. @end example
  9227. @end itemize
  9228. @anchor{palettegen}
  9229. @section palettegen
  9230. Generate one palette for a whole video stream.
  9231. It accepts the following options:
  9232. @table @option
  9233. @item max_colors
  9234. Set the maximum number of colors to quantize in the palette.
  9235. Note: the palette will still contain 256 colors; the unused palette entries
  9236. will be black.
  9237. @item reserve_transparent
  9238. Create a palette of 255 colors maximum and reserve the last one for
  9239. transparency. Reserving the transparency color is useful for GIF optimization.
  9240. If not set, the maximum of colors in the palette will be 256. You probably want
  9241. to disable this option for a standalone image.
  9242. Set by default.
  9243. @item transparency_color
  9244. Set the color that will be used as background for transparency.
  9245. @item stats_mode
  9246. Set statistics mode.
  9247. It accepts the following values:
  9248. @table @samp
  9249. @item full
  9250. Compute full frame histograms.
  9251. @item diff
  9252. Compute histograms only for the part that differs from previous frame. This
  9253. might be relevant to give more importance to the moving part of your input if
  9254. the background is static.
  9255. @item single
  9256. Compute new histogram for each frame.
  9257. @end table
  9258. Default value is @var{full}.
  9259. @end table
  9260. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  9261. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  9262. color quantization of the palette. This information is also visible at
  9263. @var{info} logging level.
  9264. @subsection Examples
  9265. @itemize
  9266. @item
  9267. Generate a representative palette of a given video using @command{ffmpeg}:
  9268. @example
  9269. ffmpeg -i input.mkv -vf palettegen palette.png
  9270. @end example
  9271. @end itemize
  9272. @section paletteuse
  9273. Use a palette to downsample an input video stream.
  9274. The filter takes two inputs: one video stream and a palette. The palette must
  9275. be a 256 pixels image.
  9276. It accepts the following options:
  9277. @table @option
  9278. @item dither
  9279. Select dithering mode. Available algorithms are:
  9280. @table @samp
  9281. @item bayer
  9282. Ordered 8x8 bayer dithering (deterministic)
  9283. @item heckbert
  9284. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  9285. Note: this dithering is sometimes considered "wrong" and is included as a
  9286. reference.
  9287. @item floyd_steinberg
  9288. Floyd and Steingberg dithering (error diffusion)
  9289. @item sierra2
  9290. Frankie Sierra dithering v2 (error diffusion)
  9291. @item sierra2_4a
  9292. Frankie Sierra dithering v2 "Lite" (error diffusion)
  9293. @end table
  9294. Default is @var{sierra2_4a}.
  9295. @item bayer_scale
  9296. When @var{bayer} dithering is selected, this option defines the scale of the
  9297. pattern (how much the crosshatch pattern is visible). A low value means more
  9298. visible pattern for less banding, and higher value means less visible pattern
  9299. at the cost of more banding.
  9300. The option must be an integer value in the range [0,5]. Default is @var{2}.
  9301. @item diff_mode
  9302. If set, define the zone to process
  9303. @table @samp
  9304. @item rectangle
  9305. Only the changing rectangle will be reprocessed. This is similar to GIF
  9306. cropping/offsetting compression mechanism. This option can be useful for speed
  9307. if only a part of the image is changing, and has use cases such as limiting the
  9308. scope of the error diffusal @option{dither} to the rectangle that bounds the
  9309. moving scene (it leads to more deterministic output if the scene doesn't change
  9310. much, and as a result less moving noise and better GIF compression).
  9311. @end table
  9312. Default is @var{none}.
  9313. @item new
  9314. Take new palette for each output frame.
  9315. @item alpha_threshold
  9316. Sets the alpha threshold for transparency. Alpha values above this threshold
  9317. will be treated as completely opaque, and values below this threshold will be
  9318. treated as completely transparent.
  9319. The option must be an integer value in the range [0,255]. Default is @var{128}.
  9320. @end table
  9321. @subsection Examples
  9322. @itemize
  9323. @item
  9324. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  9325. using @command{ffmpeg}:
  9326. @example
  9327. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  9328. @end example
  9329. @end itemize
  9330. @section perspective
  9331. Correct perspective of video not recorded perpendicular to the screen.
  9332. A description of the accepted parameters follows.
  9333. @table @option
  9334. @item x0
  9335. @item y0
  9336. @item x1
  9337. @item y1
  9338. @item x2
  9339. @item y2
  9340. @item x3
  9341. @item y3
  9342. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  9343. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  9344. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  9345. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  9346. then the corners of the source will be sent to the specified coordinates.
  9347. The expressions can use the following variables:
  9348. @table @option
  9349. @item W
  9350. @item H
  9351. the width and height of video frame.
  9352. @item in
  9353. Input frame count.
  9354. @item on
  9355. Output frame count.
  9356. @end table
  9357. @item interpolation
  9358. Set interpolation for perspective correction.
  9359. It accepts the following values:
  9360. @table @samp
  9361. @item linear
  9362. @item cubic
  9363. @end table
  9364. Default value is @samp{linear}.
  9365. @item sense
  9366. Set interpretation of coordinate options.
  9367. It accepts the following values:
  9368. @table @samp
  9369. @item 0, source
  9370. Send point in the source specified by the given coordinates to
  9371. the corners of the destination.
  9372. @item 1, destination
  9373. Send the corners of the source to the point in the destination specified
  9374. by the given coordinates.
  9375. Default value is @samp{source}.
  9376. @end table
  9377. @item eval
  9378. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  9379. It accepts the following values:
  9380. @table @samp
  9381. @item init
  9382. only evaluate expressions once during the filter initialization or
  9383. when a command is processed
  9384. @item frame
  9385. evaluate expressions for each incoming frame
  9386. @end table
  9387. Default value is @samp{init}.
  9388. @end table
  9389. @section phase
  9390. Delay interlaced video by one field time so that the field order changes.
  9391. The intended use is to fix PAL movies that have been captured with the
  9392. opposite field order to the film-to-video transfer.
  9393. A description of the accepted parameters follows.
  9394. @table @option
  9395. @item mode
  9396. Set phase mode.
  9397. It accepts the following values:
  9398. @table @samp
  9399. @item t
  9400. Capture field order top-first, transfer bottom-first.
  9401. Filter will delay the bottom field.
  9402. @item b
  9403. Capture field order bottom-first, transfer top-first.
  9404. Filter will delay the top field.
  9405. @item p
  9406. Capture and transfer with the same field order. This mode only exists
  9407. for the documentation of the other options to refer to, but if you
  9408. actually select it, the filter will faithfully do nothing.
  9409. @item a
  9410. Capture field order determined automatically by field flags, transfer
  9411. opposite.
  9412. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  9413. basis using field flags. If no field information is available,
  9414. then this works just like @samp{u}.
  9415. @item u
  9416. Capture unknown or varying, transfer opposite.
  9417. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  9418. analyzing the images and selecting the alternative that produces best
  9419. match between the fields.
  9420. @item T
  9421. Capture top-first, transfer unknown or varying.
  9422. Filter selects among @samp{t} and @samp{p} using image analysis.
  9423. @item B
  9424. Capture bottom-first, transfer unknown or varying.
  9425. Filter selects among @samp{b} and @samp{p} using image analysis.
  9426. @item A
  9427. Capture determined by field flags, transfer unknown or varying.
  9428. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  9429. image analysis. If no field information is available, then this works just
  9430. like @samp{U}. This is the default mode.
  9431. @item U
  9432. Both capture and transfer unknown or varying.
  9433. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  9434. @end table
  9435. @end table
  9436. @section pixdesctest
  9437. Pixel format descriptor test filter, mainly useful for internal
  9438. testing. The output video should be equal to the input video.
  9439. For example:
  9440. @example
  9441. format=monow, pixdesctest
  9442. @end example
  9443. can be used to test the monowhite pixel format descriptor definition.
  9444. @section pixscope
  9445. Display sample values of color channels. Mainly useful for checking color
  9446. and levels. Minimum supported resolution is 640x480.
  9447. The filters accept the following options:
  9448. @table @option
  9449. @item x
  9450. Set scope X position, relative offset on X axis.
  9451. @item y
  9452. Set scope Y position, relative offset on Y axis.
  9453. @item w
  9454. Set scope width.
  9455. @item h
  9456. Set scope height.
  9457. @item o
  9458. Set window opacity. This window also holds statistics about pixel area.
  9459. @item wx
  9460. Set window X position, relative offset on X axis.
  9461. @item wy
  9462. Set window Y position, relative offset on Y axis.
  9463. @end table
  9464. @section pp
  9465. Enable the specified chain of postprocessing subfilters using libpostproc. This
  9466. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  9467. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  9468. Each subfilter and some options have a short and a long name that can be used
  9469. interchangeably, i.e. dr/dering are the same.
  9470. The filters accept the following options:
  9471. @table @option
  9472. @item subfilters
  9473. Set postprocessing subfilters string.
  9474. @end table
  9475. All subfilters share common options to determine their scope:
  9476. @table @option
  9477. @item a/autoq
  9478. Honor the quality commands for this subfilter.
  9479. @item c/chrom
  9480. Do chrominance filtering, too (default).
  9481. @item y/nochrom
  9482. Do luminance filtering only (no chrominance).
  9483. @item n/noluma
  9484. Do chrominance filtering only (no luminance).
  9485. @end table
  9486. These options can be appended after the subfilter name, separated by a '|'.
  9487. Available subfilters are:
  9488. @table @option
  9489. @item hb/hdeblock[|difference[|flatness]]
  9490. Horizontal deblocking filter
  9491. @table @option
  9492. @item difference
  9493. Difference factor where higher values mean more deblocking (default: @code{32}).
  9494. @item flatness
  9495. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9496. @end table
  9497. @item vb/vdeblock[|difference[|flatness]]
  9498. Vertical deblocking filter
  9499. @table @option
  9500. @item difference
  9501. Difference factor where higher values mean more deblocking (default: @code{32}).
  9502. @item flatness
  9503. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9504. @end table
  9505. @item ha/hadeblock[|difference[|flatness]]
  9506. Accurate horizontal deblocking filter
  9507. @table @option
  9508. @item difference
  9509. Difference factor where higher values mean more deblocking (default: @code{32}).
  9510. @item flatness
  9511. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9512. @end table
  9513. @item va/vadeblock[|difference[|flatness]]
  9514. Accurate vertical deblocking filter
  9515. @table @option
  9516. @item difference
  9517. Difference factor where higher values mean more deblocking (default: @code{32}).
  9518. @item flatness
  9519. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9520. @end table
  9521. @end table
  9522. The horizontal and vertical deblocking filters share the difference and
  9523. flatness values so you cannot set different horizontal and vertical
  9524. thresholds.
  9525. @table @option
  9526. @item h1/x1hdeblock
  9527. Experimental horizontal deblocking filter
  9528. @item v1/x1vdeblock
  9529. Experimental vertical deblocking filter
  9530. @item dr/dering
  9531. Deringing filter
  9532. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  9533. @table @option
  9534. @item threshold1
  9535. larger -> stronger filtering
  9536. @item threshold2
  9537. larger -> stronger filtering
  9538. @item threshold3
  9539. larger -> stronger filtering
  9540. @end table
  9541. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  9542. @table @option
  9543. @item f/fullyrange
  9544. Stretch luminance to @code{0-255}.
  9545. @end table
  9546. @item lb/linblenddeint
  9547. Linear blend deinterlacing filter that deinterlaces the given block by
  9548. filtering all lines with a @code{(1 2 1)} filter.
  9549. @item li/linipoldeint
  9550. Linear interpolating deinterlacing filter that deinterlaces the given block by
  9551. linearly interpolating every second line.
  9552. @item ci/cubicipoldeint
  9553. Cubic interpolating deinterlacing filter deinterlaces the given block by
  9554. cubically interpolating every second line.
  9555. @item md/mediandeint
  9556. Median deinterlacing filter that deinterlaces the given block by applying a
  9557. median filter to every second line.
  9558. @item fd/ffmpegdeint
  9559. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  9560. second line with a @code{(-1 4 2 4 -1)} filter.
  9561. @item l5/lowpass5
  9562. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  9563. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  9564. @item fq/forceQuant[|quantizer]
  9565. Overrides the quantizer table from the input with the constant quantizer you
  9566. specify.
  9567. @table @option
  9568. @item quantizer
  9569. Quantizer to use
  9570. @end table
  9571. @item de/default
  9572. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  9573. @item fa/fast
  9574. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  9575. @item ac
  9576. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  9577. @end table
  9578. @subsection Examples
  9579. @itemize
  9580. @item
  9581. Apply horizontal and vertical deblocking, deringing and automatic
  9582. brightness/contrast:
  9583. @example
  9584. pp=hb/vb/dr/al
  9585. @end example
  9586. @item
  9587. Apply default filters without brightness/contrast correction:
  9588. @example
  9589. pp=de/-al
  9590. @end example
  9591. @item
  9592. Apply default filters and temporal denoiser:
  9593. @example
  9594. pp=default/tmpnoise|1|2|3
  9595. @end example
  9596. @item
  9597. Apply deblocking on luminance only, and switch vertical deblocking on or off
  9598. automatically depending on available CPU time:
  9599. @example
  9600. pp=hb|y/vb|a
  9601. @end example
  9602. @end itemize
  9603. @section pp7
  9604. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  9605. similar to spp = 6 with 7 point DCT, where only the center sample is
  9606. used after IDCT.
  9607. The filter accepts the following options:
  9608. @table @option
  9609. @item qp
  9610. Force a constant quantization parameter. It accepts an integer in range
  9611. 0 to 63. If not set, the filter will use the QP from the video stream
  9612. (if available).
  9613. @item mode
  9614. Set thresholding mode. Available modes are:
  9615. @table @samp
  9616. @item hard
  9617. Set hard thresholding.
  9618. @item soft
  9619. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9620. @item medium
  9621. Set medium thresholding (good results, default).
  9622. @end table
  9623. @end table
  9624. @section premultiply
  9625. Apply alpha premultiply effect to input video stream using first plane
  9626. of second stream as alpha.
  9627. Both streams must have same dimensions and same pixel format.
  9628. The filter accepts the following option:
  9629. @table @option
  9630. @item planes
  9631. Set which planes will be processed, unprocessed planes will be copied.
  9632. By default value 0xf, all planes will be processed.
  9633. @item inplace
  9634. Do not require 2nd input for processing, instead use alpha plane from input stream.
  9635. @end table
  9636. @section prewitt
  9637. Apply prewitt operator to input video stream.
  9638. The filter accepts the following option:
  9639. @table @option
  9640. @item planes
  9641. Set which planes will be processed, unprocessed planes will be copied.
  9642. By default value 0xf, all planes will be processed.
  9643. @item scale
  9644. Set value which will be multiplied with filtered result.
  9645. @item delta
  9646. Set value which will be added to filtered result.
  9647. @end table
  9648. @anchor{program_opencl}
  9649. @section program_opencl
  9650. Filter video using an OpenCL program.
  9651. @table @option
  9652. @item source
  9653. OpenCL program source file.
  9654. @item kernel
  9655. Kernel name in program.
  9656. @item inputs
  9657. Number of inputs to the filter. Defaults to 1.
  9658. @item size, s
  9659. Size of output frames. Defaults to the same as the first input.
  9660. @end table
  9661. The program source file must contain a kernel function with the given name,
  9662. which will be run once for each plane of the output. Each run on a plane
  9663. gets enqueued as a separate 2D global NDRange with one work-item for each
  9664. pixel to be generated. The global ID offset for each work-item is therefore
  9665. the coordinates of a pixel in the destination image.
  9666. The kernel function needs to take the following arguments:
  9667. @itemize
  9668. @item
  9669. Destination image, @var{__write_only image2d_t}.
  9670. This image will become the output; the kernel should write all of it.
  9671. @item
  9672. Frame index, @var{unsigned int}.
  9673. This is a counter starting from zero and increasing by one for each frame.
  9674. @item
  9675. Source images, @var{__read_only image2d_t}.
  9676. These are the most recent images on each input. The kernel may read from
  9677. them to generate the output, but they can't be written to.
  9678. @end itemize
  9679. Example programs:
  9680. @itemize
  9681. @item
  9682. Copy the input to the output (output must be the same size as the input).
  9683. @verbatim
  9684. __kernel void copy(__write_only image2d_t destination,
  9685. unsigned int index,
  9686. __read_only image2d_t source)
  9687. {
  9688. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  9689. int2 location = (int2)(get_global_id(0), get_global_id(1));
  9690. float4 value = read_imagef(source, sampler, location);
  9691. write_imagef(destination, location, value);
  9692. }
  9693. @end verbatim
  9694. @item
  9695. Apply a simple transformation, rotating the input by an amount increasing
  9696. with the index counter. Pixel values are linearly interpolated by the
  9697. sampler, and the output need not have the same dimensions as the input.
  9698. @verbatim
  9699. __kernel void rotate_image(__write_only image2d_t dst,
  9700. unsigned int index,
  9701. __read_only image2d_t src)
  9702. {
  9703. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  9704. CLK_FILTER_LINEAR);
  9705. float angle = (float)index / 100.0f;
  9706. float2 dst_dim = convert_float2(get_image_dim(dst));
  9707. float2 src_dim = convert_float2(get_image_dim(src));
  9708. float2 dst_cen = dst_dim / 2.0f;
  9709. float2 src_cen = src_dim / 2.0f;
  9710. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  9711. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  9712. float2 src_pos = {
  9713. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  9714. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  9715. };
  9716. src_pos = src_pos * src_dim / dst_dim;
  9717. float2 src_loc = src_pos + src_cen;
  9718. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  9719. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  9720. write_imagef(dst, dst_loc, 0.5f);
  9721. else
  9722. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  9723. }
  9724. @end verbatim
  9725. @item
  9726. Blend two inputs together, with the amount of each input used varying
  9727. with the index counter.
  9728. @verbatim
  9729. __kernel void blend_images(__write_only image2d_t dst,
  9730. unsigned int index,
  9731. __read_only image2d_t src1,
  9732. __read_only image2d_t src2)
  9733. {
  9734. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  9735. CLK_FILTER_LINEAR);
  9736. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  9737. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  9738. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  9739. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  9740. float4 val1 = read_imagef(src1, sampler, src1_loc);
  9741. float4 val2 = read_imagef(src2, sampler, src2_loc);
  9742. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  9743. }
  9744. @end verbatim
  9745. @end itemize
  9746. @section pseudocolor
  9747. Alter frame colors in video with pseudocolors.
  9748. This filter accept the following options:
  9749. @table @option
  9750. @item c0
  9751. set pixel first component expression
  9752. @item c1
  9753. set pixel second component expression
  9754. @item c2
  9755. set pixel third component expression
  9756. @item c3
  9757. set pixel fourth component expression, corresponds to the alpha component
  9758. @item i
  9759. set component to use as base for altering colors
  9760. @end table
  9761. Each of them specifies the expression to use for computing the lookup table for
  9762. the corresponding pixel component values.
  9763. The expressions can contain the following constants and functions:
  9764. @table @option
  9765. @item w
  9766. @item h
  9767. The input width and height.
  9768. @item val
  9769. The input value for the pixel component.
  9770. @item ymin, umin, vmin, amin
  9771. The minimum allowed component value.
  9772. @item ymax, umax, vmax, amax
  9773. The maximum allowed component value.
  9774. @end table
  9775. All expressions default to "val".
  9776. @subsection Examples
  9777. @itemize
  9778. @item
  9779. Change too high luma values to gradient:
  9780. @example
  9781. 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'"
  9782. @end example
  9783. @end itemize
  9784. @section psnr
  9785. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  9786. Ratio) between two input videos.
  9787. This filter takes in input two input videos, the first input is
  9788. considered the "main" source and is passed unchanged to the
  9789. output. The second input is used as a "reference" video for computing
  9790. the PSNR.
  9791. Both video inputs must have the same resolution and pixel format for
  9792. this filter to work correctly. Also it assumes that both inputs
  9793. have the same number of frames, which are compared one by one.
  9794. The obtained average PSNR is printed through the logging system.
  9795. The filter stores the accumulated MSE (mean squared error) of each
  9796. frame, and at the end of the processing it is averaged across all frames
  9797. equally, and the following formula is applied to obtain the PSNR:
  9798. @example
  9799. PSNR = 10*log10(MAX^2/MSE)
  9800. @end example
  9801. Where MAX is the average of the maximum values of each component of the
  9802. image.
  9803. The description of the accepted parameters follows.
  9804. @table @option
  9805. @item stats_file, f
  9806. If specified the filter will use the named file to save the PSNR of
  9807. each individual frame. When filename equals "-" the data is sent to
  9808. standard output.
  9809. @item stats_version
  9810. Specifies which version of the stats file format to use. Details of
  9811. each format are written below.
  9812. Default value is 1.
  9813. @item stats_add_max
  9814. Determines whether the max value is output to the stats log.
  9815. Default value is 0.
  9816. Requires stats_version >= 2. If this is set and stats_version < 2,
  9817. the filter will return an error.
  9818. @end table
  9819. This filter also supports the @ref{framesync} options.
  9820. The file printed if @var{stats_file} is selected, contains a sequence of
  9821. key/value pairs of the form @var{key}:@var{value} for each compared
  9822. couple of frames.
  9823. If a @var{stats_version} greater than 1 is specified, a header line precedes
  9824. the list of per-frame-pair stats, with key value pairs following the frame
  9825. format with the following parameters:
  9826. @table @option
  9827. @item psnr_log_version
  9828. The version of the log file format. Will match @var{stats_version}.
  9829. @item fields
  9830. A comma separated list of the per-frame-pair parameters included in
  9831. the log.
  9832. @end table
  9833. A description of each shown per-frame-pair parameter follows:
  9834. @table @option
  9835. @item n
  9836. sequential number of the input frame, starting from 1
  9837. @item mse_avg
  9838. Mean Square Error pixel-by-pixel average difference of the compared
  9839. frames, averaged over all the image components.
  9840. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  9841. Mean Square Error pixel-by-pixel average difference of the compared
  9842. frames for the component specified by the suffix.
  9843. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  9844. Peak Signal to Noise ratio of the compared frames for the component
  9845. specified by the suffix.
  9846. @item max_avg, max_y, max_u, max_v
  9847. Maximum allowed value for each channel, and average over all
  9848. channels.
  9849. @end table
  9850. For example:
  9851. @example
  9852. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9853. [main][ref] psnr="stats_file=stats.log" [out]
  9854. @end example
  9855. On this example the input file being processed is compared with the
  9856. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  9857. is stored in @file{stats.log}.
  9858. @anchor{pullup}
  9859. @section pullup
  9860. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  9861. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  9862. content.
  9863. The pullup filter is designed to take advantage of future context in making
  9864. its decisions. This filter is stateless in the sense that it does not lock
  9865. onto a pattern to follow, but it instead looks forward to the following
  9866. fields in order to identify matches and rebuild progressive frames.
  9867. To produce content with an even framerate, insert the fps filter after
  9868. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  9869. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  9870. The filter accepts the following options:
  9871. @table @option
  9872. @item jl
  9873. @item jr
  9874. @item jt
  9875. @item jb
  9876. These options set the amount of "junk" to ignore at the left, right, top, and
  9877. bottom of the image, respectively. Left and right are in units of 8 pixels,
  9878. while top and bottom are in units of 2 lines.
  9879. The default is 8 pixels on each side.
  9880. @item sb
  9881. Set the strict breaks. Setting this option to 1 will reduce the chances of
  9882. filter generating an occasional mismatched frame, but it may also cause an
  9883. excessive number of frames to be dropped during high motion sequences.
  9884. Conversely, setting it to -1 will make filter match fields more easily.
  9885. This may help processing of video where there is slight blurring between
  9886. the fields, but may also cause there to be interlaced frames in the output.
  9887. Default value is @code{0}.
  9888. @item mp
  9889. Set the metric plane to use. It accepts the following values:
  9890. @table @samp
  9891. @item l
  9892. Use luma plane.
  9893. @item u
  9894. Use chroma blue plane.
  9895. @item v
  9896. Use chroma red plane.
  9897. @end table
  9898. This option may be set to use chroma plane instead of the default luma plane
  9899. for doing filter's computations. This may improve accuracy on very clean
  9900. source material, but more likely will decrease accuracy, especially if there
  9901. is chroma noise (rainbow effect) or any grayscale video.
  9902. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  9903. load and make pullup usable in realtime on slow machines.
  9904. @end table
  9905. For best results (without duplicated frames in the output file) it is
  9906. necessary to change the output frame rate. For example, to inverse
  9907. telecine NTSC input:
  9908. @example
  9909. ffmpeg -i input -vf pullup -r 24000/1001 ...
  9910. @end example
  9911. @section qp
  9912. Change video quantization parameters (QP).
  9913. The filter accepts the following option:
  9914. @table @option
  9915. @item qp
  9916. Set expression for quantization parameter.
  9917. @end table
  9918. The expression is evaluated through the eval API and can contain, among others,
  9919. the following constants:
  9920. @table @var
  9921. @item known
  9922. 1 if index is not 129, 0 otherwise.
  9923. @item qp
  9924. Sequential index starting from -129 to 128.
  9925. @end table
  9926. @subsection Examples
  9927. @itemize
  9928. @item
  9929. Some equation like:
  9930. @example
  9931. qp=2+2*sin(PI*qp)
  9932. @end example
  9933. @end itemize
  9934. @section random
  9935. Flush video frames from internal cache of frames into a random order.
  9936. No frame is discarded.
  9937. Inspired by @ref{frei0r} nervous filter.
  9938. @table @option
  9939. @item frames
  9940. Set size in number of frames of internal cache, in range from @code{2} to
  9941. @code{512}. Default is @code{30}.
  9942. @item seed
  9943. Set seed for random number generator, must be an integer included between
  9944. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  9945. less than @code{0}, the filter will try to use a good random seed on a
  9946. best effort basis.
  9947. @end table
  9948. @section readeia608
  9949. Read closed captioning (EIA-608) information from the top lines of a video frame.
  9950. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  9951. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  9952. with EIA-608 data (starting from 0). A description of each metadata value follows:
  9953. @table @option
  9954. @item lavfi.readeia608.X.cc
  9955. The two bytes stored as EIA-608 data (printed in hexadecimal).
  9956. @item lavfi.readeia608.X.line
  9957. The number of the line on which the EIA-608 data was identified and read.
  9958. @end table
  9959. This filter accepts the following options:
  9960. @table @option
  9961. @item scan_min
  9962. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  9963. @item scan_max
  9964. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  9965. @item mac
  9966. Set minimal acceptable amplitude change for sync codes detection.
  9967. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  9968. @item spw
  9969. Set the ratio of width reserved for sync code detection.
  9970. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  9971. @item mhd
  9972. Set the max peaks height difference for sync code detection.
  9973. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9974. @item mpd
  9975. Set max peaks period difference for sync code detection.
  9976. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9977. @item msd
  9978. Set the first two max start code bits differences.
  9979. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  9980. @item bhd
  9981. Set the minimum ratio of bits height compared to 3rd start code bit.
  9982. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  9983. @item th_w
  9984. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  9985. @item th_b
  9986. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  9987. @item chp
  9988. Enable checking the parity bit. In the event of a parity error, the filter will output
  9989. @code{0x00} for that character. Default is false.
  9990. @end table
  9991. @subsection Examples
  9992. @itemize
  9993. @item
  9994. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  9995. @example
  9996. 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
  9997. @end example
  9998. @end itemize
  9999. @section readvitc
  10000. Read vertical interval timecode (VITC) information from the top lines of a
  10001. video frame.
  10002. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  10003. timecode value, if a valid timecode has been detected. Further metadata key
  10004. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  10005. timecode data has been found or not.
  10006. This filter accepts the following options:
  10007. @table @option
  10008. @item scan_max
  10009. Set the maximum number of lines to scan for VITC data. If the value is set to
  10010. @code{-1} the full video frame is scanned. Default is @code{45}.
  10011. @item thr_b
  10012. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  10013. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  10014. @item thr_w
  10015. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  10016. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  10017. @end table
  10018. @subsection Examples
  10019. @itemize
  10020. @item
  10021. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  10022. draw @code{--:--:--:--} as a placeholder:
  10023. @example
  10024. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  10025. @end example
  10026. @end itemize
  10027. @section remap
  10028. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  10029. Destination pixel at position (X, Y) will be picked from source (x, y) position
  10030. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  10031. value for pixel will be used for destination pixel.
  10032. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  10033. will have Xmap/Ymap video stream dimensions.
  10034. Xmap and Ymap input video streams are 16bit depth, single channel.
  10035. @section removegrain
  10036. The removegrain filter is a spatial denoiser for progressive video.
  10037. @table @option
  10038. @item m0
  10039. Set mode for the first plane.
  10040. @item m1
  10041. Set mode for the second plane.
  10042. @item m2
  10043. Set mode for the third plane.
  10044. @item m3
  10045. Set mode for the fourth plane.
  10046. @end table
  10047. Range of mode is from 0 to 24. Description of each mode follows:
  10048. @table @var
  10049. @item 0
  10050. Leave input plane unchanged. Default.
  10051. @item 1
  10052. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  10053. @item 2
  10054. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  10055. @item 3
  10056. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  10057. @item 4
  10058. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  10059. This is equivalent to a median filter.
  10060. @item 5
  10061. Line-sensitive clipping giving the minimal change.
  10062. @item 6
  10063. Line-sensitive clipping, intermediate.
  10064. @item 7
  10065. Line-sensitive clipping, intermediate.
  10066. @item 8
  10067. Line-sensitive clipping, intermediate.
  10068. @item 9
  10069. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  10070. @item 10
  10071. Replaces the target pixel with the closest neighbour.
  10072. @item 11
  10073. [1 2 1] horizontal and vertical kernel blur.
  10074. @item 12
  10075. Same as mode 11.
  10076. @item 13
  10077. Bob mode, interpolates top field from the line where the neighbours
  10078. pixels are the closest.
  10079. @item 14
  10080. Bob mode, interpolates bottom field from the line where the neighbours
  10081. pixels are the closest.
  10082. @item 15
  10083. Bob mode, interpolates top field. Same as 13 but with a more complicated
  10084. interpolation formula.
  10085. @item 16
  10086. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  10087. interpolation formula.
  10088. @item 17
  10089. Clips the pixel with the minimum and maximum of respectively the maximum and
  10090. minimum of each pair of opposite neighbour pixels.
  10091. @item 18
  10092. Line-sensitive clipping using opposite neighbours whose greatest distance from
  10093. the current pixel is minimal.
  10094. @item 19
  10095. Replaces the pixel with the average of its 8 neighbours.
  10096. @item 20
  10097. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  10098. @item 21
  10099. Clips pixels using the averages of opposite neighbour.
  10100. @item 22
  10101. Same as mode 21 but simpler and faster.
  10102. @item 23
  10103. Small edge and halo removal, but reputed useless.
  10104. @item 24
  10105. Similar as 23.
  10106. @end table
  10107. @section removelogo
  10108. Suppress a TV station logo, using an image file to determine which
  10109. pixels comprise the logo. It works by filling in the pixels that
  10110. comprise the logo with neighboring pixels.
  10111. The filter accepts the following options:
  10112. @table @option
  10113. @item filename, f
  10114. Set the filter bitmap file, which can be any image format supported by
  10115. libavformat. The width and height of the image file must match those of the
  10116. video stream being processed.
  10117. @end table
  10118. Pixels in the provided bitmap image with a value of zero are not
  10119. considered part of the logo, non-zero pixels are considered part of
  10120. the logo. If you use white (255) for the logo and black (0) for the
  10121. rest, you will be safe. For making the filter bitmap, it is
  10122. recommended to take a screen capture of a black frame with the logo
  10123. visible, and then using a threshold filter followed by the erode
  10124. filter once or twice.
  10125. If needed, little splotches can be fixed manually. Remember that if
  10126. logo pixels are not covered, the filter quality will be much
  10127. reduced. Marking too many pixels as part of the logo does not hurt as
  10128. much, but it will increase the amount of blurring needed to cover over
  10129. the image and will destroy more information than necessary, and extra
  10130. pixels will slow things down on a large logo.
  10131. @section repeatfields
  10132. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  10133. fields based on its value.
  10134. @section reverse
  10135. Reverse a video clip.
  10136. Warning: This filter requires memory to buffer the entire clip, so trimming
  10137. is suggested.
  10138. @subsection Examples
  10139. @itemize
  10140. @item
  10141. Take the first 5 seconds of a clip, and reverse it.
  10142. @example
  10143. trim=end=5,reverse
  10144. @end example
  10145. @end itemize
  10146. @section roberts
  10147. Apply roberts cross operator to input video stream.
  10148. The filter accepts the following option:
  10149. @table @option
  10150. @item planes
  10151. Set which planes will be processed, unprocessed planes will be copied.
  10152. By default value 0xf, all planes will be processed.
  10153. @item scale
  10154. Set value which will be multiplied with filtered result.
  10155. @item delta
  10156. Set value which will be added to filtered result.
  10157. @end table
  10158. @section rotate
  10159. Rotate video by an arbitrary angle expressed in radians.
  10160. The filter accepts the following options:
  10161. A description of the optional parameters follows.
  10162. @table @option
  10163. @item angle, a
  10164. Set an expression for the angle by which to rotate the input video
  10165. clockwise, expressed as a number of radians. A negative value will
  10166. result in a counter-clockwise rotation. By default it is set to "0".
  10167. This expression is evaluated for each frame.
  10168. @item out_w, ow
  10169. Set the output width expression, default value is "iw".
  10170. This expression is evaluated just once during configuration.
  10171. @item out_h, oh
  10172. Set the output height expression, default value is "ih".
  10173. This expression is evaluated just once during configuration.
  10174. @item bilinear
  10175. Enable bilinear interpolation if set to 1, a value of 0 disables
  10176. it. Default value is 1.
  10177. @item fillcolor, c
  10178. Set the color used to fill the output area not covered by the rotated
  10179. image. For the general syntax of this option, check the
  10180. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10181. If the special value "none" is selected then no
  10182. background is printed (useful for example if the background is never shown).
  10183. Default value is "black".
  10184. @end table
  10185. The expressions for the angle and the output size can contain the
  10186. following constants and functions:
  10187. @table @option
  10188. @item n
  10189. sequential number of the input frame, starting from 0. It is always NAN
  10190. before the first frame is filtered.
  10191. @item t
  10192. time in seconds of the input frame, it is set to 0 when the filter is
  10193. configured. It is always NAN before the first frame is filtered.
  10194. @item hsub
  10195. @item vsub
  10196. horizontal and vertical chroma subsample values. For example for the
  10197. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10198. @item in_w, iw
  10199. @item in_h, ih
  10200. the input video width and height
  10201. @item out_w, ow
  10202. @item out_h, oh
  10203. the output width and height, that is the size of the padded area as
  10204. specified by the @var{width} and @var{height} expressions
  10205. @item rotw(a)
  10206. @item roth(a)
  10207. the minimal width/height required for completely containing the input
  10208. video rotated by @var{a} radians.
  10209. These are only available when computing the @option{out_w} and
  10210. @option{out_h} expressions.
  10211. @end table
  10212. @subsection Examples
  10213. @itemize
  10214. @item
  10215. Rotate the input by PI/6 radians clockwise:
  10216. @example
  10217. rotate=PI/6
  10218. @end example
  10219. @item
  10220. Rotate the input by PI/6 radians counter-clockwise:
  10221. @example
  10222. rotate=-PI/6
  10223. @end example
  10224. @item
  10225. Rotate the input by 45 degrees clockwise:
  10226. @example
  10227. rotate=45*PI/180
  10228. @end example
  10229. @item
  10230. Apply a constant rotation with period T, starting from an angle of PI/3:
  10231. @example
  10232. rotate=PI/3+2*PI*t/T
  10233. @end example
  10234. @item
  10235. Make the input video rotation oscillating with a period of T
  10236. seconds and an amplitude of A radians:
  10237. @example
  10238. rotate=A*sin(2*PI/T*t)
  10239. @end example
  10240. @item
  10241. Rotate the video, output size is chosen so that the whole rotating
  10242. input video is always completely contained in the output:
  10243. @example
  10244. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  10245. @end example
  10246. @item
  10247. Rotate the video, reduce the output size so that no background is ever
  10248. shown:
  10249. @example
  10250. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  10251. @end example
  10252. @end itemize
  10253. @subsection Commands
  10254. The filter supports the following commands:
  10255. @table @option
  10256. @item a, angle
  10257. Set the angle expression.
  10258. The command accepts the same syntax of the corresponding option.
  10259. If the specified expression is not valid, it is kept at its current
  10260. value.
  10261. @end table
  10262. @section sab
  10263. Apply Shape Adaptive Blur.
  10264. The filter accepts the following options:
  10265. @table @option
  10266. @item luma_radius, lr
  10267. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  10268. value is 1.0. A greater value will result in a more blurred image, and
  10269. in slower processing.
  10270. @item luma_pre_filter_radius, lpfr
  10271. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  10272. value is 1.0.
  10273. @item luma_strength, ls
  10274. Set luma maximum difference between pixels to still be considered, must
  10275. be a value in the 0.1-100.0 range, default value is 1.0.
  10276. @item chroma_radius, cr
  10277. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  10278. greater value will result in a more blurred image, and in slower
  10279. processing.
  10280. @item chroma_pre_filter_radius, cpfr
  10281. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  10282. @item chroma_strength, cs
  10283. Set chroma maximum difference between pixels to still be considered,
  10284. must be a value in the -0.9-100.0 range.
  10285. @end table
  10286. Each chroma option value, if not explicitly specified, is set to the
  10287. corresponding luma option value.
  10288. @anchor{scale}
  10289. @section scale
  10290. Scale (resize) the input video, using the libswscale library.
  10291. The scale filter forces the output display aspect ratio to be the same
  10292. of the input, by changing the output sample aspect ratio.
  10293. If the input image format is different from the format requested by
  10294. the next filter, the scale filter will convert the input to the
  10295. requested format.
  10296. @subsection Options
  10297. The filter accepts the following options, or any of the options
  10298. supported by the libswscale scaler.
  10299. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  10300. the complete list of scaler options.
  10301. @table @option
  10302. @item width, w
  10303. @item height, h
  10304. Set the output video dimension expression. Default value is the input
  10305. dimension.
  10306. If the @var{width} or @var{w} value is 0, the input width is used for
  10307. the output. If the @var{height} or @var{h} value is 0, the input height
  10308. is used for the output.
  10309. If one and only one of the values is -n with n >= 1, the scale filter
  10310. will use a value that maintains the aspect ratio of the input image,
  10311. calculated from the other specified dimension. After that it will,
  10312. however, make sure that the calculated dimension is divisible by n and
  10313. adjust the value if necessary.
  10314. If both values are -n with n >= 1, the behavior will be identical to
  10315. both values being set to 0 as previously detailed.
  10316. See below for the list of accepted constants for use in the dimension
  10317. expression.
  10318. @item eval
  10319. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  10320. @table @samp
  10321. @item init
  10322. Only evaluate expressions once during the filter initialization or when a command is processed.
  10323. @item frame
  10324. Evaluate expressions for each incoming frame.
  10325. @end table
  10326. Default value is @samp{init}.
  10327. @item interl
  10328. Set the interlacing mode. It accepts the following values:
  10329. @table @samp
  10330. @item 1
  10331. Force interlaced aware scaling.
  10332. @item 0
  10333. Do not apply interlaced scaling.
  10334. @item -1
  10335. Select interlaced aware scaling depending on whether the source frames
  10336. are flagged as interlaced or not.
  10337. @end table
  10338. Default value is @samp{0}.
  10339. @item flags
  10340. Set libswscale scaling flags. See
  10341. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10342. complete list of values. If not explicitly specified the filter applies
  10343. the default flags.
  10344. @item param0, param1
  10345. Set libswscale input parameters for scaling algorithms that need them. See
  10346. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10347. complete documentation. If not explicitly specified the filter applies
  10348. empty parameters.
  10349. @item size, s
  10350. Set the video size. For the syntax of this option, check the
  10351. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10352. @item in_color_matrix
  10353. @item out_color_matrix
  10354. Set in/output YCbCr color space type.
  10355. This allows the autodetected value to be overridden as well as allows forcing
  10356. a specific value used for the output and encoder.
  10357. If not specified, the color space type depends on the pixel format.
  10358. Possible values:
  10359. @table @samp
  10360. @item auto
  10361. Choose automatically.
  10362. @item bt709
  10363. Format conforming to International Telecommunication Union (ITU)
  10364. Recommendation BT.709.
  10365. @item fcc
  10366. Set color space conforming to the United States Federal Communications
  10367. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  10368. @item bt601
  10369. Set color space conforming to:
  10370. @itemize
  10371. @item
  10372. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  10373. @item
  10374. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  10375. @item
  10376. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  10377. @end itemize
  10378. @item smpte240m
  10379. Set color space conforming to SMPTE ST 240:1999.
  10380. @end table
  10381. @item in_range
  10382. @item out_range
  10383. Set in/output YCbCr sample range.
  10384. This allows the autodetected value to be overridden as well as allows forcing
  10385. a specific value used for the output and encoder. If not specified, the
  10386. range depends on the pixel format. Possible values:
  10387. @table @samp
  10388. @item auto/unknown
  10389. Choose automatically.
  10390. @item jpeg/full/pc
  10391. Set full range (0-255 in case of 8-bit luma).
  10392. @item mpeg/limited/tv
  10393. Set "MPEG" range (16-235 in case of 8-bit luma).
  10394. @end table
  10395. @item force_original_aspect_ratio
  10396. Enable decreasing or increasing output video width or height if necessary to
  10397. keep the original aspect ratio. Possible values:
  10398. @table @samp
  10399. @item disable
  10400. Scale the video as specified and disable this feature.
  10401. @item decrease
  10402. The output video dimensions will automatically be decreased if needed.
  10403. @item increase
  10404. The output video dimensions will automatically be increased if needed.
  10405. @end table
  10406. One useful instance of this option is that when you know a specific device's
  10407. maximum allowed resolution, you can use this to limit the output video to
  10408. that, while retaining the aspect ratio. For example, device A allows
  10409. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  10410. decrease) and specifying 1280x720 to the command line makes the output
  10411. 1280x533.
  10412. Please note that this is a different thing than specifying -1 for @option{w}
  10413. or @option{h}, you still need to specify the output resolution for this option
  10414. to work.
  10415. @end table
  10416. The values of the @option{w} and @option{h} options are expressions
  10417. containing the following constants:
  10418. @table @var
  10419. @item in_w
  10420. @item in_h
  10421. The input width and height
  10422. @item iw
  10423. @item ih
  10424. These are the same as @var{in_w} and @var{in_h}.
  10425. @item out_w
  10426. @item out_h
  10427. The output (scaled) width and height
  10428. @item ow
  10429. @item oh
  10430. These are the same as @var{out_w} and @var{out_h}
  10431. @item a
  10432. The same as @var{iw} / @var{ih}
  10433. @item sar
  10434. input sample aspect ratio
  10435. @item dar
  10436. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  10437. @item hsub
  10438. @item vsub
  10439. horizontal and vertical input chroma subsample values. For example for the
  10440. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10441. @item ohsub
  10442. @item ovsub
  10443. horizontal and vertical output chroma subsample values. For example for the
  10444. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10445. @end table
  10446. @subsection Examples
  10447. @itemize
  10448. @item
  10449. Scale the input video to a size of 200x100
  10450. @example
  10451. scale=w=200:h=100
  10452. @end example
  10453. This is equivalent to:
  10454. @example
  10455. scale=200:100
  10456. @end example
  10457. or:
  10458. @example
  10459. scale=200x100
  10460. @end example
  10461. @item
  10462. Specify a size abbreviation for the output size:
  10463. @example
  10464. scale=qcif
  10465. @end example
  10466. which can also be written as:
  10467. @example
  10468. scale=size=qcif
  10469. @end example
  10470. @item
  10471. Scale the input to 2x:
  10472. @example
  10473. scale=w=2*iw:h=2*ih
  10474. @end example
  10475. @item
  10476. The above is the same as:
  10477. @example
  10478. scale=2*in_w:2*in_h
  10479. @end example
  10480. @item
  10481. Scale the input to 2x with forced interlaced scaling:
  10482. @example
  10483. scale=2*iw:2*ih:interl=1
  10484. @end example
  10485. @item
  10486. Scale the input to half size:
  10487. @example
  10488. scale=w=iw/2:h=ih/2
  10489. @end example
  10490. @item
  10491. Increase the width, and set the height to the same size:
  10492. @example
  10493. scale=3/2*iw:ow
  10494. @end example
  10495. @item
  10496. Seek Greek harmony:
  10497. @example
  10498. scale=iw:1/PHI*iw
  10499. scale=ih*PHI:ih
  10500. @end example
  10501. @item
  10502. Increase the height, and set the width to 3/2 of the height:
  10503. @example
  10504. scale=w=3/2*oh:h=3/5*ih
  10505. @end example
  10506. @item
  10507. Increase the size, making the size a multiple of the chroma
  10508. subsample values:
  10509. @example
  10510. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  10511. @end example
  10512. @item
  10513. Increase the width to a maximum of 500 pixels,
  10514. keeping the same aspect ratio as the input:
  10515. @example
  10516. scale=w='min(500\, iw*3/2):h=-1'
  10517. @end example
  10518. @item
  10519. Make pixels square by combining scale and setsar:
  10520. @example
  10521. scale='trunc(ih*dar):ih',setsar=1/1
  10522. @end example
  10523. @item
  10524. Make pixels square by combining scale and setsar,
  10525. making sure the resulting resolution is even (required by some codecs):
  10526. @example
  10527. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  10528. @end example
  10529. @end itemize
  10530. @subsection Commands
  10531. This filter supports the following commands:
  10532. @table @option
  10533. @item width, w
  10534. @item height, h
  10535. Set the output video dimension expression.
  10536. The command accepts the same syntax of the corresponding option.
  10537. If the specified expression is not valid, it is kept at its current
  10538. value.
  10539. @end table
  10540. @section scale_npp
  10541. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  10542. format conversion on CUDA video frames. Setting the output width and height
  10543. works in the same way as for the @var{scale} filter.
  10544. The following additional options are accepted:
  10545. @table @option
  10546. @item format
  10547. The pixel format of the output CUDA frames. If set to the string "same" (the
  10548. default), the input format will be kept. Note that automatic format negotiation
  10549. and conversion is not yet supported for hardware frames
  10550. @item interp_algo
  10551. The interpolation algorithm used for resizing. One of the following:
  10552. @table @option
  10553. @item nn
  10554. Nearest neighbour.
  10555. @item linear
  10556. @item cubic
  10557. @item cubic2p_bspline
  10558. 2-parameter cubic (B=1, C=0)
  10559. @item cubic2p_catmullrom
  10560. 2-parameter cubic (B=0, C=1/2)
  10561. @item cubic2p_b05c03
  10562. 2-parameter cubic (B=1/2, C=3/10)
  10563. @item super
  10564. Supersampling
  10565. @item lanczos
  10566. @end table
  10567. @end table
  10568. @section scale2ref
  10569. Scale (resize) the input video, based on a reference video.
  10570. See the scale filter for available options, scale2ref supports the same but
  10571. uses the reference video instead of the main input as basis. scale2ref also
  10572. supports the following additional constants for the @option{w} and
  10573. @option{h} options:
  10574. @table @var
  10575. @item main_w
  10576. @item main_h
  10577. The main input video's width and height
  10578. @item main_a
  10579. The same as @var{main_w} / @var{main_h}
  10580. @item main_sar
  10581. The main input video's sample aspect ratio
  10582. @item main_dar, mdar
  10583. The main input video's display aspect ratio. Calculated from
  10584. @code{(main_w / main_h) * main_sar}.
  10585. @item main_hsub
  10586. @item main_vsub
  10587. The main input video's horizontal and vertical chroma subsample values.
  10588. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  10589. is 1.
  10590. @end table
  10591. @subsection Examples
  10592. @itemize
  10593. @item
  10594. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  10595. @example
  10596. 'scale2ref[b][a];[a][b]overlay'
  10597. @end example
  10598. @end itemize
  10599. @anchor{selectivecolor}
  10600. @section selectivecolor
  10601. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  10602. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  10603. by the "purity" of the color (that is, how saturated it already is).
  10604. This filter is similar to the Adobe Photoshop Selective Color tool.
  10605. The filter accepts the following options:
  10606. @table @option
  10607. @item correction_method
  10608. Select color correction method.
  10609. Available values are:
  10610. @table @samp
  10611. @item absolute
  10612. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  10613. component value).
  10614. @item relative
  10615. Specified adjustments are relative to the original component value.
  10616. @end table
  10617. Default is @code{absolute}.
  10618. @item reds
  10619. Adjustments for red pixels (pixels where the red component is the maximum)
  10620. @item yellows
  10621. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  10622. @item greens
  10623. Adjustments for green pixels (pixels where the green component is the maximum)
  10624. @item cyans
  10625. Adjustments for cyan pixels (pixels where the red component is the minimum)
  10626. @item blues
  10627. Adjustments for blue pixels (pixels where the blue component is the maximum)
  10628. @item magentas
  10629. Adjustments for magenta pixels (pixels where the green component is the minimum)
  10630. @item whites
  10631. Adjustments for white pixels (pixels where all components are greater than 128)
  10632. @item neutrals
  10633. Adjustments for all pixels except pure black and pure white
  10634. @item blacks
  10635. Adjustments for black pixels (pixels where all components are lesser than 128)
  10636. @item psfile
  10637. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  10638. @end table
  10639. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  10640. 4 space separated floating point adjustment values in the [-1,1] range,
  10641. respectively to adjust the amount of cyan, magenta, yellow and black for the
  10642. pixels of its range.
  10643. @subsection Examples
  10644. @itemize
  10645. @item
  10646. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  10647. increase magenta by 27% in blue areas:
  10648. @example
  10649. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  10650. @end example
  10651. @item
  10652. Use a Photoshop selective color preset:
  10653. @example
  10654. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  10655. @end example
  10656. @end itemize
  10657. @anchor{separatefields}
  10658. @section separatefields
  10659. The @code{separatefields} takes a frame-based video input and splits
  10660. each frame into its components fields, producing a new half height clip
  10661. with twice the frame rate and twice the frame count.
  10662. This filter use field-dominance information in frame to decide which
  10663. of each pair of fields to place first in the output.
  10664. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  10665. @section setdar, setsar
  10666. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  10667. output video.
  10668. This is done by changing the specified Sample (aka Pixel) Aspect
  10669. Ratio, according to the following equation:
  10670. @example
  10671. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  10672. @end example
  10673. Keep in mind that the @code{setdar} filter does not modify the pixel
  10674. dimensions of the video frame. Also, the display aspect ratio set by
  10675. this filter may be changed by later filters in the filterchain,
  10676. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  10677. applied.
  10678. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  10679. the filter output video.
  10680. Note that as a consequence of the application of this filter, the
  10681. output display aspect ratio will change according to the equation
  10682. above.
  10683. Keep in mind that the sample aspect ratio set by the @code{setsar}
  10684. filter may be changed by later filters in the filterchain, e.g. if
  10685. another "setsar" or a "setdar" filter is applied.
  10686. It accepts the following parameters:
  10687. @table @option
  10688. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  10689. Set the aspect ratio used by the filter.
  10690. The parameter can be a floating point number string, an expression, or
  10691. a string of the form @var{num}:@var{den}, where @var{num} and
  10692. @var{den} are the numerator and denominator of the aspect ratio. If
  10693. the parameter is not specified, it is assumed the value "0".
  10694. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  10695. should be escaped.
  10696. @item max
  10697. Set the maximum integer value to use for expressing numerator and
  10698. denominator when reducing the expressed aspect ratio to a rational.
  10699. Default value is @code{100}.
  10700. @end table
  10701. The parameter @var{sar} is an expression containing
  10702. the following constants:
  10703. @table @option
  10704. @item E, PI, PHI
  10705. These are approximated values for the mathematical constants e
  10706. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  10707. @item w, h
  10708. The input width and height.
  10709. @item a
  10710. These are the same as @var{w} / @var{h}.
  10711. @item sar
  10712. The input sample aspect ratio.
  10713. @item dar
  10714. The input display aspect ratio. It is the same as
  10715. (@var{w} / @var{h}) * @var{sar}.
  10716. @item hsub, vsub
  10717. Horizontal and vertical chroma subsample values. For example, for the
  10718. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10719. @end table
  10720. @subsection Examples
  10721. @itemize
  10722. @item
  10723. To change the display aspect ratio to 16:9, specify one of the following:
  10724. @example
  10725. setdar=dar=1.77777
  10726. setdar=dar=16/9
  10727. @end example
  10728. @item
  10729. To change the sample aspect ratio to 10:11, specify:
  10730. @example
  10731. setsar=sar=10/11
  10732. @end example
  10733. @item
  10734. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  10735. 1000 in the aspect ratio reduction, use the command:
  10736. @example
  10737. setdar=ratio=16/9:max=1000
  10738. @end example
  10739. @end itemize
  10740. @anchor{setfield}
  10741. @section setfield
  10742. Force field for the output video frame.
  10743. The @code{setfield} filter marks the interlace type field for the
  10744. output frames. It does not change the input frame, but only sets the
  10745. corresponding property, which affects how the frame is treated by
  10746. following filters (e.g. @code{fieldorder} or @code{yadif}).
  10747. The filter accepts the following options:
  10748. @table @option
  10749. @item mode
  10750. Available values are:
  10751. @table @samp
  10752. @item auto
  10753. Keep the same field property.
  10754. @item bff
  10755. Mark the frame as bottom-field-first.
  10756. @item tff
  10757. Mark the frame as top-field-first.
  10758. @item prog
  10759. Mark the frame as progressive.
  10760. @end table
  10761. @end table
  10762. @section showinfo
  10763. Show a line containing various information for each input video frame.
  10764. The input video is not modified.
  10765. The shown line contains a sequence of key/value pairs of the form
  10766. @var{key}:@var{value}.
  10767. The following values are shown in the output:
  10768. @table @option
  10769. @item n
  10770. The (sequential) number of the input frame, starting from 0.
  10771. @item pts
  10772. The Presentation TimeStamp of the input frame, expressed as a number of
  10773. time base units. The time base unit depends on the filter input pad.
  10774. @item pts_time
  10775. The Presentation TimeStamp of the input frame, expressed as a number of
  10776. seconds.
  10777. @item pos
  10778. The position of the frame in the input stream, or -1 if this information is
  10779. unavailable and/or meaningless (for example in case of synthetic video).
  10780. @item fmt
  10781. The pixel format name.
  10782. @item sar
  10783. The sample aspect ratio of the input frame, expressed in the form
  10784. @var{num}/@var{den}.
  10785. @item s
  10786. The size of the input frame. For the syntax of this option, check the
  10787. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10788. @item i
  10789. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  10790. for bottom field first).
  10791. @item iskey
  10792. This is 1 if the frame is a key frame, 0 otherwise.
  10793. @item type
  10794. The picture type of the input frame ("I" for an I-frame, "P" for a
  10795. P-frame, "B" for a B-frame, or "?" for an unknown type).
  10796. Also refer to the documentation of the @code{AVPictureType} enum and of
  10797. the @code{av_get_picture_type_char} function defined in
  10798. @file{libavutil/avutil.h}.
  10799. @item checksum
  10800. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  10801. @item plane_checksum
  10802. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  10803. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  10804. @end table
  10805. @section showpalette
  10806. Displays the 256 colors palette of each frame. This filter is only relevant for
  10807. @var{pal8} pixel format frames.
  10808. It accepts the following option:
  10809. @table @option
  10810. @item s
  10811. Set the size of the box used to represent one palette color entry. Default is
  10812. @code{30} (for a @code{30x30} pixel box).
  10813. @end table
  10814. @section shuffleframes
  10815. Reorder and/or duplicate and/or drop video frames.
  10816. It accepts the following parameters:
  10817. @table @option
  10818. @item mapping
  10819. Set the destination indexes of input frames.
  10820. This is space or '|' separated list of indexes that maps input frames to output
  10821. frames. Number of indexes also sets maximal value that each index may have.
  10822. '-1' index have special meaning and that is to drop frame.
  10823. @end table
  10824. The first frame has the index 0. The default is to keep the input unchanged.
  10825. @subsection Examples
  10826. @itemize
  10827. @item
  10828. Swap second and third frame of every three frames of the input:
  10829. @example
  10830. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  10831. @end example
  10832. @item
  10833. Swap 10th and 1st frame of every ten frames of the input:
  10834. @example
  10835. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  10836. @end example
  10837. @end itemize
  10838. @section shuffleplanes
  10839. Reorder and/or duplicate video planes.
  10840. It accepts the following parameters:
  10841. @table @option
  10842. @item map0
  10843. The index of the input plane to be used as the first output plane.
  10844. @item map1
  10845. The index of the input plane to be used as the second output plane.
  10846. @item map2
  10847. The index of the input plane to be used as the third output plane.
  10848. @item map3
  10849. The index of the input plane to be used as the fourth output plane.
  10850. @end table
  10851. The first plane has the index 0. The default is to keep the input unchanged.
  10852. @subsection Examples
  10853. @itemize
  10854. @item
  10855. Swap the second and third planes of the input:
  10856. @example
  10857. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  10858. @end example
  10859. @end itemize
  10860. @anchor{signalstats}
  10861. @section signalstats
  10862. Evaluate various visual metrics that assist in determining issues associated
  10863. with the digitization of analog video media.
  10864. By default the filter will log these metadata values:
  10865. @table @option
  10866. @item YMIN
  10867. Display the minimal Y value contained within the input frame. Expressed in
  10868. range of [0-255].
  10869. @item YLOW
  10870. Display the Y value at the 10% percentile within the input frame. Expressed in
  10871. range of [0-255].
  10872. @item YAVG
  10873. Display the average Y value within the input frame. Expressed in range of
  10874. [0-255].
  10875. @item YHIGH
  10876. Display the Y value at the 90% percentile within the input frame. Expressed in
  10877. range of [0-255].
  10878. @item YMAX
  10879. Display the maximum Y value contained within the input frame. Expressed in
  10880. range of [0-255].
  10881. @item UMIN
  10882. Display the minimal U value contained within the input frame. Expressed in
  10883. range of [0-255].
  10884. @item ULOW
  10885. Display the U value at the 10% percentile within the input frame. Expressed in
  10886. range of [0-255].
  10887. @item UAVG
  10888. Display the average U value within the input frame. Expressed in range of
  10889. [0-255].
  10890. @item UHIGH
  10891. Display the U value at the 90% percentile within the input frame. Expressed in
  10892. range of [0-255].
  10893. @item UMAX
  10894. Display the maximum U value contained within the input frame. Expressed in
  10895. range of [0-255].
  10896. @item VMIN
  10897. Display the minimal V value contained within the input frame. Expressed in
  10898. range of [0-255].
  10899. @item VLOW
  10900. Display the V value at the 10% percentile within the input frame. Expressed in
  10901. range of [0-255].
  10902. @item VAVG
  10903. Display the average V value within the input frame. Expressed in range of
  10904. [0-255].
  10905. @item VHIGH
  10906. Display the V value at the 90% percentile within the input frame. Expressed in
  10907. range of [0-255].
  10908. @item VMAX
  10909. Display the maximum V value contained within the input frame. Expressed in
  10910. range of [0-255].
  10911. @item SATMIN
  10912. Display the minimal saturation value contained within the input frame.
  10913. Expressed in range of [0-~181.02].
  10914. @item SATLOW
  10915. Display the saturation value at the 10% percentile within the input frame.
  10916. Expressed in range of [0-~181.02].
  10917. @item SATAVG
  10918. Display the average saturation value within the input frame. Expressed in range
  10919. of [0-~181.02].
  10920. @item SATHIGH
  10921. Display the saturation value at the 90% percentile within the input frame.
  10922. Expressed in range of [0-~181.02].
  10923. @item SATMAX
  10924. Display the maximum saturation value contained within the input frame.
  10925. Expressed in range of [0-~181.02].
  10926. @item HUEMED
  10927. Display the median value for hue within the input frame. Expressed in range of
  10928. [0-360].
  10929. @item HUEAVG
  10930. Display the average value for hue within the input frame. Expressed in range of
  10931. [0-360].
  10932. @item YDIF
  10933. Display the average of sample value difference between all values of the Y
  10934. plane in the current frame and corresponding values of the previous input frame.
  10935. Expressed in range of [0-255].
  10936. @item UDIF
  10937. Display the average of sample value difference between all values of the U
  10938. plane in the current frame and corresponding values of the previous input frame.
  10939. Expressed in range of [0-255].
  10940. @item VDIF
  10941. Display the average of sample value difference between all values of the V
  10942. plane in the current frame and corresponding values of the previous input frame.
  10943. Expressed in range of [0-255].
  10944. @item YBITDEPTH
  10945. Display bit depth of Y plane in current frame.
  10946. Expressed in range of [0-16].
  10947. @item UBITDEPTH
  10948. Display bit depth of U plane in current frame.
  10949. Expressed in range of [0-16].
  10950. @item VBITDEPTH
  10951. Display bit depth of V plane in current frame.
  10952. Expressed in range of [0-16].
  10953. @end table
  10954. The filter accepts the following options:
  10955. @table @option
  10956. @item stat
  10957. @item out
  10958. @option{stat} specify an additional form of image analysis.
  10959. @option{out} output video with the specified type of pixel highlighted.
  10960. Both options accept the following values:
  10961. @table @samp
  10962. @item tout
  10963. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  10964. unlike the neighboring pixels of the same field. Examples of temporal outliers
  10965. include the results of video dropouts, head clogs, or tape tracking issues.
  10966. @item vrep
  10967. Identify @var{vertical line repetition}. Vertical line repetition includes
  10968. similar rows of pixels within a frame. In born-digital video vertical line
  10969. repetition is common, but this pattern is uncommon in video digitized from an
  10970. analog source. When it occurs in video that results from the digitization of an
  10971. analog source it can indicate concealment from a dropout compensator.
  10972. @item brng
  10973. Identify pixels that fall outside of legal broadcast range.
  10974. @end table
  10975. @item color, c
  10976. Set the highlight color for the @option{out} option. The default color is
  10977. yellow.
  10978. @end table
  10979. @subsection Examples
  10980. @itemize
  10981. @item
  10982. Output data of various video metrics:
  10983. @example
  10984. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  10985. @end example
  10986. @item
  10987. Output specific data about the minimum and maximum values of the Y plane per frame:
  10988. @example
  10989. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  10990. @end example
  10991. @item
  10992. Playback video while highlighting pixels that are outside of broadcast range in red.
  10993. @example
  10994. ffplay example.mov -vf signalstats="out=brng:color=red"
  10995. @end example
  10996. @item
  10997. Playback video with signalstats metadata drawn over the frame.
  10998. @example
  10999. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  11000. @end example
  11001. The contents of signalstat_drawtext.txt used in the command are:
  11002. @example
  11003. time %@{pts:hms@}
  11004. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  11005. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  11006. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  11007. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  11008. @end example
  11009. @end itemize
  11010. @anchor{signature}
  11011. @section signature
  11012. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  11013. input. In this case the matching between the inputs can be calculated additionally.
  11014. The filter always passes through the first input. The signature of each stream can
  11015. be written into a file.
  11016. It accepts the following options:
  11017. @table @option
  11018. @item detectmode
  11019. Enable or disable the matching process.
  11020. Available values are:
  11021. @table @samp
  11022. @item off
  11023. Disable the calculation of a matching (default).
  11024. @item full
  11025. Calculate the matching for the whole video and output whether the whole video
  11026. matches or only parts.
  11027. @item fast
  11028. Calculate only until a matching is found or the video ends. Should be faster in
  11029. some cases.
  11030. @end table
  11031. @item nb_inputs
  11032. Set the number of inputs. The option value must be a non negative integer.
  11033. Default value is 1.
  11034. @item filename
  11035. Set the path to which the output is written. If there is more than one input,
  11036. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  11037. integer), that will be replaced with the input number. If no filename is
  11038. specified, no output will be written. This is the default.
  11039. @item format
  11040. Choose the output format.
  11041. Available values are:
  11042. @table @samp
  11043. @item binary
  11044. Use the specified binary representation (default).
  11045. @item xml
  11046. Use the specified xml representation.
  11047. @end table
  11048. @item th_d
  11049. Set threshold to detect one word as similar. The option value must be an integer
  11050. greater than zero. The default value is 9000.
  11051. @item th_dc
  11052. Set threshold to detect all words as similar. The option value must be an integer
  11053. greater than zero. The default value is 60000.
  11054. @item th_xh
  11055. Set threshold to detect frames as similar. The option value must be an integer
  11056. greater than zero. The default value is 116.
  11057. @item th_di
  11058. Set the minimum length of a sequence in frames to recognize it as matching
  11059. sequence. The option value must be a non negative integer value.
  11060. The default value is 0.
  11061. @item th_it
  11062. Set the minimum relation, that matching frames to all frames must have.
  11063. The option value must be a double value between 0 and 1. The default value is 0.5.
  11064. @end table
  11065. @subsection Examples
  11066. @itemize
  11067. @item
  11068. To calculate the signature of an input video and store it in signature.bin:
  11069. @example
  11070. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  11071. @end example
  11072. @item
  11073. To detect whether two videos match and store the signatures in XML format in
  11074. signature0.xml and signature1.xml:
  11075. @example
  11076. 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 -
  11077. @end example
  11078. @end itemize
  11079. @anchor{smartblur}
  11080. @section smartblur
  11081. Blur the input video without impacting the outlines.
  11082. It accepts the following options:
  11083. @table @option
  11084. @item luma_radius, lr
  11085. Set the luma radius. The option value must be a float number in
  11086. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11087. used to blur the image (slower if larger). Default value is 1.0.
  11088. @item luma_strength, ls
  11089. Set the luma strength. The option value must be a float number
  11090. in the range [-1.0,1.0] that configures the blurring. A value included
  11091. in [0.0,1.0] will blur the image whereas a value included in
  11092. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  11093. @item luma_threshold, lt
  11094. Set the luma threshold used as a coefficient to determine
  11095. whether a pixel should be blurred or not. The option value must be an
  11096. integer in the range [-30,30]. A value of 0 will filter all the image,
  11097. a value included in [0,30] will filter flat areas and a value included
  11098. in [-30,0] will filter edges. Default value is 0.
  11099. @item chroma_radius, cr
  11100. Set the chroma radius. The option value must be a float number in
  11101. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11102. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  11103. @item chroma_strength, cs
  11104. Set the chroma strength. The option value must be a float number
  11105. in the range [-1.0,1.0] that configures the blurring. A value included
  11106. in [0.0,1.0] will blur the image whereas a value included in
  11107. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  11108. @item chroma_threshold, ct
  11109. Set the chroma threshold used as a coefficient to determine
  11110. whether a pixel should be blurred or not. The option value must be an
  11111. integer in the range [-30,30]. A value of 0 will filter all the image,
  11112. a value included in [0,30] will filter flat areas and a value included
  11113. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  11114. @end table
  11115. If a chroma option is not explicitly set, the corresponding luma value
  11116. is set.
  11117. @section ssim
  11118. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  11119. This filter takes in input two input videos, the first input is
  11120. considered the "main" source and is passed unchanged to the
  11121. output. The second input is used as a "reference" video for computing
  11122. the SSIM.
  11123. Both video inputs must have the same resolution and pixel format for
  11124. this filter to work correctly. Also it assumes that both inputs
  11125. have the same number of frames, which are compared one by one.
  11126. The filter stores the calculated SSIM of each frame.
  11127. The description of the accepted parameters follows.
  11128. @table @option
  11129. @item stats_file, f
  11130. If specified the filter will use the named file to save the SSIM of
  11131. each individual frame. When filename equals "-" the data is sent to
  11132. standard output.
  11133. @end table
  11134. The file printed if @var{stats_file} is selected, contains a sequence of
  11135. key/value pairs of the form @var{key}:@var{value} for each compared
  11136. couple of frames.
  11137. A description of each shown parameter follows:
  11138. @table @option
  11139. @item n
  11140. sequential number of the input frame, starting from 1
  11141. @item Y, U, V, R, G, B
  11142. SSIM of the compared frames for the component specified by the suffix.
  11143. @item All
  11144. SSIM of the compared frames for the whole frame.
  11145. @item dB
  11146. Same as above but in dB representation.
  11147. @end table
  11148. This filter also supports the @ref{framesync} options.
  11149. For example:
  11150. @example
  11151. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11152. [main][ref] ssim="stats_file=stats.log" [out]
  11153. @end example
  11154. On this example the input file being processed is compared with the
  11155. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  11156. is stored in @file{stats.log}.
  11157. Another example with both psnr and ssim at same time:
  11158. @example
  11159. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  11160. @end example
  11161. @section stereo3d
  11162. Convert between different stereoscopic image formats.
  11163. The filters accept the following options:
  11164. @table @option
  11165. @item in
  11166. Set stereoscopic image format of input.
  11167. Available values for input image formats are:
  11168. @table @samp
  11169. @item sbsl
  11170. side by side parallel (left eye left, right eye right)
  11171. @item sbsr
  11172. side by side crosseye (right eye left, left eye right)
  11173. @item sbs2l
  11174. side by side parallel with half width resolution
  11175. (left eye left, right eye right)
  11176. @item sbs2r
  11177. side by side crosseye with half width resolution
  11178. (right eye left, left eye right)
  11179. @item abl
  11180. above-below (left eye above, right eye below)
  11181. @item abr
  11182. above-below (right eye above, left eye below)
  11183. @item ab2l
  11184. above-below with half height resolution
  11185. (left eye above, right eye below)
  11186. @item ab2r
  11187. above-below with half height resolution
  11188. (right eye above, left eye below)
  11189. @item al
  11190. alternating frames (left eye first, right eye second)
  11191. @item ar
  11192. alternating frames (right eye first, left eye second)
  11193. @item irl
  11194. interleaved rows (left eye has top row, right eye starts on next row)
  11195. @item irr
  11196. interleaved rows (right eye has top row, left eye starts on next row)
  11197. @item icl
  11198. interleaved columns, left eye first
  11199. @item icr
  11200. interleaved columns, right eye first
  11201. Default value is @samp{sbsl}.
  11202. @end table
  11203. @item out
  11204. Set stereoscopic image format of output.
  11205. @table @samp
  11206. @item sbsl
  11207. side by side parallel (left eye left, right eye right)
  11208. @item sbsr
  11209. side by side crosseye (right eye left, left eye right)
  11210. @item sbs2l
  11211. side by side parallel with half width resolution
  11212. (left eye left, right eye right)
  11213. @item sbs2r
  11214. side by side crosseye with half width resolution
  11215. (right eye left, left eye right)
  11216. @item abl
  11217. above-below (left eye above, right eye below)
  11218. @item abr
  11219. above-below (right eye above, left eye below)
  11220. @item ab2l
  11221. above-below with half height resolution
  11222. (left eye above, right eye below)
  11223. @item ab2r
  11224. above-below with half height resolution
  11225. (right eye above, left eye below)
  11226. @item al
  11227. alternating frames (left eye first, right eye second)
  11228. @item ar
  11229. alternating frames (right eye first, left eye second)
  11230. @item irl
  11231. interleaved rows (left eye has top row, right eye starts on next row)
  11232. @item irr
  11233. interleaved rows (right eye has top row, left eye starts on next row)
  11234. @item arbg
  11235. anaglyph red/blue gray
  11236. (red filter on left eye, blue filter on right eye)
  11237. @item argg
  11238. anaglyph red/green gray
  11239. (red filter on left eye, green filter on right eye)
  11240. @item arcg
  11241. anaglyph red/cyan gray
  11242. (red filter on left eye, cyan filter on right eye)
  11243. @item arch
  11244. anaglyph red/cyan half colored
  11245. (red filter on left eye, cyan filter on right eye)
  11246. @item arcc
  11247. anaglyph red/cyan color
  11248. (red filter on left eye, cyan filter on right eye)
  11249. @item arcd
  11250. anaglyph red/cyan color optimized with the least squares projection of dubois
  11251. (red filter on left eye, cyan filter on right eye)
  11252. @item agmg
  11253. anaglyph green/magenta gray
  11254. (green filter on left eye, magenta filter on right eye)
  11255. @item agmh
  11256. anaglyph green/magenta half colored
  11257. (green filter on left eye, magenta filter on right eye)
  11258. @item agmc
  11259. anaglyph green/magenta colored
  11260. (green filter on left eye, magenta filter on right eye)
  11261. @item agmd
  11262. anaglyph green/magenta color optimized with the least squares projection of dubois
  11263. (green filter on left eye, magenta filter on right eye)
  11264. @item aybg
  11265. anaglyph yellow/blue gray
  11266. (yellow filter on left eye, blue filter on right eye)
  11267. @item aybh
  11268. anaglyph yellow/blue half colored
  11269. (yellow filter on left eye, blue filter on right eye)
  11270. @item aybc
  11271. anaglyph yellow/blue colored
  11272. (yellow filter on left eye, blue filter on right eye)
  11273. @item aybd
  11274. anaglyph yellow/blue color optimized with the least squares projection of dubois
  11275. (yellow filter on left eye, blue filter on right eye)
  11276. @item ml
  11277. mono output (left eye only)
  11278. @item mr
  11279. mono output (right eye only)
  11280. @item chl
  11281. checkerboard, left eye first
  11282. @item chr
  11283. checkerboard, right eye first
  11284. @item icl
  11285. interleaved columns, left eye first
  11286. @item icr
  11287. interleaved columns, right eye first
  11288. @item hdmi
  11289. HDMI frame pack
  11290. @end table
  11291. Default value is @samp{arcd}.
  11292. @end table
  11293. @subsection Examples
  11294. @itemize
  11295. @item
  11296. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  11297. @example
  11298. stereo3d=sbsl:aybd
  11299. @end example
  11300. @item
  11301. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  11302. @example
  11303. stereo3d=abl:sbsr
  11304. @end example
  11305. @end itemize
  11306. @section streamselect, astreamselect
  11307. Select video or audio streams.
  11308. The filter accepts the following options:
  11309. @table @option
  11310. @item inputs
  11311. Set number of inputs. Default is 2.
  11312. @item map
  11313. Set input indexes to remap to outputs.
  11314. @end table
  11315. @subsection Commands
  11316. The @code{streamselect} and @code{astreamselect} filter supports the following
  11317. commands:
  11318. @table @option
  11319. @item map
  11320. Set input indexes to remap to outputs.
  11321. @end table
  11322. @subsection Examples
  11323. @itemize
  11324. @item
  11325. Select first 5 seconds 1st stream and rest of time 2nd stream:
  11326. @example
  11327. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  11328. @end example
  11329. @item
  11330. Same as above, but for audio:
  11331. @example
  11332. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  11333. @end example
  11334. @end itemize
  11335. @section sobel
  11336. Apply sobel operator to input video stream.
  11337. The filter accepts the following option:
  11338. @table @option
  11339. @item planes
  11340. Set which planes will be processed, unprocessed planes will be copied.
  11341. By default value 0xf, all planes will be processed.
  11342. @item scale
  11343. Set value which will be multiplied with filtered result.
  11344. @item delta
  11345. Set value which will be added to filtered result.
  11346. @end table
  11347. @anchor{spp}
  11348. @section spp
  11349. Apply a simple postprocessing filter that compresses and decompresses the image
  11350. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  11351. and average the results.
  11352. The filter accepts the following options:
  11353. @table @option
  11354. @item quality
  11355. Set quality. This option defines the number of levels for averaging. It accepts
  11356. an integer in the range 0-6. If set to @code{0}, the filter will have no
  11357. effect. A value of @code{6} means the higher quality. For each increment of
  11358. that value the speed drops by a factor of approximately 2. Default value is
  11359. @code{3}.
  11360. @item qp
  11361. Force a constant quantization parameter. If not set, the filter will use the QP
  11362. from the video stream (if available).
  11363. @item mode
  11364. Set thresholding mode. Available modes are:
  11365. @table @samp
  11366. @item hard
  11367. Set hard thresholding (default).
  11368. @item soft
  11369. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11370. @end table
  11371. @item use_bframe_qp
  11372. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  11373. option may cause flicker since the B-Frames have often larger QP. Default is
  11374. @code{0} (not enabled).
  11375. @end table
  11376. @anchor{subtitles}
  11377. @section subtitles
  11378. Draw subtitles on top of input video using the libass library.
  11379. To enable compilation of this filter you need to configure FFmpeg with
  11380. @code{--enable-libass}. This filter also requires a build with libavcodec and
  11381. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  11382. Alpha) subtitles format.
  11383. The filter accepts the following options:
  11384. @table @option
  11385. @item filename, f
  11386. Set the filename of the subtitle file to read. It must be specified.
  11387. @item original_size
  11388. Specify the size of the original video, the video for which the ASS file
  11389. was composed. For the syntax of this option, check the
  11390. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11391. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  11392. correctly scale the fonts if the aspect ratio has been changed.
  11393. @item fontsdir
  11394. Set a directory path containing fonts that can be used by the filter.
  11395. These fonts will be used in addition to whatever the font provider uses.
  11396. @item alpha
  11397. Process alpha channel, by default alpha channel is untouched.
  11398. @item charenc
  11399. Set subtitles input character encoding. @code{subtitles} filter only. Only
  11400. useful if not UTF-8.
  11401. @item stream_index, si
  11402. Set subtitles stream index. @code{subtitles} filter only.
  11403. @item force_style
  11404. Override default style or script info parameters of the subtitles. It accepts a
  11405. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  11406. @end table
  11407. If the first key is not specified, it is assumed that the first value
  11408. specifies the @option{filename}.
  11409. For example, to render the file @file{sub.srt} on top of the input
  11410. video, use the command:
  11411. @example
  11412. subtitles=sub.srt
  11413. @end example
  11414. which is equivalent to:
  11415. @example
  11416. subtitles=filename=sub.srt
  11417. @end example
  11418. To render the default subtitles stream from file @file{video.mkv}, use:
  11419. @example
  11420. subtitles=video.mkv
  11421. @end example
  11422. To render the second subtitles stream from that file, use:
  11423. @example
  11424. subtitles=video.mkv:si=1
  11425. @end example
  11426. To make the subtitles stream from @file{sub.srt} appear in transparent green
  11427. @code{DejaVu Serif}, use:
  11428. @example
  11429. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  11430. @end example
  11431. @section super2xsai
  11432. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  11433. Interpolate) pixel art scaling algorithm.
  11434. Useful for enlarging pixel art images without reducing sharpness.
  11435. @section swaprect
  11436. Swap two rectangular objects in video.
  11437. This filter accepts the following options:
  11438. @table @option
  11439. @item w
  11440. Set object width.
  11441. @item h
  11442. Set object height.
  11443. @item x1
  11444. Set 1st rect x coordinate.
  11445. @item y1
  11446. Set 1st rect y coordinate.
  11447. @item x2
  11448. Set 2nd rect x coordinate.
  11449. @item y2
  11450. Set 2nd rect y coordinate.
  11451. All expressions are evaluated once for each frame.
  11452. @end table
  11453. The all options are expressions containing the following constants:
  11454. @table @option
  11455. @item w
  11456. @item h
  11457. The input width and height.
  11458. @item a
  11459. same as @var{w} / @var{h}
  11460. @item sar
  11461. input sample aspect ratio
  11462. @item dar
  11463. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  11464. @item n
  11465. The number of the input frame, starting from 0.
  11466. @item t
  11467. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  11468. @item pos
  11469. the position in the file of the input frame, NAN if unknown
  11470. @end table
  11471. @section swapuv
  11472. Swap U & V plane.
  11473. @section telecine
  11474. Apply telecine process to the video.
  11475. This filter accepts the following options:
  11476. @table @option
  11477. @item first_field
  11478. @table @samp
  11479. @item top, t
  11480. top field first
  11481. @item bottom, b
  11482. bottom field first
  11483. The default value is @code{top}.
  11484. @end table
  11485. @item pattern
  11486. A string of numbers representing the pulldown pattern you wish to apply.
  11487. The default value is @code{23}.
  11488. @end table
  11489. @example
  11490. Some typical patterns:
  11491. NTSC output (30i):
  11492. 27.5p: 32222
  11493. 24p: 23 (classic)
  11494. 24p: 2332 (preferred)
  11495. 20p: 33
  11496. 18p: 334
  11497. 16p: 3444
  11498. PAL output (25i):
  11499. 27.5p: 12222
  11500. 24p: 222222222223 ("Euro pulldown")
  11501. 16.67p: 33
  11502. 16p: 33333334
  11503. @end example
  11504. @section threshold
  11505. Apply threshold effect to video stream.
  11506. This filter needs four video streams to perform thresholding.
  11507. First stream is stream we are filtering.
  11508. Second stream is holding threshold values, third stream is holding min values,
  11509. and last, fourth stream is holding max values.
  11510. The filter accepts the following option:
  11511. @table @option
  11512. @item planes
  11513. Set which planes will be processed, unprocessed planes will be copied.
  11514. By default value 0xf, all planes will be processed.
  11515. @end table
  11516. For example if first stream pixel's component value is less then threshold value
  11517. of pixel component from 2nd threshold stream, third stream value will picked,
  11518. otherwise fourth stream pixel component value will be picked.
  11519. Using color source filter one can perform various types of thresholding:
  11520. @subsection Examples
  11521. @itemize
  11522. @item
  11523. Binary threshold, using gray color as threshold:
  11524. @example
  11525. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  11526. @end example
  11527. @item
  11528. Inverted binary threshold, using gray color as threshold:
  11529. @example
  11530. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  11531. @end example
  11532. @item
  11533. Truncate binary threshold, using gray color as threshold:
  11534. @example
  11535. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  11536. @end example
  11537. @item
  11538. Threshold to zero, using gray color as threshold:
  11539. @example
  11540. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  11541. @end example
  11542. @item
  11543. Inverted threshold to zero, using gray color as threshold:
  11544. @example
  11545. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  11546. @end example
  11547. @end itemize
  11548. @section thumbnail
  11549. Select the most representative frame in a given sequence of consecutive frames.
  11550. The filter accepts the following options:
  11551. @table @option
  11552. @item n
  11553. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  11554. will pick one of them, and then handle the next batch of @var{n} frames until
  11555. the end. Default is @code{100}.
  11556. @end table
  11557. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  11558. value will result in a higher memory usage, so a high value is not recommended.
  11559. @subsection Examples
  11560. @itemize
  11561. @item
  11562. Extract one picture each 50 frames:
  11563. @example
  11564. thumbnail=50
  11565. @end example
  11566. @item
  11567. Complete example of a thumbnail creation with @command{ffmpeg}:
  11568. @example
  11569. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  11570. @end example
  11571. @end itemize
  11572. @section tile
  11573. Tile several successive frames together.
  11574. The filter accepts the following options:
  11575. @table @option
  11576. @item layout
  11577. Set the grid size (i.e. the number of lines and columns). For the syntax of
  11578. this option, check the
  11579. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11580. @item nb_frames
  11581. Set the maximum number of frames to render in the given area. It must be less
  11582. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  11583. the area will be used.
  11584. @item margin
  11585. Set the outer border margin in pixels.
  11586. @item padding
  11587. Set the inner border thickness (i.e. the number of pixels between frames). For
  11588. more advanced padding options (such as having different values for the edges),
  11589. refer to the pad video filter.
  11590. @item color
  11591. Specify the color of the unused area. For the syntax of this option, check the
  11592. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11593. The default value of @var{color} is "black".
  11594. @item overlap
  11595. Set the number of frames to overlap when tiling several successive frames together.
  11596. The value must be between @code{0} and @var{nb_frames - 1}.
  11597. @item init_padding
  11598. Set the number of frames to initially be empty before displaying first output frame.
  11599. This controls how soon will one get first output frame.
  11600. The value must be between @code{0} and @var{nb_frames - 1}.
  11601. @end table
  11602. @subsection Examples
  11603. @itemize
  11604. @item
  11605. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  11606. @example
  11607. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  11608. @end example
  11609. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  11610. duplicating each output frame to accommodate the originally detected frame
  11611. rate.
  11612. @item
  11613. Display @code{5} pictures in an area of @code{3x2} frames,
  11614. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  11615. mixed flat and named options:
  11616. @example
  11617. tile=3x2:nb_frames=5:padding=7:margin=2
  11618. @end example
  11619. @end itemize
  11620. @section tinterlace
  11621. Perform various types of temporal field interlacing.
  11622. Frames are counted starting from 1, so the first input frame is
  11623. considered odd.
  11624. The filter accepts the following options:
  11625. @table @option
  11626. @item mode
  11627. Specify the mode of the interlacing. This option can also be specified
  11628. as a value alone. See below for a list of values for this option.
  11629. Available values are:
  11630. @table @samp
  11631. @item merge, 0
  11632. Move odd frames into the upper field, even into the lower field,
  11633. generating a double height frame at half frame rate.
  11634. @example
  11635. ------> time
  11636. Input:
  11637. Frame 1 Frame 2 Frame 3 Frame 4
  11638. 11111 22222 33333 44444
  11639. 11111 22222 33333 44444
  11640. 11111 22222 33333 44444
  11641. 11111 22222 33333 44444
  11642. Output:
  11643. 11111 33333
  11644. 22222 44444
  11645. 11111 33333
  11646. 22222 44444
  11647. 11111 33333
  11648. 22222 44444
  11649. 11111 33333
  11650. 22222 44444
  11651. @end example
  11652. @item drop_even, 1
  11653. Only output odd frames, even frames are dropped, generating a frame with
  11654. unchanged height at half frame rate.
  11655. @example
  11656. ------> time
  11657. Input:
  11658. Frame 1 Frame 2 Frame 3 Frame 4
  11659. 11111 22222 33333 44444
  11660. 11111 22222 33333 44444
  11661. 11111 22222 33333 44444
  11662. 11111 22222 33333 44444
  11663. Output:
  11664. 11111 33333
  11665. 11111 33333
  11666. 11111 33333
  11667. 11111 33333
  11668. @end example
  11669. @item drop_odd, 2
  11670. Only output even frames, odd frames are dropped, generating a frame with
  11671. unchanged height at half frame rate.
  11672. @example
  11673. ------> time
  11674. Input:
  11675. Frame 1 Frame 2 Frame 3 Frame 4
  11676. 11111 22222 33333 44444
  11677. 11111 22222 33333 44444
  11678. 11111 22222 33333 44444
  11679. 11111 22222 33333 44444
  11680. Output:
  11681. 22222 44444
  11682. 22222 44444
  11683. 22222 44444
  11684. 22222 44444
  11685. @end example
  11686. @item pad, 3
  11687. Expand each frame to full height, but pad alternate lines with black,
  11688. generating a frame with double height at the same input frame rate.
  11689. @example
  11690. ------> time
  11691. Input:
  11692. Frame 1 Frame 2 Frame 3 Frame 4
  11693. 11111 22222 33333 44444
  11694. 11111 22222 33333 44444
  11695. 11111 22222 33333 44444
  11696. 11111 22222 33333 44444
  11697. Output:
  11698. 11111 ..... 33333 .....
  11699. ..... 22222 ..... 44444
  11700. 11111 ..... 33333 .....
  11701. ..... 22222 ..... 44444
  11702. 11111 ..... 33333 .....
  11703. ..... 22222 ..... 44444
  11704. 11111 ..... 33333 .....
  11705. ..... 22222 ..... 44444
  11706. @end example
  11707. @item interleave_top, 4
  11708. Interleave the upper field from odd frames with the lower field from
  11709. even frames, generating a frame with unchanged height at half frame rate.
  11710. @example
  11711. ------> time
  11712. Input:
  11713. Frame 1 Frame 2 Frame 3 Frame 4
  11714. 11111<- 22222 33333<- 44444
  11715. 11111 22222<- 33333 44444<-
  11716. 11111<- 22222 33333<- 44444
  11717. 11111 22222<- 33333 44444<-
  11718. Output:
  11719. 11111 33333
  11720. 22222 44444
  11721. 11111 33333
  11722. 22222 44444
  11723. @end example
  11724. @item interleave_bottom, 5
  11725. Interleave the lower field from odd frames with the upper field from
  11726. even frames, generating a frame with unchanged height at half frame rate.
  11727. @example
  11728. ------> time
  11729. Input:
  11730. Frame 1 Frame 2 Frame 3 Frame 4
  11731. 11111 22222<- 33333 44444<-
  11732. 11111<- 22222 33333<- 44444
  11733. 11111 22222<- 33333 44444<-
  11734. 11111<- 22222 33333<- 44444
  11735. Output:
  11736. 22222 44444
  11737. 11111 33333
  11738. 22222 44444
  11739. 11111 33333
  11740. @end example
  11741. @item interlacex2, 6
  11742. Double frame rate with unchanged height. Frames are inserted each
  11743. containing the second temporal field from the previous input frame and
  11744. the first temporal field from the next input frame. This mode relies on
  11745. the top_field_first flag. Useful for interlaced video displays with no
  11746. field synchronisation.
  11747. @example
  11748. ------> time
  11749. Input:
  11750. Frame 1 Frame 2 Frame 3 Frame 4
  11751. 11111 22222 33333 44444
  11752. 11111 22222 33333 44444
  11753. 11111 22222 33333 44444
  11754. 11111 22222 33333 44444
  11755. Output:
  11756. 11111 22222 22222 33333 33333 44444 44444
  11757. 11111 11111 22222 22222 33333 33333 44444
  11758. 11111 22222 22222 33333 33333 44444 44444
  11759. 11111 11111 22222 22222 33333 33333 44444
  11760. @end example
  11761. @item mergex2, 7
  11762. Move odd frames into the upper field, even into the lower field,
  11763. generating a double height frame at same frame rate.
  11764. @example
  11765. ------> time
  11766. Input:
  11767. Frame 1 Frame 2 Frame 3 Frame 4
  11768. 11111 22222 33333 44444
  11769. 11111 22222 33333 44444
  11770. 11111 22222 33333 44444
  11771. 11111 22222 33333 44444
  11772. Output:
  11773. 11111 33333 33333 55555
  11774. 22222 22222 44444 44444
  11775. 11111 33333 33333 55555
  11776. 22222 22222 44444 44444
  11777. 11111 33333 33333 55555
  11778. 22222 22222 44444 44444
  11779. 11111 33333 33333 55555
  11780. 22222 22222 44444 44444
  11781. @end example
  11782. @end table
  11783. Numeric values are deprecated but are accepted for backward
  11784. compatibility reasons.
  11785. Default mode is @code{merge}.
  11786. @item flags
  11787. Specify flags influencing the filter process.
  11788. Available value for @var{flags} is:
  11789. @table @option
  11790. @item low_pass_filter, vlfp
  11791. Enable linear vertical low-pass filtering in the filter.
  11792. Vertical low-pass filtering is required when creating an interlaced
  11793. destination from a progressive source which contains high-frequency
  11794. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  11795. patterning.
  11796. @item complex_filter, cvlfp
  11797. Enable complex vertical low-pass filtering.
  11798. This will slightly less reduce interlace 'twitter' and Moire
  11799. patterning but better retain detail and subjective sharpness impression.
  11800. @end table
  11801. Vertical low-pass filtering can only be enabled for @option{mode}
  11802. @var{interleave_top} and @var{interleave_bottom}.
  11803. @end table
  11804. @section tonemap
  11805. Tone map colors from different dynamic ranges.
  11806. This filter expects data in single precision floating point, as it needs to
  11807. operate on (and can output) out-of-range values. Another filter, such as
  11808. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  11809. The tonemapping algorithms implemented only work on linear light, so input
  11810. data should be linearized beforehand (and possibly correctly tagged).
  11811. @example
  11812. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  11813. @end example
  11814. @subsection Options
  11815. The filter accepts the following options.
  11816. @table @option
  11817. @item tonemap
  11818. Set the tone map algorithm to use.
  11819. Possible values are:
  11820. @table @var
  11821. @item none
  11822. Do not apply any tone map, only desaturate overbright pixels.
  11823. @item clip
  11824. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  11825. in-range values, while distorting out-of-range values.
  11826. @item linear
  11827. Stretch the entire reference gamut to a linear multiple of the display.
  11828. @item gamma
  11829. Fit a logarithmic transfer between the tone curves.
  11830. @item reinhard
  11831. Preserve overall image brightness with a simple curve, using nonlinear
  11832. contrast, which results in flattening details and degrading color accuracy.
  11833. @item hable
  11834. Preserve both dark and bright details better than @var{reinhard}, at the cost
  11835. of slightly darkening everything. Use it when detail preservation is more
  11836. important than color and brightness accuracy.
  11837. @item mobius
  11838. Smoothly map out-of-range values, while retaining contrast and colors for
  11839. in-range material as much as possible. Use it when color accuracy is more
  11840. important than detail preservation.
  11841. @end table
  11842. Default is none.
  11843. @item param
  11844. Tune the tone mapping algorithm.
  11845. This affects the following algorithms:
  11846. @table @var
  11847. @item none
  11848. Ignored.
  11849. @item linear
  11850. Specifies the scale factor to use while stretching.
  11851. Default to 1.0.
  11852. @item gamma
  11853. Specifies the exponent of the function.
  11854. Default to 1.8.
  11855. @item clip
  11856. Specify an extra linear coefficient to multiply into the signal before clipping.
  11857. Default to 1.0.
  11858. @item reinhard
  11859. Specify the local contrast coefficient at the display peak.
  11860. Default to 0.5, which means that in-gamut values will be about half as bright
  11861. as when clipping.
  11862. @item hable
  11863. Ignored.
  11864. @item mobius
  11865. Specify the transition point from linear to mobius transform. Every value
  11866. below this point is guaranteed to be mapped 1:1. The higher the value, the
  11867. more accurate the result will be, at the cost of losing bright details.
  11868. Default to 0.3, which due to the steep initial slope still preserves in-range
  11869. colors fairly accurately.
  11870. @end table
  11871. @item desat
  11872. Apply desaturation for highlights that exceed this level of brightness. The
  11873. higher the parameter, the more color information will be preserved. This
  11874. setting helps prevent unnaturally blown-out colors for super-highlights, by
  11875. (smoothly) turning into white instead. This makes images feel more natural,
  11876. at the cost of reducing information about out-of-range colors.
  11877. The default of 2.0 is somewhat conservative and will mostly just apply to
  11878. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  11879. This option works only if the input frame has a supported color tag.
  11880. @item peak
  11881. Override signal/nominal/reference peak with this value. Useful when the
  11882. embedded peak information in display metadata is not reliable or when tone
  11883. mapping from a lower range to a higher range.
  11884. @end table
  11885. @section transpose
  11886. Transpose rows with columns in the input video and optionally flip it.
  11887. It accepts the following parameters:
  11888. @table @option
  11889. @item dir
  11890. Specify the transposition direction.
  11891. Can assume the following values:
  11892. @table @samp
  11893. @item 0, 4, cclock_flip
  11894. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  11895. @example
  11896. L.R L.l
  11897. . . -> . .
  11898. l.r R.r
  11899. @end example
  11900. @item 1, 5, clock
  11901. Rotate by 90 degrees clockwise, that is:
  11902. @example
  11903. L.R l.L
  11904. . . -> . .
  11905. l.r r.R
  11906. @end example
  11907. @item 2, 6, cclock
  11908. Rotate by 90 degrees counterclockwise, that is:
  11909. @example
  11910. L.R R.r
  11911. . . -> . .
  11912. l.r L.l
  11913. @end example
  11914. @item 3, 7, clock_flip
  11915. Rotate by 90 degrees clockwise and vertically flip, that is:
  11916. @example
  11917. L.R r.R
  11918. . . -> . .
  11919. l.r l.L
  11920. @end example
  11921. @end table
  11922. For values between 4-7, the transposition is only done if the input
  11923. video geometry is portrait and not landscape. These values are
  11924. deprecated, the @code{passthrough} option should be used instead.
  11925. Numerical values are deprecated, and should be dropped in favor of
  11926. symbolic constants.
  11927. @item passthrough
  11928. Do not apply the transposition if the input geometry matches the one
  11929. specified by the specified value. It accepts the following values:
  11930. @table @samp
  11931. @item none
  11932. Always apply transposition.
  11933. @item portrait
  11934. Preserve portrait geometry (when @var{height} >= @var{width}).
  11935. @item landscape
  11936. Preserve landscape geometry (when @var{width} >= @var{height}).
  11937. @end table
  11938. Default value is @code{none}.
  11939. @end table
  11940. For example to rotate by 90 degrees clockwise and preserve portrait
  11941. layout:
  11942. @example
  11943. transpose=dir=1:passthrough=portrait
  11944. @end example
  11945. The command above can also be specified as:
  11946. @example
  11947. transpose=1:portrait
  11948. @end example
  11949. @section trim
  11950. Trim the input so that the output contains one continuous subpart of the input.
  11951. It accepts the following parameters:
  11952. @table @option
  11953. @item start
  11954. Specify the time of the start of the kept section, i.e. the frame with the
  11955. timestamp @var{start} will be the first frame in the output.
  11956. @item end
  11957. Specify the time of the first frame that will be dropped, i.e. the frame
  11958. immediately preceding the one with the timestamp @var{end} will be the last
  11959. frame in the output.
  11960. @item start_pts
  11961. This is the same as @var{start}, except this option sets the start timestamp
  11962. in timebase units instead of seconds.
  11963. @item end_pts
  11964. This is the same as @var{end}, except this option sets the end timestamp
  11965. in timebase units instead of seconds.
  11966. @item duration
  11967. The maximum duration of the output in seconds.
  11968. @item start_frame
  11969. The number of the first frame that should be passed to the output.
  11970. @item end_frame
  11971. The number of the first frame that should be dropped.
  11972. @end table
  11973. @option{start}, @option{end}, and @option{duration} are expressed as time
  11974. duration specifications; see
  11975. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11976. for the accepted syntax.
  11977. Note that the first two sets of the start/end options and the @option{duration}
  11978. option look at the frame timestamp, while the _frame variants simply count the
  11979. frames that pass through the filter. Also note that this filter does not modify
  11980. the timestamps. If you wish for the output timestamps to start at zero, insert a
  11981. setpts filter after the trim filter.
  11982. If multiple start or end options are set, this filter tries to be greedy and
  11983. keep all the frames that match at least one of the specified constraints. To keep
  11984. only the part that matches all the constraints at once, chain multiple trim
  11985. filters.
  11986. The defaults are such that all the input is kept. So it is possible to set e.g.
  11987. just the end values to keep everything before the specified time.
  11988. Examples:
  11989. @itemize
  11990. @item
  11991. Drop everything except the second minute of input:
  11992. @example
  11993. ffmpeg -i INPUT -vf trim=60:120
  11994. @end example
  11995. @item
  11996. Keep only the first second:
  11997. @example
  11998. ffmpeg -i INPUT -vf trim=duration=1
  11999. @end example
  12000. @end itemize
  12001. @section unpremultiply
  12002. Apply alpha unpremultiply effect to input video stream using first plane
  12003. of second stream as alpha.
  12004. Both streams must have same dimensions and same pixel format.
  12005. The filter accepts the following option:
  12006. @table @option
  12007. @item planes
  12008. Set which planes will be processed, unprocessed planes will be copied.
  12009. By default value 0xf, all planes will be processed.
  12010. If the format has 1 or 2 components, then luma is bit 0.
  12011. If the format has 3 or 4 components:
  12012. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  12013. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  12014. If present, the alpha channel is always the last bit.
  12015. @item inplace
  12016. Do not require 2nd input for processing, instead use alpha plane from input stream.
  12017. @end table
  12018. @anchor{unsharp}
  12019. @section unsharp
  12020. Sharpen or blur the input video.
  12021. It accepts the following parameters:
  12022. @table @option
  12023. @item luma_msize_x, lx
  12024. Set the luma matrix horizontal size. It must be an odd integer between
  12025. 3 and 23. The default value is 5.
  12026. @item luma_msize_y, ly
  12027. Set the luma matrix vertical size. It must be an odd integer between 3
  12028. and 23. The default value is 5.
  12029. @item luma_amount, la
  12030. Set the luma effect strength. It must be a floating point number, reasonable
  12031. values lay between -1.5 and 1.5.
  12032. Negative values will blur the input video, while positive values will
  12033. sharpen it, a value of zero will disable the effect.
  12034. Default value is 1.0.
  12035. @item chroma_msize_x, cx
  12036. Set the chroma matrix horizontal size. It must be an odd integer
  12037. between 3 and 23. The default value is 5.
  12038. @item chroma_msize_y, cy
  12039. Set the chroma matrix vertical size. It must be an odd integer
  12040. between 3 and 23. The default value is 5.
  12041. @item chroma_amount, ca
  12042. Set the chroma effect strength. It must be a floating point number, reasonable
  12043. values lay between -1.5 and 1.5.
  12044. Negative values will blur the input video, while positive values will
  12045. sharpen it, a value of zero will disable the effect.
  12046. Default value is 0.0.
  12047. @end table
  12048. All parameters are optional and default to the equivalent of the
  12049. string '5:5:1.0:5:5:0.0'.
  12050. @subsection Examples
  12051. @itemize
  12052. @item
  12053. Apply strong luma sharpen effect:
  12054. @example
  12055. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  12056. @end example
  12057. @item
  12058. Apply a strong blur of both luma and chroma parameters:
  12059. @example
  12060. unsharp=7:7:-2:7:7:-2
  12061. @end example
  12062. @end itemize
  12063. @section uspp
  12064. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  12065. the image at several (or - in the case of @option{quality} level @code{8} - all)
  12066. shifts and average the results.
  12067. The way this differs from the behavior of spp is that uspp actually encodes &
  12068. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  12069. DCT similar to MJPEG.
  12070. The filter accepts the following options:
  12071. @table @option
  12072. @item quality
  12073. Set quality. This option defines the number of levels for averaging. It accepts
  12074. an integer in the range 0-8. If set to @code{0}, the filter will have no
  12075. effect. A value of @code{8} means the higher quality. For each increment of
  12076. that value the speed drops by a factor of approximately 2. Default value is
  12077. @code{3}.
  12078. @item qp
  12079. Force a constant quantization parameter. If not set, the filter will use the QP
  12080. from the video stream (if available).
  12081. @end table
  12082. @section vaguedenoiser
  12083. Apply a wavelet based denoiser.
  12084. It transforms each frame from the video input into the wavelet domain,
  12085. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  12086. the obtained coefficients. It does an inverse wavelet transform after.
  12087. Due to wavelet properties, it should give a nice smoothed result, and
  12088. reduced noise, without blurring picture features.
  12089. This filter accepts the following options:
  12090. @table @option
  12091. @item threshold
  12092. The filtering strength. The higher, the more filtered the video will be.
  12093. Hard thresholding can use a higher threshold than soft thresholding
  12094. before the video looks overfiltered. Default value is 2.
  12095. @item method
  12096. The filtering method the filter will use.
  12097. It accepts the following values:
  12098. @table @samp
  12099. @item hard
  12100. All values under the threshold will be zeroed.
  12101. @item soft
  12102. All values under the threshold will be zeroed. All values above will be
  12103. reduced by the threshold.
  12104. @item garrote
  12105. Scales or nullifies coefficients - intermediary between (more) soft and
  12106. (less) hard thresholding.
  12107. @end table
  12108. Default is garrote.
  12109. @item nsteps
  12110. Number of times, the wavelet will decompose the picture. Picture can't
  12111. be decomposed beyond a particular point (typically, 8 for a 640x480
  12112. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  12113. @item percent
  12114. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  12115. @item planes
  12116. A list of the planes to process. By default all planes are processed.
  12117. @end table
  12118. @section vectorscope
  12119. Display 2 color component values in the two dimensional graph (which is called
  12120. a vectorscope).
  12121. This filter accepts the following options:
  12122. @table @option
  12123. @item mode, m
  12124. Set vectorscope mode.
  12125. It accepts the following values:
  12126. @table @samp
  12127. @item gray
  12128. Gray values are displayed on graph, higher brightness means more pixels have
  12129. same component color value on location in graph. This is the default mode.
  12130. @item color
  12131. Gray values are displayed on graph. Surrounding pixels values which are not
  12132. present in video frame are drawn in gradient of 2 color components which are
  12133. set by option @code{x} and @code{y}. The 3rd color component is static.
  12134. @item color2
  12135. Actual color components values present in video frame are displayed on graph.
  12136. @item color3
  12137. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  12138. on graph increases value of another color component, which is luminance by
  12139. default values of @code{x} and @code{y}.
  12140. @item color4
  12141. Actual colors present in video frame are displayed on graph. If two different
  12142. colors map to same position on graph then color with higher value of component
  12143. not present in graph is picked.
  12144. @item color5
  12145. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  12146. component picked from radial gradient.
  12147. @end table
  12148. @item x
  12149. Set which color component will be represented on X-axis. Default is @code{1}.
  12150. @item y
  12151. Set which color component will be represented on Y-axis. Default is @code{2}.
  12152. @item intensity, i
  12153. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  12154. of color component which represents frequency of (X, Y) location in graph.
  12155. @item envelope, e
  12156. @table @samp
  12157. @item none
  12158. No envelope, this is default.
  12159. @item instant
  12160. Instant envelope, even darkest single pixel will be clearly highlighted.
  12161. @item peak
  12162. Hold maximum and minimum values presented in graph over time. This way you
  12163. can still spot out of range values without constantly looking at vectorscope.
  12164. @item peak+instant
  12165. Peak and instant envelope combined together.
  12166. @end table
  12167. @item graticule, g
  12168. Set what kind of graticule to draw.
  12169. @table @samp
  12170. @item none
  12171. @item green
  12172. @item color
  12173. @end table
  12174. @item opacity, o
  12175. Set graticule opacity.
  12176. @item flags, f
  12177. Set graticule flags.
  12178. @table @samp
  12179. @item white
  12180. Draw graticule for white point.
  12181. @item black
  12182. Draw graticule for black point.
  12183. @item name
  12184. Draw color points short names.
  12185. @end table
  12186. @item bgopacity, b
  12187. Set background opacity.
  12188. @item lthreshold, l
  12189. Set low threshold for color component not represented on X or Y axis.
  12190. Values lower than this value will be ignored. Default is 0.
  12191. Note this value is multiplied with actual max possible value one pixel component
  12192. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  12193. is 0.1 * 255 = 25.
  12194. @item hthreshold, h
  12195. Set high threshold for color component not represented on X or Y axis.
  12196. Values higher than this value will be ignored. Default is 1.
  12197. Note this value is multiplied with actual max possible value one pixel component
  12198. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  12199. is 0.9 * 255 = 230.
  12200. @item colorspace, c
  12201. Set what kind of colorspace to use when drawing graticule.
  12202. @table @samp
  12203. @item auto
  12204. @item 601
  12205. @item 709
  12206. @end table
  12207. Default is auto.
  12208. @end table
  12209. @anchor{vidstabdetect}
  12210. @section vidstabdetect
  12211. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  12212. @ref{vidstabtransform} for pass 2.
  12213. This filter generates a file with relative translation and rotation
  12214. transform information about subsequent frames, which is then used by
  12215. the @ref{vidstabtransform} filter.
  12216. To enable compilation of this filter you need to configure FFmpeg with
  12217. @code{--enable-libvidstab}.
  12218. This filter accepts the following options:
  12219. @table @option
  12220. @item result
  12221. Set the path to the file used to write the transforms information.
  12222. Default value is @file{transforms.trf}.
  12223. @item shakiness
  12224. Set how shaky the video is and how quick the camera is. It accepts an
  12225. integer in the range 1-10, a value of 1 means little shakiness, a
  12226. value of 10 means strong shakiness. Default value is 5.
  12227. @item accuracy
  12228. Set the accuracy of the detection process. It must be a value in the
  12229. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  12230. accuracy. Default value is 15.
  12231. @item stepsize
  12232. Set stepsize of the search process. The region around minimum is
  12233. scanned with 1 pixel resolution. Default value is 6.
  12234. @item mincontrast
  12235. Set minimum contrast. Below this value a local measurement field is
  12236. discarded. Must be a floating point value in the range 0-1. Default
  12237. value is 0.3.
  12238. @item tripod
  12239. Set reference frame number for tripod mode.
  12240. If enabled, the motion of the frames is compared to a reference frame
  12241. in the filtered stream, identified by the specified number. The idea
  12242. is to compensate all movements in a more-or-less static scene and keep
  12243. the camera view absolutely still.
  12244. If set to 0, it is disabled. The frames are counted starting from 1.
  12245. @item show
  12246. Show fields and transforms in the resulting frames. It accepts an
  12247. integer in the range 0-2. Default value is 0, which disables any
  12248. visualization.
  12249. @end table
  12250. @subsection Examples
  12251. @itemize
  12252. @item
  12253. Use default values:
  12254. @example
  12255. vidstabdetect
  12256. @end example
  12257. @item
  12258. Analyze strongly shaky movie and put the results in file
  12259. @file{mytransforms.trf}:
  12260. @example
  12261. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  12262. @end example
  12263. @item
  12264. Visualize the result of internal transformations in the resulting
  12265. video:
  12266. @example
  12267. vidstabdetect=show=1
  12268. @end example
  12269. @item
  12270. Analyze a video with medium shakiness using @command{ffmpeg}:
  12271. @example
  12272. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  12273. @end example
  12274. @end itemize
  12275. @anchor{vidstabtransform}
  12276. @section vidstabtransform
  12277. Video stabilization/deshaking: pass 2 of 2,
  12278. see @ref{vidstabdetect} for pass 1.
  12279. Read a file with transform information for each frame and
  12280. apply/compensate them. Together with the @ref{vidstabdetect}
  12281. filter this can be used to deshake videos. See also
  12282. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  12283. the @ref{unsharp} filter, see below.
  12284. To enable compilation of this filter you need to configure FFmpeg with
  12285. @code{--enable-libvidstab}.
  12286. @subsection Options
  12287. @table @option
  12288. @item input
  12289. Set path to the file used to read the transforms. Default value is
  12290. @file{transforms.trf}.
  12291. @item smoothing
  12292. Set the number of frames (value*2 + 1) used for lowpass filtering the
  12293. camera movements. Default value is 10.
  12294. For example a number of 10 means that 21 frames are used (10 in the
  12295. past and 10 in the future) to smoothen the motion in the video. A
  12296. larger value leads to a smoother video, but limits the acceleration of
  12297. the camera (pan/tilt movements). 0 is a special case where a static
  12298. camera is simulated.
  12299. @item optalgo
  12300. Set the camera path optimization algorithm.
  12301. Accepted values are:
  12302. @table @samp
  12303. @item gauss
  12304. gaussian kernel low-pass filter on camera motion (default)
  12305. @item avg
  12306. averaging on transformations
  12307. @end table
  12308. @item maxshift
  12309. Set maximal number of pixels to translate frames. Default value is -1,
  12310. meaning no limit.
  12311. @item maxangle
  12312. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  12313. value is -1, meaning no limit.
  12314. @item crop
  12315. Specify how to deal with borders that may be visible due to movement
  12316. compensation.
  12317. Available values are:
  12318. @table @samp
  12319. @item keep
  12320. keep image information from previous frame (default)
  12321. @item black
  12322. fill the border black
  12323. @end table
  12324. @item invert
  12325. Invert transforms if set to 1. Default value is 0.
  12326. @item relative
  12327. Consider transforms as relative to previous frame if set to 1,
  12328. absolute if set to 0. Default value is 0.
  12329. @item zoom
  12330. Set percentage to zoom. A positive value will result in a zoom-in
  12331. effect, a negative value in a zoom-out effect. Default value is 0 (no
  12332. zoom).
  12333. @item optzoom
  12334. Set optimal zooming to avoid borders.
  12335. Accepted values are:
  12336. @table @samp
  12337. @item 0
  12338. disabled
  12339. @item 1
  12340. optimal static zoom value is determined (only very strong movements
  12341. will lead to visible borders) (default)
  12342. @item 2
  12343. optimal adaptive zoom value is determined (no borders will be
  12344. visible), see @option{zoomspeed}
  12345. @end table
  12346. Note that the value given at zoom is added to the one calculated here.
  12347. @item zoomspeed
  12348. Set percent to zoom maximally each frame (enabled when
  12349. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  12350. 0.25.
  12351. @item interpol
  12352. Specify type of interpolation.
  12353. Available values are:
  12354. @table @samp
  12355. @item no
  12356. no interpolation
  12357. @item linear
  12358. linear only horizontal
  12359. @item bilinear
  12360. linear in both directions (default)
  12361. @item bicubic
  12362. cubic in both directions (slow)
  12363. @end table
  12364. @item tripod
  12365. Enable virtual tripod mode if set to 1, which is equivalent to
  12366. @code{relative=0:smoothing=0}. Default value is 0.
  12367. Use also @code{tripod} option of @ref{vidstabdetect}.
  12368. @item debug
  12369. Increase log verbosity if set to 1. Also the detected global motions
  12370. are written to the temporary file @file{global_motions.trf}. Default
  12371. value is 0.
  12372. @end table
  12373. @subsection Examples
  12374. @itemize
  12375. @item
  12376. Use @command{ffmpeg} for a typical stabilization with default values:
  12377. @example
  12378. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  12379. @end example
  12380. Note the use of the @ref{unsharp} filter which is always recommended.
  12381. @item
  12382. Zoom in a bit more and load transform data from a given file:
  12383. @example
  12384. vidstabtransform=zoom=5:input="mytransforms.trf"
  12385. @end example
  12386. @item
  12387. Smoothen the video even more:
  12388. @example
  12389. vidstabtransform=smoothing=30
  12390. @end example
  12391. @end itemize
  12392. @section vflip
  12393. Flip the input video vertically.
  12394. For example, to vertically flip a video with @command{ffmpeg}:
  12395. @example
  12396. ffmpeg -i in.avi -vf "vflip" out.avi
  12397. @end example
  12398. @anchor{vignette}
  12399. @section vignette
  12400. Make or reverse a natural vignetting effect.
  12401. The filter accepts the following options:
  12402. @table @option
  12403. @item angle, a
  12404. Set lens angle expression as a number of radians.
  12405. The value is clipped in the @code{[0,PI/2]} range.
  12406. Default value: @code{"PI/5"}
  12407. @item x0
  12408. @item y0
  12409. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  12410. by default.
  12411. @item mode
  12412. Set forward/backward mode.
  12413. Available modes are:
  12414. @table @samp
  12415. @item forward
  12416. The larger the distance from the central point, the darker the image becomes.
  12417. @item backward
  12418. The larger the distance from the central point, the brighter the image becomes.
  12419. This can be used to reverse a vignette effect, though there is no automatic
  12420. detection to extract the lens @option{angle} and other settings (yet). It can
  12421. also be used to create a burning effect.
  12422. @end table
  12423. Default value is @samp{forward}.
  12424. @item eval
  12425. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  12426. It accepts the following values:
  12427. @table @samp
  12428. @item init
  12429. Evaluate expressions only once during the filter initialization.
  12430. @item frame
  12431. Evaluate expressions for each incoming frame. This is way slower than the
  12432. @samp{init} mode since it requires all the scalers to be re-computed, but it
  12433. allows advanced dynamic expressions.
  12434. @end table
  12435. Default value is @samp{init}.
  12436. @item dither
  12437. Set dithering to reduce the circular banding effects. Default is @code{1}
  12438. (enabled).
  12439. @item aspect
  12440. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  12441. Setting this value to the SAR of the input will make a rectangular vignetting
  12442. following the dimensions of the video.
  12443. Default is @code{1/1}.
  12444. @end table
  12445. @subsection Expressions
  12446. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  12447. following parameters.
  12448. @table @option
  12449. @item w
  12450. @item h
  12451. input width and height
  12452. @item n
  12453. the number of input frame, starting from 0
  12454. @item pts
  12455. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  12456. @var{TB} units, NAN if undefined
  12457. @item r
  12458. frame rate of the input video, NAN if the input frame rate is unknown
  12459. @item t
  12460. the PTS (Presentation TimeStamp) of the filtered video frame,
  12461. expressed in seconds, NAN if undefined
  12462. @item tb
  12463. time base of the input video
  12464. @end table
  12465. @subsection Examples
  12466. @itemize
  12467. @item
  12468. Apply simple strong vignetting effect:
  12469. @example
  12470. vignette=PI/4
  12471. @end example
  12472. @item
  12473. Make a flickering vignetting:
  12474. @example
  12475. vignette='PI/4+random(1)*PI/50':eval=frame
  12476. @end example
  12477. @end itemize
  12478. @section vmafmotion
  12479. Obtain the average vmaf motion score of a video.
  12480. It is one of the component filters of VMAF.
  12481. The obtained average motion score is printed through the logging system.
  12482. In the below example the input file @file{ref.mpg} is being processed and score
  12483. is computed.
  12484. @example
  12485. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  12486. @end example
  12487. @section vstack
  12488. Stack input videos vertically.
  12489. All streams must be of same pixel format and of same width.
  12490. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  12491. to create same output.
  12492. The filter accept the following option:
  12493. @table @option
  12494. @item inputs
  12495. Set number of input streams. Default is 2.
  12496. @item shortest
  12497. If set to 1, force the output to terminate when the shortest input
  12498. terminates. Default value is 0.
  12499. @end table
  12500. @section w3fdif
  12501. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  12502. Deinterlacing Filter").
  12503. Based on the process described by Martin Weston for BBC R&D, and
  12504. implemented based on the de-interlace algorithm written by Jim
  12505. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  12506. uses filter coefficients calculated by BBC R&D.
  12507. There are two sets of filter coefficients, so called "simple":
  12508. and "complex". Which set of filter coefficients is used can
  12509. be set by passing an optional parameter:
  12510. @table @option
  12511. @item filter
  12512. Set the interlacing filter coefficients. Accepts one of the following values:
  12513. @table @samp
  12514. @item simple
  12515. Simple filter coefficient set.
  12516. @item complex
  12517. More-complex filter coefficient set.
  12518. @end table
  12519. Default value is @samp{complex}.
  12520. @item deint
  12521. Specify which frames to deinterlace. Accept one of the following values:
  12522. @table @samp
  12523. @item all
  12524. Deinterlace all frames,
  12525. @item interlaced
  12526. Only deinterlace frames marked as interlaced.
  12527. @end table
  12528. Default value is @samp{all}.
  12529. @end table
  12530. @section waveform
  12531. Video waveform monitor.
  12532. The waveform monitor plots color component intensity. By default luminance
  12533. only. Each column of the waveform corresponds to a column of pixels in the
  12534. source video.
  12535. It accepts the following options:
  12536. @table @option
  12537. @item mode, m
  12538. Can be either @code{row}, or @code{column}. Default is @code{column}.
  12539. In row mode, the graph on the left side represents color component value 0 and
  12540. the right side represents value = 255. In column mode, the top side represents
  12541. color component value = 0 and bottom side represents value = 255.
  12542. @item intensity, i
  12543. Set intensity. Smaller values are useful to find out how many values of the same
  12544. luminance are distributed across input rows/columns.
  12545. Default value is @code{0.04}. Allowed range is [0, 1].
  12546. @item mirror, r
  12547. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  12548. In mirrored mode, higher values will be represented on the left
  12549. side for @code{row} mode and at the top for @code{column} mode. Default is
  12550. @code{1} (mirrored).
  12551. @item display, d
  12552. Set display mode.
  12553. It accepts the following values:
  12554. @table @samp
  12555. @item overlay
  12556. Presents information identical to that in the @code{parade}, except
  12557. that the graphs representing color components are superimposed directly
  12558. over one another.
  12559. This display mode makes it easier to spot relative differences or similarities
  12560. in overlapping areas of the color components that are supposed to be identical,
  12561. such as neutral whites, grays, or blacks.
  12562. @item stack
  12563. Display separate graph for the color components side by side in
  12564. @code{row} mode or one below the other in @code{column} mode.
  12565. @item parade
  12566. Display separate graph for the color components side by side in
  12567. @code{column} mode or one below the other in @code{row} mode.
  12568. Using this display mode makes it easy to spot color casts in the highlights
  12569. and shadows of an image, by comparing the contours of the top and the bottom
  12570. graphs of each waveform. Since whites, grays, and blacks are characterized
  12571. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  12572. should display three waveforms of roughly equal width/height. If not, the
  12573. correction is easy to perform by making level adjustments the three waveforms.
  12574. @end table
  12575. Default is @code{stack}.
  12576. @item components, c
  12577. Set which color components to display. Default is 1, which means only luminance
  12578. or red color component if input is in RGB colorspace. If is set for example to
  12579. 7 it will display all 3 (if) available color components.
  12580. @item envelope, e
  12581. @table @samp
  12582. @item none
  12583. No envelope, this is default.
  12584. @item instant
  12585. Instant envelope, minimum and maximum values presented in graph will be easily
  12586. visible even with small @code{step} value.
  12587. @item peak
  12588. Hold minimum and maximum values presented in graph across time. This way you
  12589. can still spot out of range values without constantly looking at waveforms.
  12590. @item peak+instant
  12591. Peak and instant envelope combined together.
  12592. @end table
  12593. @item filter, f
  12594. @table @samp
  12595. @item lowpass
  12596. No filtering, this is default.
  12597. @item flat
  12598. Luma and chroma combined together.
  12599. @item aflat
  12600. Similar as above, but shows difference between blue and red chroma.
  12601. @item xflat
  12602. Similar as above, but use different colors.
  12603. @item chroma
  12604. Displays only chroma.
  12605. @item color
  12606. Displays actual color value on waveform.
  12607. @item acolor
  12608. Similar as above, but with luma showing frequency of chroma values.
  12609. @end table
  12610. @item graticule, g
  12611. Set which graticule to display.
  12612. @table @samp
  12613. @item none
  12614. Do not display graticule.
  12615. @item green
  12616. Display green graticule showing legal broadcast ranges.
  12617. @item orange
  12618. Display orange graticule showing legal broadcast ranges.
  12619. @end table
  12620. @item opacity, o
  12621. Set graticule opacity.
  12622. @item flags, fl
  12623. Set graticule flags.
  12624. @table @samp
  12625. @item numbers
  12626. Draw numbers above lines. By default enabled.
  12627. @item dots
  12628. Draw dots instead of lines.
  12629. @end table
  12630. @item scale, s
  12631. Set scale used for displaying graticule.
  12632. @table @samp
  12633. @item digital
  12634. @item millivolts
  12635. @item ire
  12636. @end table
  12637. Default is digital.
  12638. @item bgopacity, b
  12639. Set background opacity.
  12640. @end table
  12641. @section weave, doubleweave
  12642. The @code{weave} takes a field-based video input and join
  12643. each two sequential fields into single frame, producing a new double
  12644. height clip with half the frame rate and half the frame count.
  12645. The @code{doubleweave} works same as @code{weave} but without
  12646. halving frame rate and frame count.
  12647. It accepts the following option:
  12648. @table @option
  12649. @item first_field
  12650. Set first field. Available values are:
  12651. @table @samp
  12652. @item top, t
  12653. Set the frame as top-field-first.
  12654. @item bottom, b
  12655. Set the frame as bottom-field-first.
  12656. @end table
  12657. @end table
  12658. @subsection Examples
  12659. @itemize
  12660. @item
  12661. Interlace video using @ref{select} and @ref{separatefields} filter:
  12662. @example
  12663. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  12664. @end example
  12665. @end itemize
  12666. @section xbr
  12667. Apply the xBR high-quality magnification filter which is designed for pixel
  12668. art. It follows a set of edge-detection rules, see
  12669. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  12670. It accepts the following option:
  12671. @table @option
  12672. @item n
  12673. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  12674. @code{3xBR} and @code{4} for @code{4xBR}.
  12675. Default is @code{3}.
  12676. @end table
  12677. @anchor{yadif}
  12678. @section yadif
  12679. Deinterlace the input video ("yadif" means "yet another deinterlacing
  12680. filter").
  12681. It accepts the following parameters:
  12682. @table @option
  12683. @item mode
  12684. The interlacing mode to adopt. It accepts one of the following values:
  12685. @table @option
  12686. @item 0, send_frame
  12687. Output one frame for each frame.
  12688. @item 1, send_field
  12689. Output one frame for each field.
  12690. @item 2, send_frame_nospatial
  12691. Like @code{send_frame}, but it skips the spatial interlacing check.
  12692. @item 3, send_field_nospatial
  12693. Like @code{send_field}, but it skips the spatial interlacing check.
  12694. @end table
  12695. The default value is @code{send_frame}.
  12696. @item parity
  12697. The picture field parity assumed for the input interlaced video. It accepts one
  12698. of the following values:
  12699. @table @option
  12700. @item 0, tff
  12701. Assume the top field is first.
  12702. @item 1, bff
  12703. Assume the bottom field is first.
  12704. @item -1, auto
  12705. Enable automatic detection of field parity.
  12706. @end table
  12707. The default value is @code{auto}.
  12708. If the interlacing is unknown or the decoder does not export this information,
  12709. top field first will be assumed.
  12710. @item deint
  12711. Specify which frames to deinterlace. Accept one of the following
  12712. values:
  12713. @table @option
  12714. @item 0, all
  12715. Deinterlace all frames.
  12716. @item 1, interlaced
  12717. Only deinterlace frames marked as interlaced.
  12718. @end table
  12719. The default value is @code{all}.
  12720. @end table
  12721. @section zoompan
  12722. Apply Zoom & Pan effect.
  12723. This filter accepts the following options:
  12724. @table @option
  12725. @item zoom, z
  12726. Set the zoom expression. Default is 1.
  12727. @item x
  12728. @item y
  12729. Set the x and y expression. Default is 0.
  12730. @item d
  12731. Set the duration expression in number of frames.
  12732. This sets for how many number of frames effect will last for
  12733. single input image.
  12734. @item s
  12735. Set the output image size, default is 'hd720'.
  12736. @item fps
  12737. Set the output frame rate, default is '25'.
  12738. @end table
  12739. Each expression can contain the following constants:
  12740. @table @option
  12741. @item in_w, iw
  12742. Input width.
  12743. @item in_h, ih
  12744. Input height.
  12745. @item out_w, ow
  12746. Output width.
  12747. @item out_h, oh
  12748. Output height.
  12749. @item in
  12750. Input frame count.
  12751. @item on
  12752. Output frame count.
  12753. @item x
  12754. @item y
  12755. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  12756. for current input frame.
  12757. @item px
  12758. @item py
  12759. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  12760. not yet such frame (first input frame).
  12761. @item zoom
  12762. Last calculated zoom from 'z' expression for current input frame.
  12763. @item pzoom
  12764. Last calculated zoom of last output frame of previous input frame.
  12765. @item duration
  12766. Number of output frames for current input frame. Calculated from 'd' expression
  12767. for each input frame.
  12768. @item pduration
  12769. number of output frames created for previous input frame
  12770. @item a
  12771. Rational number: input width / input height
  12772. @item sar
  12773. sample aspect ratio
  12774. @item dar
  12775. display aspect ratio
  12776. @end table
  12777. @subsection Examples
  12778. @itemize
  12779. @item
  12780. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  12781. @example
  12782. 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
  12783. @end example
  12784. @item
  12785. Zoom-in up to 1.5 and pan always at center of picture:
  12786. @example
  12787. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12788. @end example
  12789. @item
  12790. Same as above but without pausing:
  12791. @example
  12792. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12793. @end example
  12794. @end itemize
  12795. @anchor{zscale}
  12796. @section zscale
  12797. Scale (resize) the input video, using the z.lib library:
  12798. https://github.com/sekrit-twc/zimg.
  12799. The zscale filter forces the output display aspect ratio to be the same
  12800. as the input, by changing the output sample aspect ratio.
  12801. If the input image format is different from the format requested by
  12802. the next filter, the zscale filter will convert the input to the
  12803. requested format.
  12804. @subsection Options
  12805. The filter accepts the following options.
  12806. @table @option
  12807. @item width, w
  12808. @item height, h
  12809. Set the output video dimension expression. Default value is the input
  12810. dimension.
  12811. If the @var{width} or @var{w} value is 0, the input width is used for
  12812. the output. If the @var{height} or @var{h} value is 0, the input height
  12813. is used for the output.
  12814. If one and only one of the values is -n with n >= 1, the zscale filter
  12815. will use a value that maintains the aspect ratio of the input image,
  12816. calculated from the other specified dimension. After that it will,
  12817. however, make sure that the calculated dimension is divisible by n and
  12818. adjust the value if necessary.
  12819. If both values are -n with n >= 1, the behavior will be identical to
  12820. both values being set to 0 as previously detailed.
  12821. See below for the list of accepted constants for use in the dimension
  12822. expression.
  12823. @item size, s
  12824. Set the video size. For the syntax of this option, check the
  12825. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12826. @item dither, d
  12827. Set the dither type.
  12828. Possible values are:
  12829. @table @var
  12830. @item none
  12831. @item ordered
  12832. @item random
  12833. @item error_diffusion
  12834. @end table
  12835. Default is none.
  12836. @item filter, f
  12837. Set the resize filter type.
  12838. Possible values are:
  12839. @table @var
  12840. @item point
  12841. @item bilinear
  12842. @item bicubic
  12843. @item spline16
  12844. @item spline36
  12845. @item lanczos
  12846. @end table
  12847. Default is bilinear.
  12848. @item range, r
  12849. Set the color range.
  12850. Possible values are:
  12851. @table @var
  12852. @item input
  12853. @item limited
  12854. @item full
  12855. @end table
  12856. Default is same as input.
  12857. @item primaries, p
  12858. Set the color primaries.
  12859. Possible values are:
  12860. @table @var
  12861. @item input
  12862. @item 709
  12863. @item unspecified
  12864. @item 170m
  12865. @item 240m
  12866. @item 2020
  12867. @end table
  12868. Default is same as input.
  12869. @item transfer, t
  12870. Set the transfer characteristics.
  12871. Possible values are:
  12872. @table @var
  12873. @item input
  12874. @item 709
  12875. @item unspecified
  12876. @item 601
  12877. @item linear
  12878. @item 2020_10
  12879. @item 2020_12
  12880. @item smpte2084
  12881. @item iec61966-2-1
  12882. @item arib-std-b67
  12883. @end table
  12884. Default is same as input.
  12885. @item matrix, m
  12886. Set the colorspace matrix.
  12887. Possible value are:
  12888. @table @var
  12889. @item input
  12890. @item 709
  12891. @item unspecified
  12892. @item 470bg
  12893. @item 170m
  12894. @item 2020_ncl
  12895. @item 2020_cl
  12896. @end table
  12897. Default is same as input.
  12898. @item rangein, rin
  12899. Set the input color range.
  12900. Possible values are:
  12901. @table @var
  12902. @item input
  12903. @item limited
  12904. @item full
  12905. @end table
  12906. Default is same as input.
  12907. @item primariesin, pin
  12908. Set the input color primaries.
  12909. Possible values are:
  12910. @table @var
  12911. @item input
  12912. @item 709
  12913. @item unspecified
  12914. @item 170m
  12915. @item 240m
  12916. @item 2020
  12917. @end table
  12918. Default is same as input.
  12919. @item transferin, tin
  12920. Set the input transfer characteristics.
  12921. Possible values are:
  12922. @table @var
  12923. @item input
  12924. @item 709
  12925. @item unspecified
  12926. @item 601
  12927. @item linear
  12928. @item 2020_10
  12929. @item 2020_12
  12930. @end table
  12931. Default is same as input.
  12932. @item matrixin, min
  12933. Set the input colorspace matrix.
  12934. Possible value are:
  12935. @table @var
  12936. @item input
  12937. @item 709
  12938. @item unspecified
  12939. @item 470bg
  12940. @item 170m
  12941. @item 2020_ncl
  12942. @item 2020_cl
  12943. @end table
  12944. @item chromal, c
  12945. Set the output chroma location.
  12946. Possible values are:
  12947. @table @var
  12948. @item input
  12949. @item left
  12950. @item center
  12951. @item topleft
  12952. @item top
  12953. @item bottomleft
  12954. @item bottom
  12955. @end table
  12956. @item chromalin, cin
  12957. Set the input chroma location.
  12958. Possible values are:
  12959. @table @var
  12960. @item input
  12961. @item left
  12962. @item center
  12963. @item topleft
  12964. @item top
  12965. @item bottomleft
  12966. @item bottom
  12967. @end table
  12968. @item npl
  12969. Set the nominal peak luminance.
  12970. @end table
  12971. The values of the @option{w} and @option{h} options are expressions
  12972. containing the following constants:
  12973. @table @var
  12974. @item in_w
  12975. @item in_h
  12976. The input width and height
  12977. @item iw
  12978. @item ih
  12979. These are the same as @var{in_w} and @var{in_h}.
  12980. @item out_w
  12981. @item out_h
  12982. The output (scaled) width and height
  12983. @item ow
  12984. @item oh
  12985. These are the same as @var{out_w} and @var{out_h}
  12986. @item a
  12987. The same as @var{iw} / @var{ih}
  12988. @item sar
  12989. input sample aspect ratio
  12990. @item dar
  12991. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12992. @item hsub
  12993. @item vsub
  12994. horizontal and vertical input chroma subsample values. For example for the
  12995. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12996. @item ohsub
  12997. @item ovsub
  12998. horizontal and vertical output chroma subsample values. For example for the
  12999. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13000. @end table
  13001. @table @option
  13002. @end table
  13003. @c man end VIDEO FILTERS
  13004. @chapter Video Sources
  13005. @c man begin VIDEO SOURCES
  13006. Below is a description of the currently available video sources.
  13007. @section buffer
  13008. Buffer video frames, and make them available to the filter chain.
  13009. This source is mainly intended for a programmatic use, in particular
  13010. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  13011. It accepts the following parameters:
  13012. @table @option
  13013. @item video_size
  13014. Specify the size (width and height) of the buffered video frames. For the
  13015. syntax of this option, check the
  13016. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13017. @item width
  13018. The input video width.
  13019. @item height
  13020. The input video height.
  13021. @item pix_fmt
  13022. A string representing the pixel format of the buffered video frames.
  13023. It may be a number corresponding to a pixel format, or a pixel format
  13024. name.
  13025. @item time_base
  13026. Specify the timebase assumed by the timestamps of the buffered frames.
  13027. @item frame_rate
  13028. Specify the frame rate expected for the video stream.
  13029. @item pixel_aspect, sar
  13030. The sample (pixel) aspect ratio of the input video.
  13031. @item sws_param
  13032. Specify the optional parameters to be used for the scale filter which
  13033. is automatically inserted when an input change is detected in the
  13034. input size or format.
  13035. @item hw_frames_ctx
  13036. When using a hardware pixel format, this should be a reference to an
  13037. AVHWFramesContext describing input frames.
  13038. @end table
  13039. For example:
  13040. @example
  13041. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  13042. @end example
  13043. will instruct the source to accept video frames with size 320x240 and
  13044. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  13045. square pixels (1:1 sample aspect ratio).
  13046. Since the pixel format with name "yuv410p" corresponds to the number 6
  13047. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  13048. this example corresponds to:
  13049. @example
  13050. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  13051. @end example
  13052. Alternatively, the options can be specified as a flat string, but this
  13053. syntax is deprecated:
  13054. @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}]
  13055. @section cellauto
  13056. Create a pattern generated by an elementary cellular automaton.
  13057. The initial state of the cellular automaton can be defined through the
  13058. @option{filename} and @option{pattern} options. If such options are
  13059. not specified an initial state is created randomly.
  13060. At each new frame a new row in the video is filled with the result of
  13061. the cellular automaton next generation. The behavior when the whole
  13062. frame is filled is defined by the @option{scroll} option.
  13063. This source accepts the following options:
  13064. @table @option
  13065. @item filename, f
  13066. Read the initial cellular automaton state, i.e. the starting row, from
  13067. the specified file.
  13068. In the file, each non-whitespace character is considered an alive
  13069. cell, a newline will terminate the row, and further characters in the
  13070. file will be ignored.
  13071. @item pattern, p
  13072. Read the initial cellular automaton state, i.e. the starting row, from
  13073. the specified string.
  13074. Each non-whitespace character in the string is considered an alive
  13075. cell, a newline will terminate the row, and further characters in the
  13076. string will be ignored.
  13077. @item rate, r
  13078. Set the video rate, that is the number of frames generated per second.
  13079. Default is 25.
  13080. @item random_fill_ratio, ratio
  13081. Set the random fill ratio for the initial cellular automaton row. It
  13082. is a floating point number value ranging from 0 to 1, defaults to
  13083. 1/PHI.
  13084. This option is ignored when a file or a pattern is specified.
  13085. @item random_seed, seed
  13086. Set the seed for filling randomly the initial row, must be an integer
  13087. included between 0 and UINT32_MAX. If not specified, or if explicitly
  13088. set to -1, the filter will try to use a good random seed on a best
  13089. effort basis.
  13090. @item rule
  13091. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  13092. Default value is 110.
  13093. @item size, s
  13094. Set the size of the output video. For the syntax of this option, check the
  13095. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13096. If @option{filename} or @option{pattern} is specified, the size is set
  13097. by default to the width of the specified initial state row, and the
  13098. height is set to @var{width} * PHI.
  13099. If @option{size} is set, it must contain the width of the specified
  13100. pattern string, and the specified pattern will be centered in the
  13101. larger row.
  13102. If a filename or a pattern string is not specified, the size value
  13103. defaults to "320x518" (used for a randomly generated initial state).
  13104. @item scroll
  13105. If set to 1, scroll the output upward when all the rows in the output
  13106. have been already filled. If set to 0, the new generated row will be
  13107. written over the top row just after the bottom row is filled.
  13108. Defaults to 1.
  13109. @item start_full, full
  13110. If set to 1, completely fill the output with generated rows before
  13111. outputting the first frame.
  13112. This is the default behavior, for disabling set the value to 0.
  13113. @item stitch
  13114. If set to 1, stitch the left and right row edges together.
  13115. This is the default behavior, for disabling set the value to 0.
  13116. @end table
  13117. @subsection Examples
  13118. @itemize
  13119. @item
  13120. Read the initial state from @file{pattern}, and specify an output of
  13121. size 200x400.
  13122. @example
  13123. cellauto=f=pattern:s=200x400
  13124. @end example
  13125. @item
  13126. Generate a random initial row with a width of 200 cells, with a fill
  13127. ratio of 2/3:
  13128. @example
  13129. cellauto=ratio=2/3:s=200x200
  13130. @end example
  13131. @item
  13132. Create a pattern generated by rule 18 starting by a single alive cell
  13133. centered on an initial row with width 100:
  13134. @example
  13135. cellauto=p=@@:s=100x400:full=0:rule=18
  13136. @end example
  13137. @item
  13138. Specify a more elaborated initial pattern:
  13139. @example
  13140. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  13141. @end example
  13142. @end itemize
  13143. @anchor{coreimagesrc}
  13144. @section coreimagesrc
  13145. Video source generated on GPU using Apple's CoreImage API on OSX.
  13146. This video source is a specialized version of the @ref{coreimage} video filter.
  13147. Use a core image generator at the beginning of the applied filterchain to
  13148. generate the content.
  13149. The coreimagesrc video source accepts the following options:
  13150. @table @option
  13151. @item list_generators
  13152. List all available generators along with all their respective options as well as
  13153. possible minimum and maximum values along with the default values.
  13154. @example
  13155. list_generators=true
  13156. @end example
  13157. @item size, s
  13158. Specify the size of the sourced video. For the syntax of this option, check the
  13159. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13160. The default value is @code{320x240}.
  13161. @item rate, r
  13162. Specify the frame rate of the sourced video, as the number of frames
  13163. generated per second. It has to be a string in the format
  13164. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13165. number or a valid video frame rate abbreviation. The default value is
  13166. "25".
  13167. @item sar
  13168. Set the sample aspect ratio of the sourced video.
  13169. @item duration, d
  13170. Set the duration of the sourced video. See
  13171. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13172. for the accepted syntax.
  13173. If not specified, or the expressed duration is negative, the video is
  13174. supposed to be generated forever.
  13175. @end table
  13176. Additionally, all options of the @ref{coreimage} video filter are accepted.
  13177. A complete filterchain can be used for further processing of the
  13178. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  13179. and examples for details.
  13180. @subsection Examples
  13181. @itemize
  13182. @item
  13183. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  13184. given as complete and escaped command-line for Apple's standard bash shell:
  13185. @example
  13186. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  13187. @end example
  13188. This example is equivalent to the QRCode example of @ref{coreimage} without the
  13189. need for a nullsrc video source.
  13190. @end itemize
  13191. @section mandelbrot
  13192. Generate a Mandelbrot set fractal, and progressively zoom towards the
  13193. point specified with @var{start_x} and @var{start_y}.
  13194. This source accepts the following options:
  13195. @table @option
  13196. @item end_pts
  13197. Set the terminal pts value. Default value is 400.
  13198. @item end_scale
  13199. Set the terminal scale value.
  13200. Must be a floating point value. Default value is 0.3.
  13201. @item inner
  13202. Set the inner coloring mode, that is the algorithm used to draw the
  13203. Mandelbrot fractal internal region.
  13204. It shall assume one of the following values:
  13205. @table @option
  13206. @item black
  13207. Set black mode.
  13208. @item convergence
  13209. Show time until convergence.
  13210. @item mincol
  13211. Set color based on point closest to the origin of the iterations.
  13212. @item period
  13213. Set period mode.
  13214. @end table
  13215. Default value is @var{mincol}.
  13216. @item bailout
  13217. Set the bailout value. Default value is 10.0.
  13218. @item maxiter
  13219. Set the maximum of iterations performed by the rendering
  13220. algorithm. Default value is 7189.
  13221. @item outer
  13222. Set outer coloring mode.
  13223. It shall assume one of following values:
  13224. @table @option
  13225. @item iteration_count
  13226. Set iteration cound mode.
  13227. @item normalized_iteration_count
  13228. set normalized iteration count mode.
  13229. @end table
  13230. Default value is @var{normalized_iteration_count}.
  13231. @item rate, r
  13232. Set frame rate, expressed as number of frames per second. Default
  13233. value is "25".
  13234. @item size, s
  13235. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  13236. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  13237. @item start_scale
  13238. Set the initial scale value. Default value is 3.0.
  13239. @item start_x
  13240. Set the initial x position. Must be a floating point value between
  13241. -100 and 100. Default value is -0.743643887037158704752191506114774.
  13242. @item start_y
  13243. Set the initial y position. Must be a floating point value between
  13244. -100 and 100. Default value is -0.131825904205311970493132056385139.
  13245. @end table
  13246. @section mptestsrc
  13247. Generate various test patterns, as generated by the MPlayer test filter.
  13248. The size of the generated video is fixed, and is 256x256.
  13249. This source is useful in particular for testing encoding features.
  13250. This source accepts the following options:
  13251. @table @option
  13252. @item rate, r
  13253. Specify the frame rate of the sourced video, as the number of frames
  13254. generated per second. It has to be a string in the format
  13255. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13256. number or a valid video frame rate abbreviation. The default value is
  13257. "25".
  13258. @item duration, d
  13259. Set the duration of the sourced video. See
  13260. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13261. for the accepted syntax.
  13262. If not specified, or the expressed duration is negative, the video is
  13263. supposed to be generated forever.
  13264. @item test, t
  13265. Set the number or the name of the test to perform. Supported tests are:
  13266. @table @option
  13267. @item dc_luma
  13268. @item dc_chroma
  13269. @item freq_luma
  13270. @item freq_chroma
  13271. @item amp_luma
  13272. @item amp_chroma
  13273. @item cbp
  13274. @item mv
  13275. @item ring1
  13276. @item ring2
  13277. @item all
  13278. @end table
  13279. Default value is "all", which will cycle through the list of all tests.
  13280. @end table
  13281. Some examples:
  13282. @example
  13283. mptestsrc=t=dc_luma
  13284. @end example
  13285. will generate a "dc_luma" test pattern.
  13286. @section frei0r_src
  13287. Provide a frei0r source.
  13288. To enable compilation of this filter you need to install the frei0r
  13289. header and configure FFmpeg with @code{--enable-frei0r}.
  13290. This source accepts the following parameters:
  13291. @table @option
  13292. @item size
  13293. The size of the video to generate. For the syntax of this option, check the
  13294. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13295. @item framerate
  13296. The framerate of the generated video. It may be a string of the form
  13297. @var{num}/@var{den} or a frame rate abbreviation.
  13298. @item filter_name
  13299. The name to the frei0r source to load. For more information regarding frei0r and
  13300. how to set the parameters, read the @ref{frei0r} section in the video filters
  13301. documentation.
  13302. @item filter_params
  13303. A '|'-separated list of parameters to pass to the frei0r source.
  13304. @end table
  13305. For example, to generate a frei0r partik0l source with size 200x200
  13306. and frame rate 10 which is overlaid on the overlay filter main input:
  13307. @example
  13308. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  13309. @end example
  13310. @section life
  13311. Generate a life pattern.
  13312. This source is based on a generalization of John Conway's life game.
  13313. The sourced input represents a life grid, each pixel represents a cell
  13314. which can be in one of two possible states, alive or dead. Every cell
  13315. interacts with its eight neighbours, which are the cells that are
  13316. horizontally, vertically, or diagonally adjacent.
  13317. At each interaction the grid evolves according to the adopted rule,
  13318. which specifies the number of neighbor alive cells which will make a
  13319. cell stay alive or born. The @option{rule} option allows one to specify
  13320. the rule to adopt.
  13321. This source accepts the following options:
  13322. @table @option
  13323. @item filename, f
  13324. Set the file from which to read the initial grid state. In the file,
  13325. each non-whitespace character is considered an alive cell, and newline
  13326. is used to delimit the end of each row.
  13327. If this option is not specified, the initial grid is generated
  13328. randomly.
  13329. @item rate, r
  13330. Set the video rate, that is the number of frames generated per second.
  13331. Default is 25.
  13332. @item random_fill_ratio, ratio
  13333. Set the random fill ratio for the initial random grid. It is a
  13334. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  13335. It is ignored when a file is specified.
  13336. @item random_seed, seed
  13337. Set the seed for filling the initial random grid, must be an integer
  13338. included between 0 and UINT32_MAX. If not specified, or if explicitly
  13339. set to -1, the filter will try to use a good random seed on a best
  13340. effort basis.
  13341. @item rule
  13342. Set the life rule.
  13343. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  13344. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  13345. @var{NS} specifies the number of alive neighbor cells which make a
  13346. live cell stay alive, and @var{NB} the number of alive neighbor cells
  13347. which make a dead cell to become alive (i.e. to "born").
  13348. "s" and "b" can be used in place of "S" and "B", respectively.
  13349. Alternatively a rule can be specified by an 18-bits integer. The 9
  13350. high order bits are used to encode the next cell state if it is alive
  13351. for each number of neighbor alive cells, the low order bits specify
  13352. the rule for "borning" new cells. Higher order bits encode for an
  13353. higher number of neighbor cells.
  13354. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  13355. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  13356. Default value is "S23/B3", which is the original Conway's game of life
  13357. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  13358. cells, and will born a new cell if there are three alive cells around
  13359. a dead cell.
  13360. @item size, s
  13361. Set the size of the output video. For the syntax of this option, check the
  13362. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13363. If @option{filename} is specified, the size is set by default to the
  13364. same size of the input file. If @option{size} is set, it must contain
  13365. the size specified in the input file, and the initial grid defined in
  13366. that file is centered in the larger resulting area.
  13367. If a filename is not specified, the size value defaults to "320x240"
  13368. (used for a randomly generated initial grid).
  13369. @item stitch
  13370. If set to 1, stitch the left and right grid edges together, and the
  13371. top and bottom edges also. Defaults to 1.
  13372. @item mold
  13373. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  13374. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  13375. value from 0 to 255.
  13376. @item life_color
  13377. Set the color of living (or new born) cells.
  13378. @item death_color
  13379. Set the color of dead cells. If @option{mold} is set, this is the first color
  13380. used to represent a dead cell.
  13381. @item mold_color
  13382. Set mold color, for definitely dead and moldy cells.
  13383. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  13384. ffmpeg-utils manual,ffmpeg-utils}.
  13385. @end table
  13386. @subsection Examples
  13387. @itemize
  13388. @item
  13389. Read a grid from @file{pattern}, and center it on a grid of size
  13390. 300x300 pixels:
  13391. @example
  13392. life=f=pattern:s=300x300
  13393. @end example
  13394. @item
  13395. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  13396. @example
  13397. life=ratio=2/3:s=200x200
  13398. @end example
  13399. @item
  13400. Specify a custom rule for evolving a randomly generated grid:
  13401. @example
  13402. life=rule=S14/B34
  13403. @end example
  13404. @item
  13405. Full example with slow death effect (mold) using @command{ffplay}:
  13406. @example
  13407. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  13408. @end example
  13409. @end itemize
  13410. @anchor{allrgb}
  13411. @anchor{allyuv}
  13412. @anchor{color}
  13413. @anchor{haldclutsrc}
  13414. @anchor{nullsrc}
  13415. @anchor{rgbtestsrc}
  13416. @anchor{smptebars}
  13417. @anchor{smptehdbars}
  13418. @anchor{testsrc}
  13419. @anchor{testsrc2}
  13420. @anchor{yuvtestsrc}
  13421. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  13422. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  13423. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  13424. The @code{color} source provides an uniformly colored input.
  13425. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  13426. @ref{haldclut} filter.
  13427. The @code{nullsrc} source returns unprocessed video frames. It is
  13428. mainly useful to be employed in analysis / debugging tools, or as the
  13429. source for filters which ignore the input data.
  13430. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  13431. detecting RGB vs BGR issues. You should see a red, green and blue
  13432. stripe from top to bottom.
  13433. The @code{smptebars} source generates a color bars pattern, based on
  13434. the SMPTE Engineering Guideline EG 1-1990.
  13435. The @code{smptehdbars} source generates a color bars pattern, based on
  13436. the SMPTE RP 219-2002.
  13437. The @code{testsrc} source generates a test video pattern, showing a
  13438. color pattern, a scrolling gradient and a timestamp. This is mainly
  13439. intended for testing purposes.
  13440. The @code{testsrc2} source is similar to testsrc, but supports more
  13441. pixel formats instead of just @code{rgb24}. This allows using it as an
  13442. input for other tests without requiring a format conversion.
  13443. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  13444. see a y, cb and cr stripe from top to bottom.
  13445. The sources accept the following parameters:
  13446. @table @option
  13447. @item level
  13448. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  13449. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  13450. pixels to be used as identity matrix for 3D lookup tables. Each component is
  13451. coded on a @code{1/(N*N)} scale.
  13452. @item color, c
  13453. Specify the color of the source, only available in the @code{color}
  13454. source. For the syntax of this option, check the
  13455. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13456. @item size, s
  13457. Specify the size of the sourced video. For the syntax of this option, check the
  13458. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13459. The default value is @code{320x240}.
  13460. This option is not available with the @code{allrgb}, @code{allyuv}, and
  13461. @code{haldclutsrc} filters.
  13462. @item rate, r
  13463. Specify the frame rate of the sourced video, as the number of frames
  13464. generated per second. It has to be a string in the format
  13465. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13466. number or a valid video frame rate abbreviation. The default value is
  13467. "25".
  13468. @item duration, d
  13469. Set the duration of the sourced video. See
  13470. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13471. for the accepted syntax.
  13472. If not specified, or the expressed duration is negative, the video is
  13473. supposed to be generated forever.
  13474. @item sar
  13475. Set the sample aspect ratio of the sourced video.
  13476. @item alpha
  13477. Specify the alpha (opacity) of the background, only available in the
  13478. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  13479. 255 (fully opaque, the default).
  13480. @item decimals, n
  13481. Set the number of decimals to show in the timestamp, only available in the
  13482. @code{testsrc} source.
  13483. The displayed timestamp value will correspond to the original
  13484. timestamp value multiplied by the power of 10 of the specified
  13485. value. Default value is 0.
  13486. @end table
  13487. @subsection Examples
  13488. @itemize
  13489. @item
  13490. Generate a video with a duration of 5.3 seconds, with size
  13491. 176x144 and a frame rate of 10 frames per second:
  13492. @example
  13493. testsrc=duration=5.3:size=qcif:rate=10
  13494. @end example
  13495. @item
  13496. The following graph description will generate a red source
  13497. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  13498. frames per second:
  13499. @example
  13500. color=c=red@@0.2:s=qcif:r=10
  13501. @end example
  13502. @item
  13503. If the input content is to be ignored, @code{nullsrc} can be used. The
  13504. following command generates noise in the luminance plane by employing
  13505. the @code{geq} filter:
  13506. @example
  13507. nullsrc=s=256x256, geq=random(1)*255:128:128
  13508. @end example
  13509. @end itemize
  13510. @subsection Commands
  13511. The @code{color} source supports the following commands:
  13512. @table @option
  13513. @item c, color
  13514. Set the color of the created image. Accepts the same syntax of the
  13515. corresponding @option{color} option.
  13516. @end table
  13517. @section openclsrc
  13518. Generate video using an OpenCL program.
  13519. @table @option
  13520. @item source
  13521. OpenCL program source file.
  13522. @item kernel
  13523. Kernel name in program.
  13524. @item size, s
  13525. Size of frames to generate. This must be set.
  13526. @item format
  13527. Pixel format to use for the generated frames. This must be set.
  13528. @item rate, r
  13529. Number of frames generated every second. Default value is '25'.
  13530. @end table
  13531. For details of how the program loading works, see the @ref{program_opencl}
  13532. filter.
  13533. Example programs:
  13534. @itemize
  13535. @item
  13536. Generate a colour ramp by setting pixel values from the position of the pixel
  13537. in the output image. (Note that this will work with all pixel formats, but
  13538. the generated output will not be the same.)
  13539. @verbatim
  13540. __kernel void ramp(__write_only image2d_t dst,
  13541. unsigned int index)
  13542. {
  13543. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  13544. float4 val;
  13545. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  13546. write_imagef(dst, loc, val);
  13547. }
  13548. @end verbatim
  13549. @item
  13550. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  13551. @verbatim
  13552. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  13553. unsigned int index)
  13554. {
  13555. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  13556. float4 value = 0.0f;
  13557. int x = loc.x + index;
  13558. int y = loc.y + index;
  13559. while (x > 0 || y > 0) {
  13560. if (x % 3 == 1 && y % 3 == 1) {
  13561. value = 1.0f;
  13562. break;
  13563. }
  13564. x /= 3;
  13565. y /= 3;
  13566. }
  13567. write_imagef(dst, loc, value);
  13568. }
  13569. @end verbatim
  13570. @end itemize
  13571. @c man end VIDEO SOURCES
  13572. @chapter Video Sinks
  13573. @c man begin VIDEO SINKS
  13574. Below is a description of the currently available video sinks.
  13575. @section buffersink
  13576. Buffer video frames, and make them available to the end of the filter
  13577. graph.
  13578. This sink is mainly intended for programmatic use, in particular
  13579. through the interface defined in @file{libavfilter/buffersink.h}
  13580. or the options system.
  13581. It accepts a pointer to an AVBufferSinkContext structure, which
  13582. defines the incoming buffers' formats, to be passed as the opaque
  13583. parameter to @code{avfilter_init_filter} for initialization.
  13584. @section nullsink
  13585. Null video sink: do absolutely nothing with the input video. It is
  13586. mainly useful as a template and for use in analysis / debugging
  13587. tools.
  13588. @c man end VIDEO SINKS
  13589. @chapter Multimedia Filters
  13590. @c man begin MULTIMEDIA FILTERS
  13591. Below is a description of the currently available multimedia filters.
  13592. @section abitscope
  13593. Convert input audio to a video output, displaying the audio bit scope.
  13594. The filter accepts the following options:
  13595. @table @option
  13596. @item rate, r
  13597. Set frame rate, expressed as number of frames per second. Default
  13598. value is "25".
  13599. @item size, s
  13600. Specify the video size for the output. For the syntax of this option, check the
  13601. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13602. Default value is @code{1024x256}.
  13603. @item colors
  13604. Specify list of colors separated by space or by '|' which will be used to
  13605. draw channels. Unrecognized or missing colors will be replaced
  13606. by white color.
  13607. @end table
  13608. @section ahistogram
  13609. Convert input audio to a video output, displaying the volume histogram.
  13610. The filter accepts the following options:
  13611. @table @option
  13612. @item dmode
  13613. Specify how histogram is calculated.
  13614. It accepts the following values:
  13615. @table @samp
  13616. @item single
  13617. Use single histogram for all channels.
  13618. @item separate
  13619. Use separate histogram for each channel.
  13620. @end table
  13621. Default is @code{single}.
  13622. @item rate, r
  13623. Set frame rate, expressed as number of frames per second. Default
  13624. value is "25".
  13625. @item size, s
  13626. Specify the video size for the output. For the syntax of this option, check the
  13627. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13628. Default value is @code{hd720}.
  13629. @item scale
  13630. Set display scale.
  13631. It accepts the following values:
  13632. @table @samp
  13633. @item log
  13634. logarithmic
  13635. @item sqrt
  13636. square root
  13637. @item cbrt
  13638. cubic root
  13639. @item lin
  13640. linear
  13641. @item rlog
  13642. reverse logarithmic
  13643. @end table
  13644. Default is @code{log}.
  13645. @item ascale
  13646. Set amplitude scale.
  13647. It accepts the following values:
  13648. @table @samp
  13649. @item log
  13650. logarithmic
  13651. @item lin
  13652. linear
  13653. @end table
  13654. Default is @code{log}.
  13655. @item acount
  13656. Set how much frames to accumulate in histogram.
  13657. Defauls is 1. Setting this to -1 accumulates all frames.
  13658. @item rheight
  13659. Set histogram ratio of window height.
  13660. @item slide
  13661. Set sonogram sliding.
  13662. It accepts the following values:
  13663. @table @samp
  13664. @item replace
  13665. replace old rows with new ones.
  13666. @item scroll
  13667. scroll from top to bottom.
  13668. @end table
  13669. Default is @code{replace}.
  13670. @end table
  13671. @section aphasemeter
  13672. Convert input audio to a video output, displaying the audio phase.
  13673. The filter accepts the following options:
  13674. @table @option
  13675. @item rate, r
  13676. Set the output frame rate. Default value is @code{25}.
  13677. @item size, s
  13678. Set the video size for the output. For the syntax of this option, check the
  13679. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13680. Default value is @code{800x400}.
  13681. @item rc
  13682. @item gc
  13683. @item bc
  13684. Specify the red, green, blue contrast. Default values are @code{2},
  13685. @code{7} and @code{1}.
  13686. Allowed range is @code{[0, 255]}.
  13687. @item mpc
  13688. Set color which will be used for drawing median phase. If color is
  13689. @code{none} which is default, no median phase value will be drawn.
  13690. @item video
  13691. Enable video output. Default is enabled.
  13692. @end table
  13693. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  13694. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  13695. The @code{-1} means left and right channels are completely out of phase and
  13696. @code{1} means channels are in phase.
  13697. @section avectorscope
  13698. Convert input audio to a video output, representing the audio vector
  13699. scope.
  13700. The filter is used to measure the difference between channels of stereo
  13701. audio stream. A monoaural signal, consisting of identical left and right
  13702. signal, results in straight vertical line. Any stereo separation is visible
  13703. as a deviation from this line, creating a Lissajous figure.
  13704. If the straight (or deviation from it) but horizontal line appears this
  13705. indicates that the left and right channels are out of phase.
  13706. The filter accepts the following options:
  13707. @table @option
  13708. @item mode, m
  13709. Set the vectorscope mode.
  13710. Available values are:
  13711. @table @samp
  13712. @item lissajous
  13713. Lissajous rotated by 45 degrees.
  13714. @item lissajous_xy
  13715. Same as above but not rotated.
  13716. @item polar
  13717. Shape resembling half of circle.
  13718. @end table
  13719. Default value is @samp{lissajous}.
  13720. @item size, s
  13721. Set the video size for the output. For the syntax of this option, check the
  13722. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13723. Default value is @code{400x400}.
  13724. @item rate, r
  13725. Set the output frame rate. Default value is @code{25}.
  13726. @item rc
  13727. @item gc
  13728. @item bc
  13729. @item ac
  13730. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  13731. @code{160}, @code{80} and @code{255}.
  13732. Allowed range is @code{[0, 255]}.
  13733. @item rf
  13734. @item gf
  13735. @item bf
  13736. @item af
  13737. Specify the red, green, blue and alpha fade. Default values are @code{15},
  13738. @code{10}, @code{5} and @code{5}.
  13739. Allowed range is @code{[0, 255]}.
  13740. @item zoom
  13741. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  13742. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  13743. @item draw
  13744. Set the vectorscope drawing mode.
  13745. Available values are:
  13746. @table @samp
  13747. @item dot
  13748. Draw dot for each sample.
  13749. @item line
  13750. Draw line between previous and current sample.
  13751. @end table
  13752. Default value is @samp{dot}.
  13753. @item scale
  13754. Specify amplitude scale of audio samples.
  13755. Available values are:
  13756. @table @samp
  13757. @item lin
  13758. Linear.
  13759. @item sqrt
  13760. Square root.
  13761. @item cbrt
  13762. Cubic root.
  13763. @item log
  13764. Logarithmic.
  13765. @end table
  13766. @item swap
  13767. Swap left channel axis with right channel axis.
  13768. @item mirror
  13769. Mirror axis.
  13770. @table @samp
  13771. @item none
  13772. No mirror.
  13773. @item x
  13774. Mirror only x axis.
  13775. @item y
  13776. Mirror only y axis.
  13777. @item xy
  13778. Mirror both axis.
  13779. @end table
  13780. @end table
  13781. @subsection Examples
  13782. @itemize
  13783. @item
  13784. Complete example using @command{ffplay}:
  13785. @example
  13786. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  13787. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  13788. @end example
  13789. @end itemize
  13790. @section bench, abench
  13791. Benchmark part of a filtergraph.
  13792. The filter accepts the following options:
  13793. @table @option
  13794. @item action
  13795. Start or stop a timer.
  13796. Available values are:
  13797. @table @samp
  13798. @item start
  13799. Get the current time, set it as frame metadata (using the key
  13800. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  13801. @item stop
  13802. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  13803. the input frame metadata to get the time difference. Time difference, average,
  13804. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  13805. @code{min}) are then printed. The timestamps are expressed in seconds.
  13806. @end table
  13807. @end table
  13808. @subsection Examples
  13809. @itemize
  13810. @item
  13811. Benchmark @ref{selectivecolor} filter:
  13812. @example
  13813. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  13814. @end example
  13815. @end itemize
  13816. @section concat
  13817. Concatenate audio and video streams, joining them together one after the
  13818. other.
  13819. The filter works on segments of synchronized video and audio streams. All
  13820. segments must have the same number of streams of each type, and that will
  13821. also be the number of streams at output.
  13822. The filter accepts the following options:
  13823. @table @option
  13824. @item n
  13825. Set the number of segments. Default is 2.
  13826. @item v
  13827. Set the number of output video streams, that is also the number of video
  13828. streams in each segment. Default is 1.
  13829. @item a
  13830. Set the number of output audio streams, that is also the number of audio
  13831. streams in each segment. Default is 0.
  13832. @item unsafe
  13833. Activate unsafe mode: do not fail if segments have a different format.
  13834. @end table
  13835. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  13836. @var{a} audio outputs.
  13837. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  13838. segment, in the same order as the outputs, then the inputs for the second
  13839. segment, etc.
  13840. Related streams do not always have exactly the same duration, for various
  13841. reasons including codec frame size or sloppy authoring. For that reason,
  13842. related synchronized streams (e.g. a video and its audio track) should be
  13843. concatenated at once. The concat filter will use the duration of the longest
  13844. stream in each segment (except the last one), and if necessary pad shorter
  13845. audio streams with silence.
  13846. For this filter to work correctly, all segments must start at timestamp 0.
  13847. All corresponding streams must have the same parameters in all segments; the
  13848. filtering system will automatically select a common pixel format for video
  13849. streams, and a common sample format, sample rate and channel layout for
  13850. audio streams, but other settings, such as resolution, must be converted
  13851. explicitly by the user.
  13852. Different frame rates are acceptable but will result in variable frame rate
  13853. at output; be sure to configure the output file to handle it.
  13854. @subsection Examples
  13855. @itemize
  13856. @item
  13857. Concatenate an opening, an episode and an ending, all in bilingual version
  13858. (video in stream 0, audio in streams 1 and 2):
  13859. @example
  13860. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  13861. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  13862. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  13863. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  13864. @end example
  13865. @item
  13866. Concatenate two parts, handling audio and video separately, using the
  13867. (a)movie sources, and adjusting the resolution:
  13868. @example
  13869. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  13870. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  13871. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  13872. @end example
  13873. Note that a desync will happen at the stitch if the audio and video streams
  13874. do not have exactly the same duration in the first file.
  13875. @end itemize
  13876. @subsection Commands
  13877. This filter supports the following commands:
  13878. @table @option
  13879. @item next
  13880. Close the current segment and step to the next one
  13881. @end table
  13882. @section drawgraph, adrawgraph
  13883. Draw a graph using input video or audio metadata.
  13884. It accepts the following parameters:
  13885. @table @option
  13886. @item m1
  13887. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  13888. @item fg1
  13889. Set 1st foreground color expression.
  13890. @item m2
  13891. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  13892. @item fg2
  13893. Set 2nd foreground color expression.
  13894. @item m3
  13895. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  13896. @item fg3
  13897. Set 3rd foreground color expression.
  13898. @item m4
  13899. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  13900. @item fg4
  13901. Set 4th foreground color expression.
  13902. @item min
  13903. Set minimal value of metadata value.
  13904. @item max
  13905. Set maximal value of metadata value.
  13906. @item bg
  13907. Set graph background color. Default is white.
  13908. @item mode
  13909. Set graph mode.
  13910. Available values for mode is:
  13911. @table @samp
  13912. @item bar
  13913. @item dot
  13914. @item line
  13915. @end table
  13916. Default is @code{line}.
  13917. @item slide
  13918. Set slide mode.
  13919. Available values for slide is:
  13920. @table @samp
  13921. @item frame
  13922. Draw new frame when right border is reached.
  13923. @item replace
  13924. Replace old columns with new ones.
  13925. @item scroll
  13926. Scroll from right to left.
  13927. @item rscroll
  13928. Scroll from left to right.
  13929. @item picture
  13930. Draw single picture.
  13931. @end table
  13932. Default is @code{frame}.
  13933. @item size
  13934. Set size of graph video. For the syntax of this option, check the
  13935. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13936. The default value is @code{900x256}.
  13937. The foreground color expressions can use the following variables:
  13938. @table @option
  13939. @item MIN
  13940. Minimal value of metadata value.
  13941. @item MAX
  13942. Maximal value of metadata value.
  13943. @item VAL
  13944. Current metadata key value.
  13945. @end table
  13946. The color is defined as 0xAABBGGRR.
  13947. @end table
  13948. Example using metadata from @ref{signalstats} filter:
  13949. @example
  13950. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  13951. @end example
  13952. Example using metadata from @ref{ebur128} filter:
  13953. @example
  13954. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  13955. @end example
  13956. @anchor{ebur128}
  13957. @section ebur128
  13958. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  13959. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  13960. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  13961. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  13962. The filter also has a video output (see the @var{video} option) with a real
  13963. time graph to observe the loudness evolution. The graphic contains the logged
  13964. message mentioned above, so it is not printed anymore when this option is set,
  13965. unless the verbose logging is set. The main graphing area contains the
  13966. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  13967. the momentary loudness (400 milliseconds).
  13968. More information about the Loudness Recommendation EBU R128 on
  13969. @url{http://tech.ebu.ch/loudness}.
  13970. The filter accepts the following options:
  13971. @table @option
  13972. @item video
  13973. Activate the video output. The audio stream is passed unchanged whether this
  13974. option is set or no. The video stream will be the first output stream if
  13975. activated. Default is @code{0}.
  13976. @item size
  13977. Set the video size. This option is for video only. For the syntax of this
  13978. option, check the
  13979. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13980. Default and minimum resolution is @code{640x480}.
  13981. @item meter
  13982. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  13983. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  13984. other integer value between this range is allowed.
  13985. @item metadata
  13986. Set metadata injection. If set to @code{1}, the audio input will be segmented
  13987. into 100ms output frames, each of them containing various loudness information
  13988. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  13989. Default is @code{0}.
  13990. @item framelog
  13991. Force the frame logging level.
  13992. Available values are:
  13993. @table @samp
  13994. @item info
  13995. information logging level
  13996. @item verbose
  13997. verbose logging level
  13998. @end table
  13999. By default, the logging level is set to @var{info}. If the @option{video} or
  14000. the @option{metadata} options are set, it switches to @var{verbose}.
  14001. @item peak
  14002. Set peak mode(s).
  14003. Available modes can be cumulated (the option is a @code{flag} type). Possible
  14004. values are:
  14005. @table @samp
  14006. @item none
  14007. Disable any peak mode (default).
  14008. @item sample
  14009. Enable sample-peak mode.
  14010. Simple peak mode looking for the higher sample value. It logs a message
  14011. for sample-peak (identified by @code{SPK}).
  14012. @item true
  14013. Enable true-peak mode.
  14014. If enabled, the peak lookup is done on an over-sampled version of the input
  14015. stream for better peak accuracy. It logs a message for true-peak.
  14016. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  14017. This mode requires a build with @code{libswresample}.
  14018. @end table
  14019. @item dualmono
  14020. Treat mono input files as "dual mono". If a mono file is intended for playback
  14021. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  14022. If set to @code{true}, this option will compensate for this effect.
  14023. Multi-channel input files are not affected by this option.
  14024. @item panlaw
  14025. Set a specific pan law to be used for the measurement of dual mono files.
  14026. This parameter is optional, and has a default value of -3.01dB.
  14027. @end table
  14028. @subsection Examples
  14029. @itemize
  14030. @item
  14031. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  14032. @example
  14033. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  14034. @end example
  14035. @item
  14036. Run an analysis with @command{ffmpeg}:
  14037. @example
  14038. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  14039. @end example
  14040. @end itemize
  14041. @section interleave, ainterleave
  14042. Temporally interleave frames from several inputs.
  14043. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  14044. These filters read frames from several inputs and send the oldest
  14045. queued frame to the output.
  14046. Input streams must have well defined, monotonically increasing frame
  14047. timestamp values.
  14048. In order to submit one frame to output, these filters need to enqueue
  14049. at least one frame for each input, so they cannot work in case one
  14050. input is not yet terminated and will not receive incoming frames.
  14051. For example consider the case when one input is a @code{select} filter
  14052. which always drops input frames. The @code{interleave} filter will keep
  14053. reading from that input, but it will never be able to send new frames
  14054. to output until the input sends an end-of-stream signal.
  14055. Also, depending on inputs synchronization, the filters will drop
  14056. frames in case one input receives more frames than the other ones, and
  14057. the queue is already filled.
  14058. These filters accept the following options:
  14059. @table @option
  14060. @item nb_inputs, n
  14061. Set the number of different inputs, it is 2 by default.
  14062. @end table
  14063. @subsection Examples
  14064. @itemize
  14065. @item
  14066. Interleave frames belonging to different streams using @command{ffmpeg}:
  14067. @example
  14068. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  14069. @end example
  14070. @item
  14071. Add flickering blur effect:
  14072. @example
  14073. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  14074. @end example
  14075. @end itemize
  14076. @section metadata, ametadata
  14077. Manipulate frame metadata.
  14078. This filter accepts the following options:
  14079. @table @option
  14080. @item mode
  14081. Set mode of operation of the filter.
  14082. Can be one of the following:
  14083. @table @samp
  14084. @item select
  14085. If both @code{value} and @code{key} is set, select frames
  14086. which have such metadata. If only @code{key} is set, select
  14087. every frame that has such key in metadata.
  14088. @item add
  14089. Add new metadata @code{key} and @code{value}. If key is already available
  14090. do nothing.
  14091. @item modify
  14092. Modify value of already present key.
  14093. @item delete
  14094. If @code{value} is set, delete only keys that have such value.
  14095. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  14096. the frame.
  14097. @item print
  14098. Print key and its value if metadata was found. If @code{key} is not set print all
  14099. metadata values available in frame.
  14100. @end table
  14101. @item key
  14102. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  14103. @item value
  14104. Set metadata value which will be used. This option is mandatory for
  14105. @code{modify} and @code{add} mode.
  14106. @item function
  14107. Which function to use when comparing metadata value and @code{value}.
  14108. Can be one of following:
  14109. @table @samp
  14110. @item same_str
  14111. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  14112. @item starts_with
  14113. Values are interpreted as strings, returns true if metadata value starts with
  14114. the @code{value} option string.
  14115. @item less
  14116. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  14117. @item equal
  14118. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  14119. @item greater
  14120. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  14121. @item expr
  14122. Values are interpreted as floats, returns true if expression from option @code{expr}
  14123. evaluates to true.
  14124. @end table
  14125. @item expr
  14126. Set expression which is used when @code{function} is set to @code{expr}.
  14127. The expression is evaluated through the eval API and can contain the following
  14128. constants:
  14129. @table @option
  14130. @item VALUE1
  14131. Float representation of @code{value} from metadata key.
  14132. @item VALUE2
  14133. Float representation of @code{value} as supplied by user in @code{value} option.
  14134. @end table
  14135. @item file
  14136. If specified in @code{print} mode, output is written to the named file. Instead of
  14137. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  14138. for standard output. If @code{file} option is not set, output is written to the log
  14139. with AV_LOG_INFO loglevel.
  14140. @end table
  14141. @subsection Examples
  14142. @itemize
  14143. @item
  14144. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  14145. between 0 and 1.
  14146. @example
  14147. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  14148. @end example
  14149. @item
  14150. Print silencedetect output to file @file{metadata.txt}.
  14151. @example
  14152. silencedetect,ametadata=mode=print:file=metadata.txt
  14153. @end example
  14154. @item
  14155. Direct all metadata to a pipe with file descriptor 4.
  14156. @example
  14157. metadata=mode=print:file='pipe\:4'
  14158. @end example
  14159. @end itemize
  14160. @section perms, aperms
  14161. Set read/write permissions for the output frames.
  14162. These filters are mainly aimed at developers to test direct path in the
  14163. following filter in the filtergraph.
  14164. The filters accept the following options:
  14165. @table @option
  14166. @item mode
  14167. Select the permissions mode.
  14168. It accepts the following values:
  14169. @table @samp
  14170. @item none
  14171. Do nothing. This is the default.
  14172. @item ro
  14173. Set all the output frames read-only.
  14174. @item rw
  14175. Set all the output frames directly writable.
  14176. @item toggle
  14177. Make the frame read-only if writable, and writable if read-only.
  14178. @item random
  14179. Set each output frame read-only or writable randomly.
  14180. @end table
  14181. @item seed
  14182. Set the seed for the @var{random} mode, must be an integer included between
  14183. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  14184. @code{-1}, the filter will try to use a good random seed on a best effort
  14185. basis.
  14186. @end table
  14187. Note: in case of auto-inserted filter between the permission filter and the
  14188. following one, the permission might not be received as expected in that
  14189. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  14190. perms/aperms filter can avoid this problem.
  14191. @section realtime, arealtime
  14192. Slow down filtering to match real time approximately.
  14193. These filters will pause the filtering for a variable amount of time to
  14194. match the output rate with the input timestamps.
  14195. They are similar to the @option{re} option to @code{ffmpeg}.
  14196. They accept the following options:
  14197. @table @option
  14198. @item limit
  14199. Time limit for the pauses. Any pause longer than that will be considered
  14200. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  14201. @end table
  14202. @anchor{select}
  14203. @section select, aselect
  14204. Select frames to pass in output.
  14205. This filter accepts the following options:
  14206. @table @option
  14207. @item expr, e
  14208. Set expression, which is evaluated for each input frame.
  14209. If the expression is evaluated to zero, the frame is discarded.
  14210. If the evaluation result is negative or NaN, the frame is sent to the
  14211. first output; otherwise it is sent to the output with index
  14212. @code{ceil(val)-1}, assuming that the input index starts from 0.
  14213. For example a value of @code{1.2} corresponds to the output with index
  14214. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  14215. @item outputs, n
  14216. Set the number of outputs. The output to which to send the selected
  14217. frame is based on the result of the evaluation. Default value is 1.
  14218. @end table
  14219. The expression can contain the following constants:
  14220. @table @option
  14221. @item n
  14222. The (sequential) number of the filtered frame, starting from 0.
  14223. @item selected_n
  14224. The (sequential) number of the selected frame, starting from 0.
  14225. @item prev_selected_n
  14226. The sequential number of the last selected frame. It's NAN if undefined.
  14227. @item TB
  14228. The timebase of the input timestamps.
  14229. @item pts
  14230. The PTS (Presentation TimeStamp) of the filtered video frame,
  14231. expressed in @var{TB} units. It's NAN if undefined.
  14232. @item t
  14233. The PTS of the filtered video frame,
  14234. expressed in seconds. It's NAN if undefined.
  14235. @item prev_pts
  14236. The PTS of the previously filtered video frame. It's NAN if undefined.
  14237. @item prev_selected_pts
  14238. The PTS of the last previously filtered video frame. It's NAN if undefined.
  14239. @item prev_selected_t
  14240. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  14241. @item start_pts
  14242. The PTS of the first video frame in the video. It's NAN if undefined.
  14243. @item start_t
  14244. The time of the first video frame in the video. It's NAN if undefined.
  14245. @item pict_type @emph{(video only)}
  14246. The type of the filtered frame. It can assume one of the following
  14247. values:
  14248. @table @option
  14249. @item I
  14250. @item P
  14251. @item B
  14252. @item S
  14253. @item SI
  14254. @item SP
  14255. @item BI
  14256. @end table
  14257. @item interlace_type @emph{(video only)}
  14258. The frame interlace type. It can assume one of the following values:
  14259. @table @option
  14260. @item PROGRESSIVE
  14261. The frame is progressive (not interlaced).
  14262. @item TOPFIRST
  14263. The frame is top-field-first.
  14264. @item BOTTOMFIRST
  14265. The frame is bottom-field-first.
  14266. @end table
  14267. @item consumed_sample_n @emph{(audio only)}
  14268. the number of selected samples before the current frame
  14269. @item samples_n @emph{(audio only)}
  14270. the number of samples in the current frame
  14271. @item sample_rate @emph{(audio only)}
  14272. the input sample rate
  14273. @item key
  14274. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  14275. @item pos
  14276. the position in the file of the filtered frame, -1 if the information
  14277. is not available (e.g. for synthetic video)
  14278. @item scene @emph{(video only)}
  14279. value between 0 and 1 to indicate a new scene; a low value reflects a low
  14280. probability for the current frame to introduce a new scene, while a higher
  14281. value means the current frame is more likely to be one (see the example below)
  14282. @item concatdec_select
  14283. The concat demuxer can select only part of a concat input file by setting an
  14284. inpoint and an outpoint, but the output packets may not be entirely contained
  14285. in the selected interval. By using this variable, it is possible to skip frames
  14286. generated by the concat demuxer which are not exactly contained in the selected
  14287. interval.
  14288. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  14289. and the @var{lavf.concat.duration} packet metadata values which are also
  14290. present in the decoded frames.
  14291. The @var{concatdec_select} variable is -1 if the frame pts is at least
  14292. start_time and either the duration metadata is missing or the frame pts is less
  14293. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  14294. missing.
  14295. That basically means that an input frame is selected if its pts is within the
  14296. interval set by the concat demuxer.
  14297. @end table
  14298. The default value of the select expression is "1".
  14299. @subsection Examples
  14300. @itemize
  14301. @item
  14302. Select all frames in input:
  14303. @example
  14304. select
  14305. @end example
  14306. The example above is the same as:
  14307. @example
  14308. select=1
  14309. @end example
  14310. @item
  14311. Skip all frames:
  14312. @example
  14313. select=0
  14314. @end example
  14315. @item
  14316. Select only I-frames:
  14317. @example
  14318. select='eq(pict_type\,I)'
  14319. @end example
  14320. @item
  14321. Select one frame every 100:
  14322. @example
  14323. select='not(mod(n\,100))'
  14324. @end example
  14325. @item
  14326. Select only frames contained in the 10-20 time interval:
  14327. @example
  14328. select=between(t\,10\,20)
  14329. @end example
  14330. @item
  14331. Select only I-frames contained in the 10-20 time interval:
  14332. @example
  14333. select=between(t\,10\,20)*eq(pict_type\,I)
  14334. @end example
  14335. @item
  14336. Select frames with a minimum distance of 10 seconds:
  14337. @example
  14338. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  14339. @end example
  14340. @item
  14341. Use aselect to select only audio frames with samples number > 100:
  14342. @example
  14343. aselect='gt(samples_n\,100)'
  14344. @end example
  14345. @item
  14346. Create a mosaic of the first scenes:
  14347. @example
  14348. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  14349. @end example
  14350. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  14351. choice.
  14352. @item
  14353. Send even and odd frames to separate outputs, and compose them:
  14354. @example
  14355. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  14356. @end example
  14357. @item
  14358. Select useful frames from an ffconcat file which is using inpoints and
  14359. outpoints but where the source files are not intra frame only.
  14360. @example
  14361. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  14362. @end example
  14363. @end itemize
  14364. @section sendcmd, asendcmd
  14365. Send commands to filters in the filtergraph.
  14366. These filters read commands to be sent to other filters in the
  14367. filtergraph.
  14368. @code{sendcmd} must be inserted between two video filters,
  14369. @code{asendcmd} must be inserted between two audio filters, but apart
  14370. from that they act the same way.
  14371. The specification of commands can be provided in the filter arguments
  14372. with the @var{commands} option, or in a file specified by the
  14373. @var{filename} option.
  14374. These filters accept the following options:
  14375. @table @option
  14376. @item commands, c
  14377. Set the commands to be read and sent to the other filters.
  14378. @item filename, f
  14379. Set the filename of the commands to be read and sent to the other
  14380. filters.
  14381. @end table
  14382. @subsection Commands syntax
  14383. A commands description consists of a sequence of interval
  14384. specifications, comprising a list of commands to be executed when a
  14385. particular event related to that interval occurs. The occurring event
  14386. is typically the current frame time entering or leaving a given time
  14387. interval.
  14388. An interval is specified by the following syntax:
  14389. @example
  14390. @var{START}[-@var{END}] @var{COMMANDS};
  14391. @end example
  14392. The time interval is specified by the @var{START} and @var{END} times.
  14393. @var{END} is optional and defaults to the maximum time.
  14394. The current frame time is considered within the specified interval if
  14395. it is included in the interval [@var{START}, @var{END}), that is when
  14396. the time is greater or equal to @var{START} and is lesser than
  14397. @var{END}.
  14398. @var{COMMANDS} consists of a sequence of one or more command
  14399. specifications, separated by ",", relating to that interval. The
  14400. syntax of a command specification is given by:
  14401. @example
  14402. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  14403. @end example
  14404. @var{FLAGS} is optional and specifies the type of events relating to
  14405. the time interval which enable sending the specified command, and must
  14406. be a non-null sequence of identifier flags separated by "+" or "|" and
  14407. enclosed between "[" and "]".
  14408. The following flags are recognized:
  14409. @table @option
  14410. @item enter
  14411. The command is sent when the current frame timestamp enters the
  14412. specified interval. In other words, the command is sent when the
  14413. previous frame timestamp was not in the given interval, and the
  14414. current is.
  14415. @item leave
  14416. The command is sent when the current frame timestamp leaves the
  14417. specified interval. In other words, the command is sent when the
  14418. previous frame timestamp was in the given interval, and the
  14419. current is not.
  14420. @end table
  14421. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  14422. assumed.
  14423. @var{TARGET} specifies the target of the command, usually the name of
  14424. the filter class or a specific filter instance name.
  14425. @var{COMMAND} specifies the name of the command for the target filter.
  14426. @var{ARG} is optional and specifies the optional list of argument for
  14427. the given @var{COMMAND}.
  14428. Between one interval specification and another, whitespaces, or
  14429. sequences of characters starting with @code{#} until the end of line,
  14430. are ignored and can be used to annotate comments.
  14431. A simplified BNF description of the commands specification syntax
  14432. follows:
  14433. @example
  14434. @var{COMMAND_FLAG} ::= "enter" | "leave"
  14435. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  14436. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  14437. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  14438. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  14439. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  14440. @end example
  14441. @subsection Examples
  14442. @itemize
  14443. @item
  14444. Specify audio tempo change at second 4:
  14445. @example
  14446. asendcmd=c='4.0 atempo tempo 1.5',atempo
  14447. @end example
  14448. @item
  14449. Target a specific filter instance:
  14450. @example
  14451. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  14452. @end example
  14453. @item
  14454. Specify a list of drawtext and hue commands in a file.
  14455. @example
  14456. # show text in the interval 5-10
  14457. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  14458. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  14459. # desaturate the image in the interval 15-20
  14460. 15.0-20.0 [enter] hue s 0,
  14461. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  14462. [leave] hue s 1,
  14463. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  14464. # apply an exponential saturation fade-out effect, starting from time 25
  14465. 25 [enter] hue s exp(25-t)
  14466. @end example
  14467. A filtergraph allowing to read and process the above command list
  14468. stored in a file @file{test.cmd}, can be specified with:
  14469. @example
  14470. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  14471. @end example
  14472. @end itemize
  14473. @anchor{setpts}
  14474. @section setpts, asetpts
  14475. Change the PTS (presentation timestamp) of the input frames.
  14476. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  14477. This filter accepts the following options:
  14478. @table @option
  14479. @item expr
  14480. The expression which is evaluated for each frame to construct its timestamp.
  14481. @end table
  14482. The expression is evaluated through the eval API and can contain the following
  14483. constants:
  14484. @table @option
  14485. @item FRAME_RATE
  14486. frame rate, only defined for constant frame-rate video
  14487. @item PTS
  14488. The presentation timestamp in input
  14489. @item N
  14490. The count of the input frame for video or the number of consumed samples,
  14491. not including the current frame for audio, starting from 0.
  14492. @item NB_CONSUMED_SAMPLES
  14493. The number of consumed samples, not including the current frame (only
  14494. audio)
  14495. @item NB_SAMPLES, S
  14496. The number of samples in the current frame (only audio)
  14497. @item SAMPLE_RATE, SR
  14498. The audio sample rate.
  14499. @item STARTPTS
  14500. The PTS of the first frame.
  14501. @item STARTT
  14502. the time in seconds of the first frame
  14503. @item INTERLACED
  14504. State whether the current frame is interlaced.
  14505. @item T
  14506. the time in seconds of the current frame
  14507. @item POS
  14508. original position in the file of the frame, or undefined if undefined
  14509. for the current frame
  14510. @item PREV_INPTS
  14511. The previous input PTS.
  14512. @item PREV_INT
  14513. previous input time in seconds
  14514. @item PREV_OUTPTS
  14515. The previous output PTS.
  14516. @item PREV_OUTT
  14517. previous output time in seconds
  14518. @item RTCTIME
  14519. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  14520. instead.
  14521. @item RTCSTART
  14522. The wallclock (RTC) time at the start of the movie in microseconds.
  14523. @item TB
  14524. The timebase of the input timestamps.
  14525. @end table
  14526. @subsection Examples
  14527. @itemize
  14528. @item
  14529. Start counting PTS from zero
  14530. @example
  14531. setpts=PTS-STARTPTS
  14532. @end example
  14533. @item
  14534. Apply fast motion effect:
  14535. @example
  14536. setpts=0.5*PTS
  14537. @end example
  14538. @item
  14539. Apply slow motion effect:
  14540. @example
  14541. setpts=2.0*PTS
  14542. @end example
  14543. @item
  14544. Set fixed rate of 25 frames per second:
  14545. @example
  14546. setpts=N/(25*TB)
  14547. @end example
  14548. @item
  14549. Set fixed rate 25 fps with some jitter:
  14550. @example
  14551. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  14552. @end example
  14553. @item
  14554. Apply an offset of 10 seconds to the input PTS:
  14555. @example
  14556. setpts=PTS+10/TB
  14557. @end example
  14558. @item
  14559. Generate timestamps from a "live source" and rebase onto the current timebase:
  14560. @example
  14561. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  14562. @end example
  14563. @item
  14564. Generate timestamps by counting samples:
  14565. @example
  14566. asetpts=N/SR/TB
  14567. @end example
  14568. @end itemize
  14569. @section setrange
  14570. Force color range for the output video frame.
  14571. The @code{setrange} filter marks the color range property for the
  14572. output frames. It does not change the input frame, but only sets the
  14573. corresponding property, which affects how the frame is treated by
  14574. following filters.
  14575. The filter accepts the following options:
  14576. @table @option
  14577. @item range
  14578. Available values are:
  14579. @table @samp
  14580. @item auto
  14581. Keep the same color range property.
  14582. @item unspecified, unknown
  14583. Set the color range as unspecified.
  14584. @item limited, tv, mpeg
  14585. Set the color range as limited.
  14586. @item full, pc, jpeg
  14587. Set the color range as full.
  14588. @end table
  14589. @end table
  14590. @section settb, asettb
  14591. Set the timebase to use for the output frames timestamps.
  14592. It is mainly useful for testing timebase configuration.
  14593. It accepts the following parameters:
  14594. @table @option
  14595. @item expr, tb
  14596. The expression which is evaluated into the output timebase.
  14597. @end table
  14598. The value for @option{tb} is an arithmetic expression representing a
  14599. rational. The expression can contain the constants "AVTB" (the default
  14600. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  14601. audio only). Default value is "intb".
  14602. @subsection Examples
  14603. @itemize
  14604. @item
  14605. Set the timebase to 1/25:
  14606. @example
  14607. settb=expr=1/25
  14608. @end example
  14609. @item
  14610. Set the timebase to 1/10:
  14611. @example
  14612. settb=expr=0.1
  14613. @end example
  14614. @item
  14615. Set the timebase to 1001/1000:
  14616. @example
  14617. settb=1+0.001
  14618. @end example
  14619. @item
  14620. Set the timebase to 2*intb:
  14621. @example
  14622. settb=2*intb
  14623. @end example
  14624. @item
  14625. Set the default timebase value:
  14626. @example
  14627. settb=AVTB
  14628. @end example
  14629. @end itemize
  14630. @section showcqt
  14631. Convert input audio to a video output representing frequency spectrum
  14632. logarithmically using Brown-Puckette constant Q transform algorithm with
  14633. direct frequency domain coefficient calculation (but the transform itself
  14634. is not really constant Q, instead the Q factor is actually variable/clamped),
  14635. with musical tone scale, from E0 to D#10.
  14636. The filter accepts the following options:
  14637. @table @option
  14638. @item size, s
  14639. Specify the video size for the output. It must be even. For the syntax of this option,
  14640. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14641. Default value is @code{1920x1080}.
  14642. @item fps, rate, r
  14643. Set the output frame rate. Default value is @code{25}.
  14644. @item bar_h
  14645. Set the bargraph height. It must be even. Default value is @code{-1} which
  14646. computes the bargraph height automatically.
  14647. @item axis_h
  14648. Set the axis height. It must be even. Default value is @code{-1} which computes
  14649. the axis height automatically.
  14650. @item sono_h
  14651. Set the sonogram height. It must be even. Default value is @code{-1} which
  14652. computes the sonogram height automatically.
  14653. @item fullhd
  14654. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  14655. instead. Default value is @code{1}.
  14656. @item sono_v, volume
  14657. Specify the sonogram volume expression. It can contain variables:
  14658. @table @option
  14659. @item bar_v
  14660. the @var{bar_v} evaluated expression
  14661. @item frequency, freq, f
  14662. the frequency where it is evaluated
  14663. @item timeclamp, tc
  14664. the value of @var{timeclamp} option
  14665. @end table
  14666. and functions:
  14667. @table @option
  14668. @item a_weighting(f)
  14669. A-weighting of equal loudness
  14670. @item b_weighting(f)
  14671. B-weighting of equal loudness
  14672. @item c_weighting(f)
  14673. C-weighting of equal loudness.
  14674. @end table
  14675. Default value is @code{16}.
  14676. @item bar_v, volume2
  14677. Specify the bargraph volume expression. It can contain variables:
  14678. @table @option
  14679. @item sono_v
  14680. the @var{sono_v} evaluated expression
  14681. @item frequency, freq, f
  14682. the frequency where it is evaluated
  14683. @item timeclamp, tc
  14684. the value of @var{timeclamp} option
  14685. @end table
  14686. and functions:
  14687. @table @option
  14688. @item a_weighting(f)
  14689. A-weighting of equal loudness
  14690. @item b_weighting(f)
  14691. B-weighting of equal loudness
  14692. @item c_weighting(f)
  14693. C-weighting of equal loudness.
  14694. @end table
  14695. Default value is @code{sono_v}.
  14696. @item sono_g, gamma
  14697. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  14698. higher gamma makes the spectrum having more range. Default value is @code{3}.
  14699. Acceptable range is @code{[1, 7]}.
  14700. @item bar_g, gamma2
  14701. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  14702. @code{[1, 7]}.
  14703. @item bar_t
  14704. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  14705. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  14706. @item timeclamp, tc
  14707. Specify the transform timeclamp. At low frequency, there is trade-off between
  14708. accuracy in time domain and frequency domain. If timeclamp is lower,
  14709. event in time domain is represented more accurately (such as fast bass drum),
  14710. otherwise event in frequency domain is represented more accurately
  14711. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  14712. @item attack
  14713. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  14714. limits future samples by applying asymmetric windowing in time domain, useful
  14715. when low latency is required. Accepted range is @code{[0, 1]}.
  14716. @item basefreq
  14717. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  14718. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  14719. @item endfreq
  14720. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  14721. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  14722. @item coeffclamp
  14723. This option is deprecated and ignored.
  14724. @item tlength
  14725. Specify the transform length in time domain. Use this option to control accuracy
  14726. trade-off between time domain and frequency domain at every frequency sample.
  14727. It can contain variables:
  14728. @table @option
  14729. @item frequency, freq, f
  14730. the frequency where it is evaluated
  14731. @item timeclamp, tc
  14732. the value of @var{timeclamp} option.
  14733. @end table
  14734. Default value is @code{384*tc/(384+tc*f)}.
  14735. @item count
  14736. Specify the transform count for every video frame. Default value is @code{6}.
  14737. Acceptable range is @code{[1, 30]}.
  14738. @item fcount
  14739. Specify the transform count for every single pixel. Default value is @code{0},
  14740. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  14741. @item fontfile
  14742. Specify font file for use with freetype to draw the axis. If not specified,
  14743. use embedded font. Note that drawing with font file or embedded font is not
  14744. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  14745. option instead.
  14746. @item font
  14747. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  14748. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  14749. @item fontcolor
  14750. Specify font color expression. This is arithmetic expression that should return
  14751. integer value 0xRRGGBB. It can contain variables:
  14752. @table @option
  14753. @item frequency, freq, f
  14754. the frequency where it is evaluated
  14755. @item timeclamp, tc
  14756. the value of @var{timeclamp} option
  14757. @end table
  14758. and functions:
  14759. @table @option
  14760. @item midi(f)
  14761. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  14762. @item r(x), g(x), b(x)
  14763. red, green, and blue value of intensity x.
  14764. @end table
  14765. Default value is @code{st(0, (midi(f)-59.5)/12);
  14766. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  14767. r(1-ld(1)) + b(ld(1))}.
  14768. @item axisfile
  14769. Specify image file to draw the axis. This option override @var{fontfile} and
  14770. @var{fontcolor} option.
  14771. @item axis, text
  14772. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  14773. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  14774. Default value is @code{1}.
  14775. @item csp
  14776. Set colorspace. The accepted values are:
  14777. @table @samp
  14778. @item unspecified
  14779. Unspecified (default)
  14780. @item bt709
  14781. BT.709
  14782. @item fcc
  14783. FCC
  14784. @item bt470bg
  14785. BT.470BG or BT.601-6 625
  14786. @item smpte170m
  14787. SMPTE-170M or BT.601-6 525
  14788. @item smpte240m
  14789. SMPTE-240M
  14790. @item bt2020ncl
  14791. BT.2020 with non-constant luminance
  14792. @end table
  14793. @item cscheme
  14794. Set spectrogram color scheme. This is list of floating point values with format
  14795. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  14796. The default is @code{1|0.5|0|0|0.5|1}.
  14797. @end table
  14798. @subsection Examples
  14799. @itemize
  14800. @item
  14801. Playing audio while showing the spectrum:
  14802. @example
  14803. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  14804. @end example
  14805. @item
  14806. Same as above, but with frame rate 30 fps:
  14807. @example
  14808. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  14809. @end example
  14810. @item
  14811. Playing at 1280x720:
  14812. @example
  14813. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  14814. @end example
  14815. @item
  14816. Disable sonogram display:
  14817. @example
  14818. sono_h=0
  14819. @end example
  14820. @item
  14821. A1 and its harmonics: A1, A2, (near)E3, A3:
  14822. @example
  14823. 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),
  14824. asplit[a][out1]; [a] showcqt [out0]'
  14825. @end example
  14826. @item
  14827. Same as above, but with more accuracy in frequency domain:
  14828. @example
  14829. 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),
  14830. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  14831. @end example
  14832. @item
  14833. Custom volume:
  14834. @example
  14835. bar_v=10:sono_v=bar_v*a_weighting(f)
  14836. @end example
  14837. @item
  14838. Custom gamma, now spectrum is linear to the amplitude.
  14839. @example
  14840. bar_g=2:sono_g=2
  14841. @end example
  14842. @item
  14843. Custom tlength equation:
  14844. @example
  14845. 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)))'
  14846. @end example
  14847. @item
  14848. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  14849. @example
  14850. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  14851. @end example
  14852. @item
  14853. Custom font using fontconfig:
  14854. @example
  14855. font='Courier New,Monospace,mono|bold'
  14856. @end example
  14857. @item
  14858. Custom frequency range with custom axis using image file:
  14859. @example
  14860. axisfile=myaxis.png:basefreq=40:endfreq=10000
  14861. @end example
  14862. @end itemize
  14863. @section showfreqs
  14864. Convert input audio to video output representing the audio power spectrum.
  14865. Audio amplitude is on Y-axis while frequency is on X-axis.
  14866. The filter accepts the following options:
  14867. @table @option
  14868. @item size, s
  14869. Specify size of video. For the syntax of this option, check the
  14870. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14871. Default is @code{1024x512}.
  14872. @item mode
  14873. Set display mode.
  14874. This set how each frequency bin will be represented.
  14875. It accepts the following values:
  14876. @table @samp
  14877. @item line
  14878. @item bar
  14879. @item dot
  14880. @end table
  14881. Default is @code{bar}.
  14882. @item ascale
  14883. Set amplitude scale.
  14884. It accepts the following values:
  14885. @table @samp
  14886. @item lin
  14887. Linear scale.
  14888. @item sqrt
  14889. Square root scale.
  14890. @item cbrt
  14891. Cubic root scale.
  14892. @item log
  14893. Logarithmic scale.
  14894. @end table
  14895. Default is @code{log}.
  14896. @item fscale
  14897. Set frequency scale.
  14898. It accepts the following values:
  14899. @table @samp
  14900. @item lin
  14901. Linear scale.
  14902. @item log
  14903. Logarithmic scale.
  14904. @item rlog
  14905. Reverse logarithmic scale.
  14906. @end table
  14907. Default is @code{lin}.
  14908. @item win_size
  14909. Set window size.
  14910. It accepts the following values:
  14911. @table @samp
  14912. @item w16
  14913. @item w32
  14914. @item w64
  14915. @item w128
  14916. @item w256
  14917. @item w512
  14918. @item w1024
  14919. @item w2048
  14920. @item w4096
  14921. @item w8192
  14922. @item w16384
  14923. @item w32768
  14924. @item w65536
  14925. @end table
  14926. Default is @code{w2048}
  14927. @item win_func
  14928. Set windowing function.
  14929. It accepts the following values:
  14930. @table @samp
  14931. @item rect
  14932. @item bartlett
  14933. @item hanning
  14934. @item hamming
  14935. @item blackman
  14936. @item welch
  14937. @item flattop
  14938. @item bharris
  14939. @item bnuttall
  14940. @item bhann
  14941. @item sine
  14942. @item nuttall
  14943. @item lanczos
  14944. @item gauss
  14945. @item tukey
  14946. @item dolph
  14947. @item cauchy
  14948. @item parzen
  14949. @item poisson
  14950. @end table
  14951. Default is @code{hanning}.
  14952. @item overlap
  14953. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14954. which means optimal overlap for selected window function will be picked.
  14955. @item averaging
  14956. Set time averaging. Setting this to 0 will display current maximal peaks.
  14957. Default is @code{1}, which means time averaging is disabled.
  14958. @item colors
  14959. Specify list of colors separated by space or by '|' which will be used to
  14960. draw channel frequencies. Unrecognized or missing colors will be replaced
  14961. by white color.
  14962. @item cmode
  14963. Set channel display mode.
  14964. It accepts the following values:
  14965. @table @samp
  14966. @item combined
  14967. @item separate
  14968. @end table
  14969. Default is @code{combined}.
  14970. @item minamp
  14971. Set minimum amplitude used in @code{log} amplitude scaler.
  14972. @end table
  14973. @anchor{showspectrum}
  14974. @section showspectrum
  14975. Convert input audio to a video output, representing the audio frequency
  14976. spectrum.
  14977. The filter accepts the following options:
  14978. @table @option
  14979. @item size, s
  14980. Specify the video size for the output. For the syntax of this option, check the
  14981. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14982. Default value is @code{640x512}.
  14983. @item slide
  14984. Specify how the spectrum should slide along the window.
  14985. It accepts the following values:
  14986. @table @samp
  14987. @item replace
  14988. the samples start again on the left when they reach the right
  14989. @item scroll
  14990. the samples scroll from right to left
  14991. @item fullframe
  14992. frames are only produced when the samples reach the right
  14993. @item rscroll
  14994. the samples scroll from left to right
  14995. @end table
  14996. Default value is @code{replace}.
  14997. @item mode
  14998. Specify display mode.
  14999. It accepts the following values:
  15000. @table @samp
  15001. @item combined
  15002. all channels are displayed in the same row
  15003. @item separate
  15004. all channels are displayed in separate rows
  15005. @end table
  15006. Default value is @samp{combined}.
  15007. @item color
  15008. Specify display color mode.
  15009. It accepts the following values:
  15010. @table @samp
  15011. @item channel
  15012. each channel is displayed in a separate color
  15013. @item intensity
  15014. each channel is displayed using the same color scheme
  15015. @item rainbow
  15016. each channel is displayed using the rainbow color scheme
  15017. @item moreland
  15018. each channel is displayed using the moreland color scheme
  15019. @item nebulae
  15020. each channel is displayed using the nebulae color scheme
  15021. @item fire
  15022. each channel is displayed using the fire color scheme
  15023. @item fiery
  15024. each channel is displayed using the fiery color scheme
  15025. @item fruit
  15026. each channel is displayed using the fruit color scheme
  15027. @item cool
  15028. each channel is displayed using the cool color scheme
  15029. @end table
  15030. Default value is @samp{channel}.
  15031. @item scale
  15032. Specify scale used for calculating intensity color values.
  15033. It accepts the following values:
  15034. @table @samp
  15035. @item lin
  15036. linear
  15037. @item sqrt
  15038. square root, default
  15039. @item cbrt
  15040. cubic root
  15041. @item log
  15042. logarithmic
  15043. @item 4thrt
  15044. 4th root
  15045. @item 5thrt
  15046. 5th root
  15047. @end table
  15048. Default value is @samp{sqrt}.
  15049. @item saturation
  15050. Set saturation modifier for displayed colors. Negative values provide
  15051. alternative color scheme. @code{0} is no saturation at all.
  15052. Saturation must be in [-10.0, 10.0] range.
  15053. Default value is @code{1}.
  15054. @item win_func
  15055. Set window function.
  15056. It accepts the following values:
  15057. @table @samp
  15058. @item rect
  15059. @item bartlett
  15060. @item hann
  15061. @item hanning
  15062. @item hamming
  15063. @item blackman
  15064. @item welch
  15065. @item flattop
  15066. @item bharris
  15067. @item bnuttall
  15068. @item bhann
  15069. @item sine
  15070. @item nuttall
  15071. @item lanczos
  15072. @item gauss
  15073. @item tukey
  15074. @item dolph
  15075. @item cauchy
  15076. @item parzen
  15077. @item poisson
  15078. @end table
  15079. Default value is @code{hann}.
  15080. @item orientation
  15081. Set orientation of time vs frequency axis. Can be @code{vertical} or
  15082. @code{horizontal}. Default is @code{vertical}.
  15083. @item overlap
  15084. Set ratio of overlap window. Default value is @code{0}.
  15085. When value is @code{1} overlap is set to recommended size for specific
  15086. window function currently used.
  15087. @item gain
  15088. Set scale gain for calculating intensity color values.
  15089. Default value is @code{1}.
  15090. @item data
  15091. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  15092. @item rotation
  15093. Set color rotation, must be in [-1.0, 1.0] range.
  15094. Default value is @code{0}.
  15095. @end table
  15096. The usage is very similar to the showwaves filter; see the examples in that
  15097. section.
  15098. @subsection Examples
  15099. @itemize
  15100. @item
  15101. Large window with logarithmic color scaling:
  15102. @example
  15103. showspectrum=s=1280x480:scale=log
  15104. @end example
  15105. @item
  15106. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  15107. @example
  15108. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  15109. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  15110. @end example
  15111. @end itemize
  15112. @section showspectrumpic
  15113. Convert input audio to a single video frame, representing the audio frequency
  15114. spectrum.
  15115. The filter accepts the following options:
  15116. @table @option
  15117. @item size, s
  15118. Specify the video size for the output. For the syntax of this option, check the
  15119. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15120. Default value is @code{4096x2048}.
  15121. @item mode
  15122. Specify display mode.
  15123. It accepts the following values:
  15124. @table @samp
  15125. @item combined
  15126. all channels are displayed in the same row
  15127. @item separate
  15128. all channels are displayed in separate rows
  15129. @end table
  15130. Default value is @samp{combined}.
  15131. @item color
  15132. Specify display color mode.
  15133. It accepts the following values:
  15134. @table @samp
  15135. @item channel
  15136. each channel is displayed in a separate color
  15137. @item intensity
  15138. each channel is displayed using the same color scheme
  15139. @item rainbow
  15140. each channel is displayed using the rainbow color scheme
  15141. @item moreland
  15142. each channel is displayed using the moreland color scheme
  15143. @item nebulae
  15144. each channel is displayed using the nebulae color scheme
  15145. @item fire
  15146. each channel is displayed using the fire color scheme
  15147. @item fiery
  15148. each channel is displayed using the fiery color scheme
  15149. @item fruit
  15150. each channel is displayed using the fruit color scheme
  15151. @item cool
  15152. each channel is displayed using the cool color scheme
  15153. @end table
  15154. Default value is @samp{intensity}.
  15155. @item scale
  15156. Specify scale used for calculating intensity color values.
  15157. It accepts the following values:
  15158. @table @samp
  15159. @item lin
  15160. linear
  15161. @item sqrt
  15162. square root, default
  15163. @item cbrt
  15164. cubic root
  15165. @item log
  15166. logarithmic
  15167. @item 4thrt
  15168. 4th root
  15169. @item 5thrt
  15170. 5th root
  15171. @end table
  15172. Default value is @samp{log}.
  15173. @item saturation
  15174. Set saturation modifier for displayed colors. Negative values provide
  15175. alternative color scheme. @code{0} is no saturation at all.
  15176. Saturation must be in [-10.0, 10.0] range.
  15177. Default value is @code{1}.
  15178. @item win_func
  15179. Set window function.
  15180. It accepts the following values:
  15181. @table @samp
  15182. @item rect
  15183. @item bartlett
  15184. @item hann
  15185. @item hanning
  15186. @item hamming
  15187. @item blackman
  15188. @item welch
  15189. @item flattop
  15190. @item bharris
  15191. @item bnuttall
  15192. @item bhann
  15193. @item sine
  15194. @item nuttall
  15195. @item lanczos
  15196. @item gauss
  15197. @item tukey
  15198. @item dolph
  15199. @item cauchy
  15200. @item parzen
  15201. @item poisson
  15202. @end table
  15203. Default value is @code{hann}.
  15204. @item orientation
  15205. Set orientation of time vs frequency axis. Can be @code{vertical} or
  15206. @code{horizontal}. Default is @code{vertical}.
  15207. @item gain
  15208. Set scale gain for calculating intensity color values.
  15209. Default value is @code{1}.
  15210. @item legend
  15211. Draw time and frequency axes and legends. Default is enabled.
  15212. @item rotation
  15213. Set color rotation, must be in [-1.0, 1.0] range.
  15214. Default value is @code{0}.
  15215. @end table
  15216. @subsection Examples
  15217. @itemize
  15218. @item
  15219. Extract an audio spectrogram of a whole audio track
  15220. in a 1024x1024 picture using @command{ffmpeg}:
  15221. @example
  15222. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  15223. @end example
  15224. @end itemize
  15225. @section showvolume
  15226. Convert input audio volume to a video output.
  15227. The filter accepts the following options:
  15228. @table @option
  15229. @item rate, r
  15230. Set video rate.
  15231. @item b
  15232. Set border width, allowed range is [0, 5]. Default is 1.
  15233. @item w
  15234. Set channel width, allowed range is [80, 8192]. Default is 400.
  15235. @item h
  15236. Set channel height, allowed range is [1, 900]. Default is 20.
  15237. @item f
  15238. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  15239. @item c
  15240. Set volume color expression.
  15241. The expression can use the following variables:
  15242. @table @option
  15243. @item VOLUME
  15244. Current max volume of channel in dB.
  15245. @item PEAK
  15246. Current peak.
  15247. @item CHANNEL
  15248. Current channel number, starting from 0.
  15249. @end table
  15250. @item t
  15251. If set, displays channel names. Default is enabled.
  15252. @item v
  15253. If set, displays volume values. Default is enabled.
  15254. @item o
  15255. Set orientation, can be @code{horizontal} or @code{vertical},
  15256. default is @code{horizontal}.
  15257. @item s
  15258. Set step size, allowed range is [0, 5]. Default is 0, which means
  15259. step is disabled.
  15260. @item p
  15261. Set background opacity, allowed range is [0, 1]. Default is 0.
  15262. @item m
  15263. Set metering mode, can be peak: @code{p} or rms: @code{r},
  15264. default is @code{p}.
  15265. @end table
  15266. @section showwaves
  15267. Convert input audio to a video output, representing the samples waves.
  15268. The filter accepts the following options:
  15269. @table @option
  15270. @item size, s
  15271. Specify the video size for the output. For the syntax of this option, check the
  15272. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15273. Default value is @code{600x240}.
  15274. @item mode
  15275. Set display mode.
  15276. Available values are:
  15277. @table @samp
  15278. @item point
  15279. Draw a point for each sample.
  15280. @item line
  15281. Draw a vertical line for each sample.
  15282. @item p2p
  15283. Draw a point for each sample and a line between them.
  15284. @item cline
  15285. Draw a centered vertical line for each sample.
  15286. @end table
  15287. Default value is @code{point}.
  15288. @item n
  15289. Set the number of samples which are printed on the same column. A
  15290. larger value will decrease the frame rate. Must be a positive
  15291. integer. This option can be set only if the value for @var{rate}
  15292. is not explicitly specified.
  15293. @item rate, r
  15294. Set the (approximate) output frame rate. This is done by setting the
  15295. option @var{n}. Default value is "25".
  15296. @item split_channels
  15297. Set if channels should be drawn separately or overlap. Default value is 0.
  15298. @item colors
  15299. Set colors separated by '|' which are going to be used for drawing of each channel.
  15300. @item scale
  15301. Set amplitude scale.
  15302. Available values are:
  15303. @table @samp
  15304. @item lin
  15305. Linear.
  15306. @item log
  15307. Logarithmic.
  15308. @item sqrt
  15309. Square root.
  15310. @item cbrt
  15311. Cubic root.
  15312. @end table
  15313. Default is linear.
  15314. @item draw
  15315. Set the draw mode. This is mostly useful to set for high @var{n}.
  15316. Available values are:
  15317. @table @samp
  15318. @item scale
  15319. Scale pixel values for each drawn sample.
  15320. @item full
  15321. Draw every sample directly.
  15322. @end table
  15323. Default value is @code{scale}.
  15324. @end table
  15325. @subsection Examples
  15326. @itemize
  15327. @item
  15328. Output the input file audio and the corresponding video representation
  15329. at the same time:
  15330. @example
  15331. amovie=a.mp3,asplit[out0],showwaves[out1]
  15332. @end example
  15333. @item
  15334. Create a synthetic signal and show it with showwaves, forcing a
  15335. frame rate of 30 frames per second:
  15336. @example
  15337. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  15338. @end example
  15339. @end itemize
  15340. @section showwavespic
  15341. Convert input audio to a single video frame, representing the samples waves.
  15342. The filter accepts the following options:
  15343. @table @option
  15344. @item size, s
  15345. Specify the video size for the output. For the syntax of this option, check the
  15346. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15347. Default value is @code{600x240}.
  15348. @item split_channels
  15349. Set if channels should be drawn separately or overlap. Default value is 0.
  15350. @item colors
  15351. Set colors separated by '|' which are going to be used for drawing of each channel.
  15352. @item scale
  15353. Set amplitude scale.
  15354. Available values are:
  15355. @table @samp
  15356. @item lin
  15357. Linear.
  15358. @item log
  15359. Logarithmic.
  15360. @item sqrt
  15361. Square root.
  15362. @item cbrt
  15363. Cubic root.
  15364. @end table
  15365. Default is linear.
  15366. @end table
  15367. @subsection Examples
  15368. @itemize
  15369. @item
  15370. Extract a channel split representation of the wave form of a whole audio track
  15371. in a 1024x800 picture using @command{ffmpeg}:
  15372. @example
  15373. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  15374. @end example
  15375. @end itemize
  15376. @section sidedata, asidedata
  15377. Delete frame side data, or select frames based on it.
  15378. This filter accepts the following options:
  15379. @table @option
  15380. @item mode
  15381. Set mode of operation of the filter.
  15382. Can be one of the following:
  15383. @table @samp
  15384. @item select
  15385. Select every frame with side data of @code{type}.
  15386. @item delete
  15387. Delete side data of @code{type}. If @code{type} is not set, delete all side
  15388. data in the frame.
  15389. @end table
  15390. @item type
  15391. Set side data type used with all modes. Must be set for @code{select} mode. For
  15392. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  15393. in @file{libavutil/frame.h}. For example, to choose
  15394. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  15395. @end table
  15396. @section spectrumsynth
  15397. Sythesize audio from 2 input video spectrums, first input stream represents
  15398. magnitude across time and second represents phase across time.
  15399. The filter will transform from frequency domain as displayed in videos back
  15400. to time domain as presented in audio output.
  15401. This filter is primarily created for reversing processed @ref{showspectrum}
  15402. filter outputs, but can synthesize sound from other spectrograms too.
  15403. But in such case results are going to be poor if the phase data is not
  15404. available, because in such cases phase data need to be recreated, usually
  15405. its just recreated from random noise.
  15406. For best results use gray only output (@code{channel} color mode in
  15407. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  15408. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  15409. @code{data} option. Inputs videos should generally use @code{fullframe}
  15410. slide mode as that saves resources needed for decoding video.
  15411. The filter accepts the following options:
  15412. @table @option
  15413. @item sample_rate
  15414. Specify sample rate of output audio, the sample rate of audio from which
  15415. spectrum was generated may differ.
  15416. @item channels
  15417. Set number of channels represented in input video spectrums.
  15418. @item scale
  15419. Set scale which was used when generating magnitude input spectrum.
  15420. Can be @code{lin} or @code{log}. Default is @code{log}.
  15421. @item slide
  15422. Set slide which was used when generating inputs spectrums.
  15423. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  15424. Default is @code{fullframe}.
  15425. @item win_func
  15426. Set window function used for resynthesis.
  15427. @item overlap
  15428. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  15429. which means optimal overlap for selected window function will be picked.
  15430. @item orientation
  15431. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  15432. Default is @code{vertical}.
  15433. @end table
  15434. @subsection Examples
  15435. @itemize
  15436. @item
  15437. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  15438. then resynthesize videos back to audio with spectrumsynth:
  15439. @example
  15440. 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
  15441. 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
  15442. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  15443. @end example
  15444. @end itemize
  15445. @section split, asplit
  15446. Split input into several identical outputs.
  15447. @code{asplit} works with audio input, @code{split} with video.
  15448. The filter accepts a single parameter which specifies the number of outputs. If
  15449. unspecified, it defaults to 2.
  15450. @subsection Examples
  15451. @itemize
  15452. @item
  15453. Create two separate outputs from the same input:
  15454. @example
  15455. [in] split [out0][out1]
  15456. @end example
  15457. @item
  15458. To create 3 or more outputs, you need to specify the number of
  15459. outputs, like in:
  15460. @example
  15461. [in] asplit=3 [out0][out1][out2]
  15462. @end example
  15463. @item
  15464. Create two separate outputs from the same input, one cropped and
  15465. one padded:
  15466. @example
  15467. [in] split [splitout1][splitout2];
  15468. [splitout1] crop=100:100:0:0 [cropout];
  15469. [splitout2] pad=200:200:100:100 [padout];
  15470. @end example
  15471. @item
  15472. Create 5 copies of the input audio with @command{ffmpeg}:
  15473. @example
  15474. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  15475. @end example
  15476. @end itemize
  15477. @section zmq, azmq
  15478. Receive commands sent through a libzmq client, and forward them to
  15479. filters in the filtergraph.
  15480. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  15481. must be inserted between two video filters, @code{azmq} between two
  15482. audio filters.
  15483. To enable these filters you need to install the libzmq library and
  15484. headers and configure FFmpeg with @code{--enable-libzmq}.
  15485. For more information about libzmq see:
  15486. @url{http://www.zeromq.org/}
  15487. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  15488. receives messages sent through a network interface defined by the
  15489. @option{bind_address} option.
  15490. The received message must be in the form:
  15491. @example
  15492. @var{TARGET} @var{COMMAND} [@var{ARG}]
  15493. @end example
  15494. @var{TARGET} specifies the target of the command, usually the name of
  15495. the filter class or a specific filter instance name.
  15496. @var{COMMAND} specifies the name of the command for the target filter.
  15497. @var{ARG} is optional and specifies the optional argument list for the
  15498. given @var{COMMAND}.
  15499. Upon reception, the message is processed and the corresponding command
  15500. is injected into the filtergraph. Depending on the result, the filter
  15501. will send a reply to the client, adopting the format:
  15502. @example
  15503. @var{ERROR_CODE} @var{ERROR_REASON}
  15504. @var{MESSAGE}
  15505. @end example
  15506. @var{MESSAGE} is optional.
  15507. @subsection Examples
  15508. Look at @file{tools/zmqsend} for an example of a zmq client which can
  15509. be used to send commands processed by these filters.
  15510. Consider the following filtergraph generated by @command{ffplay}
  15511. @example
  15512. ffplay -dumpgraph 1 -f lavfi "
  15513. color=s=100x100:c=red [l];
  15514. color=s=100x100:c=blue [r];
  15515. nullsrc=s=200x100, zmq [bg];
  15516. [bg][l] overlay [bg+l];
  15517. [bg+l][r] overlay=x=100 "
  15518. @end example
  15519. To change the color of the left side of the video, the following
  15520. command can be used:
  15521. @example
  15522. echo Parsed_color_0 c yellow | tools/zmqsend
  15523. @end example
  15524. To change the right side:
  15525. @example
  15526. echo Parsed_color_1 c pink | tools/zmqsend
  15527. @end example
  15528. @c man end MULTIMEDIA FILTERS
  15529. @chapter Multimedia Sources
  15530. @c man begin MULTIMEDIA SOURCES
  15531. Below is a description of the currently available multimedia sources.
  15532. @section amovie
  15533. This is the same as @ref{movie} source, except it selects an audio
  15534. stream by default.
  15535. @anchor{movie}
  15536. @section movie
  15537. Read audio and/or video stream(s) from a movie container.
  15538. It accepts the following parameters:
  15539. @table @option
  15540. @item filename
  15541. The name of the resource to read (not necessarily a file; it can also be a
  15542. device or a stream accessed through some protocol).
  15543. @item format_name, f
  15544. Specifies the format assumed for the movie to read, and can be either
  15545. the name of a container or an input device. If not specified, the
  15546. format is guessed from @var{movie_name} or by probing.
  15547. @item seek_point, sp
  15548. Specifies the seek point in seconds. The frames will be output
  15549. starting from this seek point. The parameter is evaluated with
  15550. @code{av_strtod}, so the numerical value may be suffixed by an IS
  15551. postfix. The default value is "0".
  15552. @item streams, s
  15553. Specifies the streams to read. Several streams can be specified,
  15554. separated by "+". The source will then have as many outputs, in the
  15555. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  15556. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  15557. respectively the default (best suited) video and audio stream. Default
  15558. is "dv", or "da" if the filter is called as "amovie".
  15559. @item stream_index, si
  15560. Specifies the index of the video stream to read. If the value is -1,
  15561. the most suitable video stream will be automatically selected. The default
  15562. value is "-1". Deprecated. If the filter is called "amovie", it will select
  15563. audio instead of video.
  15564. @item loop
  15565. Specifies how many times to read the stream in sequence.
  15566. If the value is 0, the stream will be looped infinitely.
  15567. Default value is "1".
  15568. Note that when the movie is looped the source timestamps are not
  15569. changed, so it will generate non monotonically increasing timestamps.
  15570. @item discontinuity
  15571. Specifies the time difference between frames above which the point is
  15572. considered a timestamp discontinuity which is removed by adjusting the later
  15573. timestamps.
  15574. @end table
  15575. It allows overlaying a second video on top of the main input of
  15576. a filtergraph, as shown in this graph:
  15577. @example
  15578. input -----------> deltapts0 --> overlay --> output
  15579. ^
  15580. |
  15581. movie --> scale--> deltapts1 -------+
  15582. @end example
  15583. @subsection Examples
  15584. @itemize
  15585. @item
  15586. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  15587. on top of the input labelled "in":
  15588. @example
  15589. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  15590. [in] setpts=PTS-STARTPTS [main];
  15591. [main][over] overlay=16:16 [out]
  15592. @end example
  15593. @item
  15594. Read from a video4linux2 device, and overlay it on top of the input
  15595. labelled "in":
  15596. @example
  15597. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  15598. [in] setpts=PTS-STARTPTS [main];
  15599. [main][over] overlay=16:16 [out]
  15600. @end example
  15601. @item
  15602. Read the first video stream and the audio stream with id 0x81 from
  15603. dvd.vob; the video is connected to the pad named "video" and the audio is
  15604. connected to the pad named "audio":
  15605. @example
  15606. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  15607. @end example
  15608. @end itemize
  15609. @subsection Commands
  15610. Both movie and amovie support the following commands:
  15611. @table @option
  15612. @item seek
  15613. Perform seek using "av_seek_frame".
  15614. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  15615. @itemize
  15616. @item
  15617. @var{stream_index}: If stream_index is -1, a default
  15618. stream is selected, and @var{timestamp} is automatically converted
  15619. from AV_TIME_BASE units to the stream specific time_base.
  15620. @item
  15621. @var{timestamp}: Timestamp in AVStream.time_base units
  15622. or, if no stream is specified, in AV_TIME_BASE units.
  15623. @item
  15624. @var{flags}: Flags which select direction and seeking mode.
  15625. @end itemize
  15626. @item get_duration
  15627. Get movie duration in AV_TIME_BASE units.
  15628. @end table
  15629. @c man end MULTIMEDIA SOURCES