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.

20460 lines
542KB

  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. @item weights
  1049. Specify weight of each input audio stream as sequence.
  1050. Each weight is separated by space. By default all inputs have same weight.
  1051. @end table
  1052. @section anequalizer
  1053. High-order parametric multiband equalizer for each channel.
  1054. It accepts the following parameters:
  1055. @table @option
  1056. @item params
  1057. This option string is in format:
  1058. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1059. Each equalizer band is separated by '|'.
  1060. @table @option
  1061. @item chn
  1062. Set channel number to which equalization will be applied.
  1063. If input doesn't have that channel the entry is ignored.
  1064. @item f
  1065. Set central frequency for band.
  1066. If input doesn't have that frequency the entry is ignored.
  1067. @item w
  1068. Set band width in hertz.
  1069. @item g
  1070. Set band gain in dB.
  1071. @item t
  1072. Set filter type for band, optional, can be:
  1073. @table @samp
  1074. @item 0
  1075. Butterworth, this is default.
  1076. @item 1
  1077. Chebyshev type 1.
  1078. @item 2
  1079. Chebyshev type 2.
  1080. @end table
  1081. @end table
  1082. @item curves
  1083. With this option activated frequency response of anequalizer is displayed
  1084. in video stream.
  1085. @item size
  1086. Set video stream size. Only useful if curves option is activated.
  1087. @item mgain
  1088. Set max gain that will be displayed. Only useful if curves option is activated.
  1089. Setting this to a reasonable value makes it possible to display gain which is derived from
  1090. neighbour bands which are too close to each other and thus produce higher gain
  1091. when both are activated.
  1092. @item fscale
  1093. Set frequency scale used to draw frequency response in video output.
  1094. Can be linear or logarithmic. Default is logarithmic.
  1095. @item colors
  1096. Set color for each channel curve which is going to be displayed in video stream.
  1097. This is list of color names separated by space or by '|'.
  1098. Unrecognised or missing colors will be replaced by white color.
  1099. @end table
  1100. @subsection Examples
  1101. @itemize
  1102. @item
  1103. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1104. for first 2 channels using Chebyshev type 1 filter:
  1105. @example
  1106. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1107. @end example
  1108. @end itemize
  1109. @subsection Commands
  1110. This filter supports the following commands:
  1111. @table @option
  1112. @item change
  1113. Alter existing filter parameters.
  1114. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1115. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1116. error is returned.
  1117. @var{freq} set new frequency parameter.
  1118. @var{width} set new width parameter in herz.
  1119. @var{gain} set new gain parameter in dB.
  1120. Full filter invocation with asendcmd may look like this:
  1121. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1122. @end table
  1123. @section anull
  1124. Pass the audio source unchanged to the output.
  1125. @section apad
  1126. Pad the end of an audio stream with silence.
  1127. This can be used together with @command{ffmpeg} @option{-shortest} to
  1128. extend audio streams to the same length as the video stream.
  1129. A description of the accepted options follows.
  1130. @table @option
  1131. @item packet_size
  1132. Set silence packet size. Default value is 4096.
  1133. @item pad_len
  1134. Set the number of samples of silence to add to the end. After the
  1135. value is reached, the stream is terminated. This option is mutually
  1136. exclusive with @option{whole_len}.
  1137. @item whole_len
  1138. Set the minimum total number of samples in the output audio stream. If
  1139. the value is longer than the input audio length, silence is added to
  1140. the end, until the value is reached. This option is mutually exclusive
  1141. with @option{pad_len}.
  1142. @end table
  1143. If neither the @option{pad_len} nor the @option{whole_len} option is
  1144. set, the filter will add silence to the end of the input stream
  1145. indefinitely.
  1146. @subsection Examples
  1147. @itemize
  1148. @item
  1149. Add 1024 samples of silence to the end of the input:
  1150. @example
  1151. apad=pad_len=1024
  1152. @end example
  1153. @item
  1154. Make sure the audio output will contain at least 10000 samples, pad
  1155. the input with silence if required:
  1156. @example
  1157. apad=whole_len=10000
  1158. @end example
  1159. @item
  1160. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1161. video stream will always result the shortest and will be converted
  1162. until the end in the output file when using the @option{shortest}
  1163. option:
  1164. @example
  1165. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1166. @end example
  1167. @end itemize
  1168. @section aphaser
  1169. Add a phasing effect to the input audio.
  1170. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1171. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1172. A description of the accepted parameters follows.
  1173. @table @option
  1174. @item in_gain
  1175. Set input gain. Default is 0.4.
  1176. @item out_gain
  1177. Set output gain. Default is 0.74
  1178. @item delay
  1179. Set delay in milliseconds. Default is 3.0.
  1180. @item decay
  1181. Set decay. Default is 0.4.
  1182. @item speed
  1183. Set modulation speed in Hz. Default is 0.5.
  1184. @item type
  1185. Set modulation type. Default is triangular.
  1186. It accepts the following values:
  1187. @table @samp
  1188. @item triangular, t
  1189. @item sinusoidal, s
  1190. @end table
  1191. @end table
  1192. @section apulsator
  1193. Audio pulsator is something between an autopanner and a tremolo.
  1194. But it can produce funny stereo effects as well. Pulsator changes the volume
  1195. of the left and right channel based on a LFO (low frequency oscillator) with
  1196. different waveforms and shifted phases.
  1197. This filter have the ability to define an offset between left and right
  1198. channel. An offset of 0 means that both LFO shapes match each other.
  1199. The left and right channel are altered equally - a conventional tremolo.
  1200. An offset of 50% means that the shape of the right channel is exactly shifted
  1201. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1202. an autopanner. At 1 both curves match again. Every setting in between moves the
  1203. phase shift gapless between all stages and produces some "bypassing" sounds with
  1204. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1205. the 0.5) the faster the signal passes from the left to the right speaker.
  1206. The filter accepts the following options:
  1207. @table @option
  1208. @item level_in
  1209. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1210. @item level_out
  1211. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1212. @item mode
  1213. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1214. sawup or sawdown. Default is sine.
  1215. @item amount
  1216. Set modulation. Define how much of original signal is affected by the LFO.
  1217. @item offset_l
  1218. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1219. @item offset_r
  1220. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1221. @item width
  1222. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1223. @item timing
  1224. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1225. @item bpm
  1226. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1227. is set to bpm.
  1228. @item ms
  1229. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1230. is set to ms.
  1231. @item hz
  1232. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1233. if timing is set to hz.
  1234. @end table
  1235. @anchor{aresample}
  1236. @section aresample
  1237. Resample the input audio to the specified parameters, using the
  1238. libswresample library. If none are specified then the filter will
  1239. automatically convert between its input and output.
  1240. This filter is also able to stretch/squeeze the audio data to make it match
  1241. the timestamps or to inject silence / cut out audio to make it match the
  1242. timestamps, do a combination of both or do neither.
  1243. The filter accepts the syntax
  1244. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1245. expresses a sample rate and @var{resampler_options} is a list of
  1246. @var{key}=@var{value} pairs, separated by ":". See the
  1247. @ref{Resampler Options,,"Resampler Options" section in the
  1248. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1249. for the complete list of supported options.
  1250. @subsection Examples
  1251. @itemize
  1252. @item
  1253. Resample the input audio to 44100Hz:
  1254. @example
  1255. aresample=44100
  1256. @end example
  1257. @item
  1258. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1259. samples per second compensation:
  1260. @example
  1261. aresample=async=1000
  1262. @end example
  1263. @end itemize
  1264. @section areverse
  1265. Reverse an audio clip.
  1266. Warning: This filter requires memory to buffer the entire clip, so trimming
  1267. is suggested.
  1268. @subsection Examples
  1269. @itemize
  1270. @item
  1271. Take the first 5 seconds of a clip, and reverse it.
  1272. @example
  1273. atrim=end=5,areverse
  1274. @end example
  1275. @end itemize
  1276. @section asetnsamples
  1277. Set the number of samples per each output audio frame.
  1278. The last output packet may contain a different number of samples, as
  1279. the filter will flush all the remaining samples when the input audio
  1280. signals its end.
  1281. The filter accepts the following options:
  1282. @table @option
  1283. @item nb_out_samples, n
  1284. Set the number of frames per each output audio frame. The number is
  1285. intended as the number of samples @emph{per each channel}.
  1286. Default value is 1024.
  1287. @item pad, p
  1288. If set to 1, the filter will pad the last audio frame with zeroes, so
  1289. that the last frame will contain the same number of samples as the
  1290. previous ones. Default value is 1.
  1291. @end table
  1292. For example, to set the number of per-frame samples to 1234 and
  1293. disable padding for the last frame, use:
  1294. @example
  1295. asetnsamples=n=1234:p=0
  1296. @end example
  1297. @section asetrate
  1298. Set the sample rate without altering the PCM data.
  1299. This will result in a change of speed and pitch.
  1300. The filter accepts the following options:
  1301. @table @option
  1302. @item sample_rate, r
  1303. Set the output sample rate. Default is 44100 Hz.
  1304. @end table
  1305. @section ashowinfo
  1306. Show a line containing various information for each input audio frame.
  1307. The input audio is not modified.
  1308. The shown line contains a sequence of key/value pairs of the form
  1309. @var{key}:@var{value}.
  1310. The following values are shown in the output:
  1311. @table @option
  1312. @item n
  1313. The (sequential) number of the input frame, starting from 0.
  1314. @item pts
  1315. The presentation timestamp of the input frame, in time base units; the time base
  1316. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1317. @item pts_time
  1318. The presentation timestamp of the input frame in seconds.
  1319. @item pos
  1320. position of the frame in the input stream, -1 if this information in
  1321. unavailable and/or meaningless (for example in case of synthetic audio)
  1322. @item fmt
  1323. The sample format.
  1324. @item chlayout
  1325. The channel layout.
  1326. @item rate
  1327. The sample rate for the audio frame.
  1328. @item nb_samples
  1329. The number of samples (per channel) in the frame.
  1330. @item checksum
  1331. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1332. audio, the data is treated as if all the planes were concatenated.
  1333. @item plane_checksums
  1334. A list of Adler-32 checksums for each data plane.
  1335. @end table
  1336. @anchor{astats}
  1337. @section astats
  1338. Display time domain statistical information about the audio channels.
  1339. Statistics are calculated and displayed for each audio channel and,
  1340. where applicable, an overall figure is also given.
  1341. It accepts the following option:
  1342. @table @option
  1343. @item length
  1344. Short window length in seconds, used for peak and trough RMS measurement.
  1345. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  1346. @item metadata
  1347. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1348. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1349. disabled.
  1350. Available keys for each channel are:
  1351. DC_offset
  1352. Min_level
  1353. Max_level
  1354. Min_difference
  1355. Max_difference
  1356. Mean_difference
  1357. RMS_difference
  1358. Peak_level
  1359. RMS_peak
  1360. RMS_trough
  1361. Crest_factor
  1362. Flat_factor
  1363. Peak_count
  1364. Bit_depth
  1365. Dynamic_range
  1366. and for Overall:
  1367. DC_offset
  1368. Min_level
  1369. Max_level
  1370. Min_difference
  1371. Max_difference
  1372. Mean_difference
  1373. RMS_difference
  1374. Peak_level
  1375. RMS_level
  1376. RMS_peak
  1377. RMS_trough
  1378. Flat_factor
  1379. Peak_count
  1380. Bit_depth
  1381. Number_of_samples
  1382. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1383. this @code{lavfi.astats.Overall.Peak_count}.
  1384. For description what each key means read below.
  1385. @item reset
  1386. Set number of frame after which stats are going to be recalculated.
  1387. Default is disabled.
  1388. @end table
  1389. A description of each shown parameter follows:
  1390. @table @option
  1391. @item DC offset
  1392. Mean amplitude displacement from zero.
  1393. @item Min level
  1394. Minimal sample level.
  1395. @item Max level
  1396. Maximal sample level.
  1397. @item Min difference
  1398. Minimal difference between two consecutive samples.
  1399. @item Max difference
  1400. Maximal difference between two consecutive samples.
  1401. @item Mean difference
  1402. Mean difference between two consecutive samples.
  1403. The average of each difference between two consecutive samples.
  1404. @item RMS difference
  1405. Root Mean Square difference between two consecutive samples.
  1406. @item Peak level dB
  1407. @item RMS level dB
  1408. Standard peak and RMS level measured in dBFS.
  1409. @item RMS peak dB
  1410. @item RMS trough dB
  1411. Peak and trough values for RMS level measured over a short window.
  1412. @item Crest factor
  1413. Standard ratio of peak to RMS level (note: not in dB).
  1414. @item Flat factor
  1415. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1416. (i.e. either @var{Min level} or @var{Max level}).
  1417. @item Peak count
  1418. Number of occasions (not the number of samples) that the signal attained either
  1419. @var{Min level} or @var{Max level}.
  1420. @item Bit depth
  1421. Overall bit depth of audio. Number of bits used for each sample.
  1422. @item Dynamic range
  1423. Measured dynamic range of audio in dB.
  1424. @end table
  1425. @section atempo
  1426. Adjust audio tempo.
  1427. The filter accepts exactly one parameter, the audio tempo. If not
  1428. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1429. be in the [0.5, 2.0] range.
  1430. @subsection Examples
  1431. @itemize
  1432. @item
  1433. Slow down audio to 80% tempo:
  1434. @example
  1435. atempo=0.8
  1436. @end example
  1437. @item
  1438. To speed up audio to 125% tempo:
  1439. @example
  1440. atempo=1.25
  1441. @end example
  1442. @end itemize
  1443. @section atrim
  1444. Trim the input so that the output contains one continuous subpart of the input.
  1445. It accepts the following parameters:
  1446. @table @option
  1447. @item start
  1448. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1449. sample with the timestamp @var{start} will be the first sample in the output.
  1450. @item end
  1451. Specify time of the first audio sample that will be dropped, i.e. the
  1452. audio sample immediately preceding the one with the timestamp @var{end} will be
  1453. the last sample in the output.
  1454. @item start_pts
  1455. Same as @var{start}, except this option sets the start timestamp in samples
  1456. instead of seconds.
  1457. @item end_pts
  1458. Same as @var{end}, except this option sets the end timestamp in samples instead
  1459. of seconds.
  1460. @item duration
  1461. The maximum duration of the output in seconds.
  1462. @item start_sample
  1463. The number of the first sample that should be output.
  1464. @item end_sample
  1465. The number of the first sample that should be dropped.
  1466. @end table
  1467. @option{start}, @option{end}, and @option{duration} are expressed as time
  1468. duration specifications; see
  1469. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1470. Note that the first two sets of the start/end options and the @option{duration}
  1471. option look at the frame timestamp, while the _sample options simply count the
  1472. samples that pass through the filter. So start/end_pts and start/end_sample will
  1473. give different results when the timestamps are wrong, inexact or do not start at
  1474. zero. Also note that this filter does not modify the timestamps. If you wish
  1475. to have the output timestamps start at zero, insert the asetpts filter after the
  1476. atrim filter.
  1477. If multiple start or end options are set, this filter tries to be greedy and
  1478. keep all samples that match at least one of the specified constraints. To keep
  1479. only the part that matches all the constraints at once, chain multiple atrim
  1480. filters.
  1481. The defaults are such that all the input is kept. So it is possible to set e.g.
  1482. just the end values to keep everything before the specified time.
  1483. Examples:
  1484. @itemize
  1485. @item
  1486. Drop everything except the second minute of input:
  1487. @example
  1488. ffmpeg -i INPUT -af atrim=60:120
  1489. @end example
  1490. @item
  1491. Keep only the first 1000 samples:
  1492. @example
  1493. ffmpeg -i INPUT -af atrim=end_sample=1000
  1494. @end example
  1495. @end itemize
  1496. @section bandpass
  1497. Apply a two-pole Butterworth band-pass filter with central
  1498. frequency @var{frequency}, and (3dB-point) band-width width.
  1499. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1500. instead of the default: constant 0dB peak gain.
  1501. The filter roll off at 6dB per octave (20dB per decade).
  1502. The filter accepts the following options:
  1503. @table @option
  1504. @item frequency, f
  1505. Set the filter's central frequency. Default is @code{3000}.
  1506. @item csg
  1507. Constant skirt gain if set to 1. Defaults to 0.
  1508. @item width_type, t
  1509. Set method to specify band-width of filter.
  1510. @table @option
  1511. @item h
  1512. Hz
  1513. @item q
  1514. Q-Factor
  1515. @item o
  1516. octave
  1517. @item s
  1518. slope
  1519. @item k
  1520. kHz
  1521. @end table
  1522. @item width, w
  1523. Specify the band-width of a filter in width_type units.
  1524. @item channels, c
  1525. Specify which channels to filter, by default all available are filtered.
  1526. @end table
  1527. @subsection Commands
  1528. This filter supports the following commands:
  1529. @table @option
  1530. @item frequency, f
  1531. Change bandpass frequency.
  1532. Syntax for the command is : "@var{frequency}"
  1533. @item width_type, t
  1534. Change bandpass width_type.
  1535. Syntax for the command is : "@var{width_type}"
  1536. @item width, w
  1537. Change bandpass width.
  1538. Syntax for the command is : "@var{width}"
  1539. @end table
  1540. @section bandreject
  1541. Apply a two-pole Butterworth band-reject filter with central
  1542. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1543. The filter roll off at 6dB per octave (20dB per decade).
  1544. The filter accepts the following options:
  1545. @table @option
  1546. @item frequency, f
  1547. Set the filter's central frequency. Default is @code{3000}.
  1548. @item width_type, t
  1549. Set method to specify band-width of filter.
  1550. @table @option
  1551. @item h
  1552. Hz
  1553. @item q
  1554. Q-Factor
  1555. @item o
  1556. octave
  1557. @item s
  1558. slope
  1559. @item k
  1560. kHz
  1561. @end table
  1562. @item width, w
  1563. Specify the band-width of a filter in width_type units.
  1564. @item channels, c
  1565. Specify which channels to filter, by default all available are filtered.
  1566. @end table
  1567. @subsection Commands
  1568. This filter supports the following commands:
  1569. @table @option
  1570. @item frequency, f
  1571. Change bandreject frequency.
  1572. Syntax for the command is : "@var{frequency}"
  1573. @item width_type, t
  1574. Change bandreject width_type.
  1575. Syntax for the command is : "@var{width_type}"
  1576. @item width, w
  1577. Change bandreject width.
  1578. Syntax for the command is : "@var{width}"
  1579. @end table
  1580. @section bass
  1581. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1582. shelving filter with a response similar to that of a standard
  1583. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1584. The filter accepts the following options:
  1585. @table @option
  1586. @item gain, g
  1587. Give the gain at 0 Hz. Its useful range is about -20
  1588. (for a large cut) to +20 (for a large boost).
  1589. Beware of clipping when using a positive gain.
  1590. @item frequency, f
  1591. Set the filter's central frequency and so can be used
  1592. to extend or reduce the frequency range to be boosted or cut.
  1593. The default value is @code{100} Hz.
  1594. @item width_type, t
  1595. Set method to specify band-width of filter.
  1596. @table @option
  1597. @item h
  1598. Hz
  1599. @item q
  1600. Q-Factor
  1601. @item o
  1602. octave
  1603. @item s
  1604. slope
  1605. @item k
  1606. kHz
  1607. @end table
  1608. @item width, w
  1609. Determine how steep is the filter's shelf transition.
  1610. @item channels, c
  1611. Specify which channels to filter, by default all available are filtered.
  1612. @end table
  1613. @subsection Commands
  1614. This filter supports the following commands:
  1615. @table @option
  1616. @item frequency, f
  1617. Change bass frequency.
  1618. Syntax for the command is : "@var{frequency}"
  1619. @item width_type, t
  1620. Change bass width_type.
  1621. Syntax for the command is : "@var{width_type}"
  1622. @item width, w
  1623. Change bass width.
  1624. Syntax for the command is : "@var{width}"
  1625. @item gain, g
  1626. Change bass gain.
  1627. Syntax for the command is : "@var{gain}"
  1628. @end table
  1629. @section biquad
  1630. Apply a biquad IIR filter with the given coefficients.
  1631. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1632. are the numerator and denominator coefficients respectively.
  1633. and @var{channels}, @var{c} specify which channels to filter, by default all
  1634. available are filtered.
  1635. @subsection Commands
  1636. This filter supports the following commands:
  1637. @table @option
  1638. @item a0
  1639. @item a1
  1640. @item a2
  1641. @item b0
  1642. @item b1
  1643. @item b2
  1644. Change biquad parameter.
  1645. Syntax for the command is : "@var{value}"
  1646. @end table
  1647. @section bs2b
  1648. Bauer stereo to binaural transformation, which improves headphone listening of
  1649. stereo audio records.
  1650. To enable compilation of this filter you need to configure FFmpeg with
  1651. @code{--enable-libbs2b}.
  1652. It accepts the following parameters:
  1653. @table @option
  1654. @item profile
  1655. Pre-defined crossfeed level.
  1656. @table @option
  1657. @item default
  1658. Default level (fcut=700, feed=50).
  1659. @item cmoy
  1660. Chu Moy circuit (fcut=700, feed=60).
  1661. @item jmeier
  1662. Jan Meier circuit (fcut=650, feed=95).
  1663. @end table
  1664. @item fcut
  1665. Cut frequency (in Hz).
  1666. @item feed
  1667. Feed level (in Hz).
  1668. @end table
  1669. @section channelmap
  1670. Remap input channels to new locations.
  1671. It accepts the following parameters:
  1672. @table @option
  1673. @item map
  1674. Map channels from input to output. The argument is a '|'-separated list of
  1675. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1676. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1677. channel (e.g. FL for front left) or its index in the input channel layout.
  1678. @var{out_channel} is the name of the output channel or its index in the output
  1679. channel layout. If @var{out_channel} is not given then it is implicitly an
  1680. index, starting with zero and increasing by one for each mapping.
  1681. @item channel_layout
  1682. The channel layout of the output stream.
  1683. @end table
  1684. If no mapping is present, the filter will implicitly map input channels to
  1685. output channels, preserving indices.
  1686. @subsection Examples
  1687. @itemize
  1688. @item
  1689. For example, assuming a 5.1+downmix input MOV file,
  1690. @example
  1691. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1692. @end example
  1693. will create an output WAV file tagged as stereo from the downmix channels of
  1694. the input.
  1695. @item
  1696. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1697. @example
  1698. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1699. @end example
  1700. @end itemize
  1701. @section channelsplit
  1702. Split each channel from an input audio stream into a separate output stream.
  1703. It accepts the following parameters:
  1704. @table @option
  1705. @item channel_layout
  1706. The channel layout of the input stream. The default is "stereo".
  1707. @item channels
  1708. A channel layout describing the channels to be extracted as separate output streams
  1709. or "all" to extract each input channel as a separate stream. The default is "all".
  1710. Choosing channels not present in channel layout in the input will result in an error.
  1711. @end table
  1712. @subsection Examples
  1713. @itemize
  1714. @item
  1715. For example, assuming a stereo input MP3 file,
  1716. @example
  1717. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1718. @end example
  1719. will create an output Matroska file with two audio streams, one containing only
  1720. the left channel and the other the right channel.
  1721. @item
  1722. Split a 5.1 WAV file into per-channel files:
  1723. @example
  1724. ffmpeg -i in.wav -filter_complex
  1725. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1726. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1727. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1728. side_right.wav
  1729. @end example
  1730. @item
  1731. Extract only LFE from a 5.1 WAV file:
  1732. @example
  1733. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  1734. -map '[LFE]' lfe.wav
  1735. @end example
  1736. @end itemize
  1737. @section chorus
  1738. Add a chorus effect to the audio.
  1739. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1740. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1741. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1742. The modulation depth defines the range the modulated delay is played before or after
  1743. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1744. sound tuned around the original one, like in a chorus where some vocals are slightly
  1745. off key.
  1746. It accepts the following parameters:
  1747. @table @option
  1748. @item in_gain
  1749. Set input gain. Default is 0.4.
  1750. @item out_gain
  1751. Set output gain. Default is 0.4.
  1752. @item delays
  1753. Set delays. A typical delay is around 40ms to 60ms.
  1754. @item decays
  1755. Set decays.
  1756. @item speeds
  1757. Set speeds.
  1758. @item depths
  1759. Set depths.
  1760. @end table
  1761. @subsection Examples
  1762. @itemize
  1763. @item
  1764. A single delay:
  1765. @example
  1766. chorus=0.7:0.9:55:0.4:0.25:2
  1767. @end example
  1768. @item
  1769. Two delays:
  1770. @example
  1771. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1772. @end example
  1773. @item
  1774. Fuller sounding chorus with three delays:
  1775. @example
  1776. 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
  1777. @end example
  1778. @end itemize
  1779. @section compand
  1780. Compress or expand the audio's dynamic range.
  1781. It accepts the following parameters:
  1782. @table @option
  1783. @item attacks
  1784. @item decays
  1785. A list of times in seconds for each channel over which the instantaneous level
  1786. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1787. increase of volume and @var{decays} refers to decrease of volume. For most
  1788. situations, the attack time (response to the audio getting louder) should be
  1789. shorter than the decay time, because the human ear is more sensitive to sudden
  1790. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1791. a typical value for decay is 0.8 seconds.
  1792. If specified number of attacks & decays is lower than number of channels, the last
  1793. set attack/decay will be used for all remaining channels.
  1794. @item points
  1795. A list of points for the transfer function, specified in dB relative to the
  1796. maximum possible signal amplitude. Each key points list must be defined using
  1797. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1798. @code{x0/y0 x1/y1 x2/y2 ....}
  1799. The input values must be in strictly increasing order but the transfer function
  1800. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1801. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1802. function are @code{-70/-70|-60/-20|1/0}.
  1803. @item soft-knee
  1804. Set the curve radius in dB for all joints. It defaults to 0.01.
  1805. @item gain
  1806. Set the additional gain in dB to be applied at all points on the transfer
  1807. function. This allows for easy adjustment of the overall gain.
  1808. It defaults to 0.
  1809. @item volume
  1810. Set an initial volume, in dB, to be assumed for each channel when filtering
  1811. starts. This permits the user to supply a nominal level initially, so that, for
  1812. example, a very large gain is not applied to initial signal levels before the
  1813. companding has begun to operate. A typical value for audio which is initially
  1814. quiet is -90 dB. It defaults to 0.
  1815. @item delay
  1816. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1817. delayed before being fed to the volume adjuster. Specifying a delay
  1818. approximately equal to the attack/decay times allows the filter to effectively
  1819. operate in predictive rather than reactive mode. It defaults to 0.
  1820. @end table
  1821. @subsection Examples
  1822. @itemize
  1823. @item
  1824. Make music with both quiet and loud passages suitable for listening to in a
  1825. noisy environment:
  1826. @example
  1827. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1828. @end example
  1829. Another example for audio with whisper and explosion parts:
  1830. @example
  1831. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1832. @end example
  1833. @item
  1834. A noise gate for when the noise is at a lower level than the signal:
  1835. @example
  1836. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1837. @end example
  1838. @item
  1839. Here is another noise gate, this time for when the noise is at a higher level
  1840. than the signal (making it, in some ways, similar to squelch):
  1841. @example
  1842. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1843. @end example
  1844. @item
  1845. 2:1 compression starting at -6dB:
  1846. @example
  1847. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1848. @end example
  1849. @item
  1850. 2:1 compression starting at -9dB:
  1851. @example
  1852. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1853. @end example
  1854. @item
  1855. 2:1 compression starting at -12dB:
  1856. @example
  1857. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1858. @end example
  1859. @item
  1860. 2:1 compression starting at -18dB:
  1861. @example
  1862. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1863. @end example
  1864. @item
  1865. 3:1 compression starting at -15dB:
  1866. @example
  1867. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1868. @end example
  1869. @item
  1870. Compressor/Gate:
  1871. @example
  1872. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1873. @end example
  1874. @item
  1875. Expander:
  1876. @example
  1877. 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
  1878. @end example
  1879. @item
  1880. Hard limiter at -6dB:
  1881. @example
  1882. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1883. @end example
  1884. @item
  1885. Hard limiter at -12dB:
  1886. @example
  1887. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1888. @end example
  1889. @item
  1890. Hard noise gate at -35 dB:
  1891. @example
  1892. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1893. @end example
  1894. @item
  1895. Soft limiter:
  1896. @example
  1897. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1898. @end example
  1899. @end itemize
  1900. @section compensationdelay
  1901. Compensation Delay Line is a metric based delay to compensate differing
  1902. positions of microphones or speakers.
  1903. For example, you have recorded guitar with two microphones placed in
  1904. different location. Because the front of sound wave has fixed speed in
  1905. normal conditions, the phasing of microphones can vary and depends on
  1906. their location and interposition. The best sound mix can be achieved when
  1907. these microphones are in phase (synchronized). Note that distance of
  1908. ~30 cm between microphones makes one microphone to capture signal in
  1909. antiphase to another microphone. That makes the final mix sounding moody.
  1910. This filter helps to solve phasing problems by adding different delays
  1911. to each microphone track and make them synchronized.
  1912. The best result can be reached when you take one track as base and
  1913. synchronize other tracks one by one with it.
  1914. Remember that synchronization/delay tolerance depends on sample rate, too.
  1915. Higher sample rates will give more tolerance.
  1916. It accepts the following parameters:
  1917. @table @option
  1918. @item mm
  1919. Set millimeters distance. This is compensation distance for fine tuning.
  1920. Default is 0.
  1921. @item cm
  1922. Set cm distance. This is compensation distance for tightening distance setup.
  1923. Default is 0.
  1924. @item m
  1925. Set meters distance. This is compensation distance for hard distance setup.
  1926. Default is 0.
  1927. @item dry
  1928. Set dry amount. Amount of unprocessed (dry) signal.
  1929. Default is 0.
  1930. @item wet
  1931. Set wet amount. Amount of processed (wet) signal.
  1932. Default is 1.
  1933. @item temp
  1934. Set temperature degree in Celsius. This is the temperature of the environment.
  1935. Default is 20.
  1936. @end table
  1937. @section crossfeed
  1938. Apply headphone crossfeed filter.
  1939. Crossfeed is the process of blending the left and right channels of stereo
  1940. audio recording.
  1941. It is mainly used to reduce extreme stereo separation of low frequencies.
  1942. The intent is to produce more speaker like sound to the listener.
  1943. The filter accepts the following options:
  1944. @table @option
  1945. @item strength
  1946. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  1947. This sets gain of low shelf filter for side part of stereo image.
  1948. Default is -6dB. Max allowed is -30db when strength is set to 1.
  1949. @item range
  1950. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  1951. This sets cut off frequency of low shelf filter. Default is cut off near
  1952. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  1953. @item level_in
  1954. Set input gain. Default is 0.9.
  1955. @item level_out
  1956. Set output gain. Default is 1.
  1957. @end table
  1958. @section crystalizer
  1959. Simple algorithm to expand audio dynamic range.
  1960. The filter accepts the following options:
  1961. @table @option
  1962. @item i
  1963. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  1964. (unchanged sound) to 10.0 (maximum effect).
  1965. @item c
  1966. Enable clipping. By default is enabled.
  1967. @end table
  1968. @section dcshift
  1969. Apply a DC shift to the audio.
  1970. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1971. in the recording chain) from the audio. The effect of a DC offset is reduced
  1972. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1973. a signal has a DC offset.
  1974. @table @option
  1975. @item shift
  1976. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1977. the audio.
  1978. @item limitergain
  1979. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1980. used to prevent clipping.
  1981. @end table
  1982. @section drmeter
  1983. Measure audio dynamic range.
  1984. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  1985. is found in transition material. And anything less that 8 have very poor dynamics
  1986. and is very compressed.
  1987. The filter accepts the following options:
  1988. @table @option
  1989. @item length
  1990. Set window length in seconds used to split audio into segments of equal length.
  1991. Default is 3 seconds.
  1992. @end table
  1993. @section dynaudnorm
  1994. Dynamic Audio Normalizer.
  1995. This filter applies a certain amount of gain to the input audio in order
  1996. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1997. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1998. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1999. This allows for applying extra gain to the "quiet" sections of the audio
  2000. while avoiding distortions or clipping the "loud" sections. In other words:
  2001. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2002. sections, in the sense that the volume of each section is brought to the
  2003. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2004. this goal *without* applying "dynamic range compressing". It will retain 100%
  2005. of the dynamic range *within* each section of the audio file.
  2006. @table @option
  2007. @item f
  2008. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2009. Default is 500 milliseconds.
  2010. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2011. referred to as frames. This is required, because a peak magnitude has no
  2012. meaning for just a single sample value. Instead, we need to determine the
  2013. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2014. normalizer would simply use the peak magnitude of the complete file, the
  2015. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2016. frame. The length of a frame is specified in milliseconds. By default, the
  2017. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2018. been found to give good results with most files.
  2019. Note that the exact frame length, in number of samples, will be determined
  2020. automatically, based on the sampling rate of the individual input audio file.
  2021. @item g
  2022. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2023. number. Default is 31.
  2024. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2025. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2026. is specified in frames, centered around the current frame. For the sake of
  2027. simplicity, this must be an odd number. Consequently, the default value of 31
  2028. takes into account the current frame, as well as the 15 preceding frames and
  2029. the 15 subsequent frames. Using a larger window results in a stronger
  2030. smoothing effect and thus in less gain variation, i.e. slower gain
  2031. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2032. effect and thus in more gain variation, i.e. faster gain adaptation.
  2033. In other words, the more you increase this value, the more the Dynamic Audio
  2034. Normalizer will behave like a "traditional" normalization filter. On the
  2035. contrary, the more you decrease this value, the more the Dynamic Audio
  2036. Normalizer will behave like a dynamic range compressor.
  2037. @item p
  2038. Set the target peak value. This specifies the highest permissible magnitude
  2039. level for the normalized audio input. This filter will try to approach the
  2040. target peak magnitude as closely as possible, but at the same time it also
  2041. makes sure that the normalized signal will never exceed the peak magnitude.
  2042. A frame's maximum local gain factor is imposed directly by the target peak
  2043. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2044. It is not recommended to go above this value.
  2045. @item m
  2046. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2047. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2048. factor for each input frame, i.e. the maximum gain factor that does not
  2049. result in clipping or distortion. The maximum gain factor is determined by
  2050. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2051. additionally bounds the frame's maximum gain factor by a predetermined
  2052. (global) maximum gain factor. This is done in order to avoid excessive gain
  2053. factors in "silent" or almost silent frames. By default, the maximum gain
  2054. factor is 10.0, For most inputs the default value should be sufficient and
  2055. it usually is not recommended to increase this value. Though, for input
  2056. with an extremely low overall volume level, it may be necessary to allow even
  2057. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2058. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2059. Instead, a "sigmoid" threshold function will be applied. This way, the
  2060. gain factors will smoothly approach the threshold value, but never exceed that
  2061. value.
  2062. @item r
  2063. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2064. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2065. This means that the maximum local gain factor for each frame is defined
  2066. (only) by the frame's highest magnitude sample. This way, the samples can
  2067. be amplified as much as possible without exceeding the maximum signal
  2068. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2069. Normalizer can also take into account the frame's root mean square,
  2070. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2071. determine the power of a time-varying signal. It is therefore considered
  2072. that the RMS is a better approximation of the "perceived loudness" than
  2073. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2074. frames to a constant RMS value, a uniform "perceived loudness" can be
  2075. established. If a target RMS value has been specified, a frame's local gain
  2076. factor is defined as the factor that would result in exactly that RMS value.
  2077. Note, however, that the maximum local gain factor is still restricted by the
  2078. frame's highest magnitude sample, in order to prevent clipping.
  2079. @item n
  2080. Enable channels coupling. By default is enabled.
  2081. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2082. amount. This means the same gain factor will be applied to all channels, i.e.
  2083. the maximum possible gain factor is determined by the "loudest" channel.
  2084. However, in some recordings, it may happen that the volume of the different
  2085. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2086. In this case, this option can be used to disable the channel coupling. This way,
  2087. the gain factor will be determined independently for each channel, depending
  2088. only on the individual channel's highest magnitude sample. This allows for
  2089. harmonizing the volume of the different channels.
  2090. @item c
  2091. Enable DC bias correction. By default is disabled.
  2092. An audio signal (in the time domain) is a sequence of sample values.
  2093. In the Dynamic Audio Normalizer these sample values are represented in the
  2094. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2095. audio signal, or "waveform", should be centered around the zero point.
  2096. That means if we calculate the mean value of all samples in a file, or in a
  2097. single frame, then the result should be 0.0 or at least very close to that
  2098. value. If, however, there is a significant deviation of the mean value from
  2099. 0.0, in either positive or negative direction, this is referred to as a
  2100. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2101. Audio Normalizer provides optional DC bias correction.
  2102. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2103. the mean value, or "DC correction" offset, of each input frame and subtract
  2104. that value from all of the frame's sample values which ensures those samples
  2105. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2106. boundaries, the DC correction offset values will be interpolated smoothly
  2107. between neighbouring frames.
  2108. @item b
  2109. Enable alternative boundary mode. By default is disabled.
  2110. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2111. around each frame. This includes the preceding frames as well as the
  2112. subsequent frames. However, for the "boundary" frames, located at the very
  2113. beginning and at the very end of the audio file, not all neighbouring
  2114. frames are available. In particular, for the first few frames in the audio
  2115. file, the preceding frames are not known. And, similarly, for the last few
  2116. frames in the audio file, the subsequent frames are not known. Thus, the
  2117. question arises which gain factors should be assumed for the missing frames
  2118. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2119. to deal with this situation. The default boundary mode assumes a gain factor
  2120. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2121. "fade out" at the beginning and at the end of the input, respectively.
  2122. @item s
  2123. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2124. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2125. compression. This means that signal peaks will not be pruned and thus the
  2126. full dynamic range will be retained within each local neighbourhood. However,
  2127. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2128. normalization algorithm with a more "traditional" compression.
  2129. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2130. (thresholding) function. If (and only if) the compression feature is enabled,
  2131. all input frames will be processed by a soft knee thresholding function prior
  2132. to the actual normalization process. Put simply, the thresholding function is
  2133. going to prune all samples whose magnitude exceeds a certain threshold value.
  2134. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2135. value. Instead, the threshold value will be adjusted for each individual
  2136. frame.
  2137. In general, smaller parameters result in stronger compression, and vice versa.
  2138. Values below 3.0 are not recommended, because audible distortion may appear.
  2139. @end table
  2140. @section earwax
  2141. Make audio easier to listen to on headphones.
  2142. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2143. so that when listened to on headphones the stereo image is moved from
  2144. inside your head (standard for headphones) to outside and in front of
  2145. the listener (standard for speakers).
  2146. Ported from SoX.
  2147. @section equalizer
  2148. Apply a two-pole peaking equalisation (EQ) filter. With this
  2149. filter, the signal-level at and around a selected frequency can
  2150. be increased or decreased, whilst (unlike bandpass and bandreject
  2151. filters) that at all other frequencies is unchanged.
  2152. In order to produce complex equalisation curves, this filter can
  2153. be given several times, each with a different central frequency.
  2154. The filter accepts the following options:
  2155. @table @option
  2156. @item frequency, f
  2157. Set the filter's central frequency in Hz.
  2158. @item width_type, t
  2159. Set method to specify band-width of filter.
  2160. @table @option
  2161. @item h
  2162. Hz
  2163. @item q
  2164. Q-Factor
  2165. @item o
  2166. octave
  2167. @item s
  2168. slope
  2169. @item k
  2170. kHz
  2171. @end table
  2172. @item width, w
  2173. Specify the band-width of a filter in width_type units.
  2174. @item gain, g
  2175. Set the required gain or attenuation in dB.
  2176. Beware of clipping when using a positive gain.
  2177. @item channels, c
  2178. Specify which channels to filter, by default all available are filtered.
  2179. @end table
  2180. @subsection Examples
  2181. @itemize
  2182. @item
  2183. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2184. @example
  2185. equalizer=f=1000:t=h:width=200:g=-10
  2186. @end example
  2187. @item
  2188. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2189. @example
  2190. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2191. @end example
  2192. @end itemize
  2193. @subsection Commands
  2194. This filter supports the following commands:
  2195. @table @option
  2196. @item frequency, f
  2197. Change equalizer frequency.
  2198. Syntax for the command is : "@var{frequency}"
  2199. @item width_type, t
  2200. Change equalizer width_type.
  2201. Syntax for the command is : "@var{width_type}"
  2202. @item width, w
  2203. Change equalizer width.
  2204. Syntax for the command is : "@var{width}"
  2205. @item gain, g
  2206. Change equalizer gain.
  2207. Syntax for the command is : "@var{gain}"
  2208. @end table
  2209. @section extrastereo
  2210. Linearly increases the difference between left and right channels which
  2211. adds some sort of "live" effect to playback.
  2212. The filter accepts the following options:
  2213. @table @option
  2214. @item m
  2215. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2216. (average of both channels), with 1.0 sound will be unchanged, with
  2217. -1.0 left and right channels will be swapped.
  2218. @item c
  2219. Enable clipping. By default is enabled.
  2220. @end table
  2221. @section firequalizer
  2222. Apply FIR Equalization using arbitrary frequency response.
  2223. The filter accepts the following option:
  2224. @table @option
  2225. @item gain
  2226. Set gain curve equation (in dB). The expression can contain variables:
  2227. @table @option
  2228. @item f
  2229. the evaluated frequency
  2230. @item sr
  2231. sample rate
  2232. @item ch
  2233. channel number, set to 0 when multichannels evaluation is disabled
  2234. @item chid
  2235. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2236. multichannels evaluation is disabled
  2237. @item chs
  2238. number of channels
  2239. @item chlayout
  2240. channel_layout, see libavutil/channel_layout.h
  2241. @end table
  2242. and functions:
  2243. @table @option
  2244. @item gain_interpolate(f)
  2245. interpolate gain on frequency f based on gain_entry
  2246. @item cubic_interpolate(f)
  2247. same as gain_interpolate, but smoother
  2248. @end table
  2249. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2250. @item gain_entry
  2251. Set gain entry for gain_interpolate function. The expression can
  2252. contain functions:
  2253. @table @option
  2254. @item entry(f, g)
  2255. store gain entry at frequency f with value g
  2256. @end table
  2257. This option is also available as command.
  2258. @item delay
  2259. Set filter delay in seconds. Higher value means more accurate.
  2260. Default is @code{0.01}.
  2261. @item accuracy
  2262. Set filter accuracy in Hz. Lower value means more accurate.
  2263. Default is @code{5}.
  2264. @item wfunc
  2265. Set window function. Acceptable values are:
  2266. @table @option
  2267. @item rectangular
  2268. rectangular window, useful when gain curve is already smooth
  2269. @item hann
  2270. hann window (default)
  2271. @item hamming
  2272. hamming window
  2273. @item blackman
  2274. blackman window
  2275. @item nuttall3
  2276. 3-terms continuous 1st derivative nuttall window
  2277. @item mnuttall3
  2278. minimum 3-terms discontinuous nuttall window
  2279. @item nuttall
  2280. 4-terms continuous 1st derivative nuttall window
  2281. @item bnuttall
  2282. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2283. @item bharris
  2284. blackman-harris window
  2285. @item tukey
  2286. tukey window
  2287. @end table
  2288. @item fixed
  2289. If enabled, use fixed number of audio samples. This improves speed when
  2290. filtering with large delay. Default is disabled.
  2291. @item multi
  2292. Enable multichannels evaluation on gain. Default is disabled.
  2293. @item zero_phase
  2294. Enable zero phase mode by subtracting timestamp to compensate delay.
  2295. Default is disabled.
  2296. @item scale
  2297. Set scale used by gain. Acceptable values are:
  2298. @table @option
  2299. @item linlin
  2300. linear frequency, linear gain
  2301. @item linlog
  2302. linear frequency, logarithmic (in dB) gain (default)
  2303. @item loglin
  2304. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2305. @item loglog
  2306. logarithmic frequency, logarithmic gain
  2307. @end table
  2308. @item dumpfile
  2309. Set file for dumping, suitable for gnuplot.
  2310. @item dumpscale
  2311. Set scale for dumpfile. Acceptable values are same with scale option.
  2312. Default is linlog.
  2313. @item fft2
  2314. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2315. Default is disabled.
  2316. @item min_phase
  2317. Enable minimum phase impulse response. Default is disabled.
  2318. @end table
  2319. @subsection Examples
  2320. @itemize
  2321. @item
  2322. lowpass at 1000 Hz:
  2323. @example
  2324. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2325. @end example
  2326. @item
  2327. lowpass at 1000 Hz with gain_entry:
  2328. @example
  2329. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2330. @end example
  2331. @item
  2332. custom equalization:
  2333. @example
  2334. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2335. @end example
  2336. @item
  2337. higher delay with zero phase to compensate delay:
  2338. @example
  2339. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2340. @end example
  2341. @item
  2342. lowpass on left channel, highpass on right channel:
  2343. @example
  2344. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2345. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2346. @end example
  2347. @end itemize
  2348. @section flanger
  2349. Apply a flanging effect to the audio.
  2350. The filter accepts the following options:
  2351. @table @option
  2352. @item delay
  2353. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2354. @item depth
  2355. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2356. @item regen
  2357. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2358. Default value is 0.
  2359. @item width
  2360. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2361. Default value is 71.
  2362. @item speed
  2363. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2364. @item shape
  2365. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2366. Default value is @var{sinusoidal}.
  2367. @item phase
  2368. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2369. Default value is 25.
  2370. @item interp
  2371. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2372. Default is @var{linear}.
  2373. @end table
  2374. @section haas
  2375. Apply Haas effect to audio.
  2376. Note that this makes most sense to apply on mono signals.
  2377. With this filter applied to mono signals it give some directionality and
  2378. stretches its stereo image.
  2379. The filter accepts the following options:
  2380. @table @option
  2381. @item level_in
  2382. Set input level. By default is @var{1}, or 0dB
  2383. @item level_out
  2384. Set output level. By default is @var{1}, or 0dB.
  2385. @item side_gain
  2386. Set gain applied to side part of signal. By default is @var{1}.
  2387. @item middle_source
  2388. Set kind of middle source. Can be one of the following:
  2389. @table @samp
  2390. @item left
  2391. Pick left channel.
  2392. @item right
  2393. Pick right channel.
  2394. @item mid
  2395. Pick middle part signal of stereo image.
  2396. @item side
  2397. Pick side part signal of stereo image.
  2398. @end table
  2399. @item middle_phase
  2400. Change middle phase. By default is disabled.
  2401. @item left_delay
  2402. Set left channel delay. By default is @var{2.05} milliseconds.
  2403. @item left_balance
  2404. Set left channel balance. By default is @var{-1}.
  2405. @item left_gain
  2406. Set left channel gain. By default is @var{1}.
  2407. @item left_phase
  2408. Change left phase. By default is disabled.
  2409. @item right_delay
  2410. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2411. @item right_balance
  2412. Set right channel balance. By default is @var{1}.
  2413. @item right_gain
  2414. Set right channel gain. By default is @var{1}.
  2415. @item right_phase
  2416. Change right phase. By default is enabled.
  2417. @end table
  2418. @section hdcd
  2419. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2420. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2421. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2422. of HDCD, and detects the Transient Filter flag.
  2423. @example
  2424. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2425. @end example
  2426. When using the filter with wav, note the default encoding for wav is 16-bit,
  2427. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2428. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2429. @example
  2430. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2431. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2432. @end example
  2433. The filter accepts the following options:
  2434. @table @option
  2435. @item disable_autoconvert
  2436. Disable any automatic format conversion or resampling in the filter graph.
  2437. @item process_stereo
  2438. Process the stereo channels together. If target_gain does not match between
  2439. channels, consider it invalid and use the last valid target_gain.
  2440. @item cdt_ms
  2441. Set the code detect timer period in ms.
  2442. @item force_pe
  2443. Always extend peaks above -3dBFS even if PE isn't signaled.
  2444. @item analyze_mode
  2445. Replace audio with a solid tone and adjust the amplitude to signal some
  2446. specific aspect of the decoding process. The output file can be loaded in
  2447. an audio editor alongside the original to aid analysis.
  2448. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2449. Modes are:
  2450. @table @samp
  2451. @item 0, off
  2452. Disabled
  2453. @item 1, lle
  2454. Gain adjustment level at each sample
  2455. @item 2, pe
  2456. Samples where peak extend occurs
  2457. @item 3, cdt
  2458. Samples where the code detect timer is active
  2459. @item 4, tgm
  2460. Samples where the target gain does not match between channels
  2461. @end table
  2462. @end table
  2463. @section headphone
  2464. Apply head-related transfer functions (HRTFs) to create virtual
  2465. loudspeakers around the user for binaural listening via headphones.
  2466. The HRIRs are provided via additional streams, for each channel
  2467. one stereo input stream is needed.
  2468. The filter accepts the following options:
  2469. @table @option
  2470. @item map
  2471. Set mapping of input streams for convolution.
  2472. The argument is a '|'-separated list of channel names in order as they
  2473. are given as additional stream inputs for filter.
  2474. This also specify number of input streams. Number of input streams
  2475. must be not less than number of channels in first stream plus one.
  2476. @item gain
  2477. Set gain applied to audio. Value is in dB. Default is 0.
  2478. @item type
  2479. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2480. processing audio in time domain which is slow.
  2481. @var{freq} is processing audio in frequency domain which is fast.
  2482. Default is @var{freq}.
  2483. @item lfe
  2484. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2485. @end table
  2486. @subsection Examples
  2487. @itemize
  2488. @item
  2489. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2490. each amovie filter use stereo file with IR coefficients as input.
  2491. The files give coefficients for each position of virtual loudspeaker:
  2492. @example
  2493. 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"
  2494. output.wav
  2495. @end example
  2496. @end itemize
  2497. @section highpass
  2498. Apply a high-pass filter with 3dB point frequency.
  2499. The filter can be either single-pole, or double-pole (the default).
  2500. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2501. The filter accepts the following options:
  2502. @table @option
  2503. @item frequency, f
  2504. Set frequency in Hz. Default is 3000.
  2505. @item poles, p
  2506. Set number of poles. Default is 2.
  2507. @item width_type, t
  2508. Set method to specify band-width of filter.
  2509. @table @option
  2510. @item h
  2511. Hz
  2512. @item q
  2513. Q-Factor
  2514. @item o
  2515. octave
  2516. @item s
  2517. slope
  2518. @item k
  2519. kHz
  2520. @end table
  2521. @item width, w
  2522. Specify the band-width of a filter in width_type units.
  2523. Applies only to double-pole filter.
  2524. The default is 0.707q and gives a Butterworth response.
  2525. @item channels, c
  2526. Specify which channels to filter, by default all available are filtered.
  2527. @end table
  2528. @subsection Commands
  2529. This filter supports the following commands:
  2530. @table @option
  2531. @item frequency, f
  2532. Change highpass frequency.
  2533. Syntax for the command is : "@var{frequency}"
  2534. @item width_type, t
  2535. Change highpass width_type.
  2536. Syntax for the command is : "@var{width_type}"
  2537. @item width, w
  2538. Change highpass width.
  2539. Syntax for the command is : "@var{width}"
  2540. @end table
  2541. @section join
  2542. Join multiple input streams into one multi-channel stream.
  2543. It accepts the following parameters:
  2544. @table @option
  2545. @item inputs
  2546. The number of input streams. It defaults to 2.
  2547. @item channel_layout
  2548. The desired output channel layout. It defaults to stereo.
  2549. @item map
  2550. Map channels from inputs to output. The argument is a '|'-separated list of
  2551. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2552. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2553. can be either the name of the input channel (e.g. FL for front left) or its
  2554. index in the specified input stream. @var{out_channel} is the name of the output
  2555. channel.
  2556. @end table
  2557. The filter will attempt to guess the mappings when they are not specified
  2558. explicitly. It does so by first trying to find an unused matching input channel
  2559. and if that fails it picks the first unused input channel.
  2560. Join 3 inputs (with properly set channel layouts):
  2561. @example
  2562. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2563. @end example
  2564. Build a 5.1 output from 6 single-channel streams:
  2565. @example
  2566. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2567. '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'
  2568. out
  2569. @end example
  2570. @section ladspa
  2571. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2572. To enable compilation of this filter you need to configure FFmpeg with
  2573. @code{--enable-ladspa}.
  2574. @table @option
  2575. @item file, f
  2576. Specifies the name of LADSPA plugin library to load. If the environment
  2577. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2578. each one of the directories specified by the colon separated list in
  2579. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2580. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2581. @file{/usr/lib/ladspa/}.
  2582. @item plugin, p
  2583. Specifies the plugin within the library. Some libraries contain only
  2584. one plugin, but others contain many of them. If this is not set filter
  2585. will list all available plugins within the specified library.
  2586. @item controls, c
  2587. Set the '|' separated list of controls which are zero or more floating point
  2588. values that determine the behavior of the loaded plugin (for example delay,
  2589. threshold or gain).
  2590. Controls need to be defined using the following syntax:
  2591. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2592. @var{valuei} is the value set on the @var{i}-th control.
  2593. Alternatively they can be also defined using the following syntax:
  2594. @var{value0}|@var{value1}|@var{value2}|..., where
  2595. @var{valuei} is the value set on the @var{i}-th control.
  2596. If @option{controls} is set to @code{help}, all available controls and
  2597. their valid ranges are printed.
  2598. @item sample_rate, s
  2599. Specify the sample rate, default to 44100. Only used if plugin have
  2600. zero inputs.
  2601. @item nb_samples, n
  2602. Set the number of samples per channel per each output frame, default
  2603. is 1024. Only used if plugin have zero inputs.
  2604. @item duration, d
  2605. Set the minimum duration of the sourced audio. See
  2606. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2607. for the accepted syntax.
  2608. Note that the resulting duration may be greater than the specified duration,
  2609. as the generated audio is always cut at the end of a complete frame.
  2610. If not specified, or the expressed duration is negative, the audio is
  2611. supposed to be generated forever.
  2612. Only used if plugin have zero inputs.
  2613. @end table
  2614. @subsection Examples
  2615. @itemize
  2616. @item
  2617. List all available plugins within amp (LADSPA example plugin) library:
  2618. @example
  2619. ladspa=file=amp
  2620. @end example
  2621. @item
  2622. List all available controls and their valid ranges for @code{vcf_notch}
  2623. plugin from @code{VCF} library:
  2624. @example
  2625. ladspa=f=vcf:p=vcf_notch:c=help
  2626. @end example
  2627. @item
  2628. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2629. plugin library:
  2630. @example
  2631. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2632. @end example
  2633. @item
  2634. Add reverberation to the audio using TAP-plugins
  2635. (Tom's Audio Processing plugins):
  2636. @example
  2637. ladspa=file=tap_reverb:tap_reverb
  2638. @end example
  2639. @item
  2640. Generate white noise, with 0.2 amplitude:
  2641. @example
  2642. ladspa=file=cmt:noise_source_white:c=c0=.2
  2643. @end example
  2644. @item
  2645. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2646. @code{C* Audio Plugin Suite} (CAPS) library:
  2647. @example
  2648. ladspa=file=caps:Click:c=c1=20'
  2649. @end example
  2650. @item
  2651. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2652. @example
  2653. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2654. @end example
  2655. @item
  2656. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2657. @code{SWH Plugins} collection:
  2658. @example
  2659. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2660. @end example
  2661. @item
  2662. Attenuate low frequencies using Multiband EQ from Steve Harris
  2663. @code{SWH Plugins} collection:
  2664. @example
  2665. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2666. @end example
  2667. @item
  2668. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2669. (CAPS) library:
  2670. @example
  2671. ladspa=caps:Narrower
  2672. @end example
  2673. @item
  2674. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2675. @example
  2676. ladspa=caps:White:.2
  2677. @end example
  2678. @item
  2679. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2680. @example
  2681. ladspa=caps:Fractal:c=c1=1
  2682. @end example
  2683. @item
  2684. Dynamic volume normalization using @code{VLevel} plugin:
  2685. @example
  2686. ladspa=vlevel-ladspa:vlevel_mono
  2687. @end example
  2688. @end itemize
  2689. @subsection Commands
  2690. This filter supports the following commands:
  2691. @table @option
  2692. @item cN
  2693. Modify the @var{N}-th control value.
  2694. If the specified value is not valid, it is ignored and prior one is kept.
  2695. @end table
  2696. @section loudnorm
  2697. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2698. Support for both single pass (livestreams, files) and double pass (files) modes.
  2699. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  2700. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  2701. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  2702. The filter accepts the following options:
  2703. @table @option
  2704. @item I, i
  2705. Set integrated loudness target.
  2706. Range is -70.0 - -5.0. Default value is -24.0.
  2707. @item LRA, lra
  2708. Set loudness range target.
  2709. Range is 1.0 - 20.0. Default value is 7.0.
  2710. @item TP, tp
  2711. Set maximum true peak.
  2712. Range is -9.0 - +0.0. Default value is -2.0.
  2713. @item measured_I, measured_i
  2714. Measured IL of input file.
  2715. Range is -99.0 - +0.0.
  2716. @item measured_LRA, measured_lra
  2717. Measured LRA of input file.
  2718. Range is 0.0 - 99.0.
  2719. @item measured_TP, measured_tp
  2720. Measured true peak of input file.
  2721. Range is -99.0 - +99.0.
  2722. @item measured_thresh
  2723. Measured threshold of input file.
  2724. Range is -99.0 - +0.0.
  2725. @item offset
  2726. Set offset gain. Gain is applied before the true-peak limiter.
  2727. Range is -99.0 - +99.0. Default is +0.0.
  2728. @item linear
  2729. Normalize linearly if possible.
  2730. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2731. to be specified in order to use this mode.
  2732. Options are true or false. Default is true.
  2733. @item dual_mono
  2734. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2735. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2736. If set to @code{true}, this option will compensate for this effect.
  2737. Multi-channel input files are not affected by this option.
  2738. Options are true or false. Default is false.
  2739. @item print_format
  2740. Set print format for stats. Options are summary, json, or none.
  2741. Default value is none.
  2742. @end table
  2743. @section lowpass
  2744. Apply a low-pass filter with 3dB point frequency.
  2745. The filter can be either single-pole or double-pole (the default).
  2746. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2747. The filter accepts the following options:
  2748. @table @option
  2749. @item frequency, f
  2750. Set frequency in Hz. Default is 500.
  2751. @item poles, p
  2752. Set number of poles. Default is 2.
  2753. @item width_type, t
  2754. Set method to specify band-width of filter.
  2755. @table @option
  2756. @item h
  2757. Hz
  2758. @item q
  2759. Q-Factor
  2760. @item o
  2761. octave
  2762. @item s
  2763. slope
  2764. @item k
  2765. kHz
  2766. @end table
  2767. @item width, w
  2768. Specify the band-width of a filter in width_type units.
  2769. Applies only to double-pole filter.
  2770. The default is 0.707q and gives a Butterworth response.
  2771. @item channels, c
  2772. Specify which channels to filter, by default all available are filtered.
  2773. @end table
  2774. @subsection Examples
  2775. @itemize
  2776. @item
  2777. Lowpass only LFE channel, it LFE is not present it does nothing:
  2778. @example
  2779. lowpass=c=LFE
  2780. @end example
  2781. @end itemize
  2782. @subsection Commands
  2783. This filter supports the following commands:
  2784. @table @option
  2785. @item frequency, f
  2786. Change lowpass frequency.
  2787. Syntax for the command is : "@var{frequency}"
  2788. @item width_type, t
  2789. Change lowpass width_type.
  2790. Syntax for the command is : "@var{width_type}"
  2791. @item width, w
  2792. Change lowpass width.
  2793. Syntax for the command is : "@var{width}"
  2794. @end table
  2795. @section lv2
  2796. Load a LV2 (LADSPA Version 2) plugin.
  2797. To enable compilation of this filter you need to configure FFmpeg with
  2798. @code{--enable-lv2}.
  2799. @table @option
  2800. @item plugin, p
  2801. Specifies the plugin URI. You may need to escape ':'.
  2802. @item controls, c
  2803. Set the '|' separated list of controls which are zero or more floating point
  2804. values that determine the behavior of the loaded plugin (for example delay,
  2805. threshold or gain).
  2806. If @option{controls} is set to @code{help}, all available controls and
  2807. their valid ranges are printed.
  2808. @item sample_rate, s
  2809. Specify the sample rate, default to 44100. Only used if plugin have
  2810. zero inputs.
  2811. @item nb_samples, n
  2812. Set the number of samples per channel per each output frame, default
  2813. is 1024. Only used if plugin have zero inputs.
  2814. @item duration, d
  2815. Set the minimum duration of the sourced audio. See
  2816. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2817. for the accepted syntax.
  2818. Note that the resulting duration may be greater than the specified duration,
  2819. as the generated audio is always cut at the end of a complete frame.
  2820. If not specified, or the expressed duration is negative, the audio is
  2821. supposed to be generated forever.
  2822. Only used if plugin have zero inputs.
  2823. @end table
  2824. @subsection Examples
  2825. @itemize
  2826. @item
  2827. Apply bass enhancer plugin from Calf:
  2828. @example
  2829. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  2830. @end example
  2831. @item
  2832. Apply vinyl plugin from Calf:
  2833. @example
  2834. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  2835. @end example
  2836. @item
  2837. Apply bit crusher plugin from ArtyFX:
  2838. @example
  2839. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  2840. @end example
  2841. @end itemize
  2842. @section mcompand
  2843. Multiband Compress or expand the audio's dynamic range.
  2844. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  2845. This is akin to the crossover of a loudspeaker, and results in flat frequency
  2846. response when absent compander action.
  2847. It accepts the following parameters:
  2848. @table @option
  2849. @item args
  2850. This option syntax is:
  2851. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  2852. For explanation of each item refer to compand filter documentation.
  2853. @end table
  2854. @anchor{pan}
  2855. @section pan
  2856. Mix channels with specific gain levels. The filter accepts the output
  2857. channel layout followed by a set of channels definitions.
  2858. This filter is also designed to efficiently remap the channels of an audio
  2859. stream.
  2860. The filter accepts parameters of the form:
  2861. "@var{l}|@var{outdef}|@var{outdef}|..."
  2862. @table @option
  2863. @item l
  2864. output channel layout or number of channels
  2865. @item outdef
  2866. output channel specification, of the form:
  2867. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  2868. @item out_name
  2869. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2870. number (c0, c1, etc.)
  2871. @item gain
  2872. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2873. @item in_name
  2874. input channel to use, see out_name for details; it is not possible to mix
  2875. named and numbered input channels
  2876. @end table
  2877. If the `=' in a channel specification is replaced by `<', then the gains for
  2878. that specification will be renormalized so that the total is 1, thus
  2879. avoiding clipping noise.
  2880. @subsection Mixing examples
  2881. For example, if you want to down-mix from stereo to mono, but with a bigger
  2882. factor for the left channel:
  2883. @example
  2884. pan=1c|c0=0.9*c0+0.1*c1
  2885. @end example
  2886. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2887. 7-channels surround:
  2888. @example
  2889. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2890. @end example
  2891. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2892. that should be preferred (see "-ac" option) unless you have very specific
  2893. needs.
  2894. @subsection Remapping examples
  2895. The channel remapping will be effective if, and only if:
  2896. @itemize
  2897. @item gain coefficients are zeroes or ones,
  2898. @item only one input per channel output,
  2899. @end itemize
  2900. If all these conditions are satisfied, the filter will notify the user ("Pure
  2901. channel mapping detected"), and use an optimized and lossless method to do the
  2902. remapping.
  2903. For example, if you have a 5.1 source and want a stereo audio stream by
  2904. dropping the extra channels:
  2905. @example
  2906. pan="stereo| c0=FL | c1=FR"
  2907. @end example
  2908. Given the same source, you can also switch front left and front right channels
  2909. and keep the input channel layout:
  2910. @example
  2911. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2912. @end example
  2913. If the input is a stereo audio stream, you can mute the front left channel (and
  2914. still keep the stereo channel layout) with:
  2915. @example
  2916. pan="stereo|c1=c1"
  2917. @end example
  2918. Still with a stereo audio stream input, you can copy the right channel in both
  2919. front left and right:
  2920. @example
  2921. pan="stereo| c0=FR | c1=FR"
  2922. @end example
  2923. @section replaygain
  2924. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2925. outputs it unchanged.
  2926. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2927. @section resample
  2928. Convert the audio sample format, sample rate and channel layout. It is
  2929. not meant to be used directly.
  2930. @section rubberband
  2931. Apply time-stretching and pitch-shifting with librubberband.
  2932. The filter accepts the following options:
  2933. @table @option
  2934. @item tempo
  2935. Set tempo scale factor.
  2936. @item pitch
  2937. Set pitch scale factor.
  2938. @item transients
  2939. Set transients detector.
  2940. Possible values are:
  2941. @table @var
  2942. @item crisp
  2943. @item mixed
  2944. @item smooth
  2945. @end table
  2946. @item detector
  2947. Set detector.
  2948. Possible values are:
  2949. @table @var
  2950. @item compound
  2951. @item percussive
  2952. @item soft
  2953. @end table
  2954. @item phase
  2955. Set phase.
  2956. Possible values are:
  2957. @table @var
  2958. @item laminar
  2959. @item independent
  2960. @end table
  2961. @item window
  2962. Set processing window size.
  2963. Possible values are:
  2964. @table @var
  2965. @item standard
  2966. @item short
  2967. @item long
  2968. @end table
  2969. @item smoothing
  2970. Set smoothing.
  2971. Possible values are:
  2972. @table @var
  2973. @item off
  2974. @item on
  2975. @end table
  2976. @item formant
  2977. Enable formant preservation when shift pitching.
  2978. Possible values are:
  2979. @table @var
  2980. @item shifted
  2981. @item preserved
  2982. @end table
  2983. @item pitchq
  2984. Set pitch quality.
  2985. Possible values are:
  2986. @table @var
  2987. @item quality
  2988. @item speed
  2989. @item consistency
  2990. @end table
  2991. @item channels
  2992. Set channels.
  2993. Possible values are:
  2994. @table @var
  2995. @item apart
  2996. @item together
  2997. @end table
  2998. @end table
  2999. @section sidechaincompress
  3000. This filter acts like normal compressor but has the ability to compress
  3001. detected signal using second input signal.
  3002. It needs two input streams and returns one output stream.
  3003. First input stream will be processed depending on second stream signal.
  3004. The filtered signal then can be filtered with other filters in later stages of
  3005. processing. See @ref{pan} and @ref{amerge} filter.
  3006. The filter accepts the following options:
  3007. @table @option
  3008. @item level_in
  3009. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3010. @item threshold
  3011. If a signal of second stream raises above this level it will affect the gain
  3012. reduction of first stream.
  3013. By default is 0.125. Range is between 0.00097563 and 1.
  3014. @item ratio
  3015. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3016. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3017. Default is 2. Range is between 1 and 20.
  3018. @item attack
  3019. Amount of milliseconds the signal has to rise above the threshold before gain
  3020. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3021. @item release
  3022. Amount of milliseconds the signal has to fall below the threshold before
  3023. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3024. @item makeup
  3025. Set the amount by how much signal will be amplified after processing.
  3026. Default is 1. Range is from 1 to 64.
  3027. @item knee
  3028. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3029. Default is 2.82843. Range is between 1 and 8.
  3030. @item link
  3031. Choose if the @code{average} level between all channels of side-chain stream
  3032. or the louder(@code{maximum}) channel of side-chain stream affects the
  3033. reduction. Default is @code{average}.
  3034. @item detection
  3035. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3036. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3037. @item level_sc
  3038. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3039. @item mix
  3040. How much to use compressed signal in output. Default is 1.
  3041. Range is between 0 and 1.
  3042. @end table
  3043. @subsection Examples
  3044. @itemize
  3045. @item
  3046. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3047. depending on the signal of 2nd input and later compressed signal to be
  3048. merged with 2nd input:
  3049. @example
  3050. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3051. @end example
  3052. @end itemize
  3053. @section sidechaingate
  3054. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3055. filter the detected signal before sending it to the gain reduction stage.
  3056. Normally a gate uses the full range signal to detect a level above the
  3057. threshold.
  3058. For example: If you cut all lower frequencies from your sidechain signal
  3059. the gate will decrease the volume of your track only if not enough highs
  3060. appear. With this technique you are able to reduce the resonation of a
  3061. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3062. guitar.
  3063. It needs two input streams and returns one output stream.
  3064. First input stream will be processed depending on second stream signal.
  3065. The filter accepts the following options:
  3066. @table @option
  3067. @item level_in
  3068. Set input level before filtering.
  3069. Default is 1. Allowed range is from 0.015625 to 64.
  3070. @item range
  3071. Set the level of gain reduction when the signal is below the threshold.
  3072. Default is 0.06125. Allowed range is from 0 to 1.
  3073. @item threshold
  3074. If a signal rises above this level the gain reduction is released.
  3075. Default is 0.125. Allowed range is from 0 to 1.
  3076. @item ratio
  3077. Set a ratio about which the signal is reduced.
  3078. Default is 2. Allowed range is from 1 to 9000.
  3079. @item attack
  3080. Amount of milliseconds the signal has to rise above the threshold before gain
  3081. reduction stops.
  3082. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3083. @item release
  3084. Amount of milliseconds the signal has to fall below the threshold before the
  3085. reduction is increased again. Default is 250 milliseconds.
  3086. Allowed range is from 0.01 to 9000.
  3087. @item makeup
  3088. Set amount of amplification of signal after processing.
  3089. Default is 1. Allowed range is from 1 to 64.
  3090. @item knee
  3091. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3092. Default is 2.828427125. Allowed range is from 1 to 8.
  3093. @item detection
  3094. Choose if exact signal should be taken for detection or an RMS like one.
  3095. Default is rms. Can be peak or rms.
  3096. @item link
  3097. Choose if the average level between all channels or the louder channel affects
  3098. the reduction.
  3099. Default is average. Can be average or maximum.
  3100. @item level_sc
  3101. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3102. @end table
  3103. @section silencedetect
  3104. Detect silence in an audio stream.
  3105. This filter logs a message when it detects that the input audio volume is less
  3106. or equal to a noise tolerance value for a duration greater or equal to the
  3107. minimum detected noise duration.
  3108. The printed times and duration are expressed in seconds.
  3109. The filter accepts the following options:
  3110. @table @option
  3111. @item duration, d
  3112. Set silence duration until notification (default is 2 seconds).
  3113. @item noise, n
  3114. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3115. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3116. @end table
  3117. @subsection Examples
  3118. @itemize
  3119. @item
  3120. Detect 5 seconds of silence with -50dB noise tolerance:
  3121. @example
  3122. silencedetect=n=-50dB:d=5
  3123. @end example
  3124. @item
  3125. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3126. tolerance in @file{silence.mp3}:
  3127. @example
  3128. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3129. @end example
  3130. @end itemize
  3131. @section silenceremove
  3132. Remove silence from the beginning, middle or end of the audio.
  3133. The filter accepts the following options:
  3134. @table @option
  3135. @item start_periods
  3136. This value is used to indicate if audio should be trimmed at beginning of
  3137. the audio. A value of zero indicates no silence should be trimmed from the
  3138. beginning. When specifying a non-zero value, it trims audio up until it
  3139. finds non-silence. Normally, when trimming silence from beginning of audio
  3140. the @var{start_periods} will be @code{1} but it can be increased to higher
  3141. values to trim all audio up to specific count of non-silence periods.
  3142. Default value is @code{0}.
  3143. @item start_duration
  3144. Specify the amount of time that non-silence must be detected before it stops
  3145. trimming audio. By increasing the duration, bursts of noises can be treated
  3146. as silence and trimmed off. Default value is @code{0}.
  3147. @item start_threshold
  3148. This indicates what sample value should be treated as silence. For digital
  3149. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3150. you may wish to increase the value to account for background noise.
  3151. Can be specified in dB (in case "dB" is appended to the specified value)
  3152. or amplitude ratio. Default value is @code{0}.
  3153. @item stop_periods
  3154. Set the count for trimming silence from the end of audio.
  3155. To remove silence from the middle of a file, specify a @var{stop_periods}
  3156. that is negative. This value is then treated as a positive value and is
  3157. used to indicate the effect should restart processing as specified by
  3158. @var{start_periods}, making it suitable for removing periods of silence
  3159. in the middle of the audio.
  3160. Default value is @code{0}.
  3161. @item stop_duration
  3162. Specify a duration of silence that must exist before audio is not copied any
  3163. more. By specifying a higher duration, silence that is wanted can be left in
  3164. the audio.
  3165. Default value is @code{0}.
  3166. @item stop_threshold
  3167. This is the same as @option{start_threshold} but for trimming silence from
  3168. the end of audio.
  3169. Can be specified in dB (in case "dB" is appended to the specified value)
  3170. or amplitude ratio. Default value is @code{0}.
  3171. @item leave_silence
  3172. This indicates that @var{stop_duration} length of audio should be left intact
  3173. at the beginning of each period of silence.
  3174. For example, if you want to remove long pauses between words but do not want
  3175. to remove the pauses completely. Default value is @code{0}.
  3176. @item detection
  3177. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3178. and works better with digital silence which is exactly 0.
  3179. Default value is @code{rms}.
  3180. @item window
  3181. Set ratio used to calculate size of window for detecting silence.
  3182. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3183. @end table
  3184. @subsection Examples
  3185. @itemize
  3186. @item
  3187. The following example shows how this filter can be used to start a recording
  3188. that does not contain the delay at the start which usually occurs between
  3189. pressing the record button and the start of the performance:
  3190. @example
  3191. silenceremove=1:5:0.02
  3192. @end example
  3193. @item
  3194. Trim all silence encountered from beginning to end where there is more than 1
  3195. second of silence in audio:
  3196. @example
  3197. silenceremove=0:0:0:-1:1:-90dB
  3198. @end example
  3199. @end itemize
  3200. @section sofalizer
  3201. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3202. loudspeakers around the user for binaural listening via headphones (audio
  3203. formats up to 9 channels supported).
  3204. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3205. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3206. Austrian Academy of Sciences.
  3207. To enable compilation of this filter you need to configure FFmpeg with
  3208. @code{--enable-libmysofa}.
  3209. The filter accepts the following options:
  3210. @table @option
  3211. @item sofa
  3212. Set the SOFA file used for rendering.
  3213. @item gain
  3214. Set gain applied to audio. Value is in dB. Default is 0.
  3215. @item rotation
  3216. Set rotation of virtual loudspeakers in deg. Default is 0.
  3217. @item elevation
  3218. Set elevation of virtual speakers in deg. Default is 0.
  3219. @item radius
  3220. Set distance in meters between loudspeakers and the listener with near-field
  3221. HRTFs. Default is 1.
  3222. @item type
  3223. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3224. processing audio in time domain which is slow.
  3225. @var{freq} is processing audio in frequency domain which is fast.
  3226. Default is @var{freq}.
  3227. @item speakers
  3228. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3229. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3230. Each virtual loudspeaker is described with short channel name following with
  3231. azimuth and elevation in degrees.
  3232. Each virtual loudspeaker description is separated by '|'.
  3233. For example to override front left and front right channel positions use:
  3234. 'speakers=FL 45 15|FR 345 15'.
  3235. Descriptions with unrecognised channel names are ignored.
  3236. @item lfegain
  3237. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3238. @end table
  3239. @subsection Examples
  3240. @itemize
  3241. @item
  3242. Using ClubFritz6 sofa file:
  3243. @example
  3244. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3245. @end example
  3246. @item
  3247. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3248. @example
  3249. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3250. @end example
  3251. @item
  3252. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3253. and also with custom gain:
  3254. @example
  3255. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3256. @end example
  3257. @end itemize
  3258. @section stereotools
  3259. This filter has some handy utilities to manage stereo signals, for converting
  3260. M/S stereo recordings to L/R signal while having control over the parameters
  3261. or spreading the stereo image of master track.
  3262. The filter accepts the following options:
  3263. @table @option
  3264. @item level_in
  3265. Set input level before filtering for both channels. Defaults is 1.
  3266. Allowed range is from 0.015625 to 64.
  3267. @item level_out
  3268. Set output level after filtering for both channels. Defaults is 1.
  3269. Allowed range is from 0.015625 to 64.
  3270. @item balance_in
  3271. Set input balance between both channels. Default is 0.
  3272. Allowed range is from -1 to 1.
  3273. @item balance_out
  3274. Set output balance between both channels. Default is 0.
  3275. Allowed range is from -1 to 1.
  3276. @item softclip
  3277. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3278. clipping. Disabled by default.
  3279. @item mutel
  3280. Mute the left channel. Disabled by default.
  3281. @item muter
  3282. Mute the right channel. Disabled by default.
  3283. @item phasel
  3284. Change the phase of the left channel. Disabled by default.
  3285. @item phaser
  3286. Change the phase of the right channel. Disabled by default.
  3287. @item mode
  3288. Set stereo mode. Available values are:
  3289. @table @samp
  3290. @item lr>lr
  3291. Left/Right to Left/Right, this is default.
  3292. @item lr>ms
  3293. Left/Right to Mid/Side.
  3294. @item ms>lr
  3295. Mid/Side to Left/Right.
  3296. @item lr>ll
  3297. Left/Right to Left/Left.
  3298. @item lr>rr
  3299. Left/Right to Right/Right.
  3300. @item lr>l+r
  3301. Left/Right to Left + Right.
  3302. @item lr>rl
  3303. Left/Right to Right/Left.
  3304. @item ms>ll
  3305. Mid/Side to Left/Left.
  3306. @item ms>rr
  3307. Mid/Side to Right/Right.
  3308. @end table
  3309. @item slev
  3310. Set level of side signal. Default is 1.
  3311. Allowed range is from 0.015625 to 64.
  3312. @item sbal
  3313. Set balance of side signal. Default is 0.
  3314. Allowed range is from -1 to 1.
  3315. @item mlev
  3316. Set level of the middle signal. Default is 1.
  3317. Allowed range is from 0.015625 to 64.
  3318. @item mpan
  3319. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3320. @item base
  3321. Set stereo base between mono and inversed channels. Default is 0.
  3322. Allowed range is from -1 to 1.
  3323. @item delay
  3324. Set delay in milliseconds how much to delay left from right channel and
  3325. vice versa. Default is 0. Allowed range is from -20 to 20.
  3326. @item sclevel
  3327. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3328. @item phase
  3329. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3330. @item bmode_in, bmode_out
  3331. Set balance mode for balance_in/balance_out option.
  3332. Can be one of the following:
  3333. @table @samp
  3334. @item balance
  3335. Classic balance mode. Attenuate one channel at time.
  3336. Gain is raised up to 1.
  3337. @item amplitude
  3338. Similar as classic mode above but gain is raised up to 2.
  3339. @item power
  3340. Equal power distribution, from -6dB to +6dB range.
  3341. @end table
  3342. @end table
  3343. @subsection Examples
  3344. @itemize
  3345. @item
  3346. Apply karaoke like effect:
  3347. @example
  3348. stereotools=mlev=0.015625
  3349. @end example
  3350. @item
  3351. Convert M/S signal to L/R:
  3352. @example
  3353. "stereotools=mode=ms>lr"
  3354. @end example
  3355. @end itemize
  3356. @section stereowiden
  3357. This filter enhance the stereo effect by suppressing signal common to both
  3358. channels and by delaying the signal of left into right and vice versa,
  3359. thereby widening the stereo effect.
  3360. The filter accepts the following options:
  3361. @table @option
  3362. @item delay
  3363. Time in milliseconds of the delay of left signal into right and vice versa.
  3364. Default is 20 milliseconds.
  3365. @item feedback
  3366. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3367. effect of left signal in right output and vice versa which gives widening
  3368. effect. Default is 0.3.
  3369. @item crossfeed
  3370. Cross feed of left into right with inverted phase. This helps in suppressing
  3371. the mono. If the value is 1 it will cancel all the signal common to both
  3372. channels. Default is 0.3.
  3373. @item drymix
  3374. Set level of input signal of original channel. Default is 0.8.
  3375. @end table
  3376. @section superequalizer
  3377. Apply 18 band equalizer.
  3378. The filter accepts the following options:
  3379. @table @option
  3380. @item 1b
  3381. Set 65Hz band gain.
  3382. @item 2b
  3383. Set 92Hz band gain.
  3384. @item 3b
  3385. Set 131Hz band gain.
  3386. @item 4b
  3387. Set 185Hz band gain.
  3388. @item 5b
  3389. Set 262Hz band gain.
  3390. @item 6b
  3391. Set 370Hz band gain.
  3392. @item 7b
  3393. Set 523Hz band gain.
  3394. @item 8b
  3395. Set 740Hz band gain.
  3396. @item 9b
  3397. Set 1047Hz band gain.
  3398. @item 10b
  3399. Set 1480Hz band gain.
  3400. @item 11b
  3401. Set 2093Hz band gain.
  3402. @item 12b
  3403. Set 2960Hz band gain.
  3404. @item 13b
  3405. Set 4186Hz band gain.
  3406. @item 14b
  3407. Set 5920Hz band gain.
  3408. @item 15b
  3409. Set 8372Hz band gain.
  3410. @item 16b
  3411. Set 11840Hz band gain.
  3412. @item 17b
  3413. Set 16744Hz band gain.
  3414. @item 18b
  3415. Set 20000Hz band gain.
  3416. @end table
  3417. @section surround
  3418. Apply audio surround upmix filter.
  3419. This filter allows to produce multichannel output from audio stream.
  3420. The filter accepts the following options:
  3421. @table @option
  3422. @item chl_out
  3423. Set output channel layout. By default, this is @var{5.1}.
  3424. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3425. for the required syntax.
  3426. @item chl_in
  3427. Set input channel layout. By default, this is @var{stereo}.
  3428. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3429. for the required syntax.
  3430. @item level_in
  3431. Set input volume level. By default, this is @var{1}.
  3432. @item level_out
  3433. Set output volume level. By default, this is @var{1}.
  3434. @item lfe
  3435. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3436. @item lfe_low
  3437. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3438. @item lfe_high
  3439. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3440. @item fc_in
  3441. Set front center input volume. By default, this is @var{1}.
  3442. @item fc_out
  3443. Set front center output volume. By default, this is @var{1}.
  3444. @item lfe_in
  3445. Set LFE input volume. By default, this is @var{1}.
  3446. @item lfe_out
  3447. Set LFE output volume. By default, this is @var{1}.
  3448. @end table
  3449. @section treble
  3450. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3451. shelving filter with a response similar to that of a standard
  3452. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3453. The filter accepts the following options:
  3454. @table @option
  3455. @item gain, g
  3456. Give the gain at whichever is the lower of ~22 kHz and the
  3457. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3458. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3459. @item frequency, f
  3460. Set the filter's central frequency and so can be used
  3461. to extend or reduce the frequency range to be boosted or cut.
  3462. The default value is @code{3000} Hz.
  3463. @item width_type, t
  3464. Set method to specify band-width of filter.
  3465. @table @option
  3466. @item h
  3467. Hz
  3468. @item q
  3469. Q-Factor
  3470. @item o
  3471. octave
  3472. @item s
  3473. slope
  3474. @item k
  3475. kHz
  3476. @end table
  3477. @item width, w
  3478. Determine how steep is the filter's shelf transition.
  3479. @item channels, c
  3480. Specify which channels to filter, by default all available are filtered.
  3481. @end table
  3482. @subsection Commands
  3483. This filter supports the following commands:
  3484. @table @option
  3485. @item frequency, f
  3486. Change treble frequency.
  3487. Syntax for the command is : "@var{frequency}"
  3488. @item width_type, t
  3489. Change treble width_type.
  3490. Syntax for the command is : "@var{width_type}"
  3491. @item width, w
  3492. Change treble width.
  3493. Syntax for the command is : "@var{width}"
  3494. @item gain, g
  3495. Change treble gain.
  3496. Syntax for the command is : "@var{gain}"
  3497. @end table
  3498. @section tremolo
  3499. Sinusoidal amplitude modulation.
  3500. The filter accepts the following options:
  3501. @table @option
  3502. @item f
  3503. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3504. (20 Hz or lower) will result in a tremolo effect.
  3505. This filter may also be used as a ring modulator by specifying
  3506. a modulation frequency higher than 20 Hz.
  3507. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3508. @item d
  3509. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3510. Default value is 0.5.
  3511. @end table
  3512. @section vibrato
  3513. Sinusoidal phase modulation.
  3514. The filter accepts the following options:
  3515. @table @option
  3516. @item f
  3517. Modulation frequency in Hertz.
  3518. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3519. @item d
  3520. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3521. Default value is 0.5.
  3522. @end table
  3523. @section volume
  3524. Adjust the input audio volume.
  3525. It accepts the following parameters:
  3526. @table @option
  3527. @item volume
  3528. Set audio volume expression.
  3529. Output values are clipped to the maximum value.
  3530. The output audio volume is given by the relation:
  3531. @example
  3532. @var{output_volume} = @var{volume} * @var{input_volume}
  3533. @end example
  3534. The default value for @var{volume} is "1.0".
  3535. @item precision
  3536. This parameter represents the mathematical precision.
  3537. It determines which input sample formats will be allowed, which affects the
  3538. precision of the volume scaling.
  3539. @table @option
  3540. @item fixed
  3541. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3542. @item float
  3543. 32-bit floating-point; this limits input sample format to FLT. (default)
  3544. @item double
  3545. 64-bit floating-point; this limits input sample format to DBL.
  3546. @end table
  3547. @item replaygain
  3548. Choose the behaviour on encountering ReplayGain side data in input frames.
  3549. @table @option
  3550. @item drop
  3551. Remove ReplayGain side data, ignoring its contents (the default).
  3552. @item ignore
  3553. Ignore ReplayGain side data, but leave it in the frame.
  3554. @item track
  3555. Prefer the track gain, if present.
  3556. @item album
  3557. Prefer the album gain, if present.
  3558. @end table
  3559. @item replaygain_preamp
  3560. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3561. Default value for @var{replaygain_preamp} is 0.0.
  3562. @item eval
  3563. Set when the volume expression is evaluated.
  3564. It accepts the following values:
  3565. @table @samp
  3566. @item once
  3567. only evaluate expression once during the filter initialization, or
  3568. when the @samp{volume} command is sent
  3569. @item frame
  3570. evaluate expression for each incoming frame
  3571. @end table
  3572. Default value is @samp{once}.
  3573. @end table
  3574. The volume expression can contain the following parameters.
  3575. @table @option
  3576. @item n
  3577. frame number (starting at zero)
  3578. @item nb_channels
  3579. number of channels
  3580. @item nb_consumed_samples
  3581. number of samples consumed by the filter
  3582. @item nb_samples
  3583. number of samples in the current frame
  3584. @item pos
  3585. original frame position in the file
  3586. @item pts
  3587. frame PTS
  3588. @item sample_rate
  3589. sample rate
  3590. @item startpts
  3591. PTS at start of stream
  3592. @item startt
  3593. time at start of stream
  3594. @item t
  3595. frame time
  3596. @item tb
  3597. timestamp timebase
  3598. @item volume
  3599. last set volume value
  3600. @end table
  3601. Note that when @option{eval} is set to @samp{once} only the
  3602. @var{sample_rate} and @var{tb} variables are available, all other
  3603. variables will evaluate to NAN.
  3604. @subsection Commands
  3605. This filter supports the following commands:
  3606. @table @option
  3607. @item volume
  3608. Modify the volume expression.
  3609. The command accepts the same syntax of the corresponding option.
  3610. If the specified expression is not valid, it is kept at its current
  3611. value.
  3612. @item replaygain_noclip
  3613. Prevent clipping by limiting the gain applied.
  3614. Default value for @var{replaygain_noclip} is 1.
  3615. @end table
  3616. @subsection Examples
  3617. @itemize
  3618. @item
  3619. Halve the input audio volume:
  3620. @example
  3621. volume=volume=0.5
  3622. volume=volume=1/2
  3623. volume=volume=-6.0206dB
  3624. @end example
  3625. In all the above example the named key for @option{volume} can be
  3626. omitted, for example like in:
  3627. @example
  3628. volume=0.5
  3629. @end example
  3630. @item
  3631. Increase input audio power by 6 decibels using fixed-point precision:
  3632. @example
  3633. volume=volume=6dB:precision=fixed
  3634. @end example
  3635. @item
  3636. Fade volume after time 10 with an annihilation period of 5 seconds:
  3637. @example
  3638. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3639. @end example
  3640. @end itemize
  3641. @section volumedetect
  3642. Detect the volume of the input video.
  3643. The filter has no parameters. The input is not modified. Statistics about
  3644. the volume will be printed in the log when the input stream end is reached.
  3645. In particular it will show the mean volume (root mean square), maximum
  3646. volume (on a per-sample basis), and the beginning of a histogram of the
  3647. registered volume values (from the maximum value to a cumulated 1/1000 of
  3648. the samples).
  3649. All volumes are in decibels relative to the maximum PCM value.
  3650. @subsection Examples
  3651. Here is an excerpt of the output:
  3652. @example
  3653. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3654. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3655. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3656. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3657. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3658. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3659. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3660. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3661. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3662. @end example
  3663. It means that:
  3664. @itemize
  3665. @item
  3666. The mean square energy is approximately -27 dB, or 10^-2.7.
  3667. @item
  3668. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3669. @item
  3670. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3671. @end itemize
  3672. In other words, raising the volume by +4 dB does not cause any clipping,
  3673. raising it by +5 dB causes clipping for 6 samples, etc.
  3674. @c man end AUDIO FILTERS
  3675. @chapter Audio Sources
  3676. @c man begin AUDIO SOURCES
  3677. Below is a description of the currently available audio sources.
  3678. @section abuffer
  3679. Buffer audio frames, and make them available to the filter chain.
  3680. This source is mainly intended for a programmatic use, in particular
  3681. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3682. It accepts the following parameters:
  3683. @table @option
  3684. @item time_base
  3685. The timebase which will be used for timestamps of submitted frames. It must be
  3686. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3687. @item sample_rate
  3688. The sample rate of the incoming audio buffers.
  3689. @item sample_fmt
  3690. The sample format of the incoming audio buffers.
  3691. Either a sample format name or its corresponding integer representation from
  3692. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3693. @item channel_layout
  3694. The channel layout of the incoming audio buffers.
  3695. Either a channel layout name from channel_layout_map in
  3696. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3697. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3698. @item channels
  3699. The number of channels of the incoming audio buffers.
  3700. If both @var{channels} and @var{channel_layout} are specified, then they
  3701. must be consistent.
  3702. @end table
  3703. @subsection Examples
  3704. @example
  3705. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3706. @end example
  3707. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3708. Since the sample format with name "s16p" corresponds to the number
  3709. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3710. equivalent to:
  3711. @example
  3712. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3713. @end example
  3714. @section aevalsrc
  3715. Generate an audio signal specified by an expression.
  3716. This source accepts in input one or more expressions (one for each
  3717. channel), which are evaluated and used to generate a corresponding
  3718. audio signal.
  3719. This source accepts the following options:
  3720. @table @option
  3721. @item exprs
  3722. Set the '|'-separated expressions list for each separate channel. In case the
  3723. @option{channel_layout} option is not specified, the selected channel layout
  3724. depends on the number of provided expressions. Otherwise the last
  3725. specified expression is applied to the remaining output channels.
  3726. @item channel_layout, c
  3727. Set the channel layout. The number of channels in the specified layout
  3728. must be equal to the number of specified expressions.
  3729. @item duration, d
  3730. Set the minimum duration of the sourced audio. See
  3731. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3732. for the accepted syntax.
  3733. Note that the resulting duration may be greater than the specified
  3734. duration, as the generated audio is always cut at the end of a
  3735. complete frame.
  3736. If not specified, or the expressed duration is negative, the audio is
  3737. supposed to be generated forever.
  3738. @item nb_samples, n
  3739. Set the number of samples per channel per each output frame,
  3740. default to 1024.
  3741. @item sample_rate, s
  3742. Specify the sample rate, default to 44100.
  3743. @end table
  3744. Each expression in @var{exprs} can contain the following constants:
  3745. @table @option
  3746. @item n
  3747. number of the evaluated sample, starting from 0
  3748. @item t
  3749. time of the evaluated sample expressed in seconds, starting from 0
  3750. @item s
  3751. sample rate
  3752. @end table
  3753. @subsection Examples
  3754. @itemize
  3755. @item
  3756. Generate silence:
  3757. @example
  3758. aevalsrc=0
  3759. @end example
  3760. @item
  3761. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3762. 8000 Hz:
  3763. @example
  3764. aevalsrc="sin(440*2*PI*t):s=8000"
  3765. @end example
  3766. @item
  3767. Generate a two channels signal, specify the channel layout (Front
  3768. Center + Back Center) explicitly:
  3769. @example
  3770. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3771. @end example
  3772. @item
  3773. Generate white noise:
  3774. @example
  3775. aevalsrc="-2+random(0)"
  3776. @end example
  3777. @item
  3778. Generate an amplitude modulated signal:
  3779. @example
  3780. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3781. @end example
  3782. @item
  3783. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3784. @example
  3785. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3786. @end example
  3787. @end itemize
  3788. @section anullsrc
  3789. The null audio source, return unprocessed audio frames. It is mainly useful
  3790. as a template and to be employed in analysis / debugging tools, or as
  3791. the source for filters which ignore the input data (for example the sox
  3792. synth filter).
  3793. This source accepts the following options:
  3794. @table @option
  3795. @item channel_layout, cl
  3796. Specifies the channel layout, and can be either an integer or a string
  3797. representing a channel layout. The default value of @var{channel_layout}
  3798. is "stereo".
  3799. Check the channel_layout_map definition in
  3800. @file{libavutil/channel_layout.c} for the mapping between strings and
  3801. channel layout values.
  3802. @item sample_rate, r
  3803. Specifies the sample rate, and defaults to 44100.
  3804. @item nb_samples, n
  3805. Set the number of samples per requested frames.
  3806. @end table
  3807. @subsection Examples
  3808. @itemize
  3809. @item
  3810. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3811. @example
  3812. anullsrc=r=48000:cl=4
  3813. @end example
  3814. @item
  3815. Do the same operation with a more obvious syntax:
  3816. @example
  3817. anullsrc=r=48000:cl=mono
  3818. @end example
  3819. @end itemize
  3820. All the parameters need to be explicitly defined.
  3821. @section flite
  3822. Synthesize a voice utterance using the libflite library.
  3823. To enable compilation of this filter you need to configure FFmpeg with
  3824. @code{--enable-libflite}.
  3825. Note that versions of the flite library prior to 2.0 are not thread-safe.
  3826. The filter accepts the following options:
  3827. @table @option
  3828. @item list_voices
  3829. If set to 1, list the names of the available voices and exit
  3830. immediately. Default value is 0.
  3831. @item nb_samples, n
  3832. Set the maximum number of samples per frame. Default value is 512.
  3833. @item textfile
  3834. Set the filename containing the text to speak.
  3835. @item text
  3836. Set the text to speak.
  3837. @item voice, v
  3838. Set the voice to use for the speech synthesis. Default value is
  3839. @code{kal}. See also the @var{list_voices} option.
  3840. @end table
  3841. @subsection Examples
  3842. @itemize
  3843. @item
  3844. Read from file @file{speech.txt}, and synthesize the text using the
  3845. standard flite voice:
  3846. @example
  3847. flite=textfile=speech.txt
  3848. @end example
  3849. @item
  3850. Read the specified text selecting the @code{slt} voice:
  3851. @example
  3852. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3853. @end example
  3854. @item
  3855. Input text to ffmpeg:
  3856. @example
  3857. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3858. @end example
  3859. @item
  3860. Make @file{ffplay} speak the specified text, using @code{flite} and
  3861. the @code{lavfi} device:
  3862. @example
  3863. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3864. @end example
  3865. @end itemize
  3866. For more information about libflite, check:
  3867. @url{http://www.festvox.org/flite/}
  3868. @section anoisesrc
  3869. Generate a noise audio signal.
  3870. The filter accepts the following options:
  3871. @table @option
  3872. @item sample_rate, r
  3873. Specify the sample rate. Default value is 48000 Hz.
  3874. @item amplitude, a
  3875. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3876. is 1.0.
  3877. @item duration, d
  3878. Specify the duration of the generated audio stream. Not specifying this option
  3879. results in noise with an infinite length.
  3880. @item color, colour, c
  3881. Specify the color of noise. Available noise colors are white, pink, brown,
  3882. blue and violet. Default color is white.
  3883. @item seed, s
  3884. Specify a value used to seed the PRNG.
  3885. @item nb_samples, n
  3886. Set the number of samples per each output frame, default is 1024.
  3887. @end table
  3888. @subsection Examples
  3889. @itemize
  3890. @item
  3891. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3892. @example
  3893. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3894. @end example
  3895. @end itemize
  3896. @section hilbert
  3897. Generate odd-tap Hilbert transform FIR coefficients.
  3898. The resulting stream can be used with @ref{afir} filter for phase-shifting
  3899. the signal by 90 degrees.
  3900. This is used in many matrix coding schemes and for analytic signal generation.
  3901. The process is often written as a multiplication by i (or j), the imaginary unit.
  3902. The filter accepts the following options:
  3903. @table @option
  3904. @item sample_rate, s
  3905. Set sample rate, default is 44100.
  3906. @item taps, t
  3907. Set length of FIR filter, default is 22051.
  3908. @item nb_samples, n
  3909. Set number of samples per each frame.
  3910. @item win_func, w
  3911. Set window function to be used when generating FIR coefficients.
  3912. @end table
  3913. @section sine
  3914. Generate an audio signal made of a sine wave with amplitude 1/8.
  3915. The audio signal is bit-exact.
  3916. The filter accepts the following options:
  3917. @table @option
  3918. @item frequency, f
  3919. Set the carrier frequency. Default is 440 Hz.
  3920. @item beep_factor, b
  3921. Enable a periodic beep every second with frequency @var{beep_factor} times
  3922. the carrier frequency. Default is 0, meaning the beep is disabled.
  3923. @item sample_rate, r
  3924. Specify the sample rate, default is 44100.
  3925. @item duration, d
  3926. Specify the duration of the generated audio stream.
  3927. @item samples_per_frame
  3928. Set the number of samples per output frame.
  3929. The expression can contain the following constants:
  3930. @table @option
  3931. @item n
  3932. The (sequential) number of the output audio frame, starting from 0.
  3933. @item pts
  3934. The PTS (Presentation TimeStamp) of the output audio frame,
  3935. expressed in @var{TB} units.
  3936. @item t
  3937. The PTS of the output audio frame, expressed in seconds.
  3938. @item TB
  3939. The timebase of the output audio frames.
  3940. @end table
  3941. Default is @code{1024}.
  3942. @end table
  3943. @subsection Examples
  3944. @itemize
  3945. @item
  3946. Generate a simple 440 Hz sine wave:
  3947. @example
  3948. sine
  3949. @end example
  3950. @item
  3951. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3952. @example
  3953. sine=220:4:d=5
  3954. sine=f=220:b=4:d=5
  3955. sine=frequency=220:beep_factor=4:duration=5
  3956. @end example
  3957. @item
  3958. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3959. pattern:
  3960. @example
  3961. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3962. @end example
  3963. @end itemize
  3964. @c man end AUDIO SOURCES
  3965. @chapter Audio Sinks
  3966. @c man begin AUDIO SINKS
  3967. Below is a description of the currently available audio sinks.
  3968. @section abuffersink
  3969. Buffer audio frames, and make them available to the end of filter chain.
  3970. This sink is mainly intended for programmatic use, in particular
  3971. through the interface defined in @file{libavfilter/buffersink.h}
  3972. or the options system.
  3973. It accepts a pointer to an AVABufferSinkContext structure, which
  3974. defines the incoming buffers' formats, to be passed as the opaque
  3975. parameter to @code{avfilter_init_filter} for initialization.
  3976. @section anullsink
  3977. Null audio sink; do absolutely nothing with the input audio. It is
  3978. mainly useful as a template and for use in analysis / debugging
  3979. tools.
  3980. @c man end AUDIO SINKS
  3981. @chapter Video Filters
  3982. @c man begin VIDEO FILTERS
  3983. When you configure your FFmpeg build, you can disable any of the
  3984. existing filters using @code{--disable-filters}.
  3985. The configure output will show the video filters included in your
  3986. build.
  3987. Below is a description of the currently available video filters.
  3988. @section alphaextract
  3989. Extract the alpha component from the input as a grayscale video. This
  3990. is especially useful with the @var{alphamerge} filter.
  3991. @section alphamerge
  3992. Add or replace the alpha component of the primary input with the
  3993. grayscale value of a second input. This is intended for use with
  3994. @var{alphaextract} to allow the transmission or storage of frame
  3995. sequences that have alpha in a format that doesn't support an alpha
  3996. channel.
  3997. For example, to reconstruct full frames from a normal YUV-encoded video
  3998. and a separate video created with @var{alphaextract}, you might use:
  3999. @example
  4000. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4001. @end example
  4002. Since this filter is designed for reconstruction, it operates on frame
  4003. sequences without considering timestamps, and terminates when either
  4004. input reaches end of stream. This will cause problems if your encoding
  4005. pipeline drops frames. If you're trying to apply an image as an
  4006. overlay to a video stream, consider the @var{overlay} filter instead.
  4007. @section ass
  4008. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4009. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4010. Substation Alpha) subtitles files.
  4011. This filter accepts the following option in addition to the common options from
  4012. the @ref{subtitles} filter:
  4013. @table @option
  4014. @item shaping
  4015. Set the shaping engine
  4016. Available values are:
  4017. @table @samp
  4018. @item auto
  4019. The default libass shaping engine, which is the best available.
  4020. @item simple
  4021. Fast, font-agnostic shaper that can do only substitutions
  4022. @item complex
  4023. Slower shaper using OpenType for substitutions and positioning
  4024. @end table
  4025. The default is @code{auto}.
  4026. @end table
  4027. @section atadenoise
  4028. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4029. The filter accepts the following options:
  4030. @table @option
  4031. @item 0a
  4032. Set threshold A for 1st plane. Default is 0.02.
  4033. Valid range is 0 to 0.3.
  4034. @item 0b
  4035. Set threshold B for 1st plane. Default is 0.04.
  4036. Valid range is 0 to 5.
  4037. @item 1a
  4038. Set threshold A for 2nd plane. Default is 0.02.
  4039. Valid range is 0 to 0.3.
  4040. @item 1b
  4041. Set threshold B for 2nd plane. Default is 0.04.
  4042. Valid range is 0 to 5.
  4043. @item 2a
  4044. Set threshold A for 3rd plane. Default is 0.02.
  4045. Valid range is 0 to 0.3.
  4046. @item 2b
  4047. Set threshold B for 3rd plane. Default is 0.04.
  4048. Valid range is 0 to 5.
  4049. Threshold A is designed to react on abrupt changes in the input signal and
  4050. threshold B is designed to react on continuous changes in the input signal.
  4051. @item s
  4052. Set number of frames filter will use for averaging. Default is 33. Must be odd
  4053. number in range [5, 129].
  4054. @item p
  4055. Set what planes of frame filter will use for averaging. Default is all.
  4056. @end table
  4057. @section avgblur
  4058. Apply average blur filter.
  4059. The filter accepts the following options:
  4060. @table @option
  4061. @item sizeX
  4062. Set horizontal kernel size.
  4063. @item planes
  4064. Set which planes to filter. By default all planes are filtered.
  4065. @item sizeY
  4066. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  4067. Default is @code{0}.
  4068. @end table
  4069. @section bbox
  4070. Compute the bounding box for the non-black pixels in the input frame
  4071. luminance plane.
  4072. This filter computes the bounding box containing all the pixels with a
  4073. luminance value greater than the minimum allowed value.
  4074. The parameters describing the bounding box are printed on the filter
  4075. log.
  4076. The filter accepts the following option:
  4077. @table @option
  4078. @item min_val
  4079. Set the minimal luminance value. Default is @code{16}.
  4080. @end table
  4081. @section bitplanenoise
  4082. Show and measure bit plane noise.
  4083. The filter accepts the following options:
  4084. @table @option
  4085. @item bitplane
  4086. Set which plane to analyze. Default is @code{1}.
  4087. @item filter
  4088. Filter out noisy pixels from @code{bitplane} set above.
  4089. Default is disabled.
  4090. @end table
  4091. @section blackdetect
  4092. Detect video intervals that are (almost) completely black. Can be
  4093. useful to detect chapter transitions, commercials, or invalid
  4094. recordings. Output lines contains the time for the start, end and
  4095. duration of the detected black interval expressed in seconds.
  4096. In order to display the output lines, you need to set the loglevel at
  4097. least to the AV_LOG_INFO value.
  4098. The filter accepts the following options:
  4099. @table @option
  4100. @item black_min_duration, d
  4101. Set the minimum detected black duration expressed in seconds. It must
  4102. be a non-negative floating point number.
  4103. Default value is 2.0.
  4104. @item picture_black_ratio_th, pic_th
  4105. Set the threshold for considering a picture "black".
  4106. Express the minimum value for the ratio:
  4107. @example
  4108. @var{nb_black_pixels} / @var{nb_pixels}
  4109. @end example
  4110. for which a picture is considered black.
  4111. Default value is 0.98.
  4112. @item pixel_black_th, pix_th
  4113. Set the threshold for considering a pixel "black".
  4114. The threshold expresses the maximum pixel luminance value for which a
  4115. pixel is considered "black". The provided value is scaled according to
  4116. the following equation:
  4117. @example
  4118. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4119. @end example
  4120. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4121. the input video format, the range is [0-255] for YUV full-range
  4122. formats and [16-235] for YUV non full-range formats.
  4123. Default value is 0.10.
  4124. @end table
  4125. The following example sets the maximum pixel threshold to the minimum
  4126. value, and detects only black intervals of 2 or more seconds:
  4127. @example
  4128. blackdetect=d=2:pix_th=0.00
  4129. @end example
  4130. @section blackframe
  4131. Detect frames that are (almost) completely black. Can be useful to
  4132. detect chapter transitions or commercials. Output lines consist of
  4133. the frame number of the detected frame, the percentage of blackness,
  4134. the position in the file if known or -1 and the timestamp in seconds.
  4135. In order to display the output lines, you need to set the loglevel at
  4136. least to the AV_LOG_INFO value.
  4137. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4138. The value represents the percentage of pixels in the picture that
  4139. are below the threshold value.
  4140. It accepts the following parameters:
  4141. @table @option
  4142. @item amount
  4143. The percentage of the pixels that have to be below the threshold; it defaults to
  4144. @code{98}.
  4145. @item threshold, thresh
  4146. The threshold below which a pixel value is considered black; it defaults to
  4147. @code{32}.
  4148. @end table
  4149. @section blend, tblend
  4150. Blend two video frames into each other.
  4151. The @code{blend} filter takes two input streams and outputs one
  4152. stream, the first input is the "top" layer and second input is
  4153. "bottom" layer. By default, the output terminates when the longest input terminates.
  4154. The @code{tblend} (time blend) filter takes two consecutive frames
  4155. from one single stream, and outputs the result obtained by blending
  4156. the new frame on top of the old frame.
  4157. A description of the accepted options follows.
  4158. @table @option
  4159. @item c0_mode
  4160. @item c1_mode
  4161. @item c2_mode
  4162. @item c3_mode
  4163. @item all_mode
  4164. Set blend mode for specific pixel component or all pixel components in case
  4165. of @var{all_mode}. Default value is @code{normal}.
  4166. Available values for component modes are:
  4167. @table @samp
  4168. @item addition
  4169. @item grainmerge
  4170. @item and
  4171. @item average
  4172. @item burn
  4173. @item darken
  4174. @item difference
  4175. @item grainextract
  4176. @item divide
  4177. @item dodge
  4178. @item freeze
  4179. @item exclusion
  4180. @item extremity
  4181. @item glow
  4182. @item hardlight
  4183. @item hardmix
  4184. @item heat
  4185. @item lighten
  4186. @item linearlight
  4187. @item multiply
  4188. @item multiply128
  4189. @item negation
  4190. @item normal
  4191. @item or
  4192. @item overlay
  4193. @item phoenix
  4194. @item pinlight
  4195. @item reflect
  4196. @item screen
  4197. @item softlight
  4198. @item subtract
  4199. @item vividlight
  4200. @item xor
  4201. @end table
  4202. @item c0_opacity
  4203. @item c1_opacity
  4204. @item c2_opacity
  4205. @item c3_opacity
  4206. @item all_opacity
  4207. Set blend opacity for specific pixel component or all pixel components in case
  4208. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4209. @item c0_expr
  4210. @item c1_expr
  4211. @item c2_expr
  4212. @item c3_expr
  4213. @item all_expr
  4214. Set blend expression for specific pixel component or all pixel components in case
  4215. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4216. The expressions can use the following variables:
  4217. @table @option
  4218. @item N
  4219. The sequential number of the filtered frame, starting from @code{0}.
  4220. @item X
  4221. @item Y
  4222. the coordinates of the current sample
  4223. @item W
  4224. @item H
  4225. the width and height of currently filtered plane
  4226. @item SW
  4227. @item SH
  4228. Width and height scale depending on the currently filtered plane. It is the
  4229. ratio between the corresponding luma plane number of pixels and the current
  4230. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  4231. @code{0.5,0.5} for chroma planes.
  4232. @item T
  4233. Time of the current frame, expressed in seconds.
  4234. @item TOP, A
  4235. Value of pixel component at current location for first video frame (top layer).
  4236. @item BOTTOM, B
  4237. Value of pixel component at current location for second video frame (bottom layer).
  4238. @end table
  4239. @end table
  4240. The @code{blend} filter also supports the @ref{framesync} options.
  4241. @subsection Examples
  4242. @itemize
  4243. @item
  4244. Apply transition from bottom layer to top layer in first 10 seconds:
  4245. @example
  4246. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4247. @end example
  4248. @item
  4249. Apply linear horizontal transition from top layer to bottom layer:
  4250. @example
  4251. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4252. @end example
  4253. @item
  4254. Apply 1x1 checkerboard effect:
  4255. @example
  4256. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4257. @end example
  4258. @item
  4259. Apply uncover left effect:
  4260. @example
  4261. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4262. @end example
  4263. @item
  4264. Apply uncover down effect:
  4265. @example
  4266. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4267. @end example
  4268. @item
  4269. Apply uncover up-left effect:
  4270. @example
  4271. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4272. @end example
  4273. @item
  4274. Split diagonally video and shows top and bottom layer on each side:
  4275. @example
  4276. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4277. @end example
  4278. @item
  4279. Display differences between the current and the previous frame:
  4280. @example
  4281. tblend=all_mode=grainextract
  4282. @end example
  4283. @end itemize
  4284. @section boxblur
  4285. Apply a boxblur algorithm to the input video.
  4286. It accepts the following parameters:
  4287. @table @option
  4288. @item luma_radius, lr
  4289. @item luma_power, lp
  4290. @item chroma_radius, cr
  4291. @item chroma_power, cp
  4292. @item alpha_radius, ar
  4293. @item alpha_power, ap
  4294. @end table
  4295. A description of the accepted options follows.
  4296. @table @option
  4297. @item luma_radius, lr
  4298. @item chroma_radius, cr
  4299. @item alpha_radius, ar
  4300. Set an expression for the box radius in pixels used for blurring the
  4301. corresponding input plane.
  4302. The radius value must be a non-negative number, and must not be
  4303. greater than the value of the expression @code{min(w,h)/2} for the
  4304. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4305. planes.
  4306. Default value for @option{luma_radius} is "2". If not specified,
  4307. @option{chroma_radius} and @option{alpha_radius} default to the
  4308. corresponding value set for @option{luma_radius}.
  4309. The expressions can contain the following constants:
  4310. @table @option
  4311. @item w
  4312. @item h
  4313. The input width and height in pixels.
  4314. @item cw
  4315. @item ch
  4316. The input chroma image width and height in pixels.
  4317. @item hsub
  4318. @item vsub
  4319. The horizontal and vertical chroma subsample values. For example, for the
  4320. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4321. @end table
  4322. @item luma_power, lp
  4323. @item chroma_power, cp
  4324. @item alpha_power, ap
  4325. Specify how many times the boxblur filter is applied to the
  4326. corresponding plane.
  4327. Default value for @option{luma_power} is 2. If not specified,
  4328. @option{chroma_power} and @option{alpha_power} default to the
  4329. corresponding value set for @option{luma_power}.
  4330. A value of 0 will disable the effect.
  4331. @end table
  4332. @subsection Examples
  4333. @itemize
  4334. @item
  4335. Apply a boxblur filter with the luma, chroma, and alpha radii
  4336. set to 2:
  4337. @example
  4338. boxblur=luma_radius=2:luma_power=1
  4339. boxblur=2:1
  4340. @end example
  4341. @item
  4342. Set the luma radius to 2, and alpha and chroma radius to 0:
  4343. @example
  4344. boxblur=2:1:cr=0:ar=0
  4345. @end example
  4346. @item
  4347. Set the luma and chroma radii to a fraction of the video dimension:
  4348. @example
  4349. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4350. @end example
  4351. @end itemize
  4352. @section bwdif
  4353. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4354. Deinterlacing Filter").
  4355. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4356. interpolation algorithms.
  4357. It accepts the following parameters:
  4358. @table @option
  4359. @item mode
  4360. The interlacing mode to adopt. It accepts one of the following values:
  4361. @table @option
  4362. @item 0, send_frame
  4363. Output one frame for each frame.
  4364. @item 1, send_field
  4365. Output one frame for each field.
  4366. @end table
  4367. The default value is @code{send_field}.
  4368. @item parity
  4369. The picture field parity assumed for the input interlaced video. It accepts one
  4370. of the following values:
  4371. @table @option
  4372. @item 0, tff
  4373. Assume the top field is first.
  4374. @item 1, bff
  4375. Assume the bottom field is first.
  4376. @item -1, auto
  4377. Enable automatic detection of field parity.
  4378. @end table
  4379. The default value is @code{auto}.
  4380. If the interlacing is unknown or the decoder does not export this information,
  4381. top field first will be assumed.
  4382. @item deint
  4383. Specify which frames to deinterlace. Accept one of the following
  4384. values:
  4385. @table @option
  4386. @item 0, all
  4387. Deinterlace all frames.
  4388. @item 1, interlaced
  4389. Only deinterlace frames marked as interlaced.
  4390. @end table
  4391. The default value is @code{all}.
  4392. @end table
  4393. @section chromakey
  4394. YUV colorspace color/chroma keying.
  4395. The filter accepts the following options:
  4396. @table @option
  4397. @item color
  4398. The color which will be replaced with transparency.
  4399. @item similarity
  4400. Similarity percentage with the key color.
  4401. 0.01 matches only the exact key color, while 1.0 matches everything.
  4402. @item blend
  4403. Blend percentage.
  4404. 0.0 makes pixels either fully transparent, or not transparent at all.
  4405. Higher values result in semi-transparent pixels, with a higher transparency
  4406. the more similar the pixels color is to the key color.
  4407. @item yuv
  4408. Signals that the color passed is already in YUV instead of RGB.
  4409. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4410. This can be used to pass exact YUV values as hexadecimal numbers.
  4411. @end table
  4412. @subsection Examples
  4413. @itemize
  4414. @item
  4415. Make every green pixel in the input image transparent:
  4416. @example
  4417. ffmpeg -i input.png -vf chromakey=green out.png
  4418. @end example
  4419. @item
  4420. Overlay a greenscreen-video on top of a static black background.
  4421. @example
  4422. 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
  4423. @end example
  4424. @end itemize
  4425. @section ciescope
  4426. Display CIE color diagram with pixels overlaid onto it.
  4427. The filter accepts the following options:
  4428. @table @option
  4429. @item system
  4430. Set color system.
  4431. @table @samp
  4432. @item ntsc, 470m
  4433. @item ebu, 470bg
  4434. @item smpte
  4435. @item 240m
  4436. @item apple
  4437. @item widergb
  4438. @item cie1931
  4439. @item rec709, hdtv
  4440. @item uhdtv, rec2020
  4441. @end table
  4442. @item cie
  4443. Set CIE system.
  4444. @table @samp
  4445. @item xyy
  4446. @item ucs
  4447. @item luv
  4448. @end table
  4449. @item gamuts
  4450. Set what gamuts to draw.
  4451. See @code{system} option for available values.
  4452. @item size, s
  4453. Set ciescope size, by default set to 512.
  4454. @item intensity, i
  4455. Set intensity used to map input pixel values to CIE diagram.
  4456. @item contrast
  4457. Set contrast used to draw tongue colors that are out of active color system gamut.
  4458. @item corrgamma
  4459. Correct gamma displayed on scope, by default enabled.
  4460. @item showwhite
  4461. Show white point on CIE diagram, by default disabled.
  4462. @item gamma
  4463. Set input gamma. Used only with XYZ input color space.
  4464. @end table
  4465. @section codecview
  4466. Visualize information exported by some codecs.
  4467. Some codecs can export information through frames using side-data or other
  4468. means. For example, some MPEG based codecs export motion vectors through the
  4469. @var{export_mvs} flag in the codec @option{flags2} option.
  4470. The filter accepts the following option:
  4471. @table @option
  4472. @item mv
  4473. Set motion vectors to visualize.
  4474. Available flags for @var{mv} are:
  4475. @table @samp
  4476. @item pf
  4477. forward predicted MVs of P-frames
  4478. @item bf
  4479. forward predicted MVs of B-frames
  4480. @item bb
  4481. backward predicted MVs of B-frames
  4482. @end table
  4483. @item qp
  4484. Display quantization parameters using the chroma planes.
  4485. @item mv_type, mvt
  4486. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4487. Available flags for @var{mv_type} are:
  4488. @table @samp
  4489. @item fp
  4490. forward predicted MVs
  4491. @item bp
  4492. backward predicted MVs
  4493. @end table
  4494. @item frame_type, ft
  4495. Set frame type to visualize motion vectors of.
  4496. Available flags for @var{frame_type} are:
  4497. @table @samp
  4498. @item if
  4499. intra-coded frames (I-frames)
  4500. @item pf
  4501. predicted frames (P-frames)
  4502. @item bf
  4503. bi-directionally predicted frames (B-frames)
  4504. @end table
  4505. @end table
  4506. @subsection Examples
  4507. @itemize
  4508. @item
  4509. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4510. @example
  4511. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4512. @end example
  4513. @item
  4514. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4515. @example
  4516. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4517. @end example
  4518. @end itemize
  4519. @section colorbalance
  4520. Modify intensity of primary colors (red, green and blue) of input frames.
  4521. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4522. regions for the red-cyan, green-magenta or blue-yellow balance.
  4523. A positive adjustment value shifts the balance towards the primary color, a negative
  4524. value towards the complementary color.
  4525. The filter accepts the following options:
  4526. @table @option
  4527. @item rs
  4528. @item gs
  4529. @item bs
  4530. Adjust red, green and blue shadows (darkest pixels).
  4531. @item rm
  4532. @item gm
  4533. @item bm
  4534. Adjust red, green and blue midtones (medium pixels).
  4535. @item rh
  4536. @item gh
  4537. @item bh
  4538. Adjust red, green and blue highlights (brightest pixels).
  4539. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4540. @end table
  4541. @subsection Examples
  4542. @itemize
  4543. @item
  4544. Add red color cast to shadows:
  4545. @example
  4546. colorbalance=rs=.3
  4547. @end example
  4548. @end itemize
  4549. @section colorkey
  4550. RGB colorspace color keying.
  4551. The filter accepts the following options:
  4552. @table @option
  4553. @item color
  4554. The color which will be replaced with transparency.
  4555. @item similarity
  4556. Similarity percentage with the key color.
  4557. 0.01 matches only the exact key color, while 1.0 matches everything.
  4558. @item blend
  4559. Blend percentage.
  4560. 0.0 makes pixels either fully transparent, or not transparent at all.
  4561. Higher values result in semi-transparent pixels, with a higher transparency
  4562. the more similar the pixels color is to the key color.
  4563. @end table
  4564. @subsection Examples
  4565. @itemize
  4566. @item
  4567. Make every green pixel in the input image transparent:
  4568. @example
  4569. ffmpeg -i input.png -vf colorkey=green out.png
  4570. @end example
  4571. @item
  4572. Overlay a greenscreen-video on top of a static background image.
  4573. @example
  4574. 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
  4575. @end example
  4576. @end itemize
  4577. @section colorlevels
  4578. Adjust video input frames using levels.
  4579. The filter accepts the following options:
  4580. @table @option
  4581. @item rimin
  4582. @item gimin
  4583. @item bimin
  4584. @item aimin
  4585. Adjust red, green, blue and alpha input black point.
  4586. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4587. @item rimax
  4588. @item gimax
  4589. @item bimax
  4590. @item aimax
  4591. Adjust red, green, blue and alpha input white point.
  4592. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  4593. Input levels are used to lighten highlights (bright tones), darken shadows
  4594. (dark tones), change the balance of bright and dark tones.
  4595. @item romin
  4596. @item gomin
  4597. @item bomin
  4598. @item aomin
  4599. Adjust red, green, blue and alpha output black point.
  4600. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  4601. @item romax
  4602. @item gomax
  4603. @item bomax
  4604. @item aomax
  4605. Adjust red, green, blue and alpha output white point.
  4606. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  4607. Output levels allows manual selection of a constrained output level range.
  4608. @end table
  4609. @subsection Examples
  4610. @itemize
  4611. @item
  4612. Make video output darker:
  4613. @example
  4614. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4615. @end example
  4616. @item
  4617. Increase contrast:
  4618. @example
  4619. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4620. @end example
  4621. @item
  4622. Make video output lighter:
  4623. @example
  4624. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4625. @end example
  4626. @item
  4627. Increase brightness:
  4628. @example
  4629. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4630. @end example
  4631. @end itemize
  4632. @section colorchannelmixer
  4633. Adjust video input frames by re-mixing color channels.
  4634. This filter modifies a color channel by adding the values associated to
  4635. the other channels of the same pixels. For example if the value to
  4636. modify is red, the output value will be:
  4637. @example
  4638. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4639. @end example
  4640. The filter accepts the following options:
  4641. @table @option
  4642. @item rr
  4643. @item rg
  4644. @item rb
  4645. @item ra
  4646. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4647. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4648. @item gr
  4649. @item gg
  4650. @item gb
  4651. @item ga
  4652. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4653. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4654. @item br
  4655. @item bg
  4656. @item bb
  4657. @item ba
  4658. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4659. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4660. @item ar
  4661. @item ag
  4662. @item ab
  4663. @item aa
  4664. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4665. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4666. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4667. @end table
  4668. @subsection Examples
  4669. @itemize
  4670. @item
  4671. Convert source to grayscale:
  4672. @example
  4673. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4674. @end example
  4675. @item
  4676. Simulate sepia tones:
  4677. @example
  4678. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4679. @end example
  4680. @end itemize
  4681. @section colormatrix
  4682. Convert color matrix.
  4683. The filter accepts the following options:
  4684. @table @option
  4685. @item src
  4686. @item dst
  4687. Specify the source and destination color matrix. Both values must be
  4688. specified.
  4689. The accepted values are:
  4690. @table @samp
  4691. @item bt709
  4692. BT.709
  4693. @item fcc
  4694. FCC
  4695. @item bt601
  4696. BT.601
  4697. @item bt470
  4698. BT.470
  4699. @item bt470bg
  4700. BT.470BG
  4701. @item smpte170m
  4702. SMPTE-170M
  4703. @item smpte240m
  4704. SMPTE-240M
  4705. @item bt2020
  4706. BT.2020
  4707. @end table
  4708. @end table
  4709. For example to convert from BT.601 to SMPTE-240M, use the command:
  4710. @example
  4711. colormatrix=bt601:smpte240m
  4712. @end example
  4713. @section colorspace
  4714. Convert colorspace, transfer characteristics or color primaries.
  4715. Input video needs to have an even size.
  4716. The filter accepts the following options:
  4717. @table @option
  4718. @anchor{all}
  4719. @item all
  4720. Specify all color properties at once.
  4721. The accepted values are:
  4722. @table @samp
  4723. @item bt470m
  4724. BT.470M
  4725. @item bt470bg
  4726. BT.470BG
  4727. @item bt601-6-525
  4728. BT.601-6 525
  4729. @item bt601-6-625
  4730. BT.601-6 625
  4731. @item bt709
  4732. BT.709
  4733. @item smpte170m
  4734. SMPTE-170M
  4735. @item smpte240m
  4736. SMPTE-240M
  4737. @item bt2020
  4738. BT.2020
  4739. @end table
  4740. @anchor{space}
  4741. @item space
  4742. Specify output colorspace.
  4743. The accepted values are:
  4744. @table @samp
  4745. @item bt709
  4746. BT.709
  4747. @item fcc
  4748. FCC
  4749. @item bt470bg
  4750. BT.470BG or BT.601-6 625
  4751. @item smpte170m
  4752. SMPTE-170M or BT.601-6 525
  4753. @item smpte240m
  4754. SMPTE-240M
  4755. @item ycgco
  4756. YCgCo
  4757. @item bt2020ncl
  4758. BT.2020 with non-constant luminance
  4759. @end table
  4760. @anchor{trc}
  4761. @item trc
  4762. Specify output transfer characteristics.
  4763. The accepted values are:
  4764. @table @samp
  4765. @item bt709
  4766. BT.709
  4767. @item bt470m
  4768. BT.470M
  4769. @item bt470bg
  4770. BT.470BG
  4771. @item gamma22
  4772. Constant gamma of 2.2
  4773. @item gamma28
  4774. Constant gamma of 2.8
  4775. @item smpte170m
  4776. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4777. @item smpte240m
  4778. SMPTE-240M
  4779. @item srgb
  4780. SRGB
  4781. @item iec61966-2-1
  4782. iec61966-2-1
  4783. @item iec61966-2-4
  4784. iec61966-2-4
  4785. @item xvycc
  4786. xvycc
  4787. @item bt2020-10
  4788. BT.2020 for 10-bits content
  4789. @item bt2020-12
  4790. BT.2020 for 12-bits content
  4791. @end table
  4792. @anchor{primaries}
  4793. @item primaries
  4794. Specify output color primaries.
  4795. The accepted values are:
  4796. @table @samp
  4797. @item bt709
  4798. BT.709
  4799. @item bt470m
  4800. BT.470M
  4801. @item bt470bg
  4802. BT.470BG or BT.601-6 625
  4803. @item smpte170m
  4804. SMPTE-170M or BT.601-6 525
  4805. @item smpte240m
  4806. SMPTE-240M
  4807. @item film
  4808. film
  4809. @item smpte431
  4810. SMPTE-431
  4811. @item smpte432
  4812. SMPTE-432
  4813. @item bt2020
  4814. BT.2020
  4815. @item jedec-p22
  4816. JEDEC P22 phosphors
  4817. @end table
  4818. @anchor{range}
  4819. @item range
  4820. Specify output color range.
  4821. The accepted values are:
  4822. @table @samp
  4823. @item tv
  4824. TV (restricted) range
  4825. @item mpeg
  4826. MPEG (restricted) range
  4827. @item pc
  4828. PC (full) range
  4829. @item jpeg
  4830. JPEG (full) range
  4831. @end table
  4832. @item format
  4833. Specify output color format.
  4834. The accepted values are:
  4835. @table @samp
  4836. @item yuv420p
  4837. YUV 4:2:0 planar 8-bits
  4838. @item yuv420p10
  4839. YUV 4:2:0 planar 10-bits
  4840. @item yuv420p12
  4841. YUV 4:2:0 planar 12-bits
  4842. @item yuv422p
  4843. YUV 4:2:2 planar 8-bits
  4844. @item yuv422p10
  4845. YUV 4:2:2 planar 10-bits
  4846. @item yuv422p12
  4847. YUV 4:2:2 planar 12-bits
  4848. @item yuv444p
  4849. YUV 4:4:4 planar 8-bits
  4850. @item yuv444p10
  4851. YUV 4:4:4 planar 10-bits
  4852. @item yuv444p12
  4853. YUV 4:4:4 planar 12-bits
  4854. @end table
  4855. @item fast
  4856. Do a fast conversion, which skips gamma/primary correction. This will take
  4857. significantly less CPU, but will be mathematically incorrect. To get output
  4858. compatible with that produced by the colormatrix filter, use fast=1.
  4859. @item dither
  4860. Specify dithering mode.
  4861. The accepted values are:
  4862. @table @samp
  4863. @item none
  4864. No dithering
  4865. @item fsb
  4866. Floyd-Steinberg dithering
  4867. @end table
  4868. @item wpadapt
  4869. Whitepoint adaptation mode.
  4870. The accepted values are:
  4871. @table @samp
  4872. @item bradford
  4873. Bradford whitepoint adaptation
  4874. @item vonkries
  4875. von Kries whitepoint adaptation
  4876. @item identity
  4877. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4878. @end table
  4879. @item iall
  4880. Override all input properties at once. Same accepted values as @ref{all}.
  4881. @item ispace
  4882. Override input colorspace. Same accepted values as @ref{space}.
  4883. @item iprimaries
  4884. Override input color primaries. Same accepted values as @ref{primaries}.
  4885. @item itrc
  4886. Override input transfer characteristics. Same accepted values as @ref{trc}.
  4887. @item irange
  4888. Override input color range. Same accepted values as @ref{range}.
  4889. @end table
  4890. The filter converts the transfer characteristics, color space and color
  4891. primaries to the specified user values. The output value, if not specified,
  4892. is set to a default value based on the "all" property. If that property is
  4893. also not specified, the filter will log an error. The output color range and
  4894. format default to the same value as the input color range and format. The
  4895. input transfer characteristics, color space, color primaries and color range
  4896. should be set on the input data. If any of these are missing, the filter will
  4897. log an error and no conversion will take place.
  4898. For example to convert the input to SMPTE-240M, use the command:
  4899. @example
  4900. colorspace=smpte240m
  4901. @end example
  4902. @section convolution
  4903. Apply convolution 3x3, 5x5 or 7x7 filter.
  4904. The filter accepts the following options:
  4905. @table @option
  4906. @item 0m
  4907. @item 1m
  4908. @item 2m
  4909. @item 3m
  4910. Set matrix for each plane.
  4911. Matrix is sequence of 9, 25 or 49 signed integers.
  4912. @item 0rdiv
  4913. @item 1rdiv
  4914. @item 2rdiv
  4915. @item 3rdiv
  4916. Set multiplier for calculated value for each plane.
  4917. @item 0bias
  4918. @item 1bias
  4919. @item 2bias
  4920. @item 3bias
  4921. Set bias for each plane. This value is added to the result of the multiplication.
  4922. Useful for making the overall image brighter or darker. Default is 0.0.
  4923. @end table
  4924. @subsection Examples
  4925. @itemize
  4926. @item
  4927. Apply sharpen:
  4928. @example
  4929. 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"
  4930. @end example
  4931. @item
  4932. Apply blur:
  4933. @example
  4934. 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"
  4935. @end example
  4936. @item
  4937. Apply edge enhance:
  4938. @example
  4939. 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"
  4940. @end example
  4941. @item
  4942. Apply edge detect:
  4943. @example
  4944. 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"
  4945. @end example
  4946. @item
  4947. Apply laplacian edge detector which includes diagonals:
  4948. @example
  4949. 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"
  4950. @end example
  4951. @item
  4952. Apply emboss:
  4953. @example
  4954. 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"
  4955. @end example
  4956. @end itemize
  4957. @section convolve
  4958. Apply 2D convolution of video stream in frequency domain using second stream
  4959. as impulse.
  4960. The filter accepts the following options:
  4961. @table @option
  4962. @item planes
  4963. Set which planes to process.
  4964. @item impulse
  4965. Set which impulse video frames will be processed, can be @var{first}
  4966. or @var{all}. Default is @var{all}.
  4967. @end table
  4968. The @code{convolve} filter also supports the @ref{framesync} options.
  4969. @section copy
  4970. Copy the input video source unchanged to the output. This is mainly useful for
  4971. testing purposes.
  4972. @anchor{coreimage}
  4973. @section coreimage
  4974. Video filtering on GPU using Apple's CoreImage API on OSX.
  4975. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4976. processed by video hardware. However, software-based OpenGL implementations
  4977. exist which means there is no guarantee for hardware processing. It depends on
  4978. the respective OSX.
  4979. There are many filters and image generators provided by Apple that come with a
  4980. large variety of options. The filter has to be referenced by its name along
  4981. with its options.
  4982. The coreimage filter accepts the following options:
  4983. @table @option
  4984. @item list_filters
  4985. List all available filters and generators along with all their respective
  4986. options as well as possible minimum and maximum values along with the default
  4987. values.
  4988. @example
  4989. list_filters=true
  4990. @end example
  4991. @item filter
  4992. Specify all filters by their respective name and options.
  4993. Use @var{list_filters} to determine all valid filter names and options.
  4994. Numerical options are specified by a float value and are automatically clamped
  4995. to their respective value range. Vector and color options have to be specified
  4996. by a list of space separated float values. Character escaping has to be done.
  4997. A special option name @code{default} is available to use default options for a
  4998. filter.
  4999. It is required to specify either @code{default} or at least one of the filter options.
  5000. All omitted options are used with their default values.
  5001. The syntax of the filter string is as follows:
  5002. @example
  5003. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5004. @end example
  5005. @item output_rect
  5006. Specify a rectangle where the output of the filter chain is copied into the
  5007. input image. It is given by a list of space separated float values:
  5008. @example
  5009. output_rect=x\ y\ width\ height
  5010. @end example
  5011. If not given, the output rectangle equals the dimensions of the input image.
  5012. The output rectangle is automatically cropped at the borders of the input
  5013. image. Negative values are valid for each component.
  5014. @example
  5015. output_rect=25\ 25\ 100\ 100
  5016. @end example
  5017. @end table
  5018. Several filters can be chained for successive processing without GPU-HOST
  5019. transfers allowing for fast processing of complex filter chains.
  5020. Currently, only filters with zero (generators) or exactly one (filters) input
  5021. image and one output image are supported. Also, transition filters are not yet
  5022. usable as intended.
  5023. Some filters generate output images with additional padding depending on the
  5024. respective filter kernel. The padding is automatically removed to ensure the
  5025. filter output has the same size as the input image.
  5026. For image generators, the size of the output image is determined by the
  5027. previous output image of the filter chain or the input image of the whole
  5028. filterchain, respectively. The generators do not use the pixel information of
  5029. this image to generate their output. However, the generated output is
  5030. blended onto this image, resulting in partial or complete coverage of the
  5031. output image.
  5032. The @ref{coreimagesrc} video source can be used for generating input images
  5033. which are directly fed into the filter chain. By using it, providing input
  5034. images by another video source or an input video is not required.
  5035. @subsection Examples
  5036. @itemize
  5037. @item
  5038. List all filters available:
  5039. @example
  5040. coreimage=list_filters=true
  5041. @end example
  5042. @item
  5043. Use the CIBoxBlur filter with default options to blur an image:
  5044. @example
  5045. coreimage=filter=CIBoxBlur@@default
  5046. @end example
  5047. @item
  5048. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5049. its center at 100x100 and a radius of 50 pixels:
  5050. @example
  5051. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5052. @end example
  5053. @item
  5054. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5055. given as complete and escaped command-line for Apple's standard bash shell:
  5056. @example
  5057. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5058. @end example
  5059. @end itemize
  5060. @section crop
  5061. Crop the input video to given dimensions.
  5062. It accepts the following parameters:
  5063. @table @option
  5064. @item w, out_w
  5065. The width of the output video. It defaults to @code{iw}.
  5066. This expression is evaluated only once during the filter
  5067. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5068. @item h, out_h
  5069. The height of the output video. It defaults to @code{ih}.
  5070. This expression is evaluated only once during the filter
  5071. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5072. @item x
  5073. The horizontal position, in the input video, of the left edge of the output
  5074. video. It defaults to @code{(in_w-out_w)/2}.
  5075. This expression is evaluated per-frame.
  5076. @item y
  5077. The vertical position, in the input video, of the top edge of the output video.
  5078. It defaults to @code{(in_h-out_h)/2}.
  5079. This expression is evaluated per-frame.
  5080. @item keep_aspect
  5081. If set to 1 will force the output display aspect ratio
  5082. to be the same of the input, by changing the output sample aspect
  5083. ratio. It defaults to 0.
  5084. @item exact
  5085. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5086. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5087. It defaults to 0.
  5088. @end table
  5089. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5090. expressions containing the following constants:
  5091. @table @option
  5092. @item x
  5093. @item y
  5094. The computed values for @var{x} and @var{y}. They are evaluated for
  5095. each new frame.
  5096. @item in_w
  5097. @item in_h
  5098. The input width and height.
  5099. @item iw
  5100. @item ih
  5101. These are the same as @var{in_w} and @var{in_h}.
  5102. @item out_w
  5103. @item out_h
  5104. The output (cropped) width and height.
  5105. @item ow
  5106. @item oh
  5107. These are the same as @var{out_w} and @var{out_h}.
  5108. @item a
  5109. same as @var{iw} / @var{ih}
  5110. @item sar
  5111. input sample aspect ratio
  5112. @item dar
  5113. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5114. @item hsub
  5115. @item vsub
  5116. horizontal and vertical chroma subsample values. For example for the
  5117. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5118. @item n
  5119. The number of the input frame, starting from 0.
  5120. @item pos
  5121. the position in the file of the input frame, NAN if unknown
  5122. @item t
  5123. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5124. @end table
  5125. The expression for @var{out_w} may depend on the value of @var{out_h},
  5126. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5127. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5128. evaluated after @var{out_w} and @var{out_h}.
  5129. The @var{x} and @var{y} parameters specify the expressions for the
  5130. position of the top-left corner of the output (non-cropped) area. They
  5131. are evaluated for each frame. If the evaluated value is not valid, it
  5132. is approximated to the nearest valid value.
  5133. The expression for @var{x} may depend on @var{y}, and the expression
  5134. for @var{y} may depend on @var{x}.
  5135. @subsection Examples
  5136. @itemize
  5137. @item
  5138. Crop area with size 100x100 at position (12,34).
  5139. @example
  5140. crop=100:100:12:34
  5141. @end example
  5142. Using named options, the example above becomes:
  5143. @example
  5144. crop=w=100:h=100:x=12:y=34
  5145. @end example
  5146. @item
  5147. Crop the central input area with size 100x100:
  5148. @example
  5149. crop=100:100
  5150. @end example
  5151. @item
  5152. Crop the central input area with size 2/3 of the input video:
  5153. @example
  5154. crop=2/3*in_w:2/3*in_h
  5155. @end example
  5156. @item
  5157. Crop the input video central square:
  5158. @example
  5159. crop=out_w=in_h
  5160. crop=in_h
  5161. @end example
  5162. @item
  5163. Delimit the rectangle with the top-left corner placed at position
  5164. 100:100 and the right-bottom corner corresponding to the right-bottom
  5165. corner of the input image.
  5166. @example
  5167. crop=in_w-100:in_h-100:100:100
  5168. @end example
  5169. @item
  5170. Crop 10 pixels from the left and right borders, and 20 pixels from
  5171. the top and bottom borders
  5172. @example
  5173. crop=in_w-2*10:in_h-2*20
  5174. @end example
  5175. @item
  5176. Keep only the bottom right quarter of the input image:
  5177. @example
  5178. crop=in_w/2:in_h/2:in_w/2:in_h/2
  5179. @end example
  5180. @item
  5181. Crop height for getting Greek harmony:
  5182. @example
  5183. crop=in_w:1/PHI*in_w
  5184. @end example
  5185. @item
  5186. Apply trembling effect:
  5187. @example
  5188. 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)
  5189. @end example
  5190. @item
  5191. Apply erratic camera effect depending on timestamp:
  5192. @example
  5193. 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)"
  5194. @end example
  5195. @item
  5196. Set x depending on the value of y:
  5197. @example
  5198. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  5199. @end example
  5200. @end itemize
  5201. @subsection Commands
  5202. This filter supports the following commands:
  5203. @table @option
  5204. @item w, out_w
  5205. @item h, out_h
  5206. @item x
  5207. @item y
  5208. Set width/height of the output video and the horizontal/vertical position
  5209. in the input video.
  5210. The command accepts the same syntax of the corresponding option.
  5211. If the specified expression is not valid, it is kept at its current
  5212. value.
  5213. @end table
  5214. @section cropdetect
  5215. Auto-detect the crop size.
  5216. It calculates the necessary cropping parameters and prints the
  5217. recommended parameters via the logging system. The detected dimensions
  5218. correspond to the non-black area of the input video.
  5219. It accepts the following parameters:
  5220. @table @option
  5221. @item limit
  5222. Set higher black value threshold, which can be optionally specified
  5223. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  5224. value greater to the set value is considered non-black. It defaults to 24.
  5225. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  5226. on the bitdepth of the pixel format.
  5227. @item round
  5228. The value which the width/height should be divisible by. It defaults to
  5229. 16. The offset is automatically adjusted to center the video. Use 2 to
  5230. get only even dimensions (needed for 4:2:2 video). 16 is best when
  5231. encoding to most video codecs.
  5232. @item reset_count, reset
  5233. Set the counter that determines after how many frames cropdetect will
  5234. reset the previously detected largest video area and start over to
  5235. detect the current optimal crop area. Default value is 0.
  5236. This can be useful when channel logos distort the video area. 0
  5237. indicates 'never reset', and returns the largest area encountered during
  5238. playback.
  5239. @end table
  5240. @anchor{curves}
  5241. @section curves
  5242. Apply color adjustments using curves.
  5243. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  5244. component (red, green and blue) has its values defined by @var{N} key points
  5245. tied from each other using a smooth curve. The x-axis represents the pixel
  5246. values from the input frame, and the y-axis the new pixel values to be set for
  5247. the output frame.
  5248. By default, a component curve is defined by the two points @var{(0;0)} and
  5249. @var{(1;1)}. This creates a straight line where each original pixel value is
  5250. "adjusted" to its own value, which means no change to the image.
  5251. The filter allows you to redefine these two points and add some more. A new
  5252. curve (using a natural cubic spline interpolation) will be define to pass
  5253. smoothly through all these new coordinates. The new defined points needs to be
  5254. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  5255. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  5256. the vector spaces, the values will be clipped accordingly.
  5257. The filter accepts the following options:
  5258. @table @option
  5259. @item preset
  5260. Select one of the available color presets. This option can be used in addition
  5261. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  5262. options takes priority on the preset values.
  5263. Available presets are:
  5264. @table @samp
  5265. @item none
  5266. @item color_negative
  5267. @item cross_process
  5268. @item darker
  5269. @item increase_contrast
  5270. @item lighter
  5271. @item linear_contrast
  5272. @item medium_contrast
  5273. @item negative
  5274. @item strong_contrast
  5275. @item vintage
  5276. @end table
  5277. Default is @code{none}.
  5278. @item master, m
  5279. Set the master key points. These points will define a second pass mapping. It
  5280. is sometimes called a "luminance" or "value" mapping. It can be used with
  5281. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  5282. post-processing LUT.
  5283. @item red, r
  5284. Set the key points for the red component.
  5285. @item green, g
  5286. Set the key points for the green component.
  5287. @item blue, b
  5288. Set the key points for the blue component.
  5289. @item all
  5290. Set the key points for all components (not including master).
  5291. Can be used in addition to the other key points component
  5292. options. In this case, the unset component(s) will fallback on this
  5293. @option{all} setting.
  5294. @item psfile
  5295. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  5296. @item plot
  5297. Save Gnuplot script of the curves in specified file.
  5298. @end table
  5299. To avoid some filtergraph syntax conflicts, each key points list need to be
  5300. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  5301. @subsection Examples
  5302. @itemize
  5303. @item
  5304. Increase slightly the middle level of blue:
  5305. @example
  5306. curves=blue='0/0 0.5/0.58 1/1'
  5307. @end example
  5308. @item
  5309. Vintage effect:
  5310. @example
  5311. 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'
  5312. @end example
  5313. Here we obtain the following coordinates for each components:
  5314. @table @var
  5315. @item red
  5316. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  5317. @item green
  5318. @code{(0;0) (0.50;0.48) (1;1)}
  5319. @item blue
  5320. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  5321. @end table
  5322. @item
  5323. The previous example can also be achieved with the associated built-in preset:
  5324. @example
  5325. curves=preset=vintage
  5326. @end example
  5327. @item
  5328. Or simply:
  5329. @example
  5330. curves=vintage
  5331. @end example
  5332. @item
  5333. Use a Photoshop preset and redefine the points of the green component:
  5334. @example
  5335. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  5336. @end example
  5337. @item
  5338. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  5339. and @command{gnuplot}:
  5340. @example
  5341. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  5342. gnuplot -p /tmp/curves.plt
  5343. @end example
  5344. @end itemize
  5345. @section datascope
  5346. Video data analysis filter.
  5347. This filter shows hexadecimal pixel values of part of video.
  5348. The filter accepts the following options:
  5349. @table @option
  5350. @item size, s
  5351. Set output video size.
  5352. @item x
  5353. Set x offset from where to pick pixels.
  5354. @item y
  5355. Set y offset from where to pick pixels.
  5356. @item mode
  5357. Set scope mode, can be one of the following:
  5358. @table @samp
  5359. @item mono
  5360. Draw hexadecimal pixel values with white color on black background.
  5361. @item color
  5362. Draw hexadecimal pixel values with input video pixel color on black
  5363. background.
  5364. @item color2
  5365. Draw hexadecimal pixel values on color background picked from input video,
  5366. the text color is picked in such way so its always visible.
  5367. @end table
  5368. @item axis
  5369. Draw rows and columns numbers on left and top of video.
  5370. @item opacity
  5371. Set background opacity.
  5372. @end table
  5373. @section dctdnoiz
  5374. Denoise frames using 2D DCT (frequency domain filtering).
  5375. This filter is not designed for real time.
  5376. The filter accepts the following options:
  5377. @table @option
  5378. @item sigma, s
  5379. Set the noise sigma constant.
  5380. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  5381. coefficient (absolute value) below this threshold with be dropped.
  5382. If you need a more advanced filtering, see @option{expr}.
  5383. Default is @code{0}.
  5384. @item overlap
  5385. Set number overlapping pixels for each block. Since the filter can be slow, you
  5386. may want to reduce this value, at the cost of a less effective filter and the
  5387. risk of various artefacts.
  5388. If the overlapping value doesn't permit processing the whole input width or
  5389. height, a warning will be displayed and according borders won't be denoised.
  5390. Default value is @var{blocksize}-1, which is the best possible setting.
  5391. @item expr, e
  5392. Set the coefficient factor expression.
  5393. For each coefficient of a DCT block, this expression will be evaluated as a
  5394. multiplier value for the coefficient.
  5395. If this is option is set, the @option{sigma} option will be ignored.
  5396. The absolute value of the coefficient can be accessed through the @var{c}
  5397. variable.
  5398. @item n
  5399. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  5400. @var{blocksize}, which is the width and height of the processed blocks.
  5401. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  5402. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5403. on the speed processing. Also, a larger block size does not necessarily means a
  5404. better de-noising.
  5405. @end table
  5406. @subsection Examples
  5407. Apply a denoise with a @option{sigma} of @code{4.5}:
  5408. @example
  5409. dctdnoiz=4.5
  5410. @end example
  5411. The same operation can be achieved using the expression system:
  5412. @example
  5413. dctdnoiz=e='gte(c, 4.5*3)'
  5414. @end example
  5415. Violent denoise using a block size of @code{16x16}:
  5416. @example
  5417. dctdnoiz=15:n=4
  5418. @end example
  5419. @section deband
  5420. Remove banding artifacts from input video.
  5421. It works by replacing banded pixels with average value of referenced pixels.
  5422. The filter accepts the following options:
  5423. @table @option
  5424. @item 1thr
  5425. @item 2thr
  5426. @item 3thr
  5427. @item 4thr
  5428. Set banding detection threshold for each plane. Default is 0.02.
  5429. Valid range is 0.00003 to 0.5.
  5430. If difference between current pixel and reference pixel is less than threshold,
  5431. it will be considered as banded.
  5432. @item range, r
  5433. Banding detection range in pixels. Default is 16. If positive, random number
  5434. in range 0 to set value will be used. If negative, exact absolute value
  5435. will be used.
  5436. The range defines square of four pixels around current pixel.
  5437. @item direction, d
  5438. Set direction in radians from which four pixel will be compared. If positive,
  5439. random direction from 0 to set direction will be picked. If negative, exact of
  5440. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5441. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5442. column.
  5443. @item blur, b
  5444. If enabled, current pixel is compared with average value of all four
  5445. surrounding pixels. The default is enabled. If disabled current pixel is
  5446. compared with all four surrounding pixels. The pixel is considered banded
  5447. if only all four differences with surrounding pixels are less than threshold.
  5448. @item coupling, c
  5449. If enabled, current pixel is changed if and only if all pixel components are banded,
  5450. e.g. banding detection threshold is triggered for all color components.
  5451. The default is disabled.
  5452. @end table
  5453. @anchor{decimate}
  5454. @section decimate
  5455. Drop duplicated frames at regular intervals.
  5456. The filter accepts the following options:
  5457. @table @option
  5458. @item cycle
  5459. Set the number of frames from which one will be dropped. Setting this to
  5460. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  5461. Default is @code{5}.
  5462. @item dupthresh
  5463. Set the threshold for duplicate detection. If the difference metric for a frame
  5464. is less than or equal to this value, then it is declared as duplicate. Default
  5465. is @code{1.1}
  5466. @item scthresh
  5467. Set scene change threshold. Default is @code{15}.
  5468. @item blockx
  5469. @item blocky
  5470. Set the size of the x and y-axis blocks used during metric calculations.
  5471. Larger blocks give better noise suppression, but also give worse detection of
  5472. small movements. Must be a power of two. Default is @code{32}.
  5473. @item ppsrc
  5474. Mark main input as a pre-processed input and activate clean source input
  5475. stream. This allows the input to be pre-processed with various filters to help
  5476. the metrics calculation while keeping the frame selection lossless. When set to
  5477. @code{1}, the first stream is for the pre-processed input, and the second
  5478. stream is the clean source from where the kept frames are chosen. Default is
  5479. @code{0}.
  5480. @item chroma
  5481. Set whether or not chroma is considered in the metric calculations. Default is
  5482. @code{1}.
  5483. @end table
  5484. @section deconvolve
  5485. Apply 2D deconvolution of video stream in frequency domain using second stream
  5486. as impulse.
  5487. The filter accepts the following options:
  5488. @table @option
  5489. @item planes
  5490. Set which planes to process.
  5491. @item impulse
  5492. Set which impulse video frames will be processed, can be @var{first}
  5493. or @var{all}. Default is @var{all}.
  5494. @item noise
  5495. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  5496. and height are not same and not power of 2 or if stream prior to convolving
  5497. had noise.
  5498. @end table
  5499. The @code{deconvolve} filter also supports the @ref{framesync} options.
  5500. @section deflate
  5501. Apply deflate effect to the video.
  5502. This filter replaces the pixel by the local(3x3) average by taking into account
  5503. only values lower than the pixel.
  5504. It accepts the following options:
  5505. @table @option
  5506. @item threshold0
  5507. @item threshold1
  5508. @item threshold2
  5509. @item threshold3
  5510. Limit the maximum change for each plane, default is 65535.
  5511. If 0, plane will remain unchanged.
  5512. @end table
  5513. @section deflicker
  5514. Remove temporal frame luminance variations.
  5515. It accepts the following options:
  5516. @table @option
  5517. @item size, s
  5518. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  5519. @item mode, m
  5520. Set averaging mode to smooth temporal luminance variations.
  5521. Available values are:
  5522. @table @samp
  5523. @item am
  5524. Arithmetic mean
  5525. @item gm
  5526. Geometric mean
  5527. @item hm
  5528. Harmonic mean
  5529. @item qm
  5530. Quadratic mean
  5531. @item cm
  5532. Cubic mean
  5533. @item pm
  5534. Power mean
  5535. @item median
  5536. Median
  5537. @end table
  5538. @item bypass
  5539. Do not actually modify frame. Useful when one only wants metadata.
  5540. @end table
  5541. @section dejudder
  5542. Remove judder produced by partially interlaced telecined content.
  5543. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  5544. source was partially telecined content then the output of @code{pullup,dejudder}
  5545. will have a variable frame rate. May change the recorded frame rate of the
  5546. container. Aside from that change, this filter will not affect constant frame
  5547. rate video.
  5548. The option available in this filter is:
  5549. @table @option
  5550. @item cycle
  5551. Specify the length of the window over which the judder repeats.
  5552. Accepts any integer greater than 1. Useful values are:
  5553. @table @samp
  5554. @item 4
  5555. If the original was telecined from 24 to 30 fps (Film to NTSC).
  5556. @item 5
  5557. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  5558. @item 20
  5559. If a mixture of the two.
  5560. @end table
  5561. The default is @samp{4}.
  5562. @end table
  5563. @section delogo
  5564. Suppress a TV station logo by a simple interpolation of the surrounding
  5565. pixels. Just set a rectangle covering the logo and watch it disappear
  5566. (and sometimes something even uglier appear - your mileage may vary).
  5567. It accepts the following parameters:
  5568. @table @option
  5569. @item x
  5570. @item y
  5571. Specify the top left corner coordinates of the logo. They must be
  5572. specified.
  5573. @item w
  5574. @item h
  5575. Specify the width and height of the logo to clear. They must be
  5576. specified.
  5577. @item band, t
  5578. Specify the thickness of the fuzzy edge of the rectangle (added to
  5579. @var{w} and @var{h}). The default value is 1. This option is
  5580. deprecated, setting higher values should no longer be necessary and
  5581. is not recommended.
  5582. @item show
  5583. When set to 1, a green rectangle is drawn on the screen to simplify
  5584. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  5585. The default value is 0.
  5586. The rectangle is drawn on the outermost pixels which will be (partly)
  5587. replaced with interpolated values. The values of the next pixels
  5588. immediately outside this rectangle in each direction will be used to
  5589. compute the interpolated pixel values inside the rectangle.
  5590. @end table
  5591. @subsection Examples
  5592. @itemize
  5593. @item
  5594. Set a rectangle covering the area with top left corner coordinates 0,0
  5595. and size 100x77, and a band of size 10:
  5596. @example
  5597. delogo=x=0:y=0:w=100:h=77:band=10
  5598. @end example
  5599. @end itemize
  5600. @section deshake
  5601. Attempt to fix small changes in horizontal and/or vertical shift. This
  5602. filter helps remove camera shake from hand-holding a camera, bumping a
  5603. tripod, moving on a vehicle, etc.
  5604. The filter accepts the following options:
  5605. @table @option
  5606. @item x
  5607. @item y
  5608. @item w
  5609. @item h
  5610. Specify a rectangular area where to limit the search for motion
  5611. vectors.
  5612. If desired the search for motion vectors can be limited to a
  5613. rectangular area of the frame defined by its top left corner, width
  5614. and height. These parameters have the same meaning as the drawbox
  5615. filter which can be used to visualise the position of the bounding
  5616. box.
  5617. This is useful when simultaneous movement of subjects within the frame
  5618. might be confused for camera motion by the motion vector search.
  5619. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  5620. then the full frame is used. This allows later options to be set
  5621. without specifying the bounding box for the motion vector search.
  5622. Default - search the whole frame.
  5623. @item rx
  5624. @item ry
  5625. Specify the maximum extent of movement in x and y directions in the
  5626. range 0-64 pixels. Default 16.
  5627. @item edge
  5628. Specify how to generate pixels to fill blanks at the edge of the
  5629. frame. Available values are:
  5630. @table @samp
  5631. @item blank, 0
  5632. Fill zeroes at blank locations
  5633. @item original, 1
  5634. Original image at blank locations
  5635. @item clamp, 2
  5636. Extruded edge value at blank locations
  5637. @item mirror, 3
  5638. Mirrored edge at blank locations
  5639. @end table
  5640. Default value is @samp{mirror}.
  5641. @item blocksize
  5642. Specify the blocksize to use for motion search. Range 4-128 pixels,
  5643. default 8.
  5644. @item contrast
  5645. Specify the contrast threshold for blocks. Only blocks with more than
  5646. the specified contrast (difference between darkest and lightest
  5647. pixels) will be considered. Range 1-255, default 125.
  5648. @item search
  5649. Specify the search strategy. Available values are:
  5650. @table @samp
  5651. @item exhaustive, 0
  5652. Set exhaustive search
  5653. @item less, 1
  5654. Set less exhaustive search.
  5655. @end table
  5656. Default value is @samp{exhaustive}.
  5657. @item filename
  5658. If set then a detailed log of the motion search is written to the
  5659. specified file.
  5660. @end table
  5661. @section despill
  5662. Remove unwanted contamination of foreground colors, caused by reflected color of
  5663. greenscreen or bluescreen.
  5664. This filter accepts the following options:
  5665. @table @option
  5666. @item type
  5667. Set what type of despill to use.
  5668. @item mix
  5669. Set how spillmap will be generated.
  5670. @item expand
  5671. Set how much to get rid of still remaining spill.
  5672. @item red
  5673. Controls amount of red in spill area.
  5674. @item green
  5675. Controls amount of green in spill area.
  5676. Should be -1 for greenscreen.
  5677. @item blue
  5678. Controls amount of blue in spill area.
  5679. Should be -1 for bluescreen.
  5680. @item brightness
  5681. Controls brightness of spill area, preserving colors.
  5682. @item alpha
  5683. Modify alpha from generated spillmap.
  5684. @end table
  5685. @section detelecine
  5686. Apply an exact inverse of the telecine operation. It requires a predefined
  5687. pattern specified using the pattern option which must be the same as that passed
  5688. to the telecine filter.
  5689. This filter accepts the following options:
  5690. @table @option
  5691. @item first_field
  5692. @table @samp
  5693. @item top, t
  5694. top field first
  5695. @item bottom, b
  5696. bottom field first
  5697. The default value is @code{top}.
  5698. @end table
  5699. @item pattern
  5700. A string of numbers representing the pulldown pattern you wish to apply.
  5701. The default value is @code{23}.
  5702. @item start_frame
  5703. A number representing position of the first frame with respect to the telecine
  5704. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  5705. @end table
  5706. @section dilation
  5707. Apply dilation effect to the video.
  5708. This filter replaces the pixel by the local(3x3) maximum.
  5709. It accepts the following options:
  5710. @table @option
  5711. @item threshold0
  5712. @item threshold1
  5713. @item threshold2
  5714. @item threshold3
  5715. Limit the maximum change for each plane, default is 65535.
  5716. If 0, plane will remain unchanged.
  5717. @item coordinates
  5718. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5719. pixels are used.
  5720. Flags to local 3x3 coordinates maps like this:
  5721. 1 2 3
  5722. 4 5
  5723. 6 7 8
  5724. @end table
  5725. @section displace
  5726. Displace pixels as indicated by second and third input stream.
  5727. It takes three input streams and outputs one stream, the first input is the
  5728. source, and second and third input are displacement maps.
  5729. The second input specifies how much to displace pixels along the
  5730. x-axis, while the third input specifies how much to displace pixels
  5731. along the y-axis.
  5732. If one of displacement map streams terminates, last frame from that
  5733. displacement map will be used.
  5734. Note that once generated, displacements maps can be reused over and over again.
  5735. A description of the accepted options follows.
  5736. @table @option
  5737. @item edge
  5738. Set displace behavior for pixels that are out of range.
  5739. Available values are:
  5740. @table @samp
  5741. @item blank
  5742. Missing pixels are replaced by black pixels.
  5743. @item smear
  5744. Adjacent pixels will spread out to replace missing pixels.
  5745. @item wrap
  5746. Out of range pixels are wrapped so they point to pixels of other side.
  5747. @item mirror
  5748. Out of range pixels will be replaced with mirrored pixels.
  5749. @end table
  5750. Default is @samp{smear}.
  5751. @end table
  5752. @subsection Examples
  5753. @itemize
  5754. @item
  5755. Add ripple effect to rgb input of video size hd720:
  5756. @example
  5757. 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
  5758. @end example
  5759. @item
  5760. Add wave effect to rgb input of video size hd720:
  5761. @example
  5762. 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
  5763. @end example
  5764. @end itemize
  5765. @section drawbox
  5766. Draw a colored box on the input image.
  5767. It accepts the following parameters:
  5768. @table @option
  5769. @item x
  5770. @item y
  5771. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5772. @item width, w
  5773. @item height, h
  5774. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5775. the input width and height. It defaults to 0.
  5776. @item color, c
  5777. Specify the color of the box to write. For the general syntax of this option,
  5778. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  5779. value @code{invert} is used, the box edge color is the same as the
  5780. video with inverted luma.
  5781. @item thickness, t
  5782. The expression which sets the thickness of the box edge.
  5783. A value of @code{fill} will create a filled box. Default value is @code{3}.
  5784. See below for the list of accepted constants.
  5785. @item replace
  5786. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  5787. will overwrite the video's color and alpha pixels.
  5788. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  5789. @end table
  5790. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5791. following constants:
  5792. @table @option
  5793. @item dar
  5794. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5795. @item hsub
  5796. @item vsub
  5797. horizontal and vertical chroma subsample values. For example for the
  5798. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5799. @item in_h, ih
  5800. @item in_w, iw
  5801. The input width and height.
  5802. @item sar
  5803. The input sample aspect ratio.
  5804. @item x
  5805. @item y
  5806. The x and y offset coordinates where the box is drawn.
  5807. @item w
  5808. @item h
  5809. The width and height of the drawn box.
  5810. @item t
  5811. The thickness of the drawn box.
  5812. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5813. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5814. @end table
  5815. @subsection Examples
  5816. @itemize
  5817. @item
  5818. Draw a black box around the edge of the input image:
  5819. @example
  5820. drawbox
  5821. @end example
  5822. @item
  5823. Draw a box with color red and an opacity of 50%:
  5824. @example
  5825. drawbox=10:20:200:60:red@@0.5
  5826. @end example
  5827. The previous example can be specified as:
  5828. @example
  5829. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5830. @end example
  5831. @item
  5832. Fill the box with pink color:
  5833. @example
  5834. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  5835. @end example
  5836. @item
  5837. Draw a 2-pixel red 2.40:1 mask:
  5838. @example
  5839. 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
  5840. @end example
  5841. @end itemize
  5842. @section drawgrid
  5843. Draw a grid on the input image.
  5844. It accepts the following parameters:
  5845. @table @option
  5846. @item x
  5847. @item y
  5848. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5849. @item width, w
  5850. @item height, h
  5851. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5852. input width and height, respectively, minus @code{thickness}, so image gets
  5853. framed. Default to 0.
  5854. @item color, c
  5855. Specify the color of the grid. For the general syntax of this option,
  5856. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  5857. value @code{invert} is used, the grid color is the same as the
  5858. video with inverted luma.
  5859. @item thickness, t
  5860. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5861. See below for the list of accepted constants.
  5862. @item replace
  5863. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  5864. will overwrite the video's color and alpha pixels.
  5865. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  5866. @end table
  5867. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5868. following constants:
  5869. @table @option
  5870. @item dar
  5871. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5872. @item hsub
  5873. @item vsub
  5874. horizontal and vertical chroma subsample values. For example for the
  5875. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5876. @item in_h, ih
  5877. @item in_w, iw
  5878. The input grid cell width and height.
  5879. @item sar
  5880. The input sample aspect ratio.
  5881. @item x
  5882. @item y
  5883. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5884. @item w
  5885. @item h
  5886. The width and height of the drawn cell.
  5887. @item t
  5888. The thickness of the drawn cell.
  5889. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5890. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5891. @end table
  5892. @subsection Examples
  5893. @itemize
  5894. @item
  5895. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5896. @example
  5897. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5898. @end example
  5899. @item
  5900. Draw a white 3x3 grid with an opacity of 50%:
  5901. @example
  5902. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5903. @end example
  5904. @end itemize
  5905. @anchor{drawtext}
  5906. @section drawtext
  5907. Draw a text string or text from a specified file on top of a video, using the
  5908. libfreetype library.
  5909. To enable compilation of this filter, you need to configure FFmpeg with
  5910. @code{--enable-libfreetype}.
  5911. To enable default font fallback and the @var{font} option you need to
  5912. configure FFmpeg with @code{--enable-libfontconfig}.
  5913. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5914. @code{--enable-libfribidi}.
  5915. @subsection Syntax
  5916. It accepts the following parameters:
  5917. @table @option
  5918. @item box
  5919. Used to draw a box around text using the background color.
  5920. The value must be either 1 (enable) or 0 (disable).
  5921. The default value of @var{box} is 0.
  5922. @item boxborderw
  5923. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5924. The default value of @var{boxborderw} is 0.
  5925. @item boxcolor
  5926. The color to be used for drawing box around text. For the syntax of this
  5927. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  5928. The default value of @var{boxcolor} is "white".
  5929. @item line_spacing
  5930. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  5931. The default value of @var{line_spacing} is 0.
  5932. @item borderw
  5933. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5934. The default value of @var{borderw} is 0.
  5935. @item bordercolor
  5936. Set the color to be used for drawing border around text. For the syntax of this
  5937. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  5938. The default value of @var{bordercolor} is "black".
  5939. @item expansion
  5940. Select how the @var{text} is expanded. Can be either @code{none},
  5941. @code{strftime} (deprecated) or
  5942. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5943. below for details.
  5944. @item basetime
  5945. Set a start time for the count. Value is in microseconds. Only applied
  5946. in the deprecated strftime expansion mode. To emulate in normal expansion
  5947. mode use the @code{pts} function, supplying the start time (in seconds)
  5948. as the second argument.
  5949. @item fix_bounds
  5950. If true, check and fix text coords to avoid clipping.
  5951. @item fontcolor
  5952. The color to be used for drawing fonts. For the syntax of this option, check
  5953. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  5954. The default value of @var{fontcolor} is "black".
  5955. @item fontcolor_expr
  5956. String which is expanded the same way as @var{text} to obtain dynamic
  5957. @var{fontcolor} value. By default this option has empty value and is not
  5958. processed. When this option is set, it overrides @var{fontcolor} option.
  5959. @item font
  5960. The font family to be used for drawing text. By default Sans.
  5961. @item fontfile
  5962. The font file to be used for drawing text. The path must be included.
  5963. This parameter is mandatory if the fontconfig support is disabled.
  5964. @item alpha
  5965. Draw the text applying alpha blending. The value can
  5966. be a number between 0.0 and 1.0.
  5967. The expression accepts the same variables @var{x, y} as well.
  5968. The default value is 1.
  5969. Please see @var{fontcolor_expr}.
  5970. @item fontsize
  5971. The font size to be used for drawing text.
  5972. The default value of @var{fontsize} is 16.
  5973. @item text_shaping
  5974. If set to 1, attempt to shape the text (for example, reverse the order of
  5975. right-to-left text and join Arabic characters) before drawing it.
  5976. Otherwise, just draw the text exactly as given.
  5977. By default 1 (if supported).
  5978. @item ft_load_flags
  5979. The flags to be used for loading the fonts.
  5980. The flags map the corresponding flags supported by libfreetype, and are
  5981. a combination of the following values:
  5982. @table @var
  5983. @item default
  5984. @item no_scale
  5985. @item no_hinting
  5986. @item render
  5987. @item no_bitmap
  5988. @item vertical_layout
  5989. @item force_autohint
  5990. @item crop_bitmap
  5991. @item pedantic
  5992. @item ignore_global_advance_width
  5993. @item no_recurse
  5994. @item ignore_transform
  5995. @item monochrome
  5996. @item linear_design
  5997. @item no_autohint
  5998. @end table
  5999. Default value is "default".
  6000. For more information consult the documentation for the FT_LOAD_*
  6001. libfreetype flags.
  6002. @item shadowcolor
  6003. The color to be used for drawing a shadow behind the drawn text. For the
  6004. syntax of this option, check the @ref{color syntax,,"Color" section in the
  6005. ffmpeg-utils manual,ffmpeg-utils}.
  6006. The default value of @var{shadowcolor} is "black".
  6007. @item shadowx
  6008. @item shadowy
  6009. The x and y offsets for the text shadow position with respect to the
  6010. position of the text. They can be either positive or negative
  6011. values. The default value for both is "0".
  6012. @item start_number
  6013. The starting frame number for the n/frame_num variable. The default value
  6014. is "0".
  6015. @item tabsize
  6016. The size in number of spaces to use for rendering the tab.
  6017. Default value is 4.
  6018. @item timecode
  6019. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  6020. format. It can be used with or without text parameter. @var{timecode_rate}
  6021. option must be specified.
  6022. @item timecode_rate, rate, r
  6023. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  6024. integer. Minimum value is "1".
  6025. Drop-frame timecode is supported for frame rates 30 & 60.
  6026. @item tc24hmax
  6027. If set to 1, the output of the timecode option will wrap around at 24 hours.
  6028. Default is 0 (disabled).
  6029. @item text
  6030. The text string to be drawn. The text must be a sequence of UTF-8
  6031. encoded characters.
  6032. This parameter is mandatory if no file is specified with the parameter
  6033. @var{textfile}.
  6034. @item textfile
  6035. A text file containing text to be drawn. The text must be a sequence
  6036. of UTF-8 encoded characters.
  6037. This parameter is mandatory if no text string is specified with the
  6038. parameter @var{text}.
  6039. If both @var{text} and @var{textfile} are specified, an error is thrown.
  6040. @item reload
  6041. If set to 1, the @var{textfile} will be reloaded before each frame.
  6042. Be sure to update it atomically, or it may be read partially, or even fail.
  6043. @item x
  6044. @item y
  6045. The expressions which specify the offsets where text will be drawn
  6046. within the video frame. They are relative to the top/left border of the
  6047. output image.
  6048. The default value of @var{x} and @var{y} is "0".
  6049. See below for the list of accepted constants and functions.
  6050. @end table
  6051. The parameters for @var{x} and @var{y} are expressions containing the
  6052. following constants and functions:
  6053. @table @option
  6054. @item dar
  6055. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  6056. @item hsub
  6057. @item vsub
  6058. horizontal and vertical chroma subsample values. For example for the
  6059. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6060. @item line_h, lh
  6061. the height of each text line
  6062. @item main_h, h, H
  6063. the input height
  6064. @item main_w, w, W
  6065. the input width
  6066. @item max_glyph_a, ascent
  6067. the maximum distance from the baseline to the highest/upper grid
  6068. coordinate used to place a glyph outline point, for all the rendered
  6069. glyphs.
  6070. It is a positive value, due to the grid's orientation with the Y axis
  6071. upwards.
  6072. @item max_glyph_d, descent
  6073. the maximum distance from the baseline to the lowest grid coordinate
  6074. used to place a glyph outline point, for all the rendered glyphs.
  6075. This is a negative value, due to the grid's orientation, with the Y axis
  6076. upwards.
  6077. @item max_glyph_h
  6078. maximum glyph height, that is the maximum height for all the glyphs
  6079. contained in the rendered text, it is equivalent to @var{ascent} -
  6080. @var{descent}.
  6081. @item max_glyph_w
  6082. maximum glyph width, that is the maximum width for all the glyphs
  6083. contained in the rendered text
  6084. @item n
  6085. the number of input frame, starting from 0
  6086. @item rand(min, max)
  6087. return a random number included between @var{min} and @var{max}
  6088. @item sar
  6089. The input sample aspect ratio.
  6090. @item t
  6091. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6092. @item text_h, th
  6093. the height of the rendered text
  6094. @item text_w, tw
  6095. the width of the rendered text
  6096. @item x
  6097. @item y
  6098. the x and y offset coordinates where the text is drawn.
  6099. These parameters allow the @var{x} and @var{y} expressions to refer
  6100. each other, so you can for example specify @code{y=x/dar}.
  6101. @end table
  6102. @anchor{drawtext_expansion}
  6103. @subsection Text expansion
  6104. If @option{expansion} is set to @code{strftime},
  6105. the filter recognizes strftime() sequences in the provided text and
  6106. expands them accordingly. Check the documentation of strftime(). This
  6107. feature is deprecated.
  6108. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  6109. If @option{expansion} is set to @code{normal} (which is the default),
  6110. the following expansion mechanism is used.
  6111. The backslash character @samp{\}, followed by any character, always expands to
  6112. the second character.
  6113. Sequences of the form @code{%@{...@}} are expanded. The text between the
  6114. braces is a function name, possibly followed by arguments separated by ':'.
  6115. If the arguments contain special characters or delimiters (':' or '@}'),
  6116. they should be escaped.
  6117. Note that they probably must also be escaped as the value for the
  6118. @option{text} option in the filter argument string and as the filter
  6119. argument in the filtergraph description, and possibly also for the shell,
  6120. that makes up to four levels of escaping; using a text file avoids these
  6121. problems.
  6122. The following functions are available:
  6123. @table @command
  6124. @item expr, e
  6125. The expression evaluation result.
  6126. It must take one argument specifying the expression to be evaluated,
  6127. which accepts the same constants and functions as the @var{x} and
  6128. @var{y} values. Note that not all constants should be used, for
  6129. example the text size is not known when evaluating the expression, so
  6130. the constants @var{text_w} and @var{text_h} will have an undefined
  6131. value.
  6132. @item expr_int_format, eif
  6133. Evaluate the expression's value and output as formatted integer.
  6134. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  6135. The second argument specifies the output format. Allowed values are @samp{x},
  6136. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  6137. @code{printf} function.
  6138. The third parameter is optional and sets the number of positions taken by the output.
  6139. It can be used to add padding with zeros from the left.
  6140. @item gmtime
  6141. The time at which the filter is running, expressed in UTC.
  6142. It can accept an argument: a strftime() format string.
  6143. @item localtime
  6144. The time at which the filter is running, expressed in the local time zone.
  6145. It can accept an argument: a strftime() format string.
  6146. @item metadata
  6147. Frame metadata. Takes one or two arguments.
  6148. The first argument is mandatory and specifies the metadata key.
  6149. The second argument is optional and specifies a default value, used when the
  6150. metadata key is not found or empty.
  6151. @item n, frame_num
  6152. The frame number, starting from 0.
  6153. @item pict_type
  6154. A 1 character description of the current picture type.
  6155. @item pts
  6156. The timestamp of the current frame.
  6157. It can take up to three arguments.
  6158. The first argument is the format of the timestamp; it defaults to @code{flt}
  6159. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  6160. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  6161. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  6162. @code{localtime} stands for the timestamp of the frame formatted as
  6163. local time zone time.
  6164. The second argument is an offset added to the timestamp.
  6165. If the format is set to @code{localtime} or @code{gmtime},
  6166. a third argument may be supplied: a strftime() format string.
  6167. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  6168. @end table
  6169. @subsection Examples
  6170. @itemize
  6171. @item
  6172. Draw "Test Text" with font FreeSerif, using the default values for the
  6173. optional parameters.
  6174. @example
  6175. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  6176. @end example
  6177. @item
  6178. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  6179. and y=50 (counting from the top-left corner of the screen), text is
  6180. yellow with a red box around it. Both the text and the box have an
  6181. opacity of 20%.
  6182. @example
  6183. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  6184. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  6185. @end example
  6186. Note that the double quotes are not necessary if spaces are not used
  6187. within the parameter list.
  6188. @item
  6189. Show the text at the center of the video frame:
  6190. @example
  6191. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  6192. @end example
  6193. @item
  6194. Show the text at a random position, switching to a new position every 30 seconds:
  6195. @example
  6196. 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)"
  6197. @end example
  6198. @item
  6199. Show a text line sliding from right to left in the last row of the video
  6200. frame. The file @file{LONG_LINE} is assumed to contain a single line
  6201. with no newlines.
  6202. @example
  6203. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  6204. @end example
  6205. @item
  6206. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  6207. @example
  6208. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  6209. @end example
  6210. @item
  6211. Draw a single green letter "g", at the center of the input video.
  6212. The glyph baseline is placed at half screen height.
  6213. @example
  6214. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  6215. @end example
  6216. @item
  6217. Show text for 1 second every 3 seconds:
  6218. @example
  6219. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  6220. @end example
  6221. @item
  6222. Use fontconfig to set the font. Note that the colons need to be escaped.
  6223. @example
  6224. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  6225. @end example
  6226. @item
  6227. Print the date of a real-time encoding (see strftime(3)):
  6228. @example
  6229. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  6230. @end example
  6231. @item
  6232. Show text fading in and out (appearing/disappearing):
  6233. @example
  6234. #!/bin/sh
  6235. DS=1.0 # display start
  6236. DE=10.0 # display end
  6237. FID=1.5 # fade in duration
  6238. FOD=5 # fade out duration
  6239. 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 @}"
  6240. @end example
  6241. @item
  6242. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  6243. and the @option{fontsize} value are included in the @option{y} offset.
  6244. @example
  6245. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  6246. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  6247. @end example
  6248. @end itemize
  6249. For more information about libfreetype, check:
  6250. @url{http://www.freetype.org/}.
  6251. For more information about fontconfig, check:
  6252. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  6253. For more information about libfribidi, check:
  6254. @url{http://fribidi.org/}.
  6255. @section edgedetect
  6256. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  6257. The filter accepts the following options:
  6258. @table @option
  6259. @item low
  6260. @item high
  6261. Set low and high threshold values used by the Canny thresholding
  6262. algorithm.
  6263. The high threshold selects the "strong" edge pixels, which are then
  6264. connected through 8-connectivity with the "weak" edge pixels selected
  6265. by the low threshold.
  6266. @var{low} and @var{high} threshold values must be chosen in the range
  6267. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6268. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6269. is @code{50/255}.
  6270. @item mode
  6271. Define the drawing mode.
  6272. @table @samp
  6273. @item wires
  6274. Draw white/gray wires on black background.
  6275. @item colormix
  6276. Mix the colors to create a paint/cartoon effect.
  6277. @end table
  6278. Default value is @var{wires}.
  6279. @end table
  6280. @subsection Examples
  6281. @itemize
  6282. @item
  6283. Standard edge detection with custom values for the hysteresis thresholding:
  6284. @example
  6285. edgedetect=low=0.1:high=0.4
  6286. @end example
  6287. @item
  6288. Painting effect without thresholding:
  6289. @example
  6290. edgedetect=mode=colormix:high=0
  6291. @end example
  6292. @end itemize
  6293. @section eq
  6294. Set brightness, contrast, saturation and approximate gamma adjustment.
  6295. The filter accepts the following options:
  6296. @table @option
  6297. @item contrast
  6298. Set the contrast expression. The value must be a float value in range
  6299. @code{-2.0} to @code{2.0}. The default value is "1".
  6300. @item brightness
  6301. Set the brightness expression. The value must be a float value in
  6302. range @code{-1.0} to @code{1.0}. The default value is "0".
  6303. @item saturation
  6304. Set the saturation expression. The value must be a float in
  6305. range @code{0.0} to @code{3.0}. The default value is "1".
  6306. @item gamma
  6307. Set the gamma expression. The value must be a float in range
  6308. @code{0.1} to @code{10.0}. The default value is "1".
  6309. @item gamma_r
  6310. Set the gamma expression for red. The value must be a float in
  6311. range @code{0.1} to @code{10.0}. The default value is "1".
  6312. @item gamma_g
  6313. Set the gamma expression for green. The value must be a float in range
  6314. @code{0.1} to @code{10.0}. The default value is "1".
  6315. @item gamma_b
  6316. Set the gamma expression for blue. The value must be a float in range
  6317. @code{0.1} to @code{10.0}. The default value is "1".
  6318. @item gamma_weight
  6319. Set the gamma weight expression. It can be used to reduce the effect
  6320. of a high gamma value on bright image areas, e.g. keep them from
  6321. getting overamplified and just plain white. The value must be a float
  6322. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  6323. gamma correction all the way down while @code{1.0} leaves it at its
  6324. full strength. Default is "1".
  6325. @item eval
  6326. Set when the expressions for brightness, contrast, saturation and
  6327. gamma expressions are evaluated.
  6328. It accepts the following values:
  6329. @table @samp
  6330. @item init
  6331. only evaluate expressions once during the filter initialization or
  6332. when a command is processed
  6333. @item frame
  6334. evaluate expressions for each incoming frame
  6335. @end table
  6336. Default value is @samp{init}.
  6337. @end table
  6338. The expressions accept the following parameters:
  6339. @table @option
  6340. @item n
  6341. frame count of the input frame starting from 0
  6342. @item pos
  6343. byte position of the corresponding packet in the input file, NAN if
  6344. unspecified
  6345. @item r
  6346. frame rate of the input video, NAN if the input frame rate is unknown
  6347. @item t
  6348. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6349. @end table
  6350. @subsection Commands
  6351. The filter supports the following commands:
  6352. @table @option
  6353. @item contrast
  6354. Set the contrast expression.
  6355. @item brightness
  6356. Set the brightness expression.
  6357. @item saturation
  6358. Set the saturation expression.
  6359. @item gamma
  6360. Set the gamma expression.
  6361. @item gamma_r
  6362. Set the gamma_r expression.
  6363. @item gamma_g
  6364. Set gamma_g expression.
  6365. @item gamma_b
  6366. Set gamma_b expression.
  6367. @item gamma_weight
  6368. Set gamma_weight expression.
  6369. The command accepts the same syntax of the corresponding option.
  6370. If the specified expression is not valid, it is kept at its current
  6371. value.
  6372. @end table
  6373. @section erosion
  6374. Apply erosion effect to the video.
  6375. This filter replaces the pixel by the local(3x3) minimum.
  6376. It accepts the following options:
  6377. @table @option
  6378. @item threshold0
  6379. @item threshold1
  6380. @item threshold2
  6381. @item threshold3
  6382. Limit the maximum change for each plane, default is 65535.
  6383. If 0, plane will remain unchanged.
  6384. @item coordinates
  6385. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6386. pixels are used.
  6387. Flags to local 3x3 coordinates maps like this:
  6388. 1 2 3
  6389. 4 5
  6390. 6 7 8
  6391. @end table
  6392. @section extractplanes
  6393. Extract color channel components from input video stream into
  6394. separate grayscale video streams.
  6395. The filter accepts the following option:
  6396. @table @option
  6397. @item planes
  6398. Set plane(s) to extract.
  6399. Available values for planes are:
  6400. @table @samp
  6401. @item y
  6402. @item u
  6403. @item v
  6404. @item a
  6405. @item r
  6406. @item g
  6407. @item b
  6408. @end table
  6409. Choosing planes not available in the input will result in an error.
  6410. That means you cannot select @code{r}, @code{g}, @code{b} planes
  6411. with @code{y}, @code{u}, @code{v} planes at same time.
  6412. @end table
  6413. @subsection Examples
  6414. @itemize
  6415. @item
  6416. Extract luma, u and v color channel component from input video frame
  6417. into 3 grayscale outputs:
  6418. @example
  6419. 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
  6420. @end example
  6421. @end itemize
  6422. @section elbg
  6423. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  6424. For each input image, the filter will compute the optimal mapping from
  6425. the input to the output given the codebook length, that is the number
  6426. of distinct output colors.
  6427. This filter accepts the following options.
  6428. @table @option
  6429. @item codebook_length, l
  6430. Set codebook length. The value must be a positive integer, and
  6431. represents the number of distinct output colors. Default value is 256.
  6432. @item nb_steps, n
  6433. Set the maximum number of iterations to apply for computing the optimal
  6434. mapping. The higher the value the better the result and the higher the
  6435. computation time. Default value is 1.
  6436. @item seed, s
  6437. Set a random seed, must be an integer included between 0 and
  6438. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  6439. will try to use a good random seed on a best effort basis.
  6440. @item pal8
  6441. Set pal8 output pixel format. This option does not work with codebook
  6442. length greater than 256.
  6443. @end table
  6444. @section entropy
  6445. Measure graylevel entropy in histogram of color channels of video frames.
  6446. It accepts the following parameters:
  6447. @table @option
  6448. @item mode
  6449. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  6450. @var{diff} mode measures entropy of histogram delta values, absolute differences
  6451. between neighbour histogram values.
  6452. @end table
  6453. @section fade
  6454. Apply a fade-in/out effect to the input video.
  6455. It accepts the following parameters:
  6456. @table @option
  6457. @item type, t
  6458. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  6459. effect.
  6460. Default is @code{in}.
  6461. @item start_frame, s
  6462. Specify the number of the frame to start applying the fade
  6463. effect at. Default is 0.
  6464. @item nb_frames, n
  6465. The number of frames that the fade effect lasts. At the end of the
  6466. fade-in effect, the output video will have the same intensity as the input video.
  6467. At the end of the fade-out transition, the output video will be filled with the
  6468. selected @option{color}.
  6469. Default is 25.
  6470. @item alpha
  6471. If set to 1, fade only alpha channel, if one exists on the input.
  6472. Default value is 0.
  6473. @item start_time, st
  6474. Specify the timestamp (in seconds) of the frame to start to apply the fade
  6475. effect. If both start_frame and start_time are specified, the fade will start at
  6476. whichever comes last. Default is 0.
  6477. @item duration, d
  6478. The number of seconds for which the fade effect has to last. At the end of the
  6479. fade-in effect the output video will have the same intensity as the input video,
  6480. at the end of the fade-out transition the output video will be filled with the
  6481. selected @option{color}.
  6482. If both duration and nb_frames are specified, duration is used. Default is 0
  6483. (nb_frames is used by default).
  6484. @item color, c
  6485. Specify the color of the fade. Default is "black".
  6486. @end table
  6487. @subsection Examples
  6488. @itemize
  6489. @item
  6490. Fade in the first 30 frames of video:
  6491. @example
  6492. fade=in:0:30
  6493. @end example
  6494. The command above is equivalent to:
  6495. @example
  6496. fade=t=in:s=0:n=30
  6497. @end example
  6498. @item
  6499. Fade out the last 45 frames of a 200-frame video:
  6500. @example
  6501. fade=out:155:45
  6502. fade=type=out:start_frame=155:nb_frames=45
  6503. @end example
  6504. @item
  6505. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  6506. @example
  6507. fade=in:0:25, fade=out:975:25
  6508. @end example
  6509. @item
  6510. Make the first 5 frames yellow, then fade in from frame 5-24:
  6511. @example
  6512. fade=in:5:20:color=yellow
  6513. @end example
  6514. @item
  6515. Fade in alpha over first 25 frames of video:
  6516. @example
  6517. fade=in:0:25:alpha=1
  6518. @end example
  6519. @item
  6520. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  6521. @example
  6522. fade=t=in:st=5.5:d=0.5
  6523. @end example
  6524. @end itemize
  6525. @section fftfilt
  6526. Apply arbitrary expressions to samples in frequency domain
  6527. @table @option
  6528. @item dc_Y
  6529. Adjust the dc value (gain) of the luma plane of the image. The filter
  6530. accepts an integer value in range @code{0} to @code{1000}. The default
  6531. value is set to @code{0}.
  6532. @item dc_U
  6533. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  6534. filter accepts an integer value in range @code{0} to @code{1000}. The
  6535. default value is set to @code{0}.
  6536. @item dc_V
  6537. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  6538. filter accepts an integer value in range @code{0} to @code{1000}. The
  6539. default value is set to @code{0}.
  6540. @item weight_Y
  6541. Set the frequency domain weight expression for the luma plane.
  6542. @item weight_U
  6543. Set the frequency domain weight expression for the 1st chroma plane.
  6544. @item weight_V
  6545. Set the frequency domain weight expression for the 2nd chroma plane.
  6546. @item eval
  6547. Set when the expressions are evaluated.
  6548. It accepts the following values:
  6549. @table @samp
  6550. @item init
  6551. Only evaluate expressions once during the filter initialization.
  6552. @item frame
  6553. Evaluate expressions for each incoming frame.
  6554. @end table
  6555. Default value is @samp{init}.
  6556. The filter accepts the following variables:
  6557. @item X
  6558. @item Y
  6559. The coordinates of the current sample.
  6560. @item W
  6561. @item H
  6562. The width and height of the image.
  6563. @item N
  6564. The number of input frame, starting from 0.
  6565. @end table
  6566. @subsection Examples
  6567. @itemize
  6568. @item
  6569. High-pass:
  6570. @example
  6571. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  6572. @end example
  6573. @item
  6574. Low-pass:
  6575. @example
  6576. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  6577. @end example
  6578. @item
  6579. Sharpen:
  6580. @example
  6581. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  6582. @end example
  6583. @item
  6584. Blur:
  6585. @example
  6586. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  6587. @end example
  6588. @end itemize
  6589. @section field
  6590. Extract a single field from an interlaced image using stride
  6591. arithmetic to avoid wasting CPU time. The output frames are marked as
  6592. non-interlaced.
  6593. The filter accepts the following options:
  6594. @table @option
  6595. @item type
  6596. Specify whether to extract the top (if the value is @code{0} or
  6597. @code{top}) or the bottom field (if the value is @code{1} or
  6598. @code{bottom}).
  6599. @end table
  6600. @section fieldhint
  6601. Create new frames by copying the top and bottom fields from surrounding frames
  6602. supplied as numbers by the hint file.
  6603. @table @option
  6604. @item hint
  6605. Set file containing hints: absolute/relative frame numbers.
  6606. There must be one line for each frame in a clip. Each line must contain two
  6607. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  6608. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  6609. is current frame number for @code{absolute} mode or out of [-1, 1] range
  6610. for @code{relative} mode. First number tells from which frame to pick up top
  6611. field and second number tells from which frame to pick up bottom field.
  6612. If optionally followed by @code{+} output frame will be marked as interlaced,
  6613. else if followed by @code{-} output frame will be marked as progressive, else
  6614. it will be marked same as input frame.
  6615. If line starts with @code{#} or @code{;} that line is skipped.
  6616. @item mode
  6617. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  6618. @end table
  6619. Example of first several lines of @code{hint} file for @code{relative} mode:
  6620. @example
  6621. 0,0 - # first frame
  6622. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  6623. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  6624. 1,0 -
  6625. 0,0 -
  6626. 0,0 -
  6627. 1,0 -
  6628. 1,0 -
  6629. 1,0 -
  6630. 0,0 -
  6631. 0,0 -
  6632. 1,0 -
  6633. 1,0 -
  6634. 1,0 -
  6635. 0,0 -
  6636. @end example
  6637. @section fieldmatch
  6638. Field matching filter for inverse telecine. It is meant to reconstruct the
  6639. progressive frames from a telecined stream. The filter does not drop duplicated
  6640. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  6641. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  6642. The separation of the field matching and the decimation is notably motivated by
  6643. the possibility of inserting a de-interlacing filter fallback between the two.
  6644. If the source has mixed telecined and real interlaced content,
  6645. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  6646. But these remaining combed frames will be marked as interlaced, and thus can be
  6647. de-interlaced by a later filter such as @ref{yadif} before decimation.
  6648. In addition to the various configuration options, @code{fieldmatch} can take an
  6649. optional second stream, activated through the @option{ppsrc} option. If
  6650. enabled, the frames reconstruction will be based on the fields and frames from
  6651. this second stream. This allows the first input to be pre-processed in order to
  6652. help the various algorithms of the filter, while keeping the output lossless
  6653. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  6654. or brightness/contrast adjustments can help.
  6655. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  6656. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  6657. which @code{fieldmatch} is based on. While the semantic and usage are very
  6658. close, some behaviour and options names can differ.
  6659. The @ref{decimate} filter currently only works for constant frame rate input.
  6660. If your input has mixed telecined (30fps) and progressive content with a lower
  6661. framerate like 24fps use the following filterchain to produce the necessary cfr
  6662. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  6663. The filter accepts the following options:
  6664. @table @option
  6665. @item order
  6666. Specify the assumed field order of the input stream. Available values are:
  6667. @table @samp
  6668. @item auto
  6669. Auto detect parity (use FFmpeg's internal parity value).
  6670. @item bff
  6671. Assume bottom field first.
  6672. @item tff
  6673. Assume top field first.
  6674. @end table
  6675. Note that it is sometimes recommended not to trust the parity announced by the
  6676. stream.
  6677. Default value is @var{auto}.
  6678. @item mode
  6679. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  6680. sense that it won't risk creating jerkiness due to duplicate frames when
  6681. possible, but if there are bad edits or blended fields it will end up
  6682. outputting combed frames when a good match might actually exist. On the other
  6683. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  6684. but will almost always find a good frame if there is one. The other values are
  6685. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  6686. jerkiness and creating duplicate frames versus finding good matches in sections
  6687. with bad edits, orphaned fields, blended fields, etc.
  6688. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  6689. Available values are:
  6690. @table @samp
  6691. @item pc
  6692. 2-way matching (p/c)
  6693. @item pc_n
  6694. 2-way matching, and trying 3rd match if still combed (p/c + n)
  6695. @item pc_u
  6696. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  6697. @item pc_n_ub
  6698. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  6699. still combed (p/c + n + u/b)
  6700. @item pcn
  6701. 3-way matching (p/c/n)
  6702. @item pcn_ub
  6703. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  6704. detected as combed (p/c/n + u/b)
  6705. @end table
  6706. The parenthesis at the end indicate the matches that would be used for that
  6707. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  6708. @var{top}).
  6709. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  6710. the slowest.
  6711. Default value is @var{pc_n}.
  6712. @item ppsrc
  6713. Mark the main input stream as a pre-processed input, and enable the secondary
  6714. input stream as the clean source to pick the fields from. See the filter
  6715. introduction for more details. It is similar to the @option{clip2} feature from
  6716. VFM/TFM.
  6717. Default value is @code{0} (disabled).
  6718. @item field
  6719. Set the field to match from. It is recommended to set this to the same value as
  6720. @option{order} unless you experience matching failures with that setting. In
  6721. certain circumstances changing the field that is used to match from can have a
  6722. large impact on matching performance. Available values are:
  6723. @table @samp
  6724. @item auto
  6725. Automatic (same value as @option{order}).
  6726. @item bottom
  6727. Match from the bottom field.
  6728. @item top
  6729. Match from the top field.
  6730. @end table
  6731. Default value is @var{auto}.
  6732. @item mchroma
  6733. Set whether or not chroma is included during the match comparisons. In most
  6734. cases it is recommended to leave this enabled. You should set this to @code{0}
  6735. only if your clip has bad chroma problems such as heavy rainbowing or other
  6736. artifacts. Setting this to @code{0} could also be used to speed things up at
  6737. the cost of some accuracy.
  6738. Default value is @code{1}.
  6739. @item y0
  6740. @item y1
  6741. These define an exclusion band which excludes the lines between @option{y0} and
  6742. @option{y1} from being included in the field matching decision. An exclusion
  6743. band can be used to ignore subtitles, a logo, or other things that may
  6744. interfere with the matching. @option{y0} sets the starting scan line and
  6745. @option{y1} sets the ending line; all lines in between @option{y0} and
  6746. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6747. @option{y0} and @option{y1} to the same value will disable the feature.
  6748. @option{y0} and @option{y1} defaults to @code{0}.
  6749. @item scthresh
  6750. Set the scene change detection threshold as a percentage of maximum change on
  6751. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6752. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6753. @option{scthresh} is @code{[0.0, 100.0]}.
  6754. Default value is @code{12.0}.
  6755. @item combmatch
  6756. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6757. account the combed scores of matches when deciding what match to use as the
  6758. final match. Available values are:
  6759. @table @samp
  6760. @item none
  6761. No final matching based on combed scores.
  6762. @item sc
  6763. Combed scores are only used when a scene change is detected.
  6764. @item full
  6765. Use combed scores all the time.
  6766. @end table
  6767. Default is @var{sc}.
  6768. @item combdbg
  6769. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  6770. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  6771. Available values are:
  6772. @table @samp
  6773. @item none
  6774. No forced calculation.
  6775. @item pcn
  6776. Force p/c/n calculations.
  6777. @item pcnub
  6778. Force p/c/n/u/b calculations.
  6779. @end table
  6780. Default value is @var{none}.
  6781. @item cthresh
  6782. This is the area combing threshold used for combed frame detection. This
  6783. essentially controls how "strong" or "visible" combing must be to be detected.
  6784. Larger values mean combing must be more visible and smaller values mean combing
  6785. can be less visible or strong and still be detected. Valid settings are from
  6786. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6787. be detected as combed). This is basically a pixel difference value. A good
  6788. range is @code{[8, 12]}.
  6789. Default value is @code{9}.
  6790. @item chroma
  6791. Sets whether or not chroma is considered in the combed frame decision. Only
  6792. disable this if your source has chroma problems (rainbowing, etc.) that are
  6793. causing problems for the combed frame detection with chroma enabled. Actually,
  6794. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6795. where there is chroma only combing in the source.
  6796. Default value is @code{0}.
  6797. @item blockx
  6798. @item blocky
  6799. Respectively set the x-axis and y-axis size of the window used during combed
  6800. frame detection. This has to do with the size of the area in which
  6801. @option{combpel} pixels are required to be detected as combed for a frame to be
  6802. declared combed. See the @option{combpel} parameter description for more info.
  6803. Possible values are any number that is a power of 2 starting at 4 and going up
  6804. to 512.
  6805. Default value is @code{16}.
  6806. @item combpel
  6807. The number of combed pixels inside any of the @option{blocky} by
  6808. @option{blockx} size blocks on the frame for the frame to be detected as
  6809. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6810. setting controls "how much" combing there must be in any localized area (a
  6811. window defined by the @option{blockx} and @option{blocky} settings) on the
  6812. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6813. which point no frames will ever be detected as combed). This setting is known
  6814. as @option{MI} in TFM/VFM vocabulary.
  6815. Default value is @code{80}.
  6816. @end table
  6817. @anchor{p/c/n/u/b meaning}
  6818. @subsection p/c/n/u/b meaning
  6819. @subsubsection p/c/n
  6820. We assume the following telecined stream:
  6821. @example
  6822. Top fields: 1 2 2 3 4
  6823. Bottom fields: 1 2 3 4 4
  6824. @end example
  6825. The numbers correspond to the progressive frame the fields relate to. Here, the
  6826. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6827. When @code{fieldmatch} is configured to run a matching from bottom
  6828. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6829. @example
  6830. Input stream:
  6831. T 1 2 2 3 4
  6832. B 1 2 3 4 4 <-- matching reference
  6833. Matches: c c n n c
  6834. Output stream:
  6835. T 1 2 3 4 4
  6836. B 1 2 3 4 4
  6837. @end example
  6838. As a result of the field matching, we can see that some frames get duplicated.
  6839. To perform a complete inverse telecine, you need to rely on a decimation filter
  6840. after this operation. See for instance the @ref{decimate} filter.
  6841. The same operation now matching from top fields (@option{field}=@var{top})
  6842. looks like this:
  6843. @example
  6844. Input stream:
  6845. T 1 2 2 3 4 <-- matching reference
  6846. B 1 2 3 4 4
  6847. Matches: c c p p c
  6848. Output stream:
  6849. T 1 2 2 3 4
  6850. B 1 2 2 3 4
  6851. @end example
  6852. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6853. basically, they refer to the frame and field of the opposite parity:
  6854. @itemize
  6855. @item @var{p} matches the field of the opposite parity in the previous frame
  6856. @item @var{c} matches the field of the opposite parity in the current frame
  6857. @item @var{n} matches the field of the opposite parity in the next frame
  6858. @end itemize
  6859. @subsubsection u/b
  6860. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6861. from the opposite parity flag. In the following examples, we assume that we are
  6862. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6863. 'x' is placed above and below each matched fields.
  6864. With bottom matching (@option{field}=@var{bottom}):
  6865. @example
  6866. Match: c p n b u
  6867. x x x x x
  6868. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6869. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6870. x x x x x
  6871. Output frames:
  6872. 2 1 2 2 2
  6873. 2 2 2 1 3
  6874. @end example
  6875. With top matching (@option{field}=@var{top}):
  6876. @example
  6877. Match: c p n b u
  6878. x x x x x
  6879. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6880. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6881. x x x x x
  6882. Output frames:
  6883. 2 2 2 1 2
  6884. 2 1 3 2 2
  6885. @end example
  6886. @subsection Examples
  6887. Simple IVTC of a top field first telecined stream:
  6888. @example
  6889. fieldmatch=order=tff:combmatch=none, decimate
  6890. @end example
  6891. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6892. @example
  6893. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6894. @end example
  6895. @section fieldorder
  6896. Transform the field order of the input video.
  6897. It accepts the following parameters:
  6898. @table @option
  6899. @item order
  6900. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6901. for bottom field first.
  6902. @end table
  6903. The default value is @samp{tff}.
  6904. The transformation is done by shifting the picture content up or down
  6905. by one line, and filling the remaining line with appropriate picture content.
  6906. This method is consistent with most broadcast field order converters.
  6907. If the input video is not flagged as being interlaced, or it is already
  6908. flagged as being of the required output field order, then this filter does
  6909. not alter the incoming video.
  6910. It is very useful when converting to or from PAL DV material,
  6911. which is bottom field first.
  6912. For example:
  6913. @example
  6914. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6915. @end example
  6916. @section fifo, afifo
  6917. Buffer input images and send them when they are requested.
  6918. It is mainly useful when auto-inserted by the libavfilter
  6919. framework.
  6920. It does not take parameters.
  6921. @section fillborders
  6922. Fill borders of the input video, without changing video stream dimensions.
  6923. Sometimes video can have garbage at the four edges and you may not want to
  6924. crop video input to keep size multiple of some number.
  6925. This filter accepts the following options:
  6926. @table @option
  6927. @item left
  6928. Number of pixels to fill from left border.
  6929. @item right
  6930. Number of pixels to fill from right border.
  6931. @item top
  6932. Number of pixels to fill from top border.
  6933. @item bottom
  6934. Number of pixels to fill from bottom border.
  6935. @item mode
  6936. Set fill mode.
  6937. It accepts the following values:
  6938. @table @samp
  6939. @item smear
  6940. fill pixels using outermost pixels
  6941. @item mirror
  6942. fill pixels using mirroring
  6943. @item fixed
  6944. fill pixels with constant value
  6945. @end table
  6946. Default is @var{smear}.
  6947. @item color
  6948. Set color for pixels in fixed mode. Default is @var{black}.
  6949. @end table
  6950. @section find_rect
  6951. Find a rectangular object
  6952. It accepts the following options:
  6953. @table @option
  6954. @item object
  6955. Filepath of the object image, needs to be in gray8.
  6956. @item threshold
  6957. Detection threshold, default is 0.5.
  6958. @item mipmaps
  6959. Number of mipmaps, default is 3.
  6960. @item xmin, ymin, xmax, ymax
  6961. Specifies the rectangle in which to search.
  6962. @end table
  6963. @subsection Examples
  6964. @itemize
  6965. @item
  6966. Generate a representative palette of a given video using @command{ffmpeg}:
  6967. @example
  6968. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6969. @end example
  6970. @end itemize
  6971. @section cover_rect
  6972. Cover a rectangular object
  6973. It accepts the following options:
  6974. @table @option
  6975. @item cover
  6976. Filepath of the optional cover image, needs to be in yuv420.
  6977. @item mode
  6978. Set covering mode.
  6979. It accepts the following values:
  6980. @table @samp
  6981. @item cover
  6982. cover it by the supplied image
  6983. @item blur
  6984. cover it by interpolating the surrounding pixels
  6985. @end table
  6986. Default value is @var{blur}.
  6987. @end table
  6988. @subsection Examples
  6989. @itemize
  6990. @item
  6991. Generate a representative palette of a given video using @command{ffmpeg}:
  6992. @example
  6993. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6994. @end example
  6995. @end itemize
  6996. @section floodfill
  6997. Flood area with values of same pixel components with another values.
  6998. It accepts the following options:
  6999. @table @option
  7000. @item x
  7001. Set pixel x coordinate.
  7002. @item y
  7003. Set pixel y coordinate.
  7004. @item s0
  7005. Set source #0 component value.
  7006. @item s1
  7007. Set source #1 component value.
  7008. @item s2
  7009. Set source #2 component value.
  7010. @item s3
  7011. Set source #3 component value.
  7012. @item d0
  7013. Set destination #0 component value.
  7014. @item d1
  7015. Set destination #1 component value.
  7016. @item d2
  7017. Set destination #2 component value.
  7018. @item d3
  7019. Set destination #3 component value.
  7020. @end table
  7021. @anchor{format}
  7022. @section format
  7023. Convert the input video to one of the specified pixel formats.
  7024. Libavfilter will try to pick one that is suitable as input to
  7025. the next filter.
  7026. It accepts the following parameters:
  7027. @table @option
  7028. @item pix_fmts
  7029. A '|'-separated list of pixel format names, such as
  7030. "pix_fmts=yuv420p|monow|rgb24".
  7031. @end table
  7032. @subsection Examples
  7033. @itemize
  7034. @item
  7035. Convert the input video to the @var{yuv420p} format
  7036. @example
  7037. format=pix_fmts=yuv420p
  7038. @end example
  7039. Convert the input video to any of the formats in the list
  7040. @example
  7041. format=pix_fmts=yuv420p|yuv444p|yuv410p
  7042. @end example
  7043. @end itemize
  7044. @anchor{fps}
  7045. @section fps
  7046. Convert the video to specified constant frame rate by duplicating or dropping
  7047. frames as necessary.
  7048. It accepts the following parameters:
  7049. @table @option
  7050. @item fps
  7051. The desired output frame rate. The default is @code{25}.
  7052. @item start_time
  7053. Assume the first PTS should be the given value, in seconds. This allows for
  7054. padding/trimming at the start of stream. By default, no assumption is made
  7055. about the first frame's expected PTS, so no padding or trimming is done.
  7056. For example, this could be set to 0 to pad the beginning with duplicates of
  7057. the first frame if a video stream starts after the audio stream or to trim any
  7058. frames with a negative PTS.
  7059. @item round
  7060. Timestamp (PTS) rounding method.
  7061. Possible values are:
  7062. @table @option
  7063. @item zero
  7064. round towards 0
  7065. @item inf
  7066. round away from 0
  7067. @item down
  7068. round towards -infinity
  7069. @item up
  7070. round towards +infinity
  7071. @item near
  7072. round to nearest
  7073. @end table
  7074. The default is @code{near}.
  7075. @item eof_action
  7076. Action performed when reading the last frame.
  7077. Possible values are:
  7078. @table @option
  7079. @item round
  7080. Use same timestamp rounding method as used for other frames.
  7081. @item pass
  7082. Pass through last frame if input duration has not been reached yet.
  7083. @end table
  7084. The default is @code{round}.
  7085. @end table
  7086. Alternatively, the options can be specified as a flat string:
  7087. @var{fps}[:@var{start_time}[:@var{round}]].
  7088. See also the @ref{setpts} filter.
  7089. @subsection Examples
  7090. @itemize
  7091. @item
  7092. A typical usage in order to set the fps to 25:
  7093. @example
  7094. fps=fps=25
  7095. @end example
  7096. @item
  7097. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  7098. @example
  7099. fps=fps=film:round=near
  7100. @end example
  7101. @end itemize
  7102. @section framepack
  7103. Pack two different video streams into a stereoscopic video, setting proper
  7104. metadata on supported codecs. The two views should have the same size and
  7105. framerate and processing will stop when the shorter video ends. Please note
  7106. that you may conveniently adjust view properties with the @ref{scale} and
  7107. @ref{fps} filters.
  7108. It accepts the following parameters:
  7109. @table @option
  7110. @item format
  7111. The desired packing format. Supported values are:
  7112. @table @option
  7113. @item sbs
  7114. The views are next to each other (default).
  7115. @item tab
  7116. The views are on top of each other.
  7117. @item lines
  7118. The views are packed by line.
  7119. @item columns
  7120. The views are packed by column.
  7121. @item frameseq
  7122. The views are temporally interleaved.
  7123. @end table
  7124. @end table
  7125. Some examples:
  7126. @example
  7127. # Convert left and right views into a frame-sequential video
  7128. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  7129. # Convert views into a side-by-side video with the same output resolution as the input
  7130. 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
  7131. @end example
  7132. @section framerate
  7133. Change the frame rate by interpolating new video output frames from the source
  7134. frames.
  7135. This filter is not designed to function correctly with interlaced media. If
  7136. you wish to change the frame rate of interlaced media then you are required
  7137. to deinterlace before this filter and re-interlace after this filter.
  7138. A description of the accepted options follows.
  7139. @table @option
  7140. @item fps
  7141. Specify the output frames per second. This option can also be specified
  7142. as a value alone. The default is @code{50}.
  7143. @item interp_start
  7144. Specify the start of a range where the output frame will be created as a
  7145. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7146. the default is @code{15}.
  7147. @item interp_end
  7148. Specify the end of a range where the output frame will be created as a
  7149. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7150. the default is @code{240}.
  7151. @item scene
  7152. Specify the level at which a scene change is detected as a value between
  7153. 0 and 100 to indicate a new scene; a low value reflects a low
  7154. probability for the current frame to introduce a new scene, while a higher
  7155. value means the current frame is more likely to be one.
  7156. The default is @code{8.2}.
  7157. @item flags
  7158. Specify flags influencing the filter process.
  7159. Available value for @var{flags} is:
  7160. @table @option
  7161. @item scene_change_detect, scd
  7162. Enable scene change detection using the value of the option @var{scene}.
  7163. This flag is enabled by default.
  7164. @end table
  7165. @end table
  7166. @section framestep
  7167. Select one frame every N-th frame.
  7168. This filter accepts the following option:
  7169. @table @option
  7170. @item step
  7171. Select frame after every @code{step} frames.
  7172. Allowed values are positive integers higher than 0. Default value is @code{1}.
  7173. @end table
  7174. @anchor{frei0r}
  7175. @section frei0r
  7176. Apply a frei0r effect to the input video.
  7177. To enable the compilation of this filter, you need to install the frei0r
  7178. header and configure FFmpeg with @code{--enable-frei0r}.
  7179. It accepts the following parameters:
  7180. @table @option
  7181. @item filter_name
  7182. The name of the frei0r effect to load. If the environment variable
  7183. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  7184. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  7185. Otherwise, the standard frei0r paths are searched, in this order:
  7186. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  7187. @file{/usr/lib/frei0r-1/}.
  7188. @item filter_params
  7189. A '|'-separated list of parameters to pass to the frei0r effect.
  7190. @end table
  7191. A frei0r effect parameter can be a boolean (its value is either
  7192. "y" or "n"), a double, a color (specified as
  7193. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  7194. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  7195. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  7196. a position (specified as @var{X}/@var{Y}, where
  7197. @var{X} and @var{Y} are floating point numbers) and/or a string.
  7198. The number and types of parameters depend on the loaded effect. If an
  7199. effect parameter is not specified, the default value is set.
  7200. @subsection Examples
  7201. @itemize
  7202. @item
  7203. Apply the distort0r effect, setting the first two double parameters:
  7204. @example
  7205. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  7206. @end example
  7207. @item
  7208. Apply the colordistance effect, taking a color as the first parameter:
  7209. @example
  7210. frei0r=colordistance:0.2/0.3/0.4
  7211. frei0r=colordistance:violet
  7212. frei0r=colordistance:0x112233
  7213. @end example
  7214. @item
  7215. Apply the perspective effect, specifying the top left and top right image
  7216. positions:
  7217. @example
  7218. frei0r=perspective:0.2/0.2|0.8/0.2
  7219. @end example
  7220. @end itemize
  7221. For more information, see
  7222. @url{http://frei0r.dyne.org}
  7223. @section fspp
  7224. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  7225. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  7226. processing filter, one of them is performed once per block, not per pixel.
  7227. This allows for much higher speed.
  7228. The filter accepts the following options:
  7229. @table @option
  7230. @item quality
  7231. Set quality. This option defines the number of levels for averaging. It accepts
  7232. an integer in the range 4-5. Default value is @code{4}.
  7233. @item qp
  7234. Force a constant quantization parameter. It accepts an integer in range 0-63.
  7235. If not set, the filter will use the QP from the video stream (if available).
  7236. @item strength
  7237. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  7238. more details but also more artifacts, while higher values make the image smoother
  7239. but also blurrier. Default value is @code{0} − PSNR optimal.
  7240. @item use_bframe_qp
  7241. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  7242. option may cause flicker since the B-Frames have often larger QP. Default is
  7243. @code{0} (not enabled).
  7244. @end table
  7245. @section gblur
  7246. Apply Gaussian blur filter.
  7247. The filter accepts the following options:
  7248. @table @option
  7249. @item sigma
  7250. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  7251. @item steps
  7252. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  7253. @item planes
  7254. Set which planes to filter. By default all planes are filtered.
  7255. @item sigmaV
  7256. Set vertical sigma, if negative it will be same as @code{sigma}.
  7257. Default is @code{-1}.
  7258. @end table
  7259. @section geq
  7260. The filter accepts the following options:
  7261. @table @option
  7262. @item lum_expr, lum
  7263. Set the luminance expression.
  7264. @item cb_expr, cb
  7265. Set the chrominance blue expression.
  7266. @item cr_expr, cr
  7267. Set the chrominance red expression.
  7268. @item alpha_expr, a
  7269. Set the alpha expression.
  7270. @item red_expr, r
  7271. Set the red expression.
  7272. @item green_expr, g
  7273. Set the green expression.
  7274. @item blue_expr, b
  7275. Set the blue expression.
  7276. @end table
  7277. The colorspace is selected according to the specified options. If one
  7278. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  7279. options is specified, the filter will automatically select a YCbCr
  7280. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  7281. @option{blue_expr} options is specified, it will select an RGB
  7282. colorspace.
  7283. If one of the chrominance expression is not defined, it falls back on the other
  7284. one. If no alpha expression is specified it will evaluate to opaque value.
  7285. If none of chrominance expressions are specified, they will evaluate
  7286. to the luminance expression.
  7287. The expressions can use the following variables and functions:
  7288. @table @option
  7289. @item N
  7290. The sequential number of the filtered frame, starting from @code{0}.
  7291. @item X
  7292. @item Y
  7293. The coordinates of the current sample.
  7294. @item W
  7295. @item H
  7296. The width and height of the image.
  7297. @item SW
  7298. @item SH
  7299. Width and height scale depending on the currently filtered plane. It is the
  7300. ratio between the corresponding luma plane number of pixels and the current
  7301. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  7302. @code{0.5,0.5} for chroma planes.
  7303. @item T
  7304. Time of the current frame, expressed in seconds.
  7305. @item p(x, y)
  7306. Return the value of the pixel at location (@var{x},@var{y}) of the current
  7307. plane.
  7308. @item lum(x, y)
  7309. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  7310. plane.
  7311. @item cb(x, y)
  7312. Return the value of the pixel at location (@var{x},@var{y}) of the
  7313. blue-difference chroma plane. Return 0 if there is no such plane.
  7314. @item cr(x, y)
  7315. Return the value of the pixel at location (@var{x},@var{y}) of the
  7316. red-difference chroma plane. Return 0 if there is no such plane.
  7317. @item r(x, y)
  7318. @item g(x, y)
  7319. @item b(x, y)
  7320. Return the value of the pixel at location (@var{x},@var{y}) of the
  7321. red/green/blue component. Return 0 if there is no such component.
  7322. @item alpha(x, y)
  7323. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  7324. plane. Return 0 if there is no such plane.
  7325. @end table
  7326. For functions, if @var{x} and @var{y} are outside the area, the value will be
  7327. automatically clipped to the closer edge.
  7328. @subsection Examples
  7329. @itemize
  7330. @item
  7331. Flip the image horizontally:
  7332. @example
  7333. geq=p(W-X\,Y)
  7334. @end example
  7335. @item
  7336. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  7337. wavelength of 100 pixels:
  7338. @example
  7339. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  7340. @end example
  7341. @item
  7342. Generate a fancy enigmatic moving light:
  7343. @example
  7344. 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
  7345. @end example
  7346. @item
  7347. Generate a quick emboss effect:
  7348. @example
  7349. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  7350. @end example
  7351. @item
  7352. Modify RGB components depending on pixel position:
  7353. @example
  7354. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  7355. @end example
  7356. @item
  7357. Create a radial gradient that is the same size as the input (also see
  7358. the @ref{vignette} filter):
  7359. @example
  7360. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  7361. @end example
  7362. @end itemize
  7363. @section gradfun
  7364. Fix the banding artifacts that are sometimes introduced into nearly flat
  7365. regions by truncation to 8-bit color depth.
  7366. Interpolate the gradients that should go where the bands are, and
  7367. dither them.
  7368. It is designed for playback only. Do not use it prior to
  7369. lossy compression, because compression tends to lose the dither and
  7370. bring back the bands.
  7371. It accepts the following parameters:
  7372. @table @option
  7373. @item strength
  7374. The maximum amount by which the filter will change any one pixel. This is also
  7375. the threshold for detecting nearly flat regions. Acceptable values range from
  7376. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  7377. valid range.
  7378. @item radius
  7379. The neighborhood to fit the gradient to. A larger radius makes for smoother
  7380. gradients, but also prevents the filter from modifying the pixels near detailed
  7381. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  7382. values will be clipped to the valid range.
  7383. @end table
  7384. Alternatively, the options can be specified as a flat string:
  7385. @var{strength}[:@var{radius}]
  7386. @subsection Examples
  7387. @itemize
  7388. @item
  7389. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  7390. @example
  7391. gradfun=3.5:8
  7392. @end example
  7393. @item
  7394. Specify radius, omitting the strength (which will fall-back to the default
  7395. value):
  7396. @example
  7397. gradfun=radius=8
  7398. @end example
  7399. @end itemize
  7400. @anchor{haldclut}
  7401. @section haldclut
  7402. Apply a Hald CLUT to a video stream.
  7403. First input is the video stream to process, and second one is the Hald CLUT.
  7404. The Hald CLUT input can be a simple picture or a complete video stream.
  7405. The filter accepts the following options:
  7406. @table @option
  7407. @item shortest
  7408. Force termination when the shortest input terminates. Default is @code{0}.
  7409. @item repeatlast
  7410. Continue applying the last CLUT after the end of the stream. A value of
  7411. @code{0} disable the filter after the last frame of the CLUT is reached.
  7412. Default is @code{1}.
  7413. @end table
  7414. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  7415. filters share the same internals).
  7416. More information about the Hald CLUT can be found on Eskil Steenberg's website
  7417. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  7418. @subsection Workflow examples
  7419. @subsubsection Hald CLUT video stream
  7420. Generate an identity Hald CLUT stream altered with various effects:
  7421. @example
  7422. 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
  7423. @end example
  7424. Note: make sure you use a lossless codec.
  7425. Then use it with @code{haldclut} to apply it on some random stream:
  7426. @example
  7427. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  7428. @end example
  7429. The Hald CLUT will be applied to the 10 first seconds (duration of
  7430. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  7431. to the remaining frames of the @code{mandelbrot} stream.
  7432. @subsubsection Hald CLUT with preview
  7433. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  7434. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  7435. biggest possible square starting at the top left of the picture. The remaining
  7436. padding pixels (bottom or right) will be ignored. This area can be used to add
  7437. a preview of the Hald CLUT.
  7438. Typically, the following generated Hald CLUT will be supported by the
  7439. @code{haldclut} filter:
  7440. @example
  7441. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  7442. pad=iw+320 [padded_clut];
  7443. smptebars=s=320x256, split [a][b];
  7444. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  7445. [main][b] overlay=W-320" -frames:v 1 clut.png
  7446. @end example
  7447. It contains the original and a preview of the effect of the CLUT: SMPTE color
  7448. bars are displayed on the right-top, and below the same color bars processed by
  7449. the color changes.
  7450. Then, the effect of this Hald CLUT can be visualized with:
  7451. @example
  7452. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  7453. @end example
  7454. @section hflip
  7455. Flip the input video horizontally.
  7456. For example, to horizontally flip the input video with @command{ffmpeg}:
  7457. @example
  7458. ffmpeg -i in.avi -vf "hflip" out.avi
  7459. @end example
  7460. @section histeq
  7461. This filter applies a global color histogram equalization on a
  7462. per-frame basis.
  7463. It can be used to correct video that has a compressed range of pixel
  7464. intensities. The filter redistributes the pixel intensities to
  7465. equalize their distribution across the intensity range. It may be
  7466. viewed as an "automatically adjusting contrast filter". This filter is
  7467. useful only for correcting degraded or poorly captured source
  7468. video.
  7469. The filter accepts the following options:
  7470. @table @option
  7471. @item strength
  7472. Determine the amount of equalization to be applied. As the strength
  7473. is reduced, the distribution of pixel intensities more-and-more
  7474. approaches that of the input frame. The value must be a float number
  7475. in the range [0,1] and defaults to 0.200.
  7476. @item intensity
  7477. Set the maximum intensity that can generated and scale the output
  7478. values appropriately. The strength should be set as desired and then
  7479. the intensity can be limited if needed to avoid washing-out. The value
  7480. must be a float number in the range [0,1] and defaults to 0.210.
  7481. @item antibanding
  7482. Set the antibanding level. If enabled the filter will randomly vary
  7483. the luminance of output pixels by a small amount to avoid banding of
  7484. the histogram. Possible values are @code{none}, @code{weak} or
  7485. @code{strong}. It defaults to @code{none}.
  7486. @end table
  7487. @section histogram
  7488. Compute and draw a color distribution histogram for the input video.
  7489. The computed histogram is a representation of the color component
  7490. distribution in an image.
  7491. Standard histogram displays the color components distribution in an image.
  7492. Displays color graph for each color component. Shows distribution of
  7493. the Y, U, V, A or R, G, B components, depending on input format, in the
  7494. current frame. Below each graph a color component scale meter is shown.
  7495. The filter accepts the following options:
  7496. @table @option
  7497. @item level_height
  7498. Set height of level. Default value is @code{200}.
  7499. Allowed range is [50, 2048].
  7500. @item scale_height
  7501. Set height of color scale. Default value is @code{12}.
  7502. Allowed range is [0, 40].
  7503. @item display_mode
  7504. Set display mode.
  7505. It accepts the following values:
  7506. @table @samp
  7507. @item stack
  7508. Per color component graphs are placed below each other.
  7509. @item parade
  7510. Per color component graphs are placed side by side.
  7511. @item overlay
  7512. Presents information identical to that in the @code{parade}, except
  7513. that the graphs representing color components are superimposed directly
  7514. over one another.
  7515. @end table
  7516. Default is @code{stack}.
  7517. @item levels_mode
  7518. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  7519. Default is @code{linear}.
  7520. @item components
  7521. Set what color components to display.
  7522. Default is @code{7}.
  7523. @item fgopacity
  7524. Set foreground opacity. Default is @code{0.7}.
  7525. @item bgopacity
  7526. Set background opacity. Default is @code{0.5}.
  7527. @end table
  7528. @subsection Examples
  7529. @itemize
  7530. @item
  7531. Calculate and draw histogram:
  7532. @example
  7533. ffplay -i input -vf histogram
  7534. @end example
  7535. @end itemize
  7536. @anchor{hqdn3d}
  7537. @section hqdn3d
  7538. This is a high precision/quality 3d denoise filter. It aims to reduce
  7539. image noise, producing smooth images and making still images really
  7540. still. It should enhance compressibility.
  7541. It accepts the following optional parameters:
  7542. @table @option
  7543. @item luma_spatial
  7544. A non-negative floating point number which specifies spatial luma strength.
  7545. It defaults to 4.0.
  7546. @item chroma_spatial
  7547. A non-negative floating point number which specifies spatial chroma strength.
  7548. It defaults to 3.0*@var{luma_spatial}/4.0.
  7549. @item luma_tmp
  7550. A floating point number which specifies luma temporal strength. It defaults to
  7551. 6.0*@var{luma_spatial}/4.0.
  7552. @item chroma_tmp
  7553. A floating point number which specifies chroma temporal strength. It defaults to
  7554. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  7555. @end table
  7556. @section hwdownload
  7557. Download hardware frames to system memory.
  7558. The input must be in hardware frames, and the output a non-hardware format.
  7559. Not all formats will be supported on the output - it may be necessary to insert
  7560. an additional @option{format} filter immediately following in the graph to get
  7561. the output in a supported format.
  7562. @section hwmap
  7563. Map hardware frames to system memory or to another device.
  7564. This filter has several different modes of operation; which one is used depends
  7565. on the input and output formats:
  7566. @itemize
  7567. @item
  7568. Hardware frame input, normal frame output
  7569. Map the input frames to system memory and pass them to the output. If the
  7570. original hardware frame is later required (for example, after overlaying
  7571. something else on part of it), the @option{hwmap} filter can be used again
  7572. in the next mode to retrieve it.
  7573. @item
  7574. Normal frame input, hardware frame output
  7575. If the input is actually a software-mapped hardware frame, then unmap it -
  7576. that is, return the original hardware frame.
  7577. Otherwise, a device must be provided. Create new hardware surfaces on that
  7578. device for the output, then map them back to the software format at the input
  7579. and give those frames to the preceding filter. This will then act like the
  7580. @option{hwupload} filter, but may be able to avoid an additional copy when
  7581. the input is already in a compatible format.
  7582. @item
  7583. Hardware frame input and output
  7584. A device must be supplied for the output, either directly or with the
  7585. @option{derive_device} option. The input and output devices must be of
  7586. different types and compatible - the exact meaning of this is
  7587. system-dependent, but typically it means that they must refer to the same
  7588. underlying hardware context (for example, refer to the same graphics card).
  7589. If the input frames were originally created on the output device, then unmap
  7590. to retrieve the original frames.
  7591. Otherwise, map the frames to the output device - create new hardware frames
  7592. on the output corresponding to the frames on the input.
  7593. @end itemize
  7594. The following additional parameters are accepted:
  7595. @table @option
  7596. @item mode
  7597. Set the frame mapping mode. Some combination of:
  7598. @table @var
  7599. @item read
  7600. The mapped frame should be readable.
  7601. @item write
  7602. The mapped frame should be writeable.
  7603. @item overwrite
  7604. The mapping will always overwrite the entire frame.
  7605. This may improve performance in some cases, as the original contents of the
  7606. frame need not be loaded.
  7607. @item direct
  7608. The mapping must not involve any copying.
  7609. Indirect mappings to copies of frames are created in some cases where either
  7610. direct mapping is not possible or it would have unexpected properties.
  7611. Setting this flag ensures that the mapping is direct and will fail if that is
  7612. not possible.
  7613. @end table
  7614. Defaults to @var{read+write} if not specified.
  7615. @item derive_device @var{type}
  7616. Rather than using the device supplied at initialisation, instead derive a new
  7617. device of type @var{type} from the device the input frames exist on.
  7618. @item reverse
  7619. In a hardware to hardware mapping, map in reverse - create frames in the sink
  7620. and map them back to the source. This may be necessary in some cases where
  7621. a mapping in one direction is required but only the opposite direction is
  7622. supported by the devices being used.
  7623. This option is dangerous - it may break the preceding filter in undefined
  7624. ways if there are any additional constraints on that filter's output.
  7625. Do not use it without fully understanding the implications of its use.
  7626. @end table
  7627. @section hwupload
  7628. Upload system memory frames to hardware surfaces.
  7629. The device to upload to must be supplied when the filter is initialised. If
  7630. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  7631. option.
  7632. @anchor{hwupload_cuda}
  7633. @section hwupload_cuda
  7634. Upload system memory frames to a CUDA device.
  7635. It accepts the following optional parameters:
  7636. @table @option
  7637. @item device
  7638. The number of the CUDA device to use
  7639. @end table
  7640. @section hqx
  7641. Apply a high-quality magnification filter designed for pixel art. This filter
  7642. was originally created by Maxim Stepin.
  7643. It accepts the following option:
  7644. @table @option
  7645. @item n
  7646. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  7647. @code{hq3x} and @code{4} for @code{hq4x}.
  7648. Default is @code{3}.
  7649. @end table
  7650. @section hstack
  7651. Stack input videos horizontally.
  7652. All streams must be of same pixel format and of same height.
  7653. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  7654. to create same output.
  7655. The filter accept the following option:
  7656. @table @option
  7657. @item inputs
  7658. Set number of input streams. Default is 2.
  7659. @item shortest
  7660. If set to 1, force the output to terminate when the shortest input
  7661. terminates. Default value is 0.
  7662. @end table
  7663. @section hue
  7664. Modify the hue and/or the saturation of the input.
  7665. It accepts the following parameters:
  7666. @table @option
  7667. @item h
  7668. Specify the hue angle as a number of degrees. It accepts an expression,
  7669. and defaults to "0".
  7670. @item s
  7671. Specify the saturation in the [-10,10] range. It accepts an expression and
  7672. defaults to "1".
  7673. @item H
  7674. Specify the hue angle as a number of radians. It accepts an
  7675. expression, and defaults to "0".
  7676. @item b
  7677. Specify the brightness in the [-10,10] range. It accepts an expression and
  7678. defaults to "0".
  7679. @end table
  7680. @option{h} and @option{H} are mutually exclusive, and can't be
  7681. specified at the same time.
  7682. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  7683. expressions containing the following constants:
  7684. @table @option
  7685. @item n
  7686. frame count of the input frame starting from 0
  7687. @item pts
  7688. presentation timestamp of the input frame expressed in time base units
  7689. @item r
  7690. frame rate of the input video, NAN if the input frame rate is unknown
  7691. @item t
  7692. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7693. @item tb
  7694. time base of the input video
  7695. @end table
  7696. @subsection Examples
  7697. @itemize
  7698. @item
  7699. Set the hue to 90 degrees and the saturation to 1.0:
  7700. @example
  7701. hue=h=90:s=1
  7702. @end example
  7703. @item
  7704. Same command but expressing the hue in radians:
  7705. @example
  7706. hue=H=PI/2:s=1
  7707. @end example
  7708. @item
  7709. Rotate hue and make the saturation swing between 0
  7710. and 2 over a period of 1 second:
  7711. @example
  7712. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  7713. @end example
  7714. @item
  7715. Apply a 3 seconds saturation fade-in effect starting at 0:
  7716. @example
  7717. hue="s=min(t/3\,1)"
  7718. @end example
  7719. The general fade-in expression can be written as:
  7720. @example
  7721. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  7722. @end example
  7723. @item
  7724. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  7725. @example
  7726. hue="s=max(0\, min(1\, (8-t)/3))"
  7727. @end example
  7728. The general fade-out expression can be written as:
  7729. @example
  7730. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  7731. @end example
  7732. @end itemize
  7733. @subsection Commands
  7734. This filter supports the following commands:
  7735. @table @option
  7736. @item b
  7737. @item s
  7738. @item h
  7739. @item H
  7740. Modify the hue and/or the saturation and/or brightness of the input video.
  7741. The command accepts the same syntax of the corresponding option.
  7742. If the specified expression is not valid, it is kept at its current
  7743. value.
  7744. @end table
  7745. @section hysteresis
  7746. Grow first stream into second stream by connecting components.
  7747. This makes it possible to build more robust edge masks.
  7748. This filter accepts the following options:
  7749. @table @option
  7750. @item planes
  7751. Set which planes will be processed as bitmap, unprocessed planes will be
  7752. copied from first stream.
  7753. By default value 0xf, all planes will be processed.
  7754. @item threshold
  7755. Set threshold which is used in filtering. If pixel component value is higher than
  7756. this value filter algorithm for connecting components is activated.
  7757. By default value is 0.
  7758. @end table
  7759. @section idet
  7760. Detect video interlacing type.
  7761. This filter tries to detect if the input frames are interlaced, progressive,
  7762. top or bottom field first. It will also try to detect fields that are
  7763. repeated between adjacent frames (a sign of telecine).
  7764. Single frame detection considers only immediately adjacent frames when classifying each frame.
  7765. Multiple frame detection incorporates the classification history of previous frames.
  7766. The filter will log these metadata values:
  7767. @table @option
  7768. @item single.current_frame
  7769. Detected type of current frame using single-frame detection. One of:
  7770. ``tff'' (top field first), ``bff'' (bottom field first),
  7771. ``progressive'', or ``undetermined''
  7772. @item single.tff
  7773. Cumulative number of frames detected as top field first using single-frame detection.
  7774. @item multiple.tff
  7775. Cumulative number of frames detected as top field first using multiple-frame detection.
  7776. @item single.bff
  7777. Cumulative number of frames detected as bottom field first using single-frame detection.
  7778. @item multiple.current_frame
  7779. Detected type of current frame using multiple-frame detection. One of:
  7780. ``tff'' (top field first), ``bff'' (bottom field first),
  7781. ``progressive'', or ``undetermined''
  7782. @item multiple.bff
  7783. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  7784. @item single.progressive
  7785. Cumulative number of frames detected as progressive using single-frame detection.
  7786. @item multiple.progressive
  7787. Cumulative number of frames detected as progressive using multiple-frame detection.
  7788. @item single.undetermined
  7789. Cumulative number of frames that could not be classified using single-frame detection.
  7790. @item multiple.undetermined
  7791. Cumulative number of frames that could not be classified using multiple-frame detection.
  7792. @item repeated.current_frame
  7793. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  7794. @item repeated.neither
  7795. Cumulative number of frames with no repeated field.
  7796. @item repeated.top
  7797. Cumulative number of frames with the top field repeated from the previous frame's top field.
  7798. @item repeated.bottom
  7799. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  7800. @end table
  7801. The filter accepts the following options:
  7802. @table @option
  7803. @item intl_thres
  7804. Set interlacing threshold.
  7805. @item prog_thres
  7806. Set progressive threshold.
  7807. @item rep_thres
  7808. Threshold for repeated field detection.
  7809. @item half_life
  7810. Number of frames after which a given frame's contribution to the
  7811. statistics is halved (i.e., it contributes only 0.5 to its
  7812. classification). The default of 0 means that all frames seen are given
  7813. full weight of 1.0 forever.
  7814. @item analyze_interlaced_flag
  7815. When this is not 0 then idet will use the specified number of frames to determine
  7816. if the interlaced flag is accurate, it will not count undetermined frames.
  7817. If the flag is found to be accurate it will be used without any further
  7818. computations, if it is found to be inaccurate it will be cleared without any
  7819. further computations. This allows inserting the idet filter as a low computational
  7820. method to clean up the interlaced flag
  7821. @end table
  7822. @section il
  7823. Deinterleave or interleave fields.
  7824. This filter allows one to process interlaced images fields without
  7825. deinterlacing them. Deinterleaving splits the input frame into 2
  7826. fields (so called half pictures). Odd lines are moved to the top
  7827. half of the output image, even lines to the bottom half.
  7828. You can process (filter) them independently and then re-interleave them.
  7829. The filter accepts the following options:
  7830. @table @option
  7831. @item luma_mode, l
  7832. @item chroma_mode, c
  7833. @item alpha_mode, a
  7834. Available values for @var{luma_mode}, @var{chroma_mode} and
  7835. @var{alpha_mode} are:
  7836. @table @samp
  7837. @item none
  7838. Do nothing.
  7839. @item deinterleave, d
  7840. Deinterleave fields, placing one above the other.
  7841. @item interleave, i
  7842. Interleave fields. Reverse the effect of deinterleaving.
  7843. @end table
  7844. Default value is @code{none}.
  7845. @item luma_swap, ls
  7846. @item chroma_swap, cs
  7847. @item alpha_swap, as
  7848. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  7849. @end table
  7850. @section inflate
  7851. Apply inflate effect to the video.
  7852. This filter replaces the pixel by the local(3x3) average by taking into account
  7853. only values higher than the pixel.
  7854. It accepts the following options:
  7855. @table @option
  7856. @item threshold0
  7857. @item threshold1
  7858. @item threshold2
  7859. @item threshold3
  7860. Limit the maximum change for each plane, default is 65535.
  7861. If 0, plane will remain unchanged.
  7862. @end table
  7863. @section interlace
  7864. Simple interlacing filter from progressive contents. This interleaves upper (or
  7865. lower) lines from odd frames with lower (or upper) lines from even frames,
  7866. halving the frame rate and preserving image height.
  7867. @example
  7868. Original Original New Frame
  7869. Frame 'j' Frame 'j+1' (tff)
  7870. ========== =========== ==================
  7871. Line 0 --------------------> Frame 'j' Line 0
  7872. Line 1 Line 1 ----> Frame 'j+1' Line 1
  7873. Line 2 ---------------------> Frame 'j' Line 2
  7874. Line 3 Line 3 ----> Frame 'j+1' Line 3
  7875. ... ... ...
  7876. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  7877. @end example
  7878. It accepts the following optional parameters:
  7879. @table @option
  7880. @item scan
  7881. This determines whether the interlaced frame is taken from the even
  7882. (tff - default) or odd (bff) lines of the progressive frame.
  7883. @item lowpass
  7884. Vertical lowpass filter to avoid twitter interlacing and
  7885. reduce moire patterns.
  7886. @table @samp
  7887. @item 0, off
  7888. Disable vertical lowpass filter
  7889. @item 1, linear
  7890. Enable linear filter (default)
  7891. @item 2, complex
  7892. Enable complex filter. This will slightly less reduce twitter and moire
  7893. but better retain detail and subjective sharpness impression.
  7894. @end table
  7895. @end table
  7896. @section kerndeint
  7897. Deinterlace input video by applying Donald Graft's adaptive kernel
  7898. deinterling. Work on interlaced parts of a video to produce
  7899. progressive frames.
  7900. The description of the accepted parameters follows.
  7901. @table @option
  7902. @item thresh
  7903. Set the threshold which affects the filter's tolerance when
  7904. determining if a pixel line must be processed. It must be an integer
  7905. in the range [0,255] and defaults to 10. A value of 0 will result in
  7906. applying the process on every pixels.
  7907. @item map
  7908. Paint pixels exceeding the threshold value to white if set to 1.
  7909. Default is 0.
  7910. @item order
  7911. Set the fields order. Swap fields if set to 1, leave fields alone if
  7912. 0. Default is 0.
  7913. @item sharp
  7914. Enable additional sharpening if set to 1. Default is 0.
  7915. @item twoway
  7916. Enable twoway sharpening if set to 1. Default is 0.
  7917. @end table
  7918. @subsection Examples
  7919. @itemize
  7920. @item
  7921. Apply default values:
  7922. @example
  7923. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  7924. @end example
  7925. @item
  7926. Enable additional sharpening:
  7927. @example
  7928. kerndeint=sharp=1
  7929. @end example
  7930. @item
  7931. Paint processed pixels in white:
  7932. @example
  7933. kerndeint=map=1
  7934. @end example
  7935. @end itemize
  7936. @section lenscorrection
  7937. Correct radial lens distortion
  7938. This filter can be used to correct for radial distortion as can result from the use
  7939. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  7940. one can use tools available for example as part of opencv or simply trial-and-error.
  7941. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  7942. and extract the k1 and k2 coefficients from the resulting matrix.
  7943. Note that effectively the same filter is available in the open-source tools Krita and
  7944. Digikam from the KDE project.
  7945. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  7946. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  7947. brightness distribution, so you may want to use both filters together in certain
  7948. cases, though you will have to take care of ordering, i.e. whether vignetting should
  7949. be applied before or after lens correction.
  7950. @subsection Options
  7951. The filter accepts the following options:
  7952. @table @option
  7953. @item cx
  7954. Relative x-coordinate of the focal point of the image, and thereby the center of the
  7955. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7956. width.
  7957. @item cy
  7958. Relative y-coordinate of the focal point of the image, and thereby the center of the
  7959. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7960. height.
  7961. @item k1
  7962. Coefficient of the quadratic correction term. 0.5 means no correction.
  7963. @item k2
  7964. Coefficient of the double quadratic correction term. 0.5 means no correction.
  7965. @end table
  7966. The formula that generates the correction is:
  7967. @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)
  7968. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  7969. distances from the focal point in the source and target images, respectively.
  7970. @section libvmaf
  7971. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  7972. score between two input videos.
  7973. The obtained VMAF score is printed through the logging system.
  7974. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  7975. After installing the library it can be enabled using:
  7976. @code{./configure --enable-libvmaf}.
  7977. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  7978. The filter has following options:
  7979. @table @option
  7980. @item model_path
  7981. Set the model path which is to be used for SVM.
  7982. Default value: @code{"vmaf_v0.6.1.pkl"}
  7983. @item log_path
  7984. Set the file path to be used to store logs.
  7985. @item log_fmt
  7986. Set the format of the log file (xml or json).
  7987. @item enable_transform
  7988. Enables transform for computing vmaf.
  7989. @item phone_model
  7990. Invokes the phone model which will generate VMAF scores higher than in the
  7991. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  7992. @item psnr
  7993. Enables computing psnr along with vmaf.
  7994. @item ssim
  7995. Enables computing ssim along with vmaf.
  7996. @item ms_ssim
  7997. Enables computing ms_ssim along with vmaf.
  7998. @item pool
  7999. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  8000. @end table
  8001. This filter also supports the @ref{framesync} options.
  8002. On the below examples the input file @file{main.mpg} being processed is
  8003. compared with the reference file @file{ref.mpg}.
  8004. @example
  8005. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  8006. @end example
  8007. Example with options:
  8008. @example
  8009. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
  8010. @end example
  8011. @section limiter
  8012. Limits the pixel components values to the specified range [min, max].
  8013. The filter accepts the following options:
  8014. @table @option
  8015. @item min
  8016. Lower bound. Defaults to the lowest allowed value for the input.
  8017. @item max
  8018. Upper bound. Defaults to the highest allowed value for the input.
  8019. @item planes
  8020. Specify which planes will be processed. Defaults to all available.
  8021. @end table
  8022. @section loop
  8023. Loop video frames.
  8024. The filter accepts the following options:
  8025. @table @option
  8026. @item loop
  8027. Set the number of loops. Setting this value to -1 will result in infinite loops.
  8028. Default is 0.
  8029. @item size
  8030. Set maximal size in number of frames. Default is 0.
  8031. @item start
  8032. Set first frame of loop. Default is 0.
  8033. @end table
  8034. @anchor{lut3d}
  8035. @section lut3d
  8036. Apply a 3D LUT to an input video.
  8037. The filter accepts the following options:
  8038. @table @option
  8039. @item file
  8040. Set the 3D LUT file name.
  8041. Currently supported formats:
  8042. @table @samp
  8043. @item 3dl
  8044. AfterEffects
  8045. @item cube
  8046. Iridas
  8047. @item dat
  8048. DaVinci
  8049. @item m3d
  8050. Pandora
  8051. @end table
  8052. @item interp
  8053. Select interpolation mode.
  8054. Available values are:
  8055. @table @samp
  8056. @item nearest
  8057. Use values from the nearest defined point.
  8058. @item trilinear
  8059. Interpolate values using the 8 points defining a cube.
  8060. @item tetrahedral
  8061. Interpolate values using a tetrahedron.
  8062. @end table
  8063. @end table
  8064. This filter also supports the @ref{framesync} options.
  8065. @section lumakey
  8066. Turn certain luma values into transparency.
  8067. The filter accepts the following options:
  8068. @table @option
  8069. @item threshold
  8070. Set the luma which will be used as base for transparency.
  8071. Default value is @code{0}.
  8072. @item tolerance
  8073. Set the range of luma values to be keyed out.
  8074. Default value is @code{0}.
  8075. @item softness
  8076. Set the range of softness. Default value is @code{0}.
  8077. Use this to control gradual transition from zero to full transparency.
  8078. @end table
  8079. @section lut, lutrgb, lutyuv
  8080. Compute a look-up table for binding each pixel component input value
  8081. to an output value, and apply it to the input video.
  8082. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  8083. to an RGB input video.
  8084. These filters accept the following parameters:
  8085. @table @option
  8086. @item c0
  8087. set first pixel component expression
  8088. @item c1
  8089. set second pixel component expression
  8090. @item c2
  8091. set third pixel component expression
  8092. @item c3
  8093. set fourth pixel component expression, corresponds to the alpha component
  8094. @item r
  8095. set red component expression
  8096. @item g
  8097. set green component expression
  8098. @item b
  8099. set blue component expression
  8100. @item a
  8101. alpha component expression
  8102. @item y
  8103. set Y/luminance component expression
  8104. @item u
  8105. set U/Cb component expression
  8106. @item v
  8107. set V/Cr component expression
  8108. @end table
  8109. Each of them specifies the expression to use for computing the lookup table for
  8110. the corresponding pixel component values.
  8111. The exact component associated to each of the @var{c*} options depends on the
  8112. format in input.
  8113. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  8114. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  8115. The expressions can contain the following constants and functions:
  8116. @table @option
  8117. @item w
  8118. @item h
  8119. The input width and height.
  8120. @item val
  8121. The input value for the pixel component.
  8122. @item clipval
  8123. The input value, clipped to the @var{minval}-@var{maxval} range.
  8124. @item maxval
  8125. The maximum value for the pixel component.
  8126. @item minval
  8127. The minimum value for the pixel component.
  8128. @item negval
  8129. The negated value for the pixel component value, clipped to the
  8130. @var{minval}-@var{maxval} range; it corresponds to the expression
  8131. "maxval-clipval+minval".
  8132. @item clip(val)
  8133. The computed value in @var{val}, clipped to the
  8134. @var{minval}-@var{maxval} range.
  8135. @item gammaval(gamma)
  8136. The computed gamma correction value of the pixel component value,
  8137. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  8138. expression
  8139. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  8140. @end table
  8141. All expressions default to "val".
  8142. @subsection Examples
  8143. @itemize
  8144. @item
  8145. Negate input video:
  8146. @example
  8147. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  8148. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  8149. @end example
  8150. The above is the same as:
  8151. @example
  8152. lutrgb="r=negval:g=negval:b=negval"
  8153. lutyuv="y=negval:u=negval:v=negval"
  8154. @end example
  8155. @item
  8156. Negate luminance:
  8157. @example
  8158. lutyuv=y=negval
  8159. @end example
  8160. @item
  8161. Remove chroma components, turning the video into a graytone image:
  8162. @example
  8163. lutyuv="u=128:v=128"
  8164. @end example
  8165. @item
  8166. Apply a luma burning effect:
  8167. @example
  8168. lutyuv="y=2*val"
  8169. @end example
  8170. @item
  8171. Remove green and blue components:
  8172. @example
  8173. lutrgb="g=0:b=0"
  8174. @end example
  8175. @item
  8176. Set a constant alpha channel value on input:
  8177. @example
  8178. format=rgba,lutrgb=a="maxval-minval/2"
  8179. @end example
  8180. @item
  8181. Correct luminance gamma by a factor of 0.5:
  8182. @example
  8183. lutyuv=y=gammaval(0.5)
  8184. @end example
  8185. @item
  8186. Discard least significant bits of luma:
  8187. @example
  8188. lutyuv=y='bitand(val, 128+64+32)'
  8189. @end example
  8190. @item
  8191. Technicolor like effect:
  8192. @example
  8193. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  8194. @end example
  8195. @end itemize
  8196. @section lut2, tlut2
  8197. The @code{lut2} filter takes two input streams and outputs one
  8198. stream.
  8199. The @code{tlut2} (time lut2) filter takes two consecutive frames
  8200. from one single stream.
  8201. This filter accepts the following parameters:
  8202. @table @option
  8203. @item c0
  8204. set first pixel component expression
  8205. @item c1
  8206. set second pixel component expression
  8207. @item c2
  8208. set third pixel component expression
  8209. @item c3
  8210. set fourth pixel component expression, corresponds to the alpha component
  8211. @end table
  8212. Each of them specifies the expression to use for computing the lookup table for
  8213. the corresponding pixel component values.
  8214. The exact component associated to each of the @var{c*} options depends on the
  8215. format in inputs.
  8216. The expressions can contain the following constants:
  8217. @table @option
  8218. @item w
  8219. @item h
  8220. The input width and height.
  8221. @item x
  8222. The first input value for the pixel component.
  8223. @item y
  8224. The second input value for the pixel component.
  8225. @item bdx
  8226. The first input video bit depth.
  8227. @item bdy
  8228. The second input video bit depth.
  8229. @end table
  8230. All expressions default to "x".
  8231. @subsection Examples
  8232. @itemize
  8233. @item
  8234. Highlight differences between two RGB video streams:
  8235. @example
  8236. 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)'
  8237. @end example
  8238. @item
  8239. Highlight differences between two YUV video streams:
  8240. @example
  8241. 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)'
  8242. @end example
  8243. @item
  8244. Show max difference between two video streams:
  8245. @example
  8246. 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)))'
  8247. @end example
  8248. @end itemize
  8249. @section maskedclamp
  8250. Clamp the first input stream with the second input and third input stream.
  8251. Returns the value of first stream to be between second input
  8252. stream - @code{undershoot} and third input stream + @code{overshoot}.
  8253. This filter accepts the following options:
  8254. @table @option
  8255. @item undershoot
  8256. Default value is @code{0}.
  8257. @item overshoot
  8258. Default value is @code{0}.
  8259. @item planes
  8260. Set which planes will be processed as bitmap, unprocessed planes will be
  8261. copied from first stream.
  8262. By default value 0xf, all planes will be processed.
  8263. @end table
  8264. @section maskedmerge
  8265. Merge the first input stream with the second input stream using per pixel
  8266. weights in the third input stream.
  8267. A value of 0 in the third stream pixel component means that pixel component
  8268. from first stream is returned unchanged, while maximum value (eg. 255 for
  8269. 8-bit videos) means that pixel component from second stream is returned
  8270. unchanged. Intermediate values define the amount of merging between both
  8271. input stream's pixel components.
  8272. This filter accepts the following options:
  8273. @table @option
  8274. @item planes
  8275. Set which planes will be processed as bitmap, unprocessed planes will be
  8276. copied from first stream.
  8277. By default value 0xf, all planes will be processed.
  8278. @end table
  8279. @section mcdeint
  8280. Apply motion-compensation deinterlacing.
  8281. It needs one field per frame as input and must thus be used together
  8282. with yadif=1/3 or equivalent.
  8283. This filter accepts the following options:
  8284. @table @option
  8285. @item mode
  8286. Set the deinterlacing mode.
  8287. It accepts one of the following values:
  8288. @table @samp
  8289. @item fast
  8290. @item medium
  8291. @item slow
  8292. use iterative motion estimation
  8293. @item extra_slow
  8294. like @samp{slow}, but use multiple reference frames.
  8295. @end table
  8296. Default value is @samp{fast}.
  8297. @item parity
  8298. Set the picture field parity assumed for the input video. It must be
  8299. one of the following values:
  8300. @table @samp
  8301. @item 0, tff
  8302. assume top field first
  8303. @item 1, bff
  8304. assume bottom field first
  8305. @end table
  8306. Default value is @samp{bff}.
  8307. @item qp
  8308. Set per-block quantization parameter (QP) used by the internal
  8309. encoder.
  8310. Higher values should result in a smoother motion vector field but less
  8311. optimal individual vectors. Default value is 1.
  8312. @end table
  8313. @section mergeplanes
  8314. Merge color channel components from several video streams.
  8315. The filter accepts up to 4 input streams, and merge selected input
  8316. planes to the output video.
  8317. This filter accepts the following options:
  8318. @table @option
  8319. @item mapping
  8320. Set input to output plane mapping. Default is @code{0}.
  8321. The mappings is specified as a bitmap. It should be specified as a
  8322. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  8323. mapping for the first plane of the output stream. 'A' sets the number of
  8324. the input stream to use (from 0 to 3), and 'a' the plane number of the
  8325. corresponding input to use (from 0 to 3). The rest of the mappings is
  8326. similar, 'Bb' describes the mapping for the output stream second
  8327. plane, 'Cc' describes the mapping for the output stream third plane and
  8328. 'Dd' describes the mapping for the output stream fourth plane.
  8329. @item format
  8330. Set output pixel format. Default is @code{yuva444p}.
  8331. @end table
  8332. @subsection Examples
  8333. @itemize
  8334. @item
  8335. Merge three gray video streams of same width and height into single video stream:
  8336. @example
  8337. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  8338. @end example
  8339. @item
  8340. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  8341. @example
  8342. [a0][a1]mergeplanes=0x00010210:yuva444p
  8343. @end example
  8344. @item
  8345. Swap Y and A plane in yuva444p stream:
  8346. @example
  8347. format=yuva444p,mergeplanes=0x03010200:yuva444p
  8348. @end example
  8349. @item
  8350. Swap U and V plane in yuv420p stream:
  8351. @example
  8352. format=yuv420p,mergeplanes=0x000201:yuv420p
  8353. @end example
  8354. @item
  8355. Cast a rgb24 clip to yuv444p:
  8356. @example
  8357. format=rgb24,mergeplanes=0x000102:yuv444p
  8358. @end example
  8359. @end itemize
  8360. @section mestimate
  8361. Estimate and export motion vectors using block matching algorithms.
  8362. Motion vectors are stored in frame side data to be used by other filters.
  8363. This filter accepts the following options:
  8364. @table @option
  8365. @item method
  8366. Specify the motion estimation method. Accepts one of the following values:
  8367. @table @samp
  8368. @item esa
  8369. Exhaustive search algorithm.
  8370. @item tss
  8371. Three step search algorithm.
  8372. @item tdls
  8373. Two dimensional logarithmic search algorithm.
  8374. @item ntss
  8375. New three step search algorithm.
  8376. @item fss
  8377. Four step search algorithm.
  8378. @item ds
  8379. Diamond search algorithm.
  8380. @item hexbs
  8381. Hexagon-based search algorithm.
  8382. @item epzs
  8383. Enhanced predictive zonal search algorithm.
  8384. @item umh
  8385. Uneven multi-hexagon search algorithm.
  8386. @end table
  8387. Default value is @samp{esa}.
  8388. @item mb_size
  8389. Macroblock size. Default @code{16}.
  8390. @item search_param
  8391. Search parameter. Default @code{7}.
  8392. @end table
  8393. @section midequalizer
  8394. Apply Midway Image Equalization effect using two video streams.
  8395. Midway Image Equalization adjusts a pair of images to have the same
  8396. histogram, while maintaining their dynamics as much as possible. It's
  8397. useful for e.g. matching exposures from a pair of stereo cameras.
  8398. This filter has two inputs and one output, which must be of same pixel format, but
  8399. may be of different sizes. The output of filter is first input adjusted with
  8400. midway histogram of both inputs.
  8401. This filter accepts the following option:
  8402. @table @option
  8403. @item planes
  8404. Set which planes to process. Default is @code{15}, which is all available planes.
  8405. @end table
  8406. @section minterpolate
  8407. Convert the video to specified frame rate using motion interpolation.
  8408. This filter accepts the following options:
  8409. @table @option
  8410. @item fps
  8411. 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}.
  8412. @item mi_mode
  8413. Motion interpolation mode. Following values are accepted:
  8414. @table @samp
  8415. @item dup
  8416. Duplicate previous or next frame for interpolating new ones.
  8417. @item blend
  8418. Blend source frames. Interpolated frame is mean of previous and next frames.
  8419. @item mci
  8420. Motion compensated interpolation. Following options are effective when this mode is selected:
  8421. @table @samp
  8422. @item mc_mode
  8423. Motion compensation mode. Following values are accepted:
  8424. @table @samp
  8425. @item obmc
  8426. Overlapped block motion compensation.
  8427. @item aobmc
  8428. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  8429. @end table
  8430. Default mode is @samp{obmc}.
  8431. @item me_mode
  8432. Motion estimation mode. Following values are accepted:
  8433. @table @samp
  8434. @item bidir
  8435. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  8436. @item bilat
  8437. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  8438. @end table
  8439. Default mode is @samp{bilat}.
  8440. @item me
  8441. The algorithm to be used for motion estimation. Following values are accepted:
  8442. @table @samp
  8443. @item esa
  8444. Exhaustive search algorithm.
  8445. @item tss
  8446. Three step search algorithm.
  8447. @item tdls
  8448. Two dimensional logarithmic search algorithm.
  8449. @item ntss
  8450. New three step search algorithm.
  8451. @item fss
  8452. Four step search algorithm.
  8453. @item ds
  8454. Diamond search algorithm.
  8455. @item hexbs
  8456. Hexagon-based search algorithm.
  8457. @item epzs
  8458. Enhanced predictive zonal search algorithm.
  8459. @item umh
  8460. Uneven multi-hexagon search algorithm.
  8461. @end table
  8462. Default algorithm is @samp{epzs}.
  8463. @item mb_size
  8464. Macroblock size. Default @code{16}.
  8465. @item search_param
  8466. Motion estimation search parameter. Default @code{32}.
  8467. @item vsbmc
  8468. 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).
  8469. @end table
  8470. @end table
  8471. @item scd
  8472. 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:
  8473. @table @samp
  8474. @item none
  8475. Disable scene change detection.
  8476. @item fdiff
  8477. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  8478. @end table
  8479. Default method is @samp{fdiff}.
  8480. @item scd_threshold
  8481. Scene change detection threshold. Default is @code{5.0}.
  8482. @end table
  8483. @section mix
  8484. Mix several video input streams into one video stream.
  8485. A description of the accepted options follows.
  8486. @table @option
  8487. @item nb_inputs
  8488. The number of inputs. If unspecified, it defaults to 2.
  8489. @item weights
  8490. Specify weight of each input video stream as sequence.
  8491. Each weight is separated by space.
  8492. @item duration
  8493. Specify how end of stream is determined.
  8494. @table @samp
  8495. @item longest
  8496. The duration of the longest input. (default)
  8497. @item shortest
  8498. The duration of the shortest input.
  8499. @item first
  8500. The duration of the first input.
  8501. @end table
  8502. @end table
  8503. @section mpdecimate
  8504. Drop frames that do not differ greatly from the previous frame in
  8505. order to reduce frame rate.
  8506. The main use of this filter is for very-low-bitrate encoding
  8507. (e.g. streaming over dialup modem), but it could in theory be used for
  8508. fixing movies that were inverse-telecined incorrectly.
  8509. A description of the accepted options follows.
  8510. @table @option
  8511. @item max
  8512. Set the maximum number of consecutive frames which can be dropped (if
  8513. positive), or the minimum interval between dropped frames (if
  8514. negative). If the value is 0, the frame is dropped disregarding the
  8515. number of previous sequentially dropped frames.
  8516. Default value is 0.
  8517. @item hi
  8518. @item lo
  8519. @item frac
  8520. Set the dropping threshold values.
  8521. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  8522. represent actual pixel value differences, so a threshold of 64
  8523. corresponds to 1 unit of difference for each pixel, or the same spread
  8524. out differently over the block.
  8525. A frame is a candidate for dropping if no 8x8 blocks differ by more
  8526. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  8527. meaning the whole image) differ by more than a threshold of @option{lo}.
  8528. Default value for @option{hi} is 64*12, default value for @option{lo} is
  8529. 64*5, and default value for @option{frac} is 0.33.
  8530. @end table
  8531. @section negate
  8532. Negate input video.
  8533. It accepts an integer in input; if non-zero it negates the
  8534. alpha component (if available). The default value in input is 0.
  8535. @section nlmeans
  8536. Denoise frames using Non-Local Means algorithm.
  8537. Each pixel is adjusted by looking for other pixels with similar contexts. This
  8538. context similarity is defined by comparing their surrounding patches of size
  8539. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  8540. around the pixel.
  8541. Note that the research area defines centers for patches, which means some
  8542. patches will be made of pixels outside that research area.
  8543. The filter accepts the following options.
  8544. @table @option
  8545. @item s
  8546. Set denoising strength.
  8547. @item p
  8548. Set patch size.
  8549. @item pc
  8550. Same as @option{p} but for chroma planes.
  8551. The default value is @var{0} and means automatic.
  8552. @item r
  8553. Set research size.
  8554. @item rc
  8555. Same as @option{r} but for chroma planes.
  8556. The default value is @var{0} and means automatic.
  8557. @end table
  8558. @section nnedi
  8559. Deinterlace video using neural network edge directed interpolation.
  8560. This filter accepts the following options:
  8561. @table @option
  8562. @item weights
  8563. Mandatory option, without binary file filter can not work.
  8564. Currently file can be found here:
  8565. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  8566. @item deint
  8567. Set which frames to deinterlace, by default it is @code{all}.
  8568. Can be @code{all} or @code{interlaced}.
  8569. @item field
  8570. Set mode of operation.
  8571. Can be one of the following:
  8572. @table @samp
  8573. @item af
  8574. Use frame flags, both fields.
  8575. @item a
  8576. Use frame flags, single field.
  8577. @item t
  8578. Use top field only.
  8579. @item b
  8580. Use bottom field only.
  8581. @item tf
  8582. Use both fields, top first.
  8583. @item bf
  8584. Use both fields, bottom first.
  8585. @end table
  8586. @item planes
  8587. Set which planes to process, by default filter process all frames.
  8588. @item nsize
  8589. Set size of local neighborhood around each pixel, used by the predictor neural
  8590. network.
  8591. Can be one of the following:
  8592. @table @samp
  8593. @item s8x6
  8594. @item s16x6
  8595. @item s32x6
  8596. @item s48x6
  8597. @item s8x4
  8598. @item s16x4
  8599. @item s32x4
  8600. @end table
  8601. @item nns
  8602. Set the number of neurons in predictor neural network.
  8603. Can be one of the following:
  8604. @table @samp
  8605. @item n16
  8606. @item n32
  8607. @item n64
  8608. @item n128
  8609. @item n256
  8610. @end table
  8611. @item qual
  8612. Controls the number of different neural network predictions that are blended
  8613. together to compute the final output value. Can be @code{fast}, default or
  8614. @code{slow}.
  8615. @item etype
  8616. Set which set of weights to use in the predictor.
  8617. Can be one of the following:
  8618. @table @samp
  8619. @item a
  8620. weights trained to minimize absolute error
  8621. @item s
  8622. weights trained to minimize squared error
  8623. @end table
  8624. @item pscrn
  8625. Controls whether or not the prescreener neural network is used to decide
  8626. which pixels should be processed by the predictor neural network and which
  8627. can be handled by simple cubic interpolation.
  8628. The prescreener is trained to know whether cubic interpolation will be
  8629. sufficient for a pixel or whether it should be predicted by the predictor nn.
  8630. The computational complexity of the prescreener nn is much less than that of
  8631. the predictor nn. Since most pixels can be handled by cubic interpolation,
  8632. using the prescreener generally results in much faster processing.
  8633. The prescreener is pretty accurate, so the difference between using it and not
  8634. using it is almost always unnoticeable.
  8635. Can be one of the following:
  8636. @table @samp
  8637. @item none
  8638. @item original
  8639. @item new
  8640. @end table
  8641. Default is @code{new}.
  8642. @item fapprox
  8643. Set various debugging flags.
  8644. @end table
  8645. @section noformat
  8646. Force libavfilter not to use any of the specified pixel formats for the
  8647. input to the next filter.
  8648. It accepts the following parameters:
  8649. @table @option
  8650. @item pix_fmts
  8651. A '|'-separated list of pixel format names, such as
  8652. pix_fmts=yuv420p|monow|rgb24".
  8653. @end table
  8654. @subsection Examples
  8655. @itemize
  8656. @item
  8657. Force libavfilter to use a format different from @var{yuv420p} for the
  8658. input to the vflip filter:
  8659. @example
  8660. noformat=pix_fmts=yuv420p,vflip
  8661. @end example
  8662. @item
  8663. Convert the input video to any of the formats not contained in the list:
  8664. @example
  8665. noformat=yuv420p|yuv444p|yuv410p
  8666. @end example
  8667. @end itemize
  8668. @section noise
  8669. Add noise on video input frame.
  8670. The filter accepts the following options:
  8671. @table @option
  8672. @item all_seed
  8673. @item c0_seed
  8674. @item c1_seed
  8675. @item c2_seed
  8676. @item c3_seed
  8677. Set noise seed for specific pixel component or all pixel components in case
  8678. of @var{all_seed}. Default value is @code{123457}.
  8679. @item all_strength, alls
  8680. @item c0_strength, c0s
  8681. @item c1_strength, c1s
  8682. @item c2_strength, c2s
  8683. @item c3_strength, c3s
  8684. Set noise strength for specific pixel component or all pixel components in case
  8685. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  8686. @item all_flags, allf
  8687. @item c0_flags, c0f
  8688. @item c1_flags, c1f
  8689. @item c2_flags, c2f
  8690. @item c3_flags, c3f
  8691. Set pixel component flags or set flags for all components if @var{all_flags}.
  8692. Available values for component flags are:
  8693. @table @samp
  8694. @item a
  8695. averaged temporal noise (smoother)
  8696. @item p
  8697. mix random noise with a (semi)regular pattern
  8698. @item t
  8699. temporal noise (noise pattern changes between frames)
  8700. @item u
  8701. uniform noise (gaussian otherwise)
  8702. @end table
  8703. @end table
  8704. @subsection Examples
  8705. Add temporal and uniform noise to input video:
  8706. @example
  8707. noise=alls=20:allf=t+u
  8708. @end example
  8709. @section normalize
  8710. Normalize RGB video (aka histogram stretching, contrast stretching).
  8711. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  8712. For each channel of each frame, the filter computes the input range and maps
  8713. it linearly to the user-specified output range. The output range defaults
  8714. to the full dynamic range from pure black to pure white.
  8715. Temporal smoothing can be used on the input range to reduce flickering (rapid
  8716. changes in brightness) caused when small dark or bright objects enter or leave
  8717. the scene. This is similar to the auto-exposure (automatic gain control) on a
  8718. video camera, and, like a video camera, it may cause a period of over- or
  8719. under-exposure of the video.
  8720. The R,G,B channels can be normalized independently, which may cause some
  8721. color shifting, or linked together as a single channel, which prevents
  8722. color shifting. Linked normalization preserves hue. Independent normalization
  8723. does not, so it can be used to remove some color casts. Independent and linked
  8724. normalization can be combined in any ratio.
  8725. The normalize filter accepts the following options:
  8726. @table @option
  8727. @item blackpt
  8728. @item whitept
  8729. Colors which define the output range. The minimum input value is mapped to
  8730. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  8731. The defaults are black and white respectively. Specifying white for
  8732. @var{blackpt} and black for @var{whitept} will give color-inverted,
  8733. normalized video. Shades of grey can be used to reduce the dynamic range
  8734. (contrast). Specifying saturated colors here can create some interesting
  8735. effects.
  8736. @item smoothing
  8737. The number of previous frames to use for temporal smoothing. The input range
  8738. of each channel is smoothed using a rolling average over the current frame
  8739. and the @var{smoothing} previous frames. The default is 0 (no temporal
  8740. smoothing).
  8741. @item independence
  8742. Controls the ratio of independent (color shifting) channel normalization to
  8743. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  8744. independent. Defaults to 1.0 (fully independent).
  8745. @item strength
  8746. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  8747. expensive no-op. Defaults to 1.0 (full strength).
  8748. @end table
  8749. @subsection Examples
  8750. Stretch video contrast to use the full dynamic range, with no temporal
  8751. smoothing; may flicker depending on the source content:
  8752. @example
  8753. normalize=blackpt=black:whitept=white:smoothing=0
  8754. @end example
  8755. As above, but with 50 frames of temporal smoothing; flicker should be
  8756. reduced, depending on the source content:
  8757. @example
  8758. normalize=blackpt=black:whitept=white:smoothing=50
  8759. @end example
  8760. As above, but with hue-preserving linked channel normalization:
  8761. @example
  8762. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  8763. @end example
  8764. As above, but with half strength:
  8765. @example
  8766. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  8767. @end example
  8768. Map the darkest input color to red, the brightest input color to cyan:
  8769. @example
  8770. normalize=blackpt=red:whitept=cyan
  8771. @end example
  8772. @section null
  8773. Pass the video source unchanged to the output.
  8774. @section ocr
  8775. Optical Character Recognition
  8776. This filter uses Tesseract for optical character recognition.
  8777. It accepts the following options:
  8778. @table @option
  8779. @item datapath
  8780. Set datapath to tesseract data. Default is to use whatever was
  8781. set at installation.
  8782. @item language
  8783. Set language, default is "eng".
  8784. @item whitelist
  8785. Set character whitelist.
  8786. @item blacklist
  8787. Set character blacklist.
  8788. @end table
  8789. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  8790. @section ocv
  8791. Apply a video transform using libopencv.
  8792. To enable this filter, install the libopencv library and headers and
  8793. configure FFmpeg with @code{--enable-libopencv}.
  8794. It accepts the following parameters:
  8795. @table @option
  8796. @item filter_name
  8797. The name of the libopencv filter to apply.
  8798. @item filter_params
  8799. The parameters to pass to the libopencv filter. If not specified, the default
  8800. values are assumed.
  8801. @end table
  8802. Refer to the official libopencv documentation for more precise
  8803. information:
  8804. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  8805. Several libopencv filters are supported; see the following subsections.
  8806. @anchor{dilate}
  8807. @subsection dilate
  8808. Dilate an image by using a specific structuring element.
  8809. It corresponds to the libopencv function @code{cvDilate}.
  8810. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  8811. @var{struct_el} represents a structuring element, and has the syntax:
  8812. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  8813. @var{cols} and @var{rows} represent the number of columns and rows of
  8814. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  8815. point, and @var{shape} the shape for the structuring element. @var{shape}
  8816. must be "rect", "cross", "ellipse", or "custom".
  8817. If the value for @var{shape} is "custom", it must be followed by a
  8818. string of the form "=@var{filename}". The file with name
  8819. @var{filename} is assumed to represent a binary image, with each
  8820. printable character corresponding to a bright pixel. When a custom
  8821. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  8822. or columns and rows of the read file are assumed instead.
  8823. The default value for @var{struct_el} is "3x3+0x0/rect".
  8824. @var{nb_iterations} specifies the number of times the transform is
  8825. applied to the image, and defaults to 1.
  8826. Some examples:
  8827. @example
  8828. # Use the default values
  8829. ocv=dilate
  8830. # Dilate using a structuring element with a 5x5 cross, iterating two times
  8831. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  8832. # Read the shape from the file diamond.shape, iterating two times.
  8833. # The file diamond.shape may contain a pattern of characters like this
  8834. # *
  8835. # ***
  8836. # *****
  8837. # ***
  8838. # *
  8839. # The specified columns and rows are ignored
  8840. # but the anchor point coordinates are not
  8841. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  8842. @end example
  8843. @subsection erode
  8844. Erode an image by using a specific structuring element.
  8845. It corresponds to the libopencv function @code{cvErode}.
  8846. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  8847. with the same syntax and semantics as the @ref{dilate} filter.
  8848. @subsection smooth
  8849. Smooth the input video.
  8850. The filter takes the following parameters:
  8851. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  8852. @var{type} is the type of smooth filter to apply, and must be one of
  8853. the following values: "blur", "blur_no_scale", "median", "gaussian",
  8854. or "bilateral". The default value is "gaussian".
  8855. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  8856. depend on the smooth type. @var{param1} and
  8857. @var{param2} accept integer positive values or 0. @var{param3} and
  8858. @var{param4} accept floating point values.
  8859. The default value for @var{param1} is 3. The default value for the
  8860. other parameters is 0.
  8861. These parameters correspond to the parameters assigned to the
  8862. libopencv function @code{cvSmooth}.
  8863. @section oscilloscope
  8864. 2D Video Oscilloscope.
  8865. Useful to measure spatial impulse, step responses, chroma delays, etc.
  8866. It accepts the following parameters:
  8867. @table @option
  8868. @item x
  8869. Set scope center x position.
  8870. @item y
  8871. Set scope center y position.
  8872. @item s
  8873. Set scope size, relative to frame diagonal.
  8874. @item t
  8875. Set scope tilt/rotation.
  8876. @item o
  8877. Set trace opacity.
  8878. @item tx
  8879. Set trace center x position.
  8880. @item ty
  8881. Set trace center y position.
  8882. @item tw
  8883. Set trace width, relative to width of frame.
  8884. @item th
  8885. Set trace height, relative to height of frame.
  8886. @item c
  8887. Set which components to trace. By default it traces first three components.
  8888. @item g
  8889. Draw trace grid. By default is enabled.
  8890. @item st
  8891. Draw some statistics. By default is enabled.
  8892. @item sc
  8893. Draw scope. By default is enabled.
  8894. @end table
  8895. @subsection Examples
  8896. @itemize
  8897. @item
  8898. Inspect full first row of video frame.
  8899. @example
  8900. oscilloscope=x=0.5:y=0:s=1
  8901. @end example
  8902. @item
  8903. Inspect full last row of video frame.
  8904. @example
  8905. oscilloscope=x=0.5:y=1:s=1
  8906. @end example
  8907. @item
  8908. Inspect full 5th line of video frame of height 1080.
  8909. @example
  8910. oscilloscope=x=0.5:y=5/1080:s=1
  8911. @end example
  8912. @item
  8913. Inspect full last column of video frame.
  8914. @example
  8915. oscilloscope=x=1:y=0.5:s=1:t=1
  8916. @end example
  8917. @end itemize
  8918. @anchor{overlay}
  8919. @section overlay
  8920. Overlay one video on top of another.
  8921. It takes two inputs and has one output. The first input is the "main"
  8922. video on which the second input is overlaid.
  8923. It accepts the following parameters:
  8924. A description of the accepted options follows.
  8925. @table @option
  8926. @item x
  8927. @item y
  8928. Set the expression for the x and y coordinates of the overlaid video
  8929. on the main video. Default value is "0" for both expressions. In case
  8930. the expression is invalid, it is set to a huge value (meaning that the
  8931. overlay will not be displayed within the output visible area).
  8932. @item eof_action
  8933. See @ref{framesync}.
  8934. @item eval
  8935. Set when the expressions for @option{x}, and @option{y} are evaluated.
  8936. It accepts the following values:
  8937. @table @samp
  8938. @item init
  8939. only evaluate expressions once during the filter initialization or
  8940. when a command is processed
  8941. @item frame
  8942. evaluate expressions for each incoming frame
  8943. @end table
  8944. Default value is @samp{frame}.
  8945. @item shortest
  8946. See @ref{framesync}.
  8947. @item format
  8948. Set the format for the output video.
  8949. It accepts the following values:
  8950. @table @samp
  8951. @item yuv420
  8952. force YUV420 output
  8953. @item yuv422
  8954. force YUV422 output
  8955. @item yuv444
  8956. force YUV444 output
  8957. @item rgb
  8958. force packed RGB output
  8959. @item gbrp
  8960. force planar RGB output
  8961. @item auto
  8962. automatically pick format
  8963. @end table
  8964. Default value is @samp{yuv420}.
  8965. @item repeatlast
  8966. See @ref{framesync}.
  8967. @item alpha
  8968. Set format of alpha of the overlaid video, it can be @var{straight} or
  8969. @var{premultiplied}. Default is @var{straight}.
  8970. @end table
  8971. The @option{x}, and @option{y} expressions can contain the following
  8972. parameters.
  8973. @table @option
  8974. @item main_w, W
  8975. @item main_h, H
  8976. The main input width and height.
  8977. @item overlay_w, w
  8978. @item overlay_h, h
  8979. The overlay input width and height.
  8980. @item x
  8981. @item y
  8982. The computed values for @var{x} and @var{y}. They are evaluated for
  8983. each new frame.
  8984. @item hsub
  8985. @item vsub
  8986. horizontal and vertical chroma subsample values of the output
  8987. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  8988. @var{vsub} is 1.
  8989. @item n
  8990. the number of input frame, starting from 0
  8991. @item pos
  8992. the position in the file of the input frame, NAN if unknown
  8993. @item t
  8994. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  8995. @end table
  8996. This filter also supports the @ref{framesync} options.
  8997. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  8998. when evaluation is done @emph{per frame}, and will evaluate to NAN
  8999. when @option{eval} is set to @samp{init}.
  9000. Be aware that frames are taken from each input video in timestamp
  9001. order, hence, if their initial timestamps differ, it is a good idea
  9002. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  9003. have them begin in the same zero timestamp, as the example for
  9004. the @var{movie} filter does.
  9005. You can chain together more overlays but you should test the
  9006. efficiency of such approach.
  9007. @subsection Commands
  9008. This filter supports the following commands:
  9009. @table @option
  9010. @item x
  9011. @item y
  9012. Modify the x and y of the overlay input.
  9013. The command accepts the same syntax of the corresponding option.
  9014. If the specified expression is not valid, it is kept at its current
  9015. value.
  9016. @end table
  9017. @subsection Examples
  9018. @itemize
  9019. @item
  9020. Draw the overlay at 10 pixels from the bottom right corner of the main
  9021. video:
  9022. @example
  9023. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  9024. @end example
  9025. Using named options the example above becomes:
  9026. @example
  9027. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  9028. @end example
  9029. @item
  9030. Insert a transparent PNG logo in the bottom left corner of the input,
  9031. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  9032. @example
  9033. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  9034. @end example
  9035. @item
  9036. Insert 2 different transparent PNG logos (second logo on bottom
  9037. right corner) using the @command{ffmpeg} tool:
  9038. @example
  9039. 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
  9040. @end example
  9041. @item
  9042. Add a transparent color layer on top of the main video; @code{WxH}
  9043. must specify the size of the main input to the overlay filter:
  9044. @example
  9045. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  9046. @end example
  9047. @item
  9048. Play an original video and a filtered version (here with the deshake
  9049. filter) side by side using the @command{ffplay} tool:
  9050. @example
  9051. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  9052. @end example
  9053. The above command is the same as:
  9054. @example
  9055. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  9056. @end example
  9057. @item
  9058. Make a sliding overlay appearing from the left to the right top part of the
  9059. screen starting since time 2:
  9060. @example
  9061. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  9062. @end example
  9063. @item
  9064. Compose output by putting two input videos side to side:
  9065. @example
  9066. ffmpeg -i left.avi -i right.avi -filter_complex "
  9067. nullsrc=size=200x100 [background];
  9068. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  9069. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  9070. [background][left] overlay=shortest=1 [background+left];
  9071. [background+left][right] overlay=shortest=1:x=100 [left+right]
  9072. "
  9073. @end example
  9074. @item
  9075. Mask 10-20 seconds of a video by applying the delogo filter to a section
  9076. @example
  9077. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  9078. -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]'
  9079. masked.avi
  9080. @end example
  9081. @item
  9082. Chain several overlays in cascade:
  9083. @example
  9084. nullsrc=s=200x200 [bg];
  9085. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  9086. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  9087. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  9088. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  9089. [in3] null, [mid2] overlay=100:100 [out0]
  9090. @end example
  9091. @end itemize
  9092. @section owdenoise
  9093. Apply Overcomplete Wavelet denoiser.
  9094. The filter accepts the following options:
  9095. @table @option
  9096. @item depth
  9097. Set depth.
  9098. Larger depth values will denoise lower frequency components more, but
  9099. slow down filtering.
  9100. Must be an int in the range 8-16, default is @code{8}.
  9101. @item luma_strength, ls
  9102. Set luma strength.
  9103. Must be a double value in the range 0-1000, default is @code{1.0}.
  9104. @item chroma_strength, cs
  9105. Set chroma strength.
  9106. Must be a double value in the range 0-1000, default is @code{1.0}.
  9107. @end table
  9108. @anchor{pad}
  9109. @section pad
  9110. Add paddings to the input image, and place the original input at the
  9111. provided @var{x}, @var{y} coordinates.
  9112. It accepts the following parameters:
  9113. @table @option
  9114. @item width, w
  9115. @item height, h
  9116. Specify an expression for the size of the output image with the
  9117. paddings added. If the value for @var{width} or @var{height} is 0, the
  9118. corresponding input size is used for the output.
  9119. The @var{width} expression can reference the value set by the
  9120. @var{height} expression, and vice versa.
  9121. The default value of @var{width} and @var{height} is 0.
  9122. @item x
  9123. @item y
  9124. Specify the offsets to place the input image at within the padded area,
  9125. with respect to the top/left border of the output image.
  9126. The @var{x} expression can reference the value set by the @var{y}
  9127. expression, and vice versa.
  9128. The default value of @var{x} and @var{y} is 0.
  9129. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  9130. so the input image is centered on the padded area.
  9131. @item color
  9132. Specify the color of the padded area. For the syntax of this option,
  9133. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  9134. manual,ffmpeg-utils}.
  9135. The default value of @var{color} is "black".
  9136. @item eval
  9137. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  9138. It accepts the following values:
  9139. @table @samp
  9140. @item init
  9141. Only evaluate expressions once during the filter initialization or when
  9142. a command is processed.
  9143. @item frame
  9144. Evaluate expressions for each incoming frame.
  9145. @end table
  9146. Default value is @samp{init}.
  9147. @item aspect
  9148. Pad to aspect instead to a resolution.
  9149. @end table
  9150. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  9151. options are expressions containing the following constants:
  9152. @table @option
  9153. @item in_w
  9154. @item in_h
  9155. The input video width and height.
  9156. @item iw
  9157. @item ih
  9158. These are the same as @var{in_w} and @var{in_h}.
  9159. @item out_w
  9160. @item out_h
  9161. The output width and height (the size of the padded area), as
  9162. specified by the @var{width} and @var{height} expressions.
  9163. @item ow
  9164. @item oh
  9165. These are the same as @var{out_w} and @var{out_h}.
  9166. @item x
  9167. @item y
  9168. The x and y offsets as specified by the @var{x} and @var{y}
  9169. expressions, or NAN if not yet specified.
  9170. @item a
  9171. same as @var{iw} / @var{ih}
  9172. @item sar
  9173. input sample aspect ratio
  9174. @item dar
  9175. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  9176. @item hsub
  9177. @item vsub
  9178. The horizontal and vertical chroma subsample values. For example for the
  9179. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9180. @end table
  9181. @subsection Examples
  9182. @itemize
  9183. @item
  9184. Add paddings with the color "violet" to the input video. The output video
  9185. size is 640x480, and the top-left corner of the input video is placed at
  9186. column 0, row 40
  9187. @example
  9188. pad=640:480:0:40:violet
  9189. @end example
  9190. The example above is equivalent to the following command:
  9191. @example
  9192. pad=width=640:height=480:x=0:y=40:color=violet
  9193. @end example
  9194. @item
  9195. Pad the input to get an output with dimensions increased by 3/2,
  9196. and put the input video at the center of the padded area:
  9197. @example
  9198. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  9199. @end example
  9200. @item
  9201. Pad the input to get a squared output with size equal to the maximum
  9202. value between the input width and height, and put the input video at
  9203. the center of the padded area:
  9204. @example
  9205. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  9206. @end example
  9207. @item
  9208. Pad the input to get a final w/h ratio of 16:9:
  9209. @example
  9210. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  9211. @end example
  9212. @item
  9213. In case of anamorphic video, in order to set the output display aspect
  9214. correctly, it is necessary to use @var{sar} in the expression,
  9215. according to the relation:
  9216. @example
  9217. (ih * X / ih) * sar = output_dar
  9218. X = output_dar / sar
  9219. @end example
  9220. Thus the previous example needs to be modified to:
  9221. @example
  9222. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  9223. @end example
  9224. @item
  9225. Double the output size and put the input video in the bottom-right
  9226. corner of the output padded area:
  9227. @example
  9228. pad="2*iw:2*ih:ow-iw:oh-ih"
  9229. @end example
  9230. @end itemize
  9231. @anchor{palettegen}
  9232. @section palettegen
  9233. Generate one palette for a whole video stream.
  9234. It accepts the following options:
  9235. @table @option
  9236. @item max_colors
  9237. Set the maximum number of colors to quantize in the palette.
  9238. Note: the palette will still contain 256 colors; the unused palette entries
  9239. will be black.
  9240. @item reserve_transparent
  9241. Create a palette of 255 colors maximum and reserve the last one for
  9242. transparency. Reserving the transparency color is useful for GIF optimization.
  9243. If not set, the maximum of colors in the palette will be 256. You probably want
  9244. to disable this option for a standalone image.
  9245. Set by default.
  9246. @item transparency_color
  9247. Set the color that will be used as background for transparency.
  9248. @item stats_mode
  9249. Set statistics mode.
  9250. It accepts the following values:
  9251. @table @samp
  9252. @item full
  9253. Compute full frame histograms.
  9254. @item diff
  9255. Compute histograms only for the part that differs from previous frame. This
  9256. might be relevant to give more importance to the moving part of your input if
  9257. the background is static.
  9258. @item single
  9259. Compute new histogram for each frame.
  9260. @end table
  9261. Default value is @var{full}.
  9262. @end table
  9263. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  9264. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  9265. color quantization of the palette. This information is also visible at
  9266. @var{info} logging level.
  9267. @subsection Examples
  9268. @itemize
  9269. @item
  9270. Generate a representative palette of a given video using @command{ffmpeg}:
  9271. @example
  9272. ffmpeg -i input.mkv -vf palettegen palette.png
  9273. @end example
  9274. @end itemize
  9275. @section paletteuse
  9276. Use a palette to downsample an input video stream.
  9277. The filter takes two inputs: one video stream and a palette. The palette must
  9278. be a 256 pixels image.
  9279. It accepts the following options:
  9280. @table @option
  9281. @item dither
  9282. Select dithering mode. Available algorithms are:
  9283. @table @samp
  9284. @item bayer
  9285. Ordered 8x8 bayer dithering (deterministic)
  9286. @item heckbert
  9287. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  9288. Note: this dithering is sometimes considered "wrong" and is included as a
  9289. reference.
  9290. @item floyd_steinberg
  9291. Floyd and Steingberg dithering (error diffusion)
  9292. @item sierra2
  9293. Frankie Sierra dithering v2 (error diffusion)
  9294. @item sierra2_4a
  9295. Frankie Sierra dithering v2 "Lite" (error diffusion)
  9296. @end table
  9297. Default is @var{sierra2_4a}.
  9298. @item bayer_scale
  9299. When @var{bayer} dithering is selected, this option defines the scale of the
  9300. pattern (how much the crosshatch pattern is visible). A low value means more
  9301. visible pattern for less banding, and higher value means less visible pattern
  9302. at the cost of more banding.
  9303. The option must be an integer value in the range [0,5]. Default is @var{2}.
  9304. @item diff_mode
  9305. If set, define the zone to process
  9306. @table @samp
  9307. @item rectangle
  9308. Only the changing rectangle will be reprocessed. This is similar to GIF
  9309. cropping/offsetting compression mechanism. This option can be useful for speed
  9310. if only a part of the image is changing, and has use cases such as limiting the
  9311. scope of the error diffusal @option{dither} to the rectangle that bounds the
  9312. moving scene (it leads to more deterministic output if the scene doesn't change
  9313. much, and as a result less moving noise and better GIF compression).
  9314. @end table
  9315. Default is @var{none}.
  9316. @item new
  9317. Take new palette for each output frame.
  9318. @item alpha_threshold
  9319. Sets the alpha threshold for transparency. Alpha values above this threshold
  9320. will be treated as completely opaque, and values below this threshold will be
  9321. treated as completely transparent.
  9322. The option must be an integer value in the range [0,255]. Default is @var{128}.
  9323. @end table
  9324. @subsection Examples
  9325. @itemize
  9326. @item
  9327. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  9328. using @command{ffmpeg}:
  9329. @example
  9330. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  9331. @end example
  9332. @end itemize
  9333. @section perspective
  9334. Correct perspective of video not recorded perpendicular to the screen.
  9335. A description of the accepted parameters follows.
  9336. @table @option
  9337. @item x0
  9338. @item y0
  9339. @item x1
  9340. @item y1
  9341. @item x2
  9342. @item y2
  9343. @item x3
  9344. @item y3
  9345. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  9346. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  9347. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  9348. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  9349. then the corners of the source will be sent to the specified coordinates.
  9350. The expressions can use the following variables:
  9351. @table @option
  9352. @item W
  9353. @item H
  9354. the width and height of video frame.
  9355. @item in
  9356. Input frame count.
  9357. @item on
  9358. Output frame count.
  9359. @end table
  9360. @item interpolation
  9361. Set interpolation for perspective correction.
  9362. It accepts the following values:
  9363. @table @samp
  9364. @item linear
  9365. @item cubic
  9366. @end table
  9367. Default value is @samp{linear}.
  9368. @item sense
  9369. Set interpretation of coordinate options.
  9370. It accepts the following values:
  9371. @table @samp
  9372. @item 0, source
  9373. Send point in the source specified by the given coordinates to
  9374. the corners of the destination.
  9375. @item 1, destination
  9376. Send the corners of the source to the point in the destination specified
  9377. by the given coordinates.
  9378. Default value is @samp{source}.
  9379. @end table
  9380. @item eval
  9381. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  9382. It accepts the following values:
  9383. @table @samp
  9384. @item init
  9385. only evaluate expressions once during the filter initialization or
  9386. when a command is processed
  9387. @item frame
  9388. evaluate expressions for each incoming frame
  9389. @end table
  9390. Default value is @samp{init}.
  9391. @end table
  9392. @section phase
  9393. Delay interlaced video by one field time so that the field order changes.
  9394. The intended use is to fix PAL movies that have been captured with the
  9395. opposite field order to the film-to-video transfer.
  9396. A description of the accepted parameters follows.
  9397. @table @option
  9398. @item mode
  9399. Set phase mode.
  9400. It accepts the following values:
  9401. @table @samp
  9402. @item t
  9403. Capture field order top-first, transfer bottom-first.
  9404. Filter will delay the bottom field.
  9405. @item b
  9406. Capture field order bottom-first, transfer top-first.
  9407. Filter will delay the top field.
  9408. @item p
  9409. Capture and transfer with the same field order. This mode only exists
  9410. for the documentation of the other options to refer to, but if you
  9411. actually select it, the filter will faithfully do nothing.
  9412. @item a
  9413. Capture field order determined automatically by field flags, transfer
  9414. opposite.
  9415. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  9416. basis using field flags. If no field information is available,
  9417. then this works just like @samp{u}.
  9418. @item u
  9419. Capture unknown or varying, transfer opposite.
  9420. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  9421. analyzing the images and selecting the alternative that produces best
  9422. match between the fields.
  9423. @item T
  9424. Capture top-first, transfer unknown or varying.
  9425. Filter selects among @samp{t} and @samp{p} using image analysis.
  9426. @item B
  9427. Capture bottom-first, transfer unknown or varying.
  9428. Filter selects among @samp{b} and @samp{p} using image analysis.
  9429. @item A
  9430. Capture determined by field flags, transfer unknown or varying.
  9431. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  9432. image analysis. If no field information is available, then this works just
  9433. like @samp{U}. This is the default mode.
  9434. @item U
  9435. Both capture and transfer unknown or varying.
  9436. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  9437. @end table
  9438. @end table
  9439. @section pixdesctest
  9440. Pixel format descriptor test filter, mainly useful for internal
  9441. testing. The output video should be equal to the input video.
  9442. For example:
  9443. @example
  9444. format=monow, pixdesctest
  9445. @end example
  9446. can be used to test the monowhite pixel format descriptor definition.
  9447. @section pixscope
  9448. Display sample values of color channels. Mainly useful for checking color
  9449. and levels. Minimum supported resolution is 640x480.
  9450. The filters accept the following options:
  9451. @table @option
  9452. @item x
  9453. Set scope X position, relative offset on X axis.
  9454. @item y
  9455. Set scope Y position, relative offset on Y axis.
  9456. @item w
  9457. Set scope width.
  9458. @item h
  9459. Set scope height.
  9460. @item o
  9461. Set window opacity. This window also holds statistics about pixel area.
  9462. @item wx
  9463. Set window X position, relative offset on X axis.
  9464. @item wy
  9465. Set window Y position, relative offset on Y axis.
  9466. @end table
  9467. @section pp
  9468. Enable the specified chain of postprocessing subfilters using libpostproc. This
  9469. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  9470. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  9471. Each subfilter and some options have a short and a long name that can be used
  9472. interchangeably, i.e. dr/dering are the same.
  9473. The filters accept the following options:
  9474. @table @option
  9475. @item subfilters
  9476. Set postprocessing subfilters string.
  9477. @end table
  9478. All subfilters share common options to determine their scope:
  9479. @table @option
  9480. @item a/autoq
  9481. Honor the quality commands for this subfilter.
  9482. @item c/chrom
  9483. Do chrominance filtering, too (default).
  9484. @item y/nochrom
  9485. Do luminance filtering only (no chrominance).
  9486. @item n/noluma
  9487. Do chrominance filtering only (no luminance).
  9488. @end table
  9489. These options can be appended after the subfilter name, separated by a '|'.
  9490. Available subfilters are:
  9491. @table @option
  9492. @item hb/hdeblock[|difference[|flatness]]
  9493. Horizontal deblocking filter
  9494. @table @option
  9495. @item difference
  9496. Difference factor where higher values mean more deblocking (default: @code{32}).
  9497. @item flatness
  9498. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9499. @end table
  9500. @item vb/vdeblock[|difference[|flatness]]
  9501. Vertical deblocking filter
  9502. @table @option
  9503. @item difference
  9504. Difference factor where higher values mean more deblocking (default: @code{32}).
  9505. @item flatness
  9506. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9507. @end table
  9508. @item ha/hadeblock[|difference[|flatness]]
  9509. Accurate horizontal deblocking filter
  9510. @table @option
  9511. @item difference
  9512. Difference factor where higher values mean more deblocking (default: @code{32}).
  9513. @item flatness
  9514. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9515. @end table
  9516. @item va/vadeblock[|difference[|flatness]]
  9517. Accurate vertical deblocking filter
  9518. @table @option
  9519. @item difference
  9520. Difference factor where higher values mean more deblocking (default: @code{32}).
  9521. @item flatness
  9522. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9523. @end table
  9524. @end table
  9525. The horizontal and vertical deblocking filters share the difference and
  9526. flatness values so you cannot set different horizontal and vertical
  9527. thresholds.
  9528. @table @option
  9529. @item h1/x1hdeblock
  9530. Experimental horizontal deblocking filter
  9531. @item v1/x1vdeblock
  9532. Experimental vertical deblocking filter
  9533. @item dr/dering
  9534. Deringing filter
  9535. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  9536. @table @option
  9537. @item threshold1
  9538. larger -> stronger filtering
  9539. @item threshold2
  9540. larger -> stronger filtering
  9541. @item threshold3
  9542. larger -> stronger filtering
  9543. @end table
  9544. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  9545. @table @option
  9546. @item f/fullyrange
  9547. Stretch luminance to @code{0-255}.
  9548. @end table
  9549. @item lb/linblenddeint
  9550. Linear blend deinterlacing filter that deinterlaces the given block by
  9551. filtering all lines with a @code{(1 2 1)} filter.
  9552. @item li/linipoldeint
  9553. Linear interpolating deinterlacing filter that deinterlaces the given block by
  9554. linearly interpolating every second line.
  9555. @item ci/cubicipoldeint
  9556. Cubic interpolating deinterlacing filter deinterlaces the given block by
  9557. cubically interpolating every second line.
  9558. @item md/mediandeint
  9559. Median deinterlacing filter that deinterlaces the given block by applying a
  9560. median filter to every second line.
  9561. @item fd/ffmpegdeint
  9562. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  9563. second line with a @code{(-1 4 2 4 -1)} filter.
  9564. @item l5/lowpass5
  9565. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  9566. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  9567. @item fq/forceQuant[|quantizer]
  9568. Overrides the quantizer table from the input with the constant quantizer you
  9569. specify.
  9570. @table @option
  9571. @item quantizer
  9572. Quantizer to use
  9573. @end table
  9574. @item de/default
  9575. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  9576. @item fa/fast
  9577. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  9578. @item ac
  9579. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  9580. @end table
  9581. @subsection Examples
  9582. @itemize
  9583. @item
  9584. Apply horizontal and vertical deblocking, deringing and automatic
  9585. brightness/contrast:
  9586. @example
  9587. pp=hb/vb/dr/al
  9588. @end example
  9589. @item
  9590. Apply default filters without brightness/contrast correction:
  9591. @example
  9592. pp=de/-al
  9593. @end example
  9594. @item
  9595. Apply default filters and temporal denoiser:
  9596. @example
  9597. pp=default/tmpnoise|1|2|3
  9598. @end example
  9599. @item
  9600. Apply deblocking on luminance only, and switch vertical deblocking on or off
  9601. automatically depending on available CPU time:
  9602. @example
  9603. pp=hb|y/vb|a
  9604. @end example
  9605. @end itemize
  9606. @section pp7
  9607. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  9608. similar to spp = 6 with 7 point DCT, where only the center sample is
  9609. used after IDCT.
  9610. The filter accepts the following options:
  9611. @table @option
  9612. @item qp
  9613. Force a constant quantization parameter. It accepts an integer in range
  9614. 0 to 63. If not set, the filter will use the QP from the video stream
  9615. (if available).
  9616. @item mode
  9617. Set thresholding mode. Available modes are:
  9618. @table @samp
  9619. @item hard
  9620. Set hard thresholding.
  9621. @item soft
  9622. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9623. @item medium
  9624. Set medium thresholding (good results, default).
  9625. @end table
  9626. @end table
  9627. @section premultiply
  9628. Apply alpha premultiply effect to input video stream using first plane
  9629. of second stream as alpha.
  9630. Both streams must have same dimensions and same pixel format.
  9631. The filter accepts the following option:
  9632. @table @option
  9633. @item planes
  9634. Set which planes will be processed, unprocessed planes will be copied.
  9635. By default value 0xf, all planes will be processed.
  9636. @item inplace
  9637. Do not require 2nd input for processing, instead use alpha plane from input stream.
  9638. @end table
  9639. @section prewitt
  9640. Apply prewitt operator to input video stream.
  9641. The filter accepts the following option:
  9642. @table @option
  9643. @item planes
  9644. Set which planes will be processed, unprocessed planes will be copied.
  9645. By default value 0xf, all planes will be processed.
  9646. @item scale
  9647. Set value which will be multiplied with filtered result.
  9648. @item delta
  9649. Set value which will be added to filtered result.
  9650. @end table
  9651. @anchor{program_opencl}
  9652. @section program_opencl
  9653. Filter video using an OpenCL program.
  9654. @table @option
  9655. @item source
  9656. OpenCL program source file.
  9657. @item kernel
  9658. Kernel name in program.
  9659. @item inputs
  9660. Number of inputs to the filter. Defaults to 1.
  9661. @item size, s
  9662. Size of output frames. Defaults to the same as the first input.
  9663. @end table
  9664. The program source file must contain a kernel function with the given name,
  9665. which will be run once for each plane of the output. Each run on a plane
  9666. gets enqueued as a separate 2D global NDRange with one work-item for each
  9667. pixel to be generated. The global ID offset for each work-item is therefore
  9668. the coordinates of a pixel in the destination image.
  9669. The kernel function needs to take the following arguments:
  9670. @itemize
  9671. @item
  9672. Destination image, @var{__write_only image2d_t}.
  9673. This image will become the output; the kernel should write all of it.
  9674. @item
  9675. Frame index, @var{unsigned int}.
  9676. This is a counter starting from zero and increasing by one for each frame.
  9677. @item
  9678. Source images, @var{__read_only image2d_t}.
  9679. These are the most recent images on each input. The kernel may read from
  9680. them to generate the output, but they can't be written to.
  9681. @end itemize
  9682. Example programs:
  9683. @itemize
  9684. @item
  9685. Copy the input to the output (output must be the same size as the input).
  9686. @verbatim
  9687. __kernel void copy(__write_only image2d_t destination,
  9688. unsigned int index,
  9689. __read_only image2d_t source)
  9690. {
  9691. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  9692. int2 location = (int2)(get_global_id(0), get_global_id(1));
  9693. float4 value = read_imagef(source, sampler, location);
  9694. write_imagef(destination, location, value);
  9695. }
  9696. @end verbatim
  9697. @item
  9698. Apply a simple transformation, rotating the input by an amount increasing
  9699. with the index counter. Pixel values are linearly interpolated by the
  9700. sampler, and the output need not have the same dimensions as the input.
  9701. @verbatim
  9702. __kernel void rotate_image(__write_only image2d_t dst,
  9703. unsigned int index,
  9704. __read_only image2d_t src)
  9705. {
  9706. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  9707. CLK_FILTER_LINEAR);
  9708. float angle = (float)index / 100.0f;
  9709. float2 dst_dim = convert_float2(get_image_dim(dst));
  9710. float2 src_dim = convert_float2(get_image_dim(src));
  9711. float2 dst_cen = dst_dim / 2.0f;
  9712. float2 src_cen = src_dim / 2.0f;
  9713. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  9714. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  9715. float2 src_pos = {
  9716. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  9717. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  9718. };
  9719. src_pos = src_pos * src_dim / dst_dim;
  9720. float2 src_loc = src_pos + src_cen;
  9721. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  9722. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  9723. write_imagef(dst, dst_loc, 0.5f);
  9724. else
  9725. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  9726. }
  9727. @end verbatim
  9728. @item
  9729. Blend two inputs together, with the amount of each input used varying
  9730. with the index counter.
  9731. @verbatim
  9732. __kernel void blend_images(__write_only image2d_t dst,
  9733. unsigned int index,
  9734. __read_only image2d_t src1,
  9735. __read_only image2d_t src2)
  9736. {
  9737. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  9738. CLK_FILTER_LINEAR);
  9739. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  9740. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  9741. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  9742. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  9743. float4 val1 = read_imagef(src1, sampler, src1_loc);
  9744. float4 val2 = read_imagef(src2, sampler, src2_loc);
  9745. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  9746. }
  9747. @end verbatim
  9748. @end itemize
  9749. @section pseudocolor
  9750. Alter frame colors in video with pseudocolors.
  9751. This filter accept the following options:
  9752. @table @option
  9753. @item c0
  9754. set pixel first component expression
  9755. @item c1
  9756. set pixel second component expression
  9757. @item c2
  9758. set pixel third component expression
  9759. @item c3
  9760. set pixel fourth component expression, corresponds to the alpha component
  9761. @item i
  9762. set component to use as base for altering colors
  9763. @end table
  9764. Each of them specifies the expression to use for computing the lookup table for
  9765. the corresponding pixel component values.
  9766. The expressions can contain the following constants and functions:
  9767. @table @option
  9768. @item w
  9769. @item h
  9770. The input width and height.
  9771. @item val
  9772. The input value for the pixel component.
  9773. @item ymin, umin, vmin, amin
  9774. The minimum allowed component value.
  9775. @item ymax, umax, vmax, amax
  9776. The maximum allowed component value.
  9777. @end table
  9778. All expressions default to "val".
  9779. @subsection Examples
  9780. @itemize
  9781. @item
  9782. Change too high luma values to gradient:
  9783. @example
  9784. 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'"
  9785. @end example
  9786. @end itemize
  9787. @section psnr
  9788. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  9789. Ratio) between two input videos.
  9790. This filter takes in input two input videos, the first input is
  9791. considered the "main" source and is passed unchanged to the
  9792. output. The second input is used as a "reference" video for computing
  9793. the PSNR.
  9794. Both video inputs must have the same resolution and pixel format for
  9795. this filter to work correctly. Also it assumes that both inputs
  9796. have the same number of frames, which are compared one by one.
  9797. The obtained average PSNR is printed through the logging system.
  9798. The filter stores the accumulated MSE (mean squared error) of each
  9799. frame, and at the end of the processing it is averaged across all frames
  9800. equally, and the following formula is applied to obtain the PSNR:
  9801. @example
  9802. PSNR = 10*log10(MAX^2/MSE)
  9803. @end example
  9804. Where MAX is the average of the maximum values of each component of the
  9805. image.
  9806. The description of the accepted parameters follows.
  9807. @table @option
  9808. @item stats_file, f
  9809. If specified the filter will use the named file to save the PSNR of
  9810. each individual frame. When filename equals "-" the data is sent to
  9811. standard output.
  9812. @item stats_version
  9813. Specifies which version of the stats file format to use. Details of
  9814. each format are written below.
  9815. Default value is 1.
  9816. @item stats_add_max
  9817. Determines whether the max value is output to the stats log.
  9818. Default value is 0.
  9819. Requires stats_version >= 2. If this is set and stats_version < 2,
  9820. the filter will return an error.
  9821. @end table
  9822. This filter also supports the @ref{framesync} options.
  9823. The file printed if @var{stats_file} is selected, contains a sequence of
  9824. key/value pairs of the form @var{key}:@var{value} for each compared
  9825. couple of frames.
  9826. If a @var{stats_version} greater than 1 is specified, a header line precedes
  9827. the list of per-frame-pair stats, with key value pairs following the frame
  9828. format with the following parameters:
  9829. @table @option
  9830. @item psnr_log_version
  9831. The version of the log file format. Will match @var{stats_version}.
  9832. @item fields
  9833. A comma separated list of the per-frame-pair parameters included in
  9834. the log.
  9835. @end table
  9836. A description of each shown per-frame-pair parameter follows:
  9837. @table @option
  9838. @item n
  9839. sequential number of the input frame, starting from 1
  9840. @item mse_avg
  9841. Mean Square Error pixel-by-pixel average difference of the compared
  9842. frames, averaged over all the image components.
  9843. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  9844. Mean Square Error pixel-by-pixel average difference of the compared
  9845. frames for the component specified by the suffix.
  9846. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  9847. Peak Signal to Noise ratio of the compared frames for the component
  9848. specified by the suffix.
  9849. @item max_avg, max_y, max_u, max_v
  9850. Maximum allowed value for each channel, and average over all
  9851. channels.
  9852. @end table
  9853. For example:
  9854. @example
  9855. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9856. [main][ref] psnr="stats_file=stats.log" [out]
  9857. @end example
  9858. On this example the input file being processed is compared with the
  9859. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  9860. is stored in @file{stats.log}.
  9861. @anchor{pullup}
  9862. @section pullup
  9863. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  9864. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  9865. content.
  9866. The pullup filter is designed to take advantage of future context in making
  9867. its decisions. This filter is stateless in the sense that it does not lock
  9868. onto a pattern to follow, but it instead looks forward to the following
  9869. fields in order to identify matches and rebuild progressive frames.
  9870. To produce content with an even framerate, insert the fps filter after
  9871. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  9872. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  9873. The filter accepts the following options:
  9874. @table @option
  9875. @item jl
  9876. @item jr
  9877. @item jt
  9878. @item jb
  9879. These options set the amount of "junk" to ignore at the left, right, top, and
  9880. bottom of the image, respectively. Left and right are in units of 8 pixels,
  9881. while top and bottom are in units of 2 lines.
  9882. The default is 8 pixels on each side.
  9883. @item sb
  9884. Set the strict breaks. Setting this option to 1 will reduce the chances of
  9885. filter generating an occasional mismatched frame, but it may also cause an
  9886. excessive number of frames to be dropped during high motion sequences.
  9887. Conversely, setting it to -1 will make filter match fields more easily.
  9888. This may help processing of video where there is slight blurring between
  9889. the fields, but may also cause there to be interlaced frames in the output.
  9890. Default value is @code{0}.
  9891. @item mp
  9892. Set the metric plane to use. It accepts the following values:
  9893. @table @samp
  9894. @item l
  9895. Use luma plane.
  9896. @item u
  9897. Use chroma blue plane.
  9898. @item v
  9899. Use chroma red plane.
  9900. @end table
  9901. This option may be set to use chroma plane instead of the default luma plane
  9902. for doing filter's computations. This may improve accuracy on very clean
  9903. source material, but more likely will decrease accuracy, especially if there
  9904. is chroma noise (rainbow effect) or any grayscale video.
  9905. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  9906. load and make pullup usable in realtime on slow machines.
  9907. @end table
  9908. For best results (without duplicated frames in the output file) it is
  9909. necessary to change the output frame rate. For example, to inverse
  9910. telecine NTSC input:
  9911. @example
  9912. ffmpeg -i input -vf pullup -r 24000/1001 ...
  9913. @end example
  9914. @section qp
  9915. Change video quantization parameters (QP).
  9916. The filter accepts the following option:
  9917. @table @option
  9918. @item qp
  9919. Set expression for quantization parameter.
  9920. @end table
  9921. The expression is evaluated through the eval API and can contain, among others,
  9922. the following constants:
  9923. @table @var
  9924. @item known
  9925. 1 if index is not 129, 0 otherwise.
  9926. @item qp
  9927. Sequential index starting from -129 to 128.
  9928. @end table
  9929. @subsection Examples
  9930. @itemize
  9931. @item
  9932. Some equation like:
  9933. @example
  9934. qp=2+2*sin(PI*qp)
  9935. @end example
  9936. @end itemize
  9937. @section random
  9938. Flush video frames from internal cache of frames into a random order.
  9939. No frame is discarded.
  9940. Inspired by @ref{frei0r} nervous filter.
  9941. @table @option
  9942. @item frames
  9943. Set size in number of frames of internal cache, in range from @code{2} to
  9944. @code{512}. Default is @code{30}.
  9945. @item seed
  9946. Set seed for random number generator, must be an integer included between
  9947. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  9948. less than @code{0}, the filter will try to use a good random seed on a
  9949. best effort basis.
  9950. @end table
  9951. @section readeia608
  9952. Read closed captioning (EIA-608) information from the top lines of a video frame.
  9953. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  9954. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  9955. with EIA-608 data (starting from 0). A description of each metadata value follows:
  9956. @table @option
  9957. @item lavfi.readeia608.X.cc
  9958. The two bytes stored as EIA-608 data (printed in hexadecimal).
  9959. @item lavfi.readeia608.X.line
  9960. The number of the line on which the EIA-608 data was identified and read.
  9961. @end table
  9962. This filter accepts the following options:
  9963. @table @option
  9964. @item scan_min
  9965. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  9966. @item scan_max
  9967. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  9968. @item mac
  9969. Set minimal acceptable amplitude change for sync codes detection.
  9970. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  9971. @item spw
  9972. Set the ratio of width reserved for sync code detection.
  9973. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  9974. @item mhd
  9975. Set the max peaks height difference for sync code detection.
  9976. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9977. @item mpd
  9978. Set max peaks period difference for sync code detection.
  9979. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9980. @item msd
  9981. Set the first two max start code bits differences.
  9982. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  9983. @item bhd
  9984. Set the minimum ratio of bits height compared to 3rd start code bit.
  9985. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  9986. @item th_w
  9987. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  9988. @item th_b
  9989. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  9990. @item chp
  9991. Enable checking the parity bit. In the event of a parity error, the filter will output
  9992. @code{0x00} for that character. Default is false.
  9993. @end table
  9994. @subsection Examples
  9995. @itemize
  9996. @item
  9997. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  9998. @example
  9999. 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
  10000. @end example
  10001. @end itemize
  10002. @section readvitc
  10003. Read vertical interval timecode (VITC) information from the top lines of a
  10004. video frame.
  10005. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  10006. timecode value, if a valid timecode has been detected. Further metadata key
  10007. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  10008. timecode data has been found or not.
  10009. This filter accepts the following options:
  10010. @table @option
  10011. @item scan_max
  10012. Set the maximum number of lines to scan for VITC data. If the value is set to
  10013. @code{-1} the full video frame is scanned. Default is @code{45}.
  10014. @item thr_b
  10015. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  10016. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  10017. @item thr_w
  10018. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  10019. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  10020. @end table
  10021. @subsection Examples
  10022. @itemize
  10023. @item
  10024. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  10025. draw @code{--:--:--:--} as a placeholder:
  10026. @example
  10027. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  10028. @end example
  10029. @end itemize
  10030. @section remap
  10031. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  10032. Destination pixel at position (X, Y) will be picked from source (x, y) position
  10033. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  10034. value for pixel will be used for destination pixel.
  10035. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  10036. will have Xmap/Ymap video stream dimensions.
  10037. Xmap and Ymap input video streams are 16bit depth, single channel.
  10038. @section removegrain
  10039. The removegrain filter is a spatial denoiser for progressive video.
  10040. @table @option
  10041. @item m0
  10042. Set mode for the first plane.
  10043. @item m1
  10044. Set mode for the second plane.
  10045. @item m2
  10046. Set mode for the third plane.
  10047. @item m3
  10048. Set mode for the fourth plane.
  10049. @end table
  10050. Range of mode is from 0 to 24. Description of each mode follows:
  10051. @table @var
  10052. @item 0
  10053. Leave input plane unchanged. Default.
  10054. @item 1
  10055. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  10056. @item 2
  10057. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  10058. @item 3
  10059. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  10060. @item 4
  10061. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  10062. This is equivalent to a median filter.
  10063. @item 5
  10064. Line-sensitive clipping giving the minimal change.
  10065. @item 6
  10066. Line-sensitive clipping, intermediate.
  10067. @item 7
  10068. Line-sensitive clipping, intermediate.
  10069. @item 8
  10070. Line-sensitive clipping, intermediate.
  10071. @item 9
  10072. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  10073. @item 10
  10074. Replaces the target pixel with the closest neighbour.
  10075. @item 11
  10076. [1 2 1] horizontal and vertical kernel blur.
  10077. @item 12
  10078. Same as mode 11.
  10079. @item 13
  10080. Bob mode, interpolates top field from the line where the neighbours
  10081. pixels are the closest.
  10082. @item 14
  10083. Bob mode, interpolates bottom field from the line where the neighbours
  10084. pixels are the closest.
  10085. @item 15
  10086. Bob mode, interpolates top field. Same as 13 but with a more complicated
  10087. interpolation formula.
  10088. @item 16
  10089. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  10090. interpolation formula.
  10091. @item 17
  10092. Clips the pixel with the minimum and maximum of respectively the maximum and
  10093. minimum of each pair of opposite neighbour pixels.
  10094. @item 18
  10095. Line-sensitive clipping using opposite neighbours whose greatest distance from
  10096. the current pixel is minimal.
  10097. @item 19
  10098. Replaces the pixel with the average of its 8 neighbours.
  10099. @item 20
  10100. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  10101. @item 21
  10102. Clips pixels using the averages of opposite neighbour.
  10103. @item 22
  10104. Same as mode 21 but simpler and faster.
  10105. @item 23
  10106. Small edge and halo removal, but reputed useless.
  10107. @item 24
  10108. Similar as 23.
  10109. @end table
  10110. @section removelogo
  10111. Suppress a TV station logo, using an image file to determine which
  10112. pixels comprise the logo. It works by filling in the pixels that
  10113. comprise the logo with neighboring pixels.
  10114. The filter accepts the following options:
  10115. @table @option
  10116. @item filename, f
  10117. Set the filter bitmap file, which can be any image format supported by
  10118. libavformat. The width and height of the image file must match those of the
  10119. video stream being processed.
  10120. @end table
  10121. Pixels in the provided bitmap image with a value of zero are not
  10122. considered part of the logo, non-zero pixels are considered part of
  10123. the logo. If you use white (255) for the logo and black (0) for the
  10124. rest, you will be safe. For making the filter bitmap, it is
  10125. recommended to take a screen capture of a black frame with the logo
  10126. visible, and then using a threshold filter followed by the erode
  10127. filter once or twice.
  10128. If needed, little splotches can be fixed manually. Remember that if
  10129. logo pixels are not covered, the filter quality will be much
  10130. reduced. Marking too many pixels as part of the logo does not hurt as
  10131. much, but it will increase the amount of blurring needed to cover over
  10132. the image and will destroy more information than necessary, and extra
  10133. pixels will slow things down on a large logo.
  10134. @section repeatfields
  10135. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  10136. fields based on its value.
  10137. @section reverse
  10138. Reverse a video clip.
  10139. Warning: This filter requires memory to buffer the entire clip, so trimming
  10140. is suggested.
  10141. @subsection Examples
  10142. @itemize
  10143. @item
  10144. Take the first 5 seconds of a clip, and reverse it.
  10145. @example
  10146. trim=end=5,reverse
  10147. @end example
  10148. @end itemize
  10149. @section roberts
  10150. Apply roberts cross operator to input video stream.
  10151. The filter accepts the following option:
  10152. @table @option
  10153. @item planes
  10154. Set which planes will be processed, unprocessed planes will be copied.
  10155. By default value 0xf, all planes will be processed.
  10156. @item scale
  10157. Set value which will be multiplied with filtered result.
  10158. @item delta
  10159. Set value which will be added to filtered result.
  10160. @end table
  10161. @section rotate
  10162. Rotate video by an arbitrary angle expressed in radians.
  10163. The filter accepts the following options:
  10164. A description of the optional parameters follows.
  10165. @table @option
  10166. @item angle, a
  10167. Set an expression for the angle by which to rotate the input video
  10168. clockwise, expressed as a number of radians. A negative value will
  10169. result in a counter-clockwise rotation. By default it is set to "0".
  10170. This expression is evaluated for each frame.
  10171. @item out_w, ow
  10172. Set the output width expression, default value is "iw".
  10173. This expression is evaluated just once during configuration.
  10174. @item out_h, oh
  10175. Set the output height expression, default value is "ih".
  10176. This expression is evaluated just once during configuration.
  10177. @item bilinear
  10178. Enable bilinear interpolation if set to 1, a value of 0 disables
  10179. it. Default value is 1.
  10180. @item fillcolor, c
  10181. Set the color used to fill the output area not covered by the rotated
  10182. image. For the general syntax of this option, check the
  10183. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10184. If the special value "none" is selected then no
  10185. background is printed (useful for example if the background is never shown).
  10186. Default value is "black".
  10187. @end table
  10188. The expressions for the angle and the output size can contain the
  10189. following constants and functions:
  10190. @table @option
  10191. @item n
  10192. sequential number of the input frame, starting from 0. It is always NAN
  10193. before the first frame is filtered.
  10194. @item t
  10195. time in seconds of the input frame, it is set to 0 when the filter is
  10196. configured. It is always NAN before the first frame is filtered.
  10197. @item hsub
  10198. @item vsub
  10199. horizontal and vertical chroma subsample values. For example for the
  10200. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10201. @item in_w, iw
  10202. @item in_h, ih
  10203. the input video width and height
  10204. @item out_w, ow
  10205. @item out_h, oh
  10206. the output width and height, that is the size of the padded area as
  10207. specified by the @var{width} and @var{height} expressions
  10208. @item rotw(a)
  10209. @item roth(a)
  10210. the minimal width/height required for completely containing the input
  10211. video rotated by @var{a} radians.
  10212. These are only available when computing the @option{out_w} and
  10213. @option{out_h} expressions.
  10214. @end table
  10215. @subsection Examples
  10216. @itemize
  10217. @item
  10218. Rotate the input by PI/6 radians clockwise:
  10219. @example
  10220. rotate=PI/6
  10221. @end example
  10222. @item
  10223. Rotate the input by PI/6 radians counter-clockwise:
  10224. @example
  10225. rotate=-PI/6
  10226. @end example
  10227. @item
  10228. Rotate the input by 45 degrees clockwise:
  10229. @example
  10230. rotate=45*PI/180
  10231. @end example
  10232. @item
  10233. Apply a constant rotation with period T, starting from an angle of PI/3:
  10234. @example
  10235. rotate=PI/3+2*PI*t/T
  10236. @end example
  10237. @item
  10238. Make the input video rotation oscillating with a period of T
  10239. seconds and an amplitude of A radians:
  10240. @example
  10241. rotate=A*sin(2*PI/T*t)
  10242. @end example
  10243. @item
  10244. Rotate the video, output size is chosen so that the whole rotating
  10245. input video is always completely contained in the output:
  10246. @example
  10247. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  10248. @end example
  10249. @item
  10250. Rotate the video, reduce the output size so that no background is ever
  10251. shown:
  10252. @example
  10253. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  10254. @end example
  10255. @end itemize
  10256. @subsection Commands
  10257. The filter supports the following commands:
  10258. @table @option
  10259. @item a, angle
  10260. Set the angle expression.
  10261. The command accepts the same syntax of the corresponding option.
  10262. If the specified expression is not valid, it is kept at its current
  10263. value.
  10264. @end table
  10265. @section sab
  10266. Apply Shape Adaptive Blur.
  10267. The filter accepts the following options:
  10268. @table @option
  10269. @item luma_radius, lr
  10270. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  10271. value is 1.0. A greater value will result in a more blurred image, and
  10272. in slower processing.
  10273. @item luma_pre_filter_radius, lpfr
  10274. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  10275. value is 1.0.
  10276. @item luma_strength, ls
  10277. Set luma maximum difference between pixels to still be considered, must
  10278. be a value in the 0.1-100.0 range, default value is 1.0.
  10279. @item chroma_radius, cr
  10280. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  10281. greater value will result in a more blurred image, and in slower
  10282. processing.
  10283. @item chroma_pre_filter_radius, cpfr
  10284. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  10285. @item chroma_strength, cs
  10286. Set chroma maximum difference between pixels to still be considered,
  10287. must be a value in the -0.9-100.0 range.
  10288. @end table
  10289. Each chroma option value, if not explicitly specified, is set to the
  10290. corresponding luma option value.
  10291. @anchor{scale}
  10292. @section scale
  10293. Scale (resize) the input video, using the libswscale library.
  10294. The scale filter forces the output display aspect ratio to be the same
  10295. of the input, by changing the output sample aspect ratio.
  10296. If the input image format is different from the format requested by
  10297. the next filter, the scale filter will convert the input to the
  10298. requested format.
  10299. @subsection Options
  10300. The filter accepts the following options, or any of the options
  10301. supported by the libswscale scaler.
  10302. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  10303. the complete list of scaler options.
  10304. @table @option
  10305. @item width, w
  10306. @item height, h
  10307. Set the output video dimension expression. Default value is the input
  10308. dimension.
  10309. If the @var{width} or @var{w} value is 0, the input width is used for
  10310. the output. If the @var{height} or @var{h} value is 0, the input height
  10311. is used for the output.
  10312. If one and only one of the values is -n with n >= 1, the scale filter
  10313. will use a value that maintains the aspect ratio of the input image,
  10314. calculated from the other specified dimension. After that it will,
  10315. however, make sure that the calculated dimension is divisible by n and
  10316. adjust the value if necessary.
  10317. If both values are -n with n >= 1, the behavior will be identical to
  10318. both values being set to 0 as previously detailed.
  10319. See below for the list of accepted constants for use in the dimension
  10320. expression.
  10321. @item eval
  10322. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  10323. @table @samp
  10324. @item init
  10325. Only evaluate expressions once during the filter initialization or when a command is processed.
  10326. @item frame
  10327. Evaluate expressions for each incoming frame.
  10328. @end table
  10329. Default value is @samp{init}.
  10330. @item interl
  10331. Set the interlacing mode. It accepts the following values:
  10332. @table @samp
  10333. @item 1
  10334. Force interlaced aware scaling.
  10335. @item 0
  10336. Do not apply interlaced scaling.
  10337. @item -1
  10338. Select interlaced aware scaling depending on whether the source frames
  10339. are flagged as interlaced or not.
  10340. @end table
  10341. Default value is @samp{0}.
  10342. @item flags
  10343. Set libswscale scaling flags. See
  10344. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10345. complete list of values. If not explicitly specified the filter applies
  10346. the default flags.
  10347. @item param0, param1
  10348. Set libswscale input parameters for scaling algorithms that need them. See
  10349. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10350. complete documentation. If not explicitly specified the filter applies
  10351. empty parameters.
  10352. @item size, s
  10353. Set the video size. For the syntax of this option, check the
  10354. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10355. @item in_color_matrix
  10356. @item out_color_matrix
  10357. Set in/output YCbCr color space type.
  10358. This allows the autodetected value to be overridden as well as allows forcing
  10359. a specific value used for the output and encoder.
  10360. If not specified, the color space type depends on the pixel format.
  10361. Possible values:
  10362. @table @samp
  10363. @item auto
  10364. Choose automatically.
  10365. @item bt709
  10366. Format conforming to International Telecommunication Union (ITU)
  10367. Recommendation BT.709.
  10368. @item fcc
  10369. Set color space conforming to the United States Federal Communications
  10370. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  10371. @item bt601
  10372. Set color space conforming to:
  10373. @itemize
  10374. @item
  10375. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  10376. @item
  10377. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  10378. @item
  10379. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  10380. @end itemize
  10381. @item smpte240m
  10382. Set color space conforming to SMPTE ST 240:1999.
  10383. @end table
  10384. @item in_range
  10385. @item out_range
  10386. Set in/output YCbCr sample range.
  10387. This allows the autodetected value to be overridden as well as allows forcing
  10388. a specific value used for the output and encoder. If not specified, the
  10389. range depends on the pixel format. Possible values:
  10390. @table @samp
  10391. @item auto/unknown
  10392. Choose automatically.
  10393. @item jpeg/full/pc
  10394. Set full range (0-255 in case of 8-bit luma).
  10395. @item mpeg/limited/tv
  10396. Set "MPEG" range (16-235 in case of 8-bit luma).
  10397. @end table
  10398. @item force_original_aspect_ratio
  10399. Enable decreasing or increasing output video width or height if necessary to
  10400. keep the original aspect ratio. Possible values:
  10401. @table @samp
  10402. @item disable
  10403. Scale the video as specified and disable this feature.
  10404. @item decrease
  10405. The output video dimensions will automatically be decreased if needed.
  10406. @item increase
  10407. The output video dimensions will automatically be increased if needed.
  10408. @end table
  10409. One useful instance of this option is that when you know a specific device's
  10410. maximum allowed resolution, you can use this to limit the output video to
  10411. that, while retaining the aspect ratio. For example, device A allows
  10412. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  10413. decrease) and specifying 1280x720 to the command line makes the output
  10414. 1280x533.
  10415. Please note that this is a different thing than specifying -1 for @option{w}
  10416. or @option{h}, you still need to specify the output resolution for this option
  10417. to work.
  10418. @end table
  10419. The values of the @option{w} and @option{h} options are expressions
  10420. containing the following constants:
  10421. @table @var
  10422. @item in_w
  10423. @item in_h
  10424. The input width and height
  10425. @item iw
  10426. @item ih
  10427. These are the same as @var{in_w} and @var{in_h}.
  10428. @item out_w
  10429. @item out_h
  10430. The output (scaled) width and height
  10431. @item ow
  10432. @item oh
  10433. These are the same as @var{out_w} and @var{out_h}
  10434. @item a
  10435. The same as @var{iw} / @var{ih}
  10436. @item sar
  10437. input sample aspect ratio
  10438. @item dar
  10439. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  10440. @item hsub
  10441. @item vsub
  10442. horizontal and vertical input chroma subsample values. For example for the
  10443. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10444. @item ohsub
  10445. @item ovsub
  10446. horizontal and vertical output chroma subsample values. For example for the
  10447. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10448. @end table
  10449. @subsection Examples
  10450. @itemize
  10451. @item
  10452. Scale the input video to a size of 200x100
  10453. @example
  10454. scale=w=200:h=100
  10455. @end example
  10456. This is equivalent to:
  10457. @example
  10458. scale=200:100
  10459. @end example
  10460. or:
  10461. @example
  10462. scale=200x100
  10463. @end example
  10464. @item
  10465. Specify a size abbreviation for the output size:
  10466. @example
  10467. scale=qcif
  10468. @end example
  10469. which can also be written as:
  10470. @example
  10471. scale=size=qcif
  10472. @end example
  10473. @item
  10474. Scale the input to 2x:
  10475. @example
  10476. scale=w=2*iw:h=2*ih
  10477. @end example
  10478. @item
  10479. The above is the same as:
  10480. @example
  10481. scale=2*in_w:2*in_h
  10482. @end example
  10483. @item
  10484. Scale the input to 2x with forced interlaced scaling:
  10485. @example
  10486. scale=2*iw:2*ih:interl=1
  10487. @end example
  10488. @item
  10489. Scale the input to half size:
  10490. @example
  10491. scale=w=iw/2:h=ih/2
  10492. @end example
  10493. @item
  10494. Increase the width, and set the height to the same size:
  10495. @example
  10496. scale=3/2*iw:ow
  10497. @end example
  10498. @item
  10499. Seek Greek harmony:
  10500. @example
  10501. scale=iw:1/PHI*iw
  10502. scale=ih*PHI:ih
  10503. @end example
  10504. @item
  10505. Increase the height, and set the width to 3/2 of the height:
  10506. @example
  10507. scale=w=3/2*oh:h=3/5*ih
  10508. @end example
  10509. @item
  10510. Increase the size, making the size a multiple of the chroma
  10511. subsample values:
  10512. @example
  10513. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  10514. @end example
  10515. @item
  10516. Increase the width to a maximum of 500 pixels,
  10517. keeping the same aspect ratio as the input:
  10518. @example
  10519. scale=w='min(500\, iw*3/2):h=-1'
  10520. @end example
  10521. @item
  10522. Make pixels square by combining scale and setsar:
  10523. @example
  10524. scale='trunc(ih*dar):ih',setsar=1/1
  10525. @end example
  10526. @item
  10527. Make pixels square by combining scale and setsar,
  10528. making sure the resulting resolution is even (required by some codecs):
  10529. @example
  10530. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  10531. @end example
  10532. @end itemize
  10533. @subsection Commands
  10534. This filter supports the following commands:
  10535. @table @option
  10536. @item width, w
  10537. @item height, h
  10538. Set the output video dimension expression.
  10539. The command accepts the same syntax of the corresponding option.
  10540. If the specified expression is not valid, it is kept at its current
  10541. value.
  10542. @end table
  10543. @section scale_npp
  10544. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  10545. format conversion on CUDA video frames. Setting the output width and height
  10546. works in the same way as for the @var{scale} filter.
  10547. The following additional options are accepted:
  10548. @table @option
  10549. @item format
  10550. The pixel format of the output CUDA frames. If set to the string "same" (the
  10551. default), the input format will be kept. Note that automatic format negotiation
  10552. and conversion is not yet supported for hardware frames
  10553. @item interp_algo
  10554. The interpolation algorithm used for resizing. One of the following:
  10555. @table @option
  10556. @item nn
  10557. Nearest neighbour.
  10558. @item linear
  10559. @item cubic
  10560. @item cubic2p_bspline
  10561. 2-parameter cubic (B=1, C=0)
  10562. @item cubic2p_catmullrom
  10563. 2-parameter cubic (B=0, C=1/2)
  10564. @item cubic2p_b05c03
  10565. 2-parameter cubic (B=1/2, C=3/10)
  10566. @item super
  10567. Supersampling
  10568. @item lanczos
  10569. @end table
  10570. @end table
  10571. @section scale2ref
  10572. Scale (resize) the input video, based on a reference video.
  10573. See the scale filter for available options, scale2ref supports the same but
  10574. uses the reference video instead of the main input as basis. scale2ref also
  10575. supports the following additional constants for the @option{w} and
  10576. @option{h} options:
  10577. @table @var
  10578. @item main_w
  10579. @item main_h
  10580. The main input video's width and height
  10581. @item main_a
  10582. The same as @var{main_w} / @var{main_h}
  10583. @item main_sar
  10584. The main input video's sample aspect ratio
  10585. @item main_dar, mdar
  10586. The main input video's display aspect ratio. Calculated from
  10587. @code{(main_w / main_h) * main_sar}.
  10588. @item main_hsub
  10589. @item main_vsub
  10590. The main input video's horizontal and vertical chroma subsample values.
  10591. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  10592. is 1.
  10593. @end table
  10594. @subsection Examples
  10595. @itemize
  10596. @item
  10597. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  10598. @example
  10599. 'scale2ref[b][a];[a][b]overlay'
  10600. @end example
  10601. @end itemize
  10602. @anchor{selectivecolor}
  10603. @section selectivecolor
  10604. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  10605. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  10606. by the "purity" of the color (that is, how saturated it already is).
  10607. This filter is similar to the Adobe Photoshop Selective Color tool.
  10608. The filter accepts the following options:
  10609. @table @option
  10610. @item correction_method
  10611. Select color correction method.
  10612. Available values are:
  10613. @table @samp
  10614. @item absolute
  10615. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  10616. component value).
  10617. @item relative
  10618. Specified adjustments are relative to the original component value.
  10619. @end table
  10620. Default is @code{absolute}.
  10621. @item reds
  10622. Adjustments for red pixels (pixels where the red component is the maximum)
  10623. @item yellows
  10624. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  10625. @item greens
  10626. Adjustments for green pixels (pixels where the green component is the maximum)
  10627. @item cyans
  10628. Adjustments for cyan pixels (pixels where the red component is the minimum)
  10629. @item blues
  10630. Adjustments for blue pixels (pixels where the blue component is the maximum)
  10631. @item magentas
  10632. Adjustments for magenta pixels (pixels where the green component is the minimum)
  10633. @item whites
  10634. Adjustments for white pixels (pixels where all components are greater than 128)
  10635. @item neutrals
  10636. Adjustments for all pixels except pure black and pure white
  10637. @item blacks
  10638. Adjustments for black pixels (pixels where all components are lesser than 128)
  10639. @item psfile
  10640. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  10641. @end table
  10642. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  10643. 4 space separated floating point adjustment values in the [-1,1] range,
  10644. respectively to adjust the amount of cyan, magenta, yellow and black for the
  10645. pixels of its range.
  10646. @subsection Examples
  10647. @itemize
  10648. @item
  10649. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  10650. increase magenta by 27% in blue areas:
  10651. @example
  10652. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  10653. @end example
  10654. @item
  10655. Use a Photoshop selective color preset:
  10656. @example
  10657. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  10658. @end example
  10659. @end itemize
  10660. @anchor{separatefields}
  10661. @section separatefields
  10662. The @code{separatefields} takes a frame-based video input and splits
  10663. each frame into its components fields, producing a new half height clip
  10664. with twice the frame rate and twice the frame count.
  10665. This filter use field-dominance information in frame to decide which
  10666. of each pair of fields to place first in the output.
  10667. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  10668. @section setdar, setsar
  10669. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  10670. output video.
  10671. This is done by changing the specified Sample (aka Pixel) Aspect
  10672. Ratio, according to the following equation:
  10673. @example
  10674. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  10675. @end example
  10676. Keep in mind that the @code{setdar} filter does not modify the pixel
  10677. dimensions of the video frame. Also, the display aspect ratio set by
  10678. this filter may be changed by later filters in the filterchain,
  10679. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  10680. applied.
  10681. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  10682. the filter output video.
  10683. Note that as a consequence of the application of this filter, the
  10684. output display aspect ratio will change according to the equation
  10685. above.
  10686. Keep in mind that the sample aspect ratio set by the @code{setsar}
  10687. filter may be changed by later filters in the filterchain, e.g. if
  10688. another "setsar" or a "setdar" filter is applied.
  10689. It accepts the following parameters:
  10690. @table @option
  10691. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  10692. Set the aspect ratio used by the filter.
  10693. The parameter can be a floating point number string, an expression, or
  10694. a string of the form @var{num}:@var{den}, where @var{num} and
  10695. @var{den} are the numerator and denominator of the aspect ratio. If
  10696. the parameter is not specified, it is assumed the value "0".
  10697. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  10698. should be escaped.
  10699. @item max
  10700. Set the maximum integer value to use for expressing numerator and
  10701. denominator when reducing the expressed aspect ratio to a rational.
  10702. Default value is @code{100}.
  10703. @end table
  10704. The parameter @var{sar} is an expression containing
  10705. the following constants:
  10706. @table @option
  10707. @item E, PI, PHI
  10708. These are approximated values for the mathematical constants e
  10709. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  10710. @item w, h
  10711. The input width and height.
  10712. @item a
  10713. These are the same as @var{w} / @var{h}.
  10714. @item sar
  10715. The input sample aspect ratio.
  10716. @item dar
  10717. The input display aspect ratio. It is the same as
  10718. (@var{w} / @var{h}) * @var{sar}.
  10719. @item hsub, vsub
  10720. Horizontal and vertical chroma subsample values. For example, for the
  10721. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10722. @end table
  10723. @subsection Examples
  10724. @itemize
  10725. @item
  10726. To change the display aspect ratio to 16:9, specify one of the following:
  10727. @example
  10728. setdar=dar=1.77777
  10729. setdar=dar=16/9
  10730. @end example
  10731. @item
  10732. To change the sample aspect ratio to 10:11, specify:
  10733. @example
  10734. setsar=sar=10/11
  10735. @end example
  10736. @item
  10737. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  10738. 1000 in the aspect ratio reduction, use the command:
  10739. @example
  10740. setdar=ratio=16/9:max=1000
  10741. @end example
  10742. @end itemize
  10743. @anchor{setfield}
  10744. @section setfield
  10745. Force field for the output video frame.
  10746. The @code{setfield} filter marks the interlace type field for the
  10747. output frames. It does not change the input frame, but only sets the
  10748. corresponding property, which affects how the frame is treated by
  10749. following filters (e.g. @code{fieldorder} or @code{yadif}).
  10750. The filter accepts the following options:
  10751. @table @option
  10752. @item mode
  10753. Available values are:
  10754. @table @samp
  10755. @item auto
  10756. Keep the same field property.
  10757. @item bff
  10758. Mark the frame as bottom-field-first.
  10759. @item tff
  10760. Mark the frame as top-field-first.
  10761. @item prog
  10762. Mark the frame as progressive.
  10763. @end table
  10764. @end table
  10765. @section showinfo
  10766. Show a line containing various information for each input video frame.
  10767. The input video is not modified.
  10768. The shown line contains a sequence of key/value pairs of the form
  10769. @var{key}:@var{value}.
  10770. The following values are shown in the output:
  10771. @table @option
  10772. @item n
  10773. The (sequential) number of the input frame, starting from 0.
  10774. @item pts
  10775. The Presentation TimeStamp of the input frame, expressed as a number of
  10776. time base units. The time base unit depends on the filter input pad.
  10777. @item pts_time
  10778. The Presentation TimeStamp of the input frame, expressed as a number of
  10779. seconds.
  10780. @item pos
  10781. The position of the frame in the input stream, or -1 if this information is
  10782. unavailable and/or meaningless (for example in case of synthetic video).
  10783. @item fmt
  10784. The pixel format name.
  10785. @item sar
  10786. The sample aspect ratio of the input frame, expressed in the form
  10787. @var{num}/@var{den}.
  10788. @item s
  10789. The size of the input frame. For the syntax of this option, check the
  10790. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10791. @item i
  10792. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  10793. for bottom field first).
  10794. @item iskey
  10795. This is 1 if the frame is a key frame, 0 otherwise.
  10796. @item type
  10797. The picture type of the input frame ("I" for an I-frame, "P" for a
  10798. P-frame, "B" for a B-frame, or "?" for an unknown type).
  10799. Also refer to the documentation of the @code{AVPictureType} enum and of
  10800. the @code{av_get_picture_type_char} function defined in
  10801. @file{libavutil/avutil.h}.
  10802. @item checksum
  10803. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  10804. @item plane_checksum
  10805. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  10806. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  10807. @end table
  10808. @section showpalette
  10809. Displays the 256 colors palette of each frame. This filter is only relevant for
  10810. @var{pal8} pixel format frames.
  10811. It accepts the following option:
  10812. @table @option
  10813. @item s
  10814. Set the size of the box used to represent one palette color entry. Default is
  10815. @code{30} (for a @code{30x30} pixel box).
  10816. @end table
  10817. @section shuffleframes
  10818. Reorder and/or duplicate and/or drop video frames.
  10819. It accepts the following parameters:
  10820. @table @option
  10821. @item mapping
  10822. Set the destination indexes of input frames.
  10823. This is space or '|' separated list of indexes that maps input frames to output
  10824. frames. Number of indexes also sets maximal value that each index may have.
  10825. '-1' index have special meaning and that is to drop frame.
  10826. @end table
  10827. The first frame has the index 0. The default is to keep the input unchanged.
  10828. @subsection Examples
  10829. @itemize
  10830. @item
  10831. Swap second and third frame of every three frames of the input:
  10832. @example
  10833. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  10834. @end example
  10835. @item
  10836. Swap 10th and 1st frame of every ten frames of the input:
  10837. @example
  10838. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  10839. @end example
  10840. @end itemize
  10841. @section shuffleplanes
  10842. Reorder and/or duplicate video planes.
  10843. It accepts the following parameters:
  10844. @table @option
  10845. @item map0
  10846. The index of the input plane to be used as the first output plane.
  10847. @item map1
  10848. The index of the input plane to be used as the second output plane.
  10849. @item map2
  10850. The index of the input plane to be used as the third output plane.
  10851. @item map3
  10852. The index of the input plane to be used as the fourth output plane.
  10853. @end table
  10854. The first plane has the index 0. The default is to keep the input unchanged.
  10855. @subsection Examples
  10856. @itemize
  10857. @item
  10858. Swap the second and third planes of the input:
  10859. @example
  10860. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  10861. @end example
  10862. @end itemize
  10863. @anchor{signalstats}
  10864. @section signalstats
  10865. Evaluate various visual metrics that assist in determining issues associated
  10866. with the digitization of analog video media.
  10867. By default the filter will log these metadata values:
  10868. @table @option
  10869. @item YMIN
  10870. Display the minimal Y value contained within the input frame. Expressed in
  10871. range of [0-255].
  10872. @item YLOW
  10873. Display the Y value at the 10% percentile within the input frame. Expressed in
  10874. range of [0-255].
  10875. @item YAVG
  10876. Display the average Y value within the input frame. Expressed in range of
  10877. [0-255].
  10878. @item YHIGH
  10879. Display the Y value at the 90% percentile within the input frame. Expressed in
  10880. range of [0-255].
  10881. @item YMAX
  10882. Display the maximum Y value contained within the input frame. Expressed in
  10883. range of [0-255].
  10884. @item UMIN
  10885. Display the minimal U value contained within the input frame. Expressed in
  10886. range of [0-255].
  10887. @item ULOW
  10888. Display the U value at the 10% percentile within the input frame. Expressed in
  10889. range of [0-255].
  10890. @item UAVG
  10891. Display the average U value within the input frame. Expressed in range of
  10892. [0-255].
  10893. @item UHIGH
  10894. Display the U value at the 90% percentile within the input frame. Expressed in
  10895. range of [0-255].
  10896. @item UMAX
  10897. Display the maximum U value contained within the input frame. Expressed in
  10898. range of [0-255].
  10899. @item VMIN
  10900. Display the minimal V value contained within the input frame. Expressed in
  10901. range of [0-255].
  10902. @item VLOW
  10903. Display the V value at the 10% percentile within the input frame. Expressed in
  10904. range of [0-255].
  10905. @item VAVG
  10906. Display the average V value within the input frame. Expressed in range of
  10907. [0-255].
  10908. @item VHIGH
  10909. Display the V value at the 90% percentile within the input frame. Expressed in
  10910. range of [0-255].
  10911. @item VMAX
  10912. Display the maximum V value contained within the input frame. Expressed in
  10913. range of [0-255].
  10914. @item SATMIN
  10915. Display the minimal saturation value contained within the input frame.
  10916. Expressed in range of [0-~181.02].
  10917. @item SATLOW
  10918. Display the saturation value at the 10% percentile within the input frame.
  10919. Expressed in range of [0-~181.02].
  10920. @item SATAVG
  10921. Display the average saturation value within the input frame. Expressed in range
  10922. of [0-~181.02].
  10923. @item SATHIGH
  10924. Display the saturation value at the 90% percentile within the input frame.
  10925. Expressed in range of [0-~181.02].
  10926. @item SATMAX
  10927. Display the maximum saturation value contained within the input frame.
  10928. Expressed in range of [0-~181.02].
  10929. @item HUEMED
  10930. Display the median value for hue within the input frame. Expressed in range of
  10931. [0-360].
  10932. @item HUEAVG
  10933. Display the average value for hue within the input frame. Expressed in range of
  10934. [0-360].
  10935. @item YDIF
  10936. Display the average of sample value difference between all values of the Y
  10937. plane in the current frame and corresponding values of the previous input frame.
  10938. Expressed in range of [0-255].
  10939. @item UDIF
  10940. Display the average of sample value difference between all values of the U
  10941. plane in the current frame and corresponding values of the previous input frame.
  10942. Expressed in range of [0-255].
  10943. @item VDIF
  10944. Display the average of sample value difference between all values of the V
  10945. plane in the current frame and corresponding values of the previous input frame.
  10946. Expressed in range of [0-255].
  10947. @item YBITDEPTH
  10948. Display bit depth of Y plane in current frame.
  10949. Expressed in range of [0-16].
  10950. @item UBITDEPTH
  10951. Display bit depth of U plane in current frame.
  10952. Expressed in range of [0-16].
  10953. @item VBITDEPTH
  10954. Display bit depth of V plane in current frame.
  10955. Expressed in range of [0-16].
  10956. @end table
  10957. The filter accepts the following options:
  10958. @table @option
  10959. @item stat
  10960. @item out
  10961. @option{stat} specify an additional form of image analysis.
  10962. @option{out} output video with the specified type of pixel highlighted.
  10963. Both options accept the following values:
  10964. @table @samp
  10965. @item tout
  10966. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  10967. unlike the neighboring pixels of the same field. Examples of temporal outliers
  10968. include the results of video dropouts, head clogs, or tape tracking issues.
  10969. @item vrep
  10970. Identify @var{vertical line repetition}. Vertical line repetition includes
  10971. similar rows of pixels within a frame. In born-digital video vertical line
  10972. repetition is common, but this pattern is uncommon in video digitized from an
  10973. analog source. When it occurs in video that results from the digitization of an
  10974. analog source it can indicate concealment from a dropout compensator.
  10975. @item brng
  10976. Identify pixels that fall outside of legal broadcast range.
  10977. @end table
  10978. @item color, c
  10979. Set the highlight color for the @option{out} option. The default color is
  10980. yellow.
  10981. @end table
  10982. @subsection Examples
  10983. @itemize
  10984. @item
  10985. Output data of various video metrics:
  10986. @example
  10987. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  10988. @end example
  10989. @item
  10990. Output specific data about the minimum and maximum values of the Y plane per frame:
  10991. @example
  10992. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  10993. @end example
  10994. @item
  10995. Playback video while highlighting pixels that are outside of broadcast range in red.
  10996. @example
  10997. ffplay example.mov -vf signalstats="out=brng:color=red"
  10998. @end example
  10999. @item
  11000. Playback video with signalstats metadata drawn over the frame.
  11001. @example
  11002. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  11003. @end example
  11004. The contents of signalstat_drawtext.txt used in the command are:
  11005. @example
  11006. time %@{pts:hms@}
  11007. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  11008. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  11009. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  11010. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  11011. @end example
  11012. @end itemize
  11013. @anchor{signature}
  11014. @section signature
  11015. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  11016. input. In this case the matching between the inputs can be calculated additionally.
  11017. The filter always passes through the first input. The signature of each stream can
  11018. be written into a file.
  11019. It accepts the following options:
  11020. @table @option
  11021. @item detectmode
  11022. Enable or disable the matching process.
  11023. Available values are:
  11024. @table @samp
  11025. @item off
  11026. Disable the calculation of a matching (default).
  11027. @item full
  11028. Calculate the matching for the whole video and output whether the whole video
  11029. matches or only parts.
  11030. @item fast
  11031. Calculate only until a matching is found or the video ends. Should be faster in
  11032. some cases.
  11033. @end table
  11034. @item nb_inputs
  11035. Set the number of inputs. The option value must be a non negative integer.
  11036. Default value is 1.
  11037. @item filename
  11038. Set the path to which the output is written. If there is more than one input,
  11039. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  11040. integer), that will be replaced with the input number. If no filename is
  11041. specified, no output will be written. This is the default.
  11042. @item format
  11043. Choose the output format.
  11044. Available values are:
  11045. @table @samp
  11046. @item binary
  11047. Use the specified binary representation (default).
  11048. @item xml
  11049. Use the specified xml representation.
  11050. @end table
  11051. @item th_d
  11052. Set threshold to detect one word as similar. The option value must be an integer
  11053. greater than zero. The default value is 9000.
  11054. @item th_dc
  11055. Set threshold to detect all words as similar. The option value must be an integer
  11056. greater than zero. The default value is 60000.
  11057. @item th_xh
  11058. Set threshold to detect frames as similar. The option value must be an integer
  11059. greater than zero. The default value is 116.
  11060. @item th_di
  11061. Set the minimum length of a sequence in frames to recognize it as matching
  11062. sequence. The option value must be a non negative integer value.
  11063. The default value is 0.
  11064. @item th_it
  11065. Set the minimum relation, that matching frames to all frames must have.
  11066. The option value must be a double value between 0 and 1. The default value is 0.5.
  11067. @end table
  11068. @subsection Examples
  11069. @itemize
  11070. @item
  11071. To calculate the signature of an input video and store it in signature.bin:
  11072. @example
  11073. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  11074. @end example
  11075. @item
  11076. To detect whether two videos match and store the signatures in XML format in
  11077. signature0.xml and signature1.xml:
  11078. @example
  11079. 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 -
  11080. @end example
  11081. @end itemize
  11082. @anchor{smartblur}
  11083. @section smartblur
  11084. Blur the input video without impacting the outlines.
  11085. It accepts the following options:
  11086. @table @option
  11087. @item luma_radius, lr
  11088. Set the luma radius. The option value must be a float number in
  11089. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11090. used to blur the image (slower if larger). Default value is 1.0.
  11091. @item luma_strength, ls
  11092. Set the luma strength. The option value must be a float number
  11093. in the range [-1.0,1.0] that configures the blurring. A value included
  11094. in [0.0,1.0] will blur the image whereas a value included in
  11095. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  11096. @item luma_threshold, lt
  11097. Set the luma threshold used as a coefficient to determine
  11098. whether a pixel should be blurred or not. The option value must be an
  11099. integer in the range [-30,30]. A value of 0 will filter all the image,
  11100. a value included in [0,30] will filter flat areas and a value included
  11101. in [-30,0] will filter edges. Default value is 0.
  11102. @item chroma_radius, cr
  11103. Set the chroma radius. The option value must be a float number in
  11104. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11105. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  11106. @item chroma_strength, cs
  11107. Set the chroma strength. The option value must be a float number
  11108. in the range [-1.0,1.0] that configures the blurring. A value included
  11109. in [0.0,1.0] will blur the image whereas a value included in
  11110. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  11111. @item chroma_threshold, ct
  11112. Set the chroma threshold used as a coefficient to determine
  11113. whether a pixel should be blurred or not. The option value must be an
  11114. integer in the range [-30,30]. A value of 0 will filter all the image,
  11115. a value included in [0,30] will filter flat areas and a value included
  11116. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  11117. @end table
  11118. If a chroma option is not explicitly set, the corresponding luma value
  11119. is set.
  11120. @section ssim
  11121. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  11122. This filter takes in input two input videos, the first input is
  11123. considered the "main" source and is passed unchanged to the
  11124. output. The second input is used as a "reference" video for computing
  11125. the SSIM.
  11126. Both video inputs must have the same resolution and pixel format for
  11127. this filter to work correctly. Also it assumes that both inputs
  11128. have the same number of frames, which are compared one by one.
  11129. The filter stores the calculated SSIM of each frame.
  11130. The description of the accepted parameters follows.
  11131. @table @option
  11132. @item stats_file, f
  11133. If specified the filter will use the named file to save the SSIM of
  11134. each individual frame. When filename equals "-" the data is sent to
  11135. standard output.
  11136. @end table
  11137. The file printed if @var{stats_file} is selected, contains a sequence of
  11138. key/value pairs of the form @var{key}:@var{value} for each compared
  11139. couple of frames.
  11140. A description of each shown parameter follows:
  11141. @table @option
  11142. @item n
  11143. sequential number of the input frame, starting from 1
  11144. @item Y, U, V, R, G, B
  11145. SSIM of the compared frames for the component specified by the suffix.
  11146. @item All
  11147. SSIM of the compared frames for the whole frame.
  11148. @item dB
  11149. Same as above but in dB representation.
  11150. @end table
  11151. This filter also supports the @ref{framesync} options.
  11152. For example:
  11153. @example
  11154. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11155. [main][ref] ssim="stats_file=stats.log" [out]
  11156. @end example
  11157. On this example the input file being processed is compared with the
  11158. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  11159. is stored in @file{stats.log}.
  11160. Another example with both psnr and ssim at same time:
  11161. @example
  11162. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  11163. @end example
  11164. @section stereo3d
  11165. Convert between different stereoscopic image formats.
  11166. The filters accept the following options:
  11167. @table @option
  11168. @item in
  11169. Set stereoscopic image format of input.
  11170. Available values for input image formats are:
  11171. @table @samp
  11172. @item sbsl
  11173. side by side parallel (left eye left, right eye right)
  11174. @item sbsr
  11175. side by side crosseye (right eye left, left eye right)
  11176. @item sbs2l
  11177. side by side parallel with half width resolution
  11178. (left eye left, right eye right)
  11179. @item sbs2r
  11180. side by side crosseye with half width resolution
  11181. (right eye left, left eye right)
  11182. @item abl
  11183. above-below (left eye above, right eye below)
  11184. @item abr
  11185. above-below (right eye above, left eye below)
  11186. @item ab2l
  11187. above-below with half height resolution
  11188. (left eye above, right eye below)
  11189. @item ab2r
  11190. above-below with half height resolution
  11191. (right eye above, left eye below)
  11192. @item al
  11193. alternating frames (left eye first, right eye second)
  11194. @item ar
  11195. alternating frames (right eye first, left eye second)
  11196. @item irl
  11197. interleaved rows (left eye has top row, right eye starts on next row)
  11198. @item irr
  11199. interleaved rows (right eye has top row, left eye starts on next row)
  11200. @item icl
  11201. interleaved columns, left eye first
  11202. @item icr
  11203. interleaved columns, right eye first
  11204. Default value is @samp{sbsl}.
  11205. @end table
  11206. @item out
  11207. Set stereoscopic image format of output.
  11208. @table @samp
  11209. @item sbsl
  11210. side by side parallel (left eye left, right eye right)
  11211. @item sbsr
  11212. side by side crosseye (right eye left, left eye right)
  11213. @item sbs2l
  11214. side by side parallel with half width resolution
  11215. (left eye left, right eye right)
  11216. @item sbs2r
  11217. side by side crosseye with half width resolution
  11218. (right eye left, left eye right)
  11219. @item abl
  11220. above-below (left eye above, right eye below)
  11221. @item abr
  11222. above-below (right eye above, left eye below)
  11223. @item ab2l
  11224. above-below with half height resolution
  11225. (left eye above, right eye below)
  11226. @item ab2r
  11227. above-below with half height resolution
  11228. (right eye above, left eye below)
  11229. @item al
  11230. alternating frames (left eye first, right eye second)
  11231. @item ar
  11232. alternating frames (right eye first, left eye second)
  11233. @item irl
  11234. interleaved rows (left eye has top row, right eye starts on next row)
  11235. @item irr
  11236. interleaved rows (right eye has top row, left eye starts on next row)
  11237. @item arbg
  11238. anaglyph red/blue gray
  11239. (red filter on left eye, blue filter on right eye)
  11240. @item argg
  11241. anaglyph red/green gray
  11242. (red filter on left eye, green filter on right eye)
  11243. @item arcg
  11244. anaglyph red/cyan gray
  11245. (red filter on left eye, cyan filter on right eye)
  11246. @item arch
  11247. anaglyph red/cyan half colored
  11248. (red filter on left eye, cyan filter on right eye)
  11249. @item arcc
  11250. anaglyph red/cyan color
  11251. (red filter on left eye, cyan filter on right eye)
  11252. @item arcd
  11253. anaglyph red/cyan color optimized with the least squares projection of dubois
  11254. (red filter on left eye, cyan filter on right eye)
  11255. @item agmg
  11256. anaglyph green/magenta gray
  11257. (green filter on left eye, magenta filter on right eye)
  11258. @item agmh
  11259. anaglyph green/magenta half colored
  11260. (green filter on left eye, magenta filter on right eye)
  11261. @item agmc
  11262. anaglyph green/magenta colored
  11263. (green filter on left eye, magenta filter on right eye)
  11264. @item agmd
  11265. anaglyph green/magenta color optimized with the least squares projection of dubois
  11266. (green filter on left eye, magenta filter on right eye)
  11267. @item aybg
  11268. anaglyph yellow/blue gray
  11269. (yellow filter on left eye, blue filter on right eye)
  11270. @item aybh
  11271. anaglyph yellow/blue half colored
  11272. (yellow filter on left eye, blue filter on right eye)
  11273. @item aybc
  11274. anaglyph yellow/blue colored
  11275. (yellow filter on left eye, blue filter on right eye)
  11276. @item aybd
  11277. anaglyph yellow/blue color optimized with the least squares projection of dubois
  11278. (yellow filter on left eye, blue filter on right eye)
  11279. @item ml
  11280. mono output (left eye only)
  11281. @item mr
  11282. mono output (right eye only)
  11283. @item chl
  11284. checkerboard, left eye first
  11285. @item chr
  11286. checkerboard, right eye first
  11287. @item icl
  11288. interleaved columns, left eye first
  11289. @item icr
  11290. interleaved columns, right eye first
  11291. @item hdmi
  11292. HDMI frame pack
  11293. @end table
  11294. Default value is @samp{arcd}.
  11295. @end table
  11296. @subsection Examples
  11297. @itemize
  11298. @item
  11299. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  11300. @example
  11301. stereo3d=sbsl:aybd
  11302. @end example
  11303. @item
  11304. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  11305. @example
  11306. stereo3d=abl:sbsr
  11307. @end example
  11308. @end itemize
  11309. @section streamselect, astreamselect
  11310. Select video or audio streams.
  11311. The filter accepts the following options:
  11312. @table @option
  11313. @item inputs
  11314. Set number of inputs. Default is 2.
  11315. @item map
  11316. Set input indexes to remap to outputs.
  11317. @end table
  11318. @subsection Commands
  11319. The @code{streamselect} and @code{astreamselect} filter supports the following
  11320. commands:
  11321. @table @option
  11322. @item map
  11323. Set input indexes to remap to outputs.
  11324. @end table
  11325. @subsection Examples
  11326. @itemize
  11327. @item
  11328. Select first 5 seconds 1st stream and rest of time 2nd stream:
  11329. @example
  11330. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  11331. @end example
  11332. @item
  11333. Same as above, but for audio:
  11334. @example
  11335. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  11336. @end example
  11337. @end itemize
  11338. @section sobel
  11339. Apply sobel operator to input video stream.
  11340. The filter accepts the following option:
  11341. @table @option
  11342. @item planes
  11343. Set which planes will be processed, unprocessed planes will be copied.
  11344. By default value 0xf, all planes will be processed.
  11345. @item scale
  11346. Set value which will be multiplied with filtered result.
  11347. @item delta
  11348. Set value which will be added to filtered result.
  11349. @end table
  11350. @anchor{spp}
  11351. @section spp
  11352. Apply a simple postprocessing filter that compresses and decompresses the image
  11353. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  11354. and average the results.
  11355. The filter accepts the following options:
  11356. @table @option
  11357. @item quality
  11358. Set quality. This option defines the number of levels for averaging. It accepts
  11359. an integer in the range 0-6. If set to @code{0}, the filter will have no
  11360. effect. A value of @code{6} means the higher quality. For each increment of
  11361. that value the speed drops by a factor of approximately 2. Default value is
  11362. @code{3}.
  11363. @item qp
  11364. Force a constant quantization parameter. If not set, the filter will use the QP
  11365. from the video stream (if available).
  11366. @item mode
  11367. Set thresholding mode. Available modes are:
  11368. @table @samp
  11369. @item hard
  11370. Set hard thresholding (default).
  11371. @item soft
  11372. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11373. @end table
  11374. @item use_bframe_qp
  11375. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  11376. option may cause flicker since the B-Frames have often larger QP. Default is
  11377. @code{0} (not enabled).
  11378. @end table
  11379. @anchor{subtitles}
  11380. @section subtitles
  11381. Draw subtitles on top of input video using the libass library.
  11382. To enable compilation of this filter you need to configure FFmpeg with
  11383. @code{--enable-libass}. This filter also requires a build with libavcodec and
  11384. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  11385. Alpha) subtitles format.
  11386. The filter accepts the following options:
  11387. @table @option
  11388. @item filename, f
  11389. Set the filename of the subtitle file to read. It must be specified.
  11390. @item original_size
  11391. Specify the size of the original video, the video for which the ASS file
  11392. was composed. For the syntax of this option, check the
  11393. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11394. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  11395. correctly scale the fonts if the aspect ratio has been changed.
  11396. @item fontsdir
  11397. Set a directory path containing fonts that can be used by the filter.
  11398. These fonts will be used in addition to whatever the font provider uses.
  11399. @item alpha
  11400. Process alpha channel, by default alpha channel is untouched.
  11401. @item charenc
  11402. Set subtitles input character encoding. @code{subtitles} filter only. Only
  11403. useful if not UTF-8.
  11404. @item stream_index, si
  11405. Set subtitles stream index. @code{subtitles} filter only.
  11406. @item force_style
  11407. Override default style or script info parameters of the subtitles. It accepts a
  11408. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  11409. @end table
  11410. If the first key is not specified, it is assumed that the first value
  11411. specifies the @option{filename}.
  11412. For example, to render the file @file{sub.srt} on top of the input
  11413. video, use the command:
  11414. @example
  11415. subtitles=sub.srt
  11416. @end example
  11417. which is equivalent to:
  11418. @example
  11419. subtitles=filename=sub.srt
  11420. @end example
  11421. To render the default subtitles stream from file @file{video.mkv}, use:
  11422. @example
  11423. subtitles=video.mkv
  11424. @end example
  11425. To render the second subtitles stream from that file, use:
  11426. @example
  11427. subtitles=video.mkv:si=1
  11428. @end example
  11429. To make the subtitles stream from @file{sub.srt} appear in transparent green
  11430. @code{DejaVu Serif}, use:
  11431. @example
  11432. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  11433. @end example
  11434. @section super2xsai
  11435. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  11436. Interpolate) pixel art scaling algorithm.
  11437. Useful for enlarging pixel art images without reducing sharpness.
  11438. @section swaprect
  11439. Swap two rectangular objects in video.
  11440. This filter accepts the following options:
  11441. @table @option
  11442. @item w
  11443. Set object width.
  11444. @item h
  11445. Set object height.
  11446. @item x1
  11447. Set 1st rect x coordinate.
  11448. @item y1
  11449. Set 1st rect y coordinate.
  11450. @item x2
  11451. Set 2nd rect x coordinate.
  11452. @item y2
  11453. Set 2nd rect y coordinate.
  11454. All expressions are evaluated once for each frame.
  11455. @end table
  11456. The all options are expressions containing the following constants:
  11457. @table @option
  11458. @item w
  11459. @item h
  11460. The input width and height.
  11461. @item a
  11462. same as @var{w} / @var{h}
  11463. @item sar
  11464. input sample aspect ratio
  11465. @item dar
  11466. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  11467. @item n
  11468. The number of the input frame, starting from 0.
  11469. @item t
  11470. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  11471. @item pos
  11472. the position in the file of the input frame, NAN if unknown
  11473. @end table
  11474. @section swapuv
  11475. Swap U & V plane.
  11476. @section telecine
  11477. Apply telecine process to the video.
  11478. This filter accepts the following options:
  11479. @table @option
  11480. @item first_field
  11481. @table @samp
  11482. @item top, t
  11483. top field first
  11484. @item bottom, b
  11485. bottom field first
  11486. The default value is @code{top}.
  11487. @end table
  11488. @item pattern
  11489. A string of numbers representing the pulldown pattern you wish to apply.
  11490. The default value is @code{23}.
  11491. @end table
  11492. @example
  11493. Some typical patterns:
  11494. NTSC output (30i):
  11495. 27.5p: 32222
  11496. 24p: 23 (classic)
  11497. 24p: 2332 (preferred)
  11498. 20p: 33
  11499. 18p: 334
  11500. 16p: 3444
  11501. PAL output (25i):
  11502. 27.5p: 12222
  11503. 24p: 222222222223 ("Euro pulldown")
  11504. 16.67p: 33
  11505. 16p: 33333334
  11506. @end example
  11507. @section threshold
  11508. Apply threshold effect to video stream.
  11509. This filter needs four video streams to perform thresholding.
  11510. First stream is stream we are filtering.
  11511. Second stream is holding threshold values, third stream is holding min values,
  11512. and last, fourth stream is holding max values.
  11513. The filter accepts the following option:
  11514. @table @option
  11515. @item planes
  11516. Set which planes will be processed, unprocessed planes will be copied.
  11517. By default value 0xf, all planes will be processed.
  11518. @end table
  11519. For example if first stream pixel's component value is less then threshold value
  11520. of pixel component from 2nd threshold stream, third stream value will picked,
  11521. otherwise fourth stream pixel component value will be picked.
  11522. Using color source filter one can perform various types of thresholding:
  11523. @subsection Examples
  11524. @itemize
  11525. @item
  11526. Binary threshold, using gray color as threshold:
  11527. @example
  11528. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  11529. @end example
  11530. @item
  11531. Inverted binary threshold, using gray color as threshold:
  11532. @example
  11533. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  11534. @end example
  11535. @item
  11536. Truncate binary threshold, using gray color as threshold:
  11537. @example
  11538. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  11539. @end example
  11540. @item
  11541. Threshold to zero, using gray color as threshold:
  11542. @example
  11543. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  11544. @end example
  11545. @item
  11546. Inverted threshold to zero, using gray color as threshold:
  11547. @example
  11548. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  11549. @end example
  11550. @end itemize
  11551. @section thumbnail
  11552. Select the most representative frame in a given sequence of consecutive frames.
  11553. The filter accepts the following options:
  11554. @table @option
  11555. @item n
  11556. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  11557. will pick one of them, and then handle the next batch of @var{n} frames until
  11558. the end. Default is @code{100}.
  11559. @end table
  11560. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  11561. value will result in a higher memory usage, so a high value is not recommended.
  11562. @subsection Examples
  11563. @itemize
  11564. @item
  11565. Extract one picture each 50 frames:
  11566. @example
  11567. thumbnail=50
  11568. @end example
  11569. @item
  11570. Complete example of a thumbnail creation with @command{ffmpeg}:
  11571. @example
  11572. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  11573. @end example
  11574. @end itemize
  11575. @section tile
  11576. Tile several successive frames together.
  11577. The filter accepts the following options:
  11578. @table @option
  11579. @item layout
  11580. Set the grid size (i.e. the number of lines and columns). For the syntax of
  11581. this option, check the
  11582. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11583. @item nb_frames
  11584. Set the maximum number of frames to render in the given area. It must be less
  11585. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  11586. the area will be used.
  11587. @item margin
  11588. Set the outer border margin in pixels.
  11589. @item padding
  11590. Set the inner border thickness (i.e. the number of pixels between frames). For
  11591. more advanced padding options (such as having different values for the edges),
  11592. refer to the pad video filter.
  11593. @item color
  11594. Specify the color of the unused area. For the syntax of this option, check the
  11595. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11596. The default value of @var{color} is "black".
  11597. @item overlap
  11598. Set the number of frames to overlap when tiling several successive frames together.
  11599. The value must be between @code{0} and @var{nb_frames - 1}.
  11600. @item init_padding
  11601. Set the number of frames to initially be empty before displaying first output frame.
  11602. This controls how soon will one get first output frame.
  11603. The value must be between @code{0} and @var{nb_frames - 1}.
  11604. @end table
  11605. @subsection Examples
  11606. @itemize
  11607. @item
  11608. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  11609. @example
  11610. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  11611. @end example
  11612. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  11613. duplicating each output frame to accommodate the originally detected frame
  11614. rate.
  11615. @item
  11616. Display @code{5} pictures in an area of @code{3x2} frames,
  11617. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  11618. mixed flat and named options:
  11619. @example
  11620. tile=3x2:nb_frames=5:padding=7:margin=2
  11621. @end example
  11622. @end itemize
  11623. @section tinterlace
  11624. Perform various types of temporal field interlacing.
  11625. Frames are counted starting from 1, so the first input frame is
  11626. considered odd.
  11627. The filter accepts the following options:
  11628. @table @option
  11629. @item mode
  11630. Specify the mode of the interlacing. This option can also be specified
  11631. as a value alone. See below for a list of values for this option.
  11632. Available values are:
  11633. @table @samp
  11634. @item merge, 0
  11635. Move odd frames into the upper field, even into the lower field,
  11636. generating a double height frame at half frame rate.
  11637. @example
  11638. ------> time
  11639. Input:
  11640. Frame 1 Frame 2 Frame 3 Frame 4
  11641. 11111 22222 33333 44444
  11642. 11111 22222 33333 44444
  11643. 11111 22222 33333 44444
  11644. 11111 22222 33333 44444
  11645. Output:
  11646. 11111 33333
  11647. 22222 44444
  11648. 11111 33333
  11649. 22222 44444
  11650. 11111 33333
  11651. 22222 44444
  11652. 11111 33333
  11653. 22222 44444
  11654. @end example
  11655. @item drop_even, 1
  11656. Only output odd frames, even frames are dropped, generating a frame with
  11657. unchanged height at half frame rate.
  11658. @example
  11659. ------> time
  11660. Input:
  11661. Frame 1 Frame 2 Frame 3 Frame 4
  11662. 11111 22222 33333 44444
  11663. 11111 22222 33333 44444
  11664. 11111 22222 33333 44444
  11665. 11111 22222 33333 44444
  11666. Output:
  11667. 11111 33333
  11668. 11111 33333
  11669. 11111 33333
  11670. 11111 33333
  11671. @end example
  11672. @item drop_odd, 2
  11673. Only output even frames, odd frames are dropped, generating a frame with
  11674. unchanged height at half frame rate.
  11675. @example
  11676. ------> time
  11677. Input:
  11678. Frame 1 Frame 2 Frame 3 Frame 4
  11679. 11111 22222 33333 44444
  11680. 11111 22222 33333 44444
  11681. 11111 22222 33333 44444
  11682. 11111 22222 33333 44444
  11683. Output:
  11684. 22222 44444
  11685. 22222 44444
  11686. 22222 44444
  11687. 22222 44444
  11688. @end example
  11689. @item pad, 3
  11690. Expand each frame to full height, but pad alternate lines with black,
  11691. generating a frame with double height at the same input frame rate.
  11692. @example
  11693. ------> time
  11694. Input:
  11695. Frame 1 Frame 2 Frame 3 Frame 4
  11696. 11111 22222 33333 44444
  11697. 11111 22222 33333 44444
  11698. 11111 22222 33333 44444
  11699. 11111 22222 33333 44444
  11700. Output:
  11701. 11111 ..... 33333 .....
  11702. ..... 22222 ..... 44444
  11703. 11111 ..... 33333 .....
  11704. ..... 22222 ..... 44444
  11705. 11111 ..... 33333 .....
  11706. ..... 22222 ..... 44444
  11707. 11111 ..... 33333 .....
  11708. ..... 22222 ..... 44444
  11709. @end example
  11710. @item interleave_top, 4
  11711. Interleave the upper field from odd frames with the lower field from
  11712. even frames, generating a frame with unchanged height at half frame rate.
  11713. @example
  11714. ------> time
  11715. Input:
  11716. Frame 1 Frame 2 Frame 3 Frame 4
  11717. 11111<- 22222 33333<- 44444
  11718. 11111 22222<- 33333 44444<-
  11719. 11111<- 22222 33333<- 44444
  11720. 11111 22222<- 33333 44444<-
  11721. Output:
  11722. 11111 33333
  11723. 22222 44444
  11724. 11111 33333
  11725. 22222 44444
  11726. @end example
  11727. @item interleave_bottom, 5
  11728. Interleave the lower field from odd frames with the upper field from
  11729. even frames, generating a frame with unchanged height at half frame rate.
  11730. @example
  11731. ------> time
  11732. Input:
  11733. Frame 1 Frame 2 Frame 3 Frame 4
  11734. 11111 22222<- 33333 44444<-
  11735. 11111<- 22222 33333<- 44444
  11736. 11111 22222<- 33333 44444<-
  11737. 11111<- 22222 33333<- 44444
  11738. Output:
  11739. 22222 44444
  11740. 11111 33333
  11741. 22222 44444
  11742. 11111 33333
  11743. @end example
  11744. @item interlacex2, 6
  11745. Double frame rate with unchanged height. Frames are inserted each
  11746. containing the second temporal field from the previous input frame and
  11747. the first temporal field from the next input frame. This mode relies on
  11748. the top_field_first flag. Useful for interlaced video displays with no
  11749. field synchronisation.
  11750. @example
  11751. ------> time
  11752. Input:
  11753. Frame 1 Frame 2 Frame 3 Frame 4
  11754. 11111 22222 33333 44444
  11755. 11111 22222 33333 44444
  11756. 11111 22222 33333 44444
  11757. 11111 22222 33333 44444
  11758. Output:
  11759. 11111 22222 22222 33333 33333 44444 44444
  11760. 11111 11111 22222 22222 33333 33333 44444
  11761. 11111 22222 22222 33333 33333 44444 44444
  11762. 11111 11111 22222 22222 33333 33333 44444
  11763. @end example
  11764. @item mergex2, 7
  11765. Move odd frames into the upper field, even into the lower field,
  11766. generating a double height frame at same frame rate.
  11767. @example
  11768. ------> time
  11769. Input:
  11770. Frame 1 Frame 2 Frame 3 Frame 4
  11771. 11111 22222 33333 44444
  11772. 11111 22222 33333 44444
  11773. 11111 22222 33333 44444
  11774. 11111 22222 33333 44444
  11775. Output:
  11776. 11111 33333 33333 55555
  11777. 22222 22222 44444 44444
  11778. 11111 33333 33333 55555
  11779. 22222 22222 44444 44444
  11780. 11111 33333 33333 55555
  11781. 22222 22222 44444 44444
  11782. 11111 33333 33333 55555
  11783. 22222 22222 44444 44444
  11784. @end example
  11785. @end table
  11786. Numeric values are deprecated but are accepted for backward
  11787. compatibility reasons.
  11788. Default mode is @code{merge}.
  11789. @item flags
  11790. Specify flags influencing the filter process.
  11791. Available value for @var{flags} is:
  11792. @table @option
  11793. @item low_pass_filter, vlfp
  11794. Enable linear vertical low-pass filtering in the filter.
  11795. Vertical low-pass filtering is required when creating an interlaced
  11796. destination from a progressive source which contains high-frequency
  11797. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  11798. patterning.
  11799. @item complex_filter, cvlfp
  11800. Enable complex vertical low-pass filtering.
  11801. This will slightly less reduce interlace 'twitter' and Moire
  11802. patterning but better retain detail and subjective sharpness impression.
  11803. @end table
  11804. Vertical low-pass filtering can only be enabled for @option{mode}
  11805. @var{interleave_top} and @var{interleave_bottom}.
  11806. @end table
  11807. @section tonemap
  11808. Tone map colors from different dynamic ranges.
  11809. This filter expects data in single precision floating point, as it needs to
  11810. operate on (and can output) out-of-range values. Another filter, such as
  11811. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  11812. The tonemapping algorithms implemented only work on linear light, so input
  11813. data should be linearized beforehand (and possibly correctly tagged).
  11814. @example
  11815. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  11816. @end example
  11817. @subsection Options
  11818. The filter accepts the following options.
  11819. @table @option
  11820. @item tonemap
  11821. Set the tone map algorithm to use.
  11822. Possible values are:
  11823. @table @var
  11824. @item none
  11825. Do not apply any tone map, only desaturate overbright pixels.
  11826. @item clip
  11827. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  11828. in-range values, while distorting out-of-range values.
  11829. @item linear
  11830. Stretch the entire reference gamut to a linear multiple of the display.
  11831. @item gamma
  11832. Fit a logarithmic transfer between the tone curves.
  11833. @item reinhard
  11834. Preserve overall image brightness with a simple curve, using nonlinear
  11835. contrast, which results in flattening details and degrading color accuracy.
  11836. @item hable
  11837. Preserve both dark and bright details better than @var{reinhard}, at the cost
  11838. of slightly darkening everything. Use it when detail preservation is more
  11839. important than color and brightness accuracy.
  11840. @item mobius
  11841. Smoothly map out-of-range values, while retaining contrast and colors for
  11842. in-range material as much as possible. Use it when color accuracy is more
  11843. important than detail preservation.
  11844. @end table
  11845. Default is none.
  11846. @item param
  11847. Tune the tone mapping algorithm.
  11848. This affects the following algorithms:
  11849. @table @var
  11850. @item none
  11851. Ignored.
  11852. @item linear
  11853. Specifies the scale factor to use while stretching.
  11854. Default to 1.0.
  11855. @item gamma
  11856. Specifies the exponent of the function.
  11857. Default to 1.8.
  11858. @item clip
  11859. Specify an extra linear coefficient to multiply into the signal before clipping.
  11860. Default to 1.0.
  11861. @item reinhard
  11862. Specify the local contrast coefficient at the display peak.
  11863. Default to 0.5, which means that in-gamut values will be about half as bright
  11864. as when clipping.
  11865. @item hable
  11866. Ignored.
  11867. @item mobius
  11868. Specify the transition point from linear to mobius transform. Every value
  11869. below this point is guaranteed to be mapped 1:1. The higher the value, the
  11870. more accurate the result will be, at the cost of losing bright details.
  11871. Default to 0.3, which due to the steep initial slope still preserves in-range
  11872. colors fairly accurately.
  11873. @end table
  11874. @item desat
  11875. Apply desaturation for highlights that exceed this level of brightness. The
  11876. higher the parameter, the more color information will be preserved. This
  11877. setting helps prevent unnaturally blown-out colors for super-highlights, by
  11878. (smoothly) turning into white instead. This makes images feel more natural,
  11879. at the cost of reducing information about out-of-range colors.
  11880. The default of 2.0 is somewhat conservative and will mostly just apply to
  11881. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  11882. This option works only if the input frame has a supported color tag.
  11883. @item peak
  11884. Override signal/nominal/reference peak with this value. Useful when the
  11885. embedded peak information in display metadata is not reliable or when tone
  11886. mapping from a lower range to a higher range.
  11887. @end table
  11888. @section transpose
  11889. Transpose rows with columns in the input video and optionally flip it.
  11890. It accepts the following parameters:
  11891. @table @option
  11892. @item dir
  11893. Specify the transposition direction.
  11894. Can assume the following values:
  11895. @table @samp
  11896. @item 0, 4, cclock_flip
  11897. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  11898. @example
  11899. L.R L.l
  11900. . . -> . .
  11901. l.r R.r
  11902. @end example
  11903. @item 1, 5, clock
  11904. Rotate by 90 degrees clockwise, that is:
  11905. @example
  11906. L.R l.L
  11907. . . -> . .
  11908. l.r r.R
  11909. @end example
  11910. @item 2, 6, cclock
  11911. Rotate by 90 degrees counterclockwise, that is:
  11912. @example
  11913. L.R R.r
  11914. . . -> . .
  11915. l.r L.l
  11916. @end example
  11917. @item 3, 7, clock_flip
  11918. Rotate by 90 degrees clockwise and vertically flip, that is:
  11919. @example
  11920. L.R r.R
  11921. . . -> . .
  11922. l.r l.L
  11923. @end example
  11924. @end table
  11925. For values between 4-7, the transposition is only done if the input
  11926. video geometry is portrait and not landscape. These values are
  11927. deprecated, the @code{passthrough} option should be used instead.
  11928. Numerical values are deprecated, and should be dropped in favor of
  11929. symbolic constants.
  11930. @item passthrough
  11931. Do not apply the transposition if the input geometry matches the one
  11932. specified by the specified value. It accepts the following values:
  11933. @table @samp
  11934. @item none
  11935. Always apply transposition.
  11936. @item portrait
  11937. Preserve portrait geometry (when @var{height} >= @var{width}).
  11938. @item landscape
  11939. Preserve landscape geometry (when @var{width} >= @var{height}).
  11940. @end table
  11941. Default value is @code{none}.
  11942. @end table
  11943. For example to rotate by 90 degrees clockwise and preserve portrait
  11944. layout:
  11945. @example
  11946. transpose=dir=1:passthrough=portrait
  11947. @end example
  11948. The command above can also be specified as:
  11949. @example
  11950. transpose=1:portrait
  11951. @end example
  11952. @section trim
  11953. Trim the input so that the output contains one continuous subpart of the input.
  11954. It accepts the following parameters:
  11955. @table @option
  11956. @item start
  11957. Specify the time of the start of the kept section, i.e. the frame with the
  11958. timestamp @var{start} will be the first frame in the output.
  11959. @item end
  11960. Specify the time of the first frame that will be dropped, i.e. the frame
  11961. immediately preceding the one with the timestamp @var{end} will be the last
  11962. frame in the output.
  11963. @item start_pts
  11964. This is the same as @var{start}, except this option sets the start timestamp
  11965. in timebase units instead of seconds.
  11966. @item end_pts
  11967. This is the same as @var{end}, except this option sets the end timestamp
  11968. in timebase units instead of seconds.
  11969. @item duration
  11970. The maximum duration of the output in seconds.
  11971. @item start_frame
  11972. The number of the first frame that should be passed to the output.
  11973. @item end_frame
  11974. The number of the first frame that should be dropped.
  11975. @end table
  11976. @option{start}, @option{end}, and @option{duration} are expressed as time
  11977. duration specifications; see
  11978. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11979. for the accepted syntax.
  11980. Note that the first two sets of the start/end options and the @option{duration}
  11981. option look at the frame timestamp, while the _frame variants simply count the
  11982. frames that pass through the filter. Also note that this filter does not modify
  11983. the timestamps. If you wish for the output timestamps to start at zero, insert a
  11984. setpts filter after the trim filter.
  11985. If multiple start or end options are set, this filter tries to be greedy and
  11986. keep all the frames that match at least one of the specified constraints. To keep
  11987. only the part that matches all the constraints at once, chain multiple trim
  11988. filters.
  11989. The defaults are such that all the input is kept. So it is possible to set e.g.
  11990. just the end values to keep everything before the specified time.
  11991. Examples:
  11992. @itemize
  11993. @item
  11994. Drop everything except the second minute of input:
  11995. @example
  11996. ffmpeg -i INPUT -vf trim=60:120
  11997. @end example
  11998. @item
  11999. Keep only the first second:
  12000. @example
  12001. ffmpeg -i INPUT -vf trim=duration=1
  12002. @end example
  12003. @end itemize
  12004. @section unpremultiply
  12005. Apply alpha unpremultiply effect to input video stream using first plane
  12006. of second stream as alpha.
  12007. Both streams must have same dimensions and same pixel format.
  12008. The filter accepts the following option:
  12009. @table @option
  12010. @item planes
  12011. Set which planes will be processed, unprocessed planes will be copied.
  12012. By default value 0xf, all planes will be processed.
  12013. If the format has 1 or 2 components, then luma is bit 0.
  12014. If the format has 3 or 4 components:
  12015. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  12016. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  12017. If present, the alpha channel is always the last bit.
  12018. @item inplace
  12019. Do not require 2nd input for processing, instead use alpha plane from input stream.
  12020. @end table
  12021. @anchor{unsharp}
  12022. @section unsharp
  12023. Sharpen or blur the input video.
  12024. It accepts the following parameters:
  12025. @table @option
  12026. @item luma_msize_x, lx
  12027. Set the luma matrix horizontal size. It must be an odd integer between
  12028. 3 and 23. The default value is 5.
  12029. @item luma_msize_y, ly
  12030. Set the luma matrix vertical size. It must be an odd integer between 3
  12031. and 23. The default value is 5.
  12032. @item luma_amount, la
  12033. Set the luma effect strength. It must be a floating point number, reasonable
  12034. values lay between -1.5 and 1.5.
  12035. Negative values will blur the input video, while positive values will
  12036. sharpen it, a value of zero will disable the effect.
  12037. Default value is 1.0.
  12038. @item chroma_msize_x, cx
  12039. Set the chroma matrix horizontal size. It must be an odd integer
  12040. between 3 and 23. The default value is 5.
  12041. @item chroma_msize_y, cy
  12042. Set the chroma matrix vertical size. It must be an odd integer
  12043. between 3 and 23. The default value is 5.
  12044. @item chroma_amount, ca
  12045. Set the chroma effect strength. It must be a floating point number, reasonable
  12046. values lay between -1.5 and 1.5.
  12047. Negative values will blur the input video, while positive values will
  12048. sharpen it, a value of zero will disable the effect.
  12049. Default value is 0.0.
  12050. @end table
  12051. All parameters are optional and default to the equivalent of the
  12052. string '5:5:1.0:5:5:0.0'.
  12053. @subsection Examples
  12054. @itemize
  12055. @item
  12056. Apply strong luma sharpen effect:
  12057. @example
  12058. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  12059. @end example
  12060. @item
  12061. Apply a strong blur of both luma and chroma parameters:
  12062. @example
  12063. unsharp=7:7:-2:7:7:-2
  12064. @end example
  12065. @end itemize
  12066. @section uspp
  12067. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  12068. the image at several (or - in the case of @option{quality} level @code{8} - all)
  12069. shifts and average the results.
  12070. The way this differs from the behavior of spp is that uspp actually encodes &
  12071. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  12072. DCT similar to MJPEG.
  12073. The filter accepts the following options:
  12074. @table @option
  12075. @item quality
  12076. Set quality. This option defines the number of levels for averaging. It accepts
  12077. an integer in the range 0-8. If set to @code{0}, the filter will have no
  12078. effect. A value of @code{8} means the higher quality. For each increment of
  12079. that value the speed drops by a factor of approximately 2. Default value is
  12080. @code{3}.
  12081. @item qp
  12082. Force a constant quantization parameter. If not set, the filter will use the QP
  12083. from the video stream (if available).
  12084. @end table
  12085. @section vaguedenoiser
  12086. Apply a wavelet based denoiser.
  12087. It transforms each frame from the video input into the wavelet domain,
  12088. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  12089. the obtained coefficients. It does an inverse wavelet transform after.
  12090. Due to wavelet properties, it should give a nice smoothed result, and
  12091. reduced noise, without blurring picture features.
  12092. This filter accepts the following options:
  12093. @table @option
  12094. @item threshold
  12095. The filtering strength. The higher, the more filtered the video will be.
  12096. Hard thresholding can use a higher threshold than soft thresholding
  12097. before the video looks overfiltered. Default value is 2.
  12098. @item method
  12099. The filtering method the filter will use.
  12100. It accepts the following values:
  12101. @table @samp
  12102. @item hard
  12103. All values under the threshold will be zeroed.
  12104. @item soft
  12105. All values under the threshold will be zeroed. All values above will be
  12106. reduced by the threshold.
  12107. @item garrote
  12108. Scales or nullifies coefficients - intermediary between (more) soft and
  12109. (less) hard thresholding.
  12110. @end table
  12111. Default is garrote.
  12112. @item nsteps
  12113. Number of times, the wavelet will decompose the picture. Picture can't
  12114. be decomposed beyond a particular point (typically, 8 for a 640x480
  12115. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  12116. @item percent
  12117. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  12118. @item planes
  12119. A list of the planes to process. By default all planes are processed.
  12120. @end table
  12121. @section vectorscope
  12122. Display 2 color component values in the two dimensional graph (which is called
  12123. a vectorscope).
  12124. This filter accepts the following options:
  12125. @table @option
  12126. @item mode, m
  12127. Set vectorscope mode.
  12128. It accepts the following values:
  12129. @table @samp
  12130. @item gray
  12131. Gray values are displayed on graph, higher brightness means more pixels have
  12132. same component color value on location in graph. This is the default mode.
  12133. @item color
  12134. Gray values are displayed on graph. Surrounding pixels values which are not
  12135. present in video frame are drawn in gradient of 2 color components which are
  12136. set by option @code{x} and @code{y}. The 3rd color component is static.
  12137. @item color2
  12138. Actual color components values present in video frame are displayed on graph.
  12139. @item color3
  12140. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  12141. on graph increases value of another color component, which is luminance by
  12142. default values of @code{x} and @code{y}.
  12143. @item color4
  12144. Actual colors present in video frame are displayed on graph. If two different
  12145. colors map to same position on graph then color with higher value of component
  12146. not present in graph is picked.
  12147. @item color5
  12148. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  12149. component picked from radial gradient.
  12150. @end table
  12151. @item x
  12152. Set which color component will be represented on X-axis. Default is @code{1}.
  12153. @item y
  12154. Set which color component will be represented on Y-axis. Default is @code{2}.
  12155. @item intensity, i
  12156. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  12157. of color component which represents frequency of (X, Y) location in graph.
  12158. @item envelope, e
  12159. @table @samp
  12160. @item none
  12161. No envelope, this is default.
  12162. @item instant
  12163. Instant envelope, even darkest single pixel will be clearly highlighted.
  12164. @item peak
  12165. Hold maximum and minimum values presented in graph over time. This way you
  12166. can still spot out of range values without constantly looking at vectorscope.
  12167. @item peak+instant
  12168. Peak and instant envelope combined together.
  12169. @end table
  12170. @item graticule, g
  12171. Set what kind of graticule to draw.
  12172. @table @samp
  12173. @item none
  12174. @item green
  12175. @item color
  12176. @end table
  12177. @item opacity, o
  12178. Set graticule opacity.
  12179. @item flags, f
  12180. Set graticule flags.
  12181. @table @samp
  12182. @item white
  12183. Draw graticule for white point.
  12184. @item black
  12185. Draw graticule for black point.
  12186. @item name
  12187. Draw color points short names.
  12188. @end table
  12189. @item bgopacity, b
  12190. Set background opacity.
  12191. @item lthreshold, l
  12192. Set low threshold for color component not represented on X or Y axis.
  12193. Values lower than this value will be ignored. Default is 0.
  12194. Note this value is multiplied with actual max possible value one pixel component
  12195. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  12196. is 0.1 * 255 = 25.
  12197. @item hthreshold, h
  12198. Set high threshold for color component not represented on X or Y axis.
  12199. Values higher than this value will be ignored. Default is 1.
  12200. Note this value is multiplied with actual max possible value one pixel component
  12201. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  12202. is 0.9 * 255 = 230.
  12203. @item colorspace, c
  12204. Set what kind of colorspace to use when drawing graticule.
  12205. @table @samp
  12206. @item auto
  12207. @item 601
  12208. @item 709
  12209. @end table
  12210. Default is auto.
  12211. @end table
  12212. @anchor{vidstabdetect}
  12213. @section vidstabdetect
  12214. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  12215. @ref{vidstabtransform} for pass 2.
  12216. This filter generates a file with relative translation and rotation
  12217. transform information about subsequent frames, which is then used by
  12218. the @ref{vidstabtransform} filter.
  12219. To enable compilation of this filter you need to configure FFmpeg with
  12220. @code{--enable-libvidstab}.
  12221. This filter accepts the following options:
  12222. @table @option
  12223. @item result
  12224. Set the path to the file used to write the transforms information.
  12225. Default value is @file{transforms.trf}.
  12226. @item shakiness
  12227. Set how shaky the video is and how quick the camera is. It accepts an
  12228. integer in the range 1-10, a value of 1 means little shakiness, a
  12229. value of 10 means strong shakiness. Default value is 5.
  12230. @item accuracy
  12231. Set the accuracy of the detection process. It must be a value in the
  12232. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  12233. accuracy. Default value is 15.
  12234. @item stepsize
  12235. Set stepsize of the search process. The region around minimum is
  12236. scanned with 1 pixel resolution. Default value is 6.
  12237. @item mincontrast
  12238. Set minimum contrast. Below this value a local measurement field is
  12239. discarded. Must be a floating point value in the range 0-1. Default
  12240. value is 0.3.
  12241. @item tripod
  12242. Set reference frame number for tripod mode.
  12243. If enabled, the motion of the frames is compared to a reference frame
  12244. in the filtered stream, identified by the specified number. The idea
  12245. is to compensate all movements in a more-or-less static scene and keep
  12246. the camera view absolutely still.
  12247. If set to 0, it is disabled. The frames are counted starting from 1.
  12248. @item show
  12249. Show fields and transforms in the resulting frames. It accepts an
  12250. integer in the range 0-2. Default value is 0, which disables any
  12251. visualization.
  12252. @end table
  12253. @subsection Examples
  12254. @itemize
  12255. @item
  12256. Use default values:
  12257. @example
  12258. vidstabdetect
  12259. @end example
  12260. @item
  12261. Analyze strongly shaky movie and put the results in file
  12262. @file{mytransforms.trf}:
  12263. @example
  12264. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  12265. @end example
  12266. @item
  12267. Visualize the result of internal transformations in the resulting
  12268. video:
  12269. @example
  12270. vidstabdetect=show=1
  12271. @end example
  12272. @item
  12273. Analyze a video with medium shakiness using @command{ffmpeg}:
  12274. @example
  12275. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  12276. @end example
  12277. @end itemize
  12278. @anchor{vidstabtransform}
  12279. @section vidstabtransform
  12280. Video stabilization/deshaking: pass 2 of 2,
  12281. see @ref{vidstabdetect} for pass 1.
  12282. Read a file with transform information for each frame and
  12283. apply/compensate them. Together with the @ref{vidstabdetect}
  12284. filter this can be used to deshake videos. See also
  12285. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  12286. the @ref{unsharp} filter, see below.
  12287. To enable compilation of this filter you need to configure FFmpeg with
  12288. @code{--enable-libvidstab}.
  12289. @subsection Options
  12290. @table @option
  12291. @item input
  12292. Set path to the file used to read the transforms. Default value is
  12293. @file{transforms.trf}.
  12294. @item smoothing
  12295. Set the number of frames (value*2 + 1) used for lowpass filtering the
  12296. camera movements. Default value is 10.
  12297. For example a number of 10 means that 21 frames are used (10 in the
  12298. past and 10 in the future) to smoothen the motion in the video. A
  12299. larger value leads to a smoother video, but limits the acceleration of
  12300. the camera (pan/tilt movements). 0 is a special case where a static
  12301. camera is simulated.
  12302. @item optalgo
  12303. Set the camera path optimization algorithm.
  12304. Accepted values are:
  12305. @table @samp
  12306. @item gauss
  12307. gaussian kernel low-pass filter on camera motion (default)
  12308. @item avg
  12309. averaging on transformations
  12310. @end table
  12311. @item maxshift
  12312. Set maximal number of pixels to translate frames. Default value is -1,
  12313. meaning no limit.
  12314. @item maxangle
  12315. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  12316. value is -1, meaning no limit.
  12317. @item crop
  12318. Specify how to deal with borders that may be visible due to movement
  12319. compensation.
  12320. Available values are:
  12321. @table @samp
  12322. @item keep
  12323. keep image information from previous frame (default)
  12324. @item black
  12325. fill the border black
  12326. @end table
  12327. @item invert
  12328. Invert transforms if set to 1. Default value is 0.
  12329. @item relative
  12330. Consider transforms as relative to previous frame if set to 1,
  12331. absolute if set to 0. Default value is 0.
  12332. @item zoom
  12333. Set percentage to zoom. A positive value will result in a zoom-in
  12334. effect, a negative value in a zoom-out effect. Default value is 0 (no
  12335. zoom).
  12336. @item optzoom
  12337. Set optimal zooming to avoid borders.
  12338. Accepted values are:
  12339. @table @samp
  12340. @item 0
  12341. disabled
  12342. @item 1
  12343. optimal static zoom value is determined (only very strong movements
  12344. will lead to visible borders) (default)
  12345. @item 2
  12346. optimal adaptive zoom value is determined (no borders will be
  12347. visible), see @option{zoomspeed}
  12348. @end table
  12349. Note that the value given at zoom is added to the one calculated here.
  12350. @item zoomspeed
  12351. Set percent to zoom maximally each frame (enabled when
  12352. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  12353. 0.25.
  12354. @item interpol
  12355. Specify type of interpolation.
  12356. Available values are:
  12357. @table @samp
  12358. @item no
  12359. no interpolation
  12360. @item linear
  12361. linear only horizontal
  12362. @item bilinear
  12363. linear in both directions (default)
  12364. @item bicubic
  12365. cubic in both directions (slow)
  12366. @end table
  12367. @item tripod
  12368. Enable virtual tripod mode if set to 1, which is equivalent to
  12369. @code{relative=0:smoothing=0}. Default value is 0.
  12370. Use also @code{tripod} option of @ref{vidstabdetect}.
  12371. @item debug
  12372. Increase log verbosity if set to 1. Also the detected global motions
  12373. are written to the temporary file @file{global_motions.trf}. Default
  12374. value is 0.
  12375. @end table
  12376. @subsection Examples
  12377. @itemize
  12378. @item
  12379. Use @command{ffmpeg} for a typical stabilization with default values:
  12380. @example
  12381. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  12382. @end example
  12383. Note the use of the @ref{unsharp} filter which is always recommended.
  12384. @item
  12385. Zoom in a bit more and load transform data from a given file:
  12386. @example
  12387. vidstabtransform=zoom=5:input="mytransforms.trf"
  12388. @end example
  12389. @item
  12390. Smoothen the video even more:
  12391. @example
  12392. vidstabtransform=smoothing=30
  12393. @end example
  12394. @end itemize
  12395. @section vflip
  12396. Flip the input video vertically.
  12397. For example, to vertically flip a video with @command{ffmpeg}:
  12398. @example
  12399. ffmpeg -i in.avi -vf "vflip" out.avi
  12400. @end example
  12401. @anchor{vignette}
  12402. @section vignette
  12403. Make or reverse a natural vignetting effect.
  12404. The filter accepts the following options:
  12405. @table @option
  12406. @item angle, a
  12407. Set lens angle expression as a number of radians.
  12408. The value is clipped in the @code{[0,PI/2]} range.
  12409. Default value: @code{"PI/5"}
  12410. @item x0
  12411. @item y0
  12412. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  12413. by default.
  12414. @item mode
  12415. Set forward/backward mode.
  12416. Available modes are:
  12417. @table @samp
  12418. @item forward
  12419. The larger the distance from the central point, the darker the image becomes.
  12420. @item backward
  12421. The larger the distance from the central point, the brighter the image becomes.
  12422. This can be used to reverse a vignette effect, though there is no automatic
  12423. detection to extract the lens @option{angle} and other settings (yet). It can
  12424. also be used to create a burning effect.
  12425. @end table
  12426. Default value is @samp{forward}.
  12427. @item eval
  12428. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  12429. It accepts the following values:
  12430. @table @samp
  12431. @item init
  12432. Evaluate expressions only once during the filter initialization.
  12433. @item frame
  12434. Evaluate expressions for each incoming frame. This is way slower than the
  12435. @samp{init} mode since it requires all the scalers to be re-computed, but it
  12436. allows advanced dynamic expressions.
  12437. @end table
  12438. Default value is @samp{init}.
  12439. @item dither
  12440. Set dithering to reduce the circular banding effects. Default is @code{1}
  12441. (enabled).
  12442. @item aspect
  12443. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  12444. Setting this value to the SAR of the input will make a rectangular vignetting
  12445. following the dimensions of the video.
  12446. Default is @code{1/1}.
  12447. @end table
  12448. @subsection Expressions
  12449. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  12450. following parameters.
  12451. @table @option
  12452. @item w
  12453. @item h
  12454. input width and height
  12455. @item n
  12456. the number of input frame, starting from 0
  12457. @item pts
  12458. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  12459. @var{TB} units, NAN if undefined
  12460. @item r
  12461. frame rate of the input video, NAN if the input frame rate is unknown
  12462. @item t
  12463. the PTS (Presentation TimeStamp) of the filtered video frame,
  12464. expressed in seconds, NAN if undefined
  12465. @item tb
  12466. time base of the input video
  12467. @end table
  12468. @subsection Examples
  12469. @itemize
  12470. @item
  12471. Apply simple strong vignetting effect:
  12472. @example
  12473. vignette=PI/4
  12474. @end example
  12475. @item
  12476. Make a flickering vignetting:
  12477. @example
  12478. vignette='PI/4+random(1)*PI/50':eval=frame
  12479. @end example
  12480. @end itemize
  12481. @section vmafmotion
  12482. Obtain the average vmaf motion score of a video.
  12483. It is one of the component filters of VMAF.
  12484. The obtained average motion score is printed through the logging system.
  12485. In the below example the input file @file{ref.mpg} is being processed and score
  12486. is computed.
  12487. @example
  12488. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  12489. @end example
  12490. @section vstack
  12491. Stack input videos vertically.
  12492. All streams must be of same pixel format and of same width.
  12493. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  12494. to create same output.
  12495. The filter accept the following option:
  12496. @table @option
  12497. @item inputs
  12498. Set number of input streams. Default is 2.
  12499. @item shortest
  12500. If set to 1, force the output to terminate when the shortest input
  12501. terminates. Default value is 0.
  12502. @end table
  12503. @section w3fdif
  12504. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  12505. Deinterlacing Filter").
  12506. Based on the process described by Martin Weston for BBC R&D, and
  12507. implemented based on the de-interlace algorithm written by Jim
  12508. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  12509. uses filter coefficients calculated by BBC R&D.
  12510. There are two sets of filter coefficients, so called "simple":
  12511. and "complex". Which set of filter coefficients is used can
  12512. be set by passing an optional parameter:
  12513. @table @option
  12514. @item filter
  12515. Set the interlacing filter coefficients. Accepts one of the following values:
  12516. @table @samp
  12517. @item simple
  12518. Simple filter coefficient set.
  12519. @item complex
  12520. More-complex filter coefficient set.
  12521. @end table
  12522. Default value is @samp{complex}.
  12523. @item deint
  12524. Specify which frames to deinterlace. Accept one of the following values:
  12525. @table @samp
  12526. @item all
  12527. Deinterlace all frames,
  12528. @item interlaced
  12529. Only deinterlace frames marked as interlaced.
  12530. @end table
  12531. Default value is @samp{all}.
  12532. @end table
  12533. @section waveform
  12534. Video waveform monitor.
  12535. The waveform monitor plots color component intensity. By default luminance
  12536. only. Each column of the waveform corresponds to a column of pixels in the
  12537. source video.
  12538. It accepts the following options:
  12539. @table @option
  12540. @item mode, m
  12541. Can be either @code{row}, or @code{column}. Default is @code{column}.
  12542. In row mode, the graph on the left side represents color component value 0 and
  12543. the right side represents value = 255. In column mode, the top side represents
  12544. color component value = 0 and bottom side represents value = 255.
  12545. @item intensity, i
  12546. Set intensity. Smaller values are useful to find out how many values of the same
  12547. luminance are distributed across input rows/columns.
  12548. Default value is @code{0.04}. Allowed range is [0, 1].
  12549. @item mirror, r
  12550. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  12551. In mirrored mode, higher values will be represented on the left
  12552. side for @code{row} mode and at the top for @code{column} mode. Default is
  12553. @code{1} (mirrored).
  12554. @item display, d
  12555. Set display mode.
  12556. It accepts the following values:
  12557. @table @samp
  12558. @item overlay
  12559. Presents information identical to that in the @code{parade}, except
  12560. that the graphs representing color components are superimposed directly
  12561. over one another.
  12562. This display mode makes it easier to spot relative differences or similarities
  12563. in overlapping areas of the color components that are supposed to be identical,
  12564. such as neutral whites, grays, or blacks.
  12565. @item stack
  12566. Display separate graph for the color components side by side in
  12567. @code{row} mode or one below the other in @code{column} mode.
  12568. @item parade
  12569. Display separate graph for the color components side by side in
  12570. @code{column} mode or one below the other in @code{row} mode.
  12571. Using this display mode makes it easy to spot color casts in the highlights
  12572. and shadows of an image, by comparing the contours of the top and the bottom
  12573. graphs of each waveform. Since whites, grays, and blacks are characterized
  12574. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  12575. should display three waveforms of roughly equal width/height. If not, the
  12576. correction is easy to perform by making level adjustments the three waveforms.
  12577. @end table
  12578. Default is @code{stack}.
  12579. @item components, c
  12580. Set which color components to display. Default is 1, which means only luminance
  12581. or red color component if input is in RGB colorspace. If is set for example to
  12582. 7 it will display all 3 (if) available color components.
  12583. @item envelope, e
  12584. @table @samp
  12585. @item none
  12586. No envelope, this is default.
  12587. @item instant
  12588. Instant envelope, minimum and maximum values presented in graph will be easily
  12589. visible even with small @code{step} value.
  12590. @item peak
  12591. Hold minimum and maximum values presented in graph across time. This way you
  12592. can still spot out of range values without constantly looking at waveforms.
  12593. @item peak+instant
  12594. Peak and instant envelope combined together.
  12595. @end table
  12596. @item filter, f
  12597. @table @samp
  12598. @item lowpass
  12599. No filtering, this is default.
  12600. @item flat
  12601. Luma and chroma combined together.
  12602. @item aflat
  12603. Similar as above, but shows difference between blue and red chroma.
  12604. @item xflat
  12605. Similar as above, but use different colors.
  12606. @item chroma
  12607. Displays only chroma.
  12608. @item color
  12609. Displays actual color value on waveform.
  12610. @item acolor
  12611. Similar as above, but with luma showing frequency of chroma values.
  12612. @end table
  12613. @item graticule, g
  12614. Set which graticule to display.
  12615. @table @samp
  12616. @item none
  12617. Do not display graticule.
  12618. @item green
  12619. Display green graticule showing legal broadcast ranges.
  12620. @item orange
  12621. Display orange graticule showing legal broadcast ranges.
  12622. @end table
  12623. @item opacity, o
  12624. Set graticule opacity.
  12625. @item flags, fl
  12626. Set graticule flags.
  12627. @table @samp
  12628. @item numbers
  12629. Draw numbers above lines. By default enabled.
  12630. @item dots
  12631. Draw dots instead of lines.
  12632. @end table
  12633. @item scale, s
  12634. Set scale used for displaying graticule.
  12635. @table @samp
  12636. @item digital
  12637. @item millivolts
  12638. @item ire
  12639. @end table
  12640. Default is digital.
  12641. @item bgopacity, b
  12642. Set background opacity.
  12643. @end table
  12644. @section weave, doubleweave
  12645. The @code{weave} takes a field-based video input and join
  12646. each two sequential fields into single frame, producing a new double
  12647. height clip with half the frame rate and half the frame count.
  12648. The @code{doubleweave} works same as @code{weave} but without
  12649. halving frame rate and frame count.
  12650. It accepts the following option:
  12651. @table @option
  12652. @item first_field
  12653. Set first field. Available values are:
  12654. @table @samp
  12655. @item top, t
  12656. Set the frame as top-field-first.
  12657. @item bottom, b
  12658. Set the frame as bottom-field-first.
  12659. @end table
  12660. @end table
  12661. @subsection Examples
  12662. @itemize
  12663. @item
  12664. Interlace video using @ref{select} and @ref{separatefields} filter:
  12665. @example
  12666. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  12667. @end example
  12668. @end itemize
  12669. @section xbr
  12670. Apply the xBR high-quality magnification filter which is designed for pixel
  12671. art. It follows a set of edge-detection rules, see
  12672. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  12673. It accepts the following option:
  12674. @table @option
  12675. @item n
  12676. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  12677. @code{3xBR} and @code{4} for @code{4xBR}.
  12678. Default is @code{3}.
  12679. @end table
  12680. @anchor{yadif}
  12681. @section yadif
  12682. Deinterlace the input video ("yadif" means "yet another deinterlacing
  12683. filter").
  12684. It accepts the following parameters:
  12685. @table @option
  12686. @item mode
  12687. The interlacing mode to adopt. It accepts one of the following values:
  12688. @table @option
  12689. @item 0, send_frame
  12690. Output one frame for each frame.
  12691. @item 1, send_field
  12692. Output one frame for each field.
  12693. @item 2, send_frame_nospatial
  12694. Like @code{send_frame}, but it skips the spatial interlacing check.
  12695. @item 3, send_field_nospatial
  12696. Like @code{send_field}, but it skips the spatial interlacing check.
  12697. @end table
  12698. The default value is @code{send_frame}.
  12699. @item parity
  12700. The picture field parity assumed for the input interlaced video. It accepts one
  12701. of the following values:
  12702. @table @option
  12703. @item 0, tff
  12704. Assume the top field is first.
  12705. @item 1, bff
  12706. Assume the bottom field is first.
  12707. @item -1, auto
  12708. Enable automatic detection of field parity.
  12709. @end table
  12710. The default value is @code{auto}.
  12711. If the interlacing is unknown or the decoder does not export this information,
  12712. top field first will be assumed.
  12713. @item deint
  12714. Specify which frames to deinterlace. Accept one of the following
  12715. values:
  12716. @table @option
  12717. @item 0, all
  12718. Deinterlace all frames.
  12719. @item 1, interlaced
  12720. Only deinterlace frames marked as interlaced.
  12721. @end table
  12722. The default value is @code{all}.
  12723. @end table
  12724. @section zoompan
  12725. Apply Zoom & Pan effect.
  12726. This filter accepts the following options:
  12727. @table @option
  12728. @item zoom, z
  12729. Set the zoom expression. Default is 1.
  12730. @item x
  12731. @item y
  12732. Set the x and y expression. Default is 0.
  12733. @item d
  12734. Set the duration expression in number of frames.
  12735. This sets for how many number of frames effect will last for
  12736. single input image.
  12737. @item s
  12738. Set the output image size, default is 'hd720'.
  12739. @item fps
  12740. Set the output frame rate, default is '25'.
  12741. @end table
  12742. Each expression can contain the following constants:
  12743. @table @option
  12744. @item in_w, iw
  12745. Input width.
  12746. @item in_h, ih
  12747. Input height.
  12748. @item out_w, ow
  12749. Output width.
  12750. @item out_h, oh
  12751. Output height.
  12752. @item in
  12753. Input frame count.
  12754. @item on
  12755. Output frame count.
  12756. @item x
  12757. @item y
  12758. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  12759. for current input frame.
  12760. @item px
  12761. @item py
  12762. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  12763. not yet such frame (first input frame).
  12764. @item zoom
  12765. Last calculated zoom from 'z' expression for current input frame.
  12766. @item pzoom
  12767. Last calculated zoom of last output frame of previous input frame.
  12768. @item duration
  12769. Number of output frames for current input frame. Calculated from 'd' expression
  12770. for each input frame.
  12771. @item pduration
  12772. number of output frames created for previous input frame
  12773. @item a
  12774. Rational number: input width / input height
  12775. @item sar
  12776. sample aspect ratio
  12777. @item dar
  12778. display aspect ratio
  12779. @end table
  12780. @subsection Examples
  12781. @itemize
  12782. @item
  12783. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  12784. @example
  12785. 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
  12786. @end example
  12787. @item
  12788. Zoom-in up to 1.5 and pan always at center of picture:
  12789. @example
  12790. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12791. @end example
  12792. @item
  12793. Same as above but without pausing:
  12794. @example
  12795. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12796. @end example
  12797. @end itemize
  12798. @anchor{zscale}
  12799. @section zscale
  12800. Scale (resize) the input video, using the z.lib library:
  12801. https://github.com/sekrit-twc/zimg.
  12802. The zscale filter forces the output display aspect ratio to be the same
  12803. as the input, by changing the output sample aspect ratio.
  12804. If the input image format is different from the format requested by
  12805. the next filter, the zscale filter will convert the input to the
  12806. requested format.
  12807. @subsection Options
  12808. The filter accepts the following options.
  12809. @table @option
  12810. @item width, w
  12811. @item height, h
  12812. Set the output video dimension expression. Default value is the input
  12813. dimension.
  12814. If the @var{width} or @var{w} value is 0, the input width is used for
  12815. the output. If the @var{height} or @var{h} value is 0, the input height
  12816. is used for the output.
  12817. If one and only one of the values is -n with n >= 1, the zscale filter
  12818. will use a value that maintains the aspect ratio of the input image,
  12819. calculated from the other specified dimension. After that it will,
  12820. however, make sure that the calculated dimension is divisible by n and
  12821. adjust the value if necessary.
  12822. If both values are -n with n >= 1, the behavior will be identical to
  12823. both values being set to 0 as previously detailed.
  12824. See below for the list of accepted constants for use in the dimension
  12825. expression.
  12826. @item size, s
  12827. Set the video size. For the syntax of this option, check the
  12828. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12829. @item dither, d
  12830. Set the dither type.
  12831. Possible values are:
  12832. @table @var
  12833. @item none
  12834. @item ordered
  12835. @item random
  12836. @item error_diffusion
  12837. @end table
  12838. Default is none.
  12839. @item filter, f
  12840. Set the resize filter type.
  12841. Possible values are:
  12842. @table @var
  12843. @item point
  12844. @item bilinear
  12845. @item bicubic
  12846. @item spline16
  12847. @item spline36
  12848. @item lanczos
  12849. @end table
  12850. Default is bilinear.
  12851. @item range, r
  12852. Set the color range.
  12853. Possible values are:
  12854. @table @var
  12855. @item input
  12856. @item limited
  12857. @item full
  12858. @end table
  12859. Default is same as input.
  12860. @item primaries, p
  12861. Set the color primaries.
  12862. Possible values are:
  12863. @table @var
  12864. @item input
  12865. @item 709
  12866. @item unspecified
  12867. @item 170m
  12868. @item 240m
  12869. @item 2020
  12870. @end table
  12871. Default is same as input.
  12872. @item transfer, t
  12873. Set the transfer characteristics.
  12874. Possible values are:
  12875. @table @var
  12876. @item input
  12877. @item 709
  12878. @item unspecified
  12879. @item 601
  12880. @item linear
  12881. @item 2020_10
  12882. @item 2020_12
  12883. @item smpte2084
  12884. @item iec61966-2-1
  12885. @item arib-std-b67
  12886. @end table
  12887. Default is same as input.
  12888. @item matrix, m
  12889. Set the colorspace matrix.
  12890. Possible value are:
  12891. @table @var
  12892. @item input
  12893. @item 709
  12894. @item unspecified
  12895. @item 470bg
  12896. @item 170m
  12897. @item 2020_ncl
  12898. @item 2020_cl
  12899. @end table
  12900. Default is same as input.
  12901. @item rangein, rin
  12902. Set the input color range.
  12903. Possible values are:
  12904. @table @var
  12905. @item input
  12906. @item limited
  12907. @item full
  12908. @end table
  12909. Default is same as input.
  12910. @item primariesin, pin
  12911. Set the input color primaries.
  12912. Possible values are:
  12913. @table @var
  12914. @item input
  12915. @item 709
  12916. @item unspecified
  12917. @item 170m
  12918. @item 240m
  12919. @item 2020
  12920. @end table
  12921. Default is same as input.
  12922. @item transferin, tin
  12923. Set the input transfer characteristics.
  12924. Possible values are:
  12925. @table @var
  12926. @item input
  12927. @item 709
  12928. @item unspecified
  12929. @item 601
  12930. @item linear
  12931. @item 2020_10
  12932. @item 2020_12
  12933. @end table
  12934. Default is same as input.
  12935. @item matrixin, min
  12936. Set the input colorspace matrix.
  12937. Possible value are:
  12938. @table @var
  12939. @item input
  12940. @item 709
  12941. @item unspecified
  12942. @item 470bg
  12943. @item 170m
  12944. @item 2020_ncl
  12945. @item 2020_cl
  12946. @end table
  12947. @item chromal, c
  12948. Set the output chroma location.
  12949. Possible values are:
  12950. @table @var
  12951. @item input
  12952. @item left
  12953. @item center
  12954. @item topleft
  12955. @item top
  12956. @item bottomleft
  12957. @item bottom
  12958. @end table
  12959. @item chromalin, cin
  12960. Set the input chroma location.
  12961. Possible values are:
  12962. @table @var
  12963. @item input
  12964. @item left
  12965. @item center
  12966. @item topleft
  12967. @item top
  12968. @item bottomleft
  12969. @item bottom
  12970. @end table
  12971. @item npl
  12972. Set the nominal peak luminance.
  12973. @end table
  12974. The values of the @option{w} and @option{h} options are expressions
  12975. containing the following constants:
  12976. @table @var
  12977. @item in_w
  12978. @item in_h
  12979. The input width and height
  12980. @item iw
  12981. @item ih
  12982. These are the same as @var{in_w} and @var{in_h}.
  12983. @item out_w
  12984. @item out_h
  12985. The output (scaled) width and height
  12986. @item ow
  12987. @item oh
  12988. These are the same as @var{out_w} and @var{out_h}
  12989. @item a
  12990. The same as @var{iw} / @var{ih}
  12991. @item sar
  12992. input sample aspect ratio
  12993. @item dar
  12994. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12995. @item hsub
  12996. @item vsub
  12997. horizontal and vertical input chroma subsample values. For example for the
  12998. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12999. @item ohsub
  13000. @item ovsub
  13001. horizontal and vertical output chroma subsample values. For example for the
  13002. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13003. @end table
  13004. @table @option
  13005. @end table
  13006. @c man end VIDEO FILTERS
  13007. @chapter Video Sources
  13008. @c man begin VIDEO SOURCES
  13009. Below is a description of the currently available video sources.
  13010. @section buffer
  13011. Buffer video frames, and make them available to the filter chain.
  13012. This source is mainly intended for a programmatic use, in particular
  13013. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  13014. It accepts the following parameters:
  13015. @table @option
  13016. @item video_size
  13017. Specify the size (width and height) of the buffered video frames. For the
  13018. syntax of this option, check the
  13019. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13020. @item width
  13021. The input video width.
  13022. @item height
  13023. The input video height.
  13024. @item pix_fmt
  13025. A string representing the pixel format of the buffered video frames.
  13026. It may be a number corresponding to a pixel format, or a pixel format
  13027. name.
  13028. @item time_base
  13029. Specify the timebase assumed by the timestamps of the buffered frames.
  13030. @item frame_rate
  13031. Specify the frame rate expected for the video stream.
  13032. @item pixel_aspect, sar
  13033. The sample (pixel) aspect ratio of the input video.
  13034. @item sws_param
  13035. Specify the optional parameters to be used for the scale filter which
  13036. is automatically inserted when an input change is detected in the
  13037. input size or format.
  13038. @item hw_frames_ctx
  13039. When using a hardware pixel format, this should be a reference to an
  13040. AVHWFramesContext describing input frames.
  13041. @end table
  13042. For example:
  13043. @example
  13044. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  13045. @end example
  13046. will instruct the source to accept video frames with size 320x240 and
  13047. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  13048. square pixels (1:1 sample aspect ratio).
  13049. Since the pixel format with name "yuv410p" corresponds to the number 6
  13050. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  13051. this example corresponds to:
  13052. @example
  13053. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  13054. @end example
  13055. Alternatively, the options can be specified as a flat string, but this
  13056. syntax is deprecated:
  13057. @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}]
  13058. @section cellauto
  13059. Create a pattern generated by an elementary cellular automaton.
  13060. The initial state of the cellular automaton can be defined through the
  13061. @option{filename} and @option{pattern} options. If such options are
  13062. not specified an initial state is created randomly.
  13063. At each new frame a new row in the video is filled with the result of
  13064. the cellular automaton next generation. The behavior when the whole
  13065. frame is filled is defined by the @option{scroll} option.
  13066. This source accepts the following options:
  13067. @table @option
  13068. @item filename, f
  13069. Read the initial cellular automaton state, i.e. the starting row, from
  13070. the specified file.
  13071. In the file, each non-whitespace character is considered an alive
  13072. cell, a newline will terminate the row, and further characters in the
  13073. file will be ignored.
  13074. @item pattern, p
  13075. Read the initial cellular automaton state, i.e. the starting row, from
  13076. the specified string.
  13077. Each non-whitespace character in the string is considered an alive
  13078. cell, a newline will terminate the row, and further characters in the
  13079. string will be ignored.
  13080. @item rate, r
  13081. Set the video rate, that is the number of frames generated per second.
  13082. Default is 25.
  13083. @item random_fill_ratio, ratio
  13084. Set the random fill ratio for the initial cellular automaton row. It
  13085. is a floating point number value ranging from 0 to 1, defaults to
  13086. 1/PHI.
  13087. This option is ignored when a file or a pattern is specified.
  13088. @item random_seed, seed
  13089. Set the seed for filling randomly the initial row, must be an integer
  13090. included between 0 and UINT32_MAX. If not specified, or if explicitly
  13091. set to -1, the filter will try to use a good random seed on a best
  13092. effort basis.
  13093. @item rule
  13094. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  13095. Default value is 110.
  13096. @item size, s
  13097. Set the size of the output video. For the syntax of this option, check the
  13098. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13099. If @option{filename} or @option{pattern} is specified, the size is set
  13100. by default to the width of the specified initial state row, and the
  13101. height is set to @var{width} * PHI.
  13102. If @option{size} is set, it must contain the width of the specified
  13103. pattern string, and the specified pattern will be centered in the
  13104. larger row.
  13105. If a filename or a pattern string is not specified, the size value
  13106. defaults to "320x518" (used for a randomly generated initial state).
  13107. @item scroll
  13108. If set to 1, scroll the output upward when all the rows in the output
  13109. have been already filled. If set to 0, the new generated row will be
  13110. written over the top row just after the bottom row is filled.
  13111. Defaults to 1.
  13112. @item start_full, full
  13113. If set to 1, completely fill the output with generated rows before
  13114. outputting the first frame.
  13115. This is the default behavior, for disabling set the value to 0.
  13116. @item stitch
  13117. If set to 1, stitch the left and right row edges together.
  13118. This is the default behavior, for disabling set the value to 0.
  13119. @end table
  13120. @subsection Examples
  13121. @itemize
  13122. @item
  13123. Read the initial state from @file{pattern}, and specify an output of
  13124. size 200x400.
  13125. @example
  13126. cellauto=f=pattern:s=200x400
  13127. @end example
  13128. @item
  13129. Generate a random initial row with a width of 200 cells, with a fill
  13130. ratio of 2/3:
  13131. @example
  13132. cellauto=ratio=2/3:s=200x200
  13133. @end example
  13134. @item
  13135. Create a pattern generated by rule 18 starting by a single alive cell
  13136. centered on an initial row with width 100:
  13137. @example
  13138. cellauto=p=@@:s=100x400:full=0:rule=18
  13139. @end example
  13140. @item
  13141. Specify a more elaborated initial pattern:
  13142. @example
  13143. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  13144. @end example
  13145. @end itemize
  13146. @anchor{coreimagesrc}
  13147. @section coreimagesrc
  13148. Video source generated on GPU using Apple's CoreImage API on OSX.
  13149. This video source is a specialized version of the @ref{coreimage} video filter.
  13150. Use a core image generator at the beginning of the applied filterchain to
  13151. generate the content.
  13152. The coreimagesrc video source accepts the following options:
  13153. @table @option
  13154. @item list_generators
  13155. List all available generators along with all their respective options as well as
  13156. possible minimum and maximum values along with the default values.
  13157. @example
  13158. list_generators=true
  13159. @end example
  13160. @item size, s
  13161. Specify the size of the sourced video. For the syntax of this option, check the
  13162. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13163. The default value is @code{320x240}.
  13164. @item rate, r
  13165. Specify the frame rate of the sourced video, as the number of frames
  13166. generated per second. It has to be a string in the format
  13167. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13168. number or a valid video frame rate abbreviation. The default value is
  13169. "25".
  13170. @item sar
  13171. Set the sample aspect ratio of the sourced video.
  13172. @item duration, d
  13173. Set the duration of the sourced video. See
  13174. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13175. for the accepted syntax.
  13176. If not specified, or the expressed duration is negative, the video is
  13177. supposed to be generated forever.
  13178. @end table
  13179. Additionally, all options of the @ref{coreimage} video filter are accepted.
  13180. A complete filterchain can be used for further processing of the
  13181. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  13182. and examples for details.
  13183. @subsection Examples
  13184. @itemize
  13185. @item
  13186. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  13187. given as complete and escaped command-line for Apple's standard bash shell:
  13188. @example
  13189. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  13190. @end example
  13191. This example is equivalent to the QRCode example of @ref{coreimage} without the
  13192. need for a nullsrc video source.
  13193. @end itemize
  13194. @section mandelbrot
  13195. Generate a Mandelbrot set fractal, and progressively zoom towards the
  13196. point specified with @var{start_x} and @var{start_y}.
  13197. This source accepts the following options:
  13198. @table @option
  13199. @item end_pts
  13200. Set the terminal pts value. Default value is 400.
  13201. @item end_scale
  13202. Set the terminal scale value.
  13203. Must be a floating point value. Default value is 0.3.
  13204. @item inner
  13205. Set the inner coloring mode, that is the algorithm used to draw the
  13206. Mandelbrot fractal internal region.
  13207. It shall assume one of the following values:
  13208. @table @option
  13209. @item black
  13210. Set black mode.
  13211. @item convergence
  13212. Show time until convergence.
  13213. @item mincol
  13214. Set color based on point closest to the origin of the iterations.
  13215. @item period
  13216. Set period mode.
  13217. @end table
  13218. Default value is @var{mincol}.
  13219. @item bailout
  13220. Set the bailout value. Default value is 10.0.
  13221. @item maxiter
  13222. Set the maximum of iterations performed by the rendering
  13223. algorithm. Default value is 7189.
  13224. @item outer
  13225. Set outer coloring mode.
  13226. It shall assume one of following values:
  13227. @table @option
  13228. @item iteration_count
  13229. Set iteration cound mode.
  13230. @item normalized_iteration_count
  13231. set normalized iteration count mode.
  13232. @end table
  13233. Default value is @var{normalized_iteration_count}.
  13234. @item rate, r
  13235. Set frame rate, expressed as number of frames per second. Default
  13236. value is "25".
  13237. @item size, s
  13238. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  13239. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  13240. @item start_scale
  13241. Set the initial scale value. Default value is 3.0.
  13242. @item start_x
  13243. Set the initial x position. Must be a floating point value between
  13244. -100 and 100. Default value is -0.743643887037158704752191506114774.
  13245. @item start_y
  13246. Set the initial y position. Must be a floating point value between
  13247. -100 and 100. Default value is -0.131825904205311970493132056385139.
  13248. @end table
  13249. @section mptestsrc
  13250. Generate various test patterns, as generated by the MPlayer test filter.
  13251. The size of the generated video is fixed, and is 256x256.
  13252. This source is useful in particular for testing encoding features.
  13253. This source accepts the following options:
  13254. @table @option
  13255. @item rate, r
  13256. Specify the frame rate of the sourced video, as the number of frames
  13257. generated per second. It has to be a string in the format
  13258. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13259. number or a valid video frame rate abbreviation. The default value is
  13260. "25".
  13261. @item duration, d
  13262. Set the duration of the sourced video. See
  13263. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13264. for the accepted syntax.
  13265. If not specified, or the expressed duration is negative, the video is
  13266. supposed to be generated forever.
  13267. @item test, t
  13268. Set the number or the name of the test to perform. Supported tests are:
  13269. @table @option
  13270. @item dc_luma
  13271. @item dc_chroma
  13272. @item freq_luma
  13273. @item freq_chroma
  13274. @item amp_luma
  13275. @item amp_chroma
  13276. @item cbp
  13277. @item mv
  13278. @item ring1
  13279. @item ring2
  13280. @item all
  13281. @end table
  13282. Default value is "all", which will cycle through the list of all tests.
  13283. @end table
  13284. Some examples:
  13285. @example
  13286. mptestsrc=t=dc_luma
  13287. @end example
  13288. will generate a "dc_luma" test pattern.
  13289. @section frei0r_src
  13290. Provide a frei0r source.
  13291. To enable compilation of this filter you need to install the frei0r
  13292. header and configure FFmpeg with @code{--enable-frei0r}.
  13293. This source accepts the following parameters:
  13294. @table @option
  13295. @item size
  13296. The size of the video to generate. For the syntax of this option, check the
  13297. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13298. @item framerate
  13299. The framerate of the generated video. It may be a string of the form
  13300. @var{num}/@var{den} or a frame rate abbreviation.
  13301. @item filter_name
  13302. The name to the frei0r source to load. For more information regarding frei0r and
  13303. how to set the parameters, read the @ref{frei0r} section in the video filters
  13304. documentation.
  13305. @item filter_params
  13306. A '|'-separated list of parameters to pass to the frei0r source.
  13307. @end table
  13308. For example, to generate a frei0r partik0l source with size 200x200
  13309. and frame rate 10 which is overlaid on the overlay filter main input:
  13310. @example
  13311. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  13312. @end example
  13313. @section life
  13314. Generate a life pattern.
  13315. This source is based on a generalization of John Conway's life game.
  13316. The sourced input represents a life grid, each pixel represents a cell
  13317. which can be in one of two possible states, alive or dead. Every cell
  13318. interacts with its eight neighbours, which are the cells that are
  13319. horizontally, vertically, or diagonally adjacent.
  13320. At each interaction the grid evolves according to the adopted rule,
  13321. which specifies the number of neighbor alive cells which will make a
  13322. cell stay alive or born. The @option{rule} option allows one to specify
  13323. the rule to adopt.
  13324. This source accepts the following options:
  13325. @table @option
  13326. @item filename, f
  13327. Set the file from which to read the initial grid state. In the file,
  13328. each non-whitespace character is considered an alive cell, and newline
  13329. is used to delimit the end of each row.
  13330. If this option is not specified, the initial grid is generated
  13331. randomly.
  13332. @item rate, r
  13333. Set the video rate, that is the number of frames generated per second.
  13334. Default is 25.
  13335. @item random_fill_ratio, ratio
  13336. Set the random fill ratio for the initial random grid. It is a
  13337. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  13338. It is ignored when a file is specified.
  13339. @item random_seed, seed
  13340. Set the seed for filling the initial random grid, must be an integer
  13341. included between 0 and UINT32_MAX. If not specified, or if explicitly
  13342. set to -1, the filter will try to use a good random seed on a best
  13343. effort basis.
  13344. @item rule
  13345. Set the life rule.
  13346. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  13347. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  13348. @var{NS} specifies the number of alive neighbor cells which make a
  13349. live cell stay alive, and @var{NB} the number of alive neighbor cells
  13350. which make a dead cell to become alive (i.e. to "born").
  13351. "s" and "b" can be used in place of "S" and "B", respectively.
  13352. Alternatively a rule can be specified by an 18-bits integer. The 9
  13353. high order bits are used to encode the next cell state if it is alive
  13354. for each number of neighbor alive cells, the low order bits specify
  13355. the rule for "borning" new cells. Higher order bits encode for an
  13356. higher number of neighbor cells.
  13357. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  13358. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  13359. Default value is "S23/B3", which is the original Conway's game of life
  13360. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  13361. cells, and will born a new cell if there are three alive cells around
  13362. a dead cell.
  13363. @item size, s
  13364. Set the size of the output video. For the syntax of this option, check the
  13365. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13366. If @option{filename} is specified, the size is set by default to the
  13367. same size of the input file. If @option{size} is set, it must contain
  13368. the size specified in the input file, and the initial grid defined in
  13369. that file is centered in the larger resulting area.
  13370. If a filename is not specified, the size value defaults to "320x240"
  13371. (used for a randomly generated initial grid).
  13372. @item stitch
  13373. If set to 1, stitch the left and right grid edges together, and the
  13374. top and bottom edges also. Defaults to 1.
  13375. @item mold
  13376. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  13377. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  13378. value from 0 to 255.
  13379. @item life_color
  13380. Set the color of living (or new born) cells.
  13381. @item death_color
  13382. Set the color of dead cells. If @option{mold} is set, this is the first color
  13383. used to represent a dead cell.
  13384. @item mold_color
  13385. Set mold color, for definitely dead and moldy cells.
  13386. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  13387. ffmpeg-utils manual,ffmpeg-utils}.
  13388. @end table
  13389. @subsection Examples
  13390. @itemize
  13391. @item
  13392. Read a grid from @file{pattern}, and center it on a grid of size
  13393. 300x300 pixels:
  13394. @example
  13395. life=f=pattern:s=300x300
  13396. @end example
  13397. @item
  13398. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  13399. @example
  13400. life=ratio=2/3:s=200x200
  13401. @end example
  13402. @item
  13403. Specify a custom rule for evolving a randomly generated grid:
  13404. @example
  13405. life=rule=S14/B34
  13406. @end example
  13407. @item
  13408. Full example with slow death effect (mold) using @command{ffplay}:
  13409. @example
  13410. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  13411. @end example
  13412. @end itemize
  13413. @anchor{allrgb}
  13414. @anchor{allyuv}
  13415. @anchor{color}
  13416. @anchor{haldclutsrc}
  13417. @anchor{nullsrc}
  13418. @anchor{rgbtestsrc}
  13419. @anchor{smptebars}
  13420. @anchor{smptehdbars}
  13421. @anchor{testsrc}
  13422. @anchor{testsrc2}
  13423. @anchor{yuvtestsrc}
  13424. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  13425. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  13426. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  13427. The @code{color} source provides an uniformly colored input.
  13428. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  13429. @ref{haldclut} filter.
  13430. The @code{nullsrc} source returns unprocessed video frames. It is
  13431. mainly useful to be employed in analysis / debugging tools, or as the
  13432. source for filters which ignore the input data.
  13433. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  13434. detecting RGB vs BGR issues. You should see a red, green and blue
  13435. stripe from top to bottom.
  13436. The @code{smptebars} source generates a color bars pattern, based on
  13437. the SMPTE Engineering Guideline EG 1-1990.
  13438. The @code{smptehdbars} source generates a color bars pattern, based on
  13439. the SMPTE RP 219-2002.
  13440. The @code{testsrc} source generates a test video pattern, showing a
  13441. color pattern, a scrolling gradient and a timestamp. This is mainly
  13442. intended for testing purposes.
  13443. The @code{testsrc2} source is similar to testsrc, but supports more
  13444. pixel formats instead of just @code{rgb24}. This allows using it as an
  13445. input for other tests without requiring a format conversion.
  13446. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  13447. see a y, cb and cr stripe from top to bottom.
  13448. The sources accept the following parameters:
  13449. @table @option
  13450. @item level
  13451. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  13452. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  13453. pixels to be used as identity matrix for 3D lookup tables. Each component is
  13454. coded on a @code{1/(N*N)} scale.
  13455. @item color, c
  13456. Specify the color of the source, only available in the @code{color}
  13457. source. For the syntax of this option, check the
  13458. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13459. @item size, s
  13460. Specify the size of the sourced video. For the syntax of this option, check the
  13461. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13462. The default value is @code{320x240}.
  13463. This option is not available with the @code{allrgb}, @code{allyuv}, and
  13464. @code{haldclutsrc} filters.
  13465. @item rate, r
  13466. Specify the frame rate of the sourced video, as the number of frames
  13467. generated per second. It has to be a string in the format
  13468. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13469. number or a valid video frame rate abbreviation. The default value is
  13470. "25".
  13471. @item duration, d
  13472. Set the duration of the sourced video. See
  13473. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13474. for the accepted syntax.
  13475. If not specified, or the expressed duration is negative, the video is
  13476. supposed to be generated forever.
  13477. @item sar
  13478. Set the sample aspect ratio of the sourced video.
  13479. @item alpha
  13480. Specify the alpha (opacity) of the background, only available in the
  13481. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  13482. 255 (fully opaque, the default).
  13483. @item decimals, n
  13484. Set the number of decimals to show in the timestamp, only available in the
  13485. @code{testsrc} source.
  13486. The displayed timestamp value will correspond to the original
  13487. timestamp value multiplied by the power of 10 of the specified
  13488. value. Default value is 0.
  13489. @end table
  13490. @subsection Examples
  13491. @itemize
  13492. @item
  13493. Generate a video with a duration of 5.3 seconds, with size
  13494. 176x144 and a frame rate of 10 frames per second:
  13495. @example
  13496. testsrc=duration=5.3:size=qcif:rate=10
  13497. @end example
  13498. @item
  13499. The following graph description will generate a red source
  13500. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  13501. frames per second:
  13502. @example
  13503. color=c=red@@0.2:s=qcif:r=10
  13504. @end example
  13505. @item
  13506. If the input content is to be ignored, @code{nullsrc} can be used. The
  13507. following command generates noise in the luminance plane by employing
  13508. the @code{geq} filter:
  13509. @example
  13510. nullsrc=s=256x256, geq=random(1)*255:128:128
  13511. @end example
  13512. @end itemize
  13513. @subsection Commands
  13514. The @code{color} source supports the following commands:
  13515. @table @option
  13516. @item c, color
  13517. Set the color of the created image. Accepts the same syntax of the
  13518. corresponding @option{color} option.
  13519. @end table
  13520. @section openclsrc
  13521. Generate video using an OpenCL program.
  13522. @table @option
  13523. @item source
  13524. OpenCL program source file.
  13525. @item kernel
  13526. Kernel name in program.
  13527. @item size, s
  13528. Size of frames to generate. This must be set.
  13529. @item format
  13530. Pixel format to use for the generated frames. This must be set.
  13531. @item rate, r
  13532. Number of frames generated every second. Default value is '25'.
  13533. @end table
  13534. For details of how the program loading works, see the @ref{program_opencl}
  13535. filter.
  13536. Example programs:
  13537. @itemize
  13538. @item
  13539. Generate a colour ramp by setting pixel values from the position of the pixel
  13540. in the output image. (Note that this will work with all pixel formats, but
  13541. the generated output will not be the same.)
  13542. @verbatim
  13543. __kernel void ramp(__write_only image2d_t dst,
  13544. unsigned int index)
  13545. {
  13546. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  13547. float4 val;
  13548. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  13549. write_imagef(dst, loc, val);
  13550. }
  13551. @end verbatim
  13552. @item
  13553. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  13554. @verbatim
  13555. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  13556. unsigned int index)
  13557. {
  13558. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  13559. float4 value = 0.0f;
  13560. int x = loc.x + index;
  13561. int y = loc.y + index;
  13562. while (x > 0 || y > 0) {
  13563. if (x % 3 == 1 && y % 3 == 1) {
  13564. value = 1.0f;
  13565. break;
  13566. }
  13567. x /= 3;
  13568. y /= 3;
  13569. }
  13570. write_imagef(dst, loc, value);
  13571. }
  13572. @end verbatim
  13573. @end itemize
  13574. @c man end VIDEO SOURCES
  13575. @chapter Video Sinks
  13576. @c man begin VIDEO SINKS
  13577. Below is a description of the currently available video sinks.
  13578. @section buffersink
  13579. Buffer video frames, and make them available to the end of the filter
  13580. graph.
  13581. This sink is mainly intended for programmatic use, in particular
  13582. through the interface defined in @file{libavfilter/buffersink.h}
  13583. or the options system.
  13584. It accepts a pointer to an AVBufferSinkContext structure, which
  13585. defines the incoming buffers' formats, to be passed as the opaque
  13586. parameter to @code{avfilter_init_filter} for initialization.
  13587. @section nullsink
  13588. Null video sink: do absolutely nothing with the input video. It is
  13589. mainly useful as a template and for use in analysis / debugging
  13590. tools.
  13591. @c man end VIDEO SINKS
  13592. @chapter Multimedia Filters
  13593. @c man begin MULTIMEDIA FILTERS
  13594. Below is a description of the currently available multimedia filters.
  13595. @section abitscope
  13596. Convert input audio to a video output, displaying the audio bit scope.
  13597. The filter accepts the following options:
  13598. @table @option
  13599. @item rate, r
  13600. Set frame rate, expressed as number of frames per second. Default
  13601. value is "25".
  13602. @item size, s
  13603. Specify the video size for the output. For the syntax of this option, check the
  13604. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13605. Default value is @code{1024x256}.
  13606. @item colors
  13607. Specify list of colors separated by space or by '|' which will be used to
  13608. draw channels. Unrecognized or missing colors will be replaced
  13609. by white color.
  13610. @end table
  13611. @section ahistogram
  13612. Convert input audio to a video output, displaying the volume histogram.
  13613. The filter accepts the following options:
  13614. @table @option
  13615. @item dmode
  13616. Specify how histogram is calculated.
  13617. It accepts the following values:
  13618. @table @samp
  13619. @item single
  13620. Use single histogram for all channels.
  13621. @item separate
  13622. Use separate histogram for each channel.
  13623. @end table
  13624. Default is @code{single}.
  13625. @item rate, r
  13626. Set frame rate, expressed as number of frames per second. Default
  13627. value is "25".
  13628. @item size, s
  13629. Specify the video size for the output. For the syntax of this option, check the
  13630. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13631. Default value is @code{hd720}.
  13632. @item scale
  13633. Set display scale.
  13634. It accepts the following values:
  13635. @table @samp
  13636. @item log
  13637. logarithmic
  13638. @item sqrt
  13639. square root
  13640. @item cbrt
  13641. cubic root
  13642. @item lin
  13643. linear
  13644. @item rlog
  13645. reverse logarithmic
  13646. @end table
  13647. Default is @code{log}.
  13648. @item ascale
  13649. Set amplitude scale.
  13650. It accepts the following values:
  13651. @table @samp
  13652. @item log
  13653. logarithmic
  13654. @item lin
  13655. linear
  13656. @end table
  13657. Default is @code{log}.
  13658. @item acount
  13659. Set how much frames to accumulate in histogram.
  13660. Defauls is 1. Setting this to -1 accumulates all frames.
  13661. @item rheight
  13662. Set histogram ratio of window height.
  13663. @item slide
  13664. Set sonogram sliding.
  13665. It accepts the following values:
  13666. @table @samp
  13667. @item replace
  13668. replace old rows with new ones.
  13669. @item scroll
  13670. scroll from top to bottom.
  13671. @end table
  13672. Default is @code{replace}.
  13673. @end table
  13674. @section aphasemeter
  13675. Convert input audio to a video output, displaying the audio phase.
  13676. The filter accepts the following options:
  13677. @table @option
  13678. @item rate, r
  13679. Set the output frame rate. Default value is @code{25}.
  13680. @item size, s
  13681. Set the video size for the output. For the syntax of this option, check the
  13682. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13683. Default value is @code{800x400}.
  13684. @item rc
  13685. @item gc
  13686. @item bc
  13687. Specify the red, green, blue contrast. Default values are @code{2},
  13688. @code{7} and @code{1}.
  13689. Allowed range is @code{[0, 255]}.
  13690. @item mpc
  13691. Set color which will be used for drawing median phase. If color is
  13692. @code{none} which is default, no median phase value will be drawn.
  13693. @item video
  13694. Enable video output. Default is enabled.
  13695. @end table
  13696. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  13697. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  13698. The @code{-1} means left and right channels are completely out of phase and
  13699. @code{1} means channels are in phase.
  13700. @section avectorscope
  13701. Convert input audio to a video output, representing the audio vector
  13702. scope.
  13703. The filter is used to measure the difference between channels of stereo
  13704. audio stream. A monoaural signal, consisting of identical left and right
  13705. signal, results in straight vertical line. Any stereo separation is visible
  13706. as a deviation from this line, creating a Lissajous figure.
  13707. If the straight (or deviation from it) but horizontal line appears this
  13708. indicates that the left and right channels are out of phase.
  13709. The filter accepts the following options:
  13710. @table @option
  13711. @item mode, m
  13712. Set the vectorscope mode.
  13713. Available values are:
  13714. @table @samp
  13715. @item lissajous
  13716. Lissajous rotated by 45 degrees.
  13717. @item lissajous_xy
  13718. Same as above but not rotated.
  13719. @item polar
  13720. Shape resembling half of circle.
  13721. @end table
  13722. Default value is @samp{lissajous}.
  13723. @item size, s
  13724. Set the video size for the output. For the syntax of this option, check the
  13725. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13726. Default value is @code{400x400}.
  13727. @item rate, r
  13728. Set the output frame rate. Default value is @code{25}.
  13729. @item rc
  13730. @item gc
  13731. @item bc
  13732. @item ac
  13733. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  13734. @code{160}, @code{80} and @code{255}.
  13735. Allowed range is @code{[0, 255]}.
  13736. @item rf
  13737. @item gf
  13738. @item bf
  13739. @item af
  13740. Specify the red, green, blue and alpha fade. Default values are @code{15},
  13741. @code{10}, @code{5} and @code{5}.
  13742. Allowed range is @code{[0, 255]}.
  13743. @item zoom
  13744. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  13745. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  13746. @item draw
  13747. Set the vectorscope drawing mode.
  13748. Available values are:
  13749. @table @samp
  13750. @item dot
  13751. Draw dot for each sample.
  13752. @item line
  13753. Draw line between previous and current sample.
  13754. @end table
  13755. Default value is @samp{dot}.
  13756. @item scale
  13757. Specify amplitude scale of audio samples.
  13758. Available values are:
  13759. @table @samp
  13760. @item lin
  13761. Linear.
  13762. @item sqrt
  13763. Square root.
  13764. @item cbrt
  13765. Cubic root.
  13766. @item log
  13767. Logarithmic.
  13768. @end table
  13769. @item swap
  13770. Swap left channel axis with right channel axis.
  13771. @item mirror
  13772. Mirror axis.
  13773. @table @samp
  13774. @item none
  13775. No mirror.
  13776. @item x
  13777. Mirror only x axis.
  13778. @item y
  13779. Mirror only y axis.
  13780. @item xy
  13781. Mirror both axis.
  13782. @end table
  13783. @end table
  13784. @subsection Examples
  13785. @itemize
  13786. @item
  13787. Complete example using @command{ffplay}:
  13788. @example
  13789. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  13790. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  13791. @end example
  13792. @end itemize
  13793. @section bench, abench
  13794. Benchmark part of a filtergraph.
  13795. The filter accepts the following options:
  13796. @table @option
  13797. @item action
  13798. Start or stop a timer.
  13799. Available values are:
  13800. @table @samp
  13801. @item start
  13802. Get the current time, set it as frame metadata (using the key
  13803. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  13804. @item stop
  13805. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  13806. the input frame metadata to get the time difference. Time difference, average,
  13807. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  13808. @code{min}) are then printed. The timestamps are expressed in seconds.
  13809. @end table
  13810. @end table
  13811. @subsection Examples
  13812. @itemize
  13813. @item
  13814. Benchmark @ref{selectivecolor} filter:
  13815. @example
  13816. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  13817. @end example
  13818. @end itemize
  13819. @section concat
  13820. Concatenate audio and video streams, joining them together one after the
  13821. other.
  13822. The filter works on segments of synchronized video and audio streams. All
  13823. segments must have the same number of streams of each type, and that will
  13824. also be the number of streams at output.
  13825. The filter accepts the following options:
  13826. @table @option
  13827. @item n
  13828. Set the number of segments. Default is 2.
  13829. @item v
  13830. Set the number of output video streams, that is also the number of video
  13831. streams in each segment. Default is 1.
  13832. @item a
  13833. Set the number of output audio streams, that is also the number of audio
  13834. streams in each segment. Default is 0.
  13835. @item unsafe
  13836. Activate unsafe mode: do not fail if segments have a different format.
  13837. @end table
  13838. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  13839. @var{a} audio outputs.
  13840. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  13841. segment, in the same order as the outputs, then the inputs for the second
  13842. segment, etc.
  13843. Related streams do not always have exactly the same duration, for various
  13844. reasons including codec frame size or sloppy authoring. For that reason,
  13845. related synchronized streams (e.g. a video and its audio track) should be
  13846. concatenated at once. The concat filter will use the duration of the longest
  13847. stream in each segment (except the last one), and if necessary pad shorter
  13848. audio streams with silence.
  13849. For this filter to work correctly, all segments must start at timestamp 0.
  13850. All corresponding streams must have the same parameters in all segments; the
  13851. filtering system will automatically select a common pixel format for video
  13852. streams, and a common sample format, sample rate and channel layout for
  13853. audio streams, but other settings, such as resolution, must be converted
  13854. explicitly by the user.
  13855. Different frame rates are acceptable but will result in variable frame rate
  13856. at output; be sure to configure the output file to handle it.
  13857. @subsection Examples
  13858. @itemize
  13859. @item
  13860. Concatenate an opening, an episode and an ending, all in bilingual version
  13861. (video in stream 0, audio in streams 1 and 2):
  13862. @example
  13863. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  13864. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  13865. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  13866. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  13867. @end example
  13868. @item
  13869. Concatenate two parts, handling audio and video separately, using the
  13870. (a)movie sources, and adjusting the resolution:
  13871. @example
  13872. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  13873. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  13874. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  13875. @end example
  13876. Note that a desync will happen at the stitch if the audio and video streams
  13877. do not have exactly the same duration in the first file.
  13878. @end itemize
  13879. @subsection Commands
  13880. This filter supports the following commands:
  13881. @table @option
  13882. @item next
  13883. Close the current segment and step to the next one
  13884. @end table
  13885. @section drawgraph, adrawgraph
  13886. Draw a graph using input video or audio metadata.
  13887. It accepts the following parameters:
  13888. @table @option
  13889. @item m1
  13890. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  13891. @item fg1
  13892. Set 1st foreground color expression.
  13893. @item m2
  13894. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  13895. @item fg2
  13896. Set 2nd foreground color expression.
  13897. @item m3
  13898. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  13899. @item fg3
  13900. Set 3rd foreground color expression.
  13901. @item m4
  13902. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  13903. @item fg4
  13904. Set 4th foreground color expression.
  13905. @item min
  13906. Set minimal value of metadata value.
  13907. @item max
  13908. Set maximal value of metadata value.
  13909. @item bg
  13910. Set graph background color. Default is white.
  13911. @item mode
  13912. Set graph mode.
  13913. Available values for mode is:
  13914. @table @samp
  13915. @item bar
  13916. @item dot
  13917. @item line
  13918. @end table
  13919. Default is @code{line}.
  13920. @item slide
  13921. Set slide mode.
  13922. Available values for slide is:
  13923. @table @samp
  13924. @item frame
  13925. Draw new frame when right border is reached.
  13926. @item replace
  13927. Replace old columns with new ones.
  13928. @item scroll
  13929. Scroll from right to left.
  13930. @item rscroll
  13931. Scroll from left to right.
  13932. @item picture
  13933. Draw single picture.
  13934. @end table
  13935. Default is @code{frame}.
  13936. @item size
  13937. Set size of graph video. For the syntax of this option, check the
  13938. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13939. The default value is @code{900x256}.
  13940. The foreground color expressions can use the following variables:
  13941. @table @option
  13942. @item MIN
  13943. Minimal value of metadata value.
  13944. @item MAX
  13945. Maximal value of metadata value.
  13946. @item VAL
  13947. Current metadata key value.
  13948. @end table
  13949. The color is defined as 0xAABBGGRR.
  13950. @end table
  13951. Example using metadata from @ref{signalstats} filter:
  13952. @example
  13953. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  13954. @end example
  13955. Example using metadata from @ref{ebur128} filter:
  13956. @example
  13957. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  13958. @end example
  13959. @anchor{ebur128}
  13960. @section ebur128
  13961. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  13962. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  13963. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  13964. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  13965. The filter also has a video output (see the @var{video} option) with a real
  13966. time graph to observe the loudness evolution. The graphic contains the logged
  13967. message mentioned above, so it is not printed anymore when this option is set,
  13968. unless the verbose logging is set. The main graphing area contains the
  13969. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  13970. the momentary loudness (400 milliseconds).
  13971. More information about the Loudness Recommendation EBU R128 on
  13972. @url{http://tech.ebu.ch/loudness}.
  13973. The filter accepts the following options:
  13974. @table @option
  13975. @item video
  13976. Activate the video output. The audio stream is passed unchanged whether this
  13977. option is set or no. The video stream will be the first output stream if
  13978. activated. Default is @code{0}.
  13979. @item size
  13980. Set the video size. This option is for video only. For the syntax of this
  13981. option, check the
  13982. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13983. Default and minimum resolution is @code{640x480}.
  13984. @item meter
  13985. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  13986. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  13987. other integer value between this range is allowed.
  13988. @item metadata
  13989. Set metadata injection. If set to @code{1}, the audio input will be segmented
  13990. into 100ms output frames, each of them containing various loudness information
  13991. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  13992. Default is @code{0}.
  13993. @item framelog
  13994. Force the frame logging level.
  13995. Available values are:
  13996. @table @samp
  13997. @item info
  13998. information logging level
  13999. @item verbose
  14000. verbose logging level
  14001. @end table
  14002. By default, the logging level is set to @var{info}. If the @option{video} or
  14003. the @option{metadata} options are set, it switches to @var{verbose}.
  14004. @item peak
  14005. Set peak mode(s).
  14006. Available modes can be cumulated (the option is a @code{flag} type). Possible
  14007. values are:
  14008. @table @samp
  14009. @item none
  14010. Disable any peak mode (default).
  14011. @item sample
  14012. Enable sample-peak mode.
  14013. Simple peak mode looking for the higher sample value. It logs a message
  14014. for sample-peak (identified by @code{SPK}).
  14015. @item true
  14016. Enable true-peak mode.
  14017. If enabled, the peak lookup is done on an over-sampled version of the input
  14018. stream for better peak accuracy. It logs a message for true-peak.
  14019. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  14020. This mode requires a build with @code{libswresample}.
  14021. @end table
  14022. @item dualmono
  14023. Treat mono input files as "dual mono". If a mono file is intended for playback
  14024. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  14025. If set to @code{true}, this option will compensate for this effect.
  14026. Multi-channel input files are not affected by this option.
  14027. @item panlaw
  14028. Set a specific pan law to be used for the measurement of dual mono files.
  14029. This parameter is optional, and has a default value of -3.01dB.
  14030. @end table
  14031. @subsection Examples
  14032. @itemize
  14033. @item
  14034. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  14035. @example
  14036. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  14037. @end example
  14038. @item
  14039. Run an analysis with @command{ffmpeg}:
  14040. @example
  14041. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  14042. @end example
  14043. @end itemize
  14044. @section interleave, ainterleave
  14045. Temporally interleave frames from several inputs.
  14046. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  14047. These filters read frames from several inputs and send the oldest
  14048. queued frame to the output.
  14049. Input streams must have well defined, monotonically increasing frame
  14050. timestamp values.
  14051. In order to submit one frame to output, these filters need to enqueue
  14052. at least one frame for each input, so they cannot work in case one
  14053. input is not yet terminated and will not receive incoming frames.
  14054. For example consider the case when one input is a @code{select} filter
  14055. which always drops input frames. The @code{interleave} filter will keep
  14056. reading from that input, but it will never be able to send new frames
  14057. to output until the input sends an end-of-stream signal.
  14058. Also, depending on inputs synchronization, the filters will drop
  14059. frames in case one input receives more frames than the other ones, and
  14060. the queue is already filled.
  14061. These filters accept the following options:
  14062. @table @option
  14063. @item nb_inputs, n
  14064. Set the number of different inputs, it is 2 by default.
  14065. @end table
  14066. @subsection Examples
  14067. @itemize
  14068. @item
  14069. Interleave frames belonging to different streams using @command{ffmpeg}:
  14070. @example
  14071. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  14072. @end example
  14073. @item
  14074. Add flickering blur effect:
  14075. @example
  14076. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  14077. @end example
  14078. @end itemize
  14079. @section metadata, ametadata
  14080. Manipulate frame metadata.
  14081. This filter accepts the following options:
  14082. @table @option
  14083. @item mode
  14084. Set mode of operation of the filter.
  14085. Can be one of the following:
  14086. @table @samp
  14087. @item select
  14088. If both @code{value} and @code{key} is set, select frames
  14089. which have such metadata. If only @code{key} is set, select
  14090. every frame that has such key in metadata.
  14091. @item add
  14092. Add new metadata @code{key} and @code{value}. If key is already available
  14093. do nothing.
  14094. @item modify
  14095. Modify value of already present key.
  14096. @item delete
  14097. If @code{value} is set, delete only keys that have such value.
  14098. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  14099. the frame.
  14100. @item print
  14101. Print key and its value if metadata was found. If @code{key} is not set print all
  14102. metadata values available in frame.
  14103. @end table
  14104. @item key
  14105. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  14106. @item value
  14107. Set metadata value which will be used. This option is mandatory for
  14108. @code{modify} and @code{add} mode.
  14109. @item function
  14110. Which function to use when comparing metadata value and @code{value}.
  14111. Can be one of following:
  14112. @table @samp
  14113. @item same_str
  14114. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  14115. @item starts_with
  14116. Values are interpreted as strings, returns true if metadata value starts with
  14117. the @code{value} option string.
  14118. @item less
  14119. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  14120. @item equal
  14121. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  14122. @item greater
  14123. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  14124. @item expr
  14125. Values are interpreted as floats, returns true if expression from option @code{expr}
  14126. evaluates to true.
  14127. @end table
  14128. @item expr
  14129. Set expression which is used when @code{function} is set to @code{expr}.
  14130. The expression is evaluated through the eval API and can contain the following
  14131. constants:
  14132. @table @option
  14133. @item VALUE1
  14134. Float representation of @code{value} from metadata key.
  14135. @item VALUE2
  14136. Float representation of @code{value} as supplied by user in @code{value} option.
  14137. @end table
  14138. @item file
  14139. If specified in @code{print} mode, output is written to the named file. Instead of
  14140. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  14141. for standard output. If @code{file} option is not set, output is written to the log
  14142. with AV_LOG_INFO loglevel.
  14143. @end table
  14144. @subsection Examples
  14145. @itemize
  14146. @item
  14147. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  14148. between 0 and 1.
  14149. @example
  14150. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  14151. @end example
  14152. @item
  14153. Print silencedetect output to file @file{metadata.txt}.
  14154. @example
  14155. silencedetect,ametadata=mode=print:file=metadata.txt
  14156. @end example
  14157. @item
  14158. Direct all metadata to a pipe with file descriptor 4.
  14159. @example
  14160. metadata=mode=print:file='pipe\:4'
  14161. @end example
  14162. @end itemize
  14163. @section perms, aperms
  14164. Set read/write permissions for the output frames.
  14165. These filters are mainly aimed at developers to test direct path in the
  14166. following filter in the filtergraph.
  14167. The filters accept the following options:
  14168. @table @option
  14169. @item mode
  14170. Select the permissions mode.
  14171. It accepts the following values:
  14172. @table @samp
  14173. @item none
  14174. Do nothing. This is the default.
  14175. @item ro
  14176. Set all the output frames read-only.
  14177. @item rw
  14178. Set all the output frames directly writable.
  14179. @item toggle
  14180. Make the frame read-only if writable, and writable if read-only.
  14181. @item random
  14182. Set each output frame read-only or writable randomly.
  14183. @end table
  14184. @item seed
  14185. Set the seed for the @var{random} mode, must be an integer included between
  14186. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  14187. @code{-1}, the filter will try to use a good random seed on a best effort
  14188. basis.
  14189. @end table
  14190. Note: in case of auto-inserted filter between the permission filter and the
  14191. following one, the permission might not be received as expected in that
  14192. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  14193. perms/aperms filter can avoid this problem.
  14194. @section realtime, arealtime
  14195. Slow down filtering to match real time approximately.
  14196. These filters will pause the filtering for a variable amount of time to
  14197. match the output rate with the input timestamps.
  14198. They are similar to the @option{re} option to @code{ffmpeg}.
  14199. They accept the following options:
  14200. @table @option
  14201. @item limit
  14202. Time limit for the pauses. Any pause longer than that will be considered
  14203. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  14204. @end table
  14205. @anchor{select}
  14206. @section select, aselect
  14207. Select frames to pass in output.
  14208. This filter accepts the following options:
  14209. @table @option
  14210. @item expr, e
  14211. Set expression, which is evaluated for each input frame.
  14212. If the expression is evaluated to zero, the frame is discarded.
  14213. If the evaluation result is negative or NaN, the frame is sent to the
  14214. first output; otherwise it is sent to the output with index
  14215. @code{ceil(val)-1}, assuming that the input index starts from 0.
  14216. For example a value of @code{1.2} corresponds to the output with index
  14217. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  14218. @item outputs, n
  14219. Set the number of outputs. The output to which to send the selected
  14220. frame is based on the result of the evaluation. Default value is 1.
  14221. @end table
  14222. The expression can contain the following constants:
  14223. @table @option
  14224. @item n
  14225. The (sequential) number of the filtered frame, starting from 0.
  14226. @item selected_n
  14227. The (sequential) number of the selected frame, starting from 0.
  14228. @item prev_selected_n
  14229. The sequential number of the last selected frame. It's NAN if undefined.
  14230. @item TB
  14231. The timebase of the input timestamps.
  14232. @item pts
  14233. The PTS (Presentation TimeStamp) of the filtered video frame,
  14234. expressed in @var{TB} units. It's NAN if undefined.
  14235. @item t
  14236. The PTS of the filtered video frame,
  14237. expressed in seconds. It's NAN if undefined.
  14238. @item prev_pts
  14239. The PTS of the previously filtered video frame. It's NAN if undefined.
  14240. @item prev_selected_pts
  14241. The PTS of the last previously filtered video frame. It's NAN if undefined.
  14242. @item prev_selected_t
  14243. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  14244. @item start_pts
  14245. The PTS of the first video frame in the video. It's NAN if undefined.
  14246. @item start_t
  14247. The time of the first video frame in the video. It's NAN if undefined.
  14248. @item pict_type @emph{(video only)}
  14249. The type of the filtered frame. It can assume one of the following
  14250. values:
  14251. @table @option
  14252. @item I
  14253. @item P
  14254. @item B
  14255. @item S
  14256. @item SI
  14257. @item SP
  14258. @item BI
  14259. @end table
  14260. @item interlace_type @emph{(video only)}
  14261. The frame interlace type. It can assume one of the following values:
  14262. @table @option
  14263. @item PROGRESSIVE
  14264. The frame is progressive (not interlaced).
  14265. @item TOPFIRST
  14266. The frame is top-field-first.
  14267. @item BOTTOMFIRST
  14268. The frame is bottom-field-first.
  14269. @end table
  14270. @item consumed_sample_n @emph{(audio only)}
  14271. the number of selected samples before the current frame
  14272. @item samples_n @emph{(audio only)}
  14273. the number of samples in the current frame
  14274. @item sample_rate @emph{(audio only)}
  14275. the input sample rate
  14276. @item key
  14277. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  14278. @item pos
  14279. the position in the file of the filtered frame, -1 if the information
  14280. is not available (e.g. for synthetic video)
  14281. @item scene @emph{(video only)}
  14282. value between 0 and 1 to indicate a new scene; a low value reflects a low
  14283. probability for the current frame to introduce a new scene, while a higher
  14284. value means the current frame is more likely to be one (see the example below)
  14285. @item concatdec_select
  14286. The concat demuxer can select only part of a concat input file by setting an
  14287. inpoint and an outpoint, but the output packets may not be entirely contained
  14288. in the selected interval. By using this variable, it is possible to skip frames
  14289. generated by the concat demuxer which are not exactly contained in the selected
  14290. interval.
  14291. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  14292. and the @var{lavf.concat.duration} packet metadata values which are also
  14293. present in the decoded frames.
  14294. The @var{concatdec_select} variable is -1 if the frame pts is at least
  14295. start_time and either the duration metadata is missing or the frame pts is less
  14296. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  14297. missing.
  14298. That basically means that an input frame is selected if its pts is within the
  14299. interval set by the concat demuxer.
  14300. @end table
  14301. The default value of the select expression is "1".
  14302. @subsection Examples
  14303. @itemize
  14304. @item
  14305. Select all frames in input:
  14306. @example
  14307. select
  14308. @end example
  14309. The example above is the same as:
  14310. @example
  14311. select=1
  14312. @end example
  14313. @item
  14314. Skip all frames:
  14315. @example
  14316. select=0
  14317. @end example
  14318. @item
  14319. Select only I-frames:
  14320. @example
  14321. select='eq(pict_type\,I)'
  14322. @end example
  14323. @item
  14324. Select one frame every 100:
  14325. @example
  14326. select='not(mod(n\,100))'
  14327. @end example
  14328. @item
  14329. Select only frames contained in the 10-20 time interval:
  14330. @example
  14331. select=between(t\,10\,20)
  14332. @end example
  14333. @item
  14334. Select only I-frames contained in the 10-20 time interval:
  14335. @example
  14336. select=between(t\,10\,20)*eq(pict_type\,I)
  14337. @end example
  14338. @item
  14339. Select frames with a minimum distance of 10 seconds:
  14340. @example
  14341. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  14342. @end example
  14343. @item
  14344. Use aselect to select only audio frames with samples number > 100:
  14345. @example
  14346. aselect='gt(samples_n\,100)'
  14347. @end example
  14348. @item
  14349. Create a mosaic of the first scenes:
  14350. @example
  14351. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  14352. @end example
  14353. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  14354. choice.
  14355. @item
  14356. Send even and odd frames to separate outputs, and compose them:
  14357. @example
  14358. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  14359. @end example
  14360. @item
  14361. Select useful frames from an ffconcat file which is using inpoints and
  14362. outpoints but where the source files are not intra frame only.
  14363. @example
  14364. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  14365. @end example
  14366. @end itemize
  14367. @section sendcmd, asendcmd
  14368. Send commands to filters in the filtergraph.
  14369. These filters read commands to be sent to other filters in the
  14370. filtergraph.
  14371. @code{sendcmd} must be inserted between two video filters,
  14372. @code{asendcmd} must be inserted between two audio filters, but apart
  14373. from that they act the same way.
  14374. The specification of commands can be provided in the filter arguments
  14375. with the @var{commands} option, or in a file specified by the
  14376. @var{filename} option.
  14377. These filters accept the following options:
  14378. @table @option
  14379. @item commands, c
  14380. Set the commands to be read and sent to the other filters.
  14381. @item filename, f
  14382. Set the filename of the commands to be read and sent to the other
  14383. filters.
  14384. @end table
  14385. @subsection Commands syntax
  14386. A commands description consists of a sequence of interval
  14387. specifications, comprising a list of commands to be executed when a
  14388. particular event related to that interval occurs. The occurring event
  14389. is typically the current frame time entering or leaving a given time
  14390. interval.
  14391. An interval is specified by the following syntax:
  14392. @example
  14393. @var{START}[-@var{END}] @var{COMMANDS};
  14394. @end example
  14395. The time interval is specified by the @var{START} and @var{END} times.
  14396. @var{END} is optional and defaults to the maximum time.
  14397. The current frame time is considered within the specified interval if
  14398. it is included in the interval [@var{START}, @var{END}), that is when
  14399. the time is greater or equal to @var{START} and is lesser than
  14400. @var{END}.
  14401. @var{COMMANDS} consists of a sequence of one or more command
  14402. specifications, separated by ",", relating to that interval. The
  14403. syntax of a command specification is given by:
  14404. @example
  14405. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  14406. @end example
  14407. @var{FLAGS} is optional and specifies the type of events relating to
  14408. the time interval which enable sending the specified command, and must
  14409. be a non-null sequence of identifier flags separated by "+" or "|" and
  14410. enclosed between "[" and "]".
  14411. The following flags are recognized:
  14412. @table @option
  14413. @item enter
  14414. The command is sent when the current frame timestamp enters the
  14415. specified interval. In other words, the command is sent when the
  14416. previous frame timestamp was not in the given interval, and the
  14417. current is.
  14418. @item leave
  14419. The command is sent when the current frame timestamp leaves the
  14420. specified interval. In other words, the command is sent when the
  14421. previous frame timestamp was in the given interval, and the
  14422. current is not.
  14423. @end table
  14424. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  14425. assumed.
  14426. @var{TARGET} specifies the target of the command, usually the name of
  14427. the filter class or a specific filter instance name.
  14428. @var{COMMAND} specifies the name of the command for the target filter.
  14429. @var{ARG} is optional and specifies the optional list of argument for
  14430. the given @var{COMMAND}.
  14431. Between one interval specification and another, whitespaces, or
  14432. sequences of characters starting with @code{#} until the end of line,
  14433. are ignored and can be used to annotate comments.
  14434. A simplified BNF description of the commands specification syntax
  14435. follows:
  14436. @example
  14437. @var{COMMAND_FLAG} ::= "enter" | "leave"
  14438. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  14439. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  14440. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  14441. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  14442. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  14443. @end example
  14444. @subsection Examples
  14445. @itemize
  14446. @item
  14447. Specify audio tempo change at second 4:
  14448. @example
  14449. asendcmd=c='4.0 atempo tempo 1.5',atempo
  14450. @end example
  14451. @item
  14452. Target a specific filter instance:
  14453. @example
  14454. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  14455. @end example
  14456. @item
  14457. Specify a list of drawtext and hue commands in a file.
  14458. @example
  14459. # show text in the interval 5-10
  14460. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  14461. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  14462. # desaturate the image in the interval 15-20
  14463. 15.0-20.0 [enter] hue s 0,
  14464. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  14465. [leave] hue s 1,
  14466. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  14467. # apply an exponential saturation fade-out effect, starting from time 25
  14468. 25 [enter] hue s exp(25-t)
  14469. @end example
  14470. A filtergraph allowing to read and process the above command list
  14471. stored in a file @file{test.cmd}, can be specified with:
  14472. @example
  14473. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  14474. @end example
  14475. @end itemize
  14476. @anchor{setpts}
  14477. @section setpts, asetpts
  14478. Change the PTS (presentation timestamp) of the input frames.
  14479. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  14480. This filter accepts the following options:
  14481. @table @option
  14482. @item expr
  14483. The expression which is evaluated for each frame to construct its timestamp.
  14484. @end table
  14485. The expression is evaluated through the eval API and can contain the following
  14486. constants:
  14487. @table @option
  14488. @item FRAME_RATE
  14489. frame rate, only defined for constant frame-rate video
  14490. @item PTS
  14491. The presentation timestamp in input
  14492. @item N
  14493. The count of the input frame for video or the number of consumed samples,
  14494. not including the current frame for audio, starting from 0.
  14495. @item NB_CONSUMED_SAMPLES
  14496. The number of consumed samples, not including the current frame (only
  14497. audio)
  14498. @item NB_SAMPLES, S
  14499. The number of samples in the current frame (only audio)
  14500. @item SAMPLE_RATE, SR
  14501. The audio sample rate.
  14502. @item STARTPTS
  14503. The PTS of the first frame.
  14504. @item STARTT
  14505. the time in seconds of the first frame
  14506. @item INTERLACED
  14507. State whether the current frame is interlaced.
  14508. @item T
  14509. the time in seconds of the current frame
  14510. @item POS
  14511. original position in the file of the frame, or undefined if undefined
  14512. for the current frame
  14513. @item PREV_INPTS
  14514. The previous input PTS.
  14515. @item PREV_INT
  14516. previous input time in seconds
  14517. @item PREV_OUTPTS
  14518. The previous output PTS.
  14519. @item PREV_OUTT
  14520. previous output time in seconds
  14521. @item RTCTIME
  14522. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  14523. instead.
  14524. @item RTCSTART
  14525. The wallclock (RTC) time at the start of the movie in microseconds.
  14526. @item TB
  14527. The timebase of the input timestamps.
  14528. @end table
  14529. @subsection Examples
  14530. @itemize
  14531. @item
  14532. Start counting PTS from zero
  14533. @example
  14534. setpts=PTS-STARTPTS
  14535. @end example
  14536. @item
  14537. Apply fast motion effect:
  14538. @example
  14539. setpts=0.5*PTS
  14540. @end example
  14541. @item
  14542. Apply slow motion effect:
  14543. @example
  14544. setpts=2.0*PTS
  14545. @end example
  14546. @item
  14547. Set fixed rate of 25 frames per second:
  14548. @example
  14549. setpts=N/(25*TB)
  14550. @end example
  14551. @item
  14552. Set fixed rate 25 fps with some jitter:
  14553. @example
  14554. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  14555. @end example
  14556. @item
  14557. Apply an offset of 10 seconds to the input PTS:
  14558. @example
  14559. setpts=PTS+10/TB
  14560. @end example
  14561. @item
  14562. Generate timestamps from a "live source" and rebase onto the current timebase:
  14563. @example
  14564. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  14565. @end example
  14566. @item
  14567. Generate timestamps by counting samples:
  14568. @example
  14569. asetpts=N/SR/TB
  14570. @end example
  14571. @end itemize
  14572. @section setrange
  14573. Force color range for the output video frame.
  14574. The @code{setrange} filter marks the color range property for the
  14575. output frames. It does not change the input frame, but only sets the
  14576. corresponding property, which affects how the frame is treated by
  14577. following filters.
  14578. The filter accepts the following options:
  14579. @table @option
  14580. @item range
  14581. Available values are:
  14582. @table @samp
  14583. @item auto
  14584. Keep the same color range property.
  14585. @item unspecified, unknown
  14586. Set the color range as unspecified.
  14587. @item limited, tv, mpeg
  14588. Set the color range as limited.
  14589. @item full, pc, jpeg
  14590. Set the color range as full.
  14591. @end table
  14592. @end table
  14593. @section settb, asettb
  14594. Set the timebase to use for the output frames timestamps.
  14595. It is mainly useful for testing timebase configuration.
  14596. It accepts the following parameters:
  14597. @table @option
  14598. @item expr, tb
  14599. The expression which is evaluated into the output timebase.
  14600. @end table
  14601. The value for @option{tb} is an arithmetic expression representing a
  14602. rational. The expression can contain the constants "AVTB" (the default
  14603. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  14604. audio only). Default value is "intb".
  14605. @subsection Examples
  14606. @itemize
  14607. @item
  14608. Set the timebase to 1/25:
  14609. @example
  14610. settb=expr=1/25
  14611. @end example
  14612. @item
  14613. Set the timebase to 1/10:
  14614. @example
  14615. settb=expr=0.1
  14616. @end example
  14617. @item
  14618. Set the timebase to 1001/1000:
  14619. @example
  14620. settb=1+0.001
  14621. @end example
  14622. @item
  14623. Set the timebase to 2*intb:
  14624. @example
  14625. settb=2*intb
  14626. @end example
  14627. @item
  14628. Set the default timebase value:
  14629. @example
  14630. settb=AVTB
  14631. @end example
  14632. @end itemize
  14633. @section showcqt
  14634. Convert input audio to a video output representing frequency spectrum
  14635. logarithmically using Brown-Puckette constant Q transform algorithm with
  14636. direct frequency domain coefficient calculation (but the transform itself
  14637. is not really constant Q, instead the Q factor is actually variable/clamped),
  14638. with musical tone scale, from E0 to D#10.
  14639. The filter accepts the following options:
  14640. @table @option
  14641. @item size, s
  14642. Specify the video size for the output. It must be even. For the syntax of this option,
  14643. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14644. Default value is @code{1920x1080}.
  14645. @item fps, rate, r
  14646. Set the output frame rate. Default value is @code{25}.
  14647. @item bar_h
  14648. Set the bargraph height. It must be even. Default value is @code{-1} which
  14649. computes the bargraph height automatically.
  14650. @item axis_h
  14651. Set the axis height. It must be even. Default value is @code{-1} which computes
  14652. the axis height automatically.
  14653. @item sono_h
  14654. Set the sonogram height. It must be even. Default value is @code{-1} which
  14655. computes the sonogram height automatically.
  14656. @item fullhd
  14657. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  14658. instead. Default value is @code{1}.
  14659. @item sono_v, volume
  14660. Specify the sonogram volume expression. It can contain variables:
  14661. @table @option
  14662. @item bar_v
  14663. the @var{bar_v} evaluated expression
  14664. @item frequency, freq, f
  14665. the frequency where it is evaluated
  14666. @item timeclamp, tc
  14667. the value of @var{timeclamp} option
  14668. @end table
  14669. and functions:
  14670. @table @option
  14671. @item a_weighting(f)
  14672. A-weighting of equal loudness
  14673. @item b_weighting(f)
  14674. B-weighting of equal loudness
  14675. @item c_weighting(f)
  14676. C-weighting of equal loudness.
  14677. @end table
  14678. Default value is @code{16}.
  14679. @item bar_v, volume2
  14680. Specify the bargraph volume expression. It can contain variables:
  14681. @table @option
  14682. @item sono_v
  14683. the @var{sono_v} evaluated expression
  14684. @item frequency, freq, f
  14685. the frequency where it is evaluated
  14686. @item timeclamp, tc
  14687. the value of @var{timeclamp} option
  14688. @end table
  14689. and functions:
  14690. @table @option
  14691. @item a_weighting(f)
  14692. A-weighting of equal loudness
  14693. @item b_weighting(f)
  14694. B-weighting of equal loudness
  14695. @item c_weighting(f)
  14696. C-weighting of equal loudness.
  14697. @end table
  14698. Default value is @code{sono_v}.
  14699. @item sono_g, gamma
  14700. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  14701. higher gamma makes the spectrum having more range. Default value is @code{3}.
  14702. Acceptable range is @code{[1, 7]}.
  14703. @item bar_g, gamma2
  14704. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  14705. @code{[1, 7]}.
  14706. @item bar_t
  14707. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  14708. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  14709. @item timeclamp, tc
  14710. Specify the transform timeclamp. At low frequency, there is trade-off between
  14711. accuracy in time domain and frequency domain. If timeclamp is lower,
  14712. event in time domain is represented more accurately (such as fast bass drum),
  14713. otherwise event in frequency domain is represented more accurately
  14714. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  14715. @item attack
  14716. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  14717. limits future samples by applying asymmetric windowing in time domain, useful
  14718. when low latency is required. Accepted range is @code{[0, 1]}.
  14719. @item basefreq
  14720. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  14721. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  14722. @item endfreq
  14723. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  14724. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  14725. @item coeffclamp
  14726. This option is deprecated and ignored.
  14727. @item tlength
  14728. Specify the transform length in time domain. Use this option to control accuracy
  14729. trade-off between time domain and frequency domain at every frequency sample.
  14730. It can contain variables:
  14731. @table @option
  14732. @item frequency, freq, f
  14733. the frequency where it is evaluated
  14734. @item timeclamp, tc
  14735. the value of @var{timeclamp} option.
  14736. @end table
  14737. Default value is @code{384*tc/(384+tc*f)}.
  14738. @item count
  14739. Specify the transform count for every video frame. Default value is @code{6}.
  14740. Acceptable range is @code{[1, 30]}.
  14741. @item fcount
  14742. Specify the transform count for every single pixel. Default value is @code{0},
  14743. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  14744. @item fontfile
  14745. Specify font file for use with freetype to draw the axis. If not specified,
  14746. use embedded font. Note that drawing with font file or embedded font is not
  14747. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  14748. option instead.
  14749. @item font
  14750. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  14751. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  14752. @item fontcolor
  14753. Specify font color expression. This is arithmetic expression that should return
  14754. integer value 0xRRGGBB. It can contain variables:
  14755. @table @option
  14756. @item frequency, freq, f
  14757. the frequency where it is evaluated
  14758. @item timeclamp, tc
  14759. the value of @var{timeclamp} option
  14760. @end table
  14761. and functions:
  14762. @table @option
  14763. @item midi(f)
  14764. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  14765. @item r(x), g(x), b(x)
  14766. red, green, and blue value of intensity x.
  14767. @end table
  14768. Default value is @code{st(0, (midi(f)-59.5)/12);
  14769. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  14770. r(1-ld(1)) + b(ld(1))}.
  14771. @item axisfile
  14772. Specify image file to draw the axis. This option override @var{fontfile} and
  14773. @var{fontcolor} option.
  14774. @item axis, text
  14775. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  14776. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  14777. Default value is @code{1}.
  14778. @item csp
  14779. Set colorspace. The accepted values are:
  14780. @table @samp
  14781. @item unspecified
  14782. Unspecified (default)
  14783. @item bt709
  14784. BT.709
  14785. @item fcc
  14786. FCC
  14787. @item bt470bg
  14788. BT.470BG or BT.601-6 625
  14789. @item smpte170m
  14790. SMPTE-170M or BT.601-6 525
  14791. @item smpte240m
  14792. SMPTE-240M
  14793. @item bt2020ncl
  14794. BT.2020 with non-constant luminance
  14795. @end table
  14796. @item cscheme
  14797. Set spectrogram color scheme. This is list of floating point values with format
  14798. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  14799. The default is @code{1|0.5|0|0|0.5|1}.
  14800. @end table
  14801. @subsection Examples
  14802. @itemize
  14803. @item
  14804. Playing audio while showing the spectrum:
  14805. @example
  14806. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  14807. @end example
  14808. @item
  14809. Same as above, but with frame rate 30 fps:
  14810. @example
  14811. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  14812. @end example
  14813. @item
  14814. Playing at 1280x720:
  14815. @example
  14816. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  14817. @end example
  14818. @item
  14819. Disable sonogram display:
  14820. @example
  14821. sono_h=0
  14822. @end example
  14823. @item
  14824. A1 and its harmonics: A1, A2, (near)E3, A3:
  14825. @example
  14826. 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),
  14827. asplit[a][out1]; [a] showcqt [out0]'
  14828. @end example
  14829. @item
  14830. Same as above, but with more accuracy in frequency domain:
  14831. @example
  14832. 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),
  14833. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  14834. @end example
  14835. @item
  14836. Custom volume:
  14837. @example
  14838. bar_v=10:sono_v=bar_v*a_weighting(f)
  14839. @end example
  14840. @item
  14841. Custom gamma, now spectrum is linear to the amplitude.
  14842. @example
  14843. bar_g=2:sono_g=2
  14844. @end example
  14845. @item
  14846. Custom tlength equation:
  14847. @example
  14848. 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)))'
  14849. @end example
  14850. @item
  14851. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  14852. @example
  14853. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  14854. @end example
  14855. @item
  14856. Custom font using fontconfig:
  14857. @example
  14858. font='Courier New,Monospace,mono|bold'
  14859. @end example
  14860. @item
  14861. Custom frequency range with custom axis using image file:
  14862. @example
  14863. axisfile=myaxis.png:basefreq=40:endfreq=10000
  14864. @end example
  14865. @end itemize
  14866. @section showfreqs
  14867. Convert input audio to video output representing the audio power spectrum.
  14868. Audio amplitude is on Y-axis while frequency is on X-axis.
  14869. The filter accepts the following options:
  14870. @table @option
  14871. @item size, s
  14872. Specify size of video. For the syntax of this option, check the
  14873. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14874. Default is @code{1024x512}.
  14875. @item mode
  14876. Set display mode.
  14877. This set how each frequency bin will be represented.
  14878. It accepts the following values:
  14879. @table @samp
  14880. @item line
  14881. @item bar
  14882. @item dot
  14883. @end table
  14884. Default is @code{bar}.
  14885. @item ascale
  14886. Set amplitude scale.
  14887. It accepts the following values:
  14888. @table @samp
  14889. @item lin
  14890. Linear scale.
  14891. @item sqrt
  14892. Square root scale.
  14893. @item cbrt
  14894. Cubic root scale.
  14895. @item log
  14896. Logarithmic scale.
  14897. @end table
  14898. Default is @code{log}.
  14899. @item fscale
  14900. Set frequency scale.
  14901. It accepts the following values:
  14902. @table @samp
  14903. @item lin
  14904. Linear scale.
  14905. @item log
  14906. Logarithmic scale.
  14907. @item rlog
  14908. Reverse logarithmic scale.
  14909. @end table
  14910. Default is @code{lin}.
  14911. @item win_size
  14912. Set window size.
  14913. It accepts the following values:
  14914. @table @samp
  14915. @item w16
  14916. @item w32
  14917. @item w64
  14918. @item w128
  14919. @item w256
  14920. @item w512
  14921. @item w1024
  14922. @item w2048
  14923. @item w4096
  14924. @item w8192
  14925. @item w16384
  14926. @item w32768
  14927. @item w65536
  14928. @end table
  14929. Default is @code{w2048}
  14930. @item win_func
  14931. Set windowing function.
  14932. It accepts the following values:
  14933. @table @samp
  14934. @item rect
  14935. @item bartlett
  14936. @item hanning
  14937. @item hamming
  14938. @item blackman
  14939. @item welch
  14940. @item flattop
  14941. @item bharris
  14942. @item bnuttall
  14943. @item bhann
  14944. @item sine
  14945. @item nuttall
  14946. @item lanczos
  14947. @item gauss
  14948. @item tukey
  14949. @item dolph
  14950. @item cauchy
  14951. @item parzen
  14952. @item poisson
  14953. @end table
  14954. Default is @code{hanning}.
  14955. @item overlap
  14956. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14957. which means optimal overlap for selected window function will be picked.
  14958. @item averaging
  14959. Set time averaging. Setting this to 0 will display current maximal peaks.
  14960. Default is @code{1}, which means time averaging is disabled.
  14961. @item colors
  14962. Specify list of colors separated by space or by '|' which will be used to
  14963. draw channel frequencies. Unrecognized or missing colors will be replaced
  14964. by white color.
  14965. @item cmode
  14966. Set channel display mode.
  14967. It accepts the following values:
  14968. @table @samp
  14969. @item combined
  14970. @item separate
  14971. @end table
  14972. Default is @code{combined}.
  14973. @item minamp
  14974. Set minimum amplitude used in @code{log} amplitude scaler.
  14975. @end table
  14976. @anchor{showspectrum}
  14977. @section showspectrum
  14978. Convert input audio to a video output, representing the audio frequency
  14979. spectrum.
  14980. The filter accepts the following options:
  14981. @table @option
  14982. @item size, s
  14983. Specify the video size for the output. For the syntax of this option, check the
  14984. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14985. Default value is @code{640x512}.
  14986. @item slide
  14987. Specify how the spectrum should slide along the window.
  14988. It accepts the following values:
  14989. @table @samp
  14990. @item replace
  14991. the samples start again on the left when they reach the right
  14992. @item scroll
  14993. the samples scroll from right to left
  14994. @item fullframe
  14995. frames are only produced when the samples reach the right
  14996. @item rscroll
  14997. the samples scroll from left to right
  14998. @end table
  14999. Default value is @code{replace}.
  15000. @item mode
  15001. Specify display mode.
  15002. It accepts the following values:
  15003. @table @samp
  15004. @item combined
  15005. all channels are displayed in the same row
  15006. @item separate
  15007. all channels are displayed in separate rows
  15008. @end table
  15009. Default value is @samp{combined}.
  15010. @item color
  15011. Specify display color mode.
  15012. It accepts the following values:
  15013. @table @samp
  15014. @item channel
  15015. each channel is displayed in a separate color
  15016. @item intensity
  15017. each channel is displayed using the same color scheme
  15018. @item rainbow
  15019. each channel is displayed using the rainbow color scheme
  15020. @item moreland
  15021. each channel is displayed using the moreland color scheme
  15022. @item nebulae
  15023. each channel is displayed using the nebulae color scheme
  15024. @item fire
  15025. each channel is displayed using the fire color scheme
  15026. @item fiery
  15027. each channel is displayed using the fiery color scheme
  15028. @item fruit
  15029. each channel is displayed using the fruit color scheme
  15030. @item cool
  15031. each channel is displayed using the cool color scheme
  15032. @end table
  15033. Default value is @samp{channel}.
  15034. @item scale
  15035. Specify scale used for calculating intensity color values.
  15036. It accepts the following values:
  15037. @table @samp
  15038. @item lin
  15039. linear
  15040. @item sqrt
  15041. square root, default
  15042. @item cbrt
  15043. cubic root
  15044. @item log
  15045. logarithmic
  15046. @item 4thrt
  15047. 4th root
  15048. @item 5thrt
  15049. 5th root
  15050. @end table
  15051. Default value is @samp{sqrt}.
  15052. @item saturation
  15053. Set saturation modifier for displayed colors. Negative values provide
  15054. alternative color scheme. @code{0} is no saturation at all.
  15055. Saturation must be in [-10.0, 10.0] range.
  15056. Default value is @code{1}.
  15057. @item win_func
  15058. Set window function.
  15059. It accepts the following values:
  15060. @table @samp
  15061. @item rect
  15062. @item bartlett
  15063. @item hann
  15064. @item hanning
  15065. @item hamming
  15066. @item blackman
  15067. @item welch
  15068. @item flattop
  15069. @item bharris
  15070. @item bnuttall
  15071. @item bhann
  15072. @item sine
  15073. @item nuttall
  15074. @item lanczos
  15075. @item gauss
  15076. @item tukey
  15077. @item dolph
  15078. @item cauchy
  15079. @item parzen
  15080. @item poisson
  15081. @end table
  15082. Default value is @code{hann}.
  15083. @item orientation
  15084. Set orientation of time vs frequency axis. Can be @code{vertical} or
  15085. @code{horizontal}. Default is @code{vertical}.
  15086. @item overlap
  15087. Set ratio of overlap window. Default value is @code{0}.
  15088. When value is @code{1} overlap is set to recommended size for specific
  15089. window function currently used.
  15090. @item gain
  15091. Set scale gain for calculating intensity color values.
  15092. Default value is @code{1}.
  15093. @item data
  15094. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  15095. @item rotation
  15096. Set color rotation, must be in [-1.0, 1.0] range.
  15097. Default value is @code{0}.
  15098. @end table
  15099. The usage is very similar to the showwaves filter; see the examples in that
  15100. section.
  15101. @subsection Examples
  15102. @itemize
  15103. @item
  15104. Large window with logarithmic color scaling:
  15105. @example
  15106. showspectrum=s=1280x480:scale=log
  15107. @end example
  15108. @item
  15109. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  15110. @example
  15111. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  15112. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  15113. @end example
  15114. @end itemize
  15115. @section showspectrumpic
  15116. Convert input audio to a single video frame, representing the audio frequency
  15117. spectrum.
  15118. The filter accepts the following options:
  15119. @table @option
  15120. @item size, s
  15121. Specify the video size for the output. For the syntax of this option, check the
  15122. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15123. Default value is @code{4096x2048}.
  15124. @item mode
  15125. Specify display mode.
  15126. It accepts the following values:
  15127. @table @samp
  15128. @item combined
  15129. all channels are displayed in the same row
  15130. @item separate
  15131. all channels are displayed in separate rows
  15132. @end table
  15133. Default value is @samp{combined}.
  15134. @item color
  15135. Specify display color mode.
  15136. It accepts the following values:
  15137. @table @samp
  15138. @item channel
  15139. each channel is displayed in a separate color
  15140. @item intensity
  15141. each channel is displayed using the same color scheme
  15142. @item rainbow
  15143. each channel is displayed using the rainbow color scheme
  15144. @item moreland
  15145. each channel is displayed using the moreland color scheme
  15146. @item nebulae
  15147. each channel is displayed using the nebulae color scheme
  15148. @item fire
  15149. each channel is displayed using the fire color scheme
  15150. @item fiery
  15151. each channel is displayed using the fiery color scheme
  15152. @item fruit
  15153. each channel is displayed using the fruit color scheme
  15154. @item cool
  15155. each channel is displayed using the cool color scheme
  15156. @end table
  15157. Default value is @samp{intensity}.
  15158. @item scale
  15159. Specify scale used for calculating intensity color values.
  15160. It accepts the following values:
  15161. @table @samp
  15162. @item lin
  15163. linear
  15164. @item sqrt
  15165. square root, default
  15166. @item cbrt
  15167. cubic root
  15168. @item log
  15169. logarithmic
  15170. @item 4thrt
  15171. 4th root
  15172. @item 5thrt
  15173. 5th root
  15174. @end table
  15175. Default value is @samp{log}.
  15176. @item saturation
  15177. Set saturation modifier for displayed colors. Negative values provide
  15178. alternative color scheme. @code{0} is no saturation at all.
  15179. Saturation must be in [-10.0, 10.0] range.
  15180. Default value is @code{1}.
  15181. @item win_func
  15182. Set window function.
  15183. It accepts the following values:
  15184. @table @samp
  15185. @item rect
  15186. @item bartlett
  15187. @item hann
  15188. @item hanning
  15189. @item hamming
  15190. @item blackman
  15191. @item welch
  15192. @item flattop
  15193. @item bharris
  15194. @item bnuttall
  15195. @item bhann
  15196. @item sine
  15197. @item nuttall
  15198. @item lanczos
  15199. @item gauss
  15200. @item tukey
  15201. @item dolph
  15202. @item cauchy
  15203. @item parzen
  15204. @item poisson
  15205. @end table
  15206. Default value is @code{hann}.
  15207. @item orientation
  15208. Set orientation of time vs frequency axis. Can be @code{vertical} or
  15209. @code{horizontal}. Default is @code{vertical}.
  15210. @item gain
  15211. Set scale gain for calculating intensity color values.
  15212. Default value is @code{1}.
  15213. @item legend
  15214. Draw time and frequency axes and legends. Default is enabled.
  15215. @item rotation
  15216. Set color rotation, must be in [-1.0, 1.0] range.
  15217. Default value is @code{0}.
  15218. @end table
  15219. @subsection Examples
  15220. @itemize
  15221. @item
  15222. Extract an audio spectrogram of a whole audio track
  15223. in a 1024x1024 picture using @command{ffmpeg}:
  15224. @example
  15225. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  15226. @end example
  15227. @end itemize
  15228. @section showvolume
  15229. Convert input audio volume to a video output.
  15230. The filter accepts the following options:
  15231. @table @option
  15232. @item rate, r
  15233. Set video rate.
  15234. @item b
  15235. Set border width, allowed range is [0, 5]. Default is 1.
  15236. @item w
  15237. Set channel width, allowed range is [80, 8192]. Default is 400.
  15238. @item h
  15239. Set channel height, allowed range is [1, 900]. Default is 20.
  15240. @item f
  15241. Set fade, allowed range is [0, 1]. Default is 0.95.
  15242. @item c
  15243. Set volume color expression.
  15244. The expression can use the following variables:
  15245. @table @option
  15246. @item VOLUME
  15247. Current max volume of channel in dB.
  15248. @item PEAK
  15249. Current peak.
  15250. @item CHANNEL
  15251. Current channel number, starting from 0.
  15252. @end table
  15253. @item t
  15254. If set, displays channel names. Default is enabled.
  15255. @item v
  15256. If set, displays volume values. Default is enabled.
  15257. @item o
  15258. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  15259. default is @code{h}.
  15260. @item s
  15261. Set step size, allowed range is [0, 5]. Default is 0, which means
  15262. step is disabled.
  15263. @item p
  15264. Set background opacity, allowed range is [0, 1]. Default is 0.
  15265. @item m
  15266. Set metering mode, can be peak: @code{p} or rms: @code{r},
  15267. default is @code{p}.
  15268. @end table
  15269. @section showwaves
  15270. Convert input audio to a video output, representing the samples waves.
  15271. The filter accepts the following options:
  15272. @table @option
  15273. @item size, s
  15274. Specify the video size for the output. For the syntax of this option, check the
  15275. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15276. Default value is @code{600x240}.
  15277. @item mode
  15278. Set display mode.
  15279. Available values are:
  15280. @table @samp
  15281. @item point
  15282. Draw a point for each sample.
  15283. @item line
  15284. Draw a vertical line for each sample.
  15285. @item p2p
  15286. Draw a point for each sample and a line between them.
  15287. @item cline
  15288. Draw a centered vertical line for each sample.
  15289. @end table
  15290. Default value is @code{point}.
  15291. @item n
  15292. Set the number of samples which are printed on the same column. A
  15293. larger value will decrease the frame rate. Must be a positive
  15294. integer. This option can be set only if the value for @var{rate}
  15295. is not explicitly specified.
  15296. @item rate, r
  15297. Set the (approximate) output frame rate. This is done by setting the
  15298. option @var{n}. Default value is "25".
  15299. @item split_channels
  15300. Set if channels should be drawn separately or overlap. Default value is 0.
  15301. @item colors
  15302. Set colors separated by '|' which are going to be used for drawing of each channel.
  15303. @item scale
  15304. Set amplitude scale.
  15305. Available values are:
  15306. @table @samp
  15307. @item lin
  15308. Linear.
  15309. @item log
  15310. Logarithmic.
  15311. @item sqrt
  15312. Square root.
  15313. @item cbrt
  15314. Cubic root.
  15315. @end table
  15316. Default is linear.
  15317. @item draw
  15318. Set the draw mode. This is mostly useful to set for high @var{n}.
  15319. Available values are:
  15320. @table @samp
  15321. @item scale
  15322. Scale pixel values for each drawn sample.
  15323. @item full
  15324. Draw every sample directly.
  15325. @end table
  15326. Default value is @code{scale}.
  15327. @end table
  15328. @subsection Examples
  15329. @itemize
  15330. @item
  15331. Output the input file audio and the corresponding video representation
  15332. at the same time:
  15333. @example
  15334. amovie=a.mp3,asplit[out0],showwaves[out1]
  15335. @end example
  15336. @item
  15337. Create a synthetic signal and show it with showwaves, forcing a
  15338. frame rate of 30 frames per second:
  15339. @example
  15340. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  15341. @end example
  15342. @end itemize
  15343. @section showwavespic
  15344. Convert input audio to a single video frame, representing the samples waves.
  15345. The filter accepts the following options:
  15346. @table @option
  15347. @item size, s
  15348. Specify the video size for the output. For the syntax of this option, check the
  15349. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15350. Default value is @code{600x240}.
  15351. @item split_channels
  15352. Set if channels should be drawn separately or overlap. Default value is 0.
  15353. @item colors
  15354. Set colors separated by '|' which are going to be used for drawing of each channel.
  15355. @item scale
  15356. Set amplitude scale.
  15357. Available values are:
  15358. @table @samp
  15359. @item lin
  15360. Linear.
  15361. @item log
  15362. Logarithmic.
  15363. @item sqrt
  15364. Square root.
  15365. @item cbrt
  15366. Cubic root.
  15367. @end table
  15368. Default is linear.
  15369. @end table
  15370. @subsection Examples
  15371. @itemize
  15372. @item
  15373. Extract a channel split representation of the wave form of a whole audio track
  15374. in a 1024x800 picture using @command{ffmpeg}:
  15375. @example
  15376. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  15377. @end example
  15378. @end itemize
  15379. @section sidedata, asidedata
  15380. Delete frame side data, or select frames based on it.
  15381. This filter accepts the following options:
  15382. @table @option
  15383. @item mode
  15384. Set mode of operation of the filter.
  15385. Can be one of the following:
  15386. @table @samp
  15387. @item select
  15388. Select every frame with side data of @code{type}.
  15389. @item delete
  15390. Delete side data of @code{type}. If @code{type} is not set, delete all side
  15391. data in the frame.
  15392. @end table
  15393. @item type
  15394. Set side data type used with all modes. Must be set for @code{select} mode. For
  15395. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  15396. in @file{libavutil/frame.h}. For example, to choose
  15397. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  15398. @end table
  15399. @section spectrumsynth
  15400. Sythesize audio from 2 input video spectrums, first input stream represents
  15401. magnitude across time and second represents phase across time.
  15402. The filter will transform from frequency domain as displayed in videos back
  15403. to time domain as presented in audio output.
  15404. This filter is primarily created for reversing processed @ref{showspectrum}
  15405. filter outputs, but can synthesize sound from other spectrograms too.
  15406. But in such case results are going to be poor if the phase data is not
  15407. available, because in such cases phase data need to be recreated, usually
  15408. its just recreated from random noise.
  15409. For best results use gray only output (@code{channel} color mode in
  15410. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  15411. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  15412. @code{data} option. Inputs videos should generally use @code{fullframe}
  15413. slide mode as that saves resources needed for decoding video.
  15414. The filter accepts the following options:
  15415. @table @option
  15416. @item sample_rate
  15417. Specify sample rate of output audio, the sample rate of audio from which
  15418. spectrum was generated may differ.
  15419. @item channels
  15420. Set number of channels represented in input video spectrums.
  15421. @item scale
  15422. Set scale which was used when generating magnitude input spectrum.
  15423. Can be @code{lin} or @code{log}. Default is @code{log}.
  15424. @item slide
  15425. Set slide which was used when generating inputs spectrums.
  15426. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  15427. Default is @code{fullframe}.
  15428. @item win_func
  15429. Set window function used for resynthesis.
  15430. @item overlap
  15431. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  15432. which means optimal overlap for selected window function will be picked.
  15433. @item orientation
  15434. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  15435. Default is @code{vertical}.
  15436. @end table
  15437. @subsection Examples
  15438. @itemize
  15439. @item
  15440. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  15441. then resynthesize videos back to audio with spectrumsynth:
  15442. @example
  15443. 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
  15444. 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
  15445. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  15446. @end example
  15447. @end itemize
  15448. @section split, asplit
  15449. Split input into several identical outputs.
  15450. @code{asplit} works with audio input, @code{split} with video.
  15451. The filter accepts a single parameter which specifies the number of outputs. If
  15452. unspecified, it defaults to 2.
  15453. @subsection Examples
  15454. @itemize
  15455. @item
  15456. Create two separate outputs from the same input:
  15457. @example
  15458. [in] split [out0][out1]
  15459. @end example
  15460. @item
  15461. To create 3 or more outputs, you need to specify the number of
  15462. outputs, like in:
  15463. @example
  15464. [in] asplit=3 [out0][out1][out2]
  15465. @end example
  15466. @item
  15467. Create two separate outputs from the same input, one cropped and
  15468. one padded:
  15469. @example
  15470. [in] split [splitout1][splitout2];
  15471. [splitout1] crop=100:100:0:0 [cropout];
  15472. [splitout2] pad=200:200:100:100 [padout];
  15473. @end example
  15474. @item
  15475. Create 5 copies of the input audio with @command{ffmpeg}:
  15476. @example
  15477. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  15478. @end example
  15479. @end itemize
  15480. @section zmq, azmq
  15481. Receive commands sent through a libzmq client, and forward them to
  15482. filters in the filtergraph.
  15483. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  15484. must be inserted between two video filters, @code{azmq} between two
  15485. audio filters.
  15486. To enable these filters you need to install the libzmq library and
  15487. headers and configure FFmpeg with @code{--enable-libzmq}.
  15488. For more information about libzmq see:
  15489. @url{http://www.zeromq.org/}
  15490. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  15491. receives messages sent through a network interface defined by the
  15492. @option{bind_address} option.
  15493. The received message must be in the form:
  15494. @example
  15495. @var{TARGET} @var{COMMAND} [@var{ARG}]
  15496. @end example
  15497. @var{TARGET} specifies the target of the command, usually the name of
  15498. the filter class or a specific filter instance name.
  15499. @var{COMMAND} specifies the name of the command for the target filter.
  15500. @var{ARG} is optional and specifies the optional argument list for the
  15501. given @var{COMMAND}.
  15502. Upon reception, the message is processed and the corresponding command
  15503. is injected into the filtergraph. Depending on the result, the filter
  15504. will send a reply to the client, adopting the format:
  15505. @example
  15506. @var{ERROR_CODE} @var{ERROR_REASON}
  15507. @var{MESSAGE}
  15508. @end example
  15509. @var{MESSAGE} is optional.
  15510. @subsection Examples
  15511. Look at @file{tools/zmqsend} for an example of a zmq client which can
  15512. be used to send commands processed by these filters.
  15513. Consider the following filtergraph generated by @command{ffplay}
  15514. @example
  15515. ffplay -dumpgraph 1 -f lavfi "
  15516. color=s=100x100:c=red [l];
  15517. color=s=100x100:c=blue [r];
  15518. nullsrc=s=200x100, zmq [bg];
  15519. [bg][l] overlay [bg+l];
  15520. [bg+l][r] overlay=x=100 "
  15521. @end example
  15522. To change the color of the left side of the video, the following
  15523. command can be used:
  15524. @example
  15525. echo Parsed_color_0 c yellow | tools/zmqsend
  15526. @end example
  15527. To change the right side:
  15528. @example
  15529. echo Parsed_color_1 c pink | tools/zmqsend
  15530. @end example
  15531. @c man end MULTIMEDIA FILTERS
  15532. @chapter Multimedia Sources
  15533. @c man begin MULTIMEDIA SOURCES
  15534. Below is a description of the currently available multimedia sources.
  15535. @section amovie
  15536. This is the same as @ref{movie} source, except it selects an audio
  15537. stream by default.
  15538. @anchor{movie}
  15539. @section movie
  15540. Read audio and/or video stream(s) from a movie container.
  15541. It accepts the following parameters:
  15542. @table @option
  15543. @item filename
  15544. The name of the resource to read (not necessarily a file; it can also be a
  15545. device or a stream accessed through some protocol).
  15546. @item format_name, f
  15547. Specifies the format assumed for the movie to read, and can be either
  15548. the name of a container or an input device. If not specified, the
  15549. format is guessed from @var{movie_name} or by probing.
  15550. @item seek_point, sp
  15551. Specifies the seek point in seconds. The frames will be output
  15552. starting from this seek point. The parameter is evaluated with
  15553. @code{av_strtod}, so the numerical value may be suffixed by an IS
  15554. postfix. The default value is "0".
  15555. @item streams, s
  15556. Specifies the streams to read. Several streams can be specified,
  15557. separated by "+". The source will then have as many outputs, in the
  15558. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  15559. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  15560. respectively the default (best suited) video and audio stream. Default
  15561. is "dv", or "da" if the filter is called as "amovie".
  15562. @item stream_index, si
  15563. Specifies the index of the video stream to read. If the value is -1,
  15564. the most suitable video stream will be automatically selected. The default
  15565. value is "-1". Deprecated. If the filter is called "amovie", it will select
  15566. audio instead of video.
  15567. @item loop
  15568. Specifies how many times to read the stream in sequence.
  15569. If the value is 0, the stream will be looped infinitely.
  15570. Default value is "1".
  15571. Note that when the movie is looped the source timestamps are not
  15572. changed, so it will generate non monotonically increasing timestamps.
  15573. @item discontinuity
  15574. Specifies the time difference between frames above which the point is
  15575. considered a timestamp discontinuity which is removed by adjusting the later
  15576. timestamps.
  15577. @end table
  15578. It allows overlaying a second video on top of the main input of
  15579. a filtergraph, as shown in this graph:
  15580. @example
  15581. input -----------> deltapts0 --> overlay --> output
  15582. ^
  15583. |
  15584. movie --> scale--> deltapts1 -------+
  15585. @end example
  15586. @subsection Examples
  15587. @itemize
  15588. @item
  15589. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  15590. on top of the input labelled "in":
  15591. @example
  15592. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  15593. [in] setpts=PTS-STARTPTS [main];
  15594. [main][over] overlay=16:16 [out]
  15595. @end example
  15596. @item
  15597. Read from a video4linux2 device, and overlay it on top of the input
  15598. labelled "in":
  15599. @example
  15600. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  15601. [in] setpts=PTS-STARTPTS [main];
  15602. [main][over] overlay=16:16 [out]
  15603. @end example
  15604. @item
  15605. Read the first video stream and the audio stream with id 0x81 from
  15606. dvd.vob; the video is connected to the pad named "video" and the audio is
  15607. connected to the pad named "audio":
  15608. @example
  15609. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  15610. @end example
  15611. @end itemize
  15612. @subsection Commands
  15613. Both movie and amovie support the following commands:
  15614. @table @option
  15615. @item seek
  15616. Perform seek using "av_seek_frame".
  15617. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  15618. @itemize
  15619. @item
  15620. @var{stream_index}: If stream_index is -1, a default
  15621. stream is selected, and @var{timestamp} is automatically converted
  15622. from AV_TIME_BASE units to the stream specific time_base.
  15623. @item
  15624. @var{timestamp}: Timestamp in AVStream.time_base units
  15625. or, if no stream is specified, in AV_TIME_BASE units.
  15626. @item
  15627. @var{flags}: Flags which select direction and seeking mode.
  15628. @end itemize
  15629. @item get_duration
  15630. Get movie duration in AV_TIME_BASE units.
  15631. @end table
  15632. @c man end MULTIMEDIA SOURCES