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.

19572 lines
519KB

  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. @section afir
  735. Apply an arbitrary Frequency Impulse Response filter.
  736. This filter is designed for applying long FIR filters,
  737. up to 30 seconds long.
  738. It can be used as component for digital crossover filters,
  739. room equalization, cross talk cancellation, wavefield synthesis,
  740. auralization, ambiophonics and ambisonics.
  741. This filter uses second stream as FIR coefficients.
  742. If second stream holds single channel, it will be used
  743. for all input channels in first stream, otherwise
  744. number of channels in second stream must be same as
  745. number of channels in first stream.
  746. It accepts the following parameters:
  747. @table @option
  748. @item dry
  749. Set dry gain. This sets input gain.
  750. @item wet
  751. Set wet gain. This sets final output gain.
  752. @item length
  753. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  754. @item again
  755. Enable applying gain measured from power of IR.
  756. @end table
  757. @subsection Examples
  758. @itemize
  759. @item
  760. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  761. @example
  762. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  763. @end example
  764. @end itemize
  765. @anchor{aformat}
  766. @section aformat
  767. Set output format constraints for the input audio. The framework will
  768. negotiate the most appropriate format to minimize conversions.
  769. It accepts the following parameters:
  770. @table @option
  771. @item sample_fmts
  772. A '|'-separated list of requested sample formats.
  773. @item sample_rates
  774. A '|'-separated list of requested sample rates.
  775. @item channel_layouts
  776. A '|'-separated list of requested channel layouts.
  777. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  778. for the required syntax.
  779. @end table
  780. If a parameter is omitted, all values are allowed.
  781. Force the output to either unsigned 8-bit or signed 16-bit stereo
  782. @example
  783. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  784. @end example
  785. @section agate
  786. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  787. processing reduces disturbing noise between useful signals.
  788. Gating is done by detecting the volume below a chosen level @var{threshold}
  789. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  790. floor is set via @var{range}. Because an exact manipulation of the signal
  791. would cause distortion of the waveform the reduction can be levelled over
  792. time. This is done by setting @var{attack} and @var{release}.
  793. @var{attack} determines how long the signal has to fall below the threshold
  794. before any reduction will occur and @var{release} sets the time the signal
  795. has to rise above the threshold to reduce the reduction again.
  796. Shorter signals than the chosen attack time will be left untouched.
  797. @table @option
  798. @item level_in
  799. Set input level before filtering.
  800. Default is 1. Allowed range is from 0.015625 to 64.
  801. @item range
  802. Set the level of gain reduction when the signal is below the threshold.
  803. Default is 0.06125. Allowed range is from 0 to 1.
  804. @item threshold
  805. If a signal rises above this level the gain reduction is released.
  806. Default is 0.125. Allowed range is from 0 to 1.
  807. @item ratio
  808. Set a ratio by which the signal is reduced.
  809. Default is 2. Allowed range is from 1 to 9000.
  810. @item attack
  811. Amount of milliseconds the signal has to rise above the threshold before gain
  812. reduction stops.
  813. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  814. @item release
  815. Amount of milliseconds the signal has to fall below the threshold before the
  816. reduction is increased again. Default is 250 milliseconds.
  817. Allowed range is from 0.01 to 9000.
  818. @item makeup
  819. Set amount of amplification of signal after processing.
  820. Default is 1. Allowed range is from 1 to 64.
  821. @item knee
  822. Curve the sharp knee around the threshold to enter gain reduction more softly.
  823. Default is 2.828427125. Allowed range is from 1 to 8.
  824. @item detection
  825. Choose if exact signal should be taken for detection or an RMS like one.
  826. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  827. @item link
  828. Choose if the average level between all channels or the louder channel affects
  829. the reduction.
  830. Default is @code{average}. Can be @code{average} or @code{maximum}.
  831. @end table
  832. @section alimiter
  833. The limiter prevents an input signal from rising over a desired threshold.
  834. This limiter uses lookahead technology to prevent your signal from distorting.
  835. It means that there is a small delay after the signal is processed. Keep in mind
  836. that the delay it produces is the attack time you set.
  837. The filter accepts the following options:
  838. @table @option
  839. @item level_in
  840. Set input gain. Default is 1.
  841. @item level_out
  842. Set output gain. Default is 1.
  843. @item limit
  844. Don't let signals above this level pass the limiter. Default is 1.
  845. @item attack
  846. The limiter will reach its attenuation level in this amount of time in
  847. milliseconds. Default is 5 milliseconds.
  848. @item release
  849. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  850. Default is 50 milliseconds.
  851. @item asc
  852. When gain reduction is always needed ASC takes care of releasing to an
  853. average reduction level rather than reaching a reduction of 0 in the release
  854. time.
  855. @item asc_level
  856. Select how much the release time is affected by ASC, 0 means nearly no changes
  857. in release time while 1 produces higher release times.
  858. @item level
  859. Auto level output signal. Default is enabled.
  860. This normalizes audio back to 0dB if enabled.
  861. @end table
  862. Depending on picked setting it is recommended to upsample input 2x or 4x times
  863. with @ref{aresample} before applying this filter.
  864. @section allpass
  865. Apply a two-pole all-pass filter with central frequency (in Hz)
  866. @var{frequency}, and filter-width @var{width}.
  867. An all-pass filter changes the audio's frequency to phase relationship
  868. without changing its frequency to amplitude relationship.
  869. The filter accepts the following options:
  870. @table @option
  871. @item frequency, f
  872. Set frequency in Hz.
  873. @item width_type, t
  874. Set method to specify band-width of filter.
  875. @table @option
  876. @item h
  877. Hz
  878. @item q
  879. Q-Factor
  880. @item o
  881. octave
  882. @item s
  883. slope
  884. @end table
  885. @item width, w
  886. Specify the band-width of a filter in width_type units.
  887. @item channels, c
  888. Specify which channels to filter, by default all available are filtered.
  889. @end table
  890. @section aloop
  891. Loop audio samples.
  892. The filter accepts the following options:
  893. @table @option
  894. @item loop
  895. Set the number of loops. Setting this value to -1 will result in infinite loops.
  896. Default is 0.
  897. @item size
  898. Set maximal number of samples. Default is 0.
  899. @item start
  900. Set first sample of loop. Default is 0.
  901. @end table
  902. @anchor{amerge}
  903. @section amerge
  904. Merge two or more audio streams into a single multi-channel stream.
  905. The filter accepts the following options:
  906. @table @option
  907. @item inputs
  908. Set the number of inputs. Default is 2.
  909. @end table
  910. If the channel layouts of the inputs are disjoint, and therefore compatible,
  911. the channel layout of the output will be set accordingly and the channels
  912. will be reordered as necessary. If the channel layouts of the inputs are not
  913. disjoint, the output will have all the channels of the first input then all
  914. the channels of the second input, in that order, and the channel layout of
  915. the output will be the default value corresponding to the total number of
  916. channels.
  917. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  918. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  919. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  920. first input, b1 is the first channel of the second input).
  921. On the other hand, if both input are in stereo, the output channels will be
  922. in the default order: a1, a2, b1, b2, and the channel layout will be
  923. arbitrarily set to 4.0, which may or may not be the expected value.
  924. All inputs must have the same sample rate, and format.
  925. If inputs do not have the same duration, the output will stop with the
  926. shortest.
  927. @subsection Examples
  928. @itemize
  929. @item
  930. Merge two mono files into a stereo stream:
  931. @example
  932. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  933. @end example
  934. @item
  935. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  936. @example
  937. 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
  938. @end example
  939. @end itemize
  940. @section amix
  941. Mixes multiple audio inputs into a single output.
  942. Note that this filter only supports float samples (the @var{amerge}
  943. and @var{pan} audio filters support many formats). If the @var{amix}
  944. input has integer samples then @ref{aresample} will be automatically
  945. inserted to perform the conversion to float samples.
  946. For example
  947. @example
  948. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  949. @end example
  950. will mix 3 input audio streams to a single output with the same duration as the
  951. first input and a dropout transition time of 3 seconds.
  952. It accepts the following parameters:
  953. @table @option
  954. @item inputs
  955. The number of inputs. If unspecified, it defaults to 2.
  956. @item duration
  957. How to determine the end-of-stream.
  958. @table @option
  959. @item longest
  960. The duration of the longest input. (default)
  961. @item shortest
  962. The duration of the shortest input.
  963. @item first
  964. The duration of the first input.
  965. @end table
  966. @item dropout_transition
  967. The transition time, in seconds, for volume renormalization when an input
  968. stream ends. The default value is 2 seconds.
  969. @end table
  970. @section anequalizer
  971. High-order parametric multiband equalizer for each channel.
  972. It accepts the following parameters:
  973. @table @option
  974. @item params
  975. This option string is in format:
  976. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  977. Each equalizer band is separated by '|'.
  978. @table @option
  979. @item chn
  980. Set channel number to which equalization will be applied.
  981. If input doesn't have that channel the entry is ignored.
  982. @item f
  983. Set central frequency for band.
  984. If input doesn't have that frequency the entry is ignored.
  985. @item w
  986. Set band width in hertz.
  987. @item g
  988. Set band gain in dB.
  989. @item t
  990. Set filter type for band, optional, can be:
  991. @table @samp
  992. @item 0
  993. Butterworth, this is default.
  994. @item 1
  995. Chebyshev type 1.
  996. @item 2
  997. Chebyshev type 2.
  998. @end table
  999. @end table
  1000. @item curves
  1001. With this option activated frequency response of anequalizer is displayed
  1002. in video stream.
  1003. @item size
  1004. Set video stream size. Only useful if curves option is activated.
  1005. @item mgain
  1006. Set max gain that will be displayed. Only useful if curves option is activated.
  1007. Setting this to a reasonable value makes it possible to display gain which is derived from
  1008. neighbour bands which are too close to each other and thus produce higher gain
  1009. when both are activated.
  1010. @item fscale
  1011. Set frequency scale used to draw frequency response in video output.
  1012. Can be linear or logarithmic. Default is logarithmic.
  1013. @item colors
  1014. Set color for each channel curve which is going to be displayed in video stream.
  1015. This is list of color names separated by space or by '|'.
  1016. Unrecognised or missing colors will be replaced by white color.
  1017. @end table
  1018. @subsection Examples
  1019. @itemize
  1020. @item
  1021. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1022. for first 2 channels using Chebyshev type 1 filter:
  1023. @example
  1024. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1025. @end example
  1026. @end itemize
  1027. @subsection Commands
  1028. This filter supports the following commands:
  1029. @table @option
  1030. @item change
  1031. Alter existing filter parameters.
  1032. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1033. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1034. error is returned.
  1035. @var{freq} set new frequency parameter.
  1036. @var{width} set new width parameter in herz.
  1037. @var{gain} set new gain parameter in dB.
  1038. Full filter invocation with asendcmd may look like this:
  1039. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1040. @end table
  1041. @section anull
  1042. Pass the audio source unchanged to the output.
  1043. @section apad
  1044. Pad the end of an audio stream with silence.
  1045. This can be used together with @command{ffmpeg} @option{-shortest} to
  1046. extend audio streams to the same length as the video stream.
  1047. A description of the accepted options follows.
  1048. @table @option
  1049. @item packet_size
  1050. Set silence packet size. Default value is 4096.
  1051. @item pad_len
  1052. Set the number of samples of silence to add to the end. After the
  1053. value is reached, the stream is terminated. This option is mutually
  1054. exclusive with @option{whole_len}.
  1055. @item whole_len
  1056. Set the minimum total number of samples in the output audio stream. If
  1057. the value is longer than the input audio length, silence is added to
  1058. the end, until the value is reached. This option is mutually exclusive
  1059. with @option{pad_len}.
  1060. @end table
  1061. If neither the @option{pad_len} nor the @option{whole_len} option is
  1062. set, the filter will add silence to the end of the input stream
  1063. indefinitely.
  1064. @subsection Examples
  1065. @itemize
  1066. @item
  1067. Add 1024 samples of silence to the end of the input:
  1068. @example
  1069. apad=pad_len=1024
  1070. @end example
  1071. @item
  1072. Make sure the audio output will contain at least 10000 samples, pad
  1073. the input with silence if required:
  1074. @example
  1075. apad=whole_len=10000
  1076. @end example
  1077. @item
  1078. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1079. video stream will always result the shortest and will be converted
  1080. until the end in the output file when using the @option{shortest}
  1081. option:
  1082. @example
  1083. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1084. @end example
  1085. @end itemize
  1086. @section aphaser
  1087. Add a phasing effect to the input audio.
  1088. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1089. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1090. A description of the accepted parameters follows.
  1091. @table @option
  1092. @item in_gain
  1093. Set input gain. Default is 0.4.
  1094. @item out_gain
  1095. Set output gain. Default is 0.74
  1096. @item delay
  1097. Set delay in milliseconds. Default is 3.0.
  1098. @item decay
  1099. Set decay. Default is 0.4.
  1100. @item speed
  1101. Set modulation speed in Hz. Default is 0.5.
  1102. @item type
  1103. Set modulation type. Default is triangular.
  1104. It accepts the following values:
  1105. @table @samp
  1106. @item triangular, t
  1107. @item sinusoidal, s
  1108. @end table
  1109. @end table
  1110. @section apulsator
  1111. Audio pulsator is something between an autopanner and a tremolo.
  1112. But it can produce funny stereo effects as well. Pulsator changes the volume
  1113. of the left and right channel based on a LFO (low frequency oscillator) with
  1114. different waveforms and shifted phases.
  1115. This filter have the ability to define an offset between left and right
  1116. channel. An offset of 0 means that both LFO shapes match each other.
  1117. The left and right channel are altered equally - a conventional tremolo.
  1118. An offset of 50% means that the shape of the right channel is exactly shifted
  1119. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1120. an autopanner. At 1 both curves match again. Every setting in between moves the
  1121. phase shift gapless between all stages and produces some "bypassing" sounds with
  1122. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1123. the 0.5) the faster the signal passes from the left to the right speaker.
  1124. The filter accepts the following options:
  1125. @table @option
  1126. @item level_in
  1127. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1128. @item level_out
  1129. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1130. @item mode
  1131. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1132. sawup or sawdown. Default is sine.
  1133. @item amount
  1134. Set modulation. Define how much of original signal is affected by the LFO.
  1135. @item offset_l
  1136. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1137. @item offset_r
  1138. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1139. @item width
  1140. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1141. @item timing
  1142. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1143. @item bpm
  1144. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1145. is set to bpm.
  1146. @item ms
  1147. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1148. is set to ms.
  1149. @item hz
  1150. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1151. if timing is set to hz.
  1152. @end table
  1153. @anchor{aresample}
  1154. @section aresample
  1155. Resample the input audio to the specified parameters, using the
  1156. libswresample library. If none are specified then the filter will
  1157. automatically convert between its input and output.
  1158. This filter is also able to stretch/squeeze the audio data to make it match
  1159. the timestamps or to inject silence / cut out audio to make it match the
  1160. timestamps, do a combination of both or do neither.
  1161. The filter accepts the syntax
  1162. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1163. expresses a sample rate and @var{resampler_options} is a list of
  1164. @var{key}=@var{value} pairs, separated by ":". See the
  1165. @ref{Resampler Options,,the "Resampler Options" section in the
  1166. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1167. for the complete list of supported options.
  1168. @subsection Examples
  1169. @itemize
  1170. @item
  1171. Resample the input audio to 44100Hz:
  1172. @example
  1173. aresample=44100
  1174. @end example
  1175. @item
  1176. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1177. samples per second compensation:
  1178. @example
  1179. aresample=async=1000
  1180. @end example
  1181. @end itemize
  1182. @section areverse
  1183. Reverse an audio clip.
  1184. Warning: This filter requires memory to buffer the entire clip, so trimming
  1185. is suggested.
  1186. @subsection Examples
  1187. @itemize
  1188. @item
  1189. Take the first 5 seconds of a clip, and reverse it.
  1190. @example
  1191. atrim=end=5,areverse
  1192. @end example
  1193. @end itemize
  1194. @section asetnsamples
  1195. Set the number of samples per each output audio frame.
  1196. The last output packet may contain a different number of samples, as
  1197. the filter will flush all the remaining samples when the input audio
  1198. signals its end.
  1199. The filter accepts the following options:
  1200. @table @option
  1201. @item nb_out_samples, n
  1202. Set the number of frames per each output audio frame. The number is
  1203. intended as the number of samples @emph{per each channel}.
  1204. Default value is 1024.
  1205. @item pad, p
  1206. If set to 1, the filter will pad the last audio frame with zeroes, so
  1207. that the last frame will contain the same number of samples as the
  1208. previous ones. Default value is 1.
  1209. @end table
  1210. For example, to set the number of per-frame samples to 1234 and
  1211. disable padding for the last frame, use:
  1212. @example
  1213. asetnsamples=n=1234:p=0
  1214. @end example
  1215. @section asetrate
  1216. Set the sample rate without altering the PCM data.
  1217. This will result in a change of speed and pitch.
  1218. The filter accepts the following options:
  1219. @table @option
  1220. @item sample_rate, r
  1221. Set the output sample rate. Default is 44100 Hz.
  1222. @end table
  1223. @section ashowinfo
  1224. Show a line containing various information for each input audio frame.
  1225. The input audio is not modified.
  1226. The shown line contains a sequence of key/value pairs of the form
  1227. @var{key}:@var{value}.
  1228. The following values are shown in the output:
  1229. @table @option
  1230. @item n
  1231. The (sequential) number of the input frame, starting from 0.
  1232. @item pts
  1233. The presentation timestamp of the input frame, in time base units; the time base
  1234. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1235. @item pts_time
  1236. The presentation timestamp of the input frame in seconds.
  1237. @item pos
  1238. position of the frame in the input stream, -1 if this information in
  1239. unavailable and/or meaningless (for example in case of synthetic audio)
  1240. @item fmt
  1241. The sample format.
  1242. @item chlayout
  1243. The channel layout.
  1244. @item rate
  1245. The sample rate for the audio frame.
  1246. @item nb_samples
  1247. The number of samples (per channel) in the frame.
  1248. @item checksum
  1249. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1250. audio, the data is treated as if all the planes were concatenated.
  1251. @item plane_checksums
  1252. A list of Adler-32 checksums for each data plane.
  1253. @end table
  1254. @anchor{astats}
  1255. @section astats
  1256. Display time domain statistical information about the audio channels.
  1257. Statistics are calculated and displayed for each audio channel and,
  1258. where applicable, an overall figure is also given.
  1259. It accepts the following option:
  1260. @table @option
  1261. @item length
  1262. Short window length in seconds, used for peak and trough RMS measurement.
  1263. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  1264. @item metadata
  1265. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1266. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1267. disabled.
  1268. Available keys for each channel are:
  1269. DC_offset
  1270. Min_level
  1271. Max_level
  1272. Min_difference
  1273. Max_difference
  1274. Mean_difference
  1275. RMS_difference
  1276. Peak_level
  1277. RMS_peak
  1278. RMS_trough
  1279. Crest_factor
  1280. Flat_factor
  1281. Peak_count
  1282. Bit_depth
  1283. Dynamic_range
  1284. and for Overall:
  1285. DC_offset
  1286. Min_level
  1287. Max_level
  1288. Min_difference
  1289. Max_difference
  1290. Mean_difference
  1291. RMS_difference
  1292. Peak_level
  1293. RMS_level
  1294. RMS_peak
  1295. RMS_trough
  1296. Flat_factor
  1297. Peak_count
  1298. Bit_depth
  1299. Number_of_samples
  1300. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1301. this @code{lavfi.astats.Overall.Peak_count}.
  1302. For description what each key means read below.
  1303. @item reset
  1304. Set number of frame after which stats are going to be recalculated.
  1305. Default is disabled.
  1306. @end table
  1307. A description of each shown parameter follows:
  1308. @table @option
  1309. @item DC offset
  1310. Mean amplitude displacement from zero.
  1311. @item Min level
  1312. Minimal sample level.
  1313. @item Max level
  1314. Maximal sample level.
  1315. @item Min difference
  1316. Minimal difference between two consecutive samples.
  1317. @item Max difference
  1318. Maximal difference between two consecutive samples.
  1319. @item Mean difference
  1320. Mean difference between two consecutive samples.
  1321. The average of each difference between two consecutive samples.
  1322. @item RMS difference
  1323. Root Mean Square difference between two consecutive samples.
  1324. @item Peak level dB
  1325. @item RMS level dB
  1326. Standard peak and RMS level measured in dBFS.
  1327. @item RMS peak dB
  1328. @item RMS trough dB
  1329. Peak and trough values for RMS level measured over a short window.
  1330. @item Crest factor
  1331. Standard ratio of peak to RMS level (note: not in dB).
  1332. @item Flat factor
  1333. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1334. (i.e. either @var{Min level} or @var{Max level}).
  1335. @item Peak count
  1336. Number of occasions (not the number of samples) that the signal attained either
  1337. @var{Min level} or @var{Max level}.
  1338. @item Bit depth
  1339. Overall bit depth of audio. Number of bits used for each sample.
  1340. @item Dynamic range
  1341. Measured dynamic range of audio in dB.
  1342. @end table
  1343. @section atempo
  1344. Adjust audio tempo.
  1345. The filter accepts exactly one parameter, the audio tempo. If not
  1346. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1347. be in the [0.5, 2.0] range.
  1348. @subsection Examples
  1349. @itemize
  1350. @item
  1351. Slow down audio to 80% tempo:
  1352. @example
  1353. atempo=0.8
  1354. @end example
  1355. @item
  1356. To speed up audio to 125% tempo:
  1357. @example
  1358. atempo=1.25
  1359. @end example
  1360. @end itemize
  1361. @section atrim
  1362. Trim the input so that the output contains one continuous subpart of the input.
  1363. It accepts the following parameters:
  1364. @table @option
  1365. @item start
  1366. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1367. sample with the timestamp @var{start} will be the first sample in the output.
  1368. @item end
  1369. Specify time of the first audio sample that will be dropped, i.e. the
  1370. audio sample immediately preceding the one with the timestamp @var{end} will be
  1371. the last sample in the output.
  1372. @item start_pts
  1373. Same as @var{start}, except this option sets the start timestamp in samples
  1374. instead of seconds.
  1375. @item end_pts
  1376. Same as @var{end}, except this option sets the end timestamp in samples instead
  1377. of seconds.
  1378. @item duration
  1379. The maximum duration of the output in seconds.
  1380. @item start_sample
  1381. The number of the first sample that should be output.
  1382. @item end_sample
  1383. The number of the first sample that should be dropped.
  1384. @end table
  1385. @option{start}, @option{end}, and @option{duration} are expressed as time
  1386. duration specifications; see
  1387. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1388. Note that the first two sets of the start/end options and the @option{duration}
  1389. option look at the frame timestamp, while the _sample options simply count the
  1390. samples that pass through the filter. So start/end_pts and start/end_sample will
  1391. give different results when the timestamps are wrong, inexact or do not start at
  1392. zero. Also note that this filter does not modify the timestamps. If you wish
  1393. to have the output timestamps start at zero, insert the asetpts filter after the
  1394. atrim filter.
  1395. If multiple start or end options are set, this filter tries to be greedy and
  1396. keep all samples that match at least one of the specified constraints. To keep
  1397. only the part that matches all the constraints at once, chain multiple atrim
  1398. filters.
  1399. The defaults are such that all the input is kept. So it is possible to set e.g.
  1400. just the end values to keep everything before the specified time.
  1401. Examples:
  1402. @itemize
  1403. @item
  1404. Drop everything except the second minute of input:
  1405. @example
  1406. ffmpeg -i INPUT -af atrim=60:120
  1407. @end example
  1408. @item
  1409. Keep only the first 1000 samples:
  1410. @example
  1411. ffmpeg -i INPUT -af atrim=end_sample=1000
  1412. @end example
  1413. @end itemize
  1414. @section bandpass
  1415. Apply a two-pole Butterworth band-pass filter with central
  1416. frequency @var{frequency}, and (3dB-point) band-width width.
  1417. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1418. instead of the default: constant 0dB peak gain.
  1419. The filter roll off at 6dB per octave (20dB per decade).
  1420. The filter accepts the following options:
  1421. @table @option
  1422. @item frequency, f
  1423. Set the filter's central frequency. Default is @code{3000}.
  1424. @item csg
  1425. Constant skirt gain if set to 1. Defaults to 0.
  1426. @item width_type, t
  1427. Set method to specify band-width of filter.
  1428. @table @option
  1429. @item h
  1430. Hz
  1431. @item q
  1432. Q-Factor
  1433. @item o
  1434. octave
  1435. @item s
  1436. slope
  1437. @end table
  1438. @item width, w
  1439. Specify the band-width of a filter in width_type units.
  1440. @item channels, c
  1441. Specify which channels to filter, by default all available are filtered.
  1442. @end table
  1443. @section bandreject
  1444. Apply a two-pole Butterworth band-reject filter with central
  1445. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1446. The filter roll off at 6dB per octave (20dB per decade).
  1447. The filter accepts the following options:
  1448. @table @option
  1449. @item frequency, f
  1450. Set the filter's central frequency. Default is @code{3000}.
  1451. @item width_type, t
  1452. Set method to specify band-width of filter.
  1453. @table @option
  1454. @item h
  1455. Hz
  1456. @item q
  1457. Q-Factor
  1458. @item o
  1459. octave
  1460. @item s
  1461. slope
  1462. @end table
  1463. @item width, w
  1464. Specify the band-width of a filter in width_type units.
  1465. @item channels, c
  1466. Specify which channels to filter, by default all available are filtered.
  1467. @end table
  1468. @section bass
  1469. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1470. shelving filter with a response similar to that of a standard
  1471. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1472. The filter accepts the following options:
  1473. @table @option
  1474. @item gain, g
  1475. Give the gain at 0 Hz. Its useful range is about -20
  1476. (for a large cut) to +20 (for a large boost).
  1477. Beware of clipping when using a positive gain.
  1478. @item frequency, f
  1479. Set the filter's central frequency and so can be used
  1480. to extend or reduce the frequency range to be boosted or cut.
  1481. The default value is @code{100} Hz.
  1482. @item width_type, t
  1483. Set method to specify band-width of filter.
  1484. @table @option
  1485. @item h
  1486. Hz
  1487. @item q
  1488. Q-Factor
  1489. @item o
  1490. octave
  1491. @item s
  1492. slope
  1493. @end table
  1494. @item width, w
  1495. Determine how steep is the filter's shelf transition.
  1496. @item channels, c
  1497. Specify which channels to filter, by default all available are filtered.
  1498. @end table
  1499. @section biquad
  1500. Apply a biquad IIR filter with the given coefficients.
  1501. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1502. are the numerator and denominator coefficients respectively.
  1503. and @var{channels}, @var{c} specify which channels to filter, by default all
  1504. available are filtered.
  1505. @section bs2b
  1506. Bauer stereo to binaural transformation, which improves headphone listening of
  1507. stereo audio records.
  1508. To enable compilation of this filter you need to configure FFmpeg with
  1509. @code{--enable-libbs2b}.
  1510. It accepts the following parameters:
  1511. @table @option
  1512. @item profile
  1513. Pre-defined crossfeed level.
  1514. @table @option
  1515. @item default
  1516. Default level (fcut=700, feed=50).
  1517. @item cmoy
  1518. Chu Moy circuit (fcut=700, feed=60).
  1519. @item jmeier
  1520. Jan Meier circuit (fcut=650, feed=95).
  1521. @end table
  1522. @item fcut
  1523. Cut frequency (in Hz).
  1524. @item feed
  1525. Feed level (in Hz).
  1526. @end table
  1527. @section channelmap
  1528. Remap input channels to new locations.
  1529. It accepts the following parameters:
  1530. @table @option
  1531. @item map
  1532. Map channels from input to output. The argument is a '|'-separated list of
  1533. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1534. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1535. channel (e.g. FL for front left) or its index in the input channel layout.
  1536. @var{out_channel} is the name of the output channel or its index in the output
  1537. channel layout. If @var{out_channel} is not given then it is implicitly an
  1538. index, starting with zero and increasing by one for each mapping.
  1539. @item channel_layout
  1540. The channel layout of the output stream.
  1541. @end table
  1542. If no mapping is present, the filter will implicitly map input channels to
  1543. output channels, preserving indices.
  1544. For example, assuming a 5.1+downmix input MOV file,
  1545. @example
  1546. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1547. @end example
  1548. will create an output WAV file tagged as stereo from the downmix channels of
  1549. the input.
  1550. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1551. @example
  1552. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1553. @end example
  1554. @section channelsplit
  1555. Split each channel from an input audio stream into a separate output stream.
  1556. It accepts the following parameters:
  1557. @table @option
  1558. @item channel_layout
  1559. The channel layout of the input stream. The default is "stereo".
  1560. @end table
  1561. For example, assuming a stereo input MP3 file,
  1562. @example
  1563. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1564. @end example
  1565. will create an output Matroska file with two audio streams, one containing only
  1566. the left channel and the other the right channel.
  1567. Split a 5.1 WAV file into per-channel files:
  1568. @example
  1569. ffmpeg -i in.wav -filter_complex
  1570. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1571. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1572. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1573. side_right.wav
  1574. @end example
  1575. @section chorus
  1576. Add a chorus effect to the audio.
  1577. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1578. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1579. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1580. The modulation depth defines the range the modulated delay is played before or after
  1581. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1582. sound tuned around the original one, like in a chorus where some vocals are slightly
  1583. off key.
  1584. It accepts the following parameters:
  1585. @table @option
  1586. @item in_gain
  1587. Set input gain. Default is 0.4.
  1588. @item out_gain
  1589. Set output gain. Default is 0.4.
  1590. @item delays
  1591. Set delays. A typical delay is around 40ms to 60ms.
  1592. @item decays
  1593. Set decays.
  1594. @item speeds
  1595. Set speeds.
  1596. @item depths
  1597. Set depths.
  1598. @end table
  1599. @subsection Examples
  1600. @itemize
  1601. @item
  1602. A single delay:
  1603. @example
  1604. chorus=0.7:0.9:55:0.4:0.25:2
  1605. @end example
  1606. @item
  1607. Two delays:
  1608. @example
  1609. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1610. @end example
  1611. @item
  1612. Fuller sounding chorus with three delays:
  1613. @example
  1614. 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
  1615. @end example
  1616. @end itemize
  1617. @section compand
  1618. Compress or expand the audio's dynamic range.
  1619. It accepts the following parameters:
  1620. @table @option
  1621. @item attacks
  1622. @item decays
  1623. A list of times in seconds for each channel over which the instantaneous level
  1624. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1625. increase of volume and @var{decays} refers to decrease of volume. For most
  1626. situations, the attack time (response to the audio getting louder) should be
  1627. shorter than the decay time, because the human ear is more sensitive to sudden
  1628. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1629. a typical value for decay is 0.8 seconds.
  1630. If specified number of attacks & decays is lower than number of channels, the last
  1631. set attack/decay will be used for all remaining channels.
  1632. @item points
  1633. A list of points for the transfer function, specified in dB relative to the
  1634. maximum possible signal amplitude. Each key points list must be defined using
  1635. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1636. @code{x0/y0 x1/y1 x2/y2 ....}
  1637. The input values must be in strictly increasing order but the transfer function
  1638. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1639. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1640. function are @code{-70/-70|-60/-20|1/0}.
  1641. @item soft-knee
  1642. Set the curve radius in dB for all joints. It defaults to 0.01.
  1643. @item gain
  1644. Set the additional gain in dB to be applied at all points on the transfer
  1645. function. This allows for easy adjustment of the overall gain.
  1646. It defaults to 0.
  1647. @item volume
  1648. Set an initial volume, in dB, to be assumed for each channel when filtering
  1649. starts. This permits the user to supply a nominal level initially, so that, for
  1650. example, a very large gain is not applied to initial signal levels before the
  1651. companding has begun to operate. A typical value for audio which is initially
  1652. quiet is -90 dB. It defaults to 0.
  1653. @item delay
  1654. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1655. delayed before being fed to the volume adjuster. Specifying a delay
  1656. approximately equal to the attack/decay times allows the filter to effectively
  1657. operate in predictive rather than reactive mode. It defaults to 0.
  1658. @end table
  1659. @subsection Examples
  1660. @itemize
  1661. @item
  1662. Make music with both quiet and loud passages suitable for listening to in a
  1663. noisy environment:
  1664. @example
  1665. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1666. @end example
  1667. Another example for audio with whisper and explosion parts:
  1668. @example
  1669. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1670. @end example
  1671. @item
  1672. A noise gate for when the noise is at a lower level than the signal:
  1673. @example
  1674. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1675. @end example
  1676. @item
  1677. Here is another noise gate, this time for when the noise is at a higher level
  1678. than the signal (making it, in some ways, similar to squelch):
  1679. @example
  1680. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1681. @end example
  1682. @item
  1683. 2:1 compression starting at -6dB:
  1684. @example
  1685. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1686. @end example
  1687. @item
  1688. 2:1 compression starting at -9dB:
  1689. @example
  1690. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1691. @end example
  1692. @item
  1693. 2:1 compression starting at -12dB:
  1694. @example
  1695. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1696. @end example
  1697. @item
  1698. 2:1 compression starting at -18dB:
  1699. @example
  1700. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1701. @end example
  1702. @item
  1703. 3:1 compression starting at -15dB:
  1704. @example
  1705. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1706. @end example
  1707. @item
  1708. Compressor/Gate:
  1709. @example
  1710. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1711. @end example
  1712. @item
  1713. Expander:
  1714. @example
  1715. 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
  1716. @end example
  1717. @item
  1718. Hard limiter at -6dB:
  1719. @example
  1720. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1721. @end example
  1722. @item
  1723. Hard limiter at -12dB:
  1724. @example
  1725. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1726. @end example
  1727. @item
  1728. Hard noise gate at -35 dB:
  1729. @example
  1730. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1731. @end example
  1732. @item
  1733. Soft limiter:
  1734. @example
  1735. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1736. @end example
  1737. @end itemize
  1738. @section compensationdelay
  1739. Compensation Delay Line is a metric based delay to compensate differing
  1740. positions of microphones or speakers.
  1741. For example, you have recorded guitar with two microphones placed in
  1742. different location. Because the front of sound wave has fixed speed in
  1743. normal conditions, the phasing of microphones can vary and depends on
  1744. their location and interposition. The best sound mix can be achieved when
  1745. these microphones are in phase (synchronized). Note that distance of
  1746. ~30 cm between microphones makes one microphone to capture signal in
  1747. antiphase to another microphone. That makes the final mix sounding moody.
  1748. This filter helps to solve phasing problems by adding different delays
  1749. to each microphone track and make them synchronized.
  1750. The best result can be reached when you take one track as base and
  1751. synchronize other tracks one by one with it.
  1752. Remember that synchronization/delay tolerance depends on sample rate, too.
  1753. Higher sample rates will give more tolerance.
  1754. It accepts the following parameters:
  1755. @table @option
  1756. @item mm
  1757. Set millimeters distance. This is compensation distance for fine tuning.
  1758. Default is 0.
  1759. @item cm
  1760. Set cm distance. This is compensation distance for tightening distance setup.
  1761. Default is 0.
  1762. @item m
  1763. Set meters distance. This is compensation distance for hard distance setup.
  1764. Default is 0.
  1765. @item dry
  1766. Set dry amount. Amount of unprocessed (dry) signal.
  1767. Default is 0.
  1768. @item wet
  1769. Set wet amount. Amount of processed (wet) signal.
  1770. Default is 1.
  1771. @item temp
  1772. Set temperature degree in Celsius. This is the temperature of the environment.
  1773. Default is 20.
  1774. @end table
  1775. @section crossfeed
  1776. Apply headphone crossfeed filter.
  1777. Crossfeed is the process of blending the left and right channels of stereo
  1778. audio recording.
  1779. It is mainly used to reduce extreme stereo separation of low frequencies.
  1780. The intent is to produce more speaker like sound to the listener.
  1781. The filter accepts the following options:
  1782. @table @option
  1783. @item strength
  1784. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  1785. This sets gain of low shelf filter for side part of stereo image.
  1786. Default is -6dB. Max allowed is -30db when strength is set to 1.
  1787. @item range
  1788. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  1789. This sets cut off frequency of low shelf filter. Default is cut off near
  1790. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  1791. @item level_in
  1792. Set input gain. Default is 0.9.
  1793. @item level_out
  1794. Set output gain. Default is 1.
  1795. @end table
  1796. @section crystalizer
  1797. Simple algorithm to expand audio dynamic range.
  1798. The filter accepts the following options:
  1799. @table @option
  1800. @item i
  1801. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  1802. (unchanged sound) to 10.0 (maximum effect).
  1803. @item c
  1804. Enable clipping. By default is enabled.
  1805. @end table
  1806. @section dcshift
  1807. Apply a DC shift to the audio.
  1808. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1809. in the recording chain) from the audio. The effect of a DC offset is reduced
  1810. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1811. a signal has a DC offset.
  1812. @table @option
  1813. @item shift
  1814. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1815. the audio.
  1816. @item limitergain
  1817. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1818. used to prevent clipping.
  1819. @end table
  1820. @section dynaudnorm
  1821. Dynamic Audio Normalizer.
  1822. This filter applies a certain amount of gain to the input audio in order
  1823. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1824. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1825. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1826. This allows for applying extra gain to the "quiet" sections of the audio
  1827. while avoiding distortions or clipping the "loud" sections. In other words:
  1828. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1829. sections, in the sense that the volume of each section is brought to the
  1830. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1831. this goal *without* applying "dynamic range compressing". It will retain 100%
  1832. of the dynamic range *within* each section of the audio file.
  1833. @table @option
  1834. @item f
  1835. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1836. Default is 500 milliseconds.
  1837. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1838. referred to as frames. This is required, because a peak magnitude has no
  1839. meaning for just a single sample value. Instead, we need to determine the
  1840. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1841. normalizer would simply use the peak magnitude of the complete file, the
  1842. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1843. frame. The length of a frame is specified in milliseconds. By default, the
  1844. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1845. been found to give good results with most files.
  1846. Note that the exact frame length, in number of samples, will be determined
  1847. automatically, based on the sampling rate of the individual input audio file.
  1848. @item g
  1849. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1850. number. Default is 31.
  1851. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1852. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1853. is specified in frames, centered around the current frame. For the sake of
  1854. simplicity, this must be an odd number. Consequently, the default value of 31
  1855. takes into account the current frame, as well as the 15 preceding frames and
  1856. the 15 subsequent frames. Using a larger window results in a stronger
  1857. smoothing effect and thus in less gain variation, i.e. slower gain
  1858. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1859. effect and thus in more gain variation, i.e. faster gain adaptation.
  1860. In other words, the more you increase this value, the more the Dynamic Audio
  1861. Normalizer will behave like a "traditional" normalization filter. On the
  1862. contrary, the more you decrease this value, the more the Dynamic Audio
  1863. Normalizer will behave like a dynamic range compressor.
  1864. @item p
  1865. Set the target peak value. This specifies the highest permissible magnitude
  1866. level for the normalized audio input. This filter will try to approach the
  1867. target peak magnitude as closely as possible, but at the same time it also
  1868. makes sure that the normalized signal will never exceed the peak magnitude.
  1869. A frame's maximum local gain factor is imposed directly by the target peak
  1870. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1871. It is not recommended to go above this value.
  1872. @item m
  1873. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1874. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1875. factor for each input frame, i.e. the maximum gain factor that does not
  1876. result in clipping or distortion. The maximum gain factor is determined by
  1877. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1878. additionally bounds the frame's maximum gain factor by a predetermined
  1879. (global) maximum gain factor. This is done in order to avoid excessive gain
  1880. factors in "silent" or almost silent frames. By default, the maximum gain
  1881. factor is 10.0, For most inputs the default value should be sufficient and
  1882. it usually is not recommended to increase this value. Though, for input
  1883. with an extremely low overall volume level, it may be necessary to allow even
  1884. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1885. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1886. Instead, a "sigmoid" threshold function will be applied. This way, the
  1887. gain factors will smoothly approach the threshold value, but never exceed that
  1888. value.
  1889. @item r
  1890. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1891. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1892. This means that the maximum local gain factor for each frame is defined
  1893. (only) by the frame's highest magnitude sample. This way, the samples can
  1894. be amplified as much as possible without exceeding the maximum signal
  1895. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1896. Normalizer can also take into account the frame's root mean square,
  1897. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1898. determine the power of a time-varying signal. It is therefore considered
  1899. that the RMS is a better approximation of the "perceived loudness" than
  1900. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1901. frames to a constant RMS value, a uniform "perceived loudness" can be
  1902. established. If a target RMS value has been specified, a frame's local gain
  1903. factor is defined as the factor that would result in exactly that RMS value.
  1904. Note, however, that the maximum local gain factor is still restricted by the
  1905. frame's highest magnitude sample, in order to prevent clipping.
  1906. @item n
  1907. Enable channels coupling. By default is enabled.
  1908. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1909. amount. This means the same gain factor will be applied to all channels, i.e.
  1910. the maximum possible gain factor is determined by the "loudest" channel.
  1911. However, in some recordings, it may happen that the volume of the different
  1912. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1913. In this case, this option can be used to disable the channel coupling. This way,
  1914. the gain factor will be determined independently for each channel, depending
  1915. only on the individual channel's highest magnitude sample. This allows for
  1916. harmonizing the volume of the different channels.
  1917. @item c
  1918. Enable DC bias correction. By default is disabled.
  1919. An audio signal (in the time domain) is a sequence of sample values.
  1920. In the Dynamic Audio Normalizer these sample values are represented in the
  1921. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1922. audio signal, or "waveform", should be centered around the zero point.
  1923. That means if we calculate the mean value of all samples in a file, or in a
  1924. single frame, then the result should be 0.0 or at least very close to that
  1925. value. If, however, there is a significant deviation of the mean value from
  1926. 0.0, in either positive or negative direction, this is referred to as a
  1927. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1928. Audio Normalizer provides optional DC bias correction.
  1929. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1930. the mean value, or "DC correction" offset, of each input frame and subtract
  1931. that value from all of the frame's sample values which ensures those samples
  1932. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1933. boundaries, the DC correction offset values will be interpolated smoothly
  1934. between neighbouring frames.
  1935. @item b
  1936. Enable alternative boundary mode. By default is disabled.
  1937. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1938. around each frame. This includes the preceding frames as well as the
  1939. subsequent frames. However, for the "boundary" frames, located at the very
  1940. beginning and at the very end of the audio file, not all neighbouring
  1941. frames are available. In particular, for the first few frames in the audio
  1942. file, the preceding frames are not known. And, similarly, for the last few
  1943. frames in the audio file, the subsequent frames are not known. Thus, the
  1944. question arises which gain factors should be assumed for the missing frames
  1945. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1946. to deal with this situation. The default boundary mode assumes a gain factor
  1947. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1948. "fade out" at the beginning and at the end of the input, respectively.
  1949. @item s
  1950. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1951. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1952. compression. This means that signal peaks will not be pruned and thus the
  1953. full dynamic range will be retained within each local neighbourhood. However,
  1954. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1955. normalization algorithm with a more "traditional" compression.
  1956. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1957. (thresholding) function. If (and only if) the compression feature is enabled,
  1958. all input frames will be processed by a soft knee thresholding function prior
  1959. to the actual normalization process. Put simply, the thresholding function is
  1960. going to prune all samples whose magnitude exceeds a certain threshold value.
  1961. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1962. value. Instead, the threshold value will be adjusted for each individual
  1963. frame.
  1964. In general, smaller parameters result in stronger compression, and vice versa.
  1965. Values below 3.0 are not recommended, because audible distortion may appear.
  1966. @end table
  1967. @section earwax
  1968. Make audio easier to listen to on headphones.
  1969. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1970. so that when listened to on headphones the stereo image is moved from
  1971. inside your head (standard for headphones) to outside and in front of
  1972. the listener (standard for speakers).
  1973. Ported from SoX.
  1974. @section equalizer
  1975. Apply a two-pole peaking equalisation (EQ) filter. With this
  1976. filter, the signal-level at and around a selected frequency can
  1977. be increased or decreased, whilst (unlike bandpass and bandreject
  1978. filters) that at all other frequencies is unchanged.
  1979. In order to produce complex equalisation curves, this filter can
  1980. be given several times, each with a different central frequency.
  1981. The filter accepts the following options:
  1982. @table @option
  1983. @item frequency, f
  1984. Set the filter's central frequency in Hz.
  1985. @item width_type, t
  1986. Set method to specify band-width of filter.
  1987. @table @option
  1988. @item h
  1989. Hz
  1990. @item q
  1991. Q-Factor
  1992. @item o
  1993. octave
  1994. @item s
  1995. slope
  1996. @end table
  1997. @item width, w
  1998. Specify the band-width of a filter in width_type units.
  1999. @item gain, g
  2000. Set the required gain or attenuation in dB.
  2001. Beware of clipping when using a positive gain.
  2002. @item channels, c
  2003. Specify which channels to filter, by default all available are filtered.
  2004. @end table
  2005. @subsection Examples
  2006. @itemize
  2007. @item
  2008. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2009. @example
  2010. equalizer=f=1000:t=h:width=200:g=-10
  2011. @end example
  2012. @item
  2013. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2014. @example
  2015. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2016. @end example
  2017. @end itemize
  2018. @section extrastereo
  2019. Linearly increases the difference between left and right channels which
  2020. adds some sort of "live" effect to playback.
  2021. The filter accepts the following options:
  2022. @table @option
  2023. @item m
  2024. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2025. (average of both channels), with 1.0 sound will be unchanged, with
  2026. -1.0 left and right channels will be swapped.
  2027. @item c
  2028. Enable clipping. By default is enabled.
  2029. @end table
  2030. @section firequalizer
  2031. Apply FIR Equalization using arbitrary frequency response.
  2032. The filter accepts the following option:
  2033. @table @option
  2034. @item gain
  2035. Set gain curve equation (in dB). The expression can contain variables:
  2036. @table @option
  2037. @item f
  2038. the evaluated frequency
  2039. @item sr
  2040. sample rate
  2041. @item ch
  2042. channel number, set to 0 when multichannels evaluation is disabled
  2043. @item chid
  2044. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2045. multichannels evaluation is disabled
  2046. @item chs
  2047. number of channels
  2048. @item chlayout
  2049. channel_layout, see libavutil/channel_layout.h
  2050. @end table
  2051. and functions:
  2052. @table @option
  2053. @item gain_interpolate(f)
  2054. interpolate gain on frequency f based on gain_entry
  2055. @item cubic_interpolate(f)
  2056. same as gain_interpolate, but smoother
  2057. @end table
  2058. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2059. @item gain_entry
  2060. Set gain entry for gain_interpolate function. The expression can
  2061. contain functions:
  2062. @table @option
  2063. @item entry(f, g)
  2064. store gain entry at frequency f with value g
  2065. @end table
  2066. This option is also available as command.
  2067. @item delay
  2068. Set filter delay in seconds. Higher value means more accurate.
  2069. Default is @code{0.01}.
  2070. @item accuracy
  2071. Set filter accuracy in Hz. Lower value means more accurate.
  2072. Default is @code{5}.
  2073. @item wfunc
  2074. Set window function. Acceptable values are:
  2075. @table @option
  2076. @item rectangular
  2077. rectangular window, useful when gain curve is already smooth
  2078. @item hann
  2079. hann window (default)
  2080. @item hamming
  2081. hamming window
  2082. @item blackman
  2083. blackman window
  2084. @item nuttall3
  2085. 3-terms continuous 1st derivative nuttall window
  2086. @item mnuttall3
  2087. minimum 3-terms discontinuous nuttall window
  2088. @item nuttall
  2089. 4-terms continuous 1st derivative nuttall window
  2090. @item bnuttall
  2091. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2092. @item bharris
  2093. blackman-harris window
  2094. @item tukey
  2095. tukey window
  2096. @end table
  2097. @item fixed
  2098. If enabled, use fixed number of audio samples. This improves speed when
  2099. filtering with large delay. Default is disabled.
  2100. @item multi
  2101. Enable multichannels evaluation on gain. Default is disabled.
  2102. @item zero_phase
  2103. Enable zero phase mode by subtracting timestamp to compensate delay.
  2104. Default is disabled.
  2105. @item scale
  2106. Set scale used by gain. Acceptable values are:
  2107. @table @option
  2108. @item linlin
  2109. linear frequency, linear gain
  2110. @item linlog
  2111. linear frequency, logarithmic (in dB) gain (default)
  2112. @item loglin
  2113. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2114. @item loglog
  2115. logarithmic frequency, logarithmic gain
  2116. @end table
  2117. @item dumpfile
  2118. Set file for dumping, suitable for gnuplot.
  2119. @item dumpscale
  2120. Set scale for dumpfile. Acceptable values are same with scale option.
  2121. Default is linlog.
  2122. @item fft2
  2123. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2124. Default is disabled.
  2125. @item min_phase
  2126. Enable minimum phase impulse response. Default is disabled.
  2127. @end table
  2128. @subsection Examples
  2129. @itemize
  2130. @item
  2131. lowpass at 1000 Hz:
  2132. @example
  2133. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2134. @end example
  2135. @item
  2136. lowpass at 1000 Hz with gain_entry:
  2137. @example
  2138. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2139. @end example
  2140. @item
  2141. custom equalization:
  2142. @example
  2143. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2144. @end example
  2145. @item
  2146. higher delay with zero phase to compensate delay:
  2147. @example
  2148. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2149. @end example
  2150. @item
  2151. lowpass on left channel, highpass on right channel:
  2152. @example
  2153. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2154. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2155. @end example
  2156. @end itemize
  2157. @section flanger
  2158. Apply a flanging effect to the audio.
  2159. The filter accepts the following options:
  2160. @table @option
  2161. @item delay
  2162. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2163. @item depth
  2164. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2165. @item regen
  2166. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2167. Default value is 0.
  2168. @item width
  2169. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2170. Default value is 71.
  2171. @item speed
  2172. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2173. @item shape
  2174. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2175. Default value is @var{sinusoidal}.
  2176. @item phase
  2177. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2178. Default value is 25.
  2179. @item interp
  2180. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2181. Default is @var{linear}.
  2182. @end table
  2183. @section haas
  2184. Apply Haas effect to audio.
  2185. Note that this makes most sense to apply on mono signals.
  2186. With this filter applied to mono signals it give some directionality and
  2187. stretches its stereo image.
  2188. The filter accepts the following options:
  2189. @table @option
  2190. @item level_in
  2191. Set input level. By default is @var{1}, or 0dB
  2192. @item level_out
  2193. Set output level. By default is @var{1}, or 0dB.
  2194. @item side_gain
  2195. Set gain applied to side part of signal. By default is @var{1}.
  2196. @item middle_source
  2197. Set kind of middle source. Can be one of the following:
  2198. @table @samp
  2199. @item left
  2200. Pick left channel.
  2201. @item right
  2202. Pick right channel.
  2203. @item mid
  2204. Pick middle part signal of stereo image.
  2205. @item side
  2206. Pick side part signal of stereo image.
  2207. @end table
  2208. @item middle_phase
  2209. Change middle phase. By default is disabled.
  2210. @item left_delay
  2211. Set left channel delay. By default is @var{2.05} milliseconds.
  2212. @item left_balance
  2213. Set left channel balance. By default is @var{-1}.
  2214. @item left_gain
  2215. Set left channel gain. By default is @var{1}.
  2216. @item left_phase
  2217. Change left phase. By default is disabled.
  2218. @item right_delay
  2219. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2220. @item right_balance
  2221. Set right channel balance. By default is @var{1}.
  2222. @item right_gain
  2223. Set right channel gain. By default is @var{1}.
  2224. @item right_phase
  2225. Change right phase. By default is enabled.
  2226. @end table
  2227. @section hdcd
  2228. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2229. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2230. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2231. of HDCD, and detects the Transient Filter flag.
  2232. @example
  2233. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2234. @end example
  2235. When using the filter with wav, note the default encoding for wav is 16-bit,
  2236. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2237. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2238. @example
  2239. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2240. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2241. @end example
  2242. The filter accepts the following options:
  2243. @table @option
  2244. @item disable_autoconvert
  2245. Disable any automatic format conversion or resampling in the filter graph.
  2246. @item process_stereo
  2247. Process the stereo channels together. If target_gain does not match between
  2248. channels, consider it invalid and use the last valid target_gain.
  2249. @item cdt_ms
  2250. Set the code detect timer period in ms.
  2251. @item force_pe
  2252. Always extend peaks above -3dBFS even if PE isn't signaled.
  2253. @item analyze_mode
  2254. Replace audio with a solid tone and adjust the amplitude to signal some
  2255. specific aspect of the decoding process. The output file can be loaded in
  2256. an audio editor alongside the original to aid analysis.
  2257. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2258. Modes are:
  2259. @table @samp
  2260. @item 0, off
  2261. Disabled
  2262. @item 1, lle
  2263. Gain adjustment level at each sample
  2264. @item 2, pe
  2265. Samples where peak extend occurs
  2266. @item 3, cdt
  2267. Samples where the code detect timer is active
  2268. @item 4, tgm
  2269. Samples where the target gain does not match between channels
  2270. @end table
  2271. @end table
  2272. @section headphone
  2273. Apply head-related transfer functions (HRTFs) to create virtual
  2274. loudspeakers around the user for binaural listening via headphones.
  2275. The HRIRs are provided via additional streams, for each channel
  2276. one stereo input stream is needed.
  2277. The filter accepts the following options:
  2278. @table @option
  2279. @item map
  2280. Set mapping of input streams for convolution.
  2281. The argument is a '|'-separated list of channel names in order as they
  2282. are given as additional stream inputs for filter.
  2283. This also specify number of input streams. Number of input streams
  2284. must be not less than number of channels in first stream plus one.
  2285. @item gain
  2286. Set gain applied to audio. Value is in dB. Default is 0.
  2287. @item type
  2288. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2289. processing audio in time domain which is slow.
  2290. @var{freq} is processing audio in frequency domain which is fast.
  2291. Default is @var{freq}.
  2292. @item lfe
  2293. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2294. @end table
  2295. @subsection Examples
  2296. @itemize
  2297. @item
  2298. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2299. each amovie filter use stereo file with IR coefficients as input.
  2300. The files give coefficients for each position of virtual loudspeaker:
  2301. @example
  2302. 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"
  2303. output.wav
  2304. @end example
  2305. @end itemize
  2306. @section highpass
  2307. Apply a high-pass filter with 3dB point frequency.
  2308. The filter can be either single-pole, or double-pole (the default).
  2309. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2310. The filter accepts the following options:
  2311. @table @option
  2312. @item frequency, f
  2313. Set frequency in Hz. Default is 3000.
  2314. @item poles, p
  2315. Set number of poles. Default is 2.
  2316. @item width_type, t
  2317. Set method to specify band-width of filter.
  2318. @table @option
  2319. @item h
  2320. Hz
  2321. @item q
  2322. Q-Factor
  2323. @item o
  2324. octave
  2325. @item s
  2326. slope
  2327. @end table
  2328. @item width, w
  2329. Specify the band-width of a filter in width_type units.
  2330. Applies only to double-pole filter.
  2331. The default is 0.707q and gives a Butterworth response.
  2332. @item channels, c
  2333. Specify which channels to filter, by default all available are filtered.
  2334. @end table
  2335. @section join
  2336. Join multiple input streams into one multi-channel stream.
  2337. It accepts the following parameters:
  2338. @table @option
  2339. @item inputs
  2340. The number of input streams. It defaults to 2.
  2341. @item channel_layout
  2342. The desired output channel layout. It defaults to stereo.
  2343. @item map
  2344. Map channels from inputs to output. The argument is a '|'-separated list of
  2345. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2346. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2347. can be either the name of the input channel (e.g. FL for front left) or its
  2348. index in the specified input stream. @var{out_channel} is the name of the output
  2349. channel.
  2350. @end table
  2351. The filter will attempt to guess the mappings when they are not specified
  2352. explicitly. It does so by first trying to find an unused matching input channel
  2353. and if that fails it picks the first unused input channel.
  2354. Join 3 inputs (with properly set channel layouts):
  2355. @example
  2356. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2357. @end example
  2358. Build a 5.1 output from 6 single-channel streams:
  2359. @example
  2360. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2361. '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'
  2362. out
  2363. @end example
  2364. @section ladspa
  2365. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2366. To enable compilation of this filter you need to configure FFmpeg with
  2367. @code{--enable-ladspa}.
  2368. @table @option
  2369. @item file, f
  2370. Specifies the name of LADSPA plugin library to load. If the environment
  2371. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2372. each one of the directories specified by the colon separated list in
  2373. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2374. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2375. @file{/usr/lib/ladspa/}.
  2376. @item plugin, p
  2377. Specifies the plugin within the library. Some libraries contain only
  2378. one plugin, but others contain many of them. If this is not set filter
  2379. will list all available plugins within the specified library.
  2380. @item controls, c
  2381. Set the '|' separated list of controls which are zero or more floating point
  2382. values that determine the behavior of the loaded plugin (for example delay,
  2383. threshold or gain).
  2384. Controls need to be defined using the following syntax:
  2385. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2386. @var{valuei} is the value set on the @var{i}-th control.
  2387. Alternatively they can be also defined using the following syntax:
  2388. @var{value0}|@var{value1}|@var{value2}|..., where
  2389. @var{valuei} is the value set on the @var{i}-th control.
  2390. If @option{controls} is set to @code{help}, all available controls and
  2391. their valid ranges are printed.
  2392. @item sample_rate, s
  2393. Specify the sample rate, default to 44100. Only used if plugin have
  2394. zero inputs.
  2395. @item nb_samples, n
  2396. Set the number of samples per channel per each output frame, default
  2397. is 1024. Only used if plugin have zero inputs.
  2398. @item duration, d
  2399. Set the minimum duration of the sourced audio. See
  2400. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2401. for the accepted syntax.
  2402. Note that the resulting duration may be greater than the specified duration,
  2403. as the generated audio is always cut at the end of a complete frame.
  2404. If not specified, or the expressed duration is negative, the audio is
  2405. supposed to be generated forever.
  2406. Only used if plugin have zero inputs.
  2407. @end table
  2408. @subsection Examples
  2409. @itemize
  2410. @item
  2411. List all available plugins within amp (LADSPA example plugin) library:
  2412. @example
  2413. ladspa=file=amp
  2414. @end example
  2415. @item
  2416. List all available controls and their valid ranges for @code{vcf_notch}
  2417. plugin from @code{VCF} library:
  2418. @example
  2419. ladspa=f=vcf:p=vcf_notch:c=help
  2420. @end example
  2421. @item
  2422. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2423. plugin library:
  2424. @example
  2425. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2426. @end example
  2427. @item
  2428. Add reverberation to the audio using TAP-plugins
  2429. (Tom's Audio Processing plugins):
  2430. @example
  2431. ladspa=file=tap_reverb:tap_reverb
  2432. @end example
  2433. @item
  2434. Generate white noise, with 0.2 amplitude:
  2435. @example
  2436. ladspa=file=cmt:noise_source_white:c=c0=.2
  2437. @end example
  2438. @item
  2439. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2440. @code{C* Audio Plugin Suite} (CAPS) library:
  2441. @example
  2442. ladspa=file=caps:Click:c=c1=20'
  2443. @end example
  2444. @item
  2445. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2446. @example
  2447. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2448. @end example
  2449. @item
  2450. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2451. @code{SWH Plugins} collection:
  2452. @example
  2453. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2454. @end example
  2455. @item
  2456. Attenuate low frequencies using Multiband EQ from Steve Harris
  2457. @code{SWH Plugins} collection:
  2458. @example
  2459. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2460. @end example
  2461. @item
  2462. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2463. (CAPS) library:
  2464. @example
  2465. ladspa=caps:Narrower
  2466. @end example
  2467. @item
  2468. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2469. @example
  2470. ladspa=caps:White:.2
  2471. @end example
  2472. @item
  2473. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2474. @example
  2475. ladspa=caps:Fractal:c=c1=1
  2476. @end example
  2477. @item
  2478. Dynamic volume normalization using @code{VLevel} plugin:
  2479. @example
  2480. ladspa=vlevel-ladspa:vlevel_mono
  2481. @end example
  2482. @end itemize
  2483. @subsection Commands
  2484. This filter supports the following commands:
  2485. @table @option
  2486. @item cN
  2487. Modify the @var{N}-th control value.
  2488. If the specified value is not valid, it is ignored and prior one is kept.
  2489. @end table
  2490. @section loudnorm
  2491. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2492. Support for both single pass (livestreams, files) and double pass (files) modes.
  2493. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  2494. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  2495. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  2496. The filter accepts the following options:
  2497. @table @option
  2498. @item I, i
  2499. Set integrated loudness target.
  2500. Range is -70.0 - -5.0. Default value is -24.0.
  2501. @item LRA, lra
  2502. Set loudness range target.
  2503. Range is 1.0 - 20.0. Default value is 7.0.
  2504. @item TP, tp
  2505. Set maximum true peak.
  2506. Range is -9.0 - +0.0. Default value is -2.0.
  2507. @item measured_I, measured_i
  2508. Measured IL of input file.
  2509. Range is -99.0 - +0.0.
  2510. @item measured_LRA, measured_lra
  2511. Measured LRA of input file.
  2512. Range is 0.0 - 99.0.
  2513. @item measured_TP, measured_tp
  2514. Measured true peak of input file.
  2515. Range is -99.0 - +99.0.
  2516. @item measured_thresh
  2517. Measured threshold of input file.
  2518. Range is -99.0 - +0.0.
  2519. @item offset
  2520. Set offset gain. Gain is applied before the true-peak limiter.
  2521. Range is -99.0 - +99.0. Default is +0.0.
  2522. @item linear
  2523. Normalize linearly if possible.
  2524. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2525. to be specified in order to use this mode.
  2526. Options are true or false. Default is true.
  2527. @item dual_mono
  2528. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2529. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2530. If set to @code{true}, this option will compensate for this effect.
  2531. Multi-channel input files are not affected by this option.
  2532. Options are true or false. Default is false.
  2533. @item print_format
  2534. Set print format for stats. Options are summary, json, or none.
  2535. Default value is none.
  2536. @end table
  2537. @section lowpass
  2538. Apply a low-pass filter with 3dB point frequency.
  2539. The filter can be either single-pole or double-pole (the default).
  2540. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2541. The filter accepts the following options:
  2542. @table @option
  2543. @item frequency, f
  2544. Set frequency in Hz. Default is 500.
  2545. @item poles, p
  2546. Set number of poles. Default is 2.
  2547. @item width_type, t
  2548. Set method to specify band-width of filter.
  2549. @table @option
  2550. @item h
  2551. Hz
  2552. @item q
  2553. Q-Factor
  2554. @item o
  2555. octave
  2556. @item s
  2557. slope
  2558. @end table
  2559. @item width, w
  2560. Specify the band-width of a filter in width_type units.
  2561. Applies only to double-pole filter.
  2562. The default is 0.707q and gives a Butterworth response.
  2563. @item channels, c
  2564. Specify which channels to filter, by default all available are filtered.
  2565. @end table
  2566. @subsection Examples
  2567. @itemize
  2568. @item
  2569. Lowpass only LFE channel, it LFE is not present it does nothing:
  2570. @example
  2571. lowpass=c=LFE
  2572. @end example
  2573. @end itemize
  2574. @section mcompand
  2575. Multiband Compress or expand the audio's dynamic range.
  2576. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  2577. This is akin to the crossover of a loudspeaker, and results in flat frequency
  2578. response when absent compander action.
  2579. It accepts the following parameters:
  2580. @table @option
  2581. @item args
  2582. This option syntax is:
  2583. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  2584. For explanation of each item refer to compand filter documentation.
  2585. @end table
  2586. @anchor{pan}
  2587. @section pan
  2588. Mix channels with specific gain levels. The filter accepts the output
  2589. channel layout followed by a set of channels definitions.
  2590. This filter is also designed to efficiently remap the channels of an audio
  2591. stream.
  2592. The filter accepts parameters of the form:
  2593. "@var{l}|@var{outdef}|@var{outdef}|..."
  2594. @table @option
  2595. @item l
  2596. output channel layout or number of channels
  2597. @item outdef
  2598. output channel specification, of the form:
  2599. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  2600. @item out_name
  2601. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2602. number (c0, c1, etc.)
  2603. @item gain
  2604. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2605. @item in_name
  2606. input channel to use, see out_name for details; it is not possible to mix
  2607. named and numbered input channels
  2608. @end table
  2609. If the `=' in a channel specification is replaced by `<', then the gains for
  2610. that specification will be renormalized so that the total is 1, thus
  2611. avoiding clipping noise.
  2612. @subsection Mixing examples
  2613. For example, if you want to down-mix from stereo to mono, but with a bigger
  2614. factor for the left channel:
  2615. @example
  2616. pan=1c|c0=0.9*c0+0.1*c1
  2617. @end example
  2618. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2619. 7-channels surround:
  2620. @example
  2621. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2622. @end example
  2623. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2624. that should be preferred (see "-ac" option) unless you have very specific
  2625. needs.
  2626. @subsection Remapping examples
  2627. The channel remapping will be effective if, and only if:
  2628. @itemize
  2629. @item gain coefficients are zeroes or ones,
  2630. @item only one input per channel output,
  2631. @end itemize
  2632. If all these conditions are satisfied, the filter will notify the user ("Pure
  2633. channel mapping detected"), and use an optimized and lossless method to do the
  2634. remapping.
  2635. For example, if you have a 5.1 source and want a stereo audio stream by
  2636. dropping the extra channels:
  2637. @example
  2638. pan="stereo| c0=FL | c1=FR"
  2639. @end example
  2640. Given the same source, you can also switch front left and front right channels
  2641. and keep the input channel layout:
  2642. @example
  2643. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2644. @end example
  2645. If the input is a stereo audio stream, you can mute the front left channel (and
  2646. still keep the stereo channel layout) with:
  2647. @example
  2648. pan="stereo|c1=c1"
  2649. @end example
  2650. Still with a stereo audio stream input, you can copy the right channel in both
  2651. front left and right:
  2652. @example
  2653. pan="stereo| c0=FR | c1=FR"
  2654. @end example
  2655. @section replaygain
  2656. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2657. outputs it unchanged.
  2658. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2659. @section resample
  2660. Convert the audio sample format, sample rate and channel layout. It is
  2661. not meant to be used directly.
  2662. @section rubberband
  2663. Apply time-stretching and pitch-shifting with librubberband.
  2664. The filter accepts the following options:
  2665. @table @option
  2666. @item tempo
  2667. Set tempo scale factor.
  2668. @item pitch
  2669. Set pitch scale factor.
  2670. @item transients
  2671. Set transients detector.
  2672. Possible values are:
  2673. @table @var
  2674. @item crisp
  2675. @item mixed
  2676. @item smooth
  2677. @end table
  2678. @item detector
  2679. Set detector.
  2680. Possible values are:
  2681. @table @var
  2682. @item compound
  2683. @item percussive
  2684. @item soft
  2685. @end table
  2686. @item phase
  2687. Set phase.
  2688. Possible values are:
  2689. @table @var
  2690. @item laminar
  2691. @item independent
  2692. @end table
  2693. @item window
  2694. Set processing window size.
  2695. Possible values are:
  2696. @table @var
  2697. @item standard
  2698. @item short
  2699. @item long
  2700. @end table
  2701. @item smoothing
  2702. Set smoothing.
  2703. Possible values are:
  2704. @table @var
  2705. @item off
  2706. @item on
  2707. @end table
  2708. @item formant
  2709. Enable formant preservation when shift pitching.
  2710. Possible values are:
  2711. @table @var
  2712. @item shifted
  2713. @item preserved
  2714. @end table
  2715. @item pitchq
  2716. Set pitch quality.
  2717. Possible values are:
  2718. @table @var
  2719. @item quality
  2720. @item speed
  2721. @item consistency
  2722. @end table
  2723. @item channels
  2724. Set channels.
  2725. Possible values are:
  2726. @table @var
  2727. @item apart
  2728. @item together
  2729. @end table
  2730. @end table
  2731. @section sidechaincompress
  2732. This filter acts like normal compressor but has the ability to compress
  2733. detected signal using second input signal.
  2734. It needs two input streams and returns one output stream.
  2735. First input stream will be processed depending on second stream signal.
  2736. The filtered signal then can be filtered with other filters in later stages of
  2737. processing. See @ref{pan} and @ref{amerge} filter.
  2738. The filter accepts the following options:
  2739. @table @option
  2740. @item level_in
  2741. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2742. @item threshold
  2743. If a signal of second stream raises above this level it will affect the gain
  2744. reduction of first stream.
  2745. By default is 0.125. Range is between 0.00097563 and 1.
  2746. @item ratio
  2747. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2748. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2749. Default is 2. Range is between 1 and 20.
  2750. @item attack
  2751. Amount of milliseconds the signal has to rise above the threshold before gain
  2752. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2753. @item release
  2754. Amount of milliseconds the signal has to fall below the threshold before
  2755. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2756. @item makeup
  2757. Set the amount by how much signal will be amplified after processing.
  2758. Default is 1. Range is from 1 to 64.
  2759. @item knee
  2760. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2761. Default is 2.82843. Range is between 1 and 8.
  2762. @item link
  2763. Choose if the @code{average} level between all channels of side-chain stream
  2764. or the louder(@code{maximum}) channel of side-chain stream affects the
  2765. reduction. Default is @code{average}.
  2766. @item detection
  2767. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2768. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2769. @item level_sc
  2770. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2771. @item mix
  2772. How much to use compressed signal in output. Default is 1.
  2773. Range is between 0 and 1.
  2774. @end table
  2775. @subsection Examples
  2776. @itemize
  2777. @item
  2778. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2779. depending on the signal of 2nd input and later compressed signal to be
  2780. merged with 2nd input:
  2781. @example
  2782. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2783. @end example
  2784. @end itemize
  2785. @section sidechaingate
  2786. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2787. filter the detected signal before sending it to the gain reduction stage.
  2788. Normally a gate uses the full range signal to detect a level above the
  2789. threshold.
  2790. For example: If you cut all lower frequencies from your sidechain signal
  2791. the gate will decrease the volume of your track only if not enough highs
  2792. appear. With this technique you are able to reduce the resonation of a
  2793. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2794. guitar.
  2795. It needs two input streams and returns one output stream.
  2796. First input stream will be processed depending on second stream signal.
  2797. The filter accepts the following options:
  2798. @table @option
  2799. @item level_in
  2800. Set input level before filtering.
  2801. Default is 1. Allowed range is from 0.015625 to 64.
  2802. @item range
  2803. Set the level of gain reduction when the signal is below the threshold.
  2804. Default is 0.06125. Allowed range is from 0 to 1.
  2805. @item threshold
  2806. If a signal rises above this level the gain reduction is released.
  2807. Default is 0.125. Allowed range is from 0 to 1.
  2808. @item ratio
  2809. Set a ratio about which the signal is reduced.
  2810. Default is 2. Allowed range is from 1 to 9000.
  2811. @item attack
  2812. Amount of milliseconds the signal has to rise above the threshold before gain
  2813. reduction stops.
  2814. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2815. @item release
  2816. Amount of milliseconds the signal has to fall below the threshold before the
  2817. reduction is increased again. Default is 250 milliseconds.
  2818. Allowed range is from 0.01 to 9000.
  2819. @item makeup
  2820. Set amount of amplification of signal after processing.
  2821. Default is 1. Allowed range is from 1 to 64.
  2822. @item knee
  2823. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2824. Default is 2.828427125. Allowed range is from 1 to 8.
  2825. @item detection
  2826. Choose if exact signal should be taken for detection or an RMS like one.
  2827. Default is rms. Can be peak or rms.
  2828. @item link
  2829. Choose if the average level between all channels or the louder channel affects
  2830. the reduction.
  2831. Default is average. Can be average or maximum.
  2832. @item level_sc
  2833. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2834. @end table
  2835. @section silencedetect
  2836. Detect silence in an audio stream.
  2837. This filter logs a message when it detects that the input audio volume is less
  2838. or equal to a noise tolerance value for a duration greater or equal to the
  2839. minimum detected noise duration.
  2840. The printed times and duration are expressed in seconds.
  2841. The filter accepts the following options:
  2842. @table @option
  2843. @item duration, d
  2844. Set silence duration until notification (default is 2 seconds).
  2845. @item noise, n
  2846. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2847. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2848. @end table
  2849. @subsection Examples
  2850. @itemize
  2851. @item
  2852. Detect 5 seconds of silence with -50dB noise tolerance:
  2853. @example
  2854. silencedetect=n=-50dB:d=5
  2855. @end example
  2856. @item
  2857. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2858. tolerance in @file{silence.mp3}:
  2859. @example
  2860. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2861. @end example
  2862. @end itemize
  2863. @section silenceremove
  2864. Remove silence from the beginning, middle or end of the audio.
  2865. The filter accepts the following options:
  2866. @table @option
  2867. @item start_periods
  2868. This value is used to indicate if audio should be trimmed at beginning of
  2869. the audio. A value of zero indicates no silence should be trimmed from the
  2870. beginning. When specifying a non-zero value, it trims audio up until it
  2871. finds non-silence. Normally, when trimming silence from beginning of audio
  2872. the @var{start_periods} will be @code{1} but it can be increased to higher
  2873. values to trim all audio up to specific count of non-silence periods.
  2874. Default value is @code{0}.
  2875. @item start_duration
  2876. Specify the amount of time that non-silence must be detected before it stops
  2877. trimming audio. By increasing the duration, bursts of noises can be treated
  2878. as silence and trimmed off. Default value is @code{0}.
  2879. @item start_threshold
  2880. This indicates what sample value should be treated as silence. For digital
  2881. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2882. you may wish to increase the value to account for background noise.
  2883. Can be specified in dB (in case "dB" is appended to the specified value)
  2884. or amplitude ratio. Default value is @code{0}.
  2885. @item stop_periods
  2886. Set the count for trimming silence from the end of audio.
  2887. To remove silence from the middle of a file, specify a @var{stop_periods}
  2888. that is negative. This value is then treated as a positive value and is
  2889. used to indicate the effect should restart processing as specified by
  2890. @var{start_periods}, making it suitable for removing periods of silence
  2891. in the middle of the audio.
  2892. Default value is @code{0}.
  2893. @item stop_duration
  2894. Specify a duration of silence that must exist before audio is not copied any
  2895. more. By specifying a higher duration, silence that is wanted can be left in
  2896. the audio.
  2897. Default value is @code{0}.
  2898. @item stop_threshold
  2899. This is the same as @option{start_threshold} but for trimming silence from
  2900. the end of audio.
  2901. Can be specified in dB (in case "dB" is appended to the specified value)
  2902. or amplitude ratio. Default value is @code{0}.
  2903. @item leave_silence
  2904. This indicates that @var{stop_duration} length of audio should be left intact
  2905. at the beginning of each period of silence.
  2906. For example, if you want to remove long pauses between words but do not want
  2907. to remove the pauses completely. Default value is @code{0}.
  2908. @item detection
  2909. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  2910. and works better with digital silence which is exactly 0.
  2911. Default value is @code{rms}.
  2912. @item window
  2913. Set ratio used to calculate size of window for detecting silence.
  2914. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  2915. @end table
  2916. @subsection Examples
  2917. @itemize
  2918. @item
  2919. The following example shows how this filter can be used to start a recording
  2920. that does not contain the delay at the start which usually occurs between
  2921. pressing the record button and the start of the performance:
  2922. @example
  2923. silenceremove=1:5:0.02
  2924. @end example
  2925. @item
  2926. Trim all silence encountered from beginning to end where there is more than 1
  2927. second of silence in audio:
  2928. @example
  2929. silenceremove=0:0:0:-1:1:-90dB
  2930. @end example
  2931. @end itemize
  2932. @section sofalizer
  2933. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  2934. loudspeakers around the user for binaural listening via headphones (audio
  2935. formats up to 9 channels supported).
  2936. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  2937. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  2938. Austrian Academy of Sciences.
  2939. To enable compilation of this filter you need to configure FFmpeg with
  2940. @code{--enable-libmysofa}.
  2941. The filter accepts the following options:
  2942. @table @option
  2943. @item sofa
  2944. Set the SOFA file used for rendering.
  2945. @item gain
  2946. Set gain applied to audio. Value is in dB. Default is 0.
  2947. @item rotation
  2948. Set rotation of virtual loudspeakers in deg. Default is 0.
  2949. @item elevation
  2950. Set elevation of virtual speakers in deg. Default is 0.
  2951. @item radius
  2952. Set distance in meters between loudspeakers and the listener with near-field
  2953. HRTFs. Default is 1.
  2954. @item type
  2955. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2956. processing audio in time domain which is slow.
  2957. @var{freq} is processing audio in frequency domain which is fast.
  2958. Default is @var{freq}.
  2959. @item speakers
  2960. Set custom positions of virtual loudspeakers. Syntax for this option is:
  2961. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  2962. Each virtual loudspeaker is described with short channel name following with
  2963. azimuth and elevation in degrees.
  2964. Each virtual loudspeaker description is separated by '|'.
  2965. For example to override front left and front right channel positions use:
  2966. 'speakers=FL 45 15|FR 345 15'.
  2967. Descriptions with unrecognised channel names are ignored.
  2968. @item lfegain
  2969. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2970. @end table
  2971. @subsection Examples
  2972. @itemize
  2973. @item
  2974. Using ClubFritz6 sofa file:
  2975. @example
  2976. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  2977. @end example
  2978. @item
  2979. Using ClubFritz12 sofa file and bigger radius with small rotation:
  2980. @example
  2981. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  2982. @end example
  2983. @item
  2984. Similar as above but with custom speaker positions for front left, front right, back left and back right
  2985. and also with custom gain:
  2986. @example
  2987. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  2988. @end example
  2989. @end itemize
  2990. @section stereotools
  2991. This filter has some handy utilities to manage stereo signals, for converting
  2992. M/S stereo recordings to L/R signal while having control over the parameters
  2993. or spreading the stereo image of master track.
  2994. The filter accepts the following options:
  2995. @table @option
  2996. @item level_in
  2997. Set input level before filtering for both channels. Defaults is 1.
  2998. Allowed range is from 0.015625 to 64.
  2999. @item level_out
  3000. Set output level after filtering for both channels. Defaults is 1.
  3001. Allowed range is from 0.015625 to 64.
  3002. @item balance_in
  3003. Set input balance between both channels. Default is 0.
  3004. Allowed range is from -1 to 1.
  3005. @item balance_out
  3006. Set output balance between both channels. Default is 0.
  3007. Allowed range is from -1 to 1.
  3008. @item softclip
  3009. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3010. clipping. Disabled by default.
  3011. @item mutel
  3012. Mute the left channel. Disabled by default.
  3013. @item muter
  3014. Mute the right channel. Disabled by default.
  3015. @item phasel
  3016. Change the phase of the left channel. Disabled by default.
  3017. @item phaser
  3018. Change the phase of the right channel. Disabled by default.
  3019. @item mode
  3020. Set stereo mode. Available values are:
  3021. @table @samp
  3022. @item lr>lr
  3023. Left/Right to Left/Right, this is default.
  3024. @item lr>ms
  3025. Left/Right to Mid/Side.
  3026. @item ms>lr
  3027. Mid/Side to Left/Right.
  3028. @item lr>ll
  3029. Left/Right to Left/Left.
  3030. @item lr>rr
  3031. Left/Right to Right/Right.
  3032. @item lr>l+r
  3033. Left/Right to Left + Right.
  3034. @item lr>rl
  3035. Left/Right to Right/Left.
  3036. @item ms>ll
  3037. Mid/Side to Left/Left.
  3038. @item ms>rr
  3039. Mid/Side to Right/Right.
  3040. @end table
  3041. @item slev
  3042. Set level of side signal. Default is 1.
  3043. Allowed range is from 0.015625 to 64.
  3044. @item sbal
  3045. Set balance of side signal. Default is 0.
  3046. Allowed range is from -1 to 1.
  3047. @item mlev
  3048. Set level of the middle signal. Default is 1.
  3049. Allowed range is from 0.015625 to 64.
  3050. @item mpan
  3051. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3052. @item base
  3053. Set stereo base between mono and inversed channels. Default is 0.
  3054. Allowed range is from -1 to 1.
  3055. @item delay
  3056. Set delay in milliseconds how much to delay left from right channel and
  3057. vice versa. Default is 0. Allowed range is from -20 to 20.
  3058. @item sclevel
  3059. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3060. @item phase
  3061. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3062. @item bmode_in, bmode_out
  3063. Set balance mode for balance_in/balance_out option.
  3064. Can be one of the following:
  3065. @table @samp
  3066. @item balance
  3067. Classic balance mode. Attenuate one channel at time.
  3068. Gain is raised up to 1.
  3069. @item amplitude
  3070. Similar as classic mode above but gain is raised up to 2.
  3071. @item power
  3072. Equal power distribution, from -6dB to +6dB range.
  3073. @end table
  3074. @end table
  3075. @subsection Examples
  3076. @itemize
  3077. @item
  3078. Apply karaoke like effect:
  3079. @example
  3080. stereotools=mlev=0.015625
  3081. @end example
  3082. @item
  3083. Convert M/S signal to L/R:
  3084. @example
  3085. "stereotools=mode=ms>lr"
  3086. @end example
  3087. @end itemize
  3088. @section stereowiden
  3089. This filter enhance the stereo effect by suppressing signal common to both
  3090. channels and by delaying the signal of left into right and vice versa,
  3091. thereby widening the stereo effect.
  3092. The filter accepts the following options:
  3093. @table @option
  3094. @item delay
  3095. Time in milliseconds of the delay of left signal into right and vice versa.
  3096. Default is 20 milliseconds.
  3097. @item feedback
  3098. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3099. effect of left signal in right output and vice versa which gives widening
  3100. effect. Default is 0.3.
  3101. @item crossfeed
  3102. Cross feed of left into right with inverted phase. This helps in suppressing
  3103. the mono. If the value is 1 it will cancel all the signal common to both
  3104. channels. Default is 0.3.
  3105. @item drymix
  3106. Set level of input signal of original channel. Default is 0.8.
  3107. @end table
  3108. @section superequalizer
  3109. Apply 18 band equalizer.
  3110. The filter accepts the following options:
  3111. @table @option
  3112. @item 1b
  3113. Set 65Hz band gain.
  3114. @item 2b
  3115. Set 92Hz band gain.
  3116. @item 3b
  3117. Set 131Hz band gain.
  3118. @item 4b
  3119. Set 185Hz band gain.
  3120. @item 5b
  3121. Set 262Hz band gain.
  3122. @item 6b
  3123. Set 370Hz band gain.
  3124. @item 7b
  3125. Set 523Hz band gain.
  3126. @item 8b
  3127. Set 740Hz band gain.
  3128. @item 9b
  3129. Set 1047Hz band gain.
  3130. @item 10b
  3131. Set 1480Hz band gain.
  3132. @item 11b
  3133. Set 2093Hz band gain.
  3134. @item 12b
  3135. Set 2960Hz band gain.
  3136. @item 13b
  3137. Set 4186Hz band gain.
  3138. @item 14b
  3139. Set 5920Hz band gain.
  3140. @item 15b
  3141. Set 8372Hz band gain.
  3142. @item 16b
  3143. Set 11840Hz band gain.
  3144. @item 17b
  3145. Set 16744Hz band gain.
  3146. @item 18b
  3147. Set 20000Hz band gain.
  3148. @end table
  3149. @section surround
  3150. Apply audio surround upmix filter.
  3151. This filter allows to produce multichannel output from audio stream.
  3152. The filter accepts the following options:
  3153. @table @option
  3154. @item chl_out
  3155. Set output channel layout. By default, this is @var{5.1}.
  3156. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3157. for the required syntax.
  3158. @item chl_in
  3159. Set input channel layout. By default, this is @var{stereo}.
  3160. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3161. for the required syntax.
  3162. @item level_in
  3163. Set input volume level. By default, this is @var{1}.
  3164. @item level_out
  3165. Set output volume level. By default, this is @var{1}.
  3166. @item lfe
  3167. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3168. @item lfe_low
  3169. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3170. @item lfe_high
  3171. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3172. @item fc_in
  3173. Set front center input volume. By default, this is @var{1}.
  3174. @item fc_out
  3175. Set front center output volume. By default, this is @var{1}.
  3176. @item lfe_in
  3177. Set LFE input volume. By default, this is @var{1}.
  3178. @item lfe_out
  3179. Set LFE output volume. By default, this is @var{1}.
  3180. @end table
  3181. @section treble
  3182. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3183. shelving filter with a response similar to that of a standard
  3184. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3185. The filter accepts the following options:
  3186. @table @option
  3187. @item gain, g
  3188. Give the gain at whichever is the lower of ~22 kHz and the
  3189. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3190. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3191. @item frequency, f
  3192. Set the filter's central frequency and so can be used
  3193. to extend or reduce the frequency range to be boosted or cut.
  3194. The default value is @code{3000} Hz.
  3195. @item width_type, t
  3196. Set method to specify band-width of filter.
  3197. @table @option
  3198. @item h
  3199. Hz
  3200. @item q
  3201. Q-Factor
  3202. @item o
  3203. octave
  3204. @item s
  3205. slope
  3206. @end table
  3207. @item width, w
  3208. Determine how steep is the filter's shelf transition.
  3209. @item channels, c
  3210. Specify which channels to filter, by default all available are filtered.
  3211. @end table
  3212. @section tremolo
  3213. Sinusoidal amplitude modulation.
  3214. The filter accepts the following options:
  3215. @table @option
  3216. @item f
  3217. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3218. (20 Hz or lower) will result in a tremolo effect.
  3219. This filter may also be used as a ring modulator by specifying
  3220. a modulation frequency higher than 20 Hz.
  3221. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3222. @item d
  3223. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3224. Default value is 0.5.
  3225. @end table
  3226. @section vibrato
  3227. Sinusoidal phase modulation.
  3228. The filter accepts the following options:
  3229. @table @option
  3230. @item f
  3231. Modulation frequency in Hertz.
  3232. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3233. @item d
  3234. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3235. Default value is 0.5.
  3236. @end table
  3237. @section volume
  3238. Adjust the input audio volume.
  3239. It accepts the following parameters:
  3240. @table @option
  3241. @item volume
  3242. Set audio volume expression.
  3243. Output values are clipped to the maximum value.
  3244. The output audio volume is given by the relation:
  3245. @example
  3246. @var{output_volume} = @var{volume} * @var{input_volume}
  3247. @end example
  3248. The default value for @var{volume} is "1.0".
  3249. @item precision
  3250. This parameter represents the mathematical precision.
  3251. It determines which input sample formats will be allowed, which affects the
  3252. precision of the volume scaling.
  3253. @table @option
  3254. @item fixed
  3255. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3256. @item float
  3257. 32-bit floating-point; this limits input sample format to FLT. (default)
  3258. @item double
  3259. 64-bit floating-point; this limits input sample format to DBL.
  3260. @end table
  3261. @item replaygain
  3262. Choose the behaviour on encountering ReplayGain side data in input frames.
  3263. @table @option
  3264. @item drop
  3265. Remove ReplayGain side data, ignoring its contents (the default).
  3266. @item ignore
  3267. Ignore ReplayGain side data, but leave it in the frame.
  3268. @item track
  3269. Prefer the track gain, if present.
  3270. @item album
  3271. Prefer the album gain, if present.
  3272. @end table
  3273. @item replaygain_preamp
  3274. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3275. Default value for @var{replaygain_preamp} is 0.0.
  3276. @item eval
  3277. Set when the volume expression is evaluated.
  3278. It accepts the following values:
  3279. @table @samp
  3280. @item once
  3281. only evaluate expression once during the filter initialization, or
  3282. when the @samp{volume} command is sent
  3283. @item frame
  3284. evaluate expression for each incoming frame
  3285. @end table
  3286. Default value is @samp{once}.
  3287. @end table
  3288. The volume expression can contain the following parameters.
  3289. @table @option
  3290. @item n
  3291. frame number (starting at zero)
  3292. @item nb_channels
  3293. number of channels
  3294. @item nb_consumed_samples
  3295. number of samples consumed by the filter
  3296. @item nb_samples
  3297. number of samples in the current frame
  3298. @item pos
  3299. original frame position in the file
  3300. @item pts
  3301. frame PTS
  3302. @item sample_rate
  3303. sample rate
  3304. @item startpts
  3305. PTS at start of stream
  3306. @item startt
  3307. time at start of stream
  3308. @item t
  3309. frame time
  3310. @item tb
  3311. timestamp timebase
  3312. @item volume
  3313. last set volume value
  3314. @end table
  3315. Note that when @option{eval} is set to @samp{once} only the
  3316. @var{sample_rate} and @var{tb} variables are available, all other
  3317. variables will evaluate to NAN.
  3318. @subsection Commands
  3319. This filter supports the following commands:
  3320. @table @option
  3321. @item volume
  3322. Modify the volume expression.
  3323. The command accepts the same syntax of the corresponding option.
  3324. If the specified expression is not valid, it is kept at its current
  3325. value.
  3326. @item replaygain_noclip
  3327. Prevent clipping by limiting the gain applied.
  3328. Default value for @var{replaygain_noclip} is 1.
  3329. @end table
  3330. @subsection Examples
  3331. @itemize
  3332. @item
  3333. Halve the input audio volume:
  3334. @example
  3335. volume=volume=0.5
  3336. volume=volume=1/2
  3337. volume=volume=-6.0206dB
  3338. @end example
  3339. In all the above example the named key for @option{volume} can be
  3340. omitted, for example like in:
  3341. @example
  3342. volume=0.5
  3343. @end example
  3344. @item
  3345. Increase input audio power by 6 decibels using fixed-point precision:
  3346. @example
  3347. volume=volume=6dB:precision=fixed
  3348. @end example
  3349. @item
  3350. Fade volume after time 10 with an annihilation period of 5 seconds:
  3351. @example
  3352. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3353. @end example
  3354. @end itemize
  3355. @section volumedetect
  3356. Detect the volume of the input video.
  3357. The filter has no parameters. The input is not modified. Statistics about
  3358. the volume will be printed in the log when the input stream end is reached.
  3359. In particular it will show the mean volume (root mean square), maximum
  3360. volume (on a per-sample basis), and the beginning of a histogram of the
  3361. registered volume values (from the maximum value to a cumulated 1/1000 of
  3362. the samples).
  3363. All volumes are in decibels relative to the maximum PCM value.
  3364. @subsection Examples
  3365. Here is an excerpt of the output:
  3366. @example
  3367. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3368. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3369. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3370. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3371. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3372. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3373. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3374. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3375. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3376. @end example
  3377. It means that:
  3378. @itemize
  3379. @item
  3380. The mean square energy is approximately -27 dB, or 10^-2.7.
  3381. @item
  3382. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3383. @item
  3384. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3385. @end itemize
  3386. In other words, raising the volume by +4 dB does not cause any clipping,
  3387. raising it by +5 dB causes clipping for 6 samples, etc.
  3388. @c man end AUDIO FILTERS
  3389. @chapter Audio Sources
  3390. @c man begin AUDIO SOURCES
  3391. Below is a description of the currently available audio sources.
  3392. @section abuffer
  3393. Buffer audio frames, and make them available to the filter chain.
  3394. This source is mainly intended for a programmatic use, in particular
  3395. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3396. It accepts the following parameters:
  3397. @table @option
  3398. @item time_base
  3399. The timebase which will be used for timestamps of submitted frames. It must be
  3400. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3401. @item sample_rate
  3402. The sample rate of the incoming audio buffers.
  3403. @item sample_fmt
  3404. The sample format of the incoming audio buffers.
  3405. Either a sample format name or its corresponding integer representation from
  3406. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3407. @item channel_layout
  3408. The channel layout of the incoming audio buffers.
  3409. Either a channel layout name from channel_layout_map in
  3410. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3411. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3412. @item channels
  3413. The number of channels of the incoming audio buffers.
  3414. If both @var{channels} and @var{channel_layout} are specified, then they
  3415. must be consistent.
  3416. @end table
  3417. @subsection Examples
  3418. @example
  3419. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3420. @end example
  3421. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3422. Since the sample format with name "s16p" corresponds to the number
  3423. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3424. equivalent to:
  3425. @example
  3426. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3427. @end example
  3428. @section aevalsrc
  3429. Generate an audio signal specified by an expression.
  3430. This source accepts in input one or more expressions (one for each
  3431. channel), which are evaluated and used to generate a corresponding
  3432. audio signal.
  3433. This source accepts the following options:
  3434. @table @option
  3435. @item exprs
  3436. Set the '|'-separated expressions list for each separate channel. In case the
  3437. @option{channel_layout} option is not specified, the selected channel layout
  3438. depends on the number of provided expressions. Otherwise the last
  3439. specified expression is applied to the remaining output channels.
  3440. @item channel_layout, c
  3441. Set the channel layout. The number of channels in the specified layout
  3442. must be equal to the number of specified expressions.
  3443. @item duration, d
  3444. Set the minimum duration of the sourced audio. See
  3445. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3446. for the accepted syntax.
  3447. Note that the resulting duration may be greater than the specified
  3448. duration, as the generated audio is always cut at the end of a
  3449. complete frame.
  3450. If not specified, or the expressed duration is negative, the audio is
  3451. supposed to be generated forever.
  3452. @item nb_samples, n
  3453. Set the number of samples per channel per each output frame,
  3454. default to 1024.
  3455. @item sample_rate, s
  3456. Specify the sample rate, default to 44100.
  3457. @end table
  3458. Each expression in @var{exprs} can contain the following constants:
  3459. @table @option
  3460. @item n
  3461. number of the evaluated sample, starting from 0
  3462. @item t
  3463. time of the evaluated sample expressed in seconds, starting from 0
  3464. @item s
  3465. sample rate
  3466. @end table
  3467. @subsection Examples
  3468. @itemize
  3469. @item
  3470. Generate silence:
  3471. @example
  3472. aevalsrc=0
  3473. @end example
  3474. @item
  3475. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3476. 8000 Hz:
  3477. @example
  3478. aevalsrc="sin(440*2*PI*t):s=8000"
  3479. @end example
  3480. @item
  3481. Generate a two channels signal, specify the channel layout (Front
  3482. Center + Back Center) explicitly:
  3483. @example
  3484. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3485. @end example
  3486. @item
  3487. Generate white noise:
  3488. @example
  3489. aevalsrc="-2+random(0)"
  3490. @end example
  3491. @item
  3492. Generate an amplitude modulated signal:
  3493. @example
  3494. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3495. @end example
  3496. @item
  3497. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3498. @example
  3499. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3500. @end example
  3501. @end itemize
  3502. @section anullsrc
  3503. The null audio source, return unprocessed audio frames. It is mainly useful
  3504. as a template and to be employed in analysis / debugging tools, or as
  3505. the source for filters which ignore the input data (for example the sox
  3506. synth filter).
  3507. This source accepts the following options:
  3508. @table @option
  3509. @item channel_layout, cl
  3510. Specifies the channel layout, and can be either an integer or a string
  3511. representing a channel layout. The default value of @var{channel_layout}
  3512. is "stereo".
  3513. Check the channel_layout_map definition in
  3514. @file{libavutil/channel_layout.c} for the mapping between strings and
  3515. channel layout values.
  3516. @item sample_rate, r
  3517. Specifies the sample rate, and defaults to 44100.
  3518. @item nb_samples, n
  3519. Set the number of samples per requested frames.
  3520. @end table
  3521. @subsection Examples
  3522. @itemize
  3523. @item
  3524. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3525. @example
  3526. anullsrc=r=48000:cl=4
  3527. @end example
  3528. @item
  3529. Do the same operation with a more obvious syntax:
  3530. @example
  3531. anullsrc=r=48000:cl=mono
  3532. @end example
  3533. @end itemize
  3534. All the parameters need to be explicitly defined.
  3535. @section flite
  3536. Synthesize a voice utterance using the libflite library.
  3537. To enable compilation of this filter you need to configure FFmpeg with
  3538. @code{--enable-libflite}.
  3539. Note that versions of the flite library prior to 2.0 are not thread-safe.
  3540. The filter accepts the following options:
  3541. @table @option
  3542. @item list_voices
  3543. If set to 1, list the names of the available voices and exit
  3544. immediately. Default value is 0.
  3545. @item nb_samples, n
  3546. Set the maximum number of samples per frame. Default value is 512.
  3547. @item textfile
  3548. Set the filename containing the text to speak.
  3549. @item text
  3550. Set the text to speak.
  3551. @item voice, v
  3552. Set the voice to use for the speech synthesis. Default value is
  3553. @code{kal}. See also the @var{list_voices} option.
  3554. @end table
  3555. @subsection Examples
  3556. @itemize
  3557. @item
  3558. Read from file @file{speech.txt}, and synthesize the text using the
  3559. standard flite voice:
  3560. @example
  3561. flite=textfile=speech.txt
  3562. @end example
  3563. @item
  3564. Read the specified text selecting the @code{slt} voice:
  3565. @example
  3566. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3567. @end example
  3568. @item
  3569. Input text to ffmpeg:
  3570. @example
  3571. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3572. @end example
  3573. @item
  3574. Make @file{ffplay} speak the specified text, using @code{flite} and
  3575. the @code{lavfi} device:
  3576. @example
  3577. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3578. @end example
  3579. @end itemize
  3580. For more information about libflite, check:
  3581. @url{http://www.festvox.org/flite/}
  3582. @section anoisesrc
  3583. Generate a noise audio signal.
  3584. The filter accepts the following options:
  3585. @table @option
  3586. @item sample_rate, r
  3587. Specify the sample rate. Default value is 48000 Hz.
  3588. @item amplitude, a
  3589. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3590. is 1.0.
  3591. @item duration, d
  3592. Specify the duration of the generated audio stream. Not specifying this option
  3593. results in noise with an infinite length.
  3594. @item color, colour, c
  3595. Specify the color of noise. Available noise colors are white, pink, brown,
  3596. blue and violet. Default color is white.
  3597. @item seed, s
  3598. Specify a value used to seed the PRNG.
  3599. @item nb_samples, n
  3600. Set the number of samples per each output frame, default is 1024.
  3601. @end table
  3602. @subsection Examples
  3603. @itemize
  3604. @item
  3605. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3606. @example
  3607. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3608. @end example
  3609. @end itemize
  3610. @section sine
  3611. Generate an audio signal made of a sine wave with amplitude 1/8.
  3612. The audio signal is bit-exact.
  3613. The filter accepts the following options:
  3614. @table @option
  3615. @item frequency, f
  3616. Set the carrier frequency. Default is 440 Hz.
  3617. @item beep_factor, b
  3618. Enable a periodic beep every second with frequency @var{beep_factor} times
  3619. the carrier frequency. Default is 0, meaning the beep is disabled.
  3620. @item sample_rate, r
  3621. Specify the sample rate, default is 44100.
  3622. @item duration, d
  3623. Specify the duration of the generated audio stream.
  3624. @item samples_per_frame
  3625. Set the number of samples per output frame.
  3626. The expression can contain the following constants:
  3627. @table @option
  3628. @item n
  3629. The (sequential) number of the output audio frame, starting from 0.
  3630. @item pts
  3631. The PTS (Presentation TimeStamp) of the output audio frame,
  3632. expressed in @var{TB} units.
  3633. @item t
  3634. The PTS of the output audio frame, expressed in seconds.
  3635. @item TB
  3636. The timebase of the output audio frames.
  3637. @end table
  3638. Default is @code{1024}.
  3639. @end table
  3640. @subsection Examples
  3641. @itemize
  3642. @item
  3643. Generate a simple 440 Hz sine wave:
  3644. @example
  3645. sine
  3646. @end example
  3647. @item
  3648. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3649. @example
  3650. sine=220:4:d=5
  3651. sine=f=220:b=4:d=5
  3652. sine=frequency=220:beep_factor=4:duration=5
  3653. @end example
  3654. @item
  3655. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3656. pattern:
  3657. @example
  3658. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3659. @end example
  3660. @end itemize
  3661. @c man end AUDIO SOURCES
  3662. @chapter Audio Sinks
  3663. @c man begin AUDIO SINKS
  3664. Below is a description of the currently available audio sinks.
  3665. @section abuffersink
  3666. Buffer audio frames, and make them available to the end of filter chain.
  3667. This sink is mainly intended for programmatic use, in particular
  3668. through the interface defined in @file{libavfilter/buffersink.h}
  3669. or the options system.
  3670. It accepts a pointer to an AVABufferSinkContext structure, which
  3671. defines the incoming buffers' formats, to be passed as the opaque
  3672. parameter to @code{avfilter_init_filter} for initialization.
  3673. @section anullsink
  3674. Null audio sink; do absolutely nothing with the input audio. It is
  3675. mainly useful as a template and for use in analysis / debugging
  3676. tools.
  3677. @c man end AUDIO SINKS
  3678. @chapter Video Filters
  3679. @c man begin VIDEO FILTERS
  3680. When you configure your FFmpeg build, you can disable any of the
  3681. existing filters using @code{--disable-filters}.
  3682. The configure output will show the video filters included in your
  3683. build.
  3684. Below is a description of the currently available video filters.
  3685. @section alphaextract
  3686. Extract the alpha component from the input as a grayscale video. This
  3687. is especially useful with the @var{alphamerge} filter.
  3688. @section alphamerge
  3689. Add or replace the alpha component of the primary input with the
  3690. grayscale value of a second input. This is intended for use with
  3691. @var{alphaextract} to allow the transmission or storage of frame
  3692. sequences that have alpha in a format that doesn't support an alpha
  3693. channel.
  3694. For example, to reconstruct full frames from a normal YUV-encoded video
  3695. and a separate video created with @var{alphaextract}, you might use:
  3696. @example
  3697. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3698. @end example
  3699. Since this filter is designed for reconstruction, it operates on frame
  3700. sequences without considering timestamps, and terminates when either
  3701. input reaches end of stream. This will cause problems if your encoding
  3702. pipeline drops frames. If you're trying to apply an image as an
  3703. overlay to a video stream, consider the @var{overlay} filter instead.
  3704. @section ass
  3705. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3706. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3707. Substation Alpha) subtitles files.
  3708. This filter accepts the following option in addition to the common options from
  3709. the @ref{subtitles} filter:
  3710. @table @option
  3711. @item shaping
  3712. Set the shaping engine
  3713. Available values are:
  3714. @table @samp
  3715. @item auto
  3716. The default libass shaping engine, which is the best available.
  3717. @item simple
  3718. Fast, font-agnostic shaper that can do only substitutions
  3719. @item complex
  3720. Slower shaper using OpenType for substitutions and positioning
  3721. @end table
  3722. The default is @code{auto}.
  3723. @end table
  3724. @section atadenoise
  3725. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3726. The filter accepts the following options:
  3727. @table @option
  3728. @item 0a
  3729. Set threshold A for 1st plane. Default is 0.02.
  3730. Valid range is 0 to 0.3.
  3731. @item 0b
  3732. Set threshold B for 1st plane. Default is 0.04.
  3733. Valid range is 0 to 5.
  3734. @item 1a
  3735. Set threshold A for 2nd plane. Default is 0.02.
  3736. Valid range is 0 to 0.3.
  3737. @item 1b
  3738. Set threshold B for 2nd plane. Default is 0.04.
  3739. Valid range is 0 to 5.
  3740. @item 2a
  3741. Set threshold A for 3rd plane. Default is 0.02.
  3742. Valid range is 0 to 0.3.
  3743. @item 2b
  3744. Set threshold B for 3rd plane. Default is 0.04.
  3745. Valid range is 0 to 5.
  3746. Threshold A is designed to react on abrupt changes in the input signal and
  3747. threshold B is designed to react on continuous changes in the input signal.
  3748. @item s
  3749. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3750. number in range [5, 129].
  3751. @item p
  3752. Set what planes of frame filter will use for averaging. Default is all.
  3753. @end table
  3754. @section avgblur
  3755. Apply average blur filter.
  3756. The filter accepts the following options:
  3757. @table @option
  3758. @item sizeX
  3759. Set horizontal kernel size.
  3760. @item planes
  3761. Set which planes to filter. By default all planes are filtered.
  3762. @item sizeY
  3763. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  3764. Default is @code{0}.
  3765. @end table
  3766. @section bbox
  3767. Compute the bounding box for the non-black pixels in the input frame
  3768. luminance plane.
  3769. This filter computes the bounding box containing all the pixels with a
  3770. luminance value greater than the minimum allowed value.
  3771. The parameters describing the bounding box are printed on the filter
  3772. log.
  3773. The filter accepts the following option:
  3774. @table @option
  3775. @item min_val
  3776. Set the minimal luminance value. Default is @code{16}.
  3777. @end table
  3778. @section bitplanenoise
  3779. Show and measure bit plane noise.
  3780. The filter accepts the following options:
  3781. @table @option
  3782. @item bitplane
  3783. Set which plane to analyze. Default is @code{1}.
  3784. @item filter
  3785. Filter out noisy pixels from @code{bitplane} set above.
  3786. Default is disabled.
  3787. @end table
  3788. @section blackdetect
  3789. Detect video intervals that are (almost) completely black. Can be
  3790. useful to detect chapter transitions, commercials, or invalid
  3791. recordings. Output lines contains the time for the start, end and
  3792. duration of the detected black interval expressed in seconds.
  3793. In order to display the output lines, you need to set the loglevel at
  3794. least to the AV_LOG_INFO value.
  3795. The filter accepts the following options:
  3796. @table @option
  3797. @item black_min_duration, d
  3798. Set the minimum detected black duration expressed in seconds. It must
  3799. be a non-negative floating point number.
  3800. Default value is 2.0.
  3801. @item picture_black_ratio_th, pic_th
  3802. Set the threshold for considering a picture "black".
  3803. Express the minimum value for the ratio:
  3804. @example
  3805. @var{nb_black_pixels} / @var{nb_pixels}
  3806. @end example
  3807. for which a picture is considered black.
  3808. Default value is 0.98.
  3809. @item pixel_black_th, pix_th
  3810. Set the threshold for considering a pixel "black".
  3811. The threshold expresses the maximum pixel luminance value for which a
  3812. pixel is considered "black". The provided value is scaled according to
  3813. the following equation:
  3814. @example
  3815. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  3816. @end example
  3817. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  3818. the input video format, the range is [0-255] for YUV full-range
  3819. formats and [16-235] for YUV non full-range formats.
  3820. Default value is 0.10.
  3821. @end table
  3822. The following example sets the maximum pixel threshold to the minimum
  3823. value, and detects only black intervals of 2 or more seconds:
  3824. @example
  3825. blackdetect=d=2:pix_th=0.00
  3826. @end example
  3827. @section blackframe
  3828. Detect frames that are (almost) completely black. Can be useful to
  3829. detect chapter transitions or commercials. Output lines consist of
  3830. the frame number of the detected frame, the percentage of blackness,
  3831. the position in the file if known or -1 and the timestamp in seconds.
  3832. In order to display the output lines, you need to set the loglevel at
  3833. least to the AV_LOG_INFO value.
  3834. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  3835. The value represents the percentage of pixels in the picture that
  3836. are below the threshold value.
  3837. It accepts the following parameters:
  3838. @table @option
  3839. @item amount
  3840. The percentage of the pixels that have to be below the threshold; it defaults to
  3841. @code{98}.
  3842. @item threshold, thresh
  3843. The threshold below which a pixel value is considered black; it defaults to
  3844. @code{32}.
  3845. @end table
  3846. @section blend, tblend
  3847. Blend two video frames into each other.
  3848. The @code{blend} filter takes two input streams and outputs one
  3849. stream, the first input is the "top" layer and second input is
  3850. "bottom" layer. By default, the output terminates when the longest input terminates.
  3851. The @code{tblend} (time blend) filter takes two consecutive frames
  3852. from one single stream, and outputs the result obtained by blending
  3853. the new frame on top of the old frame.
  3854. A description of the accepted options follows.
  3855. @table @option
  3856. @item c0_mode
  3857. @item c1_mode
  3858. @item c2_mode
  3859. @item c3_mode
  3860. @item all_mode
  3861. Set blend mode for specific pixel component or all pixel components in case
  3862. of @var{all_mode}. Default value is @code{normal}.
  3863. Available values for component modes are:
  3864. @table @samp
  3865. @item addition
  3866. @item grainmerge
  3867. @item and
  3868. @item average
  3869. @item burn
  3870. @item darken
  3871. @item difference
  3872. @item grainextract
  3873. @item divide
  3874. @item dodge
  3875. @item freeze
  3876. @item exclusion
  3877. @item extremity
  3878. @item glow
  3879. @item hardlight
  3880. @item hardmix
  3881. @item heat
  3882. @item lighten
  3883. @item linearlight
  3884. @item multiply
  3885. @item multiply128
  3886. @item negation
  3887. @item normal
  3888. @item or
  3889. @item overlay
  3890. @item phoenix
  3891. @item pinlight
  3892. @item reflect
  3893. @item screen
  3894. @item softlight
  3895. @item subtract
  3896. @item vividlight
  3897. @item xor
  3898. @end table
  3899. @item c0_opacity
  3900. @item c1_opacity
  3901. @item c2_opacity
  3902. @item c3_opacity
  3903. @item all_opacity
  3904. Set blend opacity for specific pixel component or all pixel components in case
  3905. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  3906. @item c0_expr
  3907. @item c1_expr
  3908. @item c2_expr
  3909. @item c3_expr
  3910. @item all_expr
  3911. Set blend expression for specific pixel component or all pixel components in case
  3912. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3913. The expressions can use the following variables:
  3914. @table @option
  3915. @item N
  3916. The sequential number of the filtered frame, starting from @code{0}.
  3917. @item X
  3918. @item Y
  3919. the coordinates of the current sample
  3920. @item W
  3921. @item H
  3922. the width and height of currently filtered plane
  3923. @item SW
  3924. @item SH
  3925. Width and height scale depending on the currently filtered plane. It is the
  3926. ratio between the corresponding luma plane number of pixels and the current
  3927. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3928. @code{0.5,0.5} for chroma planes.
  3929. @item T
  3930. Time of the current frame, expressed in seconds.
  3931. @item TOP, A
  3932. Value of pixel component at current location for first video frame (top layer).
  3933. @item BOTTOM, B
  3934. Value of pixel component at current location for second video frame (bottom layer).
  3935. @end table
  3936. @end table
  3937. The @code{blend} filter also supports the @ref{framesync} options.
  3938. @subsection Examples
  3939. @itemize
  3940. @item
  3941. Apply transition from bottom layer to top layer in first 10 seconds:
  3942. @example
  3943. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3944. @end example
  3945. @item
  3946. Apply linear horizontal transition from top layer to bottom layer:
  3947. @example
  3948. blend=all_expr='A*(X/W)+B*(1-X/W)'
  3949. @end example
  3950. @item
  3951. Apply 1x1 checkerboard effect:
  3952. @example
  3953. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  3954. @end example
  3955. @item
  3956. Apply uncover left effect:
  3957. @example
  3958. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  3959. @end example
  3960. @item
  3961. Apply uncover down effect:
  3962. @example
  3963. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  3964. @end example
  3965. @item
  3966. Apply uncover up-left effect:
  3967. @example
  3968. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  3969. @end example
  3970. @item
  3971. Split diagonally video and shows top and bottom layer on each side:
  3972. @example
  3973. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  3974. @end example
  3975. @item
  3976. Display differences between the current and the previous frame:
  3977. @example
  3978. tblend=all_mode=grainextract
  3979. @end example
  3980. @end itemize
  3981. @section boxblur
  3982. Apply a boxblur algorithm to the input video.
  3983. It accepts the following parameters:
  3984. @table @option
  3985. @item luma_radius, lr
  3986. @item luma_power, lp
  3987. @item chroma_radius, cr
  3988. @item chroma_power, cp
  3989. @item alpha_radius, ar
  3990. @item alpha_power, ap
  3991. @end table
  3992. A description of the accepted options follows.
  3993. @table @option
  3994. @item luma_radius, lr
  3995. @item chroma_radius, cr
  3996. @item alpha_radius, ar
  3997. Set an expression for the box radius in pixels used for blurring the
  3998. corresponding input plane.
  3999. The radius value must be a non-negative number, and must not be
  4000. greater than the value of the expression @code{min(w,h)/2} for the
  4001. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4002. planes.
  4003. Default value for @option{luma_radius} is "2". If not specified,
  4004. @option{chroma_radius} and @option{alpha_radius} default to the
  4005. corresponding value set for @option{luma_radius}.
  4006. The expressions can contain the following constants:
  4007. @table @option
  4008. @item w
  4009. @item h
  4010. The input width and height in pixels.
  4011. @item cw
  4012. @item ch
  4013. The input chroma image width and height in pixels.
  4014. @item hsub
  4015. @item vsub
  4016. The horizontal and vertical chroma subsample values. For example, for the
  4017. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4018. @end table
  4019. @item luma_power, lp
  4020. @item chroma_power, cp
  4021. @item alpha_power, ap
  4022. Specify how many times the boxblur filter is applied to the
  4023. corresponding plane.
  4024. Default value for @option{luma_power} is 2. If not specified,
  4025. @option{chroma_power} and @option{alpha_power} default to the
  4026. corresponding value set for @option{luma_power}.
  4027. A value of 0 will disable the effect.
  4028. @end table
  4029. @subsection Examples
  4030. @itemize
  4031. @item
  4032. Apply a boxblur filter with the luma, chroma, and alpha radii
  4033. set to 2:
  4034. @example
  4035. boxblur=luma_radius=2:luma_power=1
  4036. boxblur=2:1
  4037. @end example
  4038. @item
  4039. Set the luma radius to 2, and alpha and chroma radius to 0:
  4040. @example
  4041. boxblur=2:1:cr=0:ar=0
  4042. @end example
  4043. @item
  4044. Set the luma and chroma radii to a fraction of the video dimension:
  4045. @example
  4046. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4047. @end example
  4048. @end itemize
  4049. @section bwdif
  4050. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4051. Deinterlacing Filter").
  4052. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4053. interpolation algorithms.
  4054. It accepts the following parameters:
  4055. @table @option
  4056. @item mode
  4057. The interlacing mode to adopt. It accepts one of the following values:
  4058. @table @option
  4059. @item 0, send_frame
  4060. Output one frame for each frame.
  4061. @item 1, send_field
  4062. Output one frame for each field.
  4063. @end table
  4064. The default value is @code{send_field}.
  4065. @item parity
  4066. The picture field parity assumed for the input interlaced video. It accepts one
  4067. of the following values:
  4068. @table @option
  4069. @item 0, tff
  4070. Assume the top field is first.
  4071. @item 1, bff
  4072. Assume the bottom field is first.
  4073. @item -1, auto
  4074. Enable automatic detection of field parity.
  4075. @end table
  4076. The default value is @code{auto}.
  4077. If the interlacing is unknown or the decoder does not export this information,
  4078. top field first will be assumed.
  4079. @item deint
  4080. Specify which frames to deinterlace. Accept one of the following
  4081. values:
  4082. @table @option
  4083. @item 0, all
  4084. Deinterlace all frames.
  4085. @item 1, interlaced
  4086. Only deinterlace frames marked as interlaced.
  4087. @end table
  4088. The default value is @code{all}.
  4089. @end table
  4090. @section chromakey
  4091. YUV colorspace color/chroma keying.
  4092. The filter accepts the following options:
  4093. @table @option
  4094. @item color
  4095. The color which will be replaced with transparency.
  4096. @item similarity
  4097. Similarity percentage with the key color.
  4098. 0.01 matches only the exact key color, while 1.0 matches everything.
  4099. @item blend
  4100. Blend percentage.
  4101. 0.0 makes pixels either fully transparent, or not transparent at all.
  4102. Higher values result in semi-transparent pixels, with a higher transparency
  4103. the more similar the pixels color is to the key color.
  4104. @item yuv
  4105. Signals that the color passed is already in YUV instead of RGB.
  4106. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4107. This can be used to pass exact YUV values as hexadecimal numbers.
  4108. @end table
  4109. @subsection Examples
  4110. @itemize
  4111. @item
  4112. Make every green pixel in the input image transparent:
  4113. @example
  4114. ffmpeg -i input.png -vf chromakey=green out.png
  4115. @end example
  4116. @item
  4117. Overlay a greenscreen-video on top of a static black background.
  4118. @example
  4119. 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
  4120. @end example
  4121. @end itemize
  4122. @section ciescope
  4123. Display CIE color diagram with pixels overlaid onto it.
  4124. The filter accepts the following options:
  4125. @table @option
  4126. @item system
  4127. Set color system.
  4128. @table @samp
  4129. @item ntsc, 470m
  4130. @item ebu, 470bg
  4131. @item smpte
  4132. @item 240m
  4133. @item apple
  4134. @item widergb
  4135. @item cie1931
  4136. @item rec709, hdtv
  4137. @item uhdtv, rec2020
  4138. @end table
  4139. @item cie
  4140. Set CIE system.
  4141. @table @samp
  4142. @item xyy
  4143. @item ucs
  4144. @item luv
  4145. @end table
  4146. @item gamuts
  4147. Set what gamuts to draw.
  4148. See @code{system} option for available values.
  4149. @item size, s
  4150. Set ciescope size, by default set to 512.
  4151. @item intensity, i
  4152. Set intensity used to map input pixel values to CIE diagram.
  4153. @item contrast
  4154. Set contrast used to draw tongue colors that are out of active color system gamut.
  4155. @item corrgamma
  4156. Correct gamma displayed on scope, by default enabled.
  4157. @item showwhite
  4158. Show white point on CIE diagram, by default disabled.
  4159. @item gamma
  4160. Set input gamma. Used only with XYZ input color space.
  4161. @end table
  4162. @section codecview
  4163. Visualize information exported by some codecs.
  4164. Some codecs can export information through frames using side-data or other
  4165. means. For example, some MPEG based codecs export motion vectors through the
  4166. @var{export_mvs} flag in the codec @option{flags2} option.
  4167. The filter accepts the following option:
  4168. @table @option
  4169. @item mv
  4170. Set motion vectors to visualize.
  4171. Available flags for @var{mv} are:
  4172. @table @samp
  4173. @item pf
  4174. forward predicted MVs of P-frames
  4175. @item bf
  4176. forward predicted MVs of B-frames
  4177. @item bb
  4178. backward predicted MVs of B-frames
  4179. @end table
  4180. @item qp
  4181. Display quantization parameters using the chroma planes.
  4182. @item mv_type, mvt
  4183. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4184. Available flags for @var{mv_type} are:
  4185. @table @samp
  4186. @item fp
  4187. forward predicted MVs
  4188. @item bp
  4189. backward predicted MVs
  4190. @end table
  4191. @item frame_type, ft
  4192. Set frame type to visualize motion vectors of.
  4193. Available flags for @var{frame_type} are:
  4194. @table @samp
  4195. @item if
  4196. intra-coded frames (I-frames)
  4197. @item pf
  4198. predicted frames (P-frames)
  4199. @item bf
  4200. bi-directionally predicted frames (B-frames)
  4201. @end table
  4202. @end table
  4203. @subsection Examples
  4204. @itemize
  4205. @item
  4206. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4207. @example
  4208. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4209. @end example
  4210. @item
  4211. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4212. @example
  4213. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4214. @end example
  4215. @end itemize
  4216. @section colorbalance
  4217. Modify intensity of primary colors (red, green and blue) of input frames.
  4218. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4219. regions for the red-cyan, green-magenta or blue-yellow balance.
  4220. A positive adjustment value shifts the balance towards the primary color, a negative
  4221. value towards the complementary color.
  4222. The filter accepts the following options:
  4223. @table @option
  4224. @item rs
  4225. @item gs
  4226. @item bs
  4227. Adjust red, green and blue shadows (darkest pixels).
  4228. @item rm
  4229. @item gm
  4230. @item bm
  4231. Adjust red, green and blue midtones (medium pixels).
  4232. @item rh
  4233. @item gh
  4234. @item bh
  4235. Adjust red, green and blue highlights (brightest pixels).
  4236. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4237. @end table
  4238. @subsection Examples
  4239. @itemize
  4240. @item
  4241. Add red color cast to shadows:
  4242. @example
  4243. colorbalance=rs=.3
  4244. @end example
  4245. @end itemize
  4246. @section colorkey
  4247. RGB colorspace color keying.
  4248. The filter accepts the following options:
  4249. @table @option
  4250. @item color
  4251. The color which will be replaced with transparency.
  4252. @item similarity
  4253. Similarity percentage with the key color.
  4254. 0.01 matches only the exact key color, while 1.0 matches everything.
  4255. @item blend
  4256. Blend percentage.
  4257. 0.0 makes pixels either fully transparent, or not transparent at all.
  4258. Higher values result in semi-transparent pixels, with a higher transparency
  4259. the more similar the pixels color is to the key color.
  4260. @end table
  4261. @subsection Examples
  4262. @itemize
  4263. @item
  4264. Make every green pixel in the input image transparent:
  4265. @example
  4266. ffmpeg -i input.png -vf colorkey=green out.png
  4267. @end example
  4268. @item
  4269. Overlay a greenscreen-video on top of a static background image.
  4270. @example
  4271. 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
  4272. @end example
  4273. @end itemize
  4274. @section colorlevels
  4275. Adjust video input frames using levels.
  4276. The filter accepts the following options:
  4277. @table @option
  4278. @item rimin
  4279. @item gimin
  4280. @item bimin
  4281. @item aimin
  4282. Adjust red, green, blue and alpha input black point.
  4283. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4284. @item rimax
  4285. @item gimax
  4286. @item bimax
  4287. @item aimax
  4288. Adjust red, green, blue and alpha input white point.
  4289. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  4290. Input levels are used to lighten highlights (bright tones), darken shadows
  4291. (dark tones), change the balance of bright and dark tones.
  4292. @item romin
  4293. @item gomin
  4294. @item bomin
  4295. @item aomin
  4296. Adjust red, green, blue and alpha output black point.
  4297. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  4298. @item romax
  4299. @item gomax
  4300. @item bomax
  4301. @item aomax
  4302. Adjust red, green, blue and alpha output white point.
  4303. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  4304. Output levels allows manual selection of a constrained output level range.
  4305. @end table
  4306. @subsection Examples
  4307. @itemize
  4308. @item
  4309. Make video output darker:
  4310. @example
  4311. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4312. @end example
  4313. @item
  4314. Increase contrast:
  4315. @example
  4316. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4317. @end example
  4318. @item
  4319. Make video output lighter:
  4320. @example
  4321. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4322. @end example
  4323. @item
  4324. Increase brightness:
  4325. @example
  4326. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4327. @end example
  4328. @end itemize
  4329. @section colorchannelmixer
  4330. Adjust video input frames by re-mixing color channels.
  4331. This filter modifies a color channel by adding the values associated to
  4332. the other channels of the same pixels. For example if the value to
  4333. modify is red, the output value will be:
  4334. @example
  4335. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4336. @end example
  4337. The filter accepts the following options:
  4338. @table @option
  4339. @item rr
  4340. @item rg
  4341. @item rb
  4342. @item ra
  4343. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4344. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4345. @item gr
  4346. @item gg
  4347. @item gb
  4348. @item ga
  4349. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4350. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4351. @item br
  4352. @item bg
  4353. @item bb
  4354. @item ba
  4355. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4356. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4357. @item ar
  4358. @item ag
  4359. @item ab
  4360. @item aa
  4361. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4362. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4363. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4364. @end table
  4365. @subsection Examples
  4366. @itemize
  4367. @item
  4368. Convert source to grayscale:
  4369. @example
  4370. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4371. @end example
  4372. @item
  4373. Simulate sepia tones:
  4374. @example
  4375. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4376. @end example
  4377. @end itemize
  4378. @section colormatrix
  4379. Convert color matrix.
  4380. The filter accepts the following options:
  4381. @table @option
  4382. @item src
  4383. @item dst
  4384. Specify the source and destination color matrix. Both values must be
  4385. specified.
  4386. The accepted values are:
  4387. @table @samp
  4388. @item bt709
  4389. BT.709
  4390. @item fcc
  4391. FCC
  4392. @item bt601
  4393. BT.601
  4394. @item bt470
  4395. BT.470
  4396. @item bt470bg
  4397. BT.470BG
  4398. @item smpte170m
  4399. SMPTE-170M
  4400. @item smpte240m
  4401. SMPTE-240M
  4402. @item bt2020
  4403. BT.2020
  4404. @end table
  4405. @end table
  4406. For example to convert from BT.601 to SMPTE-240M, use the command:
  4407. @example
  4408. colormatrix=bt601:smpte240m
  4409. @end example
  4410. @section colorspace
  4411. Convert colorspace, transfer characteristics or color primaries.
  4412. Input video needs to have an even size.
  4413. The filter accepts the following options:
  4414. @table @option
  4415. @anchor{all}
  4416. @item all
  4417. Specify all color properties at once.
  4418. The accepted values are:
  4419. @table @samp
  4420. @item bt470m
  4421. BT.470M
  4422. @item bt470bg
  4423. BT.470BG
  4424. @item bt601-6-525
  4425. BT.601-6 525
  4426. @item bt601-6-625
  4427. BT.601-6 625
  4428. @item bt709
  4429. BT.709
  4430. @item smpte170m
  4431. SMPTE-170M
  4432. @item smpte240m
  4433. SMPTE-240M
  4434. @item bt2020
  4435. BT.2020
  4436. @end table
  4437. @anchor{space}
  4438. @item space
  4439. Specify output colorspace.
  4440. The accepted values are:
  4441. @table @samp
  4442. @item bt709
  4443. BT.709
  4444. @item fcc
  4445. FCC
  4446. @item bt470bg
  4447. BT.470BG or BT.601-6 625
  4448. @item smpte170m
  4449. SMPTE-170M or BT.601-6 525
  4450. @item smpte240m
  4451. SMPTE-240M
  4452. @item ycgco
  4453. YCgCo
  4454. @item bt2020ncl
  4455. BT.2020 with non-constant luminance
  4456. @end table
  4457. @anchor{trc}
  4458. @item trc
  4459. Specify output transfer characteristics.
  4460. The accepted values are:
  4461. @table @samp
  4462. @item bt709
  4463. BT.709
  4464. @item bt470m
  4465. BT.470M
  4466. @item bt470bg
  4467. BT.470BG
  4468. @item gamma22
  4469. Constant gamma of 2.2
  4470. @item gamma28
  4471. Constant gamma of 2.8
  4472. @item smpte170m
  4473. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4474. @item smpte240m
  4475. SMPTE-240M
  4476. @item srgb
  4477. SRGB
  4478. @item iec61966-2-1
  4479. iec61966-2-1
  4480. @item iec61966-2-4
  4481. iec61966-2-4
  4482. @item xvycc
  4483. xvycc
  4484. @item bt2020-10
  4485. BT.2020 for 10-bits content
  4486. @item bt2020-12
  4487. BT.2020 for 12-bits content
  4488. @end table
  4489. @anchor{primaries}
  4490. @item primaries
  4491. Specify output color primaries.
  4492. The accepted values are:
  4493. @table @samp
  4494. @item bt709
  4495. BT.709
  4496. @item bt470m
  4497. BT.470M
  4498. @item bt470bg
  4499. BT.470BG or BT.601-6 625
  4500. @item smpte170m
  4501. SMPTE-170M or BT.601-6 525
  4502. @item smpte240m
  4503. SMPTE-240M
  4504. @item film
  4505. film
  4506. @item smpte431
  4507. SMPTE-431
  4508. @item smpte432
  4509. SMPTE-432
  4510. @item bt2020
  4511. BT.2020
  4512. @item jedec-p22
  4513. JEDEC P22 phosphors
  4514. @end table
  4515. @anchor{range}
  4516. @item range
  4517. Specify output color range.
  4518. The accepted values are:
  4519. @table @samp
  4520. @item tv
  4521. TV (restricted) range
  4522. @item mpeg
  4523. MPEG (restricted) range
  4524. @item pc
  4525. PC (full) range
  4526. @item jpeg
  4527. JPEG (full) range
  4528. @end table
  4529. @item format
  4530. Specify output color format.
  4531. The accepted values are:
  4532. @table @samp
  4533. @item yuv420p
  4534. YUV 4:2:0 planar 8-bits
  4535. @item yuv420p10
  4536. YUV 4:2:0 planar 10-bits
  4537. @item yuv420p12
  4538. YUV 4:2:0 planar 12-bits
  4539. @item yuv422p
  4540. YUV 4:2:2 planar 8-bits
  4541. @item yuv422p10
  4542. YUV 4:2:2 planar 10-bits
  4543. @item yuv422p12
  4544. YUV 4:2:2 planar 12-bits
  4545. @item yuv444p
  4546. YUV 4:4:4 planar 8-bits
  4547. @item yuv444p10
  4548. YUV 4:4:4 planar 10-bits
  4549. @item yuv444p12
  4550. YUV 4:4:4 planar 12-bits
  4551. @end table
  4552. @item fast
  4553. Do a fast conversion, which skips gamma/primary correction. This will take
  4554. significantly less CPU, but will be mathematically incorrect. To get output
  4555. compatible with that produced by the colormatrix filter, use fast=1.
  4556. @item dither
  4557. Specify dithering mode.
  4558. The accepted values are:
  4559. @table @samp
  4560. @item none
  4561. No dithering
  4562. @item fsb
  4563. Floyd-Steinberg dithering
  4564. @end table
  4565. @item wpadapt
  4566. Whitepoint adaptation mode.
  4567. The accepted values are:
  4568. @table @samp
  4569. @item bradford
  4570. Bradford whitepoint adaptation
  4571. @item vonkries
  4572. von Kries whitepoint adaptation
  4573. @item identity
  4574. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4575. @end table
  4576. @item iall
  4577. Override all input properties at once. Same accepted values as @ref{all}.
  4578. @item ispace
  4579. Override input colorspace. Same accepted values as @ref{space}.
  4580. @item iprimaries
  4581. Override input color primaries. Same accepted values as @ref{primaries}.
  4582. @item itrc
  4583. Override input transfer characteristics. Same accepted values as @ref{trc}.
  4584. @item irange
  4585. Override input color range. Same accepted values as @ref{range}.
  4586. @end table
  4587. The filter converts the transfer characteristics, color space and color
  4588. primaries to the specified user values. The output value, if not specified,
  4589. is set to a default value based on the "all" property. If that property is
  4590. also not specified, the filter will log an error. The output color range and
  4591. format default to the same value as the input color range and format. The
  4592. input transfer characteristics, color space, color primaries and color range
  4593. should be set on the input data. If any of these are missing, the filter will
  4594. log an error and no conversion will take place.
  4595. For example to convert the input to SMPTE-240M, use the command:
  4596. @example
  4597. colorspace=smpte240m
  4598. @end example
  4599. @section convolution
  4600. Apply convolution 3x3 or 5x5 filter.
  4601. The filter accepts the following options:
  4602. @table @option
  4603. @item 0m
  4604. @item 1m
  4605. @item 2m
  4606. @item 3m
  4607. Set matrix for each plane.
  4608. Matrix is sequence of 9 or 25 signed integers.
  4609. @item 0rdiv
  4610. @item 1rdiv
  4611. @item 2rdiv
  4612. @item 3rdiv
  4613. Set multiplier for calculated value for each plane.
  4614. @item 0bias
  4615. @item 1bias
  4616. @item 2bias
  4617. @item 3bias
  4618. Set bias for each plane. This value is added to the result of the multiplication.
  4619. Useful for making the overall image brighter or darker. Default is 0.0.
  4620. @end table
  4621. @subsection Examples
  4622. @itemize
  4623. @item
  4624. Apply sharpen:
  4625. @example
  4626. 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"
  4627. @end example
  4628. @item
  4629. Apply blur:
  4630. @example
  4631. 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"
  4632. @end example
  4633. @item
  4634. Apply edge enhance:
  4635. @example
  4636. 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"
  4637. @end example
  4638. @item
  4639. Apply edge detect:
  4640. @example
  4641. 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"
  4642. @end example
  4643. @item
  4644. Apply laplacian edge detector which includes diagonals:
  4645. @example
  4646. 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"
  4647. @end example
  4648. @item
  4649. Apply emboss:
  4650. @example
  4651. 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"
  4652. @end example
  4653. @end itemize
  4654. @section convolve
  4655. Apply 2D convolution of video stream in frequency domain using second stream
  4656. as impulse.
  4657. The filter accepts the following options:
  4658. @table @option
  4659. @item planes
  4660. Set which planes to process.
  4661. @item impulse
  4662. Set which impulse video frames will be processed, can be @var{first}
  4663. or @var{all}. Default is @var{all}.
  4664. @end table
  4665. The @code{convolve} filter also supports the @ref{framesync} options.
  4666. @section copy
  4667. Copy the input video source unchanged to the output. This is mainly useful for
  4668. testing purposes.
  4669. @anchor{coreimage}
  4670. @section coreimage
  4671. Video filtering on GPU using Apple's CoreImage API on OSX.
  4672. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4673. processed by video hardware. However, software-based OpenGL implementations
  4674. exist which means there is no guarantee for hardware processing. It depends on
  4675. the respective OSX.
  4676. There are many filters and image generators provided by Apple that come with a
  4677. large variety of options. The filter has to be referenced by its name along
  4678. with its options.
  4679. The coreimage filter accepts the following options:
  4680. @table @option
  4681. @item list_filters
  4682. List all available filters and generators along with all their respective
  4683. options as well as possible minimum and maximum values along with the default
  4684. values.
  4685. @example
  4686. list_filters=true
  4687. @end example
  4688. @item filter
  4689. Specify all filters by their respective name and options.
  4690. Use @var{list_filters} to determine all valid filter names and options.
  4691. Numerical options are specified by a float value and are automatically clamped
  4692. to their respective value range. Vector and color options have to be specified
  4693. by a list of space separated float values. Character escaping has to be done.
  4694. A special option name @code{default} is available to use default options for a
  4695. filter.
  4696. It is required to specify either @code{default} or at least one of the filter options.
  4697. All omitted options are used with their default values.
  4698. The syntax of the filter string is as follows:
  4699. @example
  4700. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  4701. @end example
  4702. @item output_rect
  4703. Specify a rectangle where the output of the filter chain is copied into the
  4704. input image. It is given by a list of space separated float values:
  4705. @example
  4706. output_rect=x\ y\ width\ height
  4707. @end example
  4708. If not given, the output rectangle equals the dimensions of the input image.
  4709. The output rectangle is automatically cropped at the borders of the input
  4710. image. Negative values are valid for each component.
  4711. @example
  4712. output_rect=25\ 25\ 100\ 100
  4713. @end example
  4714. @end table
  4715. Several filters can be chained for successive processing without GPU-HOST
  4716. transfers allowing for fast processing of complex filter chains.
  4717. Currently, only filters with zero (generators) or exactly one (filters) input
  4718. image and one output image are supported. Also, transition filters are not yet
  4719. usable as intended.
  4720. Some filters generate output images with additional padding depending on the
  4721. respective filter kernel. The padding is automatically removed to ensure the
  4722. filter output has the same size as the input image.
  4723. For image generators, the size of the output image is determined by the
  4724. previous output image of the filter chain or the input image of the whole
  4725. filterchain, respectively. The generators do not use the pixel information of
  4726. this image to generate their output. However, the generated output is
  4727. blended onto this image, resulting in partial or complete coverage of the
  4728. output image.
  4729. The @ref{coreimagesrc} video source can be used for generating input images
  4730. which are directly fed into the filter chain. By using it, providing input
  4731. images by another video source or an input video is not required.
  4732. @subsection Examples
  4733. @itemize
  4734. @item
  4735. List all filters available:
  4736. @example
  4737. coreimage=list_filters=true
  4738. @end example
  4739. @item
  4740. Use the CIBoxBlur filter with default options to blur an image:
  4741. @example
  4742. coreimage=filter=CIBoxBlur@@default
  4743. @end example
  4744. @item
  4745. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  4746. its center at 100x100 and a radius of 50 pixels:
  4747. @example
  4748. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  4749. @end example
  4750. @item
  4751. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  4752. given as complete and escaped command-line for Apple's standard bash shell:
  4753. @example
  4754. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  4755. @end example
  4756. @end itemize
  4757. @section crop
  4758. Crop the input video to given dimensions.
  4759. It accepts the following parameters:
  4760. @table @option
  4761. @item w, out_w
  4762. The width of the output video. It defaults to @code{iw}.
  4763. This expression is evaluated only once during the filter
  4764. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  4765. @item h, out_h
  4766. The height of the output video. It defaults to @code{ih}.
  4767. This expression is evaluated only once during the filter
  4768. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  4769. @item x
  4770. The horizontal position, in the input video, of the left edge of the output
  4771. video. It defaults to @code{(in_w-out_w)/2}.
  4772. This expression is evaluated per-frame.
  4773. @item y
  4774. The vertical position, in the input video, of the top edge of the output video.
  4775. It defaults to @code{(in_h-out_h)/2}.
  4776. This expression is evaluated per-frame.
  4777. @item keep_aspect
  4778. If set to 1 will force the output display aspect ratio
  4779. to be the same of the input, by changing the output sample aspect
  4780. ratio. It defaults to 0.
  4781. @item exact
  4782. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  4783. width/height/x/y as specified and will not be rounded to nearest smaller value.
  4784. It defaults to 0.
  4785. @end table
  4786. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  4787. expressions containing the following constants:
  4788. @table @option
  4789. @item x
  4790. @item y
  4791. The computed values for @var{x} and @var{y}. They are evaluated for
  4792. each new frame.
  4793. @item in_w
  4794. @item in_h
  4795. The input width and height.
  4796. @item iw
  4797. @item ih
  4798. These are the same as @var{in_w} and @var{in_h}.
  4799. @item out_w
  4800. @item out_h
  4801. The output (cropped) width and height.
  4802. @item ow
  4803. @item oh
  4804. These are the same as @var{out_w} and @var{out_h}.
  4805. @item a
  4806. same as @var{iw} / @var{ih}
  4807. @item sar
  4808. input sample aspect ratio
  4809. @item dar
  4810. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4811. @item hsub
  4812. @item vsub
  4813. horizontal and vertical chroma subsample values. For example for the
  4814. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4815. @item n
  4816. The number of the input frame, starting from 0.
  4817. @item pos
  4818. the position in the file of the input frame, NAN if unknown
  4819. @item t
  4820. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  4821. @end table
  4822. The expression for @var{out_w} may depend on the value of @var{out_h},
  4823. and the expression for @var{out_h} may depend on @var{out_w}, but they
  4824. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  4825. evaluated after @var{out_w} and @var{out_h}.
  4826. The @var{x} and @var{y} parameters specify the expressions for the
  4827. position of the top-left corner of the output (non-cropped) area. They
  4828. are evaluated for each frame. If the evaluated value is not valid, it
  4829. is approximated to the nearest valid value.
  4830. The expression for @var{x} may depend on @var{y}, and the expression
  4831. for @var{y} may depend on @var{x}.
  4832. @subsection Examples
  4833. @itemize
  4834. @item
  4835. Crop area with size 100x100 at position (12,34).
  4836. @example
  4837. crop=100:100:12:34
  4838. @end example
  4839. Using named options, the example above becomes:
  4840. @example
  4841. crop=w=100:h=100:x=12:y=34
  4842. @end example
  4843. @item
  4844. Crop the central input area with size 100x100:
  4845. @example
  4846. crop=100:100
  4847. @end example
  4848. @item
  4849. Crop the central input area with size 2/3 of the input video:
  4850. @example
  4851. crop=2/3*in_w:2/3*in_h
  4852. @end example
  4853. @item
  4854. Crop the input video central square:
  4855. @example
  4856. crop=out_w=in_h
  4857. crop=in_h
  4858. @end example
  4859. @item
  4860. Delimit the rectangle with the top-left corner placed at position
  4861. 100:100 and the right-bottom corner corresponding to the right-bottom
  4862. corner of the input image.
  4863. @example
  4864. crop=in_w-100:in_h-100:100:100
  4865. @end example
  4866. @item
  4867. Crop 10 pixels from the left and right borders, and 20 pixels from
  4868. the top and bottom borders
  4869. @example
  4870. crop=in_w-2*10:in_h-2*20
  4871. @end example
  4872. @item
  4873. Keep only the bottom right quarter of the input image:
  4874. @example
  4875. crop=in_w/2:in_h/2:in_w/2:in_h/2
  4876. @end example
  4877. @item
  4878. Crop height for getting Greek harmony:
  4879. @example
  4880. crop=in_w:1/PHI*in_w
  4881. @end example
  4882. @item
  4883. Apply trembling effect:
  4884. @example
  4885. 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)
  4886. @end example
  4887. @item
  4888. Apply erratic camera effect depending on timestamp:
  4889. @example
  4890. 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)"
  4891. @end example
  4892. @item
  4893. Set x depending on the value of y:
  4894. @example
  4895. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  4896. @end example
  4897. @end itemize
  4898. @subsection Commands
  4899. This filter supports the following commands:
  4900. @table @option
  4901. @item w, out_w
  4902. @item h, out_h
  4903. @item x
  4904. @item y
  4905. Set width/height of the output video and the horizontal/vertical position
  4906. in the input video.
  4907. The command accepts the same syntax of the corresponding option.
  4908. If the specified expression is not valid, it is kept at its current
  4909. value.
  4910. @end table
  4911. @section cropdetect
  4912. Auto-detect the crop size.
  4913. It calculates the necessary cropping parameters and prints the
  4914. recommended parameters via the logging system. The detected dimensions
  4915. correspond to the non-black area of the input video.
  4916. It accepts the following parameters:
  4917. @table @option
  4918. @item limit
  4919. Set higher black value threshold, which can be optionally specified
  4920. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  4921. value greater to the set value is considered non-black. It defaults to 24.
  4922. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  4923. on the bitdepth of the pixel format.
  4924. @item round
  4925. The value which the width/height should be divisible by. It defaults to
  4926. 16. The offset is automatically adjusted to center the video. Use 2 to
  4927. get only even dimensions (needed for 4:2:2 video). 16 is best when
  4928. encoding to most video codecs.
  4929. @item reset_count, reset
  4930. Set the counter that determines after how many frames cropdetect will
  4931. reset the previously detected largest video area and start over to
  4932. detect the current optimal crop area. Default value is 0.
  4933. This can be useful when channel logos distort the video area. 0
  4934. indicates 'never reset', and returns the largest area encountered during
  4935. playback.
  4936. @end table
  4937. @anchor{curves}
  4938. @section curves
  4939. Apply color adjustments using curves.
  4940. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  4941. component (red, green and blue) has its values defined by @var{N} key points
  4942. tied from each other using a smooth curve. The x-axis represents the pixel
  4943. values from the input frame, and the y-axis the new pixel values to be set for
  4944. the output frame.
  4945. By default, a component curve is defined by the two points @var{(0;0)} and
  4946. @var{(1;1)}. This creates a straight line where each original pixel value is
  4947. "adjusted" to its own value, which means no change to the image.
  4948. The filter allows you to redefine these two points and add some more. A new
  4949. curve (using a natural cubic spline interpolation) will be define to pass
  4950. smoothly through all these new coordinates. The new defined points needs to be
  4951. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  4952. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  4953. the vector spaces, the values will be clipped accordingly.
  4954. The filter accepts the following options:
  4955. @table @option
  4956. @item preset
  4957. Select one of the available color presets. This option can be used in addition
  4958. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  4959. options takes priority on the preset values.
  4960. Available presets are:
  4961. @table @samp
  4962. @item none
  4963. @item color_negative
  4964. @item cross_process
  4965. @item darker
  4966. @item increase_contrast
  4967. @item lighter
  4968. @item linear_contrast
  4969. @item medium_contrast
  4970. @item negative
  4971. @item strong_contrast
  4972. @item vintage
  4973. @end table
  4974. Default is @code{none}.
  4975. @item master, m
  4976. Set the master key points. These points will define a second pass mapping. It
  4977. is sometimes called a "luminance" or "value" mapping. It can be used with
  4978. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  4979. post-processing LUT.
  4980. @item red, r
  4981. Set the key points for the red component.
  4982. @item green, g
  4983. Set the key points for the green component.
  4984. @item blue, b
  4985. Set the key points for the blue component.
  4986. @item all
  4987. Set the key points for all components (not including master).
  4988. Can be used in addition to the other key points component
  4989. options. In this case, the unset component(s) will fallback on this
  4990. @option{all} setting.
  4991. @item psfile
  4992. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  4993. @item plot
  4994. Save Gnuplot script of the curves in specified file.
  4995. @end table
  4996. To avoid some filtergraph syntax conflicts, each key points list need to be
  4997. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  4998. @subsection Examples
  4999. @itemize
  5000. @item
  5001. Increase slightly the middle level of blue:
  5002. @example
  5003. curves=blue='0/0 0.5/0.58 1/1'
  5004. @end example
  5005. @item
  5006. Vintage effect:
  5007. @example
  5008. 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'
  5009. @end example
  5010. Here we obtain the following coordinates for each components:
  5011. @table @var
  5012. @item red
  5013. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  5014. @item green
  5015. @code{(0;0) (0.50;0.48) (1;1)}
  5016. @item blue
  5017. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  5018. @end table
  5019. @item
  5020. The previous example can also be achieved with the associated built-in preset:
  5021. @example
  5022. curves=preset=vintage
  5023. @end example
  5024. @item
  5025. Or simply:
  5026. @example
  5027. curves=vintage
  5028. @end example
  5029. @item
  5030. Use a Photoshop preset and redefine the points of the green component:
  5031. @example
  5032. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  5033. @end example
  5034. @item
  5035. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  5036. and @command{gnuplot}:
  5037. @example
  5038. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  5039. gnuplot -p /tmp/curves.plt
  5040. @end example
  5041. @end itemize
  5042. @section datascope
  5043. Video data analysis filter.
  5044. This filter shows hexadecimal pixel values of part of video.
  5045. The filter accepts the following options:
  5046. @table @option
  5047. @item size, s
  5048. Set output video size.
  5049. @item x
  5050. Set x offset from where to pick pixels.
  5051. @item y
  5052. Set y offset from where to pick pixels.
  5053. @item mode
  5054. Set scope mode, can be one of the following:
  5055. @table @samp
  5056. @item mono
  5057. Draw hexadecimal pixel values with white color on black background.
  5058. @item color
  5059. Draw hexadecimal pixel values with input video pixel color on black
  5060. background.
  5061. @item color2
  5062. Draw hexadecimal pixel values on color background picked from input video,
  5063. the text color is picked in such way so its always visible.
  5064. @end table
  5065. @item axis
  5066. Draw rows and columns numbers on left and top of video.
  5067. @item opacity
  5068. Set background opacity.
  5069. @end table
  5070. @section dctdnoiz
  5071. Denoise frames using 2D DCT (frequency domain filtering).
  5072. This filter is not designed for real time.
  5073. The filter accepts the following options:
  5074. @table @option
  5075. @item sigma, s
  5076. Set the noise sigma constant.
  5077. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  5078. coefficient (absolute value) below this threshold with be dropped.
  5079. If you need a more advanced filtering, see @option{expr}.
  5080. Default is @code{0}.
  5081. @item overlap
  5082. Set number overlapping pixels for each block. Since the filter can be slow, you
  5083. may want to reduce this value, at the cost of a less effective filter and the
  5084. risk of various artefacts.
  5085. If the overlapping value doesn't permit processing the whole input width or
  5086. height, a warning will be displayed and according borders won't be denoised.
  5087. Default value is @var{blocksize}-1, which is the best possible setting.
  5088. @item expr, e
  5089. Set the coefficient factor expression.
  5090. For each coefficient of a DCT block, this expression will be evaluated as a
  5091. multiplier value for the coefficient.
  5092. If this is option is set, the @option{sigma} option will be ignored.
  5093. The absolute value of the coefficient can be accessed through the @var{c}
  5094. variable.
  5095. @item n
  5096. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  5097. @var{blocksize}, which is the width and height of the processed blocks.
  5098. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  5099. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5100. on the speed processing. Also, a larger block size does not necessarily means a
  5101. better de-noising.
  5102. @end table
  5103. @subsection Examples
  5104. Apply a denoise with a @option{sigma} of @code{4.5}:
  5105. @example
  5106. dctdnoiz=4.5
  5107. @end example
  5108. The same operation can be achieved using the expression system:
  5109. @example
  5110. dctdnoiz=e='gte(c, 4.5*3)'
  5111. @end example
  5112. Violent denoise using a block size of @code{16x16}:
  5113. @example
  5114. dctdnoiz=15:n=4
  5115. @end example
  5116. @section deband
  5117. Remove banding artifacts from input video.
  5118. It works by replacing banded pixels with average value of referenced pixels.
  5119. The filter accepts the following options:
  5120. @table @option
  5121. @item 1thr
  5122. @item 2thr
  5123. @item 3thr
  5124. @item 4thr
  5125. Set banding detection threshold for each plane. Default is 0.02.
  5126. Valid range is 0.00003 to 0.5.
  5127. If difference between current pixel and reference pixel is less than threshold,
  5128. it will be considered as banded.
  5129. @item range, r
  5130. Banding detection range in pixels. Default is 16. If positive, random number
  5131. in range 0 to set value will be used. If negative, exact absolute value
  5132. will be used.
  5133. The range defines square of four pixels around current pixel.
  5134. @item direction, d
  5135. Set direction in radians from which four pixel will be compared. If positive,
  5136. random direction from 0 to set direction will be picked. If negative, exact of
  5137. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5138. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5139. column.
  5140. @item blur, b
  5141. If enabled, current pixel is compared with average value of all four
  5142. surrounding pixels. The default is enabled. If disabled current pixel is
  5143. compared with all four surrounding pixels. The pixel is considered banded
  5144. if only all four differences with surrounding pixels are less than threshold.
  5145. @item coupling, c
  5146. If enabled, current pixel is changed if and only if all pixel components are banded,
  5147. e.g. banding detection threshold is triggered for all color components.
  5148. The default is disabled.
  5149. @end table
  5150. @anchor{decimate}
  5151. @section decimate
  5152. Drop duplicated frames at regular intervals.
  5153. The filter accepts the following options:
  5154. @table @option
  5155. @item cycle
  5156. Set the number of frames from which one will be dropped. Setting this to
  5157. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  5158. Default is @code{5}.
  5159. @item dupthresh
  5160. Set the threshold for duplicate detection. If the difference metric for a frame
  5161. is less than or equal to this value, then it is declared as duplicate. Default
  5162. is @code{1.1}
  5163. @item scthresh
  5164. Set scene change threshold. Default is @code{15}.
  5165. @item blockx
  5166. @item blocky
  5167. Set the size of the x and y-axis blocks used during metric calculations.
  5168. Larger blocks give better noise suppression, but also give worse detection of
  5169. small movements. Must be a power of two. Default is @code{32}.
  5170. @item ppsrc
  5171. Mark main input as a pre-processed input and activate clean source input
  5172. stream. This allows the input to be pre-processed with various filters to help
  5173. the metrics calculation while keeping the frame selection lossless. When set to
  5174. @code{1}, the first stream is for the pre-processed input, and the second
  5175. stream is the clean source from where the kept frames are chosen. Default is
  5176. @code{0}.
  5177. @item chroma
  5178. Set whether or not chroma is considered in the metric calculations. Default is
  5179. @code{1}.
  5180. @end table
  5181. @section deflate
  5182. Apply deflate effect to the video.
  5183. This filter replaces the pixel by the local(3x3) average by taking into account
  5184. only values lower than the pixel.
  5185. It accepts the following options:
  5186. @table @option
  5187. @item threshold0
  5188. @item threshold1
  5189. @item threshold2
  5190. @item threshold3
  5191. Limit the maximum change for each plane, default is 65535.
  5192. If 0, plane will remain unchanged.
  5193. @end table
  5194. @section deflicker
  5195. Remove temporal frame luminance variations.
  5196. It accepts the following options:
  5197. @table @option
  5198. @item size, s
  5199. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  5200. @item mode, m
  5201. Set averaging mode to smooth temporal luminance variations.
  5202. Available values are:
  5203. @table @samp
  5204. @item am
  5205. Arithmetic mean
  5206. @item gm
  5207. Geometric mean
  5208. @item hm
  5209. Harmonic mean
  5210. @item qm
  5211. Quadratic mean
  5212. @item cm
  5213. Cubic mean
  5214. @item pm
  5215. Power mean
  5216. @item median
  5217. Median
  5218. @end table
  5219. @item bypass
  5220. Do not actually modify frame. Useful when one only wants metadata.
  5221. @end table
  5222. @section dejudder
  5223. Remove judder produced by partially interlaced telecined content.
  5224. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  5225. source was partially telecined content then the output of @code{pullup,dejudder}
  5226. will have a variable frame rate. May change the recorded frame rate of the
  5227. container. Aside from that change, this filter will not affect constant frame
  5228. rate video.
  5229. The option available in this filter is:
  5230. @table @option
  5231. @item cycle
  5232. Specify the length of the window over which the judder repeats.
  5233. Accepts any integer greater than 1. Useful values are:
  5234. @table @samp
  5235. @item 4
  5236. If the original was telecined from 24 to 30 fps (Film to NTSC).
  5237. @item 5
  5238. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  5239. @item 20
  5240. If a mixture of the two.
  5241. @end table
  5242. The default is @samp{4}.
  5243. @end table
  5244. @section delogo
  5245. Suppress a TV station logo by a simple interpolation of the surrounding
  5246. pixels. Just set a rectangle covering the logo and watch it disappear
  5247. (and sometimes something even uglier appear - your mileage may vary).
  5248. It accepts the following parameters:
  5249. @table @option
  5250. @item x
  5251. @item y
  5252. Specify the top left corner coordinates of the logo. They must be
  5253. specified.
  5254. @item w
  5255. @item h
  5256. Specify the width and height of the logo to clear. They must be
  5257. specified.
  5258. @item band, t
  5259. Specify the thickness of the fuzzy edge of the rectangle (added to
  5260. @var{w} and @var{h}). The default value is 1. This option is
  5261. deprecated, setting higher values should no longer be necessary and
  5262. is not recommended.
  5263. @item show
  5264. When set to 1, a green rectangle is drawn on the screen to simplify
  5265. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  5266. The default value is 0.
  5267. The rectangle is drawn on the outermost pixels which will be (partly)
  5268. replaced with interpolated values. The values of the next pixels
  5269. immediately outside this rectangle in each direction will be used to
  5270. compute the interpolated pixel values inside the rectangle.
  5271. @end table
  5272. @subsection Examples
  5273. @itemize
  5274. @item
  5275. Set a rectangle covering the area with top left corner coordinates 0,0
  5276. and size 100x77, and a band of size 10:
  5277. @example
  5278. delogo=x=0:y=0:w=100:h=77:band=10
  5279. @end example
  5280. @end itemize
  5281. @section deshake
  5282. Attempt to fix small changes in horizontal and/or vertical shift. This
  5283. filter helps remove camera shake from hand-holding a camera, bumping a
  5284. tripod, moving on a vehicle, etc.
  5285. The filter accepts the following options:
  5286. @table @option
  5287. @item x
  5288. @item y
  5289. @item w
  5290. @item h
  5291. Specify a rectangular area where to limit the search for motion
  5292. vectors.
  5293. If desired the search for motion vectors can be limited to a
  5294. rectangular area of the frame defined by its top left corner, width
  5295. and height. These parameters have the same meaning as the drawbox
  5296. filter which can be used to visualise the position of the bounding
  5297. box.
  5298. This is useful when simultaneous movement of subjects within the frame
  5299. might be confused for camera motion by the motion vector search.
  5300. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  5301. then the full frame is used. This allows later options to be set
  5302. without specifying the bounding box for the motion vector search.
  5303. Default - search the whole frame.
  5304. @item rx
  5305. @item ry
  5306. Specify the maximum extent of movement in x and y directions in the
  5307. range 0-64 pixels. Default 16.
  5308. @item edge
  5309. Specify how to generate pixels to fill blanks at the edge of the
  5310. frame. Available values are:
  5311. @table @samp
  5312. @item blank, 0
  5313. Fill zeroes at blank locations
  5314. @item original, 1
  5315. Original image at blank locations
  5316. @item clamp, 2
  5317. Extruded edge value at blank locations
  5318. @item mirror, 3
  5319. Mirrored edge at blank locations
  5320. @end table
  5321. Default value is @samp{mirror}.
  5322. @item blocksize
  5323. Specify the blocksize to use for motion search. Range 4-128 pixels,
  5324. default 8.
  5325. @item contrast
  5326. Specify the contrast threshold for blocks. Only blocks with more than
  5327. the specified contrast (difference between darkest and lightest
  5328. pixels) will be considered. Range 1-255, default 125.
  5329. @item search
  5330. Specify the search strategy. Available values are:
  5331. @table @samp
  5332. @item exhaustive, 0
  5333. Set exhaustive search
  5334. @item less, 1
  5335. Set less exhaustive search.
  5336. @end table
  5337. Default value is @samp{exhaustive}.
  5338. @item filename
  5339. If set then a detailed log of the motion search is written to the
  5340. specified file.
  5341. @end table
  5342. @section despill
  5343. Remove unwanted contamination of foreground colors, caused by reflected color of
  5344. greenscreen or bluescreen.
  5345. This filter accepts the following options:
  5346. @table @option
  5347. @item type
  5348. Set what type of despill to use.
  5349. @item mix
  5350. Set how spillmap will be generated.
  5351. @item expand
  5352. Set how much to get rid of still remaining spill.
  5353. @item red
  5354. Controls amount of red in spill area.
  5355. @item green
  5356. Controls amount of green in spill area.
  5357. Should be -1 for greenscreen.
  5358. @item blue
  5359. Controls amount of blue in spill area.
  5360. Should be -1 for bluescreen.
  5361. @item brightness
  5362. Controls brightness of spill area, preserving colors.
  5363. @item alpha
  5364. Modify alpha from generated spillmap.
  5365. @end table
  5366. @section detelecine
  5367. Apply an exact inverse of the telecine operation. It requires a predefined
  5368. pattern specified using the pattern option which must be the same as that passed
  5369. to the telecine filter.
  5370. This filter accepts the following options:
  5371. @table @option
  5372. @item first_field
  5373. @table @samp
  5374. @item top, t
  5375. top field first
  5376. @item bottom, b
  5377. bottom field first
  5378. The default value is @code{top}.
  5379. @end table
  5380. @item pattern
  5381. A string of numbers representing the pulldown pattern you wish to apply.
  5382. The default value is @code{23}.
  5383. @item start_frame
  5384. A number representing position of the first frame with respect to the telecine
  5385. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  5386. @end table
  5387. @section dilation
  5388. Apply dilation effect to the video.
  5389. This filter replaces the pixel by the local(3x3) maximum.
  5390. It accepts the following options:
  5391. @table @option
  5392. @item threshold0
  5393. @item threshold1
  5394. @item threshold2
  5395. @item threshold3
  5396. Limit the maximum change for each plane, default is 65535.
  5397. If 0, plane will remain unchanged.
  5398. @item coordinates
  5399. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5400. pixels are used.
  5401. Flags to local 3x3 coordinates maps like this:
  5402. 1 2 3
  5403. 4 5
  5404. 6 7 8
  5405. @end table
  5406. @section displace
  5407. Displace pixels as indicated by second and third input stream.
  5408. It takes three input streams and outputs one stream, the first input is the
  5409. source, and second and third input are displacement maps.
  5410. The second input specifies how much to displace pixels along the
  5411. x-axis, while the third input specifies how much to displace pixels
  5412. along the y-axis.
  5413. If one of displacement map streams terminates, last frame from that
  5414. displacement map will be used.
  5415. Note that once generated, displacements maps can be reused over and over again.
  5416. A description of the accepted options follows.
  5417. @table @option
  5418. @item edge
  5419. Set displace behavior for pixels that are out of range.
  5420. Available values are:
  5421. @table @samp
  5422. @item blank
  5423. Missing pixels are replaced by black pixels.
  5424. @item smear
  5425. Adjacent pixels will spread out to replace missing pixels.
  5426. @item wrap
  5427. Out of range pixels are wrapped so they point to pixels of other side.
  5428. @item mirror
  5429. Out of range pixels will be replaced with mirrored pixels.
  5430. @end table
  5431. Default is @samp{smear}.
  5432. @end table
  5433. @subsection Examples
  5434. @itemize
  5435. @item
  5436. Add ripple effect to rgb input of video size hd720:
  5437. @example
  5438. 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
  5439. @end example
  5440. @item
  5441. Add wave effect to rgb input of video size hd720:
  5442. @example
  5443. 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
  5444. @end example
  5445. @end itemize
  5446. @section drawbox
  5447. Draw a colored box on the input image.
  5448. It accepts the following parameters:
  5449. @table @option
  5450. @item x
  5451. @item y
  5452. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5453. @item width, w
  5454. @item height, h
  5455. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5456. the input width and height. It defaults to 0.
  5457. @item color, c
  5458. Specify the color of the box to write. For the general syntax of this option,
  5459. check the "Color" section in the ffmpeg-utils manual. If the special
  5460. value @code{invert} is used, the box edge color is the same as the
  5461. video with inverted luma.
  5462. @item thickness, t
  5463. The expression which sets the thickness of the box edge. Default value is @code{3}.
  5464. See below for the list of accepted constants.
  5465. @end table
  5466. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5467. following constants:
  5468. @table @option
  5469. @item dar
  5470. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5471. @item hsub
  5472. @item vsub
  5473. horizontal and vertical chroma subsample values. For example for the
  5474. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5475. @item in_h, ih
  5476. @item in_w, iw
  5477. The input width and height.
  5478. @item sar
  5479. The input sample aspect ratio.
  5480. @item x
  5481. @item y
  5482. The x and y offset coordinates where the box is drawn.
  5483. @item w
  5484. @item h
  5485. The width and height of the drawn box.
  5486. @item t
  5487. The thickness of the drawn box.
  5488. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5489. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5490. @end table
  5491. @subsection Examples
  5492. @itemize
  5493. @item
  5494. Draw a black box around the edge of the input image:
  5495. @example
  5496. drawbox
  5497. @end example
  5498. @item
  5499. Draw a box with color red and an opacity of 50%:
  5500. @example
  5501. drawbox=10:20:200:60:red@@0.5
  5502. @end example
  5503. The previous example can be specified as:
  5504. @example
  5505. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5506. @end example
  5507. @item
  5508. Fill the box with pink color:
  5509. @example
  5510. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  5511. @end example
  5512. @item
  5513. Draw a 2-pixel red 2.40:1 mask:
  5514. @example
  5515. 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
  5516. @end example
  5517. @end itemize
  5518. @section drawgrid
  5519. Draw a grid on the input image.
  5520. It accepts the following parameters:
  5521. @table @option
  5522. @item x
  5523. @item y
  5524. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5525. @item width, w
  5526. @item height, h
  5527. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5528. input width and height, respectively, minus @code{thickness}, so image gets
  5529. framed. Default to 0.
  5530. @item color, c
  5531. Specify the color of the grid. For the general syntax of this option,
  5532. check the "Color" section in the ffmpeg-utils manual. If the special
  5533. value @code{invert} is used, the grid color is the same as the
  5534. video with inverted luma.
  5535. @item thickness, t
  5536. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5537. See below for the list of accepted constants.
  5538. @end table
  5539. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5540. following constants:
  5541. @table @option
  5542. @item dar
  5543. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5544. @item hsub
  5545. @item vsub
  5546. horizontal and vertical chroma subsample values. For example for the
  5547. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5548. @item in_h, ih
  5549. @item in_w, iw
  5550. The input grid cell width and height.
  5551. @item sar
  5552. The input sample aspect ratio.
  5553. @item x
  5554. @item y
  5555. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5556. @item w
  5557. @item h
  5558. The width and height of the drawn cell.
  5559. @item t
  5560. The thickness of the drawn cell.
  5561. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5562. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5563. @end table
  5564. @subsection Examples
  5565. @itemize
  5566. @item
  5567. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5568. @example
  5569. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5570. @end example
  5571. @item
  5572. Draw a white 3x3 grid with an opacity of 50%:
  5573. @example
  5574. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5575. @end example
  5576. @end itemize
  5577. @anchor{drawtext}
  5578. @section drawtext
  5579. Draw a text string or text from a specified file on top of a video, using the
  5580. libfreetype library.
  5581. To enable compilation of this filter, you need to configure FFmpeg with
  5582. @code{--enable-libfreetype}.
  5583. To enable default font fallback and the @var{font} option you need to
  5584. configure FFmpeg with @code{--enable-libfontconfig}.
  5585. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5586. @code{--enable-libfribidi}.
  5587. @subsection Syntax
  5588. It accepts the following parameters:
  5589. @table @option
  5590. @item box
  5591. Used to draw a box around text using the background color.
  5592. The value must be either 1 (enable) or 0 (disable).
  5593. The default value of @var{box} is 0.
  5594. @item boxborderw
  5595. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5596. The default value of @var{boxborderw} is 0.
  5597. @item boxcolor
  5598. The color to be used for drawing box around text. For the syntax of this
  5599. option, check the "Color" section in the ffmpeg-utils manual.
  5600. The default value of @var{boxcolor} is "white".
  5601. @item line_spacing
  5602. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  5603. The default value of @var{line_spacing} is 0.
  5604. @item borderw
  5605. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5606. The default value of @var{borderw} is 0.
  5607. @item bordercolor
  5608. Set the color to be used for drawing border around text. For the syntax of this
  5609. option, check the "Color" section in the ffmpeg-utils manual.
  5610. The default value of @var{bordercolor} is "black".
  5611. @item expansion
  5612. Select how the @var{text} is expanded. Can be either @code{none},
  5613. @code{strftime} (deprecated) or
  5614. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5615. below for details.
  5616. @item basetime
  5617. Set a start time for the count. Value is in microseconds. Only applied
  5618. in the deprecated strftime expansion mode. To emulate in normal expansion
  5619. mode use the @code{pts} function, supplying the start time (in seconds)
  5620. as the second argument.
  5621. @item fix_bounds
  5622. If true, check and fix text coords to avoid clipping.
  5623. @item fontcolor
  5624. The color to be used for drawing fonts. For the syntax of this option, check
  5625. the "Color" section in the ffmpeg-utils manual.
  5626. The default value of @var{fontcolor} is "black".
  5627. @item fontcolor_expr
  5628. String which is expanded the same way as @var{text} to obtain dynamic
  5629. @var{fontcolor} value. By default this option has empty value and is not
  5630. processed. When this option is set, it overrides @var{fontcolor} option.
  5631. @item font
  5632. The font family to be used for drawing text. By default Sans.
  5633. @item fontfile
  5634. The font file to be used for drawing text. The path must be included.
  5635. This parameter is mandatory if the fontconfig support is disabled.
  5636. @item alpha
  5637. Draw the text applying alpha blending. The value can
  5638. be a number between 0.0 and 1.0.
  5639. The expression accepts the same variables @var{x, y} as well.
  5640. The default value is 1.
  5641. Please see @var{fontcolor_expr}.
  5642. @item fontsize
  5643. The font size to be used for drawing text.
  5644. The default value of @var{fontsize} is 16.
  5645. @item text_shaping
  5646. If set to 1, attempt to shape the text (for example, reverse the order of
  5647. right-to-left text and join Arabic characters) before drawing it.
  5648. Otherwise, just draw the text exactly as given.
  5649. By default 1 (if supported).
  5650. @item ft_load_flags
  5651. The flags to be used for loading the fonts.
  5652. The flags map the corresponding flags supported by libfreetype, and are
  5653. a combination of the following values:
  5654. @table @var
  5655. @item default
  5656. @item no_scale
  5657. @item no_hinting
  5658. @item render
  5659. @item no_bitmap
  5660. @item vertical_layout
  5661. @item force_autohint
  5662. @item crop_bitmap
  5663. @item pedantic
  5664. @item ignore_global_advance_width
  5665. @item no_recurse
  5666. @item ignore_transform
  5667. @item monochrome
  5668. @item linear_design
  5669. @item no_autohint
  5670. @end table
  5671. Default value is "default".
  5672. For more information consult the documentation for the FT_LOAD_*
  5673. libfreetype flags.
  5674. @item shadowcolor
  5675. The color to be used for drawing a shadow behind the drawn text. For the
  5676. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  5677. The default value of @var{shadowcolor} is "black".
  5678. @item shadowx
  5679. @item shadowy
  5680. The x and y offsets for the text shadow position with respect to the
  5681. position of the text. They can be either positive or negative
  5682. values. The default value for both is "0".
  5683. @item start_number
  5684. The starting frame number for the n/frame_num variable. The default value
  5685. is "0".
  5686. @item tabsize
  5687. The size in number of spaces to use for rendering the tab.
  5688. Default value is 4.
  5689. @item timecode
  5690. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5691. format. It can be used with or without text parameter. @var{timecode_rate}
  5692. option must be specified.
  5693. @item timecode_rate, rate, r
  5694. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  5695. integer. Minimum value is "1".
  5696. Drop-frame timecode is supported for frame rates 30 & 60.
  5697. @item tc24hmax
  5698. If set to 1, the output of the timecode option will wrap around at 24 hours.
  5699. Default is 0 (disabled).
  5700. @item text
  5701. The text string to be drawn. The text must be a sequence of UTF-8
  5702. encoded characters.
  5703. This parameter is mandatory if no file is specified with the parameter
  5704. @var{textfile}.
  5705. @item textfile
  5706. A text file containing text to be drawn. The text must be a sequence
  5707. of UTF-8 encoded characters.
  5708. This parameter is mandatory if no text string is specified with the
  5709. parameter @var{text}.
  5710. If both @var{text} and @var{textfile} are specified, an error is thrown.
  5711. @item reload
  5712. If set to 1, the @var{textfile} will be reloaded before each frame.
  5713. Be sure to update it atomically, or it may be read partially, or even fail.
  5714. @item x
  5715. @item y
  5716. The expressions which specify the offsets where text will be drawn
  5717. within the video frame. They are relative to the top/left border of the
  5718. output image.
  5719. The default value of @var{x} and @var{y} is "0".
  5720. See below for the list of accepted constants and functions.
  5721. @end table
  5722. The parameters for @var{x} and @var{y} are expressions containing the
  5723. following constants and functions:
  5724. @table @option
  5725. @item dar
  5726. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  5727. @item hsub
  5728. @item vsub
  5729. horizontal and vertical chroma subsample values. For example for the
  5730. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5731. @item line_h, lh
  5732. the height of each text line
  5733. @item main_h, h, H
  5734. the input height
  5735. @item main_w, w, W
  5736. the input width
  5737. @item max_glyph_a, ascent
  5738. the maximum distance from the baseline to the highest/upper grid
  5739. coordinate used to place a glyph outline point, for all the rendered
  5740. glyphs.
  5741. It is a positive value, due to the grid's orientation with the Y axis
  5742. upwards.
  5743. @item max_glyph_d, descent
  5744. the maximum distance from the baseline to the lowest grid coordinate
  5745. used to place a glyph outline point, for all the rendered glyphs.
  5746. This is a negative value, due to the grid's orientation, with the Y axis
  5747. upwards.
  5748. @item max_glyph_h
  5749. maximum glyph height, that is the maximum height for all the glyphs
  5750. contained in the rendered text, it is equivalent to @var{ascent} -
  5751. @var{descent}.
  5752. @item max_glyph_w
  5753. maximum glyph width, that is the maximum width for all the glyphs
  5754. contained in the rendered text
  5755. @item n
  5756. the number of input frame, starting from 0
  5757. @item rand(min, max)
  5758. return a random number included between @var{min} and @var{max}
  5759. @item sar
  5760. The input sample aspect ratio.
  5761. @item t
  5762. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5763. @item text_h, th
  5764. the height of the rendered text
  5765. @item text_w, tw
  5766. the width of the rendered text
  5767. @item x
  5768. @item y
  5769. the x and y offset coordinates where the text is drawn.
  5770. These parameters allow the @var{x} and @var{y} expressions to refer
  5771. each other, so you can for example specify @code{y=x/dar}.
  5772. @end table
  5773. @anchor{drawtext_expansion}
  5774. @subsection Text expansion
  5775. If @option{expansion} is set to @code{strftime},
  5776. the filter recognizes strftime() sequences in the provided text and
  5777. expands them accordingly. Check the documentation of strftime(). This
  5778. feature is deprecated.
  5779. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  5780. If @option{expansion} is set to @code{normal} (which is the default),
  5781. the following expansion mechanism is used.
  5782. The backslash character @samp{\}, followed by any character, always expands to
  5783. the second character.
  5784. Sequences of the form @code{%@{...@}} are expanded. The text between the
  5785. braces is a function name, possibly followed by arguments separated by ':'.
  5786. If the arguments contain special characters or delimiters (':' or '@}'),
  5787. they should be escaped.
  5788. Note that they probably must also be escaped as the value for the
  5789. @option{text} option in the filter argument string and as the filter
  5790. argument in the filtergraph description, and possibly also for the shell,
  5791. that makes up to four levels of escaping; using a text file avoids these
  5792. problems.
  5793. The following functions are available:
  5794. @table @command
  5795. @item expr, e
  5796. The expression evaluation result.
  5797. It must take one argument specifying the expression to be evaluated,
  5798. which accepts the same constants and functions as the @var{x} and
  5799. @var{y} values. Note that not all constants should be used, for
  5800. example the text size is not known when evaluating the expression, so
  5801. the constants @var{text_w} and @var{text_h} will have an undefined
  5802. value.
  5803. @item expr_int_format, eif
  5804. Evaluate the expression's value and output as formatted integer.
  5805. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  5806. The second argument specifies the output format. Allowed values are @samp{x},
  5807. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  5808. @code{printf} function.
  5809. The third parameter is optional and sets the number of positions taken by the output.
  5810. It can be used to add padding with zeros from the left.
  5811. @item gmtime
  5812. The time at which the filter is running, expressed in UTC.
  5813. It can accept an argument: a strftime() format string.
  5814. @item localtime
  5815. The time at which the filter is running, expressed in the local time zone.
  5816. It can accept an argument: a strftime() format string.
  5817. @item metadata
  5818. Frame metadata. Takes one or two arguments.
  5819. The first argument is mandatory and specifies the metadata key.
  5820. The second argument is optional and specifies a default value, used when the
  5821. metadata key is not found or empty.
  5822. @item n, frame_num
  5823. The frame number, starting from 0.
  5824. @item pict_type
  5825. A 1 character description of the current picture type.
  5826. @item pts
  5827. The timestamp of the current frame.
  5828. It can take up to three arguments.
  5829. The first argument is the format of the timestamp; it defaults to @code{flt}
  5830. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  5831. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  5832. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  5833. @code{localtime} stands for the timestamp of the frame formatted as
  5834. local time zone time.
  5835. The second argument is an offset added to the timestamp.
  5836. If the format is set to @code{localtime} or @code{gmtime},
  5837. a third argument may be supplied: a strftime() format string.
  5838. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  5839. @end table
  5840. @subsection Examples
  5841. @itemize
  5842. @item
  5843. Draw "Test Text" with font FreeSerif, using the default values for the
  5844. optional parameters.
  5845. @example
  5846. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  5847. @end example
  5848. @item
  5849. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  5850. and y=50 (counting from the top-left corner of the screen), text is
  5851. yellow with a red box around it. Both the text and the box have an
  5852. opacity of 20%.
  5853. @example
  5854. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  5855. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  5856. @end example
  5857. Note that the double quotes are not necessary if spaces are not used
  5858. within the parameter list.
  5859. @item
  5860. Show the text at the center of the video frame:
  5861. @example
  5862. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  5863. @end example
  5864. @item
  5865. Show the text at a random position, switching to a new position every 30 seconds:
  5866. @example
  5867. 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)"
  5868. @end example
  5869. @item
  5870. Show a text line sliding from right to left in the last row of the video
  5871. frame. The file @file{LONG_LINE} is assumed to contain a single line
  5872. with no newlines.
  5873. @example
  5874. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  5875. @end example
  5876. @item
  5877. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  5878. @example
  5879. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  5880. @end example
  5881. @item
  5882. Draw a single green letter "g", at the center of the input video.
  5883. The glyph baseline is placed at half screen height.
  5884. @example
  5885. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  5886. @end example
  5887. @item
  5888. Show text for 1 second every 3 seconds:
  5889. @example
  5890. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  5891. @end example
  5892. @item
  5893. Use fontconfig to set the font. Note that the colons need to be escaped.
  5894. @example
  5895. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  5896. @end example
  5897. @item
  5898. Print the date of a real-time encoding (see strftime(3)):
  5899. @example
  5900. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  5901. @end example
  5902. @item
  5903. Show text fading in and out (appearing/disappearing):
  5904. @example
  5905. #!/bin/sh
  5906. DS=1.0 # display start
  5907. DE=10.0 # display end
  5908. FID=1.5 # fade in duration
  5909. FOD=5 # fade out duration
  5910. 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 @}"
  5911. @end example
  5912. @item
  5913. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  5914. and the @option{fontsize} value are included in the @option{y} offset.
  5915. @example
  5916. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  5917. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  5918. @end example
  5919. @end itemize
  5920. For more information about libfreetype, check:
  5921. @url{http://www.freetype.org/}.
  5922. For more information about fontconfig, check:
  5923. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  5924. For more information about libfribidi, check:
  5925. @url{http://fribidi.org/}.
  5926. @section edgedetect
  5927. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  5928. The filter accepts the following options:
  5929. @table @option
  5930. @item low
  5931. @item high
  5932. Set low and high threshold values used by the Canny thresholding
  5933. algorithm.
  5934. The high threshold selects the "strong" edge pixels, which are then
  5935. connected through 8-connectivity with the "weak" edge pixels selected
  5936. by the low threshold.
  5937. @var{low} and @var{high} threshold values must be chosen in the range
  5938. [0,1], and @var{low} should be lesser or equal to @var{high}.
  5939. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  5940. is @code{50/255}.
  5941. @item mode
  5942. Define the drawing mode.
  5943. @table @samp
  5944. @item wires
  5945. Draw white/gray wires on black background.
  5946. @item colormix
  5947. Mix the colors to create a paint/cartoon effect.
  5948. @end table
  5949. Default value is @var{wires}.
  5950. @end table
  5951. @subsection Examples
  5952. @itemize
  5953. @item
  5954. Standard edge detection with custom values for the hysteresis thresholding:
  5955. @example
  5956. edgedetect=low=0.1:high=0.4
  5957. @end example
  5958. @item
  5959. Painting effect without thresholding:
  5960. @example
  5961. edgedetect=mode=colormix:high=0
  5962. @end example
  5963. @end itemize
  5964. @section eq
  5965. Set brightness, contrast, saturation and approximate gamma adjustment.
  5966. The filter accepts the following options:
  5967. @table @option
  5968. @item contrast
  5969. Set the contrast expression. The value must be a float value in range
  5970. @code{-2.0} to @code{2.0}. The default value is "1".
  5971. @item brightness
  5972. Set the brightness expression. The value must be a float value in
  5973. range @code{-1.0} to @code{1.0}. The default value is "0".
  5974. @item saturation
  5975. Set the saturation expression. The value must be a float in
  5976. range @code{0.0} to @code{3.0}. The default value is "1".
  5977. @item gamma
  5978. Set the gamma expression. The value must be a float in range
  5979. @code{0.1} to @code{10.0}. The default value is "1".
  5980. @item gamma_r
  5981. Set the gamma expression for red. The value must be a float in
  5982. range @code{0.1} to @code{10.0}. The default value is "1".
  5983. @item gamma_g
  5984. Set the gamma expression for green. The value must be a float in range
  5985. @code{0.1} to @code{10.0}. The default value is "1".
  5986. @item gamma_b
  5987. Set the gamma expression for blue. The value must be a float in range
  5988. @code{0.1} to @code{10.0}. The default value is "1".
  5989. @item gamma_weight
  5990. Set the gamma weight expression. It can be used to reduce the effect
  5991. of a high gamma value on bright image areas, e.g. keep them from
  5992. getting overamplified and just plain white. The value must be a float
  5993. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  5994. gamma correction all the way down while @code{1.0} leaves it at its
  5995. full strength. Default is "1".
  5996. @item eval
  5997. Set when the expressions for brightness, contrast, saturation and
  5998. gamma expressions are evaluated.
  5999. It accepts the following values:
  6000. @table @samp
  6001. @item init
  6002. only evaluate expressions once during the filter initialization or
  6003. when a command is processed
  6004. @item frame
  6005. evaluate expressions for each incoming frame
  6006. @end table
  6007. Default value is @samp{init}.
  6008. @end table
  6009. The expressions accept the following parameters:
  6010. @table @option
  6011. @item n
  6012. frame count of the input frame starting from 0
  6013. @item pos
  6014. byte position of the corresponding packet in the input file, NAN if
  6015. unspecified
  6016. @item r
  6017. frame rate of the input video, NAN if the input frame rate is unknown
  6018. @item t
  6019. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6020. @end table
  6021. @subsection Commands
  6022. The filter supports the following commands:
  6023. @table @option
  6024. @item contrast
  6025. Set the contrast expression.
  6026. @item brightness
  6027. Set the brightness expression.
  6028. @item saturation
  6029. Set the saturation expression.
  6030. @item gamma
  6031. Set the gamma expression.
  6032. @item gamma_r
  6033. Set the gamma_r expression.
  6034. @item gamma_g
  6035. Set gamma_g expression.
  6036. @item gamma_b
  6037. Set gamma_b expression.
  6038. @item gamma_weight
  6039. Set gamma_weight expression.
  6040. The command accepts the same syntax of the corresponding option.
  6041. If the specified expression is not valid, it is kept at its current
  6042. value.
  6043. @end table
  6044. @section erosion
  6045. Apply erosion effect to the video.
  6046. This filter replaces the pixel by the local(3x3) minimum.
  6047. It accepts the following options:
  6048. @table @option
  6049. @item threshold0
  6050. @item threshold1
  6051. @item threshold2
  6052. @item threshold3
  6053. Limit the maximum change for each plane, default is 65535.
  6054. If 0, plane will remain unchanged.
  6055. @item coordinates
  6056. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6057. pixels are used.
  6058. Flags to local 3x3 coordinates maps like this:
  6059. 1 2 3
  6060. 4 5
  6061. 6 7 8
  6062. @end table
  6063. @section extractplanes
  6064. Extract color channel components from input video stream into
  6065. separate grayscale video streams.
  6066. The filter accepts the following option:
  6067. @table @option
  6068. @item planes
  6069. Set plane(s) to extract.
  6070. Available values for planes are:
  6071. @table @samp
  6072. @item y
  6073. @item u
  6074. @item v
  6075. @item a
  6076. @item r
  6077. @item g
  6078. @item b
  6079. @end table
  6080. Choosing planes not available in the input will result in an error.
  6081. That means you cannot select @code{r}, @code{g}, @code{b} planes
  6082. with @code{y}, @code{u}, @code{v} planes at same time.
  6083. @end table
  6084. @subsection Examples
  6085. @itemize
  6086. @item
  6087. Extract luma, u and v color channel component from input video frame
  6088. into 3 grayscale outputs:
  6089. @example
  6090. 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
  6091. @end example
  6092. @end itemize
  6093. @section elbg
  6094. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  6095. For each input image, the filter will compute the optimal mapping from
  6096. the input to the output given the codebook length, that is the number
  6097. of distinct output colors.
  6098. This filter accepts the following options.
  6099. @table @option
  6100. @item codebook_length, l
  6101. Set codebook length. The value must be a positive integer, and
  6102. represents the number of distinct output colors. Default value is 256.
  6103. @item nb_steps, n
  6104. Set the maximum number of iterations to apply for computing the optimal
  6105. mapping. The higher the value the better the result and the higher the
  6106. computation time. Default value is 1.
  6107. @item seed, s
  6108. Set a random seed, must be an integer included between 0 and
  6109. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  6110. will try to use a good random seed on a best effort basis.
  6111. @item pal8
  6112. Set pal8 output pixel format. This option does not work with codebook
  6113. length greater than 256.
  6114. @end table
  6115. @section fade
  6116. Apply a fade-in/out effect to the input video.
  6117. It accepts the following parameters:
  6118. @table @option
  6119. @item type, t
  6120. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  6121. effect.
  6122. Default is @code{in}.
  6123. @item start_frame, s
  6124. Specify the number of the frame to start applying the fade
  6125. effect at. Default is 0.
  6126. @item nb_frames, n
  6127. The number of frames that the fade effect lasts. At the end of the
  6128. fade-in effect, the output video will have the same intensity as the input video.
  6129. At the end of the fade-out transition, the output video will be filled with the
  6130. selected @option{color}.
  6131. Default is 25.
  6132. @item alpha
  6133. If set to 1, fade only alpha channel, if one exists on the input.
  6134. Default value is 0.
  6135. @item start_time, st
  6136. Specify the timestamp (in seconds) of the frame to start to apply the fade
  6137. effect. If both start_frame and start_time are specified, the fade will start at
  6138. whichever comes last. Default is 0.
  6139. @item duration, d
  6140. The number of seconds for which the fade effect has to last. At the end of the
  6141. fade-in effect the output video will have the same intensity as the input video,
  6142. at the end of the fade-out transition the output video will be filled with the
  6143. selected @option{color}.
  6144. If both duration and nb_frames are specified, duration is used. Default is 0
  6145. (nb_frames is used by default).
  6146. @item color, c
  6147. Specify the color of the fade. Default is "black".
  6148. @end table
  6149. @subsection Examples
  6150. @itemize
  6151. @item
  6152. Fade in the first 30 frames of video:
  6153. @example
  6154. fade=in:0:30
  6155. @end example
  6156. The command above is equivalent to:
  6157. @example
  6158. fade=t=in:s=0:n=30
  6159. @end example
  6160. @item
  6161. Fade out the last 45 frames of a 200-frame video:
  6162. @example
  6163. fade=out:155:45
  6164. fade=type=out:start_frame=155:nb_frames=45
  6165. @end example
  6166. @item
  6167. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  6168. @example
  6169. fade=in:0:25, fade=out:975:25
  6170. @end example
  6171. @item
  6172. Make the first 5 frames yellow, then fade in from frame 5-24:
  6173. @example
  6174. fade=in:5:20:color=yellow
  6175. @end example
  6176. @item
  6177. Fade in alpha over first 25 frames of video:
  6178. @example
  6179. fade=in:0:25:alpha=1
  6180. @end example
  6181. @item
  6182. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  6183. @example
  6184. fade=t=in:st=5.5:d=0.5
  6185. @end example
  6186. @end itemize
  6187. @section fftfilt
  6188. Apply arbitrary expressions to samples in frequency domain
  6189. @table @option
  6190. @item dc_Y
  6191. Adjust the dc value (gain) of the luma plane of the image. The filter
  6192. accepts an integer value in range @code{0} to @code{1000}. The default
  6193. value is set to @code{0}.
  6194. @item dc_U
  6195. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  6196. filter accepts an integer value in range @code{0} to @code{1000}. The
  6197. default value is set to @code{0}.
  6198. @item dc_V
  6199. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  6200. filter accepts an integer value in range @code{0} to @code{1000}. The
  6201. default value is set to @code{0}.
  6202. @item weight_Y
  6203. Set the frequency domain weight expression for the luma plane.
  6204. @item weight_U
  6205. Set the frequency domain weight expression for the 1st chroma plane.
  6206. @item weight_V
  6207. Set the frequency domain weight expression for the 2nd chroma plane.
  6208. @item eval
  6209. Set when the expressions are evaluated.
  6210. It accepts the following values:
  6211. @table @samp
  6212. @item init
  6213. Only evaluate expressions once during the filter initialization.
  6214. @item frame
  6215. Evaluate expressions for each incoming frame.
  6216. @end table
  6217. Default value is @samp{init}.
  6218. The filter accepts the following variables:
  6219. @item X
  6220. @item Y
  6221. The coordinates of the current sample.
  6222. @item W
  6223. @item H
  6224. The width and height of the image.
  6225. @item N
  6226. The number of input frame, starting from 0.
  6227. @end table
  6228. @subsection Examples
  6229. @itemize
  6230. @item
  6231. High-pass:
  6232. @example
  6233. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  6234. @end example
  6235. @item
  6236. Low-pass:
  6237. @example
  6238. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  6239. @end example
  6240. @item
  6241. Sharpen:
  6242. @example
  6243. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  6244. @end example
  6245. @item
  6246. Blur:
  6247. @example
  6248. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  6249. @end example
  6250. @end itemize
  6251. @section field
  6252. Extract a single field from an interlaced image using stride
  6253. arithmetic to avoid wasting CPU time. The output frames are marked as
  6254. non-interlaced.
  6255. The filter accepts the following options:
  6256. @table @option
  6257. @item type
  6258. Specify whether to extract the top (if the value is @code{0} or
  6259. @code{top}) or the bottom field (if the value is @code{1} or
  6260. @code{bottom}).
  6261. @end table
  6262. @section fieldhint
  6263. Create new frames by copying the top and bottom fields from surrounding frames
  6264. supplied as numbers by the hint file.
  6265. @table @option
  6266. @item hint
  6267. Set file containing hints: absolute/relative frame numbers.
  6268. There must be one line for each frame in a clip. Each line must contain two
  6269. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  6270. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  6271. is current frame number for @code{absolute} mode or out of [-1, 1] range
  6272. for @code{relative} mode. First number tells from which frame to pick up top
  6273. field and second number tells from which frame to pick up bottom field.
  6274. If optionally followed by @code{+} output frame will be marked as interlaced,
  6275. else if followed by @code{-} output frame will be marked as progressive, else
  6276. it will be marked same as input frame.
  6277. If line starts with @code{#} or @code{;} that line is skipped.
  6278. @item mode
  6279. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  6280. @end table
  6281. Example of first several lines of @code{hint} file for @code{relative} mode:
  6282. @example
  6283. 0,0 - # first frame
  6284. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  6285. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  6286. 1,0 -
  6287. 0,0 -
  6288. 0,0 -
  6289. 1,0 -
  6290. 1,0 -
  6291. 1,0 -
  6292. 0,0 -
  6293. 0,0 -
  6294. 1,0 -
  6295. 1,0 -
  6296. 1,0 -
  6297. 0,0 -
  6298. @end example
  6299. @section fieldmatch
  6300. Field matching filter for inverse telecine. It is meant to reconstruct the
  6301. progressive frames from a telecined stream. The filter does not drop duplicated
  6302. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  6303. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  6304. The separation of the field matching and the decimation is notably motivated by
  6305. the possibility of inserting a de-interlacing filter fallback between the two.
  6306. If the source has mixed telecined and real interlaced content,
  6307. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  6308. But these remaining combed frames will be marked as interlaced, and thus can be
  6309. de-interlaced by a later filter such as @ref{yadif} before decimation.
  6310. In addition to the various configuration options, @code{fieldmatch} can take an
  6311. optional second stream, activated through the @option{ppsrc} option. If
  6312. enabled, the frames reconstruction will be based on the fields and frames from
  6313. this second stream. This allows the first input to be pre-processed in order to
  6314. help the various algorithms of the filter, while keeping the output lossless
  6315. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  6316. or brightness/contrast adjustments can help.
  6317. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  6318. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  6319. which @code{fieldmatch} is based on. While the semantic and usage are very
  6320. close, some behaviour and options names can differ.
  6321. The @ref{decimate} filter currently only works for constant frame rate input.
  6322. If your input has mixed telecined (30fps) and progressive content with a lower
  6323. framerate like 24fps use the following filterchain to produce the necessary cfr
  6324. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  6325. The filter accepts the following options:
  6326. @table @option
  6327. @item order
  6328. Specify the assumed field order of the input stream. Available values are:
  6329. @table @samp
  6330. @item auto
  6331. Auto detect parity (use FFmpeg's internal parity value).
  6332. @item bff
  6333. Assume bottom field first.
  6334. @item tff
  6335. Assume top field first.
  6336. @end table
  6337. Note that it is sometimes recommended not to trust the parity announced by the
  6338. stream.
  6339. Default value is @var{auto}.
  6340. @item mode
  6341. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  6342. sense that it won't risk creating jerkiness due to duplicate frames when
  6343. possible, but if there are bad edits or blended fields it will end up
  6344. outputting combed frames when a good match might actually exist. On the other
  6345. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  6346. but will almost always find a good frame if there is one. The other values are
  6347. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  6348. jerkiness and creating duplicate frames versus finding good matches in sections
  6349. with bad edits, orphaned fields, blended fields, etc.
  6350. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  6351. Available values are:
  6352. @table @samp
  6353. @item pc
  6354. 2-way matching (p/c)
  6355. @item pc_n
  6356. 2-way matching, and trying 3rd match if still combed (p/c + n)
  6357. @item pc_u
  6358. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  6359. @item pc_n_ub
  6360. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  6361. still combed (p/c + n + u/b)
  6362. @item pcn
  6363. 3-way matching (p/c/n)
  6364. @item pcn_ub
  6365. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  6366. detected as combed (p/c/n + u/b)
  6367. @end table
  6368. The parenthesis at the end indicate the matches that would be used for that
  6369. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  6370. @var{top}).
  6371. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  6372. the slowest.
  6373. Default value is @var{pc_n}.
  6374. @item ppsrc
  6375. Mark the main input stream as a pre-processed input, and enable the secondary
  6376. input stream as the clean source to pick the fields from. See the filter
  6377. introduction for more details. It is similar to the @option{clip2} feature from
  6378. VFM/TFM.
  6379. Default value is @code{0} (disabled).
  6380. @item field
  6381. Set the field to match from. It is recommended to set this to the same value as
  6382. @option{order} unless you experience matching failures with that setting. In
  6383. certain circumstances changing the field that is used to match from can have a
  6384. large impact on matching performance. Available values are:
  6385. @table @samp
  6386. @item auto
  6387. Automatic (same value as @option{order}).
  6388. @item bottom
  6389. Match from the bottom field.
  6390. @item top
  6391. Match from the top field.
  6392. @end table
  6393. Default value is @var{auto}.
  6394. @item mchroma
  6395. Set whether or not chroma is included during the match comparisons. In most
  6396. cases it is recommended to leave this enabled. You should set this to @code{0}
  6397. only if your clip has bad chroma problems such as heavy rainbowing or other
  6398. artifacts. Setting this to @code{0} could also be used to speed things up at
  6399. the cost of some accuracy.
  6400. Default value is @code{1}.
  6401. @item y0
  6402. @item y1
  6403. These define an exclusion band which excludes the lines between @option{y0} and
  6404. @option{y1} from being included in the field matching decision. An exclusion
  6405. band can be used to ignore subtitles, a logo, or other things that may
  6406. interfere with the matching. @option{y0} sets the starting scan line and
  6407. @option{y1} sets the ending line; all lines in between @option{y0} and
  6408. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6409. @option{y0} and @option{y1} to the same value will disable the feature.
  6410. @option{y0} and @option{y1} defaults to @code{0}.
  6411. @item scthresh
  6412. Set the scene change detection threshold as a percentage of maximum change on
  6413. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6414. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6415. @option{scthresh} is @code{[0.0, 100.0]}.
  6416. Default value is @code{12.0}.
  6417. @item combmatch
  6418. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6419. account the combed scores of matches when deciding what match to use as the
  6420. final match. Available values are:
  6421. @table @samp
  6422. @item none
  6423. No final matching based on combed scores.
  6424. @item sc
  6425. Combed scores are only used when a scene change is detected.
  6426. @item full
  6427. Use combed scores all the time.
  6428. @end table
  6429. Default is @var{sc}.
  6430. @item combdbg
  6431. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  6432. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  6433. Available values are:
  6434. @table @samp
  6435. @item none
  6436. No forced calculation.
  6437. @item pcn
  6438. Force p/c/n calculations.
  6439. @item pcnub
  6440. Force p/c/n/u/b calculations.
  6441. @end table
  6442. Default value is @var{none}.
  6443. @item cthresh
  6444. This is the area combing threshold used for combed frame detection. This
  6445. essentially controls how "strong" or "visible" combing must be to be detected.
  6446. Larger values mean combing must be more visible and smaller values mean combing
  6447. can be less visible or strong and still be detected. Valid settings are from
  6448. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6449. be detected as combed). This is basically a pixel difference value. A good
  6450. range is @code{[8, 12]}.
  6451. Default value is @code{9}.
  6452. @item chroma
  6453. Sets whether or not chroma is considered in the combed frame decision. Only
  6454. disable this if your source has chroma problems (rainbowing, etc.) that are
  6455. causing problems for the combed frame detection with chroma enabled. Actually,
  6456. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6457. where there is chroma only combing in the source.
  6458. Default value is @code{0}.
  6459. @item blockx
  6460. @item blocky
  6461. Respectively set the x-axis and y-axis size of the window used during combed
  6462. frame detection. This has to do with the size of the area in which
  6463. @option{combpel} pixels are required to be detected as combed for a frame to be
  6464. declared combed. See the @option{combpel} parameter description for more info.
  6465. Possible values are any number that is a power of 2 starting at 4 and going up
  6466. to 512.
  6467. Default value is @code{16}.
  6468. @item combpel
  6469. The number of combed pixels inside any of the @option{blocky} by
  6470. @option{blockx} size blocks on the frame for the frame to be detected as
  6471. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6472. setting controls "how much" combing there must be in any localized area (a
  6473. window defined by the @option{blockx} and @option{blocky} settings) on the
  6474. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6475. which point no frames will ever be detected as combed). This setting is known
  6476. as @option{MI} in TFM/VFM vocabulary.
  6477. Default value is @code{80}.
  6478. @end table
  6479. @anchor{p/c/n/u/b meaning}
  6480. @subsection p/c/n/u/b meaning
  6481. @subsubsection p/c/n
  6482. We assume the following telecined stream:
  6483. @example
  6484. Top fields: 1 2 2 3 4
  6485. Bottom fields: 1 2 3 4 4
  6486. @end example
  6487. The numbers correspond to the progressive frame the fields relate to. Here, the
  6488. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6489. When @code{fieldmatch} is configured to run a matching from bottom
  6490. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6491. @example
  6492. Input stream:
  6493. T 1 2 2 3 4
  6494. B 1 2 3 4 4 <-- matching reference
  6495. Matches: c c n n c
  6496. Output stream:
  6497. T 1 2 3 4 4
  6498. B 1 2 3 4 4
  6499. @end example
  6500. As a result of the field matching, we can see that some frames get duplicated.
  6501. To perform a complete inverse telecine, you need to rely on a decimation filter
  6502. after this operation. See for instance the @ref{decimate} filter.
  6503. The same operation now matching from top fields (@option{field}=@var{top})
  6504. looks like this:
  6505. @example
  6506. Input stream:
  6507. T 1 2 2 3 4 <-- matching reference
  6508. B 1 2 3 4 4
  6509. Matches: c c p p c
  6510. Output stream:
  6511. T 1 2 2 3 4
  6512. B 1 2 2 3 4
  6513. @end example
  6514. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6515. basically, they refer to the frame and field of the opposite parity:
  6516. @itemize
  6517. @item @var{p} matches the field of the opposite parity in the previous frame
  6518. @item @var{c} matches the field of the opposite parity in the current frame
  6519. @item @var{n} matches the field of the opposite parity in the next frame
  6520. @end itemize
  6521. @subsubsection u/b
  6522. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6523. from the opposite parity flag. In the following examples, we assume that we are
  6524. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6525. 'x' is placed above and below each matched fields.
  6526. With bottom matching (@option{field}=@var{bottom}):
  6527. @example
  6528. Match: c p n b u
  6529. x x x x x
  6530. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6531. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6532. x x x x x
  6533. Output frames:
  6534. 2 1 2 2 2
  6535. 2 2 2 1 3
  6536. @end example
  6537. With top matching (@option{field}=@var{top}):
  6538. @example
  6539. Match: c p n b u
  6540. x x x x x
  6541. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6542. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6543. x x x x x
  6544. Output frames:
  6545. 2 2 2 1 2
  6546. 2 1 3 2 2
  6547. @end example
  6548. @subsection Examples
  6549. Simple IVTC of a top field first telecined stream:
  6550. @example
  6551. fieldmatch=order=tff:combmatch=none, decimate
  6552. @end example
  6553. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6554. @example
  6555. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6556. @end example
  6557. @section fieldorder
  6558. Transform the field order of the input video.
  6559. It accepts the following parameters:
  6560. @table @option
  6561. @item order
  6562. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6563. for bottom field first.
  6564. @end table
  6565. The default value is @samp{tff}.
  6566. The transformation is done by shifting the picture content up or down
  6567. by one line, and filling the remaining line with appropriate picture content.
  6568. This method is consistent with most broadcast field order converters.
  6569. If the input video is not flagged as being interlaced, or it is already
  6570. flagged as being of the required output field order, then this filter does
  6571. not alter the incoming video.
  6572. It is very useful when converting to or from PAL DV material,
  6573. which is bottom field first.
  6574. For example:
  6575. @example
  6576. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6577. @end example
  6578. @section fifo, afifo
  6579. Buffer input images and send them when they are requested.
  6580. It is mainly useful when auto-inserted by the libavfilter
  6581. framework.
  6582. It does not take parameters.
  6583. @section find_rect
  6584. Find a rectangular object
  6585. It accepts the following options:
  6586. @table @option
  6587. @item object
  6588. Filepath of the object image, needs to be in gray8.
  6589. @item threshold
  6590. Detection threshold, default is 0.5.
  6591. @item mipmaps
  6592. Number of mipmaps, default is 3.
  6593. @item xmin, ymin, xmax, ymax
  6594. Specifies the rectangle in which to search.
  6595. @end table
  6596. @subsection Examples
  6597. @itemize
  6598. @item
  6599. Generate a representative palette of a given video using @command{ffmpeg}:
  6600. @example
  6601. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6602. @end example
  6603. @end itemize
  6604. @section cover_rect
  6605. Cover a rectangular object
  6606. It accepts the following options:
  6607. @table @option
  6608. @item cover
  6609. Filepath of the optional cover image, needs to be in yuv420.
  6610. @item mode
  6611. Set covering mode.
  6612. It accepts the following values:
  6613. @table @samp
  6614. @item cover
  6615. cover it by the supplied image
  6616. @item blur
  6617. cover it by interpolating the surrounding pixels
  6618. @end table
  6619. Default value is @var{blur}.
  6620. @end table
  6621. @subsection Examples
  6622. @itemize
  6623. @item
  6624. Generate a representative palette of a given video using @command{ffmpeg}:
  6625. @example
  6626. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6627. @end example
  6628. @end itemize
  6629. @section floodfill
  6630. Flood area with values of same pixel components with another values.
  6631. It accepts the following options:
  6632. @table @option
  6633. @item x
  6634. Set pixel x coordinate.
  6635. @item y
  6636. Set pixel y coordinate.
  6637. @item s0
  6638. Set source #0 component value.
  6639. @item s1
  6640. Set source #1 component value.
  6641. @item s2
  6642. Set source #2 component value.
  6643. @item s3
  6644. Set source #3 component value.
  6645. @item d0
  6646. Set destination #0 component value.
  6647. @item d1
  6648. Set destination #1 component value.
  6649. @item d2
  6650. Set destination #2 component value.
  6651. @item d3
  6652. Set destination #3 component value.
  6653. @end table
  6654. @anchor{format}
  6655. @section format
  6656. Convert the input video to one of the specified pixel formats.
  6657. Libavfilter will try to pick one that is suitable as input to
  6658. the next filter.
  6659. It accepts the following parameters:
  6660. @table @option
  6661. @item pix_fmts
  6662. A '|'-separated list of pixel format names, such as
  6663. "pix_fmts=yuv420p|monow|rgb24".
  6664. @end table
  6665. @subsection Examples
  6666. @itemize
  6667. @item
  6668. Convert the input video to the @var{yuv420p} format
  6669. @example
  6670. format=pix_fmts=yuv420p
  6671. @end example
  6672. Convert the input video to any of the formats in the list
  6673. @example
  6674. format=pix_fmts=yuv420p|yuv444p|yuv410p
  6675. @end example
  6676. @end itemize
  6677. @anchor{fps}
  6678. @section fps
  6679. Convert the video to specified constant frame rate by duplicating or dropping
  6680. frames as necessary.
  6681. It accepts the following parameters:
  6682. @table @option
  6683. @item fps
  6684. The desired output frame rate. The default is @code{25}.
  6685. @item start_time
  6686. Assume the first PTS should be the given value, in seconds. This allows for
  6687. padding/trimming at the start of stream. By default, no assumption is made
  6688. about the first frame's expected PTS, so no padding or trimming is done.
  6689. For example, this could be set to 0 to pad the beginning with duplicates of
  6690. the first frame if a video stream starts after the audio stream or to trim any
  6691. frames with a negative PTS.
  6692. @item round
  6693. Timestamp (PTS) rounding method.
  6694. Possible values are:
  6695. @table @option
  6696. @item zero
  6697. round towards 0
  6698. @item inf
  6699. round away from 0
  6700. @item down
  6701. round towards -infinity
  6702. @item up
  6703. round towards +infinity
  6704. @item near
  6705. round to nearest
  6706. @end table
  6707. The default is @code{near}.
  6708. @item eof_action
  6709. Action performed when reading the last frame.
  6710. Possible values are:
  6711. @table @option
  6712. @item round
  6713. Use same timestamp rounding method as used for other frames.
  6714. @item pass
  6715. Pass through last frame if input duration has not been reached yet.
  6716. @end table
  6717. The default is @code{round}.
  6718. @end table
  6719. Alternatively, the options can be specified as a flat string:
  6720. @var{fps}[:@var{start_time}[:@var{round}]].
  6721. See also the @ref{setpts} filter.
  6722. @subsection Examples
  6723. @itemize
  6724. @item
  6725. A typical usage in order to set the fps to 25:
  6726. @example
  6727. fps=fps=25
  6728. @end example
  6729. @item
  6730. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  6731. @example
  6732. fps=fps=film:round=near
  6733. @end example
  6734. @end itemize
  6735. @section framepack
  6736. Pack two different video streams into a stereoscopic video, setting proper
  6737. metadata on supported codecs. The two views should have the same size and
  6738. framerate and processing will stop when the shorter video ends. Please note
  6739. that you may conveniently adjust view properties with the @ref{scale} and
  6740. @ref{fps} filters.
  6741. It accepts the following parameters:
  6742. @table @option
  6743. @item format
  6744. The desired packing format. Supported values are:
  6745. @table @option
  6746. @item sbs
  6747. The views are next to each other (default).
  6748. @item tab
  6749. The views are on top of each other.
  6750. @item lines
  6751. The views are packed by line.
  6752. @item columns
  6753. The views are packed by column.
  6754. @item frameseq
  6755. The views are temporally interleaved.
  6756. @end table
  6757. @end table
  6758. Some examples:
  6759. @example
  6760. # Convert left and right views into a frame-sequential video
  6761. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  6762. # Convert views into a side-by-side video with the same output resolution as the input
  6763. 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
  6764. @end example
  6765. @section framerate
  6766. Change the frame rate by interpolating new video output frames from the source
  6767. frames.
  6768. This filter is not designed to function correctly with interlaced media. If
  6769. you wish to change the frame rate of interlaced media then you are required
  6770. to deinterlace before this filter and re-interlace after this filter.
  6771. A description of the accepted options follows.
  6772. @table @option
  6773. @item fps
  6774. Specify the output frames per second. This option can also be specified
  6775. as a value alone. The default is @code{50}.
  6776. @item interp_start
  6777. Specify the start of a range where the output frame will be created as a
  6778. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6779. the default is @code{15}.
  6780. @item interp_end
  6781. Specify the end of a range where the output frame will be created as a
  6782. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6783. the default is @code{240}.
  6784. @item scene
  6785. Specify the level at which a scene change is detected as a value between
  6786. 0 and 100 to indicate a new scene; a low value reflects a low
  6787. probability for the current frame to introduce a new scene, while a higher
  6788. value means the current frame is more likely to be one.
  6789. The default is @code{7}.
  6790. @item flags
  6791. Specify flags influencing the filter process.
  6792. Available value for @var{flags} is:
  6793. @table @option
  6794. @item scene_change_detect, scd
  6795. Enable scene change detection using the value of the option @var{scene}.
  6796. This flag is enabled by default.
  6797. @end table
  6798. @end table
  6799. @section framestep
  6800. Select one frame every N-th frame.
  6801. This filter accepts the following option:
  6802. @table @option
  6803. @item step
  6804. Select frame after every @code{step} frames.
  6805. Allowed values are positive integers higher than 0. Default value is @code{1}.
  6806. @end table
  6807. @anchor{frei0r}
  6808. @section frei0r
  6809. Apply a frei0r effect to the input video.
  6810. To enable the compilation of this filter, you need to install the frei0r
  6811. header and configure FFmpeg with @code{--enable-frei0r}.
  6812. It accepts the following parameters:
  6813. @table @option
  6814. @item filter_name
  6815. The name of the frei0r effect to load. If the environment variable
  6816. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  6817. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  6818. Otherwise, the standard frei0r paths are searched, in this order:
  6819. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  6820. @file{/usr/lib/frei0r-1/}.
  6821. @item filter_params
  6822. A '|'-separated list of parameters to pass to the frei0r effect.
  6823. @end table
  6824. A frei0r effect parameter can be a boolean (its value is either
  6825. "y" or "n"), a double, a color (specified as
  6826. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  6827. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  6828. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  6829. @var{X} and @var{Y} are floating point numbers) and/or a string.
  6830. The number and types of parameters depend on the loaded effect. If an
  6831. effect parameter is not specified, the default value is set.
  6832. @subsection Examples
  6833. @itemize
  6834. @item
  6835. Apply the distort0r effect, setting the first two double parameters:
  6836. @example
  6837. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  6838. @end example
  6839. @item
  6840. Apply the colordistance effect, taking a color as the first parameter:
  6841. @example
  6842. frei0r=colordistance:0.2/0.3/0.4
  6843. frei0r=colordistance:violet
  6844. frei0r=colordistance:0x112233
  6845. @end example
  6846. @item
  6847. Apply the perspective effect, specifying the top left and top right image
  6848. positions:
  6849. @example
  6850. frei0r=perspective:0.2/0.2|0.8/0.2
  6851. @end example
  6852. @end itemize
  6853. For more information, see
  6854. @url{http://frei0r.dyne.org}
  6855. @section fspp
  6856. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  6857. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  6858. processing filter, one of them is performed once per block, not per pixel.
  6859. This allows for much higher speed.
  6860. The filter accepts the following options:
  6861. @table @option
  6862. @item quality
  6863. Set quality. This option defines the number of levels for averaging. It accepts
  6864. an integer in the range 4-5. Default value is @code{4}.
  6865. @item qp
  6866. Force a constant quantization parameter. It accepts an integer in range 0-63.
  6867. If not set, the filter will use the QP from the video stream (if available).
  6868. @item strength
  6869. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  6870. more details but also more artifacts, while higher values make the image smoother
  6871. but also blurrier. Default value is @code{0} − PSNR optimal.
  6872. @item use_bframe_qp
  6873. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  6874. option may cause flicker since the B-Frames have often larger QP. Default is
  6875. @code{0} (not enabled).
  6876. @end table
  6877. @section gblur
  6878. Apply Gaussian blur filter.
  6879. The filter accepts the following options:
  6880. @table @option
  6881. @item sigma
  6882. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  6883. @item steps
  6884. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  6885. @item planes
  6886. Set which planes to filter. By default all planes are filtered.
  6887. @item sigmaV
  6888. Set vertical sigma, if negative it will be same as @code{sigma}.
  6889. Default is @code{-1}.
  6890. @end table
  6891. @section geq
  6892. The filter accepts the following options:
  6893. @table @option
  6894. @item lum_expr, lum
  6895. Set the luminance expression.
  6896. @item cb_expr, cb
  6897. Set the chrominance blue expression.
  6898. @item cr_expr, cr
  6899. Set the chrominance red expression.
  6900. @item alpha_expr, a
  6901. Set the alpha expression.
  6902. @item red_expr, r
  6903. Set the red expression.
  6904. @item green_expr, g
  6905. Set the green expression.
  6906. @item blue_expr, b
  6907. Set the blue expression.
  6908. @end table
  6909. The colorspace is selected according to the specified options. If one
  6910. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  6911. options is specified, the filter will automatically select a YCbCr
  6912. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  6913. @option{blue_expr} options is specified, it will select an RGB
  6914. colorspace.
  6915. If one of the chrominance expression is not defined, it falls back on the other
  6916. one. If no alpha expression is specified it will evaluate to opaque value.
  6917. If none of chrominance expressions are specified, they will evaluate
  6918. to the luminance expression.
  6919. The expressions can use the following variables and functions:
  6920. @table @option
  6921. @item N
  6922. The sequential number of the filtered frame, starting from @code{0}.
  6923. @item X
  6924. @item Y
  6925. The coordinates of the current sample.
  6926. @item W
  6927. @item H
  6928. The width and height of the image.
  6929. @item SW
  6930. @item SH
  6931. Width and height scale depending on the currently filtered plane. It is the
  6932. ratio between the corresponding luma plane number of pixels and the current
  6933. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  6934. @code{0.5,0.5} for chroma planes.
  6935. @item T
  6936. Time of the current frame, expressed in seconds.
  6937. @item p(x, y)
  6938. Return the value of the pixel at location (@var{x},@var{y}) of the current
  6939. plane.
  6940. @item lum(x, y)
  6941. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  6942. plane.
  6943. @item cb(x, y)
  6944. Return the value of the pixel at location (@var{x},@var{y}) of the
  6945. blue-difference chroma plane. Return 0 if there is no such plane.
  6946. @item cr(x, y)
  6947. Return the value of the pixel at location (@var{x},@var{y}) of the
  6948. red-difference chroma plane. Return 0 if there is no such plane.
  6949. @item r(x, y)
  6950. @item g(x, y)
  6951. @item b(x, y)
  6952. Return the value of the pixel at location (@var{x},@var{y}) of the
  6953. red/green/blue component. Return 0 if there is no such component.
  6954. @item alpha(x, y)
  6955. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  6956. plane. Return 0 if there is no such plane.
  6957. @end table
  6958. For functions, if @var{x} and @var{y} are outside the area, the value will be
  6959. automatically clipped to the closer edge.
  6960. @subsection Examples
  6961. @itemize
  6962. @item
  6963. Flip the image horizontally:
  6964. @example
  6965. geq=p(W-X\,Y)
  6966. @end example
  6967. @item
  6968. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  6969. wavelength of 100 pixels:
  6970. @example
  6971. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  6972. @end example
  6973. @item
  6974. Generate a fancy enigmatic moving light:
  6975. @example
  6976. 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
  6977. @end example
  6978. @item
  6979. Generate a quick emboss effect:
  6980. @example
  6981. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  6982. @end example
  6983. @item
  6984. Modify RGB components depending on pixel position:
  6985. @example
  6986. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  6987. @end example
  6988. @item
  6989. Create a radial gradient that is the same size as the input (also see
  6990. the @ref{vignette} filter):
  6991. @example
  6992. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  6993. @end example
  6994. @end itemize
  6995. @section gradfun
  6996. Fix the banding artifacts that are sometimes introduced into nearly flat
  6997. regions by truncation to 8-bit color depth.
  6998. Interpolate the gradients that should go where the bands are, and
  6999. dither them.
  7000. It is designed for playback only. Do not use it prior to
  7001. lossy compression, because compression tends to lose the dither and
  7002. bring back the bands.
  7003. It accepts the following parameters:
  7004. @table @option
  7005. @item strength
  7006. The maximum amount by which the filter will change any one pixel. This is also
  7007. the threshold for detecting nearly flat regions. Acceptable values range from
  7008. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  7009. valid range.
  7010. @item radius
  7011. The neighborhood to fit the gradient to. A larger radius makes for smoother
  7012. gradients, but also prevents the filter from modifying the pixels near detailed
  7013. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  7014. values will be clipped to the valid range.
  7015. @end table
  7016. Alternatively, the options can be specified as a flat string:
  7017. @var{strength}[:@var{radius}]
  7018. @subsection Examples
  7019. @itemize
  7020. @item
  7021. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  7022. @example
  7023. gradfun=3.5:8
  7024. @end example
  7025. @item
  7026. Specify radius, omitting the strength (which will fall-back to the default
  7027. value):
  7028. @example
  7029. gradfun=radius=8
  7030. @end example
  7031. @end itemize
  7032. @anchor{haldclut}
  7033. @section haldclut
  7034. Apply a Hald CLUT to a video stream.
  7035. First input is the video stream to process, and second one is the Hald CLUT.
  7036. The Hald CLUT input can be a simple picture or a complete video stream.
  7037. The filter accepts the following options:
  7038. @table @option
  7039. @item shortest
  7040. Force termination when the shortest input terminates. Default is @code{0}.
  7041. @item repeatlast
  7042. Continue applying the last CLUT after the end of the stream. A value of
  7043. @code{0} disable the filter after the last frame of the CLUT is reached.
  7044. Default is @code{1}.
  7045. @end table
  7046. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  7047. filters share the same internals).
  7048. More information about the Hald CLUT can be found on Eskil Steenberg's website
  7049. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  7050. @subsection Workflow examples
  7051. @subsubsection Hald CLUT video stream
  7052. Generate an identity Hald CLUT stream altered with various effects:
  7053. @example
  7054. 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
  7055. @end example
  7056. Note: make sure you use a lossless codec.
  7057. Then use it with @code{haldclut} to apply it on some random stream:
  7058. @example
  7059. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  7060. @end example
  7061. The Hald CLUT will be applied to the 10 first seconds (duration of
  7062. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  7063. to the remaining frames of the @code{mandelbrot} stream.
  7064. @subsubsection Hald CLUT with preview
  7065. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  7066. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  7067. biggest possible square starting at the top left of the picture. The remaining
  7068. padding pixels (bottom or right) will be ignored. This area can be used to add
  7069. a preview of the Hald CLUT.
  7070. Typically, the following generated Hald CLUT will be supported by the
  7071. @code{haldclut} filter:
  7072. @example
  7073. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  7074. pad=iw+320 [padded_clut];
  7075. smptebars=s=320x256, split [a][b];
  7076. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  7077. [main][b] overlay=W-320" -frames:v 1 clut.png
  7078. @end example
  7079. It contains the original and a preview of the effect of the CLUT: SMPTE color
  7080. bars are displayed on the right-top, and below the same color bars processed by
  7081. the color changes.
  7082. Then, the effect of this Hald CLUT can be visualized with:
  7083. @example
  7084. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  7085. @end example
  7086. @section hflip
  7087. Flip the input video horizontally.
  7088. For example, to horizontally flip the input video with @command{ffmpeg}:
  7089. @example
  7090. ffmpeg -i in.avi -vf "hflip" out.avi
  7091. @end example
  7092. @section histeq
  7093. This filter applies a global color histogram equalization on a
  7094. per-frame basis.
  7095. It can be used to correct video that has a compressed range of pixel
  7096. intensities. The filter redistributes the pixel intensities to
  7097. equalize their distribution across the intensity range. It may be
  7098. viewed as an "automatically adjusting contrast filter". This filter is
  7099. useful only for correcting degraded or poorly captured source
  7100. video.
  7101. The filter accepts the following options:
  7102. @table @option
  7103. @item strength
  7104. Determine the amount of equalization to be applied. As the strength
  7105. is reduced, the distribution of pixel intensities more-and-more
  7106. approaches that of the input frame. The value must be a float number
  7107. in the range [0,1] and defaults to 0.200.
  7108. @item intensity
  7109. Set the maximum intensity that can generated and scale the output
  7110. values appropriately. The strength should be set as desired and then
  7111. the intensity can be limited if needed to avoid washing-out. The value
  7112. must be a float number in the range [0,1] and defaults to 0.210.
  7113. @item antibanding
  7114. Set the antibanding level. If enabled the filter will randomly vary
  7115. the luminance of output pixels by a small amount to avoid banding of
  7116. the histogram. Possible values are @code{none}, @code{weak} or
  7117. @code{strong}. It defaults to @code{none}.
  7118. @end table
  7119. @section histogram
  7120. Compute and draw a color distribution histogram for the input video.
  7121. The computed histogram is a representation of the color component
  7122. distribution in an image.
  7123. Standard histogram displays the color components distribution in an image.
  7124. Displays color graph for each color component. Shows distribution of
  7125. the Y, U, V, A or R, G, B components, depending on input format, in the
  7126. current frame. Below each graph a color component scale meter is shown.
  7127. The filter accepts the following options:
  7128. @table @option
  7129. @item level_height
  7130. Set height of level. Default value is @code{200}.
  7131. Allowed range is [50, 2048].
  7132. @item scale_height
  7133. Set height of color scale. Default value is @code{12}.
  7134. Allowed range is [0, 40].
  7135. @item display_mode
  7136. Set display mode.
  7137. It accepts the following values:
  7138. @table @samp
  7139. @item stack
  7140. Per color component graphs are placed below each other.
  7141. @item parade
  7142. Per color component graphs are placed side by side.
  7143. @item overlay
  7144. Presents information identical to that in the @code{parade}, except
  7145. that the graphs representing color components are superimposed directly
  7146. over one another.
  7147. @end table
  7148. Default is @code{stack}.
  7149. @item levels_mode
  7150. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  7151. Default is @code{linear}.
  7152. @item components
  7153. Set what color components to display.
  7154. Default is @code{7}.
  7155. @item fgopacity
  7156. Set foreground opacity. Default is @code{0.7}.
  7157. @item bgopacity
  7158. Set background opacity. Default is @code{0.5}.
  7159. @end table
  7160. @subsection Examples
  7161. @itemize
  7162. @item
  7163. Calculate and draw histogram:
  7164. @example
  7165. ffplay -i input -vf histogram
  7166. @end example
  7167. @end itemize
  7168. @anchor{hqdn3d}
  7169. @section hqdn3d
  7170. This is a high precision/quality 3d denoise filter. It aims to reduce
  7171. image noise, producing smooth images and making still images really
  7172. still. It should enhance compressibility.
  7173. It accepts the following optional parameters:
  7174. @table @option
  7175. @item luma_spatial
  7176. A non-negative floating point number which specifies spatial luma strength.
  7177. It defaults to 4.0.
  7178. @item chroma_spatial
  7179. A non-negative floating point number which specifies spatial chroma strength.
  7180. It defaults to 3.0*@var{luma_spatial}/4.0.
  7181. @item luma_tmp
  7182. A floating point number which specifies luma temporal strength. It defaults to
  7183. 6.0*@var{luma_spatial}/4.0.
  7184. @item chroma_tmp
  7185. A floating point number which specifies chroma temporal strength. It defaults to
  7186. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  7187. @end table
  7188. @section hwdownload
  7189. Download hardware frames to system memory.
  7190. The input must be in hardware frames, and the output a non-hardware format.
  7191. Not all formats will be supported on the output - it may be necessary to insert
  7192. an additional @option{format} filter immediately following in the graph to get
  7193. the output in a supported format.
  7194. @section hwmap
  7195. Map hardware frames to system memory or to another device.
  7196. This filter has several different modes of operation; which one is used depends
  7197. on the input and output formats:
  7198. @itemize
  7199. @item
  7200. Hardware frame input, normal frame output
  7201. Map the input frames to system memory and pass them to the output. If the
  7202. original hardware frame is later required (for example, after overlaying
  7203. something else on part of it), the @option{hwmap} filter can be used again
  7204. in the next mode to retrieve it.
  7205. @item
  7206. Normal frame input, hardware frame output
  7207. If the input is actually a software-mapped hardware frame, then unmap it -
  7208. that is, return the original hardware frame.
  7209. Otherwise, a device must be provided. Create new hardware surfaces on that
  7210. device for the output, then map them back to the software format at the input
  7211. and give those frames to the preceding filter. This will then act like the
  7212. @option{hwupload} filter, but may be able to avoid an additional copy when
  7213. the input is already in a compatible format.
  7214. @item
  7215. Hardware frame input and output
  7216. A device must be supplied for the output, either directly or with the
  7217. @option{derive_device} option. The input and output devices must be of
  7218. different types and compatible - the exact meaning of this is
  7219. system-dependent, but typically it means that they must refer to the same
  7220. underlying hardware context (for example, refer to the same graphics card).
  7221. If the input frames were originally created on the output device, then unmap
  7222. to retrieve the original frames.
  7223. Otherwise, map the frames to the output device - create new hardware frames
  7224. on the output corresponding to the frames on the input.
  7225. @end itemize
  7226. The following additional parameters are accepted:
  7227. @table @option
  7228. @item mode
  7229. Set the frame mapping mode. Some combination of:
  7230. @table @var
  7231. @item read
  7232. The mapped frame should be readable.
  7233. @item write
  7234. The mapped frame should be writeable.
  7235. @item overwrite
  7236. The mapping will always overwrite the entire frame.
  7237. This may improve performance in some cases, as the original contents of the
  7238. frame need not be loaded.
  7239. @item direct
  7240. The mapping must not involve any copying.
  7241. Indirect mappings to copies of frames are created in some cases where either
  7242. direct mapping is not possible or it would have unexpected properties.
  7243. Setting this flag ensures that the mapping is direct and will fail if that is
  7244. not possible.
  7245. @end table
  7246. Defaults to @var{read+write} if not specified.
  7247. @item derive_device @var{type}
  7248. Rather than using the device supplied at initialisation, instead derive a new
  7249. device of type @var{type} from the device the input frames exist on.
  7250. @item reverse
  7251. In a hardware to hardware mapping, map in reverse - create frames in the sink
  7252. and map them back to the source. This may be necessary in some cases where
  7253. a mapping in one direction is required but only the opposite direction is
  7254. supported by the devices being used.
  7255. This option is dangerous - it may break the preceding filter in undefined
  7256. ways if there are any additional constraints on that filter's output.
  7257. Do not use it without fully understanding the implications of its use.
  7258. @end table
  7259. @section hwupload
  7260. Upload system memory frames to hardware surfaces.
  7261. The device to upload to must be supplied when the filter is initialised. If
  7262. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  7263. option.
  7264. @anchor{hwupload_cuda}
  7265. @section hwupload_cuda
  7266. Upload system memory frames to a CUDA device.
  7267. It accepts the following optional parameters:
  7268. @table @option
  7269. @item device
  7270. The number of the CUDA device to use
  7271. @end table
  7272. @section hqx
  7273. Apply a high-quality magnification filter designed for pixel art. This filter
  7274. was originally created by Maxim Stepin.
  7275. It accepts the following option:
  7276. @table @option
  7277. @item n
  7278. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  7279. @code{hq3x} and @code{4} for @code{hq4x}.
  7280. Default is @code{3}.
  7281. @end table
  7282. @section hstack
  7283. Stack input videos horizontally.
  7284. All streams must be of same pixel format and of same height.
  7285. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  7286. to create same output.
  7287. The filter accept the following option:
  7288. @table @option
  7289. @item inputs
  7290. Set number of input streams. Default is 2.
  7291. @item shortest
  7292. If set to 1, force the output to terminate when the shortest input
  7293. terminates. Default value is 0.
  7294. @end table
  7295. @section hue
  7296. Modify the hue and/or the saturation of the input.
  7297. It accepts the following parameters:
  7298. @table @option
  7299. @item h
  7300. Specify the hue angle as a number of degrees. It accepts an expression,
  7301. and defaults to "0".
  7302. @item s
  7303. Specify the saturation in the [-10,10] range. It accepts an expression and
  7304. defaults to "1".
  7305. @item H
  7306. Specify the hue angle as a number of radians. It accepts an
  7307. expression, and defaults to "0".
  7308. @item b
  7309. Specify the brightness in the [-10,10] range. It accepts an expression and
  7310. defaults to "0".
  7311. @end table
  7312. @option{h} and @option{H} are mutually exclusive, and can't be
  7313. specified at the same time.
  7314. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  7315. expressions containing the following constants:
  7316. @table @option
  7317. @item n
  7318. frame count of the input frame starting from 0
  7319. @item pts
  7320. presentation timestamp of the input frame expressed in time base units
  7321. @item r
  7322. frame rate of the input video, NAN if the input frame rate is unknown
  7323. @item t
  7324. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7325. @item tb
  7326. time base of the input video
  7327. @end table
  7328. @subsection Examples
  7329. @itemize
  7330. @item
  7331. Set the hue to 90 degrees and the saturation to 1.0:
  7332. @example
  7333. hue=h=90:s=1
  7334. @end example
  7335. @item
  7336. Same command but expressing the hue in radians:
  7337. @example
  7338. hue=H=PI/2:s=1
  7339. @end example
  7340. @item
  7341. Rotate hue and make the saturation swing between 0
  7342. and 2 over a period of 1 second:
  7343. @example
  7344. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  7345. @end example
  7346. @item
  7347. Apply a 3 seconds saturation fade-in effect starting at 0:
  7348. @example
  7349. hue="s=min(t/3\,1)"
  7350. @end example
  7351. The general fade-in expression can be written as:
  7352. @example
  7353. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  7354. @end example
  7355. @item
  7356. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  7357. @example
  7358. hue="s=max(0\, min(1\, (8-t)/3))"
  7359. @end example
  7360. The general fade-out expression can be written as:
  7361. @example
  7362. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  7363. @end example
  7364. @end itemize
  7365. @subsection Commands
  7366. This filter supports the following commands:
  7367. @table @option
  7368. @item b
  7369. @item s
  7370. @item h
  7371. @item H
  7372. Modify the hue and/or the saturation and/or brightness of the input video.
  7373. The command accepts the same syntax of the corresponding option.
  7374. If the specified expression is not valid, it is kept at its current
  7375. value.
  7376. @end table
  7377. @section hysteresis
  7378. Grow first stream into second stream by connecting components.
  7379. This makes it possible to build more robust edge masks.
  7380. This filter accepts the following options:
  7381. @table @option
  7382. @item planes
  7383. Set which planes will be processed as bitmap, unprocessed planes will be
  7384. copied from first stream.
  7385. By default value 0xf, all planes will be processed.
  7386. @item threshold
  7387. Set threshold which is used in filtering. If pixel component value is higher than
  7388. this value filter algorithm for connecting components is activated.
  7389. By default value is 0.
  7390. @end table
  7391. @section idet
  7392. Detect video interlacing type.
  7393. This filter tries to detect if the input frames are interlaced, progressive,
  7394. top or bottom field first. It will also try to detect fields that are
  7395. repeated between adjacent frames (a sign of telecine).
  7396. Single frame detection considers only immediately adjacent frames when classifying each frame.
  7397. Multiple frame detection incorporates the classification history of previous frames.
  7398. The filter will log these metadata values:
  7399. @table @option
  7400. @item single.current_frame
  7401. Detected type of current frame using single-frame detection. One of:
  7402. ``tff'' (top field first), ``bff'' (bottom field first),
  7403. ``progressive'', or ``undetermined''
  7404. @item single.tff
  7405. Cumulative number of frames detected as top field first using single-frame detection.
  7406. @item multiple.tff
  7407. Cumulative number of frames detected as top field first using multiple-frame detection.
  7408. @item single.bff
  7409. Cumulative number of frames detected as bottom field first using single-frame detection.
  7410. @item multiple.current_frame
  7411. Detected type of current frame using multiple-frame detection. One of:
  7412. ``tff'' (top field first), ``bff'' (bottom field first),
  7413. ``progressive'', or ``undetermined''
  7414. @item multiple.bff
  7415. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  7416. @item single.progressive
  7417. Cumulative number of frames detected as progressive using single-frame detection.
  7418. @item multiple.progressive
  7419. Cumulative number of frames detected as progressive using multiple-frame detection.
  7420. @item single.undetermined
  7421. Cumulative number of frames that could not be classified using single-frame detection.
  7422. @item multiple.undetermined
  7423. Cumulative number of frames that could not be classified using multiple-frame detection.
  7424. @item repeated.current_frame
  7425. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  7426. @item repeated.neither
  7427. Cumulative number of frames with no repeated field.
  7428. @item repeated.top
  7429. Cumulative number of frames with the top field repeated from the previous frame's top field.
  7430. @item repeated.bottom
  7431. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  7432. @end table
  7433. The filter accepts the following options:
  7434. @table @option
  7435. @item intl_thres
  7436. Set interlacing threshold.
  7437. @item prog_thres
  7438. Set progressive threshold.
  7439. @item rep_thres
  7440. Threshold for repeated field detection.
  7441. @item half_life
  7442. Number of frames after which a given frame's contribution to the
  7443. statistics is halved (i.e., it contributes only 0.5 to its
  7444. classification). The default of 0 means that all frames seen are given
  7445. full weight of 1.0 forever.
  7446. @item analyze_interlaced_flag
  7447. When this is not 0 then idet will use the specified number of frames to determine
  7448. if the interlaced flag is accurate, it will not count undetermined frames.
  7449. If the flag is found to be accurate it will be used without any further
  7450. computations, if it is found to be inaccurate it will be cleared without any
  7451. further computations. This allows inserting the idet filter as a low computational
  7452. method to clean up the interlaced flag
  7453. @end table
  7454. @section il
  7455. Deinterleave or interleave fields.
  7456. This filter allows one to process interlaced images fields without
  7457. deinterlacing them. Deinterleaving splits the input frame into 2
  7458. fields (so called half pictures). Odd lines are moved to the top
  7459. half of the output image, even lines to the bottom half.
  7460. You can process (filter) them independently and then re-interleave them.
  7461. The filter accepts the following options:
  7462. @table @option
  7463. @item luma_mode, l
  7464. @item chroma_mode, c
  7465. @item alpha_mode, a
  7466. Available values for @var{luma_mode}, @var{chroma_mode} and
  7467. @var{alpha_mode} are:
  7468. @table @samp
  7469. @item none
  7470. Do nothing.
  7471. @item deinterleave, d
  7472. Deinterleave fields, placing one above the other.
  7473. @item interleave, i
  7474. Interleave fields. Reverse the effect of deinterleaving.
  7475. @end table
  7476. Default value is @code{none}.
  7477. @item luma_swap, ls
  7478. @item chroma_swap, cs
  7479. @item alpha_swap, as
  7480. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  7481. @end table
  7482. @section inflate
  7483. Apply inflate effect to the video.
  7484. This filter replaces the pixel by the local(3x3) average by taking into account
  7485. only values higher than the pixel.
  7486. It accepts the following options:
  7487. @table @option
  7488. @item threshold0
  7489. @item threshold1
  7490. @item threshold2
  7491. @item threshold3
  7492. Limit the maximum change for each plane, default is 65535.
  7493. If 0, plane will remain unchanged.
  7494. @end table
  7495. @section interlace
  7496. Simple interlacing filter from progressive contents. This interleaves upper (or
  7497. lower) lines from odd frames with lower (or upper) lines from even frames,
  7498. halving the frame rate and preserving image height.
  7499. @example
  7500. Original Original New Frame
  7501. Frame 'j' Frame 'j+1' (tff)
  7502. ========== =========== ==================
  7503. Line 0 --------------------> Frame 'j' Line 0
  7504. Line 1 Line 1 ----> Frame 'j+1' Line 1
  7505. Line 2 ---------------------> Frame 'j' Line 2
  7506. Line 3 Line 3 ----> Frame 'j+1' Line 3
  7507. ... ... ...
  7508. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  7509. @end example
  7510. It accepts the following optional parameters:
  7511. @table @option
  7512. @item scan
  7513. This determines whether the interlaced frame is taken from the even
  7514. (tff - default) or odd (bff) lines of the progressive frame.
  7515. @item lowpass
  7516. Vertical lowpass filter to avoid twitter interlacing and
  7517. reduce moire patterns.
  7518. @table @samp
  7519. @item 0, off
  7520. Disable vertical lowpass filter
  7521. @item 1, linear
  7522. Enable linear filter (default)
  7523. @item 2, complex
  7524. Enable complex filter. This will slightly less reduce twitter and moire
  7525. but better retain detail and subjective sharpness impression.
  7526. @end table
  7527. @end table
  7528. @section kerndeint
  7529. Deinterlace input video by applying Donald Graft's adaptive kernel
  7530. deinterling. Work on interlaced parts of a video to produce
  7531. progressive frames.
  7532. The description of the accepted parameters follows.
  7533. @table @option
  7534. @item thresh
  7535. Set the threshold which affects the filter's tolerance when
  7536. determining if a pixel line must be processed. It must be an integer
  7537. in the range [0,255] and defaults to 10. A value of 0 will result in
  7538. applying the process on every pixels.
  7539. @item map
  7540. Paint pixels exceeding the threshold value to white if set to 1.
  7541. Default is 0.
  7542. @item order
  7543. Set the fields order. Swap fields if set to 1, leave fields alone if
  7544. 0. Default is 0.
  7545. @item sharp
  7546. Enable additional sharpening if set to 1. Default is 0.
  7547. @item twoway
  7548. Enable twoway sharpening if set to 1. Default is 0.
  7549. @end table
  7550. @subsection Examples
  7551. @itemize
  7552. @item
  7553. Apply default values:
  7554. @example
  7555. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  7556. @end example
  7557. @item
  7558. Enable additional sharpening:
  7559. @example
  7560. kerndeint=sharp=1
  7561. @end example
  7562. @item
  7563. Paint processed pixels in white:
  7564. @example
  7565. kerndeint=map=1
  7566. @end example
  7567. @end itemize
  7568. @section lenscorrection
  7569. Correct radial lens distortion
  7570. This filter can be used to correct for radial distortion as can result from the use
  7571. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  7572. one can use tools available for example as part of opencv or simply trial-and-error.
  7573. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  7574. and extract the k1 and k2 coefficients from the resulting matrix.
  7575. Note that effectively the same filter is available in the open-source tools Krita and
  7576. Digikam from the KDE project.
  7577. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  7578. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  7579. brightness distribution, so you may want to use both filters together in certain
  7580. cases, though you will have to take care of ordering, i.e. whether vignetting should
  7581. be applied before or after lens correction.
  7582. @subsection Options
  7583. The filter accepts the following options:
  7584. @table @option
  7585. @item cx
  7586. Relative x-coordinate of the focal point of the image, and thereby the center of the
  7587. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7588. width.
  7589. @item cy
  7590. Relative y-coordinate of the focal point of the image, and thereby the center of the
  7591. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7592. height.
  7593. @item k1
  7594. Coefficient of the quadratic correction term. 0.5 means no correction.
  7595. @item k2
  7596. Coefficient of the double quadratic correction term. 0.5 means no correction.
  7597. @end table
  7598. The formula that generates the correction is:
  7599. @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)
  7600. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  7601. distances from the focal point in the source and target images, respectively.
  7602. @section libvmaf
  7603. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  7604. score between two input videos.
  7605. The obtained VMAF score is printed through the logging system.
  7606. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  7607. After installing the library it can be enabled using:
  7608. @code{./configure --enable-libvmaf}.
  7609. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  7610. The filter has following options:
  7611. @table @option
  7612. @item model_path
  7613. Set the model path which is to be used for SVM.
  7614. Default value: @code{"vmaf_v0.6.1.pkl"}
  7615. @item log_path
  7616. Set the file path to be used to store logs.
  7617. @item log_fmt
  7618. Set the format of the log file (xml or json).
  7619. @item enable_transform
  7620. Enables transform for computing vmaf.
  7621. @item phone_model
  7622. Invokes the phone model which will generate VMAF scores higher than in the
  7623. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  7624. @item psnr
  7625. Enables computing psnr along with vmaf.
  7626. @item ssim
  7627. Enables computing ssim along with vmaf.
  7628. @item ms_ssim
  7629. Enables computing ms_ssim along with vmaf.
  7630. @item pool
  7631. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  7632. @end table
  7633. This filter also supports the @ref{framesync} options.
  7634. On the below examples the input file @file{main.mpg} being processed is
  7635. compared with the reference file @file{ref.mpg}.
  7636. @example
  7637. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  7638. @end example
  7639. Example with options:
  7640. @example
  7641. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
  7642. @end example
  7643. @section limiter
  7644. Limits the pixel components values to the specified range [min, max].
  7645. The filter accepts the following options:
  7646. @table @option
  7647. @item min
  7648. Lower bound. Defaults to the lowest allowed value for the input.
  7649. @item max
  7650. Upper bound. Defaults to the highest allowed value for the input.
  7651. @item planes
  7652. Specify which planes will be processed. Defaults to all available.
  7653. @end table
  7654. @section loop
  7655. Loop video frames.
  7656. The filter accepts the following options:
  7657. @table @option
  7658. @item loop
  7659. Set the number of loops. Setting this value to -1 will result in infinite loops.
  7660. Default is 0.
  7661. @item size
  7662. Set maximal size in number of frames. Default is 0.
  7663. @item start
  7664. Set first frame of loop. Default is 0.
  7665. @end table
  7666. @anchor{lut3d}
  7667. @section lut3d
  7668. Apply a 3D LUT to an input video.
  7669. The filter accepts the following options:
  7670. @table @option
  7671. @item file
  7672. Set the 3D LUT file name.
  7673. Currently supported formats:
  7674. @table @samp
  7675. @item 3dl
  7676. AfterEffects
  7677. @item cube
  7678. Iridas
  7679. @item dat
  7680. DaVinci
  7681. @item m3d
  7682. Pandora
  7683. @end table
  7684. @item interp
  7685. Select interpolation mode.
  7686. Available values are:
  7687. @table @samp
  7688. @item nearest
  7689. Use values from the nearest defined point.
  7690. @item trilinear
  7691. Interpolate values using the 8 points defining a cube.
  7692. @item tetrahedral
  7693. Interpolate values using a tetrahedron.
  7694. @end table
  7695. @end table
  7696. This filter also supports the @ref{framesync} options.
  7697. @section lumakey
  7698. Turn certain luma values into transparency.
  7699. The filter accepts the following options:
  7700. @table @option
  7701. @item threshold
  7702. Set the luma which will be used as base for transparency.
  7703. Default value is @code{0}.
  7704. @item tolerance
  7705. Set the range of luma values to be keyed out.
  7706. Default value is @code{0}.
  7707. @item softness
  7708. Set the range of softness. Default value is @code{0}.
  7709. Use this to control gradual transition from zero to full transparency.
  7710. @end table
  7711. @section lut, lutrgb, lutyuv
  7712. Compute a look-up table for binding each pixel component input value
  7713. to an output value, and apply it to the input video.
  7714. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  7715. to an RGB input video.
  7716. These filters accept the following parameters:
  7717. @table @option
  7718. @item c0
  7719. set first pixel component expression
  7720. @item c1
  7721. set second pixel component expression
  7722. @item c2
  7723. set third pixel component expression
  7724. @item c3
  7725. set fourth pixel component expression, corresponds to the alpha component
  7726. @item r
  7727. set red component expression
  7728. @item g
  7729. set green component expression
  7730. @item b
  7731. set blue component expression
  7732. @item a
  7733. alpha component expression
  7734. @item y
  7735. set Y/luminance component expression
  7736. @item u
  7737. set U/Cb component expression
  7738. @item v
  7739. set V/Cr component expression
  7740. @end table
  7741. Each of them specifies the expression to use for computing the lookup table for
  7742. the corresponding pixel component values.
  7743. The exact component associated to each of the @var{c*} options depends on the
  7744. format in input.
  7745. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  7746. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  7747. The expressions can contain the following constants and functions:
  7748. @table @option
  7749. @item w
  7750. @item h
  7751. The input width and height.
  7752. @item val
  7753. The input value for the pixel component.
  7754. @item clipval
  7755. The input value, clipped to the @var{minval}-@var{maxval} range.
  7756. @item maxval
  7757. The maximum value for the pixel component.
  7758. @item minval
  7759. The minimum value for the pixel component.
  7760. @item negval
  7761. The negated value for the pixel component value, clipped to the
  7762. @var{minval}-@var{maxval} range; it corresponds to the expression
  7763. "maxval-clipval+minval".
  7764. @item clip(val)
  7765. The computed value in @var{val}, clipped to the
  7766. @var{minval}-@var{maxval} range.
  7767. @item gammaval(gamma)
  7768. The computed gamma correction value of the pixel component value,
  7769. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  7770. expression
  7771. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  7772. @end table
  7773. All expressions default to "val".
  7774. @subsection Examples
  7775. @itemize
  7776. @item
  7777. Negate input video:
  7778. @example
  7779. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  7780. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  7781. @end example
  7782. The above is the same as:
  7783. @example
  7784. lutrgb="r=negval:g=negval:b=negval"
  7785. lutyuv="y=negval:u=negval:v=negval"
  7786. @end example
  7787. @item
  7788. Negate luminance:
  7789. @example
  7790. lutyuv=y=negval
  7791. @end example
  7792. @item
  7793. Remove chroma components, turning the video into a graytone image:
  7794. @example
  7795. lutyuv="u=128:v=128"
  7796. @end example
  7797. @item
  7798. Apply a luma burning effect:
  7799. @example
  7800. lutyuv="y=2*val"
  7801. @end example
  7802. @item
  7803. Remove green and blue components:
  7804. @example
  7805. lutrgb="g=0:b=0"
  7806. @end example
  7807. @item
  7808. Set a constant alpha channel value on input:
  7809. @example
  7810. format=rgba,lutrgb=a="maxval-minval/2"
  7811. @end example
  7812. @item
  7813. Correct luminance gamma by a factor of 0.5:
  7814. @example
  7815. lutyuv=y=gammaval(0.5)
  7816. @end example
  7817. @item
  7818. Discard least significant bits of luma:
  7819. @example
  7820. lutyuv=y='bitand(val, 128+64+32)'
  7821. @end example
  7822. @item
  7823. Technicolor like effect:
  7824. @example
  7825. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  7826. @end example
  7827. @end itemize
  7828. @section lut2, tlut2
  7829. The @code{lut2} filter takes two input streams and outputs one
  7830. stream.
  7831. The @code{tlut2} (time lut2) filter takes two consecutive frames
  7832. from one single stream.
  7833. This filter accepts the following parameters:
  7834. @table @option
  7835. @item c0
  7836. set first pixel component expression
  7837. @item c1
  7838. set second pixel component expression
  7839. @item c2
  7840. set third pixel component expression
  7841. @item c3
  7842. set fourth pixel component expression, corresponds to the alpha component
  7843. @end table
  7844. Each of them specifies the expression to use for computing the lookup table for
  7845. the corresponding pixel component values.
  7846. The exact component associated to each of the @var{c*} options depends on the
  7847. format in inputs.
  7848. The expressions can contain the following constants:
  7849. @table @option
  7850. @item w
  7851. @item h
  7852. The input width and height.
  7853. @item x
  7854. The first input value for the pixel component.
  7855. @item y
  7856. The second input value for the pixel component.
  7857. @item bdx
  7858. The first input video bit depth.
  7859. @item bdy
  7860. The second input video bit depth.
  7861. @end table
  7862. All expressions default to "x".
  7863. @subsection Examples
  7864. @itemize
  7865. @item
  7866. Highlight differences between two RGB video streams:
  7867. @example
  7868. 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)'
  7869. @end example
  7870. @item
  7871. Highlight differences between two YUV video streams:
  7872. @example
  7873. 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)'
  7874. @end example
  7875. @item
  7876. Show max difference between two video streams:
  7877. @example
  7878. 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)))'
  7879. @end example
  7880. @end itemize
  7881. @section maskedclamp
  7882. Clamp the first input stream with the second input and third input stream.
  7883. Returns the value of first stream to be between second input
  7884. stream - @code{undershoot} and third input stream + @code{overshoot}.
  7885. This filter accepts the following options:
  7886. @table @option
  7887. @item undershoot
  7888. Default value is @code{0}.
  7889. @item overshoot
  7890. Default value is @code{0}.
  7891. @item planes
  7892. Set which planes will be processed as bitmap, unprocessed planes will be
  7893. copied from first stream.
  7894. By default value 0xf, all planes will be processed.
  7895. @end table
  7896. @section maskedmerge
  7897. Merge the first input stream with the second input stream using per pixel
  7898. weights in the third input stream.
  7899. A value of 0 in the third stream pixel component means that pixel component
  7900. from first stream is returned unchanged, while maximum value (eg. 255 for
  7901. 8-bit videos) means that pixel component from second stream is returned
  7902. unchanged. Intermediate values define the amount of merging between both
  7903. input stream's pixel components.
  7904. This filter accepts the following options:
  7905. @table @option
  7906. @item planes
  7907. Set which planes will be processed as bitmap, unprocessed planes will be
  7908. copied from first stream.
  7909. By default value 0xf, all planes will be processed.
  7910. @end table
  7911. @section mcdeint
  7912. Apply motion-compensation deinterlacing.
  7913. It needs one field per frame as input and must thus be used together
  7914. with yadif=1/3 or equivalent.
  7915. This filter accepts the following options:
  7916. @table @option
  7917. @item mode
  7918. Set the deinterlacing mode.
  7919. It accepts one of the following values:
  7920. @table @samp
  7921. @item fast
  7922. @item medium
  7923. @item slow
  7924. use iterative motion estimation
  7925. @item extra_slow
  7926. like @samp{slow}, but use multiple reference frames.
  7927. @end table
  7928. Default value is @samp{fast}.
  7929. @item parity
  7930. Set the picture field parity assumed for the input video. It must be
  7931. one of the following values:
  7932. @table @samp
  7933. @item 0, tff
  7934. assume top field first
  7935. @item 1, bff
  7936. assume bottom field first
  7937. @end table
  7938. Default value is @samp{bff}.
  7939. @item qp
  7940. Set per-block quantization parameter (QP) used by the internal
  7941. encoder.
  7942. Higher values should result in a smoother motion vector field but less
  7943. optimal individual vectors. Default value is 1.
  7944. @end table
  7945. @section mergeplanes
  7946. Merge color channel components from several video streams.
  7947. The filter accepts up to 4 input streams, and merge selected input
  7948. planes to the output video.
  7949. This filter accepts the following options:
  7950. @table @option
  7951. @item mapping
  7952. Set input to output plane mapping. Default is @code{0}.
  7953. The mappings is specified as a bitmap. It should be specified as a
  7954. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  7955. mapping for the first plane of the output stream. 'A' sets the number of
  7956. the input stream to use (from 0 to 3), and 'a' the plane number of the
  7957. corresponding input to use (from 0 to 3). The rest of the mappings is
  7958. similar, 'Bb' describes the mapping for the output stream second
  7959. plane, 'Cc' describes the mapping for the output stream third plane and
  7960. 'Dd' describes the mapping for the output stream fourth plane.
  7961. @item format
  7962. Set output pixel format. Default is @code{yuva444p}.
  7963. @end table
  7964. @subsection Examples
  7965. @itemize
  7966. @item
  7967. Merge three gray video streams of same width and height into single video stream:
  7968. @example
  7969. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  7970. @end example
  7971. @item
  7972. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  7973. @example
  7974. [a0][a1]mergeplanes=0x00010210:yuva444p
  7975. @end example
  7976. @item
  7977. Swap Y and A plane in yuva444p stream:
  7978. @example
  7979. format=yuva444p,mergeplanes=0x03010200:yuva444p
  7980. @end example
  7981. @item
  7982. Swap U and V plane in yuv420p stream:
  7983. @example
  7984. format=yuv420p,mergeplanes=0x000201:yuv420p
  7985. @end example
  7986. @item
  7987. Cast a rgb24 clip to yuv444p:
  7988. @example
  7989. format=rgb24,mergeplanes=0x000102:yuv444p
  7990. @end example
  7991. @end itemize
  7992. @section mestimate
  7993. Estimate and export motion vectors using block matching algorithms.
  7994. Motion vectors are stored in frame side data to be used by other filters.
  7995. This filter accepts the following options:
  7996. @table @option
  7997. @item method
  7998. Specify the motion estimation method. Accepts one of the following values:
  7999. @table @samp
  8000. @item esa
  8001. Exhaustive search algorithm.
  8002. @item tss
  8003. Three step search algorithm.
  8004. @item tdls
  8005. Two dimensional logarithmic search algorithm.
  8006. @item ntss
  8007. New three step search algorithm.
  8008. @item fss
  8009. Four step search algorithm.
  8010. @item ds
  8011. Diamond search algorithm.
  8012. @item hexbs
  8013. Hexagon-based search algorithm.
  8014. @item epzs
  8015. Enhanced predictive zonal search algorithm.
  8016. @item umh
  8017. Uneven multi-hexagon search algorithm.
  8018. @end table
  8019. Default value is @samp{esa}.
  8020. @item mb_size
  8021. Macroblock size. Default @code{16}.
  8022. @item search_param
  8023. Search parameter. Default @code{7}.
  8024. @end table
  8025. @section midequalizer
  8026. Apply Midway Image Equalization effect using two video streams.
  8027. Midway Image Equalization adjusts a pair of images to have the same
  8028. histogram, while maintaining their dynamics as much as possible. It's
  8029. useful for e.g. matching exposures from a pair of stereo cameras.
  8030. This filter has two inputs and one output, which must be of same pixel format, but
  8031. may be of different sizes. The output of filter is first input adjusted with
  8032. midway histogram of both inputs.
  8033. This filter accepts the following option:
  8034. @table @option
  8035. @item planes
  8036. Set which planes to process. Default is @code{15}, which is all available planes.
  8037. @end table
  8038. @section minterpolate
  8039. Convert the video to specified frame rate using motion interpolation.
  8040. This filter accepts the following options:
  8041. @table @option
  8042. @item fps
  8043. 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}.
  8044. @item mi_mode
  8045. Motion interpolation mode. Following values are accepted:
  8046. @table @samp
  8047. @item dup
  8048. Duplicate previous or next frame for interpolating new ones.
  8049. @item blend
  8050. Blend source frames. Interpolated frame is mean of previous and next frames.
  8051. @item mci
  8052. Motion compensated interpolation. Following options are effective when this mode is selected:
  8053. @table @samp
  8054. @item mc_mode
  8055. Motion compensation mode. Following values are accepted:
  8056. @table @samp
  8057. @item obmc
  8058. Overlapped block motion compensation.
  8059. @item aobmc
  8060. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  8061. @end table
  8062. Default mode is @samp{obmc}.
  8063. @item me_mode
  8064. Motion estimation mode. Following values are accepted:
  8065. @table @samp
  8066. @item bidir
  8067. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  8068. @item bilat
  8069. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  8070. @end table
  8071. Default mode is @samp{bilat}.
  8072. @item me
  8073. The algorithm to be used for motion estimation. Following values are accepted:
  8074. @table @samp
  8075. @item esa
  8076. Exhaustive search algorithm.
  8077. @item tss
  8078. Three step search algorithm.
  8079. @item tdls
  8080. Two dimensional logarithmic search algorithm.
  8081. @item ntss
  8082. New three step search algorithm.
  8083. @item fss
  8084. Four step search algorithm.
  8085. @item ds
  8086. Diamond search algorithm.
  8087. @item hexbs
  8088. Hexagon-based search algorithm.
  8089. @item epzs
  8090. Enhanced predictive zonal search algorithm.
  8091. @item umh
  8092. Uneven multi-hexagon search algorithm.
  8093. @end table
  8094. Default algorithm is @samp{epzs}.
  8095. @item mb_size
  8096. Macroblock size. Default @code{16}.
  8097. @item search_param
  8098. Motion estimation search parameter. Default @code{32}.
  8099. @item vsbmc
  8100. 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).
  8101. @end table
  8102. @end table
  8103. @item scd
  8104. 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:
  8105. @table @samp
  8106. @item none
  8107. Disable scene change detection.
  8108. @item fdiff
  8109. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  8110. @end table
  8111. Default method is @samp{fdiff}.
  8112. @item scd_threshold
  8113. Scene change detection threshold. Default is @code{5.0}.
  8114. @end table
  8115. @section mpdecimate
  8116. Drop frames that do not differ greatly from the previous frame in
  8117. order to reduce frame rate.
  8118. The main use of this filter is for very-low-bitrate encoding
  8119. (e.g. streaming over dialup modem), but it could in theory be used for
  8120. fixing movies that were inverse-telecined incorrectly.
  8121. A description of the accepted options follows.
  8122. @table @option
  8123. @item max
  8124. Set the maximum number of consecutive frames which can be dropped (if
  8125. positive), or the minimum interval between dropped frames (if
  8126. negative). If the value is 0, the frame is dropped disregarding the
  8127. number of previous sequentially dropped frames.
  8128. Default value is 0.
  8129. @item hi
  8130. @item lo
  8131. @item frac
  8132. Set the dropping threshold values.
  8133. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  8134. represent actual pixel value differences, so a threshold of 64
  8135. corresponds to 1 unit of difference for each pixel, or the same spread
  8136. out differently over the block.
  8137. A frame is a candidate for dropping if no 8x8 blocks differ by more
  8138. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  8139. meaning the whole image) differ by more than a threshold of @option{lo}.
  8140. Default value for @option{hi} is 64*12, default value for @option{lo} is
  8141. 64*5, and default value for @option{frac} is 0.33.
  8142. @end table
  8143. @section negate
  8144. Negate input video.
  8145. It accepts an integer in input; if non-zero it negates the
  8146. alpha component (if available). The default value in input is 0.
  8147. @section nlmeans
  8148. Denoise frames using Non-Local Means algorithm.
  8149. Each pixel is adjusted by looking for other pixels with similar contexts. This
  8150. context similarity is defined by comparing their surrounding patches of size
  8151. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  8152. around the pixel.
  8153. Note that the research area defines centers for patches, which means some
  8154. patches will be made of pixels outside that research area.
  8155. The filter accepts the following options.
  8156. @table @option
  8157. @item s
  8158. Set denoising strength.
  8159. @item p
  8160. Set patch size.
  8161. @item pc
  8162. Same as @option{p} but for chroma planes.
  8163. The default value is @var{0} and means automatic.
  8164. @item r
  8165. Set research size.
  8166. @item rc
  8167. Same as @option{r} but for chroma planes.
  8168. The default value is @var{0} and means automatic.
  8169. @end table
  8170. @section nnedi
  8171. Deinterlace video using neural network edge directed interpolation.
  8172. This filter accepts the following options:
  8173. @table @option
  8174. @item weights
  8175. Mandatory option, without binary file filter can not work.
  8176. Currently file can be found here:
  8177. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  8178. @item deint
  8179. Set which frames to deinterlace, by default it is @code{all}.
  8180. Can be @code{all} or @code{interlaced}.
  8181. @item field
  8182. Set mode of operation.
  8183. Can be one of the following:
  8184. @table @samp
  8185. @item af
  8186. Use frame flags, both fields.
  8187. @item a
  8188. Use frame flags, single field.
  8189. @item t
  8190. Use top field only.
  8191. @item b
  8192. Use bottom field only.
  8193. @item tf
  8194. Use both fields, top first.
  8195. @item bf
  8196. Use both fields, bottom first.
  8197. @end table
  8198. @item planes
  8199. Set which planes to process, by default filter process all frames.
  8200. @item nsize
  8201. Set size of local neighborhood around each pixel, used by the predictor neural
  8202. network.
  8203. Can be one of the following:
  8204. @table @samp
  8205. @item s8x6
  8206. @item s16x6
  8207. @item s32x6
  8208. @item s48x6
  8209. @item s8x4
  8210. @item s16x4
  8211. @item s32x4
  8212. @end table
  8213. @item nns
  8214. Set the number of neurons in predictor neural network.
  8215. Can be one of the following:
  8216. @table @samp
  8217. @item n16
  8218. @item n32
  8219. @item n64
  8220. @item n128
  8221. @item n256
  8222. @end table
  8223. @item qual
  8224. Controls the number of different neural network predictions that are blended
  8225. together to compute the final output value. Can be @code{fast}, default or
  8226. @code{slow}.
  8227. @item etype
  8228. Set which set of weights to use in the predictor.
  8229. Can be one of the following:
  8230. @table @samp
  8231. @item a
  8232. weights trained to minimize absolute error
  8233. @item s
  8234. weights trained to minimize squared error
  8235. @end table
  8236. @item pscrn
  8237. Controls whether or not the prescreener neural network is used to decide
  8238. which pixels should be processed by the predictor neural network and which
  8239. can be handled by simple cubic interpolation.
  8240. The prescreener is trained to know whether cubic interpolation will be
  8241. sufficient for a pixel or whether it should be predicted by the predictor nn.
  8242. The computational complexity of the prescreener nn is much less than that of
  8243. the predictor nn. Since most pixels can be handled by cubic interpolation,
  8244. using the prescreener generally results in much faster processing.
  8245. The prescreener is pretty accurate, so the difference between using it and not
  8246. using it is almost always unnoticeable.
  8247. Can be one of the following:
  8248. @table @samp
  8249. @item none
  8250. @item original
  8251. @item new
  8252. @end table
  8253. Default is @code{new}.
  8254. @item fapprox
  8255. Set various debugging flags.
  8256. @end table
  8257. @section noformat
  8258. Force libavfilter not to use any of the specified pixel formats for the
  8259. input to the next filter.
  8260. It accepts the following parameters:
  8261. @table @option
  8262. @item pix_fmts
  8263. A '|'-separated list of pixel format names, such as
  8264. pix_fmts=yuv420p|monow|rgb24".
  8265. @end table
  8266. @subsection Examples
  8267. @itemize
  8268. @item
  8269. Force libavfilter to use a format different from @var{yuv420p} for the
  8270. input to the vflip filter:
  8271. @example
  8272. noformat=pix_fmts=yuv420p,vflip
  8273. @end example
  8274. @item
  8275. Convert the input video to any of the formats not contained in the list:
  8276. @example
  8277. noformat=yuv420p|yuv444p|yuv410p
  8278. @end example
  8279. @end itemize
  8280. @section noise
  8281. Add noise on video input frame.
  8282. The filter accepts the following options:
  8283. @table @option
  8284. @item all_seed
  8285. @item c0_seed
  8286. @item c1_seed
  8287. @item c2_seed
  8288. @item c3_seed
  8289. Set noise seed for specific pixel component or all pixel components in case
  8290. of @var{all_seed}. Default value is @code{123457}.
  8291. @item all_strength, alls
  8292. @item c0_strength, c0s
  8293. @item c1_strength, c1s
  8294. @item c2_strength, c2s
  8295. @item c3_strength, c3s
  8296. Set noise strength for specific pixel component or all pixel components in case
  8297. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  8298. @item all_flags, allf
  8299. @item c0_flags, c0f
  8300. @item c1_flags, c1f
  8301. @item c2_flags, c2f
  8302. @item c3_flags, c3f
  8303. Set pixel component flags or set flags for all components if @var{all_flags}.
  8304. Available values for component flags are:
  8305. @table @samp
  8306. @item a
  8307. averaged temporal noise (smoother)
  8308. @item p
  8309. mix random noise with a (semi)regular pattern
  8310. @item t
  8311. temporal noise (noise pattern changes between frames)
  8312. @item u
  8313. uniform noise (gaussian otherwise)
  8314. @end table
  8315. @end table
  8316. @subsection Examples
  8317. Add temporal and uniform noise to input video:
  8318. @example
  8319. noise=alls=20:allf=t+u
  8320. @end example
  8321. @section null
  8322. Pass the video source unchanged to the output.
  8323. @section ocr
  8324. Optical Character Recognition
  8325. This filter uses Tesseract for optical character recognition.
  8326. It accepts the following options:
  8327. @table @option
  8328. @item datapath
  8329. Set datapath to tesseract data. Default is to use whatever was
  8330. set at installation.
  8331. @item language
  8332. Set language, default is "eng".
  8333. @item whitelist
  8334. Set character whitelist.
  8335. @item blacklist
  8336. Set character blacklist.
  8337. @end table
  8338. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  8339. @section ocv
  8340. Apply a video transform using libopencv.
  8341. To enable this filter, install the libopencv library and headers and
  8342. configure FFmpeg with @code{--enable-libopencv}.
  8343. It accepts the following parameters:
  8344. @table @option
  8345. @item filter_name
  8346. The name of the libopencv filter to apply.
  8347. @item filter_params
  8348. The parameters to pass to the libopencv filter. If not specified, the default
  8349. values are assumed.
  8350. @end table
  8351. Refer to the official libopencv documentation for more precise
  8352. information:
  8353. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  8354. Several libopencv filters are supported; see the following subsections.
  8355. @anchor{dilate}
  8356. @subsection dilate
  8357. Dilate an image by using a specific structuring element.
  8358. It corresponds to the libopencv function @code{cvDilate}.
  8359. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  8360. @var{struct_el} represents a structuring element, and has the syntax:
  8361. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  8362. @var{cols} and @var{rows} represent the number of columns and rows of
  8363. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  8364. point, and @var{shape} the shape for the structuring element. @var{shape}
  8365. must be "rect", "cross", "ellipse", or "custom".
  8366. If the value for @var{shape} is "custom", it must be followed by a
  8367. string of the form "=@var{filename}". The file with name
  8368. @var{filename} is assumed to represent a binary image, with each
  8369. printable character corresponding to a bright pixel. When a custom
  8370. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  8371. or columns and rows of the read file are assumed instead.
  8372. The default value for @var{struct_el} is "3x3+0x0/rect".
  8373. @var{nb_iterations} specifies the number of times the transform is
  8374. applied to the image, and defaults to 1.
  8375. Some examples:
  8376. @example
  8377. # Use the default values
  8378. ocv=dilate
  8379. # Dilate using a structuring element with a 5x5 cross, iterating two times
  8380. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  8381. # Read the shape from the file diamond.shape, iterating two times.
  8382. # The file diamond.shape may contain a pattern of characters like this
  8383. # *
  8384. # ***
  8385. # *****
  8386. # ***
  8387. # *
  8388. # The specified columns and rows are ignored
  8389. # but the anchor point coordinates are not
  8390. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  8391. @end example
  8392. @subsection erode
  8393. Erode an image by using a specific structuring element.
  8394. It corresponds to the libopencv function @code{cvErode}.
  8395. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  8396. with the same syntax and semantics as the @ref{dilate} filter.
  8397. @subsection smooth
  8398. Smooth the input video.
  8399. The filter takes the following parameters:
  8400. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  8401. @var{type} is the type of smooth filter to apply, and must be one of
  8402. the following values: "blur", "blur_no_scale", "median", "gaussian",
  8403. or "bilateral". The default value is "gaussian".
  8404. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  8405. depend on the smooth type. @var{param1} and
  8406. @var{param2} accept integer positive values or 0. @var{param3} and
  8407. @var{param4} accept floating point values.
  8408. The default value for @var{param1} is 3. The default value for the
  8409. other parameters is 0.
  8410. These parameters correspond to the parameters assigned to the
  8411. libopencv function @code{cvSmooth}.
  8412. @section oscilloscope
  8413. 2D Video Oscilloscope.
  8414. Useful to measure spatial impulse, step responses, chroma delays, etc.
  8415. It accepts the following parameters:
  8416. @table @option
  8417. @item x
  8418. Set scope center x position.
  8419. @item y
  8420. Set scope center y position.
  8421. @item s
  8422. Set scope size, relative to frame diagonal.
  8423. @item t
  8424. Set scope tilt/rotation.
  8425. @item o
  8426. Set trace opacity.
  8427. @item tx
  8428. Set trace center x position.
  8429. @item ty
  8430. Set trace center y position.
  8431. @item tw
  8432. Set trace width, relative to width of frame.
  8433. @item th
  8434. Set trace height, relative to height of frame.
  8435. @item c
  8436. Set which components to trace. By default it traces first three components.
  8437. @item g
  8438. Draw trace grid. By default is enabled.
  8439. @item st
  8440. Draw some statistics. By default is enabled.
  8441. @item sc
  8442. Draw scope. By default is enabled.
  8443. @end table
  8444. @subsection Examples
  8445. @itemize
  8446. @item
  8447. Inspect full first row of video frame.
  8448. @example
  8449. oscilloscope=x=0.5:y=0:s=1
  8450. @end example
  8451. @item
  8452. Inspect full last row of video frame.
  8453. @example
  8454. oscilloscope=x=0.5:y=1:s=1
  8455. @end example
  8456. @item
  8457. Inspect full 5th line of video frame of height 1080.
  8458. @example
  8459. oscilloscope=x=0.5:y=5/1080:s=1
  8460. @end example
  8461. @item
  8462. Inspect full last column of video frame.
  8463. @example
  8464. oscilloscope=x=1:y=0.5:s=1:t=1
  8465. @end example
  8466. @end itemize
  8467. @anchor{overlay}
  8468. @section overlay
  8469. Overlay one video on top of another.
  8470. It takes two inputs and has one output. The first input is the "main"
  8471. video on which the second input is overlaid.
  8472. It accepts the following parameters:
  8473. A description of the accepted options follows.
  8474. @table @option
  8475. @item x
  8476. @item y
  8477. Set the expression for the x and y coordinates of the overlaid video
  8478. on the main video. Default value is "0" for both expressions. In case
  8479. the expression is invalid, it is set to a huge value (meaning that the
  8480. overlay will not be displayed within the output visible area).
  8481. @item eof_action
  8482. See @ref{framesync}.
  8483. @item eval
  8484. Set when the expressions for @option{x}, and @option{y} are evaluated.
  8485. It accepts the following values:
  8486. @table @samp
  8487. @item init
  8488. only evaluate expressions once during the filter initialization or
  8489. when a command is processed
  8490. @item frame
  8491. evaluate expressions for each incoming frame
  8492. @end table
  8493. Default value is @samp{frame}.
  8494. @item shortest
  8495. See @ref{framesync}.
  8496. @item format
  8497. Set the format for the output video.
  8498. It accepts the following values:
  8499. @table @samp
  8500. @item yuv420
  8501. force YUV420 output
  8502. @item yuv422
  8503. force YUV422 output
  8504. @item yuv444
  8505. force YUV444 output
  8506. @item rgb
  8507. force packed RGB output
  8508. @item gbrp
  8509. force planar RGB output
  8510. @item auto
  8511. automatically pick format
  8512. @end table
  8513. Default value is @samp{yuv420}.
  8514. @item repeatlast
  8515. See @ref{framesync}.
  8516. @end table
  8517. The @option{x}, and @option{y} expressions can contain the following
  8518. parameters.
  8519. @table @option
  8520. @item main_w, W
  8521. @item main_h, H
  8522. The main input width and height.
  8523. @item overlay_w, w
  8524. @item overlay_h, h
  8525. The overlay input width and height.
  8526. @item x
  8527. @item y
  8528. The computed values for @var{x} and @var{y}. They are evaluated for
  8529. each new frame.
  8530. @item hsub
  8531. @item vsub
  8532. horizontal and vertical chroma subsample values of the output
  8533. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  8534. @var{vsub} is 1.
  8535. @item n
  8536. the number of input frame, starting from 0
  8537. @item pos
  8538. the position in the file of the input frame, NAN if unknown
  8539. @item t
  8540. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  8541. @end table
  8542. This filter also supports the @ref{framesync} options.
  8543. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  8544. when evaluation is done @emph{per frame}, and will evaluate to NAN
  8545. when @option{eval} is set to @samp{init}.
  8546. Be aware that frames are taken from each input video in timestamp
  8547. order, hence, if their initial timestamps differ, it is a good idea
  8548. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  8549. have them begin in the same zero timestamp, as the example for
  8550. the @var{movie} filter does.
  8551. You can chain together more overlays but you should test the
  8552. efficiency of such approach.
  8553. @subsection Commands
  8554. This filter supports the following commands:
  8555. @table @option
  8556. @item x
  8557. @item y
  8558. Modify the x and y of the overlay input.
  8559. The command accepts the same syntax of the corresponding option.
  8560. If the specified expression is not valid, it is kept at its current
  8561. value.
  8562. @end table
  8563. @subsection Examples
  8564. @itemize
  8565. @item
  8566. Draw the overlay at 10 pixels from the bottom right corner of the main
  8567. video:
  8568. @example
  8569. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  8570. @end example
  8571. Using named options the example above becomes:
  8572. @example
  8573. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  8574. @end example
  8575. @item
  8576. Insert a transparent PNG logo in the bottom left corner of the input,
  8577. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  8578. @example
  8579. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  8580. @end example
  8581. @item
  8582. Insert 2 different transparent PNG logos (second logo on bottom
  8583. right corner) using the @command{ffmpeg} tool:
  8584. @example
  8585. 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
  8586. @end example
  8587. @item
  8588. Add a transparent color layer on top of the main video; @code{WxH}
  8589. must specify the size of the main input to the overlay filter:
  8590. @example
  8591. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  8592. @end example
  8593. @item
  8594. Play an original video and a filtered version (here with the deshake
  8595. filter) side by side using the @command{ffplay} tool:
  8596. @example
  8597. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  8598. @end example
  8599. The above command is the same as:
  8600. @example
  8601. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  8602. @end example
  8603. @item
  8604. Make a sliding overlay appearing from the left to the right top part of the
  8605. screen starting since time 2:
  8606. @example
  8607. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  8608. @end example
  8609. @item
  8610. Compose output by putting two input videos side to side:
  8611. @example
  8612. ffmpeg -i left.avi -i right.avi -filter_complex "
  8613. nullsrc=size=200x100 [background];
  8614. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  8615. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  8616. [background][left] overlay=shortest=1 [background+left];
  8617. [background+left][right] overlay=shortest=1:x=100 [left+right]
  8618. "
  8619. @end example
  8620. @item
  8621. Mask 10-20 seconds of a video by applying the delogo filter to a section
  8622. @example
  8623. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  8624. -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]'
  8625. masked.avi
  8626. @end example
  8627. @item
  8628. Chain several overlays in cascade:
  8629. @example
  8630. nullsrc=s=200x200 [bg];
  8631. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  8632. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  8633. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  8634. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  8635. [in3] null, [mid2] overlay=100:100 [out0]
  8636. @end example
  8637. @end itemize
  8638. @section owdenoise
  8639. Apply Overcomplete Wavelet denoiser.
  8640. The filter accepts the following options:
  8641. @table @option
  8642. @item depth
  8643. Set depth.
  8644. Larger depth values will denoise lower frequency components more, but
  8645. slow down filtering.
  8646. Must be an int in the range 8-16, default is @code{8}.
  8647. @item luma_strength, ls
  8648. Set luma strength.
  8649. Must be a double value in the range 0-1000, default is @code{1.0}.
  8650. @item chroma_strength, cs
  8651. Set chroma strength.
  8652. Must be a double value in the range 0-1000, default is @code{1.0}.
  8653. @end table
  8654. @anchor{pad}
  8655. @section pad
  8656. Add paddings to the input image, and place the original input at the
  8657. provided @var{x}, @var{y} coordinates.
  8658. It accepts the following parameters:
  8659. @table @option
  8660. @item width, w
  8661. @item height, h
  8662. Specify an expression for the size of the output image with the
  8663. paddings added. If the value for @var{width} or @var{height} is 0, the
  8664. corresponding input size is used for the output.
  8665. The @var{width} expression can reference the value set by the
  8666. @var{height} expression, and vice versa.
  8667. The default value of @var{width} and @var{height} is 0.
  8668. @item x
  8669. @item y
  8670. Specify the offsets to place the input image at within the padded area,
  8671. with respect to the top/left border of the output image.
  8672. The @var{x} expression can reference the value set by the @var{y}
  8673. expression, and vice versa.
  8674. The default value of @var{x} and @var{y} is 0.
  8675. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  8676. so the input image is centered on the padded area.
  8677. @item color
  8678. Specify the color of the padded area. For the syntax of this option,
  8679. check the "Color" section in the ffmpeg-utils manual.
  8680. The default value of @var{color} is "black".
  8681. @item eval
  8682. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  8683. It accepts the following values:
  8684. @table @samp
  8685. @item init
  8686. Only evaluate expressions once during the filter initialization or when
  8687. a command is processed.
  8688. @item frame
  8689. Evaluate expressions for each incoming frame.
  8690. @end table
  8691. Default value is @samp{init}.
  8692. @item aspect
  8693. Pad to aspect instead to a resolution.
  8694. @end table
  8695. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  8696. options are expressions containing the following constants:
  8697. @table @option
  8698. @item in_w
  8699. @item in_h
  8700. The input video width and height.
  8701. @item iw
  8702. @item ih
  8703. These are the same as @var{in_w} and @var{in_h}.
  8704. @item out_w
  8705. @item out_h
  8706. The output width and height (the size of the padded area), as
  8707. specified by the @var{width} and @var{height} expressions.
  8708. @item ow
  8709. @item oh
  8710. These are the same as @var{out_w} and @var{out_h}.
  8711. @item x
  8712. @item y
  8713. The x and y offsets as specified by the @var{x} and @var{y}
  8714. expressions, or NAN if not yet specified.
  8715. @item a
  8716. same as @var{iw} / @var{ih}
  8717. @item sar
  8718. input sample aspect ratio
  8719. @item dar
  8720. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  8721. @item hsub
  8722. @item vsub
  8723. The horizontal and vertical chroma subsample values. For example for the
  8724. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8725. @end table
  8726. @subsection Examples
  8727. @itemize
  8728. @item
  8729. Add paddings with the color "violet" to the input video. The output video
  8730. size is 640x480, and the top-left corner of the input video is placed at
  8731. column 0, row 40
  8732. @example
  8733. pad=640:480:0:40:violet
  8734. @end example
  8735. The example above is equivalent to the following command:
  8736. @example
  8737. pad=width=640:height=480:x=0:y=40:color=violet
  8738. @end example
  8739. @item
  8740. Pad the input to get an output with dimensions increased by 3/2,
  8741. and put the input video at the center of the padded area:
  8742. @example
  8743. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  8744. @end example
  8745. @item
  8746. Pad the input to get a squared output with size equal to the maximum
  8747. value between the input width and height, and put the input video at
  8748. the center of the padded area:
  8749. @example
  8750. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  8751. @end example
  8752. @item
  8753. Pad the input to get a final w/h ratio of 16:9:
  8754. @example
  8755. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  8756. @end example
  8757. @item
  8758. In case of anamorphic video, in order to set the output display aspect
  8759. correctly, it is necessary to use @var{sar} in the expression,
  8760. according to the relation:
  8761. @example
  8762. (ih * X / ih) * sar = output_dar
  8763. X = output_dar / sar
  8764. @end example
  8765. Thus the previous example needs to be modified to:
  8766. @example
  8767. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  8768. @end example
  8769. @item
  8770. Double the output size and put the input video in the bottom-right
  8771. corner of the output padded area:
  8772. @example
  8773. pad="2*iw:2*ih:ow-iw:oh-ih"
  8774. @end example
  8775. @end itemize
  8776. @anchor{palettegen}
  8777. @section palettegen
  8778. Generate one palette for a whole video stream.
  8779. It accepts the following options:
  8780. @table @option
  8781. @item max_colors
  8782. Set the maximum number of colors to quantize in the palette.
  8783. Note: the palette will still contain 256 colors; the unused palette entries
  8784. will be black.
  8785. @item reserve_transparent
  8786. Create a palette of 255 colors maximum and reserve the last one for
  8787. transparency. Reserving the transparency color is useful for GIF optimization.
  8788. If not set, the maximum of colors in the palette will be 256. You probably want
  8789. to disable this option for a standalone image.
  8790. Set by default.
  8791. @item transparency_color
  8792. Set the color that will be used as background for transparency.
  8793. @item stats_mode
  8794. Set statistics mode.
  8795. It accepts the following values:
  8796. @table @samp
  8797. @item full
  8798. Compute full frame histograms.
  8799. @item diff
  8800. Compute histograms only for the part that differs from previous frame. This
  8801. might be relevant to give more importance to the moving part of your input if
  8802. the background is static.
  8803. @item single
  8804. Compute new histogram for each frame.
  8805. @end table
  8806. Default value is @var{full}.
  8807. @end table
  8808. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  8809. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  8810. color quantization of the palette. This information is also visible at
  8811. @var{info} logging level.
  8812. @subsection Examples
  8813. @itemize
  8814. @item
  8815. Generate a representative palette of a given video using @command{ffmpeg}:
  8816. @example
  8817. ffmpeg -i input.mkv -vf palettegen palette.png
  8818. @end example
  8819. @end itemize
  8820. @section paletteuse
  8821. Use a palette to downsample an input video stream.
  8822. The filter takes two inputs: one video stream and a palette. The palette must
  8823. be a 256 pixels image.
  8824. It accepts the following options:
  8825. @table @option
  8826. @item dither
  8827. Select dithering mode. Available algorithms are:
  8828. @table @samp
  8829. @item bayer
  8830. Ordered 8x8 bayer dithering (deterministic)
  8831. @item heckbert
  8832. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  8833. Note: this dithering is sometimes considered "wrong" and is included as a
  8834. reference.
  8835. @item floyd_steinberg
  8836. Floyd and Steingberg dithering (error diffusion)
  8837. @item sierra2
  8838. Frankie Sierra dithering v2 (error diffusion)
  8839. @item sierra2_4a
  8840. Frankie Sierra dithering v2 "Lite" (error diffusion)
  8841. @end table
  8842. Default is @var{sierra2_4a}.
  8843. @item bayer_scale
  8844. When @var{bayer} dithering is selected, this option defines the scale of the
  8845. pattern (how much the crosshatch pattern is visible). A low value means more
  8846. visible pattern for less banding, and higher value means less visible pattern
  8847. at the cost of more banding.
  8848. The option must be an integer value in the range [0,5]. Default is @var{2}.
  8849. @item diff_mode
  8850. If set, define the zone to process
  8851. @table @samp
  8852. @item rectangle
  8853. Only the changing rectangle will be reprocessed. This is similar to GIF
  8854. cropping/offsetting compression mechanism. This option can be useful for speed
  8855. if only a part of the image is changing, and has use cases such as limiting the
  8856. scope of the error diffusal @option{dither} to the rectangle that bounds the
  8857. moving scene (it leads to more deterministic output if the scene doesn't change
  8858. much, and as a result less moving noise and better GIF compression).
  8859. @end table
  8860. Default is @var{none}.
  8861. @item new
  8862. Take new palette for each output frame.
  8863. @item alpha_threshold
  8864. Sets the alpha threshold for transparency. Alpha values above this threshold
  8865. will be treated as completely opaque, and values below this threshold will be
  8866. treated as completely transparent.
  8867. The option must be an integer value in the range [0,255]. Default is @var{128}.
  8868. @end table
  8869. @subsection Examples
  8870. @itemize
  8871. @item
  8872. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  8873. using @command{ffmpeg}:
  8874. @example
  8875. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  8876. @end example
  8877. @end itemize
  8878. @section perspective
  8879. Correct perspective of video not recorded perpendicular to the screen.
  8880. A description of the accepted parameters follows.
  8881. @table @option
  8882. @item x0
  8883. @item y0
  8884. @item x1
  8885. @item y1
  8886. @item x2
  8887. @item y2
  8888. @item x3
  8889. @item y3
  8890. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  8891. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  8892. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  8893. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  8894. then the corners of the source will be sent to the specified coordinates.
  8895. The expressions can use the following variables:
  8896. @table @option
  8897. @item W
  8898. @item H
  8899. the width and height of video frame.
  8900. @item in
  8901. Input frame count.
  8902. @item on
  8903. Output frame count.
  8904. @end table
  8905. @item interpolation
  8906. Set interpolation for perspective correction.
  8907. It accepts the following values:
  8908. @table @samp
  8909. @item linear
  8910. @item cubic
  8911. @end table
  8912. Default value is @samp{linear}.
  8913. @item sense
  8914. Set interpretation of coordinate options.
  8915. It accepts the following values:
  8916. @table @samp
  8917. @item 0, source
  8918. Send point in the source specified by the given coordinates to
  8919. the corners of the destination.
  8920. @item 1, destination
  8921. Send the corners of the source to the point in the destination specified
  8922. by the given coordinates.
  8923. Default value is @samp{source}.
  8924. @end table
  8925. @item eval
  8926. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  8927. It accepts the following values:
  8928. @table @samp
  8929. @item init
  8930. only evaluate expressions once during the filter initialization or
  8931. when a command is processed
  8932. @item frame
  8933. evaluate expressions for each incoming frame
  8934. @end table
  8935. Default value is @samp{init}.
  8936. @end table
  8937. @section phase
  8938. Delay interlaced video by one field time so that the field order changes.
  8939. The intended use is to fix PAL movies that have been captured with the
  8940. opposite field order to the film-to-video transfer.
  8941. A description of the accepted parameters follows.
  8942. @table @option
  8943. @item mode
  8944. Set phase mode.
  8945. It accepts the following values:
  8946. @table @samp
  8947. @item t
  8948. Capture field order top-first, transfer bottom-first.
  8949. Filter will delay the bottom field.
  8950. @item b
  8951. Capture field order bottom-first, transfer top-first.
  8952. Filter will delay the top field.
  8953. @item p
  8954. Capture and transfer with the same field order. This mode only exists
  8955. for the documentation of the other options to refer to, but if you
  8956. actually select it, the filter will faithfully do nothing.
  8957. @item a
  8958. Capture field order determined automatically by field flags, transfer
  8959. opposite.
  8960. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  8961. basis using field flags. If no field information is available,
  8962. then this works just like @samp{u}.
  8963. @item u
  8964. Capture unknown or varying, transfer opposite.
  8965. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  8966. analyzing the images and selecting the alternative that produces best
  8967. match between the fields.
  8968. @item T
  8969. Capture top-first, transfer unknown or varying.
  8970. Filter selects among @samp{t} and @samp{p} using image analysis.
  8971. @item B
  8972. Capture bottom-first, transfer unknown or varying.
  8973. Filter selects among @samp{b} and @samp{p} using image analysis.
  8974. @item A
  8975. Capture determined by field flags, transfer unknown or varying.
  8976. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  8977. image analysis. If no field information is available, then this works just
  8978. like @samp{U}. This is the default mode.
  8979. @item U
  8980. Both capture and transfer unknown or varying.
  8981. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  8982. @end table
  8983. @end table
  8984. @section pixdesctest
  8985. Pixel format descriptor test filter, mainly useful for internal
  8986. testing. The output video should be equal to the input video.
  8987. For example:
  8988. @example
  8989. format=monow, pixdesctest
  8990. @end example
  8991. can be used to test the monowhite pixel format descriptor definition.
  8992. @section pixscope
  8993. Display sample values of color channels. Mainly useful for checking color
  8994. and levels. Minimum supported resolution is 640x480.
  8995. The filters accept the following options:
  8996. @table @option
  8997. @item x
  8998. Set scope X position, relative offset on X axis.
  8999. @item y
  9000. Set scope Y position, relative offset on Y axis.
  9001. @item w
  9002. Set scope width.
  9003. @item h
  9004. Set scope height.
  9005. @item o
  9006. Set window opacity. This window also holds statistics about pixel area.
  9007. @item wx
  9008. Set window X position, relative offset on X axis.
  9009. @item wy
  9010. Set window Y position, relative offset on Y axis.
  9011. @end table
  9012. @section pp
  9013. Enable the specified chain of postprocessing subfilters using libpostproc. This
  9014. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  9015. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  9016. Each subfilter and some options have a short and a long name that can be used
  9017. interchangeably, i.e. dr/dering are the same.
  9018. The filters accept the following options:
  9019. @table @option
  9020. @item subfilters
  9021. Set postprocessing subfilters string.
  9022. @end table
  9023. All subfilters share common options to determine their scope:
  9024. @table @option
  9025. @item a/autoq
  9026. Honor the quality commands for this subfilter.
  9027. @item c/chrom
  9028. Do chrominance filtering, too (default).
  9029. @item y/nochrom
  9030. Do luminance filtering only (no chrominance).
  9031. @item n/noluma
  9032. Do chrominance filtering only (no luminance).
  9033. @end table
  9034. These options can be appended after the subfilter name, separated by a '|'.
  9035. Available subfilters are:
  9036. @table @option
  9037. @item hb/hdeblock[|difference[|flatness]]
  9038. Horizontal deblocking filter
  9039. @table @option
  9040. @item difference
  9041. Difference factor where higher values mean more deblocking (default: @code{32}).
  9042. @item flatness
  9043. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9044. @end table
  9045. @item vb/vdeblock[|difference[|flatness]]
  9046. Vertical deblocking filter
  9047. @table @option
  9048. @item difference
  9049. Difference factor where higher values mean more deblocking (default: @code{32}).
  9050. @item flatness
  9051. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9052. @end table
  9053. @item ha/hadeblock[|difference[|flatness]]
  9054. Accurate horizontal deblocking filter
  9055. @table @option
  9056. @item difference
  9057. Difference factor where higher values mean more deblocking (default: @code{32}).
  9058. @item flatness
  9059. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9060. @end table
  9061. @item va/vadeblock[|difference[|flatness]]
  9062. Accurate vertical deblocking filter
  9063. @table @option
  9064. @item difference
  9065. Difference factor where higher values mean more deblocking (default: @code{32}).
  9066. @item flatness
  9067. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9068. @end table
  9069. @end table
  9070. The horizontal and vertical deblocking filters share the difference and
  9071. flatness values so you cannot set different horizontal and vertical
  9072. thresholds.
  9073. @table @option
  9074. @item h1/x1hdeblock
  9075. Experimental horizontal deblocking filter
  9076. @item v1/x1vdeblock
  9077. Experimental vertical deblocking filter
  9078. @item dr/dering
  9079. Deringing filter
  9080. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  9081. @table @option
  9082. @item threshold1
  9083. larger -> stronger filtering
  9084. @item threshold2
  9085. larger -> stronger filtering
  9086. @item threshold3
  9087. larger -> stronger filtering
  9088. @end table
  9089. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  9090. @table @option
  9091. @item f/fullyrange
  9092. Stretch luminance to @code{0-255}.
  9093. @end table
  9094. @item lb/linblenddeint
  9095. Linear blend deinterlacing filter that deinterlaces the given block by
  9096. filtering all lines with a @code{(1 2 1)} filter.
  9097. @item li/linipoldeint
  9098. Linear interpolating deinterlacing filter that deinterlaces the given block by
  9099. linearly interpolating every second line.
  9100. @item ci/cubicipoldeint
  9101. Cubic interpolating deinterlacing filter deinterlaces the given block by
  9102. cubically interpolating every second line.
  9103. @item md/mediandeint
  9104. Median deinterlacing filter that deinterlaces the given block by applying a
  9105. median filter to every second line.
  9106. @item fd/ffmpegdeint
  9107. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  9108. second line with a @code{(-1 4 2 4 -1)} filter.
  9109. @item l5/lowpass5
  9110. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  9111. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  9112. @item fq/forceQuant[|quantizer]
  9113. Overrides the quantizer table from the input with the constant quantizer you
  9114. specify.
  9115. @table @option
  9116. @item quantizer
  9117. Quantizer to use
  9118. @end table
  9119. @item de/default
  9120. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  9121. @item fa/fast
  9122. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  9123. @item ac
  9124. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  9125. @end table
  9126. @subsection Examples
  9127. @itemize
  9128. @item
  9129. Apply horizontal and vertical deblocking, deringing and automatic
  9130. brightness/contrast:
  9131. @example
  9132. pp=hb/vb/dr/al
  9133. @end example
  9134. @item
  9135. Apply default filters without brightness/contrast correction:
  9136. @example
  9137. pp=de/-al
  9138. @end example
  9139. @item
  9140. Apply default filters and temporal denoiser:
  9141. @example
  9142. pp=default/tmpnoise|1|2|3
  9143. @end example
  9144. @item
  9145. Apply deblocking on luminance only, and switch vertical deblocking on or off
  9146. automatically depending on available CPU time:
  9147. @example
  9148. pp=hb|y/vb|a
  9149. @end example
  9150. @end itemize
  9151. @section pp7
  9152. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  9153. similar to spp = 6 with 7 point DCT, where only the center sample is
  9154. used after IDCT.
  9155. The filter accepts the following options:
  9156. @table @option
  9157. @item qp
  9158. Force a constant quantization parameter. It accepts an integer in range
  9159. 0 to 63. If not set, the filter will use the QP from the video stream
  9160. (if available).
  9161. @item mode
  9162. Set thresholding mode. Available modes are:
  9163. @table @samp
  9164. @item hard
  9165. Set hard thresholding.
  9166. @item soft
  9167. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9168. @item medium
  9169. Set medium thresholding (good results, default).
  9170. @end table
  9171. @end table
  9172. @section premultiply
  9173. Apply alpha premultiply effect to input video stream using first plane
  9174. of second stream as alpha.
  9175. Both streams must have same dimensions and same pixel format.
  9176. The filter accepts the following option:
  9177. @table @option
  9178. @item planes
  9179. Set which planes will be processed, unprocessed planes will be copied.
  9180. By default value 0xf, all planes will be processed.
  9181. @item inplace
  9182. Do not require 2nd input for processing, instead use alpha plane from input stream.
  9183. @end table
  9184. @section prewitt
  9185. Apply prewitt operator to input video stream.
  9186. The filter accepts the following option:
  9187. @table @option
  9188. @item planes
  9189. Set which planes will be processed, unprocessed planes will be copied.
  9190. By default value 0xf, all planes will be processed.
  9191. @item scale
  9192. Set value which will be multiplied with filtered result.
  9193. @item delta
  9194. Set value which will be added to filtered result.
  9195. @end table
  9196. @section pseudocolor
  9197. Alter frame colors in video with pseudocolors.
  9198. This filter accept the following options:
  9199. @table @option
  9200. @item c0
  9201. set pixel first component expression
  9202. @item c1
  9203. set pixel second component expression
  9204. @item c2
  9205. set pixel third component expression
  9206. @item c3
  9207. set pixel fourth component expression, corresponds to the alpha component
  9208. @item i
  9209. set component to use as base for altering colors
  9210. @end table
  9211. Each of them specifies the expression to use for computing the lookup table for
  9212. the corresponding pixel component values.
  9213. The expressions can contain the following constants and functions:
  9214. @table @option
  9215. @item w
  9216. @item h
  9217. The input width and height.
  9218. @item val
  9219. The input value for the pixel component.
  9220. @item ymin, umin, vmin, amin
  9221. The minimum allowed component value.
  9222. @item ymax, umax, vmax, amax
  9223. The maximum allowed component value.
  9224. @end table
  9225. All expressions default to "val".
  9226. @subsection Examples
  9227. @itemize
  9228. @item
  9229. Change too high luma values to gradient:
  9230. @example
  9231. 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'"
  9232. @end example
  9233. @end itemize
  9234. @section psnr
  9235. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  9236. Ratio) between two input videos.
  9237. This filter takes in input two input videos, the first input is
  9238. considered the "main" source and is passed unchanged to the
  9239. output. The second input is used as a "reference" video for computing
  9240. the PSNR.
  9241. Both video inputs must have the same resolution and pixel format for
  9242. this filter to work correctly. Also it assumes that both inputs
  9243. have the same number of frames, which are compared one by one.
  9244. The obtained average PSNR is printed through the logging system.
  9245. The filter stores the accumulated MSE (mean squared error) of each
  9246. frame, and at the end of the processing it is averaged across all frames
  9247. equally, and the following formula is applied to obtain the PSNR:
  9248. @example
  9249. PSNR = 10*log10(MAX^2/MSE)
  9250. @end example
  9251. Where MAX is the average of the maximum values of each component of the
  9252. image.
  9253. The description of the accepted parameters follows.
  9254. @table @option
  9255. @item stats_file, f
  9256. If specified the filter will use the named file to save the PSNR of
  9257. each individual frame. When filename equals "-" the data is sent to
  9258. standard output.
  9259. @item stats_version
  9260. Specifies which version of the stats file format to use. Details of
  9261. each format are written below.
  9262. Default value is 1.
  9263. @item stats_add_max
  9264. Determines whether the max value is output to the stats log.
  9265. Default value is 0.
  9266. Requires stats_version >= 2. If this is set and stats_version < 2,
  9267. the filter will return an error.
  9268. @end table
  9269. This filter also supports the @ref{framesync} options.
  9270. The file printed if @var{stats_file} is selected, contains a sequence of
  9271. key/value pairs of the form @var{key}:@var{value} for each compared
  9272. couple of frames.
  9273. If a @var{stats_version} greater than 1 is specified, a header line precedes
  9274. the list of per-frame-pair stats, with key value pairs following the frame
  9275. format with the following parameters:
  9276. @table @option
  9277. @item psnr_log_version
  9278. The version of the log file format. Will match @var{stats_version}.
  9279. @item fields
  9280. A comma separated list of the per-frame-pair parameters included in
  9281. the log.
  9282. @end table
  9283. A description of each shown per-frame-pair parameter follows:
  9284. @table @option
  9285. @item n
  9286. sequential number of the input frame, starting from 1
  9287. @item mse_avg
  9288. Mean Square Error pixel-by-pixel average difference of the compared
  9289. frames, averaged over all the image components.
  9290. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  9291. Mean Square Error pixel-by-pixel average difference of the compared
  9292. frames for the component specified by the suffix.
  9293. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  9294. Peak Signal to Noise ratio of the compared frames for the component
  9295. specified by the suffix.
  9296. @item max_avg, max_y, max_u, max_v
  9297. Maximum allowed value for each channel, and average over all
  9298. channels.
  9299. @end table
  9300. For example:
  9301. @example
  9302. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9303. [main][ref] psnr="stats_file=stats.log" [out]
  9304. @end example
  9305. On this example the input file being processed is compared with the
  9306. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  9307. is stored in @file{stats.log}.
  9308. @anchor{pullup}
  9309. @section pullup
  9310. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  9311. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  9312. content.
  9313. The pullup filter is designed to take advantage of future context in making
  9314. its decisions. This filter is stateless in the sense that it does not lock
  9315. onto a pattern to follow, but it instead looks forward to the following
  9316. fields in order to identify matches and rebuild progressive frames.
  9317. To produce content with an even framerate, insert the fps filter after
  9318. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  9319. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  9320. The filter accepts the following options:
  9321. @table @option
  9322. @item jl
  9323. @item jr
  9324. @item jt
  9325. @item jb
  9326. These options set the amount of "junk" to ignore at the left, right, top, and
  9327. bottom of the image, respectively. Left and right are in units of 8 pixels,
  9328. while top and bottom are in units of 2 lines.
  9329. The default is 8 pixels on each side.
  9330. @item sb
  9331. Set the strict breaks. Setting this option to 1 will reduce the chances of
  9332. filter generating an occasional mismatched frame, but it may also cause an
  9333. excessive number of frames to be dropped during high motion sequences.
  9334. Conversely, setting it to -1 will make filter match fields more easily.
  9335. This may help processing of video where there is slight blurring between
  9336. the fields, but may also cause there to be interlaced frames in the output.
  9337. Default value is @code{0}.
  9338. @item mp
  9339. Set the metric plane to use. It accepts the following values:
  9340. @table @samp
  9341. @item l
  9342. Use luma plane.
  9343. @item u
  9344. Use chroma blue plane.
  9345. @item v
  9346. Use chroma red plane.
  9347. @end table
  9348. This option may be set to use chroma plane instead of the default luma plane
  9349. for doing filter's computations. This may improve accuracy on very clean
  9350. source material, but more likely will decrease accuracy, especially if there
  9351. is chroma noise (rainbow effect) or any grayscale video.
  9352. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  9353. load and make pullup usable in realtime on slow machines.
  9354. @end table
  9355. For best results (without duplicated frames in the output file) it is
  9356. necessary to change the output frame rate. For example, to inverse
  9357. telecine NTSC input:
  9358. @example
  9359. ffmpeg -i input -vf pullup -r 24000/1001 ...
  9360. @end example
  9361. @section qp
  9362. Change video quantization parameters (QP).
  9363. The filter accepts the following option:
  9364. @table @option
  9365. @item qp
  9366. Set expression for quantization parameter.
  9367. @end table
  9368. The expression is evaluated through the eval API and can contain, among others,
  9369. the following constants:
  9370. @table @var
  9371. @item known
  9372. 1 if index is not 129, 0 otherwise.
  9373. @item qp
  9374. Sequential index starting from -129 to 128.
  9375. @end table
  9376. @subsection Examples
  9377. @itemize
  9378. @item
  9379. Some equation like:
  9380. @example
  9381. qp=2+2*sin(PI*qp)
  9382. @end example
  9383. @end itemize
  9384. @section random
  9385. Flush video frames from internal cache of frames into a random order.
  9386. No frame is discarded.
  9387. Inspired by @ref{frei0r} nervous filter.
  9388. @table @option
  9389. @item frames
  9390. Set size in number of frames of internal cache, in range from @code{2} to
  9391. @code{512}. Default is @code{30}.
  9392. @item seed
  9393. Set seed for random number generator, must be an integer included between
  9394. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  9395. less than @code{0}, the filter will try to use a good random seed on a
  9396. best effort basis.
  9397. @end table
  9398. @section readeia608
  9399. Read closed captioning (EIA-608) information from the top lines of a video frame.
  9400. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  9401. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  9402. with EIA-608 data (starting from 0). A description of each metadata value follows:
  9403. @table @option
  9404. @item lavfi.readeia608.X.cc
  9405. The two bytes stored as EIA-608 data (printed in hexadecimal).
  9406. @item lavfi.readeia608.X.line
  9407. The number of the line on which the EIA-608 data was identified and read.
  9408. @end table
  9409. This filter accepts the following options:
  9410. @table @option
  9411. @item scan_min
  9412. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  9413. @item scan_max
  9414. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  9415. @item mac
  9416. Set minimal acceptable amplitude change for sync codes detection.
  9417. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  9418. @item spw
  9419. Set the ratio of width reserved for sync code detection.
  9420. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  9421. @item mhd
  9422. Set the max peaks height difference for sync code detection.
  9423. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9424. @item mpd
  9425. Set max peaks period difference for sync code detection.
  9426. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9427. @item msd
  9428. Set the first two max start code bits differences.
  9429. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  9430. @item bhd
  9431. Set the minimum ratio of bits height compared to 3rd start code bit.
  9432. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  9433. @item th_w
  9434. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  9435. @item th_b
  9436. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  9437. @item chp
  9438. Enable checking the parity bit. In the event of a parity error, the filter will output
  9439. @code{0x00} for that character. Default is false.
  9440. @end table
  9441. @subsection Examples
  9442. @itemize
  9443. @item
  9444. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  9445. @example
  9446. 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
  9447. @end example
  9448. @end itemize
  9449. @section readvitc
  9450. Read vertical interval timecode (VITC) information from the top lines of a
  9451. video frame.
  9452. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  9453. timecode value, if a valid timecode has been detected. Further metadata key
  9454. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  9455. timecode data has been found or not.
  9456. This filter accepts the following options:
  9457. @table @option
  9458. @item scan_max
  9459. Set the maximum number of lines to scan for VITC data. If the value is set to
  9460. @code{-1} the full video frame is scanned. Default is @code{45}.
  9461. @item thr_b
  9462. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  9463. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  9464. @item thr_w
  9465. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  9466. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  9467. @end table
  9468. @subsection Examples
  9469. @itemize
  9470. @item
  9471. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  9472. draw @code{--:--:--:--} as a placeholder:
  9473. @example
  9474. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  9475. @end example
  9476. @end itemize
  9477. @section remap
  9478. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  9479. Destination pixel at position (X, Y) will be picked from source (x, y) position
  9480. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  9481. value for pixel will be used for destination pixel.
  9482. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  9483. will have Xmap/Ymap video stream dimensions.
  9484. Xmap and Ymap input video streams are 16bit depth, single channel.
  9485. @section removegrain
  9486. The removegrain filter is a spatial denoiser for progressive video.
  9487. @table @option
  9488. @item m0
  9489. Set mode for the first plane.
  9490. @item m1
  9491. Set mode for the second plane.
  9492. @item m2
  9493. Set mode for the third plane.
  9494. @item m3
  9495. Set mode for the fourth plane.
  9496. @end table
  9497. Range of mode is from 0 to 24. Description of each mode follows:
  9498. @table @var
  9499. @item 0
  9500. Leave input plane unchanged. Default.
  9501. @item 1
  9502. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  9503. @item 2
  9504. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  9505. @item 3
  9506. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  9507. @item 4
  9508. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  9509. This is equivalent to a median filter.
  9510. @item 5
  9511. Line-sensitive clipping giving the minimal change.
  9512. @item 6
  9513. Line-sensitive clipping, intermediate.
  9514. @item 7
  9515. Line-sensitive clipping, intermediate.
  9516. @item 8
  9517. Line-sensitive clipping, intermediate.
  9518. @item 9
  9519. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  9520. @item 10
  9521. Replaces the target pixel with the closest neighbour.
  9522. @item 11
  9523. [1 2 1] horizontal and vertical kernel blur.
  9524. @item 12
  9525. Same as mode 11.
  9526. @item 13
  9527. Bob mode, interpolates top field from the line where the neighbours
  9528. pixels are the closest.
  9529. @item 14
  9530. Bob mode, interpolates bottom field from the line where the neighbours
  9531. pixels are the closest.
  9532. @item 15
  9533. Bob mode, interpolates top field. Same as 13 but with a more complicated
  9534. interpolation formula.
  9535. @item 16
  9536. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  9537. interpolation formula.
  9538. @item 17
  9539. Clips the pixel with the minimum and maximum of respectively the maximum and
  9540. minimum of each pair of opposite neighbour pixels.
  9541. @item 18
  9542. Line-sensitive clipping using opposite neighbours whose greatest distance from
  9543. the current pixel is minimal.
  9544. @item 19
  9545. Replaces the pixel with the average of its 8 neighbours.
  9546. @item 20
  9547. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  9548. @item 21
  9549. Clips pixels using the averages of opposite neighbour.
  9550. @item 22
  9551. Same as mode 21 but simpler and faster.
  9552. @item 23
  9553. Small edge and halo removal, but reputed useless.
  9554. @item 24
  9555. Similar as 23.
  9556. @end table
  9557. @section removelogo
  9558. Suppress a TV station logo, using an image file to determine which
  9559. pixels comprise the logo. It works by filling in the pixels that
  9560. comprise the logo with neighboring pixels.
  9561. The filter accepts the following options:
  9562. @table @option
  9563. @item filename, f
  9564. Set the filter bitmap file, which can be any image format supported by
  9565. libavformat. The width and height of the image file must match those of the
  9566. video stream being processed.
  9567. @end table
  9568. Pixels in the provided bitmap image with a value of zero are not
  9569. considered part of the logo, non-zero pixels are considered part of
  9570. the logo. If you use white (255) for the logo and black (0) for the
  9571. rest, you will be safe. For making the filter bitmap, it is
  9572. recommended to take a screen capture of a black frame with the logo
  9573. visible, and then using a threshold filter followed by the erode
  9574. filter once or twice.
  9575. If needed, little splotches can be fixed manually. Remember that if
  9576. logo pixels are not covered, the filter quality will be much
  9577. reduced. Marking too many pixels as part of the logo does not hurt as
  9578. much, but it will increase the amount of blurring needed to cover over
  9579. the image and will destroy more information than necessary, and extra
  9580. pixels will slow things down on a large logo.
  9581. @section repeatfields
  9582. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  9583. fields based on its value.
  9584. @section reverse
  9585. Reverse a video clip.
  9586. Warning: This filter requires memory to buffer the entire clip, so trimming
  9587. is suggested.
  9588. @subsection Examples
  9589. @itemize
  9590. @item
  9591. Take the first 5 seconds of a clip, and reverse it.
  9592. @example
  9593. trim=end=5,reverse
  9594. @end example
  9595. @end itemize
  9596. @section roberts
  9597. Apply roberts cross operator to input video stream.
  9598. The filter accepts the following option:
  9599. @table @option
  9600. @item planes
  9601. Set which planes will be processed, unprocessed planes will be copied.
  9602. By default value 0xf, all planes will be processed.
  9603. @item scale
  9604. Set value which will be multiplied with filtered result.
  9605. @item delta
  9606. Set value which will be added to filtered result.
  9607. @end table
  9608. @section rotate
  9609. Rotate video by an arbitrary angle expressed in radians.
  9610. The filter accepts the following options:
  9611. A description of the optional parameters follows.
  9612. @table @option
  9613. @item angle, a
  9614. Set an expression for the angle by which to rotate the input video
  9615. clockwise, expressed as a number of radians. A negative value will
  9616. result in a counter-clockwise rotation. By default it is set to "0".
  9617. This expression is evaluated for each frame.
  9618. @item out_w, ow
  9619. Set the output width expression, default value is "iw".
  9620. This expression is evaluated just once during configuration.
  9621. @item out_h, oh
  9622. Set the output height expression, default value is "ih".
  9623. This expression is evaluated just once during configuration.
  9624. @item bilinear
  9625. Enable bilinear interpolation if set to 1, a value of 0 disables
  9626. it. Default value is 1.
  9627. @item fillcolor, c
  9628. Set the color used to fill the output area not covered by the rotated
  9629. image. For the general syntax of this option, check the "Color" section in the
  9630. ffmpeg-utils manual. If the special value "none" is selected then no
  9631. background is printed (useful for example if the background is never shown).
  9632. Default value is "black".
  9633. @end table
  9634. The expressions for the angle and the output size can contain the
  9635. following constants and functions:
  9636. @table @option
  9637. @item n
  9638. sequential number of the input frame, starting from 0. It is always NAN
  9639. before the first frame is filtered.
  9640. @item t
  9641. time in seconds of the input frame, it is set to 0 when the filter is
  9642. configured. It is always NAN before the first frame is filtered.
  9643. @item hsub
  9644. @item vsub
  9645. horizontal and vertical chroma subsample values. For example for the
  9646. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9647. @item in_w, iw
  9648. @item in_h, ih
  9649. the input video width and height
  9650. @item out_w, ow
  9651. @item out_h, oh
  9652. the output width and height, that is the size of the padded area as
  9653. specified by the @var{width} and @var{height} expressions
  9654. @item rotw(a)
  9655. @item roth(a)
  9656. the minimal width/height required for completely containing the input
  9657. video rotated by @var{a} radians.
  9658. These are only available when computing the @option{out_w} and
  9659. @option{out_h} expressions.
  9660. @end table
  9661. @subsection Examples
  9662. @itemize
  9663. @item
  9664. Rotate the input by PI/6 radians clockwise:
  9665. @example
  9666. rotate=PI/6
  9667. @end example
  9668. @item
  9669. Rotate the input by PI/6 radians counter-clockwise:
  9670. @example
  9671. rotate=-PI/6
  9672. @end example
  9673. @item
  9674. Rotate the input by 45 degrees clockwise:
  9675. @example
  9676. rotate=45*PI/180
  9677. @end example
  9678. @item
  9679. Apply a constant rotation with period T, starting from an angle of PI/3:
  9680. @example
  9681. rotate=PI/3+2*PI*t/T
  9682. @end example
  9683. @item
  9684. Make the input video rotation oscillating with a period of T
  9685. seconds and an amplitude of A radians:
  9686. @example
  9687. rotate=A*sin(2*PI/T*t)
  9688. @end example
  9689. @item
  9690. Rotate the video, output size is chosen so that the whole rotating
  9691. input video is always completely contained in the output:
  9692. @example
  9693. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  9694. @end example
  9695. @item
  9696. Rotate the video, reduce the output size so that no background is ever
  9697. shown:
  9698. @example
  9699. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  9700. @end example
  9701. @end itemize
  9702. @subsection Commands
  9703. The filter supports the following commands:
  9704. @table @option
  9705. @item a, angle
  9706. Set the angle expression.
  9707. The command accepts the same syntax of the corresponding option.
  9708. If the specified expression is not valid, it is kept at its current
  9709. value.
  9710. @end table
  9711. @section sab
  9712. Apply Shape Adaptive Blur.
  9713. The filter accepts the following options:
  9714. @table @option
  9715. @item luma_radius, lr
  9716. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  9717. value is 1.0. A greater value will result in a more blurred image, and
  9718. in slower processing.
  9719. @item luma_pre_filter_radius, lpfr
  9720. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  9721. value is 1.0.
  9722. @item luma_strength, ls
  9723. Set luma maximum difference between pixels to still be considered, must
  9724. be a value in the 0.1-100.0 range, default value is 1.0.
  9725. @item chroma_radius, cr
  9726. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  9727. greater value will result in a more blurred image, and in slower
  9728. processing.
  9729. @item chroma_pre_filter_radius, cpfr
  9730. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  9731. @item chroma_strength, cs
  9732. Set chroma maximum difference between pixels to still be considered,
  9733. must be a value in the -0.9-100.0 range.
  9734. @end table
  9735. Each chroma option value, if not explicitly specified, is set to the
  9736. corresponding luma option value.
  9737. @anchor{scale}
  9738. @section scale
  9739. Scale (resize) the input video, using the libswscale library.
  9740. The scale filter forces the output display aspect ratio to be the same
  9741. of the input, by changing the output sample aspect ratio.
  9742. If the input image format is different from the format requested by
  9743. the next filter, the scale filter will convert the input to the
  9744. requested format.
  9745. @subsection Options
  9746. The filter accepts the following options, or any of the options
  9747. supported by the libswscale scaler.
  9748. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  9749. the complete list of scaler options.
  9750. @table @option
  9751. @item width, w
  9752. @item height, h
  9753. Set the output video dimension expression. Default value is the input
  9754. dimension.
  9755. If the @var{width} or @var{w} value is 0, the input width is used for
  9756. the output. If the @var{height} or @var{h} value is 0, the input height
  9757. is used for the output.
  9758. If one and only one of the values is -n with n >= 1, the scale filter
  9759. will use a value that maintains the aspect ratio of the input image,
  9760. calculated from the other specified dimension. After that it will,
  9761. however, make sure that the calculated dimension is divisible by n and
  9762. adjust the value if necessary.
  9763. If both values are -n with n >= 1, the behavior will be identical to
  9764. both values being set to 0 as previously detailed.
  9765. See below for the list of accepted constants for use in the dimension
  9766. expression.
  9767. @item eval
  9768. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  9769. @table @samp
  9770. @item init
  9771. Only evaluate expressions once during the filter initialization or when a command is processed.
  9772. @item frame
  9773. Evaluate expressions for each incoming frame.
  9774. @end table
  9775. Default value is @samp{init}.
  9776. @item interl
  9777. Set the interlacing mode. It accepts the following values:
  9778. @table @samp
  9779. @item 1
  9780. Force interlaced aware scaling.
  9781. @item 0
  9782. Do not apply interlaced scaling.
  9783. @item -1
  9784. Select interlaced aware scaling depending on whether the source frames
  9785. are flagged as interlaced or not.
  9786. @end table
  9787. Default value is @samp{0}.
  9788. @item flags
  9789. Set libswscale scaling flags. See
  9790. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9791. complete list of values. If not explicitly specified the filter applies
  9792. the default flags.
  9793. @item param0, param1
  9794. Set libswscale input parameters for scaling algorithms that need them. See
  9795. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9796. complete documentation. If not explicitly specified the filter applies
  9797. empty parameters.
  9798. @item size, s
  9799. Set the video size. For the syntax of this option, check the
  9800. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9801. @item in_color_matrix
  9802. @item out_color_matrix
  9803. Set in/output YCbCr color space type.
  9804. This allows the autodetected value to be overridden as well as allows forcing
  9805. a specific value used for the output and encoder.
  9806. If not specified, the color space type depends on the pixel format.
  9807. Possible values:
  9808. @table @samp
  9809. @item auto
  9810. Choose automatically.
  9811. @item bt709
  9812. Format conforming to International Telecommunication Union (ITU)
  9813. Recommendation BT.709.
  9814. @item fcc
  9815. Set color space conforming to the United States Federal Communications
  9816. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  9817. @item bt601
  9818. Set color space conforming to:
  9819. @itemize
  9820. @item
  9821. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  9822. @item
  9823. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  9824. @item
  9825. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  9826. @end itemize
  9827. @item smpte240m
  9828. Set color space conforming to SMPTE ST 240:1999.
  9829. @end table
  9830. @item in_range
  9831. @item out_range
  9832. Set in/output YCbCr sample range.
  9833. This allows the autodetected value to be overridden as well as allows forcing
  9834. a specific value used for the output and encoder. If not specified, the
  9835. range depends on the pixel format. Possible values:
  9836. @table @samp
  9837. @item auto
  9838. Choose automatically.
  9839. @item jpeg/full/pc
  9840. Set full range (0-255 in case of 8-bit luma).
  9841. @item mpeg/tv
  9842. Set "MPEG" range (16-235 in case of 8-bit luma).
  9843. @end table
  9844. @item force_original_aspect_ratio
  9845. Enable decreasing or increasing output video width or height if necessary to
  9846. keep the original aspect ratio. Possible values:
  9847. @table @samp
  9848. @item disable
  9849. Scale the video as specified and disable this feature.
  9850. @item decrease
  9851. The output video dimensions will automatically be decreased if needed.
  9852. @item increase
  9853. The output video dimensions will automatically be increased if needed.
  9854. @end table
  9855. One useful instance of this option is that when you know a specific device's
  9856. maximum allowed resolution, you can use this to limit the output video to
  9857. that, while retaining the aspect ratio. For example, device A allows
  9858. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  9859. decrease) and specifying 1280x720 to the command line makes the output
  9860. 1280x533.
  9861. Please note that this is a different thing than specifying -1 for @option{w}
  9862. or @option{h}, you still need to specify the output resolution for this option
  9863. to work.
  9864. @end table
  9865. The values of the @option{w} and @option{h} options are expressions
  9866. containing the following constants:
  9867. @table @var
  9868. @item in_w
  9869. @item in_h
  9870. The input width and height
  9871. @item iw
  9872. @item ih
  9873. These are the same as @var{in_w} and @var{in_h}.
  9874. @item out_w
  9875. @item out_h
  9876. The output (scaled) width and height
  9877. @item ow
  9878. @item oh
  9879. These are the same as @var{out_w} and @var{out_h}
  9880. @item a
  9881. The same as @var{iw} / @var{ih}
  9882. @item sar
  9883. input sample aspect ratio
  9884. @item dar
  9885. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  9886. @item hsub
  9887. @item vsub
  9888. horizontal and vertical input chroma subsample values. For example for the
  9889. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9890. @item ohsub
  9891. @item ovsub
  9892. horizontal and vertical output chroma subsample values. For example for the
  9893. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9894. @end table
  9895. @subsection Examples
  9896. @itemize
  9897. @item
  9898. Scale the input video to a size of 200x100
  9899. @example
  9900. scale=w=200:h=100
  9901. @end example
  9902. This is equivalent to:
  9903. @example
  9904. scale=200:100
  9905. @end example
  9906. or:
  9907. @example
  9908. scale=200x100
  9909. @end example
  9910. @item
  9911. Specify a size abbreviation for the output size:
  9912. @example
  9913. scale=qcif
  9914. @end example
  9915. which can also be written as:
  9916. @example
  9917. scale=size=qcif
  9918. @end example
  9919. @item
  9920. Scale the input to 2x:
  9921. @example
  9922. scale=w=2*iw:h=2*ih
  9923. @end example
  9924. @item
  9925. The above is the same as:
  9926. @example
  9927. scale=2*in_w:2*in_h
  9928. @end example
  9929. @item
  9930. Scale the input to 2x with forced interlaced scaling:
  9931. @example
  9932. scale=2*iw:2*ih:interl=1
  9933. @end example
  9934. @item
  9935. Scale the input to half size:
  9936. @example
  9937. scale=w=iw/2:h=ih/2
  9938. @end example
  9939. @item
  9940. Increase the width, and set the height to the same size:
  9941. @example
  9942. scale=3/2*iw:ow
  9943. @end example
  9944. @item
  9945. Seek Greek harmony:
  9946. @example
  9947. scale=iw:1/PHI*iw
  9948. scale=ih*PHI:ih
  9949. @end example
  9950. @item
  9951. Increase the height, and set the width to 3/2 of the height:
  9952. @example
  9953. scale=w=3/2*oh:h=3/5*ih
  9954. @end example
  9955. @item
  9956. Increase the size, making the size a multiple of the chroma
  9957. subsample values:
  9958. @example
  9959. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  9960. @end example
  9961. @item
  9962. Increase the width to a maximum of 500 pixels,
  9963. keeping the same aspect ratio as the input:
  9964. @example
  9965. scale=w='min(500\, iw*3/2):h=-1'
  9966. @end example
  9967. @end itemize
  9968. @subsection Commands
  9969. This filter supports the following commands:
  9970. @table @option
  9971. @item width, w
  9972. @item height, h
  9973. Set the output video dimension expression.
  9974. The command accepts the same syntax of the corresponding option.
  9975. If the specified expression is not valid, it is kept at its current
  9976. value.
  9977. @end table
  9978. @section scale_npp
  9979. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  9980. format conversion on CUDA video frames. Setting the output width and height
  9981. works in the same way as for the @var{scale} filter.
  9982. The following additional options are accepted:
  9983. @table @option
  9984. @item format
  9985. The pixel format of the output CUDA frames. If set to the string "same" (the
  9986. default), the input format will be kept. Note that automatic format negotiation
  9987. and conversion is not yet supported for hardware frames
  9988. @item interp_algo
  9989. The interpolation algorithm used for resizing. One of the following:
  9990. @table @option
  9991. @item nn
  9992. Nearest neighbour.
  9993. @item linear
  9994. @item cubic
  9995. @item cubic2p_bspline
  9996. 2-parameter cubic (B=1, C=0)
  9997. @item cubic2p_catmullrom
  9998. 2-parameter cubic (B=0, C=1/2)
  9999. @item cubic2p_b05c03
  10000. 2-parameter cubic (B=1/2, C=3/10)
  10001. @item super
  10002. Supersampling
  10003. @item lanczos
  10004. @end table
  10005. @end table
  10006. @section scale2ref
  10007. Scale (resize) the input video, based on a reference video.
  10008. See the scale filter for available options, scale2ref supports the same but
  10009. uses the reference video instead of the main input as basis. scale2ref also
  10010. supports the following additional constants for the @option{w} and
  10011. @option{h} options:
  10012. @table @var
  10013. @item main_w
  10014. @item main_h
  10015. The main input video's width and height
  10016. @item main_a
  10017. The same as @var{main_w} / @var{main_h}
  10018. @item main_sar
  10019. The main input video's sample aspect ratio
  10020. @item main_dar, mdar
  10021. The main input video's display aspect ratio. Calculated from
  10022. @code{(main_w / main_h) * main_sar}.
  10023. @item main_hsub
  10024. @item main_vsub
  10025. The main input video's horizontal and vertical chroma subsample values.
  10026. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  10027. is 1.
  10028. @end table
  10029. @subsection Examples
  10030. @itemize
  10031. @item
  10032. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  10033. @example
  10034. 'scale2ref[b][a];[a][b]overlay'
  10035. @end example
  10036. @end itemize
  10037. @anchor{selectivecolor}
  10038. @section selectivecolor
  10039. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  10040. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  10041. by the "purity" of the color (that is, how saturated it already is).
  10042. This filter is similar to the Adobe Photoshop Selective Color tool.
  10043. The filter accepts the following options:
  10044. @table @option
  10045. @item correction_method
  10046. Select color correction method.
  10047. Available values are:
  10048. @table @samp
  10049. @item absolute
  10050. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  10051. component value).
  10052. @item relative
  10053. Specified adjustments are relative to the original component value.
  10054. @end table
  10055. Default is @code{absolute}.
  10056. @item reds
  10057. Adjustments for red pixels (pixels where the red component is the maximum)
  10058. @item yellows
  10059. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  10060. @item greens
  10061. Adjustments for green pixels (pixels where the green component is the maximum)
  10062. @item cyans
  10063. Adjustments for cyan pixels (pixels where the red component is the minimum)
  10064. @item blues
  10065. Adjustments for blue pixels (pixels where the blue component is the maximum)
  10066. @item magentas
  10067. Adjustments for magenta pixels (pixels where the green component is the minimum)
  10068. @item whites
  10069. Adjustments for white pixels (pixels where all components are greater than 128)
  10070. @item neutrals
  10071. Adjustments for all pixels except pure black and pure white
  10072. @item blacks
  10073. Adjustments for black pixels (pixels where all components are lesser than 128)
  10074. @item psfile
  10075. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  10076. @end table
  10077. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  10078. 4 space separated floating point adjustment values in the [-1,1] range,
  10079. respectively to adjust the amount of cyan, magenta, yellow and black for the
  10080. pixels of its range.
  10081. @subsection Examples
  10082. @itemize
  10083. @item
  10084. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  10085. increase magenta by 27% in blue areas:
  10086. @example
  10087. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  10088. @end example
  10089. @item
  10090. Use a Photoshop selective color preset:
  10091. @example
  10092. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  10093. @end example
  10094. @end itemize
  10095. @anchor{separatefields}
  10096. @section separatefields
  10097. The @code{separatefields} takes a frame-based video input and splits
  10098. each frame into its components fields, producing a new half height clip
  10099. with twice the frame rate and twice the frame count.
  10100. This filter use field-dominance information in frame to decide which
  10101. of each pair of fields to place first in the output.
  10102. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  10103. @section setdar, setsar
  10104. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  10105. output video.
  10106. This is done by changing the specified Sample (aka Pixel) Aspect
  10107. Ratio, according to the following equation:
  10108. @example
  10109. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  10110. @end example
  10111. Keep in mind that the @code{setdar} filter does not modify the pixel
  10112. dimensions of the video frame. Also, the display aspect ratio set by
  10113. this filter may be changed by later filters in the filterchain,
  10114. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  10115. applied.
  10116. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  10117. the filter output video.
  10118. Note that as a consequence of the application of this filter, the
  10119. output display aspect ratio will change according to the equation
  10120. above.
  10121. Keep in mind that the sample aspect ratio set by the @code{setsar}
  10122. filter may be changed by later filters in the filterchain, e.g. if
  10123. another "setsar" or a "setdar" filter is applied.
  10124. It accepts the following parameters:
  10125. @table @option
  10126. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  10127. Set the aspect ratio used by the filter.
  10128. The parameter can be a floating point number string, an expression, or
  10129. a string of the form @var{num}:@var{den}, where @var{num} and
  10130. @var{den} are the numerator and denominator of the aspect ratio. If
  10131. the parameter is not specified, it is assumed the value "0".
  10132. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  10133. should be escaped.
  10134. @item max
  10135. Set the maximum integer value to use for expressing numerator and
  10136. denominator when reducing the expressed aspect ratio to a rational.
  10137. Default value is @code{100}.
  10138. @end table
  10139. The parameter @var{sar} is an expression containing
  10140. the following constants:
  10141. @table @option
  10142. @item E, PI, PHI
  10143. These are approximated values for the mathematical constants e
  10144. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  10145. @item w, h
  10146. The input width and height.
  10147. @item a
  10148. These are the same as @var{w} / @var{h}.
  10149. @item sar
  10150. The input sample aspect ratio.
  10151. @item dar
  10152. The input display aspect ratio. It is the same as
  10153. (@var{w} / @var{h}) * @var{sar}.
  10154. @item hsub, vsub
  10155. Horizontal and vertical chroma subsample values. For example, for the
  10156. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10157. @end table
  10158. @subsection Examples
  10159. @itemize
  10160. @item
  10161. To change the display aspect ratio to 16:9, specify one of the following:
  10162. @example
  10163. setdar=dar=1.77777
  10164. setdar=dar=16/9
  10165. @end example
  10166. @item
  10167. To change the sample aspect ratio to 10:11, specify:
  10168. @example
  10169. setsar=sar=10/11
  10170. @end example
  10171. @item
  10172. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  10173. 1000 in the aspect ratio reduction, use the command:
  10174. @example
  10175. setdar=ratio=16/9:max=1000
  10176. @end example
  10177. @end itemize
  10178. @anchor{setfield}
  10179. @section setfield
  10180. Force field for the output video frame.
  10181. The @code{setfield} filter marks the interlace type field for the
  10182. output frames. It does not change the input frame, but only sets the
  10183. corresponding property, which affects how the frame is treated by
  10184. following filters (e.g. @code{fieldorder} or @code{yadif}).
  10185. The filter accepts the following options:
  10186. @table @option
  10187. @item mode
  10188. Available values are:
  10189. @table @samp
  10190. @item auto
  10191. Keep the same field property.
  10192. @item bff
  10193. Mark the frame as bottom-field-first.
  10194. @item tff
  10195. Mark the frame as top-field-first.
  10196. @item prog
  10197. Mark the frame as progressive.
  10198. @end table
  10199. @end table
  10200. @section showinfo
  10201. Show a line containing various information for each input video frame.
  10202. The input video is not modified.
  10203. The shown line contains a sequence of key/value pairs of the form
  10204. @var{key}:@var{value}.
  10205. The following values are shown in the output:
  10206. @table @option
  10207. @item n
  10208. The (sequential) number of the input frame, starting from 0.
  10209. @item pts
  10210. The Presentation TimeStamp of the input frame, expressed as a number of
  10211. time base units. The time base unit depends on the filter input pad.
  10212. @item pts_time
  10213. The Presentation TimeStamp of the input frame, expressed as a number of
  10214. seconds.
  10215. @item pos
  10216. The position of the frame in the input stream, or -1 if this information is
  10217. unavailable and/or meaningless (for example in case of synthetic video).
  10218. @item fmt
  10219. The pixel format name.
  10220. @item sar
  10221. The sample aspect ratio of the input frame, expressed in the form
  10222. @var{num}/@var{den}.
  10223. @item s
  10224. The size of the input frame. For the syntax of this option, check the
  10225. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10226. @item i
  10227. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  10228. for bottom field first).
  10229. @item iskey
  10230. This is 1 if the frame is a key frame, 0 otherwise.
  10231. @item type
  10232. The picture type of the input frame ("I" for an I-frame, "P" for a
  10233. P-frame, "B" for a B-frame, or "?" for an unknown type).
  10234. Also refer to the documentation of the @code{AVPictureType} enum and of
  10235. the @code{av_get_picture_type_char} function defined in
  10236. @file{libavutil/avutil.h}.
  10237. @item checksum
  10238. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  10239. @item plane_checksum
  10240. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  10241. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  10242. @end table
  10243. @section showpalette
  10244. Displays the 256 colors palette of each frame. This filter is only relevant for
  10245. @var{pal8} pixel format frames.
  10246. It accepts the following option:
  10247. @table @option
  10248. @item s
  10249. Set the size of the box used to represent one palette color entry. Default is
  10250. @code{30} (for a @code{30x30} pixel box).
  10251. @end table
  10252. @section shuffleframes
  10253. Reorder and/or duplicate and/or drop video frames.
  10254. It accepts the following parameters:
  10255. @table @option
  10256. @item mapping
  10257. Set the destination indexes of input frames.
  10258. This is space or '|' separated list of indexes that maps input frames to output
  10259. frames. Number of indexes also sets maximal value that each index may have.
  10260. '-1' index have special meaning and that is to drop frame.
  10261. @end table
  10262. The first frame has the index 0. The default is to keep the input unchanged.
  10263. @subsection Examples
  10264. @itemize
  10265. @item
  10266. Swap second and third frame of every three frames of the input:
  10267. @example
  10268. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  10269. @end example
  10270. @item
  10271. Swap 10th and 1st frame of every ten frames of the input:
  10272. @example
  10273. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  10274. @end example
  10275. @end itemize
  10276. @section shuffleplanes
  10277. Reorder and/or duplicate video planes.
  10278. It accepts the following parameters:
  10279. @table @option
  10280. @item map0
  10281. The index of the input plane to be used as the first output plane.
  10282. @item map1
  10283. The index of the input plane to be used as the second output plane.
  10284. @item map2
  10285. The index of the input plane to be used as the third output plane.
  10286. @item map3
  10287. The index of the input plane to be used as the fourth output plane.
  10288. @end table
  10289. The first plane has the index 0. The default is to keep the input unchanged.
  10290. @subsection Examples
  10291. @itemize
  10292. @item
  10293. Swap the second and third planes of the input:
  10294. @example
  10295. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  10296. @end example
  10297. @end itemize
  10298. @anchor{signalstats}
  10299. @section signalstats
  10300. Evaluate various visual metrics that assist in determining issues associated
  10301. with the digitization of analog video media.
  10302. By default the filter will log these metadata values:
  10303. @table @option
  10304. @item YMIN
  10305. Display the minimal Y value contained within the input frame. Expressed in
  10306. range of [0-255].
  10307. @item YLOW
  10308. Display the Y value at the 10% percentile within the input frame. Expressed in
  10309. range of [0-255].
  10310. @item YAVG
  10311. Display the average Y value within the input frame. Expressed in range of
  10312. [0-255].
  10313. @item YHIGH
  10314. Display the Y value at the 90% percentile within the input frame. Expressed in
  10315. range of [0-255].
  10316. @item YMAX
  10317. Display the maximum Y value contained within the input frame. Expressed in
  10318. range of [0-255].
  10319. @item UMIN
  10320. Display the minimal U value contained within the input frame. Expressed in
  10321. range of [0-255].
  10322. @item ULOW
  10323. Display the U value at the 10% percentile within the input frame. Expressed in
  10324. range of [0-255].
  10325. @item UAVG
  10326. Display the average U value within the input frame. Expressed in range of
  10327. [0-255].
  10328. @item UHIGH
  10329. Display the U value at the 90% percentile within the input frame. Expressed in
  10330. range of [0-255].
  10331. @item UMAX
  10332. Display the maximum U value contained within the input frame. Expressed in
  10333. range of [0-255].
  10334. @item VMIN
  10335. Display the minimal V value contained within the input frame. Expressed in
  10336. range of [0-255].
  10337. @item VLOW
  10338. Display the V value at the 10% percentile within the input frame. Expressed in
  10339. range of [0-255].
  10340. @item VAVG
  10341. Display the average V value within the input frame. Expressed in range of
  10342. [0-255].
  10343. @item VHIGH
  10344. Display the V value at the 90% percentile within the input frame. Expressed in
  10345. range of [0-255].
  10346. @item VMAX
  10347. Display the maximum V value contained within the input frame. Expressed in
  10348. range of [0-255].
  10349. @item SATMIN
  10350. Display the minimal saturation value contained within the input frame.
  10351. Expressed in range of [0-~181.02].
  10352. @item SATLOW
  10353. Display the saturation value at the 10% percentile within the input frame.
  10354. Expressed in range of [0-~181.02].
  10355. @item SATAVG
  10356. Display the average saturation value within the input frame. Expressed in range
  10357. of [0-~181.02].
  10358. @item SATHIGH
  10359. Display the saturation value at the 90% percentile within the input frame.
  10360. Expressed in range of [0-~181.02].
  10361. @item SATMAX
  10362. Display the maximum saturation value contained within the input frame.
  10363. Expressed in range of [0-~181.02].
  10364. @item HUEMED
  10365. Display the median value for hue within the input frame. Expressed in range of
  10366. [0-360].
  10367. @item HUEAVG
  10368. Display the average value for hue within the input frame. Expressed in range of
  10369. [0-360].
  10370. @item YDIF
  10371. Display the average of sample value difference between all values of the Y
  10372. plane in the current frame and corresponding values of the previous input frame.
  10373. Expressed in range of [0-255].
  10374. @item UDIF
  10375. Display the average of sample value difference between all values of the U
  10376. plane in the current frame and corresponding values of the previous input frame.
  10377. Expressed in range of [0-255].
  10378. @item VDIF
  10379. Display the average of sample value difference between all values of the V
  10380. plane in the current frame and corresponding values of the previous input frame.
  10381. Expressed in range of [0-255].
  10382. @item YBITDEPTH
  10383. Display bit depth of Y plane in current frame.
  10384. Expressed in range of [0-16].
  10385. @item UBITDEPTH
  10386. Display bit depth of U plane in current frame.
  10387. Expressed in range of [0-16].
  10388. @item VBITDEPTH
  10389. Display bit depth of V plane in current frame.
  10390. Expressed in range of [0-16].
  10391. @end table
  10392. The filter accepts the following options:
  10393. @table @option
  10394. @item stat
  10395. @item out
  10396. @option{stat} specify an additional form of image analysis.
  10397. @option{out} output video with the specified type of pixel highlighted.
  10398. Both options accept the following values:
  10399. @table @samp
  10400. @item tout
  10401. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  10402. unlike the neighboring pixels of the same field. Examples of temporal outliers
  10403. include the results of video dropouts, head clogs, or tape tracking issues.
  10404. @item vrep
  10405. Identify @var{vertical line repetition}. Vertical line repetition includes
  10406. similar rows of pixels within a frame. In born-digital video vertical line
  10407. repetition is common, but this pattern is uncommon in video digitized from an
  10408. analog source. When it occurs in video that results from the digitization of an
  10409. analog source it can indicate concealment from a dropout compensator.
  10410. @item brng
  10411. Identify pixels that fall outside of legal broadcast range.
  10412. @end table
  10413. @item color, c
  10414. Set the highlight color for the @option{out} option. The default color is
  10415. yellow.
  10416. @end table
  10417. @subsection Examples
  10418. @itemize
  10419. @item
  10420. Output data of various video metrics:
  10421. @example
  10422. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  10423. @end example
  10424. @item
  10425. Output specific data about the minimum and maximum values of the Y plane per frame:
  10426. @example
  10427. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  10428. @end example
  10429. @item
  10430. Playback video while highlighting pixels that are outside of broadcast range in red.
  10431. @example
  10432. ffplay example.mov -vf signalstats="out=brng:color=red"
  10433. @end example
  10434. @item
  10435. Playback video with signalstats metadata drawn over the frame.
  10436. @example
  10437. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  10438. @end example
  10439. The contents of signalstat_drawtext.txt used in the command are:
  10440. @example
  10441. time %@{pts:hms@}
  10442. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  10443. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  10444. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  10445. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  10446. @end example
  10447. @end itemize
  10448. @anchor{signature}
  10449. @section signature
  10450. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  10451. input. In this case the matching between the inputs can be calculated additionally.
  10452. The filter always passes through the first input. The signature of each stream can
  10453. be written into a file.
  10454. It accepts the following options:
  10455. @table @option
  10456. @item detectmode
  10457. Enable or disable the matching process.
  10458. Available values are:
  10459. @table @samp
  10460. @item off
  10461. Disable the calculation of a matching (default).
  10462. @item full
  10463. Calculate the matching for the whole video and output whether the whole video
  10464. matches or only parts.
  10465. @item fast
  10466. Calculate only until a matching is found or the video ends. Should be faster in
  10467. some cases.
  10468. @end table
  10469. @item nb_inputs
  10470. Set the number of inputs. The option value must be a non negative integer.
  10471. Default value is 1.
  10472. @item filename
  10473. Set the path to which the output is written. If there is more than one input,
  10474. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  10475. integer), that will be replaced with the input number. If no filename is
  10476. specified, no output will be written. This is the default.
  10477. @item format
  10478. Choose the output format.
  10479. Available values are:
  10480. @table @samp
  10481. @item binary
  10482. Use the specified binary representation (default).
  10483. @item xml
  10484. Use the specified xml representation.
  10485. @end table
  10486. @item th_d
  10487. Set threshold to detect one word as similar. The option value must be an integer
  10488. greater than zero. The default value is 9000.
  10489. @item th_dc
  10490. Set threshold to detect all words as similar. The option value must be an integer
  10491. greater than zero. The default value is 60000.
  10492. @item th_xh
  10493. Set threshold to detect frames as similar. The option value must be an integer
  10494. greater than zero. The default value is 116.
  10495. @item th_di
  10496. Set the minimum length of a sequence in frames to recognize it as matching
  10497. sequence. The option value must be a non negative integer value.
  10498. The default value is 0.
  10499. @item th_it
  10500. Set the minimum relation, that matching frames to all frames must have.
  10501. The option value must be a double value between 0 and 1. The default value is 0.5.
  10502. @end table
  10503. @subsection Examples
  10504. @itemize
  10505. @item
  10506. To calculate the signature of an input video and store it in signature.bin:
  10507. @example
  10508. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  10509. @end example
  10510. @item
  10511. To detect whether two videos match and store the signatures in XML format in
  10512. signature0.xml and signature1.xml:
  10513. @example
  10514. 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 -
  10515. @end example
  10516. @end itemize
  10517. @anchor{smartblur}
  10518. @section smartblur
  10519. Blur the input video without impacting the outlines.
  10520. It accepts the following options:
  10521. @table @option
  10522. @item luma_radius, lr
  10523. Set the luma radius. The option value must be a float number in
  10524. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10525. used to blur the image (slower if larger). Default value is 1.0.
  10526. @item luma_strength, ls
  10527. Set the luma strength. The option value must be a float number
  10528. in the range [-1.0,1.0] that configures the blurring. A value included
  10529. in [0.0,1.0] will blur the image whereas a value included in
  10530. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  10531. @item luma_threshold, lt
  10532. Set the luma threshold used as a coefficient to determine
  10533. whether a pixel should be blurred or not. The option value must be an
  10534. integer in the range [-30,30]. A value of 0 will filter all the image,
  10535. a value included in [0,30] will filter flat areas and a value included
  10536. in [-30,0] will filter edges. Default value is 0.
  10537. @item chroma_radius, cr
  10538. Set the chroma radius. The option value must be a float number in
  10539. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10540. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  10541. @item chroma_strength, cs
  10542. Set the chroma strength. The option value must be a float number
  10543. in the range [-1.0,1.0] that configures the blurring. A value included
  10544. in [0.0,1.0] will blur the image whereas a value included in
  10545. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  10546. @item chroma_threshold, ct
  10547. Set the chroma threshold used as a coefficient to determine
  10548. whether a pixel should be blurred or not. The option value must be an
  10549. integer in the range [-30,30]. A value of 0 will filter all the image,
  10550. a value included in [0,30] will filter flat areas and a value included
  10551. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  10552. @end table
  10553. If a chroma option is not explicitly set, the corresponding luma value
  10554. is set.
  10555. @section ssim
  10556. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  10557. This filter takes in input two input videos, the first input is
  10558. considered the "main" source and is passed unchanged to the
  10559. output. The second input is used as a "reference" video for computing
  10560. the SSIM.
  10561. Both video inputs must have the same resolution and pixel format for
  10562. this filter to work correctly. Also it assumes that both inputs
  10563. have the same number of frames, which are compared one by one.
  10564. The filter stores the calculated SSIM of each frame.
  10565. The description of the accepted parameters follows.
  10566. @table @option
  10567. @item stats_file, f
  10568. If specified the filter will use the named file to save the SSIM of
  10569. each individual frame. When filename equals "-" the data is sent to
  10570. standard output.
  10571. @end table
  10572. The file printed if @var{stats_file} is selected, contains a sequence of
  10573. key/value pairs of the form @var{key}:@var{value} for each compared
  10574. couple of frames.
  10575. A description of each shown parameter follows:
  10576. @table @option
  10577. @item n
  10578. sequential number of the input frame, starting from 1
  10579. @item Y, U, V, R, G, B
  10580. SSIM of the compared frames for the component specified by the suffix.
  10581. @item All
  10582. SSIM of the compared frames for the whole frame.
  10583. @item dB
  10584. Same as above but in dB representation.
  10585. @end table
  10586. This filter also supports the @ref{framesync} options.
  10587. For example:
  10588. @example
  10589. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10590. [main][ref] ssim="stats_file=stats.log" [out]
  10591. @end example
  10592. On this example the input file being processed is compared with the
  10593. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  10594. is stored in @file{stats.log}.
  10595. Another example with both psnr and ssim at same time:
  10596. @example
  10597. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  10598. @end example
  10599. @section stereo3d
  10600. Convert between different stereoscopic image formats.
  10601. The filters accept the following options:
  10602. @table @option
  10603. @item in
  10604. Set stereoscopic image format of input.
  10605. Available values for input image formats are:
  10606. @table @samp
  10607. @item sbsl
  10608. side by side parallel (left eye left, right eye right)
  10609. @item sbsr
  10610. side by side crosseye (right eye left, left eye right)
  10611. @item sbs2l
  10612. side by side parallel with half width resolution
  10613. (left eye left, right eye right)
  10614. @item sbs2r
  10615. side by side crosseye with half width resolution
  10616. (right eye left, left eye right)
  10617. @item abl
  10618. above-below (left eye above, right eye below)
  10619. @item abr
  10620. above-below (right eye above, left eye below)
  10621. @item ab2l
  10622. above-below with half height resolution
  10623. (left eye above, right eye below)
  10624. @item ab2r
  10625. above-below with half height resolution
  10626. (right eye above, left eye below)
  10627. @item al
  10628. alternating frames (left eye first, right eye second)
  10629. @item ar
  10630. alternating frames (right eye first, left eye second)
  10631. @item irl
  10632. interleaved rows (left eye has top row, right eye starts on next row)
  10633. @item irr
  10634. interleaved rows (right eye has top row, left eye starts on next row)
  10635. @item icl
  10636. interleaved columns, left eye first
  10637. @item icr
  10638. interleaved columns, right eye first
  10639. Default value is @samp{sbsl}.
  10640. @end table
  10641. @item out
  10642. Set stereoscopic image format of output.
  10643. @table @samp
  10644. @item sbsl
  10645. side by side parallel (left eye left, right eye right)
  10646. @item sbsr
  10647. side by side crosseye (right eye left, left eye right)
  10648. @item sbs2l
  10649. side by side parallel with half width resolution
  10650. (left eye left, right eye right)
  10651. @item sbs2r
  10652. side by side crosseye with half width resolution
  10653. (right eye left, left eye right)
  10654. @item abl
  10655. above-below (left eye above, right eye below)
  10656. @item abr
  10657. above-below (right eye above, left eye below)
  10658. @item ab2l
  10659. above-below with half height resolution
  10660. (left eye above, right eye below)
  10661. @item ab2r
  10662. above-below with half height resolution
  10663. (right eye above, left eye below)
  10664. @item al
  10665. alternating frames (left eye first, right eye second)
  10666. @item ar
  10667. alternating frames (right eye first, left eye second)
  10668. @item irl
  10669. interleaved rows (left eye has top row, right eye starts on next row)
  10670. @item irr
  10671. interleaved rows (right eye has top row, left eye starts on next row)
  10672. @item arbg
  10673. anaglyph red/blue gray
  10674. (red filter on left eye, blue filter on right eye)
  10675. @item argg
  10676. anaglyph red/green gray
  10677. (red filter on left eye, green filter on right eye)
  10678. @item arcg
  10679. anaglyph red/cyan gray
  10680. (red filter on left eye, cyan filter on right eye)
  10681. @item arch
  10682. anaglyph red/cyan half colored
  10683. (red filter on left eye, cyan filter on right eye)
  10684. @item arcc
  10685. anaglyph red/cyan color
  10686. (red filter on left eye, cyan filter on right eye)
  10687. @item arcd
  10688. anaglyph red/cyan color optimized with the least squares projection of dubois
  10689. (red filter on left eye, cyan filter on right eye)
  10690. @item agmg
  10691. anaglyph green/magenta gray
  10692. (green filter on left eye, magenta filter on right eye)
  10693. @item agmh
  10694. anaglyph green/magenta half colored
  10695. (green filter on left eye, magenta filter on right eye)
  10696. @item agmc
  10697. anaglyph green/magenta colored
  10698. (green filter on left eye, magenta filter on right eye)
  10699. @item agmd
  10700. anaglyph green/magenta color optimized with the least squares projection of dubois
  10701. (green filter on left eye, magenta filter on right eye)
  10702. @item aybg
  10703. anaglyph yellow/blue gray
  10704. (yellow filter on left eye, blue filter on right eye)
  10705. @item aybh
  10706. anaglyph yellow/blue half colored
  10707. (yellow filter on left eye, blue filter on right eye)
  10708. @item aybc
  10709. anaglyph yellow/blue colored
  10710. (yellow filter on left eye, blue filter on right eye)
  10711. @item aybd
  10712. anaglyph yellow/blue color optimized with the least squares projection of dubois
  10713. (yellow filter on left eye, blue filter on right eye)
  10714. @item ml
  10715. mono output (left eye only)
  10716. @item mr
  10717. mono output (right eye only)
  10718. @item chl
  10719. checkerboard, left eye first
  10720. @item chr
  10721. checkerboard, right eye first
  10722. @item icl
  10723. interleaved columns, left eye first
  10724. @item icr
  10725. interleaved columns, right eye first
  10726. @item hdmi
  10727. HDMI frame pack
  10728. @end table
  10729. Default value is @samp{arcd}.
  10730. @end table
  10731. @subsection Examples
  10732. @itemize
  10733. @item
  10734. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  10735. @example
  10736. stereo3d=sbsl:aybd
  10737. @end example
  10738. @item
  10739. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  10740. @example
  10741. stereo3d=abl:sbsr
  10742. @end example
  10743. @end itemize
  10744. @section streamselect, astreamselect
  10745. Select video or audio streams.
  10746. The filter accepts the following options:
  10747. @table @option
  10748. @item inputs
  10749. Set number of inputs. Default is 2.
  10750. @item map
  10751. Set input indexes to remap to outputs.
  10752. @end table
  10753. @subsection Commands
  10754. The @code{streamselect} and @code{astreamselect} filter supports the following
  10755. commands:
  10756. @table @option
  10757. @item map
  10758. Set input indexes to remap to outputs.
  10759. @end table
  10760. @subsection Examples
  10761. @itemize
  10762. @item
  10763. Select first 5 seconds 1st stream and rest of time 2nd stream:
  10764. @example
  10765. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  10766. @end example
  10767. @item
  10768. Same as above, but for audio:
  10769. @example
  10770. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  10771. @end example
  10772. @end itemize
  10773. @section sobel
  10774. Apply sobel operator to input video stream.
  10775. The filter accepts the following option:
  10776. @table @option
  10777. @item planes
  10778. Set which planes will be processed, unprocessed planes will be copied.
  10779. By default value 0xf, all planes will be processed.
  10780. @item scale
  10781. Set value which will be multiplied with filtered result.
  10782. @item delta
  10783. Set value which will be added to filtered result.
  10784. @end table
  10785. @anchor{spp}
  10786. @section spp
  10787. Apply a simple postprocessing filter that compresses and decompresses the image
  10788. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  10789. and average the results.
  10790. The filter accepts the following options:
  10791. @table @option
  10792. @item quality
  10793. Set quality. This option defines the number of levels for averaging. It accepts
  10794. an integer in the range 0-6. If set to @code{0}, the filter will have no
  10795. effect. A value of @code{6} means the higher quality. For each increment of
  10796. that value the speed drops by a factor of approximately 2. Default value is
  10797. @code{3}.
  10798. @item qp
  10799. Force a constant quantization parameter. If not set, the filter will use the QP
  10800. from the video stream (if available).
  10801. @item mode
  10802. Set thresholding mode. Available modes are:
  10803. @table @samp
  10804. @item hard
  10805. Set hard thresholding (default).
  10806. @item soft
  10807. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10808. @end table
  10809. @item use_bframe_qp
  10810. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  10811. option may cause flicker since the B-Frames have often larger QP. Default is
  10812. @code{0} (not enabled).
  10813. @end table
  10814. @anchor{subtitles}
  10815. @section subtitles
  10816. Draw subtitles on top of input video using the libass library.
  10817. To enable compilation of this filter you need to configure FFmpeg with
  10818. @code{--enable-libass}. This filter also requires a build with libavcodec and
  10819. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  10820. Alpha) subtitles format.
  10821. The filter accepts the following options:
  10822. @table @option
  10823. @item filename, f
  10824. Set the filename of the subtitle file to read. It must be specified.
  10825. @item original_size
  10826. Specify the size of the original video, the video for which the ASS file
  10827. was composed. For the syntax of this option, check the
  10828. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10829. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  10830. correctly scale the fonts if the aspect ratio has been changed.
  10831. @item fontsdir
  10832. Set a directory path containing fonts that can be used by the filter.
  10833. These fonts will be used in addition to whatever the font provider uses.
  10834. @item alpha
  10835. Process alpha channel, by default alpha channel is untouched.
  10836. @item charenc
  10837. Set subtitles input character encoding. @code{subtitles} filter only. Only
  10838. useful if not UTF-8.
  10839. @item stream_index, si
  10840. Set subtitles stream index. @code{subtitles} filter only.
  10841. @item force_style
  10842. Override default style or script info parameters of the subtitles. It accepts a
  10843. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  10844. @end table
  10845. If the first key is not specified, it is assumed that the first value
  10846. specifies the @option{filename}.
  10847. For example, to render the file @file{sub.srt} on top of the input
  10848. video, use the command:
  10849. @example
  10850. subtitles=sub.srt
  10851. @end example
  10852. which is equivalent to:
  10853. @example
  10854. subtitles=filename=sub.srt
  10855. @end example
  10856. To render the default subtitles stream from file @file{video.mkv}, use:
  10857. @example
  10858. subtitles=video.mkv
  10859. @end example
  10860. To render the second subtitles stream from that file, use:
  10861. @example
  10862. subtitles=video.mkv:si=1
  10863. @end example
  10864. To make the subtitles stream from @file{sub.srt} appear in transparent green
  10865. @code{DejaVu Serif}, use:
  10866. @example
  10867. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  10868. @end example
  10869. @section super2xsai
  10870. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  10871. Interpolate) pixel art scaling algorithm.
  10872. Useful for enlarging pixel art images without reducing sharpness.
  10873. @section swaprect
  10874. Swap two rectangular objects in video.
  10875. This filter accepts the following options:
  10876. @table @option
  10877. @item w
  10878. Set object width.
  10879. @item h
  10880. Set object height.
  10881. @item x1
  10882. Set 1st rect x coordinate.
  10883. @item y1
  10884. Set 1st rect y coordinate.
  10885. @item x2
  10886. Set 2nd rect x coordinate.
  10887. @item y2
  10888. Set 2nd rect y coordinate.
  10889. All expressions are evaluated once for each frame.
  10890. @end table
  10891. The all options are expressions containing the following constants:
  10892. @table @option
  10893. @item w
  10894. @item h
  10895. The input width and height.
  10896. @item a
  10897. same as @var{w} / @var{h}
  10898. @item sar
  10899. input sample aspect ratio
  10900. @item dar
  10901. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  10902. @item n
  10903. The number of the input frame, starting from 0.
  10904. @item t
  10905. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  10906. @item pos
  10907. the position in the file of the input frame, NAN if unknown
  10908. @end table
  10909. @section swapuv
  10910. Swap U & V plane.
  10911. @section telecine
  10912. Apply telecine process to the video.
  10913. This filter accepts the following options:
  10914. @table @option
  10915. @item first_field
  10916. @table @samp
  10917. @item top, t
  10918. top field first
  10919. @item bottom, b
  10920. bottom field first
  10921. The default value is @code{top}.
  10922. @end table
  10923. @item pattern
  10924. A string of numbers representing the pulldown pattern you wish to apply.
  10925. The default value is @code{23}.
  10926. @end table
  10927. @example
  10928. Some typical patterns:
  10929. NTSC output (30i):
  10930. 27.5p: 32222
  10931. 24p: 23 (classic)
  10932. 24p: 2332 (preferred)
  10933. 20p: 33
  10934. 18p: 334
  10935. 16p: 3444
  10936. PAL output (25i):
  10937. 27.5p: 12222
  10938. 24p: 222222222223 ("Euro pulldown")
  10939. 16.67p: 33
  10940. 16p: 33333334
  10941. @end example
  10942. @section threshold
  10943. Apply threshold effect to video stream.
  10944. This filter needs four video streams to perform thresholding.
  10945. First stream is stream we are filtering.
  10946. Second stream is holding threshold values, third stream is holding min values,
  10947. and last, fourth stream is holding max values.
  10948. The filter accepts the following option:
  10949. @table @option
  10950. @item planes
  10951. Set which planes will be processed, unprocessed planes will be copied.
  10952. By default value 0xf, all planes will be processed.
  10953. @end table
  10954. For example if first stream pixel's component value is less then threshold value
  10955. of pixel component from 2nd threshold stream, third stream value will picked,
  10956. otherwise fourth stream pixel component value will be picked.
  10957. Using color source filter one can perform various types of thresholding:
  10958. @subsection Examples
  10959. @itemize
  10960. @item
  10961. Binary threshold, using gray color as threshold:
  10962. @example
  10963. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  10964. @end example
  10965. @item
  10966. Inverted binary threshold, using gray color as threshold:
  10967. @example
  10968. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  10969. @end example
  10970. @item
  10971. Truncate binary threshold, using gray color as threshold:
  10972. @example
  10973. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  10974. @end example
  10975. @item
  10976. Threshold to zero, using gray color as threshold:
  10977. @example
  10978. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  10979. @end example
  10980. @item
  10981. Inverted threshold to zero, using gray color as threshold:
  10982. @example
  10983. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  10984. @end example
  10985. @end itemize
  10986. @section thumbnail
  10987. Select the most representative frame in a given sequence of consecutive frames.
  10988. The filter accepts the following options:
  10989. @table @option
  10990. @item n
  10991. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  10992. will pick one of them, and then handle the next batch of @var{n} frames until
  10993. the end. Default is @code{100}.
  10994. @end table
  10995. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  10996. value will result in a higher memory usage, so a high value is not recommended.
  10997. @subsection Examples
  10998. @itemize
  10999. @item
  11000. Extract one picture each 50 frames:
  11001. @example
  11002. thumbnail=50
  11003. @end example
  11004. @item
  11005. Complete example of a thumbnail creation with @command{ffmpeg}:
  11006. @example
  11007. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  11008. @end example
  11009. @end itemize
  11010. @section tile
  11011. Tile several successive frames together.
  11012. The filter accepts the following options:
  11013. @table @option
  11014. @item layout
  11015. Set the grid size (i.e. the number of lines and columns). For the syntax of
  11016. this option, check the
  11017. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11018. @item nb_frames
  11019. Set the maximum number of frames to render in the given area. It must be less
  11020. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  11021. the area will be used.
  11022. @item margin
  11023. Set the outer border margin in pixels.
  11024. @item padding
  11025. Set the inner border thickness (i.e. the number of pixels between frames). For
  11026. more advanced padding options (such as having different values for the edges),
  11027. refer to the pad video filter.
  11028. @item color
  11029. Specify the color of the unused area. For the syntax of this option, check the
  11030. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  11031. is "black".
  11032. @item overlap
  11033. Set the number of frames to overlap when tiling several successive frames together.
  11034. The value must be between @code{0} and @var{nb_frames - 1}.
  11035. @end table
  11036. @subsection Examples
  11037. @itemize
  11038. @item
  11039. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  11040. @example
  11041. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  11042. @end example
  11043. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  11044. duplicating each output frame to accommodate the originally detected frame
  11045. rate.
  11046. @item
  11047. Display @code{5} pictures in an area of @code{3x2} frames,
  11048. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  11049. mixed flat and named options:
  11050. @example
  11051. tile=3x2:nb_frames=5:padding=7:margin=2
  11052. @end example
  11053. @end itemize
  11054. @section tinterlace
  11055. Perform various types of temporal field interlacing.
  11056. Frames are counted starting from 1, so the first input frame is
  11057. considered odd.
  11058. The filter accepts the following options:
  11059. @table @option
  11060. @item mode
  11061. Specify the mode of the interlacing. This option can also be specified
  11062. as a value alone. See below for a list of values for this option.
  11063. Available values are:
  11064. @table @samp
  11065. @item merge, 0
  11066. Move odd frames into the upper field, even into the lower field,
  11067. generating a double height frame at half frame rate.
  11068. @example
  11069. ------> time
  11070. Input:
  11071. Frame 1 Frame 2 Frame 3 Frame 4
  11072. 11111 22222 33333 44444
  11073. 11111 22222 33333 44444
  11074. 11111 22222 33333 44444
  11075. 11111 22222 33333 44444
  11076. Output:
  11077. 11111 33333
  11078. 22222 44444
  11079. 11111 33333
  11080. 22222 44444
  11081. 11111 33333
  11082. 22222 44444
  11083. 11111 33333
  11084. 22222 44444
  11085. @end example
  11086. @item drop_even, 1
  11087. Only output odd frames, even frames are dropped, generating a frame with
  11088. unchanged height at half frame rate.
  11089. @example
  11090. ------> time
  11091. Input:
  11092. Frame 1 Frame 2 Frame 3 Frame 4
  11093. 11111 22222 33333 44444
  11094. 11111 22222 33333 44444
  11095. 11111 22222 33333 44444
  11096. 11111 22222 33333 44444
  11097. Output:
  11098. 11111 33333
  11099. 11111 33333
  11100. 11111 33333
  11101. 11111 33333
  11102. @end example
  11103. @item drop_odd, 2
  11104. Only output even frames, odd frames are dropped, generating a frame with
  11105. unchanged height at half frame rate.
  11106. @example
  11107. ------> time
  11108. Input:
  11109. Frame 1 Frame 2 Frame 3 Frame 4
  11110. 11111 22222 33333 44444
  11111. 11111 22222 33333 44444
  11112. 11111 22222 33333 44444
  11113. 11111 22222 33333 44444
  11114. Output:
  11115. 22222 44444
  11116. 22222 44444
  11117. 22222 44444
  11118. 22222 44444
  11119. @end example
  11120. @item pad, 3
  11121. Expand each frame to full height, but pad alternate lines with black,
  11122. generating a frame with double height at the same input frame rate.
  11123. @example
  11124. ------> time
  11125. Input:
  11126. Frame 1 Frame 2 Frame 3 Frame 4
  11127. 11111 22222 33333 44444
  11128. 11111 22222 33333 44444
  11129. 11111 22222 33333 44444
  11130. 11111 22222 33333 44444
  11131. Output:
  11132. 11111 ..... 33333 .....
  11133. ..... 22222 ..... 44444
  11134. 11111 ..... 33333 .....
  11135. ..... 22222 ..... 44444
  11136. 11111 ..... 33333 .....
  11137. ..... 22222 ..... 44444
  11138. 11111 ..... 33333 .....
  11139. ..... 22222 ..... 44444
  11140. @end example
  11141. @item interleave_top, 4
  11142. Interleave the upper field from odd frames with the lower field from
  11143. even frames, generating a frame with unchanged height at half frame rate.
  11144. @example
  11145. ------> time
  11146. Input:
  11147. Frame 1 Frame 2 Frame 3 Frame 4
  11148. 11111<- 22222 33333<- 44444
  11149. 11111 22222<- 33333 44444<-
  11150. 11111<- 22222 33333<- 44444
  11151. 11111 22222<- 33333 44444<-
  11152. Output:
  11153. 11111 33333
  11154. 22222 44444
  11155. 11111 33333
  11156. 22222 44444
  11157. @end example
  11158. @item interleave_bottom, 5
  11159. Interleave the lower field from odd frames with the upper field from
  11160. even frames, generating a frame with unchanged height at half frame rate.
  11161. @example
  11162. ------> time
  11163. Input:
  11164. Frame 1 Frame 2 Frame 3 Frame 4
  11165. 11111 22222<- 33333 44444<-
  11166. 11111<- 22222 33333<- 44444
  11167. 11111 22222<- 33333 44444<-
  11168. 11111<- 22222 33333<- 44444
  11169. Output:
  11170. 22222 44444
  11171. 11111 33333
  11172. 22222 44444
  11173. 11111 33333
  11174. @end example
  11175. @item interlacex2, 6
  11176. Double frame rate with unchanged height. Frames are inserted each
  11177. containing the second temporal field from the previous input frame and
  11178. the first temporal field from the next input frame. This mode relies on
  11179. the top_field_first flag. Useful for interlaced video displays with no
  11180. field synchronisation.
  11181. @example
  11182. ------> time
  11183. Input:
  11184. Frame 1 Frame 2 Frame 3 Frame 4
  11185. 11111 22222 33333 44444
  11186. 11111 22222 33333 44444
  11187. 11111 22222 33333 44444
  11188. 11111 22222 33333 44444
  11189. Output:
  11190. 11111 22222 22222 33333 33333 44444 44444
  11191. 11111 11111 22222 22222 33333 33333 44444
  11192. 11111 22222 22222 33333 33333 44444 44444
  11193. 11111 11111 22222 22222 33333 33333 44444
  11194. @end example
  11195. @item mergex2, 7
  11196. Move odd frames into the upper field, even into the lower field,
  11197. generating a double height frame at same frame rate.
  11198. @example
  11199. ------> time
  11200. Input:
  11201. Frame 1 Frame 2 Frame 3 Frame 4
  11202. 11111 22222 33333 44444
  11203. 11111 22222 33333 44444
  11204. 11111 22222 33333 44444
  11205. 11111 22222 33333 44444
  11206. Output:
  11207. 11111 33333 33333 55555
  11208. 22222 22222 44444 44444
  11209. 11111 33333 33333 55555
  11210. 22222 22222 44444 44444
  11211. 11111 33333 33333 55555
  11212. 22222 22222 44444 44444
  11213. 11111 33333 33333 55555
  11214. 22222 22222 44444 44444
  11215. @end example
  11216. @end table
  11217. Numeric values are deprecated but are accepted for backward
  11218. compatibility reasons.
  11219. Default mode is @code{merge}.
  11220. @item flags
  11221. Specify flags influencing the filter process.
  11222. Available value for @var{flags} is:
  11223. @table @option
  11224. @item low_pass_filter, vlfp
  11225. Enable linear vertical low-pass filtering in the filter.
  11226. Vertical low-pass filtering is required when creating an interlaced
  11227. destination from a progressive source which contains high-frequency
  11228. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  11229. patterning.
  11230. @item complex_filter, cvlfp
  11231. Enable complex vertical low-pass filtering.
  11232. This will slightly less reduce interlace 'twitter' and Moire
  11233. patterning but better retain detail and subjective sharpness impression.
  11234. @end table
  11235. Vertical low-pass filtering can only be enabled for @option{mode}
  11236. @var{interleave_top} and @var{interleave_bottom}.
  11237. @end table
  11238. @section tonemap
  11239. Tone map colors from different dynamic ranges.
  11240. This filter expects data in single precision floating point, as it needs to
  11241. operate on (and can output) out-of-range values. Another filter, such as
  11242. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  11243. The tonemapping algorithms implemented only work on linear light, so input
  11244. data should be linearized beforehand (and possibly correctly tagged).
  11245. @example
  11246. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  11247. @end example
  11248. @subsection Options
  11249. The filter accepts the following options.
  11250. @table @option
  11251. @item tonemap
  11252. Set the tone map algorithm to use.
  11253. Possible values are:
  11254. @table @var
  11255. @item none
  11256. Do not apply any tone map, only desaturate overbright pixels.
  11257. @item clip
  11258. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  11259. in-range values, while distorting out-of-range values.
  11260. @item linear
  11261. Stretch the entire reference gamut to a linear multiple of the display.
  11262. @item gamma
  11263. Fit a logarithmic transfer between the tone curves.
  11264. @item reinhard
  11265. Preserve overall image brightness with a simple curve, using nonlinear
  11266. contrast, which results in flattening details and degrading color accuracy.
  11267. @item hable
  11268. Preserve both dark and bright details better than @var{reinhard}, at the cost
  11269. of slightly darkening everything. Use it when detail preservation is more
  11270. important than color and brightness accuracy.
  11271. @item mobius
  11272. Smoothly map out-of-range values, while retaining contrast and colors for
  11273. in-range material as much as possible. Use it when color accuracy is more
  11274. important than detail preservation.
  11275. @end table
  11276. Default is none.
  11277. @item param
  11278. Tune the tone mapping algorithm.
  11279. This affects the following algorithms:
  11280. @table @var
  11281. @item none
  11282. Ignored.
  11283. @item linear
  11284. Specifies the scale factor to use while stretching.
  11285. Default to 1.0.
  11286. @item gamma
  11287. Specifies the exponent of the function.
  11288. Default to 1.8.
  11289. @item clip
  11290. Specify an extra linear coefficient to multiply into the signal before clipping.
  11291. Default to 1.0.
  11292. @item reinhard
  11293. Specify the local contrast coefficient at the display peak.
  11294. Default to 0.5, which means that in-gamut values will be about half as bright
  11295. as when clipping.
  11296. @item hable
  11297. Ignored.
  11298. @item mobius
  11299. Specify the transition point from linear to mobius transform. Every value
  11300. below this point is guaranteed to be mapped 1:1. The higher the value, the
  11301. more accurate the result will be, at the cost of losing bright details.
  11302. Default to 0.3, which due to the steep initial slope still preserves in-range
  11303. colors fairly accurately.
  11304. @end table
  11305. @item desat
  11306. Apply desaturation for highlights that exceed this level of brightness. The
  11307. higher the parameter, the more color information will be preserved. This
  11308. setting helps prevent unnaturally blown-out colors for super-highlights, by
  11309. (smoothly) turning into white instead. This makes images feel more natural,
  11310. at the cost of reducing information about out-of-range colors.
  11311. The default of 2.0 is somewhat conservative and will mostly just apply to
  11312. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  11313. This option works only if the input frame has a supported color tag.
  11314. @item peak
  11315. Override signal/nominal/reference peak with this value. Useful when the
  11316. embedded peak information in display metadata is not reliable or when tone
  11317. mapping from a lower range to a higher range.
  11318. @end table
  11319. @section transpose
  11320. Transpose rows with columns in the input video and optionally flip it.
  11321. It accepts the following parameters:
  11322. @table @option
  11323. @item dir
  11324. Specify the transposition direction.
  11325. Can assume the following values:
  11326. @table @samp
  11327. @item 0, 4, cclock_flip
  11328. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  11329. @example
  11330. L.R L.l
  11331. . . -> . .
  11332. l.r R.r
  11333. @end example
  11334. @item 1, 5, clock
  11335. Rotate by 90 degrees clockwise, that is:
  11336. @example
  11337. L.R l.L
  11338. . . -> . .
  11339. l.r r.R
  11340. @end example
  11341. @item 2, 6, cclock
  11342. Rotate by 90 degrees counterclockwise, that is:
  11343. @example
  11344. L.R R.r
  11345. . . -> . .
  11346. l.r L.l
  11347. @end example
  11348. @item 3, 7, clock_flip
  11349. Rotate by 90 degrees clockwise and vertically flip, that is:
  11350. @example
  11351. L.R r.R
  11352. . . -> . .
  11353. l.r l.L
  11354. @end example
  11355. @end table
  11356. For values between 4-7, the transposition is only done if the input
  11357. video geometry is portrait and not landscape. These values are
  11358. deprecated, the @code{passthrough} option should be used instead.
  11359. Numerical values are deprecated, and should be dropped in favor of
  11360. symbolic constants.
  11361. @item passthrough
  11362. Do not apply the transposition if the input geometry matches the one
  11363. specified by the specified value. It accepts the following values:
  11364. @table @samp
  11365. @item none
  11366. Always apply transposition.
  11367. @item portrait
  11368. Preserve portrait geometry (when @var{height} >= @var{width}).
  11369. @item landscape
  11370. Preserve landscape geometry (when @var{width} >= @var{height}).
  11371. @end table
  11372. Default value is @code{none}.
  11373. @end table
  11374. For example to rotate by 90 degrees clockwise and preserve portrait
  11375. layout:
  11376. @example
  11377. transpose=dir=1:passthrough=portrait
  11378. @end example
  11379. The command above can also be specified as:
  11380. @example
  11381. transpose=1:portrait
  11382. @end example
  11383. @section trim
  11384. Trim the input so that the output contains one continuous subpart of the input.
  11385. It accepts the following parameters:
  11386. @table @option
  11387. @item start
  11388. Specify the time of the start of the kept section, i.e. the frame with the
  11389. timestamp @var{start} will be the first frame in the output.
  11390. @item end
  11391. Specify the time of the first frame that will be dropped, i.e. the frame
  11392. immediately preceding the one with the timestamp @var{end} will be the last
  11393. frame in the output.
  11394. @item start_pts
  11395. This is the same as @var{start}, except this option sets the start timestamp
  11396. in timebase units instead of seconds.
  11397. @item end_pts
  11398. This is the same as @var{end}, except this option sets the end timestamp
  11399. in timebase units instead of seconds.
  11400. @item duration
  11401. The maximum duration of the output in seconds.
  11402. @item start_frame
  11403. The number of the first frame that should be passed to the output.
  11404. @item end_frame
  11405. The number of the first frame that should be dropped.
  11406. @end table
  11407. @option{start}, @option{end}, and @option{duration} are expressed as time
  11408. duration specifications; see
  11409. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11410. for the accepted syntax.
  11411. Note that the first two sets of the start/end options and the @option{duration}
  11412. option look at the frame timestamp, while the _frame variants simply count the
  11413. frames that pass through the filter. Also note that this filter does not modify
  11414. the timestamps. If you wish for the output timestamps to start at zero, insert a
  11415. setpts filter after the trim filter.
  11416. If multiple start or end options are set, this filter tries to be greedy and
  11417. keep all the frames that match at least one of the specified constraints. To keep
  11418. only the part that matches all the constraints at once, chain multiple trim
  11419. filters.
  11420. The defaults are such that all the input is kept. So it is possible to set e.g.
  11421. just the end values to keep everything before the specified time.
  11422. Examples:
  11423. @itemize
  11424. @item
  11425. Drop everything except the second minute of input:
  11426. @example
  11427. ffmpeg -i INPUT -vf trim=60:120
  11428. @end example
  11429. @item
  11430. Keep only the first second:
  11431. @example
  11432. ffmpeg -i INPUT -vf trim=duration=1
  11433. @end example
  11434. @end itemize
  11435. @section unpremultiply
  11436. Apply alpha unpremultiply effect to input video stream using first plane
  11437. of second stream as alpha.
  11438. Both streams must have same dimensions and same pixel format.
  11439. The filter accepts the following option:
  11440. @table @option
  11441. @item planes
  11442. Set which planes will be processed, unprocessed planes will be copied.
  11443. By default value 0xf, all planes will be processed.
  11444. If the format has 1 or 2 components, then luma is bit 0.
  11445. If the format has 3 or 4 components:
  11446. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  11447. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  11448. If present, the alpha channel is always the last bit.
  11449. @item inplace
  11450. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11451. @end table
  11452. @anchor{unsharp}
  11453. @section unsharp
  11454. Sharpen or blur the input video.
  11455. It accepts the following parameters:
  11456. @table @option
  11457. @item luma_msize_x, lx
  11458. Set the luma matrix horizontal size. It must be an odd integer between
  11459. 3 and 23. The default value is 5.
  11460. @item luma_msize_y, ly
  11461. Set the luma matrix vertical size. It must be an odd integer between 3
  11462. and 23. The default value is 5.
  11463. @item luma_amount, la
  11464. Set the luma effect strength. It must be a floating point number, reasonable
  11465. values lay between -1.5 and 1.5.
  11466. Negative values will blur the input video, while positive values will
  11467. sharpen it, a value of zero will disable the effect.
  11468. Default value is 1.0.
  11469. @item chroma_msize_x, cx
  11470. Set the chroma matrix horizontal size. It must be an odd integer
  11471. between 3 and 23. The default value is 5.
  11472. @item chroma_msize_y, cy
  11473. Set the chroma matrix vertical size. It must be an odd integer
  11474. between 3 and 23. The default value is 5.
  11475. @item chroma_amount, ca
  11476. Set the chroma effect strength. It must be a floating point number, reasonable
  11477. values lay between -1.5 and 1.5.
  11478. Negative values will blur the input video, while positive values will
  11479. sharpen it, a value of zero will disable the effect.
  11480. Default value is 0.0.
  11481. @end table
  11482. All parameters are optional and default to the equivalent of the
  11483. string '5:5:1.0:5:5:0.0'.
  11484. @subsection Examples
  11485. @itemize
  11486. @item
  11487. Apply strong luma sharpen effect:
  11488. @example
  11489. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  11490. @end example
  11491. @item
  11492. Apply a strong blur of both luma and chroma parameters:
  11493. @example
  11494. unsharp=7:7:-2:7:7:-2
  11495. @end example
  11496. @end itemize
  11497. @section uspp
  11498. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  11499. the image at several (or - in the case of @option{quality} level @code{8} - all)
  11500. shifts and average the results.
  11501. The way this differs from the behavior of spp is that uspp actually encodes &
  11502. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  11503. DCT similar to MJPEG.
  11504. The filter accepts the following options:
  11505. @table @option
  11506. @item quality
  11507. Set quality. This option defines the number of levels for averaging. It accepts
  11508. an integer in the range 0-8. If set to @code{0}, the filter will have no
  11509. effect. A value of @code{8} means the higher quality. For each increment of
  11510. that value the speed drops by a factor of approximately 2. Default value is
  11511. @code{3}.
  11512. @item qp
  11513. Force a constant quantization parameter. If not set, the filter will use the QP
  11514. from the video stream (if available).
  11515. @end table
  11516. @section vaguedenoiser
  11517. Apply a wavelet based denoiser.
  11518. It transforms each frame from the video input into the wavelet domain,
  11519. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  11520. the obtained coefficients. It does an inverse wavelet transform after.
  11521. Due to wavelet properties, it should give a nice smoothed result, and
  11522. reduced noise, without blurring picture features.
  11523. This filter accepts the following options:
  11524. @table @option
  11525. @item threshold
  11526. The filtering strength. The higher, the more filtered the video will be.
  11527. Hard thresholding can use a higher threshold than soft thresholding
  11528. before the video looks overfiltered. Default value is 2.
  11529. @item method
  11530. The filtering method the filter will use.
  11531. It accepts the following values:
  11532. @table @samp
  11533. @item hard
  11534. All values under the threshold will be zeroed.
  11535. @item soft
  11536. All values under the threshold will be zeroed. All values above will be
  11537. reduced by the threshold.
  11538. @item garrote
  11539. Scales or nullifies coefficients - intermediary between (more) soft and
  11540. (less) hard thresholding.
  11541. @end table
  11542. Default is garrote.
  11543. @item nsteps
  11544. Number of times, the wavelet will decompose the picture. Picture can't
  11545. be decomposed beyond a particular point (typically, 8 for a 640x480
  11546. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  11547. @item percent
  11548. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  11549. @item planes
  11550. A list of the planes to process. By default all planes are processed.
  11551. @end table
  11552. @section vectorscope
  11553. Display 2 color component values in the two dimensional graph (which is called
  11554. a vectorscope).
  11555. This filter accepts the following options:
  11556. @table @option
  11557. @item mode, m
  11558. Set vectorscope mode.
  11559. It accepts the following values:
  11560. @table @samp
  11561. @item gray
  11562. Gray values are displayed on graph, higher brightness means more pixels have
  11563. same component color value on location in graph. This is the default mode.
  11564. @item color
  11565. Gray values are displayed on graph. Surrounding pixels values which are not
  11566. present in video frame are drawn in gradient of 2 color components which are
  11567. set by option @code{x} and @code{y}. The 3rd color component is static.
  11568. @item color2
  11569. Actual color components values present in video frame are displayed on graph.
  11570. @item color3
  11571. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  11572. on graph increases value of another color component, which is luminance by
  11573. default values of @code{x} and @code{y}.
  11574. @item color4
  11575. Actual colors present in video frame are displayed on graph. If two different
  11576. colors map to same position on graph then color with higher value of component
  11577. not present in graph is picked.
  11578. @item color5
  11579. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  11580. component picked from radial gradient.
  11581. @end table
  11582. @item x
  11583. Set which color component will be represented on X-axis. Default is @code{1}.
  11584. @item y
  11585. Set which color component will be represented on Y-axis. Default is @code{2}.
  11586. @item intensity, i
  11587. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  11588. of color component which represents frequency of (X, Y) location in graph.
  11589. @item envelope, e
  11590. @table @samp
  11591. @item none
  11592. No envelope, this is default.
  11593. @item instant
  11594. Instant envelope, even darkest single pixel will be clearly highlighted.
  11595. @item peak
  11596. Hold maximum and minimum values presented in graph over time. This way you
  11597. can still spot out of range values without constantly looking at vectorscope.
  11598. @item peak+instant
  11599. Peak and instant envelope combined together.
  11600. @end table
  11601. @item graticule, g
  11602. Set what kind of graticule to draw.
  11603. @table @samp
  11604. @item none
  11605. @item green
  11606. @item color
  11607. @end table
  11608. @item opacity, o
  11609. Set graticule opacity.
  11610. @item flags, f
  11611. Set graticule flags.
  11612. @table @samp
  11613. @item white
  11614. Draw graticule for white point.
  11615. @item black
  11616. Draw graticule for black point.
  11617. @item name
  11618. Draw color points short names.
  11619. @end table
  11620. @item bgopacity, b
  11621. Set background opacity.
  11622. @item lthreshold, l
  11623. Set low threshold for color component not represented on X or Y axis.
  11624. Values lower than this value will be ignored. Default is 0.
  11625. Note this value is multiplied with actual max possible value one pixel component
  11626. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  11627. is 0.1 * 255 = 25.
  11628. @item hthreshold, h
  11629. Set high threshold for color component not represented on X or Y axis.
  11630. Values higher than this value will be ignored. Default is 1.
  11631. Note this value is multiplied with actual max possible value one pixel component
  11632. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  11633. is 0.9 * 255 = 230.
  11634. @item colorspace, c
  11635. Set what kind of colorspace to use when drawing graticule.
  11636. @table @samp
  11637. @item auto
  11638. @item 601
  11639. @item 709
  11640. @end table
  11641. Default is auto.
  11642. @end table
  11643. @anchor{vidstabdetect}
  11644. @section vidstabdetect
  11645. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  11646. @ref{vidstabtransform} for pass 2.
  11647. This filter generates a file with relative translation and rotation
  11648. transform information about subsequent frames, which is then used by
  11649. the @ref{vidstabtransform} filter.
  11650. To enable compilation of this filter you need to configure FFmpeg with
  11651. @code{--enable-libvidstab}.
  11652. This filter accepts the following options:
  11653. @table @option
  11654. @item result
  11655. Set the path to the file used to write the transforms information.
  11656. Default value is @file{transforms.trf}.
  11657. @item shakiness
  11658. Set how shaky the video is and how quick the camera is. It accepts an
  11659. integer in the range 1-10, a value of 1 means little shakiness, a
  11660. value of 10 means strong shakiness. Default value is 5.
  11661. @item accuracy
  11662. Set the accuracy of the detection process. It must be a value in the
  11663. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  11664. accuracy. Default value is 15.
  11665. @item stepsize
  11666. Set stepsize of the search process. The region around minimum is
  11667. scanned with 1 pixel resolution. Default value is 6.
  11668. @item mincontrast
  11669. Set minimum contrast. Below this value a local measurement field is
  11670. discarded. Must be a floating point value in the range 0-1. Default
  11671. value is 0.3.
  11672. @item tripod
  11673. Set reference frame number for tripod mode.
  11674. If enabled, the motion of the frames is compared to a reference frame
  11675. in the filtered stream, identified by the specified number. The idea
  11676. is to compensate all movements in a more-or-less static scene and keep
  11677. the camera view absolutely still.
  11678. If set to 0, it is disabled. The frames are counted starting from 1.
  11679. @item show
  11680. Show fields and transforms in the resulting frames. It accepts an
  11681. integer in the range 0-2. Default value is 0, which disables any
  11682. visualization.
  11683. @end table
  11684. @subsection Examples
  11685. @itemize
  11686. @item
  11687. Use default values:
  11688. @example
  11689. vidstabdetect
  11690. @end example
  11691. @item
  11692. Analyze strongly shaky movie and put the results in file
  11693. @file{mytransforms.trf}:
  11694. @example
  11695. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  11696. @end example
  11697. @item
  11698. Visualize the result of internal transformations in the resulting
  11699. video:
  11700. @example
  11701. vidstabdetect=show=1
  11702. @end example
  11703. @item
  11704. Analyze a video with medium shakiness using @command{ffmpeg}:
  11705. @example
  11706. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  11707. @end example
  11708. @end itemize
  11709. @anchor{vidstabtransform}
  11710. @section vidstabtransform
  11711. Video stabilization/deshaking: pass 2 of 2,
  11712. see @ref{vidstabdetect} for pass 1.
  11713. Read a file with transform information for each frame and
  11714. apply/compensate them. Together with the @ref{vidstabdetect}
  11715. filter this can be used to deshake videos. See also
  11716. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  11717. the @ref{unsharp} filter, see below.
  11718. To enable compilation of this filter you need to configure FFmpeg with
  11719. @code{--enable-libvidstab}.
  11720. @subsection Options
  11721. @table @option
  11722. @item input
  11723. Set path to the file used to read the transforms. Default value is
  11724. @file{transforms.trf}.
  11725. @item smoothing
  11726. Set the number of frames (value*2 + 1) used for lowpass filtering the
  11727. camera movements. Default value is 10.
  11728. For example a number of 10 means that 21 frames are used (10 in the
  11729. past and 10 in the future) to smoothen the motion in the video. A
  11730. larger value leads to a smoother video, but limits the acceleration of
  11731. the camera (pan/tilt movements). 0 is a special case where a static
  11732. camera is simulated.
  11733. @item optalgo
  11734. Set the camera path optimization algorithm.
  11735. Accepted values are:
  11736. @table @samp
  11737. @item gauss
  11738. gaussian kernel low-pass filter on camera motion (default)
  11739. @item avg
  11740. averaging on transformations
  11741. @end table
  11742. @item maxshift
  11743. Set maximal number of pixels to translate frames. Default value is -1,
  11744. meaning no limit.
  11745. @item maxangle
  11746. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  11747. value is -1, meaning no limit.
  11748. @item crop
  11749. Specify how to deal with borders that may be visible due to movement
  11750. compensation.
  11751. Available values are:
  11752. @table @samp
  11753. @item keep
  11754. keep image information from previous frame (default)
  11755. @item black
  11756. fill the border black
  11757. @end table
  11758. @item invert
  11759. Invert transforms if set to 1. Default value is 0.
  11760. @item relative
  11761. Consider transforms as relative to previous frame if set to 1,
  11762. absolute if set to 0. Default value is 0.
  11763. @item zoom
  11764. Set percentage to zoom. A positive value will result in a zoom-in
  11765. effect, a negative value in a zoom-out effect. Default value is 0 (no
  11766. zoom).
  11767. @item optzoom
  11768. Set optimal zooming to avoid borders.
  11769. Accepted values are:
  11770. @table @samp
  11771. @item 0
  11772. disabled
  11773. @item 1
  11774. optimal static zoom value is determined (only very strong movements
  11775. will lead to visible borders) (default)
  11776. @item 2
  11777. optimal adaptive zoom value is determined (no borders will be
  11778. visible), see @option{zoomspeed}
  11779. @end table
  11780. Note that the value given at zoom is added to the one calculated here.
  11781. @item zoomspeed
  11782. Set percent to zoom maximally each frame (enabled when
  11783. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  11784. 0.25.
  11785. @item interpol
  11786. Specify type of interpolation.
  11787. Available values are:
  11788. @table @samp
  11789. @item no
  11790. no interpolation
  11791. @item linear
  11792. linear only horizontal
  11793. @item bilinear
  11794. linear in both directions (default)
  11795. @item bicubic
  11796. cubic in both directions (slow)
  11797. @end table
  11798. @item tripod
  11799. Enable virtual tripod mode if set to 1, which is equivalent to
  11800. @code{relative=0:smoothing=0}. Default value is 0.
  11801. Use also @code{tripod} option of @ref{vidstabdetect}.
  11802. @item debug
  11803. Increase log verbosity if set to 1. Also the detected global motions
  11804. are written to the temporary file @file{global_motions.trf}. Default
  11805. value is 0.
  11806. @end table
  11807. @subsection Examples
  11808. @itemize
  11809. @item
  11810. Use @command{ffmpeg} for a typical stabilization with default values:
  11811. @example
  11812. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  11813. @end example
  11814. Note the use of the @ref{unsharp} filter which is always recommended.
  11815. @item
  11816. Zoom in a bit more and load transform data from a given file:
  11817. @example
  11818. vidstabtransform=zoom=5:input="mytransforms.trf"
  11819. @end example
  11820. @item
  11821. Smoothen the video even more:
  11822. @example
  11823. vidstabtransform=smoothing=30
  11824. @end example
  11825. @end itemize
  11826. @section vflip
  11827. Flip the input video vertically.
  11828. For example, to vertically flip a video with @command{ffmpeg}:
  11829. @example
  11830. ffmpeg -i in.avi -vf "vflip" out.avi
  11831. @end example
  11832. @anchor{vignette}
  11833. @section vignette
  11834. Make or reverse a natural vignetting effect.
  11835. The filter accepts the following options:
  11836. @table @option
  11837. @item angle, a
  11838. Set lens angle expression as a number of radians.
  11839. The value is clipped in the @code{[0,PI/2]} range.
  11840. Default value: @code{"PI/5"}
  11841. @item x0
  11842. @item y0
  11843. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  11844. by default.
  11845. @item mode
  11846. Set forward/backward mode.
  11847. Available modes are:
  11848. @table @samp
  11849. @item forward
  11850. The larger the distance from the central point, the darker the image becomes.
  11851. @item backward
  11852. The larger the distance from the central point, the brighter the image becomes.
  11853. This can be used to reverse a vignette effect, though there is no automatic
  11854. detection to extract the lens @option{angle} and other settings (yet). It can
  11855. also be used to create a burning effect.
  11856. @end table
  11857. Default value is @samp{forward}.
  11858. @item eval
  11859. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  11860. It accepts the following values:
  11861. @table @samp
  11862. @item init
  11863. Evaluate expressions only once during the filter initialization.
  11864. @item frame
  11865. Evaluate expressions for each incoming frame. This is way slower than the
  11866. @samp{init} mode since it requires all the scalers to be re-computed, but it
  11867. allows advanced dynamic expressions.
  11868. @end table
  11869. Default value is @samp{init}.
  11870. @item dither
  11871. Set dithering to reduce the circular banding effects. Default is @code{1}
  11872. (enabled).
  11873. @item aspect
  11874. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  11875. Setting this value to the SAR of the input will make a rectangular vignetting
  11876. following the dimensions of the video.
  11877. Default is @code{1/1}.
  11878. @end table
  11879. @subsection Expressions
  11880. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  11881. following parameters.
  11882. @table @option
  11883. @item w
  11884. @item h
  11885. input width and height
  11886. @item n
  11887. the number of input frame, starting from 0
  11888. @item pts
  11889. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  11890. @var{TB} units, NAN if undefined
  11891. @item r
  11892. frame rate of the input video, NAN if the input frame rate is unknown
  11893. @item t
  11894. the PTS (Presentation TimeStamp) of the filtered video frame,
  11895. expressed in seconds, NAN if undefined
  11896. @item tb
  11897. time base of the input video
  11898. @end table
  11899. @subsection Examples
  11900. @itemize
  11901. @item
  11902. Apply simple strong vignetting effect:
  11903. @example
  11904. vignette=PI/4
  11905. @end example
  11906. @item
  11907. Make a flickering vignetting:
  11908. @example
  11909. vignette='PI/4+random(1)*PI/50':eval=frame
  11910. @end example
  11911. @end itemize
  11912. @section vmafmotion
  11913. Obtain the average vmaf motion score of a video.
  11914. It is one of the component filters of VMAF.
  11915. The obtained average motion score is printed through the logging system.
  11916. In the below example the input file @file{ref.mpg} is being processed and score
  11917. is computed.
  11918. @example
  11919. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  11920. @end example
  11921. @section vstack
  11922. Stack input videos vertically.
  11923. All streams must be of same pixel format and of same width.
  11924. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  11925. to create same output.
  11926. The filter accept the following option:
  11927. @table @option
  11928. @item inputs
  11929. Set number of input streams. Default is 2.
  11930. @item shortest
  11931. If set to 1, force the output to terminate when the shortest input
  11932. terminates. Default value is 0.
  11933. @end table
  11934. @section w3fdif
  11935. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  11936. Deinterlacing Filter").
  11937. Based on the process described by Martin Weston for BBC R&D, and
  11938. implemented based on the de-interlace algorithm written by Jim
  11939. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  11940. uses filter coefficients calculated by BBC R&D.
  11941. There are two sets of filter coefficients, so called "simple":
  11942. and "complex". Which set of filter coefficients is used can
  11943. be set by passing an optional parameter:
  11944. @table @option
  11945. @item filter
  11946. Set the interlacing filter coefficients. Accepts one of the following values:
  11947. @table @samp
  11948. @item simple
  11949. Simple filter coefficient set.
  11950. @item complex
  11951. More-complex filter coefficient set.
  11952. @end table
  11953. Default value is @samp{complex}.
  11954. @item deint
  11955. Specify which frames to deinterlace. Accept one of the following values:
  11956. @table @samp
  11957. @item all
  11958. Deinterlace all frames,
  11959. @item interlaced
  11960. Only deinterlace frames marked as interlaced.
  11961. @end table
  11962. Default value is @samp{all}.
  11963. @end table
  11964. @section waveform
  11965. Video waveform monitor.
  11966. The waveform monitor plots color component intensity. By default luminance
  11967. only. Each column of the waveform corresponds to a column of pixels in the
  11968. source video.
  11969. It accepts the following options:
  11970. @table @option
  11971. @item mode, m
  11972. Can be either @code{row}, or @code{column}. Default is @code{column}.
  11973. In row mode, the graph on the left side represents color component value 0 and
  11974. the right side represents value = 255. In column mode, the top side represents
  11975. color component value = 0 and bottom side represents value = 255.
  11976. @item intensity, i
  11977. Set intensity. Smaller values are useful to find out how many values of the same
  11978. luminance are distributed across input rows/columns.
  11979. Default value is @code{0.04}. Allowed range is [0, 1].
  11980. @item mirror, r
  11981. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  11982. In mirrored mode, higher values will be represented on the left
  11983. side for @code{row} mode and at the top for @code{column} mode. Default is
  11984. @code{1} (mirrored).
  11985. @item display, d
  11986. Set display mode.
  11987. It accepts the following values:
  11988. @table @samp
  11989. @item overlay
  11990. Presents information identical to that in the @code{parade}, except
  11991. that the graphs representing color components are superimposed directly
  11992. over one another.
  11993. This display mode makes it easier to spot relative differences or similarities
  11994. in overlapping areas of the color components that are supposed to be identical,
  11995. such as neutral whites, grays, or blacks.
  11996. @item stack
  11997. Display separate graph for the color components side by side in
  11998. @code{row} mode or one below the other in @code{column} mode.
  11999. @item parade
  12000. Display separate graph for the color components side by side in
  12001. @code{column} mode or one below the other in @code{row} mode.
  12002. Using this display mode makes it easy to spot color casts in the highlights
  12003. and shadows of an image, by comparing the contours of the top and the bottom
  12004. graphs of each waveform. Since whites, grays, and blacks are characterized
  12005. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  12006. should display three waveforms of roughly equal width/height. If not, the
  12007. correction is easy to perform by making level adjustments the three waveforms.
  12008. @end table
  12009. Default is @code{stack}.
  12010. @item components, c
  12011. Set which color components to display. Default is 1, which means only luminance
  12012. or red color component if input is in RGB colorspace. If is set for example to
  12013. 7 it will display all 3 (if) available color components.
  12014. @item envelope, e
  12015. @table @samp
  12016. @item none
  12017. No envelope, this is default.
  12018. @item instant
  12019. Instant envelope, minimum and maximum values presented in graph will be easily
  12020. visible even with small @code{step} value.
  12021. @item peak
  12022. Hold minimum and maximum values presented in graph across time. This way you
  12023. can still spot out of range values without constantly looking at waveforms.
  12024. @item peak+instant
  12025. Peak and instant envelope combined together.
  12026. @end table
  12027. @item filter, f
  12028. @table @samp
  12029. @item lowpass
  12030. No filtering, this is default.
  12031. @item flat
  12032. Luma and chroma combined together.
  12033. @item aflat
  12034. Similar as above, but shows difference between blue and red chroma.
  12035. @item chroma
  12036. Displays only chroma.
  12037. @item color
  12038. Displays actual color value on waveform.
  12039. @item acolor
  12040. Similar as above, but with luma showing frequency of chroma values.
  12041. @end table
  12042. @item graticule, g
  12043. Set which graticule to display.
  12044. @table @samp
  12045. @item none
  12046. Do not display graticule.
  12047. @item green
  12048. Display green graticule showing legal broadcast ranges.
  12049. @end table
  12050. @item opacity, o
  12051. Set graticule opacity.
  12052. @item flags, fl
  12053. Set graticule flags.
  12054. @table @samp
  12055. @item numbers
  12056. Draw numbers above lines. By default enabled.
  12057. @item dots
  12058. Draw dots instead of lines.
  12059. @end table
  12060. @item scale, s
  12061. Set scale used for displaying graticule.
  12062. @table @samp
  12063. @item digital
  12064. @item millivolts
  12065. @item ire
  12066. @end table
  12067. Default is digital.
  12068. @item bgopacity, b
  12069. Set background opacity.
  12070. @end table
  12071. @section weave, doubleweave
  12072. The @code{weave} takes a field-based video input and join
  12073. each two sequential fields into single frame, producing a new double
  12074. height clip with half the frame rate and half the frame count.
  12075. The @code{doubleweave} works same as @code{weave} but without
  12076. halving frame rate and frame count.
  12077. It accepts the following option:
  12078. @table @option
  12079. @item first_field
  12080. Set first field. Available values are:
  12081. @table @samp
  12082. @item top, t
  12083. Set the frame as top-field-first.
  12084. @item bottom, b
  12085. Set the frame as bottom-field-first.
  12086. @end table
  12087. @end table
  12088. @subsection Examples
  12089. @itemize
  12090. @item
  12091. Interlace video using @ref{select} and @ref{separatefields} filter:
  12092. @example
  12093. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  12094. @end example
  12095. @end itemize
  12096. @section xbr
  12097. Apply the xBR high-quality magnification filter which is designed for pixel
  12098. art. It follows a set of edge-detection rules, see
  12099. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  12100. It accepts the following option:
  12101. @table @option
  12102. @item n
  12103. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  12104. @code{3xBR} and @code{4} for @code{4xBR}.
  12105. Default is @code{3}.
  12106. @end table
  12107. @anchor{yadif}
  12108. @section yadif
  12109. Deinterlace the input video ("yadif" means "yet another deinterlacing
  12110. filter").
  12111. It accepts the following parameters:
  12112. @table @option
  12113. @item mode
  12114. The interlacing mode to adopt. It accepts one of the following values:
  12115. @table @option
  12116. @item 0, send_frame
  12117. Output one frame for each frame.
  12118. @item 1, send_field
  12119. Output one frame for each field.
  12120. @item 2, send_frame_nospatial
  12121. Like @code{send_frame}, but it skips the spatial interlacing check.
  12122. @item 3, send_field_nospatial
  12123. Like @code{send_field}, but it skips the spatial interlacing check.
  12124. @end table
  12125. The default value is @code{send_frame}.
  12126. @item parity
  12127. The picture field parity assumed for the input interlaced video. It accepts one
  12128. of the following values:
  12129. @table @option
  12130. @item 0, tff
  12131. Assume the top field is first.
  12132. @item 1, bff
  12133. Assume the bottom field is first.
  12134. @item -1, auto
  12135. Enable automatic detection of field parity.
  12136. @end table
  12137. The default value is @code{auto}.
  12138. If the interlacing is unknown or the decoder does not export this information,
  12139. top field first will be assumed.
  12140. @item deint
  12141. Specify which frames to deinterlace. Accept one of the following
  12142. values:
  12143. @table @option
  12144. @item 0, all
  12145. Deinterlace all frames.
  12146. @item 1, interlaced
  12147. Only deinterlace frames marked as interlaced.
  12148. @end table
  12149. The default value is @code{all}.
  12150. @end table
  12151. @section zoompan
  12152. Apply Zoom & Pan effect.
  12153. This filter accepts the following options:
  12154. @table @option
  12155. @item zoom, z
  12156. Set the zoom expression. Default is 1.
  12157. @item x
  12158. @item y
  12159. Set the x and y expression. Default is 0.
  12160. @item d
  12161. Set the duration expression in number of frames.
  12162. This sets for how many number of frames effect will last for
  12163. single input image.
  12164. @item s
  12165. Set the output image size, default is 'hd720'.
  12166. @item fps
  12167. Set the output frame rate, default is '25'.
  12168. @end table
  12169. Each expression can contain the following constants:
  12170. @table @option
  12171. @item in_w, iw
  12172. Input width.
  12173. @item in_h, ih
  12174. Input height.
  12175. @item out_w, ow
  12176. Output width.
  12177. @item out_h, oh
  12178. Output height.
  12179. @item in
  12180. Input frame count.
  12181. @item on
  12182. Output frame count.
  12183. @item x
  12184. @item y
  12185. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  12186. for current input frame.
  12187. @item px
  12188. @item py
  12189. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  12190. not yet such frame (first input frame).
  12191. @item zoom
  12192. Last calculated zoom from 'z' expression for current input frame.
  12193. @item pzoom
  12194. Last calculated zoom of last output frame of previous input frame.
  12195. @item duration
  12196. Number of output frames for current input frame. Calculated from 'd' expression
  12197. for each input frame.
  12198. @item pduration
  12199. number of output frames created for previous input frame
  12200. @item a
  12201. Rational number: input width / input height
  12202. @item sar
  12203. sample aspect ratio
  12204. @item dar
  12205. display aspect ratio
  12206. @end table
  12207. @subsection Examples
  12208. @itemize
  12209. @item
  12210. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  12211. @example
  12212. 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
  12213. @end example
  12214. @item
  12215. Zoom-in up to 1.5 and pan always at center of picture:
  12216. @example
  12217. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12218. @end example
  12219. @item
  12220. Same as above but without pausing:
  12221. @example
  12222. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12223. @end example
  12224. @end itemize
  12225. @anchor{zscale}
  12226. @section zscale
  12227. Scale (resize) the input video, using the z.lib library:
  12228. https://github.com/sekrit-twc/zimg.
  12229. The zscale filter forces the output display aspect ratio to be the same
  12230. as the input, by changing the output sample aspect ratio.
  12231. If the input image format is different from the format requested by
  12232. the next filter, the zscale filter will convert the input to the
  12233. requested format.
  12234. @subsection Options
  12235. The filter accepts the following options.
  12236. @table @option
  12237. @item width, w
  12238. @item height, h
  12239. Set the output video dimension expression. Default value is the input
  12240. dimension.
  12241. If the @var{width} or @var{w} value is 0, the input width is used for
  12242. the output. If the @var{height} or @var{h} value is 0, the input height
  12243. is used for the output.
  12244. If one and only one of the values is -n with n >= 1, the zscale filter
  12245. will use a value that maintains the aspect ratio of the input image,
  12246. calculated from the other specified dimension. After that it will,
  12247. however, make sure that the calculated dimension is divisible by n and
  12248. adjust the value if necessary.
  12249. If both values are -n with n >= 1, the behavior will be identical to
  12250. both values being set to 0 as previously detailed.
  12251. See below for the list of accepted constants for use in the dimension
  12252. expression.
  12253. @item size, s
  12254. Set the video size. For the syntax of this option, check the
  12255. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12256. @item dither, d
  12257. Set the dither type.
  12258. Possible values are:
  12259. @table @var
  12260. @item none
  12261. @item ordered
  12262. @item random
  12263. @item error_diffusion
  12264. @end table
  12265. Default is none.
  12266. @item filter, f
  12267. Set the resize filter type.
  12268. Possible values are:
  12269. @table @var
  12270. @item point
  12271. @item bilinear
  12272. @item bicubic
  12273. @item spline16
  12274. @item spline36
  12275. @item lanczos
  12276. @end table
  12277. Default is bilinear.
  12278. @item range, r
  12279. Set the color range.
  12280. Possible values are:
  12281. @table @var
  12282. @item input
  12283. @item limited
  12284. @item full
  12285. @end table
  12286. Default is same as input.
  12287. @item primaries, p
  12288. Set the color primaries.
  12289. Possible values are:
  12290. @table @var
  12291. @item input
  12292. @item 709
  12293. @item unspecified
  12294. @item 170m
  12295. @item 240m
  12296. @item 2020
  12297. @end table
  12298. Default is same as input.
  12299. @item transfer, t
  12300. Set the transfer characteristics.
  12301. Possible values are:
  12302. @table @var
  12303. @item input
  12304. @item 709
  12305. @item unspecified
  12306. @item 601
  12307. @item linear
  12308. @item 2020_10
  12309. @item 2020_12
  12310. @item smpte2084
  12311. @item iec61966-2-1
  12312. @item arib-std-b67
  12313. @end table
  12314. Default is same as input.
  12315. @item matrix, m
  12316. Set the colorspace matrix.
  12317. Possible value are:
  12318. @table @var
  12319. @item input
  12320. @item 709
  12321. @item unspecified
  12322. @item 470bg
  12323. @item 170m
  12324. @item 2020_ncl
  12325. @item 2020_cl
  12326. @end table
  12327. Default is same as input.
  12328. @item rangein, rin
  12329. Set the input color range.
  12330. Possible values are:
  12331. @table @var
  12332. @item input
  12333. @item limited
  12334. @item full
  12335. @end table
  12336. Default is same as input.
  12337. @item primariesin, pin
  12338. Set the input color primaries.
  12339. Possible values are:
  12340. @table @var
  12341. @item input
  12342. @item 709
  12343. @item unspecified
  12344. @item 170m
  12345. @item 240m
  12346. @item 2020
  12347. @end table
  12348. Default is same as input.
  12349. @item transferin, tin
  12350. Set the input transfer characteristics.
  12351. Possible values are:
  12352. @table @var
  12353. @item input
  12354. @item 709
  12355. @item unspecified
  12356. @item 601
  12357. @item linear
  12358. @item 2020_10
  12359. @item 2020_12
  12360. @end table
  12361. Default is same as input.
  12362. @item matrixin, min
  12363. Set the input colorspace matrix.
  12364. Possible value are:
  12365. @table @var
  12366. @item input
  12367. @item 709
  12368. @item unspecified
  12369. @item 470bg
  12370. @item 170m
  12371. @item 2020_ncl
  12372. @item 2020_cl
  12373. @end table
  12374. @item chromal, c
  12375. Set the output chroma location.
  12376. Possible values are:
  12377. @table @var
  12378. @item input
  12379. @item left
  12380. @item center
  12381. @item topleft
  12382. @item top
  12383. @item bottomleft
  12384. @item bottom
  12385. @end table
  12386. @item chromalin, cin
  12387. Set the input chroma location.
  12388. Possible values are:
  12389. @table @var
  12390. @item input
  12391. @item left
  12392. @item center
  12393. @item topleft
  12394. @item top
  12395. @item bottomleft
  12396. @item bottom
  12397. @end table
  12398. @item npl
  12399. Set the nominal peak luminance.
  12400. @end table
  12401. The values of the @option{w} and @option{h} options are expressions
  12402. containing the following constants:
  12403. @table @var
  12404. @item in_w
  12405. @item in_h
  12406. The input width and height
  12407. @item iw
  12408. @item ih
  12409. These are the same as @var{in_w} and @var{in_h}.
  12410. @item out_w
  12411. @item out_h
  12412. The output (scaled) width and height
  12413. @item ow
  12414. @item oh
  12415. These are the same as @var{out_w} and @var{out_h}
  12416. @item a
  12417. The same as @var{iw} / @var{ih}
  12418. @item sar
  12419. input sample aspect ratio
  12420. @item dar
  12421. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12422. @item hsub
  12423. @item vsub
  12424. horizontal and vertical input chroma subsample values. For example for the
  12425. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12426. @item ohsub
  12427. @item ovsub
  12428. horizontal and vertical output chroma subsample values. For example for the
  12429. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12430. @end table
  12431. @table @option
  12432. @end table
  12433. @c man end VIDEO FILTERS
  12434. @chapter Video Sources
  12435. @c man begin VIDEO SOURCES
  12436. Below is a description of the currently available video sources.
  12437. @section buffer
  12438. Buffer video frames, and make them available to the filter chain.
  12439. This source is mainly intended for a programmatic use, in particular
  12440. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  12441. It accepts the following parameters:
  12442. @table @option
  12443. @item video_size
  12444. Specify the size (width and height) of the buffered video frames. For the
  12445. syntax of this option, check the
  12446. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12447. @item width
  12448. The input video width.
  12449. @item height
  12450. The input video height.
  12451. @item pix_fmt
  12452. A string representing the pixel format of the buffered video frames.
  12453. It may be a number corresponding to a pixel format, or a pixel format
  12454. name.
  12455. @item time_base
  12456. Specify the timebase assumed by the timestamps of the buffered frames.
  12457. @item frame_rate
  12458. Specify the frame rate expected for the video stream.
  12459. @item pixel_aspect, sar
  12460. The sample (pixel) aspect ratio of the input video.
  12461. @item sws_param
  12462. Specify the optional parameters to be used for the scale filter which
  12463. is automatically inserted when an input change is detected in the
  12464. input size or format.
  12465. @item hw_frames_ctx
  12466. When using a hardware pixel format, this should be a reference to an
  12467. AVHWFramesContext describing input frames.
  12468. @end table
  12469. For example:
  12470. @example
  12471. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  12472. @end example
  12473. will instruct the source to accept video frames with size 320x240 and
  12474. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  12475. square pixels (1:1 sample aspect ratio).
  12476. Since the pixel format with name "yuv410p" corresponds to the number 6
  12477. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  12478. this example corresponds to:
  12479. @example
  12480. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  12481. @end example
  12482. Alternatively, the options can be specified as a flat string, but this
  12483. syntax is deprecated:
  12484. @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}]
  12485. @section cellauto
  12486. Create a pattern generated by an elementary cellular automaton.
  12487. The initial state of the cellular automaton can be defined through the
  12488. @option{filename} and @option{pattern} options. If such options are
  12489. not specified an initial state is created randomly.
  12490. At each new frame a new row in the video is filled with the result of
  12491. the cellular automaton next generation. The behavior when the whole
  12492. frame is filled is defined by the @option{scroll} option.
  12493. This source accepts the following options:
  12494. @table @option
  12495. @item filename, f
  12496. Read the initial cellular automaton state, i.e. the starting row, from
  12497. the specified file.
  12498. In the file, each non-whitespace character is considered an alive
  12499. cell, a newline will terminate the row, and further characters in the
  12500. file will be ignored.
  12501. @item pattern, p
  12502. Read the initial cellular automaton state, i.e. the starting row, from
  12503. the specified string.
  12504. Each non-whitespace character in the string is considered an alive
  12505. cell, a newline will terminate the row, and further characters in the
  12506. string will be ignored.
  12507. @item rate, r
  12508. Set the video rate, that is the number of frames generated per second.
  12509. Default is 25.
  12510. @item random_fill_ratio, ratio
  12511. Set the random fill ratio for the initial cellular automaton row. It
  12512. is a floating point number value ranging from 0 to 1, defaults to
  12513. 1/PHI.
  12514. This option is ignored when a file or a pattern is specified.
  12515. @item random_seed, seed
  12516. Set the seed for filling randomly the initial row, must be an integer
  12517. included between 0 and UINT32_MAX. If not specified, or if explicitly
  12518. set to -1, the filter will try to use a good random seed on a best
  12519. effort basis.
  12520. @item rule
  12521. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  12522. Default value is 110.
  12523. @item size, s
  12524. Set the size of the output video. For the syntax of this option, check the
  12525. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12526. If @option{filename} or @option{pattern} is specified, the size is set
  12527. by default to the width of the specified initial state row, and the
  12528. height is set to @var{width} * PHI.
  12529. If @option{size} is set, it must contain the width of the specified
  12530. pattern string, and the specified pattern will be centered in the
  12531. larger row.
  12532. If a filename or a pattern string is not specified, the size value
  12533. defaults to "320x518" (used for a randomly generated initial state).
  12534. @item scroll
  12535. If set to 1, scroll the output upward when all the rows in the output
  12536. have been already filled. If set to 0, the new generated row will be
  12537. written over the top row just after the bottom row is filled.
  12538. Defaults to 1.
  12539. @item start_full, full
  12540. If set to 1, completely fill the output with generated rows before
  12541. outputting the first frame.
  12542. This is the default behavior, for disabling set the value to 0.
  12543. @item stitch
  12544. If set to 1, stitch the left and right row edges together.
  12545. This is the default behavior, for disabling set the value to 0.
  12546. @end table
  12547. @subsection Examples
  12548. @itemize
  12549. @item
  12550. Read the initial state from @file{pattern}, and specify an output of
  12551. size 200x400.
  12552. @example
  12553. cellauto=f=pattern:s=200x400
  12554. @end example
  12555. @item
  12556. Generate a random initial row with a width of 200 cells, with a fill
  12557. ratio of 2/3:
  12558. @example
  12559. cellauto=ratio=2/3:s=200x200
  12560. @end example
  12561. @item
  12562. Create a pattern generated by rule 18 starting by a single alive cell
  12563. centered on an initial row with width 100:
  12564. @example
  12565. cellauto=p=@@:s=100x400:full=0:rule=18
  12566. @end example
  12567. @item
  12568. Specify a more elaborated initial pattern:
  12569. @example
  12570. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  12571. @end example
  12572. @end itemize
  12573. @anchor{coreimagesrc}
  12574. @section coreimagesrc
  12575. Video source generated on GPU using Apple's CoreImage API on OSX.
  12576. This video source is a specialized version of the @ref{coreimage} video filter.
  12577. Use a core image generator at the beginning of the applied filterchain to
  12578. generate the content.
  12579. The coreimagesrc video source accepts the following options:
  12580. @table @option
  12581. @item list_generators
  12582. List all available generators along with all their respective options as well as
  12583. possible minimum and maximum values along with the default values.
  12584. @example
  12585. list_generators=true
  12586. @end example
  12587. @item size, s
  12588. Specify the size of the sourced video. For the syntax of this option, check the
  12589. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12590. The default value is @code{320x240}.
  12591. @item rate, r
  12592. Specify the frame rate of the sourced video, as the number of frames
  12593. generated per second. It has to be a string in the format
  12594. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12595. number or a valid video frame rate abbreviation. The default value is
  12596. "25".
  12597. @item sar
  12598. Set the sample aspect ratio of the sourced video.
  12599. @item duration, d
  12600. Set the duration of the sourced video. See
  12601. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12602. for the accepted syntax.
  12603. If not specified, or the expressed duration is negative, the video is
  12604. supposed to be generated forever.
  12605. @end table
  12606. Additionally, all options of the @ref{coreimage} video filter are accepted.
  12607. A complete filterchain can be used for further processing of the
  12608. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  12609. and examples for details.
  12610. @subsection Examples
  12611. @itemize
  12612. @item
  12613. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  12614. given as complete and escaped command-line for Apple's standard bash shell:
  12615. @example
  12616. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  12617. @end example
  12618. This example is equivalent to the QRCode example of @ref{coreimage} without the
  12619. need for a nullsrc video source.
  12620. @end itemize
  12621. @section mandelbrot
  12622. Generate a Mandelbrot set fractal, and progressively zoom towards the
  12623. point specified with @var{start_x} and @var{start_y}.
  12624. This source accepts the following options:
  12625. @table @option
  12626. @item end_pts
  12627. Set the terminal pts value. Default value is 400.
  12628. @item end_scale
  12629. Set the terminal scale value.
  12630. Must be a floating point value. Default value is 0.3.
  12631. @item inner
  12632. Set the inner coloring mode, that is the algorithm used to draw the
  12633. Mandelbrot fractal internal region.
  12634. It shall assume one of the following values:
  12635. @table @option
  12636. @item black
  12637. Set black mode.
  12638. @item convergence
  12639. Show time until convergence.
  12640. @item mincol
  12641. Set color based on point closest to the origin of the iterations.
  12642. @item period
  12643. Set period mode.
  12644. @end table
  12645. Default value is @var{mincol}.
  12646. @item bailout
  12647. Set the bailout value. Default value is 10.0.
  12648. @item maxiter
  12649. Set the maximum of iterations performed by the rendering
  12650. algorithm. Default value is 7189.
  12651. @item outer
  12652. Set outer coloring mode.
  12653. It shall assume one of following values:
  12654. @table @option
  12655. @item iteration_count
  12656. Set iteration cound mode.
  12657. @item normalized_iteration_count
  12658. set normalized iteration count mode.
  12659. @end table
  12660. Default value is @var{normalized_iteration_count}.
  12661. @item rate, r
  12662. Set frame rate, expressed as number of frames per second. Default
  12663. value is "25".
  12664. @item size, s
  12665. Set frame size. For the syntax of this option, check the "Video
  12666. size" section in the ffmpeg-utils manual. Default value is "640x480".
  12667. @item start_scale
  12668. Set the initial scale value. Default value is 3.0.
  12669. @item start_x
  12670. Set the initial x position. Must be a floating point value between
  12671. -100 and 100. Default value is -0.743643887037158704752191506114774.
  12672. @item start_y
  12673. Set the initial y position. Must be a floating point value between
  12674. -100 and 100. Default value is -0.131825904205311970493132056385139.
  12675. @end table
  12676. @section mptestsrc
  12677. Generate various test patterns, as generated by the MPlayer test filter.
  12678. The size of the generated video is fixed, and is 256x256.
  12679. This source is useful in particular for testing encoding features.
  12680. This source accepts the following options:
  12681. @table @option
  12682. @item rate, r
  12683. Specify the frame rate of the sourced video, as the number of frames
  12684. generated per second. It has to be a string in the format
  12685. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12686. number or a valid video frame rate abbreviation. The default value is
  12687. "25".
  12688. @item duration, d
  12689. Set the duration of the sourced video. See
  12690. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12691. for the accepted syntax.
  12692. If not specified, or the expressed duration is negative, the video is
  12693. supposed to be generated forever.
  12694. @item test, t
  12695. Set the number or the name of the test to perform. Supported tests are:
  12696. @table @option
  12697. @item dc_luma
  12698. @item dc_chroma
  12699. @item freq_luma
  12700. @item freq_chroma
  12701. @item amp_luma
  12702. @item amp_chroma
  12703. @item cbp
  12704. @item mv
  12705. @item ring1
  12706. @item ring2
  12707. @item all
  12708. @end table
  12709. Default value is "all", which will cycle through the list of all tests.
  12710. @end table
  12711. Some examples:
  12712. @example
  12713. mptestsrc=t=dc_luma
  12714. @end example
  12715. will generate a "dc_luma" test pattern.
  12716. @section frei0r_src
  12717. Provide a frei0r source.
  12718. To enable compilation of this filter you need to install the frei0r
  12719. header and configure FFmpeg with @code{--enable-frei0r}.
  12720. This source accepts the following parameters:
  12721. @table @option
  12722. @item size
  12723. The size of the video to generate. For the syntax of this option, check the
  12724. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12725. @item framerate
  12726. The framerate of the generated video. It may be a string of the form
  12727. @var{num}/@var{den} or a frame rate abbreviation.
  12728. @item filter_name
  12729. The name to the frei0r source to load. For more information regarding frei0r and
  12730. how to set the parameters, read the @ref{frei0r} section in the video filters
  12731. documentation.
  12732. @item filter_params
  12733. A '|'-separated list of parameters to pass to the frei0r source.
  12734. @end table
  12735. For example, to generate a frei0r partik0l source with size 200x200
  12736. and frame rate 10 which is overlaid on the overlay filter main input:
  12737. @example
  12738. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  12739. @end example
  12740. @section life
  12741. Generate a life pattern.
  12742. This source is based on a generalization of John Conway's life game.
  12743. The sourced input represents a life grid, each pixel represents a cell
  12744. which can be in one of two possible states, alive or dead. Every cell
  12745. interacts with its eight neighbours, which are the cells that are
  12746. horizontally, vertically, or diagonally adjacent.
  12747. At each interaction the grid evolves according to the adopted rule,
  12748. which specifies the number of neighbor alive cells which will make a
  12749. cell stay alive or born. The @option{rule} option allows one to specify
  12750. the rule to adopt.
  12751. This source accepts the following options:
  12752. @table @option
  12753. @item filename, f
  12754. Set the file from which to read the initial grid state. In the file,
  12755. each non-whitespace character is considered an alive cell, and newline
  12756. is used to delimit the end of each row.
  12757. If this option is not specified, the initial grid is generated
  12758. randomly.
  12759. @item rate, r
  12760. Set the video rate, that is the number of frames generated per second.
  12761. Default is 25.
  12762. @item random_fill_ratio, ratio
  12763. Set the random fill ratio for the initial random grid. It is a
  12764. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  12765. It is ignored when a file is specified.
  12766. @item random_seed, seed
  12767. Set the seed for filling the initial random grid, must be an integer
  12768. included between 0 and UINT32_MAX. If not specified, or if explicitly
  12769. set to -1, the filter will try to use a good random seed on a best
  12770. effort basis.
  12771. @item rule
  12772. Set the life rule.
  12773. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  12774. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  12775. @var{NS} specifies the number of alive neighbor cells which make a
  12776. live cell stay alive, and @var{NB} the number of alive neighbor cells
  12777. which make a dead cell to become alive (i.e. to "born").
  12778. "s" and "b" can be used in place of "S" and "B", respectively.
  12779. Alternatively a rule can be specified by an 18-bits integer. The 9
  12780. high order bits are used to encode the next cell state if it is alive
  12781. for each number of neighbor alive cells, the low order bits specify
  12782. the rule for "borning" new cells. Higher order bits encode for an
  12783. higher number of neighbor cells.
  12784. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  12785. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  12786. Default value is "S23/B3", which is the original Conway's game of life
  12787. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  12788. cells, and will born a new cell if there are three alive cells around
  12789. a dead cell.
  12790. @item size, s
  12791. Set the size of the output video. For the syntax of this option, check the
  12792. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12793. If @option{filename} is specified, the size is set by default to the
  12794. same size of the input file. If @option{size} is set, it must contain
  12795. the size specified in the input file, and the initial grid defined in
  12796. that file is centered in the larger resulting area.
  12797. If a filename is not specified, the size value defaults to "320x240"
  12798. (used for a randomly generated initial grid).
  12799. @item stitch
  12800. If set to 1, stitch the left and right grid edges together, and the
  12801. top and bottom edges also. Defaults to 1.
  12802. @item mold
  12803. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  12804. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  12805. value from 0 to 255.
  12806. @item life_color
  12807. Set the color of living (or new born) cells.
  12808. @item death_color
  12809. Set the color of dead cells. If @option{mold} is set, this is the first color
  12810. used to represent a dead cell.
  12811. @item mold_color
  12812. Set mold color, for definitely dead and moldy cells.
  12813. For the syntax of these 3 color options, check the "Color" section in the
  12814. ffmpeg-utils manual.
  12815. @end table
  12816. @subsection Examples
  12817. @itemize
  12818. @item
  12819. Read a grid from @file{pattern}, and center it on a grid of size
  12820. 300x300 pixels:
  12821. @example
  12822. life=f=pattern:s=300x300
  12823. @end example
  12824. @item
  12825. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  12826. @example
  12827. life=ratio=2/3:s=200x200
  12828. @end example
  12829. @item
  12830. Specify a custom rule for evolving a randomly generated grid:
  12831. @example
  12832. life=rule=S14/B34
  12833. @end example
  12834. @item
  12835. Full example with slow death effect (mold) using @command{ffplay}:
  12836. @example
  12837. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  12838. @end example
  12839. @end itemize
  12840. @anchor{allrgb}
  12841. @anchor{allyuv}
  12842. @anchor{color}
  12843. @anchor{haldclutsrc}
  12844. @anchor{nullsrc}
  12845. @anchor{rgbtestsrc}
  12846. @anchor{smptebars}
  12847. @anchor{smptehdbars}
  12848. @anchor{testsrc}
  12849. @anchor{testsrc2}
  12850. @anchor{yuvtestsrc}
  12851. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  12852. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  12853. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  12854. The @code{color} source provides an uniformly colored input.
  12855. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  12856. @ref{haldclut} filter.
  12857. The @code{nullsrc} source returns unprocessed video frames. It is
  12858. mainly useful to be employed in analysis / debugging tools, or as the
  12859. source for filters which ignore the input data.
  12860. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  12861. detecting RGB vs BGR issues. You should see a red, green and blue
  12862. stripe from top to bottom.
  12863. The @code{smptebars} source generates a color bars pattern, based on
  12864. the SMPTE Engineering Guideline EG 1-1990.
  12865. The @code{smptehdbars} source generates a color bars pattern, based on
  12866. the SMPTE RP 219-2002.
  12867. The @code{testsrc} source generates a test video pattern, showing a
  12868. color pattern, a scrolling gradient and a timestamp. This is mainly
  12869. intended for testing purposes.
  12870. The @code{testsrc2} source is similar to testsrc, but supports more
  12871. pixel formats instead of just @code{rgb24}. This allows using it as an
  12872. input for other tests without requiring a format conversion.
  12873. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  12874. see a y, cb and cr stripe from top to bottom.
  12875. The sources accept the following parameters:
  12876. @table @option
  12877. @item alpha
  12878. Specify the alpha (opacity) of the background, only available in the
  12879. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  12880. 255 (fully opaque, the default).
  12881. @item color, c
  12882. Specify the color of the source, only available in the @code{color}
  12883. source. For the syntax of this option, check the "Color" section in the
  12884. ffmpeg-utils manual.
  12885. @item level
  12886. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  12887. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  12888. pixels to be used as identity matrix for 3D lookup tables. Each component is
  12889. coded on a @code{1/(N*N)} scale.
  12890. @item size, s
  12891. Specify the size of the sourced video. For the syntax of this option, check the
  12892. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12893. The default value is @code{320x240}.
  12894. This option is not available with the @code{haldclutsrc} filter.
  12895. @item rate, r
  12896. Specify the frame rate of the sourced video, as the number of frames
  12897. generated per second. It has to be a string in the format
  12898. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12899. number or a valid video frame rate abbreviation. The default value is
  12900. "25".
  12901. @item sar
  12902. Set the sample aspect ratio of the sourced video.
  12903. @item duration, d
  12904. Set the duration of the sourced video. See
  12905. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12906. for the accepted syntax.
  12907. If not specified, or the expressed duration is negative, the video is
  12908. supposed to be generated forever.
  12909. @item decimals, n
  12910. Set the number of decimals to show in the timestamp, only available in the
  12911. @code{testsrc} source.
  12912. The displayed timestamp value will correspond to the original
  12913. timestamp value multiplied by the power of 10 of the specified
  12914. value. Default value is 0.
  12915. @end table
  12916. For example the following:
  12917. @example
  12918. testsrc=duration=5.3:size=qcif:rate=10
  12919. @end example
  12920. will generate a video with a duration of 5.3 seconds, with size
  12921. 176x144 and a frame rate of 10 frames per second.
  12922. The following graph description will generate a red source
  12923. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  12924. frames per second.
  12925. @example
  12926. color=c=red@@0.2:s=qcif:r=10
  12927. @end example
  12928. If the input content is to be ignored, @code{nullsrc} can be used. The
  12929. following command generates noise in the luminance plane by employing
  12930. the @code{geq} filter:
  12931. @example
  12932. nullsrc=s=256x256, geq=random(1)*255:128:128
  12933. @end example
  12934. @subsection Commands
  12935. The @code{color} source supports the following commands:
  12936. @table @option
  12937. @item c, color
  12938. Set the color of the created image. Accepts the same syntax of the
  12939. corresponding @option{color} option.
  12940. @end table
  12941. @c man end VIDEO SOURCES
  12942. @chapter Video Sinks
  12943. @c man begin VIDEO SINKS
  12944. Below is a description of the currently available video sinks.
  12945. @section buffersink
  12946. Buffer video frames, and make them available to the end of the filter
  12947. graph.
  12948. This sink is mainly intended for programmatic use, in particular
  12949. through the interface defined in @file{libavfilter/buffersink.h}
  12950. or the options system.
  12951. It accepts a pointer to an AVBufferSinkContext structure, which
  12952. defines the incoming buffers' formats, to be passed as the opaque
  12953. parameter to @code{avfilter_init_filter} for initialization.
  12954. @section nullsink
  12955. Null video sink: do absolutely nothing with the input video. It is
  12956. mainly useful as a template and for use in analysis / debugging
  12957. tools.
  12958. @c man end VIDEO SINKS
  12959. @chapter Multimedia Filters
  12960. @c man begin MULTIMEDIA FILTERS
  12961. Below is a description of the currently available multimedia filters.
  12962. @section abitscope
  12963. Convert input audio to a video output, displaying the audio bit scope.
  12964. The filter accepts the following options:
  12965. @table @option
  12966. @item rate, r
  12967. Set frame rate, expressed as number of frames per second. Default
  12968. value is "25".
  12969. @item size, s
  12970. Specify the video size for the output. For the syntax of this option, check the
  12971. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12972. Default value is @code{1024x256}.
  12973. @item colors
  12974. Specify list of colors separated by space or by '|' which will be used to
  12975. draw channels. Unrecognized or missing colors will be replaced
  12976. by white color.
  12977. @end table
  12978. @section ahistogram
  12979. Convert input audio to a video output, displaying the volume histogram.
  12980. The filter accepts the following options:
  12981. @table @option
  12982. @item dmode
  12983. Specify how histogram is calculated.
  12984. It accepts the following values:
  12985. @table @samp
  12986. @item single
  12987. Use single histogram for all channels.
  12988. @item separate
  12989. Use separate histogram for each channel.
  12990. @end table
  12991. Default is @code{single}.
  12992. @item rate, r
  12993. Set frame rate, expressed as number of frames per second. Default
  12994. value is "25".
  12995. @item size, s
  12996. Specify the video size for the output. For the syntax of this option, check the
  12997. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12998. Default value is @code{hd720}.
  12999. @item scale
  13000. Set display scale.
  13001. It accepts the following values:
  13002. @table @samp
  13003. @item log
  13004. logarithmic
  13005. @item sqrt
  13006. square root
  13007. @item cbrt
  13008. cubic root
  13009. @item lin
  13010. linear
  13011. @item rlog
  13012. reverse logarithmic
  13013. @end table
  13014. Default is @code{log}.
  13015. @item ascale
  13016. Set amplitude scale.
  13017. It accepts the following values:
  13018. @table @samp
  13019. @item log
  13020. logarithmic
  13021. @item lin
  13022. linear
  13023. @end table
  13024. Default is @code{log}.
  13025. @item acount
  13026. Set how much frames to accumulate in histogram.
  13027. Defauls is 1. Setting this to -1 accumulates all frames.
  13028. @item rheight
  13029. Set histogram ratio of window height.
  13030. @item slide
  13031. Set sonogram sliding.
  13032. It accepts the following values:
  13033. @table @samp
  13034. @item replace
  13035. replace old rows with new ones.
  13036. @item scroll
  13037. scroll from top to bottom.
  13038. @end table
  13039. Default is @code{replace}.
  13040. @end table
  13041. @section aphasemeter
  13042. Convert input audio to a video output, displaying the audio phase.
  13043. The filter accepts the following options:
  13044. @table @option
  13045. @item rate, r
  13046. Set the output frame rate. Default value is @code{25}.
  13047. @item size, s
  13048. Set the video size for the output. For the syntax of this option, check the
  13049. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13050. Default value is @code{800x400}.
  13051. @item rc
  13052. @item gc
  13053. @item bc
  13054. Specify the red, green, blue contrast. Default values are @code{2},
  13055. @code{7} and @code{1}.
  13056. Allowed range is @code{[0, 255]}.
  13057. @item mpc
  13058. Set color which will be used for drawing median phase. If color is
  13059. @code{none} which is default, no median phase value will be drawn.
  13060. @item video
  13061. Enable video output. Default is enabled.
  13062. @end table
  13063. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  13064. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  13065. The @code{-1} means left and right channels are completely out of phase and
  13066. @code{1} means channels are in phase.
  13067. @section avectorscope
  13068. Convert input audio to a video output, representing the audio vector
  13069. scope.
  13070. The filter is used to measure the difference between channels of stereo
  13071. audio stream. A monoaural signal, consisting of identical left and right
  13072. signal, results in straight vertical line. Any stereo separation is visible
  13073. as a deviation from this line, creating a Lissajous figure.
  13074. If the straight (or deviation from it) but horizontal line appears this
  13075. indicates that the left and right channels are out of phase.
  13076. The filter accepts the following options:
  13077. @table @option
  13078. @item mode, m
  13079. Set the vectorscope mode.
  13080. Available values are:
  13081. @table @samp
  13082. @item lissajous
  13083. Lissajous rotated by 45 degrees.
  13084. @item lissajous_xy
  13085. Same as above but not rotated.
  13086. @item polar
  13087. Shape resembling half of circle.
  13088. @end table
  13089. Default value is @samp{lissajous}.
  13090. @item size, s
  13091. Set the video size for the output. For the syntax of this option, check the
  13092. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13093. Default value is @code{400x400}.
  13094. @item rate, r
  13095. Set the output frame rate. Default value is @code{25}.
  13096. @item rc
  13097. @item gc
  13098. @item bc
  13099. @item ac
  13100. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  13101. @code{160}, @code{80} and @code{255}.
  13102. Allowed range is @code{[0, 255]}.
  13103. @item rf
  13104. @item gf
  13105. @item bf
  13106. @item af
  13107. Specify the red, green, blue and alpha fade. Default values are @code{15},
  13108. @code{10}, @code{5} and @code{5}.
  13109. Allowed range is @code{[0, 255]}.
  13110. @item zoom
  13111. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  13112. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  13113. @item draw
  13114. Set the vectorscope drawing mode.
  13115. Available values are:
  13116. @table @samp
  13117. @item dot
  13118. Draw dot for each sample.
  13119. @item line
  13120. Draw line between previous and current sample.
  13121. @end table
  13122. Default value is @samp{dot}.
  13123. @item scale
  13124. Specify amplitude scale of audio samples.
  13125. Available values are:
  13126. @table @samp
  13127. @item lin
  13128. Linear.
  13129. @item sqrt
  13130. Square root.
  13131. @item cbrt
  13132. Cubic root.
  13133. @item log
  13134. Logarithmic.
  13135. @end table
  13136. @item swap
  13137. Swap left channel axis with right channel axis.
  13138. @item mirror
  13139. Mirror axis.
  13140. @table @samp
  13141. @item none
  13142. No mirror.
  13143. @item x
  13144. Mirror only x axis.
  13145. @item y
  13146. Mirror only y axis.
  13147. @item xy
  13148. Mirror both axis.
  13149. @end table
  13150. @end table
  13151. @subsection Examples
  13152. @itemize
  13153. @item
  13154. Complete example using @command{ffplay}:
  13155. @example
  13156. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  13157. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  13158. @end example
  13159. @end itemize
  13160. @section bench, abench
  13161. Benchmark part of a filtergraph.
  13162. The filter accepts the following options:
  13163. @table @option
  13164. @item action
  13165. Start or stop a timer.
  13166. Available values are:
  13167. @table @samp
  13168. @item start
  13169. Get the current time, set it as frame metadata (using the key
  13170. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  13171. @item stop
  13172. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  13173. the input frame metadata to get the time difference. Time difference, average,
  13174. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  13175. @code{min}) are then printed. The timestamps are expressed in seconds.
  13176. @end table
  13177. @end table
  13178. @subsection Examples
  13179. @itemize
  13180. @item
  13181. Benchmark @ref{selectivecolor} filter:
  13182. @example
  13183. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  13184. @end example
  13185. @end itemize
  13186. @section concat
  13187. Concatenate audio and video streams, joining them together one after the
  13188. other.
  13189. The filter works on segments of synchronized video and audio streams. All
  13190. segments must have the same number of streams of each type, and that will
  13191. also be the number of streams at output.
  13192. The filter accepts the following options:
  13193. @table @option
  13194. @item n
  13195. Set the number of segments. Default is 2.
  13196. @item v
  13197. Set the number of output video streams, that is also the number of video
  13198. streams in each segment. Default is 1.
  13199. @item a
  13200. Set the number of output audio streams, that is also the number of audio
  13201. streams in each segment. Default is 0.
  13202. @item unsafe
  13203. Activate unsafe mode: do not fail if segments have a different format.
  13204. @end table
  13205. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  13206. @var{a} audio outputs.
  13207. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  13208. segment, in the same order as the outputs, then the inputs for the second
  13209. segment, etc.
  13210. Related streams do not always have exactly the same duration, for various
  13211. reasons including codec frame size or sloppy authoring. For that reason,
  13212. related synchronized streams (e.g. a video and its audio track) should be
  13213. concatenated at once. The concat filter will use the duration of the longest
  13214. stream in each segment (except the last one), and if necessary pad shorter
  13215. audio streams with silence.
  13216. For this filter to work correctly, all segments must start at timestamp 0.
  13217. All corresponding streams must have the same parameters in all segments; the
  13218. filtering system will automatically select a common pixel format for video
  13219. streams, and a common sample format, sample rate and channel layout for
  13220. audio streams, but other settings, such as resolution, must be converted
  13221. explicitly by the user.
  13222. Different frame rates are acceptable but will result in variable frame rate
  13223. at output; be sure to configure the output file to handle it.
  13224. @subsection Examples
  13225. @itemize
  13226. @item
  13227. Concatenate an opening, an episode and an ending, all in bilingual version
  13228. (video in stream 0, audio in streams 1 and 2):
  13229. @example
  13230. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  13231. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  13232. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  13233. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  13234. @end example
  13235. @item
  13236. Concatenate two parts, handling audio and video separately, using the
  13237. (a)movie sources, and adjusting the resolution:
  13238. @example
  13239. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  13240. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  13241. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  13242. @end example
  13243. Note that a desync will happen at the stitch if the audio and video streams
  13244. do not have exactly the same duration in the first file.
  13245. @end itemize
  13246. @section drawgraph, adrawgraph
  13247. Draw a graph using input video or audio metadata.
  13248. It accepts the following parameters:
  13249. @table @option
  13250. @item m1
  13251. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  13252. @item fg1
  13253. Set 1st foreground color expression.
  13254. @item m2
  13255. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  13256. @item fg2
  13257. Set 2nd foreground color expression.
  13258. @item m3
  13259. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  13260. @item fg3
  13261. Set 3rd foreground color expression.
  13262. @item m4
  13263. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  13264. @item fg4
  13265. Set 4th foreground color expression.
  13266. @item min
  13267. Set minimal value of metadata value.
  13268. @item max
  13269. Set maximal value of metadata value.
  13270. @item bg
  13271. Set graph background color. Default is white.
  13272. @item mode
  13273. Set graph mode.
  13274. Available values for mode is:
  13275. @table @samp
  13276. @item bar
  13277. @item dot
  13278. @item line
  13279. @end table
  13280. Default is @code{line}.
  13281. @item slide
  13282. Set slide mode.
  13283. Available values for slide is:
  13284. @table @samp
  13285. @item frame
  13286. Draw new frame when right border is reached.
  13287. @item replace
  13288. Replace old columns with new ones.
  13289. @item scroll
  13290. Scroll from right to left.
  13291. @item rscroll
  13292. Scroll from left to right.
  13293. @item picture
  13294. Draw single picture.
  13295. @end table
  13296. Default is @code{frame}.
  13297. @item size
  13298. Set size of graph video. For the syntax of this option, check the
  13299. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13300. The default value is @code{900x256}.
  13301. The foreground color expressions can use the following variables:
  13302. @table @option
  13303. @item MIN
  13304. Minimal value of metadata value.
  13305. @item MAX
  13306. Maximal value of metadata value.
  13307. @item VAL
  13308. Current metadata key value.
  13309. @end table
  13310. The color is defined as 0xAABBGGRR.
  13311. @end table
  13312. Example using metadata from @ref{signalstats} filter:
  13313. @example
  13314. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  13315. @end example
  13316. Example using metadata from @ref{ebur128} filter:
  13317. @example
  13318. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  13319. @end example
  13320. @anchor{ebur128}
  13321. @section ebur128
  13322. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  13323. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  13324. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  13325. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  13326. The filter also has a video output (see the @var{video} option) with a real
  13327. time graph to observe the loudness evolution. The graphic contains the logged
  13328. message mentioned above, so it is not printed anymore when this option is set,
  13329. unless the verbose logging is set. The main graphing area contains the
  13330. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  13331. the momentary loudness (400 milliseconds).
  13332. More information about the Loudness Recommendation EBU R128 on
  13333. @url{http://tech.ebu.ch/loudness}.
  13334. The filter accepts the following options:
  13335. @table @option
  13336. @item video
  13337. Activate the video output. The audio stream is passed unchanged whether this
  13338. option is set or no. The video stream will be the first output stream if
  13339. activated. Default is @code{0}.
  13340. @item size
  13341. Set the video size. This option is for video only. For the syntax of this
  13342. option, check the
  13343. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13344. Default and minimum resolution is @code{640x480}.
  13345. @item meter
  13346. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  13347. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  13348. other integer value between this range is allowed.
  13349. @item metadata
  13350. Set metadata injection. If set to @code{1}, the audio input will be segmented
  13351. into 100ms output frames, each of them containing various loudness information
  13352. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  13353. Default is @code{0}.
  13354. @item framelog
  13355. Force the frame logging level.
  13356. Available values are:
  13357. @table @samp
  13358. @item info
  13359. information logging level
  13360. @item verbose
  13361. verbose logging level
  13362. @end table
  13363. By default, the logging level is set to @var{info}. If the @option{video} or
  13364. the @option{metadata} options are set, it switches to @var{verbose}.
  13365. @item peak
  13366. Set peak mode(s).
  13367. Available modes can be cumulated (the option is a @code{flag} type). Possible
  13368. values are:
  13369. @table @samp
  13370. @item none
  13371. Disable any peak mode (default).
  13372. @item sample
  13373. Enable sample-peak mode.
  13374. Simple peak mode looking for the higher sample value. It logs a message
  13375. for sample-peak (identified by @code{SPK}).
  13376. @item true
  13377. Enable true-peak mode.
  13378. If enabled, the peak lookup is done on an over-sampled version of the input
  13379. stream for better peak accuracy. It logs a message for true-peak.
  13380. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  13381. This mode requires a build with @code{libswresample}.
  13382. @end table
  13383. @item dualmono
  13384. Treat mono input files as "dual mono". If a mono file is intended for playback
  13385. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  13386. If set to @code{true}, this option will compensate for this effect.
  13387. Multi-channel input files are not affected by this option.
  13388. @item panlaw
  13389. Set a specific pan law to be used for the measurement of dual mono files.
  13390. This parameter is optional, and has a default value of -3.01dB.
  13391. @end table
  13392. @subsection Examples
  13393. @itemize
  13394. @item
  13395. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  13396. @example
  13397. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  13398. @end example
  13399. @item
  13400. Run an analysis with @command{ffmpeg}:
  13401. @example
  13402. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  13403. @end example
  13404. @end itemize
  13405. @section interleave, ainterleave
  13406. Temporally interleave frames from several inputs.
  13407. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  13408. These filters read frames from several inputs and send the oldest
  13409. queued frame to the output.
  13410. Input streams must have well defined, monotonically increasing frame
  13411. timestamp values.
  13412. In order to submit one frame to output, these filters need to enqueue
  13413. at least one frame for each input, so they cannot work in case one
  13414. input is not yet terminated and will not receive incoming frames.
  13415. For example consider the case when one input is a @code{select} filter
  13416. which always drops input frames. The @code{interleave} filter will keep
  13417. reading from that input, but it will never be able to send new frames
  13418. to output until the input sends an end-of-stream signal.
  13419. Also, depending on inputs synchronization, the filters will drop
  13420. frames in case one input receives more frames than the other ones, and
  13421. the queue is already filled.
  13422. These filters accept the following options:
  13423. @table @option
  13424. @item nb_inputs, n
  13425. Set the number of different inputs, it is 2 by default.
  13426. @end table
  13427. @subsection Examples
  13428. @itemize
  13429. @item
  13430. Interleave frames belonging to different streams using @command{ffmpeg}:
  13431. @example
  13432. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  13433. @end example
  13434. @item
  13435. Add flickering blur effect:
  13436. @example
  13437. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  13438. @end example
  13439. @end itemize
  13440. @section metadata, ametadata
  13441. Manipulate frame metadata.
  13442. This filter accepts the following options:
  13443. @table @option
  13444. @item mode
  13445. Set mode of operation of the filter.
  13446. Can be one of the following:
  13447. @table @samp
  13448. @item select
  13449. If both @code{value} and @code{key} is set, select frames
  13450. which have such metadata. If only @code{key} is set, select
  13451. every frame that has such key in metadata.
  13452. @item add
  13453. Add new metadata @code{key} and @code{value}. If key is already available
  13454. do nothing.
  13455. @item modify
  13456. Modify value of already present key.
  13457. @item delete
  13458. If @code{value} is set, delete only keys that have such value.
  13459. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  13460. the frame.
  13461. @item print
  13462. Print key and its value if metadata was found. If @code{key} is not set print all
  13463. metadata values available in frame.
  13464. @end table
  13465. @item key
  13466. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  13467. @item value
  13468. Set metadata value which will be used. This option is mandatory for
  13469. @code{modify} and @code{add} mode.
  13470. @item function
  13471. Which function to use when comparing metadata value and @code{value}.
  13472. Can be one of following:
  13473. @table @samp
  13474. @item same_str
  13475. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  13476. @item starts_with
  13477. Values are interpreted as strings, returns true if metadata value starts with
  13478. the @code{value} option string.
  13479. @item less
  13480. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  13481. @item equal
  13482. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  13483. @item greater
  13484. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  13485. @item expr
  13486. Values are interpreted as floats, returns true if expression from option @code{expr}
  13487. evaluates to true.
  13488. @end table
  13489. @item expr
  13490. Set expression which is used when @code{function} is set to @code{expr}.
  13491. The expression is evaluated through the eval API and can contain the following
  13492. constants:
  13493. @table @option
  13494. @item VALUE1
  13495. Float representation of @code{value} from metadata key.
  13496. @item VALUE2
  13497. Float representation of @code{value} as supplied by user in @code{value} option.
  13498. @end table
  13499. @item file
  13500. If specified in @code{print} mode, output is written to the named file. Instead of
  13501. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  13502. for standard output. If @code{file} option is not set, output is written to the log
  13503. with AV_LOG_INFO loglevel.
  13504. @end table
  13505. @subsection Examples
  13506. @itemize
  13507. @item
  13508. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  13509. between 0 and 1.
  13510. @example
  13511. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  13512. @end example
  13513. @item
  13514. Print silencedetect output to file @file{metadata.txt}.
  13515. @example
  13516. silencedetect,ametadata=mode=print:file=metadata.txt
  13517. @end example
  13518. @item
  13519. Direct all metadata to a pipe with file descriptor 4.
  13520. @example
  13521. metadata=mode=print:file='pipe\:4'
  13522. @end example
  13523. @end itemize
  13524. @section perms, aperms
  13525. Set read/write permissions for the output frames.
  13526. These filters are mainly aimed at developers to test direct path in the
  13527. following filter in the filtergraph.
  13528. The filters accept the following options:
  13529. @table @option
  13530. @item mode
  13531. Select the permissions mode.
  13532. It accepts the following values:
  13533. @table @samp
  13534. @item none
  13535. Do nothing. This is the default.
  13536. @item ro
  13537. Set all the output frames read-only.
  13538. @item rw
  13539. Set all the output frames directly writable.
  13540. @item toggle
  13541. Make the frame read-only if writable, and writable if read-only.
  13542. @item random
  13543. Set each output frame read-only or writable randomly.
  13544. @end table
  13545. @item seed
  13546. Set the seed for the @var{random} mode, must be an integer included between
  13547. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  13548. @code{-1}, the filter will try to use a good random seed on a best effort
  13549. basis.
  13550. @end table
  13551. Note: in case of auto-inserted filter between the permission filter and the
  13552. following one, the permission might not be received as expected in that
  13553. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  13554. perms/aperms filter can avoid this problem.
  13555. @section realtime, arealtime
  13556. Slow down filtering to match real time approximately.
  13557. These filters will pause the filtering for a variable amount of time to
  13558. match the output rate with the input timestamps.
  13559. They are similar to the @option{re} option to @code{ffmpeg}.
  13560. They accept the following options:
  13561. @table @option
  13562. @item limit
  13563. Time limit for the pauses. Any pause longer than that will be considered
  13564. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  13565. @end table
  13566. @anchor{select}
  13567. @section select, aselect
  13568. Select frames to pass in output.
  13569. This filter accepts the following options:
  13570. @table @option
  13571. @item expr, e
  13572. Set expression, which is evaluated for each input frame.
  13573. If the expression is evaluated to zero, the frame is discarded.
  13574. If the evaluation result is negative or NaN, the frame is sent to the
  13575. first output; otherwise it is sent to the output with index
  13576. @code{ceil(val)-1}, assuming that the input index starts from 0.
  13577. For example a value of @code{1.2} corresponds to the output with index
  13578. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  13579. @item outputs, n
  13580. Set the number of outputs. The output to which to send the selected
  13581. frame is based on the result of the evaluation. Default value is 1.
  13582. @end table
  13583. The expression can contain the following constants:
  13584. @table @option
  13585. @item n
  13586. The (sequential) number of the filtered frame, starting from 0.
  13587. @item selected_n
  13588. The (sequential) number of the selected frame, starting from 0.
  13589. @item prev_selected_n
  13590. The sequential number of the last selected frame. It's NAN if undefined.
  13591. @item TB
  13592. The timebase of the input timestamps.
  13593. @item pts
  13594. The PTS (Presentation TimeStamp) of the filtered video frame,
  13595. expressed in @var{TB} units. It's NAN if undefined.
  13596. @item t
  13597. The PTS of the filtered video frame,
  13598. expressed in seconds. It's NAN if undefined.
  13599. @item prev_pts
  13600. The PTS of the previously filtered video frame. It's NAN if undefined.
  13601. @item prev_selected_pts
  13602. The PTS of the last previously filtered video frame. It's NAN if undefined.
  13603. @item prev_selected_t
  13604. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  13605. @item start_pts
  13606. The PTS of the first video frame in the video. It's NAN if undefined.
  13607. @item start_t
  13608. The time of the first video frame in the video. It's NAN if undefined.
  13609. @item pict_type @emph{(video only)}
  13610. The type of the filtered frame. It can assume one of the following
  13611. values:
  13612. @table @option
  13613. @item I
  13614. @item P
  13615. @item B
  13616. @item S
  13617. @item SI
  13618. @item SP
  13619. @item BI
  13620. @end table
  13621. @item interlace_type @emph{(video only)}
  13622. The frame interlace type. It can assume one of the following values:
  13623. @table @option
  13624. @item PROGRESSIVE
  13625. The frame is progressive (not interlaced).
  13626. @item TOPFIRST
  13627. The frame is top-field-first.
  13628. @item BOTTOMFIRST
  13629. The frame is bottom-field-first.
  13630. @end table
  13631. @item consumed_sample_n @emph{(audio only)}
  13632. the number of selected samples before the current frame
  13633. @item samples_n @emph{(audio only)}
  13634. the number of samples in the current frame
  13635. @item sample_rate @emph{(audio only)}
  13636. the input sample rate
  13637. @item key
  13638. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  13639. @item pos
  13640. the position in the file of the filtered frame, -1 if the information
  13641. is not available (e.g. for synthetic video)
  13642. @item scene @emph{(video only)}
  13643. value between 0 and 1 to indicate a new scene; a low value reflects a low
  13644. probability for the current frame to introduce a new scene, while a higher
  13645. value means the current frame is more likely to be one (see the example below)
  13646. @item concatdec_select
  13647. The concat demuxer can select only part of a concat input file by setting an
  13648. inpoint and an outpoint, but the output packets may not be entirely contained
  13649. in the selected interval. By using this variable, it is possible to skip frames
  13650. generated by the concat demuxer which are not exactly contained in the selected
  13651. interval.
  13652. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  13653. and the @var{lavf.concat.duration} packet metadata values which are also
  13654. present in the decoded frames.
  13655. The @var{concatdec_select} variable is -1 if the frame pts is at least
  13656. start_time and either the duration metadata is missing or the frame pts is less
  13657. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  13658. missing.
  13659. That basically means that an input frame is selected if its pts is within the
  13660. interval set by the concat demuxer.
  13661. @end table
  13662. The default value of the select expression is "1".
  13663. @subsection Examples
  13664. @itemize
  13665. @item
  13666. Select all frames in input:
  13667. @example
  13668. select
  13669. @end example
  13670. The example above is the same as:
  13671. @example
  13672. select=1
  13673. @end example
  13674. @item
  13675. Skip all frames:
  13676. @example
  13677. select=0
  13678. @end example
  13679. @item
  13680. Select only I-frames:
  13681. @example
  13682. select='eq(pict_type\,I)'
  13683. @end example
  13684. @item
  13685. Select one frame every 100:
  13686. @example
  13687. select='not(mod(n\,100))'
  13688. @end example
  13689. @item
  13690. Select only frames contained in the 10-20 time interval:
  13691. @example
  13692. select=between(t\,10\,20)
  13693. @end example
  13694. @item
  13695. Select only I-frames contained in the 10-20 time interval:
  13696. @example
  13697. select=between(t\,10\,20)*eq(pict_type\,I)
  13698. @end example
  13699. @item
  13700. Select frames with a minimum distance of 10 seconds:
  13701. @example
  13702. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  13703. @end example
  13704. @item
  13705. Use aselect to select only audio frames with samples number > 100:
  13706. @example
  13707. aselect='gt(samples_n\,100)'
  13708. @end example
  13709. @item
  13710. Create a mosaic of the first scenes:
  13711. @example
  13712. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  13713. @end example
  13714. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  13715. choice.
  13716. @item
  13717. Send even and odd frames to separate outputs, and compose them:
  13718. @example
  13719. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  13720. @end example
  13721. @item
  13722. Select useful frames from an ffconcat file which is using inpoints and
  13723. outpoints but where the source files are not intra frame only.
  13724. @example
  13725. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  13726. @end example
  13727. @end itemize
  13728. @section sendcmd, asendcmd
  13729. Send commands to filters in the filtergraph.
  13730. These filters read commands to be sent to other filters in the
  13731. filtergraph.
  13732. @code{sendcmd} must be inserted between two video filters,
  13733. @code{asendcmd} must be inserted between two audio filters, but apart
  13734. from that they act the same way.
  13735. The specification of commands can be provided in the filter arguments
  13736. with the @var{commands} option, or in a file specified by the
  13737. @var{filename} option.
  13738. These filters accept the following options:
  13739. @table @option
  13740. @item commands, c
  13741. Set the commands to be read and sent to the other filters.
  13742. @item filename, f
  13743. Set the filename of the commands to be read and sent to the other
  13744. filters.
  13745. @end table
  13746. @subsection Commands syntax
  13747. A commands description consists of a sequence of interval
  13748. specifications, comprising a list of commands to be executed when a
  13749. particular event related to that interval occurs. The occurring event
  13750. is typically the current frame time entering or leaving a given time
  13751. interval.
  13752. An interval is specified by the following syntax:
  13753. @example
  13754. @var{START}[-@var{END}] @var{COMMANDS};
  13755. @end example
  13756. The time interval is specified by the @var{START} and @var{END} times.
  13757. @var{END} is optional and defaults to the maximum time.
  13758. The current frame time is considered within the specified interval if
  13759. it is included in the interval [@var{START}, @var{END}), that is when
  13760. the time is greater or equal to @var{START} and is lesser than
  13761. @var{END}.
  13762. @var{COMMANDS} consists of a sequence of one or more command
  13763. specifications, separated by ",", relating to that interval. The
  13764. syntax of a command specification is given by:
  13765. @example
  13766. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  13767. @end example
  13768. @var{FLAGS} is optional and specifies the type of events relating to
  13769. the time interval which enable sending the specified command, and must
  13770. be a non-null sequence of identifier flags separated by "+" or "|" and
  13771. enclosed between "[" and "]".
  13772. The following flags are recognized:
  13773. @table @option
  13774. @item enter
  13775. The command is sent when the current frame timestamp enters the
  13776. specified interval. In other words, the command is sent when the
  13777. previous frame timestamp was not in the given interval, and the
  13778. current is.
  13779. @item leave
  13780. The command is sent when the current frame timestamp leaves the
  13781. specified interval. In other words, the command is sent when the
  13782. previous frame timestamp was in the given interval, and the
  13783. current is not.
  13784. @end table
  13785. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  13786. assumed.
  13787. @var{TARGET} specifies the target of the command, usually the name of
  13788. the filter class or a specific filter instance name.
  13789. @var{COMMAND} specifies the name of the command for the target filter.
  13790. @var{ARG} is optional and specifies the optional list of argument for
  13791. the given @var{COMMAND}.
  13792. Between one interval specification and another, whitespaces, or
  13793. sequences of characters starting with @code{#} until the end of line,
  13794. are ignored and can be used to annotate comments.
  13795. A simplified BNF description of the commands specification syntax
  13796. follows:
  13797. @example
  13798. @var{COMMAND_FLAG} ::= "enter" | "leave"
  13799. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  13800. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  13801. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  13802. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  13803. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  13804. @end example
  13805. @subsection Examples
  13806. @itemize
  13807. @item
  13808. Specify audio tempo change at second 4:
  13809. @example
  13810. asendcmd=c='4.0 atempo tempo 1.5',atempo
  13811. @end example
  13812. @item
  13813. Target a specific filter instance:
  13814. @example
  13815. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  13816. @end example
  13817. @item
  13818. Specify a list of drawtext and hue commands in a file.
  13819. @example
  13820. # show text in the interval 5-10
  13821. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  13822. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  13823. # desaturate the image in the interval 15-20
  13824. 15.0-20.0 [enter] hue s 0,
  13825. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  13826. [leave] hue s 1,
  13827. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  13828. # apply an exponential saturation fade-out effect, starting from time 25
  13829. 25 [enter] hue s exp(25-t)
  13830. @end example
  13831. A filtergraph allowing to read and process the above command list
  13832. stored in a file @file{test.cmd}, can be specified with:
  13833. @example
  13834. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  13835. @end example
  13836. @end itemize
  13837. @anchor{setpts}
  13838. @section setpts, asetpts
  13839. Change the PTS (presentation timestamp) of the input frames.
  13840. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  13841. This filter accepts the following options:
  13842. @table @option
  13843. @item expr
  13844. The expression which is evaluated for each frame to construct its timestamp.
  13845. @end table
  13846. The expression is evaluated through the eval API and can contain the following
  13847. constants:
  13848. @table @option
  13849. @item FRAME_RATE
  13850. frame rate, only defined for constant frame-rate video
  13851. @item PTS
  13852. The presentation timestamp in input
  13853. @item N
  13854. The count of the input frame for video or the number of consumed samples,
  13855. not including the current frame for audio, starting from 0.
  13856. @item NB_CONSUMED_SAMPLES
  13857. The number of consumed samples, not including the current frame (only
  13858. audio)
  13859. @item NB_SAMPLES, S
  13860. The number of samples in the current frame (only audio)
  13861. @item SAMPLE_RATE, SR
  13862. The audio sample rate.
  13863. @item STARTPTS
  13864. The PTS of the first frame.
  13865. @item STARTT
  13866. the time in seconds of the first frame
  13867. @item INTERLACED
  13868. State whether the current frame is interlaced.
  13869. @item T
  13870. the time in seconds of the current frame
  13871. @item POS
  13872. original position in the file of the frame, or undefined if undefined
  13873. for the current frame
  13874. @item PREV_INPTS
  13875. The previous input PTS.
  13876. @item PREV_INT
  13877. previous input time in seconds
  13878. @item PREV_OUTPTS
  13879. The previous output PTS.
  13880. @item PREV_OUTT
  13881. previous output time in seconds
  13882. @item RTCTIME
  13883. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  13884. instead.
  13885. @item RTCSTART
  13886. The wallclock (RTC) time at the start of the movie in microseconds.
  13887. @item TB
  13888. The timebase of the input timestamps.
  13889. @end table
  13890. @subsection Examples
  13891. @itemize
  13892. @item
  13893. Start counting PTS from zero
  13894. @example
  13895. setpts=PTS-STARTPTS
  13896. @end example
  13897. @item
  13898. Apply fast motion effect:
  13899. @example
  13900. setpts=0.5*PTS
  13901. @end example
  13902. @item
  13903. Apply slow motion effect:
  13904. @example
  13905. setpts=2.0*PTS
  13906. @end example
  13907. @item
  13908. Set fixed rate of 25 frames per second:
  13909. @example
  13910. setpts=N/(25*TB)
  13911. @end example
  13912. @item
  13913. Set fixed rate 25 fps with some jitter:
  13914. @example
  13915. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  13916. @end example
  13917. @item
  13918. Apply an offset of 10 seconds to the input PTS:
  13919. @example
  13920. setpts=PTS+10/TB
  13921. @end example
  13922. @item
  13923. Generate timestamps from a "live source" and rebase onto the current timebase:
  13924. @example
  13925. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  13926. @end example
  13927. @item
  13928. Generate timestamps by counting samples:
  13929. @example
  13930. asetpts=N/SR/TB
  13931. @end example
  13932. @end itemize
  13933. @section settb, asettb
  13934. Set the timebase to use for the output frames timestamps.
  13935. It is mainly useful for testing timebase configuration.
  13936. It accepts the following parameters:
  13937. @table @option
  13938. @item expr, tb
  13939. The expression which is evaluated into the output timebase.
  13940. @end table
  13941. The value for @option{tb} is an arithmetic expression representing a
  13942. rational. The expression can contain the constants "AVTB" (the default
  13943. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  13944. audio only). Default value is "intb".
  13945. @subsection Examples
  13946. @itemize
  13947. @item
  13948. Set the timebase to 1/25:
  13949. @example
  13950. settb=expr=1/25
  13951. @end example
  13952. @item
  13953. Set the timebase to 1/10:
  13954. @example
  13955. settb=expr=0.1
  13956. @end example
  13957. @item
  13958. Set the timebase to 1001/1000:
  13959. @example
  13960. settb=1+0.001
  13961. @end example
  13962. @item
  13963. Set the timebase to 2*intb:
  13964. @example
  13965. settb=2*intb
  13966. @end example
  13967. @item
  13968. Set the default timebase value:
  13969. @example
  13970. settb=AVTB
  13971. @end example
  13972. @end itemize
  13973. @section showcqt
  13974. Convert input audio to a video output representing frequency spectrum
  13975. logarithmically using Brown-Puckette constant Q transform algorithm with
  13976. direct frequency domain coefficient calculation (but the transform itself
  13977. is not really constant Q, instead the Q factor is actually variable/clamped),
  13978. with musical tone scale, from E0 to D#10.
  13979. The filter accepts the following options:
  13980. @table @option
  13981. @item size, s
  13982. Specify the video size for the output. It must be even. For the syntax of this option,
  13983. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13984. Default value is @code{1920x1080}.
  13985. @item fps, rate, r
  13986. Set the output frame rate. Default value is @code{25}.
  13987. @item bar_h
  13988. Set the bargraph height. It must be even. Default value is @code{-1} which
  13989. computes the bargraph height automatically.
  13990. @item axis_h
  13991. Set the axis height. It must be even. Default value is @code{-1} which computes
  13992. the axis height automatically.
  13993. @item sono_h
  13994. Set the sonogram height. It must be even. Default value is @code{-1} which
  13995. computes the sonogram height automatically.
  13996. @item fullhd
  13997. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  13998. instead. Default value is @code{1}.
  13999. @item sono_v, volume
  14000. Specify the sonogram volume expression. It can contain variables:
  14001. @table @option
  14002. @item bar_v
  14003. the @var{bar_v} evaluated expression
  14004. @item frequency, freq, f
  14005. the frequency where it is evaluated
  14006. @item timeclamp, tc
  14007. the value of @var{timeclamp} option
  14008. @end table
  14009. and functions:
  14010. @table @option
  14011. @item a_weighting(f)
  14012. A-weighting of equal loudness
  14013. @item b_weighting(f)
  14014. B-weighting of equal loudness
  14015. @item c_weighting(f)
  14016. C-weighting of equal loudness.
  14017. @end table
  14018. Default value is @code{16}.
  14019. @item bar_v, volume2
  14020. Specify the bargraph volume expression. It can contain variables:
  14021. @table @option
  14022. @item sono_v
  14023. the @var{sono_v} evaluated expression
  14024. @item frequency, freq, f
  14025. the frequency where it is evaluated
  14026. @item timeclamp, tc
  14027. the value of @var{timeclamp} option
  14028. @end table
  14029. and functions:
  14030. @table @option
  14031. @item a_weighting(f)
  14032. A-weighting of equal loudness
  14033. @item b_weighting(f)
  14034. B-weighting of equal loudness
  14035. @item c_weighting(f)
  14036. C-weighting of equal loudness.
  14037. @end table
  14038. Default value is @code{sono_v}.
  14039. @item sono_g, gamma
  14040. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  14041. higher gamma makes the spectrum having more range. Default value is @code{3}.
  14042. Acceptable range is @code{[1, 7]}.
  14043. @item bar_g, gamma2
  14044. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  14045. @code{[1, 7]}.
  14046. @item bar_t
  14047. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  14048. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  14049. @item timeclamp, tc
  14050. Specify the transform timeclamp. At low frequency, there is trade-off between
  14051. accuracy in time domain and frequency domain. If timeclamp is lower,
  14052. event in time domain is represented more accurately (such as fast bass drum),
  14053. otherwise event in frequency domain is represented more accurately
  14054. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  14055. @item attack
  14056. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  14057. limits future samples by applying asymmetric windowing in time domain, useful
  14058. when low latency is required. Accepted range is @code{[0, 1]}.
  14059. @item basefreq
  14060. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  14061. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  14062. @item endfreq
  14063. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  14064. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  14065. @item coeffclamp
  14066. This option is deprecated and ignored.
  14067. @item tlength
  14068. Specify the transform length in time domain. Use this option to control accuracy
  14069. trade-off between time domain and frequency domain at every frequency sample.
  14070. It can contain variables:
  14071. @table @option
  14072. @item frequency, freq, f
  14073. the frequency where it is evaluated
  14074. @item timeclamp, tc
  14075. the value of @var{timeclamp} option.
  14076. @end table
  14077. Default value is @code{384*tc/(384+tc*f)}.
  14078. @item count
  14079. Specify the transform count for every video frame. Default value is @code{6}.
  14080. Acceptable range is @code{[1, 30]}.
  14081. @item fcount
  14082. Specify the transform count for every single pixel. Default value is @code{0},
  14083. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  14084. @item fontfile
  14085. Specify font file for use with freetype to draw the axis. If not specified,
  14086. use embedded font. Note that drawing with font file or embedded font is not
  14087. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  14088. option instead.
  14089. @item font
  14090. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  14091. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  14092. @item fontcolor
  14093. Specify font color expression. This is arithmetic expression that should return
  14094. integer value 0xRRGGBB. It can contain variables:
  14095. @table @option
  14096. @item frequency, freq, f
  14097. the frequency where it is evaluated
  14098. @item timeclamp, tc
  14099. the value of @var{timeclamp} option
  14100. @end table
  14101. and functions:
  14102. @table @option
  14103. @item midi(f)
  14104. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  14105. @item r(x), g(x), b(x)
  14106. red, green, and blue value of intensity x.
  14107. @end table
  14108. Default value is @code{st(0, (midi(f)-59.5)/12);
  14109. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  14110. r(1-ld(1)) + b(ld(1))}.
  14111. @item axisfile
  14112. Specify image file to draw the axis. This option override @var{fontfile} and
  14113. @var{fontcolor} option.
  14114. @item axis, text
  14115. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  14116. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  14117. Default value is @code{1}.
  14118. @item csp
  14119. Set colorspace. The accepted values are:
  14120. @table @samp
  14121. @item unspecified
  14122. Unspecified (default)
  14123. @item bt709
  14124. BT.709
  14125. @item fcc
  14126. FCC
  14127. @item bt470bg
  14128. BT.470BG or BT.601-6 625
  14129. @item smpte170m
  14130. SMPTE-170M or BT.601-6 525
  14131. @item smpte240m
  14132. SMPTE-240M
  14133. @item bt2020ncl
  14134. BT.2020 with non-constant luminance
  14135. @end table
  14136. @item cscheme
  14137. Set spectrogram color scheme. This is list of floating point values with format
  14138. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  14139. The default is @code{1|0.5|0|0|0.5|1}.
  14140. @end table
  14141. @subsection Examples
  14142. @itemize
  14143. @item
  14144. Playing audio while showing the spectrum:
  14145. @example
  14146. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  14147. @end example
  14148. @item
  14149. Same as above, but with frame rate 30 fps:
  14150. @example
  14151. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  14152. @end example
  14153. @item
  14154. Playing at 1280x720:
  14155. @example
  14156. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  14157. @end example
  14158. @item
  14159. Disable sonogram display:
  14160. @example
  14161. sono_h=0
  14162. @end example
  14163. @item
  14164. A1 and its harmonics: A1, A2, (near)E3, A3:
  14165. @example
  14166. 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),
  14167. asplit[a][out1]; [a] showcqt [out0]'
  14168. @end example
  14169. @item
  14170. Same as above, but with more accuracy in frequency domain:
  14171. @example
  14172. 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),
  14173. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  14174. @end example
  14175. @item
  14176. Custom volume:
  14177. @example
  14178. bar_v=10:sono_v=bar_v*a_weighting(f)
  14179. @end example
  14180. @item
  14181. Custom gamma, now spectrum is linear to the amplitude.
  14182. @example
  14183. bar_g=2:sono_g=2
  14184. @end example
  14185. @item
  14186. Custom tlength equation:
  14187. @example
  14188. 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)))'
  14189. @end example
  14190. @item
  14191. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  14192. @example
  14193. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  14194. @end example
  14195. @item
  14196. Custom font using fontconfig:
  14197. @example
  14198. font='Courier New,Monospace,mono|bold'
  14199. @end example
  14200. @item
  14201. Custom frequency range with custom axis using image file:
  14202. @example
  14203. axisfile=myaxis.png:basefreq=40:endfreq=10000
  14204. @end example
  14205. @end itemize
  14206. @section showfreqs
  14207. Convert input audio to video output representing the audio power spectrum.
  14208. Audio amplitude is on Y-axis while frequency is on X-axis.
  14209. The filter accepts the following options:
  14210. @table @option
  14211. @item size, s
  14212. Specify size of video. For the syntax of this option, check the
  14213. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14214. Default is @code{1024x512}.
  14215. @item mode
  14216. Set display mode.
  14217. This set how each frequency bin will be represented.
  14218. It accepts the following values:
  14219. @table @samp
  14220. @item line
  14221. @item bar
  14222. @item dot
  14223. @end table
  14224. Default is @code{bar}.
  14225. @item ascale
  14226. Set amplitude scale.
  14227. It accepts the following values:
  14228. @table @samp
  14229. @item lin
  14230. Linear scale.
  14231. @item sqrt
  14232. Square root scale.
  14233. @item cbrt
  14234. Cubic root scale.
  14235. @item log
  14236. Logarithmic scale.
  14237. @end table
  14238. Default is @code{log}.
  14239. @item fscale
  14240. Set frequency scale.
  14241. It accepts the following values:
  14242. @table @samp
  14243. @item lin
  14244. Linear scale.
  14245. @item log
  14246. Logarithmic scale.
  14247. @item rlog
  14248. Reverse logarithmic scale.
  14249. @end table
  14250. Default is @code{lin}.
  14251. @item win_size
  14252. Set window size.
  14253. It accepts the following values:
  14254. @table @samp
  14255. @item w16
  14256. @item w32
  14257. @item w64
  14258. @item w128
  14259. @item w256
  14260. @item w512
  14261. @item w1024
  14262. @item w2048
  14263. @item w4096
  14264. @item w8192
  14265. @item w16384
  14266. @item w32768
  14267. @item w65536
  14268. @end table
  14269. Default is @code{w2048}
  14270. @item win_func
  14271. Set windowing function.
  14272. It accepts the following values:
  14273. @table @samp
  14274. @item rect
  14275. @item bartlett
  14276. @item hanning
  14277. @item hamming
  14278. @item blackman
  14279. @item welch
  14280. @item flattop
  14281. @item bharris
  14282. @item bnuttall
  14283. @item bhann
  14284. @item sine
  14285. @item nuttall
  14286. @item lanczos
  14287. @item gauss
  14288. @item tukey
  14289. @item dolph
  14290. @item cauchy
  14291. @item parzen
  14292. @item poisson
  14293. @end table
  14294. Default is @code{hanning}.
  14295. @item overlap
  14296. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14297. which means optimal overlap for selected window function will be picked.
  14298. @item averaging
  14299. Set time averaging. Setting this to 0 will display current maximal peaks.
  14300. Default is @code{1}, which means time averaging is disabled.
  14301. @item colors
  14302. Specify list of colors separated by space or by '|' which will be used to
  14303. draw channel frequencies. Unrecognized or missing colors will be replaced
  14304. by white color.
  14305. @item cmode
  14306. Set channel display mode.
  14307. It accepts the following values:
  14308. @table @samp
  14309. @item combined
  14310. @item separate
  14311. @end table
  14312. Default is @code{combined}.
  14313. @item minamp
  14314. Set minimum amplitude used in @code{log} amplitude scaler.
  14315. @end table
  14316. @anchor{showspectrum}
  14317. @section showspectrum
  14318. Convert input audio to a video output, representing the audio frequency
  14319. spectrum.
  14320. The filter accepts the following options:
  14321. @table @option
  14322. @item size, s
  14323. Specify the video size for the output. For the syntax of this option, check the
  14324. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14325. Default value is @code{640x512}.
  14326. @item slide
  14327. Specify how the spectrum should slide along the window.
  14328. It accepts the following values:
  14329. @table @samp
  14330. @item replace
  14331. the samples start again on the left when they reach the right
  14332. @item scroll
  14333. the samples scroll from right to left
  14334. @item fullframe
  14335. frames are only produced when the samples reach the right
  14336. @item rscroll
  14337. the samples scroll from left to right
  14338. @end table
  14339. Default value is @code{replace}.
  14340. @item mode
  14341. Specify display mode.
  14342. It accepts the following values:
  14343. @table @samp
  14344. @item combined
  14345. all channels are displayed in the same row
  14346. @item separate
  14347. all channels are displayed in separate rows
  14348. @end table
  14349. Default value is @samp{combined}.
  14350. @item color
  14351. Specify display color mode.
  14352. It accepts the following values:
  14353. @table @samp
  14354. @item channel
  14355. each channel is displayed in a separate color
  14356. @item intensity
  14357. each channel is displayed using the same color scheme
  14358. @item rainbow
  14359. each channel is displayed using the rainbow color scheme
  14360. @item moreland
  14361. each channel is displayed using the moreland color scheme
  14362. @item nebulae
  14363. each channel is displayed using the nebulae color scheme
  14364. @item fire
  14365. each channel is displayed using the fire color scheme
  14366. @item fiery
  14367. each channel is displayed using the fiery color scheme
  14368. @item fruit
  14369. each channel is displayed using the fruit color scheme
  14370. @item cool
  14371. each channel is displayed using the cool color scheme
  14372. @end table
  14373. Default value is @samp{channel}.
  14374. @item scale
  14375. Specify scale used for calculating intensity color values.
  14376. It accepts the following values:
  14377. @table @samp
  14378. @item lin
  14379. linear
  14380. @item sqrt
  14381. square root, default
  14382. @item cbrt
  14383. cubic root
  14384. @item log
  14385. logarithmic
  14386. @item 4thrt
  14387. 4th root
  14388. @item 5thrt
  14389. 5th root
  14390. @end table
  14391. Default value is @samp{sqrt}.
  14392. @item saturation
  14393. Set saturation modifier for displayed colors. Negative values provide
  14394. alternative color scheme. @code{0} is no saturation at all.
  14395. Saturation must be in [-10.0, 10.0] range.
  14396. Default value is @code{1}.
  14397. @item win_func
  14398. Set window function.
  14399. It accepts the following values:
  14400. @table @samp
  14401. @item rect
  14402. @item bartlett
  14403. @item hann
  14404. @item hanning
  14405. @item hamming
  14406. @item blackman
  14407. @item welch
  14408. @item flattop
  14409. @item bharris
  14410. @item bnuttall
  14411. @item bhann
  14412. @item sine
  14413. @item nuttall
  14414. @item lanczos
  14415. @item gauss
  14416. @item tukey
  14417. @item dolph
  14418. @item cauchy
  14419. @item parzen
  14420. @item poisson
  14421. @end table
  14422. Default value is @code{hann}.
  14423. @item orientation
  14424. Set orientation of time vs frequency axis. Can be @code{vertical} or
  14425. @code{horizontal}. Default is @code{vertical}.
  14426. @item overlap
  14427. Set ratio of overlap window. Default value is @code{0}.
  14428. When value is @code{1} overlap is set to recommended size for specific
  14429. window function currently used.
  14430. @item gain
  14431. Set scale gain for calculating intensity color values.
  14432. Default value is @code{1}.
  14433. @item data
  14434. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  14435. @item rotation
  14436. Set color rotation, must be in [-1.0, 1.0] range.
  14437. Default value is @code{0}.
  14438. @end table
  14439. The usage is very similar to the showwaves filter; see the examples in that
  14440. section.
  14441. @subsection Examples
  14442. @itemize
  14443. @item
  14444. Large window with logarithmic color scaling:
  14445. @example
  14446. showspectrum=s=1280x480:scale=log
  14447. @end example
  14448. @item
  14449. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  14450. @example
  14451. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  14452. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  14453. @end example
  14454. @end itemize
  14455. @section showspectrumpic
  14456. Convert input audio to a single video frame, representing the audio frequency
  14457. spectrum.
  14458. The filter accepts the following options:
  14459. @table @option
  14460. @item size, s
  14461. Specify the video size for the output. For the syntax of this option, check the
  14462. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14463. Default value is @code{4096x2048}.
  14464. @item mode
  14465. Specify display mode.
  14466. It accepts the following values:
  14467. @table @samp
  14468. @item combined
  14469. all channels are displayed in the same row
  14470. @item separate
  14471. all channels are displayed in separate rows
  14472. @end table
  14473. Default value is @samp{combined}.
  14474. @item color
  14475. Specify display color mode.
  14476. It accepts the following values:
  14477. @table @samp
  14478. @item channel
  14479. each channel is displayed in a separate color
  14480. @item intensity
  14481. each channel is displayed using the same color scheme
  14482. @item rainbow
  14483. each channel is displayed using the rainbow color scheme
  14484. @item moreland
  14485. each channel is displayed using the moreland color scheme
  14486. @item nebulae
  14487. each channel is displayed using the nebulae color scheme
  14488. @item fire
  14489. each channel is displayed using the fire color scheme
  14490. @item fiery
  14491. each channel is displayed using the fiery color scheme
  14492. @item fruit
  14493. each channel is displayed using the fruit color scheme
  14494. @item cool
  14495. each channel is displayed using the cool color scheme
  14496. @end table
  14497. Default value is @samp{intensity}.
  14498. @item scale
  14499. Specify scale used for calculating intensity color values.
  14500. It accepts the following values:
  14501. @table @samp
  14502. @item lin
  14503. linear
  14504. @item sqrt
  14505. square root, default
  14506. @item cbrt
  14507. cubic root
  14508. @item log
  14509. logarithmic
  14510. @item 4thrt
  14511. 4th root
  14512. @item 5thrt
  14513. 5th root
  14514. @end table
  14515. Default value is @samp{log}.
  14516. @item saturation
  14517. Set saturation modifier for displayed colors. Negative values provide
  14518. alternative color scheme. @code{0} is no saturation at all.
  14519. Saturation must be in [-10.0, 10.0] range.
  14520. Default value is @code{1}.
  14521. @item win_func
  14522. Set window function.
  14523. It accepts the following values:
  14524. @table @samp
  14525. @item rect
  14526. @item bartlett
  14527. @item hann
  14528. @item hanning
  14529. @item hamming
  14530. @item blackman
  14531. @item welch
  14532. @item flattop
  14533. @item bharris
  14534. @item bnuttall
  14535. @item bhann
  14536. @item sine
  14537. @item nuttall
  14538. @item lanczos
  14539. @item gauss
  14540. @item tukey
  14541. @item dolph
  14542. @item cauchy
  14543. @item parzen
  14544. @item poisson
  14545. @end table
  14546. Default value is @code{hann}.
  14547. @item orientation
  14548. Set orientation of time vs frequency axis. Can be @code{vertical} or
  14549. @code{horizontal}. Default is @code{vertical}.
  14550. @item gain
  14551. Set scale gain for calculating intensity color values.
  14552. Default value is @code{1}.
  14553. @item legend
  14554. Draw time and frequency axes and legends. Default is enabled.
  14555. @item rotation
  14556. Set color rotation, must be in [-1.0, 1.0] range.
  14557. Default value is @code{0}.
  14558. @end table
  14559. @subsection Examples
  14560. @itemize
  14561. @item
  14562. Extract an audio spectrogram of a whole audio track
  14563. in a 1024x1024 picture using @command{ffmpeg}:
  14564. @example
  14565. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  14566. @end example
  14567. @end itemize
  14568. @section showvolume
  14569. Convert input audio volume to a video output.
  14570. The filter accepts the following options:
  14571. @table @option
  14572. @item rate, r
  14573. Set video rate.
  14574. @item b
  14575. Set border width, allowed range is [0, 5]. Default is 1.
  14576. @item w
  14577. Set channel width, allowed range is [80, 8192]. Default is 400.
  14578. @item h
  14579. Set channel height, allowed range is [1, 900]. Default is 20.
  14580. @item f
  14581. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  14582. @item c
  14583. Set volume color expression.
  14584. The expression can use the following variables:
  14585. @table @option
  14586. @item VOLUME
  14587. Current max volume of channel in dB.
  14588. @item PEAK
  14589. Current peak.
  14590. @item CHANNEL
  14591. Current channel number, starting from 0.
  14592. @end table
  14593. @item t
  14594. If set, displays channel names. Default is enabled.
  14595. @item v
  14596. If set, displays volume values. Default is enabled.
  14597. @item o
  14598. Set orientation, can be @code{horizontal} or @code{vertical},
  14599. default is @code{horizontal}.
  14600. @item s
  14601. Set step size, allowed range s [0, 5]. Default is 0, which means
  14602. step is disabled.
  14603. @end table
  14604. @section showwaves
  14605. Convert input audio to a video output, representing the samples waves.
  14606. The filter accepts the following options:
  14607. @table @option
  14608. @item size, s
  14609. Specify the video size for the output. For the syntax of this option, check the
  14610. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14611. Default value is @code{600x240}.
  14612. @item mode
  14613. Set display mode.
  14614. Available values are:
  14615. @table @samp
  14616. @item point
  14617. Draw a point for each sample.
  14618. @item line
  14619. Draw a vertical line for each sample.
  14620. @item p2p
  14621. Draw a point for each sample and a line between them.
  14622. @item cline
  14623. Draw a centered vertical line for each sample.
  14624. @end table
  14625. Default value is @code{point}.
  14626. @item n
  14627. Set the number of samples which are printed on the same column. A
  14628. larger value will decrease the frame rate. Must be a positive
  14629. integer. This option can be set only if the value for @var{rate}
  14630. is not explicitly specified.
  14631. @item rate, r
  14632. Set the (approximate) output frame rate. This is done by setting the
  14633. option @var{n}. Default value is "25".
  14634. @item split_channels
  14635. Set if channels should be drawn separately or overlap. Default value is 0.
  14636. @item colors
  14637. Set colors separated by '|' which are going to be used for drawing of each channel.
  14638. @item scale
  14639. Set amplitude scale.
  14640. Available values are:
  14641. @table @samp
  14642. @item lin
  14643. Linear.
  14644. @item log
  14645. Logarithmic.
  14646. @item sqrt
  14647. Square root.
  14648. @item cbrt
  14649. Cubic root.
  14650. @end table
  14651. Default is linear.
  14652. @end table
  14653. @subsection Examples
  14654. @itemize
  14655. @item
  14656. Output the input file audio and the corresponding video representation
  14657. at the same time:
  14658. @example
  14659. amovie=a.mp3,asplit[out0],showwaves[out1]
  14660. @end example
  14661. @item
  14662. Create a synthetic signal and show it with showwaves, forcing a
  14663. frame rate of 30 frames per second:
  14664. @example
  14665. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  14666. @end example
  14667. @end itemize
  14668. @section showwavespic
  14669. Convert input audio to a single video frame, representing the samples waves.
  14670. The filter accepts the following options:
  14671. @table @option
  14672. @item size, s
  14673. Specify the video size for the output. For the syntax of this option, check the
  14674. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14675. Default value is @code{600x240}.
  14676. @item split_channels
  14677. Set if channels should be drawn separately or overlap. Default value is 0.
  14678. @item colors
  14679. Set colors separated by '|' which are going to be used for drawing of each channel.
  14680. @item scale
  14681. Set amplitude scale.
  14682. Available values are:
  14683. @table @samp
  14684. @item lin
  14685. Linear.
  14686. @item log
  14687. Logarithmic.
  14688. @item sqrt
  14689. Square root.
  14690. @item cbrt
  14691. Cubic root.
  14692. @end table
  14693. Default is linear.
  14694. @end table
  14695. @subsection Examples
  14696. @itemize
  14697. @item
  14698. Extract a channel split representation of the wave form of a whole audio track
  14699. in a 1024x800 picture using @command{ffmpeg}:
  14700. @example
  14701. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  14702. @end example
  14703. @end itemize
  14704. @section sidedata, asidedata
  14705. Delete frame side data, or select frames based on it.
  14706. This filter accepts the following options:
  14707. @table @option
  14708. @item mode
  14709. Set mode of operation of the filter.
  14710. Can be one of the following:
  14711. @table @samp
  14712. @item select
  14713. Select every frame with side data of @code{type}.
  14714. @item delete
  14715. Delete side data of @code{type}. If @code{type} is not set, delete all side
  14716. data in the frame.
  14717. @end table
  14718. @item type
  14719. Set side data type used with all modes. Must be set for @code{select} mode. For
  14720. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  14721. in @file{libavutil/frame.h}. For example, to choose
  14722. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  14723. @end table
  14724. @section spectrumsynth
  14725. Sythesize audio from 2 input video spectrums, first input stream represents
  14726. magnitude across time and second represents phase across time.
  14727. The filter will transform from frequency domain as displayed in videos back
  14728. to time domain as presented in audio output.
  14729. This filter is primarily created for reversing processed @ref{showspectrum}
  14730. filter outputs, but can synthesize sound from other spectrograms too.
  14731. But in such case results are going to be poor if the phase data is not
  14732. available, because in such cases phase data need to be recreated, usually
  14733. its just recreated from random noise.
  14734. For best results use gray only output (@code{channel} color mode in
  14735. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  14736. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  14737. @code{data} option. Inputs videos should generally use @code{fullframe}
  14738. slide mode as that saves resources needed for decoding video.
  14739. The filter accepts the following options:
  14740. @table @option
  14741. @item sample_rate
  14742. Specify sample rate of output audio, the sample rate of audio from which
  14743. spectrum was generated may differ.
  14744. @item channels
  14745. Set number of channels represented in input video spectrums.
  14746. @item scale
  14747. Set scale which was used when generating magnitude input spectrum.
  14748. Can be @code{lin} or @code{log}. Default is @code{log}.
  14749. @item slide
  14750. Set slide which was used when generating inputs spectrums.
  14751. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  14752. Default is @code{fullframe}.
  14753. @item win_func
  14754. Set window function used for resynthesis.
  14755. @item overlap
  14756. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14757. which means optimal overlap for selected window function will be picked.
  14758. @item orientation
  14759. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  14760. Default is @code{vertical}.
  14761. @end table
  14762. @subsection Examples
  14763. @itemize
  14764. @item
  14765. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  14766. then resynthesize videos back to audio with spectrumsynth:
  14767. @example
  14768. 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
  14769. 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
  14770. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  14771. @end example
  14772. @end itemize
  14773. @section split, asplit
  14774. Split input into several identical outputs.
  14775. @code{asplit} works with audio input, @code{split} with video.
  14776. The filter accepts a single parameter which specifies the number of outputs. If
  14777. unspecified, it defaults to 2.
  14778. @subsection Examples
  14779. @itemize
  14780. @item
  14781. Create two separate outputs from the same input:
  14782. @example
  14783. [in] split [out0][out1]
  14784. @end example
  14785. @item
  14786. To create 3 or more outputs, you need to specify the number of
  14787. outputs, like in:
  14788. @example
  14789. [in] asplit=3 [out0][out1][out2]
  14790. @end example
  14791. @item
  14792. Create two separate outputs from the same input, one cropped and
  14793. one padded:
  14794. @example
  14795. [in] split [splitout1][splitout2];
  14796. [splitout1] crop=100:100:0:0 [cropout];
  14797. [splitout2] pad=200:200:100:100 [padout];
  14798. @end example
  14799. @item
  14800. Create 5 copies of the input audio with @command{ffmpeg}:
  14801. @example
  14802. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  14803. @end example
  14804. @end itemize
  14805. @section zmq, azmq
  14806. Receive commands sent through a libzmq client, and forward them to
  14807. filters in the filtergraph.
  14808. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  14809. must be inserted between two video filters, @code{azmq} between two
  14810. audio filters.
  14811. To enable these filters you need to install the libzmq library and
  14812. headers and configure FFmpeg with @code{--enable-libzmq}.
  14813. For more information about libzmq see:
  14814. @url{http://www.zeromq.org/}
  14815. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  14816. receives messages sent through a network interface defined by the
  14817. @option{bind_address} option.
  14818. The received message must be in the form:
  14819. @example
  14820. @var{TARGET} @var{COMMAND} [@var{ARG}]
  14821. @end example
  14822. @var{TARGET} specifies the target of the command, usually the name of
  14823. the filter class or a specific filter instance name.
  14824. @var{COMMAND} specifies the name of the command for the target filter.
  14825. @var{ARG} is optional and specifies the optional argument list for the
  14826. given @var{COMMAND}.
  14827. Upon reception, the message is processed and the corresponding command
  14828. is injected into the filtergraph. Depending on the result, the filter
  14829. will send a reply to the client, adopting the format:
  14830. @example
  14831. @var{ERROR_CODE} @var{ERROR_REASON}
  14832. @var{MESSAGE}
  14833. @end example
  14834. @var{MESSAGE} is optional.
  14835. @subsection Examples
  14836. Look at @file{tools/zmqsend} for an example of a zmq client which can
  14837. be used to send commands processed by these filters.
  14838. Consider the following filtergraph generated by @command{ffplay}
  14839. @example
  14840. ffplay -dumpgraph 1 -f lavfi "
  14841. color=s=100x100:c=red [l];
  14842. color=s=100x100:c=blue [r];
  14843. nullsrc=s=200x100, zmq [bg];
  14844. [bg][l] overlay [bg+l];
  14845. [bg+l][r] overlay=x=100 "
  14846. @end example
  14847. To change the color of the left side of the video, the following
  14848. command can be used:
  14849. @example
  14850. echo Parsed_color_0 c yellow | tools/zmqsend
  14851. @end example
  14852. To change the right side:
  14853. @example
  14854. echo Parsed_color_1 c pink | tools/zmqsend
  14855. @end example
  14856. @c man end MULTIMEDIA FILTERS
  14857. @chapter Multimedia Sources
  14858. @c man begin MULTIMEDIA SOURCES
  14859. Below is a description of the currently available multimedia sources.
  14860. @section amovie
  14861. This is the same as @ref{movie} source, except it selects an audio
  14862. stream by default.
  14863. @anchor{movie}
  14864. @section movie
  14865. Read audio and/or video stream(s) from a movie container.
  14866. It accepts the following parameters:
  14867. @table @option
  14868. @item filename
  14869. The name of the resource to read (not necessarily a file; it can also be a
  14870. device or a stream accessed through some protocol).
  14871. @item format_name, f
  14872. Specifies the format assumed for the movie to read, and can be either
  14873. the name of a container or an input device. If not specified, the
  14874. format is guessed from @var{movie_name} or by probing.
  14875. @item seek_point, sp
  14876. Specifies the seek point in seconds. The frames will be output
  14877. starting from this seek point. The parameter is evaluated with
  14878. @code{av_strtod}, so the numerical value may be suffixed by an IS
  14879. postfix. The default value is "0".
  14880. @item streams, s
  14881. Specifies the streams to read. Several streams can be specified,
  14882. separated by "+". The source will then have as many outputs, in the
  14883. same order. The syntax is explained in the ``Stream specifiers''
  14884. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  14885. respectively the default (best suited) video and audio stream. Default
  14886. is "dv", or "da" if the filter is called as "amovie".
  14887. @item stream_index, si
  14888. Specifies the index of the video stream to read. If the value is -1,
  14889. the most suitable video stream will be automatically selected. The default
  14890. value is "-1". Deprecated. If the filter is called "amovie", it will select
  14891. audio instead of video.
  14892. @item loop
  14893. Specifies how many times to read the stream in sequence.
  14894. If the value is 0, the stream will be looped infinitely.
  14895. Default value is "1".
  14896. Note that when the movie is looped the source timestamps are not
  14897. changed, so it will generate non monotonically increasing timestamps.
  14898. @item discontinuity
  14899. Specifies the time difference between frames above which the point is
  14900. considered a timestamp discontinuity which is removed by adjusting the later
  14901. timestamps.
  14902. @end table
  14903. It allows overlaying a second video on top of the main input of
  14904. a filtergraph, as shown in this graph:
  14905. @example
  14906. input -----------> deltapts0 --> overlay --> output
  14907. ^
  14908. |
  14909. movie --> scale--> deltapts1 -------+
  14910. @end example
  14911. @subsection Examples
  14912. @itemize
  14913. @item
  14914. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  14915. on top of the input labelled "in":
  14916. @example
  14917. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  14918. [in] setpts=PTS-STARTPTS [main];
  14919. [main][over] overlay=16:16 [out]
  14920. @end example
  14921. @item
  14922. Read from a video4linux2 device, and overlay it on top of the input
  14923. labelled "in":
  14924. @example
  14925. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  14926. [in] setpts=PTS-STARTPTS [main];
  14927. [main][over] overlay=16:16 [out]
  14928. @end example
  14929. @item
  14930. Read the first video stream and the audio stream with id 0x81 from
  14931. dvd.vob; the video is connected to the pad named "video" and the audio is
  14932. connected to the pad named "audio":
  14933. @example
  14934. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  14935. @end example
  14936. @end itemize
  14937. @subsection Commands
  14938. Both movie and amovie support the following commands:
  14939. @table @option
  14940. @item seek
  14941. Perform seek using "av_seek_frame".
  14942. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  14943. @itemize
  14944. @item
  14945. @var{stream_index}: If stream_index is -1, a default
  14946. stream is selected, and @var{timestamp} is automatically converted
  14947. from AV_TIME_BASE units to the stream specific time_base.
  14948. @item
  14949. @var{timestamp}: Timestamp in AVStream.time_base units
  14950. or, if no stream is specified, in AV_TIME_BASE units.
  14951. @item
  14952. @var{flags}: Flags which select direction and seeking mode.
  14953. @end itemize
  14954. @item get_duration
  14955. Get movie duration in AV_TIME_BASE units.
  14956. @end table
  14957. @c man end MULTIMEDIA SOURCES