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.

20366 lines
539KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @section Notes on filtergraph escaping
  181. Filtergraph description composition entails several levels of
  182. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  183. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  184. information about the employed escaping procedure.
  185. A first level escaping affects the content of each filter option
  186. value, which may contain the special character @code{:} used to
  187. separate values, or one of the escaping characters @code{\'}.
  188. A second level escaping affects the whole filter description, which
  189. may contain the escaping characters @code{\'} or the special
  190. characters @code{[],;} used by the filtergraph description.
  191. Finally, when you specify a filtergraph on a shell commandline, you
  192. need to perform a third level escaping for the shell special
  193. characters contained within it.
  194. For example, consider the following string to be embedded in
  195. the @ref{drawtext} filter description @option{text} value:
  196. @example
  197. this is a 'string': may contain one, or more, special characters
  198. @end example
  199. This string contains the @code{'} special escaping character, and the
  200. @code{:} special character, so it needs to be escaped in this way:
  201. @example
  202. text=this is a \'string\'\: may contain one, or more, special characters
  203. @end example
  204. A second level of escaping is required when embedding the filter
  205. description in a filtergraph description, in order to escape all the
  206. filtergraph special characters. Thus the example above becomes:
  207. @example
  208. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  209. @end example
  210. (note that in addition to the @code{\'} escaping special characters,
  211. also @code{,} needs to be escaped).
  212. Finally an additional level of escaping is needed when writing the
  213. filtergraph description in a shell command, which depends on the
  214. escaping rules of the adopted shell. For example, assuming that
  215. @code{\} is special and needs to be escaped with another @code{\}, the
  216. previous string will finally result in:
  217. @example
  218. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  219. @end example
  220. @chapter Timeline editing
  221. Some filters support a generic @option{enable} option. For the filters
  222. supporting timeline editing, this option can be set to an expression which is
  223. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  224. the filter will be enabled, otherwise the frame will be sent unchanged to the
  225. next filter in the filtergraph.
  226. The expression accepts the following values:
  227. @table @samp
  228. @item t
  229. timestamp expressed in seconds, NAN if the input timestamp is unknown
  230. @item n
  231. sequential number of the input frame, starting from 0
  232. @item pos
  233. the position in the file of the input frame, NAN if unknown
  234. @item w
  235. @item h
  236. width and height of the input frame if video
  237. @end table
  238. Additionally, these filters support an @option{enable} command that can be used
  239. to re-define the expression.
  240. Like any other filtering option, the @option{enable} option follows the same
  241. rules.
  242. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  243. minutes, and a @ref{curves} filter starting at 3 seconds:
  244. @example
  245. smartblur = enable='between(t,10,3*60)',
  246. curves = enable='gte(t,3)' : preset=cross_process
  247. @end example
  248. See @code{ffmpeg -filters} to view which filters have timeline support.
  249. @c man end FILTERGRAPH DESCRIPTION
  250. @anchor{framesync}
  251. @chapter Options for filters with several inputs (framesync)
  252. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  253. Some filters with several inputs support a common set of options.
  254. These options can only be set by name, not with the short notation.
  255. @table @option
  256. @item eof_action
  257. The action to take when EOF is encountered on the secondary input; it accepts
  258. one of the following values:
  259. @table @option
  260. @item repeat
  261. Repeat the last frame (the default).
  262. @item endall
  263. End both streams.
  264. @item pass
  265. Pass the main input through.
  266. @end table
  267. @item shortest
  268. If set to 1, force the output to terminate when the shortest input
  269. terminates. Default value is 0.
  270. @item repeatlast
  271. If set to 1, force the filter to extend the last frame of secondary streams
  272. until the end of the primary stream. A value of 0 disables this behavior.
  273. Default value is 1.
  274. @end table
  275. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  276. @chapter Audio Filters
  277. @c man begin AUDIO FILTERS
  278. When you configure your FFmpeg build, you can disable any of the
  279. existing filters using @code{--disable-filters}.
  280. The configure output will show the audio filters included in your
  281. build.
  282. Below is a description of the currently available audio filters.
  283. @section acompressor
  284. A compressor is mainly used to reduce the dynamic range of a signal.
  285. Especially modern music is mostly compressed at a high ratio to
  286. improve the overall loudness. It's done to get the highest attention
  287. of a listener, "fatten" the sound and bring more "power" to the track.
  288. If a signal is compressed too much it may sound dull or "dead"
  289. afterwards or it may start to "pump" (which could be a powerful effect
  290. but can also destroy a track completely).
  291. The right compression is the key to reach a professional sound and is
  292. the high art of mixing and mastering. Because of its complex settings
  293. it may take a long time to get the right feeling for this kind of effect.
  294. Compression is done by detecting the volume above a chosen level
  295. @code{threshold} and dividing it by the factor set with @code{ratio}.
  296. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  297. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  298. the signal would cause distortion of the waveform the reduction can be
  299. levelled over the time. This is done by setting "Attack" and "Release".
  300. @code{attack} determines how long the signal has to rise above the threshold
  301. before any reduction will occur and @code{release} sets the time the signal
  302. has to fall below the threshold to reduce the reduction again. Shorter signals
  303. than the chosen attack time will be left untouched.
  304. The overall reduction of the signal can be made up afterwards with the
  305. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  306. raising the makeup to this level results in a signal twice as loud than the
  307. source. To gain a softer entry in the compression the @code{knee} flattens the
  308. hard edge at the threshold in the range of the chosen decibels.
  309. The filter accepts the following options:
  310. @table @option
  311. @item level_in
  312. Set input gain. Default is 1. Range is between 0.015625 and 64.
  313. @item threshold
  314. If a signal of stream rises above this level it will affect the gain
  315. reduction.
  316. By default it is 0.125. Range is between 0.00097563 and 1.
  317. @item ratio
  318. Set a ratio by which the signal is reduced. 1:2 means that if the level
  319. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  320. Default is 2. Range is between 1 and 20.
  321. @item attack
  322. Amount of milliseconds the signal has to rise above the threshold before gain
  323. reduction starts. Default is 20. Range is between 0.01 and 2000.
  324. @item release
  325. Amount of milliseconds the signal has to fall below the threshold before
  326. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  327. @item makeup
  328. Set the amount by how much signal will be amplified after processing.
  329. Default is 1. Range is from 1 to 64.
  330. @item knee
  331. Curve the sharp knee around the threshold to enter gain reduction more softly.
  332. Default is 2.82843. Range is between 1 and 8.
  333. @item link
  334. Choose if the @code{average} level between all channels of input stream
  335. or the louder(@code{maximum}) channel of input stream affects the
  336. reduction. Default is @code{average}.
  337. @item detection
  338. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  339. of @code{rms}. Default is @code{rms} which is mostly smoother.
  340. @item mix
  341. How much to use compressed signal in output. Default is 1.
  342. Range is between 0 and 1.
  343. @end table
  344. @section acontrast
  345. Simple audio dynamic range commpression/expansion filter.
  346. The filter accepts the following options:
  347. @table @option
  348. @item contrast
  349. Set contrast. Default is 33. Allowed range is between 0 and 100.
  350. @end table
  351. @section acopy
  352. Copy the input audio source unchanged to the output. This is mainly useful for
  353. testing purposes.
  354. @section acrossfade
  355. Apply cross fade from one input audio stream to another input audio stream.
  356. The cross fade is applied for specified duration near the end of first stream.
  357. The filter accepts the following options:
  358. @table @option
  359. @item nb_samples, ns
  360. Specify the number of samples for which the cross fade effect has to last.
  361. At the end of the cross fade effect the first input audio will be completely
  362. silent. Default is 44100.
  363. @item duration, d
  364. Specify the duration of the cross fade effect. See
  365. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  366. for the accepted syntax.
  367. By default the duration is determined by @var{nb_samples}.
  368. If set this option is used instead of @var{nb_samples}.
  369. @item overlap, o
  370. Should first stream end overlap with second stream start. Default is enabled.
  371. @item curve1
  372. Set curve for cross fade transition for first stream.
  373. @item curve2
  374. Set curve for cross fade transition for second stream.
  375. For description of available curve types see @ref{afade} filter description.
  376. @end table
  377. @subsection Examples
  378. @itemize
  379. @item
  380. Cross fade from one input to another:
  381. @example
  382. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  383. @end example
  384. @item
  385. Cross fade from one input to another but without overlapping:
  386. @example
  387. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  388. @end example
  389. @end itemize
  390. @section acrusher
  391. Reduce audio bit resolution.
  392. This filter is bit crusher with enhanced functionality. A bit crusher
  393. is used to audibly reduce number of bits an audio signal is sampled
  394. with. This doesn't change the bit depth at all, it just produces the
  395. effect. Material reduced in bit depth sounds more harsh and "digital".
  396. This filter is able to even round to continuous values instead of discrete
  397. bit depths.
  398. Additionally it has a D/C offset which results in different crushing of
  399. the lower and the upper half of the signal.
  400. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  401. Another feature of this filter is the logarithmic mode.
  402. This setting switches from linear distances between bits to logarithmic ones.
  403. The result is a much more "natural" sounding crusher which doesn't gate low
  404. signals for example. The human ear has a logarithmic perception, too
  405. so this kind of crushing is much more pleasant.
  406. Logarithmic crushing is also able to get anti-aliased.
  407. The filter accepts the following options:
  408. @table @option
  409. @item level_in
  410. Set level in.
  411. @item level_out
  412. Set level out.
  413. @item bits
  414. Set bit reduction.
  415. @item mix
  416. Set mixing amount.
  417. @item mode
  418. Can be linear: @code{lin} or logarithmic: @code{log}.
  419. @item dc
  420. Set DC.
  421. @item aa
  422. Set anti-aliasing.
  423. @item samples
  424. Set sample reduction.
  425. @item lfo
  426. Enable LFO. By default disabled.
  427. @item lforange
  428. Set LFO range.
  429. @item lforate
  430. Set LFO rate.
  431. @end table
  432. @section adelay
  433. Delay one or more audio channels.
  434. Samples in delayed channel are filled with silence.
  435. The filter accepts the following option:
  436. @table @option
  437. @item delays
  438. Set list of delays in milliseconds for each channel separated by '|'.
  439. Unused delays will be silently ignored. If number of given delays is
  440. smaller than number of channels all remaining channels will not be delayed.
  441. If you want to delay exact number of samples, append 'S' to number.
  442. @end table
  443. @subsection Examples
  444. @itemize
  445. @item
  446. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  447. the second channel (and any other channels that may be present) unchanged.
  448. @example
  449. adelay=1500|0|500
  450. @end example
  451. @item
  452. Delay second channel by 500 samples, the third channel by 700 samples and leave
  453. the first channel (and any other channels that may be present) unchanged.
  454. @example
  455. adelay=0|500S|700S
  456. @end example
  457. @end itemize
  458. @section aecho
  459. Apply echoing to the input audio.
  460. Echoes are reflected sound and can occur naturally amongst mountains
  461. (and sometimes large buildings) when talking or shouting; digital echo
  462. effects emulate this behaviour and are often used to help fill out the
  463. sound of a single instrument or vocal. The time difference between the
  464. original signal and the reflection is the @code{delay}, and the
  465. loudness of the reflected signal is the @code{decay}.
  466. Multiple echoes can have different delays and decays.
  467. A description of the accepted parameters follows.
  468. @table @option
  469. @item in_gain
  470. Set input gain of reflected signal. Default is @code{0.6}.
  471. @item out_gain
  472. Set output gain of reflected signal. Default is @code{0.3}.
  473. @item delays
  474. Set list of time intervals in milliseconds between original signal and reflections
  475. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  476. Default is @code{1000}.
  477. @item decays
  478. Set list of loudness of reflected signals separated by '|'.
  479. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  480. Default is @code{0.5}.
  481. @end table
  482. @subsection Examples
  483. @itemize
  484. @item
  485. Make it sound as if there are twice as many instruments as are actually playing:
  486. @example
  487. aecho=0.8:0.88:60:0.4
  488. @end example
  489. @item
  490. If delay is very short, then it sound like a (metallic) robot playing music:
  491. @example
  492. aecho=0.8:0.88:6:0.4
  493. @end example
  494. @item
  495. A longer delay will sound like an open air concert in the mountains:
  496. @example
  497. aecho=0.8:0.9:1000:0.3
  498. @end example
  499. @item
  500. Same as above but with one more mountain:
  501. @example
  502. aecho=0.8:0.9:1000|1800:0.3|0.25
  503. @end example
  504. @end itemize
  505. @section aemphasis
  506. Audio emphasis filter creates or restores material directly taken from LPs or
  507. emphased CDs with different filter curves. E.g. to store music on vinyl the
  508. signal has to be altered by a filter first to even out the disadvantages of
  509. this recording medium.
  510. Once the material is played back the inverse filter has to be applied to
  511. restore the distortion of the frequency response.
  512. The filter accepts the following options:
  513. @table @option
  514. @item level_in
  515. Set input gain.
  516. @item level_out
  517. Set output gain.
  518. @item mode
  519. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  520. use @code{production} mode. Default is @code{reproduction} mode.
  521. @item type
  522. Set filter type. Selects medium. Can be one of the following:
  523. @table @option
  524. @item col
  525. select Columbia.
  526. @item emi
  527. select EMI.
  528. @item bsi
  529. select BSI (78RPM).
  530. @item riaa
  531. select RIAA.
  532. @item cd
  533. select Compact Disc (CD).
  534. @item 50fm
  535. select 50µs (FM).
  536. @item 75fm
  537. select 75µs (FM).
  538. @item 50kf
  539. select 50µs (FM-KF).
  540. @item 75kf
  541. select 75µs (FM-KF).
  542. @end table
  543. @end table
  544. @section aeval
  545. Modify an audio signal according to the specified expressions.
  546. This filter accepts one or more expressions (one for each channel),
  547. which are evaluated and used to modify a corresponding audio signal.
  548. It accepts the following parameters:
  549. @table @option
  550. @item exprs
  551. Set the '|'-separated expressions list for each separate channel. If
  552. the number of input channels is greater than the number of
  553. expressions, the last specified expression is used for the remaining
  554. output channels.
  555. @item channel_layout, c
  556. Set output channel layout. If not specified, the channel layout is
  557. specified by the number of expressions. If set to @samp{same}, it will
  558. use by default the same input channel layout.
  559. @end table
  560. Each expression in @var{exprs} can contain the following constants and functions:
  561. @table @option
  562. @item ch
  563. channel number of the current expression
  564. @item n
  565. number of the evaluated sample, starting from 0
  566. @item s
  567. sample rate
  568. @item t
  569. time of the evaluated sample expressed in seconds
  570. @item nb_in_channels
  571. @item nb_out_channels
  572. input and output number of channels
  573. @item val(CH)
  574. the value of input channel with number @var{CH}
  575. @end table
  576. Note: this filter is slow. For faster processing you should use a
  577. dedicated filter.
  578. @subsection Examples
  579. @itemize
  580. @item
  581. Half volume:
  582. @example
  583. aeval=val(ch)/2:c=same
  584. @end example
  585. @item
  586. Invert phase of the second channel:
  587. @example
  588. aeval=val(0)|-val(1)
  589. @end example
  590. @end itemize
  591. @anchor{afade}
  592. @section afade
  593. Apply fade-in/out effect to input audio.
  594. A description of the accepted parameters follows.
  595. @table @option
  596. @item type, t
  597. Specify the effect type, can be either @code{in} for fade-in, or
  598. @code{out} for a fade-out effect. Default is @code{in}.
  599. @item start_sample, ss
  600. Specify the number of the start sample for starting to apply the fade
  601. effect. Default is 0.
  602. @item nb_samples, ns
  603. Specify the number of samples for which the fade effect has to last. At
  604. the end of the fade-in effect the output audio will have the same
  605. volume as the input audio, at the end of the fade-out transition
  606. the output audio will be silence. Default is 44100.
  607. @item start_time, st
  608. Specify the start time of the fade effect. Default is 0.
  609. The value must be specified as a time duration; see
  610. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  611. for the accepted syntax.
  612. If set this option is used instead of @var{start_sample}.
  613. @item duration, d
  614. Specify the duration of the fade effect. See
  615. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  616. for the accepted syntax.
  617. At the end of the fade-in effect the output audio will have the same
  618. volume as the input audio, at the end of the fade-out transition
  619. the output audio will be silence.
  620. By default the duration is determined by @var{nb_samples}.
  621. If set this option is used instead of @var{nb_samples}.
  622. @item curve
  623. Set curve for fade transition.
  624. It accepts the following values:
  625. @table @option
  626. @item tri
  627. select triangular, linear slope (default)
  628. @item qsin
  629. select quarter of sine wave
  630. @item hsin
  631. select half of sine wave
  632. @item esin
  633. select exponential sine wave
  634. @item log
  635. select logarithmic
  636. @item ipar
  637. select inverted parabola
  638. @item qua
  639. select quadratic
  640. @item cub
  641. select cubic
  642. @item squ
  643. select square root
  644. @item cbr
  645. select cubic root
  646. @item par
  647. select parabola
  648. @item exp
  649. select exponential
  650. @item iqsin
  651. select inverted quarter of sine wave
  652. @item ihsin
  653. select inverted half of sine wave
  654. @item dese
  655. select double-exponential seat
  656. @item desi
  657. select double-exponential sigmoid
  658. @end table
  659. @end table
  660. @subsection Examples
  661. @itemize
  662. @item
  663. Fade in first 15 seconds of audio:
  664. @example
  665. afade=t=in:ss=0:d=15
  666. @end example
  667. @item
  668. Fade out last 25 seconds of a 900 seconds audio:
  669. @example
  670. afade=t=out:st=875:d=25
  671. @end example
  672. @end itemize
  673. @section afftfilt
  674. Apply arbitrary expressions to samples in frequency domain.
  675. @table @option
  676. @item real
  677. Set frequency domain real expression for each separate channel separated
  678. by '|'. Default is "1".
  679. If the number of input channels is greater than the number of
  680. expressions, the last specified expression is used for the remaining
  681. output channels.
  682. @item imag
  683. Set frequency domain imaginary expression for each separate channel
  684. separated by '|'. If not set, @var{real} option is used.
  685. Each expression in @var{real} and @var{imag} can contain the following
  686. constants:
  687. @table @option
  688. @item sr
  689. sample rate
  690. @item b
  691. current frequency bin number
  692. @item nb
  693. number of available bins
  694. @item ch
  695. channel number of the current expression
  696. @item chs
  697. number of channels
  698. @item pts
  699. current frame pts
  700. @end table
  701. @item win_size
  702. Set window size.
  703. It accepts the following values:
  704. @table @samp
  705. @item w16
  706. @item w32
  707. @item w64
  708. @item w128
  709. @item w256
  710. @item w512
  711. @item w1024
  712. @item w2048
  713. @item w4096
  714. @item w8192
  715. @item w16384
  716. @item w32768
  717. @item w65536
  718. @end table
  719. Default is @code{w4096}
  720. @item win_func
  721. Set window function. Default is @code{hann}.
  722. @item overlap
  723. Set window overlap. If set to 1, the recommended overlap for selected
  724. window function will be picked. Default is @code{0.75}.
  725. @end table
  726. @subsection Examples
  727. @itemize
  728. @item
  729. Leave almost only low frequencies in audio:
  730. @example
  731. afftfilt="1-clip((b/nb)*b,0,1)"
  732. @end example
  733. @end itemize
  734. @anchor{afir}
  735. @section afir
  736. Apply an arbitrary Frequency Impulse Response filter.
  737. This filter is designed for applying long FIR filters,
  738. up to 30 seconds long.
  739. It can be used as component for digital crossover filters,
  740. room equalization, cross talk cancellation, wavefield synthesis,
  741. auralization, ambiophonics and ambisonics.
  742. This filter uses second stream as FIR coefficients.
  743. If second stream holds single channel, it will be used
  744. for all input channels in first stream, otherwise
  745. number of channels in second stream must be same as
  746. number of channels in first stream.
  747. It accepts the following parameters:
  748. @table @option
  749. @item dry
  750. Set dry gain. This sets input gain.
  751. @item wet
  752. Set wet gain. This sets final output gain.
  753. @item length
  754. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  755. @item again
  756. Enable applying gain measured from power of IR.
  757. @end table
  758. @subsection Examples
  759. @itemize
  760. @item
  761. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  762. @example
  763. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  764. @end example
  765. @end itemize
  766. @anchor{aformat}
  767. @section aformat
  768. Set output format constraints for the input audio. The framework will
  769. negotiate the most appropriate format to minimize conversions.
  770. It accepts the following parameters:
  771. @table @option
  772. @item sample_fmts
  773. A '|'-separated list of requested sample formats.
  774. @item sample_rates
  775. A '|'-separated list of requested sample rates.
  776. @item channel_layouts
  777. A '|'-separated list of requested channel layouts.
  778. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  779. for the required syntax.
  780. @end table
  781. If a parameter is omitted, all values are allowed.
  782. Force the output to either unsigned 8-bit or signed 16-bit stereo
  783. @example
  784. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  785. @end example
  786. @section agate
  787. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  788. processing reduces disturbing noise between useful signals.
  789. Gating is done by detecting the volume below a chosen level @var{threshold}
  790. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  791. floor is set via @var{range}. Because an exact manipulation of the signal
  792. would cause distortion of the waveform the reduction can be levelled over
  793. time. This is done by setting @var{attack} and @var{release}.
  794. @var{attack} determines how long the signal has to fall below the threshold
  795. before any reduction will occur and @var{release} sets the time the signal
  796. has to rise above the threshold to reduce the reduction again.
  797. Shorter signals than the chosen attack time will be left untouched.
  798. @table @option
  799. @item level_in
  800. Set input level before filtering.
  801. Default is 1. Allowed range is from 0.015625 to 64.
  802. @item range
  803. Set the level of gain reduction when the signal is below the threshold.
  804. Default is 0.06125. Allowed range is from 0 to 1.
  805. @item threshold
  806. If a signal rises above this level the gain reduction is released.
  807. Default is 0.125. Allowed range is from 0 to 1.
  808. @item ratio
  809. Set a ratio by which the signal is reduced.
  810. Default is 2. Allowed range is from 1 to 9000.
  811. @item attack
  812. Amount of milliseconds the signal has to rise above the threshold before gain
  813. reduction stops.
  814. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  815. @item release
  816. Amount of milliseconds the signal has to fall below the threshold before the
  817. reduction is increased again. Default is 250 milliseconds.
  818. Allowed range is from 0.01 to 9000.
  819. @item makeup
  820. Set amount of amplification of signal after processing.
  821. Default is 1. Allowed range is from 1 to 64.
  822. @item knee
  823. Curve the sharp knee around the threshold to enter gain reduction more softly.
  824. Default is 2.828427125. Allowed range is from 1 to 8.
  825. @item detection
  826. Choose if exact signal should be taken for detection or an RMS like one.
  827. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  828. @item link
  829. Choose if the average level between all channels or the louder channel affects
  830. the reduction.
  831. Default is @code{average}. Can be @code{average} or @code{maximum}.
  832. @end table
  833. @section aiir
  834. Apply an arbitrary Infinite Impulse Response filter.
  835. It accepts the following parameters:
  836. @table @option
  837. @item z
  838. Set numerator/zeros coefficients.
  839. @item p
  840. Set denominator/poles coefficients.
  841. @item k
  842. Set channels gains.
  843. @item dry_gain
  844. Set input gain.
  845. @item wet_gain
  846. Set output gain.
  847. @item f
  848. Set coefficients format.
  849. @table @samp
  850. @item tf
  851. transfer function
  852. @item zp
  853. Z-plane zeros/poles, cartesian (default)
  854. @item pr
  855. Z-plane zeros/poles, polar radians
  856. @item pd
  857. Z-plane zeros/poles, polar degrees
  858. @end table
  859. @item r
  860. Set kind of processing.
  861. Can be @code{d} - direct or @code{s} - serial cascading. Defauls is @code{s}.
  862. @item e
  863. Set filtering precision.
  864. @table @samp
  865. @item dbl
  866. double-precision floating-point (default)
  867. @item flt
  868. single-precision floating-point
  869. @item i32
  870. 32-bit integers
  871. @item i16
  872. 16-bit integers
  873. @end table
  874. @end table
  875. Coefficients in @code{tf} format are separated by spaces and are in ascending
  876. order.
  877. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  878. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  879. imaginary unit.
  880. Different coefficients and gains can be provided for every channel, in such case
  881. use '|' to separate coefficients or gains. Last provided coefficients will be
  882. used for all remaining channels.
  883. @subsection Examples
  884. @itemize
  885. @item
  886. Apply 2 pole elliptic notch at arround 5000Hz for 48000 Hz sample rate:
  887. @example
  888. aiir=k=1:z=7.957584807809675810E-1 -2.575128568908332300 3.674839853930788710 -2.57512875289799137 7.957586296317130880E-1:p=1 -2.86950072432325953 3.63022088054647218 -2.28075678147272232 6.361362326477423500E-1:f=tf:r=d
  889. @end example
  890. @item
  891. Same as above but in @code{zp} format:
  892. @example
  893. aiir=k=0.79575848078096756:z=0.80918701+0.58773007i 0.80918701-0.58773007i 0.80884700+0.58784055i 0.80884700-0.58784055i:p=0.63892345+0.59951235i 0.63892345-0.59951235i 0.79582691+0.44198673i 0.79582691-0.44198673i:f=zp:r=s
  894. @end example
  895. @end itemize
  896. @section alimiter
  897. The limiter prevents an input signal from rising over a desired threshold.
  898. This limiter uses lookahead technology to prevent your signal from distorting.
  899. It means that there is a small delay after the signal is processed. Keep in mind
  900. that the delay it produces is the attack time you set.
  901. The filter accepts the following options:
  902. @table @option
  903. @item level_in
  904. Set input gain. Default is 1.
  905. @item level_out
  906. Set output gain. Default is 1.
  907. @item limit
  908. Don't let signals above this level pass the limiter. Default is 1.
  909. @item attack
  910. The limiter will reach its attenuation level in this amount of time in
  911. milliseconds. Default is 5 milliseconds.
  912. @item release
  913. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  914. Default is 50 milliseconds.
  915. @item asc
  916. When gain reduction is always needed ASC takes care of releasing to an
  917. average reduction level rather than reaching a reduction of 0 in the release
  918. time.
  919. @item asc_level
  920. Select how much the release time is affected by ASC, 0 means nearly no changes
  921. in release time while 1 produces higher release times.
  922. @item level
  923. Auto level output signal. Default is enabled.
  924. This normalizes audio back to 0dB if enabled.
  925. @end table
  926. Depending on picked setting it is recommended to upsample input 2x or 4x times
  927. with @ref{aresample} before applying this filter.
  928. @section allpass
  929. Apply a two-pole all-pass filter with central frequency (in Hz)
  930. @var{frequency}, and filter-width @var{width}.
  931. An all-pass filter changes the audio's frequency to phase relationship
  932. without changing its frequency to amplitude relationship.
  933. The filter accepts the following options:
  934. @table @option
  935. @item frequency, f
  936. Set frequency in Hz.
  937. @item width_type, t
  938. Set method to specify band-width of filter.
  939. @table @option
  940. @item h
  941. Hz
  942. @item q
  943. Q-Factor
  944. @item o
  945. octave
  946. @item s
  947. slope
  948. @item k
  949. kHz
  950. @end table
  951. @item width, w
  952. Specify the band-width of a filter in width_type units.
  953. @item channels, c
  954. Specify which channels to filter, by default all available are filtered.
  955. @end table
  956. @subsection Commands
  957. This filter supports the following commands:
  958. @table @option
  959. @item frequency, f
  960. Change allpass frequency.
  961. Syntax for the command is : "@var{frequency}"
  962. @item width_type, t
  963. Change allpass width_type.
  964. Syntax for the command is : "@var{width_type}"
  965. @item width, w
  966. Change allpass width.
  967. Syntax for the command is : "@var{width}"
  968. @end table
  969. @section aloop
  970. Loop audio samples.
  971. The filter accepts the following options:
  972. @table @option
  973. @item loop
  974. Set the number of loops. Setting this value to -1 will result in infinite loops.
  975. Default is 0.
  976. @item size
  977. Set maximal number of samples. Default is 0.
  978. @item start
  979. Set first sample of loop. Default is 0.
  980. @end table
  981. @anchor{amerge}
  982. @section amerge
  983. Merge two or more audio streams into a single multi-channel stream.
  984. The filter accepts the following options:
  985. @table @option
  986. @item inputs
  987. Set the number of inputs. Default is 2.
  988. @end table
  989. If the channel layouts of the inputs are disjoint, and therefore compatible,
  990. the channel layout of the output will be set accordingly and the channels
  991. will be reordered as necessary. If the channel layouts of the inputs are not
  992. disjoint, the output will have all the channels of the first input then all
  993. the channels of the second input, in that order, and the channel layout of
  994. the output will be the default value corresponding to the total number of
  995. channels.
  996. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  997. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  998. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  999. first input, b1 is the first channel of the second input).
  1000. On the other hand, if both input are in stereo, the output channels will be
  1001. in the default order: a1, a2, b1, b2, and the channel layout will be
  1002. arbitrarily set to 4.0, which may or may not be the expected value.
  1003. All inputs must have the same sample rate, and format.
  1004. If inputs do not have the same duration, the output will stop with the
  1005. shortest.
  1006. @subsection Examples
  1007. @itemize
  1008. @item
  1009. Merge two mono files into a stereo stream:
  1010. @example
  1011. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1012. @end example
  1013. @item
  1014. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1015. @example
  1016. ffmpeg -i input.mkv -filter_complex "[0:1][0:2][0:3][0:4][0:5][0:6] amerge=inputs=6" -c:a pcm_s16le output.mkv
  1017. @end example
  1018. @end itemize
  1019. @section amix
  1020. Mixes multiple audio inputs into a single output.
  1021. Note that this filter only supports float samples (the @var{amerge}
  1022. and @var{pan} audio filters support many formats). If the @var{amix}
  1023. input has integer samples then @ref{aresample} will be automatically
  1024. inserted to perform the conversion to float samples.
  1025. For example
  1026. @example
  1027. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1028. @end example
  1029. will mix 3 input audio streams to a single output with the same duration as the
  1030. first input and a dropout transition time of 3 seconds.
  1031. It accepts the following parameters:
  1032. @table @option
  1033. @item inputs
  1034. The number of inputs. If unspecified, it defaults to 2.
  1035. @item duration
  1036. How to determine the end-of-stream.
  1037. @table @option
  1038. @item longest
  1039. The duration of the longest input. (default)
  1040. @item shortest
  1041. The duration of the shortest input.
  1042. @item first
  1043. The duration of the first input.
  1044. @end table
  1045. @item dropout_transition
  1046. The transition time, in seconds, for volume renormalization when an input
  1047. stream ends. The default value is 2 seconds.
  1048. @end table
  1049. @section anequalizer
  1050. High-order parametric multiband equalizer for each channel.
  1051. It accepts the following parameters:
  1052. @table @option
  1053. @item params
  1054. This option string is in format:
  1055. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1056. Each equalizer band is separated by '|'.
  1057. @table @option
  1058. @item chn
  1059. Set channel number to which equalization will be applied.
  1060. If input doesn't have that channel the entry is ignored.
  1061. @item f
  1062. Set central frequency for band.
  1063. If input doesn't have that frequency the entry is ignored.
  1064. @item w
  1065. Set band width in hertz.
  1066. @item g
  1067. Set band gain in dB.
  1068. @item t
  1069. Set filter type for band, optional, can be:
  1070. @table @samp
  1071. @item 0
  1072. Butterworth, this is default.
  1073. @item 1
  1074. Chebyshev type 1.
  1075. @item 2
  1076. Chebyshev type 2.
  1077. @end table
  1078. @end table
  1079. @item curves
  1080. With this option activated frequency response of anequalizer is displayed
  1081. in video stream.
  1082. @item size
  1083. Set video stream size. Only useful if curves option is activated.
  1084. @item mgain
  1085. Set max gain that will be displayed. Only useful if curves option is activated.
  1086. Setting this to a reasonable value makes it possible to display gain which is derived from
  1087. neighbour bands which are too close to each other and thus produce higher gain
  1088. when both are activated.
  1089. @item fscale
  1090. Set frequency scale used to draw frequency response in video output.
  1091. Can be linear or logarithmic. Default is logarithmic.
  1092. @item colors
  1093. Set color for each channel curve which is going to be displayed in video stream.
  1094. This is list of color names separated by space or by '|'.
  1095. Unrecognised or missing colors will be replaced by white color.
  1096. @end table
  1097. @subsection Examples
  1098. @itemize
  1099. @item
  1100. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1101. for first 2 channels using Chebyshev type 1 filter:
  1102. @example
  1103. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1104. @end example
  1105. @end itemize
  1106. @subsection Commands
  1107. This filter supports the following commands:
  1108. @table @option
  1109. @item change
  1110. Alter existing filter parameters.
  1111. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1112. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1113. error is returned.
  1114. @var{freq} set new frequency parameter.
  1115. @var{width} set new width parameter in herz.
  1116. @var{gain} set new gain parameter in dB.
  1117. Full filter invocation with asendcmd may look like this:
  1118. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1119. @end table
  1120. @section anull
  1121. Pass the audio source unchanged to the output.
  1122. @section apad
  1123. Pad the end of an audio stream with silence.
  1124. This can be used together with @command{ffmpeg} @option{-shortest} to
  1125. extend audio streams to the same length as the video stream.
  1126. A description of the accepted options follows.
  1127. @table @option
  1128. @item packet_size
  1129. Set silence packet size. Default value is 4096.
  1130. @item pad_len
  1131. Set the number of samples of silence to add to the end. After the
  1132. value is reached, the stream is terminated. This option is mutually
  1133. exclusive with @option{whole_len}.
  1134. @item whole_len
  1135. Set the minimum total number of samples in the output audio stream. If
  1136. the value is longer than the input audio length, silence is added to
  1137. the end, until the value is reached. This option is mutually exclusive
  1138. with @option{pad_len}.
  1139. @end table
  1140. If neither the @option{pad_len} nor the @option{whole_len} option is
  1141. set, the filter will add silence to the end of the input stream
  1142. indefinitely.
  1143. @subsection Examples
  1144. @itemize
  1145. @item
  1146. Add 1024 samples of silence to the end of the input:
  1147. @example
  1148. apad=pad_len=1024
  1149. @end example
  1150. @item
  1151. Make sure the audio output will contain at least 10000 samples, pad
  1152. the input with silence if required:
  1153. @example
  1154. apad=whole_len=10000
  1155. @end example
  1156. @item
  1157. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1158. video stream will always result the shortest and will be converted
  1159. until the end in the output file when using the @option{shortest}
  1160. option:
  1161. @example
  1162. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1163. @end example
  1164. @end itemize
  1165. @section aphaser
  1166. Add a phasing effect to the input audio.
  1167. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1168. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1169. A description of the accepted parameters follows.
  1170. @table @option
  1171. @item in_gain
  1172. Set input gain. Default is 0.4.
  1173. @item out_gain
  1174. Set output gain. Default is 0.74
  1175. @item delay
  1176. Set delay in milliseconds. Default is 3.0.
  1177. @item decay
  1178. Set decay. Default is 0.4.
  1179. @item speed
  1180. Set modulation speed in Hz. Default is 0.5.
  1181. @item type
  1182. Set modulation type. Default is triangular.
  1183. It accepts the following values:
  1184. @table @samp
  1185. @item triangular, t
  1186. @item sinusoidal, s
  1187. @end table
  1188. @end table
  1189. @section apulsator
  1190. Audio pulsator is something between an autopanner and a tremolo.
  1191. But it can produce funny stereo effects as well. Pulsator changes the volume
  1192. of the left and right channel based on a LFO (low frequency oscillator) with
  1193. different waveforms and shifted phases.
  1194. This filter have the ability to define an offset between left and right
  1195. channel. An offset of 0 means that both LFO shapes match each other.
  1196. The left and right channel are altered equally - a conventional tremolo.
  1197. An offset of 50% means that the shape of the right channel is exactly shifted
  1198. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1199. an autopanner. At 1 both curves match again. Every setting in between moves the
  1200. phase shift gapless between all stages and produces some "bypassing" sounds with
  1201. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1202. the 0.5) the faster the signal passes from the left to the right speaker.
  1203. The filter accepts the following options:
  1204. @table @option
  1205. @item level_in
  1206. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1207. @item level_out
  1208. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1209. @item mode
  1210. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1211. sawup or sawdown. Default is sine.
  1212. @item amount
  1213. Set modulation. Define how much of original signal is affected by the LFO.
  1214. @item offset_l
  1215. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1216. @item offset_r
  1217. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1218. @item width
  1219. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1220. @item timing
  1221. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1222. @item bpm
  1223. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1224. is set to bpm.
  1225. @item ms
  1226. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1227. is set to ms.
  1228. @item hz
  1229. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1230. if timing is set to hz.
  1231. @end table
  1232. @anchor{aresample}
  1233. @section aresample
  1234. Resample the input audio to the specified parameters, using the
  1235. libswresample library. If none are specified then the filter will
  1236. automatically convert between its input and output.
  1237. This filter is also able to stretch/squeeze the audio data to make it match
  1238. the timestamps or to inject silence / cut out audio to make it match the
  1239. timestamps, do a combination of both or do neither.
  1240. The filter accepts the syntax
  1241. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1242. expresses a sample rate and @var{resampler_options} is a list of
  1243. @var{key}=@var{value} pairs, separated by ":". See the
  1244. @ref{Resampler Options,,the "Resampler Options" section in the
  1245. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1246. for the complete list of supported options.
  1247. @subsection Examples
  1248. @itemize
  1249. @item
  1250. Resample the input audio to 44100Hz:
  1251. @example
  1252. aresample=44100
  1253. @end example
  1254. @item
  1255. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1256. samples per second compensation:
  1257. @example
  1258. aresample=async=1000
  1259. @end example
  1260. @end itemize
  1261. @section areverse
  1262. Reverse an audio clip.
  1263. Warning: This filter requires memory to buffer the entire clip, so trimming
  1264. is suggested.
  1265. @subsection Examples
  1266. @itemize
  1267. @item
  1268. Take the first 5 seconds of a clip, and reverse it.
  1269. @example
  1270. atrim=end=5,areverse
  1271. @end example
  1272. @end itemize
  1273. @section asetnsamples
  1274. Set the number of samples per each output audio frame.
  1275. The last output packet may contain a different number of samples, as
  1276. the filter will flush all the remaining samples when the input audio
  1277. signals its end.
  1278. The filter accepts the following options:
  1279. @table @option
  1280. @item nb_out_samples, n
  1281. Set the number of frames per each output audio frame. The number is
  1282. intended as the number of samples @emph{per each channel}.
  1283. Default value is 1024.
  1284. @item pad, p
  1285. If set to 1, the filter will pad the last audio frame with zeroes, so
  1286. that the last frame will contain the same number of samples as the
  1287. previous ones. Default value is 1.
  1288. @end table
  1289. For example, to set the number of per-frame samples to 1234 and
  1290. disable padding for the last frame, use:
  1291. @example
  1292. asetnsamples=n=1234:p=0
  1293. @end example
  1294. @section asetrate
  1295. Set the sample rate without altering the PCM data.
  1296. This will result in a change of speed and pitch.
  1297. The filter accepts the following options:
  1298. @table @option
  1299. @item sample_rate, r
  1300. Set the output sample rate. Default is 44100 Hz.
  1301. @end table
  1302. @section ashowinfo
  1303. Show a line containing various information for each input audio frame.
  1304. The input audio is not modified.
  1305. The shown line contains a sequence of key/value pairs of the form
  1306. @var{key}:@var{value}.
  1307. The following values are shown in the output:
  1308. @table @option
  1309. @item n
  1310. The (sequential) number of the input frame, starting from 0.
  1311. @item pts
  1312. The presentation timestamp of the input frame, in time base units; the time base
  1313. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1314. @item pts_time
  1315. The presentation timestamp of the input frame in seconds.
  1316. @item pos
  1317. position of the frame in the input stream, -1 if this information in
  1318. unavailable and/or meaningless (for example in case of synthetic audio)
  1319. @item fmt
  1320. The sample format.
  1321. @item chlayout
  1322. The channel layout.
  1323. @item rate
  1324. The sample rate for the audio frame.
  1325. @item nb_samples
  1326. The number of samples (per channel) in the frame.
  1327. @item checksum
  1328. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1329. audio, the data is treated as if all the planes were concatenated.
  1330. @item plane_checksums
  1331. A list of Adler-32 checksums for each data plane.
  1332. @end table
  1333. @anchor{astats}
  1334. @section astats
  1335. Display time domain statistical information about the audio channels.
  1336. Statistics are calculated and displayed for each audio channel and,
  1337. where applicable, an overall figure is also given.
  1338. It accepts the following option:
  1339. @table @option
  1340. @item length
  1341. Short window length in seconds, used for peak and trough RMS measurement.
  1342. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  1343. @item metadata
  1344. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1345. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1346. disabled.
  1347. Available keys for each channel are:
  1348. DC_offset
  1349. Min_level
  1350. Max_level
  1351. Min_difference
  1352. Max_difference
  1353. Mean_difference
  1354. RMS_difference
  1355. Peak_level
  1356. RMS_peak
  1357. RMS_trough
  1358. Crest_factor
  1359. Flat_factor
  1360. Peak_count
  1361. Bit_depth
  1362. Dynamic_range
  1363. and for Overall:
  1364. DC_offset
  1365. Min_level
  1366. Max_level
  1367. Min_difference
  1368. Max_difference
  1369. Mean_difference
  1370. RMS_difference
  1371. Peak_level
  1372. RMS_level
  1373. RMS_peak
  1374. RMS_trough
  1375. Flat_factor
  1376. Peak_count
  1377. Bit_depth
  1378. Number_of_samples
  1379. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1380. this @code{lavfi.astats.Overall.Peak_count}.
  1381. For description what each key means read below.
  1382. @item reset
  1383. Set number of frame after which stats are going to be recalculated.
  1384. Default is disabled.
  1385. @end table
  1386. A description of each shown parameter follows:
  1387. @table @option
  1388. @item DC offset
  1389. Mean amplitude displacement from zero.
  1390. @item Min level
  1391. Minimal sample level.
  1392. @item Max level
  1393. Maximal sample level.
  1394. @item Min difference
  1395. Minimal difference between two consecutive samples.
  1396. @item Max difference
  1397. Maximal difference between two consecutive samples.
  1398. @item Mean difference
  1399. Mean difference between two consecutive samples.
  1400. The average of each difference between two consecutive samples.
  1401. @item RMS difference
  1402. Root Mean Square difference between two consecutive samples.
  1403. @item Peak level dB
  1404. @item RMS level dB
  1405. Standard peak and RMS level measured in dBFS.
  1406. @item RMS peak dB
  1407. @item RMS trough dB
  1408. Peak and trough values for RMS level measured over a short window.
  1409. @item Crest factor
  1410. Standard ratio of peak to RMS level (note: not in dB).
  1411. @item Flat factor
  1412. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1413. (i.e. either @var{Min level} or @var{Max level}).
  1414. @item Peak count
  1415. Number of occasions (not the number of samples) that the signal attained either
  1416. @var{Min level} or @var{Max level}.
  1417. @item Bit depth
  1418. Overall bit depth of audio. Number of bits used for each sample.
  1419. @item Dynamic range
  1420. Measured dynamic range of audio in dB.
  1421. @end table
  1422. @section atempo
  1423. Adjust audio tempo.
  1424. The filter accepts exactly one parameter, the audio tempo. If not
  1425. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1426. be in the [0.5, 2.0] range.
  1427. @subsection Examples
  1428. @itemize
  1429. @item
  1430. Slow down audio to 80% tempo:
  1431. @example
  1432. atempo=0.8
  1433. @end example
  1434. @item
  1435. To speed up audio to 125% tempo:
  1436. @example
  1437. atempo=1.25
  1438. @end example
  1439. @end itemize
  1440. @section atrim
  1441. Trim the input so that the output contains one continuous subpart of the input.
  1442. It accepts the following parameters:
  1443. @table @option
  1444. @item start
  1445. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1446. sample with the timestamp @var{start} will be the first sample in the output.
  1447. @item end
  1448. Specify time of the first audio sample that will be dropped, i.e. the
  1449. audio sample immediately preceding the one with the timestamp @var{end} will be
  1450. the last sample in the output.
  1451. @item start_pts
  1452. Same as @var{start}, except this option sets the start timestamp in samples
  1453. instead of seconds.
  1454. @item end_pts
  1455. Same as @var{end}, except this option sets the end timestamp in samples instead
  1456. of seconds.
  1457. @item duration
  1458. The maximum duration of the output in seconds.
  1459. @item start_sample
  1460. The number of the first sample that should be output.
  1461. @item end_sample
  1462. The number of the first sample that should be dropped.
  1463. @end table
  1464. @option{start}, @option{end}, and @option{duration} are expressed as time
  1465. duration specifications; see
  1466. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1467. Note that the first two sets of the start/end options and the @option{duration}
  1468. option look at the frame timestamp, while the _sample options simply count the
  1469. samples that pass through the filter. So start/end_pts and start/end_sample will
  1470. give different results when the timestamps are wrong, inexact or do not start at
  1471. zero. Also note that this filter does not modify the timestamps. If you wish
  1472. to have the output timestamps start at zero, insert the asetpts filter after the
  1473. atrim filter.
  1474. If multiple start or end options are set, this filter tries to be greedy and
  1475. keep all samples that match at least one of the specified constraints. To keep
  1476. only the part that matches all the constraints at once, chain multiple atrim
  1477. filters.
  1478. The defaults are such that all the input is kept. So it is possible to set e.g.
  1479. just the end values to keep everything before the specified time.
  1480. Examples:
  1481. @itemize
  1482. @item
  1483. Drop everything except the second minute of input:
  1484. @example
  1485. ffmpeg -i INPUT -af atrim=60:120
  1486. @end example
  1487. @item
  1488. Keep only the first 1000 samples:
  1489. @example
  1490. ffmpeg -i INPUT -af atrim=end_sample=1000
  1491. @end example
  1492. @end itemize
  1493. @section bandpass
  1494. Apply a two-pole Butterworth band-pass filter with central
  1495. frequency @var{frequency}, and (3dB-point) band-width width.
  1496. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1497. instead of the default: constant 0dB peak gain.
  1498. The filter roll off at 6dB per octave (20dB per decade).
  1499. The filter accepts the following options:
  1500. @table @option
  1501. @item frequency, f
  1502. Set the filter's central frequency. Default is @code{3000}.
  1503. @item csg
  1504. Constant skirt gain if set to 1. Defaults to 0.
  1505. @item width_type, t
  1506. Set method to specify band-width of filter.
  1507. @table @option
  1508. @item h
  1509. Hz
  1510. @item q
  1511. Q-Factor
  1512. @item o
  1513. octave
  1514. @item s
  1515. slope
  1516. @item k
  1517. kHz
  1518. @end table
  1519. @item width, w
  1520. Specify the band-width of a filter in width_type units.
  1521. @item channels, c
  1522. Specify which channels to filter, by default all available are filtered.
  1523. @end table
  1524. @subsection Commands
  1525. This filter supports the following commands:
  1526. @table @option
  1527. @item frequency, f
  1528. Change bandpass frequency.
  1529. Syntax for the command is : "@var{frequency}"
  1530. @item width_type, t
  1531. Change bandpass width_type.
  1532. Syntax for the command is : "@var{width_type}"
  1533. @item width, w
  1534. Change bandpass width.
  1535. Syntax for the command is : "@var{width}"
  1536. @end table
  1537. @section bandreject
  1538. Apply a two-pole Butterworth band-reject filter with central
  1539. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1540. The filter roll off at 6dB per octave (20dB per decade).
  1541. The filter accepts the following options:
  1542. @table @option
  1543. @item frequency, f
  1544. Set the filter's central frequency. Default is @code{3000}.
  1545. @item width_type, t
  1546. Set method to specify band-width of filter.
  1547. @table @option
  1548. @item h
  1549. Hz
  1550. @item q
  1551. Q-Factor
  1552. @item o
  1553. octave
  1554. @item s
  1555. slope
  1556. @item k
  1557. kHz
  1558. @end table
  1559. @item width, w
  1560. Specify the band-width of a filter in width_type units.
  1561. @item channels, c
  1562. Specify which channels to filter, by default all available are filtered.
  1563. @end table
  1564. @subsection Commands
  1565. This filter supports the following commands:
  1566. @table @option
  1567. @item frequency, f
  1568. Change bandreject frequency.
  1569. Syntax for the command is : "@var{frequency}"
  1570. @item width_type, t
  1571. Change bandreject width_type.
  1572. Syntax for the command is : "@var{width_type}"
  1573. @item width, w
  1574. Change bandreject width.
  1575. Syntax for the command is : "@var{width}"
  1576. @end table
  1577. @section bass
  1578. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1579. shelving filter with a response similar to that of a standard
  1580. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1581. The filter accepts the following options:
  1582. @table @option
  1583. @item gain, g
  1584. Give the gain at 0 Hz. Its useful range is about -20
  1585. (for a large cut) to +20 (for a large boost).
  1586. Beware of clipping when using a positive gain.
  1587. @item frequency, f
  1588. Set the filter's central frequency and so can be used
  1589. to extend or reduce the frequency range to be boosted or cut.
  1590. The default value is @code{100} Hz.
  1591. @item width_type, t
  1592. Set method to specify band-width of filter.
  1593. @table @option
  1594. @item h
  1595. Hz
  1596. @item q
  1597. Q-Factor
  1598. @item o
  1599. octave
  1600. @item s
  1601. slope
  1602. @item k
  1603. kHz
  1604. @end table
  1605. @item width, w
  1606. Determine how steep is the filter's shelf transition.
  1607. @item channels, c
  1608. Specify which channels to filter, by default all available are filtered.
  1609. @end table
  1610. @subsection Commands
  1611. This filter supports the following commands:
  1612. @table @option
  1613. @item frequency, f
  1614. Change bass frequency.
  1615. Syntax for the command is : "@var{frequency}"
  1616. @item width_type, t
  1617. Change bass width_type.
  1618. Syntax for the command is : "@var{width_type}"
  1619. @item width, w
  1620. Change bass width.
  1621. Syntax for the command is : "@var{width}"
  1622. @item gain, g
  1623. Change bass gain.
  1624. Syntax for the command is : "@var{gain}"
  1625. @end table
  1626. @section biquad
  1627. Apply a biquad IIR filter with the given coefficients.
  1628. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1629. are the numerator and denominator coefficients respectively.
  1630. and @var{channels}, @var{c} specify which channels to filter, by default all
  1631. available are filtered.
  1632. @subsection Commands
  1633. This filter supports the following commands:
  1634. @table @option
  1635. @item a0
  1636. @item a1
  1637. @item a2
  1638. @item b0
  1639. @item b1
  1640. @item b2
  1641. Change biquad parameter.
  1642. Syntax for the command is : "@var{value}"
  1643. @end table
  1644. @section bs2b
  1645. Bauer stereo to binaural transformation, which improves headphone listening of
  1646. stereo audio records.
  1647. To enable compilation of this filter you need to configure FFmpeg with
  1648. @code{--enable-libbs2b}.
  1649. It accepts the following parameters:
  1650. @table @option
  1651. @item profile
  1652. Pre-defined crossfeed level.
  1653. @table @option
  1654. @item default
  1655. Default level (fcut=700, feed=50).
  1656. @item cmoy
  1657. Chu Moy circuit (fcut=700, feed=60).
  1658. @item jmeier
  1659. Jan Meier circuit (fcut=650, feed=95).
  1660. @end table
  1661. @item fcut
  1662. Cut frequency (in Hz).
  1663. @item feed
  1664. Feed level (in Hz).
  1665. @end table
  1666. @section channelmap
  1667. Remap input channels to new locations.
  1668. It accepts the following parameters:
  1669. @table @option
  1670. @item map
  1671. Map channels from input to output. The argument is a '|'-separated list of
  1672. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1673. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1674. channel (e.g. FL for front left) or its index in the input channel layout.
  1675. @var{out_channel} is the name of the output channel or its index in the output
  1676. channel layout. If @var{out_channel} is not given then it is implicitly an
  1677. index, starting with zero and increasing by one for each mapping.
  1678. @item channel_layout
  1679. The channel layout of the output stream.
  1680. @end table
  1681. If no mapping is present, the filter will implicitly map input channels to
  1682. output channels, preserving indices.
  1683. For example, assuming a 5.1+downmix input MOV file,
  1684. @example
  1685. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1686. @end example
  1687. will create an output WAV file tagged as stereo from the downmix channels of
  1688. the input.
  1689. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1690. @example
  1691. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1692. @end example
  1693. @section channelsplit
  1694. Split each channel from an input audio stream into a separate output stream.
  1695. It accepts the following parameters:
  1696. @table @option
  1697. @item channel_layout
  1698. The channel layout of the input stream. The default is "stereo".
  1699. @end table
  1700. For example, assuming a stereo input MP3 file,
  1701. @example
  1702. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1703. @end example
  1704. will create an output Matroska file with two audio streams, one containing only
  1705. the left channel and the other the right channel.
  1706. Split a 5.1 WAV file into per-channel files:
  1707. @example
  1708. ffmpeg -i in.wav -filter_complex
  1709. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1710. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1711. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1712. side_right.wav
  1713. @end example
  1714. @section chorus
  1715. Add a chorus effect to the audio.
  1716. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1717. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1718. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1719. The modulation depth defines the range the modulated delay is played before or after
  1720. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1721. sound tuned around the original one, like in a chorus where some vocals are slightly
  1722. off key.
  1723. It accepts the following parameters:
  1724. @table @option
  1725. @item in_gain
  1726. Set input gain. Default is 0.4.
  1727. @item out_gain
  1728. Set output gain. Default is 0.4.
  1729. @item delays
  1730. Set delays. A typical delay is around 40ms to 60ms.
  1731. @item decays
  1732. Set decays.
  1733. @item speeds
  1734. Set speeds.
  1735. @item depths
  1736. Set depths.
  1737. @end table
  1738. @subsection Examples
  1739. @itemize
  1740. @item
  1741. A single delay:
  1742. @example
  1743. chorus=0.7:0.9:55:0.4:0.25:2
  1744. @end example
  1745. @item
  1746. Two delays:
  1747. @example
  1748. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1749. @end example
  1750. @item
  1751. Fuller sounding chorus with three delays:
  1752. @example
  1753. chorus=0.5:0.9:50|60|40:0.4|0.32|0.3:0.25|0.4|0.3:2|2.3|1.3
  1754. @end example
  1755. @end itemize
  1756. @section compand
  1757. Compress or expand the audio's dynamic range.
  1758. It accepts the following parameters:
  1759. @table @option
  1760. @item attacks
  1761. @item decays
  1762. A list of times in seconds for each channel over which the instantaneous level
  1763. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1764. increase of volume and @var{decays} refers to decrease of volume. For most
  1765. situations, the attack time (response to the audio getting louder) should be
  1766. shorter than the decay time, because the human ear is more sensitive to sudden
  1767. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1768. a typical value for decay is 0.8 seconds.
  1769. If specified number of attacks & decays is lower than number of channels, the last
  1770. set attack/decay will be used for all remaining channels.
  1771. @item points
  1772. A list of points for the transfer function, specified in dB relative to the
  1773. maximum possible signal amplitude. Each key points list must be defined using
  1774. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1775. @code{x0/y0 x1/y1 x2/y2 ....}
  1776. The input values must be in strictly increasing order but the transfer function
  1777. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1778. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1779. function are @code{-70/-70|-60/-20|1/0}.
  1780. @item soft-knee
  1781. Set the curve radius in dB for all joints. It defaults to 0.01.
  1782. @item gain
  1783. Set the additional gain in dB to be applied at all points on the transfer
  1784. function. This allows for easy adjustment of the overall gain.
  1785. It defaults to 0.
  1786. @item volume
  1787. Set an initial volume, in dB, to be assumed for each channel when filtering
  1788. starts. This permits the user to supply a nominal level initially, so that, for
  1789. example, a very large gain is not applied to initial signal levels before the
  1790. companding has begun to operate. A typical value for audio which is initially
  1791. quiet is -90 dB. It defaults to 0.
  1792. @item delay
  1793. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1794. delayed before being fed to the volume adjuster. Specifying a delay
  1795. approximately equal to the attack/decay times allows the filter to effectively
  1796. operate in predictive rather than reactive mode. It defaults to 0.
  1797. @end table
  1798. @subsection Examples
  1799. @itemize
  1800. @item
  1801. Make music with both quiet and loud passages suitable for listening to in a
  1802. noisy environment:
  1803. @example
  1804. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1805. @end example
  1806. Another example for audio with whisper and explosion parts:
  1807. @example
  1808. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1809. @end example
  1810. @item
  1811. A noise gate for when the noise is at a lower level than the signal:
  1812. @example
  1813. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1814. @end example
  1815. @item
  1816. Here is another noise gate, this time for when the noise is at a higher level
  1817. than the signal (making it, in some ways, similar to squelch):
  1818. @example
  1819. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1820. @end example
  1821. @item
  1822. 2:1 compression starting at -6dB:
  1823. @example
  1824. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1825. @end example
  1826. @item
  1827. 2:1 compression starting at -9dB:
  1828. @example
  1829. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1830. @end example
  1831. @item
  1832. 2:1 compression starting at -12dB:
  1833. @example
  1834. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1835. @end example
  1836. @item
  1837. 2:1 compression starting at -18dB:
  1838. @example
  1839. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1840. @end example
  1841. @item
  1842. 3:1 compression starting at -15dB:
  1843. @example
  1844. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1845. @end example
  1846. @item
  1847. Compressor/Gate:
  1848. @example
  1849. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1850. @end example
  1851. @item
  1852. Expander:
  1853. @example
  1854. compand=attacks=0:points=-80/-169|-54/-80|-49.5/-64.6|-41.1/-41.1|-25.8/-15|-10.8/-4.5|0/0|20/8.3
  1855. @end example
  1856. @item
  1857. Hard limiter at -6dB:
  1858. @example
  1859. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1860. @end example
  1861. @item
  1862. Hard limiter at -12dB:
  1863. @example
  1864. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1865. @end example
  1866. @item
  1867. Hard noise gate at -35 dB:
  1868. @example
  1869. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1870. @end example
  1871. @item
  1872. Soft limiter:
  1873. @example
  1874. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1875. @end example
  1876. @end itemize
  1877. @section compensationdelay
  1878. Compensation Delay Line is a metric based delay to compensate differing
  1879. positions of microphones or speakers.
  1880. For example, you have recorded guitar with two microphones placed in
  1881. different location. Because the front of sound wave has fixed speed in
  1882. normal conditions, the phasing of microphones can vary and depends on
  1883. their location and interposition. The best sound mix can be achieved when
  1884. these microphones are in phase (synchronized). Note that distance of
  1885. ~30 cm between microphones makes one microphone to capture signal in
  1886. antiphase to another microphone. That makes the final mix sounding moody.
  1887. This filter helps to solve phasing problems by adding different delays
  1888. to each microphone track and make them synchronized.
  1889. The best result can be reached when you take one track as base and
  1890. synchronize other tracks one by one with it.
  1891. Remember that synchronization/delay tolerance depends on sample rate, too.
  1892. Higher sample rates will give more tolerance.
  1893. It accepts the following parameters:
  1894. @table @option
  1895. @item mm
  1896. Set millimeters distance. This is compensation distance for fine tuning.
  1897. Default is 0.
  1898. @item cm
  1899. Set cm distance. This is compensation distance for tightening distance setup.
  1900. Default is 0.
  1901. @item m
  1902. Set meters distance. This is compensation distance for hard distance setup.
  1903. Default is 0.
  1904. @item dry
  1905. Set dry amount. Amount of unprocessed (dry) signal.
  1906. Default is 0.
  1907. @item wet
  1908. Set wet amount. Amount of processed (wet) signal.
  1909. Default is 1.
  1910. @item temp
  1911. Set temperature degree in Celsius. This is the temperature of the environment.
  1912. Default is 20.
  1913. @end table
  1914. @section crossfeed
  1915. Apply headphone crossfeed filter.
  1916. Crossfeed is the process of blending the left and right channels of stereo
  1917. audio recording.
  1918. It is mainly used to reduce extreme stereo separation of low frequencies.
  1919. The intent is to produce more speaker like sound to the listener.
  1920. The filter accepts the following options:
  1921. @table @option
  1922. @item strength
  1923. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  1924. This sets gain of low shelf filter for side part of stereo image.
  1925. Default is -6dB. Max allowed is -30db when strength is set to 1.
  1926. @item range
  1927. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  1928. This sets cut off frequency of low shelf filter. Default is cut off near
  1929. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  1930. @item level_in
  1931. Set input gain. Default is 0.9.
  1932. @item level_out
  1933. Set output gain. Default is 1.
  1934. @end table
  1935. @section crystalizer
  1936. Simple algorithm to expand audio dynamic range.
  1937. The filter accepts the following options:
  1938. @table @option
  1939. @item i
  1940. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  1941. (unchanged sound) to 10.0 (maximum effect).
  1942. @item c
  1943. Enable clipping. By default is enabled.
  1944. @end table
  1945. @section dcshift
  1946. Apply a DC shift to the audio.
  1947. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1948. in the recording chain) from the audio. The effect of a DC offset is reduced
  1949. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1950. a signal has a DC offset.
  1951. @table @option
  1952. @item shift
  1953. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1954. the audio.
  1955. @item limitergain
  1956. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1957. used to prevent clipping.
  1958. @end table
  1959. @section dynaudnorm
  1960. Dynamic Audio Normalizer.
  1961. This filter applies a certain amount of gain to the input audio in order
  1962. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1963. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1964. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1965. This allows for applying extra gain to the "quiet" sections of the audio
  1966. while avoiding distortions or clipping the "loud" sections. In other words:
  1967. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1968. sections, in the sense that the volume of each section is brought to the
  1969. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1970. this goal *without* applying "dynamic range compressing". It will retain 100%
  1971. of the dynamic range *within* each section of the audio file.
  1972. @table @option
  1973. @item f
  1974. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1975. Default is 500 milliseconds.
  1976. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1977. referred to as frames. This is required, because a peak magnitude has no
  1978. meaning for just a single sample value. Instead, we need to determine the
  1979. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1980. normalizer would simply use the peak magnitude of the complete file, the
  1981. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1982. frame. The length of a frame is specified in milliseconds. By default, the
  1983. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1984. been found to give good results with most files.
  1985. Note that the exact frame length, in number of samples, will be determined
  1986. automatically, based on the sampling rate of the individual input audio file.
  1987. @item g
  1988. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1989. number. Default is 31.
  1990. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1991. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1992. is specified in frames, centered around the current frame. For the sake of
  1993. simplicity, this must be an odd number. Consequently, the default value of 31
  1994. takes into account the current frame, as well as the 15 preceding frames and
  1995. the 15 subsequent frames. Using a larger window results in a stronger
  1996. smoothing effect and thus in less gain variation, i.e. slower gain
  1997. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1998. effect and thus in more gain variation, i.e. faster gain adaptation.
  1999. In other words, the more you increase this value, the more the Dynamic Audio
  2000. Normalizer will behave like a "traditional" normalization filter. On the
  2001. contrary, the more you decrease this value, the more the Dynamic Audio
  2002. Normalizer will behave like a dynamic range compressor.
  2003. @item p
  2004. Set the target peak value. This specifies the highest permissible magnitude
  2005. level for the normalized audio input. This filter will try to approach the
  2006. target peak magnitude as closely as possible, but at the same time it also
  2007. makes sure that the normalized signal will never exceed the peak magnitude.
  2008. A frame's maximum local gain factor is imposed directly by the target peak
  2009. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2010. It is not recommended to go above this value.
  2011. @item m
  2012. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2013. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2014. factor for each input frame, i.e. the maximum gain factor that does not
  2015. result in clipping or distortion. The maximum gain factor is determined by
  2016. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2017. additionally bounds the frame's maximum gain factor by a predetermined
  2018. (global) maximum gain factor. This is done in order to avoid excessive gain
  2019. factors in "silent" or almost silent frames. By default, the maximum gain
  2020. factor is 10.0, For most inputs the default value should be sufficient and
  2021. it usually is not recommended to increase this value. Though, for input
  2022. with an extremely low overall volume level, it may be necessary to allow even
  2023. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2024. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2025. Instead, a "sigmoid" threshold function will be applied. This way, the
  2026. gain factors will smoothly approach the threshold value, but never exceed that
  2027. value.
  2028. @item r
  2029. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2030. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2031. This means that the maximum local gain factor for each frame is defined
  2032. (only) by the frame's highest magnitude sample. This way, the samples can
  2033. be amplified as much as possible without exceeding the maximum signal
  2034. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2035. Normalizer can also take into account the frame's root mean square,
  2036. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2037. determine the power of a time-varying signal. It is therefore considered
  2038. that the RMS is a better approximation of the "perceived loudness" than
  2039. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2040. frames to a constant RMS value, a uniform "perceived loudness" can be
  2041. established. If a target RMS value has been specified, a frame's local gain
  2042. factor is defined as the factor that would result in exactly that RMS value.
  2043. Note, however, that the maximum local gain factor is still restricted by the
  2044. frame's highest magnitude sample, in order to prevent clipping.
  2045. @item n
  2046. Enable channels coupling. By default is enabled.
  2047. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2048. amount. This means the same gain factor will be applied to all channels, i.e.
  2049. the maximum possible gain factor is determined by the "loudest" channel.
  2050. However, in some recordings, it may happen that the volume of the different
  2051. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2052. In this case, this option can be used to disable the channel coupling. This way,
  2053. the gain factor will be determined independently for each channel, depending
  2054. only on the individual channel's highest magnitude sample. This allows for
  2055. harmonizing the volume of the different channels.
  2056. @item c
  2057. Enable DC bias correction. By default is disabled.
  2058. An audio signal (in the time domain) is a sequence of sample values.
  2059. In the Dynamic Audio Normalizer these sample values are represented in the
  2060. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2061. audio signal, or "waveform", should be centered around the zero point.
  2062. That means if we calculate the mean value of all samples in a file, or in a
  2063. single frame, then the result should be 0.0 or at least very close to that
  2064. value. If, however, there is a significant deviation of the mean value from
  2065. 0.0, in either positive or negative direction, this is referred to as a
  2066. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2067. Audio Normalizer provides optional DC bias correction.
  2068. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2069. the mean value, or "DC correction" offset, of each input frame and subtract
  2070. that value from all of the frame's sample values which ensures those samples
  2071. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2072. boundaries, the DC correction offset values will be interpolated smoothly
  2073. between neighbouring frames.
  2074. @item b
  2075. Enable alternative boundary mode. By default is disabled.
  2076. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2077. around each frame. This includes the preceding frames as well as the
  2078. subsequent frames. However, for the "boundary" frames, located at the very
  2079. beginning and at the very end of the audio file, not all neighbouring
  2080. frames are available. In particular, for the first few frames in the audio
  2081. file, the preceding frames are not known. And, similarly, for the last few
  2082. frames in the audio file, the subsequent frames are not known. Thus, the
  2083. question arises which gain factors should be assumed for the missing frames
  2084. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2085. to deal with this situation. The default boundary mode assumes a gain factor
  2086. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2087. "fade out" at the beginning and at the end of the input, respectively.
  2088. @item s
  2089. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2090. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2091. compression. This means that signal peaks will not be pruned and thus the
  2092. full dynamic range will be retained within each local neighbourhood. However,
  2093. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2094. normalization algorithm with a more "traditional" compression.
  2095. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2096. (thresholding) function. If (and only if) the compression feature is enabled,
  2097. all input frames will be processed by a soft knee thresholding function prior
  2098. to the actual normalization process. Put simply, the thresholding function is
  2099. going to prune all samples whose magnitude exceeds a certain threshold value.
  2100. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2101. value. Instead, the threshold value will be adjusted for each individual
  2102. frame.
  2103. In general, smaller parameters result in stronger compression, and vice versa.
  2104. Values below 3.0 are not recommended, because audible distortion may appear.
  2105. @end table
  2106. @section earwax
  2107. Make audio easier to listen to on headphones.
  2108. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2109. so that when listened to on headphones the stereo image is moved from
  2110. inside your head (standard for headphones) to outside and in front of
  2111. the listener (standard for speakers).
  2112. Ported from SoX.
  2113. @section equalizer
  2114. Apply a two-pole peaking equalisation (EQ) filter. With this
  2115. filter, the signal-level at and around a selected frequency can
  2116. be increased or decreased, whilst (unlike bandpass and bandreject
  2117. filters) that at all other frequencies is unchanged.
  2118. In order to produce complex equalisation curves, this filter can
  2119. be given several times, each with a different central frequency.
  2120. The filter accepts the following options:
  2121. @table @option
  2122. @item frequency, f
  2123. Set the filter's central frequency in Hz.
  2124. @item width_type, t
  2125. Set method to specify band-width of filter.
  2126. @table @option
  2127. @item h
  2128. Hz
  2129. @item q
  2130. Q-Factor
  2131. @item o
  2132. octave
  2133. @item s
  2134. slope
  2135. @item k
  2136. kHz
  2137. @end table
  2138. @item width, w
  2139. Specify the band-width of a filter in width_type units.
  2140. @item gain, g
  2141. Set the required gain or attenuation in dB.
  2142. Beware of clipping when using a positive gain.
  2143. @item channels, c
  2144. Specify which channels to filter, by default all available are filtered.
  2145. @end table
  2146. @subsection Examples
  2147. @itemize
  2148. @item
  2149. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2150. @example
  2151. equalizer=f=1000:t=h:width=200:g=-10
  2152. @end example
  2153. @item
  2154. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2155. @example
  2156. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2157. @end example
  2158. @end itemize
  2159. @subsection Commands
  2160. This filter supports the following commands:
  2161. @table @option
  2162. @item frequency, f
  2163. Change equalizer frequency.
  2164. Syntax for the command is : "@var{frequency}"
  2165. @item width_type, t
  2166. Change equalizer width_type.
  2167. Syntax for the command is : "@var{width_type}"
  2168. @item width, w
  2169. Change equalizer width.
  2170. Syntax for the command is : "@var{width}"
  2171. @item gain, g
  2172. Change equalizer gain.
  2173. Syntax for the command is : "@var{gain}"
  2174. @end table
  2175. @section extrastereo
  2176. Linearly increases the difference between left and right channels which
  2177. adds some sort of "live" effect to playback.
  2178. The filter accepts the following options:
  2179. @table @option
  2180. @item m
  2181. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2182. (average of both channels), with 1.0 sound will be unchanged, with
  2183. -1.0 left and right channels will be swapped.
  2184. @item c
  2185. Enable clipping. By default is enabled.
  2186. @end table
  2187. @section firequalizer
  2188. Apply FIR Equalization using arbitrary frequency response.
  2189. The filter accepts the following option:
  2190. @table @option
  2191. @item gain
  2192. Set gain curve equation (in dB). The expression can contain variables:
  2193. @table @option
  2194. @item f
  2195. the evaluated frequency
  2196. @item sr
  2197. sample rate
  2198. @item ch
  2199. channel number, set to 0 when multichannels evaluation is disabled
  2200. @item chid
  2201. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2202. multichannels evaluation is disabled
  2203. @item chs
  2204. number of channels
  2205. @item chlayout
  2206. channel_layout, see libavutil/channel_layout.h
  2207. @end table
  2208. and functions:
  2209. @table @option
  2210. @item gain_interpolate(f)
  2211. interpolate gain on frequency f based on gain_entry
  2212. @item cubic_interpolate(f)
  2213. same as gain_interpolate, but smoother
  2214. @end table
  2215. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2216. @item gain_entry
  2217. Set gain entry for gain_interpolate function. The expression can
  2218. contain functions:
  2219. @table @option
  2220. @item entry(f, g)
  2221. store gain entry at frequency f with value g
  2222. @end table
  2223. This option is also available as command.
  2224. @item delay
  2225. Set filter delay in seconds. Higher value means more accurate.
  2226. Default is @code{0.01}.
  2227. @item accuracy
  2228. Set filter accuracy in Hz. Lower value means more accurate.
  2229. Default is @code{5}.
  2230. @item wfunc
  2231. Set window function. Acceptable values are:
  2232. @table @option
  2233. @item rectangular
  2234. rectangular window, useful when gain curve is already smooth
  2235. @item hann
  2236. hann window (default)
  2237. @item hamming
  2238. hamming window
  2239. @item blackman
  2240. blackman window
  2241. @item nuttall3
  2242. 3-terms continuous 1st derivative nuttall window
  2243. @item mnuttall3
  2244. minimum 3-terms discontinuous nuttall window
  2245. @item nuttall
  2246. 4-terms continuous 1st derivative nuttall window
  2247. @item bnuttall
  2248. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2249. @item bharris
  2250. blackman-harris window
  2251. @item tukey
  2252. tukey window
  2253. @end table
  2254. @item fixed
  2255. If enabled, use fixed number of audio samples. This improves speed when
  2256. filtering with large delay. Default is disabled.
  2257. @item multi
  2258. Enable multichannels evaluation on gain. Default is disabled.
  2259. @item zero_phase
  2260. Enable zero phase mode by subtracting timestamp to compensate delay.
  2261. Default is disabled.
  2262. @item scale
  2263. Set scale used by gain. Acceptable values are:
  2264. @table @option
  2265. @item linlin
  2266. linear frequency, linear gain
  2267. @item linlog
  2268. linear frequency, logarithmic (in dB) gain (default)
  2269. @item loglin
  2270. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2271. @item loglog
  2272. logarithmic frequency, logarithmic gain
  2273. @end table
  2274. @item dumpfile
  2275. Set file for dumping, suitable for gnuplot.
  2276. @item dumpscale
  2277. Set scale for dumpfile. Acceptable values are same with scale option.
  2278. Default is linlog.
  2279. @item fft2
  2280. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2281. Default is disabled.
  2282. @item min_phase
  2283. Enable minimum phase impulse response. Default is disabled.
  2284. @end table
  2285. @subsection Examples
  2286. @itemize
  2287. @item
  2288. lowpass at 1000 Hz:
  2289. @example
  2290. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2291. @end example
  2292. @item
  2293. lowpass at 1000 Hz with gain_entry:
  2294. @example
  2295. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2296. @end example
  2297. @item
  2298. custom equalization:
  2299. @example
  2300. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2301. @end example
  2302. @item
  2303. higher delay with zero phase to compensate delay:
  2304. @example
  2305. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2306. @end example
  2307. @item
  2308. lowpass on left channel, highpass on right channel:
  2309. @example
  2310. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2311. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2312. @end example
  2313. @end itemize
  2314. @section flanger
  2315. Apply a flanging effect to the audio.
  2316. The filter accepts the following options:
  2317. @table @option
  2318. @item delay
  2319. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2320. @item depth
  2321. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2322. @item regen
  2323. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2324. Default value is 0.
  2325. @item width
  2326. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2327. Default value is 71.
  2328. @item speed
  2329. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2330. @item shape
  2331. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2332. Default value is @var{sinusoidal}.
  2333. @item phase
  2334. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2335. Default value is 25.
  2336. @item interp
  2337. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2338. Default is @var{linear}.
  2339. @end table
  2340. @section haas
  2341. Apply Haas effect to audio.
  2342. Note that this makes most sense to apply on mono signals.
  2343. With this filter applied to mono signals it give some directionality and
  2344. stretches its stereo image.
  2345. The filter accepts the following options:
  2346. @table @option
  2347. @item level_in
  2348. Set input level. By default is @var{1}, or 0dB
  2349. @item level_out
  2350. Set output level. By default is @var{1}, or 0dB.
  2351. @item side_gain
  2352. Set gain applied to side part of signal. By default is @var{1}.
  2353. @item middle_source
  2354. Set kind of middle source. Can be one of the following:
  2355. @table @samp
  2356. @item left
  2357. Pick left channel.
  2358. @item right
  2359. Pick right channel.
  2360. @item mid
  2361. Pick middle part signal of stereo image.
  2362. @item side
  2363. Pick side part signal of stereo image.
  2364. @end table
  2365. @item middle_phase
  2366. Change middle phase. By default is disabled.
  2367. @item left_delay
  2368. Set left channel delay. By default is @var{2.05} milliseconds.
  2369. @item left_balance
  2370. Set left channel balance. By default is @var{-1}.
  2371. @item left_gain
  2372. Set left channel gain. By default is @var{1}.
  2373. @item left_phase
  2374. Change left phase. By default is disabled.
  2375. @item right_delay
  2376. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2377. @item right_balance
  2378. Set right channel balance. By default is @var{1}.
  2379. @item right_gain
  2380. Set right channel gain. By default is @var{1}.
  2381. @item right_phase
  2382. Change right phase. By default is enabled.
  2383. @end table
  2384. @section hdcd
  2385. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2386. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2387. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2388. of HDCD, and detects the Transient Filter flag.
  2389. @example
  2390. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2391. @end example
  2392. When using the filter with wav, note the default encoding for wav is 16-bit,
  2393. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2394. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2395. @example
  2396. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2397. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2398. @end example
  2399. The filter accepts the following options:
  2400. @table @option
  2401. @item disable_autoconvert
  2402. Disable any automatic format conversion or resampling in the filter graph.
  2403. @item process_stereo
  2404. Process the stereo channels together. If target_gain does not match between
  2405. channels, consider it invalid and use the last valid target_gain.
  2406. @item cdt_ms
  2407. Set the code detect timer period in ms.
  2408. @item force_pe
  2409. Always extend peaks above -3dBFS even if PE isn't signaled.
  2410. @item analyze_mode
  2411. Replace audio with a solid tone and adjust the amplitude to signal some
  2412. specific aspect of the decoding process. The output file can be loaded in
  2413. an audio editor alongside the original to aid analysis.
  2414. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2415. Modes are:
  2416. @table @samp
  2417. @item 0, off
  2418. Disabled
  2419. @item 1, lle
  2420. Gain adjustment level at each sample
  2421. @item 2, pe
  2422. Samples where peak extend occurs
  2423. @item 3, cdt
  2424. Samples where the code detect timer is active
  2425. @item 4, tgm
  2426. Samples where the target gain does not match between channels
  2427. @end table
  2428. @end table
  2429. @section headphone
  2430. Apply head-related transfer functions (HRTFs) to create virtual
  2431. loudspeakers around the user for binaural listening via headphones.
  2432. The HRIRs are provided via additional streams, for each channel
  2433. one stereo input stream is needed.
  2434. The filter accepts the following options:
  2435. @table @option
  2436. @item map
  2437. Set mapping of input streams for convolution.
  2438. The argument is a '|'-separated list of channel names in order as they
  2439. are given as additional stream inputs for filter.
  2440. This also specify number of input streams. Number of input streams
  2441. must be not less than number of channels in first stream plus one.
  2442. @item gain
  2443. Set gain applied to audio. Value is in dB. Default is 0.
  2444. @item type
  2445. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2446. processing audio in time domain which is slow.
  2447. @var{freq} is processing audio in frequency domain which is fast.
  2448. Default is @var{freq}.
  2449. @item lfe
  2450. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2451. @end table
  2452. @subsection Examples
  2453. @itemize
  2454. @item
  2455. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2456. each amovie filter use stereo file with IR coefficients as input.
  2457. The files give coefficients for each position of virtual loudspeaker:
  2458. @example
  2459. ffmpeg -i input.wav -lavfi-complex "amovie=azi_270_ele_0_DFC.wav[sr],amovie=azi_90_ele_0_DFC.wav[sl],amovie=azi_225_ele_0_DFC.wav[br],amovie=azi_135_ele_0_DFC.wav[bl],amovie=azi_0_ele_0_DFC.wav,asplit[fc][lfe],amovie=azi_35_ele_0_DFC.wav[fl],amovie=azi_325_ele_0_DFC.wav[fr],[a:0][fl][fr][fc][lfe][bl][br][sl][sr]headphone=FL|FR|FC|LFE|BL|BR|SL|SR"
  2460. output.wav
  2461. @end example
  2462. @end itemize
  2463. @section highpass
  2464. Apply a high-pass filter with 3dB point frequency.
  2465. The filter can be either single-pole, or double-pole (the default).
  2466. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2467. The filter accepts the following options:
  2468. @table @option
  2469. @item frequency, f
  2470. Set frequency in Hz. Default is 3000.
  2471. @item poles, p
  2472. Set number of poles. Default is 2.
  2473. @item width_type, t
  2474. Set method to specify band-width of filter.
  2475. @table @option
  2476. @item h
  2477. Hz
  2478. @item q
  2479. Q-Factor
  2480. @item o
  2481. octave
  2482. @item s
  2483. slope
  2484. @item k
  2485. kHz
  2486. @end table
  2487. @item width, w
  2488. Specify the band-width of a filter in width_type units.
  2489. Applies only to double-pole filter.
  2490. The default is 0.707q and gives a Butterworth response.
  2491. @item channels, c
  2492. Specify which channels to filter, by default all available are filtered.
  2493. @end table
  2494. @subsection Commands
  2495. This filter supports the following commands:
  2496. @table @option
  2497. @item frequency, f
  2498. Change highpass frequency.
  2499. Syntax for the command is : "@var{frequency}"
  2500. @item width_type, t
  2501. Change highpass width_type.
  2502. Syntax for the command is : "@var{width_type}"
  2503. @item width, w
  2504. Change highpass width.
  2505. Syntax for the command is : "@var{width}"
  2506. @end table
  2507. @section join
  2508. Join multiple input streams into one multi-channel stream.
  2509. It accepts the following parameters:
  2510. @table @option
  2511. @item inputs
  2512. The number of input streams. It defaults to 2.
  2513. @item channel_layout
  2514. The desired output channel layout. It defaults to stereo.
  2515. @item map
  2516. Map channels from inputs to output. The argument is a '|'-separated list of
  2517. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2518. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2519. can be either the name of the input channel (e.g. FL for front left) or its
  2520. index in the specified input stream. @var{out_channel} is the name of the output
  2521. channel.
  2522. @end table
  2523. The filter will attempt to guess the mappings when they are not specified
  2524. explicitly. It does so by first trying to find an unused matching input channel
  2525. and if that fails it picks the first unused input channel.
  2526. Join 3 inputs (with properly set channel layouts):
  2527. @example
  2528. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2529. @end example
  2530. Build a 5.1 output from 6 single-channel streams:
  2531. @example
  2532. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2533. 'join=inputs=6:channel_layout=5.1:map=0.0-FL|1.0-FR|2.0-FC|3.0-SL|4.0-SR|5.0-LFE'
  2534. out
  2535. @end example
  2536. @section ladspa
  2537. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2538. To enable compilation of this filter you need to configure FFmpeg with
  2539. @code{--enable-ladspa}.
  2540. @table @option
  2541. @item file, f
  2542. Specifies the name of LADSPA plugin library to load. If the environment
  2543. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2544. each one of the directories specified by the colon separated list in
  2545. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2546. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2547. @file{/usr/lib/ladspa/}.
  2548. @item plugin, p
  2549. Specifies the plugin within the library. Some libraries contain only
  2550. one plugin, but others contain many of them. If this is not set filter
  2551. will list all available plugins within the specified library.
  2552. @item controls, c
  2553. Set the '|' separated list of controls which are zero or more floating point
  2554. values that determine the behavior of the loaded plugin (for example delay,
  2555. threshold or gain).
  2556. Controls need to be defined using the following syntax:
  2557. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2558. @var{valuei} is the value set on the @var{i}-th control.
  2559. Alternatively they can be also defined using the following syntax:
  2560. @var{value0}|@var{value1}|@var{value2}|..., where
  2561. @var{valuei} is the value set on the @var{i}-th control.
  2562. If @option{controls} is set to @code{help}, all available controls and
  2563. their valid ranges are printed.
  2564. @item sample_rate, s
  2565. Specify the sample rate, default to 44100. Only used if plugin have
  2566. zero inputs.
  2567. @item nb_samples, n
  2568. Set the number of samples per channel per each output frame, default
  2569. is 1024. Only used if plugin have zero inputs.
  2570. @item duration, d
  2571. Set the minimum duration of the sourced audio. See
  2572. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2573. for the accepted syntax.
  2574. Note that the resulting duration may be greater than the specified duration,
  2575. as the generated audio is always cut at the end of a complete frame.
  2576. If not specified, or the expressed duration is negative, the audio is
  2577. supposed to be generated forever.
  2578. Only used if plugin have zero inputs.
  2579. @end table
  2580. @subsection Examples
  2581. @itemize
  2582. @item
  2583. List all available plugins within amp (LADSPA example plugin) library:
  2584. @example
  2585. ladspa=file=amp
  2586. @end example
  2587. @item
  2588. List all available controls and their valid ranges for @code{vcf_notch}
  2589. plugin from @code{VCF} library:
  2590. @example
  2591. ladspa=f=vcf:p=vcf_notch:c=help
  2592. @end example
  2593. @item
  2594. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2595. plugin library:
  2596. @example
  2597. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2598. @end example
  2599. @item
  2600. Add reverberation to the audio using TAP-plugins
  2601. (Tom's Audio Processing plugins):
  2602. @example
  2603. ladspa=file=tap_reverb:tap_reverb
  2604. @end example
  2605. @item
  2606. Generate white noise, with 0.2 amplitude:
  2607. @example
  2608. ladspa=file=cmt:noise_source_white:c=c0=.2
  2609. @end example
  2610. @item
  2611. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2612. @code{C* Audio Plugin Suite} (CAPS) library:
  2613. @example
  2614. ladspa=file=caps:Click:c=c1=20'
  2615. @end example
  2616. @item
  2617. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2618. @example
  2619. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2620. @end example
  2621. @item
  2622. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2623. @code{SWH Plugins} collection:
  2624. @example
  2625. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2626. @end example
  2627. @item
  2628. Attenuate low frequencies using Multiband EQ from Steve Harris
  2629. @code{SWH Plugins} collection:
  2630. @example
  2631. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2632. @end example
  2633. @item
  2634. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2635. (CAPS) library:
  2636. @example
  2637. ladspa=caps:Narrower
  2638. @end example
  2639. @item
  2640. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2641. @example
  2642. ladspa=caps:White:.2
  2643. @end example
  2644. @item
  2645. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2646. @example
  2647. ladspa=caps:Fractal:c=c1=1
  2648. @end example
  2649. @item
  2650. Dynamic volume normalization using @code{VLevel} plugin:
  2651. @example
  2652. ladspa=vlevel-ladspa:vlevel_mono
  2653. @end example
  2654. @end itemize
  2655. @subsection Commands
  2656. This filter supports the following commands:
  2657. @table @option
  2658. @item cN
  2659. Modify the @var{N}-th control value.
  2660. If the specified value is not valid, it is ignored and prior one is kept.
  2661. @end table
  2662. @section loudnorm
  2663. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2664. Support for both single pass (livestreams, files) and double pass (files) modes.
  2665. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  2666. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  2667. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  2668. The filter accepts the following options:
  2669. @table @option
  2670. @item I, i
  2671. Set integrated loudness target.
  2672. Range is -70.0 - -5.0. Default value is -24.0.
  2673. @item LRA, lra
  2674. Set loudness range target.
  2675. Range is 1.0 - 20.0. Default value is 7.0.
  2676. @item TP, tp
  2677. Set maximum true peak.
  2678. Range is -9.0 - +0.0. Default value is -2.0.
  2679. @item measured_I, measured_i
  2680. Measured IL of input file.
  2681. Range is -99.0 - +0.0.
  2682. @item measured_LRA, measured_lra
  2683. Measured LRA of input file.
  2684. Range is 0.0 - 99.0.
  2685. @item measured_TP, measured_tp
  2686. Measured true peak of input file.
  2687. Range is -99.0 - +99.0.
  2688. @item measured_thresh
  2689. Measured threshold of input file.
  2690. Range is -99.0 - +0.0.
  2691. @item offset
  2692. Set offset gain. Gain is applied before the true-peak limiter.
  2693. Range is -99.0 - +99.0. Default is +0.0.
  2694. @item linear
  2695. Normalize linearly if possible.
  2696. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2697. to be specified in order to use this mode.
  2698. Options are true or false. Default is true.
  2699. @item dual_mono
  2700. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2701. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2702. If set to @code{true}, this option will compensate for this effect.
  2703. Multi-channel input files are not affected by this option.
  2704. Options are true or false. Default is false.
  2705. @item print_format
  2706. Set print format for stats. Options are summary, json, or none.
  2707. Default value is none.
  2708. @end table
  2709. @section lowpass
  2710. Apply a low-pass filter with 3dB point frequency.
  2711. The filter can be either single-pole or double-pole (the default).
  2712. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2713. The filter accepts the following options:
  2714. @table @option
  2715. @item frequency, f
  2716. Set frequency in Hz. Default is 500.
  2717. @item poles, p
  2718. Set number of poles. Default is 2.
  2719. @item width_type, t
  2720. Set method to specify band-width of filter.
  2721. @table @option
  2722. @item h
  2723. Hz
  2724. @item q
  2725. Q-Factor
  2726. @item o
  2727. octave
  2728. @item s
  2729. slope
  2730. @item k
  2731. kHz
  2732. @end table
  2733. @item width, w
  2734. Specify the band-width of a filter in width_type units.
  2735. Applies only to double-pole filter.
  2736. The default is 0.707q and gives a Butterworth response.
  2737. @item channels, c
  2738. Specify which channels to filter, by default all available are filtered.
  2739. @end table
  2740. @subsection Examples
  2741. @itemize
  2742. @item
  2743. Lowpass only LFE channel, it LFE is not present it does nothing:
  2744. @example
  2745. lowpass=c=LFE
  2746. @end example
  2747. @end itemize
  2748. @subsection Commands
  2749. This filter supports the following commands:
  2750. @table @option
  2751. @item frequency, f
  2752. Change lowpass frequency.
  2753. Syntax for the command is : "@var{frequency}"
  2754. @item width_type, t
  2755. Change lowpass width_type.
  2756. Syntax for the command is : "@var{width_type}"
  2757. @item width, w
  2758. Change lowpass width.
  2759. Syntax for the command is : "@var{width}"
  2760. @end table
  2761. @section lv2
  2762. Load a LV2 (LADSPA Version 2) plugin.
  2763. To enable compilation of this filter you need to configure FFmpeg with
  2764. @code{--enable-lv2}.
  2765. @table @option
  2766. @item plugin, p
  2767. Specifies the plugin URI. You may need to escape ':'.
  2768. @item controls, c
  2769. Set the '|' separated list of controls which are zero or more floating point
  2770. values that determine the behavior of the loaded plugin (for example delay,
  2771. threshold or gain).
  2772. If @option{controls} is set to @code{help}, all available controls and
  2773. their valid ranges are printed.
  2774. @item sample_rate, s
  2775. Specify the sample rate, default to 44100. Only used if plugin have
  2776. zero inputs.
  2777. @item nb_samples, n
  2778. Set the number of samples per channel per each output frame, default
  2779. is 1024. Only used if plugin have zero inputs.
  2780. @item duration, d
  2781. Set the minimum duration of the sourced audio. See
  2782. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2783. for the accepted syntax.
  2784. Note that the resulting duration may be greater than the specified duration,
  2785. as the generated audio is always cut at the end of a complete frame.
  2786. If not specified, or the expressed duration is negative, the audio is
  2787. supposed to be generated forever.
  2788. Only used if plugin have zero inputs.
  2789. @end table
  2790. @subsection Examples
  2791. @itemize
  2792. @item
  2793. Apply bass enhancer plugin from Calf:
  2794. @example
  2795. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  2796. @end example
  2797. @item
  2798. Apply bass vinyl plugin from Calf:
  2799. @example
  2800. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  2801. @end example
  2802. @item
  2803. Apply bit crusher plugin from ArtyFX:
  2804. @example
  2805. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  2806. @end example
  2807. @end itemize
  2808. @section mcompand
  2809. Multiband Compress or expand the audio's dynamic range.
  2810. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  2811. This is akin to the crossover of a loudspeaker, and results in flat frequency
  2812. response when absent compander action.
  2813. It accepts the following parameters:
  2814. @table @option
  2815. @item args
  2816. This option syntax is:
  2817. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  2818. For explanation of each item refer to compand filter documentation.
  2819. @end table
  2820. @anchor{pan}
  2821. @section pan
  2822. Mix channels with specific gain levels. The filter accepts the output
  2823. channel layout followed by a set of channels definitions.
  2824. This filter is also designed to efficiently remap the channels of an audio
  2825. stream.
  2826. The filter accepts parameters of the form:
  2827. "@var{l}|@var{outdef}|@var{outdef}|..."
  2828. @table @option
  2829. @item l
  2830. output channel layout or number of channels
  2831. @item outdef
  2832. output channel specification, of the form:
  2833. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  2834. @item out_name
  2835. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2836. number (c0, c1, etc.)
  2837. @item gain
  2838. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2839. @item in_name
  2840. input channel to use, see out_name for details; it is not possible to mix
  2841. named and numbered input channels
  2842. @end table
  2843. If the `=' in a channel specification is replaced by `<', then the gains for
  2844. that specification will be renormalized so that the total is 1, thus
  2845. avoiding clipping noise.
  2846. @subsection Mixing examples
  2847. For example, if you want to down-mix from stereo to mono, but with a bigger
  2848. factor for the left channel:
  2849. @example
  2850. pan=1c|c0=0.9*c0+0.1*c1
  2851. @end example
  2852. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2853. 7-channels surround:
  2854. @example
  2855. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2856. @end example
  2857. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2858. that should be preferred (see "-ac" option) unless you have very specific
  2859. needs.
  2860. @subsection Remapping examples
  2861. The channel remapping will be effective if, and only if:
  2862. @itemize
  2863. @item gain coefficients are zeroes or ones,
  2864. @item only one input per channel output,
  2865. @end itemize
  2866. If all these conditions are satisfied, the filter will notify the user ("Pure
  2867. channel mapping detected"), and use an optimized and lossless method to do the
  2868. remapping.
  2869. For example, if you have a 5.1 source and want a stereo audio stream by
  2870. dropping the extra channels:
  2871. @example
  2872. pan="stereo| c0=FL | c1=FR"
  2873. @end example
  2874. Given the same source, you can also switch front left and front right channels
  2875. and keep the input channel layout:
  2876. @example
  2877. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2878. @end example
  2879. If the input is a stereo audio stream, you can mute the front left channel (and
  2880. still keep the stereo channel layout) with:
  2881. @example
  2882. pan="stereo|c1=c1"
  2883. @end example
  2884. Still with a stereo audio stream input, you can copy the right channel in both
  2885. front left and right:
  2886. @example
  2887. pan="stereo| c0=FR | c1=FR"
  2888. @end example
  2889. @section replaygain
  2890. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2891. outputs it unchanged.
  2892. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2893. @section resample
  2894. Convert the audio sample format, sample rate and channel layout. It is
  2895. not meant to be used directly.
  2896. @section rubberband
  2897. Apply time-stretching and pitch-shifting with librubberband.
  2898. The filter accepts the following options:
  2899. @table @option
  2900. @item tempo
  2901. Set tempo scale factor.
  2902. @item pitch
  2903. Set pitch scale factor.
  2904. @item transients
  2905. Set transients detector.
  2906. Possible values are:
  2907. @table @var
  2908. @item crisp
  2909. @item mixed
  2910. @item smooth
  2911. @end table
  2912. @item detector
  2913. Set detector.
  2914. Possible values are:
  2915. @table @var
  2916. @item compound
  2917. @item percussive
  2918. @item soft
  2919. @end table
  2920. @item phase
  2921. Set phase.
  2922. Possible values are:
  2923. @table @var
  2924. @item laminar
  2925. @item independent
  2926. @end table
  2927. @item window
  2928. Set processing window size.
  2929. Possible values are:
  2930. @table @var
  2931. @item standard
  2932. @item short
  2933. @item long
  2934. @end table
  2935. @item smoothing
  2936. Set smoothing.
  2937. Possible values are:
  2938. @table @var
  2939. @item off
  2940. @item on
  2941. @end table
  2942. @item formant
  2943. Enable formant preservation when shift pitching.
  2944. Possible values are:
  2945. @table @var
  2946. @item shifted
  2947. @item preserved
  2948. @end table
  2949. @item pitchq
  2950. Set pitch quality.
  2951. Possible values are:
  2952. @table @var
  2953. @item quality
  2954. @item speed
  2955. @item consistency
  2956. @end table
  2957. @item channels
  2958. Set channels.
  2959. Possible values are:
  2960. @table @var
  2961. @item apart
  2962. @item together
  2963. @end table
  2964. @end table
  2965. @section sidechaincompress
  2966. This filter acts like normal compressor but has the ability to compress
  2967. detected signal using second input signal.
  2968. It needs two input streams and returns one output stream.
  2969. First input stream will be processed depending on second stream signal.
  2970. The filtered signal then can be filtered with other filters in later stages of
  2971. processing. See @ref{pan} and @ref{amerge} filter.
  2972. The filter accepts the following options:
  2973. @table @option
  2974. @item level_in
  2975. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2976. @item threshold
  2977. If a signal of second stream raises above this level it will affect the gain
  2978. reduction of first stream.
  2979. By default is 0.125. Range is between 0.00097563 and 1.
  2980. @item ratio
  2981. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2982. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2983. Default is 2. Range is between 1 and 20.
  2984. @item attack
  2985. Amount of milliseconds the signal has to rise above the threshold before gain
  2986. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2987. @item release
  2988. Amount of milliseconds the signal has to fall below the threshold before
  2989. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2990. @item makeup
  2991. Set the amount by how much signal will be amplified after processing.
  2992. Default is 1. Range is from 1 to 64.
  2993. @item knee
  2994. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2995. Default is 2.82843. Range is between 1 and 8.
  2996. @item link
  2997. Choose if the @code{average} level between all channels of side-chain stream
  2998. or the louder(@code{maximum}) channel of side-chain stream affects the
  2999. reduction. Default is @code{average}.
  3000. @item detection
  3001. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3002. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3003. @item level_sc
  3004. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3005. @item mix
  3006. How much to use compressed signal in output. Default is 1.
  3007. Range is between 0 and 1.
  3008. @end table
  3009. @subsection Examples
  3010. @itemize
  3011. @item
  3012. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3013. depending on the signal of 2nd input and later compressed signal to be
  3014. merged with 2nd input:
  3015. @example
  3016. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3017. @end example
  3018. @end itemize
  3019. @section sidechaingate
  3020. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3021. filter the detected signal before sending it to the gain reduction stage.
  3022. Normally a gate uses the full range signal to detect a level above the
  3023. threshold.
  3024. For example: If you cut all lower frequencies from your sidechain signal
  3025. the gate will decrease the volume of your track only if not enough highs
  3026. appear. With this technique you are able to reduce the resonation of a
  3027. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3028. guitar.
  3029. It needs two input streams and returns one output stream.
  3030. First input stream will be processed depending on second stream signal.
  3031. The filter accepts the following options:
  3032. @table @option
  3033. @item level_in
  3034. Set input level before filtering.
  3035. Default is 1. Allowed range is from 0.015625 to 64.
  3036. @item range
  3037. Set the level of gain reduction when the signal is below the threshold.
  3038. Default is 0.06125. Allowed range is from 0 to 1.
  3039. @item threshold
  3040. If a signal rises above this level the gain reduction is released.
  3041. Default is 0.125. Allowed range is from 0 to 1.
  3042. @item ratio
  3043. Set a ratio about which the signal is reduced.
  3044. Default is 2. Allowed range is from 1 to 9000.
  3045. @item attack
  3046. Amount of milliseconds the signal has to rise above the threshold before gain
  3047. reduction stops.
  3048. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3049. @item release
  3050. Amount of milliseconds the signal has to fall below the threshold before the
  3051. reduction is increased again. Default is 250 milliseconds.
  3052. Allowed range is from 0.01 to 9000.
  3053. @item makeup
  3054. Set amount of amplification of signal after processing.
  3055. Default is 1. Allowed range is from 1 to 64.
  3056. @item knee
  3057. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3058. Default is 2.828427125. Allowed range is from 1 to 8.
  3059. @item detection
  3060. Choose if exact signal should be taken for detection or an RMS like one.
  3061. Default is rms. Can be peak or rms.
  3062. @item link
  3063. Choose if the average level between all channels or the louder channel affects
  3064. the reduction.
  3065. Default is average. Can be average or maximum.
  3066. @item level_sc
  3067. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3068. @end table
  3069. @section silencedetect
  3070. Detect silence in an audio stream.
  3071. This filter logs a message when it detects that the input audio volume is less
  3072. or equal to a noise tolerance value for a duration greater or equal to the
  3073. minimum detected noise duration.
  3074. The printed times and duration are expressed in seconds.
  3075. The filter accepts the following options:
  3076. @table @option
  3077. @item duration, d
  3078. Set silence duration until notification (default is 2 seconds).
  3079. @item noise, n
  3080. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3081. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3082. @end table
  3083. @subsection Examples
  3084. @itemize
  3085. @item
  3086. Detect 5 seconds of silence with -50dB noise tolerance:
  3087. @example
  3088. silencedetect=n=-50dB:d=5
  3089. @end example
  3090. @item
  3091. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3092. tolerance in @file{silence.mp3}:
  3093. @example
  3094. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3095. @end example
  3096. @end itemize
  3097. @section silenceremove
  3098. Remove silence from the beginning, middle or end of the audio.
  3099. The filter accepts the following options:
  3100. @table @option
  3101. @item start_periods
  3102. This value is used to indicate if audio should be trimmed at beginning of
  3103. the audio. A value of zero indicates no silence should be trimmed from the
  3104. beginning. When specifying a non-zero value, it trims audio up until it
  3105. finds non-silence. Normally, when trimming silence from beginning of audio
  3106. the @var{start_periods} will be @code{1} but it can be increased to higher
  3107. values to trim all audio up to specific count of non-silence periods.
  3108. Default value is @code{0}.
  3109. @item start_duration
  3110. Specify the amount of time that non-silence must be detected before it stops
  3111. trimming audio. By increasing the duration, bursts of noises can be treated
  3112. as silence and trimmed off. Default value is @code{0}.
  3113. @item start_threshold
  3114. This indicates what sample value should be treated as silence. For digital
  3115. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3116. you may wish to increase the value to account for background noise.
  3117. Can be specified in dB (in case "dB" is appended to the specified value)
  3118. or amplitude ratio. Default value is @code{0}.
  3119. @item stop_periods
  3120. Set the count for trimming silence from the end of audio.
  3121. To remove silence from the middle of a file, specify a @var{stop_periods}
  3122. that is negative. This value is then treated as a positive value and is
  3123. used to indicate the effect should restart processing as specified by
  3124. @var{start_periods}, making it suitable for removing periods of silence
  3125. in the middle of the audio.
  3126. Default value is @code{0}.
  3127. @item stop_duration
  3128. Specify a duration of silence that must exist before audio is not copied any
  3129. more. By specifying a higher duration, silence that is wanted can be left in
  3130. the audio.
  3131. Default value is @code{0}.
  3132. @item stop_threshold
  3133. This is the same as @option{start_threshold} but for trimming silence from
  3134. the end of audio.
  3135. Can be specified in dB (in case "dB" is appended to the specified value)
  3136. or amplitude ratio. Default value is @code{0}.
  3137. @item leave_silence
  3138. This indicates that @var{stop_duration} length of audio should be left intact
  3139. at the beginning of each period of silence.
  3140. For example, if you want to remove long pauses between words but do not want
  3141. to remove the pauses completely. Default value is @code{0}.
  3142. @item detection
  3143. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3144. and works better with digital silence which is exactly 0.
  3145. Default value is @code{rms}.
  3146. @item window
  3147. Set ratio used to calculate size of window for detecting silence.
  3148. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3149. @end table
  3150. @subsection Examples
  3151. @itemize
  3152. @item
  3153. The following example shows how this filter can be used to start a recording
  3154. that does not contain the delay at the start which usually occurs between
  3155. pressing the record button and the start of the performance:
  3156. @example
  3157. silenceremove=1:5:0.02
  3158. @end example
  3159. @item
  3160. Trim all silence encountered from beginning to end where there is more than 1
  3161. second of silence in audio:
  3162. @example
  3163. silenceremove=0:0:0:-1:1:-90dB
  3164. @end example
  3165. @end itemize
  3166. @section sofalizer
  3167. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3168. loudspeakers around the user for binaural listening via headphones (audio
  3169. formats up to 9 channels supported).
  3170. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3171. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3172. Austrian Academy of Sciences.
  3173. To enable compilation of this filter you need to configure FFmpeg with
  3174. @code{--enable-libmysofa}.
  3175. The filter accepts the following options:
  3176. @table @option
  3177. @item sofa
  3178. Set the SOFA file used for rendering.
  3179. @item gain
  3180. Set gain applied to audio. Value is in dB. Default is 0.
  3181. @item rotation
  3182. Set rotation of virtual loudspeakers in deg. Default is 0.
  3183. @item elevation
  3184. Set elevation of virtual speakers in deg. Default is 0.
  3185. @item radius
  3186. Set distance in meters between loudspeakers and the listener with near-field
  3187. HRTFs. Default is 1.
  3188. @item type
  3189. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3190. processing audio in time domain which is slow.
  3191. @var{freq} is processing audio in frequency domain which is fast.
  3192. Default is @var{freq}.
  3193. @item speakers
  3194. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3195. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3196. Each virtual loudspeaker is described with short channel name following with
  3197. azimuth and elevation in degrees.
  3198. Each virtual loudspeaker description is separated by '|'.
  3199. For example to override front left and front right channel positions use:
  3200. 'speakers=FL 45 15|FR 345 15'.
  3201. Descriptions with unrecognised channel names are ignored.
  3202. @item lfegain
  3203. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3204. @end table
  3205. @subsection Examples
  3206. @itemize
  3207. @item
  3208. Using ClubFritz6 sofa file:
  3209. @example
  3210. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3211. @end example
  3212. @item
  3213. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3214. @example
  3215. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3216. @end example
  3217. @item
  3218. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3219. and also with custom gain:
  3220. @example
  3221. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3222. @end example
  3223. @end itemize
  3224. @section stereotools
  3225. This filter has some handy utilities to manage stereo signals, for converting
  3226. M/S stereo recordings to L/R signal while having control over the parameters
  3227. or spreading the stereo image of master track.
  3228. The filter accepts the following options:
  3229. @table @option
  3230. @item level_in
  3231. Set input level before filtering for both channels. Defaults is 1.
  3232. Allowed range is from 0.015625 to 64.
  3233. @item level_out
  3234. Set output level after filtering for both channels. Defaults is 1.
  3235. Allowed range is from 0.015625 to 64.
  3236. @item balance_in
  3237. Set input balance between both channels. Default is 0.
  3238. Allowed range is from -1 to 1.
  3239. @item balance_out
  3240. Set output balance between both channels. Default is 0.
  3241. Allowed range is from -1 to 1.
  3242. @item softclip
  3243. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3244. clipping. Disabled by default.
  3245. @item mutel
  3246. Mute the left channel. Disabled by default.
  3247. @item muter
  3248. Mute the right channel. Disabled by default.
  3249. @item phasel
  3250. Change the phase of the left channel. Disabled by default.
  3251. @item phaser
  3252. Change the phase of the right channel. Disabled by default.
  3253. @item mode
  3254. Set stereo mode. Available values are:
  3255. @table @samp
  3256. @item lr>lr
  3257. Left/Right to Left/Right, this is default.
  3258. @item lr>ms
  3259. Left/Right to Mid/Side.
  3260. @item ms>lr
  3261. Mid/Side to Left/Right.
  3262. @item lr>ll
  3263. Left/Right to Left/Left.
  3264. @item lr>rr
  3265. Left/Right to Right/Right.
  3266. @item lr>l+r
  3267. Left/Right to Left + Right.
  3268. @item lr>rl
  3269. Left/Right to Right/Left.
  3270. @item ms>ll
  3271. Mid/Side to Left/Left.
  3272. @item ms>rr
  3273. Mid/Side to Right/Right.
  3274. @end table
  3275. @item slev
  3276. Set level of side signal. Default is 1.
  3277. Allowed range is from 0.015625 to 64.
  3278. @item sbal
  3279. Set balance of side signal. Default is 0.
  3280. Allowed range is from -1 to 1.
  3281. @item mlev
  3282. Set level of the middle signal. Default is 1.
  3283. Allowed range is from 0.015625 to 64.
  3284. @item mpan
  3285. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3286. @item base
  3287. Set stereo base between mono and inversed channels. Default is 0.
  3288. Allowed range is from -1 to 1.
  3289. @item delay
  3290. Set delay in milliseconds how much to delay left from right channel and
  3291. vice versa. Default is 0. Allowed range is from -20 to 20.
  3292. @item sclevel
  3293. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3294. @item phase
  3295. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3296. @item bmode_in, bmode_out
  3297. Set balance mode for balance_in/balance_out option.
  3298. Can be one of the following:
  3299. @table @samp
  3300. @item balance
  3301. Classic balance mode. Attenuate one channel at time.
  3302. Gain is raised up to 1.
  3303. @item amplitude
  3304. Similar as classic mode above but gain is raised up to 2.
  3305. @item power
  3306. Equal power distribution, from -6dB to +6dB range.
  3307. @end table
  3308. @end table
  3309. @subsection Examples
  3310. @itemize
  3311. @item
  3312. Apply karaoke like effect:
  3313. @example
  3314. stereotools=mlev=0.015625
  3315. @end example
  3316. @item
  3317. Convert M/S signal to L/R:
  3318. @example
  3319. "stereotools=mode=ms>lr"
  3320. @end example
  3321. @end itemize
  3322. @section stereowiden
  3323. This filter enhance the stereo effect by suppressing signal common to both
  3324. channels and by delaying the signal of left into right and vice versa,
  3325. thereby widening the stereo effect.
  3326. The filter accepts the following options:
  3327. @table @option
  3328. @item delay
  3329. Time in milliseconds of the delay of left signal into right and vice versa.
  3330. Default is 20 milliseconds.
  3331. @item feedback
  3332. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3333. effect of left signal in right output and vice versa which gives widening
  3334. effect. Default is 0.3.
  3335. @item crossfeed
  3336. Cross feed of left into right with inverted phase. This helps in suppressing
  3337. the mono. If the value is 1 it will cancel all the signal common to both
  3338. channels. Default is 0.3.
  3339. @item drymix
  3340. Set level of input signal of original channel. Default is 0.8.
  3341. @end table
  3342. @section superequalizer
  3343. Apply 18 band equalizer.
  3344. The filter accepts the following options:
  3345. @table @option
  3346. @item 1b
  3347. Set 65Hz band gain.
  3348. @item 2b
  3349. Set 92Hz band gain.
  3350. @item 3b
  3351. Set 131Hz band gain.
  3352. @item 4b
  3353. Set 185Hz band gain.
  3354. @item 5b
  3355. Set 262Hz band gain.
  3356. @item 6b
  3357. Set 370Hz band gain.
  3358. @item 7b
  3359. Set 523Hz band gain.
  3360. @item 8b
  3361. Set 740Hz band gain.
  3362. @item 9b
  3363. Set 1047Hz band gain.
  3364. @item 10b
  3365. Set 1480Hz band gain.
  3366. @item 11b
  3367. Set 2093Hz band gain.
  3368. @item 12b
  3369. Set 2960Hz band gain.
  3370. @item 13b
  3371. Set 4186Hz band gain.
  3372. @item 14b
  3373. Set 5920Hz band gain.
  3374. @item 15b
  3375. Set 8372Hz band gain.
  3376. @item 16b
  3377. Set 11840Hz band gain.
  3378. @item 17b
  3379. Set 16744Hz band gain.
  3380. @item 18b
  3381. Set 20000Hz band gain.
  3382. @end table
  3383. @section surround
  3384. Apply audio surround upmix filter.
  3385. This filter allows to produce multichannel output from audio stream.
  3386. The filter accepts the following options:
  3387. @table @option
  3388. @item chl_out
  3389. Set output channel layout. By default, this is @var{5.1}.
  3390. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3391. for the required syntax.
  3392. @item chl_in
  3393. Set input channel layout. By default, this is @var{stereo}.
  3394. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3395. for the required syntax.
  3396. @item level_in
  3397. Set input volume level. By default, this is @var{1}.
  3398. @item level_out
  3399. Set output volume level. By default, this is @var{1}.
  3400. @item lfe
  3401. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3402. @item lfe_low
  3403. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3404. @item lfe_high
  3405. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3406. @item fc_in
  3407. Set front center input volume. By default, this is @var{1}.
  3408. @item fc_out
  3409. Set front center output volume. By default, this is @var{1}.
  3410. @item lfe_in
  3411. Set LFE input volume. By default, this is @var{1}.
  3412. @item lfe_out
  3413. Set LFE output volume. By default, this is @var{1}.
  3414. @end table
  3415. @section treble
  3416. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3417. shelving filter with a response similar to that of a standard
  3418. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3419. The filter accepts the following options:
  3420. @table @option
  3421. @item gain, g
  3422. Give the gain at whichever is the lower of ~22 kHz and the
  3423. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3424. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3425. @item frequency, f
  3426. Set the filter's central frequency and so can be used
  3427. to extend or reduce the frequency range to be boosted or cut.
  3428. The default value is @code{3000} Hz.
  3429. @item width_type, t
  3430. Set method to specify band-width of filter.
  3431. @table @option
  3432. @item h
  3433. Hz
  3434. @item q
  3435. Q-Factor
  3436. @item o
  3437. octave
  3438. @item s
  3439. slope
  3440. @item k
  3441. kHz
  3442. @end table
  3443. @item width, w
  3444. Determine how steep is the filter's shelf transition.
  3445. @item channels, c
  3446. Specify which channels to filter, by default all available are filtered.
  3447. @end table
  3448. @subsection Commands
  3449. This filter supports the following commands:
  3450. @table @option
  3451. @item frequency, f
  3452. Change treble frequency.
  3453. Syntax for the command is : "@var{frequency}"
  3454. @item width_type, t
  3455. Change treble width_type.
  3456. Syntax for the command is : "@var{width_type}"
  3457. @item width, w
  3458. Change treble width.
  3459. Syntax for the command is : "@var{width}"
  3460. @item gain, g
  3461. Change treble gain.
  3462. Syntax for the command is : "@var{gain}"
  3463. @end table
  3464. @section tremolo
  3465. Sinusoidal amplitude modulation.
  3466. The filter accepts the following options:
  3467. @table @option
  3468. @item f
  3469. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3470. (20 Hz or lower) will result in a tremolo effect.
  3471. This filter may also be used as a ring modulator by specifying
  3472. a modulation frequency higher than 20 Hz.
  3473. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3474. @item d
  3475. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3476. Default value is 0.5.
  3477. @end table
  3478. @section vibrato
  3479. Sinusoidal phase modulation.
  3480. The filter accepts the following options:
  3481. @table @option
  3482. @item f
  3483. Modulation frequency in Hertz.
  3484. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3485. @item d
  3486. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3487. Default value is 0.5.
  3488. @end table
  3489. @section volume
  3490. Adjust the input audio volume.
  3491. It accepts the following parameters:
  3492. @table @option
  3493. @item volume
  3494. Set audio volume expression.
  3495. Output values are clipped to the maximum value.
  3496. The output audio volume is given by the relation:
  3497. @example
  3498. @var{output_volume} = @var{volume} * @var{input_volume}
  3499. @end example
  3500. The default value for @var{volume} is "1.0".
  3501. @item precision
  3502. This parameter represents the mathematical precision.
  3503. It determines which input sample formats will be allowed, which affects the
  3504. precision of the volume scaling.
  3505. @table @option
  3506. @item fixed
  3507. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3508. @item float
  3509. 32-bit floating-point; this limits input sample format to FLT. (default)
  3510. @item double
  3511. 64-bit floating-point; this limits input sample format to DBL.
  3512. @end table
  3513. @item replaygain
  3514. Choose the behaviour on encountering ReplayGain side data in input frames.
  3515. @table @option
  3516. @item drop
  3517. Remove ReplayGain side data, ignoring its contents (the default).
  3518. @item ignore
  3519. Ignore ReplayGain side data, but leave it in the frame.
  3520. @item track
  3521. Prefer the track gain, if present.
  3522. @item album
  3523. Prefer the album gain, if present.
  3524. @end table
  3525. @item replaygain_preamp
  3526. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3527. Default value for @var{replaygain_preamp} is 0.0.
  3528. @item eval
  3529. Set when the volume expression is evaluated.
  3530. It accepts the following values:
  3531. @table @samp
  3532. @item once
  3533. only evaluate expression once during the filter initialization, or
  3534. when the @samp{volume} command is sent
  3535. @item frame
  3536. evaluate expression for each incoming frame
  3537. @end table
  3538. Default value is @samp{once}.
  3539. @end table
  3540. The volume expression can contain the following parameters.
  3541. @table @option
  3542. @item n
  3543. frame number (starting at zero)
  3544. @item nb_channels
  3545. number of channels
  3546. @item nb_consumed_samples
  3547. number of samples consumed by the filter
  3548. @item nb_samples
  3549. number of samples in the current frame
  3550. @item pos
  3551. original frame position in the file
  3552. @item pts
  3553. frame PTS
  3554. @item sample_rate
  3555. sample rate
  3556. @item startpts
  3557. PTS at start of stream
  3558. @item startt
  3559. time at start of stream
  3560. @item t
  3561. frame time
  3562. @item tb
  3563. timestamp timebase
  3564. @item volume
  3565. last set volume value
  3566. @end table
  3567. Note that when @option{eval} is set to @samp{once} only the
  3568. @var{sample_rate} and @var{tb} variables are available, all other
  3569. variables will evaluate to NAN.
  3570. @subsection Commands
  3571. This filter supports the following commands:
  3572. @table @option
  3573. @item volume
  3574. Modify the volume expression.
  3575. The command accepts the same syntax of the corresponding option.
  3576. If the specified expression is not valid, it is kept at its current
  3577. value.
  3578. @item replaygain_noclip
  3579. Prevent clipping by limiting the gain applied.
  3580. Default value for @var{replaygain_noclip} is 1.
  3581. @end table
  3582. @subsection Examples
  3583. @itemize
  3584. @item
  3585. Halve the input audio volume:
  3586. @example
  3587. volume=volume=0.5
  3588. volume=volume=1/2
  3589. volume=volume=-6.0206dB
  3590. @end example
  3591. In all the above example the named key for @option{volume} can be
  3592. omitted, for example like in:
  3593. @example
  3594. volume=0.5
  3595. @end example
  3596. @item
  3597. Increase input audio power by 6 decibels using fixed-point precision:
  3598. @example
  3599. volume=volume=6dB:precision=fixed
  3600. @end example
  3601. @item
  3602. Fade volume after time 10 with an annihilation period of 5 seconds:
  3603. @example
  3604. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3605. @end example
  3606. @end itemize
  3607. @section volumedetect
  3608. Detect the volume of the input video.
  3609. The filter has no parameters. The input is not modified. Statistics about
  3610. the volume will be printed in the log when the input stream end is reached.
  3611. In particular it will show the mean volume (root mean square), maximum
  3612. volume (on a per-sample basis), and the beginning of a histogram of the
  3613. registered volume values (from the maximum value to a cumulated 1/1000 of
  3614. the samples).
  3615. All volumes are in decibels relative to the maximum PCM value.
  3616. @subsection Examples
  3617. Here is an excerpt of the output:
  3618. @example
  3619. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3620. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3621. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3622. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3623. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3624. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3625. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3626. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3627. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3628. @end example
  3629. It means that:
  3630. @itemize
  3631. @item
  3632. The mean square energy is approximately -27 dB, or 10^-2.7.
  3633. @item
  3634. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3635. @item
  3636. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3637. @end itemize
  3638. In other words, raising the volume by +4 dB does not cause any clipping,
  3639. raising it by +5 dB causes clipping for 6 samples, etc.
  3640. @c man end AUDIO FILTERS
  3641. @chapter Audio Sources
  3642. @c man begin AUDIO SOURCES
  3643. Below is a description of the currently available audio sources.
  3644. @section abuffer
  3645. Buffer audio frames, and make them available to the filter chain.
  3646. This source is mainly intended for a programmatic use, in particular
  3647. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3648. It accepts the following parameters:
  3649. @table @option
  3650. @item time_base
  3651. The timebase which will be used for timestamps of submitted frames. It must be
  3652. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3653. @item sample_rate
  3654. The sample rate of the incoming audio buffers.
  3655. @item sample_fmt
  3656. The sample format of the incoming audio buffers.
  3657. Either a sample format name or its corresponding integer representation from
  3658. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3659. @item channel_layout
  3660. The channel layout of the incoming audio buffers.
  3661. Either a channel layout name from channel_layout_map in
  3662. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3663. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3664. @item channels
  3665. The number of channels of the incoming audio buffers.
  3666. If both @var{channels} and @var{channel_layout} are specified, then they
  3667. must be consistent.
  3668. @end table
  3669. @subsection Examples
  3670. @example
  3671. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3672. @end example
  3673. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3674. Since the sample format with name "s16p" corresponds to the number
  3675. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3676. equivalent to:
  3677. @example
  3678. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3679. @end example
  3680. @section aevalsrc
  3681. Generate an audio signal specified by an expression.
  3682. This source accepts in input one or more expressions (one for each
  3683. channel), which are evaluated and used to generate a corresponding
  3684. audio signal.
  3685. This source accepts the following options:
  3686. @table @option
  3687. @item exprs
  3688. Set the '|'-separated expressions list for each separate channel. In case the
  3689. @option{channel_layout} option is not specified, the selected channel layout
  3690. depends on the number of provided expressions. Otherwise the last
  3691. specified expression is applied to the remaining output channels.
  3692. @item channel_layout, c
  3693. Set the channel layout. The number of channels in the specified layout
  3694. must be equal to the number of specified expressions.
  3695. @item duration, d
  3696. Set the minimum duration of the sourced audio. See
  3697. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3698. for the accepted syntax.
  3699. Note that the resulting duration may be greater than the specified
  3700. duration, as the generated audio is always cut at the end of a
  3701. complete frame.
  3702. If not specified, or the expressed duration is negative, the audio is
  3703. supposed to be generated forever.
  3704. @item nb_samples, n
  3705. Set the number of samples per channel per each output frame,
  3706. default to 1024.
  3707. @item sample_rate, s
  3708. Specify the sample rate, default to 44100.
  3709. @end table
  3710. Each expression in @var{exprs} can contain the following constants:
  3711. @table @option
  3712. @item n
  3713. number of the evaluated sample, starting from 0
  3714. @item t
  3715. time of the evaluated sample expressed in seconds, starting from 0
  3716. @item s
  3717. sample rate
  3718. @end table
  3719. @subsection Examples
  3720. @itemize
  3721. @item
  3722. Generate silence:
  3723. @example
  3724. aevalsrc=0
  3725. @end example
  3726. @item
  3727. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3728. 8000 Hz:
  3729. @example
  3730. aevalsrc="sin(440*2*PI*t):s=8000"
  3731. @end example
  3732. @item
  3733. Generate a two channels signal, specify the channel layout (Front
  3734. Center + Back Center) explicitly:
  3735. @example
  3736. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3737. @end example
  3738. @item
  3739. Generate white noise:
  3740. @example
  3741. aevalsrc="-2+random(0)"
  3742. @end example
  3743. @item
  3744. Generate an amplitude modulated signal:
  3745. @example
  3746. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3747. @end example
  3748. @item
  3749. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3750. @example
  3751. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3752. @end example
  3753. @end itemize
  3754. @section anullsrc
  3755. The null audio source, return unprocessed audio frames. It is mainly useful
  3756. as a template and to be employed in analysis / debugging tools, or as
  3757. the source for filters which ignore the input data (for example the sox
  3758. synth filter).
  3759. This source accepts the following options:
  3760. @table @option
  3761. @item channel_layout, cl
  3762. Specifies the channel layout, and can be either an integer or a string
  3763. representing a channel layout. The default value of @var{channel_layout}
  3764. is "stereo".
  3765. Check the channel_layout_map definition in
  3766. @file{libavutil/channel_layout.c} for the mapping between strings and
  3767. channel layout values.
  3768. @item sample_rate, r
  3769. Specifies the sample rate, and defaults to 44100.
  3770. @item nb_samples, n
  3771. Set the number of samples per requested frames.
  3772. @end table
  3773. @subsection Examples
  3774. @itemize
  3775. @item
  3776. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3777. @example
  3778. anullsrc=r=48000:cl=4
  3779. @end example
  3780. @item
  3781. Do the same operation with a more obvious syntax:
  3782. @example
  3783. anullsrc=r=48000:cl=mono
  3784. @end example
  3785. @end itemize
  3786. All the parameters need to be explicitly defined.
  3787. @section flite
  3788. Synthesize a voice utterance using the libflite library.
  3789. To enable compilation of this filter you need to configure FFmpeg with
  3790. @code{--enable-libflite}.
  3791. Note that versions of the flite library prior to 2.0 are not thread-safe.
  3792. The filter accepts the following options:
  3793. @table @option
  3794. @item list_voices
  3795. If set to 1, list the names of the available voices and exit
  3796. immediately. Default value is 0.
  3797. @item nb_samples, n
  3798. Set the maximum number of samples per frame. Default value is 512.
  3799. @item textfile
  3800. Set the filename containing the text to speak.
  3801. @item text
  3802. Set the text to speak.
  3803. @item voice, v
  3804. Set the voice to use for the speech synthesis. Default value is
  3805. @code{kal}. See also the @var{list_voices} option.
  3806. @end table
  3807. @subsection Examples
  3808. @itemize
  3809. @item
  3810. Read from file @file{speech.txt}, and synthesize the text using the
  3811. standard flite voice:
  3812. @example
  3813. flite=textfile=speech.txt
  3814. @end example
  3815. @item
  3816. Read the specified text selecting the @code{slt} voice:
  3817. @example
  3818. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3819. @end example
  3820. @item
  3821. Input text to ffmpeg:
  3822. @example
  3823. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3824. @end example
  3825. @item
  3826. Make @file{ffplay} speak the specified text, using @code{flite} and
  3827. the @code{lavfi} device:
  3828. @example
  3829. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3830. @end example
  3831. @end itemize
  3832. For more information about libflite, check:
  3833. @url{http://www.festvox.org/flite/}
  3834. @section anoisesrc
  3835. Generate a noise audio signal.
  3836. The filter accepts the following options:
  3837. @table @option
  3838. @item sample_rate, r
  3839. Specify the sample rate. Default value is 48000 Hz.
  3840. @item amplitude, a
  3841. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3842. is 1.0.
  3843. @item duration, d
  3844. Specify the duration of the generated audio stream. Not specifying this option
  3845. results in noise with an infinite length.
  3846. @item color, colour, c
  3847. Specify the color of noise. Available noise colors are white, pink, brown,
  3848. blue and violet. Default color is white.
  3849. @item seed, s
  3850. Specify a value used to seed the PRNG.
  3851. @item nb_samples, n
  3852. Set the number of samples per each output frame, default is 1024.
  3853. @end table
  3854. @subsection Examples
  3855. @itemize
  3856. @item
  3857. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3858. @example
  3859. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3860. @end example
  3861. @end itemize
  3862. @section hilbert
  3863. Generate odd-tap Hilbert transform FIR coefficients.
  3864. The resulting stream can be used with @ref{afir} filter for phase-shifting
  3865. the signal by 90 degrees.
  3866. This is used in many matrix coding schemes and for analytic signal generation.
  3867. The process is often written as a multiplication by i (or j), the imaginary unit.
  3868. The filter accepts the following options:
  3869. @table @option
  3870. @item sample_rate, s
  3871. Set sample rate, default is 44100.
  3872. @item taps, t
  3873. Set length of FIR filter, default is 22051.
  3874. @item nb_samples, n
  3875. Set number of samples per each frame.
  3876. @item win_func, w
  3877. Set window function to be used when generating FIR coefficients.
  3878. @end table
  3879. @section sine
  3880. Generate an audio signal made of a sine wave with amplitude 1/8.
  3881. The audio signal is bit-exact.
  3882. The filter accepts the following options:
  3883. @table @option
  3884. @item frequency, f
  3885. Set the carrier frequency. Default is 440 Hz.
  3886. @item beep_factor, b
  3887. Enable a periodic beep every second with frequency @var{beep_factor} times
  3888. the carrier frequency. Default is 0, meaning the beep is disabled.
  3889. @item sample_rate, r
  3890. Specify the sample rate, default is 44100.
  3891. @item duration, d
  3892. Specify the duration of the generated audio stream.
  3893. @item samples_per_frame
  3894. Set the number of samples per output frame.
  3895. The expression can contain the following constants:
  3896. @table @option
  3897. @item n
  3898. The (sequential) number of the output audio frame, starting from 0.
  3899. @item pts
  3900. The PTS (Presentation TimeStamp) of the output audio frame,
  3901. expressed in @var{TB} units.
  3902. @item t
  3903. The PTS of the output audio frame, expressed in seconds.
  3904. @item TB
  3905. The timebase of the output audio frames.
  3906. @end table
  3907. Default is @code{1024}.
  3908. @end table
  3909. @subsection Examples
  3910. @itemize
  3911. @item
  3912. Generate a simple 440 Hz sine wave:
  3913. @example
  3914. sine
  3915. @end example
  3916. @item
  3917. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3918. @example
  3919. sine=220:4:d=5
  3920. sine=f=220:b=4:d=5
  3921. sine=frequency=220:beep_factor=4:duration=5
  3922. @end example
  3923. @item
  3924. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3925. pattern:
  3926. @example
  3927. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3928. @end example
  3929. @end itemize
  3930. @c man end AUDIO SOURCES
  3931. @chapter Audio Sinks
  3932. @c man begin AUDIO SINKS
  3933. Below is a description of the currently available audio sinks.
  3934. @section abuffersink
  3935. Buffer audio frames, and make them available to the end of filter chain.
  3936. This sink is mainly intended for programmatic use, in particular
  3937. through the interface defined in @file{libavfilter/buffersink.h}
  3938. or the options system.
  3939. It accepts a pointer to an AVABufferSinkContext structure, which
  3940. defines the incoming buffers' formats, to be passed as the opaque
  3941. parameter to @code{avfilter_init_filter} for initialization.
  3942. @section anullsink
  3943. Null audio sink; do absolutely nothing with the input audio. It is
  3944. mainly useful as a template and for use in analysis / debugging
  3945. tools.
  3946. @c man end AUDIO SINKS
  3947. @chapter Video Filters
  3948. @c man begin VIDEO FILTERS
  3949. When you configure your FFmpeg build, you can disable any of the
  3950. existing filters using @code{--disable-filters}.
  3951. The configure output will show the video filters included in your
  3952. build.
  3953. Below is a description of the currently available video filters.
  3954. @section alphaextract
  3955. Extract the alpha component from the input as a grayscale video. This
  3956. is especially useful with the @var{alphamerge} filter.
  3957. @section alphamerge
  3958. Add or replace the alpha component of the primary input with the
  3959. grayscale value of a second input. This is intended for use with
  3960. @var{alphaextract} to allow the transmission or storage of frame
  3961. sequences that have alpha in a format that doesn't support an alpha
  3962. channel.
  3963. For example, to reconstruct full frames from a normal YUV-encoded video
  3964. and a separate video created with @var{alphaextract}, you might use:
  3965. @example
  3966. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3967. @end example
  3968. Since this filter is designed for reconstruction, it operates on frame
  3969. sequences without considering timestamps, and terminates when either
  3970. input reaches end of stream. This will cause problems if your encoding
  3971. pipeline drops frames. If you're trying to apply an image as an
  3972. overlay to a video stream, consider the @var{overlay} filter instead.
  3973. @section ass
  3974. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3975. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3976. Substation Alpha) subtitles files.
  3977. This filter accepts the following option in addition to the common options from
  3978. the @ref{subtitles} filter:
  3979. @table @option
  3980. @item shaping
  3981. Set the shaping engine
  3982. Available values are:
  3983. @table @samp
  3984. @item auto
  3985. The default libass shaping engine, which is the best available.
  3986. @item simple
  3987. Fast, font-agnostic shaper that can do only substitutions
  3988. @item complex
  3989. Slower shaper using OpenType for substitutions and positioning
  3990. @end table
  3991. The default is @code{auto}.
  3992. @end table
  3993. @section atadenoise
  3994. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3995. The filter accepts the following options:
  3996. @table @option
  3997. @item 0a
  3998. Set threshold A for 1st plane. Default is 0.02.
  3999. Valid range is 0 to 0.3.
  4000. @item 0b
  4001. Set threshold B for 1st plane. Default is 0.04.
  4002. Valid range is 0 to 5.
  4003. @item 1a
  4004. Set threshold A for 2nd plane. Default is 0.02.
  4005. Valid range is 0 to 0.3.
  4006. @item 1b
  4007. Set threshold B for 2nd plane. Default is 0.04.
  4008. Valid range is 0 to 5.
  4009. @item 2a
  4010. Set threshold A for 3rd plane. Default is 0.02.
  4011. Valid range is 0 to 0.3.
  4012. @item 2b
  4013. Set threshold B for 3rd plane. Default is 0.04.
  4014. Valid range is 0 to 5.
  4015. Threshold A is designed to react on abrupt changes in the input signal and
  4016. threshold B is designed to react on continuous changes in the input signal.
  4017. @item s
  4018. Set number of frames filter will use for averaging. Default is 33. Must be odd
  4019. number in range [5, 129].
  4020. @item p
  4021. Set what planes of frame filter will use for averaging. Default is all.
  4022. @end table
  4023. @section avgblur
  4024. Apply average blur filter.
  4025. The filter accepts the following options:
  4026. @table @option
  4027. @item sizeX
  4028. Set horizontal kernel size.
  4029. @item planes
  4030. Set which planes to filter. By default all planes are filtered.
  4031. @item sizeY
  4032. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  4033. Default is @code{0}.
  4034. @end table
  4035. @section bbox
  4036. Compute the bounding box for the non-black pixels in the input frame
  4037. luminance plane.
  4038. This filter computes the bounding box containing all the pixels with a
  4039. luminance value greater than the minimum allowed value.
  4040. The parameters describing the bounding box are printed on the filter
  4041. log.
  4042. The filter accepts the following option:
  4043. @table @option
  4044. @item min_val
  4045. Set the minimal luminance value. Default is @code{16}.
  4046. @end table
  4047. @section bitplanenoise
  4048. Show and measure bit plane noise.
  4049. The filter accepts the following options:
  4050. @table @option
  4051. @item bitplane
  4052. Set which plane to analyze. Default is @code{1}.
  4053. @item filter
  4054. Filter out noisy pixels from @code{bitplane} set above.
  4055. Default is disabled.
  4056. @end table
  4057. @section blackdetect
  4058. Detect video intervals that are (almost) completely black. Can be
  4059. useful to detect chapter transitions, commercials, or invalid
  4060. recordings. Output lines contains the time for the start, end and
  4061. duration of the detected black interval expressed in seconds.
  4062. In order to display the output lines, you need to set the loglevel at
  4063. least to the AV_LOG_INFO value.
  4064. The filter accepts the following options:
  4065. @table @option
  4066. @item black_min_duration, d
  4067. Set the minimum detected black duration expressed in seconds. It must
  4068. be a non-negative floating point number.
  4069. Default value is 2.0.
  4070. @item picture_black_ratio_th, pic_th
  4071. Set the threshold for considering a picture "black".
  4072. Express the minimum value for the ratio:
  4073. @example
  4074. @var{nb_black_pixels} / @var{nb_pixels}
  4075. @end example
  4076. for which a picture is considered black.
  4077. Default value is 0.98.
  4078. @item pixel_black_th, pix_th
  4079. Set the threshold for considering a pixel "black".
  4080. The threshold expresses the maximum pixel luminance value for which a
  4081. pixel is considered "black". The provided value is scaled according to
  4082. the following equation:
  4083. @example
  4084. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4085. @end example
  4086. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4087. the input video format, the range is [0-255] for YUV full-range
  4088. formats and [16-235] for YUV non full-range formats.
  4089. Default value is 0.10.
  4090. @end table
  4091. The following example sets the maximum pixel threshold to the minimum
  4092. value, and detects only black intervals of 2 or more seconds:
  4093. @example
  4094. blackdetect=d=2:pix_th=0.00
  4095. @end example
  4096. @section blackframe
  4097. Detect frames that are (almost) completely black. Can be useful to
  4098. detect chapter transitions or commercials. Output lines consist of
  4099. the frame number of the detected frame, the percentage of blackness,
  4100. the position in the file if known or -1 and the timestamp in seconds.
  4101. In order to display the output lines, you need to set the loglevel at
  4102. least to the AV_LOG_INFO value.
  4103. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4104. The value represents the percentage of pixels in the picture that
  4105. are below the threshold value.
  4106. It accepts the following parameters:
  4107. @table @option
  4108. @item amount
  4109. The percentage of the pixels that have to be below the threshold; it defaults to
  4110. @code{98}.
  4111. @item threshold, thresh
  4112. The threshold below which a pixel value is considered black; it defaults to
  4113. @code{32}.
  4114. @end table
  4115. @section blend, tblend
  4116. Blend two video frames into each other.
  4117. The @code{blend} filter takes two input streams and outputs one
  4118. stream, the first input is the "top" layer and second input is
  4119. "bottom" layer. By default, the output terminates when the longest input terminates.
  4120. The @code{tblend} (time blend) filter takes two consecutive frames
  4121. from one single stream, and outputs the result obtained by blending
  4122. the new frame on top of the old frame.
  4123. A description of the accepted options follows.
  4124. @table @option
  4125. @item c0_mode
  4126. @item c1_mode
  4127. @item c2_mode
  4128. @item c3_mode
  4129. @item all_mode
  4130. Set blend mode for specific pixel component or all pixel components in case
  4131. of @var{all_mode}. Default value is @code{normal}.
  4132. Available values for component modes are:
  4133. @table @samp
  4134. @item addition
  4135. @item grainmerge
  4136. @item and
  4137. @item average
  4138. @item burn
  4139. @item darken
  4140. @item difference
  4141. @item grainextract
  4142. @item divide
  4143. @item dodge
  4144. @item freeze
  4145. @item exclusion
  4146. @item extremity
  4147. @item glow
  4148. @item hardlight
  4149. @item hardmix
  4150. @item heat
  4151. @item lighten
  4152. @item linearlight
  4153. @item multiply
  4154. @item multiply128
  4155. @item negation
  4156. @item normal
  4157. @item or
  4158. @item overlay
  4159. @item phoenix
  4160. @item pinlight
  4161. @item reflect
  4162. @item screen
  4163. @item softlight
  4164. @item subtract
  4165. @item vividlight
  4166. @item xor
  4167. @end table
  4168. @item c0_opacity
  4169. @item c1_opacity
  4170. @item c2_opacity
  4171. @item c3_opacity
  4172. @item all_opacity
  4173. Set blend opacity for specific pixel component or all pixel components in case
  4174. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4175. @item c0_expr
  4176. @item c1_expr
  4177. @item c2_expr
  4178. @item c3_expr
  4179. @item all_expr
  4180. Set blend expression for specific pixel component or all pixel components in case
  4181. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4182. The expressions can use the following variables:
  4183. @table @option
  4184. @item N
  4185. The sequential number of the filtered frame, starting from @code{0}.
  4186. @item X
  4187. @item Y
  4188. the coordinates of the current sample
  4189. @item W
  4190. @item H
  4191. the width and height of currently filtered plane
  4192. @item SW
  4193. @item SH
  4194. Width and height scale depending on the currently filtered plane. It is the
  4195. ratio between the corresponding luma plane number of pixels and the current
  4196. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  4197. @code{0.5,0.5} for chroma planes.
  4198. @item T
  4199. Time of the current frame, expressed in seconds.
  4200. @item TOP, A
  4201. Value of pixel component at current location for first video frame (top layer).
  4202. @item BOTTOM, B
  4203. Value of pixel component at current location for second video frame (bottom layer).
  4204. @end table
  4205. @end table
  4206. The @code{blend} filter also supports the @ref{framesync} options.
  4207. @subsection Examples
  4208. @itemize
  4209. @item
  4210. Apply transition from bottom layer to top layer in first 10 seconds:
  4211. @example
  4212. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4213. @end example
  4214. @item
  4215. Apply linear horizontal transition from top layer to bottom layer:
  4216. @example
  4217. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4218. @end example
  4219. @item
  4220. Apply 1x1 checkerboard effect:
  4221. @example
  4222. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4223. @end example
  4224. @item
  4225. Apply uncover left effect:
  4226. @example
  4227. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4228. @end example
  4229. @item
  4230. Apply uncover down effect:
  4231. @example
  4232. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4233. @end example
  4234. @item
  4235. Apply uncover up-left effect:
  4236. @example
  4237. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4238. @end example
  4239. @item
  4240. Split diagonally video and shows top and bottom layer on each side:
  4241. @example
  4242. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4243. @end example
  4244. @item
  4245. Display differences between the current and the previous frame:
  4246. @example
  4247. tblend=all_mode=grainextract
  4248. @end example
  4249. @end itemize
  4250. @section boxblur
  4251. Apply a boxblur algorithm to the input video.
  4252. It accepts the following parameters:
  4253. @table @option
  4254. @item luma_radius, lr
  4255. @item luma_power, lp
  4256. @item chroma_radius, cr
  4257. @item chroma_power, cp
  4258. @item alpha_radius, ar
  4259. @item alpha_power, ap
  4260. @end table
  4261. A description of the accepted options follows.
  4262. @table @option
  4263. @item luma_radius, lr
  4264. @item chroma_radius, cr
  4265. @item alpha_radius, ar
  4266. Set an expression for the box radius in pixels used for blurring the
  4267. corresponding input plane.
  4268. The radius value must be a non-negative number, and must not be
  4269. greater than the value of the expression @code{min(w,h)/2} for the
  4270. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4271. planes.
  4272. Default value for @option{luma_radius} is "2". If not specified,
  4273. @option{chroma_radius} and @option{alpha_radius} default to the
  4274. corresponding value set for @option{luma_radius}.
  4275. The expressions can contain the following constants:
  4276. @table @option
  4277. @item w
  4278. @item h
  4279. The input width and height in pixels.
  4280. @item cw
  4281. @item ch
  4282. The input chroma image width and height in pixels.
  4283. @item hsub
  4284. @item vsub
  4285. The horizontal and vertical chroma subsample values. For example, for the
  4286. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4287. @end table
  4288. @item luma_power, lp
  4289. @item chroma_power, cp
  4290. @item alpha_power, ap
  4291. Specify how many times the boxblur filter is applied to the
  4292. corresponding plane.
  4293. Default value for @option{luma_power} is 2. If not specified,
  4294. @option{chroma_power} and @option{alpha_power} default to the
  4295. corresponding value set for @option{luma_power}.
  4296. A value of 0 will disable the effect.
  4297. @end table
  4298. @subsection Examples
  4299. @itemize
  4300. @item
  4301. Apply a boxblur filter with the luma, chroma, and alpha radii
  4302. set to 2:
  4303. @example
  4304. boxblur=luma_radius=2:luma_power=1
  4305. boxblur=2:1
  4306. @end example
  4307. @item
  4308. Set the luma radius to 2, and alpha and chroma radius to 0:
  4309. @example
  4310. boxblur=2:1:cr=0:ar=0
  4311. @end example
  4312. @item
  4313. Set the luma and chroma radii to a fraction of the video dimension:
  4314. @example
  4315. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4316. @end example
  4317. @end itemize
  4318. @section bwdif
  4319. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4320. Deinterlacing Filter").
  4321. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4322. interpolation algorithms.
  4323. It accepts the following parameters:
  4324. @table @option
  4325. @item mode
  4326. The interlacing mode to adopt. It accepts one of the following values:
  4327. @table @option
  4328. @item 0, send_frame
  4329. Output one frame for each frame.
  4330. @item 1, send_field
  4331. Output one frame for each field.
  4332. @end table
  4333. The default value is @code{send_field}.
  4334. @item parity
  4335. The picture field parity assumed for the input interlaced video. It accepts one
  4336. of the following values:
  4337. @table @option
  4338. @item 0, tff
  4339. Assume the top field is first.
  4340. @item 1, bff
  4341. Assume the bottom field is first.
  4342. @item -1, auto
  4343. Enable automatic detection of field parity.
  4344. @end table
  4345. The default value is @code{auto}.
  4346. If the interlacing is unknown or the decoder does not export this information,
  4347. top field first will be assumed.
  4348. @item deint
  4349. Specify which frames to deinterlace. Accept one of the following
  4350. values:
  4351. @table @option
  4352. @item 0, all
  4353. Deinterlace all frames.
  4354. @item 1, interlaced
  4355. Only deinterlace frames marked as interlaced.
  4356. @end table
  4357. The default value is @code{all}.
  4358. @end table
  4359. @section chromakey
  4360. YUV colorspace color/chroma keying.
  4361. The filter accepts the following options:
  4362. @table @option
  4363. @item color
  4364. The color which will be replaced with transparency.
  4365. @item similarity
  4366. Similarity percentage with the key color.
  4367. 0.01 matches only the exact key color, while 1.0 matches everything.
  4368. @item blend
  4369. Blend percentage.
  4370. 0.0 makes pixels either fully transparent, or not transparent at all.
  4371. Higher values result in semi-transparent pixels, with a higher transparency
  4372. the more similar the pixels color is to the key color.
  4373. @item yuv
  4374. Signals that the color passed is already in YUV instead of RGB.
  4375. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4376. This can be used to pass exact YUV values as hexadecimal numbers.
  4377. @end table
  4378. @subsection Examples
  4379. @itemize
  4380. @item
  4381. Make every green pixel in the input image transparent:
  4382. @example
  4383. ffmpeg -i input.png -vf chromakey=green out.png
  4384. @end example
  4385. @item
  4386. Overlay a greenscreen-video on top of a static black background.
  4387. @example
  4388. ffmpeg -f lavfi -i color=c=black:s=1280x720 -i video.mp4 -shortest -filter_complex "[1:v]chromakey=0x70de77:0.1:0.2[ckout];[0:v][ckout]overlay[out]" -map "[out]" output.mkv
  4389. @end example
  4390. @end itemize
  4391. @section ciescope
  4392. Display CIE color diagram with pixels overlaid onto it.
  4393. The filter accepts the following options:
  4394. @table @option
  4395. @item system
  4396. Set color system.
  4397. @table @samp
  4398. @item ntsc, 470m
  4399. @item ebu, 470bg
  4400. @item smpte
  4401. @item 240m
  4402. @item apple
  4403. @item widergb
  4404. @item cie1931
  4405. @item rec709, hdtv
  4406. @item uhdtv, rec2020
  4407. @end table
  4408. @item cie
  4409. Set CIE system.
  4410. @table @samp
  4411. @item xyy
  4412. @item ucs
  4413. @item luv
  4414. @end table
  4415. @item gamuts
  4416. Set what gamuts to draw.
  4417. See @code{system} option for available values.
  4418. @item size, s
  4419. Set ciescope size, by default set to 512.
  4420. @item intensity, i
  4421. Set intensity used to map input pixel values to CIE diagram.
  4422. @item contrast
  4423. Set contrast used to draw tongue colors that are out of active color system gamut.
  4424. @item corrgamma
  4425. Correct gamma displayed on scope, by default enabled.
  4426. @item showwhite
  4427. Show white point on CIE diagram, by default disabled.
  4428. @item gamma
  4429. Set input gamma. Used only with XYZ input color space.
  4430. @end table
  4431. @section codecview
  4432. Visualize information exported by some codecs.
  4433. Some codecs can export information through frames using side-data or other
  4434. means. For example, some MPEG based codecs export motion vectors through the
  4435. @var{export_mvs} flag in the codec @option{flags2} option.
  4436. The filter accepts the following option:
  4437. @table @option
  4438. @item mv
  4439. Set motion vectors to visualize.
  4440. Available flags for @var{mv} are:
  4441. @table @samp
  4442. @item pf
  4443. forward predicted MVs of P-frames
  4444. @item bf
  4445. forward predicted MVs of B-frames
  4446. @item bb
  4447. backward predicted MVs of B-frames
  4448. @end table
  4449. @item qp
  4450. Display quantization parameters using the chroma planes.
  4451. @item mv_type, mvt
  4452. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4453. Available flags for @var{mv_type} are:
  4454. @table @samp
  4455. @item fp
  4456. forward predicted MVs
  4457. @item bp
  4458. backward predicted MVs
  4459. @end table
  4460. @item frame_type, ft
  4461. Set frame type to visualize motion vectors of.
  4462. Available flags for @var{frame_type} are:
  4463. @table @samp
  4464. @item if
  4465. intra-coded frames (I-frames)
  4466. @item pf
  4467. predicted frames (P-frames)
  4468. @item bf
  4469. bi-directionally predicted frames (B-frames)
  4470. @end table
  4471. @end table
  4472. @subsection Examples
  4473. @itemize
  4474. @item
  4475. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4476. @example
  4477. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4478. @end example
  4479. @item
  4480. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4481. @example
  4482. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4483. @end example
  4484. @end itemize
  4485. @section colorbalance
  4486. Modify intensity of primary colors (red, green and blue) of input frames.
  4487. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4488. regions for the red-cyan, green-magenta or blue-yellow balance.
  4489. A positive adjustment value shifts the balance towards the primary color, a negative
  4490. value towards the complementary color.
  4491. The filter accepts the following options:
  4492. @table @option
  4493. @item rs
  4494. @item gs
  4495. @item bs
  4496. Adjust red, green and blue shadows (darkest pixels).
  4497. @item rm
  4498. @item gm
  4499. @item bm
  4500. Adjust red, green and blue midtones (medium pixels).
  4501. @item rh
  4502. @item gh
  4503. @item bh
  4504. Adjust red, green and blue highlights (brightest pixels).
  4505. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4506. @end table
  4507. @subsection Examples
  4508. @itemize
  4509. @item
  4510. Add red color cast to shadows:
  4511. @example
  4512. colorbalance=rs=.3
  4513. @end example
  4514. @end itemize
  4515. @section colorkey
  4516. RGB colorspace color keying.
  4517. The filter accepts the following options:
  4518. @table @option
  4519. @item color
  4520. The color which will be replaced with transparency.
  4521. @item similarity
  4522. Similarity percentage with the key color.
  4523. 0.01 matches only the exact key color, while 1.0 matches everything.
  4524. @item blend
  4525. Blend percentage.
  4526. 0.0 makes pixels either fully transparent, or not transparent at all.
  4527. Higher values result in semi-transparent pixels, with a higher transparency
  4528. the more similar the pixels color is to the key color.
  4529. @end table
  4530. @subsection Examples
  4531. @itemize
  4532. @item
  4533. Make every green pixel in the input image transparent:
  4534. @example
  4535. ffmpeg -i input.png -vf colorkey=green out.png
  4536. @end example
  4537. @item
  4538. Overlay a greenscreen-video on top of a static background image.
  4539. @example
  4540. ffmpeg -i background.png -i video.mp4 -filter_complex "[1:v]colorkey=0x3BBD1E:0.3:0.2[ckout];[0:v][ckout]overlay[out]" -map "[out]" output.flv
  4541. @end example
  4542. @end itemize
  4543. @section colorlevels
  4544. Adjust video input frames using levels.
  4545. The filter accepts the following options:
  4546. @table @option
  4547. @item rimin
  4548. @item gimin
  4549. @item bimin
  4550. @item aimin
  4551. Adjust red, green, blue and alpha input black point.
  4552. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4553. @item rimax
  4554. @item gimax
  4555. @item bimax
  4556. @item aimax
  4557. Adjust red, green, blue and alpha input white point.
  4558. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  4559. Input levels are used to lighten highlights (bright tones), darken shadows
  4560. (dark tones), change the balance of bright and dark tones.
  4561. @item romin
  4562. @item gomin
  4563. @item bomin
  4564. @item aomin
  4565. Adjust red, green, blue and alpha output black point.
  4566. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  4567. @item romax
  4568. @item gomax
  4569. @item bomax
  4570. @item aomax
  4571. Adjust red, green, blue and alpha output white point.
  4572. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  4573. Output levels allows manual selection of a constrained output level range.
  4574. @end table
  4575. @subsection Examples
  4576. @itemize
  4577. @item
  4578. Make video output darker:
  4579. @example
  4580. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4581. @end example
  4582. @item
  4583. Increase contrast:
  4584. @example
  4585. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4586. @end example
  4587. @item
  4588. Make video output lighter:
  4589. @example
  4590. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4591. @end example
  4592. @item
  4593. Increase brightness:
  4594. @example
  4595. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4596. @end example
  4597. @end itemize
  4598. @section colorchannelmixer
  4599. Adjust video input frames by re-mixing color channels.
  4600. This filter modifies a color channel by adding the values associated to
  4601. the other channels of the same pixels. For example if the value to
  4602. modify is red, the output value will be:
  4603. @example
  4604. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4605. @end example
  4606. The filter accepts the following options:
  4607. @table @option
  4608. @item rr
  4609. @item rg
  4610. @item rb
  4611. @item ra
  4612. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4613. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4614. @item gr
  4615. @item gg
  4616. @item gb
  4617. @item ga
  4618. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4619. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4620. @item br
  4621. @item bg
  4622. @item bb
  4623. @item ba
  4624. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4625. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4626. @item ar
  4627. @item ag
  4628. @item ab
  4629. @item aa
  4630. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4631. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4632. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4633. @end table
  4634. @subsection Examples
  4635. @itemize
  4636. @item
  4637. Convert source to grayscale:
  4638. @example
  4639. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4640. @end example
  4641. @item
  4642. Simulate sepia tones:
  4643. @example
  4644. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4645. @end example
  4646. @end itemize
  4647. @section colormatrix
  4648. Convert color matrix.
  4649. The filter accepts the following options:
  4650. @table @option
  4651. @item src
  4652. @item dst
  4653. Specify the source and destination color matrix. Both values must be
  4654. specified.
  4655. The accepted values are:
  4656. @table @samp
  4657. @item bt709
  4658. BT.709
  4659. @item fcc
  4660. FCC
  4661. @item bt601
  4662. BT.601
  4663. @item bt470
  4664. BT.470
  4665. @item bt470bg
  4666. BT.470BG
  4667. @item smpte170m
  4668. SMPTE-170M
  4669. @item smpte240m
  4670. SMPTE-240M
  4671. @item bt2020
  4672. BT.2020
  4673. @end table
  4674. @end table
  4675. For example to convert from BT.601 to SMPTE-240M, use the command:
  4676. @example
  4677. colormatrix=bt601:smpte240m
  4678. @end example
  4679. @section colorspace
  4680. Convert colorspace, transfer characteristics or color primaries.
  4681. Input video needs to have an even size.
  4682. The filter accepts the following options:
  4683. @table @option
  4684. @anchor{all}
  4685. @item all
  4686. Specify all color properties at once.
  4687. The accepted values are:
  4688. @table @samp
  4689. @item bt470m
  4690. BT.470M
  4691. @item bt470bg
  4692. BT.470BG
  4693. @item bt601-6-525
  4694. BT.601-6 525
  4695. @item bt601-6-625
  4696. BT.601-6 625
  4697. @item bt709
  4698. BT.709
  4699. @item smpte170m
  4700. SMPTE-170M
  4701. @item smpte240m
  4702. SMPTE-240M
  4703. @item bt2020
  4704. BT.2020
  4705. @end table
  4706. @anchor{space}
  4707. @item space
  4708. Specify output colorspace.
  4709. The accepted values are:
  4710. @table @samp
  4711. @item bt709
  4712. BT.709
  4713. @item fcc
  4714. FCC
  4715. @item bt470bg
  4716. BT.470BG or BT.601-6 625
  4717. @item smpte170m
  4718. SMPTE-170M or BT.601-6 525
  4719. @item smpte240m
  4720. SMPTE-240M
  4721. @item ycgco
  4722. YCgCo
  4723. @item bt2020ncl
  4724. BT.2020 with non-constant luminance
  4725. @end table
  4726. @anchor{trc}
  4727. @item trc
  4728. Specify output transfer characteristics.
  4729. The accepted values are:
  4730. @table @samp
  4731. @item bt709
  4732. BT.709
  4733. @item bt470m
  4734. BT.470M
  4735. @item bt470bg
  4736. BT.470BG
  4737. @item gamma22
  4738. Constant gamma of 2.2
  4739. @item gamma28
  4740. Constant gamma of 2.8
  4741. @item smpte170m
  4742. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4743. @item smpte240m
  4744. SMPTE-240M
  4745. @item srgb
  4746. SRGB
  4747. @item iec61966-2-1
  4748. iec61966-2-1
  4749. @item iec61966-2-4
  4750. iec61966-2-4
  4751. @item xvycc
  4752. xvycc
  4753. @item bt2020-10
  4754. BT.2020 for 10-bits content
  4755. @item bt2020-12
  4756. BT.2020 for 12-bits content
  4757. @end table
  4758. @anchor{primaries}
  4759. @item primaries
  4760. Specify output color primaries.
  4761. The accepted values are:
  4762. @table @samp
  4763. @item bt709
  4764. BT.709
  4765. @item bt470m
  4766. BT.470M
  4767. @item bt470bg
  4768. BT.470BG or BT.601-6 625
  4769. @item smpte170m
  4770. SMPTE-170M or BT.601-6 525
  4771. @item smpte240m
  4772. SMPTE-240M
  4773. @item film
  4774. film
  4775. @item smpte431
  4776. SMPTE-431
  4777. @item smpte432
  4778. SMPTE-432
  4779. @item bt2020
  4780. BT.2020
  4781. @item jedec-p22
  4782. JEDEC P22 phosphors
  4783. @end table
  4784. @anchor{range}
  4785. @item range
  4786. Specify output color range.
  4787. The accepted values are:
  4788. @table @samp
  4789. @item tv
  4790. TV (restricted) range
  4791. @item mpeg
  4792. MPEG (restricted) range
  4793. @item pc
  4794. PC (full) range
  4795. @item jpeg
  4796. JPEG (full) range
  4797. @end table
  4798. @item format
  4799. Specify output color format.
  4800. The accepted values are:
  4801. @table @samp
  4802. @item yuv420p
  4803. YUV 4:2:0 planar 8-bits
  4804. @item yuv420p10
  4805. YUV 4:2:0 planar 10-bits
  4806. @item yuv420p12
  4807. YUV 4:2:0 planar 12-bits
  4808. @item yuv422p
  4809. YUV 4:2:2 planar 8-bits
  4810. @item yuv422p10
  4811. YUV 4:2:2 planar 10-bits
  4812. @item yuv422p12
  4813. YUV 4:2:2 planar 12-bits
  4814. @item yuv444p
  4815. YUV 4:4:4 planar 8-bits
  4816. @item yuv444p10
  4817. YUV 4:4:4 planar 10-bits
  4818. @item yuv444p12
  4819. YUV 4:4:4 planar 12-bits
  4820. @end table
  4821. @item fast
  4822. Do a fast conversion, which skips gamma/primary correction. This will take
  4823. significantly less CPU, but will be mathematically incorrect. To get output
  4824. compatible with that produced by the colormatrix filter, use fast=1.
  4825. @item dither
  4826. Specify dithering mode.
  4827. The accepted values are:
  4828. @table @samp
  4829. @item none
  4830. No dithering
  4831. @item fsb
  4832. Floyd-Steinberg dithering
  4833. @end table
  4834. @item wpadapt
  4835. Whitepoint adaptation mode.
  4836. The accepted values are:
  4837. @table @samp
  4838. @item bradford
  4839. Bradford whitepoint adaptation
  4840. @item vonkries
  4841. von Kries whitepoint adaptation
  4842. @item identity
  4843. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4844. @end table
  4845. @item iall
  4846. Override all input properties at once. Same accepted values as @ref{all}.
  4847. @item ispace
  4848. Override input colorspace. Same accepted values as @ref{space}.
  4849. @item iprimaries
  4850. Override input color primaries. Same accepted values as @ref{primaries}.
  4851. @item itrc
  4852. Override input transfer characteristics. Same accepted values as @ref{trc}.
  4853. @item irange
  4854. Override input color range. Same accepted values as @ref{range}.
  4855. @end table
  4856. The filter converts the transfer characteristics, color space and color
  4857. primaries to the specified user values. The output value, if not specified,
  4858. is set to a default value based on the "all" property. If that property is
  4859. also not specified, the filter will log an error. The output color range and
  4860. format default to the same value as the input color range and format. The
  4861. input transfer characteristics, color space, color primaries and color range
  4862. should be set on the input data. If any of these are missing, the filter will
  4863. log an error and no conversion will take place.
  4864. For example to convert the input to SMPTE-240M, use the command:
  4865. @example
  4866. colorspace=smpte240m
  4867. @end example
  4868. @section convolution
  4869. Apply convolution 3x3, 5x5 or 7x7 filter.
  4870. The filter accepts the following options:
  4871. @table @option
  4872. @item 0m
  4873. @item 1m
  4874. @item 2m
  4875. @item 3m
  4876. Set matrix for each plane.
  4877. Matrix is sequence of 9, 25 or 49 signed integers.
  4878. @item 0rdiv
  4879. @item 1rdiv
  4880. @item 2rdiv
  4881. @item 3rdiv
  4882. Set multiplier for calculated value for each plane.
  4883. @item 0bias
  4884. @item 1bias
  4885. @item 2bias
  4886. @item 3bias
  4887. Set bias for each plane. This value is added to the result of the multiplication.
  4888. Useful for making the overall image brighter or darker. Default is 0.0.
  4889. @end table
  4890. @subsection Examples
  4891. @itemize
  4892. @item
  4893. Apply sharpen:
  4894. @example
  4895. convolution="0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0"
  4896. @end example
  4897. @item
  4898. Apply blur:
  4899. @example
  4900. convolution="1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1/9:1/9:1/9:1/9"
  4901. @end example
  4902. @item
  4903. Apply edge enhance:
  4904. @example
  4905. convolution="0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:5:1:1:1:0:128:128:128"
  4906. @end example
  4907. @item
  4908. Apply edge detect:
  4909. @example
  4910. convolution="0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:5:5:5:1:0:128:128:128"
  4911. @end example
  4912. @item
  4913. Apply laplacian edge detector which includes diagonals:
  4914. @example
  4915. convolution="1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:5:5:5:1:0:128:128:0"
  4916. @end example
  4917. @item
  4918. Apply emboss:
  4919. @example
  4920. convolution="-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2"
  4921. @end example
  4922. @end itemize
  4923. @section convolve
  4924. Apply 2D convolution of video stream in frequency domain using second stream
  4925. as impulse.
  4926. The filter accepts the following options:
  4927. @table @option
  4928. @item planes
  4929. Set which planes to process.
  4930. @item impulse
  4931. Set which impulse video frames will be processed, can be @var{first}
  4932. or @var{all}. Default is @var{all}.
  4933. @end table
  4934. The @code{convolve} filter also supports the @ref{framesync} options.
  4935. @section copy
  4936. Copy the input video source unchanged to the output. This is mainly useful for
  4937. testing purposes.
  4938. @anchor{coreimage}
  4939. @section coreimage
  4940. Video filtering on GPU using Apple's CoreImage API on OSX.
  4941. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4942. processed by video hardware. However, software-based OpenGL implementations
  4943. exist which means there is no guarantee for hardware processing. It depends on
  4944. the respective OSX.
  4945. There are many filters and image generators provided by Apple that come with a
  4946. large variety of options. The filter has to be referenced by its name along
  4947. with its options.
  4948. The coreimage filter accepts the following options:
  4949. @table @option
  4950. @item list_filters
  4951. List all available filters and generators along with all their respective
  4952. options as well as possible minimum and maximum values along with the default
  4953. values.
  4954. @example
  4955. list_filters=true
  4956. @end example
  4957. @item filter
  4958. Specify all filters by their respective name and options.
  4959. Use @var{list_filters} to determine all valid filter names and options.
  4960. Numerical options are specified by a float value and are automatically clamped
  4961. to their respective value range. Vector and color options have to be specified
  4962. by a list of space separated float values. Character escaping has to be done.
  4963. A special option name @code{default} is available to use default options for a
  4964. filter.
  4965. It is required to specify either @code{default} or at least one of the filter options.
  4966. All omitted options are used with their default values.
  4967. The syntax of the filter string is as follows:
  4968. @example
  4969. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  4970. @end example
  4971. @item output_rect
  4972. Specify a rectangle where the output of the filter chain is copied into the
  4973. input image. It is given by a list of space separated float values:
  4974. @example
  4975. output_rect=x\ y\ width\ height
  4976. @end example
  4977. If not given, the output rectangle equals the dimensions of the input image.
  4978. The output rectangle is automatically cropped at the borders of the input
  4979. image. Negative values are valid for each component.
  4980. @example
  4981. output_rect=25\ 25\ 100\ 100
  4982. @end example
  4983. @end table
  4984. Several filters can be chained for successive processing without GPU-HOST
  4985. transfers allowing for fast processing of complex filter chains.
  4986. Currently, only filters with zero (generators) or exactly one (filters) input
  4987. image and one output image are supported. Also, transition filters are not yet
  4988. usable as intended.
  4989. Some filters generate output images with additional padding depending on the
  4990. respective filter kernel. The padding is automatically removed to ensure the
  4991. filter output has the same size as the input image.
  4992. For image generators, the size of the output image is determined by the
  4993. previous output image of the filter chain or the input image of the whole
  4994. filterchain, respectively. The generators do not use the pixel information of
  4995. this image to generate their output. However, the generated output is
  4996. blended onto this image, resulting in partial or complete coverage of the
  4997. output image.
  4998. The @ref{coreimagesrc} video source can be used for generating input images
  4999. which are directly fed into the filter chain. By using it, providing input
  5000. images by another video source or an input video is not required.
  5001. @subsection Examples
  5002. @itemize
  5003. @item
  5004. List all filters available:
  5005. @example
  5006. coreimage=list_filters=true
  5007. @end example
  5008. @item
  5009. Use the CIBoxBlur filter with default options to blur an image:
  5010. @example
  5011. coreimage=filter=CIBoxBlur@@default
  5012. @end example
  5013. @item
  5014. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5015. its center at 100x100 and a radius of 50 pixels:
  5016. @example
  5017. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5018. @end example
  5019. @item
  5020. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5021. given as complete and escaped command-line for Apple's standard bash shell:
  5022. @example
  5023. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5024. @end example
  5025. @end itemize
  5026. @section crop
  5027. Crop the input video to given dimensions.
  5028. It accepts the following parameters:
  5029. @table @option
  5030. @item w, out_w
  5031. The width of the output video. It defaults to @code{iw}.
  5032. This expression is evaluated only once during the filter
  5033. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5034. @item h, out_h
  5035. The height of the output video. It defaults to @code{ih}.
  5036. This expression is evaluated only once during the filter
  5037. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5038. @item x
  5039. The horizontal position, in the input video, of the left edge of the output
  5040. video. It defaults to @code{(in_w-out_w)/2}.
  5041. This expression is evaluated per-frame.
  5042. @item y
  5043. The vertical position, in the input video, of the top edge of the output video.
  5044. It defaults to @code{(in_h-out_h)/2}.
  5045. This expression is evaluated per-frame.
  5046. @item keep_aspect
  5047. If set to 1 will force the output display aspect ratio
  5048. to be the same of the input, by changing the output sample aspect
  5049. ratio. It defaults to 0.
  5050. @item exact
  5051. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5052. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5053. It defaults to 0.
  5054. @end table
  5055. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5056. expressions containing the following constants:
  5057. @table @option
  5058. @item x
  5059. @item y
  5060. The computed values for @var{x} and @var{y}. They are evaluated for
  5061. each new frame.
  5062. @item in_w
  5063. @item in_h
  5064. The input width and height.
  5065. @item iw
  5066. @item ih
  5067. These are the same as @var{in_w} and @var{in_h}.
  5068. @item out_w
  5069. @item out_h
  5070. The output (cropped) width and height.
  5071. @item ow
  5072. @item oh
  5073. These are the same as @var{out_w} and @var{out_h}.
  5074. @item a
  5075. same as @var{iw} / @var{ih}
  5076. @item sar
  5077. input sample aspect ratio
  5078. @item dar
  5079. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5080. @item hsub
  5081. @item vsub
  5082. horizontal and vertical chroma subsample values. For example for the
  5083. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5084. @item n
  5085. The number of the input frame, starting from 0.
  5086. @item pos
  5087. the position in the file of the input frame, NAN if unknown
  5088. @item t
  5089. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5090. @end table
  5091. The expression for @var{out_w} may depend on the value of @var{out_h},
  5092. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5093. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5094. evaluated after @var{out_w} and @var{out_h}.
  5095. The @var{x} and @var{y} parameters specify the expressions for the
  5096. position of the top-left corner of the output (non-cropped) area. They
  5097. are evaluated for each frame. If the evaluated value is not valid, it
  5098. is approximated to the nearest valid value.
  5099. The expression for @var{x} may depend on @var{y}, and the expression
  5100. for @var{y} may depend on @var{x}.
  5101. @subsection Examples
  5102. @itemize
  5103. @item
  5104. Crop area with size 100x100 at position (12,34).
  5105. @example
  5106. crop=100:100:12:34
  5107. @end example
  5108. Using named options, the example above becomes:
  5109. @example
  5110. crop=w=100:h=100:x=12:y=34
  5111. @end example
  5112. @item
  5113. Crop the central input area with size 100x100:
  5114. @example
  5115. crop=100:100
  5116. @end example
  5117. @item
  5118. Crop the central input area with size 2/3 of the input video:
  5119. @example
  5120. crop=2/3*in_w:2/3*in_h
  5121. @end example
  5122. @item
  5123. Crop the input video central square:
  5124. @example
  5125. crop=out_w=in_h
  5126. crop=in_h
  5127. @end example
  5128. @item
  5129. Delimit the rectangle with the top-left corner placed at position
  5130. 100:100 and the right-bottom corner corresponding to the right-bottom
  5131. corner of the input image.
  5132. @example
  5133. crop=in_w-100:in_h-100:100:100
  5134. @end example
  5135. @item
  5136. Crop 10 pixels from the left and right borders, and 20 pixels from
  5137. the top and bottom borders
  5138. @example
  5139. crop=in_w-2*10:in_h-2*20
  5140. @end example
  5141. @item
  5142. Keep only the bottom right quarter of the input image:
  5143. @example
  5144. crop=in_w/2:in_h/2:in_w/2:in_h/2
  5145. @end example
  5146. @item
  5147. Crop height for getting Greek harmony:
  5148. @example
  5149. crop=in_w:1/PHI*in_w
  5150. @end example
  5151. @item
  5152. Apply trembling effect:
  5153. @example
  5154. crop=in_w/2:in_h/2:(in_w-out_w)/2+((in_w-out_w)/2)*sin(n/10):(in_h-out_h)/2 +((in_h-out_h)/2)*sin(n/7)
  5155. @end example
  5156. @item
  5157. Apply erratic camera effect depending on timestamp:
  5158. @example
  5159. crop=in_w/2:in_h/2:(in_w-out_w)/2+((in_w-out_w)/2)*sin(t*10):(in_h-out_h)/2 +((in_h-out_h)/2)*sin(t*13)"
  5160. @end example
  5161. @item
  5162. Set x depending on the value of y:
  5163. @example
  5164. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  5165. @end example
  5166. @end itemize
  5167. @subsection Commands
  5168. This filter supports the following commands:
  5169. @table @option
  5170. @item w, out_w
  5171. @item h, out_h
  5172. @item x
  5173. @item y
  5174. Set width/height of the output video and the horizontal/vertical position
  5175. in the input video.
  5176. The command accepts the same syntax of the corresponding option.
  5177. If the specified expression is not valid, it is kept at its current
  5178. value.
  5179. @end table
  5180. @section cropdetect
  5181. Auto-detect the crop size.
  5182. It calculates the necessary cropping parameters and prints the
  5183. recommended parameters via the logging system. The detected dimensions
  5184. correspond to the non-black area of the input video.
  5185. It accepts the following parameters:
  5186. @table @option
  5187. @item limit
  5188. Set higher black value threshold, which can be optionally specified
  5189. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  5190. value greater to the set value is considered non-black. It defaults to 24.
  5191. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  5192. on the bitdepth of the pixel format.
  5193. @item round
  5194. The value which the width/height should be divisible by. It defaults to
  5195. 16. The offset is automatically adjusted to center the video. Use 2 to
  5196. get only even dimensions (needed for 4:2:2 video). 16 is best when
  5197. encoding to most video codecs.
  5198. @item reset_count, reset
  5199. Set the counter that determines after how many frames cropdetect will
  5200. reset the previously detected largest video area and start over to
  5201. detect the current optimal crop area. Default value is 0.
  5202. This can be useful when channel logos distort the video area. 0
  5203. indicates 'never reset', and returns the largest area encountered during
  5204. playback.
  5205. @end table
  5206. @anchor{curves}
  5207. @section curves
  5208. Apply color adjustments using curves.
  5209. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  5210. component (red, green and blue) has its values defined by @var{N} key points
  5211. tied from each other using a smooth curve. The x-axis represents the pixel
  5212. values from the input frame, and the y-axis the new pixel values to be set for
  5213. the output frame.
  5214. By default, a component curve is defined by the two points @var{(0;0)} and
  5215. @var{(1;1)}. This creates a straight line where each original pixel value is
  5216. "adjusted" to its own value, which means no change to the image.
  5217. The filter allows you to redefine these two points and add some more. A new
  5218. curve (using a natural cubic spline interpolation) will be define to pass
  5219. smoothly through all these new coordinates. The new defined points needs to be
  5220. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  5221. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  5222. the vector spaces, the values will be clipped accordingly.
  5223. The filter accepts the following options:
  5224. @table @option
  5225. @item preset
  5226. Select one of the available color presets. This option can be used in addition
  5227. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  5228. options takes priority on the preset values.
  5229. Available presets are:
  5230. @table @samp
  5231. @item none
  5232. @item color_negative
  5233. @item cross_process
  5234. @item darker
  5235. @item increase_contrast
  5236. @item lighter
  5237. @item linear_contrast
  5238. @item medium_contrast
  5239. @item negative
  5240. @item strong_contrast
  5241. @item vintage
  5242. @end table
  5243. Default is @code{none}.
  5244. @item master, m
  5245. Set the master key points. These points will define a second pass mapping. It
  5246. is sometimes called a "luminance" or "value" mapping. It can be used with
  5247. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  5248. post-processing LUT.
  5249. @item red, r
  5250. Set the key points for the red component.
  5251. @item green, g
  5252. Set the key points for the green component.
  5253. @item blue, b
  5254. Set the key points for the blue component.
  5255. @item all
  5256. Set the key points for all components (not including master).
  5257. Can be used in addition to the other key points component
  5258. options. In this case, the unset component(s) will fallback on this
  5259. @option{all} setting.
  5260. @item psfile
  5261. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  5262. @item plot
  5263. Save Gnuplot script of the curves in specified file.
  5264. @end table
  5265. To avoid some filtergraph syntax conflicts, each key points list need to be
  5266. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  5267. @subsection Examples
  5268. @itemize
  5269. @item
  5270. Increase slightly the middle level of blue:
  5271. @example
  5272. curves=blue='0/0 0.5/0.58 1/1'
  5273. @end example
  5274. @item
  5275. Vintage effect:
  5276. @example
  5277. curves=r='0/0.11 .42/.51 1/0.95':g='0/0 0.50/0.48 1/1':b='0/0.22 .49/.44 1/0.8'
  5278. @end example
  5279. Here we obtain the following coordinates for each components:
  5280. @table @var
  5281. @item red
  5282. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  5283. @item green
  5284. @code{(0;0) (0.50;0.48) (1;1)}
  5285. @item blue
  5286. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  5287. @end table
  5288. @item
  5289. The previous example can also be achieved with the associated built-in preset:
  5290. @example
  5291. curves=preset=vintage
  5292. @end example
  5293. @item
  5294. Or simply:
  5295. @example
  5296. curves=vintage
  5297. @end example
  5298. @item
  5299. Use a Photoshop preset and redefine the points of the green component:
  5300. @example
  5301. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  5302. @end example
  5303. @item
  5304. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  5305. and @command{gnuplot}:
  5306. @example
  5307. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  5308. gnuplot -p /tmp/curves.plt
  5309. @end example
  5310. @end itemize
  5311. @section datascope
  5312. Video data analysis filter.
  5313. This filter shows hexadecimal pixel values of part of video.
  5314. The filter accepts the following options:
  5315. @table @option
  5316. @item size, s
  5317. Set output video size.
  5318. @item x
  5319. Set x offset from where to pick pixels.
  5320. @item y
  5321. Set y offset from where to pick pixels.
  5322. @item mode
  5323. Set scope mode, can be one of the following:
  5324. @table @samp
  5325. @item mono
  5326. Draw hexadecimal pixel values with white color on black background.
  5327. @item color
  5328. Draw hexadecimal pixel values with input video pixel color on black
  5329. background.
  5330. @item color2
  5331. Draw hexadecimal pixel values on color background picked from input video,
  5332. the text color is picked in such way so its always visible.
  5333. @end table
  5334. @item axis
  5335. Draw rows and columns numbers on left and top of video.
  5336. @item opacity
  5337. Set background opacity.
  5338. @end table
  5339. @section dctdnoiz
  5340. Denoise frames using 2D DCT (frequency domain filtering).
  5341. This filter is not designed for real time.
  5342. The filter accepts the following options:
  5343. @table @option
  5344. @item sigma, s
  5345. Set the noise sigma constant.
  5346. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  5347. coefficient (absolute value) below this threshold with be dropped.
  5348. If you need a more advanced filtering, see @option{expr}.
  5349. Default is @code{0}.
  5350. @item overlap
  5351. Set number overlapping pixels for each block. Since the filter can be slow, you
  5352. may want to reduce this value, at the cost of a less effective filter and the
  5353. risk of various artefacts.
  5354. If the overlapping value doesn't permit processing the whole input width or
  5355. height, a warning will be displayed and according borders won't be denoised.
  5356. Default value is @var{blocksize}-1, which is the best possible setting.
  5357. @item expr, e
  5358. Set the coefficient factor expression.
  5359. For each coefficient of a DCT block, this expression will be evaluated as a
  5360. multiplier value for the coefficient.
  5361. If this is option is set, the @option{sigma} option will be ignored.
  5362. The absolute value of the coefficient can be accessed through the @var{c}
  5363. variable.
  5364. @item n
  5365. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  5366. @var{blocksize}, which is the width and height of the processed blocks.
  5367. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  5368. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5369. on the speed processing. Also, a larger block size does not necessarily means a
  5370. better de-noising.
  5371. @end table
  5372. @subsection Examples
  5373. Apply a denoise with a @option{sigma} of @code{4.5}:
  5374. @example
  5375. dctdnoiz=4.5
  5376. @end example
  5377. The same operation can be achieved using the expression system:
  5378. @example
  5379. dctdnoiz=e='gte(c, 4.5*3)'
  5380. @end example
  5381. Violent denoise using a block size of @code{16x16}:
  5382. @example
  5383. dctdnoiz=15:n=4
  5384. @end example
  5385. @section deband
  5386. Remove banding artifacts from input video.
  5387. It works by replacing banded pixels with average value of referenced pixels.
  5388. The filter accepts the following options:
  5389. @table @option
  5390. @item 1thr
  5391. @item 2thr
  5392. @item 3thr
  5393. @item 4thr
  5394. Set banding detection threshold for each plane. Default is 0.02.
  5395. Valid range is 0.00003 to 0.5.
  5396. If difference between current pixel and reference pixel is less than threshold,
  5397. it will be considered as banded.
  5398. @item range, r
  5399. Banding detection range in pixels. Default is 16. If positive, random number
  5400. in range 0 to set value will be used. If negative, exact absolute value
  5401. will be used.
  5402. The range defines square of four pixels around current pixel.
  5403. @item direction, d
  5404. Set direction in radians from which four pixel will be compared. If positive,
  5405. random direction from 0 to set direction will be picked. If negative, exact of
  5406. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5407. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5408. column.
  5409. @item blur, b
  5410. If enabled, current pixel is compared with average value of all four
  5411. surrounding pixels. The default is enabled. If disabled current pixel is
  5412. compared with all four surrounding pixels. The pixel is considered banded
  5413. if only all four differences with surrounding pixels are less than threshold.
  5414. @item coupling, c
  5415. If enabled, current pixel is changed if and only if all pixel components are banded,
  5416. e.g. banding detection threshold is triggered for all color components.
  5417. The default is disabled.
  5418. @end table
  5419. @anchor{decimate}
  5420. @section decimate
  5421. Drop duplicated frames at regular intervals.
  5422. The filter accepts the following options:
  5423. @table @option
  5424. @item cycle
  5425. Set the number of frames from which one will be dropped. Setting this to
  5426. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  5427. Default is @code{5}.
  5428. @item dupthresh
  5429. Set the threshold for duplicate detection. If the difference metric for a frame
  5430. is less than or equal to this value, then it is declared as duplicate. Default
  5431. is @code{1.1}
  5432. @item scthresh
  5433. Set scene change threshold. Default is @code{15}.
  5434. @item blockx
  5435. @item blocky
  5436. Set the size of the x and y-axis blocks used during metric calculations.
  5437. Larger blocks give better noise suppression, but also give worse detection of
  5438. small movements. Must be a power of two. Default is @code{32}.
  5439. @item ppsrc
  5440. Mark main input as a pre-processed input and activate clean source input
  5441. stream. This allows the input to be pre-processed with various filters to help
  5442. the metrics calculation while keeping the frame selection lossless. When set to
  5443. @code{1}, the first stream is for the pre-processed input, and the second
  5444. stream is the clean source from where the kept frames are chosen. Default is
  5445. @code{0}.
  5446. @item chroma
  5447. Set whether or not chroma is considered in the metric calculations. Default is
  5448. @code{1}.
  5449. @end table
  5450. @section deconvolve
  5451. Apply 2D deconvolution of video stream in frequency domain using second stream
  5452. as impulse.
  5453. The filter accepts the following options:
  5454. @table @option
  5455. @item planes
  5456. Set which planes to process.
  5457. @item impulse
  5458. Set which impulse video frames will be processed, can be @var{first}
  5459. or @var{all}. Default is @var{all}.
  5460. @item noise
  5461. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  5462. and height are not same and not power of 2 or if stream prior to convolving
  5463. had noise.
  5464. @end table
  5465. The @code{deconvolve} filter also supports the @ref{framesync} options.
  5466. @section deflate
  5467. Apply deflate effect to the video.
  5468. This filter replaces the pixel by the local(3x3) average by taking into account
  5469. only values lower than the pixel.
  5470. It accepts the following options:
  5471. @table @option
  5472. @item threshold0
  5473. @item threshold1
  5474. @item threshold2
  5475. @item threshold3
  5476. Limit the maximum change for each plane, default is 65535.
  5477. If 0, plane will remain unchanged.
  5478. @end table
  5479. @section deflicker
  5480. Remove temporal frame luminance variations.
  5481. It accepts the following options:
  5482. @table @option
  5483. @item size, s
  5484. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  5485. @item mode, m
  5486. Set averaging mode to smooth temporal luminance variations.
  5487. Available values are:
  5488. @table @samp
  5489. @item am
  5490. Arithmetic mean
  5491. @item gm
  5492. Geometric mean
  5493. @item hm
  5494. Harmonic mean
  5495. @item qm
  5496. Quadratic mean
  5497. @item cm
  5498. Cubic mean
  5499. @item pm
  5500. Power mean
  5501. @item median
  5502. Median
  5503. @end table
  5504. @item bypass
  5505. Do not actually modify frame. Useful when one only wants metadata.
  5506. @end table
  5507. @section dejudder
  5508. Remove judder produced by partially interlaced telecined content.
  5509. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  5510. source was partially telecined content then the output of @code{pullup,dejudder}
  5511. will have a variable frame rate. May change the recorded frame rate of the
  5512. container. Aside from that change, this filter will not affect constant frame
  5513. rate video.
  5514. The option available in this filter is:
  5515. @table @option
  5516. @item cycle
  5517. Specify the length of the window over which the judder repeats.
  5518. Accepts any integer greater than 1. Useful values are:
  5519. @table @samp
  5520. @item 4
  5521. If the original was telecined from 24 to 30 fps (Film to NTSC).
  5522. @item 5
  5523. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  5524. @item 20
  5525. If a mixture of the two.
  5526. @end table
  5527. The default is @samp{4}.
  5528. @end table
  5529. @section delogo
  5530. Suppress a TV station logo by a simple interpolation of the surrounding
  5531. pixels. Just set a rectangle covering the logo and watch it disappear
  5532. (and sometimes something even uglier appear - your mileage may vary).
  5533. It accepts the following parameters:
  5534. @table @option
  5535. @item x
  5536. @item y
  5537. Specify the top left corner coordinates of the logo. They must be
  5538. specified.
  5539. @item w
  5540. @item h
  5541. Specify the width and height of the logo to clear. They must be
  5542. specified.
  5543. @item band, t
  5544. Specify the thickness of the fuzzy edge of the rectangle (added to
  5545. @var{w} and @var{h}). The default value is 1. This option is
  5546. deprecated, setting higher values should no longer be necessary and
  5547. is not recommended.
  5548. @item show
  5549. When set to 1, a green rectangle is drawn on the screen to simplify
  5550. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  5551. The default value is 0.
  5552. The rectangle is drawn on the outermost pixels which will be (partly)
  5553. replaced with interpolated values. The values of the next pixels
  5554. immediately outside this rectangle in each direction will be used to
  5555. compute the interpolated pixel values inside the rectangle.
  5556. @end table
  5557. @subsection Examples
  5558. @itemize
  5559. @item
  5560. Set a rectangle covering the area with top left corner coordinates 0,0
  5561. and size 100x77, and a band of size 10:
  5562. @example
  5563. delogo=x=0:y=0:w=100:h=77:band=10
  5564. @end example
  5565. @end itemize
  5566. @section deshake
  5567. Attempt to fix small changes in horizontal and/or vertical shift. This
  5568. filter helps remove camera shake from hand-holding a camera, bumping a
  5569. tripod, moving on a vehicle, etc.
  5570. The filter accepts the following options:
  5571. @table @option
  5572. @item x
  5573. @item y
  5574. @item w
  5575. @item h
  5576. Specify a rectangular area where to limit the search for motion
  5577. vectors.
  5578. If desired the search for motion vectors can be limited to a
  5579. rectangular area of the frame defined by its top left corner, width
  5580. and height. These parameters have the same meaning as the drawbox
  5581. filter which can be used to visualise the position of the bounding
  5582. box.
  5583. This is useful when simultaneous movement of subjects within the frame
  5584. might be confused for camera motion by the motion vector search.
  5585. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  5586. then the full frame is used. This allows later options to be set
  5587. without specifying the bounding box for the motion vector search.
  5588. Default - search the whole frame.
  5589. @item rx
  5590. @item ry
  5591. Specify the maximum extent of movement in x and y directions in the
  5592. range 0-64 pixels. Default 16.
  5593. @item edge
  5594. Specify how to generate pixels to fill blanks at the edge of the
  5595. frame. Available values are:
  5596. @table @samp
  5597. @item blank, 0
  5598. Fill zeroes at blank locations
  5599. @item original, 1
  5600. Original image at blank locations
  5601. @item clamp, 2
  5602. Extruded edge value at blank locations
  5603. @item mirror, 3
  5604. Mirrored edge at blank locations
  5605. @end table
  5606. Default value is @samp{mirror}.
  5607. @item blocksize
  5608. Specify the blocksize to use for motion search. Range 4-128 pixels,
  5609. default 8.
  5610. @item contrast
  5611. Specify the contrast threshold for blocks. Only blocks with more than
  5612. the specified contrast (difference between darkest and lightest
  5613. pixels) will be considered. Range 1-255, default 125.
  5614. @item search
  5615. Specify the search strategy. Available values are:
  5616. @table @samp
  5617. @item exhaustive, 0
  5618. Set exhaustive search
  5619. @item less, 1
  5620. Set less exhaustive search.
  5621. @end table
  5622. Default value is @samp{exhaustive}.
  5623. @item filename
  5624. If set then a detailed log of the motion search is written to the
  5625. specified file.
  5626. @end table
  5627. @section despill
  5628. Remove unwanted contamination of foreground colors, caused by reflected color of
  5629. greenscreen or bluescreen.
  5630. This filter accepts the following options:
  5631. @table @option
  5632. @item type
  5633. Set what type of despill to use.
  5634. @item mix
  5635. Set how spillmap will be generated.
  5636. @item expand
  5637. Set how much to get rid of still remaining spill.
  5638. @item red
  5639. Controls amount of red in spill area.
  5640. @item green
  5641. Controls amount of green in spill area.
  5642. Should be -1 for greenscreen.
  5643. @item blue
  5644. Controls amount of blue in spill area.
  5645. Should be -1 for bluescreen.
  5646. @item brightness
  5647. Controls brightness of spill area, preserving colors.
  5648. @item alpha
  5649. Modify alpha from generated spillmap.
  5650. @end table
  5651. @section detelecine
  5652. Apply an exact inverse of the telecine operation. It requires a predefined
  5653. pattern specified using the pattern option which must be the same as that passed
  5654. to the telecine filter.
  5655. This filter accepts the following options:
  5656. @table @option
  5657. @item first_field
  5658. @table @samp
  5659. @item top, t
  5660. top field first
  5661. @item bottom, b
  5662. bottom field first
  5663. The default value is @code{top}.
  5664. @end table
  5665. @item pattern
  5666. A string of numbers representing the pulldown pattern you wish to apply.
  5667. The default value is @code{23}.
  5668. @item start_frame
  5669. A number representing position of the first frame with respect to the telecine
  5670. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  5671. @end table
  5672. @section dilation
  5673. Apply dilation effect to the video.
  5674. This filter replaces the pixel by the local(3x3) maximum.
  5675. It accepts the following options:
  5676. @table @option
  5677. @item threshold0
  5678. @item threshold1
  5679. @item threshold2
  5680. @item threshold3
  5681. Limit the maximum change for each plane, default is 65535.
  5682. If 0, plane will remain unchanged.
  5683. @item coordinates
  5684. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5685. pixels are used.
  5686. Flags to local 3x3 coordinates maps like this:
  5687. 1 2 3
  5688. 4 5
  5689. 6 7 8
  5690. @end table
  5691. @section displace
  5692. Displace pixels as indicated by second and third input stream.
  5693. It takes three input streams and outputs one stream, the first input is the
  5694. source, and second and third input are displacement maps.
  5695. The second input specifies how much to displace pixels along the
  5696. x-axis, while the third input specifies how much to displace pixels
  5697. along the y-axis.
  5698. If one of displacement map streams terminates, last frame from that
  5699. displacement map will be used.
  5700. Note that once generated, displacements maps can be reused over and over again.
  5701. A description of the accepted options follows.
  5702. @table @option
  5703. @item edge
  5704. Set displace behavior for pixels that are out of range.
  5705. Available values are:
  5706. @table @samp
  5707. @item blank
  5708. Missing pixels are replaced by black pixels.
  5709. @item smear
  5710. Adjacent pixels will spread out to replace missing pixels.
  5711. @item wrap
  5712. Out of range pixels are wrapped so they point to pixels of other side.
  5713. @item mirror
  5714. Out of range pixels will be replaced with mirrored pixels.
  5715. @end table
  5716. Default is @samp{smear}.
  5717. @end table
  5718. @subsection Examples
  5719. @itemize
  5720. @item
  5721. Add ripple effect to rgb input of video size hd720:
  5722. @example
  5723. ffmpeg -i INPUT -f lavfi -i nullsrc=s=hd720,lutrgb=128:128:128 -f lavfi -i nullsrc=s=hd720,geq='r=128+30*sin(2*PI*X/400+T):g=128+30*sin(2*PI*X/400+T):b=128+30*sin(2*PI*X/400+T)' -lavfi '[0][1][2]displace' OUTPUT
  5724. @end example
  5725. @item
  5726. Add wave effect to rgb input of video size hd720:
  5727. @example
  5728. ffmpeg -i INPUT -f lavfi -i nullsrc=hd720,geq='r=128+80*(sin(sqrt((X-W/2)*(X-W/2)+(Y-H/2)*(Y-H/2))/220*2*PI+T)):g=128+80*(sin(sqrt((X-W/2)*(X-W/2)+(Y-H/2)*(Y-H/2))/220*2*PI+T)):b=128+80*(sin(sqrt((X-W/2)*(X-W/2)+(Y-H/2)*(Y-H/2))/220*2*PI+T))' -lavfi '[1]split[x][y],[0][x][y]displace' OUTPUT
  5729. @end example
  5730. @end itemize
  5731. @section drawbox
  5732. Draw a colored box on the input image.
  5733. It accepts the following parameters:
  5734. @table @option
  5735. @item x
  5736. @item y
  5737. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5738. @item width, w
  5739. @item height, h
  5740. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5741. the input width and height. It defaults to 0.
  5742. @item color, c
  5743. Specify the color of the box to write. For the general syntax of this option,
  5744. check the "Color" section in the ffmpeg-utils manual. If the special
  5745. value @code{invert} is used, the box edge color is the same as the
  5746. video with inverted luma.
  5747. @item thickness, t
  5748. The expression which sets the thickness of the box edge.
  5749. A value of @code{fill} will create a filled box. Default value is @code{3}.
  5750. See below for the list of accepted constants.
  5751. @item replace
  5752. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  5753. will overwrite the video's color and alpha pixels.
  5754. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  5755. @end table
  5756. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5757. following constants:
  5758. @table @option
  5759. @item dar
  5760. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5761. @item hsub
  5762. @item vsub
  5763. horizontal and vertical chroma subsample values. For example for the
  5764. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5765. @item in_h, ih
  5766. @item in_w, iw
  5767. The input width and height.
  5768. @item sar
  5769. The input sample aspect ratio.
  5770. @item x
  5771. @item y
  5772. The x and y offset coordinates where the box is drawn.
  5773. @item w
  5774. @item h
  5775. The width and height of the drawn box.
  5776. @item t
  5777. The thickness of the drawn box.
  5778. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5779. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5780. @end table
  5781. @subsection Examples
  5782. @itemize
  5783. @item
  5784. Draw a black box around the edge of the input image:
  5785. @example
  5786. drawbox
  5787. @end example
  5788. @item
  5789. Draw a box with color red and an opacity of 50%:
  5790. @example
  5791. drawbox=10:20:200:60:red@@0.5
  5792. @end example
  5793. The previous example can be specified as:
  5794. @example
  5795. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5796. @end example
  5797. @item
  5798. Fill the box with pink color:
  5799. @example
  5800. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  5801. @end example
  5802. @item
  5803. Draw a 2-pixel red 2.40:1 mask:
  5804. @example
  5805. drawbox=x=-t:y=0.5*(ih-iw/2.4)-t:w=iw+t*2:h=iw/2.4+t*2:t=2:c=red
  5806. @end example
  5807. @end itemize
  5808. @section drawgrid
  5809. Draw a grid on the input image.
  5810. It accepts the following parameters:
  5811. @table @option
  5812. @item x
  5813. @item y
  5814. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5815. @item width, w
  5816. @item height, h
  5817. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5818. input width and height, respectively, minus @code{thickness}, so image gets
  5819. framed. Default to 0.
  5820. @item color, c
  5821. Specify the color of the grid. For the general syntax of this option,
  5822. check the "Color" section in the ffmpeg-utils manual. If the special
  5823. value @code{invert} is used, the grid color is the same as the
  5824. video with inverted luma.
  5825. @item thickness, t
  5826. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5827. See below for the list of accepted constants.
  5828. @item replace
  5829. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  5830. will overwrite the video's color and alpha pixels.
  5831. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  5832. @end table
  5833. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5834. following constants:
  5835. @table @option
  5836. @item dar
  5837. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5838. @item hsub
  5839. @item vsub
  5840. horizontal and vertical chroma subsample values. For example for the
  5841. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5842. @item in_h, ih
  5843. @item in_w, iw
  5844. The input grid cell width and height.
  5845. @item sar
  5846. The input sample aspect ratio.
  5847. @item x
  5848. @item y
  5849. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5850. @item w
  5851. @item h
  5852. The width and height of the drawn cell.
  5853. @item t
  5854. The thickness of the drawn cell.
  5855. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5856. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5857. @end table
  5858. @subsection Examples
  5859. @itemize
  5860. @item
  5861. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5862. @example
  5863. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5864. @end example
  5865. @item
  5866. Draw a white 3x3 grid with an opacity of 50%:
  5867. @example
  5868. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5869. @end example
  5870. @end itemize
  5871. @anchor{drawtext}
  5872. @section drawtext
  5873. Draw a text string or text from a specified file on top of a video, using the
  5874. libfreetype library.
  5875. To enable compilation of this filter, you need to configure FFmpeg with
  5876. @code{--enable-libfreetype}.
  5877. To enable default font fallback and the @var{font} option you need to
  5878. configure FFmpeg with @code{--enable-libfontconfig}.
  5879. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5880. @code{--enable-libfribidi}.
  5881. @subsection Syntax
  5882. It accepts the following parameters:
  5883. @table @option
  5884. @item box
  5885. Used to draw a box around text using the background color.
  5886. The value must be either 1 (enable) or 0 (disable).
  5887. The default value of @var{box} is 0.
  5888. @item boxborderw
  5889. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5890. The default value of @var{boxborderw} is 0.
  5891. @item boxcolor
  5892. The color to be used for drawing box around text. For the syntax of this
  5893. option, check the "Color" section in the ffmpeg-utils manual.
  5894. The default value of @var{boxcolor} is "white".
  5895. @item line_spacing
  5896. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  5897. The default value of @var{line_spacing} is 0.
  5898. @item borderw
  5899. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5900. The default value of @var{borderw} is 0.
  5901. @item bordercolor
  5902. Set the color to be used for drawing border around text. For the syntax of this
  5903. option, check the "Color" section in the ffmpeg-utils manual.
  5904. The default value of @var{bordercolor} is "black".
  5905. @item expansion
  5906. Select how the @var{text} is expanded. Can be either @code{none},
  5907. @code{strftime} (deprecated) or
  5908. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5909. below for details.
  5910. @item basetime
  5911. Set a start time for the count. Value is in microseconds. Only applied
  5912. in the deprecated strftime expansion mode. To emulate in normal expansion
  5913. mode use the @code{pts} function, supplying the start time (in seconds)
  5914. as the second argument.
  5915. @item fix_bounds
  5916. If true, check and fix text coords to avoid clipping.
  5917. @item fontcolor
  5918. The color to be used for drawing fonts. For the syntax of this option, check
  5919. the "Color" section in the ffmpeg-utils manual.
  5920. The default value of @var{fontcolor} is "black".
  5921. @item fontcolor_expr
  5922. String which is expanded the same way as @var{text} to obtain dynamic
  5923. @var{fontcolor} value. By default this option has empty value and is not
  5924. processed. When this option is set, it overrides @var{fontcolor} option.
  5925. @item font
  5926. The font family to be used for drawing text. By default Sans.
  5927. @item fontfile
  5928. The font file to be used for drawing text. The path must be included.
  5929. This parameter is mandatory if the fontconfig support is disabled.
  5930. @item alpha
  5931. Draw the text applying alpha blending. The value can
  5932. be a number between 0.0 and 1.0.
  5933. The expression accepts the same variables @var{x, y} as well.
  5934. The default value is 1.
  5935. Please see @var{fontcolor_expr}.
  5936. @item fontsize
  5937. The font size to be used for drawing text.
  5938. The default value of @var{fontsize} is 16.
  5939. @item text_shaping
  5940. If set to 1, attempt to shape the text (for example, reverse the order of
  5941. right-to-left text and join Arabic characters) before drawing it.
  5942. Otherwise, just draw the text exactly as given.
  5943. By default 1 (if supported).
  5944. @item ft_load_flags
  5945. The flags to be used for loading the fonts.
  5946. The flags map the corresponding flags supported by libfreetype, and are
  5947. a combination of the following values:
  5948. @table @var
  5949. @item default
  5950. @item no_scale
  5951. @item no_hinting
  5952. @item render
  5953. @item no_bitmap
  5954. @item vertical_layout
  5955. @item force_autohint
  5956. @item crop_bitmap
  5957. @item pedantic
  5958. @item ignore_global_advance_width
  5959. @item no_recurse
  5960. @item ignore_transform
  5961. @item monochrome
  5962. @item linear_design
  5963. @item no_autohint
  5964. @end table
  5965. Default value is "default".
  5966. For more information consult the documentation for the FT_LOAD_*
  5967. libfreetype flags.
  5968. @item shadowcolor
  5969. The color to be used for drawing a shadow behind the drawn text. For the
  5970. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  5971. The default value of @var{shadowcolor} is "black".
  5972. @item shadowx
  5973. @item shadowy
  5974. The x and y offsets for the text shadow position with respect to the
  5975. position of the text. They can be either positive or negative
  5976. values. The default value for both is "0".
  5977. @item start_number
  5978. The starting frame number for the n/frame_num variable. The default value
  5979. is "0".
  5980. @item tabsize
  5981. The size in number of spaces to use for rendering the tab.
  5982. Default value is 4.
  5983. @item timecode
  5984. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5985. format. It can be used with or without text parameter. @var{timecode_rate}
  5986. option must be specified.
  5987. @item timecode_rate, rate, r
  5988. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  5989. integer. Minimum value is "1".
  5990. Drop-frame timecode is supported for frame rates 30 & 60.
  5991. @item tc24hmax
  5992. If set to 1, the output of the timecode option will wrap around at 24 hours.
  5993. Default is 0 (disabled).
  5994. @item text
  5995. The text string to be drawn. The text must be a sequence of UTF-8
  5996. encoded characters.
  5997. This parameter is mandatory if no file is specified with the parameter
  5998. @var{textfile}.
  5999. @item textfile
  6000. A text file containing text to be drawn. The text must be a sequence
  6001. of UTF-8 encoded characters.
  6002. This parameter is mandatory if no text string is specified with the
  6003. parameter @var{text}.
  6004. If both @var{text} and @var{textfile} are specified, an error is thrown.
  6005. @item reload
  6006. If set to 1, the @var{textfile} will be reloaded before each frame.
  6007. Be sure to update it atomically, or it may be read partially, or even fail.
  6008. @item x
  6009. @item y
  6010. The expressions which specify the offsets where text will be drawn
  6011. within the video frame. They are relative to the top/left border of the
  6012. output image.
  6013. The default value of @var{x} and @var{y} is "0".
  6014. See below for the list of accepted constants and functions.
  6015. @end table
  6016. The parameters for @var{x} and @var{y} are expressions containing the
  6017. following constants and functions:
  6018. @table @option
  6019. @item dar
  6020. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  6021. @item hsub
  6022. @item vsub
  6023. horizontal and vertical chroma subsample values. For example for the
  6024. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6025. @item line_h, lh
  6026. the height of each text line
  6027. @item main_h, h, H
  6028. the input height
  6029. @item main_w, w, W
  6030. the input width
  6031. @item max_glyph_a, ascent
  6032. the maximum distance from the baseline to the highest/upper grid
  6033. coordinate used to place a glyph outline point, for all the rendered
  6034. glyphs.
  6035. It is a positive value, due to the grid's orientation with the Y axis
  6036. upwards.
  6037. @item max_glyph_d, descent
  6038. the maximum distance from the baseline to the lowest grid coordinate
  6039. used to place a glyph outline point, for all the rendered glyphs.
  6040. This is a negative value, due to the grid's orientation, with the Y axis
  6041. upwards.
  6042. @item max_glyph_h
  6043. maximum glyph height, that is the maximum height for all the glyphs
  6044. contained in the rendered text, it is equivalent to @var{ascent} -
  6045. @var{descent}.
  6046. @item max_glyph_w
  6047. maximum glyph width, that is the maximum width for all the glyphs
  6048. contained in the rendered text
  6049. @item n
  6050. the number of input frame, starting from 0
  6051. @item rand(min, max)
  6052. return a random number included between @var{min} and @var{max}
  6053. @item sar
  6054. The input sample aspect ratio.
  6055. @item t
  6056. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6057. @item text_h, th
  6058. the height of the rendered text
  6059. @item text_w, tw
  6060. the width of the rendered text
  6061. @item x
  6062. @item y
  6063. the x and y offset coordinates where the text is drawn.
  6064. These parameters allow the @var{x} and @var{y} expressions to refer
  6065. each other, so you can for example specify @code{y=x/dar}.
  6066. @end table
  6067. @anchor{drawtext_expansion}
  6068. @subsection Text expansion
  6069. If @option{expansion} is set to @code{strftime},
  6070. the filter recognizes strftime() sequences in the provided text and
  6071. expands them accordingly. Check the documentation of strftime(). This
  6072. feature is deprecated.
  6073. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  6074. If @option{expansion} is set to @code{normal} (which is the default),
  6075. the following expansion mechanism is used.
  6076. The backslash character @samp{\}, followed by any character, always expands to
  6077. the second character.
  6078. Sequences of the form @code{%@{...@}} are expanded. The text between the
  6079. braces is a function name, possibly followed by arguments separated by ':'.
  6080. If the arguments contain special characters or delimiters (':' or '@}'),
  6081. they should be escaped.
  6082. Note that they probably must also be escaped as the value for the
  6083. @option{text} option in the filter argument string and as the filter
  6084. argument in the filtergraph description, and possibly also for the shell,
  6085. that makes up to four levels of escaping; using a text file avoids these
  6086. problems.
  6087. The following functions are available:
  6088. @table @command
  6089. @item expr, e
  6090. The expression evaluation result.
  6091. It must take one argument specifying the expression to be evaluated,
  6092. which accepts the same constants and functions as the @var{x} and
  6093. @var{y} values. Note that not all constants should be used, for
  6094. example the text size is not known when evaluating the expression, so
  6095. the constants @var{text_w} and @var{text_h} will have an undefined
  6096. value.
  6097. @item expr_int_format, eif
  6098. Evaluate the expression's value and output as formatted integer.
  6099. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  6100. The second argument specifies the output format. Allowed values are @samp{x},
  6101. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  6102. @code{printf} function.
  6103. The third parameter is optional and sets the number of positions taken by the output.
  6104. It can be used to add padding with zeros from the left.
  6105. @item gmtime
  6106. The time at which the filter is running, expressed in UTC.
  6107. It can accept an argument: a strftime() format string.
  6108. @item localtime
  6109. The time at which the filter is running, expressed in the local time zone.
  6110. It can accept an argument: a strftime() format string.
  6111. @item metadata
  6112. Frame metadata. Takes one or two arguments.
  6113. The first argument is mandatory and specifies the metadata key.
  6114. The second argument is optional and specifies a default value, used when the
  6115. metadata key is not found or empty.
  6116. @item n, frame_num
  6117. The frame number, starting from 0.
  6118. @item pict_type
  6119. A 1 character description of the current picture type.
  6120. @item pts
  6121. The timestamp of the current frame.
  6122. It can take up to three arguments.
  6123. The first argument is the format of the timestamp; it defaults to @code{flt}
  6124. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  6125. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  6126. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  6127. @code{localtime} stands for the timestamp of the frame formatted as
  6128. local time zone time.
  6129. The second argument is an offset added to the timestamp.
  6130. If the format is set to @code{localtime} or @code{gmtime},
  6131. a third argument may be supplied: a strftime() format string.
  6132. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  6133. @end table
  6134. @subsection Examples
  6135. @itemize
  6136. @item
  6137. Draw "Test Text" with font FreeSerif, using the default values for the
  6138. optional parameters.
  6139. @example
  6140. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  6141. @end example
  6142. @item
  6143. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  6144. and y=50 (counting from the top-left corner of the screen), text is
  6145. yellow with a red box around it. Both the text and the box have an
  6146. opacity of 20%.
  6147. @example
  6148. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  6149. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  6150. @end example
  6151. Note that the double quotes are not necessary if spaces are not used
  6152. within the parameter list.
  6153. @item
  6154. Show the text at the center of the video frame:
  6155. @example
  6156. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  6157. @end example
  6158. @item
  6159. Show the text at a random position, switching to a new position every 30 seconds:
  6160. @example
  6161. 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)"
  6162. @end example
  6163. @item
  6164. Show a text line sliding from right to left in the last row of the video
  6165. frame. The file @file{LONG_LINE} is assumed to contain a single line
  6166. with no newlines.
  6167. @example
  6168. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  6169. @end example
  6170. @item
  6171. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  6172. @example
  6173. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  6174. @end example
  6175. @item
  6176. Draw a single green letter "g", at the center of the input video.
  6177. The glyph baseline is placed at half screen height.
  6178. @example
  6179. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  6180. @end example
  6181. @item
  6182. Show text for 1 second every 3 seconds:
  6183. @example
  6184. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  6185. @end example
  6186. @item
  6187. Use fontconfig to set the font. Note that the colons need to be escaped.
  6188. @example
  6189. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  6190. @end example
  6191. @item
  6192. Print the date of a real-time encoding (see strftime(3)):
  6193. @example
  6194. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  6195. @end example
  6196. @item
  6197. Show text fading in and out (appearing/disappearing):
  6198. @example
  6199. #!/bin/sh
  6200. DS=1.0 # display start
  6201. DE=10.0 # display end
  6202. FID=1.5 # fade in duration
  6203. FOD=5 # fade out duration
  6204. 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 @}"
  6205. @end example
  6206. @item
  6207. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  6208. and the @option{fontsize} value are included in the @option{y} offset.
  6209. @example
  6210. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  6211. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  6212. @end example
  6213. @end itemize
  6214. For more information about libfreetype, check:
  6215. @url{http://www.freetype.org/}.
  6216. For more information about fontconfig, check:
  6217. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  6218. For more information about libfribidi, check:
  6219. @url{http://fribidi.org/}.
  6220. @section edgedetect
  6221. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  6222. The filter accepts the following options:
  6223. @table @option
  6224. @item low
  6225. @item high
  6226. Set low and high threshold values used by the Canny thresholding
  6227. algorithm.
  6228. The high threshold selects the "strong" edge pixels, which are then
  6229. connected through 8-connectivity with the "weak" edge pixels selected
  6230. by the low threshold.
  6231. @var{low} and @var{high} threshold values must be chosen in the range
  6232. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6233. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6234. is @code{50/255}.
  6235. @item mode
  6236. Define the drawing mode.
  6237. @table @samp
  6238. @item wires
  6239. Draw white/gray wires on black background.
  6240. @item colormix
  6241. Mix the colors to create a paint/cartoon effect.
  6242. @end table
  6243. Default value is @var{wires}.
  6244. @end table
  6245. @subsection Examples
  6246. @itemize
  6247. @item
  6248. Standard edge detection with custom values for the hysteresis thresholding:
  6249. @example
  6250. edgedetect=low=0.1:high=0.4
  6251. @end example
  6252. @item
  6253. Painting effect without thresholding:
  6254. @example
  6255. edgedetect=mode=colormix:high=0
  6256. @end example
  6257. @end itemize
  6258. @section eq
  6259. Set brightness, contrast, saturation and approximate gamma adjustment.
  6260. The filter accepts the following options:
  6261. @table @option
  6262. @item contrast
  6263. Set the contrast expression. The value must be a float value in range
  6264. @code{-2.0} to @code{2.0}. The default value is "1".
  6265. @item brightness
  6266. Set the brightness expression. The value must be a float value in
  6267. range @code{-1.0} to @code{1.0}. The default value is "0".
  6268. @item saturation
  6269. Set the saturation expression. The value must be a float in
  6270. range @code{0.0} to @code{3.0}. The default value is "1".
  6271. @item gamma
  6272. Set the gamma expression. The value must be a float in range
  6273. @code{0.1} to @code{10.0}. The default value is "1".
  6274. @item gamma_r
  6275. Set the gamma expression for red. The value must be a float in
  6276. range @code{0.1} to @code{10.0}. The default value is "1".
  6277. @item gamma_g
  6278. Set the gamma expression for green. The value must be a float in range
  6279. @code{0.1} to @code{10.0}. The default value is "1".
  6280. @item gamma_b
  6281. Set the gamma expression for blue. The value must be a float in range
  6282. @code{0.1} to @code{10.0}. The default value is "1".
  6283. @item gamma_weight
  6284. Set the gamma weight expression. It can be used to reduce the effect
  6285. of a high gamma value on bright image areas, e.g. keep them from
  6286. getting overamplified and just plain white. The value must be a float
  6287. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  6288. gamma correction all the way down while @code{1.0} leaves it at its
  6289. full strength. Default is "1".
  6290. @item eval
  6291. Set when the expressions for brightness, contrast, saturation and
  6292. gamma expressions are evaluated.
  6293. It accepts the following values:
  6294. @table @samp
  6295. @item init
  6296. only evaluate expressions once during the filter initialization or
  6297. when a command is processed
  6298. @item frame
  6299. evaluate expressions for each incoming frame
  6300. @end table
  6301. Default value is @samp{init}.
  6302. @end table
  6303. The expressions accept the following parameters:
  6304. @table @option
  6305. @item n
  6306. frame count of the input frame starting from 0
  6307. @item pos
  6308. byte position of the corresponding packet in the input file, NAN if
  6309. unspecified
  6310. @item r
  6311. frame rate of the input video, NAN if the input frame rate is unknown
  6312. @item t
  6313. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6314. @end table
  6315. @subsection Commands
  6316. The filter supports the following commands:
  6317. @table @option
  6318. @item contrast
  6319. Set the contrast expression.
  6320. @item brightness
  6321. Set the brightness expression.
  6322. @item saturation
  6323. Set the saturation expression.
  6324. @item gamma
  6325. Set the gamma expression.
  6326. @item gamma_r
  6327. Set the gamma_r expression.
  6328. @item gamma_g
  6329. Set gamma_g expression.
  6330. @item gamma_b
  6331. Set gamma_b expression.
  6332. @item gamma_weight
  6333. Set gamma_weight expression.
  6334. The command accepts the same syntax of the corresponding option.
  6335. If the specified expression is not valid, it is kept at its current
  6336. value.
  6337. @end table
  6338. @section erosion
  6339. Apply erosion effect to the video.
  6340. This filter replaces the pixel by the local(3x3) minimum.
  6341. It accepts the following options:
  6342. @table @option
  6343. @item threshold0
  6344. @item threshold1
  6345. @item threshold2
  6346. @item threshold3
  6347. Limit the maximum change for each plane, default is 65535.
  6348. If 0, plane will remain unchanged.
  6349. @item coordinates
  6350. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6351. pixels are used.
  6352. Flags to local 3x3 coordinates maps like this:
  6353. 1 2 3
  6354. 4 5
  6355. 6 7 8
  6356. @end table
  6357. @section extractplanes
  6358. Extract color channel components from input video stream into
  6359. separate grayscale video streams.
  6360. The filter accepts the following option:
  6361. @table @option
  6362. @item planes
  6363. Set plane(s) to extract.
  6364. Available values for planes are:
  6365. @table @samp
  6366. @item y
  6367. @item u
  6368. @item v
  6369. @item a
  6370. @item r
  6371. @item g
  6372. @item b
  6373. @end table
  6374. Choosing planes not available in the input will result in an error.
  6375. That means you cannot select @code{r}, @code{g}, @code{b} planes
  6376. with @code{y}, @code{u}, @code{v} planes at same time.
  6377. @end table
  6378. @subsection Examples
  6379. @itemize
  6380. @item
  6381. Extract luma, u and v color channel component from input video frame
  6382. into 3 grayscale outputs:
  6383. @example
  6384. 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
  6385. @end example
  6386. @end itemize
  6387. @section elbg
  6388. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  6389. For each input image, the filter will compute the optimal mapping from
  6390. the input to the output given the codebook length, that is the number
  6391. of distinct output colors.
  6392. This filter accepts the following options.
  6393. @table @option
  6394. @item codebook_length, l
  6395. Set codebook length. The value must be a positive integer, and
  6396. represents the number of distinct output colors. Default value is 256.
  6397. @item nb_steps, n
  6398. Set the maximum number of iterations to apply for computing the optimal
  6399. mapping. The higher the value the better the result and the higher the
  6400. computation time. Default value is 1.
  6401. @item seed, s
  6402. Set a random seed, must be an integer included between 0 and
  6403. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  6404. will try to use a good random seed on a best effort basis.
  6405. @item pal8
  6406. Set pal8 output pixel format. This option does not work with codebook
  6407. length greater than 256.
  6408. @end table
  6409. @section entropy
  6410. Measure graylevel entropy in histogram of color channels of video frames.
  6411. It accepts the following parameters:
  6412. @table @option
  6413. @item mode
  6414. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  6415. @var{diff} mode measures entropy of histogram delta values, absolute differences
  6416. between neighbour histogram values.
  6417. @end table
  6418. @section fade
  6419. Apply a fade-in/out effect to the input video.
  6420. It accepts the following parameters:
  6421. @table @option
  6422. @item type, t
  6423. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  6424. effect.
  6425. Default is @code{in}.
  6426. @item start_frame, s
  6427. Specify the number of the frame to start applying the fade
  6428. effect at. Default is 0.
  6429. @item nb_frames, n
  6430. The number of frames that the fade effect lasts. At the end of the
  6431. fade-in effect, the output video will have the same intensity as the input video.
  6432. At the end of the fade-out transition, the output video will be filled with the
  6433. selected @option{color}.
  6434. Default is 25.
  6435. @item alpha
  6436. If set to 1, fade only alpha channel, if one exists on the input.
  6437. Default value is 0.
  6438. @item start_time, st
  6439. Specify the timestamp (in seconds) of the frame to start to apply the fade
  6440. effect. If both start_frame and start_time are specified, the fade will start at
  6441. whichever comes last. Default is 0.
  6442. @item duration, d
  6443. The number of seconds for which the fade effect has to last. At the end of the
  6444. fade-in effect the output video will have the same intensity as the input video,
  6445. at the end of the fade-out transition the output video will be filled with the
  6446. selected @option{color}.
  6447. If both duration and nb_frames are specified, duration is used. Default is 0
  6448. (nb_frames is used by default).
  6449. @item color, c
  6450. Specify the color of the fade. Default is "black".
  6451. @end table
  6452. @subsection Examples
  6453. @itemize
  6454. @item
  6455. Fade in the first 30 frames of video:
  6456. @example
  6457. fade=in:0:30
  6458. @end example
  6459. The command above is equivalent to:
  6460. @example
  6461. fade=t=in:s=0:n=30
  6462. @end example
  6463. @item
  6464. Fade out the last 45 frames of a 200-frame video:
  6465. @example
  6466. fade=out:155:45
  6467. fade=type=out:start_frame=155:nb_frames=45
  6468. @end example
  6469. @item
  6470. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  6471. @example
  6472. fade=in:0:25, fade=out:975:25
  6473. @end example
  6474. @item
  6475. Make the first 5 frames yellow, then fade in from frame 5-24:
  6476. @example
  6477. fade=in:5:20:color=yellow
  6478. @end example
  6479. @item
  6480. Fade in alpha over first 25 frames of video:
  6481. @example
  6482. fade=in:0:25:alpha=1
  6483. @end example
  6484. @item
  6485. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  6486. @example
  6487. fade=t=in:st=5.5:d=0.5
  6488. @end example
  6489. @end itemize
  6490. @section fftfilt
  6491. Apply arbitrary expressions to samples in frequency domain
  6492. @table @option
  6493. @item dc_Y
  6494. Adjust the dc value (gain) of the luma plane of the image. The filter
  6495. accepts an integer value in range @code{0} to @code{1000}. The default
  6496. value is set to @code{0}.
  6497. @item dc_U
  6498. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  6499. filter accepts an integer value in range @code{0} to @code{1000}. The
  6500. default value is set to @code{0}.
  6501. @item dc_V
  6502. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  6503. filter accepts an integer value in range @code{0} to @code{1000}. The
  6504. default value is set to @code{0}.
  6505. @item weight_Y
  6506. Set the frequency domain weight expression for the luma plane.
  6507. @item weight_U
  6508. Set the frequency domain weight expression for the 1st chroma plane.
  6509. @item weight_V
  6510. Set the frequency domain weight expression for the 2nd chroma plane.
  6511. @item eval
  6512. Set when the expressions are evaluated.
  6513. It accepts the following values:
  6514. @table @samp
  6515. @item init
  6516. Only evaluate expressions once during the filter initialization.
  6517. @item frame
  6518. Evaluate expressions for each incoming frame.
  6519. @end table
  6520. Default value is @samp{init}.
  6521. The filter accepts the following variables:
  6522. @item X
  6523. @item Y
  6524. The coordinates of the current sample.
  6525. @item W
  6526. @item H
  6527. The width and height of the image.
  6528. @item N
  6529. The number of input frame, starting from 0.
  6530. @end table
  6531. @subsection Examples
  6532. @itemize
  6533. @item
  6534. High-pass:
  6535. @example
  6536. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  6537. @end example
  6538. @item
  6539. Low-pass:
  6540. @example
  6541. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  6542. @end example
  6543. @item
  6544. Sharpen:
  6545. @example
  6546. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  6547. @end example
  6548. @item
  6549. Blur:
  6550. @example
  6551. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  6552. @end example
  6553. @end itemize
  6554. @section field
  6555. Extract a single field from an interlaced image using stride
  6556. arithmetic to avoid wasting CPU time. The output frames are marked as
  6557. non-interlaced.
  6558. The filter accepts the following options:
  6559. @table @option
  6560. @item type
  6561. Specify whether to extract the top (if the value is @code{0} or
  6562. @code{top}) or the bottom field (if the value is @code{1} or
  6563. @code{bottom}).
  6564. @end table
  6565. @section fieldhint
  6566. Create new frames by copying the top and bottom fields from surrounding frames
  6567. supplied as numbers by the hint file.
  6568. @table @option
  6569. @item hint
  6570. Set file containing hints: absolute/relative frame numbers.
  6571. There must be one line for each frame in a clip. Each line must contain two
  6572. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  6573. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  6574. is current frame number for @code{absolute} mode or out of [-1, 1] range
  6575. for @code{relative} mode. First number tells from which frame to pick up top
  6576. field and second number tells from which frame to pick up bottom field.
  6577. If optionally followed by @code{+} output frame will be marked as interlaced,
  6578. else if followed by @code{-} output frame will be marked as progressive, else
  6579. it will be marked same as input frame.
  6580. If line starts with @code{#} or @code{;} that line is skipped.
  6581. @item mode
  6582. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  6583. @end table
  6584. Example of first several lines of @code{hint} file for @code{relative} mode:
  6585. @example
  6586. 0,0 - # first frame
  6587. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  6588. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  6589. 1,0 -
  6590. 0,0 -
  6591. 0,0 -
  6592. 1,0 -
  6593. 1,0 -
  6594. 1,0 -
  6595. 0,0 -
  6596. 0,0 -
  6597. 1,0 -
  6598. 1,0 -
  6599. 1,0 -
  6600. 0,0 -
  6601. @end example
  6602. @section fieldmatch
  6603. Field matching filter for inverse telecine. It is meant to reconstruct the
  6604. progressive frames from a telecined stream. The filter does not drop duplicated
  6605. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  6606. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  6607. The separation of the field matching and the decimation is notably motivated by
  6608. the possibility of inserting a de-interlacing filter fallback between the two.
  6609. If the source has mixed telecined and real interlaced content,
  6610. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  6611. But these remaining combed frames will be marked as interlaced, and thus can be
  6612. de-interlaced by a later filter such as @ref{yadif} before decimation.
  6613. In addition to the various configuration options, @code{fieldmatch} can take an
  6614. optional second stream, activated through the @option{ppsrc} option. If
  6615. enabled, the frames reconstruction will be based on the fields and frames from
  6616. this second stream. This allows the first input to be pre-processed in order to
  6617. help the various algorithms of the filter, while keeping the output lossless
  6618. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  6619. or brightness/contrast adjustments can help.
  6620. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  6621. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  6622. which @code{fieldmatch} is based on. While the semantic and usage are very
  6623. close, some behaviour and options names can differ.
  6624. The @ref{decimate} filter currently only works for constant frame rate input.
  6625. If your input has mixed telecined (30fps) and progressive content with a lower
  6626. framerate like 24fps use the following filterchain to produce the necessary cfr
  6627. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  6628. The filter accepts the following options:
  6629. @table @option
  6630. @item order
  6631. Specify the assumed field order of the input stream. Available values are:
  6632. @table @samp
  6633. @item auto
  6634. Auto detect parity (use FFmpeg's internal parity value).
  6635. @item bff
  6636. Assume bottom field first.
  6637. @item tff
  6638. Assume top field first.
  6639. @end table
  6640. Note that it is sometimes recommended not to trust the parity announced by the
  6641. stream.
  6642. Default value is @var{auto}.
  6643. @item mode
  6644. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  6645. sense that it won't risk creating jerkiness due to duplicate frames when
  6646. possible, but if there are bad edits or blended fields it will end up
  6647. outputting combed frames when a good match might actually exist. On the other
  6648. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  6649. but will almost always find a good frame if there is one. The other values are
  6650. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  6651. jerkiness and creating duplicate frames versus finding good matches in sections
  6652. with bad edits, orphaned fields, blended fields, etc.
  6653. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  6654. Available values are:
  6655. @table @samp
  6656. @item pc
  6657. 2-way matching (p/c)
  6658. @item pc_n
  6659. 2-way matching, and trying 3rd match if still combed (p/c + n)
  6660. @item pc_u
  6661. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  6662. @item pc_n_ub
  6663. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  6664. still combed (p/c + n + u/b)
  6665. @item pcn
  6666. 3-way matching (p/c/n)
  6667. @item pcn_ub
  6668. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  6669. detected as combed (p/c/n + u/b)
  6670. @end table
  6671. The parenthesis at the end indicate the matches that would be used for that
  6672. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  6673. @var{top}).
  6674. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  6675. the slowest.
  6676. Default value is @var{pc_n}.
  6677. @item ppsrc
  6678. Mark the main input stream as a pre-processed input, and enable the secondary
  6679. input stream as the clean source to pick the fields from. See the filter
  6680. introduction for more details. It is similar to the @option{clip2} feature from
  6681. VFM/TFM.
  6682. Default value is @code{0} (disabled).
  6683. @item field
  6684. Set the field to match from. It is recommended to set this to the same value as
  6685. @option{order} unless you experience matching failures with that setting. In
  6686. certain circumstances changing the field that is used to match from can have a
  6687. large impact on matching performance. Available values are:
  6688. @table @samp
  6689. @item auto
  6690. Automatic (same value as @option{order}).
  6691. @item bottom
  6692. Match from the bottom field.
  6693. @item top
  6694. Match from the top field.
  6695. @end table
  6696. Default value is @var{auto}.
  6697. @item mchroma
  6698. Set whether or not chroma is included during the match comparisons. In most
  6699. cases it is recommended to leave this enabled. You should set this to @code{0}
  6700. only if your clip has bad chroma problems such as heavy rainbowing or other
  6701. artifacts. Setting this to @code{0} could also be used to speed things up at
  6702. the cost of some accuracy.
  6703. Default value is @code{1}.
  6704. @item y0
  6705. @item y1
  6706. These define an exclusion band which excludes the lines between @option{y0} and
  6707. @option{y1} from being included in the field matching decision. An exclusion
  6708. band can be used to ignore subtitles, a logo, or other things that may
  6709. interfere with the matching. @option{y0} sets the starting scan line and
  6710. @option{y1} sets the ending line; all lines in between @option{y0} and
  6711. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6712. @option{y0} and @option{y1} to the same value will disable the feature.
  6713. @option{y0} and @option{y1} defaults to @code{0}.
  6714. @item scthresh
  6715. Set the scene change detection threshold as a percentage of maximum change on
  6716. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6717. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6718. @option{scthresh} is @code{[0.0, 100.0]}.
  6719. Default value is @code{12.0}.
  6720. @item combmatch
  6721. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6722. account the combed scores of matches when deciding what match to use as the
  6723. final match. Available values are:
  6724. @table @samp
  6725. @item none
  6726. No final matching based on combed scores.
  6727. @item sc
  6728. Combed scores are only used when a scene change is detected.
  6729. @item full
  6730. Use combed scores all the time.
  6731. @end table
  6732. Default is @var{sc}.
  6733. @item combdbg
  6734. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  6735. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  6736. Available values are:
  6737. @table @samp
  6738. @item none
  6739. No forced calculation.
  6740. @item pcn
  6741. Force p/c/n calculations.
  6742. @item pcnub
  6743. Force p/c/n/u/b calculations.
  6744. @end table
  6745. Default value is @var{none}.
  6746. @item cthresh
  6747. This is the area combing threshold used for combed frame detection. This
  6748. essentially controls how "strong" or "visible" combing must be to be detected.
  6749. Larger values mean combing must be more visible and smaller values mean combing
  6750. can be less visible or strong and still be detected. Valid settings are from
  6751. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6752. be detected as combed). This is basically a pixel difference value. A good
  6753. range is @code{[8, 12]}.
  6754. Default value is @code{9}.
  6755. @item chroma
  6756. Sets whether or not chroma is considered in the combed frame decision. Only
  6757. disable this if your source has chroma problems (rainbowing, etc.) that are
  6758. causing problems for the combed frame detection with chroma enabled. Actually,
  6759. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6760. where there is chroma only combing in the source.
  6761. Default value is @code{0}.
  6762. @item blockx
  6763. @item blocky
  6764. Respectively set the x-axis and y-axis size of the window used during combed
  6765. frame detection. This has to do with the size of the area in which
  6766. @option{combpel} pixels are required to be detected as combed for a frame to be
  6767. declared combed. See the @option{combpel} parameter description for more info.
  6768. Possible values are any number that is a power of 2 starting at 4 and going up
  6769. to 512.
  6770. Default value is @code{16}.
  6771. @item combpel
  6772. The number of combed pixels inside any of the @option{blocky} by
  6773. @option{blockx} size blocks on the frame for the frame to be detected as
  6774. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6775. setting controls "how much" combing there must be in any localized area (a
  6776. window defined by the @option{blockx} and @option{blocky} settings) on the
  6777. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6778. which point no frames will ever be detected as combed). This setting is known
  6779. as @option{MI} in TFM/VFM vocabulary.
  6780. Default value is @code{80}.
  6781. @end table
  6782. @anchor{p/c/n/u/b meaning}
  6783. @subsection p/c/n/u/b meaning
  6784. @subsubsection p/c/n
  6785. We assume the following telecined stream:
  6786. @example
  6787. Top fields: 1 2 2 3 4
  6788. Bottom fields: 1 2 3 4 4
  6789. @end example
  6790. The numbers correspond to the progressive frame the fields relate to. Here, the
  6791. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6792. When @code{fieldmatch} is configured to run a matching from bottom
  6793. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6794. @example
  6795. Input stream:
  6796. T 1 2 2 3 4
  6797. B 1 2 3 4 4 <-- matching reference
  6798. Matches: c c n n c
  6799. Output stream:
  6800. T 1 2 3 4 4
  6801. B 1 2 3 4 4
  6802. @end example
  6803. As a result of the field matching, we can see that some frames get duplicated.
  6804. To perform a complete inverse telecine, you need to rely on a decimation filter
  6805. after this operation. See for instance the @ref{decimate} filter.
  6806. The same operation now matching from top fields (@option{field}=@var{top})
  6807. looks like this:
  6808. @example
  6809. Input stream:
  6810. T 1 2 2 3 4 <-- matching reference
  6811. B 1 2 3 4 4
  6812. Matches: c c p p c
  6813. Output stream:
  6814. T 1 2 2 3 4
  6815. B 1 2 2 3 4
  6816. @end example
  6817. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6818. basically, they refer to the frame and field of the opposite parity:
  6819. @itemize
  6820. @item @var{p} matches the field of the opposite parity in the previous frame
  6821. @item @var{c} matches the field of the opposite parity in the current frame
  6822. @item @var{n} matches the field of the opposite parity in the next frame
  6823. @end itemize
  6824. @subsubsection u/b
  6825. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6826. from the opposite parity flag. In the following examples, we assume that we are
  6827. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6828. 'x' is placed above and below each matched fields.
  6829. With bottom matching (@option{field}=@var{bottom}):
  6830. @example
  6831. Match: c p n b u
  6832. x x x x x
  6833. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6834. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6835. x x x x x
  6836. Output frames:
  6837. 2 1 2 2 2
  6838. 2 2 2 1 3
  6839. @end example
  6840. With top matching (@option{field}=@var{top}):
  6841. @example
  6842. Match: c p n b u
  6843. x x x x x
  6844. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6845. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6846. x x x x x
  6847. Output frames:
  6848. 2 2 2 1 2
  6849. 2 1 3 2 2
  6850. @end example
  6851. @subsection Examples
  6852. Simple IVTC of a top field first telecined stream:
  6853. @example
  6854. fieldmatch=order=tff:combmatch=none, decimate
  6855. @end example
  6856. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6857. @example
  6858. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6859. @end example
  6860. @section fieldorder
  6861. Transform the field order of the input video.
  6862. It accepts the following parameters:
  6863. @table @option
  6864. @item order
  6865. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6866. for bottom field first.
  6867. @end table
  6868. The default value is @samp{tff}.
  6869. The transformation is done by shifting the picture content up or down
  6870. by one line, and filling the remaining line with appropriate picture content.
  6871. This method is consistent with most broadcast field order converters.
  6872. If the input video is not flagged as being interlaced, or it is already
  6873. flagged as being of the required output field order, then this filter does
  6874. not alter the incoming video.
  6875. It is very useful when converting to or from PAL DV material,
  6876. which is bottom field first.
  6877. For example:
  6878. @example
  6879. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6880. @end example
  6881. @section fifo, afifo
  6882. Buffer input images and send them when they are requested.
  6883. It is mainly useful when auto-inserted by the libavfilter
  6884. framework.
  6885. It does not take parameters.
  6886. @section fillborders
  6887. Fill borders of the input video, without changing video stream dimensions.
  6888. Sometimes video can have garbage at the four edges and you may not want to
  6889. crop video input to keep size multiple of some number.
  6890. This filter accepts the following options:
  6891. @table @option
  6892. @item left
  6893. Number of pixels to fill from left border.
  6894. @item right
  6895. Number of pixels to fill from right border.
  6896. @item top
  6897. Number of pixels to fill from top border.
  6898. @item bottom
  6899. Number of pixels to fill from bottom border.
  6900. @item mode
  6901. Set fill mode.
  6902. It accepts the following values:
  6903. @table @samp
  6904. @item smear
  6905. fill pixels using outermost pixels
  6906. @item mirror
  6907. fill pixels using mirroring
  6908. @item fixed
  6909. fill pixels with constant value
  6910. @end table
  6911. Default is @var{smear}.
  6912. @item color
  6913. Set color for pixels in fixed mode. Default is @var{black}.
  6914. @end table
  6915. @section find_rect
  6916. Find a rectangular object
  6917. It accepts the following options:
  6918. @table @option
  6919. @item object
  6920. Filepath of the object image, needs to be in gray8.
  6921. @item threshold
  6922. Detection threshold, default is 0.5.
  6923. @item mipmaps
  6924. Number of mipmaps, default is 3.
  6925. @item xmin, ymin, xmax, ymax
  6926. Specifies the rectangle in which to search.
  6927. @end table
  6928. @subsection Examples
  6929. @itemize
  6930. @item
  6931. Generate a representative palette of a given video using @command{ffmpeg}:
  6932. @example
  6933. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6934. @end example
  6935. @end itemize
  6936. @section cover_rect
  6937. Cover a rectangular object
  6938. It accepts the following options:
  6939. @table @option
  6940. @item cover
  6941. Filepath of the optional cover image, needs to be in yuv420.
  6942. @item mode
  6943. Set covering mode.
  6944. It accepts the following values:
  6945. @table @samp
  6946. @item cover
  6947. cover it by the supplied image
  6948. @item blur
  6949. cover it by interpolating the surrounding pixels
  6950. @end table
  6951. Default value is @var{blur}.
  6952. @end table
  6953. @subsection Examples
  6954. @itemize
  6955. @item
  6956. Generate a representative palette of a given video using @command{ffmpeg}:
  6957. @example
  6958. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6959. @end example
  6960. @end itemize
  6961. @section floodfill
  6962. Flood area with values of same pixel components with another values.
  6963. It accepts the following options:
  6964. @table @option
  6965. @item x
  6966. Set pixel x coordinate.
  6967. @item y
  6968. Set pixel y coordinate.
  6969. @item s0
  6970. Set source #0 component value.
  6971. @item s1
  6972. Set source #1 component value.
  6973. @item s2
  6974. Set source #2 component value.
  6975. @item s3
  6976. Set source #3 component value.
  6977. @item d0
  6978. Set destination #0 component value.
  6979. @item d1
  6980. Set destination #1 component value.
  6981. @item d2
  6982. Set destination #2 component value.
  6983. @item d3
  6984. Set destination #3 component value.
  6985. @end table
  6986. @anchor{format}
  6987. @section format
  6988. Convert the input video to one of the specified pixel formats.
  6989. Libavfilter will try to pick one that is suitable as input to
  6990. the next filter.
  6991. It accepts the following parameters:
  6992. @table @option
  6993. @item pix_fmts
  6994. A '|'-separated list of pixel format names, such as
  6995. "pix_fmts=yuv420p|monow|rgb24".
  6996. @end table
  6997. @subsection Examples
  6998. @itemize
  6999. @item
  7000. Convert the input video to the @var{yuv420p} format
  7001. @example
  7002. format=pix_fmts=yuv420p
  7003. @end example
  7004. Convert the input video to any of the formats in the list
  7005. @example
  7006. format=pix_fmts=yuv420p|yuv444p|yuv410p
  7007. @end example
  7008. @end itemize
  7009. @anchor{fps}
  7010. @section fps
  7011. Convert the video to specified constant frame rate by duplicating or dropping
  7012. frames as necessary.
  7013. It accepts the following parameters:
  7014. @table @option
  7015. @item fps
  7016. The desired output frame rate. The default is @code{25}.
  7017. @item start_time
  7018. Assume the first PTS should be the given value, in seconds. This allows for
  7019. padding/trimming at the start of stream. By default, no assumption is made
  7020. about the first frame's expected PTS, so no padding or trimming is done.
  7021. For example, this could be set to 0 to pad the beginning with duplicates of
  7022. the first frame if a video stream starts after the audio stream or to trim any
  7023. frames with a negative PTS.
  7024. @item round
  7025. Timestamp (PTS) rounding method.
  7026. Possible values are:
  7027. @table @option
  7028. @item zero
  7029. round towards 0
  7030. @item inf
  7031. round away from 0
  7032. @item down
  7033. round towards -infinity
  7034. @item up
  7035. round towards +infinity
  7036. @item near
  7037. round to nearest
  7038. @end table
  7039. The default is @code{near}.
  7040. @item eof_action
  7041. Action performed when reading the last frame.
  7042. Possible values are:
  7043. @table @option
  7044. @item round
  7045. Use same timestamp rounding method as used for other frames.
  7046. @item pass
  7047. Pass through last frame if input duration has not been reached yet.
  7048. @end table
  7049. The default is @code{round}.
  7050. @end table
  7051. Alternatively, the options can be specified as a flat string:
  7052. @var{fps}[:@var{start_time}[:@var{round}]].
  7053. See also the @ref{setpts} filter.
  7054. @subsection Examples
  7055. @itemize
  7056. @item
  7057. A typical usage in order to set the fps to 25:
  7058. @example
  7059. fps=fps=25
  7060. @end example
  7061. @item
  7062. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  7063. @example
  7064. fps=fps=film:round=near
  7065. @end example
  7066. @end itemize
  7067. @section framepack
  7068. Pack two different video streams into a stereoscopic video, setting proper
  7069. metadata on supported codecs. The two views should have the same size and
  7070. framerate and processing will stop when the shorter video ends. Please note
  7071. that you may conveniently adjust view properties with the @ref{scale} and
  7072. @ref{fps} filters.
  7073. It accepts the following parameters:
  7074. @table @option
  7075. @item format
  7076. The desired packing format. Supported values are:
  7077. @table @option
  7078. @item sbs
  7079. The views are next to each other (default).
  7080. @item tab
  7081. The views are on top of each other.
  7082. @item lines
  7083. The views are packed by line.
  7084. @item columns
  7085. The views are packed by column.
  7086. @item frameseq
  7087. The views are temporally interleaved.
  7088. @end table
  7089. @end table
  7090. Some examples:
  7091. @example
  7092. # Convert left and right views into a frame-sequential video
  7093. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  7094. # Convert views into a side-by-side video with the same output resolution as the input
  7095. 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
  7096. @end example
  7097. @section framerate
  7098. Change the frame rate by interpolating new video output frames from the source
  7099. frames.
  7100. This filter is not designed to function correctly with interlaced media. If
  7101. you wish to change the frame rate of interlaced media then you are required
  7102. to deinterlace before this filter and re-interlace after this filter.
  7103. A description of the accepted options follows.
  7104. @table @option
  7105. @item fps
  7106. Specify the output frames per second. This option can also be specified
  7107. as a value alone. The default is @code{50}.
  7108. @item interp_start
  7109. Specify the start of a range where the output frame will be created as a
  7110. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7111. the default is @code{15}.
  7112. @item interp_end
  7113. Specify the end of a range where the output frame will be created as a
  7114. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7115. the default is @code{240}.
  7116. @item scene
  7117. Specify the level at which a scene change is detected as a value between
  7118. 0 and 100 to indicate a new scene; a low value reflects a low
  7119. probability for the current frame to introduce a new scene, while a higher
  7120. value means the current frame is more likely to be one.
  7121. The default is @code{8.2}.
  7122. @item flags
  7123. Specify flags influencing the filter process.
  7124. Available value for @var{flags} is:
  7125. @table @option
  7126. @item scene_change_detect, scd
  7127. Enable scene change detection using the value of the option @var{scene}.
  7128. This flag is enabled by default.
  7129. @end table
  7130. @end table
  7131. @section framestep
  7132. Select one frame every N-th frame.
  7133. This filter accepts the following option:
  7134. @table @option
  7135. @item step
  7136. Select frame after every @code{step} frames.
  7137. Allowed values are positive integers higher than 0. Default value is @code{1}.
  7138. @end table
  7139. @anchor{frei0r}
  7140. @section frei0r
  7141. Apply a frei0r effect to the input video.
  7142. To enable the compilation of this filter, you need to install the frei0r
  7143. header and configure FFmpeg with @code{--enable-frei0r}.
  7144. It accepts the following parameters:
  7145. @table @option
  7146. @item filter_name
  7147. The name of the frei0r effect to load. If the environment variable
  7148. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  7149. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  7150. Otherwise, the standard frei0r paths are searched, in this order:
  7151. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  7152. @file{/usr/lib/frei0r-1/}.
  7153. @item filter_params
  7154. A '|'-separated list of parameters to pass to the frei0r effect.
  7155. @end table
  7156. A frei0r effect parameter can be a boolean (its value is either
  7157. "y" or "n"), a double, a color (specified as
  7158. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  7159. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  7160. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  7161. @var{X} and @var{Y} are floating point numbers) and/or a string.
  7162. The number and types of parameters depend on the loaded effect. If an
  7163. effect parameter is not specified, the default value is set.
  7164. @subsection Examples
  7165. @itemize
  7166. @item
  7167. Apply the distort0r effect, setting the first two double parameters:
  7168. @example
  7169. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  7170. @end example
  7171. @item
  7172. Apply the colordistance effect, taking a color as the first parameter:
  7173. @example
  7174. frei0r=colordistance:0.2/0.3/0.4
  7175. frei0r=colordistance:violet
  7176. frei0r=colordistance:0x112233
  7177. @end example
  7178. @item
  7179. Apply the perspective effect, specifying the top left and top right image
  7180. positions:
  7181. @example
  7182. frei0r=perspective:0.2/0.2|0.8/0.2
  7183. @end example
  7184. @end itemize
  7185. For more information, see
  7186. @url{http://frei0r.dyne.org}
  7187. @section fspp
  7188. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  7189. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  7190. processing filter, one of them is performed once per block, not per pixel.
  7191. This allows for much higher speed.
  7192. The filter accepts the following options:
  7193. @table @option
  7194. @item quality
  7195. Set quality. This option defines the number of levels for averaging. It accepts
  7196. an integer in the range 4-5. Default value is @code{4}.
  7197. @item qp
  7198. Force a constant quantization parameter. It accepts an integer in range 0-63.
  7199. If not set, the filter will use the QP from the video stream (if available).
  7200. @item strength
  7201. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  7202. more details but also more artifacts, while higher values make the image smoother
  7203. but also blurrier. Default value is @code{0} − PSNR optimal.
  7204. @item use_bframe_qp
  7205. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  7206. option may cause flicker since the B-Frames have often larger QP. Default is
  7207. @code{0} (not enabled).
  7208. @end table
  7209. @section gblur
  7210. Apply Gaussian blur filter.
  7211. The filter accepts the following options:
  7212. @table @option
  7213. @item sigma
  7214. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  7215. @item steps
  7216. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  7217. @item planes
  7218. Set which planes to filter. By default all planes are filtered.
  7219. @item sigmaV
  7220. Set vertical sigma, if negative it will be same as @code{sigma}.
  7221. Default is @code{-1}.
  7222. @end table
  7223. @section geq
  7224. The filter accepts the following options:
  7225. @table @option
  7226. @item lum_expr, lum
  7227. Set the luminance expression.
  7228. @item cb_expr, cb
  7229. Set the chrominance blue expression.
  7230. @item cr_expr, cr
  7231. Set the chrominance red expression.
  7232. @item alpha_expr, a
  7233. Set the alpha expression.
  7234. @item red_expr, r
  7235. Set the red expression.
  7236. @item green_expr, g
  7237. Set the green expression.
  7238. @item blue_expr, b
  7239. Set the blue expression.
  7240. @end table
  7241. The colorspace is selected according to the specified options. If one
  7242. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  7243. options is specified, the filter will automatically select a YCbCr
  7244. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  7245. @option{blue_expr} options is specified, it will select an RGB
  7246. colorspace.
  7247. If one of the chrominance expression is not defined, it falls back on the other
  7248. one. If no alpha expression is specified it will evaluate to opaque value.
  7249. If none of chrominance expressions are specified, they will evaluate
  7250. to the luminance expression.
  7251. The expressions can use the following variables and functions:
  7252. @table @option
  7253. @item N
  7254. The sequential number of the filtered frame, starting from @code{0}.
  7255. @item X
  7256. @item Y
  7257. The coordinates of the current sample.
  7258. @item W
  7259. @item H
  7260. The width and height of the image.
  7261. @item SW
  7262. @item SH
  7263. Width and height scale depending on the currently filtered plane. It is the
  7264. ratio between the corresponding luma plane number of pixels and the current
  7265. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  7266. @code{0.5,0.5} for chroma planes.
  7267. @item T
  7268. Time of the current frame, expressed in seconds.
  7269. @item p(x, y)
  7270. Return the value of the pixel at location (@var{x},@var{y}) of the current
  7271. plane.
  7272. @item lum(x, y)
  7273. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  7274. plane.
  7275. @item cb(x, y)
  7276. Return the value of the pixel at location (@var{x},@var{y}) of the
  7277. blue-difference chroma plane. Return 0 if there is no such plane.
  7278. @item cr(x, y)
  7279. Return the value of the pixel at location (@var{x},@var{y}) of the
  7280. red-difference chroma plane. Return 0 if there is no such plane.
  7281. @item r(x, y)
  7282. @item g(x, y)
  7283. @item b(x, y)
  7284. Return the value of the pixel at location (@var{x},@var{y}) of the
  7285. red/green/blue component. Return 0 if there is no such component.
  7286. @item alpha(x, y)
  7287. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  7288. plane. Return 0 if there is no such plane.
  7289. @end table
  7290. For functions, if @var{x} and @var{y} are outside the area, the value will be
  7291. automatically clipped to the closer edge.
  7292. @subsection Examples
  7293. @itemize
  7294. @item
  7295. Flip the image horizontally:
  7296. @example
  7297. geq=p(W-X\,Y)
  7298. @end example
  7299. @item
  7300. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  7301. wavelength of 100 pixels:
  7302. @example
  7303. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  7304. @end example
  7305. @item
  7306. Generate a fancy enigmatic moving light:
  7307. @example
  7308. 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
  7309. @end example
  7310. @item
  7311. Generate a quick emboss effect:
  7312. @example
  7313. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  7314. @end example
  7315. @item
  7316. Modify RGB components depending on pixel position:
  7317. @example
  7318. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  7319. @end example
  7320. @item
  7321. Create a radial gradient that is the same size as the input (also see
  7322. the @ref{vignette} filter):
  7323. @example
  7324. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  7325. @end example
  7326. @end itemize
  7327. @section gradfun
  7328. Fix the banding artifacts that are sometimes introduced into nearly flat
  7329. regions by truncation to 8-bit color depth.
  7330. Interpolate the gradients that should go where the bands are, and
  7331. dither them.
  7332. It is designed for playback only. Do not use it prior to
  7333. lossy compression, because compression tends to lose the dither and
  7334. bring back the bands.
  7335. It accepts the following parameters:
  7336. @table @option
  7337. @item strength
  7338. The maximum amount by which the filter will change any one pixel. This is also
  7339. the threshold for detecting nearly flat regions. Acceptable values range from
  7340. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  7341. valid range.
  7342. @item radius
  7343. The neighborhood to fit the gradient to. A larger radius makes for smoother
  7344. gradients, but also prevents the filter from modifying the pixels near detailed
  7345. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  7346. values will be clipped to the valid range.
  7347. @end table
  7348. Alternatively, the options can be specified as a flat string:
  7349. @var{strength}[:@var{radius}]
  7350. @subsection Examples
  7351. @itemize
  7352. @item
  7353. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  7354. @example
  7355. gradfun=3.5:8
  7356. @end example
  7357. @item
  7358. Specify radius, omitting the strength (which will fall-back to the default
  7359. value):
  7360. @example
  7361. gradfun=radius=8
  7362. @end example
  7363. @end itemize
  7364. @anchor{haldclut}
  7365. @section haldclut
  7366. Apply a Hald CLUT to a video stream.
  7367. First input is the video stream to process, and second one is the Hald CLUT.
  7368. The Hald CLUT input can be a simple picture or a complete video stream.
  7369. The filter accepts the following options:
  7370. @table @option
  7371. @item shortest
  7372. Force termination when the shortest input terminates. Default is @code{0}.
  7373. @item repeatlast
  7374. Continue applying the last CLUT after the end of the stream. A value of
  7375. @code{0} disable the filter after the last frame of the CLUT is reached.
  7376. Default is @code{1}.
  7377. @end table
  7378. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  7379. filters share the same internals).
  7380. More information about the Hald CLUT can be found on Eskil Steenberg's website
  7381. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  7382. @subsection Workflow examples
  7383. @subsubsection Hald CLUT video stream
  7384. Generate an identity Hald CLUT stream altered with various effects:
  7385. @example
  7386. 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
  7387. @end example
  7388. Note: make sure you use a lossless codec.
  7389. Then use it with @code{haldclut} to apply it on some random stream:
  7390. @example
  7391. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  7392. @end example
  7393. The Hald CLUT will be applied to the 10 first seconds (duration of
  7394. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  7395. to the remaining frames of the @code{mandelbrot} stream.
  7396. @subsubsection Hald CLUT with preview
  7397. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  7398. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  7399. biggest possible square starting at the top left of the picture. The remaining
  7400. padding pixels (bottom or right) will be ignored. This area can be used to add
  7401. a preview of the Hald CLUT.
  7402. Typically, the following generated Hald CLUT will be supported by the
  7403. @code{haldclut} filter:
  7404. @example
  7405. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  7406. pad=iw+320 [padded_clut];
  7407. smptebars=s=320x256, split [a][b];
  7408. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  7409. [main][b] overlay=W-320" -frames:v 1 clut.png
  7410. @end example
  7411. It contains the original and a preview of the effect of the CLUT: SMPTE color
  7412. bars are displayed on the right-top, and below the same color bars processed by
  7413. the color changes.
  7414. Then, the effect of this Hald CLUT can be visualized with:
  7415. @example
  7416. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  7417. @end example
  7418. @section hflip
  7419. Flip the input video horizontally.
  7420. For example, to horizontally flip the input video with @command{ffmpeg}:
  7421. @example
  7422. ffmpeg -i in.avi -vf "hflip" out.avi
  7423. @end example
  7424. @section histeq
  7425. This filter applies a global color histogram equalization on a
  7426. per-frame basis.
  7427. It can be used to correct video that has a compressed range of pixel
  7428. intensities. The filter redistributes the pixel intensities to
  7429. equalize their distribution across the intensity range. It may be
  7430. viewed as an "automatically adjusting contrast filter". This filter is
  7431. useful only for correcting degraded or poorly captured source
  7432. video.
  7433. The filter accepts the following options:
  7434. @table @option
  7435. @item strength
  7436. Determine the amount of equalization to be applied. As the strength
  7437. is reduced, the distribution of pixel intensities more-and-more
  7438. approaches that of the input frame. The value must be a float number
  7439. in the range [0,1] and defaults to 0.200.
  7440. @item intensity
  7441. Set the maximum intensity that can generated and scale the output
  7442. values appropriately. The strength should be set as desired and then
  7443. the intensity can be limited if needed to avoid washing-out. The value
  7444. must be a float number in the range [0,1] and defaults to 0.210.
  7445. @item antibanding
  7446. Set the antibanding level. If enabled the filter will randomly vary
  7447. the luminance of output pixels by a small amount to avoid banding of
  7448. the histogram. Possible values are @code{none}, @code{weak} or
  7449. @code{strong}. It defaults to @code{none}.
  7450. @end table
  7451. @section histogram
  7452. Compute and draw a color distribution histogram for the input video.
  7453. The computed histogram is a representation of the color component
  7454. distribution in an image.
  7455. Standard histogram displays the color components distribution in an image.
  7456. Displays color graph for each color component. Shows distribution of
  7457. the Y, U, V, A or R, G, B components, depending on input format, in the
  7458. current frame. Below each graph a color component scale meter is shown.
  7459. The filter accepts the following options:
  7460. @table @option
  7461. @item level_height
  7462. Set height of level. Default value is @code{200}.
  7463. Allowed range is [50, 2048].
  7464. @item scale_height
  7465. Set height of color scale. Default value is @code{12}.
  7466. Allowed range is [0, 40].
  7467. @item display_mode
  7468. Set display mode.
  7469. It accepts the following values:
  7470. @table @samp
  7471. @item stack
  7472. Per color component graphs are placed below each other.
  7473. @item parade
  7474. Per color component graphs are placed side by side.
  7475. @item overlay
  7476. Presents information identical to that in the @code{parade}, except
  7477. that the graphs representing color components are superimposed directly
  7478. over one another.
  7479. @end table
  7480. Default is @code{stack}.
  7481. @item levels_mode
  7482. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  7483. Default is @code{linear}.
  7484. @item components
  7485. Set what color components to display.
  7486. Default is @code{7}.
  7487. @item fgopacity
  7488. Set foreground opacity. Default is @code{0.7}.
  7489. @item bgopacity
  7490. Set background opacity. Default is @code{0.5}.
  7491. @end table
  7492. @subsection Examples
  7493. @itemize
  7494. @item
  7495. Calculate and draw histogram:
  7496. @example
  7497. ffplay -i input -vf histogram
  7498. @end example
  7499. @end itemize
  7500. @anchor{hqdn3d}
  7501. @section hqdn3d
  7502. This is a high precision/quality 3d denoise filter. It aims to reduce
  7503. image noise, producing smooth images and making still images really
  7504. still. It should enhance compressibility.
  7505. It accepts the following optional parameters:
  7506. @table @option
  7507. @item luma_spatial
  7508. A non-negative floating point number which specifies spatial luma strength.
  7509. It defaults to 4.0.
  7510. @item chroma_spatial
  7511. A non-negative floating point number which specifies spatial chroma strength.
  7512. It defaults to 3.0*@var{luma_spatial}/4.0.
  7513. @item luma_tmp
  7514. A floating point number which specifies luma temporal strength. It defaults to
  7515. 6.0*@var{luma_spatial}/4.0.
  7516. @item chroma_tmp
  7517. A floating point number which specifies chroma temporal strength. It defaults to
  7518. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  7519. @end table
  7520. @section hwdownload
  7521. Download hardware frames to system memory.
  7522. The input must be in hardware frames, and the output a non-hardware format.
  7523. Not all formats will be supported on the output - it may be necessary to insert
  7524. an additional @option{format} filter immediately following in the graph to get
  7525. the output in a supported format.
  7526. @section hwmap
  7527. Map hardware frames to system memory or to another device.
  7528. This filter has several different modes of operation; which one is used depends
  7529. on the input and output formats:
  7530. @itemize
  7531. @item
  7532. Hardware frame input, normal frame output
  7533. Map the input frames to system memory and pass them to the output. If the
  7534. original hardware frame is later required (for example, after overlaying
  7535. something else on part of it), the @option{hwmap} filter can be used again
  7536. in the next mode to retrieve it.
  7537. @item
  7538. Normal frame input, hardware frame output
  7539. If the input is actually a software-mapped hardware frame, then unmap it -
  7540. that is, return the original hardware frame.
  7541. Otherwise, a device must be provided. Create new hardware surfaces on that
  7542. device for the output, then map them back to the software format at the input
  7543. and give those frames to the preceding filter. This will then act like the
  7544. @option{hwupload} filter, but may be able to avoid an additional copy when
  7545. the input is already in a compatible format.
  7546. @item
  7547. Hardware frame input and output
  7548. A device must be supplied for the output, either directly or with the
  7549. @option{derive_device} option. The input and output devices must be of
  7550. different types and compatible - the exact meaning of this is
  7551. system-dependent, but typically it means that they must refer to the same
  7552. underlying hardware context (for example, refer to the same graphics card).
  7553. If the input frames were originally created on the output device, then unmap
  7554. to retrieve the original frames.
  7555. Otherwise, map the frames to the output device - create new hardware frames
  7556. on the output corresponding to the frames on the input.
  7557. @end itemize
  7558. The following additional parameters are accepted:
  7559. @table @option
  7560. @item mode
  7561. Set the frame mapping mode. Some combination of:
  7562. @table @var
  7563. @item read
  7564. The mapped frame should be readable.
  7565. @item write
  7566. The mapped frame should be writeable.
  7567. @item overwrite
  7568. The mapping will always overwrite the entire frame.
  7569. This may improve performance in some cases, as the original contents of the
  7570. frame need not be loaded.
  7571. @item direct
  7572. The mapping must not involve any copying.
  7573. Indirect mappings to copies of frames are created in some cases where either
  7574. direct mapping is not possible or it would have unexpected properties.
  7575. Setting this flag ensures that the mapping is direct and will fail if that is
  7576. not possible.
  7577. @end table
  7578. Defaults to @var{read+write} if not specified.
  7579. @item derive_device @var{type}
  7580. Rather than using the device supplied at initialisation, instead derive a new
  7581. device of type @var{type} from the device the input frames exist on.
  7582. @item reverse
  7583. In a hardware to hardware mapping, map in reverse - create frames in the sink
  7584. and map them back to the source. This may be necessary in some cases where
  7585. a mapping in one direction is required but only the opposite direction is
  7586. supported by the devices being used.
  7587. This option is dangerous - it may break the preceding filter in undefined
  7588. ways if there are any additional constraints on that filter's output.
  7589. Do not use it without fully understanding the implications of its use.
  7590. @end table
  7591. @section hwupload
  7592. Upload system memory frames to hardware surfaces.
  7593. The device to upload to must be supplied when the filter is initialised. If
  7594. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  7595. option.
  7596. @anchor{hwupload_cuda}
  7597. @section hwupload_cuda
  7598. Upload system memory frames to a CUDA device.
  7599. It accepts the following optional parameters:
  7600. @table @option
  7601. @item device
  7602. The number of the CUDA device to use
  7603. @end table
  7604. @section hqx
  7605. Apply a high-quality magnification filter designed for pixel art. This filter
  7606. was originally created by Maxim Stepin.
  7607. It accepts the following option:
  7608. @table @option
  7609. @item n
  7610. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  7611. @code{hq3x} and @code{4} for @code{hq4x}.
  7612. Default is @code{3}.
  7613. @end table
  7614. @section hstack
  7615. Stack input videos horizontally.
  7616. All streams must be of same pixel format and of same height.
  7617. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  7618. to create same output.
  7619. The filter accept the following option:
  7620. @table @option
  7621. @item inputs
  7622. Set number of input streams. Default is 2.
  7623. @item shortest
  7624. If set to 1, force the output to terminate when the shortest input
  7625. terminates. Default value is 0.
  7626. @end table
  7627. @section hue
  7628. Modify the hue and/or the saturation of the input.
  7629. It accepts the following parameters:
  7630. @table @option
  7631. @item h
  7632. Specify the hue angle as a number of degrees. It accepts an expression,
  7633. and defaults to "0".
  7634. @item s
  7635. Specify the saturation in the [-10,10] range. It accepts an expression and
  7636. defaults to "1".
  7637. @item H
  7638. Specify the hue angle as a number of radians. It accepts an
  7639. expression, and defaults to "0".
  7640. @item b
  7641. Specify the brightness in the [-10,10] range. It accepts an expression and
  7642. defaults to "0".
  7643. @end table
  7644. @option{h} and @option{H} are mutually exclusive, and can't be
  7645. specified at the same time.
  7646. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  7647. expressions containing the following constants:
  7648. @table @option
  7649. @item n
  7650. frame count of the input frame starting from 0
  7651. @item pts
  7652. presentation timestamp of the input frame expressed in time base units
  7653. @item r
  7654. frame rate of the input video, NAN if the input frame rate is unknown
  7655. @item t
  7656. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7657. @item tb
  7658. time base of the input video
  7659. @end table
  7660. @subsection Examples
  7661. @itemize
  7662. @item
  7663. Set the hue to 90 degrees and the saturation to 1.0:
  7664. @example
  7665. hue=h=90:s=1
  7666. @end example
  7667. @item
  7668. Same command but expressing the hue in radians:
  7669. @example
  7670. hue=H=PI/2:s=1
  7671. @end example
  7672. @item
  7673. Rotate hue and make the saturation swing between 0
  7674. and 2 over a period of 1 second:
  7675. @example
  7676. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  7677. @end example
  7678. @item
  7679. Apply a 3 seconds saturation fade-in effect starting at 0:
  7680. @example
  7681. hue="s=min(t/3\,1)"
  7682. @end example
  7683. The general fade-in expression can be written as:
  7684. @example
  7685. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  7686. @end example
  7687. @item
  7688. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  7689. @example
  7690. hue="s=max(0\, min(1\, (8-t)/3))"
  7691. @end example
  7692. The general fade-out expression can be written as:
  7693. @example
  7694. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  7695. @end example
  7696. @end itemize
  7697. @subsection Commands
  7698. This filter supports the following commands:
  7699. @table @option
  7700. @item b
  7701. @item s
  7702. @item h
  7703. @item H
  7704. Modify the hue and/or the saturation and/or brightness of the input video.
  7705. The command accepts the same syntax of the corresponding option.
  7706. If the specified expression is not valid, it is kept at its current
  7707. value.
  7708. @end table
  7709. @section hysteresis
  7710. Grow first stream into second stream by connecting components.
  7711. This makes it possible to build more robust edge masks.
  7712. This filter accepts the following options:
  7713. @table @option
  7714. @item planes
  7715. Set which planes will be processed as bitmap, unprocessed planes will be
  7716. copied from first stream.
  7717. By default value 0xf, all planes will be processed.
  7718. @item threshold
  7719. Set threshold which is used in filtering. If pixel component value is higher than
  7720. this value filter algorithm for connecting components is activated.
  7721. By default value is 0.
  7722. @end table
  7723. @section idet
  7724. Detect video interlacing type.
  7725. This filter tries to detect if the input frames are interlaced, progressive,
  7726. top or bottom field first. It will also try to detect fields that are
  7727. repeated between adjacent frames (a sign of telecine).
  7728. Single frame detection considers only immediately adjacent frames when classifying each frame.
  7729. Multiple frame detection incorporates the classification history of previous frames.
  7730. The filter will log these metadata values:
  7731. @table @option
  7732. @item single.current_frame
  7733. Detected type of current frame using single-frame detection. One of:
  7734. ``tff'' (top field first), ``bff'' (bottom field first),
  7735. ``progressive'', or ``undetermined''
  7736. @item single.tff
  7737. Cumulative number of frames detected as top field first using single-frame detection.
  7738. @item multiple.tff
  7739. Cumulative number of frames detected as top field first using multiple-frame detection.
  7740. @item single.bff
  7741. Cumulative number of frames detected as bottom field first using single-frame detection.
  7742. @item multiple.current_frame
  7743. Detected type of current frame using multiple-frame detection. One of:
  7744. ``tff'' (top field first), ``bff'' (bottom field first),
  7745. ``progressive'', or ``undetermined''
  7746. @item multiple.bff
  7747. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  7748. @item single.progressive
  7749. Cumulative number of frames detected as progressive using single-frame detection.
  7750. @item multiple.progressive
  7751. Cumulative number of frames detected as progressive using multiple-frame detection.
  7752. @item single.undetermined
  7753. Cumulative number of frames that could not be classified using single-frame detection.
  7754. @item multiple.undetermined
  7755. Cumulative number of frames that could not be classified using multiple-frame detection.
  7756. @item repeated.current_frame
  7757. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  7758. @item repeated.neither
  7759. Cumulative number of frames with no repeated field.
  7760. @item repeated.top
  7761. Cumulative number of frames with the top field repeated from the previous frame's top field.
  7762. @item repeated.bottom
  7763. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  7764. @end table
  7765. The filter accepts the following options:
  7766. @table @option
  7767. @item intl_thres
  7768. Set interlacing threshold.
  7769. @item prog_thres
  7770. Set progressive threshold.
  7771. @item rep_thres
  7772. Threshold for repeated field detection.
  7773. @item half_life
  7774. Number of frames after which a given frame's contribution to the
  7775. statistics is halved (i.e., it contributes only 0.5 to its
  7776. classification). The default of 0 means that all frames seen are given
  7777. full weight of 1.0 forever.
  7778. @item analyze_interlaced_flag
  7779. When this is not 0 then idet will use the specified number of frames to determine
  7780. if the interlaced flag is accurate, it will not count undetermined frames.
  7781. If the flag is found to be accurate it will be used without any further
  7782. computations, if it is found to be inaccurate it will be cleared without any
  7783. further computations. This allows inserting the idet filter as a low computational
  7784. method to clean up the interlaced flag
  7785. @end table
  7786. @section il
  7787. Deinterleave or interleave fields.
  7788. This filter allows one to process interlaced images fields without
  7789. deinterlacing them. Deinterleaving splits the input frame into 2
  7790. fields (so called half pictures). Odd lines are moved to the top
  7791. half of the output image, even lines to the bottom half.
  7792. You can process (filter) them independently and then re-interleave them.
  7793. The filter accepts the following options:
  7794. @table @option
  7795. @item luma_mode, l
  7796. @item chroma_mode, c
  7797. @item alpha_mode, a
  7798. Available values for @var{luma_mode}, @var{chroma_mode} and
  7799. @var{alpha_mode} are:
  7800. @table @samp
  7801. @item none
  7802. Do nothing.
  7803. @item deinterleave, d
  7804. Deinterleave fields, placing one above the other.
  7805. @item interleave, i
  7806. Interleave fields. Reverse the effect of deinterleaving.
  7807. @end table
  7808. Default value is @code{none}.
  7809. @item luma_swap, ls
  7810. @item chroma_swap, cs
  7811. @item alpha_swap, as
  7812. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  7813. @end table
  7814. @section inflate
  7815. Apply inflate effect to the video.
  7816. This filter replaces the pixel by the local(3x3) average by taking into account
  7817. only values higher than the pixel.
  7818. It accepts the following options:
  7819. @table @option
  7820. @item threshold0
  7821. @item threshold1
  7822. @item threshold2
  7823. @item threshold3
  7824. Limit the maximum change for each plane, default is 65535.
  7825. If 0, plane will remain unchanged.
  7826. @end table
  7827. @section interlace
  7828. Simple interlacing filter from progressive contents. This interleaves upper (or
  7829. lower) lines from odd frames with lower (or upper) lines from even frames,
  7830. halving the frame rate and preserving image height.
  7831. @example
  7832. Original Original New Frame
  7833. Frame 'j' Frame 'j+1' (tff)
  7834. ========== =========== ==================
  7835. Line 0 --------------------> Frame 'j' Line 0
  7836. Line 1 Line 1 ----> Frame 'j+1' Line 1
  7837. Line 2 ---------------------> Frame 'j' Line 2
  7838. Line 3 Line 3 ----> Frame 'j+1' Line 3
  7839. ... ... ...
  7840. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  7841. @end example
  7842. It accepts the following optional parameters:
  7843. @table @option
  7844. @item scan
  7845. This determines whether the interlaced frame is taken from the even
  7846. (tff - default) or odd (bff) lines of the progressive frame.
  7847. @item lowpass
  7848. Vertical lowpass filter to avoid twitter interlacing and
  7849. reduce moire patterns.
  7850. @table @samp
  7851. @item 0, off
  7852. Disable vertical lowpass filter
  7853. @item 1, linear
  7854. Enable linear filter (default)
  7855. @item 2, complex
  7856. Enable complex filter. This will slightly less reduce twitter and moire
  7857. but better retain detail and subjective sharpness impression.
  7858. @end table
  7859. @end table
  7860. @section kerndeint
  7861. Deinterlace input video by applying Donald Graft's adaptive kernel
  7862. deinterling. Work on interlaced parts of a video to produce
  7863. progressive frames.
  7864. The description of the accepted parameters follows.
  7865. @table @option
  7866. @item thresh
  7867. Set the threshold which affects the filter's tolerance when
  7868. determining if a pixel line must be processed. It must be an integer
  7869. in the range [0,255] and defaults to 10. A value of 0 will result in
  7870. applying the process on every pixels.
  7871. @item map
  7872. Paint pixels exceeding the threshold value to white if set to 1.
  7873. Default is 0.
  7874. @item order
  7875. Set the fields order. Swap fields if set to 1, leave fields alone if
  7876. 0. Default is 0.
  7877. @item sharp
  7878. Enable additional sharpening if set to 1. Default is 0.
  7879. @item twoway
  7880. Enable twoway sharpening if set to 1. Default is 0.
  7881. @end table
  7882. @subsection Examples
  7883. @itemize
  7884. @item
  7885. Apply default values:
  7886. @example
  7887. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  7888. @end example
  7889. @item
  7890. Enable additional sharpening:
  7891. @example
  7892. kerndeint=sharp=1
  7893. @end example
  7894. @item
  7895. Paint processed pixels in white:
  7896. @example
  7897. kerndeint=map=1
  7898. @end example
  7899. @end itemize
  7900. @section lenscorrection
  7901. Correct radial lens distortion
  7902. This filter can be used to correct for radial distortion as can result from the use
  7903. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  7904. one can use tools available for example as part of opencv or simply trial-and-error.
  7905. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  7906. and extract the k1 and k2 coefficients from the resulting matrix.
  7907. Note that effectively the same filter is available in the open-source tools Krita and
  7908. Digikam from the KDE project.
  7909. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  7910. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  7911. brightness distribution, so you may want to use both filters together in certain
  7912. cases, though you will have to take care of ordering, i.e. whether vignetting should
  7913. be applied before or after lens correction.
  7914. @subsection Options
  7915. The filter accepts the following options:
  7916. @table @option
  7917. @item cx
  7918. Relative x-coordinate of the focal point of the image, and thereby the center of the
  7919. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7920. width.
  7921. @item cy
  7922. Relative y-coordinate of the focal point of the image, and thereby the center of the
  7923. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7924. height.
  7925. @item k1
  7926. Coefficient of the quadratic correction term. 0.5 means no correction.
  7927. @item k2
  7928. Coefficient of the double quadratic correction term. 0.5 means no correction.
  7929. @end table
  7930. The formula that generates the correction is:
  7931. @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)
  7932. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  7933. distances from the focal point in the source and target images, respectively.
  7934. @section libvmaf
  7935. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  7936. score between two input videos.
  7937. The obtained VMAF score is printed through the logging system.
  7938. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  7939. After installing the library it can be enabled using:
  7940. @code{./configure --enable-libvmaf}.
  7941. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  7942. The filter has following options:
  7943. @table @option
  7944. @item model_path
  7945. Set the model path which is to be used for SVM.
  7946. Default value: @code{"vmaf_v0.6.1.pkl"}
  7947. @item log_path
  7948. Set the file path to be used to store logs.
  7949. @item log_fmt
  7950. Set the format of the log file (xml or json).
  7951. @item enable_transform
  7952. Enables transform for computing vmaf.
  7953. @item phone_model
  7954. Invokes the phone model which will generate VMAF scores higher than in the
  7955. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  7956. @item psnr
  7957. Enables computing psnr along with vmaf.
  7958. @item ssim
  7959. Enables computing ssim along with vmaf.
  7960. @item ms_ssim
  7961. Enables computing ms_ssim along with vmaf.
  7962. @item pool
  7963. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  7964. @end table
  7965. This filter also supports the @ref{framesync} options.
  7966. On the below examples the input file @file{main.mpg} being processed is
  7967. compared with the reference file @file{ref.mpg}.
  7968. @example
  7969. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  7970. @end example
  7971. Example with options:
  7972. @example
  7973. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
  7974. @end example
  7975. @section limiter
  7976. Limits the pixel components values to the specified range [min, max].
  7977. The filter accepts the following options:
  7978. @table @option
  7979. @item min
  7980. Lower bound. Defaults to the lowest allowed value for the input.
  7981. @item max
  7982. Upper bound. Defaults to the highest allowed value for the input.
  7983. @item planes
  7984. Specify which planes will be processed. Defaults to all available.
  7985. @end table
  7986. @section loop
  7987. Loop video frames.
  7988. The filter accepts the following options:
  7989. @table @option
  7990. @item loop
  7991. Set the number of loops. Setting this value to -1 will result in infinite loops.
  7992. Default is 0.
  7993. @item size
  7994. Set maximal size in number of frames. Default is 0.
  7995. @item start
  7996. Set first frame of loop. Default is 0.
  7997. @end table
  7998. @anchor{lut3d}
  7999. @section lut3d
  8000. Apply a 3D LUT to an input video.
  8001. The filter accepts the following options:
  8002. @table @option
  8003. @item file
  8004. Set the 3D LUT file name.
  8005. Currently supported formats:
  8006. @table @samp
  8007. @item 3dl
  8008. AfterEffects
  8009. @item cube
  8010. Iridas
  8011. @item dat
  8012. DaVinci
  8013. @item m3d
  8014. Pandora
  8015. @end table
  8016. @item interp
  8017. Select interpolation mode.
  8018. Available values are:
  8019. @table @samp
  8020. @item nearest
  8021. Use values from the nearest defined point.
  8022. @item trilinear
  8023. Interpolate values using the 8 points defining a cube.
  8024. @item tetrahedral
  8025. Interpolate values using a tetrahedron.
  8026. @end table
  8027. @end table
  8028. This filter also supports the @ref{framesync} options.
  8029. @section lumakey
  8030. Turn certain luma values into transparency.
  8031. The filter accepts the following options:
  8032. @table @option
  8033. @item threshold
  8034. Set the luma which will be used as base for transparency.
  8035. Default value is @code{0}.
  8036. @item tolerance
  8037. Set the range of luma values to be keyed out.
  8038. Default value is @code{0}.
  8039. @item softness
  8040. Set the range of softness. Default value is @code{0}.
  8041. Use this to control gradual transition from zero to full transparency.
  8042. @end table
  8043. @section lut, lutrgb, lutyuv
  8044. Compute a look-up table for binding each pixel component input value
  8045. to an output value, and apply it to the input video.
  8046. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  8047. to an RGB input video.
  8048. These filters accept the following parameters:
  8049. @table @option
  8050. @item c0
  8051. set first pixel component expression
  8052. @item c1
  8053. set second pixel component expression
  8054. @item c2
  8055. set third pixel component expression
  8056. @item c3
  8057. set fourth pixel component expression, corresponds to the alpha component
  8058. @item r
  8059. set red component expression
  8060. @item g
  8061. set green component expression
  8062. @item b
  8063. set blue component expression
  8064. @item a
  8065. alpha component expression
  8066. @item y
  8067. set Y/luminance component expression
  8068. @item u
  8069. set U/Cb component expression
  8070. @item v
  8071. set V/Cr component expression
  8072. @end table
  8073. Each of them specifies the expression to use for computing the lookup table for
  8074. the corresponding pixel component values.
  8075. The exact component associated to each of the @var{c*} options depends on the
  8076. format in input.
  8077. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  8078. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  8079. The expressions can contain the following constants and functions:
  8080. @table @option
  8081. @item w
  8082. @item h
  8083. The input width and height.
  8084. @item val
  8085. The input value for the pixel component.
  8086. @item clipval
  8087. The input value, clipped to the @var{minval}-@var{maxval} range.
  8088. @item maxval
  8089. The maximum value for the pixel component.
  8090. @item minval
  8091. The minimum value for the pixel component.
  8092. @item negval
  8093. The negated value for the pixel component value, clipped to the
  8094. @var{minval}-@var{maxval} range; it corresponds to the expression
  8095. "maxval-clipval+minval".
  8096. @item clip(val)
  8097. The computed value in @var{val}, clipped to the
  8098. @var{minval}-@var{maxval} range.
  8099. @item gammaval(gamma)
  8100. The computed gamma correction value of the pixel component value,
  8101. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  8102. expression
  8103. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  8104. @end table
  8105. All expressions default to "val".
  8106. @subsection Examples
  8107. @itemize
  8108. @item
  8109. Negate input video:
  8110. @example
  8111. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  8112. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  8113. @end example
  8114. The above is the same as:
  8115. @example
  8116. lutrgb="r=negval:g=negval:b=negval"
  8117. lutyuv="y=negval:u=negval:v=negval"
  8118. @end example
  8119. @item
  8120. Negate luminance:
  8121. @example
  8122. lutyuv=y=negval
  8123. @end example
  8124. @item
  8125. Remove chroma components, turning the video into a graytone image:
  8126. @example
  8127. lutyuv="u=128:v=128"
  8128. @end example
  8129. @item
  8130. Apply a luma burning effect:
  8131. @example
  8132. lutyuv="y=2*val"
  8133. @end example
  8134. @item
  8135. Remove green and blue components:
  8136. @example
  8137. lutrgb="g=0:b=0"
  8138. @end example
  8139. @item
  8140. Set a constant alpha channel value on input:
  8141. @example
  8142. format=rgba,lutrgb=a="maxval-minval/2"
  8143. @end example
  8144. @item
  8145. Correct luminance gamma by a factor of 0.5:
  8146. @example
  8147. lutyuv=y=gammaval(0.5)
  8148. @end example
  8149. @item
  8150. Discard least significant bits of luma:
  8151. @example
  8152. lutyuv=y='bitand(val, 128+64+32)'
  8153. @end example
  8154. @item
  8155. Technicolor like effect:
  8156. @example
  8157. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  8158. @end example
  8159. @end itemize
  8160. @section lut2, tlut2
  8161. The @code{lut2} filter takes two input streams and outputs one
  8162. stream.
  8163. The @code{tlut2} (time lut2) filter takes two consecutive frames
  8164. from one single stream.
  8165. This filter accepts the following parameters:
  8166. @table @option
  8167. @item c0
  8168. set first pixel component expression
  8169. @item c1
  8170. set second pixel component expression
  8171. @item c2
  8172. set third pixel component expression
  8173. @item c3
  8174. set fourth pixel component expression, corresponds to the alpha component
  8175. @end table
  8176. Each of them specifies the expression to use for computing the lookup table for
  8177. the corresponding pixel component values.
  8178. The exact component associated to each of the @var{c*} options depends on the
  8179. format in inputs.
  8180. The expressions can contain the following constants:
  8181. @table @option
  8182. @item w
  8183. @item h
  8184. The input width and height.
  8185. @item x
  8186. The first input value for the pixel component.
  8187. @item y
  8188. The second input value for the pixel component.
  8189. @item bdx
  8190. The first input video bit depth.
  8191. @item bdy
  8192. The second input video bit depth.
  8193. @end table
  8194. All expressions default to "x".
  8195. @subsection Examples
  8196. @itemize
  8197. @item
  8198. Highlight differences between two RGB video streams:
  8199. @example
  8200. 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)'
  8201. @end example
  8202. @item
  8203. Highlight differences between two YUV video streams:
  8204. @example
  8205. 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)'
  8206. @end example
  8207. @item
  8208. Show max difference between two video streams:
  8209. @example
  8210. 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)))'
  8211. @end example
  8212. @end itemize
  8213. @section maskedclamp
  8214. Clamp the first input stream with the second input and third input stream.
  8215. Returns the value of first stream to be between second input
  8216. stream - @code{undershoot} and third input stream + @code{overshoot}.
  8217. This filter accepts the following options:
  8218. @table @option
  8219. @item undershoot
  8220. Default value is @code{0}.
  8221. @item overshoot
  8222. Default value is @code{0}.
  8223. @item planes
  8224. Set which planes will be processed as bitmap, unprocessed planes will be
  8225. copied from first stream.
  8226. By default value 0xf, all planes will be processed.
  8227. @end table
  8228. @section maskedmerge
  8229. Merge the first input stream with the second input stream using per pixel
  8230. weights in the third input stream.
  8231. A value of 0 in the third stream pixel component means that pixel component
  8232. from first stream is returned unchanged, while maximum value (eg. 255 for
  8233. 8-bit videos) means that pixel component from second stream is returned
  8234. unchanged. Intermediate values define the amount of merging between both
  8235. input stream's pixel components.
  8236. This filter accepts the following options:
  8237. @table @option
  8238. @item planes
  8239. Set which planes will be processed as bitmap, unprocessed planes will be
  8240. copied from first stream.
  8241. By default value 0xf, all planes will be processed.
  8242. @end table
  8243. @section mcdeint
  8244. Apply motion-compensation deinterlacing.
  8245. It needs one field per frame as input and must thus be used together
  8246. with yadif=1/3 or equivalent.
  8247. This filter accepts the following options:
  8248. @table @option
  8249. @item mode
  8250. Set the deinterlacing mode.
  8251. It accepts one of the following values:
  8252. @table @samp
  8253. @item fast
  8254. @item medium
  8255. @item slow
  8256. use iterative motion estimation
  8257. @item extra_slow
  8258. like @samp{slow}, but use multiple reference frames.
  8259. @end table
  8260. Default value is @samp{fast}.
  8261. @item parity
  8262. Set the picture field parity assumed for the input video. It must be
  8263. one of the following values:
  8264. @table @samp
  8265. @item 0, tff
  8266. assume top field first
  8267. @item 1, bff
  8268. assume bottom field first
  8269. @end table
  8270. Default value is @samp{bff}.
  8271. @item qp
  8272. Set per-block quantization parameter (QP) used by the internal
  8273. encoder.
  8274. Higher values should result in a smoother motion vector field but less
  8275. optimal individual vectors. Default value is 1.
  8276. @end table
  8277. @section mergeplanes
  8278. Merge color channel components from several video streams.
  8279. The filter accepts up to 4 input streams, and merge selected input
  8280. planes to the output video.
  8281. This filter accepts the following options:
  8282. @table @option
  8283. @item mapping
  8284. Set input to output plane mapping. Default is @code{0}.
  8285. The mappings is specified as a bitmap. It should be specified as a
  8286. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  8287. mapping for the first plane of the output stream. 'A' sets the number of
  8288. the input stream to use (from 0 to 3), and 'a' the plane number of the
  8289. corresponding input to use (from 0 to 3). The rest of the mappings is
  8290. similar, 'Bb' describes the mapping for the output stream second
  8291. plane, 'Cc' describes the mapping for the output stream third plane and
  8292. 'Dd' describes the mapping for the output stream fourth plane.
  8293. @item format
  8294. Set output pixel format. Default is @code{yuva444p}.
  8295. @end table
  8296. @subsection Examples
  8297. @itemize
  8298. @item
  8299. Merge three gray video streams of same width and height into single video stream:
  8300. @example
  8301. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  8302. @end example
  8303. @item
  8304. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  8305. @example
  8306. [a0][a1]mergeplanes=0x00010210:yuva444p
  8307. @end example
  8308. @item
  8309. Swap Y and A plane in yuva444p stream:
  8310. @example
  8311. format=yuva444p,mergeplanes=0x03010200:yuva444p
  8312. @end example
  8313. @item
  8314. Swap U and V plane in yuv420p stream:
  8315. @example
  8316. format=yuv420p,mergeplanes=0x000201:yuv420p
  8317. @end example
  8318. @item
  8319. Cast a rgb24 clip to yuv444p:
  8320. @example
  8321. format=rgb24,mergeplanes=0x000102:yuv444p
  8322. @end example
  8323. @end itemize
  8324. @section mestimate
  8325. Estimate and export motion vectors using block matching algorithms.
  8326. Motion vectors are stored in frame side data to be used by other filters.
  8327. This filter accepts the following options:
  8328. @table @option
  8329. @item method
  8330. Specify the motion estimation method. Accepts one of the following values:
  8331. @table @samp
  8332. @item esa
  8333. Exhaustive search algorithm.
  8334. @item tss
  8335. Three step search algorithm.
  8336. @item tdls
  8337. Two dimensional logarithmic search algorithm.
  8338. @item ntss
  8339. New three step search algorithm.
  8340. @item fss
  8341. Four step search algorithm.
  8342. @item ds
  8343. Diamond search algorithm.
  8344. @item hexbs
  8345. Hexagon-based search algorithm.
  8346. @item epzs
  8347. Enhanced predictive zonal search algorithm.
  8348. @item umh
  8349. Uneven multi-hexagon search algorithm.
  8350. @end table
  8351. Default value is @samp{esa}.
  8352. @item mb_size
  8353. Macroblock size. Default @code{16}.
  8354. @item search_param
  8355. Search parameter. Default @code{7}.
  8356. @end table
  8357. @section midequalizer
  8358. Apply Midway Image Equalization effect using two video streams.
  8359. Midway Image Equalization adjusts a pair of images to have the same
  8360. histogram, while maintaining their dynamics as much as possible. It's
  8361. useful for e.g. matching exposures from a pair of stereo cameras.
  8362. This filter has two inputs and one output, which must be of same pixel format, but
  8363. may be of different sizes. The output of filter is first input adjusted with
  8364. midway histogram of both inputs.
  8365. This filter accepts the following option:
  8366. @table @option
  8367. @item planes
  8368. Set which planes to process. Default is @code{15}, which is all available planes.
  8369. @end table
  8370. @section minterpolate
  8371. Convert the video to specified frame rate using motion interpolation.
  8372. This filter accepts the following options:
  8373. @table @option
  8374. @item fps
  8375. 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}.
  8376. @item mi_mode
  8377. Motion interpolation mode. Following values are accepted:
  8378. @table @samp
  8379. @item dup
  8380. Duplicate previous or next frame for interpolating new ones.
  8381. @item blend
  8382. Blend source frames. Interpolated frame is mean of previous and next frames.
  8383. @item mci
  8384. Motion compensated interpolation. Following options are effective when this mode is selected:
  8385. @table @samp
  8386. @item mc_mode
  8387. Motion compensation mode. Following values are accepted:
  8388. @table @samp
  8389. @item obmc
  8390. Overlapped block motion compensation.
  8391. @item aobmc
  8392. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  8393. @end table
  8394. Default mode is @samp{obmc}.
  8395. @item me_mode
  8396. Motion estimation mode. Following values are accepted:
  8397. @table @samp
  8398. @item bidir
  8399. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  8400. @item bilat
  8401. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  8402. @end table
  8403. Default mode is @samp{bilat}.
  8404. @item me
  8405. The algorithm to be used for motion estimation. Following values are accepted:
  8406. @table @samp
  8407. @item esa
  8408. Exhaustive search algorithm.
  8409. @item tss
  8410. Three step search algorithm.
  8411. @item tdls
  8412. Two dimensional logarithmic search algorithm.
  8413. @item ntss
  8414. New three step search algorithm.
  8415. @item fss
  8416. Four step search algorithm.
  8417. @item ds
  8418. Diamond search algorithm.
  8419. @item hexbs
  8420. Hexagon-based search algorithm.
  8421. @item epzs
  8422. Enhanced predictive zonal search algorithm.
  8423. @item umh
  8424. Uneven multi-hexagon search algorithm.
  8425. @end table
  8426. Default algorithm is @samp{epzs}.
  8427. @item mb_size
  8428. Macroblock size. Default @code{16}.
  8429. @item search_param
  8430. Motion estimation search parameter. Default @code{32}.
  8431. @item vsbmc
  8432. 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).
  8433. @end table
  8434. @end table
  8435. @item scd
  8436. 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:
  8437. @table @samp
  8438. @item none
  8439. Disable scene change detection.
  8440. @item fdiff
  8441. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  8442. @end table
  8443. Default method is @samp{fdiff}.
  8444. @item scd_threshold
  8445. Scene change detection threshold. Default is @code{5.0}.
  8446. @end table
  8447. @section mix
  8448. Mix several video input streams into one video stream.
  8449. A description of the accepted options follows.
  8450. @table @option
  8451. @item nb_inputs
  8452. The number of inputs. If unspecified, it defaults to 2.
  8453. @item weights
  8454. Specify weight of each input video stream as sequence.
  8455. Each weight is separated by space.
  8456. @item duration
  8457. Specify how end of stream is determined.
  8458. @table @samp
  8459. @item longest
  8460. The duration of the longest input. (default)
  8461. @item shortest
  8462. The duration of the shortest input.
  8463. @item first
  8464. The duration of the first input.
  8465. @end table
  8466. @end table
  8467. @section mpdecimate
  8468. Drop frames that do not differ greatly from the previous frame in
  8469. order to reduce frame rate.
  8470. The main use of this filter is for very-low-bitrate encoding
  8471. (e.g. streaming over dialup modem), but it could in theory be used for
  8472. fixing movies that were inverse-telecined incorrectly.
  8473. A description of the accepted options follows.
  8474. @table @option
  8475. @item max
  8476. Set the maximum number of consecutive frames which can be dropped (if
  8477. positive), or the minimum interval between dropped frames (if
  8478. negative). If the value is 0, the frame is dropped disregarding the
  8479. number of previous sequentially dropped frames.
  8480. Default value is 0.
  8481. @item hi
  8482. @item lo
  8483. @item frac
  8484. Set the dropping threshold values.
  8485. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  8486. represent actual pixel value differences, so a threshold of 64
  8487. corresponds to 1 unit of difference for each pixel, or the same spread
  8488. out differently over the block.
  8489. A frame is a candidate for dropping if no 8x8 blocks differ by more
  8490. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  8491. meaning the whole image) differ by more than a threshold of @option{lo}.
  8492. Default value for @option{hi} is 64*12, default value for @option{lo} is
  8493. 64*5, and default value for @option{frac} is 0.33.
  8494. @end table
  8495. @section negate
  8496. Negate input video.
  8497. It accepts an integer in input; if non-zero it negates the
  8498. alpha component (if available). The default value in input is 0.
  8499. @section nlmeans
  8500. Denoise frames using Non-Local Means algorithm.
  8501. Each pixel is adjusted by looking for other pixels with similar contexts. This
  8502. context similarity is defined by comparing their surrounding patches of size
  8503. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  8504. around the pixel.
  8505. Note that the research area defines centers for patches, which means some
  8506. patches will be made of pixels outside that research area.
  8507. The filter accepts the following options.
  8508. @table @option
  8509. @item s
  8510. Set denoising strength.
  8511. @item p
  8512. Set patch size.
  8513. @item pc
  8514. Same as @option{p} but for chroma planes.
  8515. The default value is @var{0} and means automatic.
  8516. @item r
  8517. Set research size.
  8518. @item rc
  8519. Same as @option{r} but for chroma planes.
  8520. The default value is @var{0} and means automatic.
  8521. @end table
  8522. @section nnedi
  8523. Deinterlace video using neural network edge directed interpolation.
  8524. This filter accepts the following options:
  8525. @table @option
  8526. @item weights
  8527. Mandatory option, without binary file filter can not work.
  8528. Currently file can be found here:
  8529. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  8530. @item deint
  8531. Set which frames to deinterlace, by default it is @code{all}.
  8532. Can be @code{all} or @code{interlaced}.
  8533. @item field
  8534. Set mode of operation.
  8535. Can be one of the following:
  8536. @table @samp
  8537. @item af
  8538. Use frame flags, both fields.
  8539. @item a
  8540. Use frame flags, single field.
  8541. @item t
  8542. Use top field only.
  8543. @item b
  8544. Use bottom field only.
  8545. @item tf
  8546. Use both fields, top first.
  8547. @item bf
  8548. Use both fields, bottom first.
  8549. @end table
  8550. @item planes
  8551. Set which planes to process, by default filter process all frames.
  8552. @item nsize
  8553. Set size of local neighborhood around each pixel, used by the predictor neural
  8554. network.
  8555. Can be one of the following:
  8556. @table @samp
  8557. @item s8x6
  8558. @item s16x6
  8559. @item s32x6
  8560. @item s48x6
  8561. @item s8x4
  8562. @item s16x4
  8563. @item s32x4
  8564. @end table
  8565. @item nns
  8566. Set the number of neurons in predictor neural network.
  8567. Can be one of the following:
  8568. @table @samp
  8569. @item n16
  8570. @item n32
  8571. @item n64
  8572. @item n128
  8573. @item n256
  8574. @end table
  8575. @item qual
  8576. Controls the number of different neural network predictions that are blended
  8577. together to compute the final output value. Can be @code{fast}, default or
  8578. @code{slow}.
  8579. @item etype
  8580. Set which set of weights to use in the predictor.
  8581. Can be one of the following:
  8582. @table @samp
  8583. @item a
  8584. weights trained to minimize absolute error
  8585. @item s
  8586. weights trained to minimize squared error
  8587. @end table
  8588. @item pscrn
  8589. Controls whether or not the prescreener neural network is used to decide
  8590. which pixels should be processed by the predictor neural network and which
  8591. can be handled by simple cubic interpolation.
  8592. The prescreener is trained to know whether cubic interpolation will be
  8593. sufficient for a pixel or whether it should be predicted by the predictor nn.
  8594. The computational complexity of the prescreener nn is much less than that of
  8595. the predictor nn. Since most pixels can be handled by cubic interpolation,
  8596. using the prescreener generally results in much faster processing.
  8597. The prescreener is pretty accurate, so the difference between using it and not
  8598. using it is almost always unnoticeable.
  8599. Can be one of the following:
  8600. @table @samp
  8601. @item none
  8602. @item original
  8603. @item new
  8604. @end table
  8605. Default is @code{new}.
  8606. @item fapprox
  8607. Set various debugging flags.
  8608. @end table
  8609. @section noformat
  8610. Force libavfilter not to use any of the specified pixel formats for the
  8611. input to the next filter.
  8612. It accepts the following parameters:
  8613. @table @option
  8614. @item pix_fmts
  8615. A '|'-separated list of pixel format names, such as
  8616. pix_fmts=yuv420p|monow|rgb24".
  8617. @end table
  8618. @subsection Examples
  8619. @itemize
  8620. @item
  8621. Force libavfilter to use a format different from @var{yuv420p} for the
  8622. input to the vflip filter:
  8623. @example
  8624. noformat=pix_fmts=yuv420p,vflip
  8625. @end example
  8626. @item
  8627. Convert the input video to any of the formats not contained in the list:
  8628. @example
  8629. noformat=yuv420p|yuv444p|yuv410p
  8630. @end example
  8631. @end itemize
  8632. @section noise
  8633. Add noise on video input frame.
  8634. The filter accepts the following options:
  8635. @table @option
  8636. @item all_seed
  8637. @item c0_seed
  8638. @item c1_seed
  8639. @item c2_seed
  8640. @item c3_seed
  8641. Set noise seed for specific pixel component or all pixel components in case
  8642. of @var{all_seed}. Default value is @code{123457}.
  8643. @item all_strength, alls
  8644. @item c0_strength, c0s
  8645. @item c1_strength, c1s
  8646. @item c2_strength, c2s
  8647. @item c3_strength, c3s
  8648. Set noise strength for specific pixel component or all pixel components in case
  8649. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  8650. @item all_flags, allf
  8651. @item c0_flags, c0f
  8652. @item c1_flags, c1f
  8653. @item c2_flags, c2f
  8654. @item c3_flags, c3f
  8655. Set pixel component flags or set flags for all components if @var{all_flags}.
  8656. Available values for component flags are:
  8657. @table @samp
  8658. @item a
  8659. averaged temporal noise (smoother)
  8660. @item p
  8661. mix random noise with a (semi)regular pattern
  8662. @item t
  8663. temporal noise (noise pattern changes between frames)
  8664. @item u
  8665. uniform noise (gaussian otherwise)
  8666. @end table
  8667. @end table
  8668. @subsection Examples
  8669. Add temporal and uniform noise to input video:
  8670. @example
  8671. noise=alls=20:allf=t+u
  8672. @end example
  8673. @section normalize
  8674. Normalize RGB video (aka histogram stretching, contrast stretching).
  8675. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  8676. For each channel of each frame, the filter computes the input range and maps
  8677. it linearly to the user-specified output range. The output range defaults
  8678. to the full dynamic range from pure black to pure white.
  8679. Temporal smoothing can be used on the input range to reduce flickering (rapid
  8680. changes in brightness) caused when small dark or bright objects enter or leave
  8681. the scene. This is similar to the auto-exposure (automatic gain control) on a
  8682. video camera, and, like a video camera, it may cause a period of over- or
  8683. under-exposure of the video.
  8684. The R,G,B channels can be normalized independently, which may cause some
  8685. color shifting, or linked together as a single channel, which prevents
  8686. color shifting. Linked normalization preserves hue. Independent normalization
  8687. does not, so it can be used to remove some color casts. Independent and linked
  8688. normalization can be combined in any ratio.
  8689. The normalize filter accepts the following options:
  8690. @table @option
  8691. @item blackpt
  8692. @item whitept
  8693. Colors which define the output range. The minimum input value is mapped to
  8694. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  8695. The defaults are black and white respectively. Specifying white for
  8696. @var{blackpt} and black for @var{whitept} will give color-inverted,
  8697. normalized video. Shades of grey can be used to reduce the dynamic range
  8698. (contrast). Specifying saturated colors here can create some interesting
  8699. effects.
  8700. @item smoothing
  8701. The number of previous frames to use for temporal smoothing. The input range
  8702. of each channel is smoothed using a rolling average over the current frame
  8703. and the @var{smoothing} previous frames. The default is 0 (no temporal
  8704. smoothing).
  8705. @item independence
  8706. Controls the ratio of independent (color shifting) channel normalization to
  8707. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  8708. independent. Defaults to 1.0 (fully independent).
  8709. @item strength
  8710. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  8711. expensive no-op. Defaults to 1.0 (full strength).
  8712. @end table
  8713. @subsection Examples
  8714. Stretch video contrast to use the full dynamic range, with no temporal
  8715. smoothing; may flicker depending on the source content:
  8716. @example
  8717. normalize=blackpt=black:whitept=white:smoothing=0
  8718. @end example
  8719. As above, but with 50 frames of temporal smoothing; flicker should be
  8720. reduced, depending on the source content:
  8721. @example
  8722. normalize=blackpt=black:whitept=white:smoothing=50
  8723. @end example
  8724. As above, but with hue-preserving linked channel normalization:
  8725. @example
  8726. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  8727. @end example
  8728. As above, but with half strength:
  8729. @example
  8730. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  8731. @end example
  8732. Map the darkest input color to red, the brightest input color to cyan:
  8733. @example
  8734. normalize=blackpt=red:whitept=cyan
  8735. @end example
  8736. @section null
  8737. Pass the video source unchanged to the output.
  8738. @section ocr
  8739. Optical Character Recognition
  8740. This filter uses Tesseract for optical character recognition.
  8741. It accepts the following options:
  8742. @table @option
  8743. @item datapath
  8744. Set datapath to tesseract data. Default is to use whatever was
  8745. set at installation.
  8746. @item language
  8747. Set language, default is "eng".
  8748. @item whitelist
  8749. Set character whitelist.
  8750. @item blacklist
  8751. Set character blacklist.
  8752. @end table
  8753. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  8754. @section ocv
  8755. Apply a video transform using libopencv.
  8756. To enable this filter, install the libopencv library and headers and
  8757. configure FFmpeg with @code{--enable-libopencv}.
  8758. It accepts the following parameters:
  8759. @table @option
  8760. @item filter_name
  8761. The name of the libopencv filter to apply.
  8762. @item filter_params
  8763. The parameters to pass to the libopencv filter. If not specified, the default
  8764. values are assumed.
  8765. @end table
  8766. Refer to the official libopencv documentation for more precise
  8767. information:
  8768. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  8769. Several libopencv filters are supported; see the following subsections.
  8770. @anchor{dilate}
  8771. @subsection dilate
  8772. Dilate an image by using a specific structuring element.
  8773. It corresponds to the libopencv function @code{cvDilate}.
  8774. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  8775. @var{struct_el} represents a structuring element, and has the syntax:
  8776. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  8777. @var{cols} and @var{rows} represent the number of columns and rows of
  8778. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  8779. point, and @var{shape} the shape for the structuring element. @var{shape}
  8780. must be "rect", "cross", "ellipse", or "custom".
  8781. If the value for @var{shape} is "custom", it must be followed by a
  8782. string of the form "=@var{filename}". The file with name
  8783. @var{filename} is assumed to represent a binary image, with each
  8784. printable character corresponding to a bright pixel. When a custom
  8785. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  8786. or columns and rows of the read file are assumed instead.
  8787. The default value for @var{struct_el} is "3x3+0x0/rect".
  8788. @var{nb_iterations} specifies the number of times the transform is
  8789. applied to the image, and defaults to 1.
  8790. Some examples:
  8791. @example
  8792. # Use the default values
  8793. ocv=dilate
  8794. # Dilate using a structuring element with a 5x5 cross, iterating two times
  8795. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  8796. # Read the shape from the file diamond.shape, iterating two times.
  8797. # The file diamond.shape may contain a pattern of characters like this
  8798. # *
  8799. # ***
  8800. # *****
  8801. # ***
  8802. # *
  8803. # The specified columns and rows are ignored
  8804. # but the anchor point coordinates are not
  8805. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  8806. @end example
  8807. @subsection erode
  8808. Erode an image by using a specific structuring element.
  8809. It corresponds to the libopencv function @code{cvErode}.
  8810. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  8811. with the same syntax and semantics as the @ref{dilate} filter.
  8812. @subsection smooth
  8813. Smooth the input video.
  8814. The filter takes the following parameters:
  8815. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  8816. @var{type} is the type of smooth filter to apply, and must be one of
  8817. the following values: "blur", "blur_no_scale", "median", "gaussian",
  8818. or "bilateral". The default value is "gaussian".
  8819. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  8820. depend on the smooth type. @var{param1} and
  8821. @var{param2} accept integer positive values or 0. @var{param3} and
  8822. @var{param4} accept floating point values.
  8823. The default value for @var{param1} is 3. The default value for the
  8824. other parameters is 0.
  8825. These parameters correspond to the parameters assigned to the
  8826. libopencv function @code{cvSmooth}.
  8827. @section oscilloscope
  8828. 2D Video Oscilloscope.
  8829. Useful to measure spatial impulse, step responses, chroma delays, etc.
  8830. It accepts the following parameters:
  8831. @table @option
  8832. @item x
  8833. Set scope center x position.
  8834. @item y
  8835. Set scope center y position.
  8836. @item s
  8837. Set scope size, relative to frame diagonal.
  8838. @item t
  8839. Set scope tilt/rotation.
  8840. @item o
  8841. Set trace opacity.
  8842. @item tx
  8843. Set trace center x position.
  8844. @item ty
  8845. Set trace center y position.
  8846. @item tw
  8847. Set trace width, relative to width of frame.
  8848. @item th
  8849. Set trace height, relative to height of frame.
  8850. @item c
  8851. Set which components to trace. By default it traces first three components.
  8852. @item g
  8853. Draw trace grid. By default is enabled.
  8854. @item st
  8855. Draw some statistics. By default is enabled.
  8856. @item sc
  8857. Draw scope. By default is enabled.
  8858. @end table
  8859. @subsection Examples
  8860. @itemize
  8861. @item
  8862. Inspect full first row of video frame.
  8863. @example
  8864. oscilloscope=x=0.5:y=0:s=1
  8865. @end example
  8866. @item
  8867. Inspect full last row of video frame.
  8868. @example
  8869. oscilloscope=x=0.5:y=1:s=1
  8870. @end example
  8871. @item
  8872. Inspect full 5th line of video frame of height 1080.
  8873. @example
  8874. oscilloscope=x=0.5:y=5/1080:s=1
  8875. @end example
  8876. @item
  8877. Inspect full last column of video frame.
  8878. @example
  8879. oscilloscope=x=1:y=0.5:s=1:t=1
  8880. @end example
  8881. @end itemize
  8882. @anchor{overlay}
  8883. @section overlay
  8884. Overlay one video on top of another.
  8885. It takes two inputs and has one output. The first input is the "main"
  8886. video on which the second input is overlaid.
  8887. It accepts the following parameters:
  8888. A description of the accepted options follows.
  8889. @table @option
  8890. @item x
  8891. @item y
  8892. Set the expression for the x and y coordinates of the overlaid video
  8893. on the main video. Default value is "0" for both expressions. In case
  8894. the expression is invalid, it is set to a huge value (meaning that the
  8895. overlay will not be displayed within the output visible area).
  8896. @item eof_action
  8897. See @ref{framesync}.
  8898. @item eval
  8899. Set when the expressions for @option{x}, and @option{y} are evaluated.
  8900. It accepts the following values:
  8901. @table @samp
  8902. @item init
  8903. only evaluate expressions once during the filter initialization or
  8904. when a command is processed
  8905. @item frame
  8906. evaluate expressions for each incoming frame
  8907. @end table
  8908. Default value is @samp{frame}.
  8909. @item shortest
  8910. See @ref{framesync}.
  8911. @item format
  8912. Set the format for the output video.
  8913. It accepts the following values:
  8914. @table @samp
  8915. @item yuv420
  8916. force YUV420 output
  8917. @item yuv422
  8918. force YUV422 output
  8919. @item yuv444
  8920. force YUV444 output
  8921. @item rgb
  8922. force packed RGB output
  8923. @item gbrp
  8924. force planar RGB output
  8925. @item auto
  8926. automatically pick format
  8927. @end table
  8928. Default value is @samp{yuv420}.
  8929. @item repeatlast
  8930. See @ref{framesync}.
  8931. @item alpha
  8932. Set format of alpha of the overlaid video, it can be @var{straight} or
  8933. @var{premultiplied}. Default is @var{straight}.
  8934. @end table
  8935. The @option{x}, and @option{y} expressions can contain the following
  8936. parameters.
  8937. @table @option
  8938. @item main_w, W
  8939. @item main_h, H
  8940. The main input width and height.
  8941. @item overlay_w, w
  8942. @item overlay_h, h
  8943. The overlay input width and height.
  8944. @item x
  8945. @item y
  8946. The computed values for @var{x} and @var{y}. They are evaluated for
  8947. each new frame.
  8948. @item hsub
  8949. @item vsub
  8950. horizontal and vertical chroma subsample values of the output
  8951. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  8952. @var{vsub} is 1.
  8953. @item n
  8954. the number of input frame, starting from 0
  8955. @item pos
  8956. the position in the file of the input frame, NAN if unknown
  8957. @item t
  8958. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  8959. @end table
  8960. This filter also supports the @ref{framesync} options.
  8961. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  8962. when evaluation is done @emph{per frame}, and will evaluate to NAN
  8963. when @option{eval} is set to @samp{init}.
  8964. Be aware that frames are taken from each input video in timestamp
  8965. order, hence, if their initial timestamps differ, it is a good idea
  8966. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  8967. have them begin in the same zero timestamp, as the example for
  8968. the @var{movie} filter does.
  8969. You can chain together more overlays but you should test the
  8970. efficiency of such approach.
  8971. @subsection Commands
  8972. This filter supports the following commands:
  8973. @table @option
  8974. @item x
  8975. @item y
  8976. Modify the x and y of the overlay input.
  8977. The command accepts the same syntax of the corresponding option.
  8978. If the specified expression is not valid, it is kept at its current
  8979. value.
  8980. @end table
  8981. @subsection Examples
  8982. @itemize
  8983. @item
  8984. Draw the overlay at 10 pixels from the bottom right corner of the main
  8985. video:
  8986. @example
  8987. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  8988. @end example
  8989. Using named options the example above becomes:
  8990. @example
  8991. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  8992. @end example
  8993. @item
  8994. Insert a transparent PNG logo in the bottom left corner of the input,
  8995. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  8996. @example
  8997. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  8998. @end example
  8999. @item
  9000. Insert 2 different transparent PNG logos (second logo on bottom
  9001. right corner) using the @command{ffmpeg} tool:
  9002. @example
  9003. 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
  9004. @end example
  9005. @item
  9006. Add a transparent color layer on top of the main video; @code{WxH}
  9007. must specify the size of the main input to the overlay filter:
  9008. @example
  9009. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  9010. @end example
  9011. @item
  9012. Play an original video and a filtered version (here with the deshake
  9013. filter) side by side using the @command{ffplay} tool:
  9014. @example
  9015. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  9016. @end example
  9017. The above command is the same as:
  9018. @example
  9019. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  9020. @end example
  9021. @item
  9022. Make a sliding overlay appearing from the left to the right top part of the
  9023. screen starting since time 2:
  9024. @example
  9025. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  9026. @end example
  9027. @item
  9028. Compose output by putting two input videos side to side:
  9029. @example
  9030. ffmpeg -i left.avi -i right.avi -filter_complex "
  9031. nullsrc=size=200x100 [background];
  9032. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  9033. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  9034. [background][left] overlay=shortest=1 [background+left];
  9035. [background+left][right] overlay=shortest=1:x=100 [left+right]
  9036. "
  9037. @end example
  9038. @item
  9039. Mask 10-20 seconds of a video by applying the delogo filter to a section
  9040. @example
  9041. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  9042. -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]'
  9043. masked.avi
  9044. @end example
  9045. @item
  9046. Chain several overlays in cascade:
  9047. @example
  9048. nullsrc=s=200x200 [bg];
  9049. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  9050. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  9051. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  9052. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  9053. [in3] null, [mid2] overlay=100:100 [out0]
  9054. @end example
  9055. @end itemize
  9056. @section owdenoise
  9057. Apply Overcomplete Wavelet denoiser.
  9058. The filter accepts the following options:
  9059. @table @option
  9060. @item depth
  9061. Set depth.
  9062. Larger depth values will denoise lower frequency components more, but
  9063. slow down filtering.
  9064. Must be an int in the range 8-16, default is @code{8}.
  9065. @item luma_strength, ls
  9066. Set luma strength.
  9067. Must be a double value in the range 0-1000, default is @code{1.0}.
  9068. @item chroma_strength, cs
  9069. Set chroma strength.
  9070. Must be a double value in the range 0-1000, default is @code{1.0}.
  9071. @end table
  9072. @anchor{pad}
  9073. @section pad
  9074. Add paddings to the input image, and place the original input at the
  9075. provided @var{x}, @var{y} coordinates.
  9076. It accepts the following parameters:
  9077. @table @option
  9078. @item width, w
  9079. @item height, h
  9080. Specify an expression for the size of the output image with the
  9081. paddings added. If the value for @var{width} or @var{height} is 0, the
  9082. corresponding input size is used for the output.
  9083. The @var{width} expression can reference the value set by the
  9084. @var{height} expression, and vice versa.
  9085. The default value of @var{width} and @var{height} is 0.
  9086. @item x
  9087. @item y
  9088. Specify the offsets to place the input image at within the padded area,
  9089. with respect to the top/left border of the output image.
  9090. The @var{x} expression can reference the value set by the @var{y}
  9091. expression, and vice versa.
  9092. The default value of @var{x} and @var{y} is 0.
  9093. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  9094. so the input image is centered on the padded area.
  9095. @item color
  9096. Specify the color of the padded area. For the syntax of this option,
  9097. check the "Color" section in the ffmpeg-utils manual.
  9098. The default value of @var{color} is "black".
  9099. @item eval
  9100. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  9101. It accepts the following values:
  9102. @table @samp
  9103. @item init
  9104. Only evaluate expressions once during the filter initialization or when
  9105. a command is processed.
  9106. @item frame
  9107. Evaluate expressions for each incoming frame.
  9108. @end table
  9109. Default value is @samp{init}.
  9110. @item aspect
  9111. Pad to aspect instead to a resolution.
  9112. @end table
  9113. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  9114. options are expressions containing the following constants:
  9115. @table @option
  9116. @item in_w
  9117. @item in_h
  9118. The input video width and height.
  9119. @item iw
  9120. @item ih
  9121. These are the same as @var{in_w} and @var{in_h}.
  9122. @item out_w
  9123. @item out_h
  9124. The output width and height (the size of the padded area), as
  9125. specified by the @var{width} and @var{height} expressions.
  9126. @item ow
  9127. @item oh
  9128. These are the same as @var{out_w} and @var{out_h}.
  9129. @item x
  9130. @item y
  9131. The x and y offsets as specified by the @var{x} and @var{y}
  9132. expressions, or NAN if not yet specified.
  9133. @item a
  9134. same as @var{iw} / @var{ih}
  9135. @item sar
  9136. input sample aspect ratio
  9137. @item dar
  9138. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  9139. @item hsub
  9140. @item vsub
  9141. The horizontal and vertical chroma subsample values. For example for the
  9142. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9143. @end table
  9144. @subsection Examples
  9145. @itemize
  9146. @item
  9147. Add paddings with the color "violet" to the input video. The output video
  9148. size is 640x480, and the top-left corner of the input video is placed at
  9149. column 0, row 40
  9150. @example
  9151. pad=640:480:0:40:violet
  9152. @end example
  9153. The example above is equivalent to the following command:
  9154. @example
  9155. pad=width=640:height=480:x=0:y=40:color=violet
  9156. @end example
  9157. @item
  9158. Pad the input to get an output with dimensions increased by 3/2,
  9159. and put the input video at the center of the padded area:
  9160. @example
  9161. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  9162. @end example
  9163. @item
  9164. Pad the input to get a squared output with size equal to the maximum
  9165. value between the input width and height, and put the input video at
  9166. the center of the padded area:
  9167. @example
  9168. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  9169. @end example
  9170. @item
  9171. Pad the input to get a final w/h ratio of 16:9:
  9172. @example
  9173. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  9174. @end example
  9175. @item
  9176. In case of anamorphic video, in order to set the output display aspect
  9177. correctly, it is necessary to use @var{sar} in the expression,
  9178. according to the relation:
  9179. @example
  9180. (ih * X / ih) * sar = output_dar
  9181. X = output_dar / sar
  9182. @end example
  9183. Thus the previous example needs to be modified to:
  9184. @example
  9185. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  9186. @end example
  9187. @item
  9188. Double the output size and put the input video in the bottom-right
  9189. corner of the output padded area:
  9190. @example
  9191. pad="2*iw:2*ih:ow-iw:oh-ih"
  9192. @end example
  9193. @end itemize
  9194. @anchor{palettegen}
  9195. @section palettegen
  9196. Generate one palette for a whole video stream.
  9197. It accepts the following options:
  9198. @table @option
  9199. @item max_colors
  9200. Set the maximum number of colors to quantize in the palette.
  9201. Note: the palette will still contain 256 colors; the unused palette entries
  9202. will be black.
  9203. @item reserve_transparent
  9204. Create a palette of 255 colors maximum and reserve the last one for
  9205. transparency. Reserving the transparency color is useful for GIF optimization.
  9206. If not set, the maximum of colors in the palette will be 256. You probably want
  9207. to disable this option for a standalone image.
  9208. Set by default.
  9209. @item transparency_color
  9210. Set the color that will be used as background for transparency.
  9211. @item stats_mode
  9212. Set statistics mode.
  9213. It accepts the following values:
  9214. @table @samp
  9215. @item full
  9216. Compute full frame histograms.
  9217. @item diff
  9218. Compute histograms only for the part that differs from previous frame. This
  9219. might be relevant to give more importance to the moving part of your input if
  9220. the background is static.
  9221. @item single
  9222. Compute new histogram for each frame.
  9223. @end table
  9224. Default value is @var{full}.
  9225. @end table
  9226. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  9227. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  9228. color quantization of the palette. This information is also visible at
  9229. @var{info} logging level.
  9230. @subsection Examples
  9231. @itemize
  9232. @item
  9233. Generate a representative palette of a given video using @command{ffmpeg}:
  9234. @example
  9235. ffmpeg -i input.mkv -vf palettegen palette.png
  9236. @end example
  9237. @end itemize
  9238. @section paletteuse
  9239. Use a palette to downsample an input video stream.
  9240. The filter takes two inputs: one video stream and a palette. The palette must
  9241. be a 256 pixels image.
  9242. It accepts the following options:
  9243. @table @option
  9244. @item dither
  9245. Select dithering mode. Available algorithms are:
  9246. @table @samp
  9247. @item bayer
  9248. Ordered 8x8 bayer dithering (deterministic)
  9249. @item heckbert
  9250. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  9251. Note: this dithering is sometimes considered "wrong" and is included as a
  9252. reference.
  9253. @item floyd_steinberg
  9254. Floyd and Steingberg dithering (error diffusion)
  9255. @item sierra2
  9256. Frankie Sierra dithering v2 (error diffusion)
  9257. @item sierra2_4a
  9258. Frankie Sierra dithering v2 "Lite" (error diffusion)
  9259. @end table
  9260. Default is @var{sierra2_4a}.
  9261. @item bayer_scale
  9262. When @var{bayer} dithering is selected, this option defines the scale of the
  9263. pattern (how much the crosshatch pattern is visible). A low value means more
  9264. visible pattern for less banding, and higher value means less visible pattern
  9265. at the cost of more banding.
  9266. The option must be an integer value in the range [0,5]. Default is @var{2}.
  9267. @item diff_mode
  9268. If set, define the zone to process
  9269. @table @samp
  9270. @item rectangle
  9271. Only the changing rectangle will be reprocessed. This is similar to GIF
  9272. cropping/offsetting compression mechanism. This option can be useful for speed
  9273. if only a part of the image is changing, and has use cases such as limiting the
  9274. scope of the error diffusal @option{dither} to the rectangle that bounds the
  9275. moving scene (it leads to more deterministic output if the scene doesn't change
  9276. much, and as a result less moving noise and better GIF compression).
  9277. @end table
  9278. Default is @var{none}.
  9279. @item new
  9280. Take new palette for each output frame.
  9281. @item alpha_threshold
  9282. Sets the alpha threshold for transparency. Alpha values above this threshold
  9283. will be treated as completely opaque, and values below this threshold will be
  9284. treated as completely transparent.
  9285. The option must be an integer value in the range [0,255]. Default is @var{128}.
  9286. @end table
  9287. @subsection Examples
  9288. @itemize
  9289. @item
  9290. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  9291. using @command{ffmpeg}:
  9292. @example
  9293. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  9294. @end example
  9295. @end itemize
  9296. @section perspective
  9297. Correct perspective of video not recorded perpendicular to the screen.
  9298. A description of the accepted parameters follows.
  9299. @table @option
  9300. @item x0
  9301. @item y0
  9302. @item x1
  9303. @item y1
  9304. @item x2
  9305. @item y2
  9306. @item x3
  9307. @item y3
  9308. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  9309. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  9310. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  9311. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  9312. then the corners of the source will be sent to the specified coordinates.
  9313. The expressions can use the following variables:
  9314. @table @option
  9315. @item W
  9316. @item H
  9317. the width and height of video frame.
  9318. @item in
  9319. Input frame count.
  9320. @item on
  9321. Output frame count.
  9322. @end table
  9323. @item interpolation
  9324. Set interpolation for perspective correction.
  9325. It accepts the following values:
  9326. @table @samp
  9327. @item linear
  9328. @item cubic
  9329. @end table
  9330. Default value is @samp{linear}.
  9331. @item sense
  9332. Set interpretation of coordinate options.
  9333. It accepts the following values:
  9334. @table @samp
  9335. @item 0, source
  9336. Send point in the source specified by the given coordinates to
  9337. the corners of the destination.
  9338. @item 1, destination
  9339. Send the corners of the source to the point in the destination specified
  9340. by the given coordinates.
  9341. Default value is @samp{source}.
  9342. @end table
  9343. @item eval
  9344. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  9345. It accepts the following values:
  9346. @table @samp
  9347. @item init
  9348. only evaluate expressions once during the filter initialization or
  9349. when a command is processed
  9350. @item frame
  9351. evaluate expressions for each incoming frame
  9352. @end table
  9353. Default value is @samp{init}.
  9354. @end table
  9355. @section phase
  9356. Delay interlaced video by one field time so that the field order changes.
  9357. The intended use is to fix PAL movies that have been captured with the
  9358. opposite field order to the film-to-video transfer.
  9359. A description of the accepted parameters follows.
  9360. @table @option
  9361. @item mode
  9362. Set phase mode.
  9363. It accepts the following values:
  9364. @table @samp
  9365. @item t
  9366. Capture field order top-first, transfer bottom-first.
  9367. Filter will delay the bottom field.
  9368. @item b
  9369. Capture field order bottom-first, transfer top-first.
  9370. Filter will delay the top field.
  9371. @item p
  9372. Capture and transfer with the same field order. This mode only exists
  9373. for the documentation of the other options to refer to, but if you
  9374. actually select it, the filter will faithfully do nothing.
  9375. @item a
  9376. Capture field order determined automatically by field flags, transfer
  9377. opposite.
  9378. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  9379. basis using field flags. If no field information is available,
  9380. then this works just like @samp{u}.
  9381. @item u
  9382. Capture unknown or varying, transfer opposite.
  9383. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  9384. analyzing the images and selecting the alternative that produces best
  9385. match between the fields.
  9386. @item T
  9387. Capture top-first, transfer unknown or varying.
  9388. Filter selects among @samp{t} and @samp{p} using image analysis.
  9389. @item B
  9390. Capture bottom-first, transfer unknown or varying.
  9391. Filter selects among @samp{b} and @samp{p} using image analysis.
  9392. @item A
  9393. Capture determined by field flags, transfer unknown or varying.
  9394. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  9395. image analysis. If no field information is available, then this works just
  9396. like @samp{U}. This is the default mode.
  9397. @item U
  9398. Both capture and transfer unknown or varying.
  9399. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  9400. @end table
  9401. @end table
  9402. @section pixdesctest
  9403. Pixel format descriptor test filter, mainly useful for internal
  9404. testing. The output video should be equal to the input video.
  9405. For example:
  9406. @example
  9407. format=monow, pixdesctest
  9408. @end example
  9409. can be used to test the monowhite pixel format descriptor definition.
  9410. @section pixscope
  9411. Display sample values of color channels. Mainly useful for checking color
  9412. and levels. Minimum supported resolution is 640x480.
  9413. The filters accept the following options:
  9414. @table @option
  9415. @item x
  9416. Set scope X position, relative offset on X axis.
  9417. @item y
  9418. Set scope Y position, relative offset on Y axis.
  9419. @item w
  9420. Set scope width.
  9421. @item h
  9422. Set scope height.
  9423. @item o
  9424. Set window opacity. This window also holds statistics about pixel area.
  9425. @item wx
  9426. Set window X position, relative offset on X axis.
  9427. @item wy
  9428. Set window Y position, relative offset on Y axis.
  9429. @end table
  9430. @section pp
  9431. Enable the specified chain of postprocessing subfilters using libpostproc. This
  9432. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  9433. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  9434. Each subfilter and some options have a short and a long name that can be used
  9435. interchangeably, i.e. dr/dering are the same.
  9436. The filters accept the following options:
  9437. @table @option
  9438. @item subfilters
  9439. Set postprocessing subfilters string.
  9440. @end table
  9441. All subfilters share common options to determine their scope:
  9442. @table @option
  9443. @item a/autoq
  9444. Honor the quality commands for this subfilter.
  9445. @item c/chrom
  9446. Do chrominance filtering, too (default).
  9447. @item y/nochrom
  9448. Do luminance filtering only (no chrominance).
  9449. @item n/noluma
  9450. Do chrominance filtering only (no luminance).
  9451. @end table
  9452. These options can be appended after the subfilter name, separated by a '|'.
  9453. Available subfilters are:
  9454. @table @option
  9455. @item hb/hdeblock[|difference[|flatness]]
  9456. Horizontal deblocking filter
  9457. @table @option
  9458. @item difference
  9459. Difference factor where higher values mean more deblocking (default: @code{32}).
  9460. @item flatness
  9461. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9462. @end table
  9463. @item vb/vdeblock[|difference[|flatness]]
  9464. Vertical deblocking filter
  9465. @table @option
  9466. @item difference
  9467. Difference factor where higher values mean more deblocking (default: @code{32}).
  9468. @item flatness
  9469. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9470. @end table
  9471. @item ha/hadeblock[|difference[|flatness]]
  9472. Accurate horizontal deblocking filter
  9473. @table @option
  9474. @item difference
  9475. Difference factor where higher values mean more deblocking (default: @code{32}).
  9476. @item flatness
  9477. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9478. @end table
  9479. @item va/vadeblock[|difference[|flatness]]
  9480. Accurate vertical deblocking filter
  9481. @table @option
  9482. @item difference
  9483. Difference factor where higher values mean more deblocking (default: @code{32}).
  9484. @item flatness
  9485. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9486. @end table
  9487. @end table
  9488. The horizontal and vertical deblocking filters share the difference and
  9489. flatness values so you cannot set different horizontal and vertical
  9490. thresholds.
  9491. @table @option
  9492. @item h1/x1hdeblock
  9493. Experimental horizontal deblocking filter
  9494. @item v1/x1vdeblock
  9495. Experimental vertical deblocking filter
  9496. @item dr/dering
  9497. Deringing filter
  9498. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  9499. @table @option
  9500. @item threshold1
  9501. larger -> stronger filtering
  9502. @item threshold2
  9503. larger -> stronger filtering
  9504. @item threshold3
  9505. larger -> stronger filtering
  9506. @end table
  9507. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  9508. @table @option
  9509. @item f/fullyrange
  9510. Stretch luminance to @code{0-255}.
  9511. @end table
  9512. @item lb/linblenddeint
  9513. Linear blend deinterlacing filter that deinterlaces the given block by
  9514. filtering all lines with a @code{(1 2 1)} filter.
  9515. @item li/linipoldeint
  9516. Linear interpolating deinterlacing filter that deinterlaces the given block by
  9517. linearly interpolating every second line.
  9518. @item ci/cubicipoldeint
  9519. Cubic interpolating deinterlacing filter deinterlaces the given block by
  9520. cubically interpolating every second line.
  9521. @item md/mediandeint
  9522. Median deinterlacing filter that deinterlaces the given block by applying a
  9523. median filter to every second line.
  9524. @item fd/ffmpegdeint
  9525. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  9526. second line with a @code{(-1 4 2 4 -1)} filter.
  9527. @item l5/lowpass5
  9528. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  9529. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  9530. @item fq/forceQuant[|quantizer]
  9531. Overrides the quantizer table from the input with the constant quantizer you
  9532. specify.
  9533. @table @option
  9534. @item quantizer
  9535. Quantizer to use
  9536. @end table
  9537. @item de/default
  9538. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  9539. @item fa/fast
  9540. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  9541. @item ac
  9542. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  9543. @end table
  9544. @subsection Examples
  9545. @itemize
  9546. @item
  9547. Apply horizontal and vertical deblocking, deringing and automatic
  9548. brightness/contrast:
  9549. @example
  9550. pp=hb/vb/dr/al
  9551. @end example
  9552. @item
  9553. Apply default filters without brightness/contrast correction:
  9554. @example
  9555. pp=de/-al
  9556. @end example
  9557. @item
  9558. Apply default filters and temporal denoiser:
  9559. @example
  9560. pp=default/tmpnoise|1|2|3
  9561. @end example
  9562. @item
  9563. Apply deblocking on luminance only, and switch vertical deblocking on or off
  9564. automatically depending on available CPU time:
  9565. @example
  9566. pp=hb|y/vb|a
  9567. @end example
  9568. @end itemize
  9569. @section pp7
  9570. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  9571. similar to spp = 6 with 7 point DCT, where only the center sample is
  9572. used after IDCT.
  9573. The filter accepts the following options:
  9574. @table @option
  9575. @item qp
  9576. Force a constant quantization parameter. It accepts an integer in range
  9577. 0 to 63. If not set, the filter will use the QP from the video stream
  9578. (if available).
  9579. @item mode
  9580. Set thresholding mode. Available modes are:
  9581. @table @samp
  9582. @item hard
  9583. Set hard thresholding.
  9584. @item soft
  9585. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9586. @item medium
  9587. Set medium thresholding (good results, default).
  9588. @end table
  9589. @end table
  9590. @section premultiply
  9591. Apply alpha premultiply effect to input video stream using first plane
  9592. of second stream as alpha.
  9593. Both streams must have same dimensions and same pixel format.
  9594. The filter accepts the following option:
  9595. @table @option
  9596. @item planes
  9597. Set which planes will be processed, unprocessed planes will be copied.
  9598. By default value 0xf, all planes will be processed.
  9599. @item inplace
  9600. Do not require 2nd input for processing, instead use alpha plane from input stream.
  9601. @end table
  9602. @section prewitt
  9603. Apply prewitt operator to input video stream.
  9604. The filter accepts the following option:
  9605. @table @option
  9606. @item planes
  9607. Set which planes will be processed, unprocessed planes will be copied.
  9608. By default value 0xf, all planes will be processed.
  9609. @item scale
  9610. Set value which will be multiplied with filtered result.
  9611. @item delta
  9612. Set value which will be added to filtered result.
  9613. @end table
  9614. @anchor{program_opencl}
  9615. @section program_opencl
  9616. Filter video using an OpenCL program.
  9617. @table @option
  9618. @item source
  9619. OpenCL program source file.
  9620. @item kernel
  9621. Kernel name in program.
  9622. @item inputs
  9623. Number of inputs to the filter. Defaults to 1.
  9624. @item size, s
  9625. Size of output frames. Defaults to the same as the first input.
  9626. @end table
  9627. The program source file must contain a kernel function with the given name,
  9628. which will be run once for each plane of the output. Each run on a plane
  9629. gets enqueued as a separate 2D global NDRange with one work-item for each
  9630. pixel to be generated. The global ID offset for each work-item is therefore
  9631. the coordinates of a pixel in the destination image.
  9632. The kernel function needs to take the following arguments:
  9633. @itemize
  9634. @item
  9635. Destination image, @var{__write_only image2d_t}.
  9636. This image will become the output; the kernel should write all of it.
  9637. @item
  9638. Frame index, @var{unsigned int}.
  9639. This is a counter starting from zero and increasing by one for each frame.
  9640. @item
  9641. Source images, @var{__read_only image2d_t}.
  9642. These are the most recent images on each input. The kernel may read from
  9643. them to generate the output, but they can't be written to.
  9644. @end itemize
  9645. Example programs:
  9646. @itemize
  9647. @item
  9648. Copy the input to the output (output must be the same size as the input).
  9649. @verbatim
  9650. __kernel void copy(__write_only image2d_t destination,
  9651. unsigned int index,
  9652. __read_only image2d_t source)
  9653. {
  9654. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  9655. int2 location = (int2)(get_global_id(0), get_global_id(1));
  9656. float4 value = read_imagef(source, sampler, location);
  9657. write_imagef(destination, location, value);
  9658. }
  9659. @end verbatim
  9660. @item
  9661. Apply a simple transformation, rotating the input by an amount increasing
  9662. with the index counter. Pixel values are linearly interpolated by the
  9663. sampler, and the output need not have the same dimensions as the input.
  9664. @verbatim
  9665. __kernel void rotate_image(__write_only image2d_t dst,
  9666. unsigned int index,
  9667. __read_only image2d_t src)
  9668. {
  9669. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  9670. CLK_FILTER_LINEAR);
  9671. float angle = (float)index / 100.0f;
  9672. float2 dst_dim = convert_float2(get_image_dim(dst));
  9673. float2 src_dim = convert_float2(get_image_dim(src));
  9674. float2 dst_cen = dst_dim / 2.0f;
  9675. float2 src_cen = src_dim / 2.0f;
  9676. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  9677. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  9678. float2 src_pos = {
  9679. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  9680. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  9681. };
  9682. src_pos = src_pos * src_dim / dst_dim;
  9683. float2 src_loc = src_pos + src_cen;
  9684. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  9685. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  9686. write_imagef(dst, dst_loc, 0.5f);
  9687. else
  9688. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  9689. }
  9690. @end verbatim
  9691. @item
  9692. Blend two inputs together, with the amount of each input used varying
  9693. with the index counter.
  9694. @verbatim
  9695. __kernel void blend_images(__write_only image2d_t dst,
  9696. unsigned int index,
  9697. __read_only image2d_t src1,
  9698. __read_only image2d_t src2)
  9699. {
  9700. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  9701. CLK_FILTER_LINEAR);
  9702. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  9703. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  9704. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  9705. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  9706. float4 val1 = read_imagef(src1, sampler, src1_loc);
  9707. float4 val2 = read_imagef(src2, sampler, src2_loc);
  9708. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  9709. }
  9710. @end verbatim
  9711. @end itemize
  9712. @section pseudocolor
  9713. Alter frame colors in video with pseudocolors.
  9714. This filter accept the following options:
  9715. @table @option
  9716. @item c0
  9717. set pixel first component expression
  9718. @item c1
  9719. set pixel second component expression
  9720. @item c2
  9721. set pixel third component expression
  9722. @item c3
  9723. set pixel fourth component expression, corresponds to the alpha component
  9724. @item i
  9725. set component to use as base for altering colors
  9726. @end table
  9727. Each of them specifies the expression to use for computing the lookup table for
  9728. the corresponding pixel component values.
  9729. The expressions can contain the following constants and functions:
  9730. @table @option
  9731. @item w
  9732. @item h
  9733. The input width and height.
  9734. @item val
  9735. The input value for the pixel component.
  9736. @item ymin, umin, vmin, amin
  9737. The minimum allowed component value.
  9738. @item ymax, umax, vmax, amax
  9739. The maximum allowed component value.
  9740. @end table
  9741. All expressions default to "val".
  9742. @subsection Examples
  9743. @itemize
  9744. @item
  9745. Change too high luma values to gradient:
  9746. @example
  9747. 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'"
  9748. @end example
  9749. @end itemize
  9750. @section psnr
  9751. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  9752. Ratio) between two input videos.
  9753. This filter takes in input two input videos, the first input is
  9754. considered the "main" source and is passed unchanged to the
  9755. output. The second input is used as a "reference" video for computing
  9756. the PSNR.
  9757. Both video inputs must have the same resolution and pixel format for
  9758. this filter to work correctly. Also it assumes that both inputs
  9759. have the same number of frames, which are compared one by one.
  9760. The obtained average PSNR is printed through the logging system.
  9761. The filter stores the accumulated MSE (mean squared error) of each
  9762. frame, and at the end of the processing it is averaged across all frames
  9763. equally, and the following formula is applied to obtain the PSNR:
  9764. @example
  9765. PSNR = 10*log10(MAX^2/MSE)
  9766. @end example
  9767. Where MAX is the average of the maximum values of each component of the
  9768. image.
  9769. The description of the accepted parameters follows.
  9770. @table @option
  9771. @item stats_file, f
  9772. If specified the filter will use the named file to save the PSNR of
  9773. each individual frame. When filename equals "-" the data is sent to
  9774. standard output.
  9775. @item stats_version
  9776. Specifies which version of the stats file format to use. Details of
  9777. each format are written below.
  9778. Default value is 1.
  9779. @item stats_add_max
  9780. Determines whether the max value is output to the stats log.
  9781. Default value is 0.
  9782. Requires stats_version >= 2. If this is set and stats_version < 2,
  9783. the filter will return an error.
  9784. @end table
  9785. This filter also supports the @ref{framesync} options.
  9786. The file printed if @var{stats_file} is selected, contains a sequence of
  9787. key/value pairs of the form @var{key}:@var{value} for each compared
  9788. couple of frames.
  9789. If a @var{stats_version} greater than 1 is specified, a header line precedes
  9790. the list of per-frame-pair stats, with key value pairs following the frame
  9791. format with the following parameters:
  9792. @table @option
  9793. @item psnr_log_version
  9794. The version of the log file format. Will match @var{stats_version}.
  9795. @item fields
  9796. A comma separated list of the per-frame-pair parameters included in
  9797. the log.
  9798. @end table
  9799. A description of each shown per-frame-pair parameter follows:
  9800. @table @option
  9801. @item n
  9802. sequential number of the input frame, starting from 1
  9803. @item mse_avg
  9804. Mean Square Error pixel-by-pixel average difference of the compared
  9805. frames, averaged over all the image components.
  9806. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  9807. Mean Square Error pixel-by-pixel average difference of the compared
  9808. frames for the component specified by the suffix.
  9809. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  9810. Peak Signal to Noise ratio of the compared frames for the component
  9811. specified by the suffix.
  9812. @item max_avg, max_y, max_u, max_v
  9813. Maximum allowed value for each channel, and average over all
  9814. channels.
  9815. @end table
  9816. For example:
  9817. @example
  9818. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9819. [main][ref] psnr="stats_file=stats.log" [out]
  9820. @end example
  9821. On this example the input file being processed is compared with the
  9822. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  9823. is stored in @file{stats.log}.
  9824. @anchor{pullup}
  9825. @section pullup
  9826. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  9827. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  9828. content.
  9829. The pullup filter is designed to take advantage of future context in making
  9830. its decisions. This filter is stateless in the sense that it does not lock
  9831. onto a pattern to follow, but it instead looks forward to the following
  9832. fields in order to identify matches and rebuild progressive frames.
  9833. To produce content with an even framerate, insert the fps filter after
  9834. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  9835. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  9836. The filter accepts the following options:
  9837. @table @option
  9838. @item jl
  9839. @item jr
  9840. @item jt
  9841. @item jb
  9842. These options set the amount of "junk" to ignore at the left, right, top, and
  9843. bottom of the image, respectively. Left and right are in units of 8 pixels,
  9844. while top and bottom are in units of 2 lines.
  9845. The default is 8 pixels on each side.
  9846. @item sb
  9847. Set the strict breaks. Setting this option to 1 will reduce the chances of
  9848. filter generating an occasional mismatched frame, but it may also cause an
  9849. excessive number of frames to be dropped during high motion sequences.
  9850. Conversely, setting it to -1 will make filter match fields more easily.
  9851. This may help processing of video where there is slight blurring between
  9852. the fields, but may also cause there to be interlaced frames in the output.
  9853. Default value is @code{0}.
  9854. @item mp
  9855. Set the metric plane to use. It accepts the following values:
  9856. @table @samp
  9857. @item l
  9858. Use luma plane.
  9859. @item u
  9860. Use chroma blue plane.
  9861. @item v
  9862. Use chroma red plane.
  9863. @end table
  9864. This option may be set to use chroma plane instead of the default luma plane
  9865. for doing filter's computations. This may improve accuracy on very clean
  9866. source material, but more likely will decrease accuracy, especially if there
  9867. is chroma noise (rainbow effect) or any grayscale video.
  9868. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  9869. load and make pullup usable in realtime on slow machines.
  9870. @end table
  9871. For best results (without duplicated frames in the output file) it is
  9872. necessary to change the output frame rate. For example, to inverse
  9873. telecine NTSC input:
  9874. @example
  9875. ffmpeg -i input -vf pullup -r 24000/1001 ...
  9876. @end example
  9877. @section qp
  9878. Change video quantization parameters (QP).
  9879. The filter accepts the following option:
  9880. @table @option
  9881. @item qp
  9882. Set expression for quantization parameter.
  9883. @end table
  9884. The expression is evaluated through the eval API and can contain, among others,
  9885. the following constants:
  9886. @table @var
  9887. @item known
  9888. 1 if index is not 129, 0 otherwise.
  9889. @item qp
  9890. Sequential index starting from -129 to 128.
  9891. @end table
  9892. @subsection Examples
  9893. @itemize
  9894. @item
  9895. Some equation like:
  9896. @example
  9897. qp=2+2*sin(PI*qp)
  9898. @end example
  9899. @end itemize
  9900. @section random
  9901. Flush video frames from internal cache of frames into a random order.
  9902. No frame is discarded.
  9903. Inspired by @ref{frei0r} nervous filter.
  9904. @table @option
  9905. @item frames
  9906. Set size in number of frames of internal cache, in range from @code{2} to
  9907. @code{512}. Default is @code{30}.
  9908. @item seed
  9909. Set seed for random number generator, must be an integer included between
  9910. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  9911. less than @code{0}, the filter will try to use a good random seed on a
  9912. best effort basis.
  9913. @end table
  9914. @section readeia608
  9915. Read closed captioning (EIA-608) information from the top lines of a video frame.
  9916. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  9917. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  9918. with EIA-608 data (starting from 0). A description of each metadata value follows:
  9919. @table @option
  9920. @item lavfi.readeia608.X.cc
  9921. The two bytes stored as EIA-608 data (printed in hexadecimal).
  9922. @item lavfi.readeia608.X.line
  9923. The number of the line on which the EIA-608 data was identified and read.
  9924. @end table
  9925. This filter accepts the following options:
  9926. @table @option
  9927. @item scan_min
  9928. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  9929. @item scan_max
  9930. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  9931. @item mac
  9932. Set minimal acceptable amplitude change for sync codes detection.
  9933. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  9934. @item spw
  9935. Set the ratio of width reserved for sync code detection.
  9936. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  9937. @item mhd
  9938. Set the max peaks height difference for sync code detection.
  9939. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9940. @item mpd
  9941. Set max peaks period difference for sync code detection.
  9942. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9943. @item msd
  9944. Set the first two max start code bits differences.
  9945. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  9946. @item bhd
  9947. Set the minimum ratio of bits height compared to 3rd start code bit.
  9948. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  9949. @item th_w
  9950. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  9951. @item th_b
  9952. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  9953. @item chp
  9954. Enable checking the parity bit. In the event of a parity error, the filter will output
  9955. @code{0x00} for that character. Default is false.
  9956. @end table
  9957. @subsection Examples
  9958. @itemize
  9959. @item
  9960. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  9961. @example
  9962. 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
  9963. @end example
  9964. @end itemize
  9965. @section readvitc
  9966. Read vertical interval timecode (VITC) information from the top lines of a
  9967. video frame.
  9968. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  9969. timecode value, if a valid timecode has been detected. Further metadata key
  9970. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  9971. timecode data has been found or not.
  9972. This filter accepts the following options:
  9973. @table @option
  9974. @item scan_max
  9975. Set the maximum number of lines to scan for VITC data. If the value is set to
  9976. @code{-1} the full video frame is scanned. Default is @code{45}.
  9977. @item thr_b
  9978. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  9979. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  9980. @item thr_w
  9981. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  9982. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  9983. @end table
  9984. @subsection Examples
  9985. @itemize
  9986. @item
  9987. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  9988. draw @code{--:--:--:--} as a placeholder:
  9989. @example
  9990. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  9991. @end example
  9992. @end itemize
  9993. @section remap
  9994. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  9995. Destination pixel at position (X, Y) will be picked from source (x, y) position
  9996. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  9997. value for pixel will be used for destination pixel.
  9998. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  9999. will have Xmap/Ymap video stream dimensions.
  10000. Xmap and Ymap input video streams are 16bit depth, single channel.
  10001. @section removegrain
  10002. The removegrain filter is a spatial denoiser for progressive video.
  10003. @table @option
  10004. @item m0
  10005. Set mode for the first plane.
  10006. @item m1
  10007. Set mode for the second plane.
  10008. @item m2
  10009. Set mode for the third plane.
  10010. @item m3
  10011. Set mode for the fourth plane.
  10012. @end table
  10013. Range of mode is from 0 to 24. Description of each mode follows:
  10014. @table @var
  10015. @item 0
  10016. Leave input plane unchanged. Default.
  10017. @item 1
  10018. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  10019. @item 2
  10020. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  10021. @item 3
  10022. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  10023. @item 4
  10024. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  10025. This is equivalent to a median filter.
  10026. @item 5
  10027. Line-sensitive clipping giving the minimal change.
  10028. @item 6
  10029. Line-sensitive clipping, intermediate.
  10030. @item 7
  10031. Line-sensitive clipping, intermediate.
  10032. @item 8
  10033. Line-sensitive clipping, intermediate.
  10034. @item 9
  10035. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  10036. @item 10
  10037. Replaces the target pixel with the closest neighbour.
  10038. @item 11
  10039. [1 2 1] horizontal and vertical kernel blur.
  10040. @item 12
  10041. Same as mode 11.
  10042. @item 13
  10043. Bob mode, interpolates top field from the line where the neighbours
  10044. pixels are the closest.
  10045. @item 14
  10046. Bob mode, interpolates bottom field from the line where the neighbours
  10047. pixels are the closest.
  10048. @item 15
  10049. Bob mode, interpolates top field. Same as 13 but with a more complicated
  10050. interpolation formula.
  10051. @item 16
  10052. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  10053. interpolation formula.
  10054. @item 17
  10055. Clips the pixel with the minimum and maximum of respectively the maximum and
  10056. minimum of each pair of opposite neighbour pixels.
  10057. @item 18
  10058. Line-sensitive clipping using opposite neighbours whose greatest distance from
  10059. the current pixel is minimal.
  10060. @item 19
  10061. Replaces the pixel with the average of its 8 neighbours.
  10062. @item 20
  10063. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  10064. @item 21
  10065. Clips pixels using the averages of opposite neighbour.
  10066. @item 22
  10067. Same as mode 21 but simpler and faster.
  10068. @item 23
  10069. Small edge and halo removal, but reputed useless.
  10070. @item 24
  10071. Similar as 23.
  10072. @end table
  10073. @section removelogo
  10074. Suppress a TV station logo, using an image file to determine which
  10075. pixels comprise the logo. It works by filling in the pixels that
  10076. comprise the logo with neighboring pixels.
  10077. The filter accepts the following options:
  10078. @table @option
  10079. @item filename, f
  10080. Set the filter bitmap file, which can be any image format supported by
  10081. libavformat. The width and height of the image file must match those of the
  10082. video stream being processed.
  10083. @end table
  10084. Pixels in the provided bitmap image with a value of zero are not
  10085. considered part of the logo, non-zero pixels are considered part of
  10086. the logo. If you use white (255) for the logo and black (0) for the
  10087. rest, you will be safe. For making the filter bitmap, it is
  10088. recommended to take a screen capture of a black frame with the logo
  10089. visible, and then using a threshold filter followed by the erode
  10090. filter once or twice.
  10091. If needed, little splotches can be fixed manually. Remember that if
  10092. logo pixels are not covered, the filter quality will be much
  10093. reduced. Marking too many pixels as part of the logo does not hurt as
  10094. much, but it will increase the amount of blurring needed to cover over
  10095. the image and will destroy more information than necessary, and extra
  10096. pixels will slow things down on a large logo.
  10097. @section repeatfields
  10098. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  10099. fields based on its value.
  10100. @section reverse
  10101. Reverse a video clip.
  10102. Warning: This filter requires memory to buffer the entire clip, so trimming
  10103. is suggested.
  10104. @subsection Examples
  10105. @itemize
  10106. @item
  10107. Take the first 5 seconds of a clip, and reverse it.
  10108. @example
  10109. trim=end=5,reverse
  10110. @end example
  10111. @end itemize
  10112. @section roberts
  10113. Apply roberts cross operator to input video stream.
  10114. The filter accepts the following option:
  10115. @table @option
  10116. @item planes
  10117. Set which planes will be processed, unprocessed planes will be copied.
  10118. By default value 0xf, all planes will be processed.
  10119. @item scale
  10120. Set value which will be multiplied with filtered result.
  10121. @item delta
  10122. Set value which will be added to filtered result.
  10123. @end table
  10124. @section rotate
  10125. Rotate video by an arbitrary angle expressed in radians.
  10126. The filter accepts the following options:
  10127. A description of the optional parameters follows.
  10128. @table @option
  10129. @item angle, a
  10130. Set an expression for the angle by which to rotate the input video
  10131. clockwise, expressed as a number of radians. A negative value will
  10132. result in a counter-clockwise rotation. By default it is set to "0".
  10133. This expression is evaluated for each frame.
  10134. @item out_w, ow
  10135. Set the output width expression, default value is "iw".
  10136. This expression is evaluated just once during configuration.
  10137. @item out_h, oh
  10138. Set the output height expression, default value is "ih".
  10139. This expression is evaluated just once during configuration.
  10140. @item bilinear
  10141. Enable bilinear interpolation if set to 1, a value of 0 disables
  10142. it. Default value is 1.
  10143. @item fillcolor, c
  10144. Set the color used to fill the output area not covered by the rotated
  10145. image. For the general syntax of this option, check the "Color" section in the
  10146. ffmpeg-utils manual. If the special value "none" is selected then no
  10147. background is printed (useful for example if the background is never shown).
  10148. Default value is "black".
  10149. @end table
  10150. The expressions for the angle and the output size can contain the
  10151. following constants and functions:
  10152. @table @option
  10153. @item n
  10154. sequential number of the input frame, starting from 0. It is always NAN
  10155. before the first frame is filtered.
  10156. @item t
  10157. time in seconds of the input frame, it is set to 0 when the filter is
  10158. configured. It is always NAN before the first frame is filtered.
  10159. @item hsub
  10160. @item vsub
  10161. horizontal and vertical chroma subsample values. For example for the
  10162. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10163. @item in_w, iw
  10164. @item in_h, ih
  10165. the input video width and height
  10166. @item out_w, ow
  10167. @item out_h, oh
  10168. the output width and height, that is the size of the padded area as
  10169. specified by the @var{width} and @var{height} expressions
  10170. @item rotw(a)
  10171. @item roth(a)
  10172. the minimal width/height required for completely containing the input
  10173. video rotated by @var{a} radians.
  10174. These are only available when computing the @option{out_w} and
  10175. @option{out_h} expressions.
  10176. @end table
  10177. @subsection Examples
  10178. @itemize
  10179. @item
  10180. Rotate the input by PI/6 radians clockwise:
  10181. @example
  10182. rotate=PI/6
  10183. @end example
  10184. @item
  10185. Rotate the input by PI/6 radians counter-clockwise:
  10186. @example
  10187. rotate=-PI/6
  10188. @end example
  10189. @item
  10190. Rotate the input by 45 degrees clockwise:
  10191. @example
  10192. rotate=45*PI/180
  10193. @end example
  10194. @item
  10195. Apply a constant rotation with period T, starting from an angle of PI/3:
  10196. @example
  10197. rotate=PI/3+2*PI*t/T
  10198. @end example
  10199. @item
  10200. Make the input video rotation oscillating with a period of T
  10201. seconds and an amplitude of A radians:
  10202. @example
  10203. rotate=A*sin(2*PI/T*t)
  10204. @end example
  10205. @item
  10206. Rotate the video, output size is chosen so that the whole rotating
  10207. input video is always completely contained in the output:
  10208. @example
  10209. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  10210. @end example
  10211. @item
  10212. Rotate the video, reduce the output size so that no background is ever
  10213. shown:
  10214. @example
  10215. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  10216. @end example
  10217. @end itemize
  10218. @subsection Commands
  10219. The filter supports the following commands:
  10220. @table @option
  10221. @item a, angle
  10222. Set the angle expression.
  10223. The command accepts the same syntax of the corresponding option.
  10224. If the specified expression is not valid, it is kept at its current
  10225. value.
  10226. @end table
  10227. @section sab
  10228. Apply Shape Adaptive Blur.
  10229. The filter accepts the following options:
  10230. @table @option
  10231. @item luma_radius, lr
  10232. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  10233. value is 1.0. A greater value will result in a more blurred image, and
  10234. in slower processing.
  10235. @item luma_pre_filter_radius, lpfr
  10236. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  10237. value is 1.0.
  10238. @item luma_strength, ls
  10239. Set luma maximum difference between pixels to still be considered, must
  10240. be a value in the 0.1-100.0 range, default value is 1.0.
  10241. @item chroma_radius, cr
  10242. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  10243. greater value will result in a more blurred image, and in slower
  10244. processing.
  10245. @item chroma_pre_filter_radius, cpfr
  10246. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  10247. @item chroma_strength, cs
  10248. Set chroma maximum difference between pixels to still be considered,
  10249. must be a value in the -0.9-100.0 range.
  10250. @end table
  10251. Each chroma option value, if not explicitly specified, is set to the
  10252. corresponding luma option value.
  10253. @anchor{scale}
  10254. @section scale
  10255. Scale (resize) the input video, using the libswscale library.
  10256. The scale filter forces the output display aspect ratio to be the same
  10257. of the input, by changing the output sample aspect ratio.
  10258. If the input image format is different from the format requested by
  10259. the next filter, the scale filter will convert the input to the
  10260. requested format.
  10261. @subsection Options
  10262. The filter accepts the following options, or any of the options
  10263. supported by the libswscale scaler.
  10264. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  10265. the complete list of scaler options.
  10266. @table @option
  10267. @item width, w
  10268. @item height, h
  10269. Set the output video dimension expression. Default value is the input
  10270. dimension.
  10271. If the @var{width} or @var{w} value is 0, the input width is used for
  10272. the output. If the @var{height} or @var{h} value is 0, the input height
  10273. is used for the output.
  10274. If one and only one of the values is -n with n >= 1, the scale filter
  10275. will use a value that maintains the aspect ratio of the input image,
  10276. calculated from the other specified dimension. After that it will,
  10277. however, make sure that the calculated dimension is divisible by n and
  10278. adjust the value if necessary.
  10279. If both values are -n with n >= 1, the behavior will be identical to
  10280. both values being set to 0 as previously detailed.
  10281. See below for the list of accepted constants for use in the dimension
  10282. expression.
  10283. @item eval
  10284. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  10285. @table @samp
  10286. @item init
  10287. Only evaluate expressions once during the filter initialization or when a command is processed.
  10288. @item frame
  10289. Evaluate expressions for each incoming frame.
  10290. @end table
  10291. Default value is @samp{init}.
  10292. @item interl
  10293. Set the interlacing mode. It accepts the following values:
  10294. @table @samp
  10295. @item 1
  10296. Force interlaced aware scaling.
  10297. @item 0
  10298. Do not apply interlaced scaling.
  10299. @item -1
  10300. Select interlaced aware scaling depending on whether the source frames
  10301. are flagged as interlaced or not.
  10302. @end table
  10303. Default value is @samp{0}.
  10304. @item flags
  10305. Set libswscale scaling flags. See
  10306. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10307. complete list of values. If not explicitly specified the filter applies
  10308. the default flags.
  10309. @item param0, param1
  10310. Set libswscale input parameters for scaling algorithms that need them. See
  10311. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10312. complete documentation. If not explicitly specified the filter applies
  10313. empty parameters.
  10314. @item size, s
  10315. Set the video size. For the syntax of this option, check the
  10316. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10317. @item in_color_matrix
  10318. @item out_color_matrix
  10319. Set in/output YCbCr color space type.
  10320. This allows the autodetected value to be overridden as well as allows forcing
  10321. a specific value used for the output and encoder.
  10322. If not specified, the color space type depends on the pixel format.
  10323. Possible values:
  10324. @table @samp
  10325. @item auto
  10326. Choose automatically.
  10327. @item bt709
  10328. Format conforming to International Telecommunication Union (ITU)
  10329. Recommendation BT.709.
  10330. @item fcc
  10331. Set color space conforming to the United States Federal Communications
  10332. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  10333. @item bt601
  10334. Set color space conforming to:
  10335. @itemize
  10336. @item
  10337. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  10338. @item
  10339. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  10340. @item
  10341. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  10342. @end itemize
  10343. @item smpte240m
  10344. Set color space conforming to SMPTE ST 240:1999.
  10345. @end table
  10346. @item in_range
  10347. @item out_range
  10348. Set in/output YCbCr sample range.
  10349. This allows the autodetected value to be overridden as well as allows forcing
  10350. a specific value used for the output and encoder. If not specified, the
  10351. range depends on the pixel format. Possible values:
  10352. @table @samp
  10353. @item auto/unknown
  10354. Choose automatically.
  10355. @item jpeg/full/pc
  10356. Set full range (0-255 in case of 8-bit luma).
  10357. @item mpeg/limited/tv
  10358. Set "MPEG" range (16-235 in case of 8-bit luma).
  10359. @end table
  10360. @item force_original_aspect_ratio
  10361. Enable decreasing or increasing output video width or height if necessary to
  10362. keep the original aspect ratio. Possible values:
  10363. @table @samp
  10364. @item disable
  10365. Scale the video as specified and disable this feature.
  10366. @item decrease
  10367. The output video dimensions will automatically be decreased if needed.
  10368. @item increase
  10369. The output video dimensions will automatically be increased if needed.
  10370. @end table
  10371. One useful instance of this option is that when you know a specific device's
  10372. maximum allowed resolution, you can use this to limit the output video to
  10373. that, while retaining the aspect ratio. For example, device A allows
  10374. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  10375. decrease) and specifying 1280x720 to the command line makes the output
  10376. 1280x533.
  10377. Please note that this is a different thing than specifying -1 for @option{w}
  10378. or @option{h}, you still need to specify the output resolution for this option
  10379. to work.
  10380. @end table
  10381. The values of the @option{w} and @option{h} options are expressions
  10382. containing the following constants:
  10383. @table @var
  10384. @item in_w
  10385. @item in_h
  10386. The input width and height
  10387. @item iw
  10388. @item ih
  10389. These are the same as @var{in_w} and @var{in_h}.
  10390. @item out_w
  10391. @item out_h
  10392. The output (scaled) width and height
  10393. @item ow
  10394. @item oh
  10395. These are the same as @var{out_w} and @var{out_h}
  10396. @item a
  10397. The same as @var{iw} / @var{ih}
  10398. @item sar
  10399. input sample aspect ratio
  10400. @item dar
  10401. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  10402. @item hsub
  10403. @item vsub
  10404. horizontal and vertical input chroma subsample values. For example for the
  10405. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10406. @item ohsub
  10407. @item ovsub
  10408. horizontal and vertical output chroma subsample values. For example for the
  10409. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10410. @end table
  10411. @subsection Examples
  10412. @itemize
  10413. @item
  10414. Scale the input video to a size of 200x100
  10415. @example
  10416. scale=w=200:h=100
  10417. @end example
  10418. This is equivalent to:
  10419. @example
  10420. scale=200:100
  10421. @end example
  10422. or:
  10423. @example
  10424. scale=200x100
  10425. @end example
  10426. @item
  10427. Specify a size abbreviation for the output size:
  10428. @example
  10429. scale=qcif
  10430. @end example
  10431. which can also be written as:
  10432. @example
  10433. scale=size=qcif
  10434. @end example
  10435. @item
  10436. Scale the input to 2x:
  10437. @example
  10438. scale=w=2*iw:h=2*ih
  10439. @end example
  10440. @item
  10441. The above is the same as:
  10442. @example
  10443. scale=2*in_w:2*in_h
  10444. @end example
  10445. @item
  10446. Scale the input to 2x with forced interlaced scaling:
  10447. @example
  10448. scale=2*iw:2*ih:interl=1
  10449. @end example
  10450. @item
  10451. Scale the input to half size:
  10452. @example
  10453. scale=w=iw/2:h=ih/2
  10454. @end example
  10455. @item
  10456. Increase the width, and set the height to the same size:
  10457. @example
  10458. scale=3/2*iw:ow
  10459. @end example
  10460. @item
  10461. Seek Greek harmony:
  10462. @example
  10463. scale=iw:1/PHI*iw
  10464. scale=ih*PHI:ih
  10465. @end example
  10466. @item
  10467. Increase the height, and set the width to 3/2 of the height:
  10468. @example
  10469. scale=w=3/2*oh:h=3/5*ih
  10470. @end example
  10471. @item
  10472. Increase the size, making the size a multiple of the chroma
  10473. subsample values:
  10474. @example
  10475. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  10476. @end example
  10477. @item
  10478. Increase the width to a maximum of 500 pixels,
  10479. keeping the same aspect ratio as the input:
  10480. @example
  10481. scale=w='min(500\, iw*3/2):h=-1'
  10482. @end example
  10483. @end itemize
  10484. @subsection Commands
  10485. This filter supports the following commands:
  10486. @table @option
  10487. @item width, w
  10488. @item height, h
  10489. Set the output video dimension expression.
  10490. The command accepts the same syntax of the corresponding option.
  10491. If the specified expression is not valid, it is kept at its current
  10492. value.
  10493. @end table
  10494. @section scale_npp
  10495. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  10496. format conversion on CUDA video frames. Setting the output width and height
  10497. works in the same way as for the @var{scale} filter.
  10498. The following additional options are accepted:
  10499. @table @option
  10500. @item format
  10501. The pixel format of the output CUDA frames. If set to the string "same" (the
  10502. default), the input format will be kept. Note that automatic format negotiation
  10503. and conversion is not yet supported for hardware frames
  10504. @item interp_algo
  10505. The interpolation algorithm used for resizing. One of the following:
  10506. @table @option
  10507. @item nn
  10508. Nearest neighbour.
  10509. @item linear
  10510. @item cubic
  10511. @item cubic2p_bspline
  10512. 2-parameter cubic (B=1, C=0)
  10513. @item cubic2p_catmullrom
  10514. 2-parameter cubic (B=0, C=1/2)
  10515. @item cubic2p_b05c03
  10516. 2-parameter cubic (B=1/2, C=3/10)
  10517. @item super
  10518. Supersampling
  10519. @item lanczos
  10520. @end table
  10521. @end table
  10522. @section scale2ref
  10523. Scale (resize) the input video, based on a reference video.
  10524. See the scale filter for available options, scale2ref supports the same but
  10525. uses the reference video instead of the main input as basis. scale2ref also
  10526. supports the following additional constants for the @option{w} and
  10527. @option{h} options:
  10528. @table @var
  10529. @item main_w
  10530. @item main_h
  10531. The main input video's width and height
  10532. @item main_a
  10533. The same as @var{main_w} / @var{main_h}
  10534. @item main_sar
  10535. The main input video's sample aspect ratio
  10536. @item main_dar, mdar
  10537. The main input video's display aspect ratio. Calculated from
  10538. @code{(main_w / main_h) * main_sar}.
  10539. @item main_hsub
  10540. @item main_vsub
  10541. The main input video's horizontal and vertical chroma subsample values.
  10542. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  10543. is 1.
  10544. @end table
  10545. @subsection Examples
  10546. @itemize
  10547. @item
  10548. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  10549. @example
  10550. 'scale2ref[b][a];[a][b]overlay'
  10551. @end example
  10552. @end itemize
  10553. @anchor{selectivecolor}
  10554. @section selectivecolor
  10555. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  10556. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  10557. by the "purity" of the color (that is, how saturated it already is).
  10558. This filter is similar to the Adobe Photoshop Selective Color tool.
  10559. The filter accepts the following options:
  10560. @table @option
  10561. @item correction_method
  10562. Select color correction method.
  10563. Available values are:
  10564. @table @samp
  10565. @item absolute
  10566. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  10567. component value).
  10568. @item relative
  10569. Specified adjustments are relative to the original component value.
  10570. @end table
  10571. Default is @code{absolute}.
  10572. @item reds
  10573. Adjustments for red pixels (pixels where the red component is the maximum)
  10574. @item yellows
  10575. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  10576. @item greens
  10577. Adjustments for green pixels (pixels where the green component is the maximum)
  10578. @item cyans
  10579. Adjustments for cyan pixels (pixels where the red component is the minimum)
  10580. @item blues
  10581. Adjustments for blue pixels (pixels where the blue component is the maximum)
  10582. @item magentas
  10583. Adjustments for magenta pixels (pixels where the green component is the minimum)
  10584. @item whites
  10585. Adjustments for white pixels (pixels where all components are greater than 128)
  10586. @item neutrals
  10587. Adjustments for all pixels except pure black and pure white
  10588. @item blacks
  10589. Adjustments for black pixels (pixels where all components are lesser than 128)
  10590. @item psfile
  10591. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  10592. @end table
  10593. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  10594. 4 space separated floating point adjustment values in the [-1,1] range,
  10595. respectively to adjust the amount of cyan, magenta, yellow and black for the
  10596. pixels of its range.
  10597. @subsection Examples
  10598. @itemize
  10599. @item
  10600. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  10601. increase magenta by 27% in blue areas:
  10602. @example
  10603. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  10604. @end example
  10605. @item
  10606. Use a Photoshop selective color preset:
  10607. @example
  10608. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  10609. @end example
  10610. @end itemize
  10611. @anchor{separatefields}
  10612. @section separatefields
  10613. The @code{separatefields} takes a frame-based video input and splits
  10614. each frame into its components fields, producing a new half height clip
  10615. with twice the frame rate and twice the frame count.
  10616. This filter use field-dominance information in frame to decide which
  10617. of each pair of fields to place first in the output.
  10618. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  10619. @section setdar, setsar
  10620. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  10621. output video.
  10622. This is done by changing the specified Sample (aka Pixel) Aspect
  10623. Ratio, according to the following equation:
  10624. @example
  10625. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  10626. @end example
  10627. Keep in mind that the @code{setdar} filter does not modify the pixel
  10628. dimensions of the video frame. Also, the display aspect ratio set by
  10629. this filter may be changed by later filters in the filterchain,
  10630. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  10631. applied.
  10632. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  10633. the filter output video.
  10634. Note that as a consequence of the application of this filter, the
  10635. output display aspect ratio will change according to the equation
  10636. above.
  10637. Keep in mind that the sample aspect ratio set by the @code{setsar}
  10638. filter may be changed by later filters in the filterchain, e.g. if
  10639. another "setsar" or a "setdar" filter is applied.
  10640. It accepts the following parameters:
  10641. @table @option
  10642. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  10643. Set the aspect ratio used by the filter.
  10644. The parameter can be a floating point number string, an expression, or
  10645. a string of the form @var{num}:@var{den}, where @var{num} and
  10646. @var{den} are the numerator and denominator of the aspect ratio. If
  10647. the parameter is not specified, it is assumed the value "0".
  10648. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  10649. should be escaped.
  10650. @item max
  10651. Set the maximum integer value to use for expressing numerator and
  10652. denominator when reducing the expressed aspect ratio to a rational.
  10653. Default value is @code{100}.
  10654. @end table
  10655. The parameter @var{sar} is an expression containing
  10656. the following constants:
  10657. @table @option
  10658. @item E, PI, PHI
  10659. These are approximated values for the mathematical constants e
  10660. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  10661. @item w, h
  10662. The input width and height.
  10663. @item a
  10664. These are the same as @var{w} / @var{h}.
  10665. @item sar
  10666. The input sample aspect ratio.
  10667. @item dar
  10668. The input display aspect ratio. It is the same as
  10669. (@var{w} / @var{h}) * @var{sar}.
  10670. @item hsub, vsub
  10671. Horizontal and vertical chroma subsample values. For example, for the
  10672. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10673. @end table
  10674. @subsection Examples
  10675. @itemize
  10676. @item
  10677. To change the display aspect ratio to 16:9, specify one of the following:
  10678. @example
  10679. setdar=dar=1.77777
  10680. setdar=dar=16/9
  10681. @end example
  10682. @item
  10683. To change the sample aspect ratio to 10:11, specify:
  10684. @example
  10685. setsar=sar=10/11
  10686. @end example
  10687. @item
  10688. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  10689. 1000 in the aspect ratio reduction, use the command:
  10690. @example
  10691. setdar=ratio=16/9:max=1000
  10692. @end example
  10693. @end itemize
  10694. @anchor{setfield}
  10695. @section setfield
  10696. Force field for the output video frame.
  10697. The @code{setfield} filter marks the interlace type field for the
  10698. output frames. It does not change the input frame, but only sets the
  10699. corresponding property, which affects how the frame is treated by
  10700. following filters (e.g. @code{fieldorder} or @code{yadif}).
  10701. The filter accepts the following options:
  10702. @table @option
  10703. @item mode
  10704. Available values are:
  10705. @table @samp
  10706. @item auto
  10707. Keep the same field property.
  10708. @item bff
  10709. Mark the frame as bottom-field-first.
  10710. @item tff
  10711. Mark the frame as top-field-first.
  10712. @item prog
  10713. Mark the frame as progressive.
  10714. @end table
  10715. @end table
  10716. @section showinfo
  10717. Show a line containing various information for each input video frame.
  10718. The input video is not modified.
  10719. The shown line contains a sequence of key/value pairs of the form
  10720. @var{key}:@var{value}.
  10721. The following values are shown in the output:
  10722. @table @option
  10723. @item n
  10724. The (sequential) number of the input frame, starting from 0.
  10725. @item pts
  10726. The Presentation TimeStamp of the input frame, expressed as a number of
  10727. time base units. The time base unit depends on the filter input pad.
  10728. @item pts_time
  10729. The Presentation TimeStamp of the input frame, expressed as a number of
  10730. seconds.
  10731. @item pos
  10732. The position of the frame in the input stream, or -1 if this information is
  10733. unavailable and/or meaningless (for example in case of synthetic video).
  10734. @item fmt
  10735. The pixel format name.
  10736. @item sar
  10737. The sample aspect ratio of the input frame, expressed in the form
  10738. @var{num}/@var{den}.
  10739. @item s
  10740. The size of the input frame. For the syntax of this option, check the
  10741. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10742. @item i
  10743. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  10744. for bottom field first).
  10745. @item iskey
  10746. This is 1 if the frame is a key frame, 0 otherwise.
  10747. @item type
  10748. The picture type of the input frame ("I" for an I-frame, "P" for a
  10749. P-frame, "B" for a B-frame, or "?" for an unknown type).
  10750. Also refer to the documentation of the @code{AVPictureType} enum and of
  10751. the @code{av_get_picture_type_char} function defined in
  10752. @file{libavutil/avutil.h}.
  10753. @item checksum
  10754. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  10755. @item plane_checksum
  10756. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  10757. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  10758. @end table
  10759. @section showpalette
  10760. Displays the 256 colors palette of each frame. This filter is only relevant for
  10761. @var{pal8} pixel format frames.
  10762. It accepts the following option:
  10763. @table @option
  10764. @item s
  10765. Set the size of the box used to represent one palette color entry. Default is
  10766. @code{30} (for a @code{30x30} pixel box).
  10767. @end table
  10768. @section shuffleframes
  10769. Reorder and/or duplicate and/or drop video frames.
  10770. It accepts the following parameters:
  10771. @table @option
  10772. @item mapping
  10773. Set the destination indexes of input frames.
  10774. This is space or '|' separated list of indexes that maps input frames to output
  10775. frames. Number of indexes also sets maximal value that each index may have.
  10776. '-1' index have special meaning and that is to drop frame.
  10777. @end table
  10778. The first frame has the index 0. The default is to keep the input unchanged.
  10779. @subsection Examples
  10780. @itemize
  10781. @item
  10782. Swap second and third frame of every three frames of the input:
  10783. @example
  10784. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  10785. @end example
  10786. @item
  10787. Swap 10th and 1st frame of every ten frames of the input:
  10788. @example
  10789. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  10790. @end example
  10791. @end itemize
  10792. @section shuffleplanes
  10793. Reorder and/or duplicate video planes.
  10794. It accepts the following parameters:
  10795. @table @option
  10796. @item map0
  10797. The index of the input plane to be used as the first output plane.
  10798. @item map1
  10799. The index of the input plane to be used as the second output plane.
  10800. @item map2
  10801. The index of the input plane to be used as the third output plane.
  10802. @item map3
  10803. The index of the input plane to be used as the fourth output plane.
  10804. @end table
  10805. The first plane has the index 0. The default is to keep the input unchanged.
  10806. @subsection Examples
  10807. @itemize
  10808. @item
  10809. Swap the second and third planes of the input:
  10810. @example
  10811. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  10812. @end example
  10813. @end itemize
  10814. @anchor{signalstats}
  10815. @section signalstats
  10816. Evaluate various visual metrics that assist in determining issues associated
  10817. with the digitization of analog video media.
  10818. By default the filter will log these metadata values:
  10819. @table @option
  10820. @item YMIN
  10821. Display the minimal Y value contained within the input frame. Expressed in
  10822. range of [0-255].
  10823. @item YLOW
  10824. Display the Y value at the 10% percentile within the input frame. Expressed in
  10825. range of [0-255].
  10826. @item YAVG
  10827. Display the average Y value within the input frame. Expressed in range of
  10828. [0-255].
  10829. @item YHIGH
  10830. Display the Y value at the 90% percentile within the input frame. Expressed in
  10831. range of [0-255].
  10832. @item YMAX
  10833. Display the maximum Y value contained within the input frame. Expressed in
  10834. range of [0-255].
  10835. @item UMIN
  10836. Display the minimal U value contained within the input frame. Expressed in
  10837. range of [0-255].
  10838. @item ULOW
  10839. Display the U value at the 10% percentile within the input frame. Expressed in
  10840. range of [0-255].
  10841. @item UAVG
  10842. Display the average U value within the input frame. Expressed in range of
  10843. [0-255].
  10844. @item UHIGH
  10845. Display the U value at the 90% percentile within the input frame. Expressed in
  10846. range of [0-255].
  10847. @item UMAX
  10848. Display the maximum U value contained within the input frame. Expressed in
  10849. range of [0-255].
  10850. @item VMIN
  10851. Display the minimal V value contained within the input frame. Expressed in
  10852. range of [0-255].
  10853. @item VLOW
  10854. Display the V value at the 10% percentile within the input frame. Expressed in
  10855. range of [0-255].
  10856. @item VAVG
  10857. Display the average V value within the input frame. Expressed in range of
  10858. [0-255].
  10859. @item VHIGH
  10860. Display the V value at the 90% percentile within the input frame. Expressed in
  10861. range of [0-255].
  10862. @item VMAX
  10863. Display the maximum V value contained within the input frame. Expressed in
  10864. range of [0-255].
  10865. @item SATMIN
  10866. Display the minimal saturation value contained within the input frame.
  10867. Expressed in range of [0-~181.02].
  10868. @item SATLOW
  10869. Display the saturation value at the 10% percentile within the input frame.
  10870. Expressed in range of [0-~181.02].
  10871. @item SATAVG
  10872. Display the average saturation value within the input frame. Expressed in range
  10873. of [0-~181.02].
  10874. @item SATHIGH
  10875. Display the saturation value at the 90% percentile within the input frame.
  10876. Expressed in range of [0-~181.02].
  10877. @item SATMAX
  10878. Display the maximum saturation value contained within the input frame.
  10879. Expressed in range of [0-~181.02].
  10880. @item HUEMED
  10881. Display the median value for hue within the input frame. Expressed in range of
  10882. [0-360].
  10883. @item HUEAVG
  10884. Display the average value for hue within the input frame. Expressed in range of
  10885. [0-360].
  10886. @item YDIF
  10887. Display the average of sample value difference between all values of the Y
  10888. plane in the current frame and corresponding values of the previous input frame.
  10889. Expressed in range of [0-255].
  10890. @item UDIF
  10891. Display the average of sample value difference between all values of the U
  10892. plane in the current frame and corresponding values of the previous input frame.
  10893. Expressed in range of [0-255].
  10894. @item VDIF
  10895. Display the average of sample value difference between all values of the V
  10896. plane in the current frame and corresponding values of the previous input frame.
  10897. Expressed in range of [0-255].
  10898. @item YBITDEPTH
  10899. Display bit depth of Y plane in current frame.
  10900. Expressed in range of [0-16].
  10901. @item UBITDEPTH
  10902. Display bit depth of U plane in current frame.
  10903. Expressed in range of [0-16].
  10904. @item VBITDEPTH
  10905. Display bit depth of V plane in current frame.
  10906. Expressed in range of [0-16].
  10907. @end table
  10908. The filter accepts the following options:
  10909. @table @option
  10910. @item stat
  10911. @item out
  10912. @option{stat} specify an additional form of image analysis.
  10913. @option{out} output video with the specified type of pixel highlighted.
  10914. Both options accept the following values:
  10915. @table @samp
  10916. @item tout
  10917. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  10918. unlike the neighboring pixels of the same field. Examples of temporal outliers
  10919. include the results of video dropouts, head clogs, or tape tracking issues.
  10920. @item vrep
  10921. Identify @var{vertical line repetition}. Vertical line repetition includes
  10922. similar rows of pixels within a frame. In born-digital video vertical line
  10923. repetition is common, but this pattern is uncommon in video digitized from an
  10924. analog source. When it occurs in video that results from the digitization of an
  10925. analog source it can indicate concealment from a dropout compensator.
  10926. @item brng
  10927. Identify pixels that fall outside of legal broadcast range.
  10928. @end table
  10929. @item color, c
  10930. Set the highlight color for the @option{out} option. The default color is
  10931. yellow.
  10932. @end table
  10933. @subsection Examples
  10934. @itemize
  10935. @item
  10936. Output data of various video metrics:
  10937. @example
  10938. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  10939. @end example
  10940. @item
  10941. Output specific data about the minimum and maximum values of the Y plane per frame:
  10942. @example
  10943. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  10944. @end example
  10945. @item
  10946. Playback video while highlighting pixels that are outside of broadcast range in red.
  10947. @example
  10948. ffplay example.mov -vf signalstats="out=brng:color=red"
  10949. @end example
  10950. @item
  10951. Playback video with signalstats metadata drawn over the frame.
  10952. @example
  10953. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  10954. @end example
  10955. The contents of signalstat_drawtext.txt used in the command are:
  10956. @example
  10957. time %@{pts:hms@}
  10958. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  10959. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  10960. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  10961. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  10962. @end example
  10963. @end itemize
  10964. @anchor{signature}
  10965. @section signature
  10966. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  10967. input. In this case the matching between the inputs can be calculated additionally.
  10968. The filter always passes through the first input. The signature of each stream can
  10969. be written into a file.
  10970. It accepts the following options:
  10971. @table @option
  10972. @item detectmode
  10973. Enable or disable the matching process.
  10974. Available values are:
  10975. @table @samp
  10976. @item off
  10977. Disable the calculation of a matching (default).
  10978. @item full
  10979. Calculate the matching for the whole video and output whether the whole video
  10980. matches or only parts.
  10981. @item fast
  10982. Calculate only until a matching is found or the video ends. Should be faster in
  10983. some cases.
  10984. @end table
  10985. @item nb_inputs
  10986. Set the number of inputs. The option value must be a non negative integer.
  10987. Default value is 1.
  10988. @item filename
  10989. Set the path to which the output is written. If there is more than one input,
  10990. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  10991. integer), that will be replaced with the input number. If no filename is
  10992. specified, no output will be written. This is the default.
  10993. @item format
  10994. Choose the output format.
  10995. Available values are:
  10996. @table @samp
  10997. @item binary
  10998. Use the specified binary representation (default).
  10999. @item xml
  11000. Use the specified xml representation.
  11001. @end table
  11002. @item th_d
  11003. Set threshold to detect one word as similar. The option value must be an integer
  11004. greater than zero. The default value is 9000.
  11005. @item th_dc
  11006. Set threshold to detect all words as similar. The option value must be an integer
  11007. greater than zero. The default value is 60000.
  11008. @item th_xh
  11009. Set threshold to detect frames as similar. The option value must be an integer
  11010. greater than zero. The default value is 116.
  11011. @item th_di
  11012. Set the minimum length of a sequence in frames to recognize it as matching
  11013. sequence. The option value must be a non negative integer value.
  11014. The default value is 0.
  11015. @item th_it
  11016. Set the minimum relation, that matching frames to all frames must have.
  11017. The option value must be a double value between 0 and 1. The default value is 0.5.
  11018. @end table
  11019. @subsection Examples
  11020. @itemize
  11021. @item
  11022. To calculate the signature of an input video and store it in signature.bin:
  11023. @example
  11024. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  11025. @end example
  11026. @item
  11027. To detect whether two videos match and store the signatures in XML format in
  11028. signature0.xml and signature1.xml:
  11029. @example
  11030. 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 -
  11031. @end example
  11032. @end itemize
  11033. @anchor{smartblur}
  11034. @section smartblur
  11035. Blur the input video without impacting the outlines.
  11036. It accepts the following options:
  11037. @table @option
  11038. @item luma_radius, lr
  11039. Set the luma radius. The option value must be a float number in
  11040. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11041. used to blur the image (slower if larger). Default value is 1.0.
  11042. @item luma_strength, ls
  11043. Set the luma strength. The option value must be a float number
  11044. in the range [-1.0,1.0] that configures the blurring. A value included
  11045. in [0.0,1.0] will blur the image whereas a value included in
  11046. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  11047. @item luma_threshold, lt
  11048. Set the luma threshold used as a coefficient to determine
  11049. whether a pixel should be blurred or not. The option value must be an
  11050. integer in the range [-30,30]. A value of 0 will filter all the image,
  11051. a value included in [0,30] will filter flat areas and a value included
  11052. in [-30,0] will filter edges. Default value is 0.
  11053. @item chroma_radius, cr
  11054. Set the chroma radius. The option value must be a float number in
  11055. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11056. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  11057. @item chroma_strength, cs
  11058. Set the chroma strength. The option value must be a float number
  11059. in the range [-1.0,1.0] that configures the blurring. A value included
  11060. in [0.0,1.0] will blur the image whereas a value included in
  11061. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  11062. @item chroma_threshold, ct
  11063. Set the chroma threshold used as a coefficient to determine
  11064. whether a pixel should be blurred or not. The option value must be an
  11065. integer in the range [-30,30]. A value of 0 will filter all the image,
  11066. a value included in [0,30] will filter flat areas and a value included
  11067. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  11068. @end table
  11069. If a chroma option is not explicitly set, the corresponding luma value
  11070. is set.
  11071. @section ssim
  11072. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  11073. This filter takes in input two input videos, the first input is
  11074. considered the "main" source and is passed unchanged to the
  11075. output. The second input is used as a "reference" video for computing
  11076. the SSIM.
  11077. Both video inputs must have the same resolution and pixel format for
  11078. this filter to work correctly. Also it assumes that both inputs
  11079. have the same number of frames, which are compared one by one.
  11080. The filter stores the calculated SSIM of each frame.
  11081. The description of the accepted parameters follows.
  11082. @table @option
  11083. @item stats_file, f
  11084. If specified the filter will use the named file to save the SSIM of
  11085. each individual frame. When filename equals "-" the data is sent to
  11086. standard output.
  11087. @end table
  11088. The file printed if @var{stats_file} is selected, contains a sequence of
  11089. key/value pairs of the form @var{key}:@var{value} for each compared
  11090. couple of frames.
  11091. A description of each shown parameter follows:
  11092. @table @option
  11093. @item n
  11094. sequential number of the input frame, starting from 1
  11095. @item Y, U, V, R, G, B
  11096. SSIM of the compared frames for the component specified by the suffix.
  11097. @item All
  11098. SSIM of the compared frames for the whole frame.
  11099. @item dB
  11100. Same as above but in dB representation.
  11101. @end table
  11102. This filter also supports the @ref{framesync} options.
  11103. For example:
  11104. @example
  11105. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11106. [main][ref] ssim="stats_file=stats.log" [out]
  11107. @end example
  11108. On this example the input file being processed is compared with the
  11109. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  11110. is stored in @file{stats.log}.
  11111. Another example with both psnr and ssim at same time:
  11112. @example
  11113. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  11114. @end example
  11115. @section stereo3d
  11116. Convert between different stereoscopic image formats.
  11117. The filters accept the following options:
  11118. @table @option
  11119. @item in
  11120. Set stereoscopic image format of input.
  11121. Available values for input image formats are:
  11122. @table @samp
  11123. @item sbsl
  11124. side by side parallel (left eye left, right eye right)
  11125. @item sbsr
  11126. side by side crosseye (right eye left, left eye right)
  11127. @item sbs2l
  11128. side by side parallel with half width resolution
  11129. (left eye left, right eye right)
  11130. @item sbs2r
  11131. side by side crosseye with half width resolution
  11132. (right eye left, left eye right)
  11133. @item abl
  11134. above-below (left eye above, right eye below)
  11135. @item abr
  11136. above-below (right eye above, left eye below)
  11137. @item ab2l
  11138. above-below with half height resolution
  11139. (left eye above, right eye below)
  11140. @item ab2r
  11141. above-below with half height resolution
  11142. (right eye above, left eye below)
  11143. @item al
  11144. alternating frames (left eye first, right eye second)
  11145. @item ar
  11146. alternating frames (right eye first, left eye second)
  11147. @item irl
  11148. interleaved rows (left eye has top row, right eye starts on next row)
  11149. @item irr
  11150. interleaved rows (right eye has top row, left eye starts on next row)
  11151. @item icl
  11152. interleaved columns, left eye first
  11153. @item icr
  11154. interleaved columns, right eye first
  11155. Default value is @samp{sbsl}.
  11156. @end table
  11157. @item out
  11158. Set stereoscopic image format of output.
  11159. @table @samp
  11160. @item sbsl
  11161. side by side parallel (left eye left, right eye right)
  11162. @item sbsr
  11163. side by side crosseye (right eye left, left eye right)
  11164. @item sbs2l
  11165. side by side parallel with half width resolution
  11166. (left eye left, right eye right)
  11167. @item sbs2r
  11168. side by side crosseye with half width resolution
  11169. (right eye left, left eye right)
  11170. @item abl
  11171. above-below (left eye above, right eye below)
  11172. @item abr
  11173. above-below (right eye above, left eye below)
  11174. @item ab2l
  11175. above-below with half height resolution
  11176. (left eye above, right eye below)
  11177. @item ab2r
  11178. above-below with half height resolution
  11179. (right eye above, left eye below)
  11180. @item al
  11181. alternating frames (left eye first, right eye second)
  11182. @item ar
  11183. alternating frames (right eye first, left eye second)
  11184. @item irl
  11185. interleaved rows (left eye has top row, right eye starts on next row)
  11186. @item irr
  11187. interleaved rows (right eye has top row, left eye starts on next row)
  11188. @item arbg
  11189. anaglyph red/blue gray
  11190. (red filter on left eye, blue filter on right eye)
  11191. @item argg
  11192. anaglyph red/green gray
  11193. (red filter on left eye, green filter on right eye)
  11194. @item arcg
  11195. anaglyph red/cyan gray
  11196. (red filter on left eye, cyan filter on right eye)
  11197. @item arch
  11198. anaglyph red/cyan half colored
  11199. (red filter on left eye, cyan filter on right eye)
  11200. @item arcc
  11201. anaglyph red/cyan color
  11202. (red filter on left eye, cyan filter on right eye)
  11203. @item arcd
  11204. anaglyph red/cyan color optimized with the least squares projection of dubois
  11205. (red filter on left eye, cyan filter on right eye)
  11206. @item agmg
  11207. anaglyph green/magenta gray
  11208. (green filter on left eye, magenta filter on right eye)
  11209. @item agmh
  11210. anaglyph green/magenta half colored
  11211. (green filter on left eye, magenta filter on right eye)
  11212. @item agmc
  11213. anaglyph green/magenta colored
  11214. (green filter on left eye, magenta filter on right eye)
  11215. @item agmd
  11216. anaglyph green/magenta color optimized with the least squares projection of dubois
  11217. (green filter on left eye, magenta filter on right eye)
  11218. @item aybg
  11219. anaglyph yellow/blue gray
  11220. (yellow filter on left eye, blue filter on right eye)
  11221. @item aybh
  11222. anaglyph yellow/blue half colored
  11223. (yellow filter on left eye, blue filter on right eye)
  11224. @item aybc
  11225. anaglyph yellow/blue colored
  11226. (yellow filter on left eye, blue filter on right eye)
  11227. @item aybd
  11228. anaglyph yellow/blue color optimized with the least squares projection of dubois
  11229. (yellow filter on left eye, blue filter on right eye)
  11230. @item ml
  11231. mono output (left eye only)
  11232. @item mr
  11233. mono output (right eye only)
  11234. @item chl
  11235. checkerboard, left eye first
  11236. @item chr
  11237. checkerboard, right eye first
  11238. @item icl
  11239. interleaved columns, left eye first
  11240. @item icr
  11241. interleaved columns, right eye first
  11242. @item hdmi
  11243. HDMI frame pack
  11244. @end table
  11245. Default value is @samp{arcd}.
  11246. @end table
  11247. @subsection Examples
  11248. @itemize
  11249. @item
  11250. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  11251. @example
  11252. stereo3d=sbsl:aybd
  11253. @end example
  11254. @item
  11255. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  11256. @example
  11257. stereo3d=abl:sbsr
  11258. @end example
  11259. @end itemize
  11260. @section streamselect, astreamselect
  11261. Select video or audio streams.
  11262. The filter accepts the following options:
  11263. @table @option
  11264. @item inputs
  11265. Set number of inputs. Default is 2.
  11266. @item map
  11267. Set input indexes to remap to outputs.
  11268. @end table
  11269. @subsection Commands
  11270. The @code{streamselect} and @code{astreamselect} filter supports the following
  11271. commands:
  11272. @table @option
  11273. @item map
  11274. Set input indexes to remap to outputs.
  11275. @end table
  11276. @subsection Examples
  11277. @itemize
  11278. @item
  11279. Select first 5 seconds 1st stream and rest of time 2nd stream:
  11280. @example
  11281. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  11282. @end example
  11283. @item
  11284. Same as above, but for audio:
  11285. @example
  11286. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  11287. @end example
  11288. @end itemize
  11289. @section sobel
  11290. Apply sobel operator to input video stream.
  11291. The filter accepts the following option:
  11292. @table @option
  11293. @item planes
  11294. Set which planes will be processed, unprocessed planes will be copied.
  11295. By default value 0xf, all planes will be processed.
  11296. @item scale
  11297. Set value which will be multiplied with filtered result.
  11298. @item delta
  11299. Set value which will be added to filtered result.
  11300. @end table
  11301. @anchor{spp}
  11302. @section spp
  11303. Apply a simple postprocessing filter that compresses and decompresses the image
  11304. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  11305. and average the results.
  11306. The filter accepts the following options:
  11307. @table @option
  11308. @item quality
  11309. Set quality. This option defines the number of levels for averaging. It accepts
  11310. an integer in the range 0-6. If set to @code{0}, the filter will have no
  11311. effect. A value of @code{6} means the higher quality. For each increment of
  11312. that value the speed drops by a factor of approximately 2. Default value is
  11313. @code{3}.
  11314. @item qp
  11315. Force a constant quantization parameter. If not set, the filter will use the QP
  11316. from the video stream (if available).
  11317. @item mode
  11318. Set thresholding mode. Available modes are:
  11319. @table @samp
  11320. @item hard
  11321. Set hard thresholding (default).
  11322. @item soft
  11323. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11324. @end table
  11325. @item use_bframe_qp
  11326. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  11327. option may cause flicker since the B-Frames have often larger QP. Default is
  11328. @code{0} (not enabled).
  11329. @end table
  11330. @anchor{subtitles}
  11331. @section subtitles
  11332. Draw subtitles on top of input video using the libass library.
  11333. To enable compilation of this filter you need to configure FFmpeg with
  11334. @code{--enable-libass}. This filter also requires a build with libavcodec and
  11335. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  11336. Alpha) subtitles format.
  11337. The filter accepts the following options:
  11338. @table @option
  11339. @item filename, f
  11340. Set the filename of the subtitle file to read. It must be specified.
  11341. @item original_size
  11342. Specify the size of the original video, the video for which the ASS file
  11343. was composed. For the syntax of this option, check the
  11344. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11345. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  11346. correctly scale the fonts if the aspect ratio has been changed.
  11347. @item fontsdir
  11348. Set a directory path containing fonts that can be used by the filter.
  11349. These fonts will be used in addition to whatever the font provider uses.
  11350. @item alpha
  11351. Process alpha channel, by default alpha channel is untouched.
  11352. @item charenc
  11353. Set subtitles input character encoding. @code{subtitles} filter only. Only
  11354. useful if not UTF-8.
  11355. @item stream_index, si
  11356. Set subtitles stream index. @code{subtitles} filter only.
  11357. @item force_style
  11358. Override default style or script info parameters of the subtitles. It accepts a
  11359. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  11360. @end table
  11361. If the first key is not specified, it is assumed that the first value
  11362. specifies the @option{filename}.
  11363. For example, to render the file @file{sub.srt} on top of the input
  11364. video, use the command:
  11365. @example
  11366. subtitles=sub.srt
  11367. @end example
  11368. which is equivalent to:
  11369. @example
  11370. subtitles=filename=sub.srt
  11371. @end example
  11372. To render the default subtitles stream from file @file{video.mkv}, use:
  11373. @example
  11374. subtitles=video.mkv
  11375. @end example
  11376. To render the second subtitles stream from that file, use:
  11377. @example
  11378. subtitles=video.mkv:si=1
  11379. @end example
  11380. To make the subtitles stream from @file{sub.srt} appear in transparent green
  11381. @code{DejaVu Serif}, use:
  11382. @example
  11383. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  11384. @end example
  11385. @section super2xsai
  11386. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  11387. Interpolate) pixel art scaling algorithm.
  11388. Useful for enlarging pixel art images without reducing sharpness.
  11389. @section swaprect
  11390. Swap two rectangular objects in video.
  11391. This filter accepts the following options:
  11392. @table @option
  11393. @item w
  11394. Set object width.
  11395. @item h
  11396. Set object height.
  11397. @item x1
  11398. Set 1st rect x coordinate.
  11399. @item y1
  11400. Set 1st rect y coordinate.
  11401. @item x2
  11402. Set 2nd rect x coordinate.
  11403. @item y2
  11404. Set 2nd rect y coordinate.
  11405. All expressions are evaluated once for each frame.
  11406. @end table
  11407. The all options are expressions containing the following constants:
  11408. @table @option
  11409. @item w
  11410. @item h
  11411. The input width and height.
  11412. @item a
  11413. same as @var{w} / @var{h}
  11414. @item sar
  11415. input sample aspect ratio
  11416. @item dar
  11417. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  11418. @item n
  11419. The number of the input frame, starting from 0.
  11420. @item t
  11421. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  11422. @item pos
  11423. the position in the file of the input frame, NAN if unknown
  11424. @end table
  11425. @section swapuv
  11426. Swap U & V plane.
  11427. @section telecine
  11428. Apply telecine process to the video.
  11429. This filter accepts the following options:
  11430. @table @option
  11431. @item first_field
  11432. @table @samp
  11433. @item top, t
  11434. top field first
  11435. @item bottom, b
  11436. bottom field first
  11437. The default value is @code{top}.
  11438. @end table
  11439. @item pattern
  11440. A string of numbers representing the pulldown pattern you wish to apply.
  11441. The default value is @code{23}.
  11442. @end table
  11443. @example
  11444. Some typical patterns:
  11445. NTSC output (30i):
  11446. 27.5p: 32222
  11447. 24p: 23 (classic)
  11448. 24p: 2332 (preferred)
  11449. 20p: 33
  11450. 18p: 334
  11451. 16p: 3444
  11452. PAL output (25i):
  11453. 27.5p: 12222
  11454. 24p: 222222222223 ("Euro pulldown")
  11455. 16.67p: 33
  11456. 16p: 33333334
  11457. @end example
  11458. @section threshold
  11459. Apply threshold effect to video stream.
  11460. This filter needs four video streams to perform thresholding.
  11461. First stream is stream we are filtering.
  11462. Second stream is holding threshold values, third stream is holding min values,
  11463. and last, fourth stream is holding max values.
  11464. The filter accepts the following option:
  11465. @table @option
  11466. @item planes
  11467. Set which planes will be processed, unprocessed planes will be copied.
  11468. By default value 0xf, all planes will be processed.
  11469. @end table
  11470. For example if first stream pixel's component value is less then threshold value
  11471. of pixel component from 2nd threshold stream, third stream value will picked,
  11472. otherwise fourth stream pixel component value will be picked.
  11473. Using color source filter one can perform various types of thresholding:
  11474. @subsection Examples
  11475. @itemize
  11476. @item
  11477. Binary threshold, using gray color as threshold:
  11478. @example
  11479. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  11480. @end example
  11481. @item
  11482. Inverted binary threshold, using gray color as threshold:
  11483. @example
  11484. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  11485. @end example
  11486. @item
  11487. Truncate binary threshold, using gray color as threshold:
  11488. @example
  11489. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  11490. @end example
  11491. @item
  11492. Threshold to zero, using gray color as threshold:
  11493. @example
  11494. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  11495. @end example
  11496. @item
  11497. Inverted threshold to zero, using gray color as threshold:
  11498. @example
  11499. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  11500. @end example
  11501. @end itemize
  11502. @section thumbnail
  11503. Select the most representative frame in a given sequence of consecutive frames.
  11504. The filter accepts the following options:
  11505. @table @option
  11506. @item n
  11507. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  11508. will pick one of them, and then handle the next batch of @var{n} frames until
  11509. the end. Default is @code{100}.
  11510. @end table
  11511. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  11512. value will result in a higher memory usage, so a high value is not recommended.
  11513. @subsection Examples
  11514. @itemize
  11515. @item
  11516. Extract one picture each 50 frames:
  11517. @example
  11518. thumbnail=50
  11519. @end example
  11520. @item
  11521. Complete example of a thumbnail creation with @command{ffmpeg}:
  11522. @example
  11523. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  11524. @end example
  11525. @end itemize
  11526. @section tile
  11527. Tile several successive frames together.
  11528. The filter accepts the following options:
  11529. @table @option
  11530. @item layout
  11531. Set the grid size (i.e. the number of lines and columns). For the syntax of
  11532. this option, check the
  11533. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11534. @item nb_frames
  11535. Set the maximum number of frames to render in the given area. It must be less
  11536. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  11537. the area will be used.
  11538. @item margin
  11539. Set the outer border margin in pixels.
  11540. @item padding
  11541. Set the inner border thickness (i.e. the number of pixels between frames). For
  11542. more advanced padding options (such as having different values for the edges),
  11543. refer to the pad video filter.
  11544. @item color
  11545. Specify the color of the unused area. For the syntax of this option, check the
  11546. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  11547. is "black".
  11548. @item overlap
  11549. Set the number of frames to overlap when tiling several successive frames together.
  11550. The value must be between @code{0} and @var{nb_frames - 1}.
  11551. @item init_padding
  11552. Set the number of frames to initially be empty before displaying first output frame.
  11553. This controls how soon will one get first output frame.
  11554. The value must be between @code{0} and @var{nb_frames - 1}.
  11555. @end table
  11556. @subsection Examples
  11557. @itemize
  11558. @item
  11559. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  11560. @example
  11561. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  11562. @end example
  11563. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  11564. duplicating each output frame to accommodate the originally detected frame
  11565. rate.
  11566. @item
  11567. Display @code{5} pictures in an area of @code{3x2} frames,
  11568. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  11569. mixed flat and named options:
  11570. @example
  11571. tile=3x2:nb_frames=5:padding=7:margin=2
  11572. @end example
  11573. @end itemize
  11574. @section tinterlace
  11575. Perform various types of temporal field interlacing.
  11576. Frames are counted starting from 1, so the first input frame is
  11577. considered odd.
  11578. The filter accepts the following options:
  11579. @table @option
  11580. @item mode
  11581. Specify the mode of the interlacing. This option can also be specified
  11582. as a value alone. See below for a list of values for this option.
  11583. Available values are:
  11584. @table @samp
  11585. @item merge, 0
  11586. Move odd frames into the upper field, even into the lower field,
  11587. generating a double height frame at half frame rate.
  11588. @example
  11589. ------> time
  11590. Input:
  11591. Frame 1 Frame 2 Frame 3 Frame 4
  11592. 11111 22222 33333 44444
  11593. 11111 22222 33333 44444
  11594. 11111 22222 33333 44444
  11595. 11111 22222 33333 44444
  11596. Output:
  11597. 11111 33333
  11598. 22222 44444
  11599. 11111 33333
  11600. 22222 44444
  11601. 11111 33333
  11602. 22222 44444
  11603. 11111 33333
  11604. 22222 44444
  11605. @end example
  11606. @item drop_even, 1
  11607. Only output odd frames, even frames are dropped, generating a frame with
  11608. unchanged height at half frame rate.
  11609. @example
  11610. ------> time
  11611. Input:
  11612. Frame 1 Frame 2 Frame 3 Frame 4
  11613. 11111 22222 33333 44444
  11614. 11111 22222 33333 44444
  11615. 11111 22222 33333 44444
  11616. 11111 22222 33333 44444
  11617. Output:
  11618. 11111 33333
  11619. 11111 33333
  11620. 11111 33333
  11621. 11111 33333
  11622. @end example
  11623. @item drop_odd, 2
  11624. Only output even frames, odd frames are dropped, generating a frame with
  11625. unchanged height at half frame rate.
  11626. @example
  11627. ------> time
  11628. Input:
  11629. Frame 1 Frame 2 Frame 3 Frame 4
  11630. 11111 22222 33333 44444
  11631. 11111 22222 33333 44444
  11632. 11111 22222 33333 44444
  11633. 11111 22222 33333 44444
  11634. Output:
  11635. 22222 44444
  11636. 22222 44444
  11637. 22222 44444
  11638. 22222 44444
  11639. @end example
  11640. @item pad, 3
  11641. Expand each frame to full height, but pad alternate lines with black,
  11642. generating a frame with double height at the same input frame rate.
  11643. @example
  11644. ------> time
  11645. Input:
  11646. Frame 1 Frame 2 Frame 3 Frame 4
  11647. 11111 22222 33333 44444
  11648. 11111 22222 33333 44444
  11649. 11111 22222 33333 44444
  11650. 11111 22222 33333 44444
  11651. Output:
  11652. 11111 ..... 33333 .....
  11653. ..... 22222 ..... 44444
  11654. 11111 ..... 33333 .....
  11655. ..... 22222 ..... 44444
  11656. 11111 ..... 33333 .....
  11657. ..... 22222 ..... 44444
  11658. 11111 ..... 33333 .....
  11659. ..... 22222 ..... 44444
  11660. @end example
  11661. @item interleave_top, 4
  11662. Interleave the upper field from odd frames with the lower field from
  11663. even frames, generating a frame with unchanged height at half frame rate.
  11664. @example
  11665. ------> time
  11666. Input:
  11667. Frame 1 Frame 2 Frame 3 Frame 4
  11668. 11111<- 22222 33333<- 44444
  11669. 11111 22222<- 33333 44444<-
  11670. 11111<- 22222 33333<- 44444
  11671. 11111 22222<- 33333 44444<-
  11672. Output:
  11673. 11111 33333
  11674. 22222 44444
  11675. 11111 33333
  11676. 22222 44444
  11677. @end example
  11678. @item interleave_bottom, 5
  11679. Interleave the lower field from odd frames with the upper field from
  11680. even frames, generating a frame with unchanged height at half frame rate.
  11681. @example
  11682. ------> time
  11683. Input:
  11684. Frame 1 Frame 2 Frame 3 Frame 4
  11685. 11111 22222<- 33333 44444<-
  11686. 11111<- 22222 33333<- 44444
  11687. 11111 22222<- 33333 44444<-
  11688. 11111<- 22222 33333<- 44444
  11689. Output:
  11690. 22222 44444
  11691. 11111 33333
  11692. 22222 44444
  11693. 11111 33333
  11694. @end example
  11695. @item interlacex2, 6
  11696. Double frame rate with unchanged height. Frames are inserted each
  11697. containing the second temporal field from the previous input frame and
  11698. the first temporal field from the next input frame. This mode relies on
  11699. the top_field_first flag. Useful for interlaced video displays with no
  11700. field synchronisation.
  11701. @example
  11702. ------> time
  11703. Input:
  11704. Frame 1 Frame 2 Frame 3 Frame 4
  11705. 11111 22222 33333 44444
  11706. 11111 22222 33333 44444
  11707. 11111 22222 33333 44444
  11708. 11111 22222 33333 44444
  11709. Output:
  11710. 11111 22222 22222 33333 33333 44444 44444
  11711. 11111 11111 22222 22222 33333 33333 44444
  11712. 11111 22222 22222 33333 33333 44444 44444
  11713. 11111 11111 22222 22222 33333 33333 44444
  11714. @end example
  11715. @item mergex2, 7
  11716. Move odd frames into the upper field, even into the lower field,
  11717. generating a double height frame at same frame rate.
  11718. @example
  11719. ------> time
  11720. Input:
  11721. Frame 1 Frame 2 Frame 3 Frame 4
  11722. 11111 22222 33333 44444
  11723. 11111 22222 33333 44444
  11724. 11111 22222 33333 44444
  11725. 11111 22222 33333 44444
  11726. Output:
  11727. 11111 33333 33333 55555
  11728. 22222 22222 44444 44444
  11729. 11111 33333 33333 55555
  11730. 22222 22222 44444 44444
  11731. 11111 33333 33333 55555
  11732. 22222 22222 44444 44444
  11733. 11111 33333 33333 55555
  11734. 22222 22222 44444 44444
  11735. @end example
  11736. @end table
  11737. Numeric values are deprecated but are accepted for backward
  11738. compatibility reasons.
  11739. Default mode is @code{merge}.
  11740. @item flags
  11741. Specify flags influencing the filter process.
  11742. Available value for @var{flags} is:
  11743. @table @option
  11744. @item low_pass_filter, vlfp
  11745. Enable linear vertical low-pass filtering in the filter.
  11746. Vertical low-pass filtering is required when creating an interlaced
  11747. destination from a progressive source which contains high-frequency
  11748. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  11749. patterning.
  11750. @item complex_filter, cvlfp
  11751. Enable complex vertical low-pass filtering.
  11752. This will slightly less reduce interlace 'twitter' and Moire
  11753. patterning but better retain detail and subjective sharpness impression.
  11754. @end table
  11755. Vertical low-pass filtering can only be enabled for @option{mode}
  11756. @var{interleave_top} and @var{interleave_bottom}.
  11757. @end table
  11758. @section tonemap
  11759. Tone map colors from different dynamic ranges.
  11760. This filter expects data in single precision floating point, as it needs to
  11761. operate on (and can output) out-of-range values. Another filter, such as
  11762. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  11763. The tonemapping algorithms implemented only work on linear light, so input
  11764. data should be linearized beforehand (and possibly correctly tagged).
  11765. @example
  11766. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  11767. @end example
  11768. @subsection Options
  11769. The filter accepts the following options.
  11770. @table @option
  11771. @item tonemap
  11772. Set the tone map algorithm to use.
  11773. Possible values are:
  11774. @table @var
  11775. @item none
  11776. Do not apply any tone map, only desaturate overbright pixels.
  11777. @item clip
  11778. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  11779. in-range values, while distorting out-of-range values.
  11780. @item linear
  11781. Stretch the entire reference gamut to a linear multiple of the display.
  11782. @item gamma
  11783. Fit a logarithmic transfer between the tone curves.
  11784. @item reinhard
  11785. Preserve overall image brightness with a simple curve, using nonlinear
  11786. contrast, which results in flattening details and degrading color accuracy.
  11787. @item hable
  11788. Preserve both dark and bright details better than @var{reinhard}, at the cost
  11789. of slightly darkening everything. Use it when detail preservation is more
  11790. important than color and brightness accuracy.
  11791. @item mobius
  11792. Smoothly map out-of-range values, while retaining contrast and colors for
  11793. in-range material as much as possible. Use it when color accuracy is more
  11794. important than detail preservation.
  11795. @end table
  11796. Default is none.
  11797. @item param
  11798. Tune the tone mapping algorithm.
  11799. This affects the following algorithms:
  11800. @table @var
  11801. @item none
  11802. Ignored.
  11803. @item linear
  11804. Specifies the scale factor to use while stretching.
  11805. Default to 1.0.
  11806. @item gamma
  11807. Specifies the exponent of the function.
  11808. Default to 1.8.
  11809. @item clip
  11810. Specify an extra linear coefficient to multiply into the signal before clipping.
  11811. Default to 1.0.
  11812. @item reinhard
  11813. Specify the local contrast coefficient at the display peak.
  11814. Default to 0.5, which means that in-gamut values will be about half as bright
  11815. as when clipping.
  11816. @item hable
  11817. Ignored.
  11818. @item mobius
  11819. Specify the transition point from linear to mobius transform. Every value
  11820. below this point is guaranteed to be mapped 1:1. The higher the value, the
  11821. more accurate the result will be, at the cost of losing bright details.
  11822. Default to 0.3, which due to the steep initial slope still preserves in-range
  11823. colors fairly accurately.
  11824. @end table
  11825. @item desat
  11826. Apply desaturation for highlights that exceed this level of brightness. The
  11827. higher the parameter, the more color information will be preserved. This
  11828. setting helps prevent unnaturally blown-out colors for super-highlights, by
  11829. (smoothly) turning into white instead. This makes images feel more natural,
  11830. at the cost of reducing information about out-of-range colors.
  11831. The default of 2.0 is somewhat conservative and will mostly just apply to
  11832. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  11833. This option works only if the input frame has a supported color tag.
  11834. @item peak
  11835. Override signal/nominal/reference peak with this value. Useful when the
  11836. embedded peak information in display metadata is not reliable or when tone
  11837. mapping from a lower range to a higher range.
  11838. @end table
  11839. @section transpose
  11840. Transpose rows with columns in the input video and optionally flip it.
  11841. It accepts the following parameters:
  11842. @table @option
  11843. @item dir
  11844. Specify the transposition direction.
  11845. Can assume the following values:
  11846. @table @samp
  11847. @item 0, 4, cclock_flip
  11848. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  11849. @example
  11850. L.R L.l
  11851. . . -> . .
  11852. l.r R.r
  11853. @end example
  11854. @item 1, 5, clock
  11855. Rotate by 90 degrees clockwise, that is:
  11856. @example
  11857. L.R l.L
  11858. . . -> . .
  11859. l.r r.R
  11860. @end example
  11861. @item 2, 6, cclock
  11862. Rotate by 90 degrees counterclockwise, that is:
  11863. @example
  11864. L.R R.r
  11865. . . -> . .
  11866. l.r L.l
  11867. @end example
  11868. @item 3, 7, clock_flip
  11869. Rotate by 90 degrees clockwise and vertically flip, that is:
  11870. @example
  11871. L.R r.R
  11872. . . -> . .
  11873. l.r l.L
  11874. @end example
  11875. @end table
  11876. For values between 4-7, the transposition is only done if the input
  11877. video geometry is portrait and not landscape. These values are
  11878. deprecated, the @code{passthrough} option should be used instead.
  11879. Numerical values are deprecated, and should be dropped in favor of
  11880. symbolic constants.
  11881. @item passthrough
  11882. Do not apply the transposition if the input geometry matches the one
  11883. specified by the specified value. It accepts the following values:
  11884. @table @samp
  11885. @item none
  11886. Always apply transposition.
  11887. @item portrait
  11888. Preserve portrait geometry (when @var{height} >= @var{width}).
  11889. @item landscape
  11890. Preserve landscape geometry (when @var{width} >= @var{height}).
  11891. @end table
  11892. Default value is @code{none}.
  11893. @end table
  11894. For example to rotate by 90 degrees clockwise and preserve portrait
  11895. layout:
  11896. @example
  11897. transpose=dir=1:passthrough=portrait
  11898. @end example
  11899. The command above can also be specified as:
  11900. @example
  11901. transpose=1:portrait
  11902. @end example
  11903. @section trim
  11904. Trim the input so that the output contains one continuous subpart of the input.
  11905. It accepts the following parameters:
  11906. @table @option
  11907. @item start
  11908. Specify the time of the start of the kept section, i.e. the frame with the
  11909. timestamp @var{start} will be the first frame in the output.
  11910. @item end
  11911. Specify the time of the first frame that will be dropped, i.e. the frame
  11912. immediately preceding the one with the timestamp @var{end} will be the last
  11913. frame in the output.
  11914. @item start_pts
  11915. This is the same as @var{start}, except this option sets the start timestamp
  11916. in timebase units instead of seconds.
  11917. @item end_pts
  11918. This is the same as @var{end}, except this option sets the end timestamp
  11919. in timebase units instead of seconds.
  11920. @item duration
  11921. The maximum duration of the output in seconds.
  11922. @item start_frame
  11923. The number of the first frame that should be passed to the output.
  11924. @item end_frame
  11925. The number of the first frame that should be dropped.
  11926. @end table
  11927. @option{start}, @option{end}, and @option{duration} are expressed as time
  11928. duration specifications; see
  11929. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11930. for the accepted syntax.
  11931. Note that the first two sets of the start/end options and the @option{duration}
  11932. option look at the frame timestamp, while the _frame variants simply count the
  11933. frames that pass through the filter. Also note that this filter does not modify
  11934. the timestamps. If you wish for the output timestamps to start at zero, insert a
  11935. setpts filter after the trim filter.
  11936. If multiple start or end options are set, this filter tries to be greedy and
  11937. keep all the frames that match at least one of the specified constraints. To keep
  11938. only the part that matches all the constraints at once, chain multiple trim
  11939. filters.
  11940. The defaults are such that all the input is kept. So it is possible to set e.g.
  11941. just the end values to keep everything before the specified time.
  11942. Examples:
  11943. @itemize
  11944. @item
  11945. Drop everything except the second minute of input:
  11946. @example
  11947. ffmpeg -i INPUT -vf trim=60:120
  11948. @end example
  11949. @item
  11950. Keep only the first second:
  11951. @example
  11952. ffmpeg -i INPUT -vf trim=duration=1
  11953. @end example
  11954. @end itemize
  11955. @section unpremultiply
  11956. Apply alpha unpremultiply effect to input video stream using first plane
  11957. of second stream as alpha.
  11958. Both streams must have same dimensions and same pixel format.
  11959. The filter accepts the following option:
  11960. @table @option
  11961. @item planes
  11962. Set which planes will be processed, unprocessed planes will be copied.
  11963. By default value 0xf, all planes will be processed.
  11964. If the format has 1 or 2 components, then luma is bit 0.
  11965. If the format has 3 or 4 components:
  11966. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  11967. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  11968. If present, the alpha channel is always the last bit.
  11969. @item inplace
  11970. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11971. @end table
  11972. @anchor{unsharp}
  11973. @section unsharp
  11974. Sharpen or blur the input video.
  11975. It accepts the following parameters:
  11976. @table @option
  11977. @item luma_msize_x, lx
  11978. Set the luma matrix horizontal size. It must be an odd integer between
  11979. 3 and 23. The default value is 5.
  11980. @item luma_msize_y, ly
  11981. Set the luma matrix vertical size. It must be an odd integer between 3
  11982. and 23. The default value is 5.
  11983. @item luma_amount, la
  11984. Set the luma effect strength. It must be a floating point number, reasonable
  11985. values lay between -1.5 and 1.5.
  11986. Negative values will blur the input video, while positive values will
  11987. sharpen it, a value of zero will disable the effect.
  11988. Default value is 1.0.
  11989. @item chroma_msize_x, cx
  11990. Set the chroma matrix horizontal size. It must be an odd integer
  11991. between 3 and 23. The default value is 5.
  11992. @item chroma_msize_y, cy
  11993. Set the chroma matrix vertical size. It must be an odd integer
  11994. between 3 and 23. The default value is 5.
  11995. @item chroma_amount, ca
  11996. Set the chroma effect strength. It must be a floating point number, reasonable
  11997. values lay between -1.5 and 1.5.
  11998. Negative values will blur the input video, while positive values will
  11999. sharpen it, a value of zero will disable the effect.
  12000. Default value is 0.0.
  12001. @end table
  12002. All parameters are optional and default to the equivalent of the
  12003. string '5:5:1.0:5:5:0.0'.
  12004. @subsection Examples
  12005. @itemize
  12006. @item
  12007. Apply strong luma sharpen effect:
  12008. @example
  12009. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  12010. @end example
  12011. @item
  12012. Apply a strong blur of both luma and chroma parameters:
  12013. @example
  12014. unsharp=7:7:-2:7:7:-2
  12015. @end example
  12016. @end itemize
  12017. @section uspp
  12018. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  12019. the image at several (or - in the case of @option{quality} level @code{8} - all)
  12020. shifts and average the results.
  12021. The way this differs from the behavior of spp is that uspp actually encodes &
  12022. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  12023. DCT similar to MJPEG.
  12024. The filter accepts the following options:
  12025. @table @option
  12026. @item quality
  12027. Set quality. This option defines the number of levels for averaging. It accepts
  12028. an integer in the range 0-8. If set to @code{0}, the filter will have no
  12029. effect. A value of @code{8} means the higher quality. For each increment of
  12030. that value the speed drops by a factor of approximately 2. Default value is
  12031. @code{3}.
  12032. @item qp
  12033. Force a constant quantization parameter. If not set, the filter will use the QP
  12034. from the video stream (if available).
  12035. @end table
  12036. @section vaguedenoiser
  12037. Apply a wavelet based denoiser.
  12038. It transforms each frame from the video input into the wavelet domain,
  12039. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  12040. the obtained coefficients. It does an inverse wavelet transform after.
  12041. Due to wavelet properties, it should give a nice smoothed result, and
  12042. reduced noise, without blurring picture features.
  12043. This filter accepts the following options:
  12044. @table @option
  12045. @item threshold
  12046. The filtering strength. The higher, the more filtered the video will be.
  12047. Hard thresholding can use a higher threshold than soft thresholding
  12048. before the video looks overfiltered. Default value is 2.
  12049. @item method
  12050. The filtering method the filter will use.
  12051. It accepts the following values:
  12052. @table @samp
  12053. @item hard
  12054. All values under the threshold will be zeroed.
  12055. @item soft
  12056. All values under the threshold will be zeroed. All values above will be
  12057. reduced by the threshold.
  12058. @item garrote
  12059. Scales or nullifies coefficients - intermediary between (more) soft and
  12060. (less) hard thresholding.
  12061. @end table
  12062. Default is garrote.
  12063. @item nsteps
  12064. Number of times, the wavelet will decompose the picture. Picture can't
  12065. be decomposed beyond a particular point (typically, 8 for a 640x480
  12066. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  12067. @item percent
  12068. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  12069. @item planes
  12070. A list of the planes to process. By default all planes are processed.
  12071. @end table
  12072. @section vectorscope
  12073. Display 2 color component values in the two dimensional graph (which is called
  12074. a vectorscope).
  12075. This filter accepts the following options:
  12076. @table @option
  12077. @item mode, m
  12078. Set vectorscope mode.
  12079. It accepts the following values:
  12080. @table @samp
  12081. @item gray
  12082. Gray values are displayed on graph, higher brightness means more pixels have
  12083. same component color value on location in graph. This is the default mode.
  12084. @item color
  12085. Gray values are displayed on graph. Surrounding pixels values which are not
  12086. present in video frame are drawn in gradient of 2 color components which are
  12087. set by option @code{x} and @code{y}. The 3rd color component is static.
  12088. @item color2
  12089. Actual color components values present in video frame are displayed on graph.
  12090. @item color3
  12091. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  12092. on graph increases value of another color component, which is luminance by
  12093. default values of @code{x} and @code{y}.
  12094. @item color4
  12095. Actual colors present in video frame are displayed on graph. If two different
  12096. colors map to same position on graph then color with higher value of component
  12097. not present in graph is picked.
  12098. @item color5
  12099. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  12100. component picked from radial gradient.
  12101. @end table
  12102. @item x
  12103. Set which color component will be represented on X-axis. Default is @code{1}.
  12104. @item y
  12105. Set which color component will be represented on Y-axis. Default is @code{2}.
  12106. @item intensity, i
  12107. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  12108. of color component which represents frequency of (X, Y) location in graph.
  12109. @item envelope, e
  12110. @table @samp
  12111. @item none
  12112. No envelope, this is default.
  12113. @item instant
  12114. Instant envelope, even darkest single pixel will be clearly highlighted.
  12115. @item peak
  12116. Hold maximum and minimum values presented in graph over time. This way you
  12117. can still spot out of range values without constantly looking at vectorscope.
  12118. @item peak+instant
  12119. Peak and instant envelope combined together.
  12120. @end table
  12121. @item graticule, g
  12122. Set what kind of graticule to draw.
  12123. @table @samp
  12124. @item none
  12125. @item green
  12126. @item color
  12127. @end table
  12128. @item opacity, o
  12129. Set graticule opacity.
  12130. @item flags, f
  12131. Set graticule flags.
  12132. @table @samp
  12133. @item white
  12134. Draw graticule for white point.
  12135. @item black
  12136. Draw graticule for black point.
  12137. @item name
  12138. Draw color points short names.
  12139. @end table
  12140. @item bgopacity, b
  12141. Set background opacity.
  12142. @item lthreshold, l
  12143. Set low threshold for color component not represented on X or Y axis.
  12144. Values lower than this value will be ignored. Default is 0.
  12145. Note this value is multiplied with actual max possible value one pixel component
  12146. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  12147. is 0.1 * 255 = 25.
  12148. @item hthreshold, h
  12149. Set high threshold for color component not represented on X or Y axis.
  12150. Values higher than this value will be ignored. Default is 1.
  12151. Note this value is multiplied with actual max possible value one pixel component
  12152. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  12153. is 0.9 * 255 = 230.
  12154. @item colorspace, c
  12155. Set what kind of colorspace to use when drawing graticule.
  12156. @table @samp
  12157. @item auto
  12158. @item 601
  12159. @item 709
  12160. @end table
  12161. Default is auto.
  12162. @end table
  12163. @anchor{vidstabdetect}
  12164. @section vidstabdetect
  12165. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  12166. @ref{vidstabtransform} for pass 2.
  12167. This filter generates a file with relative translation and rotation
  12168. transform information about subsequent frames, which is then used by
  12169. the @ref{vidstabtransform} filter.
  12170. To enable compilation of this filter you need to configure FFmpeg with
  12171. @code{--enable-libvidstab}.
  12172. This filter accepts the following options:
  12173. @table @option
  12174. @item result
  12175. Set the path to the file used to write the transforms information.
  12176. Default value is @file{transforms.trf}.
  12177. @item shakiness
  12178. Set how shaky the video is and how quick the camera is. It accepts an
  12179. integer in the range 1-10, a value of 1 means little shakiness, a
  12180. value of 10 means strong shakiness. Default value is 5.
  12181. @item accuracy
  12182. Set the accuracy of the detection process. It must be a value in the
  12183. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  12184. accuracy. Default value is 15.
  12185. @item stepsize
  12186. Set stepsize of the search process. The region around minimum is
  12187. scanned with 1 pixel resolution. Default value is 6.
  12188. @item mincontrast
  12189. Set minimum contrast. Below this value a local measurement field is
  12190. discarded. Must be a floating point value in the range 0-1. Default
  12191. value is 0.3.
  12192. @item tripod
  12193. Set reference frame number for tripod mode.
  12194. If enabled, the motion of the frames is compared to a reference frame
  12195. in the filtered stream, identified by the specified number. The idea
  12196. is to compensate all movements in a more-or-less static scene and keep
  12197. the camera view absolutely still.
  12198. If set to 0, it is disabled. The frames are counted starting from 1.
  12199. @item show
  12200. Show fields and transforms in the resulting frames. It accepts an
  12201. integer in the range 0-2. Default value is 0, which disables any
  12202. visualization.
  12203. @end table
  12204. @subsection Examples
  12205. @itemize
  12206. @item
  12207. Use default values:
  12208. @example
  12209. vidstabdetect
  12210. @end example
  12211. @item
  12212. Analyze strongly shaky movie and put the results in file
  12213. @file{mytransforms.trf}:
  12214. @example
  12215. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  12216. @end example
  12217. @item
  12218. Visualize the result of internal transformations in the resulting
  12219. video:
  12220. @example
  12221. vidstabdetect=show=1
  12222. @end example
  12223. @item
  12224. Analyze a video with medium shakiness using @command{ffmpeg}:
  12225. @example
  12226. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  12227. @end example
  12228. @end itemize
  12229. @anchor{vidstabtransform}
  12230. @section vidstabtransform
  12231. Video stabilization/deshaking: pass 2 of 2,
  12232. see @ref{vidstabdetect} for pass 1.
  12233. Read a file with transform information for each frame and
  12234. apply/compensate them. Together with the @ref{vidstabdetect}
  12235. filter this can be used to deshake videos. See also
  12236. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  12237. the @ref{unsharp} filter, see below.
  12238. To enable compilation of this filter you need to configure FFmpeg with
  12239. @code{--enable-libvidstab}.
  12240. @subsection Options
  12241. @table @option
  12242. @item input
  12243. Set path to the file used to read the transforms. Default value is
  12244. @file{transforms.trf}.
  12245. @item smoothing
  12246. Set the number of frames (value*2 + 1) used for lowpass filtering the
  12247. camera movements. Default value is 10.
  12248. For example a number of 10 means that 21 frames are used (10 in the
  12249. past and 10 in the future) to smoothen the motion in the video. A
  12250. larger value leads to a smoother video, but limits the acceleration of
  12251. the camera (pan/tilt movements). 0 is a special case where a static
  12252. camera is simulated.
  12253. @item optalgo
  12254. Set the camera path optimization algorithm.
  12255. Accepted values are:
  12256. @table @samp
  12257. @item gauss
  12258. gaussian kernel low-pass filter on camera motion (default)
  12259. @item avg
  12260. averaging on transformations
  12261. @end table
  12262. @item maxshift
  12263. Set maximal number of pixels to translate frames. Default value is -1,
  12264. meaning no limit.
  12265. @item maxangle
  12266. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  12267. value is -1, meaning no limit.
  12268. @item crop
  12269. Specify how to deal with borders that may be visible due to movement
  12270. compensation.
  12271. Available values are:
  12272. @table @samp
  12273. @item keep
  12274. keep image information from previous frame (default)
  12275. @item black
  12276. fill the border black
  12277. @end table
  12278. @item invert
  12279. Invert transforms if set to 1. Default value is 0.
  12280. @item relative
  12281. Consider transforms as relative to previous frame if set to 1,
  12282. absolute if set to 0. Default value is 0.
  12283. @item zoom
  12284. Set percentage to zoom. A positive value will result in a zoom-in
  12285. effect, a negative value in a zoom-out effect. Default value is 0 (no
  12286. zoom).
  12287. @item optzoom
  12288. Set optimal zooming to avoid borders.
  12289. Accepted values are:
  12290. @table @samp
  12291. @item 0
  12292. disabled
  12293. @item 1
  12294. optimal static zoom value is determined (only very strong movements
  12295. will lead to visible borders) (default)
  12296. @item 2
  12297. optimal adaptive zoom value is determined (no borders will be
  12298. visible), see @option{zoomspeed}
  12299. @end table
  12300. Note that the value given at zoom is added to the one calculated here.
  12301. @item zoomspeed
  12302. Set percent to zoom maximally each frame (enabled when
  12303. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  12304. 0.25.
  12305. @item interpol
  12306. Specify type of interpolation.
  12307. Available values are:
  12308. @table @samp
  12309. @item no
  12310. no interpolation
  12311. @item linear
  12312. linear only horizontal
  12313. @item bilinear
  12314. linear in both directions (default)
  12315. @item bicubic
  12316. cubic in both directions (slow)
  12317. @end table
  12318. @item tripod
  12319. Enable virtual tripod mode if set to 1, which is equivalent to
  12320. @code{relative=0:smoothing=0}. Default value is 0.
  12321. Use also @code{tripod} option of @ref{vidstabdetect}.
  12322. @item debug
  12323. Increase log verbosity if set to 1. Also the detected global motions
  12324. are written to the temporary file @file{global_motions.trf}. Default
  12325. value is 0.
  12326. @end table
  12327. @subsection Examples
  12328. @itemize
  12329. @item
  12330. Use @command{ffmpeg} for a typical stabilization with default values:
  12331. @example
  12332. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  12333. @end example
  12334. Note the use of the @ref{unsharp} filter which is always recommended.
  12335. @item
  12336. Zoom in a bit more and load transform data from a given file:
  12337. @example
  12338. vidstabtransform=zoom=5:input="mytransforms.trf"
  12339. @end example
  12340. @item
  12341. Smoothen the video even more:
  12342. @example
  12343. vidstabtransform=smoothing=30
  12344. @end example
  12345. @end itemize
  12346. @section vflip
  12347. Flip the input video vertically.
  12348. For example, to vertically flip a video with @command{ffmpeg}:
  12349. @example
  12350. ffmpeg -i in.avi -vf "vflip" out.avi
  12351. @end example
  12352. @anchor{vignette}
  12353. @section vignette
  12354. Make or reverse a natural vignetting effect.
  12355. The filter accepts the following options:
  12356. @table @option
  12357. @item angle, a
  12358. Set lens angle expression as a number of radians.
  12359. The value is clipped in the @code{[0,PI/2]} range.
  12360. Default value: @code{"PI/5"}
  12361. @item x0
  12362. @item y0
  12363. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  12364. by default.
  12365. @item mode
  12366. Set forward/backward mode.
  12367. Available modes are:
  12368. @table @samp
  12369. @item forward
  12370. The larger the distance from the central point, the darker the image becomes.
  12371. @item backward
  12372. The larger the distance from the central point, the brighter the image becomes.
  12373. This can be used to reverse a vignette effect, though there is no automatic
  12374. detection to extract the lens @option{angle} and other settings (yet). It can
  12375. also be used to create a burning effect.
  12376. @end table
  12377. Default value is @samp{forward}.
  12378. @item eval
  12379. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  12380. It accepts the following values:
  12381. @table @samp
  12382. @item init
  12383. Evaluate expressions only once during the filter initialization.
  12384. @item frame
  12385. Evaluate expressions for each incoming frame. This is way slower than the
  12386. @samp{init} mode since it requires all the scalers to be re-computed, but it
  12387. allows advanced dynamic expressions.
  12388. @end table
  12389. Default value is @samp{init}.
  12390. @item dither
  12391. Set dithering to reduce the circular banding effects. Default is @code{1}
  12392. (enabled).
  12393. @item aspect
  12394. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  12395. Setting this value to the SAR of the input will make a rectangular vignetting
  12396. following the dimensions of the video.
  12397. Default is @code{1/1}.
  12398. @end table
  12399. @subsection Expressions
  12400. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  12401. following parameters.
  12402. @table @option
  12403. @item w
  12404. @item h
  12405. input width and height
  12406. @item n
  12407. the number of input frame, starting from 0
  12408. @item pts
  12409. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  12410. @var{TB} units, NAN if undefined
  12411. @item r
  12412. frame rate of the input video, NAN if the input frame rate is unknown
  12413. @item t
  12414. the PTS (Presentation TimeStamp) of the filtered video frame,
  12415. expressed in seconds, NAN if undefined
  12416. @item tb
  12417. time base of the input video
  12418. @end table
  12419. @subsection Examples
  12420. @itemize
  12421. @item
  12422. Apply simple strong vignetting effect:
  12423. @example
  12424. vignette=PI/4
  12425. @end example
  12426. @item
  12427. Make a flickering vignetting:
  12428. @example
  12429. vignette='PI/4+random(1)*PI/50':eval=frame
  12430. @end example
  12431. @end itemize
  12432. @section vmafmotion
  12433. Obtain the average vmaf motion score of a video.
  12434. It is one of the component filters of VMAF.
  12435. The obtained average motion score is printed through the logging system.
  12436. In the below example the input file @file{ref.mpg} is being processed and score
  12437. is computed.
  12438. @example
  12439. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  12440. @end example
  12441. @section vstack
  12442. Stack input videos vertically.
  12443. All streams must be of same pixel format and of same width.
  12444. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  12445. to create same output.
  12446. The filter accept the following option:
  12447. @table @option
  12448. @item inputs
  12449. Set number of input streams. Default is 2.
  12450. @item shortest
  12451. If set to 1, force the output to terminate when the shortest input
  12452. terminates. Default value is 0.
  12453. @end table
  12454. @section w3fdif
  12455. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  12456. Deinterlacing Filter").
  12457. Based on the process described by Martin Weston for BBC R&D, and
  12458. implemented based on the de-interlace algorithm written by Jim
  12459. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  12460. uses filter coefficients calculated by BBC R&D.
  12461. There are two sets of filter coefficients, so called "simple":
  12462. and "complex". Which set of filter coefficients is used can
  12463. be set by passing an optional parameter:
  12464. @table @option
  12465. @item filter
  12466. Set the interlacing filter coefficients. Accepts one of the following values:
  12467. @table @samp
  12468. @item simple
  12469. Simple filter coefficient set.
  12470. @item complex
  12471. More-complex filter coefficient set.
  12472. @end table
  12473. Default value is @samp{complex}.
  12474. @item deint
  12475. Specify which frames to deinterlace. Accept one of the following values:
  12476. @table @samp
  12477. @item all
  12478. Deinterlace all frames,
  12479. @item interlaced
  12480. Only deinterlace frames marked as interlaced.
  12481. @end table
  12482. Default value is @samp{all}.
  12483. @end table
  12484. @section waveform
  12485. Video waveform monitor.
  12486. The waveform monitor plots color component intensity. By default luminance
  12487. only. Each column of the waveform corresponds to a column of pixels in the
  12488. source video.
  12489. It accepts the following options:
  12490. @table @option
  12491. @item mode, m
  12492. Can be either @code{row}, or @code{column}. Default is @code{column}.
  12493. In row mode, the graph on the left side represents color component value 0 and
  12494. the right side represents value = 255. In column mode, the top side represents
  12495. color component value = 0 and bottom side represents value = 255.
  12496. @item intensity, i
  12497. Set intensity. Smaller values are useful to find out how many values of the same
  12498. luminance are distributed across input rows/columns.
  12499. Default value is @code{0.04}. Allowed range is [0, 1].
  12500. @item mirror, r
  12501. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  12502. In mirrored mode, higher values will be represented on the left
  12503. side for @code{row} mode and at the top for @code{column} mode. Default is
  12504. @code{1} (mirrored).
  12505. @item display, d
  12506. Set display mode.
  12507. It accepts the following values:
  12508. @table @samp
  12509. @item overlay
  12510. Presents information identical to that in the @code{parade}, except
  12511. that the graphs representing color components are superimposed directly
  12512. over one another.
  12513. This display mode makes it easier to spot relative differences or similarities
  12514. in overlapping areas of the color components that are supposed to be identical,
  12515. such as neutral whites, grays, or blacks.
  12516. @item stack
  12517. Display separate graph for the color components side by side in
  12518. @code{row} mode or one below the other in @code{column} mode.
  12519. @item parade
  12520. Display separate graph for the color components side by side in
  12521. @code{column} mode or one below the other in @code{row} mode.
  12522. Using this display mode makes it easy to spot color casts in the highlights
  12523. and shadows of an image, by comparing the contours of the top and the bottom
  12524. graphs of each waveform. Since whites, grays, and blacks are characterized
  12525. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  12526. should display three waveforms of roughly equal width/height. If not, the
  12527. correction is easy to perform by making level adjustments the three waveforms.
  12528. @end table
  12529. Default is @code{stack}.
  12530. @item components, c
  12531. Set which color components to display. Default is 1, which means only luminance
  12532. or red color component if input is in RGB colorspace. If is set for example to
  12533. 7 it will display all 3 (if) available color components.
  12534. @item envelope, e
  12535. @table @samp
  12536. @item none
  12537. No envelope, this is default.
  12538. @item instant
  12539. Instant envelope, minimum and maximum values presented in graph will be easily
  12540. visible even with small @code{step} value.
  12541. @item peak
  12542. Hold minimum and maximum values presented in graph across time. This way you
  12543. can still spot out of range values without constantly looking at waveforms.
  12544. @item peak+instant
  12545. Peak and instant envelope combined together.
  12546. @end table
  12547. @item filter, f
  12548. @table @samp
  12549. @item lowpass
  12550. No filtering, this is default.
  12551. @item flat
  12552. Luma and chroma combined together.
  12553. @item aflat
  12554. Similar as above, but shows difference between blue and red chroma.
  12555. @item chroma
  12556. Displays only chroma.
  12557. @item color
  12558. Displays actual color value on waveform.
  12559. @item acolor
  12560. Similar as above, but with luma showing frequency of chroma values.
  12561. @end table
  12562. @item graticule, g
  12563. Set which graticule to display.
  12564. @table @samp
  12565. @item none
  12566. Do not display graticule.
  12567. @item green
  12568. Display green graticule showing legal broadcast ranges.
  12569. @end table
  12570. @item opacity, o
  12571. Set graticule opacity.
  12572. @item flags, fl
  12573. Set graticule flags.
  12574. @table @samp
  12575. @item numbers
  12576. Draw numbers above lines. By default enabled.
  12577. @item dots
  12578. Draw dots instead of lines.
  12579. @end table
  12580. @item scale, s
  12581. Set scale used for displaying graticule.
  12582. @table @samp
  12583. @item digital
  12584. @item millivolts
  12585. @item ire
  12586. @end table
  12587. Default is digital.
  12588. @item bgopacity, b
  12589. Set background opacity.
  12590. @end table
  12591. @section weave, doubleweave
  12592. The @code{weave} takes a field-based video input and join
  12593. each two sequential fields into single frame, producing a new double
  12594. height clip with half the frame rate and half the frame count.
  12595. The @code{doubleweave} works same as @code{weave} but without
  12596. halving frame rate and frame count.
  12597. It accepts the following option:
  12598. @table @option
  12599. @item first_field
  12600. Set first field. Available values are:
  12601. @table @samp
  12602. @item top, t
  12603. Set the frame as top-field-first.
  12604. @item bottom, b
  12605. Set the frame as bottom-field-first.
  12606. @end table
  12607. @end table
  12608. @subsection Examples
  12609. @itemize
  12610. @item
  12611. Interlace video using @ref{select} and @ref{separatefields} filter:
  12612. @example
  12613. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  12614. @end example
  12615. @end itemize
  12616. @section xbr
  12617. Apply the xBR high-quality magnification filter which is designed for pixel
  12618. art. It follows a set of edge-detection rules, see
  12619. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  12620. It accepts the following option:
  12621. @table @option
  12622. @item n
  12623. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  12624. @code{3xBR} and @code{4} for @code{4xBR}.
  12625. Default is @code{3}.
  12626. @end table
  12627. @anchor{yadif}
  12628. @section yadif
  12629. Deinterlace the input video ("yadif" means "yet another deinterlacing
  12630. filter").
  12631. It accepts the following parameters:
  12632. @table @option
  12633. @item mode
  12634. The interlacing mode to adopt. It accepts one of the following values:
  12635. @table @option
  12636. @item 0, send_frame
  12637. Output one frame for each frame.
  12638. @item 1, send_field
  12639. Output one frame for each field.
  12640. @item 2, send_frame_nospatial
  12641. Like @code{send_frame}, but it skips the spatial interlacing check.
  12642. @item 3, send_field_nospatial
  12643. Like @code{send_field}, but it skips the spatial interlacing check.
  12644. @end table
  12645. The default value is @code{send_frame}.
  12646. @item parity
  12647. The picture field parity assumed for the input interlaced video. It accepts one
  12648. of the following values:
  12649. @table @option
  12650. @item 0, tff
  12651. Assume the top field is first.
  12652. @item 1, bff
  12653. Assume the bottom field is first.
  12654. @item -1, auto
  12655. Enable automatic detection of field parity.
  12656. @end table
  12657. The default value is @code{auto}.
  12658. If the interlacing is unknown or the decoder does not export this information,
  12659. top field first will be assumed.
  12660. @item deint
  12661. Specify which frames to deinterlace. Accept one of the following
  12662. values:
  12663. @table @option
  12664. @item 0, all
  12665. Deinterlace all frames.
  12666. @item 1, interlaced
  12667. Only deinterlace frames marked as interlaced.
  12668. @end table
  12669. The default value is @code{all}.
  12670. @end table
  12671. @section zoompan
  12672. Apply Zoom & Pan effect.
  12673. This filter accepts the following options:
  12674. @table @option
  12675. @item zoom, z
  12676. Set the zoom expression. Default is 1.
  12677. @item x
  12678. @item y
  12679. Set the x and y expression. Default is 0.
  12680. @item d
  12681. Set the duration expression in number of frames.
  12682. This sets for how many number of frames effect will last for
  12683. single input image.
  12684. @item s
  12685. Set the output image size, default is 'hd720'.
  12686. @item fps
  12687. Set the output frame rate, default is '25'.
  12688. @end table
  12689. Each expression can contain the following constants:
  12690. @table @option
  12691. @item in_w, iw
  12692. Input width.
  12693. @item in_h, ih
  12694. Input height.
  12695. @item out_w, ow
  12696. Output width.
  12697. @item out_h, oh
  12698. Output height.
  12699. @item in
  12700. Input frame count.
  12701. @item on
  12702. Output frame count.
  12703. @item x
  12704. @item y
  12705. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  12706. for current input frame.
  12707. @item px
  12708. @item py
  12709. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  12710. not yet such frame (first input frame).
  12711. @item zoom
  12712. Last calculated zoom from 'z' expression for current input frame.
  12713. @item pzoom
  12714. Last calculated zoom of last output frame of previous input frame.
  12715. @item duration
  12716. Number of output frames for current input frame. Calculated from 'd' expression
  12717. for each input frame.
  12718. @item pduration
  12719. number of output frames created for previous input frame
  12720. @item a
  12721. Rational number: input width / input height
  12722. @item sar
  12723. sample aspect ratio
  12724. @item dar
  12725. display aspect ratio
  12726. @end table
  12727. @subsection Examples
  12728. @itemize
  12729. @item
  12730. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  12731. @example
  12732. 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
  12733. @end example
  12734. @item
  12735. Zoom-in up to 1.5 and pan always at center of picture:
  12736. @example
  12737. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12738. @end example
  12739. @item
  12740. Same as above but without pausing:
  12741. @example
  12742. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12743. @end example
  12744. @end itemize
  12745. @anchor{zscale}
  12746. @section zscale
  12747. Scale (resize) the input video, using the z.lib library:
  12748. https://github.com/sekrit-twc/zimg.
  12749. The zscale filter forces the output display aspect ratio to be the same
  12750. as the input, by changing the output sample aspect ratio.
  12751. If the input image format is different from the format requested by
  12752. the next filter, the zscale filter will convert the input to the
  12753. requested format.
  12754. @subsection Options
  12755. The filter accepts the following options.
  12756. @table @option
  12757. @item width, w
  12758. @item height, h
  12759. Set the output video dimension expression. Default value is the input
  12760. dimension.
  12761. If the @var{width} or @var{w} value is 0, the input width is used for
  12762. the output. If the @var{height} or @var{h} value is 0, the input height
  12763. is used for the output.
  12764. If one and only one of the values is -n with n >= 1, the zscale filter
  12765. will use a value that maintains the aspect ratio of the input image,
  12766. calculated from the other specified dimension. After that it will,
  12767. however, make sure that the calculated dimension is divisible by n and
  12768. adjust the value if necessary.
  12769. If both values are -n with n >= 1, the behavior will be identical to
  12770. both values being set to 0 as previously detailed.
  12771. See below for the list of accepted constants for use in the dimension
  12772. expression.
  12773. @item size, s
  12774. Set the video size. For the syntax of this option, check the
  12775. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12776. @item dither, d
  12777. Set the dither type.
  12778. Possible values are:
  12779. @table @var
  12780. @item none
  12781. @item ordered
  12782. @item random
  12783. @item error_diffusion
  12784. @end table
  12785. Default is none.
  12786. @item filter, f
  12787. Set the resize filter type.
  12788. Possible values are:
  12789. @table @var
  12790. @item point
  12791. @item bilinear
  12792. @item bicubic
  12793. @item spline16
  12794. @item spline36
  12795. @item lanczos
  12796. @end table
  12797. Default is bilinear.
  12798. @item range, r
  12799. Set the color range.
  12800. Possible values are:
  12801. @table @var
  12802. @item input
  12803. @item limited
  12804. @item full
  12805. @end table
  12806. Default is same as input.
  12807. @item primaries, p
  12808. Set the color primaries.
  12809. Possible values are:
  12810. @table @var
  12811. @item input
  12812. @item 709
  12813. @item unspecified
  12814. @item 170m
  12815. @item 240m
  12816. @item 2020
  12817. @end table
  12818. Default is same as input.
  12819. @item transfer, t
  12820. Set the transfer characteristics.
  12821. Possible values are:
  12822. @table @var
  12823. @item input
  12824. @item 709
  12825. @item unspecified
  12826. @item 601
  12827. @item linear
  12828. @item 2020_10
  12829. @item 2020_12
  12830. @item smpte2084
  12831. @item iec61966-2-1
  12832. @item arib-std-b67
  12833. @end table
  12834. Default is same as input.
  12835. @item matrix, m
  12836. Set the colorspace matrix.
  12837. Possible value are:
  12838. @table @var
  12839. @item input
  12840. @item 709
  12841. @item unspecified
  12842. @item 470bg
  12843. @item 170m
  12844. @item 2020_ncl
  12845. @item 2020_cl
  12846. @end table
  12847. Default is same as input.
  12848. @item rangein, rin
  12849. Set the input color range.
  12850. Possible values are:
  12851. @table @var
  12852. @item input
  12853. @item limited
  12854. @item full
  12855. @end table
  12856. Default is same as input.
  12857. @item primariesin, pin
  12858. Set the input color primaries.
  12859. Possible values are:
  12860. @table @var
  12861. @item input
  12862. @item 709
  12863. @item unspecified
  12864. @item 170m
  12865. @item 240m
  12866. @item 2020
  12867. @end table
  12868. Default is same as input.
  12869. @item transferin, tin
  12870. Set the input transfer characteristics.
  12871. Possible values are:
  12872. @table @var
  12873. @item input
  12874. @item 709
  12875. @item unspecified
  12876. @item 601
  12877. @item linear
  12878. @item 2020_10
  12879. @item 2020_12
  12880. @end table
  12881. Default is same as input.
  12882. @item matrixin, min
  12883. Set the input colorspace matrix.
  12884. Possible value are:
  12885. @table @var
  12886. @item input
  12887. @item 709
  12888. @item unspecified
  12889. @item 470bg
  12890. @item 170m
  12891. @item 2020_ncl
  12892. @item 2020_cl
  12893. @end table
  12894. @item chromal, c
  12895. Set the output chroma location.
  12896. Possible values are:
  12897. @table @var
  12898. @item input
  12899. @item left
  12900. @item center
  12901. @item topleft
  12902. @item top
  12903. @item bottomleft
  12904. @item bottom
  12905. @end table
  12906. @item chromalin, cin
  12907. Set the input chroma location.
  12908. Possible values are:
  12909. @table @var
  12910. @item input
  12911. @item left
  12912. @item center
  12913. @item topleft
  12914. @item top
  12915. @item bottomleft
  12916. @item bottom
  12917. @end table
  12918. @item npl
  12919. Set the nominal peak luminance.
  12920. @end table
  12921. The values of the @option{w} and @option{h} options are expressions
  12922. containing the following constants:
  12923. @table @var
  12924. @item in_w
  12925. @item in_h
  12926. The input width and height
  12927. @item iw
  12928. @item ih
  12929. These are the same as @var{in_w} and @var{in_h}.
  12930. @item out_w
  12931. @item out_h
  12932. The output (scaled) width and height
  12933. @item ow
  12934. @item oh
  12935. These are the same as @var{out_w} and @var{out_h}
  12936. @item a
  12937. The same as @var{iw} / @var{ih}
  12938. @item sar
  12939. input sample aspect ratio
  12940. @item dar
  12941. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12942. @item hsub
  12943. @item vsub
  12944. horizontal and vertical input chroma subsample values. For example for the
  12945. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12946. @item ohsub
  12947. @item ovsub
  12948. horizontal and vertical output chroma subsample values. For example for the
  12949. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12950. @end table
  12951. @table @option
  12952. @end table
  12953. @c man end VIDEO FILTERS
  12954. @chapter Video Sources
  12955. @c man begin VIDEO SOURCES
  12956. Below is a description of the currently available video sources.
  12957. @section buffer
  12958. Buffer video frames, and make them available to the filter chain.
  12959. This source is mainly intended for a programmatic use, in particular
  12960. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  12961. It accepts the following parameters:
  12962. @table @option
  12963. @item video_size
  12964. Specify the size (width and height) of the buffered video frames. For the
  12965. syntax of this option, check the
  12966. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12967. @item width
  12968. The input video width.
  12969. @item height
  12970. The input video height.
  12971. @item pix_fmt
  12972. A string representing the pixel format of the buffered video frames.
  12973. It may be a number corresponding to a pixel format, or a pixel format
  12974. name.
  12975. @item time_base
  12976. Specify the timebase assumed by the timestamps of the buffered frames.
  12977. @item frame_rate
  12978. Specify the frame rate expected for the video stream.
  12979. @item pixel_aspect, sar
  12980. The sample (pixel) aspect ratio of the input video.
  12981. @item sws_param
  12982. Specify the optional parameters to be used for the scale filter which
  12983. is automatically inserted when an input change is detected in the
  12984. input size or format.
  12985. @item hw_frames_ctx
  12986. When using a hardware pixel format, this should be a reference to an
  12987. AVHWFramesContext describing input frames.
  12988. @end table
  12989. For example:
  12990. @example
  12991. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  12992. @end example
  12993. will instruct the source to accept video frames with size 320x240 and
  12994. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  12995. square pixels (1:1 sample aspect ratio).
  12996. Since the pixel format with name "yuv410p" corresponds to the number 6
  12997. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  12998. this example corresponds to:
  12999. @example
  13000. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  13001. @end example
  13002. Alternatively, the options can be specified as a flat string, but this
  13003. syntax is deprecated:
  13004. @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}]
  13005. @section cellauto
  13006. Create a pattern generated by an elementary cellular automaton.
  13007. The initial state of the cellular automaton can be defined through the
  13008. @option{filename} and @option{pattern} options. If such options are
  13009. not specified an initial state is created randomly.
  13010. At each new frame a new row in the video is filled with the result of
  13011. the cellular automaton next generation. The behavior when the whole
  13012. frame is filled is defined by the @option{scroll} option.
  13013. This source accepts the following options:
  13014. @table @option
  13015. @item filename, f
  13016. Read the initial cellular automaton state, i.e. the starting row, from
  13017. the specified file.
  13018. In the file, each non-whitespace character is considered an alive
  13019. cell, a newline will terminate the row, and further characters in the
  13020. file will be ignored.
  13021. @item pattern, p
  13022. Read the initial cellular automaton state, i.e. the starting row, from
  13023. the specified string.
  13024. Each non-whitespace character in the string is considered an alive
  13025. cell, a newline will terminate the row, and further characters in the
  13026. string will be ignored.
  13027. @item rate, r
  13028. Set the video rate, that is the number of frames generated per second.
  13029. Default is 25.
  13030. @item random_fill_ratio, ratio
  13031. Set the random fill ratio for the initial cellular automaton row. It
  13032. is a floating point number value ranging from 0 to 1, defaults to
  13033. 1/PHI.
  13034. This option is ignored when a file or a pattern is specified.
  13035. @item random_seed, seed
  13036. Set the seed for filling randomly the initial row, must be an integer
  13037. included between 0 and UINT32_MAX. If not specified, or if explicitly
  13038. set to -1, the filter will try to use a good random seed on a best
  13039. effort basis.
  13040. @item rule
  13041. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  13042. Default value is 110.
  13043. @item size, s
  13044. Set the size of the output video. For the syntax of this option, check the
  13045. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13046. If @option{filename} or @option{pattern} is specified, the size is set
  13047. by default to the width of the specified initial state row, and the
  13048. height is set to @var{width} * PHI.
  13049. If @option{size} is set, it must contain the width of the specified
  13050. pattern string, and the specified pattern will be centered in the
  13051. larger row.
  13052. If a filename or a pattern string is not specified, the size value
  13053. defaults to "320x518" (used for a randomly generated initial state).
  13054. @item scroll
  13055. If set to 1, scroll the output upward when all the rows in the output
  13056. have been already filled. If set to 0, the new generated row will be
  13057. written over the top row just after the bottom row is filled.
  13058. Defaults to 1.
  13059. @item start_full, full
  13060. If set to 1, completely fill the output with generated rows before
  13061. outputting the first frame.
  13062. This is the default behavior, for disabling set the value to 0.
  13063. @item stitch
  13064. If set to 1, stitch the left and right row edges together.
  13065. This is the default behavior, for disabling set the value to 0.
  13066. @end table
  13067. @subsection Examples
  13068. @itemize
  13069. @item
  13070. Read the initial state from @file{pattern}, and specify an output of
  13071. size 200x400.
  13072. @example
  13073. cellauto=f=pattern:s=200x400
  13074. @end example
  13075. @item
  13076. Generate a random initial row with a width of 200 cells, with a fill
  13077. ratio of 2/3:
  13078. @example
  13079. cellauto=ratio=2/3:s=200x200
  13080. @end example
  13081. @item
  13082. Create a pattern generated by rule 18 starting by a single alive cell
  13083. centered on an initial row with width 100:
  13084. @example
  13085. cellauto=p=@@:s=100x400:full=0:rule=18
  13086. @end example
  13087. @item
  13088. Specify a more elaborated initial pattern:
  13089. @example
  13090. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  13091. @end example
  13092. @end itemize
  13093. @anchor{coreimagesrc}
  13094. @section coreimagesrc
  13095. Video source generated on GPU using Apple's CoreImage API on OSX.
  13096. This video source is a specialized version of the @ref{coreimage} video filter.
  13097. Use a core image generator at the beginning of the applied filterchain to
  13098. generate the content.
  13099. The coreimagesrc video source accepts the following options:
  13100. @table @option
  13101. @item list_generators
  13102. List all available generators along with all their respective options as well as
  13103. possible minimum and maximum values along with the default values.
  13104. @example
  13105. list_generators=true
  13106. @end example
  13107. @item size, s
  13108. Specify the size of the sourced video. For the syntax of this option, check the
  13109. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13110. The default value is @code{320x240}.
  13111. @item rate, r
  13112. Specify the frame rate of the sourced video, as the number of frames
  13113. generated per second. It has to be a string in the format
  13114. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13115. number or a valid video frame rate abbreviation. The default value is
  13116. "25".
  13117. @item sar
  13118. Set the sample aspect ratio of the sourced video.
  13119. @item duration, d
  13120. Set the duration of the sourced video. See
  13121. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13122. for the accepted syntax.
  13123. If not specified, or the expressed duration is negative, the video is
  13124. supposed to be generated forever.
  13125. @end table
  13126. Additionally, all options of the @ref{coreimage} video filter are accepted.
  13127. A complete filterchain can be used for further processing of the
  13128. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  13129. and examples for details.
  13130. @subsection Examples
  13131. @itemize
  13132. @item
  13133. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  13134. given as complete and escaped command-line for Apple's standard bash shell:
  13135. @example
  13136. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  13137. @end example
  13138. This example is equivalent to the QRCode example of @ref{coreimage} without the
  13139. need for a nullsrc video source.
  13140. @end itemize
  13141. @section mandelbrot
  13142. Generate a Mandelbrot set fractal, and progressively zoom towards the
  13143. point specified with @var{start_x} and @var{start_y}.
  13144. This source accepts the following options:
  13145. @table @option
  13146. @item end_pts
  13147. Set the terminal pts value. Default value is 400.
  13148. @item end_scale
  13149. Set the terminal scale value.
  13150. Must be a floating point value. Default value is 0.3.
  13151. @item inner
  13152. Set the inner coloring mode, that is the algorithm used to draw the
  13153. Mandelbrot fractal internal region.
  13154. It shall assume one of the following values:
  13155. @table @option
  13156. @item black
  13157. Set black mode.
  13158. @item convergence
  13159. Show time until convergence.
  13160. @item mincol
  13161. Set color based on point closest to the origin of the iterations.
  13162. @item period
  13163. Set period mode.
  13164. @end table
  13165. Default value is @var{mincol}.
  13166. @item bailout
  13167. Set the bailout value. Default value is 10.0.
  13168. @item maxiter
  13169. Set the maximum of iterations performed by the rendering
  13170. algorithm. Default value is 7189.
  13171. @item outer
  13172. Set outer coloring mode.
  13173. It shall assume one of following values:
  13174. @table @option
  13175. @item iteration_count
  13176. Set iteration cound mode.
  13177. @item normalized_iteration_count
  13178. set normalized iteration count mode.
  13179. @end table
  13180. Default value is @var{normalized_iteration_count}.
  13181. @item rate, r
  13182. Set frame rate, expressed as number of frames per second. Default
  13183. value is "25".
  13184. @item size, s
  13185. Set frame size. For the syntax of this option, check the "Video
  13186. size" section in the ffmpeg-utils manual. Default value is "640x480".
  13187. @item start_scale
  13188. Set the initial scale value. Default value is 3.0.
  13189. @item start_x
  13190. Set the initial x position. Must be a floating point value between
  13191. -100 and 100. Default value is -0.743643887037158704752191506114774.
  13192. @item start_y
  13193. Set the initial y position. Must be a floating point value between
  13194. -100 and 100. Default value is -0.131825904205311970493132056385139.
  13195. @end table
  13196. @section mptestsrc
  13197. Generate various test patterns, as generated by the MPlayer test filter.
  13198. The size of the generated video is fixed, and is 256x256.
  13199. This source is useful in particular for testing encoding features.
  13200. This source accepts the following options:
  13201. @table @option
  13202. @item rate, r
  13203. Specify the frame rate of the sourced video, as the number of frames
  13204. generated per second. It has to be a string in the format
  13205. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13206. number or a valid video frame rate abbreviation. The default value is
  13207. "25".
  13208. @item duration, d
  13209. Set the duration of the sourced video. See
  13210. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13211. for the accepted syntax.
  13212. If not specified, or the expressed duration is negative, the video is
  13213. supposed to be generated forever.
  13214. @item test, t
  13215. Set the number or the name of the test to perform. Supported tests are:
  13216. @table @option
  13217. @item dc_luma
  13218. @item dc_chroma
  13219. @item freq_luma
  13220. @item freq_chroma
  13221. @item amp_luma
  13222. @item amp_chroma
  13223. @item cbp
  13224. @item mv
  13225. @item ring1
  13226. @item ring2
  13227. @item all
  13228. @end table
  13229. Default value is "all", which will cycle through the list of all tests.
  13230. @end table
  13231. Some examples:
  13232. @example
  13233. mptestsrc=t=dc_luma
  13234. @end example
  13235. will generate a "dc_luma" test pattern.
  13236. @section frei0r_src
  13237. Provide a frei0r source.
  13238. To enable compilation of this filter you need to install the frei0r
  13239. header and configure FFmpeg with @code{--enable-frei0r}.
  13240. This source accepts the following parameters:
  13241. @table @option
  13242. @item size
  13243. The size of the video to generate. For the syntax of this option, check the
  13244. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13245. @item framerate
  13246. The framerate of the generated video. It may be a string of the form
  13247. @var{num}/@var{den} or a frame rate abbreviation.
  13248. @item filter_name
  13249. The name to the frei0r source to load. For more information regarding frei0r and
  13250. how to set the parameters, read the @ref{frei0r} section in the video filters
  13251. documentation.
  13252. @item filter_params
  13253. A '|'-separated list of parameters to pass to the frei0r source.
  13254. @end table
  13255. For example, to generate a frei0r partik0l source with size 200x200
  13256. and frame rate 10 which is overlaid on the overlay filter main input:
  13257. @example
  13258. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  13259. @end example
  13260. @section life
  13261. Generate a life pattern.
  13262. This source is based on a generalization of John Conway's life game.
  13263. The sourced input represents a life grid, each pixel represents a cell
  13264. which can be in one of two possible states, alive or dead. Every cell
  13265. interacts with its eight neighbours, which are the cells that are
  13266. horizontally, vertically, or diagonally adjacent.
  13267. At each interaction the grid evolves according to the adopted rule,
  13268. which specifies the number of neighbor alive cells which will make a
  13269. cell stay alive or born. The @option{rule} option allows one to specify
  13270. the rule to adopt.
  13271. This source accepts the following options:
  13272. @table @option
  13273. @item filename, f
  13274. Set the file from which to read the initial grid state. In the file,
  13275. each non-whitespace character is considered an alive cell, and newline
  13276. is used to delimit the end of each row.
  13277. If this option is not specified, the initial grid is generated
  13278. randomly.
  13279. @item rate, r
  13280. Set the video rate, that is the number of frames generated per second.
  13281. Default is 25.
  13282. @item random_fill_ratio, ratio
  13283. Set the random fill ratio for the initial random grid. It is a
  13284. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  13285. It is ignored when a file is specified.
  13286. @item random_seed, seed
  13287. Set the seed for filling the initial random grid, must be an integer
  13288. included between 0 and UINT32_MAX. If not specified, or if explicitly
  13289. set to -1, the filter will try to use a good random seed on a best
  13290. effort basis.
  13291. @item rule
  13292. Set the life rule.
  13293. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  13294. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  13295. @var{NS} specifies the number of alive neighbor cells which make a
  13296. live cell stay alive, and @var{NB} the number of alive neighbor cells
  13297. which make a dead cell to become alive (i.e. to "born").
  13298. "s" and "b" can be used in place of "S" and "B", respectively.
  13299. Alternatively a rule can be specified by an 18-bits integer. The 9
  13300. high order bits are used to encode the next cell state if it is alive
  13301. for each number of neighbor alive cells, the low order bits specify
  13302. the rule for "borning" new cells. Higher order bits encode for an
  13303. higher number of neighbor cells.
  13304. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  13305. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  13306. Default value is "S23/B3", which is the original Conway's game of life
  13307. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  13308. cells, and will born a new cell if there are three alive cells around
  13309. a dead cell.
  13310. @item size, s
  13311. Set the size of the output video. For the syntax of this option, check the
  13312. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13313. If @option{filename} is specified, the size is set by default to the
  13314. same size of the input file. If @option{size} is set, it must contain
  13315. the size specified in the input file, and the initial grid defined in
  13316. that file is centered in the larger resulting area.
  13317. If a filename is not specified, the size value defaults to "320x240"
  13318. (used for a randomly generated initial grid).
  13319. @item stitch
  13320. If set to 1, stitch the left and right grid edges together, and the
  13321. top and bottom edges also. Defaults to 1.
  13322. @item mold
  13323. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  13324. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  13325. value from 0 to 255.
  13326. @item life_color
  13327. Set the color of living (or new born) cells.
  13328. @item death_color
  13329. Set the color of dead cells. If @option{mold} is set, this is the first color
  13330. used to represent a dead cell.
  13331. @item mold_color
  13332. Set mold color, for definitely dead and moldy cells.
  13333. For the syntax of these 3 color options, check the "Color" section in the
  13334. ffmpeg-utils manual.
  13335. @end table
  13336. @subsection Examples
  13337. @itemize
  13338. @item
  13339. Read a grid from @file{pattern}, and center it on a grid of size
  13340. 300x300 pixels:
  13341. @example
  13342. life=f=pattern:s=300x300
  13343. @end example
  13344. @item
  13345. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  13346. @example
  13347. life=ratio=2/3:s=200x200
  13348. @end example
  13349. @item
  13350. Specify a custom rule for evolving a randomly generated grid:
  13351. @example
  13352. life=rule=S14/B34
  13353. @end example
  13354. @item
  13355. Full example with slow death effect (mold) using @command{ffplay}:
  13356. @example
  13357. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  13358. @end example
  13359. @end itemize
  13360. @anchor{allrgb}
  13361. @anchor{allyuv}
  13362. @anchor{color}
  13363. @anchor{haldclutsrc}
  13364. @anchor{nullsrc}
  13365. @anchor{rgbtestsrc}
  13366. @anchor{smptebars}
  13367. @anchor{smptehdbars}
  13368. @anchor{testsrc}
  13369. @anchor{testsrc2}
  13370. @anchor{yuvtestsrc}
  13371. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  13372. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  13373. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  13374. The @code{color} source provides an uniformly colored input.
  13375. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  13376. @ref{haldclut} filter.
  13377. The @code{nullsrc} source returns unprocessed video frames. It is
  13378. mainly useful to be employed in analysis / debugging tools, or as the
  13379. source for filters which ignore the input data.
  13380. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  13381. detecting RGB vs BGR issues. You should see a red, green and blue
  13382. stripe from top to bottom.
  13383. The @code{smptebars} source generates a color bars pattern, based on
  13384. the SMPTE Engineering Guideline EG 1-1990.
  13385. The @code{smptehdbars} source generates a color bars pattern, based on
  13386. the SMPTE RP 219-2002.
  13387. The @code{testsrc} source generates a test video pattern, showing a
  13388. color pattern, a scrolling gradient and a timestamp. This is mainly
  13389. intended for testing purposes.
  13390. The @code{testsrc2} source is similar to testsrc, but supports more
  13391. pixel formats instead of just @code{rgb24}. This allows using it as an
  13392. input for other tests without requiring a format conversion.
  13393. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  13394. see a y, cb and cr stripe from top to bottom.
  13395. The sources accept the following parameters:
  13396. @table @option
  13397. @item level
  13398. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  13399. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  13400. pixels to be used as identity matrix for 3D lookup tables. Each component is
  13401. coded on a @code{1/(N*N)} scale.
  13402. @item color, c
  13403. Specify the color of the source, only available in the @code{color}
  13404. source. For the syntax of this option, check the "Color" section in the
  13405. ffmpeg-utils manual.
  13406. @item size, s
  13407. Specify the size of the sourced video. For the syntax of this option, check the
  13408. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13409. The default value is @code{320x240}.
  13410. This option is not available with the @code{allrgb}, @code{allyuv}, and
  13411. @code{haldclutsrc} filters.
  13412. @item rate, r
  13413. Specify the frame rate of the sourced video, as the number of frames
  13414. generated per second. It has to be a string in the format
  13415. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13416. number or a valid video frame rate abbreviation. The default value is
  13417. "25".
  13418. @item duration, d
  13419. Set the duration of the sourced video. See
  13420. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13421. for the accepted syntax.
  13422. If not specified, or the expressed duration is negative, the video is
  13423. supposed to be generated forever.
  13424. @item sar
  13425. Set the sample aspect ratio of the sourced video.
  13426. @item alpha
  13427. Specify the alpha (opacity) of the background, only available in the
  13428. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  13429. 255 (fully opaque, the default).
  13430. @item decimals, n
  13431. Set the number of decimals to show in the timestamp, only available in the
  13432. @code{testsrc} source.
  13433. The displayed timestamp value will correspond to the original
  13434. timestamp value multiplied by the power of 10 of the specified
  13435. value. Default value is 0.
  13436. @end table
  13437. @subsection Examples
  13438. @itemize
  13439. @item
  13440. Generate a video with a duration of 5.3 seconds, with size
  13441. 176x144 and a frame rate of 10 frames per second:
  13442. @example
  13443. testsrc=duration=5.3:size=qcif:rate=10
  13444. @end example
  13445. @item
  13446. The following graph description will generate a red source
  13447. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  13448. frames per second:
  13449. @example
  13450. color=c=red@@0.2:s=qcif:r=10
  13451. @end example
  13452. @item
  13453. If the input content is to be ignored, @code{nullsrc} can be used. The
  13454. following command generates noise in the luminance plane by employing
  13455. the @code{geq} filter:
  13456. @example
  13457. nullsrc=s=256x256, geq=random(1)*255:128:128
  13458. @end example
  13459. @end itemize
  13460. @subsection Commands
  13461. The @code{color} source supports the following commands:
  13462. @table @option
  13463. @item c, color
  13464. Set the color of the created image. Accepts the same syntax of the
  13465. corresponding @option{color} option.
  13466. @end table
  13467. @section openclsrc
  13468. Generate video using an OpenCL program.
  13469. @table @option
  13470. @item source
  13471. OpenCL program source file.
  13472. @item kernel
  13473. Kernel name in program.
  13474. @item size, s
  13475. Size of frames to generate. This must be set.
  13476. @item format
  13477. Pixel format to use for the generated frames. This must be set.
  13478. @item rate, r
  13479. Number of frames generated every second. Default value is '25'.
  13480. @end table
  13481. For details of how the program loading works, see the @ref{program_opencl}
  13482. filter.
  13483. Example programs:
  13484. @itemize
  13485. @item
  13486. Generate a colour ramp by setting pixel values from the position of the pixel
  13487. in the output image. (Note that this will work with all pixel formats, but
  13488. the generated output will not be the same.)
  13489. @verbatim
  13490. __kernel void ramp(__write_only image2d_t dst,
  13491. unsigned int index)
  13492. {
  13493. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  13494. float4 val;
  13495. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  13496. write_imagef(dst, loc, val);
  13497. }
  13498. @end verbatim
  13499. @item
  13500. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  13501. @verbatim
  13502. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  13503. unsigned int index)
  13504. {
  13505. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  13506. float4 value = 0.0f;
  13507. int x = loc.x + index;
  13508. int y = loc.y + index;
  13509. while (x > 0 || y > 0) {
  13510. if (x % 3 == 1 && y % 3 == 1) {
  13511. value = 1.0f;
  13512. break;
  13513. }
  13514. x /= 3;
  13515. y /= 3;
  13516. }
  13517. write_imagef(dst, loc, value);
  13518. }
  13519. @end verbatim
  13520. @end itemize
  13521. @c man end VIDEO SOURCES
  13522. @chapter Video Sinks
  13523. @c man begin VIDEO SINKS
  13524. Below is a description of the currently available video sinks.
  13525. @section buffersink
  13526. Buffer video frames, and make them available to the end of the filter
  13527. graph.
  13528. This sink is mainly intended for programmatic use, in particular
  13529. through the interface defined in @file{libavfilter/buffersink.h}
  13530. or the options system.
  13531. It accepts a pointer to an AVBufferSinkContext structure, which
  13532. defines the incoming buffers' formats, to be passed as the opaque
  13533. parameter to @code{avfilter_init_filter} for initialization.
  13534. @section nullsink
  13535. Null video sink: do absolutely nothing with the input video. It is
  13536. mainly useful as a template and for use in analysis / debugging
  13537. tools.
  13538. @c man end VIDEO SINKS
  13539. @chapter Multimedia Filters
  13540. @c man begin MULTIMEDIA FILTERS
  13541. Below is a description of the currently available multimedia filters.
  13542. @section abitscope
  13543. Convert input audio to a video output, displaying the audio bit scope.
  13544. The filter accepts the following options:
  13545. @table @option
  13546. @item rate, r
  13547. Set frame rate, expressed as number of frames per second. Default
  13548. value is "25".
  13549. @item size, s
  13550. Specify the video size for the output. For the syntax of this option, check the
  13551. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13552. Default value is @code{1024x256}.
  13553. @item colors
  13554. Specify list of colors separated by space or by '|' which will be used to
  13555. draw channels. Unrecognized or missing colors will be replaced
  13556. by white color.
  13557. @end table
  13558. @section ahistogram
  13559. Convert input audio to a video output, displaying the volume histogram.
  13560. The filter accepts the following options:
  13561. @table @option
  13562. @item dmode
  13563. Specify how histogram is calculated.
  13564. It accepts the following values:
  13565. @table @samp
  13566. @item single
  13567. Use single histogram for all channels.
  13568. @item separate
  13569. Use separate histogram for each channel.
  13570. @end table
  13571. Default is @code{single}.
  13572. @item rate, r
  13573. Set frame rate, expressed as number of frames per second. Default
  13574. value is "25".
  13575. @item size, s
  13576. Specify the video size for the output. For the syntax of this option, check the
  13577. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13578. Default value is @code{hd720}.
  13579. @item scale
  13580. Set display scale.
  13581. It accepts the following values:
  13582. @table @samp
  13583. @item log
  13584. logarithmic
  13585. @item sqrt
  13586. square root
  13587. @item cbrt
  13588. cubic root
  13589. @item lin
  13590. linear
  13591. @item rlog
  13592. reverse logarithmic
  13593. @end table
  13594. Default is @code{log}.
  13595. @item ascale
  13596. Set amplitude scale.
  13597. It accepts the following values:
  13598. @table @samp
  13599. @item log
  13600. logarithmic
  13601. @item lin
  13602. linear
  13603. @end table
  13604. Default is @code{log}.
  13605. @item acount
  13606. Set how much frames to accumulate in histogram.
  13607. Defauls is 1. Setting this to -1 accumulates all frames.
  13608. @item rheight
  13609. Set histogram ratio of window height.
  13610. @item slide
  13611. Set sonogram sliding.
  13612. It accepts the following values:
  13613. @table @samp
  13614. @item replace
  13615. replace old rows with new ones.
  13616. @item scroll
  13617. scroll from top to bottom.
  13618. @end table
  13619. Default is @code{replace}.
  13620. @end table
  13621. @section aphasemeter
  13622. Convert input audio to a video output, displaying the audio phase.
  13623. The filter accepts the following options:
  13624. @table @option
  13625. @item rate, r
  13626. Set the output frame rate. Default value is @code{25}.
  13627. @item size, s
  13628. Set the video size for the output. For the syntax of this option, check the
  13629. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13630. Default value is @code{800x400}.
  13631. @item rc
  13632. @item gc
  13633. @item bc
  13634. Specify the red, green, blue contrast. Default values are @code{2},
  13635. @code{7} and @code{1}.
  13636. Allowed range is @code{[0, 255]}.
  13637. @item mpc
  13638. Set color which will be used for drawing median phase. If color is
  13639. @code{none} which is default, no median phase value will be drawn.
  13640. @item video
  13641. Enable video output. Default is enabled.
  13642. @end table
  13643. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  13644. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  13645. The @code{-1} means left and right channels are completely out of phase and
  13646. @code{1} means channels are in phase.
  13647. @section avectorscope
  13648. Convert input audio to a video output, representing the audio vector
  13649. scope.
  13650. The filter is used to measure the difference between channels of stereo
  13651. audio stream. A monoaural signal, consisting of identical left and right
  13652. signal, results in straight vertical line. Any stereo separation is visible
  13653. as a deviation from this line, creating a Lissajous figure.
  13654. If the straight (or deviation from it) but horizontal line appears this
  13655. indicates that the left and right channels are out of phase.
  13656. The filter accepts the following options:
  13657. @table @option
  13658. @item mode, m
  13659. Set the vectorscope mode.
  13660. Available values are:
  13661. @table @samp
  13662. @item lissajous
  13663. Lissajous rotated by 45 degrees.
  13664. @item lissajous_xy
  13665. Same as above but not rotated.
  13666. @item polar
  13667. Shape resembling half of circle.
  13668. @end table
  13669. Default value is @samp{lissajous}.
  13670. @item size, s
  13671. Set the video size for the output. For the syntax of this option, check the
  13672. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13673. Default value is @code{400x400}.
  13674. @item rate, r
  13675. Set the output frame rate. Default value is @code{25}.
  13676. @item rc
  13677. @item gc
  13678. @item bc
  13679. @item ac
  13680. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  13681. @code{160}, @code{80} and @code{255}.
  13682. Allowed range is @code{[0, 255]}.
  13683. @item rf
  13684. @item gf
  13685. @item bf
  13686. @item af
  13687. Specify the red, green, blue and alpha fade. Default values are @code{15},
  13688. @code{10}, @code{5} and @code{5}.
  13689. Allowed range is @code{[0, 255]}.
  13690. @item zoom
  13691. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  13692. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  13693. @item draw
  13694. Set the vectorscope drawing mode.
  13695. Available values are:
  13696. @table @samp
  13697. @item dot
  13698. Draw dot for each sample.
  13699. @item line
  13700. Draw line between previous and current sample.
  13701. @end table
  13702. Default value is @samp{dot}.
  13703. @item scale
  13704. Specify amplitude scale of audio samples.
  13705. Available values are:
  13706. @table @samp
  13707. @item lin
  13708. Linear.
  13709. @item sqrt
  13710. Square root.
  13711. @item cbrt
  13712. Cubic root.
  13713. @item log
  13714. Logarithmic.
  13715. @end table
  13716. @item swap
  13717. Swap left channel axis with right channel axis.
  13718. @item mirror
  13719. Mirror axis.
  13720. @table @samp
  13721. @item none
  13722. No mirror.
  13723. @item x
  13724. Mirror only x axis.
  13725. @item y
  13726. Mirror only y axis.
  13727. @item xy
  13728. Mirror both axis.
  13729. @end table
  13730. @end table
  13731. @subsection Examples
  13732. @itemize
  13733. @item
  13734. Complete example using @command{ffplay}:
  13735. @example
  13736. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  13737. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  13738. @end example
  13739. @end itemize
  13740. @section bench, abench
  13741. Benchmark part of a filtergraph.
  13742. The filter accepts the following options:
  13743. @table @option
  13744. @item action
  13745. Start or stop a timer.
  13746. Available values are:
  13747. @table @samp
  13748. @item start
  13749. Get the current time, set it as frame metadata (using the key
  13750. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  13751. @item stop
  13752. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  13753. the input frame metadata to get the time difference. Time difference, average,
  13754. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  13755. @code{min}) are then printed. The timestamps are expressed in seconds.
  13756. @end table
  13757. @end table
  13758. @subsection Examples
  13759. @itemize
  13760. @item
  13761. Benchmark @ref{selectivecolor} filter:
  13762. @example
  13763. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  13764. @end example
  13765. @end itemize
  13766. @section concat
  13767. Concatenate audio and video streams, joining them together one after the
  13768. other.
  13769. The filter works on segments of synchronized video and audio streams. All
  13770. segments must have the same number of streams of each type, and that will
  13771. also be the number of streams at output.
  13772. The filter accepts the following options:
  13773. @table @option
  13774. @item n
  13775. Set the number of segments. Default is 2.
  13776. @item v
  13777. Set the number of output video streams, that is also the number of video
  13778. streams in each segment. Default is 1.
  13779. @item a
  13780. Set the number of output audio streams, that is also the number of audio
  13781. streams in each segment. Default is 0.
  13782. @item unsafe
  13783. Activate unsafe mode: do not fail if segments have a different format.
  13784. @end table
  13785. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  13786. @var{a} audio outputs.
  13787. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  13788. segment, in the same order as the outputs, then the inputs for the second
  13789. segment, etc.
  13790. Related streams do not always have exactly the same duration, for various
  13791. reasons including codec frame size or sloppy authoring. For that reason,
  13792. related synchronized streams (e.g. a video and its audio track) should be
  13793. concatenated at once. The concat filter will use the duration of the longest
  13794. stream in each segment (except the last one), and if necessary pad shorter
  13795. audio streams with silence.
  13796. For this filter to work correctly, all segments must start at timestamp 0.
  13797. All corresponding streams must have the same parameters in all segments; the
  13798. filtering system will automatically select a common pixel format for video
  13799. streams, and a common sample format, sample rate and channel layout for
  13800. audio streams, but other settings, such as resolution, must be converted
  13801. explicitly by the user.
  13802. Different frame rates are acceptable but will result in variable frame rate
  13803. at output; be sure to configure the output file to handle it.
  13804. @subsection Examples
  13805. @itemize
  13806. @item
  13807. Concatenate an opening, an episode and an ending, all in bilingual version
  13808. (video in stream 0, audio in streams 1 and 2):
  13809. @example
  13810. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  13811. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  13812. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  13813. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  13814. @end example
  13815. @item
  13816. Concatenate two parts, handling audio and video separately, using the
  13817. (a)movie sources, and adjusting the resolution:
  13818. @example
  13819. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  13820. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  13821. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  13822. @end example
  13823. Note that a desync will happen at the stitch if the audio and video streams
  13824. do not have exactly the same duration in the first file.
  13825. @end itemize
  13826. @section drawgraph, adrawgraph
  13827. Draw a graph using input video or audio metadata.
  13828. It accepts the following parameters:
  13829. @table @option
  13830. @item m1
  13831. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  13832. @item fg1
  13833. Set 1st foreground color expression.
  13834. @item m2
  13835. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  13836. @item fg2
  13837. Set 2nd foreground color expression.
  13838. @item m3
  13839. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  13840. @item fg3
  13841. Set 3rd foreground color expression.
  13842. @item m4
  13843. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  13844. @item fg4
  13845. Set 4th foreground color expression.
  13846. @item min
  13847. Set minimal value of metadata value.
  13848. @item max
  13849. Set maximal value of metadata value.
  13850. @item bg
  13851. Set graph background color. Default is white.
  13852. @item mode
  13853. Set graph mode.
  13854. Available values for mode is:
  13855. @table @samp
  13856. @item bar
  13857. @item dot
  13858. @item line
  13859. @end table
  13860. Default is @code{line}.
  13861. @item slide
  13862. Set slide mode.
  13863. Available values for slide is:
  13864. @table @samp
  13865. @item frame
  13866. Draw new frame when right border is reached.
  13867. @item replace
  13868. Replace old columns with new ones.
  13869. @item scroll
  13870. Scroll from right to left.
  13871. @item rscroll
  13872. Scroll from left to right.
  13873. @item picture
  13874. Draw single picture.
  13875. @end table
  13876. Default is @code{frame}.
  13877. @item size
  13878. Set size of graph video. For the syntax of this option, check the
  13879. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13880. The default value is @code{900x256}.
  13881. The foreground color expressions can use the following variables:
  13882. @table @option
  13883. @item MIN
  13884. Minimal value of metadata value.
  13885. @item MAX
  13886. Maximal value of metadata value.
  13887. @item VAL
  13888. Current metadata key value.
  13889. @end table
  13890. The color is defined as 0xAABBGGRR.
  13891. @end table
  13892. Example using metadata from @ref{signalstats} filter:
  13893. @example
  13894. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  13895. @end example
  13896. Example using metadata from @ref{ebur128} filter:
  13897. @example
  13898. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  13899. @end example
  13900. @anchor{ebur128}
  13901. @section ebur128
  13902. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  13903. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  13904. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  13905. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  13906. The filter also has a video output (see the @var{video} option) with a real
  13907. time graph to observe the loudness evolution. The graphic contains the logged
  13908. message mentioned above, so it is not printed anymore when this option is set,
  13909. unless the verbose logging is set. The main graphing area contains the
  13910. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  13911. the momentary loudness (400 milliseconds).
  13912. More information about the Loudness Recommendation EBU R128 on
  13913. @url{http://tech.ebu.ch/loudness}.
  13914. The filter accepts the following options:
  13915. @table @option
  13916. @item video
  13917. Activate the video output. The audio stream is passed unchanged whether this
  13918. option is set or no. The video stream will be the first output stream if
  13919. activated. Default is @code{0}.
  13920. @item size
  13921. Set the video size. This option is for video only. For the syntax of this
  13922. option, check the
  13923. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13924. Default and minimum resolution is @code{640x480}.
  13925. @item meter
  13926. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  13927. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  13928. other integer value between this range is allowed.
  13929. @item metadata
  13930. Set metadata injection. If set to @code{1}, the audio input will be segmented
  13931. into 100ms output frames, each of them containing various loudness information
  13932. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  13933. Default is @code{0}.
  13934. @item framelog
  13935. Force the frame logging level.
  13936. Available values are:
  13937. @table @samp
  13938. @item info
  13939. information logging level
  13940. @item verbose
  13941. verbose logging level
  13942. @end table
  13943. By default, the logging level is set to @var{info}. If the @option{video} or
  13944. the @option{metadata} options are set, it switches to @var{verbose}.
  13945. @item peak
  13946. Set peak mode(s).
  13947. Available modes can be cumulated (the option is a @code{flag} type). Possible
  13948. values are:
  13949. @table @samp
  13950. @item none
  13951. Disable any peak mode (default).
  13952. @item sample
  13953. Enable sample-peak mode.
  13954. Simple peak mode looking for the higher sample value. It logs a message
  13955. for sample-peak (identified by @code{SPK}).
  13956. @item true
  13957. Enable true-peak mode.
  13958. If enabled, the peak lookup is done on an over-sampled version of the input
  13959. stream for better peak accuracy. It logs a message for true-peak.
  13960. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  13961. This mode requires a build with @code{libswresample}.
  13962. @end table
  13963. @item dualmono
  13964. Treat mono input files as "dual mono". If a mono file is intended for playback
  13965. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  13966. If set to @code{true}, this option will compensate for this effect.
  13967. Multi-channel input files are not affected by this option.
  13968. @item panlaw
  13969. Set a specific pan law to be used for the measurement of dual mono files.
  13970. This parameter is optional, and has a default value of -3.01dB.
  13971. @end table
  13972. @subsection Examples
  13973. @itemize
  13974. @item
  13975. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  13976. @example
  13977. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  13978. @end example
  13979. @item
  13980. Run an analysis with @command{ffmpeg}:
  13981. @example
  13982. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  13983. @end example
  13984. @end itemize
  13985. @section interleave, ainterleave
  13986. Temporally interleave frames from several inputs.
  13987. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  13988. These filters read frames from several inputs and send the oldest
  13989. queued frame to the output.
  13990. Input streams must have well defined, monotonically increasing frame
  13991. timestamp values.
  13992. In order to submit one frame to output, these filters need to enqueue
  13993. at least one frame for each input, so they cannot work in case one
  13994. input is not yet terminated and will not receive incoming frames.
  13995. For example consider the case when one input is a @code{select} filter
  13996. which always drops input frames. The @code{interleave} filter will keep
  13997. reading from that input, but it will never be able to send new frames
  13998. to output until the input sends an end-of-stream signal.
  13999. Also, depending on inputs synchronization, the filters will drop
  14000. frames in case one input receives more frames than the other ones, and
  14001. the queue is already filled.
  14002. These filters accept the following options:
  14003. @table @option
  14004. @item nb_inputs, n
  14005. Set the number of different inputs, it is 2 by default.
  14006. @end table
  14007. @subsection Examples
  14008. @itemize
  14009. @item
  14010. Interleave frames belonging to different streams using @command{ffmpeg}:
  14011. @example
  14012. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  14013. @end example
  14014. @item
  14015. Add flickering blur effect:
  14016. @example
  14017. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  14018. @end example
  14019. @end itemize
  14020. @section metadata, ametadata
  14021. Manipulate frame metadata.
  14022. This filter accepts the following options:
  14023. @table @option
  14024. @item mode
  14025. Set mode of operation of the filter.
  14026. Can be one of the following:
  14027. @table @samp
  14028. @item select
  14029. If both @code{value} and @code{key} is set, select frames
  14030. which have such metadata. If only @code{key} is set, select
  14031. every frame that has such key in metadata.
  14032. @item add
  14033. Add new metadata @code{key} and @code{value}. If key is already available
  14034. do nothing.
  14035. @item modify
  14036. Modify value of already present key.
  14037. @item delete
  14038. If @code{value} is set, delete only keys that have such value.
  14039. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  14040. the frame.
  14041. @item print
  14042. Print key and its value if metadata was found. If @code{key} is not set print all
  14043. metadata values available in frame.
  14044. @end table
  14045. @item key
  14046. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  14047. @item value
  14048. Set metadata value which will be used. This option is mandatory for
  14049. @code{modify} and @code{add} mode.
  14050. @item function
  14051. Which function to use when comparing metadata value and @code{value}.
  14052. Can be one of following:
  14053. @table @samp
  14054. @item same_str
  14055. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  14056. @item starts_with
  14057. Values are interpreted as strings, returns true if metadata value starts with
  14058. the @code{value} option string.
  14059. @item less
  14060. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  14061. @item equal
  14062. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  14063. @item greater
  14064. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  14065. @item expr
  14066. Values are interpreted as floats, returns true if expression from option @code{expr}
  14067. evaluates to true.
  14068. @end table
  14069. @item expr
  14070. Set expression which is used when @code{function} is set to @code{expr}.
  14071. The expression is evaluated through the eval API and can contain the following
  14072. constants:
  14073. @table @option
  14074. @item VALUE1
  14075. Float representation of @code{value} from metadata key.
  14076. @item VALUE2
  14077. Float representation of @code{value} as supplied by user in @code{value} option.
  14078. @end table
  14079. @item file
  14080. If specified in @code{print} mode, output is written to the named file. Instead of
  14081. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  14082. for standard output. If @code{file} option is not set, output is written to the log
  14083. with AV_LOG_INFO loglevel.
  14084. @end table
  14085. @subsection Examples
  14086. @itemize
  14087. @item
  14088. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  14089. between 0 and 1.
  14090. @example
  14091. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  14092. @end example
  14093. @item
  14094. Print silencedetect output to file @file{metadata.txt}.
  14095. @example
  14096. silencedetect,ametadata=mode=print:file=metadata.txt
  14097. @end example
  14098. @item
  14099. Direct all metadata to a pipe with file descriptor 4.
  14100. @example
  14101. metadata=mode=print:file='pipe\:4'
  14102. @end example
  14103. @end itemize
  14104. @section perms, aperms
  14105. Set read/write permissions for the output frames.
  14106. These filters are mainly aimed at developers to test direct path in the
  14107. following filter in the filtergraph.
  14108. The filters accept the following options:
  14109. @table @option
  14110. @item mode
  14111. Select the permissions mode.
  14112. It accepts the following values:
  14113. @table @samp
  14114. @item none
  14115. Do nothing. This is the default.
  14116. @item ro
  14117. Set all the output frames read-only.
  14118. @item rw
  14119. Set all the output frames directly writable.
  14120. @item toggle
  14121. Make the frame read-only if writable, and writable if read-only.
  14122. @item random
  14123. Set each output frame read-only or writable randomly.
  14124. @end table
  14125. @item seed
  14126. Set the seed for the @var{random} mode, must be an integer included between
  14127. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  14128. @code{-1}, the filter will try to use a good random seed on a best effort
  14129. basis.
  14130. @end table
  14131. Note: in case of auto-inserted filter between the permission filter and the
  14132. following one, the permission might not be received as expected in that
  14133. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  14134. perms/aperms filter can avoid this problem.
  14135. @section realtime, arealtime
  14136. Slow down filtering to match real time approximately.
  14137. These filters will pause the filtering for a variable amount of time to
  14138. match the output rate with the input timestamps.
  14139. They are similar to the @option{re} option to @code{ffmpeg}.
  14140. They accept the following options:
  14141. @table @option
  14142. @item limit
  14143. Time limit for the pauses. Any pause longer than that will be considered
  14144. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  14145. @end table
  14146. @anchor{select}
  14147. @section select, aselect
  14148. Select frames to pass in output.
  14149. This filter accepts the following options:
  14150. @table @option
  14151. @item expr, e
  14152. Set expression, which is evaluated for each input frame.
  14153. If the expression is evaluated to zero, the frame is discarded.
  14154. If the evaluation result is negative or NaN, the frame is sent to the
  14155. first output; otherwise it is sent to the output with index
  14156. @code{ceil(val)-1}, assuming that the input index starts from 0.
  14157. For example a value of @code{1.2} corresponds to the output with index
  14158. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  14159. @item outputs, n
  14160. Set the number of outputs. The output to which to send the selected
  14161. frame is based on the result of the evaluation. Default value is 1.
  14162. @end table
  14163. The expression can contain the following constants:
  14164. @table @option
  14165. @item n
  14166. The (sequential) number of the filtered frame, starting from 0.
  14167. @item selected_n
  14168. The (sequential) number of the selected frame, starting from 0.
  14169. @item prev_selected_n
  14170. The sequential number of the last selected frame. It's NAN if undefined.
  14171. @item TB
  14172. The timebase of the input timestamps.
  14173. @item pts
  14174. The PTS (Presentation TimeStamp) of the filtered video frame,
  14175. expressed in @var{TB} units. It's NAN if undefined.
  14176. @item t
  14177. The PTS of the filtered video frame,
  14178. expressed in seconds. It's NAN if undefined.
  14179. @item prev_pts
  14180. The PTS of the previously filtered video frame. It's NAN if undefined.
  14181. @item prev_selected_pts
  14182. The PTS of the last previously filtered video frame. It's NAN if undefined.
  14183. @item prev_selected_t
  14184. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  14185. @item start_pts
  14186. The PTS of the first video frame in the video. It's NAN if undefined.
  14187. @item start_t
  14188. The time of the first video frame in the video. It's NAN if undefined.
  14189. @item pict_type @emph{(video only)}
  14190. The type of the filtered frame. It can assume one of the following
  14191. values:
  14192. @table @option
  14193. @item I
  14194. @item P
  14195. @item B
  14196. @item S
  14197. @item SI
  14198. @item SP
  14199. @item BI
  14200. @end table
  14201. @item interlace_type @emph{(video only)}
  14202. The frame interlace type. It can assume one of the following values:
  14203. @table @option
  14204. @item PROGRESSIVE
  14205. The frame is progressive (not interlaced).
  14206. @item TOPFIRST
  14207. The frame is top-field-first.
  14208. @item BOTTOMFIRST
  14209. The frame is bottom-field-first.
  14210. @end table
  14211. @item consumed_sample_n @emph{(audio only)}
  14212. the number of selected samples before the current frame
  14213. @item samples_n @emph{(audio only)}
  14214. the number of samples in the current frame
  14215. @item sample_rate @emph{(audio only)}
  14216. the input sample rate
  14217. @item key
  14218. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  14219. @item pos
  14220. the position in the file of the filtered frame, -1 if the information
  14221. is not available (e.g. for synthetic video)
  14222. @item scene @emph{(video only)}
  14223. value between 0 and 1 to indicate a new scene; a low value reflects a low
  14224. probability for the current frame to introduce a new scene, while a higher
  14225. value means the current frame is more likely to be one (see the example below)
  14226. @item concatdec_select
  14227. The concat demuxer can select only part of a concat input file by setting an
  14228. inpoint and an outpoint, but the output packets may not be entirely contained
  14229. in the selected interval. By using this variable, it is possible to skip frames
  14230. generated by the concat demuxer which are not exactly contained in the selected
  14231. interval.
  14232. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  14233. and the @var{lavf.concat.duration} packet metadata values which are also
  14234. present in the decoded frames.
  14235. The @var{concatdec_select} variable is -1 if the frame pts is at least
  14236. start_time and either the duration metadata is missing or the frame pts is less
  14237. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  14238. missing.
  14239. That basically means that an input frame is selected if its pts is within the
  14240. interval set by the concat demuxer.
  14241. @end table
  14242. The default value of the select expression is "1".
  14243. @subsection Examples
  14244. @itemize
  14245. @item
  14246. Select all frames in input:
  14247. @example
  14248. select
  14249. @end example
  14250. The example above is the same as:
  14251. @example
  14252. select=1
  14253. @end example
  14254. @item
  14255. Skip all frames:
  14256. @example
  14257. select=0
  14258. @end example
  14259. @item
  14260. Select only I-frames:
  14261. @example
  14262. select='eq(pict_type\,I)'
  14263. @end example
  14264. @item
  14265. Select one frame every 100:
  14266. @example
  14267. select='not(mod(n\,100))'
  14268. @end example
  14269. @item
  14270. Select only frames contained in the 10-20 time interval:
  14271. @example
  14272. select=between(t\,10\,20)
  14273. @end example
  14274. @item
  14275. Select only I-frames contained in the 10-20 time interval:
  14276. @example
  14277. select=between(t\,10\,20)*eq(pict_type\,I)
  14278. @end example
  14279. @item
  14280. Select frames with a minimum distance of 10 seconds:
  14281. @example
  14282. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  14283. @end example
  14284. @item
  14285. Use aselect to select only audio frames with samples number > 100:
  14286. @example
  14287. aselect='gt(samples_n\,100)'
  14288. @end example
  14289. @item
  14290. Create a mosaic of the first scenes:
  14291. @example
  14292. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  14293. @end example
  14294. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  14295. choice.
  14296. @item
  14297. Send even and odd frames to separate outputs, and compose them:
  14298. @example
  14299. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  14300. @end example
  14301. @item
  14302. Select useful frames from an ffconcat file which is using inpoints and
  14303. outpoints but where the source files are not intra frame only.
  14304. @example
  14305. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  14306. @end example
  14307. @end itemize
  14308. @section sendcmd, asendcmd
  14309. Send commands to filters in the filtergraph.
  14310. These filters read commands to be sent to other filters in the
  14311. filtergraph.
  14312. @code{sendcmd} must be inserted between two video filters,
  14313. @code{asendcmd} must be inserted between two audio filters, but apart
  14314. from that they act the same way.
  14315. The specification of commands can be provided in the filter arguments
  14316. with the @var{commands} option, or in a file specified by the
  14317. @var{filename} option.
  14318. These filters accept the following options:
  14319. @table @option
  14320. @item commands, c
  14321. Set the commands to be read and sent to the other filters.
  14322. @item filename, f
  14323. Set the filename of the commands to be read and sent to the other
  14324. filters.
  14325. @end table
  14326. @subsection Commands syntax
  14327. A commands description consists of a sequence of interval
  14328. specifications, comprising a list of commands to be executed when a
  14329. particular event related to that interval occurs. The occurring event
  14330. is typically the current frame time entering or leaving a given time
  14331. interval.
  14332. An interval is specified by the following syntax:
  14333. @example
  14334. @var{START}[-@var{END}] @var{COMMANDS};
  14335. @end example
  14336. The time interval is specified by the @var{START} and @var{END} times.
  14337. @var{END} is optional and defaults to the maximum time.
  14338. The current frame time is considered within the specified interval if
  14339. it is included in the interval [@var{START}, @var{END}), that is when
  14340. the time is greater or equal to @var{START} and is lesser than
  14341. @var{END}.
  14342. @var{COMMANDS} consists of a sequence of one or more command
  14343. specifications, separated by ",", relating to that interval. The
  14344. syntax of a command specification is given by:
  14345. @example
  14346. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  14347. @end example
  14348. @var{FLAGS} is optional and specifies the type of events relating to
  14349. the time interval which enable sending the specified command, and must
  14350. be a non-null sequence of identifier flags separated by "+" or "|" and
  14351. enclosed between "[" and "]".
  14352. The following flags are recognized:
  14353. @table @option
  14354. @item enter
  14355. The command is sent when the current frame timestamp enters the
  14356. specified interval. In other words, the command is sent when the
  14357. previous frame timestamp was not in the given interval, and the
  14358. current is.
  14359. @item leave
  14360. The command is sent when the current frame timestamp leaves the
  14361. specified interval. In other words, the command is sent when the
  14362. previous frame timestamp was in the given interval, and the
  14363. current is not.
  14364. @end table
  14365. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  14366. assumed.
  14367. @var{TARGET} specifies the target of the command, usually the name of
  14368. the filter class or a specific filter instance name.
  14369. @var{COMMAND} specifies the name of the command for the target filter.
  14370. @var{ARG} is optional and specifies the optional list of argument for
  14371. the given @var{COMMAND}.
  14372. Between one interval specification and another, whitespaces, or
  14373. sequences of characters starting with @code{#} until the end of line,
  14374. are ignored and can be used to annotate comments.
  14375. A simplified BNF description of the commands specification syntax
  14376. follows:
  14377. @example
  14378. @var{COMMAND_FLAG} ::= "enter" | "leave"
  14379. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  14380. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  14381. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  14382. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  14383. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  14384. @end example
  14385. @subsection Examples
  14386. @itemize
  14387. @item
  14388. Specify audio tempo change at second 4:
  14389. @example
  14390. asendcmd=c='4.0 atempo tempo 1.5',atempo
  14391. @end example
  14392. @item
  14393. Target a specific filter instance:
  14394. @example
  14395. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  14396. @end example
  14397. @item
  14398. Specify a list of drawtext and hue commands in a file.
  14399. @example
  14400. # show text in the interval 5-10
  14401. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  14402. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  14403. # desaturate the image in the interval 15-20
  14404. 15.0-20.0 [enter] hue s 0,
  14405. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  14406. [leave] hue s 1,
  14407. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  14408. # apply an exponential saturation fade-out effect, starting from time 25
  14409. 25 [enter] hue s exp(25-t)
  14410. @end example
  14411. A filtergraph allowing to read and process the above command list
  14412. stored in a file @file{test.cmd}, can be specified with:
  14413. @example
  14414. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  14415. @end example
  14416. @end itemize
  14417. @anchor{setpts}
  14418. @section setpts, asetpts
  14419. Change the PTS (presentation timestamp) of the input frames.
  14420. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  14421. This filter accepts the following options:
  14422. @table @option
  14423. @item expr
  14424. The expression which is evaluated for each frame to construct its timestamp.
  14425. @end table
  14426. The expression is evaluated through the eval API and can contain the following
  14427. constants:
  14428. @table @option
  14429. @item FRAME_RATE
  14430. frame rate, only defined for constant frame-rate video
  14431. @item PTS
  14432. The presentation timestamp in input
  14433. @item N
  14434. The count of the input frame for video or the number of consumed samples,
  14435. not including the current frame for audio, starting from 0.
  14436. @item NB_CONSUMED_SAMPLES
  14437. The number of consumed samples, not including the current frame (only
  14438. audio)
  14439. @item NB_SAMPLES, S
  14440. The number of samples in the current frame (only audio)
  14441. @item SAMPLE_RATE, SR
  14442. The audio sample rate.
  14443. @item STARTPTS
  14444. The PTS of the first frame.
  14445. @item STARTT
  14446. the time in seconds of the first frame
  14447. @item INTERLACED
  14448. State whether the current frame is interlaced.
  14449. @item T
  14450. the time in seconds of the current frame
  14451. @item POS
  14452. original position in the file of the frame, or undefined if undefined
  14453. for the current frame
  14454. @item PREV_INPTS
  14455. The previous input PTS.
  14456. @item PREV_INT
  14457. previous input time in seconds
  14458. @item PREV_OUTPTS
  14459. The previous output PTS.
  14460. @item PREV_OUTT
  14461. previous output time in seconds
  14462. @item RTCTIME
  14463. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  14464. instead.
  14465. @item RTCSTART
  14466. The wallclock (RTC) time at the start of the movie in microseconds.
  14467. @item TB
  14468. The timebase of the input timestamps.
  14469. @end table
  14470. @subsection Examples
  14471. @itemize
  14472. @item
  14473. Start counting PTS from zero
  14474. @example
  14475. setpts=PTS-STARTPTS
  14476. @end example
  14477. @item
  14478. Apply fast motion effect:
  14479. @example
  14480. setpts=0.5*PTS
  14481. @end example
  14482. @item
  14483. Apply slow motion effect:
  14484. @example
  14485. setpts=2.0*PTS
  14486. @end example
  14487. @item
  14488. Set fixed rate of 25 frames per second:
  14489. @example
  14490. setpts=N/(25*TB)
  14491. @end example
  14492. @item
  14493. Set fixed rate 25 fps with some jitter:
  14494. @example
  14495. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  14496. @end example
  14497. @item
  14498. Apply an offset of 10 seconds to the input PTS:
  14499. @example
  14500. setpts=PTS+10/TB
  14501. @end example
  14502. @item
  14503. Generate timestamps from a "live source" and rebase onto the current timebase:
  14504. @example
  14505. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  14506. @end example
  14507. @item
  14508. Generate timestamps by counting samples:
  14509. @example
  14510. asetpts=N/SR/TB
  14511. @end example
  14512. @end itemize
  14513. @section setrange
  14514. Force color range for the output video frame.
  14515. The @code{setrange} filter marks the color range property for the
  14516. output frames. It does not change the input frame, but only sets the
  14517. corresponding property, which affects how the frame is treated by
  14518. following filters.
  14519. The filter accepts the following options:
  14520. @table @option
  14521. @item range
  14522. Available values are:
  14523. @table @samp
  14524. @item auto
  14525. Keep the same color range property.
  14526. @item unspecified, unknown
  14527. Set the color range as unspecified.
  14528. @item limited, tv, mpeg
  14529. Set the color range as limited.
  14530. @item full, pc, jpeg
  14531. Set the color range as full.
  14532. @end table
  14533. @end table
  14534. @section settb, asettb
  14535. Set the timebase to use for the output frames timestamps.
  14536. It is mainly useful for testing timebase configuration.
  14537. It accepts the following parameters:
  14538. @table @option
  14539. @item expr, tb
  14540. The expression which is evaluated into the output timebase.
  14541. @end table
  14542. The value for @option{tb} is an arithmetic expression representing a
  14543. rational. The expression can contain the constants "AVTB" (the default
  14544. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  14545. audio only). Default value is "intb".
  14546. @subsection Examples
  14547. @itemize
  14548. @item
  14549. Set the timebase to 1/25:
  14550. @example
  14551. settb=expr=1/25
  14552. @end example
  14553. @item
  14554. Set the timebase to 1/10:
  14555. @example
  14556. settb=expr=0.1
  14557. @end example
  14558. @item
  14559. Set the timebase to 1001/1000:
  14560. @example
  14561. settb=1+0.001
  14562. @end example
  14563. @item
  14564. Set the timebase to 2*intb:
  14565. @example
  14566. settb=2*intb
  14567. @end example
  14568. @item
  14569. Set the default timebase value:
  14570. @example
  14571. settb=AVTB
  14572. @end example
  14573. @end itemize
  14574. @section showcqt
  14575. Convert input audio to a video output representing frequency spectrum
  14576. logarithmically using Brown-Puckette constant Q transform algorithm with
  14577. direct frequency domain coefficient calculation (but the transform itself
  14578. is not really constant Q, instead the Q factor is actually variable/clamped),
  14579. with musical tone scale, from E0 to D#10.
  14580. The filter accepts the following options:
  14581. @table @option
  14582. @item size, s
  14583. Specify the video size for the output. It must be even. For the syntax of this option,
  14584. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14585. Default value is @code{1920x1080}.
  14586. @item fps, rate, r
  14587. Set the output frame rate. Default value is @code{25}.
  14588. @item bar_h
  14589. Set the bargraph height. It must be even. Default value is @code{-1} which
  14590. computes the bargraph height automatically.
  14591. @item axis_h
  14592. Set the axis height. It must be even. Default value is @code{-1} which computes
  14593. the axis height automatically.
  14594. @item sono_h
  14595. Set the sonogram height. It must be even. Default value is @code{-1} which
  14596. computes the sonogram height automatically.
  14597. @item fullhd
  14598. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  14599. instead. Default value is @code{1}.
  14600. @item sono_v, volume
  14601. Specify the sonogram volume expression. It can contain variables:
  14602. @table @option
  14603. @item bar_v
  14604. the @var{bar_v} evaluated expression
  14605. @item frequency, freq, f
  14606. the frequency where it is evaluated
  14607. @item timeclamp, tc
  14608. the value of @var{timeclamp} option
  14609. @end table
  14610. and functions:
  14611. @table @option
  14612. @item a_weighting(f)
  14613. A-weighting of equal loudness
  14614. @item b_weighting(f)
  14615. B-weighting of equal loudness
  14616. @item c_weighting(f)
  14617. C-weighting of equal loudness.
  14618. @end table
  14619. Default value is @code{16}.
  14620. @item bar_v, volume2
  14621. Specify the bargraph volume expression. It can contain variables:
  14622. @table @option
  14623. @item sono_v
  14624. the @var{sono_v} evaluated expression
  14625. @item frequency, freq, f
  14626. the frequency where it is evaluated
  14627. @item timeclamp, tc
  14628. the value of @var{timeclamp} option
  14629. @end table
  14630. and functions:
  14631. @table @option
  14632. @item a_weighting(f)
  14633. A-weighting of equal loudness
  14634. @item b_weighting(f)
  14635. B-weighting of equal loudness
  14636. @item c_weighting(f)
  14637. C-weighting of equal loudness.
  14638. @end table
  14639. Default value is @code{sono_v}.
  14640. @item sono_g, gamma
  14641. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  14642. higher gamma makes the spectrum having more range. Default value is @code{3}.
  14643. Acceptable range is @code{[1, 7]}.
  14644. @item bar_g, gamma2
  14645. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  14646. @code{[1, 7]}.
  14647. @item bar_t
  14648. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  14649. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  14650. @item timeclamp, tc
  14651. Specify the transform timeclamp. At low frequency, there is trade-off between
  14652. accuracy in time domain and frequency domain. If timeclamp is lower,
  14653. event in time domain is represented more accurately (such as fast bass drum),
  14654. otherwise event in frequency domain is represented more accurately
  14655. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  14656. @item attack
  14657. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  14658. limits future samples by applying asymmetric windowing in time domain, useful
  14659. when low latency is required. Accepted range is @code{[0, 1]}.
  14660. @item basefreq
  14661. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  14662. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  14663. @item endfreq
  14664. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  14665. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  14666. @item coeffclamp
  14667. This option is deprecated and ignored.
  14668. @item tlength
  14669. Specify the transform length in time domain. Use this option to control accuracy
  14670. trade-off between time domain and frequency domain at every frequency sample.
  14671. It can contain variables:
  14672. @table @option
  14673. @item frequency, freq, f
  14674. the frequency where it is evaluated
  14675. @item timeclamp, tc
  14676. the value of @var{timeclamp} option.
  14677. @end table
  14678. Default value is @code{384*tc/(384+tc*f)}.
  14679. @item count
  14680. Specify the transform count for every video frame. Default value is @code{6}.
  14681. Acceptable range is @code{[1, 30]}.
  14682. @item fcount
  14683. Specify the transform count for every single pixel. Default value is @code{0},
  14684. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  14685. @item fontfile
  14686. Specify font file for use with freetype to draw the axis. If not specified,
  14687. use embedded font. Note that drawing with font file or embedded font is not
  14688. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  14689. option instead.
  14690. @item font
  14691. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  14692. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  14693. @item fontcolor
  14694. Specify font color expression. This is arithmetic expression that should return
  14695. integer value 0xRRGGBB. It can contain variables:
  14696. @table @option
  14697. @item frequency, freq, f
  14698. the frequency where it is evaluated
  14699. @item timeclamp, tc
  14700. the value of @var{timeclamp} option
  14701. @end table
  14702. and functions:
  14703. @table @option
  14704. @item midi(f)
  14705. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  14706. @item r(x), g(x), b(x)
  14707. red, green, and blue value of intensity x.
  14708. @end table
  14709. Default value is @code{st(0, (midi(f)-59.5)/12);
  14710. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  14711. r(1-ld(1)) + b(ld(1))}.
  14712. @item axisfile
  14713. Specify image file to draw the axis. This option override @var{fontfile} and
  14714. @var{fontcolor} option.
  14715. @item axis, text
  14716. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  14717. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  14718. Default value is @code{1}.
  14719. @item csp
  14720. Set colorspace. The accepted values are:
  14721. @table @samp
  14722. @item unspecified
  14723. Unspecified (default)
  14724. @item bt709
  14725. BT.709
  14726. @item fcc
  14727. FCC
  14728. @item bt470bg
  14729. BT.470BG or BT.601-6 625
  14730. @item smpte170m
  14731. SMPTE-170M or BT.601-6 525
  14732. @item smpte240m
  14733. SMPTE-240M
  14734. @item bt2020ncl
  14735. BT.2020 with non-constant luminance
  14736. @end table
  14737. @item cscheme
  14738. Set spectrogram color scheme. This is list of floating point values with format
  14739. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  14740. The default is @code{1|0.5|0|0|0.5|1}.
  14741. @end table
  14742. @subsection Examples
  14743. @itemize
  14744. @item
  14745. Playing audio while showing the spectrum:
  14746. @example
  14747. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  14748. @end example
  14749. @item
  14750. Same as above, but with frame rate 30 fps:
  14751. @example
  14752. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  14753. @end example
  14754. @item
  14755. Playing at 1280x720:
  14756. @example
  14757. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  14758. @end example
  14759. @item
  14760. Disable sonogram display:
  14761. @example
  14762. sono_h=0
  14763. @end example
  14764. @item
  14765. A1 and its harmonics: A1, A2, (near)E3, A3:
  14766. @example
  14767. 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),
  14768. asplit[a][out1]; [a] showcqt [out0]'
  14769. @end example
  14770. @item
  14771. Same as above, but with more accuracy in frequency domain:
  14772. @example
  14773. 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),
  14774. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  14775. @end example
  14776. @item
  14777. Custom volume:
  14778. @example
  14779. bar_v=10:sono_v=bar_v*a_weighting(f)
  14780. @end example
  14781. @item
  14782. Custom gamma, now spectrum is linear to the amplitude.
  14783. @example
  14784. bar_g=2:sono_g=2
  14785. @end example
  14786. @item
  14787. Custom tlength equation:
  14788. @example
  14789. 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)))'
  14790. @end example
  14791. @item
  14792. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  14793. @example
  14794. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  14795. @end example
  14796. @item
  14797. Custom font using fontconfig:
  14798. @example
  14799. font='Courier New,Monospace,mono|bold'
  14800. @end example
  14801. @item
  14802. Custom frequency range with custom axis using image file:
  14803. @example
  14804. axisfile=myaxis.png:basefreq=40:endfreq=10000
  14805. @end example
  14806. @end itemize
  14807. @section showfreqs
  14808. Convert input audio to video output representing the audio power spectrum.
  14809. Audio amplitude is on Y-axis while frequency is on X-axis.
  14810. The filter accepts the following options:
  14811. @table @option
  14812. @item size, s
  14813. Specify size of video. For the syntax of this option, check the
  14814. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14815. Default is @code{1024x512}.
  14816. @item mode
  14817. Set display mode.
  14818. This set how each frequency bin will be represented.
  14819. It accepts the following values:
  14820. @table @samp
  14821. @item line
  14822. @item bar
  14823. @item dot
  14824. @end table
  14825. Default is @code{bar}.
  14826. @item ascale
  14827. Set amplitude scale.
  14828. It accepts the following values:
  14829. @table @samp
  14830. @item lin
  14831. Linear scale.
  14832. @item sqrt
  14833. Square root scale.
  14834. @item cbrt
  14835. Cubic root scale.
  14836. @item log
  14837. Logarithmic scale.
  14838. @end table
  14839. Default is @code{log}.
  14840. @item fscale
  14841. Set frequency scale.
  14842. It accepts the following values:
  14843. @table @samp
  14844. @item lin
  14845. Linear scale.
  14846. @item log
  14847. Logarithmic scale.
  14848. @item rlog
  14849. Reverse logarithmic scale.
  14850. @end table
  14851. Default is @code{lin}.
  14852. @item win_size
  14853. Set window size.
  14854. It accepts the following values:
  14855. @table @samp
  14856. @item w16
  14857. @item w32
  14858. @item w64
  14859. @item w128
  14860. @item w256
  14861. @item w512
  14862. @item w1024
  14863. @item w2048
  14864. @item w4096
  14865. @item w8192
  14866. @item w16384
  14867. @item w32768
  14868. @item w65536
  14869. @end table
  14870. Default is @code{w2048}
  14871. @item win_func
  14872. Set windowing function.
  14873. It accepts the following values:
  14874. @table @samp
  14875. @item rect
  14876. @item bartlett
  14877. @item hanning
  14878. @item hamming
  14879. @item blackman
  14880. @item welch
  14881. @item flattop
  14882. @item bharris
  14883. @item bnuttall
  14884. @item bhann
  14885. @item sine
  14886. @item nuttall
  14887. @item lanczos
  14888. @item gauss
  14889. @item tukey
  14890. @item dolph
  14891. @item cauchy
  14892. @item parzen
  14893. @item poisson
  14894. @end table
  14895. Default is @code{hanning}.
  14896. @item overlap
  14897. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14898. which means optimal overlap for selected window function will be picked.
  14899. @item averaging
  14900. Set time averaging. Setting this to 0 will display current maximal peaks.
  14901. Default is @code{1}, which means time averaging is disabled.
  14902. @item colors
  14903. Specify list of colors separated by space or by '|' which will be used to
  14904. draw channel frequencies. Unrecognized or missing colors will be replaced
  14905. by white color.
  14906. @item cmode
  14907. Set channel display mode.
  14908. It accepts the following values:
  14909. @table @samp
  14910. @item combined
  14911. @item separate
  14912. @end table
  14913. Default is @code{combined}.
  14914. @item minamp
  14915. Set minimum amplitude used in @code{log} amplitude scaler.
  14916. @end table
  14917. @anchor{showspectrum}
  14918. @section showspectrum
  14919. Convert input audio to a video output, representing the audio frequency
  14920. spectrum.
  14921. The filter accepts the following options:
  14922. @table @option
  14923. @item size, s
  14924. Specify the video size for the output. For the syntax of this option, check the
  14925. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14926. Default value is @code{640x512}.
  14927. @item slide
  14928. Specify how the spectrum should slide along the window.
  14929. It accepts the following values:
  14930. @table @samp
  14931. @item replace
  14932. the samples start again on the left when they reach the right
  14933. @item scroll
  14934. the samples scroll from right to left
  14935. @item fullframe
  14936. frames are only produced when the samples reach the right
  14937. @item rscroll
  14938. the samples scroll from left to right
  14939. @end table
  14940. Default value is @code{replace}.
  14941. @item mode
  14942. Specify display mode.
  14943. It accepts the following values:
  14944. @table @samp
  14945. @item combined
  14946. all channels are displayed in the same row
  14947. @item separate
  14948. all channels are displayed in separate rows
  14949. @end table
  14950. Default value is @samp{combined}.
  14951. @item color
  14952. Specify display color mode.
  14953. It accepts the following values:
  14954. @table @samp
  14955. @item channel
  14956. each channel is displayed in a separate color
  14957. @item intensity
  14958. each channel is displayed using the same color scheme
  14959. @item rainbow
  14960. each channel is displayed using the rainbow color scheme
  14961. @item moreland
  14962. each channel is displayed using the moreland color scheme
  14963. @item nebulae
  14964. each channel is displayed using the nebulae color scheme
  14965. @item fire
  14966. each channel is displayed using the fire color scheme
  14967. @item fiery
  14968. each channel is displayed using the fiery color scheme
  14969. @item fruit
  14970. each channel is displayed using the fruit color scheme
  14971. @item cool
  14972. each channel is displayed using the cool color scheme
  14973. @end table
  14974. Default value is @samp{channel}.
  14975. @item scale
  14976. Specify scale used for calculating intensity color values.
  14977. It accepts the following values:
  14978. @table @samp
  14979. @item lin
  14980. linear
  14981. @item sqrt
  14982. square root, default
  14983. @item cbrt
  14984. cubic root
  14985. @item log
  14986. logarithmic
  14987. @item 4thrt
  14988. 4th root
  14989. @item 5thrt
  14990. 5th root
  14991. @end table
  14992. Default value is @samp{sqrt}.
  14993. @item saturation
  14994. Set saturation modifier for displayed colors. Negative values provide
  14995. alternative color scheme. @code{0} is no saturation at all.
  14996. Saturation must be in [-10.0, 10.0] range.
  14997. Default value is @code{1}.
  14998. @item win_func
  14999. Set window function.
  15000. It accepts the following values:
  15001. @table @samp
  15002. @item rect
  15003. @item bartlett
  15004. @item hann
  15005. @item hanning
  15006. @item hamming
  15007. @item blackman
  15008. @item welch
  15009. @item flattop
  15010. @item bharris
  15011. @item bnuttall
  15012. @item bhann
  15013. @item sine
  15014. @item nuttall
  15015. @item lanczos
  15016. @item gauss
  15017. @item tukey
  15018. @item dolph
  15019. @item cauchy
  15020. @item parzen
  15021. @item poisson
  15022. @end table
  15023. Default value is @code{hann}.
  15024. @item orientation
  15025. Set orientation of time vs frequency axis. Can be @code{vertical} or
  15026. @code{horizontal}. Default is @code{vertical}.
  15027. @item overlap
  15028. Set ratio of overlap window. Default value is @code{0}.
  15029. When value is @code{1} overlap is set to recommended size for specific
  15030. window function currently used.
  15031. @item gain
  15032. Set scale gain for calculating intensity color values.
  15033. Default value is @code{1}.
  15034. @item data
  15035. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  15036. @item rotation
  15037. Set color rotation, must be in [-1.0, 1.0] range.
  15038. Default value is @code{0}.
  15039. @end table
  15040. The usage is very similar to the showwaves filter; see the examples in that
  15041. section.
  15042. @subsection Examples
  15043. @itemize
  15044. @item
  15045. Large window with logarithmic color scaling:
  15046. @example
  15047. showspectrum=s=1280x480:scale=log
  15048. @end example
  15049. @item
  15050. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  15051. @example
  15052. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  15053. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  15054. @end example
  15055. @end itemize
  15056. @section showspectrumpic
  15057. Convert input audio to a single video frame, representing the audio frequency
  15058. spectrum.
  15059. The filter accepts the following options:
  15060. @table @option
  15061. @item size, s
  15062. Specify the video size for the output. For the syntax of this option, check the
  15063. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15064. Default value is @code{4096x2048}.
  15065. @item mode
  15066. Specify display mode.
  15067. It accepts the following values:
  15068. @table @samp
  15069. @item combined
  15070. all channels are displayed in the same row
  15071. @item separate
  15072. all channels are displayed in separate rows
  15073. @end table
  15074. Default value is @samp{combined}.
  15075. @item color
  15076. Specify display color mode.
  15077. It accepts the following values:
  15078. @table @samp
  15079. @item channel
  15080. each channel is displayed in a separate color
  15081. @item intensity
  15082. each channel is displayed using the same color scheme
  15083. @item rainbow
  15084. each channel is displayed using the rainbow color scheme
  15085. @item moreland
  15086. each channel is displayed using the moreland color scheme
  15087. @item nebulae
  15088. each channel is displayed using the nebulae color scheme
  15089. @item fire
  15090. each channel is displayed using the fire color scheme
  15091. @item fiery
  15092. each channel is displayed using the fiery color scheme
  15093. @item fruit
  15094. each channel is displayed using the fruit color scheme
  15095. @item cool
  15096. each channel is displayed using the cool color scheme
  15097. @end table
  15098. Default value is @samp{intensity}.
  15099. @item scale
  15100. Specify scale used for calculating intensity color values.
  15101. It accepts the following values:
  15102. @table @samp
  15103. @item lin
  15104. linear
  15105. @item sqrt
  15106. square root, default
  15107. @item cbrt
  15108. cubic root
  15109. @item log
  15110. logarithmic
  15111. @item 4thrt
  15112. 4th root
  15113. @item 5thrt
  15114. 5th root
  15115. @end table
  15116. Default value is @samp{log}.
  15117. @item saturation
  15118. Set saturation modifier for displayed colors. Negative values provide
  15119. alternative color scheme. @code{0} is no saturation at all.
  15120. Saturation must be in [-10.0, 10.0] range.
  15121. Default value is @code{1}.
  15122. @item win_func
  15123. Set window function.
  15124. It accepts the following values:
  15125. @table @samp
  15126. @item rect
  15127. @item bartlett
  15128. @item hann
  15129. @item hanning
  15130. @item hamming
  15131. @item blackman
  15132. @item welch
  15133. @item flattop
  15134. @item bharris
  15135. @item bnuttall
  15136. @item bhann
  15137. @item sine
  15138. @item nuttall
  15139. @item lanczos
  15140. @item gauss
  15141. @item tukey
  15142. @item dolph
  15143. @item cauchy
  15144. @item parzen
  15145. @item poisson
  15146. @end table
  15147. Default value is @code{hann}.
  15148. @item orientation
  15149. Set orientation of time vs frequency axis. Can be @code{vertical} or
  15150. @code{horizontal}. Default is @code{vertical}.
  15151. @item gain
  15152. Set scale gain for calculating intensity color values.
  15153. Default value is @code{1}.
  15154. @item legend
  15155. Draw time and frequency axes and legends. Default is enabled.
  15156. @item rotation
  15157. Set color rotation, must be in [-1.0, 1.0] range.
  15158. Default value is @code{0}.
  15159. @end table
  15160. @subsection Examples
  15161. @itemize
  15162. @item
  15163. Extract an audio spectrogram of a whole audio track
  15164. in a 1024x1024 picture using @command{ffmpeg}:
  15165. @example
  15166. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  15167. @end example
  15168. @end itemize
  15169. @section showvolume
  15170. Convert input audio volume to a video output.
  15171. The filter accepts the following options:
  15172. @table @option
  15173. @item rate, r
  15174. Set video rate.
  15175. @item b
  15176. Set border width, allowed range is [0, 5]. Default is 1.
  15177. @item w
  15178. Set channel width, allowed range is [80, 8192]. Default is 400.
  15179. @item h
  15180. Set channel height, allowed range is [1, 900]. Default is 20.
  15181. @item f
  15182. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  15183. @item c
  15184. Set volume color expression.
  15185. The expression can use the following variables:
  15186. @table @option
  15187. @item VOLUME
  15188. Current max volume of channel in dB.
  15189. @item PEAK
  15190. Current peak.
  15191. @item CHANNEL
  15192. Current channel number, starting from 0.
  15193. @end table
  15194. @item t
  15195. If set, displays channel names. Default is enabled.
  15196. @item v
  15197. If set, displays volume values. Default is enabled.
  15198. @item o
  15199. Set orientation, can be @code{horizontal} or @code{vertical},
  15200. default is @code{horizontal}.
  15201. @item s
  15202. Set step size, allowed range s [0, 5]. Default is 0, which means
  15203. step is disabled.
  15204. @end table
  15205. @section showwaves
  15206. Convert input audio to a video output, representing the samples waves.
  15207. The filter accepts the following options:
  15208. @table @option
  15209. @item size, s
  15210. Specify the video size for the output. For the syntax of this option, check the
  15211. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15212. Default value is @code{600x240}.
  15213. @item mode
  15214. Set display mode.
  15215. Available values are:
  15216. @table @samp
  15217. @item point
  15218. Draw a point for each sample.
  15219. @item line
  15220. Draw a vertical line for each sample.
  15221. @item p2p
  15222. Draw a point for each sample and a line between them.
  15223. @item cline
  15224. Draw a centered vertical line for each sample.
  15225. @end table
  15226. Default value is @code{point}.
  15227. @item n
  15228. Set the number of samples which are printed on the same column. A
  15229. larger value will decrease the frame rate. Must be a positive
  15230. integer. This option can be set only if the value for @var{rate}
  15231. is not explicitly specified.
  15232. @item rate, r
  15233. Set the (approximate) output frame rate. This is done by setting the
  15234. option @var{n}. Default value is "25".
  15235. @item split_channels
  15236. Set if channels should be drawn separately or overlap. Default value is 0.
  15237. @item colors
  15238. Set colors separated by '|' which are going to be used for drawing of each channel.
  15239. @item scale
  15240. Set amplitude scale.
  15241. Available values are:
  15242. @table @samp
  15243. @item lin
  15244. Linear.
  15245. @item log
  15246. Logarithmic.
  15247. @item sqrt
  15248. Square root.
  15249. @item cbrt
  15250. Cubic root.
  15251. @end table
  15252. Default is linear.
  15253. @end table
  15254. @subsection Examples
  15255. @itemize
  15256. @item
  15257. Output the input file audio and the corresponding video representation
  15258. at the same time:
  15259. @example
  15260. amovie=a.mp3,asplit[out0],showwaves[out1]
  15261. @end example
  15262. @item
  15263. Create a synthetic signal and show it with showwaves, forcing a
  15264. frame rate of 30 frames per second:
  15265. @example
  15266. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  15267. @end example
  15268. @end itemize
  15269. @section showwavespic
  15270. Convert input audio to a single video frame, 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 split_channels
  15278. Set if channels should be drawn separately or overlap. Default value is 0.
  15279. @item colors
  15280. Set colors separated by '|' which are going to be used for drawing of each channel.
  15281. @item scale
  15282. Set amplitude scale.
  15283. Available values are:
  15284. @table @samp
  15285. @item lin
  15286. Linear.
  15287. @item log
  15288. Logarithmic.
  15289. @item sqrt
  15290. Square root.
  15291. @item cbrt
  15292. Cubic root.
  15293. @end table
  15294. Default is linear.
  15295. @end table
  15296. @subsection Examples
  15297. @itemize
  15298. @item
  15299. Extract a channel split representation of the wave form of a whole audio track
  15300. in a 1024x800 picture using @command{ffmpeg}:
  15301. @example
  15302. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  15303. @end example
  15304. @end itemize
  15305. @section sidedata, asidedata
  15306. Delete frame side data, or select frames based on it.
  15307. This filter accepts the following options:
  15308. @table @option
  15309. @item mode
  15310. Set mode of operation of the filter.
  15311. Can be one of the following:
  15312. @table @samp
  15313. @item select
  15314. Select every frame with side data of @code{type}.
  15315. @item delete
  15316. Delete side data of @code{type}. If @code{type} is not set, delete all side
  15317. data in the frame.
  15318. @end table
  15319. @item type
  15320. Set side data type used with all modes. Must be set for @code{select} mode. For
  15321. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  15322. in @file{libavutil/frame.h}. For example, to choose
  15323. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  15324. @end table
  15325. @section spectrumsynth
  15326. Sythesize audio from 2 input video spectrums, first input stream represents
  15327. magnitude across time and second represents phase across time.
  15328. The filter will transform from frequency domain as displayed in videos back
  15329. to time domain as presented in audio output.
  15330. This filter is primarily created for reversing processed @ref{showspectrum}
  15331. filter outputs, but can synthesize sound from other spectrograms too.
  15332. But in such case results are going to be poor if the phase data is not
  15333. available, because in such cases phase data need to be recreated, usually
  15334. its just recreated from random noise.
  15335. For best results use gray only output (@code{channel} color mode in
  15336. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  15337. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  15338. @code{data} option. Inputs videos should generally use @code{fullframe}
  15339. slide mode as that saves resources needed for decoding video.
  15340. The filter accepts the following options:
  15341. @table @option
  15342. @item sample_rate
  15343. Specify sample rate of output audio, the sample rate of audio from which
  15344. spectrum was generated may differ.
  15345. @item channels
  15346. Set number of channels represented in input video spectrums.
  15347. @item scale
  15348. Set scale which was used when generating magnitude input spectrum.
  15349. Can be @code{lin} or @code{log}. Default is @code{log}.
  15350. @item slide
  15351. Set slide which was used when generating inputs spectrums.
  15352. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  15353. Default is @code{fullframe}.
  15354. @item win_func
  15355. Set window function used for resynthesis.
  15356. @item overlap
  15357. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  15358. which means optimal overlap for selected window function will be picked.
  15359. @item orientation
  15360. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  15361. Default is @code{vertical}.
  15362. @end table
  15363. @subsection Examples
  15364. @itemize
  15365. @item
  15366. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  15367. then resynthesize videos back to audio with spectrumsynth:
  15368. @example
  15369. 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
  15370. 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
  15371. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  15372. @end example
  15373. @end itemize
  15374. @section split, asplit
  15375. Split input into several identical outputs.
  15376. @code{asplit} works with audio input, @code{split} with video.
  15377. The filter accepts a single parameter which specifies the number of outputs. If
  15378. unspecified, it defaults to 2.
  15379. @subsection Examples
  15380. @itemize
  15381. @item
  15382. Create two separate outputs from the same input:
  15383. @example
  15384. [in] split [out0][out1]
  15385. @end example
  15386. @item
  15387. To create 3 or more outputs, you need to specify the number of
  15388. outputs, like in:
  15389. @example
  15390. [in] asplit=3 [out0][out1][out2]
  15391. @end example
  15392. @item
  15393. Create two separate outputs from the same input, one cropped and
  15394. one padded:
  15395. @example
  15396. [in] split [splitout1][splitout2];
  15397. [splitout1] crop=100:100:0:0 [cropout];
  15398. [splitout2] pad=200:200:100:100 [padout];
  15399. @end example
  15400. @item
  15401. Create 5 copies of the input audio with @command{ffmpeg}:
  15402. @example
  15403. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  15404. @end example
  15405. @end itemize
  15406. @section zmq, azmq
  15407. Receive commands sent through a libzmq client, and forward them to
  15408. filters in the filtergraph.
  15409. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  15410. must be inserted between two video filters, @code{azmq} between two
  15411. audio filters.
  15412. To enable these filters you need to install the libzmq library and
  15413. headers and configure FFmpeg with @code{--enable-libzmq}.
  15414. For more information about libzmq see:
  15415. @url{http://www.zeromq.org/}
  15416. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  15417. receives messages sent through a network interface defined by the
  15418. @option{bind_address} option.
  15419. The received message must be in the form:
  15420. @example
  15421. @var{TARGET} @var{COMMAND} [@var{ARG}]
  15422. @end example
  15423. @var{TARGET} specifies the target of the command, usually the name of
  15424. the filter class or a specific filter instance name.
  15425. @var{COMMAND} specifies the name of the command for the target filter.
  15426. @var{ARG} is optional and specifies the optional argument list for the
  15427. given @var{COMMAND}.
  15428. Upon reception, the message is processed and the corresponding command
  15429. is injected into the filtergraph. Depending on the result, the filter
  15430. will send a reply to the client, adopting the format:
  15431. @example
  15432. @var{ERROR_CODE} @var{ERROR_REASON}
  15433. @var{MESSAGE}
  15434. @end example
  15435. @var{MESSAGE} is optional.
  15436. @subsection Examples
  15437. Look at @file{tools/zmqsend} for an example of a zmq client which can
  15438. be used to send commands processed by these filters.
  15439. Consider the following filtergraph generated by @command{ffplay}
  15440. @example
  15441. ffplay -dumpgraph 1 -f lavfi "
  15442. color=s=100x100:c=red [l];
  15443. color=s=100x100:c=blue [r];
  15444. nullsrc=s=200x100, zmq [bg];
  15445. [bg][l] overlay [bg+l];
  15446. [bg+l][r] overlay=x=100 "
  15447. @end example
  15448. To change the color of the left side of the video, the following
  15449. command can be used:
  15450. @example
  15451. echo Parsed_color_0 c yellow | tools/zmqsend
  15452. @end example
  15453. To change the right side:
  15454. @example
  15455. echo Parsed_color_1 c pink | tools/zmqsend
  15456. @end example
  15457. @c man end MULTIMEDIA FILTERS
  15458. @chapter Multimedia Sources
  15459. @c man begin MULTIMEDIA SOURCES
  15460. Below is a description of the currently available multimedia sources.
  15461. @section amovie
  15462. This is the same as @ref{movie} source, except it selects an audio
  15463. stream by default.
  15464. @anchor{movie}
  15465. @section movie
  15466. Read audio and/or video stream(s) from a movie container.
  15467. It accepts the following parameters:
  15468. @table @option
  15469. @item filename
  15470. The name of the resource to read (not necessarily a file; it can also be a
  15471. device or a stream accessed through some protocol).
  15472. @item format_name, f
  15473. Specifies the format assumed for the movie to read, and can be either
  15474. the name of a container or an input device. If not specified, the
  15475. format is guessed from @var{movie_name} or by probing.
  15476. @item seek_point, sp
  15477. Specifies the seek point in seconds. The frames will be output
  15478. starting from this seek point. The parameter is evaluated with
  15479. @code{av_strtod}, so the numerical value may be suffixed by an IS
  15480. postfix. The default value is "0".
  15481. @item streams, s
  15482. Specifies the streams to read. Several streams can be specified,
  15483. separated by "+". The source will then have as many outputs, in the
  15484. same order. The syntax is explained in the ``Stream specifiers''
  15485. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  15486. respectively the default (best suited) video and audio stream. Default
  15487. is "dv", or "da" if the filter is called as "amovie".
  15488. @item stream_index, si
  15489. Specifies the index of the video stream to read. If the value is -1,
  15490. the most suitable video stream will be automatically selected. The default
  15491. value is "-1". Deprecated. If the filter is called "amovie", it will select
  15492. audio instead of video.
  15493. @item loop
  15494. Specifies how many times to read the stream in sequence.
  15495. If the value is 0, the stream will be looped infinitely.
  15496. Default value is "1".
  15497. Note that when the movie is looped the source timestamps are not
  15498. changed, so it will generate non monotonically increasing timestamps.
  15499. @item discontinuity
  15500. Specifies the time difference between frames above which the point is
  15501. considered a timestamp discontinuity which is removed by adjusting the later
  15502. timestamps.
  15503. @end table
  15504. It allows overlaying a second video on top of the main input of
  15505. a filtergraph, as shown in this graph:
  15506. @example
  15507. input -----------> deltapts0 --> overlay --> output
  15508. ^
  15509. |
  15510. movie --> scale--> deltapts1 -------+
  15511. @end example
  15512. @subsection Examples
  15513. @itemize
  15514. @item
  15515. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  15516. on top of the input labelled "in":
  15517. @example
  15518. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  15519. [in] setpts=PTS-STARTPTS [main];
  15520. [main][over] overlay=16:16 [out]
  15521. @end example
  15522. @item
  15523. Read from a video4linux2 device, and overlay it on top of the input
  15524. labelled "in":
  15525. @example
  15526. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  15527. [in] setpts=PTS-STARTPTS [main];
  15528. [main][over] overlay=16:16 [out]
  15529. @end example
  15530. @item
  15531. Read the first video stream and the audio stream with id 0x81 from
  15532. dvd.vob; the video is connected to the pad named "video" and the audio is
  15533. connected to the pad named "audio":
  15534. @example
  15535. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  15536. @end example
  15537. @end itemize
  15538. @subsection Commands
  15539. Both movie and amovie support the following commands:
  15540. @table @option
  15541. @item seek
  15542. Perform seek using "av_seek_frame".
  15543. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  15544. @itemize
  15545. @item
  15546. @var{stream_index}: If stream_index is -1, a default
  15547. stream is selected, and @var{timestamp} is automatically converted
  15548. from AV_TIME_BASE units to the stream specific time_base.
  15549. @item
  15550. @var{timestamp}: Timestamp in AVStream.time_base units
  15551. or, if no stream is specified, in AV_TIME_BASE units.
  15552. @item
  15553. @var{flags}: Flags which select direction and seeking mode.
  15554. @end itemize
  15555. @item get_duration
  15556. Get movie duration in AV_TIME_BASE units.
  15557. @end table
  15558. @c man end MULTIMEDIA SOURCES