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.

19548 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 acopy
  345. Copy the input audio source unchanged to the output. This is mainly useful for
  346. testing purposes.
  347. @section acrossfade
  348. Apply cross fade from one input audio stream to another input audio stream.
  349. The cross fade is applied for specified duration near the end of first stream.
  350. The filter accepts the following options:
  351. @table @option
  352. @item nb_samples, ns
  353. Specify the number of samples for which the cross fade effect has to last.
  354. At the end of the cross fade effect the first input audio will be completely
  355. silent. Default is 44100.
  356. @item duration, d
  357. Specify the duration of the cross fade effect. See
  358. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  359. for the accepted syntax.
  360. By default the duration is determined by @var{nb_samples}.
  361. If set this option is used instead of @var{nb_samples}.
  362. @item overlap, o
  363. Should first stream end overlap with second stream start. Default is enabled.
  364. @item curve1
  365. Set curve for cross fade transition for first stream.
  366. @item curve2
  367. Set curve for cross fade transition for second stream.
  368. For description of available curve types see @ref{afade} filter description.
  369. @end table
  370. @subsection Examples
  371. @itemize
  372. @item
  373. Cross fade from one input to another:
  374. @example
  375. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  376. @end example
  377. @item
  378. Cross fade from one input to another but without overlapping:
  379. @example
  380. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  381. @end example
  382. @end itemize
  383. @section acrusher
  384. Reduce audio bit resolution.
  385. This filter is bit crusher with enhanced functionality. A bit crusher
  386. is used to audibly reduce number of bits an audio signal is sampled
  387. with. This doesn't change the bit depth at all, it just produces the
  388. effect. Material reduced in bit depth sounds more harsh and "digital".
  389. This filter is able to even round to continuous values instead of discrete
  390. bit depths.
  391. Additionally it has a D/C offset which results in different crushing of
  392. the lower and the upper half of the signal.
  393. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  394. Another feature of this filter is the logarithmic mode.
  395. This setting switches from linear distances between bits to logarithmic ones.
  396. The result is a much more "natural" sounding crusher which doesn't gate low
  397. signals for example. The human ear has a logarithmic perception, too
  398. so this kind of crushing is much more pleasant.
  399. Logarithmic crushing is also able to get anti-aliased.
  400. The filter accepts the following options:
  401. @table @option
  402. @item level_in
  403. Set level in.
  404. @item level_out
  405. Set level out.
  406. @item bits
  407. Set bit reduction.
  408. @item mix
  409. Set mixing amount.
  410. @item mode
  411. Can be linear: @code{lin} or logarithmic: @code{log}.
  412. @item dc
  413. Set DC.
  414. @item aa
  415. Set anti-aliasing.
  416. @item samples
  417. Set sample reduction.
  418. @item lfo
  419. Enable LFO. By default disabled.
  420. @item lforange
  421. Set LFO range.
  422. @item lforate
  423. Set LFO rate.
  424. @end table
  425. @section adelay
  426. Delay one or more audio channels.
  427. Samples in delayed channel are filled with silence.
  428. The filter accepts the following option:
  429. @table @option
  430. @item delays
  431. Set list of delays in milliseconds for each channel separated by '|'.
  432. Unused delays will be silently ignored. If number of given delays is
  433. smaller than number of channels all remaining channels will not be delayed.
  434. If you want to delay exact number of samples, append 'S' to number.
  435. @end table
  436. @subsection Examples
  437. @itemize
  438. @item
  439. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  440. the second channel (and any other channels that may be present) unchanged.
  441. @example
  442. adelay=1500|0|500
  443. @end example
  444. @item
  445. Delay second channel by 500 samples, the third channel by 700 samples and leave
  446. the first channel (and any other channels that may be present) unchanged.
  447. @example
  448. adelay=0|500S|700S
  449. @end example
  450. @end itemize
  451. @section aecho
  452. Apply echoing to the input audio.
  453. Echoes are reflected sound and can occur naturally amongst mountains
  454. (and sometimes large buildings) when talking or shouting; digital echo
  455. effects emulate this behaviour and are often used to help fill out the
  456. sound of a single instrument or vocal. The time difference between the
  457. original signal and the reflection is the @code{delay}, and the
  458. loudness of the reflected signal is the @code{decay}.
  459. Multiple echoes can have different delays and decays.
  460. A description of the accepted parameters follows.
  461. @table @option
  462. @item in_gain
  463. Set input gain of reflected signal. Default is @code{0.6}.
  464. @item out_gain
  465. Set output gain of reflected signal. Default is @code{0.3}.
  466. @item delays
  467. Set list of time intervals in milliseconds between original signal and reflections
  468. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  469. Default is @code{1000}.
  470. @item decays
  471. Set list of loudness of reflected signals separated by '|'.
  472. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  473. Default is @code{0.5}.
  474. @end table
  475. @subsection Examples
  476. @itemize
  477. @item
  478. Make it sound as if there are twice as many instruments as are actually playing:
  479. @example
  480. aecho=0.8:0.88:60:0.4
  481. @end example
  482. @item
  483. If delay is very short, then it sound like a (metallic) robot playing music:
  484. @example
  485. aecho=0.8:0.88:6:0.4
  486. @end example
  487. @item
  488. A longer delay will sound like an open air concert in the mountains:
  489. @example
  490. aecho=0.8:0.9:1000:0.3
  491. @end example
  492. @item
  493. Same as above but with one more mountain:
  494. @example
  495. aecho=0.8:0.9:1000|1800:0.3|0.25
  496. @end example
  497. @end itemize
  498. @section aemphasis
  499. Audio emphasis filter creates or restores material directly taken from LPs or
  500. emphased CDs with different filter curves. E.g. to store music on vinyl the
  501. signal has to be altered by a filter first to even out the disadvantages of
  502. this recording medium.
  503. Once the material is played back the inverse filter has to be applied to
  504. restore the distortion of the frequency response.
  505. The filter accepts the following options:
  506. @table @option
  507. @item level_in
  508. Set input gain.
  509. @item level_out
  510. Set output gain.
  511. @item mode
  512. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  513. use @code{production} mode. Default is @code{reproduction} mode.
  514. @item type
  515. Set filter type. Selects medium. Can be one of the following:
  516. @table @option
  517. @item col
  518. select Columbia.
  519. @item emi
  520. select EMI.
  521. @item bsi
  522. select BSI (78RPM).
  523. @item riaa
  524. select RIAA.
  525. @item cd
  526. select Compact Disc (CD).
  527. @item 50fm
  528. select 50µs (FM).
  529. @item 75fm
  530. select 75µs (FM).
  531. @item 50kf
  532. select 50µs (FM-KF).
  533. @item 75kf
  534. select 75µs (FM-KF).
  535. @end table
  536. @end table
  537. @section aeval
  538. Modify an audio signal according to the specified expressions.
  539. This filter accepts one or more expressions (one for each channel),
  540. which are evaluated and used to modify a corresponding audio signal.
  541. It accepts the following parameters:
  542. @table @option
  543. @item exprs
  544. Set the '|'-separated expressions list for each separate channel. If
  545. the number of input channels is greater than the number of
  546. expressions, the last specified expression is used for the remaining
  547. output channels.
  548. @item channel_layout, c
  549. Set output channel layout. If not specified, the channel layout is
  550. specified by the number of expressions. If set to @samp{same}, it will
  551. use by default the same input channel layout.
  552. @end table
  553. Each expression in @var{exprs} can contain the following constants and functions:
  554. @table @option
  555. @item ch
  556. channel number of the current expression
  557. @item n
  558. number of the evaluated sample, starting from 0
  559. @item s
  560. sample rate
  561. @item t
  562. time of the evaluated sample expressed in seconds
  563. @item nb_in_channels
  564. @item nb_out_channels
  565. input and output number of channels
  566. @item val(CH)
  567. the value of input channel with number @var{CH}
  568. @end table
  569. Note: this filter is slow. For faster processing you should use a
  570. dedicated filter.
  571. @subsection Examples
  572. @itemize
  573. @item
  574. Half volume:
  575. @example
  576. aeval=val(ch)/2:c=same
  577. @end example
  578. @item
  579. Invert phase of the second channel:
  580. @example
  581. aeval=val(0)|-val(1)
  582. @end example
  583. @end itemize
  584. @anchor{afade}
  585. @section afade
  586. Apply fade-in/out effect to input audio.
  587. A description of the accepted parameters follows.
  588. @table @option
  589. @item type, t
  590. Specify the effect type, can be either @code{in} for fade-in, or
  591. @code{out} for a fade-out effect. Default is @code{in}.
  592. @item start_sample, ss
  593. Specify the number of the start sample for starting to apply the fade
  594. effect. Default is 0.
  595. @item nb_samples, ns
  596. Specify the number of samples for which the fade effect has to last. At
  597. the end of the fade-in effect the output audio will have the same
  598. volume as the input audio, at the end of the fade-out transition
  599. the output audio will be silence. Default is 44100.
  600. @item start_time, st
  601. Specify the start time of the fade effect. Default is 0.
  602. The value must be specified as a time duration; see
  603. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  604. for the accepted syntax.
  605. If set this option is used instead of @var{start_sample}.
  606. @item duration, d
  607. Specify the duration of the fade effect. See
  608. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  609. for the accepted syntax.
  610. At the end of the fade-in effect the output audio will have the same
  611. volume as the input audio, at the end of the fade-out transition
  612. the output audio will be silence.
  613. By default the duration is determined by @var{nb_samples}.
  614. If set this option is used instead of @var{nb_samples}.
  615. @item curve
  616. Set curve for fade transition.
  617. It accepts the following values:
  618. @table @option
  619. @item tri
  620. select triangular, linear slope (default)
  621. @item qsin
  622. select quarter of sine wave
  623. @item hsin
  624. select half of sine wave
  625. @item esin
  626. select exponential sine wave
  627. @item log
  628. select logarithmic
  629. @item ipar
  630. select inverted parabola
  631. @item qua
  632. select quadratic
  633. @item cub
  634. select cubic
  635. @item squ
  636. select square root
  637. @item cbr
  638. select cubic root
  639. @item par
  640. select parabola
  641. @item exp
  642. select exponential
  643. @item iqsin
  644. select inverted quarter of sine wave
  645. @item ihsin
  646. select inverted half of sine wave
  647. @item dese
  648. select double-exponential seat
  649. @item desi
  650. select double-exponential sigmoid
  651. @end table
  652. @end table
  653. @subsection Examples
  654. @itemize
  655. @item
  656. Fade in first 15 seconds of audio:
  657. @example
  658. afade=t=in:ss=0:d=15
  659. @end example
  660. @item
  661. Fade out last 25 seconds of a 900 seconds audio:
  662. @example
  663. afade=t=out:st=875:d=25
  664. @end example
  665. @end itemize
  666. @section afftfilt
  667. Apply arbitrary expressions to samples in frequency domain.
  668. @table @option
  669. @item real
  670. Set frequency domain real expression for each separate channel separated
  671. by '|'. Default is "1".
  672. If the number of input channels is greater than the number of
  673. expressions, the last specified expression is used for the remaining
  674. output channels.
  675. @item imag
  676. Set frequency domain imaginary expression for each separate channel
  677. separated by '|'. If not set, @var{real} option is used.
  678. Each expression in @var{real} and @var{imag} can contain the following
  679. constants:
  680. @table @option
  681. @item sr
  682. sample rate
  683. @item b
  684. current frequency bin number
  685. @item nb
  686. number of available bins
  687. @item ch
  688. channel number of the current expression
  689. @item chs
  690. number of channels
  691. @item pts
  692. current frame pts
  693. @end table
  694. @item win_size
  695. Set window size.
  696. It accepts the following values:
  697. @table @samp
  698. @item w16
  699. @item w32
  700. @item w64
  701. @item w128
  702. @item w256
  703. @item w512
  704. @item w1024
  705. @item w2048
  706. @item w4096
  707. @item w8192
  708. @item w16384
  709. @item w32768
  710. @item w65536
  711. @end table
  712. Default is @code{w4096}
  713. @item win_func
  714. Set window function. Default is @code{hann}.
  715. @item overlap
  716. Set window overlap. If set to 1, the recommended overlap for selected
  717. window function will be picked. Default is @code{0.75}.
  718. @end table
  719. @subsection Examples
  720. @itemize
  721. @item
  722. Leave almost only low frequencies in audio:
  723. @example
  724. afftfilt="1-clip((b/nb)*b,0,1)"
  725. @end example
  726. @end itemize
  727. @section afir
  728. Apply an arbitrary Frequency Impulse Response filter.
  729. This filter is designed for applying long FIR filters,
  730. up to 30 seconds long.
  731. It can be used as component for digital crossover filters,
  732. room equalization, cross talk cancellation, wavefield synthesis,
  733. auralization, ambiophonics and ambisonics.
  734. This filter uses second stream as FIR coefficients.
  735. If second stream holds single channel, it will be used
  736. for all input channels in first stream, otherwise
  737. number of channels in second stream must be same as
  738. number of channels in first stream.
  739. It accepts the following parameters:
  740. @table @option
  741. @item dry
  742. Set dry gain. This sets input gain.
  743. @item wet
  744. Set wet gain. This sets final output gain.
  745. @item length
  746. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  747. @item again
  748. Enable applying gain measured from power of IR.
  749. @end table
  750. @subsection Examples
  751. @itemize
  752. @item
  753. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  754. @example
  755. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  756. @end example
  757. @end itemize
  758. @anchor{aformat}
  759. @section aformat
  760. Set output format constraints for the input audio. The framework will
  761. negotiate the most appropriate format to minimize conversions.
  762. It accepts the following parameters:
  763. @table @option
  764. @item sample_fmts
  765. A '|'-separated list of requested sample formats.
  766. @item sample_rates
  767. A '|'-separated list of requested sample rates.
  768. @item channel_layouts
  769. A '|'-separated list of requested channel layouts.
  770. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  771. for the required syntax.
  772. @end table
  773. If a parameter is omitted, all values are allowed.
  774. Force the output to either unsigned 8-bit or signed 16-bit stereo
  775. @example
  776. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  777. @end example
  778. @section agate
  779. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  780. processing reduces disturbing noise between useful signals.
  781. Gating is done by detecting the volume below a chosen level @var{threshold}
  782. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  783. floor is set via @var{range}. Because an exact manipulation of the signal
  784. would cause distortion of the waveform the reduction can be levelled over
  785. time. This is done by setting @var{attack} and @var{release}.
  786. @var{attack} determines how long the signal has to fall below the threshold
  787. before any reduction will occur and @var{release} sets the time the signal
  788. has to rise above the threshold to reduce the reduction again.
  789. Shorter signals than the chosen attack time will be left untouched.
  790. @table @option
  791. @item level_in
  792. Set input level before filtering.
  793. Default is 1. Allowed range is from 0.015625 to 64.
  794. @item range
  795. Set the level of gain reduction when the signal is below the threshold.
  796. Default is 0.06125. Allowed range is from 0 to 1.
  797. @item threshold
  798. If a signal rises above this level the gain reduction is released.
  799. Default is 0.125. Allowed range is from 0 to 1.
  800. @item ratio
  801. Set a ratio by which the signal is reduced.
  802. Default is 2. Allowed range is from 1 to 9000.
  803. @item attack
  804. Amount of milliseconds the signal has to rise above the threshold before gain
  805. reduction stops.
  806. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  807. @item release
  808. Amount of milliseconds the signal has to fall below the threshold before the
  809. reduction is increased again. Default is 250 milliseconds.
  810. Allowed range is from 0.01 to 9000.
  811. @item makeup
  812. Set amount of amplification of signal after processing.
  813. Default is 1. Allowed range is from 1 to 64.
  814. @item knee
  815. Curve the sharp knee around the threshold to enter gain reduction more softly.
  816. Default is 2.828427125. Allowed range is from 1 to 8.
  817. @item detection
  818. Choose if exact signal should be taken for detection or an RMS like one.
  819. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  820. @item link
  821. Choose if the average level between all channels or the louder channel affects
  822. the reduction.
  823. Default is @code{average}. Can be @code{average} or @code{maximum}.
  824. @end table
  825. @section alimiter
  826. The limiter prevents an input signal from rising over a desired threshold.
  827. This limiter uses lookahead technology to prevent your signal from distorting.
  828. It means that there is a small delay after the signal is processed. Keep in mind
  829. that the delay it produces is the attack time you set.
  830. The filter accepts the following options:
  831. @table @option
  832. @item level_in
  833. Set input gain. Default is 1.
  834. @item level_out
  835. Set output gain. Default is 1.
  836. @item limit
  837. Don't let signals above this level pass the limiter. Default is 1.
  838. @item attack
  839. The limiter will reach its attenuation level in this amount of time in
  840. milliseconds. Default is 5 milliseconds.
  841. @item release
  842. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  843. Default is 50 milliseconds.
  844. @item asc
  845. When gain reduction is always needed ASC takes care of releasing to an
  846. average reduction level rather than reaching a reduction of 0 in the release
  847. time.
  848. @item asc_level
  849. Select how much the release time is affected by ASC, 0 means nearly no changes
  850. in release time while 1 produces higher release times.
  851. @item level
  852. Auto level output signal. Default is enabled.
  853. This normalizes audio back to 0dB if enabled.
  854. @end table
  855. Depending on picked setting it is recommended to upsample input 2x or 4x times
  856. with @ref{aresample} before applying this filter.
  857. @section allpass
  858. Apply a two-pole all-pass filter with central frequency (in Hz)
  859. @var{frequency}, and filter-width @var{width}.
  860. An all-pass filter changes the audio's frequency to phase relationship
  861. without changing its frequency to amplitude relationship.
  862. The filter accepts the following options:
  863. @table @option
  864. @item frequency, f
  865. Set frequency in Hz.
  866. @item width_type, t
  867. Set method to specify band-width of filter.
  868. @table @option
  869. @item h
  870. Hz
  871. @item q
  872. Q-Factor
  873. @item o
  874. octave
  875. @item s
  876. slope
  877. @end table
  878. @item width, w
  879. Specify the band-width of a filter in width_type units.
  880. @item channels, c
  881. Specify which channels to filter, by default all available are filtered.
  882. @end table
  883. @section aloop
  884. Loop audio samples.
  885. The filter accepts the following options:
  886. @table @option
  887. @item loop
  888. Set the number of loops.
  889. @item size
  890. Set maximal number of samples.
  891. @item start
  892. Set first sample of loop.
  893. @end table
  894. @anchor{amerge}
  895. @section amerge
  896. Merge two or more audio streams into a single multi-channel stream.
  897. The filter accepts the following options:
  898. @table @option
  899. @item inputs
  900. Set the number of inputs. Default is 2.
  901. @end table
  902. If the channel layouts of the inputs are disjoint, and therefore compatible,
  903. the channel layout of the output will be set accordingly and the channels
  904. will be reordered as necessary. If the channel layouts of the inputs are not
  905. disjoint, the output will have all the channels of the first input then all
  906. the channels of the second input, in that order, and the channel layout of
  907. the output will be the default value corresponding to the total number of
  908. channels.
  909. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  910. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  911. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  912. first input, b1 is the first channel of the second input).
  913. On the other hand, if both input are in stereo, the output channels will be
  914. in the default order: a1, a2, b1, b2, and the channel layout will be
  915. arbitrarily set to 4.0, which may or may not be the expected value.
  916. All inputs must have the same sample rate, and format.
  917. If inputs do not have the same duration, the output will stop with the
  918. shortest.
  919. @subsection Examples
  920. @itemize
  921. @item
  922. Merge two mono files into a stereo stream:
  923. @example
  924. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  925. @end example
  926. @item
  927. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  928. @example
  929. 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
  930. @end example
  931. @end itemize
  932. @section amix
  933. Mixes multiple audio inputs into a single output.
  934. Note that this filter only supports float samples (the @var{amerge}
  935. and @var{pan} audio filters support many formats). If the @var{amix}
  936. input has integer samples then @ref{aresample} will be automatically
  937. inserted to perform the conversion to float samples.
  938. For example
  939. @example
  940. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  941. @end example
  942. will mix 3 input audio streams to a single output with the same duration as the
  943. first input and a dropout transition time of 3 seconds.
  944. It accepts the following parameters:
  945. @table @option
  946. @item inputs
  947. The number of inputs. If unspecified, it defaults to 2.
  948. @item duration
  949. How to determine the end-of-stream.
  950. @table @option
  951. @item longest
  952. The duration of the longest input. (default)
  953. @item shortest
  954. The duration of the shortest input.
  955. @item first
  956. The duration of the first input.
  957. @end table
  958. @item dropout_transition
  959. The transition time, in seconds, for volume renormalization when an input
  960. stream ends. The default value is 2 seconds.
  961. @end table
  962. @section anequalizer
  963. High-order parametric multiband equalizer for each channel.
  964. It accepts the following parameters:
  965. @table @option
  966. @item params
  967. This option string is in format:
  968. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  969. Each equalizer band is separated by '|'.
  970. @table @option
  971. @item chn
  972. Set channel number to which equalization will be applied.
  973. If input doesn't have that channel the entry is ignored.
  974. @item f
  975. Set central frequency for band.
  976. If input doesn't have that frequency the entry is ignored.
  977. @item w
  978. Set band width in hertz.
  979. @item g
  980. Set band gain in dB.
  981. @item t
  982. Set filter type for band, optional, can be:
  983. @table @samp
  984. @item 0
  985. Butterworth, this is default.
  986. @item 1
  987. Chebyshev type 1.
  988. @item 2
  989. Chebyshev type 2.
  990. @end table
  991. @end table
  992. @item curves
  993. With this option activated frequency response of anequalizer is displayed
  994. in video stream.
  995. @item size
  996. Set video stream size. Only useful if curves option is activated.
  997. @item mgain
  998. Set max gain that will be displayed. Only useful if curves option is activated.
  999. Setting this to a reasonable value makes it possible to display gain which is derived from
  1000. neighbour bands which are too close to each other and thus produce higher gain
  1001. when both are activated.
  1002. @item fscale
  1003. Set frequency scale used to draw frequency response in video output.
  1004. Can be linear or logarithmic. Default is logarithmic.
  1005. @item colors
  1006. Set color for each channel curve which is going to be displayed in video stream.
  1007. This is list of color names separated by space or by '|'.
  1008. Unrecognised or missing colors will be replaced by white color.
  1009. @end table
  1010. @subsection Examples
  1011. @itemize
  1012. @item
  1013. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1014. for first 2 channels using Chebyshev type 1 filter:
  1015. @example
  1016. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1017. @end example
  1018. @end itemize
  1019. @subsection Commands
  1020. This filter supports the following commands:
  1021. @table @option
  1022. @item change
  1023. Alter existing filter parameters.
  1024. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1025. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1026. error is returned.
  1027. @var{freq} set new frequency parameter.
  1028. @var{width} set new width parameter in herz.
  1029. @var{gain} set new gain parameter in dB.
  1030. Full filter invocation with asendcmd may look like this:
  1031. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1032. @end table
  1033. @section anull
  1034. Pass the audio source unchanged to the output.
  1035. @section apad
  1036. Pad the end of an audio stream with silence.
  1037. This can be used together with @command{ffmpeg} @option{-shortest} to
  1038. extend audio streams to the same length as the video stream.
  1039. A description of the accepted options follows.
  1040. @table @option
  1041. @item packet_size
  1042. Set silence packet size. Default value is 4096.
  1043. @item pad_len
  1044. Set the number of samples of silence to add to the end. After the
  1045. value is reached, the stream is terminated. This option is mutually
  1046. exclusive with @option{whole_len}.
  1047. @item whole_len
  1048. Set the minimum total number of samples in the output audio stream. If
  1049. the value is longer than the input audio length, silence is added to
  1050. the end, until the value is reached. This option is mutually exclusive
  1051. with @option{pad_len}.
  1052. @end table
  1053. If neither the @option{pad_len} nor the @option{whole_len} option is
  1054. set, the filter will add silence to the end of the input stream
  1055. indefinitely.
  1056. @subsection Examples
  1057. @itemize
  1058. @item
  1059. Add 1024 samples of silence to the end of the input:
  1060. @example
  1061. apad=pad_len=1024
  1062. @end example
  1063. @item
  1064. Make sure the audio output will contain at least 10000 samples, pad
  1065. the input with silence if required:
  1066. @example
  1067. apad=whole_len=10000
  1068. @end example
  1069. @item
  1070. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1071. video stream will always result the shortest and will be converted
  1072. until the end in the output file when using the @option{shortest}
  1073. option:
  1074. @example
  1075. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1076. @end example
  1077. @end itemize
  1078. @section aphaser
  1079. Add a phasing effect to the input audio.
  1080. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1081. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1082. A description of the accepted parameters follows.
  1083. @table @option
  1084. @item in_gain
  1085. Set input gain. Default is 0.4.
  1086. @item out_gain
  1087. Set output gain. Default is 0.74
  1088. @item delay
  1089. Set delay in milliseconds. Default is 3.0.
  1090. @item decay
  1091. Set decay. Default is 0.4.
  1092. @item speed
  1093. Set modulation speed in Hz. Default is 0.5.
  1094. @item type
  1095. Set modulation type. Default is triangular.
  1096. It accepts the following values:
  1097. @table @samp
  1098. @item triangular, t
  1099. @item sinusoidal, s
  1100. @end table
  1101. @end table
  1102. @section apulsator
  1103. Audio pulsator is something between an autopanner and a tremolo.
  1104. But it can produce funny stereo effects as well. Pulsator changes the volume
  1105. of the left and right channel based on a LFO (low frequency oscillator) with
  1106. different waveforms and shifted phases.
  1107. This filter have the ability to define an offset between left and right
  1108. channel. An offset of 0 means that both LFO shapes match each other.
  1109. The left and right channel are altered equally - a conventional tremolo.
  1110. An offset of 50% means that the shape of the right channel is exactly shifted
  1111. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1112. an autopanner. At 1 both curves match again. Every setting in between moves the
  1113. phase shift gapless between all stages and produces some "bypassing" sounds with
  1114. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1115. the 0.5) the faster the signal passes from the left to the right speaker.
  1116. The filter accepts the following options:
  1117. @table @option
  1118. @item level_in
  1119. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1120. @item level_out
  1121. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1122. @item mode
  1123. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1124. sawup or sawdown. Default is sine.
  1125. @item amount
  1126. Set modulation. Define how much of original signal is affected by the LFO.
  1127. @item offset_l
  1128. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1129. @item offset_r
  1130. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1131. @item width
  1132. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1133. @item timing
  1134. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1135. @item bpm
  1136. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1137. is set to bpm.
  1138. @item ms
  1139. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1140. is set to ms.
  1141. @item hz
  1142. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1143. if timing is set to hz.
  1144. @end table
  1145. @anchor{aresample}
  1146. @section aresample
  1147. Resample the input audio to the specified parameters, using the
  1148. libswresample library. If none are specified then the filter will
  1149. automatically convert between its input and output.
  1150. This filter is also able to stretch/squeeze the audio data to make it match
  1151. the timestamps or to inject silence / cut out audio to make it match the
  1152. timestamps, do a combination of both or do neither.
  1153. The filter accepts the syntax
  1154. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1155. expresses a sample rate and @var{resampler_options} is a list of
  1156. @var{key}=@var{value} pairs, separated by ":". See the
  1157. @ref{Resampler Options,,the "Resampler Options" section in the
  1158. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1159. for the complete list of supported options.
  1160. @subsection Examples
  1161. @itemize
  1162. @item
  1163. Resample the input audio to 44100Hz:
  1164. @example
  1165. aresample=44100
  1166. @end example
  1167. @item
  1168. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1169. samples per second compensation:
  1170. @example
  1171. aresample=async=1000
  1172. @end example
  1173. @end itemize
  1174. @section areverse
  1175. Reverse an audio clip.
  1176. Warning: This filter requires memory to buffer the entire clip, so trimming
  1177. is suggested.
  1178. @subsection Examples
  1179. @itemize
  1180. @item
  1181. Take the first 5 seconds of a clip, and reverse it.
  1182. @example
  1183. atrim=end=5,areverse
  1184. @end example
  1185. @end itemize
  1186. @section asetnsamples
  1187. Set the number of samples per each output audio frame.
  1188. The last output packet may contain a different number of samples, as
  1189. the filter will flush all the remaining samples when the input audio
  1190. signals its end.
  1191. The filter accepts the following options:
  1192. @table @option
  1193. @item nb_out_samples, n
  1194. Set the number of frames per each output audio frame. The number is
  1195. intended as the number of samples @emph{per each channel}.
  1196. Default value is 1024.
  1197. @item pad, p
  1198. If set to 1, the filter will pad the last audio frame with zeroes, so
  1199. that the last frame will contain the same number of samples as the
  1200. previous ones. Default value is 1.
  1201. @end table
  1202. For example, to set the number of per-frame samples to 1234 and
  1203. disable padding for the last frame, use:
  1204. @example
  1205. asetnsamples=n=1234:p=0
  1206. @end example
  1207. @section asetrate
  1208. Set the sample rate without altering the PCM data.
  1209. This will result in a change of speed and pitch.
  1210. The filter accepts the following options:
  1211. @table @option
  1212. @item sample_rate, r
  1213. Set the output sample rate. Default is 44100 Hz.
  1214. @end table
  1215. @section ashowinfo
  1216. Show a line containing various information for each input audio frame.
  1217. The input audio is not modified.
  1218. The shown line contains a sequence of key/value pairs of the form
  1219. @var{key}:@var{value}.
  1220. The following values are shown in the output:
  1221. @table @option
  1222. @item n
  1223. The (sequential) number of the input frame, starting from 0.
  1224. @item pts
  1225. The presentation timestamp of the input frame, in time base units; the time base
  1226. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1227. @item pts_time
  1228. The presentation timestamp of the input frame in seconds.
  1229. @item pos
  1230. position of the frame in the input stream, -1 if this information in
  1231. unavailable and/or meaningless (for example in case of synthetic audio)
  1232. @item fmt
  1233. The sample format.
  1234. @item chlayout
  1235. The channel layout.
  1236. @item rate
  1237. The sample rate for the audio frame.
  1238. @item nb_samples
  1239. The number of samples (per channel) in the frame.
  1240. @item checksum
  1241. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1242. audio, the data is treated as if all the planes were concatenated.
  1243. @item plane_checksums
  1244. A list of Adler-32 checksums for each data plane.
  1245. @end table
  1246. @anchor{astats}
  1247. @section astats
  1248. Display time domain statistical information about the audio channels.
  1249. Statistics are calculated and displayed for each audio channel and,
  1250. where applicable, an overall figure is also given.
  1251. It accepts the following option:
  1252. @table @option
  1253. @item length
  1254. Short window length in seconds, used for peak and trough RMS measurement.
  1255. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  1256. @item metadata
  1257. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1258. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1259. disabled.
  1260. Available keys for each channel are:
  1261. DC_offset
  1262. Min_level
  1263. Max_level
  1264. Min_difference
  1265. Max_difference
  1266. Mean_difference
  1267. RMS_difference
  1268. Peak_level
  1269. RMS_peak
  1270. RMS_trough
  1271. Crest_factor
  1272. Flat_factor
  1273. Peak_count
  1274. Bit_depth
  1275. Dynamic_range
  1276. and for Overall:
  1277. DC_offset
  1278. Min_level
  1279. Max_level
  1280. Min_difference
  1281. Max_difference
  1282. Mean_difference
  1283. RMS_difference
  1284. Peak_level
  1285. RMS_level
  1286. RMS_peak
  1287. RMS_trough
  1288. Flat_factor
  1289. Peak_count
  1290. Bit_depth
  1291. Number_of_samples
  1292. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1293. this @code{lavfi.astats.Overall.Peak_count}.
  1294. For description what each key means read below.
  1295. @item reset
  1296. Set number of frame after which stats are going to be recalculated.
  1297. Default is disabled.
  1298. @end table
  1299. A description of each shown parameter follows:
  1300. @table @option
  1301. @item DC offset
  1302. Mean amplitude displacement from zero.
  1303. @item Min level
  1304. Minimal sample level.
  1305. @item Max level
  1306. Maximal sample level.
  1307. @item Min difference
  1308. Minimal difference between two consecutive samples.
  1309. @item Max difference
  1310. Maximal difference between two consecutive samples.
  1311. @item Mean difference
  1312. Mean difference between two consecutive samples.
  1313. The average of each difference between two consecutive samples.
  1314. @item RMS difference
  1315. Root Mean Square difference between two consecutive samples.
  1316. @item Peak level dB
  1317. @item RMS level dB
  1318. Standard peak and RMS level measured in dBFS.
  1319. @item RMS peak dB
  1320. @item RMS trough dB
  1321. Peak and trough values for RMS level measured over a short window.
  1322. @item Crest factor
  1323. Standard ratio of peak to RMS level (note: not in dB).
  1324. @item Flat factor
  1325. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1326. (i.e. either @var{Min level} or @var{Max level}).
  1327. @item Peak count
  1328. Number of occasions (not the number of samples) that the signal attained either
  1329. @var{Min level} or @var{Max level}.
  1330. @item Bit depth
  1331. Overall bit depth of audio. Number of bits used for each sample.
  1332. @item Dynamic range
  1333. Measured dynamic range of audio in dB.
  1334. @end table
  1335. @section atempo
  1336. Adjust audio tempo.
  1337. The filter accepts exactly one parameter, the audio tempo. If not
  1338. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1339. be in the [0.5, 2.0] range.
  1340. @subsection Examples
  1341. @itemize
  1342. @item
  1343. Slow down audio to 80% tempo:
  1344. @example
  1345. atempo=0.8
  1346. @end example
  1347. @item
  1348. To speed up audio to 125% tempo:
  1349. @example
  1350. atempo=1.25
  1351. @end example
  1352. @end itemize
  1353. @section atrim
  1354. Trim the input so that the output contains one continuous subpart of the input.
  1355. It accepts the following parameters:
  1356. @table @option
  1357. @item start
  1358. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1359. sample with the timestamp @var{start} will be the first sample in the output.
  1360. @item end
  1361. Specify time of the first audio sample that will be dropped, i.e. the
  1362. audio sample immediately preceding the one with the timestamp @var{end} will be
  1363. the last sample in the output.
  1364. @item start_pts
  1365. Same as @var{start}, except this option sets the start timestamp in samples
  1366. instead of seconds.
  1367. @item end_pts
  1368. Same as @var{end}, except this option sets the end timestamp in samples instead
  1369. of seconds.
  1370. @item duration
  1371. The maximum duration of the output in seconds.
  1372. @item start_sample
  1373. The number of the first sample that should be output.
  1374. @item end_sample
  1375. The number of the first sample that should be dropped.
  1376. @end table
  1377. @option{start}, @option{end}, and @option{duration} are expressed as time
  1378. duration specifications; see
  1379. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1380. Note that the first two sets of the start/end options and the @option{duration}
  1381. option look at the frame timestamp, while the _sample options simply count the
  1382. samples that pass through the filter. So start/end_pts and start/end_sample will
  1383. give different results when the timestamps are wrong, inexact or do not start at
  1384. zero. Also note that this filter does not modify the timestamps. If you wish
  1385. to have the output timestamps start at zero, insert the asetpts filter after the
  1386. atrim filter.
  1387. If multiple start or end options are set, this filter tries to be greedy and
  1388. keep all samples that match at least one of the specified constraints. To keep
  1389. only the part that matches all the constraints at once, chain multiple atrim
  1390. filters.
  1391. The defaults are such that all the input is kept. So it is possible to set e.g.
  1392. just the end values to keep everything before the specified time.
  1393. Examples:
  1394. @itemize
  1395. @item
  1396. Drop everything except the second minute of input:
  1397. @example
  1398. ffmpeg -i INPUT -af atrim=60:120
  1399. @end example
  1400. @item
  1401. Keep only the first 1000 samples:
  1402. @example
  1403. ffmpeg -i INPUT -af atrim=end_sample=1000
  1404. @end example
  1405. @end itemize
  1406. @section bandpass
  1407. Apply a two-pole Butterworth band-pass filter with central
  1408. frequency @var{frequency}, and (3dB-point) band-width width.
  1409. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1410. instead of the default: constant 0dB peak gain.
  1411. The filter roll off at 6dB per octave (20dB per decade).
  1412. The filter accepts the following options:
  1413. @table @option
  1414. @item frequency, f
  1415. Set the filter's central frequency. Default is @code{3000}.
  1416. @item csg
  1417. Constant skirt gain if set to 1. Defaults to 0.
  1418. @item width_type, t
  1419. Set method to specify band-width of filter.
  1420. @table @option
  1421. @item h
  1422. Hz
  1423. @item q
  1424. Q-Factor
  1425. @item o
  1426. octave
  1427. @item s
  1428. slope
  1429. @end table
  1430. @item width, w
  1431. Specify the band-width of a filter in width_type units.
  1432. @item channels, c
  1433. Specify which channels to filter, by default all available are filtered.
  1434. @end table
  1435. @section bandreject
  1436. Apply a two-pole Butterworth band-reject filter with central
  1437. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1438. The filter roll off at 6dB per octave (20dB per decade).
  1439. The filter accepts the following options:
  1440. @table @option
  1441. @item frequency, f
  1442. Set the filter's central frequency. Default is @code{3000}.
  1443. @item width_type, t
  1444. Set method to specify band-width of filter.
  1445. @table @option
  1446. @item h
  1447. Hz
  1448. @item q
  1449. Q-Factor
  1450. @item o
  1451. octave
  1452. @item s
  1453. slope
  1454. @end table
  1455. @item width, w
  1456. Specify the band-width of a filter in width_type units.
  1457. @item channels, c
  1458. Specify which channels to filter, by default all available are filtered.
  1459. @end table
  1460. @section bass
  1461. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1462. shelving filter with a response similar to that of a standard
  1463. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1464. The filter accepts the following options:
  1465. @table @option
  1466. @item gain, g
  1467. Give the gain at 0 Hz. Its useful range is about -20
  1468. (for a large cut) to +20 (for a large boost).
  1469. Beware of clipping when using a positive gain.
  1470. @item frequency, f
  1471. Set the filter's central frequency and so can be used
  1472. to extend or reduce the frequency range to be boosted or cut.
  1473. The default value is @code{100} Hz.
  1474. @item width_type, t
  1475. Set method to specify band-width of filter.
  1476. @table @option
  1477. @item h
  1478. Hz
  1479. @item q
  1480. Q-Factor
  1481. @item o
  1482. octave
  1483. @item s
  1484. slope
  1485. @end table
  1486. @item width, w
  1487. Determine how steep is the filter's shelf transition.
  1488. @item channels, c
  1489. Specify which channels to filter, by default all available are filtered.
  1490. @end table
  1491. @section biquad
  1492. Apply a biquad IIR filter with the given coefficients.
  1493. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1494. are the numerator and denominator coefficients respectively.
  1495. and @var{channels}, @var{c} specify which channels to filter, by default all
  1496. available are filtered.
  1497. @section bs2b
  1498. Bauer stereo to binaural transformation, which improves headphone listening of
  1499. stereo audio records.
  1500. To enable compilation of this filter you need to configure FFmpeg with
  1501. @code{--enable-libbs2b}.
  1502. It accepts the following parameters:
  1503. @table @option
  1504. @item profile
  1505. Pre-defined crossfeed level.
  1506. @table @option
  1507. @item default
  1508. Default level (fcut=700, feed=50).
  1509. @item cmoy
  1510. Chu Moy circuit (fcut=700, feed=60).
  1511. @item jmeier
  1512. Jan Meier circuit (fcut=650, feed=95).
  1513. @end table
  1514. @item fcut
  1515. Cut frequency (in Hz).
  1516. @item feed
  1517. Feed level (in Hz).
  1518. @end table
  1519. @section channelmap
  1520. Remap input channels to new locations.
  1521. It accepts the following parameters:
  1522. @table @option
  1523. @item map
  1524. Map channels from input to output. The argument is a '|'-separated list of
  1525. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1526. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1527. channel (e.g. FL for front left) or its index in the input channel layout.
  1528. @var{out_channel} is the name of the output channel or its index in the output
  1529. channel layout. If @var{out_channel} is not given then it is implicitly an
  1530. index, starting with zero and increasing by one for each mapping.
  1531. @item channel_layout
  1532. The channel layout of the output stream.
  1533. @end table
  1534. If no mapping is present, the filter will implicitly map input channels to
  1535. output channels, preserving indices.
  1536. For example, assuming a 5.1+downmix input MOV file,
  1537. @example
  1538. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1539. @end example
  1540. will create an output WAV file tagged as stereo from the downmix channels of
  1541. the input.
  1542. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1543. @example
  1544. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1545. @end example
  1546. @section channelsplit
  1547. Split each channel from an input audio stream into a separate output stream.
  1548. It accepts the following parameters:
  1549. @table @option
  1550. @item channel_layout
  1551. The channel layout of the input stream. The default is "stereo".
  1552. @end table
  1553. For example, assuming a stereo input MP3 file,
  1554. @example
  1555. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1556. @end example
  1557. will create an output Matroska file with two audio streams, one containing only
  1558. the left channel and the other the right channel.
  1559. Split a 5.1 WAV file into per-channel files:
  1560. @example
  1561. ffmpeg -i in.wav -filter_complex
  1562. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1563. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1564. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1565. side_right.wav
  1566. @end example
  1567. @section chorus
  1568. Add a chorus effect to the audio.
  1569. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1570. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1571. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1572. The modulation depth defines the range the modulated delay is played before or after
  1573. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1574. sound tuned around the original one, like in a chorus where some vocals are slightly
  1575. off key.
  1576. It accepts the following parameters:
  1577. @table @option
  1578. @item in_gain
  1579. Set input gain. Default is 0.4.
  1580. @item out_gain
  1581. Set output gain. Default is 0.4.
  1582. @item delays
  1583. Set delays. A typical delay is around 40ms to 60ms.
  1584. @item decays
  1585. Set decays.
  1586. @item speeds
  1587. Set speeds.
  1588. @item depths
  1589. Set depths.
  1590. @end table
  1591. @subsection Examples
  1592. @itemize
  1593. @item
  1594. A single delay:
  1595. @example
  1596. chorus=0.7:0.9:55:0.4:0.25:2
  1597. @end example
  1598. @item
  1599. Two delays:
  1600. @example
  1601. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1602. @end example
  1603. @item
  1604. Fuller sounding chorus with three delays:
  1605. @example
  1606. 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
  1607. @end example
  1608. @end itemize
  1609. @section compand
  1610. Compress or expand the audio's dynamic range.
  1611. It accepts the following parameters:
  1612. @table @option
  1613. @item attacks
  1614. @item decays
  1615. A list of times in seconds for each channel over which the instantaneous level
  1616. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1617. increase of volume and @var{decays} refers to decrease of volume. For most
  1618. situations, the attack time (response to the audio getting louder) should be
  1619. shorter than the decay time, because the human ear is more sensitive to sudden
  1620. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1621. a typical value for decay is 0.8 seconds.
  1622. If specified number of attacks & decays is lower than number of channels, the last
  1623. set attack/decay will be used for all remaining channels.
  1624. @item points
  1625. A list of points for the transfer function, specified in dB relative to the
  1626. maximum possible signal amplitude. Each key points list must be defined using
  1627. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1628. @code{x0/y0 x1/y1 x2/y2 ....}
  1629. The input values must be in strictly increasing order but the transfer function
  1630. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1631. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1632. function are @code{-70/-70|-60/-20|1/0}.
  1633. @item soft-knee
  1634. Set the curve radius in dB for all joints. It defaults to 0.01.
  1635. @item gain
  1636. Set the additional gain in dB to be applied at all points on the transfer
  1637. function. This allows for easy adjustment of the overall gain.
  1638. It defaults to 0.
  1639. @item volume
  1640. Set an initial volume, in dB, to be assumed for each channel when filtering
  1641. starts. This permits the user to supply a nominal level initially, so that, for
  1642. example, a very large gain is not applied to initial signal levels before the
  1643. companding has begun to operate. A typical value for audio which is initially
  1644. quiet is -90 dB. It defaults to 0.
  1645. @item delay
  1646. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1647. delayed before being fed to the volume adjuster. Specifying a delay
  1648. approximately equal to the attack/decay times allows the filter to effectively
  1649. operate in predictive rather than reactive mode. It defaults to 0.
  1650. @end table
  1651. @subsection Examples
  1652. @itemize
  1653. @item
  1654. Make music with both quiet and loud passages suitable for listening to in a
  1655. noisy environment:
  1656. @example
  1657. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1658. @end example
  1659. Another example for audio with whisper and explosion parts:
  1660. @example
  1661. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1662. @end example
  1663. @item
  1664. A noise gate for when the noise is at a lower level than the signal:
  1665. @example
  1666. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1667. @end example
  1668. @item
  1669. Here is another noise gate, this time for when the noise is at a higher level
  1670. than the signal (making it, in some ways, similar to squelch):
  1671. @example
  1672. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1673. @end example
  1674. @item
  1675. 2:1 compression starting at -6dB:
  1676. @example
  1677. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1678. @end example
  1679. @item
  1680. 2:1 compression starting at -9dB:
  1681. @example
  1682. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1683. @end example
  1684. @item
  1685. 2:1 compression starting at -12dB:
  1686. @example
  1687. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1688. @end example
  1689. @item
  1690. 2:1 compression starting at -18dB:
  1691. @example
  1692. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1693. @end example
  1694. @item
  1695. 3:1 compression starting at -15dB:
  1696. @example
  1697. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1698. @end example
  1699. @item
  1700. Compressor/Gate:
  1701. @example
  1702. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1703. @end example
  1704. @item
  1705. Expander:
  1706. @example
  1707. 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
  1708. @end example
  1709. @item
  1710. Hard limiter at -6dB:
  1711. @example
  1712. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1713. @end example
  1714. @item
  1715. Hard limiter at -12dB:
  1716. @example
  1717. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1718. @end example
  1719. @item
  1720. Hard noise gate at -35 dB:
  1721. @example
  1722. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1723. @end example
  1724. @item
  1725. Soft limiter:
  1726. @example
  1727. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1728. @end example
  1729. @end itemize
  1730. @section compensationdelay
  1731. Compensation Delay Line is a metric based delay to compensate differing
  1732. positions of microphones or speakers.
  1733. For example, you have recorded guitar with two microphones placed in
  1734. different location. Because the front of sound wave has fixed speed in
  1735. normal conditions, the phasing of microphones can vary and depends on
  1736. their location and interposition. The best sound mix can be achieved when
  1737. these microphones are in phase (synchronized). Note that distance of
  1738. ~30 cm between microphones makes one microphone to capture signal in
  1739. antiphase to another microphone. That makes the final mix sounding moody.
  1740. This filter helps to solve phasing problems by adding different delays
  1741. to each microphone track and make them synchronized.
  1742. The best result can be reached when you take one track as base and
  1743. synchronize other tracks one by one with it.
  1744. Remember that synchronization/delay tolerance depends on sample rate, too.
  1745. Higher sample rates will give more tolerance.
  1746. It accepts the following parameters:
  1747. @table @option
  1748. @item mm
  1749. Set millimeters distance. This is compensation distance for fine tuning.
  1750. Default is 0.
  1751. @item cm
  1752. Set cm distance. This is compensation distance for tightening distance setup.
  1753. Default is 0.
  1754. @item m
  1755. Set meters distance. This is compensation distance for hard distance setup.
  1756. Default is 0.
  1757. @item dry
  1758. Set dry amount. Amount of unprocessed (dry) signal.
  1759. Default is 0.
  1760. @item wet
  1761. Set wet amount. Amount of processed (wet) signal.
  1762. Default is 1.
  1763. @item temp
  1764. Set temperature degree in Celsius. This is the temperature of the environment.
  1765. Default is 20.
  1766. @end table
  1767. @section crossfeed
  1768. Apply headphone crossfeed filter.
  1769. Crossfeed is the process of blending the left and right channels of stereo
  1770. audio recording.
  1771. It is mainly used to reduce extreme stereo separation of low frequencies.
  1772. The intent is to produce more speaker like sound to the listener.
  1773. The filter accepts the following options:
  1774. @table @option
  1775. @item strength
  1776. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  1777. This sets gain of low shelf filter for side part of stereo image.
  1778. Default is -6dB. Max allowed is -30db when strength is set to 1.
  1779. @item range
  1780. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  1781. This sets cut off frequency of low shelf filter. Default is cut off near
  1782. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  1783. @item level_in
  1784. Set input gain. Default is 0.9.
  1785. @item level_out
  1786. Set output gain. Default is 1.
  1787. @end table
  1788. @section crystalizer
  1789. Simple algorithm to expand audio dynamic range.
  1790. The filter accepts the following options:
  1791. @table @option
  1792. @item i
  1793. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  1794. (unchanged sound) to 10.0 (maximum effect).
  1795. @item c
  1796. Enable clipping. By default is enabled.
  1797. @end table
  1798. @section dcshift
  1799. Apply a DC shift to the audio.
  1800. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1801. in the recording chain) from the audio. The effect of a DC offset is reduced
  1802. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1803. a signal has a DC offset.
  1804. @table @option
  1805. @item shift
  1806. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1807. the audio.
  1808. @item limitergain
  1809. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1810. used to prevent clipping.
  1811. @end table
  1812. @section dynaudnorm
  1813. Dynamic Audio Normalizer.
  1814. This filter applies a certain amount of gain to the input audio in order
  1815. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1816. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1817. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1818. This allows for applying extra gain to the "quiet" sections of the audio
  1819. while avoiding distortions or clipping the "loud" sections. In other words:
  1820. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1821. sections, in the sense that the volume of each section is brought to the
  1822. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1823. this goal *without* applying "dynamic range compressing". It will retain 100%
  1824. of the dynamic range *within* each section of the audio file.
  1825. @table @option
  1826. @item f
  1827. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1828. Default is 500 milliseconds.
  1829. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1830. referred to as frames. This is required, because a peak magnitude has no
  1831. meaning for just a single sample value. Instead, we need to determine the
  1832. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1833. normalizer would simply use the peak magnitude of the complete file, the
  1834. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1835. frame. The length of a frame is specified in milliseconds. By default, the
  1836. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1837. been found to give good results with most files.
  1838. Note that the exact frame length, in number of samples, will be determined
  1839. automatically, based on the sampling rate of the individual input audio file.
  1840. @item g
  1841. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1842. number. Default is 31.
  1843. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1844. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1845. is specified in frames, centered around the current frame. For the sake of
  1846. simplicity, this must be an odd number. Consequently, the default value of 31
  1847. takes into account the current frame, as well as the 15 preceding frames and
  1848. the 15 subsequent frames. Using a larger window results in a stronger
  1849. smoothing effect and thus in less gain variation, i.e. slower gain
  1850. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1851. effect and thus in more gain variation, i.e. faster gain adaptation.
  1852. In other words, the more you increase this value, the more the Dynamic Audio
  1853. Normalizer will behave like a "traditional" normalization filter. On the
  1854. contrary, the more you decrease this value, the more the Dynamic Audio
  1855. Normalizer will behave like a dynamic range compressor.
  1856. @item p
  1857. Set the target peak value. This specifies the highest permissible magnitude
  1858. level for the normalized audio input. This filter will try to approach the
  1859. target peak magnitude as closely as possible, but at the same time it also
  1860. makes sure that the normalized signal will never exceed the peak magnitude.
  1861. A frame's maximum local gain factor is imposed directly by the target peak
  1862. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1863. It is not recommended to go above this value.
  1864. @item m
  1865. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1866. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1867. factor for each input frame, i.e. the maximum gain factor that does not
  1868. result in clipping or distortion. The maximum gain factor is determined by
  1869. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1870. additionally bounds the frame's maximum gain factor by a predetermined
  1871. (global) maximum gain factor. This is done in order to avoid excessive gain
  1872. factors in "silent" or almost silent frames. By default, the maximum gain
  1873. factor is 10.0, For most inputs the default value should be sufficient and
  1874. it usually is not recommended to increase this value. Though, for input
  1875. with an extremely low overall volume level, it may be necessary to allow even
  1876. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1877. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1878. Instead, a "sigmoid" threshold function will be applied. This way, the
  1879. gain factors will smoothly approach the threshold value, but never exceed that
  1880. value.
  1881. @item r
  1882. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1883. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1884. This means that the maximum local gain factor for each frame is defined
  1885. (only) by the frame's highest magnitude sample. This way, the samples can
  1886. be amplified as much as possible without exceeding the maximum signal
  1887. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1888. Normalizer can also take into account the frame's root mean square,
  1889. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1890. determine the power of a time-varying signal. It is therefore considered
  1891. that the RMS is a better approximation of the "perceived loudness" than
  1892. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1893. frames to a constant RMS value, a uniform "perceived loudness" can be
  1894. established. If a target RMS value has been specified, a frame's local gain
  1895. factor is defined as the factor that would result in exactly that RMS value.
  1896. Note, however, that the maximum local gain factor is still restricted by the
  1897. frame's highest magnitude sample, in order to prevent clipping.
  1898. @item n
  1899. Enable channels coupling. By default is enabled.
  1900. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1901. amount. This means the same gain factor will be applied to all channels, i.e.
  1902. the maximum possible gain factor is determined by the "loudest" channel.
  1903. However, in some recordings, it may happen that the volume of the different
  1904. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1905. In this case, this option can be used to disable the channel coupling. This way,
  1906. the gain factor will be determined independently for each channel, depending
  1907. only on the individual channel's highest magnitude sample. This allows for
  1908. harmonizing the volume of the different channels.
  1909. @item c
  1910. Enable DC bias correction. By default is disabled.
  1911. An audio signal (in the time domain) is a sequence of sample values.
  1912. In the Dynamic Audio Normalizer these sample values are represented in the
  1913. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1914. audio signal, or "waveform", should be centered around the zero point.
  1915. That means if we calculate the mean value of all samples in a file, or in a
  1916. single frame, then the result should be 0.0 or at least very close to that
  1917. value. If, however, there is a significant deviation of the mean value from
  1918. 0.0, in either positive or negative direction, this is referred to as a
  1919. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1920. Audio Normalizer provides optional DC bias correction.
  1921. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1922. the mean value, or "DC correction" offset, of each input frame and subtract
  1923. that value from all of the frame's sample values which ensures those samples
  1924. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1925. boundaries, the DC correction offset values will be interpolated smoothly
  1926. between neighbouring frames.
  1927. @item b
  1928. Enable alternative boundary mode. By default is disabled.
  1929. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1930. around each frame. This includes the preceding frames as well as the
  1931. subsequent frames. However, for the "boundary" frames, located at the very
  1932. beginning and at the very end of the audio file, not all neighbouring
  1933. frames are available. In particular, for the first few frames in the audio
  1934. file, the preceding frames are not known. And, similarly, for the last few
  1935. frames in the audio file, the subsequent frames are not known. Thus, the
  1936. question arises which gain factors should be assumed for the missing frames
  1937. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1938. to deal with this situation. The default boundary mode assumes a gain factor
  1939. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1940. "fade out" at the beginning and at the end of the input, respectively.
  1941. @item s
  1942. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1943. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1944. compression. This means that signal peaks will not be pruned and thus the
  1945. full dynamic range will be retained within each local neighbourhood. However,
  1946. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1947. normalization algorithm with a more "traditional" compression.
  1948. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1949. (thresholding) function. If (and only if) the compression feature is enabled,
  1950. all input frames will be processed by a soft knee thresholding function prior
  1951. to the actual normalization process. Put simply, the thresholding function is
  1952. going to prune all samples whose magnitude exceeds a certain threshold value.
  1953. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1954. value. Instead, the threshold value will be adjusted for each individual
  1955. frame.
  1956. In general, smaller parameters result in stronger compression, and vice versa.
  1957. Values below 3.0 are not recommended, because audible distortion may appear.
  1958. @end table
  1959. @section earwax
  1960. Make audio easier to listen to on headphones.
  1961. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1962. so that when listened to on headphones the stereo image is moved from
  1963. inside your head (standard for headphones) to outside and in front of
  1964. the listener (standard for speakers).
  1965. Ported from SoX.
  1966. @section equalizer
  1967. Apply a two-pole peaking equalisation (EQ) filter. With this
  1968. filter, the signal-level at and around a selected frequency can
  1969. be increased or decreased, whilst (unlike bandpass and bandreject
  1970. filters) that at all other frequencies is unchanged.
  1971. In order to produce complex equalisation curves, this filter can
  1972. be given several times, each with a different central frequency.
  1973. The filter accepts the following options:
  1974. @table @option
  1975. @item frequency, f
  1976. Set the filter's central frequency in Hz.
  1977. @item width_type, t
  1978. Set method to specify band-width of filter.
  1979. @table @option
  1980. @item h
  1981. Hz
  1982. @item q
  1983. Q-Factor
  1984. @item o
  1985. octave
  1986. @item s
  1987. slope
  1988. @end table
  1989. @item width, w
  1990. Specify the band-width of a filter in width_type units.
  1991. @item gain, g
  1992. Set the required gain or attenuation in dB.
  1993. Beware of clipping when using a positive gain.
  1994. @item channels, c
  1995. Specify which channels to filter, by default all available are filtered.
  1996. @end table
  1997. @subsection Examples
  1998. @itemize
  1999. @item
  2000. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2001. @example
  2002. equalizer=f=1000:t=h:width=200:g=-10
  2003. @end example
  2004. @item
  2005. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2006. @example
  2007. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2008. @end example
  2009. @end itemize
  2010. @section extrastereo
  2011. Linearly increases the difference between left and right channels which
  2012. adds some sort of "live" effect to playback.
  2013. The filter accepts the following options:
  2014. @table @option
  2015. @item m
  2016. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2017. (average of both channels), with 1.0 sound will be unchanged, with
  2018. -1.0 left and right channels will be swapped.
  2019. @item c
  2020. Enable clipping. By default is enabled.
  2021. @end table
  2022. @section firequalizer
  2023. Apply FIR Equalization using arbitrary frequency response.
  2024. The filter accepts the following option:
  2025. @table @option
  2026. @item gain
  2027. Set gain curve equation (in dB). The expression can contain variables:
  2028. @table @option
  2029. @item f
  2030. the evaluated frequency
  2031. @item sr
  2032. sample rate
  2033. @item ch
  2034. channel number, set to 0 when multichannels evaluation is disabled
  2035. @item chid
  2036. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2037. multichannels evaluation is disabled
  2038. @item chs
  2039. number of channels
  2040. @item chlayout
  2041. channel_layout, see libavutil/channel_layout.h
  2042. @end table
  2043. and functions:
  2044. @table @option
  2045. @item gain_interpolate(f)
  2046. interpolate gain on frequency f based on gain_entry
  2047. @item cubic_interpolate(f)
  2048. same as gain_interpolate, but smoother
  2049. @end table
  2050. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2051. @item gain_entry
  2052. Set gain entry for gain_interpolate function. The expression can
  2053. contain functions:
  2054. @table @option
  2055. @item entry(f, g)
  2056. store gain entry at frequency f with value g
  2057. @end table
  2058. This option is also available as command.
  2059. @item delay
  2060. Set filter delay in seconds. Higher value means more accurate.
  2061. Default is @code{0.01}.
  2062. @item accuracy
  2063. Set filter accuracy in Hz. Lower value means more accurate.
  2064. Default is @code{5}.
  2065. @item wfunc
  2066. Set window function. Acceptable values are:
  2067. @table @option
  2068. @item rectangular
  2069. rectangular window, useful when gain curve is already smooth
  2070. @item hann
  2071. hann window (default)
  2072. @item hamming
  2073. hamming window
  2074. @item blackman
  2075. blackman window
  2076. @item nuttall3
  2077. 3-terms continuous 1st derivative nuttall window
  2078. @item mnuttall3
  2079. minimum 3-terms discontinuous nuttall window
  2080. @item nuttall
  2081. 4-terms continuous 1st derivative nuttall window
  2082. @item bnuttall
  2083. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2084. @item bharris
  2085. blackman-harris window
  2086. @item tukey
  2087. tukey window
  2088. @end table
  2089. @item fixed
  2090. If enabled, use fixed number of audio samples. This improves speed when
  2091. filtering with large delay. Default is disabled.
  2092. @item multi
  2093. Enable multichannels evaluation on gain. Default is disabled.
  2094. @item zero_phase
  2095. Enable zero phase mode by subtracting timestamp to compensate delay.
  2096. Default is disabled.
  2097. @item scale
  2098. Set scale used by gain. Acceptable values are:
  2099. @table @option
  2100. @item linlin
  2101. linear frequency, linear gain
  2102. @item linlog
  2103. linear frequency, logarithmic (in dB) gain (default)
  2104. @item loglin
  2105. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2106. @item loglog
  2107. logarithmic frequency, logarithmic gain
  2108. @end table
  2109. @item dumpfile
  2110. Set file for dumping, suitable for gnuplot.
  2111. @item dumpscale
  2112. Set scale for dumpfile. Acceptable values are same with scale option.
  2113. Default is linlog.
  2114. @item fft2
  2115. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2116. Default is disabled.
  2117. @item min_phase
  2118. Enable minimum phase impulse response. Default is disabled.
  2119. @end table
  2120. @subsection Examples
  2121. @itemize
  2122. @item
  2123. lowpass at 1000 Hz:
  2124. @example
  2125. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2126. @end example
  2127. @item
  2128. lowpass at 1000 Hz with gain_entry:
  2129. @example
  2130. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2131. @end example
  2132. @item
  2133. custom equalization:
  2134. @example
  2135. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2136. @end example
  2137. @item
  2138. higher delay with zero phase to compensate delay:
  2139. @example
  2140. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2141. @end example
  2142. @item
  2143. lowpass on left channel, highpass on right channel:
  2144. @example
  2145. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2146. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2147. @end example
  2148. @end itemize
  2149. @section flanger
  2150. Apply a flanging effect to the audio.
  2151. The filter accepts the following options:
  2152. @table @option
  2153. @item delay
  2154. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2155. @item depth
  2156. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2157. @item regen
  2158. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2159. Default value is 0.
  2160. @item width
  2161. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2162. Default value is 71.
  2163. @item speed
  2164. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2165. @item shape
  2166. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2167. Default value is @var{sinusoidal}.
  2168. @item phase
  2169. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2170. Default value is 25.
  2171. @item interp
  2172. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2173. Default is @var{linear}.
  2174. @end table
  2175. @section haas
  2176. Apply Haas effect to audio.
  2177. Note that this makes most sense to apply on mono signals.
  2178. With this filter applied to mono signals it give some directionality and
  2179. stretches its stereo image.
  2180. The filter accepts the following options:
  2181. @table @option
  2182. @item level_in
  2183. Set input level. By default is @var{1}, or 0dB
  2184. @item level_out
  2185. Set output level. By default is @var{1}, or 0dB.
  2186. @item side_gain
  2187. Set gain applied to side part of signal. By default is @var{1}.
  2188. @item middle_source
  2189. Set kind of middle source. Can be one of the following:
  2190. @table @samp
  2191. @item left
  2192. Pick left channel.
  2193. @item right
  2194. Pick right channel.
  2195. @item mid
  2196. Pick middle part signal of stereo image.
  2197. @item side
  2198. Pick side part signal of stereo image.
  2199. @end table
  2200. @item middle_phase
  2201. Change middle phase. By default is disabled.
  2202. @item left_delay
  2203. Set left channel delay. By default is @var{2.05} milliseconds.
  2204. @item left_balance
  2205. Set left channel balance. By default is @var{-1}.
  2206. @item left_gain
  2207. Set left channel gain. By default is @var{1}.
  2208. @item left_phase
  2209. Change left phase. By default is disabled.
  2210. @item right_delay
  2211. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2212. @item right_balance
  2213. Set right channel balance. By default is @var{1}.
  2214. @item right_gain
  2215. Set right channel gain. By default is @var{1}.
  2216. @item right_phase
  2217. Change right phase. By default is enabled.
  2218. @end table
  2219. @section hdcd
  2220. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2221. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2222. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2223. of HDCD, and detects the Transient Filter flag.
  2224. @example
  2225. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2226. @end example
  2227. When using the filter with wav, note the default encoding for wav is 16-bit,
  2228. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2229. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2230. @example
  2231. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2232. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2233. @end example
  2234. The filter accepts the following options:
  2235. @table @option
  2236. @item disable_autoconvert
  2237. Disable any automatic format conversion or resampling in the filter graph.
  2238. @item process_stereo
  2239. Process the stereo channels together. If target_gain does not match between
  2240. channels, consider it invalid and use the last valid target_gain.
  2241. @item cdt_ms
  2242. Set the code detect timer period in ms.
  2243. @item force_pe
  2244. Always extend peaks above -3dBFS even if PE isn't signaled.
  2245. @item analyze_mode
  2246. Replace audio with a solid tone and adjust the amplitude to signal some
  2247. specific aspect of the decoding process. The output file can be loaded in
  2248. an audio editor alongside the original to aid analysis.
  2249. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2250. Modes are:
  2251. @table @samp
  2252. @item 0, off
  2253. Disabled
  2254. @item 1, lle
  2255. Gain adjustment level at each sample
  2256. @item 2, pe
  2257. Samples where peak extend occurs
  2258. @item 3, cdt
  2259. Samples where the code detect timer is active
  2260. @item 4, tgm
  2261. Samples where the target gain does not match between channels
  2262. @end table
  2263. @end table
  2264. @section headphone
  2265. Apply head-related transfer functions (HRTFs) to create virtual
  2266. loudspeakers around the user for binaural listening via headphones.
  2267. The HRIRs are provided via additional streams, for each channel
  2268. one stereo input stream is needed.
  2269. The filter accepts the following options:
  2270. @table @option
  2271. @item map
  2272. Set mapping of input streams for convolution.
  2273. The argument is a '|'-separated list of channel names in order as they
  2274. are given as additional stream inputs for filter.
  2275. This also specify number of input streams. Number of input streams
  2276. must be not less than number of channels in first stream plus one.
  2277. @item gain
  2278. Set gain applied to audio. Value is in dB. Default is 0.
  2279. @item type
  2280. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2281. processing audio in time domain which is slow.
  2282. @var{freq} is processing audio in frequency domain which is fast.
  2283. Default is @var{freq}.
  2284. @item lfe
  2285. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2286. @end table
  2287. @subsection Examples
  2288. @itemize
  2289. @item
  2290. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2291. each amovie filter use stereo file with IR coefficients as input.
  2292. The files give coefficients for each position of virtual loudspeaker:
  2293. @example
  2294. 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"
  2295. output.wav
  2296. @end example
  2297. @end itemize
  2298. @section highpass
  2299. Apply a high-pass filter with 3dB point frequency.
  2300. The filter can be either single-pole, or double-pole (the default).
  2301. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2302. The filter accepts the following options:
  2303. @table @option
  2304. @item frequency, f
  2305. Set frequency in Hz. Default is 3000.
  2306. @item poles, p
  2307. Set number of poles. Default is 2.
  2308. @item width_type, t
  2309. Set method to specify band-width of filter.
  2310. @table @option
  2311. @item h
  2312. Hz
  2313. @item q
  2314. Q-Factor
  2315. @item o
  2316. octave
  2317. @item s
  2318. slope
  2319. @end table
  2320. @item width, w
  2321. Specify the band-width of a filter in width_type units.
  2322. Applies only to double-pole filter.
  2323. The default is 0.707q and gives a Butterworth response.
  2324. @item channels, c
  2325. Specify which channels to filter, by default all available are filtered.
  2326. @end table
  2327. @section join
  2328. Join multiple input streams into one multi-channel stream.
  2329. It accepts the following parameters:
  2330. @table @option
  2331. @item inputs
  2332. The number of input streams. It defaults to 2.
  2333. @item channel_layout
  2334. The desired output channel layout. It defaults to stereo.
  2335. @item map
  2336. Map channels from inputs to output. The argument is a '|'-separated list of
  2337. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2338. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2339. can be either the name of the input channel (e.g. FL for front left) or its
  2340. index in the specified input stream. @var{out_channel} is the name of the output
  2341. channel.
  2342. @end table
  2343. The filter will attempt to guess the mappings when they are not specified
  2344. explicitly. It does so by first trying to find an unused matching input channel
  2345. and if that fails it picks the first unused input channel.
  2346. Join 3 inputs (with properly set channel layouts):
  2347. @example
  2348. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2349. @end example
  2350. Build a 5.1 output from 6 single-channel streams:
  2351. @example
  2352. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2353. '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'
  2354. out
  2355. @end example
  2356. @section ladspa
  2357. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2358. To enable compilation of this filter you need to configure FFmpeg with
  2359. @code{--enable-ladspa}.
  2360. @table @option
  2361. @item file, f
  2362. Specifies the name of LADSPA plugin library to load. If the environment
  2363. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2364. each one of the directories specified by the colon separated list in
  2365. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2366. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2367. @file{/usr/lib/ladspa/}.
  2368. @item plugin, p
  2369. Specifies the plugin within the library. Some libraries contain only
  2370. one plugin, but others contain many of them. If this is not set filter
  2371. will list all available plugins within the specified library.
  2372. @item controls, c
  2373. Set the '|' separated list of controls which are zero or more floating point
  2374. values that determine the behavior of the loaded plugin (for example delay,
  2375. threshold or gain).
  2376. Controls need to be defined using the following syntax:
  2377. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2378. @var{valuei} is the value set on the @var{i}-th control.
  2379. Alternatively they can be also defined using the following syntax:
  2380. @var{value0}|@var{value1}|@var{value2}|..., where
  2381. @var{valuei} is the value set on the @var{i}-th control.
  2382. If @option{controls} is set to @code{help}, all available controls and
  2383. their valid ranges are printed.
  2384. @item sample_rate, s
  2385. Specify the sample rate, default to 44100. Only used if plugin have
  2386. zero inputs.
  2387. @item nb_samples, n
  2388. Set the number of samples per channel per each output frame, default
  2389. is 1024. Only used if plugin have zero inputs.
  2390. @item duration, d
  2391. Set the minimum duration of the sourced audio. See
  2392. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2393. for the accepted syntax.
  2394. Note that the resulting duration may be greater than the specified duration,
  2395. as the generated audio is always cut at the end of a complete frame.
  2396. If not specified, or the expressed duration is negative, the audio is
  2397. supposed to be generated forever.
  2398. Only used if plugin have zero inputs.
  2399. @end table
  2400. @subsection Examples
  2401. @itemize
  2402. @item
  2403. List all available plugins within amp (LADSPA example plugin) library:
  2404. @example
  2405. ladspa=file=amp
  2406. @end example
  2407. @item
  2408. List all available controls and their valid ranges for @code{vcf_notch}
  2409. plugin from @code{VCF} library:
  2410. @example
  2411. ladspa=f=vcf:p=vcf_notch:c=help
  2412. @end example
  2413. @item
  2414. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2415. plugin library:
  2416. @example
  2417. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2418. @end example
  2419. @item
  2420. Add reverberation to the audio using TAP-plugins
  2421. (Tom's Audio Processing plugins):
  2422. @example
  2423. ladspa=file=tap_reverb:tap_reverb
  2424. @end example
  2425. @item
  2426. Generate white noise, with 0.2 amplitude:
  2427. @example
  2428. ladspa=file=cmt:noise_source_white:c=c0=.2
  2429. @end example
  2430. @item
  2431. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2432. @code{C* Audio Plugin Suite} (CAPS) library:
  2433. @example
  2434. ladspa=file=caps:Click:c=c1=20'
  2435. @end example
  2436. @item
  2437. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2438. @example
  2439. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2440. @end example
  2441. @item
  2442. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2443. @code{SWH Plugins} collection:
  2444. @example
  2445. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2446. @end example
  2447. @item
  2448. Attenuate low frequencies using Multiband EQ from Steve Harris
  2449. @code{SWH Plugins} collection:
  2450. @example
  2451. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2452. @end example
  2453. @item
  2454. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2455. (CAPS) library:
  2456. @example
  2457. ladspa=caps:Narrower
  2458. @end example
  2459. @item
  2460. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2461. @example
  2462. ladspa=caps:White:.2
  2463. @end example
  2464. @item
  2465. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2466. @example
  2467. ladspa=caps:Fractal:c=c1=1
  2468. @end example
  2469. @item
  2470. Dynamic volume normalization using @code{VLevel} plugin:
  2471. @example
  2472. ladspa=vlevel-ladspa:vlevel_mono
  2473. @end example
  2474. @end itemize
  2475. @subsection Commands
  2476. This filter supports the following commands:
  2477. @table @option
  2478. @item cN
  2479. Modify the @var{N}-th control value.
  2480. If the specified value is not valid, it is ignored and prior one is kept.
  2481. @end table
  2482. @section loudnorm
  2483. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2484. Support for both single pass (livestreams, files) and double pass (files) modes.
  2485. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  2486. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  2487. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  2488. The filter accepts the following options:
  2489. @table @option
  2490. @item I, i
  2491. Set integrated loudness target.
  2492. Range is -70.0 - -5.0. Default value is -24.0.
  2493. @item LRA, lra
  2494. Set loudness range target.
  2495. Range is 1.0 - 20.0. Default value is 7.0.
  2496. @item TP, tp
  2497. Set maximum true peak.
  2498. Range is -9.0 - +0.0. Default value is -2.0.
  2499. @item measured_I, measured_i
  2500. Measured IL of input file.
  2501. Range is -99.0 - +0.0.
  2502. @item measured_LRA, measured_lra
  2503. Measured LRA of input file.
  2504. Range is 0.0 - 99.0.
  2505. @item measured_TP, measured_tp
  2506. Measured true peak of input file.
  2507. Range is -99.0 - +99.0.
  2508. @item measured_thresh
  2509. Measured threshold of input file.
  2510. Range is -99.0 - +0.0.
  2511. @item offset
  2512. Set offset gain. Gain is applied before the true-peak limiter.
  2513. Range is -99.0 - +99.0. Default is +0.0.
  2514. @item linear
  2515. Normalize linearly if possible.
  2516. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2517. to be specified in order to use this mode.
  2518. Options are true or false. Default is true.
  2519. @item dual_mono
  2520. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2521. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2522. If set to @code{true}, this option will compensate for this effect.
  2523. Multi-channel input files are not affected by this option.
  2524. Options are true or false. Default is false.
  2525. @item print_format
  2526. Set print format for stats. Options are summary, json, or none.
  2527. Default value is none.
  2528. @end table
  2529. @section lowpass
  2530. Apply a low-pass filter with 3dB point frequency.
  2531. The filter can be either single-pole or double-pole (the default).
  2532. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2533. The filter accepts the following options:
  2534. @table @option
  2535. @item frequency, f
  2536. Set frequency in Hz. Default is 500.
  2537. @item poles, p
  2538. Set number of poles. Default is 2.
  2539. @item width_type, t
  2540. Set method to specify band-width of filter.
  2541. @table @option
  2542. @item h
  2543. Hz
  2544. @item q
  2545. Q-Factor
  2546. @item o
  2547. octave
  2548. @item s
  2549. slope
  2550. @end table
  2551. @item width, w
  2552. Specify the band-width of a filter in width_type units.
  2553. Applies only to double-pole filter.
  2554. The default is 0.707q and gives a Butterworth response.
  2555. @item channels, c
  2556. Specify which channels to filter, by default all available are filtered.
  2557. @end table
  2558. @subsection Examples
  2559. @itemize
  2560. @item
  2561. Lowpass only LFE channel, it LFE is not present it does nothing:
  2562. @example
  2563. lowpass=c=LFE
  2564. @end example
  2565. @end itemize
  2566. @section mcompand
  2567. Multiband Compress or expand the audio's dynamic range.
  2568. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  2569. This is akin to the crossover of a loudspeaker, and results in flat frequency
  2570. response when absent compander action.
  2571. It accepts the following parameters:
  2572. @table @option
  2573. @item args
  2574. This option syntax is:
  2575. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  2576. For explanation of each item refer to compand filter documentation.
  2577. @end table
  2578. @anchor{pan}
  2579. @section pan
  2580. Mix channels with specific gain levels. The filter accepts the output
  2581. channel layout followed by a set of channels definitions.
  2582. This filter is also designed to efficiently remap the channels of an audio
  2583. stream.
  2584. The filter accepts parameters of the form:
  2585. "@var{l}|@var{outdef}|@var{outdef}|..."
  2586. @table @option
  2587. @item l
  2588. output channel layout or number of channels
  2589. @item outdef
  2590. output channel specification, of the form:
  2591. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  2592. @item out_name
  2593. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2594. number (c0, c1, etc.)
  2595. @item gain
  2596. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2597. @item in_name
  2598. input channel to use, see out_name for details; it is not possible to mix
  2599. named and numbered input channels
  2600. @end table
  2601. If the `=' in a channel specification is replaced by `<', then the gains for
  2602. that specification will be renormalized so that the total is 1, thus
  2603. avoiding clipping noise.
  2604. @subsection Mixing examples
  2605. For example, if you want to down-mix from stereo to mono, but with a bigger
  2606. factor for the left channel:
  2607. @example
  2608. pan=1c|c0=0.9*c0+0.1*c1
  2609. @end example
  2610. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2611. 7-channels surround:
  2612. @example
  2613. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2614. @end example
  2615. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2616. that should be preferred (see "-ac" option) unless you have very specific
  2617. needs.
  2618. @subsection Remapping examples
  2619. The channel remapping will be effective if, and only if:
  2620. @itemize
  2621. @item gain coefficients are zeroes or ones,
  2622. @item only one input per channel output,
  2623. @end itemize
  2624. If all these conditions are satisfied, the filter will notify the user ("Pure
  2625. channel mapping detected"), and use an optimized and lossless method to do the
  2626. remapping.
  2627. For example, if you have a 5.1 source and want a stereo audio stream by
  2628. dropping the extra channels:
  2629. @example
  2630. pan="stereo| c0=FL | c1=FR"
  2631. @end example
  2632. Given the same source, you can also switch front left and front right channels
  2633. and keep the input channel layout:
  2634. @example
  2635. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2636. @end example
  2637. If the input is a stereo audio stream, you can mute the front left channel (and
  2638. still keep the stereo channel layout) with:
  2639. @example
  2640. pan="stereo|c1=c1"
  2641. @end example
  2642. Still with a stereo audio stream input, you can copy the right channel in both
  2643. front left and right:
  2644. @example
  2645. pan="stereo| c0=FR | c1=FR"
  2646. @end example
  2647. @section replaygain
  2648. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2649. outputs it unchanged.
  2650. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2651. @section resample
  2652. Convert the audio sample format, sample rate and channel layout. It is
  2653. not meant to be used directly.
  2654. @section rubberband
  2655. Apply time-stretching and pitch-shifting with librubberband.
  2656. The filter accepts the following options:
  2657. @table @option
  2658. @item tempo
  2659. Set tempo scale factor.
  2660. @item pitch
  2661. Set pitch scale factor.
  2662. @item transients
  2663. Set transients detector.
  2664. Possible values are:
  2665. @table @var
  2666. @item crisp
  2667. @item mixed
  2668. @item smooth
  2669. @end table
  2670. @item detector
  2671. Set detector.
  2672. Possible values are:
  2673. @table @var
  2674. @item compound
  2675. @item percussive
  2676. @item soft
  2677. @end table
  2678. @item phase
  2679. Set phase.
  2680. Possible values are:
  2681. @table @var
  2682. @item laminar
  2683. @item independent
  2684. @end table
  2685. @item window
  2686. Set processing window size.
  2687. Possible values are:
  2688. @table @var
  2689. @item standard
  2690. @item short
  2691. @item long
  2692. @end table
  2693. @item smoothing
  2694. Set smoothing.
  2695. Possible values are:
  2696. @table @var
  2697. @item off
  2698. @item on
  2699. @end table
  2700. @item formant
  2701. Enable formant preservation when shift pitching.
  2702. Possible values are:
  2703. @table @var
  2704. @item shifted
  2705. @item preserved
  2706. @end table
  2707. @item pitchq
  2708. Set pitch quality.
  2709. Possible values are:
  2710. @table @var
  2711. @item quality
  2712. @item speed
  2713. @item consistency
  2714. @end table
  2715. @item channels
  2716. Set channels.
  2717. Possible values are:
  2718. @table @var
  2719. @item apart
  2720. @item together
  2721. @end table
  2722. @end table
  2723. @section sidechaincompress
  2724. This filter acts like normal compressor but has the ability to compress
  2725. detected signal using second input signal.
  2726. It needs two input streams and returns one output stream.
  2727. First input stream will be processed depending on second stream signal.
  2728. The filtered signal then can be filtered with other filters in later stages of
  2729. processing. See @ref{pan} and @ref{amerge} filter.
  2730. The filter accepts the following options:
  2731. @table @option
  2732. @item level_in
  2733. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2734. @item threshold
  2735. If a signal of second stream raises above this level it will affect the gain
  2736. reduction of first stream.
  2737. By default is 0.125. Range is between 0.00097563 and 1.
  2738. @item ratio
  2739. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2740. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2741. Default is 2. Range is between 1 and 20.
  2742. @item attack
  2743. Amount of milliseconds the signal has to rise above the threshold before gain
  2744. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2745. @item release
  2746. Amount of milliseconds the signal has to fall below the threshold before
  2747. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2748. @item makeup
  2749. Set the amount by how much signal will be amplified after processing.
  2750. Default is 1. Range is from 1 to 64.
  2751. @item knee
  2752. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2753. Default is 2.82843. Range is between 1 and 8.
  2754. @item link
  2755. Choose if the @code{average} level between all channels of side-chain stream
  2756. or the louder(@code{maximum}) channel of side-chain stream affects the
  2757. reduction. Default is @code{average}.
  2758. @item detection
  2759. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2760. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2761. @item level_sc
  2762. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2763. @item mix
  2764. How much to use compressed signal in output. Default is 1.
  2765. Range is between 0 and 1.
  2766. @end table
  2767. @subsection Examples
  2768. @itemize
  2769. @item
  2770. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2771. depending on the signal of 2nd input and later compressed signal to be
  2772. merged with 2nd input:
  2773. @example
  2774. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2775. @end example
  2776. @end itemize
  2777. @section sidechaingate
  2778. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2779. filter the detected signal before sending it to the gain reduction stage.
  2780. Normally a gate uses the full range signal to detect a level above the
  2781. threshold.
  2782. For example: If you cut all lower frequencies from your sidechain signal
  2783. the gate will decrease the volume of your track only if not enough highs
  2784. appear. With this technique you are able to reduce the resonation of a
  2785. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2786. guitar.
  2787. It needs two input streams and returns one output stream.
  2788. First input stream will be processed depending on second stream signal.
  2789. The filter accepts the following options:
  2790. @table @option
  2791. @item level_in
  2792. Set input level before filtering.
  2793. Default is 1. Allowed range is from 0.015625 to 64.
  2794. @item range
  2795. Set the level of gain reduction when the signal is below the threshold.
  2796. Default is 0.06125. Allowed range is from 0 to 1.
  2797. @item threshold
  2798. If a signal rises above this level the gain reduction is released.
  2799. Default is 0.125. Allowed range is from 0 to 1.
  2800. @item ratio
  2801. Set a ratio about which the signal is reduced.
  2802. Default is 2. Allowed range is from 1 to 9000.
  2803. @item attack
  2804. Amount of milliseconds the signal has to rise above the threshold before gain
  2805. reduction stops.
  2806. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2807. @item release
  2808. Amount of milliseconds the signal has to fall below the threshold before the
  2809. reduction is increased again. Default is 250 milliseconds.
  2810. Allowed range is from 0.01 to 9000.
  2811. @item makeup
  2812. Set amount of amplification of signal after processing.
  2813. Default is 1. Allowed range is from 1 to 64.
  2814. @item knee
  2815. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2816. Default is 2.828427125. Allowed range is from 1 to 8.
  2817. @item detection
  2818. Choose if exact signal should be taken for detection or an RMS like one.
  2819. Default is rms. Can be peak or rms.
  2820. @item link
  2821. Choose if the average level between all channels or the louder channel affects
  2822. the reduction.
  2823. Default is average. Can be average or maximum.
  2824. @item level_sc
  2825. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2826. @end table
  2827. @section silencedetect
  2828. Detect silence in an audio stream.
  2829. This filter logs a message when it detects that the input audio volume is less
  2830. or equal to a noise tolerance value for a duration greater or equal to the
  2831. minimum detected noise duration.
  2832. The printed times and duration are expressed in seconds.
  2833. The filter accepts the following options:
  2834. @table @option
  2835. @item duration, d
  2836. Set silence duration until notification (default is 2 seconds).
  2837. @item noise, n
  2838. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2839. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2840. @end table
  2841. @subsection Examples
  2842. @itemize
  2843. @item
  2844. Detect 5 seconds of silence with -50dB noise tolerance:
  2845. @example
  2846. silencedetect=n=-50dB:d=5
  2847. @end example
  2848. @item
  2849. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2850. tolerance in @file{silence.mp3}:
  2851. @example
  2852. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2853. @end example
  2854. @end itemize
  2855. @section silenceremove
  2856. Remove silence from the beginning, middle or end of the audio.
  2857. The filter accepts the following options:
  2858. @table @option
  2859. @item start_periods
  2860. This value is used to indicate if audio should be trimmed at beginning of
  2861. the audio. A value of zero indicates no silence should be trimmed from the
  2862. beginning. When specifying a non-zero value, it trims audio up until it
  2863. finds non-silence. Normally, when trimming silence from beginning of audio
  2864. the @var{start_periods} will be @code{1} but it can be increased to higher
  2865. values to trim all audio up to specific count of non-silence periods.
  2866. Default value is @code{0}.
  2867. @item start_duration
  2868. Specify the amount of time that non-silence must be detected before it stops
  2869. trimming audio. By increasing the duration, bursts of noises can be treated
  2870. as silence and trimmed off. Default value is @code{0}.
  2871. @item start_threshold
  2872. This indicates what sample value should be treated as silence. For digital
  2873. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2874. you may wish to increase the value to account for background noise.
  2875. Can be specified in dB (in case "dB" is appended to the specified value)
  2876. or amplitude ratio. Default value is @code{0}.
  2877. @item stop_periods
  2878. Set the count for trimming silence from the end of audio.
  2879. To remove silence from the middle of a file, specify a @var{stop_periods}
  2880. that is negative. This value is then treated as a positive value and is
  2881. used to indicate the effect should restart processing as specified by
  2882. @var{start_periods}, making it suitable for removing periods of silence
  2883. in the middle of the audio.
  2884. Default value is @code{0}.
  2885. @item stop_duration
  2886. Specify a duration of silence that must exist before audio is not copied any
  2887. more. By specifying a higher duration, silence that is wanted can be left in
  2888. the audio.
  2889. Default value is @code{0}.
  2890. @item stop_threshold
  2891. This is the same as @option{start_threshold} but for trimming silence from
  2892. the end of audio.
  2893. Can be specified in dB (in case "dB" is appended to the specified value)
  2894. or amplitude ratio. Default value is @code{0}.
  2895. @item leave_silence
  2896. This indicates that @var{stop_duration} length of audio should be left intact
  2897. at the beginning of each period of silence.
  2898. For example, if you want to remove long pauses between words but do not want
  2899. to remove the pauses completely. Default value is @code{0}.
  2900. @item detection
  2901. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  2902. and works better with digital silence which is exactly 0.
  2903. Default value is @code{rms}.
  2904. @item window
  2905. Set ratio used to calculate size of window for detecting silence.
  2906. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  2907. @end table
  2908. @subsection Examples
  2909. @itemize
  2910. @item
  2911. The following example shows how this filter can be used to start a recording
  2912. that does not contain the delay at the start which usually occurs between
  2913. pressing the record button and the start of the performance:
  2914. @example
  2915. silenceremove=1:5:0.02
  2916. @end example
  2917. @item
  2918. Trim all silence encountered from beginning to end where there is more than 1
  2919. second of silence in audio:
  2920. @example
  2921. silenceremove=0:0:0:-1:1:-90dB
  2922. @end example
  2923. @end itemize
  2924. @section sofalizer
  2925. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  2926. loudspeakers around the user for binaural listening via headphones (audio
  2927. formats up to 9 channels supported).
  2928. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  2929. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  2930. Austrian Academy of Sciences.
  2931. To enable compilation of this filter you need to configure FFmpeg with
  2932. @code{--enable-libmysofa}.
  2933. The filter accepts the following options:
  2934. @table @option
  2935. @item sofa
  2936. Set the SOFA file used for rendering.
  2937. @item gain
  2938. Set gain applied to audio. Value is in dB. Default is 0.
  2939. @item rotation
  2940. Set rotation of virtual loudspeakers in deg. Default is 0.
  2941. @item elevation
  2942. Set elevation of virtual speakers in deg. Default is 0.
  2943. @item radius
  2944. Set distance in meters between loudspeakers and the listener with near-field
  2945. HRTFs. Default is 1.
  2946. @item type
  2947. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2948. processing audio in time domain which is slow.
  2949. @var{freq} is processing audio in frequency domain which is fast.
  2950. Default is @var{freq}.
  2951. @item speakers
  2952. Set custom positions of virtual loudspeakers. Syntax for this option is:
  2953. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  2954. Each virtual loudspeaker is described with short channel name following with
  2955. azimuth and elevation in degrees.
  2956. Each virtual loudspeaker description is separated by '|'.
  2957. For example to override front left and front right channel positions use:
  2958. 'speakers=FL 45 15|FR 345 15'.
  2959. Descriptions with unrecognised channel names are ignored.
  2960. @item lfegain
  2961. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2962. @end table
  2963. @subsection Examples
  2964. @itemize
  2965. @item
  2966. Using ClubFritz6 sofa file:
  2967. @example
  2968. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  2969. @end example
  2970. @item
  2971. Using ClubFritz12 sofa file and bigger radius with small rotation:
  2972. @example
  2973. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  2974. @end example
  2975. @item
  2976. Similar as above but with custom speaker positions for front left, front right, back left and back right
  2977. and also with custom gain:
  2978. @example
  2979. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  2980. @end example
  2981. @end itemize
  2982. @section stereotools
  2983. This filter has some handy utilities to manage stereo signals, for converting
  2984. M/S stereo recordings to L/R signal while having control over the parameters
  2985. or spreading the stereo image of master track.
  2986. The filter accepts the following options:
  2987. @table @option
  2988. @item level_in
  2989. Set input level before filtering for both channels. Defaults is 1.
  2990. Allowed range is from 0.015625 to 64.
  2991. @item level_out
  2992. Set output level after filtering for both channels. Defaults is 1.
  2993. Allowed range is from 0.015625 to 64.
  2994. @item balance_in
  2995. Set input balance between both channels. Default is 0.
  2996. Allowed range is from -1 to 1.
  2997. @item balance_out
  2998. Set output balance between both channels. Default is 0.
  2999. Allowed range is from -1 to 1.
  3000. @item softclip
  3001. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3002. clipping. Disabled by default.
  3003. @item mutel
  3004. Mute the left channel. Disabled by default.
  3005. @item muter
  3006. Mute the right channel. Disabled by default.
  3007. @item phasel
  3008. Change the phase of the left channel. Disabled by default.
  3009. @item phaser
  3010. Change the phase of the right channel. Disabled by default.
  3011. @item mode
  3012. Set stereo mode. Available values are:
  3013. @table @samp
  3014. @item lr>lr
  3015. Left/Right to Left/Right, this is default.
  3016. @item lr>ms
  3017. Left/Right to Mid/Side.
  3018. @item ms>lr
  3019. Mid/Side to Left/Right.
  3020. @item lr>ll
  3021. Left/Right to Left/Left.
  3022. @item lr>rr
  3023. Left/Right to Right/Right.
  3024. @item lr>l+r
  3025. Left/Right to Left + Right.
  3026. @item lr>rl
  3027. Left/Right to Right/Left.
  3028. @item ms>ll
  3029. Mid/Side to Left/Left.
  3030. @item ms>rr
  3031. Mid/Side to Right/Right.
  3032. @end table
  3033. @item slev
  3034. Set level of side signal. Default is 1.
  3035. Allowed range is from 0.015625 to 64.
  3036. @item sbal
  3037. Set balance of side signal. Default is 0.
  3038. Allowed range is from -1 to 1.
  3039. @item mlev
  3040. Set level of the middle signal. Default is 1.
  3041. Allowed range is from 0.015625 to 64.
  3042. @item mpan
  3043. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3044. @item base
  3045. Set stereo base between mono and inversed channels. Default is 0.
  3046. Allowed range is from -1 to 1.
  3047. @item delay
  3048. Set delay in milliseconds how much to delay left from right channel and
  3049. vice versa. Default is 0. Allowed range is from -20 to 20.
  3050. @item sclevel
  3051. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3052. @item phase
  3053. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3054. @item bmode_in, bmode_out
  3055. Set balance mode for balance_in/balance_out option.
  3056. Can be one of the following:
  3057. @table @samp
  3058. @item balance
  3059. Classic balance mode. Attenuate one channel at time.
  3060. Gain is raised up to 1.
  3061. @item amplitude
  3062. Similar as classic mode above but gain is raised up to 2.
  3063. @item power
  3064. Equal power distribution, from -6dB to +6dB range.
  3065. @end table
  3066. @end table
  3067. @subsection Examples
  3068. @itemize
  3069. @item
  3070. Apply karaoke like effect:
  3071. @example
  3072. stereotools=mlev=0.015625
  3073. @end example
  3074. @item
  3075. Convert M/S signal to L/R:
  3076. @example
  3077. "stereotools=mode=ms>lr"
  3078. @end example
  3079. @end itemize
  3080. @section stereowiden
  3081. This filter enhance the stereo effect by suppressing signal common to both
  3082. channels and by delaying the signal of left into right and vice versa,
  3083. thereby widening the stereo effect.
  3084. The filter accepts the following options:
  3085. @table @option
  3086. @item delay
  3087. Time in milliseconds of the delay of left signal into right and vice versa.
  3088. Default is 20 milliseconds.
  3089. @item feedback
  3090. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3091. effect of left signal in right output and vice versa which gives widening
  3092. effect. Default is 0.3.
  3093. @item crossfeed
  3094. Cross feed of left into right with inverted phase. This helps in suppressing
  3095. the mono. If the value is 1 it will cancel all the signal common to both
  3096. channels. Default is 0.3.
  3097. @item drymix
  3098. Set level of input signal of original channel. Default is 0.8.
  3099. @end table
  3100. @section superequalizer
  3101. Apply 18 band equalizer.
  3102. The filter accepts the following options:
  3103. @table @option
  3104. @item 1b
  3105. Set 65Hz band gain.
  3106. @item 2b
  3107. Set 92Hz band gain.
  3108. @item 3b
  3109. Set 131Hz band gain.
  3110. @item 4b
  3111. Set 185Hz band gain.
  3112. @item 5b
  3113. Set 262Hz band gain.
  3114. @item 6b
  3115. Set 370Hz band gain.
  3116. @item 7b
  3117. Set 523Hz band gain.
  3118. @item 8b
  3119. Set 740Hz band gain.
  3120. @item 9b
  3121. Set 1047Hz band gain.
  3122. @item 10b
  3123. Set 1480Hz band gain.
  3124. @item 11b
  3125. Set 2093Hz band gain.
  3126. @item 12b
  3127. Set 2960Hz band gain.
  3128. @item 13b
  3129. Set 4186Hz band gain.
  3130. @item 14b
  3131. Set 5920Hz band gain.
  3132. @item 15b
  3133. Set 8372Hz band gain.
  3134. @item 16b
  3135. Set 11840Hz band gain.
  3136. @item 17b
  3137. Set 16744Hz band gain.
  3138. @item 18b
  3139. Set 20000Hz band gain.
  3140. @end table
  3141. @section surround
  3142. Apply audio surround upmix filter.
  3143. This filter allows to produce multichannel output from audio stream.
  3144. The filter accepts the following options:
  3145. @table @option
  3146. @item chl_out
  3147. Set output channel layout. By default, this is @var{5.1}.
  3148. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3149. for the required syntax.
  3150. @item chl_in
  3151. Set input channel layout. By default, this is @var{stereo}.
  3152. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3153. for the required syntax.
  3154. @item level_in
  3155. Set input volume level. By default, this is @var{1}.
  3156. @item level_out
  3157. Set output volume level. By default, this is @var{1}.
  3158. @item lfe
  3159. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3160. @item lfe_low
  3161. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3162. @item lfe_high
  3163. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3164. @item fc_in
  3165. Set front center input volume. By default, this is @var{1}.
  3166. @item fc_out
  3167. Set front center output volume. By default, this is @var{1}.
  3168. @item lfe_in
  3169. Set LFE input volume. By default, this is @var{1}.
  3170. @item lfe_out
  3171. Set LFE output volume. By default, this is @var{1}.
  3172. @end table
  3173. @section treble
  3174. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3175. shelving filter with a response similar to that of a standard
  3176. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3177. The filter accepts the following options:
  3178. @table @option
  3179. @item gain, g
  3180. Give the gain at whichever is the lower of ~22 kHz and the
  3181. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3182. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3183. @item frequency, f
  3184. Set the filter's central frequency and so can be used
  3185. to extend or reduce the frequency range to be boosted or cut.
  3186. The default value is @code{3000} Hz.
  3187. @item width_type, t
  3188. Set method to specify band-width of filter.
  3189. @table @option
  3190. @item h
  3191. Hz
  3192. @item q
  3193. Q-Factor
  3194. @item o
  3195. octave
  3196. @item s
  3197. slope
  3198. @end table
  3199. @item width, w
  3200. Determine how steep is the filter's shelf transition.
  3201. @item channels, c
  3202. Specify which channels to filter, by default all available are filtered.
  3203. @end table
  3204. @section tremolo
  3205. Sinusoidal amplitude modulation.
  3206. The filter accepts the following options:
  3207. @table @option
  3208. @item f
  3209. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3210. (20 Hz or lower) will result in a tremolo effect.
  3211. This filter may also be used as a ring modulator by specifying
  3212. a modulation frequency higher than 20 Hz.
  3213. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3214. @item d
  3215. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3216. Default value is 0.5.
  3217. @end table
  3218. @section vibrato
  3219. Sinusoidal phase modulation.
  3220. The filter accepts the following options:
  3221. @table @option
  3222. @item f
  3223. Modulation frequency in Hertz.
  3224. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3225. @item d
  3226. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3227. Default value is 0.5.
  3228. @end table
  3229. @section volume
  3230. Adjust the input audio volume.
  3231. It accepts the following parameters:
  3232. @table @option
  3233. @item volume
  3234. Set audio volume expression.
  3235. Output values are clipped to the maximum value.
  3236. The output audio volume is given by the relation:
  3237. @example
  3238. @var{output_volume} = @var{volume} * @var{input_volume}
  3239. @end example
  3240. The default value for @var{volume} is "1.0".
  3241. @item precision
  3242. This parameter represents the mathematical precision.
  3243. It determines which input sample formats will be allowed, which affects the
  3244. precision of the volume scaling.
  3245. @table @option
  3246. @item fixed
  3247. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3248. @item float
  3249. 32-bit floating-point; this limits input sample format to FLT. (default)
  3250. @item double
  3251. 64-bit floating-point; this limits input sample format to DBL.
  3252. @end table
  3253. @item replaygain
  3254. Choose the behaviour on encountering ReplayGain side data in input frames.
  3255. @table @option
  3256. @item drop
  3257. Remove ReplayGain side data, ignoring its contents (the default).
  3258. @item ignore
  3259. Ignore ReplayGain side data, but leave it in the frame.
  3260. @item track
  3261. Prefer the track gain, if present.
  3262. @item album
  3263. Prefer the album gain, if present.
  3264. @end table
  3265. @item replaygain_preamp
  3266. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3267. Default value for @var{replaygain_preamp} is 0.0.
  3268. @item eval
  3269. Set when the volume expression is evaluated.
  3270. It accepts the following values:
  3271. @table @samp
  3272. @item once
  3273. only evaluate expression once during the filter initialization, or
  3274. when the @samp{volume} command is sent
  3275. @item frame
  3276. evaluate expression for each incoming frame
  3277. @end table
  3278. Default value is @samp{once}.
  3279. @end table
  3280. The volume expression can contain the following parameters.
  3281. @table @option
  3282. @item n
  3283. frame number (starting at zero)
  3284. @item nb_channels
  3285. number of channels
  3286. @item nb_consumed_samples
  3287. number of samples consumed by the filter
  3288. @item nb_samples
  3289. number of samples in the current frame
  3290. @item pos
  3291. original frame position in the file
  3292. @item pts
  3293. frame PTS
  3294. @item sample_rate
  3295. sample rate
  3296. @item startpts
  3297. PTS at start of stream
  3298. @item startt
  3299. time at start of stream
  3300. @item t
  3301. frame time
  3302. @item tb
  3303. timestamp timebase
  3304. @item volume
  3305. last set volume value
  3306. @end table
  3307. Note that when @option{eval} is set to @samp{once} only the
  3308. @var{sample_rate} and @var{tb} variables are available, all other
  3309. variables will evaluate to NAN.
  3310. @subsection Commands
  3311. This filter supports the following commands:
  3312. @table @option
  3313. @item volume
  3314. Modify the volume expression.
  3315. The command accepts the same syntax of the corresponding option.
  3316. If the specified expression is not valid, it is kept at its current
  3317. value.
  3318. @item replaygain_noclip
  3319. Prevent clipping by limiting the gain applied.
  3320. Default value for @var{replaygain_noclip} is 1.
  3321. @end table
  3322. @subsection Examples
  3323. @itemize
  3324. @item
  3325. Halve the input audio volume:
  3326. @example
  3327. volume=volume=0.5
  3328. volume=volume=1/2
  3329. volume=volume=-6.0206dB
  3330. @end example
  3331. In all the above example the named key for @option{volume} can be
  3332. omitted, for example like in:
  3333. @example
  3334. volume=0.5
  3335. @end example
  3336. @item
  3337. Increase input audio power by 6 decibels using fixed-point precision:
  3338. @example
  3339. volume=volume=6dB:precision=fixed
  3340. @end example
  3341. @item
  3342. Fade volume after time 10 with an annihilation period of 5 seconds:
  3343. @example
  3344. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3345. @end example
  3346. @end itemize
  3347. @section volumedetect
  3348. Detect the volume of the input video.
  3349. The filter has no parameters. The input is not modified. Statistics about
  3350. the volume will be printed in the log when the input stream end is reached.
  3351. In particular it will show the mean volume (root mean square), maximum
  3352. volume (on a per-sample basis), and the beginning of a histogram of the
  3353. registered volume values (from the maximum value to a cumulated 1/1000 of
  3354. the samples).
  3355. All volumes are in decibels relative to the maximum PCM value.
  3356. @subsection Examples
  3357. Here is an excerpt of the output:
  3358. @example
  3359. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3360. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3361. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3362. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3363. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3364. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3365. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3366. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3367. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3368. @end example
  3369. It means that:
  3370. @itemize
  3371. @item
  3372. The mean square energy is approximately -27 dB, or 10^-2.7.
  3373. @item
  3374. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3375. @item
  3376. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3377. @end itemize
  3378. In other words, raising the volume by +4 dB does not cause any clipping,
  3379. raising it by +5 dB causes clipping for 6 samples, etc.
  3380. @c man end AUDIO FILTERS
  3381. @chapter Audio Sources
  3382. @c man begin AUDIO SOURCES
  3383. Below is a description of the currently available audio sources.
  3384. @section abuffer
  3385. Buffer audio frames, and make them available to the filter chain.
  3386. This source is mainly intended for a programmatic use, in particular
  3387. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3388. It accepts the following parameters:
  3389. @table @option
  3390. @item time_base
  3391. The timebase which will be used for timestamps of submitted frames. It must be
  3392. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3393. @item sample_rate
  3394. The sample rate of the incoming audio buffers.
  3395. @item sample_fmt
  3396. The sample format of the incoming audio buffers.
  3397. Either a sample format name or its corresponding integer representation from
  3398. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3399. @item channel_layout
  3400. The channel layout of the incoming audio buffers.
  3401. Either a channel layout name from channel_layout_map in
  3402. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3403. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3404. @item channels
  3405. The number of channels of the incoming audio buffers.
  3406. If both @var{channels} and @var{channel_layout} are specified, then they
  3407. must be consistent.
  3408. @end table
  3409. @subsection Examples
  3410. @example
  3411. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3412. @end example
  3413. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3414. Since the sample format with name "s16p" corresponds to the number
  3415. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3416. equivalent to:
  3417. @example
  3418. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3419. @end example
  3420. @section aevalsrc
  3421. Generate an audio signal specified by an expression.
  3422. This source accepts in input one or more expressions (one for each
  3423. channel), which are evaluated and used to generate a corresponding
  3424. audio signal.
  3425. This source accepts the following options:
  3426. @table @option
  3427. @item exprs
  3428. Set the '|'-separated expressions list for each separate channel. In case the
  3429. @option{channel_layout} option is not specified, the selected channel layout
  3430. depends on the number of provided expressions. Otherwise the last
  3431. specified expression is applied to the remaining output channels.
  3432. @item channel_layout, c
  3433. Set the channel layout. The number of channels in the specified layout
  3434. must be equal to the number of specified expressions.
  3435. @item duration, d
  3436. Set the minimum duration of the sourced audio. See
  3437. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3438. for the accepted syntax.
  3439. Note that the resulting duration may be greater than the specified
  3440. duration, as the generated audio is always cut at the end of a
  3441. complete frame.
  3442. If not specified, or the expressed duration is negative, the audio is
  3443. supposed to be generated forever.
  3444. @item nb_samples, n
  3445. Set the number of samples per channel per each output frame,
  3446. default to 1024.
  3447. @item sample_rate, s
  3448. Specify the sample rate, default to 44100.
  3449. @end table
  3450. Each expression in @var{exprs} can contain the following constants:
  3451. @table @option
  3452. @item n
  3453. number of the evaluated sample, starting from 0
  3454. @item t
  3455. time of the evaluated sample expressed in seconds, starting from 0
  3456. @item s
  3457. sample rate
  3458. @end table
  3459. @subsection Examples
  3460. @itemize
  3461. @item
  3462. Generate silence:
  3463. @example
  3464. aevalsrc=0
  3465. @end example
  3466. @item
  3467. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3468. 8000 Hz:
  3469. @example
  3470. aevalsrc="sin(440*2*PI*t):s=8000"
  3471. @end example
  3472. @item
  3473. Generate a two channels signal, specify the channel layout (Front
  3474. Center + Back Center) explicitly:
  3475. @example
  3476. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3477. @end example
  3478. @item
  3479. Generate white noise:
  3480. @example
  3481. aevalsrc="-2+random(0)"
  3482. @end example
  3483. @item
  3484. Generate an amplitude modulated signal:
  3485. @example
  3486. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3487. @end example
  3488. @item
  3489. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3490. @example
  3491. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3492. @end example
  3493. @end itemize
  3494. @section anullsrc
  3495. The null audio source, return unprocessed audio frames. It is mainly useful
  3496. as a template and to be employed in analysis / debugging tools, or as
  3497. the source for filters which ignore the input data (for example the sox
  3498. synth filter).
  3499. This source accepts the following options:
  3500. @table @option
  3501. @item channel_layout, cl
  3502. Specifies the channel layout, and can be either an integer or a string
  3503. representing a channel layout. The default value of @var{channel_layout}
  3504. is "stereo".
  3505. Check the channel_layout_map definition in
  3506. @file{libavutil/channel_layout.c} for the mapping between strings and
  3507. channel layout values.
  3508. @item sample_rate, r
  3509. Specifies the sample rate, and defaults to 44100.
  3510. @item nb_samples, n
  3511. Set the number of samples per requested frames.
  3512. @end table
  3513. @subsection Examples
  3514. @itemize
  3515. @item
  3516. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3517. @example
  3518. anullsrc=r=48000:cl=4
  3519. @end example
  3520. @item
  3521. Do the same operation with a more obvious syntax:
  3522. @example
  3523. anullsrc=r=48000:cl=mono
  3524. @end example
  3525. @end itemize
  3526. All the parameters need to be explicitly defined.
  3527. @section flite
  3528. Synthesize a voice utterance using the libflite library.
  3529. To enable compilation of this filter you need to configure FFmpeg with
  3530. @code{--enable-libflite}.
  3531. Note that versions of the flite library prior to 2.0 are not thread-safe.
  3532. The filter accepts the following options:
  3533. @table @option
  3534. @item list_voices
  3535. If set to 1, list the names of the available voices and exit
  3536. immediately. Default value is 0.
  3537. @item nb_samples, n
  3538. Set the maximum number of samples per frame. Default value is 512.
  3539. @item textfile
  3540. Set the filename containing the text to speak.
  3541. @item text
  3542. Set the text to speak.
  3543. @item voice, v
  3544. Set the voice to use for the speech synthesis. Default value is
  3545. @code{kal}. See also the @var{list_voices} option.
  3546. @end table
  3547. @subsection Examples
  3548. @itemize
  3549. @item
  3550. Read from file @file{speech.txt}, and synthesize the text using the
  3551. standard flite voice:
  3552. @example
  3553. flite=textfile=speech.txt
  3554. @end example
  3555. @item
  3556. Read the specified text selecting the @code{slt} voice:
  3557. @example
  3558. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3559. @end example
  3560. @item
  3561. Input text to ffmpeg:
  3562. @example
  3563. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3564. @end example
  3565. @item
  3566. Make @file{ffplay} speak the specified text, using @code{flite} and
  3567. the @code{lavfi} device:
  3568. @example
  3569. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3570. @end example
  3571. @end itemize
  3572. For more information about libflite, check:
  3573. @url{http://www.festvox.org/flite/}
  3574. @section anoisesrc
  3575. Generate a noise audio signal.
  3576. The filter accepts the following options:
  3577. @table @option
  3578. @item sample_rate, r
  3579. Specify the sample rate. Default value is 48000 Hz.
  3580. @item amplitude, a
  3581. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3582. is 1.0.
  3583. @item duration, d
  3584. Specify the duration of the generated audio stream. Not specifying this option
  3585. results in noise with an infinite length.
  3586. @item color, colour, c
  3587. Specify the color of noise. Available noise colors are white, pink, brown,
  3588. blue and violet. Default color is white.
  3589. @item seed, s
  3590. Specify a value used to seed the PRNG.
  3591. @item nb_samples, n
  3592. Set the number of samples per each output frame, default is 1024.
  3593. @end table
  3594. @subsection Examples
  3595. @itemize
  3596. @item
  3597. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3598. @example
  3599. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3600. @end example
  3601. @end itemize
  3602. @section sine
  3603. Generate an audio signal made of a sine wave with amplitude 1/8.
  3604. The audio signal is bit-exact.
  3605. The filter accepts the following options:
  3606. @table @option
  3607. @item frequency, f
  3608. Set the carrier frequency. Default is 440 Hz.
  3609. @item beep_factor, b
  3610. Enable a periodic beep every second with frequency @var{beep_factor} times
  3611. the carrier frequency. Default is 0, meaning the beep is disabled.
  3612. @item sample_rate, r
  3613. Specify the sample rate, default is 44100.
  3614. @item duration, d
  3615. Specify the duration of the generated audio stream.
  3616. @item samples_per_frame
  3617. Set the number of samples per output frame.
  3618. The expression can contain the following constants:
  3619. @table @option
  3620. @item n
  3621. The (sequential) number of the output audio frame, starting from 0.
  3622. @item pts
  3623. The PTS (Presentation TimeStamp) of the output audio frame,
  3624. expressed in @var{TB} units.
  3625. @item t
  3626. The PTS of the output audio frame, expressed in seconds.
  3627. @item TB
  3628. The timebase of the output audio frames.
  3629. @end table
  3630. Default is @code{1024}.
  3631. @end table
  3632. @subsection Examples
  3633. @itemize
  3634. @item
  3635. Generate a simple 440 Hz sine wave:
  3636. @example
  3637. sine
  3638. @end example
  3639. @item
  3640. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3641. @example
  3642. sine=220:4:d=5
  3643. sine=f=220:b=4:d=5
  3644. sine=frequency=220:beep_factor=4:duration=5
  3645. @end example
  3646. @item
  3647. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3648. pattern:
  3649. @example
  3650. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3651. @end example
  3652. @end itemize
  3653. @c man end AUDIO SOURCES
  3654. @chapter Audio Sinks
  3655. @c man begin AUDIO SINKS
  3656. Below is a description of the currently available audio sinks.
  3657. @section abuffersink
  3658. Buffer audio frames, and make them available to the end of filter chain.
  3659. This sink is mainly intended for programmatic use, in particular
  3660. through the interface defined in @file{libavfilter/buffersink.h}
  3661. or the options system.
  3662. It accepts a pointer to an AVABufferSinkContext structure, which
  3663. defines the incoming buffers' formats, to be passed as the opaque
  3664. parameter to @code{avfilter_init_filter} for initialization.
  3665. @section anullsink
  3666. Null audio sink; do absolutely nothing with the input audio. It is
  3667. mainly useful as a template and for use in analysis / debugging
  3668. tools.
  3669. @c man end AUDIO SINKS
  3670. @chapter Video Filters
  3671. @c man begin VIDEO FILTERS
  3672. When you configure your FFmpeg build, you can disable any of the
  3673. existing filters using @code{--disable-filters}.
  3674. The configure output will show the video filters included in your
  3675. build.
  3676. Below is a description of the currently available video filters.
  3677. @section alphaextract
  3678. Extract the alpha component from the input as a grayscale video. This
  3679. is especially useful with the @var{alphamerge} filter.
  3680. @section alphamerge
  3681. Add or replace the alpha component of the primary input with the
  3682. grayscale value of a second input. This is intended for use with
  3683. @var{alphaextract} to allow the transmission or storage of frame
  3684. sequences that have alpha in a format that doesn't support an alpha
  3685. channel.
  3686. For example, to reconstruct full frames from a normal YUV-encoded video
  3687. and a separate video created with @var{alphaextract}, you might use:
  3688. @example
  3689. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3690. @end example
  3691. Since this filter is designed for reconstruction, it operates on frame
  3692. sequences without considering timestamps, and terminates when either
  3693. input reaches end of stream. This will cause problems if your encoding
  3694. pipeline drops frames. If you're trying to apply an image as an
  3695. overlay to a video stream, consider the @var{overlay} filter instead.
  3696. @section ass
  3697. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3698. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3699. Substation Alpha) subtitles files.
  3700. This filter accepts the following option in addition to the common options from
  3701. the @ref{subtitles} filter:
  3702. @table @option
  3703. @item shaping
  3704. Set the shaping engine
  3705. Available values are:
  3706. @table @samp
  3707. @item auto
  3708. The default libass shaping engine, which is the best available.
  3709. @item simple
  3710. Fast, font-agnostic shaper that can do only substitutions
  3711. @item complex
  3712. Slower shaper using OpenType for substitutions and positioning
  3713. @end table
  3714. The default is @code{auto}.
  3715. @end table
  3716. @section atadenoise
  3717. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3718. The filter accepts the following options:
  3719. @table @option
  3720. @item 0a
  3721. Set threshold A for 1st plane. Default is 0.02.
  3722. Valid range is 0 to 0.3.
  3723. @item 0b
  3724. Set threshold B for 1st plane. Default is 0.04.
  3725. Valid range is 0 to 5.
  3726. @item 1a
  3727. Set threshold A for 2nd plane. Default is 0.02.
  3728. Valid range is 0 to 0.3.
  3729. @item 1b
  3730. Set threshold B for 2nd plane. Default is 0.04.
  3731. Valid range is 0 to 5.
  3732. @item 2a
  3733. Set threshold A for 3rd plane. Default is 0.02.
  3734. Valid range is 0 to 0.3.
  3735. @item 2b
  3736. Set threshold B for 3rd plane. Default is 0.04.
  3737. Valid range is 0 to 5.
  3738. Threshold A is designed to react on abrupt changes in the input signal and
  3739. threshold B is designed to react on continuous changes in the input signal.
  3740. @item s
  3741. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3742. number in range [5, 129].
  3743. @item p
  3744. Set what planes of frame filter will use for averaging. Default is all.
  3745. @end table
  3746. @section avgblur
  3747. Apply average blur filter.
  3748. The filter accepts the following options:
  3749. @table @option
  3750. @item sizeX
  3751. Set horizontal kernel size.
  3752. @item planes
  3753. Set which planes to filter. By default all planes are filtered.
  3754. @item sizeY
  3755. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  3756. Default is @code{0}.
  3757. @end table
  3758. @section bbox
  3759. Compute the bounding box for the non-black pixels in the input frame
  3760. luminance plane.
  3761. This filter computes the bounding box containing all the pixels with a
  3762. luminance value greater than the minimum allowed value.
  3763. The parameters describing the bounding box are printed on the filter
  3764. log.
  3765. The filter accepts the following option:
  3766. @table @option
  3767. @item min_val
  3768. Set the minimal luminance value. Default is @code{16}.
  3769. @end table
  3770. @section bitplanenoise
  3771. Show and measure bit plane noise.
  3772. The filter accepts the following options:
  3773. @table @option
  3774. @item bitplane
  3775. Set which plane to analyze. Default is @code{1}.
  3776. @item filter
  3777. Filter out noisy pixels from @code{bitplane} set above.
  3778. Default is disabled.
  3779. @end table
  3780. @section blackdetect
  3781. Detect video intervals that are (almost) completely black. Can be
  3782. useful to detect chapter transitions, commercials, or invalid
  3783. recordings. Output lines contains the time for the start, end and
  3784. duration of the detected black interval expressed in seconds.
  3785. In order to display the output lines, you need to set the loglevel at
  3786. least to the AV_LOG_INFO value.
  3787. The filter accepts the following options:
  3788. @table @option
  3789. @item black_min_duration, d
  3790. Set the minimum detected black duration expressed in seconds. It must
  3791. be a non-negative floating point number.
  3792. Default value is 2.0.
  3793. @item picture_black_ratio_th, pic_th
  3794. Set the threshold for considering a picture "black".
  3795. Express the minimum value for the ratio:
  3796. @example
  3797. @var{nb_black_pixels} / @var{nb_pixels}
  3798. @end example
  3799. for which a picture is considered black.
  3800. Default value is 0.98.
  3801. @item pixel_black_th, pix_th
  3802. Set the threshold for considering a pixel "black".
  3803. The threshold expresses the maximum pixel luminance value for which a
  3804. pixel is considered "black". The provided value is scaled according to
  3805. the following equation:
  3806. @example
  3807. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  3808. @end example
  3809. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  3810. the input video format, the range is [0-255] for YUV full-range
  3811. formats and [16-235] for YUV non full-range formats.
  3812. Default value is 0.10.
  3813. @end table
  3814. The following example sets the maximum pixel threshold to the minimum
  3815. value, and detects only black intervals of 2 or more seconds:
  3816. @example
  3817. blackdetect=d=2:pix_th=0.00
  3818. @end example
  3819. @section blackframe
  3820. Detect frames that are (almost) completely black. Can be useful to
  3821. detect chapter transitions or commercials. Output lines consist of
  3822. the frame number of the detected frame, the percentage of blackness,
  3823. the position in the file if known or -1 and the timestamp in seconds.
  3824. In order to display the output lines, you need to set the loglevel at
  3825. least to the AV_LOG_INFO value.
  3826. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  3827. The value represents the percentage of pixels in the picture that
  3828. are below the threshold value.
  3829. It accepts the following parameters:
  3830. @table @option
  3831. @item amount
  3832. The percentage of the pixels that have to be below the threshold; it defaults to
  3833. @code{98}.
  3834. @item threshold, thresh
  3835. The threshold below which a pixel value is considered black; it defaults to
  3836. @code{32}.
  3837. @end table
  3838. @section blend, tblend
  3839. Blend two video frames into each other.
  3840. The @code{blend} filter takes two input streams and outputs one
  3841. stream, the first input is the "top" layer and second input is
  3842. "bottom" layer. By default, the output terminates when the longest input terminates.
  3843. The @code{tblend} (time blend) filter takes two consecutive frames
  3844. from one single stream, and outputs the result obtained by blending
  3845. the new frame on top of the old frame.
  3846. A description of the accepted options follows.
  3847. @table @option
  3848. @item c0_mode
  3849. @item c1_mode
  3850. @item c2_mode
  3851. @item c3_mode
  3852. @item all_mode
  3853. Set blend mode for specific pixel component or all pixel components in case
  3854. of @var{all_mode}. Default value is @code{normal}.
  3855. Available values for component modes are:
  3856. @table @samp
  3857. @item addition
  3858. @item grainmerge
  3859. @item and
  3860. @item average
  3861. @item burn
  3862. @item darken
  3863. @item difference
  3864. @item grainextract
  3865. @item divide
  3866. @item dodge
  3867. @item freeze
  3868. @item exclusion
  3869. @item extremity
  3870. @item glow
  3871. @item hardlight
  3872. @item hardmix
  3873. @item heat
  3874. @item lighten
  3875. @item linearlight
  3876. @item multiply
  3877. @item multiply128
  3878. @item negation
  3879. @item normal
  3880. @item or
  3881. @item overlay
  3882. @item phoenix
  3883. @item pinlight
  3884. @item reflect
  3885. @item screen
  3886. @item softlight
  3887. @item subtract
  3888. @item vividlight
  3889. @item xor
  3890. @end table
  3891. @item c0_opacity
  3892. @item c1_opacity
  3893. @item c2_opacity
  3894. @item c3_opacity
  3895. @item all_opacity
  3896. Set blend opacity for specific pixel component or all pixel components in case
  3897. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  3898. @item c0_expr
  3899. @item c1_expr
  3900. @item c2_expr
  3901. @item c3_expr
  3902. @item all_expr
  3903. Set blend expression for specific pixel component or all pixel components in case
  3904. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3905. The expressions can use the following variables:
  3906. @table @option
  3907. @item N
  3908. The sequential number of the filtered frame, starting from @code{0}.
  3909. @item X
  3910. @item Y
  3911. the coordinates of the current sample
  3912. @item W
  3913. @item H
  3914. the width and height of currently filtered plane
  3915. @item SW
  3916. @item SH
  3917. Width and height scale depending on the currently filtered plane. It is the
  3918. ratio between the corresponding luma plane number of pixels and the current
  3919. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3920. @code{0.5,0.5} for chroma planes.
  3921. @item T
  3922. Time of the current frame, expressed in seconds.
  3923. @item TOP, A
  3924. Value of pixel component at current location for first video frame (top layer).
  3925. @item BOTTOM, B
  3926. Value of pixel component at current location for second video frame (bottom layer).
  3927. @end table
  3928. @end table
  3929. The @code{blend} filter also supports the @ref{framesync} options.
  3930. @subsection Examples
  3931. @itemize
  3932. @item
  3933. Apply transition from bottom layer to top layer in first 10 seconds:
  3934. @example
  3935. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3936. @end example
  3937. @item
  3938. Apply linear horizontal transition from top layer to bottom layer:
  3939. @example
  3940. blend=all_expr='A*(X/W)+B*(1-X/W)'
  3941. @end example
  3942. @item
  3943. Apply 1x1 checkerboard effect:
  3944. @example
  3945. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  3946. @end example
  3947. @item
  3948. Apply uncover left effect:
  3949. @example
  3950. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  3951. @end example
  3952. @item
  3953. Apply uncover down effect:
  3954. @example
  3955. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  3956. @end example
  3957. @item
  3958. Apply uncover up-left effect:
  3959. @example
  3960. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  3961. @end example
  3962. @item
  3963. Split diagonally video and shows top and bottom layer on each side:
  3964. @example
  3965. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  3966. @end example
  3967. @item
  3968. Display differences between the current and the previous frame:
  3969. @example
  3970. tblend=all_mode=grainextract
  3971. @end example
  3972. @end itemize
  3973. @section boxblur
  3974. Apply a boxblur algorithm to the input video.
  3975. It accepts the following parameters:
  3976. @table @option
  3977. @item luma_radius, lr
  3978. @item luma_power, lp
  3979. @item chroma_radius, cr
  3980. @item chroma_power, cp
  3981. @item alpha_radius, ar
  3982. @item alpha_power, ap
  3983. @end table
  3984. A description of the accepted options follows.
  3985. @table @option
  3986. @item luma_radius, lr
  3987. @item chroma_radius, cr
  3988. @item alpha_radius, ar
  3989. Set an expression for the box radius in pixels used for blurring the
  3990. corresponding input plane.
  3991. The radius value must be a non-negative number, and must not be
  3992. greater than the value of the expression @code{min(w,h)/2} for the
  3993. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  3994. planes.
  3995. Default value for @option{luma_radius} is "2". If not specified,
  3996. @option{chroma_radius} and @option{alpha_radius} default to the
  3997. corresponding value set for @option{luma_radius}.
  3998. The expressions can contain the following constants:
  3999. @table @option
  4000. @item w
  4001. @item h
  4002. The input width and height in pixels.
  4003. @item cw
  4004. @item ch
  4005. The input chroma image width and height in pixels.
  4006. @item hsub
  4007. @item vsub
  4008. The horizontal and vertical chroma subsample values. For example, for the
  4009. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4010. @end table
  4011. @item luma_power, lp
  4012. @item chroma_power, cp
  4013. @item alpha_power, ap
  4014. Specify how many times the boxblur filter is applied to the
  4015. corresponding plane.
  4016. Default value for @option{luma_power} is 2. If not specified,
  4017. @option{chroma_power} and @option{alpha_power} default to the
  4018. corresponding value set for @option{luma_power}.
  4019. A value of 0 will disable the effect.
  4020. @end table
  4021. @subsection Examples
  4022. @itemize
  4023. @item
  4024. Apply a boxblur filter with the luma, chroma, and alpha radii
  4025. set to 2:
  4026. @example
  4027. boxblur=luma_radius=2:luma_power=1
  4028. boxblur=2:1
  4029. @end example
  4030. @item
  4031. Set the luma radius to 2, and alpha and chroma radius to 0:
  4032. @example
  4033. boxblur=2:1:cr=0:ar=0
  4034. @end example
  4035. @item
  4036. Set the luma and chroma radii to a fraction of the video dimension:
  4037. @example
  4038. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4039. @end example
  4040. @end itemize
  4041. @section bwdif
  4042. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4043. Deinterlacing Filter").
  4044. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4045. interpolation algorithms.
  4046. It accepts the following parameters:
  4047. @table @option
  4048. @item mode
  4049. The interlacing mode to adopt. It accepts one of the following values:
  4050. @table @option
  4051. @item 0, send_frame
  4052. Output one frame for each frame.
  4053. @item 1, send_field
  4054. Output one frame for each field.
  4055. @end table
  4056. The default value is @code{send_field}.
  4057. @item parity
  4058. The picture field parity assumed for the input interlaced video. It accepts one
  4059. of the following values:
  4060. @table @option
  4061. @item 0, tff
  4062. Assume the top field is first.
  4063. @item 1, bff
  4064. Assume the bottom field is first.
  4065. @item -1, auto
  4066. Enable automatic detection of field parity.
  4067. @end table
  4068. The default value is @code{auto}.
  4069. If the interlacing is unknown or the decoder does not export this information,
  4070. top field first will be assumed.
  4071. @item deint
  4072. Specify which frames to deinterlace. Accept one of the following
  4073. values:
  4074. @table @option
  4075. @item 0, all
  4076. Deinterlace all frames.
  4077. @item 1, interlaced
  4078. Only deinterlace frames marked as interlaced.
  4079. @end table
  4080. The default value is @code{all}.
  4081. @end table
  4082. @section chromakey
  4083. YUV colorspace color/chroma keying.
  4084. The filter accepts the following options:
  4085. @table @option
  4086. @item color
  4087. The color which will be replaced with transparency.
  4088. @item similarity
  4089. Similarity percentage with the key color.
  4090. 0.01 matches only the exact key color, while 1.0 matches everything.
  4091. @item blend
  4092. Blend percentage.
  4093. 0.0 makes pixels either fully transparent, or not transparent at all.
  4094. Higher values result in semi-transparent pixels, with a higher transparency
  4095. the more similar the pixels color is to the key color.
  4096. @item yuv
  4097. Signals that the color passed is already in YUV instead of RGB.
  4098. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4099. This can be used to pass exact YUV values as hexadecimal numbers.
  4100. @end table
  4101. @subsection Examples
  4102. @itemize
  4103. @item
  4104. Make every green pixel in the input image transparent:
  4105. @example
  4106. ffmpeg -i input.png -vf chromakey=green out.png
  4107. @end example
  4108. @item
  4109. Overlay a greenscreen-video on top of a static black background.
  4110. @example
  4111. 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
  4112. @end example
  4113. @end itemize
  4114. @section ciescope
  4115. Display CIE color diagram with pixels overlaid onto it.
  4116. The filter accepts the following options:
  4117. @table @option
  4118. @item system
  4119. Set color system.
  4120. @table @samp
  4121. @item ntsc, 470m
  4122. @item ebu, 470bg
  4123. @item smpte
  4124. @item 240m
  4125. @item apple
  4126. @item widergb
  4127. @item cie1931
  4128. @item rec709, hdtv
  4129. @item uhdtv, rec2020
  4130. @end table
  4131. @item cie
  4132. Set CIE system.
  4133. @table @samp
  4134. @item xyy
  4135. @item ucs
  4136. @item luv
  4137. @end table
  4138. @item gamuts
  4139. Set what gamuts to draw.
  4140. See @code{system} option for available values.
  4141. @item size, s
  4142. Set ciescope size, by default set to 512.
  4143. @item intensity, i
  4144. Set intensity used to map input pixel values to CIE diagram.
  4145. @item contrast
  4146. Set contrast used to draw tongue colors that are out of active color system gamut.
  4147. @item corrgamma
  4148. Correct gamma displayed on scope, by default enabled.
  4149. @item showwhite
  4150. Show white point on CIE diagram, by default disabled.
  4151. @item gamma
  4152. Set input gamma. Used only with XYZ input color space.
  4153. @end table
  4154. @section codecview
  4155. Visualize information exported by some codecs.
  4156. Some codecs can export information through frames using side-data or other
  4157. means. For example, some MPEG based codecs export motion vectors through the
  4158. @var{export_mvs} flag in the codec @option{flags2} option.
  4159. The filter accepts the following option:
  4160. @table @option
  4161. @item mv
  4162. Set motion vectors to visualize.
  4163. Available flags for @var{mv} are:
  4164. @table @samp
  4165. @item pf
  4166. forward predicted MVs of P-frames
  4167. @item bf
  4168. forward predicted MVs of B-frames
  4169. @item bb
  4170. backward predicted MVs of B-frames
  4171. @end table
  4172. @item qp
  4173. Display quantization parameters using the chroma planes.
  4174. @item mv_type, mvt
  4175. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4176. Available flags for @var{mv_type} are:
  4177. @table @samp
  4178. @item fp
  4179. forward predicted MVs
  4180. @item bp
  4181. backward predicted MVs
  4182. @end table
  4183. @item frame_type, ft
  4184. Set frame type to visualize motion vectors of.
  4185. Available flags for @var{frame_type} are:
  4186. @table @samp
  4187. @item if
  4188. intra-coded frames (I-frames)
  4189. @item pf
  4190. predicted frames (P-frames)
  4191. @item bf
  4192. bi-directionally predicted frames (B-frames)
  4193. @end table
  4194. @end table
  4195. @subsection Examples
  4196. @itemize
  4197. @item
  4198. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4199. @example
  4200. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4201. @end example
  4202. @item
  4203. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4204. @example
  4205. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4206. @end example
  4207. @end itemize
  4208. @section colorbalance
  4209. Modify intensity of primary colors (red, green and blue) of input frames.
  4210. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4211. regions for the red-cyan, green-magenta or blue-yellow balance.
  4212. A positive adjustment value shifts the balance towards the primary color, a negative
  4213. value towards the complementary color.
  4214. The filter accepts the following options:
  4215. @table @option
  4216. @item rs
  4217. @item gs
  4218. @item bs
  4219. Adjust red, green and blue shadows (darkest pixels).
  4220. @item rm
  4221. @item gm
  4222. @item bm
  4223. Adjust red, green and blue midtones (medium pixels).
  4224. @item rh
  4225. @item gh
  4226. @item bh
  4227. Adjust red, green and blue highlights (brightest pixels).
  4228. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4229. @end table
  4230. @subsection Examples
  4231. @itemize
  4232. @item
  4233. Add red color cast to shadows:
  4234. @example
  4235. colorbalance=rs=.3
  4236. @end example
  4237. @end itemize
  4238. @section colorkey
  4239. RGB colorspace color keying.
  4240. The filter accepts the following options:
  4241. @table @option
  4242. @item color
  4243. The color which will be replaced with transparency.
  4244. @item similarity
  4245. Similarity percentage with the key color.
  4246. 0.01 matches only the exact key color, while 1.0 matches everything.
  4247. @item blend
  4248. Blend percentage.
  4249. 0.0 makes pixels either fully transparent, or not transparent at all.
  4250. Higher values result in semi-transparent pixels, with a higher transparency
  4251. the more similar the pixels color is to the key color.
  4252. @end table
  4253. @subsection Examples
  4254. @itemize
  4255. @item
  4256. Make every green pixel in the input image transparent:
  4257. @example
  4258. ffmpeg -i input.png -vf colorkey=green out.png
  4259. @end example
  4260. @item
  4261. Overlay a greenscreen-video on top of a static background image.
  4262. @example
  4263. 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
  4264. @end example
  4265. @end itemize
  4266. @section colorlevels
  4267. Adjust video input frames using levels.
  4268. The filter accepts the following options:
  4269. @table @option
  4270. @item rimin
  4271. @item gimin
  4272. @item bimin
  4273. @item aimin
  4274. Adjust red, green, blue and alpha input black point.
  4275. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4276. @item rimax
  4277. @item gimax
  4278. @item bimax
  4279. @item aimax
  4280. Adjust red, green, blue and alpha input white point.
  4281. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  4282. Input levels are used to lighten highlights (bright tones), darken shadows
  4283. (dark tones), change the balance of bright and dark tones.
  4284. @item romin
  4285. @item gomin
  4286. @item bomin
  4287. @item aomin
  4288. Adjust red, green, blue and alpha output black point.
  4289. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  4290. @item romax
  4291. @item gomax
  4292. @item bomax
  4293. @item aomax
  4294. Adjust red, green, blue and alpha output white point.
  4295. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  4296. Output levels allows manual selection of a constrained output level range.
  4297. @end table
  4298. @subsection Examples
  4299. @itemize
  4300. @item
  4301. Make video output darker:
  4302. @example
  4303. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4304. @end example
  4305. @item
  4306. Increase contrast:
  4307. @example
  4308. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4309. @end example
  4310. @item
  4311. Make video output lighter:
  4312. @example
  4313. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4314. @end example
  4315. @item
  4316. Increase brightness:
  4317. @example
  4318. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4319. @end example
  4320. @end itemize
  4321. @section colorchannelmixer
  4322. Adjust video input frames by re-mixing color channels.
  4323. This filter modifies a color channel by adding the values associated to
  4324. the other channels of the same pixels. For example if the value to
  4325. modify is red, the output value will be:
  4326. @example
  4327. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4328. @end example
  4329. The filter accepts the following options:
  4330. @table @option
  4331. @item rr
  4332. @item rg
  4333. @item rb
  4334. @item ra
  4335. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4336. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4337. @item gr
  4338. @item gg
  4339. @item gb
  4340. @item ga
  4341. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4342. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4343. @item br
  4344. @item bg
  4345. @item bb
  4346. @item ba
  4347. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4348. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4349. @item ar
  4350. @item ag
  4351. @item ab
  4352. @item aa
  4353. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4354. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4355. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4356. @end table
  4357. @subsection Examples
  4358. @itemize
  4359. @item
  4360. Convert source to grayscale:
  4361. @example
  4362. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4363. @end example
  4364. @item
  4365. Simulate sepia tones:
  4366. @example
  4367. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4368. @end example
  4369. @end itemize
  4370. @section colormatrix
  4371. Convert color matrix.
  4372. The filter accepts the following options:
  4373. @table @option
  4374. @item src
  4375. @item dst
  4376. Specify the source and destination color matrix. Both values must be
  4377. specified.
  4378. The accepted values are:
  4379. @table @samp
  4380. @item bt709
  4381. BT.709
  4382. @item fcc
  4383. FCC
  4384. @item bt601
  4385. BT.601
  4386. @item bt470
  4387. BT.470
  4388. @item bt470bg
  4389. BT.470BG
  4390. @item smpte170m
  4391. SMPTE-170M
  4392. @item smpte240m
  4393. SMPTE-240M
  4394. @item bt2020
  4395. BT.2020
  4396. @end table
  4397. @end table
  4398. For example to convert from BT.601 to SMPTE-240M, use the command:
  4399. @example
  4400. colormatrix=bt601:smpte240m
  4401. @end example
  4402. @section colorspace
  4403. Convert colorspace, transfer characteristics or color primaries.
  4404. Input video needs to have an even size.
  4405. The filter accepts the following options:
  4406. @table @option
  4407. @anchor{all}
  4408. @item all
  4409. Specify all color properties at once.
  4410. The accepted values are:
  4411. @table @samp
  4412. @item bt470m
  4413. BT.470M
  4414. @item bt470bg
  4415. BT.470BG
  4416. @item bt601-6-525
  4417. BT.601-6 525
  4418. @item bt601-6-625
  4419. BT.601-6 625
  4420. @item bt709
  4421. BT.709
  4422. @item smpte170m
  4423. SMPTE-170M
  4424. @item smpte240m
  4425. SMPTE-240M
  4426. @item bt2020
  4427. BT.2020
  4428. @end table
  4429. @anchor{space}
  4430. @item space
  4431. Specify output colorspace.
  4432. The accepted values are:
  4433. @table @samp
  4434. @item bt709
  4435. BT.709
  4436. @item fcc
  4437. FCC
  4438. @item bt470bg
  4439. BT.470BG or BT.601-6 625
  4440. @item smpte170m
  4441. SMPTE-170M or BT.601-6 525
  4442. @item smpte240m
  4443. SMPTE-240M
  4444. @item ycgco
  4445. YCgCo
  4446. @item bt2020ncl
  4447. BT.2020 with non-constant luminance
  4448. @end table
  4449. @anchor{trc}
  4450. @item trc
  4451. Specify output transfer characteristics.
  4452. The accepted values are:
  4453. @table @samp
  4454. @item bt709
  4455. BT.709
  4456. @item bt470m
  4457. BT.470M
  4458. @item bt470bg
  4459. BT.470BG
  4460. @item gamma22
  4461. Constant gamma of 2.2
  4462. @item gamma28
  4463. Constant gamma of 2.8
  4464. @item smpte170m
  4465. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4466. @item smpte240m
  4467. SMPTE-240M
  4468. @item srgb
  4469. SRGB
  4470. @item iec61966-2-1
  4471. iec61966-2-1
  4472. @item iec61966-2-4
  4473. iec61966-2-4
  4474. @item xvycc
  4475. xvycc
  4476. @item bt2020-10
  4477. BT.2020 for 10-bits content
  4478. @item bt2020-12
  4479. BT.2020 for 12-bits content
  4480. @end table
  4481. @anchor{primaries}
  4482. @item primaries
  4483. Specify output color primaries.
  4484. The accepted values are:
  4485. @table @samp
  4486. @item bt709
  4487. BT.709
  4488. @item bt470m
  4489. BT.470M
  4490. @item bt470bg
  4491. BT.470BG or BT.601-6 625
  4492. @item smpte170m
  4493. SMPTE-170M or BT.601-6 525
  4494. @item smpte240m
  4495. SMPTE-240M
  4496. @item film
  4497. film
  4498. @item smpte431
  4499. SMPTE-431
  4500. @item smpte432
  4501. SMPTE-432
  4502. @item bt2020
  4503. BT.2020
  4504. @item jedec-p22
  4505. JEDEC P22 phosphors
  4506. @end table
  4507. @anchor{range}
  4508. @item range
  4509. Specify output color range.
  4510. The accepted values are:
  4511. @table @samp
  4512. @item tv
  4513. TV (restricted) range
  4514. @item mpeg
  4515. MPEG (restricted) range
  4516. @item pc
  4517. PC (full) range
  4518. @item jpeg
  4519. JPEG (full) range
  4520. @end table
  4521. @item format
  4522. Specify output color format.
  4523. The accepted values are:
  4524. @table @samp
  4525. @item yuv420p
  4526. YUV 4:2:0 planar 8-bits
  4527. @item yuv420p10
  4528. YUV 4:2:0 planar 10-bits
  4529. @item yuv420p12
  4530. YUV 4:2:0 planar 12-bits
  4531. @item yuv422p
  4532. YUV 4:2:2 planar 8-bits
  4533. @item yuv422p10
  4534. YUV 4:2:2 planar 10-bits
  4535. @item yuv422p12
  4536. YUV 4:2:2 planar 12-bits
  4537. @item yuv444p
  4538. YUV 4:4:4 planar 8-bits
  4539. @item yuv444p10
  4540. YUV 4:4:4 planar 10-bits
  4541. @item yuv444p12
  4542. YUV 4:4:4 planar 12-bits
  4543. @end table
  4544. @item fast
  4545. Do a fast conversion, which skips gamma/primary correction. This will take
  4546. significantly less CPU, but will be mathematically incorrect. To get output
  4547. compatible with that produced by the colormatrix filter, use fast=1.
  4548. @item dither
  4549. Specify dithering mode.
  4550. The accepted values are:
  4551. @table @samp
  4552. @item none
  4553. No dithering
  4554. @item fsb
  4555. Floyd-Steinberg dithering
  4556. @end table
  4557. @item wpadapt
  4558. Whitepoint adaptation mode.
  4559. The accepted values are:
  4560. @table @samp
  4561. @item bradford
  4562. Bradford whitepoint adaptation
  4563. @item vonkries
  4564. von Kries whitepoint adaptation
  4565. @item identity
  4566. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4567. @end table
  4568. @item iall
  4569. Override all input properties at once. Same accepted values as @ref{all}.
  4570. @item ispace
  4571. Override input colorspace. Same accepted values as @ref{space}.
  4572. @item iprimaries
  4573. Override input color primaries. Same accepted values as @ref{primaries}.
  4574. @item itrc
  4575. Override input transfer characteristics. Same accepted values as @ref{trc}.
  4576. @item irange
  4577. Override input color range. Same accepted values as @ref{range}.
  4578. @end table
  4579. The filter converts the transfer characteristics, color space and color
  4580. primaries to the specified user values. The output value, if not specified,
  4581. is set to a default value based on the "all" property. If that property is
  4582. also not specified, the filter will log an error. The output color range and
  4583. format default to the same value as the input color range and format. The
  4584. input transfer characteristics, color space, color primaries and color range
  4585. should be set on the input data. If any of these are missing, the filter will
  4586. log an error and no conversion will take place.
  4587. For example to convert the input to SMPTE-240M, use the command:
  4588. @example
  4589. colorspace=smpte240m
  4590. @end example
  4591. @section convolution
  4592. Apply convolution 3x3 or 5x5 filter.
  4593. The filter accepts the following options:
  4594. @table @option
  4595. @item 0m
  4596. @item 1m
  4597. @item 2m
  4598. @item 3m
  4599. Set matrix for each plane.
  4600. Matrix is sequence of 9 or 25 signed integers.
  4601. @item 0rdiv
  4602. @item 1rdiv
  4603. @item 2rdiv
  4604. @item 3rdiv
  4605. Set multiplier for calculated value for each plane.
  4606. @item 0bias
  4607. @item 1bias
  4608. @item 2bias
  4609. @item 3bias
  4610. Set bias for each plane. This value is added to the result of the multiplication.
  4611. Useful for making the overall image brighter or darker. Default is 0.0.
  4612. @end table
  4613. @subsection Examples
  4614. @itemize
  4615. @item
  4616. Apply sharpen:
  4617. @example
  4618. 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"
  4619. @end example
  4620. @item
  4621. Apply blur:
  4622. @example
  4623. 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"
  4624. @end example
  4625. @item
  4626. Apply edge enhance:
  4627. @example
  4628. 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"
  4629. @end example
  4630. @item
  4631. Apply edge detect:
  4632. @example
  4633. 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"
  4634. @end example
  4635. @item
  4636. Apply laplacian edge detector which includes diagonals:
  4637. @example
  4638. 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"
  4639. @end example
  4640. @item
  4641. Apply emboss:
  4642. @example
  4643. 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"
  4644. @end example
  4645. @end itemize
  4646. @section convolve
  4647. Apply 2D convolution of video stream in frequency domain using second stream
  4648. as impulse.
  4649. The filter accepts the following options:
  4650. @table @option
  4651. @item planes
  4652. Set which planes to process.
  4653. @item impulse
  4654. Set which impulse video frames will be processed, can be @var{first}
  4655. or @var{all}. Default is @var{all}.
  4656. @end table
  4657. The @code{convolve} filter also supports the @ref{framesync} options.
  4658. @section copy
  4659. Copy the input video source unchanged to the output. This is mainly useful for
  4660. testing purposes.
  4661. @anchor{coreimage}
  4662. @section coreimage
  4663. Video filtering on GPU using Apple's CoreImage API on OSX.
  4664. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4665. processed by video hardware. However, software-based OpenGL implementations
  4666. exist which means there is no guarantee for hardware processing. It depends on
  4667. the respective OSX.
  4668. There are many filters and image generators provided by Apple that come with a
  4669. large variety of options. The filter has to be referenced by its name along
  4670. with its options.
  4671. The coreimage filter accepts the following options:
  4672. @table @option
  4673. @item list_filters
  4674. List all available filters and generators along with all their respective
  4675. options as well as possible minimum and maximum values along with the default
  4676. values.
  4677. @example
  4678. list_filters=true
  4679. @end example
  4680. @item filter
  4681. Specify all filters by their respective name and options.
  4682. Use @var{list_filters} to determine all valid filter names and options.
  4683. Numerical options are specified by a float value and are automatically clamped
  4684. to their respective value range. Vector and color options have to be specified
  4685. by a list of space separated float values. Character escaping has to be done.
  4686. A special option name @code{default} is available to use default options for a
  4687. filter.
  4688. It is required to specify either @code{default} or at least one of the filter options.
  4689. All omitted options are used with their default values.
  4690. The syntax of the filter string is as follows:
  4691. @example
  4692. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  4693. @end example
  4694. @item output_rect
  4695. Specify a rectangle where the output of the filter chain is copied into the
  4696. input image. It is given by a list of space separated float values:
  4697. @example
  4698. output_rect=x\ y\ width\ height
  4699. @end example
  4700. If not given, the output rectangle equals the dimensions of the input image.
  4701. The output rectangle is automatically cropped at the borders of the input
  4702. image. Negative values are valid for each component.
  4703. @example
  4704. output_rect=25\ 25\ 100\ 100
  4705. @end example
  4706. @end table
  4707. Several filters can be chained for successive processing without GPU-HOST
  4708. transfers allowing for fast processing of complex filter chains.
  4709. Currently, only filters with zero (generators) or exactly one (filters) input
  4710. image and one output image are supported. Also, transition filters are not yet
  4711. usable as intended.
  4712. Some filters generate output images with additional padding depending on the
  4713. respective filter kernel. The padding is automatically removed to ensure the
  4714. filter output has the same size as the input image.
  4715. For image generators, the size of the output image is determined by the
  4716. previous output image of the filter chain or the input image of the whole
  4717. filterchain, respectively. The generators do not use the pixel information of
  4718. this image to generate their output. However, the generated output is
  4719. blended onto this image, resulting in partial or complete coverage of the
  4720. output image.
  4721. The @ref{coreimagesrc} video source can be used for generating input images
  4722. which are directly fed into the filter chain. By using it, providing input
  4723. images by another video source or an input video is not required.
  4724. @subsection Examples
  4725. @itemize
  4726. @item
  4727. List all filters available:
  4728. @example
  4729. coreimage=list_filters=true
  4730. @end example
  4731. @item
  4732. Use the CIBoxBlur filter with default options to blur an image:
  4733. @example
  4734. coreimage=filter=CIBoxBlur@@default
  4735. @end example
  4736. @item
  4737. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  4738. its center at 100x100 and a radius of 50 pixels:
  4739. @example
  4740. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  4741. @end example
  4742. @item
  4743. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  4744. given as complete and escaped command-line for Apple's standard bash shell:
  4745. @example
  4746. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  4747. @end example
  4748. @end itemize
  4749. @section crop
  4750. Crop the input video to given dimensions.
  4751. It accepts the following parameters:
  4752. @table @option
  4753. @item w, out_w
  4754. The width of the output video. It defaults to @code{iw}.
  4755. This expression is evaluated only once during the filter
  4756. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  4757. @item h, out_h
  4758. The height of the output video. It defaults to @code{ih}.
  4759. This expression is evaluated only once during the filter
  4760. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  4761. @item x
  4762. The horizontal position, in the input video, of the left edge of the output
  4763. video. It defaults to @code{(in_w-out_w)/2}.
  4764. This expression is evaluated per-frame.
  4765. @item y
  4766. The vertical position, in the input video, of the top edge of the output video.
  4767. It defaults to @code{(in_h-out_h)/2}.
  4768. This expression is evaluated per-frame.
  4769. @item keep_aspect
  4770. If set to 1 will force the output display aspect ratio
  4771. to be the same of the input, by changing the output sample aspect
  4772. ratio. It defaults to 0.
  4773. @item exact
  4774. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  4775. width/height/x/y as specified and will not be rounded to nearest smaller value.
  4776. It defaults to 0.
  4777. @end table
  4778. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  4779. expressions containing the following constants:
  4780. @table @option
  4781. @item x
  4782. @item y
  4783. The computed values for @var{x} and @var{y}. They are evaluated for
  4784. each new frame.
  4785. @item in_w
  4786. @item in_h
  4787. The input width and height.
  4788. @item iw
  4789. @item ih
  4790. These are the same as @var{in_w} and @var{in_h}.
  4791. @item out_w
  4792. @item out_h
  4793. The output (cropped) width and height.
  4794. @item ow
  4795. @item oh
  4796. These are the same as @var{out_w} and @var{out_h}.
  4797. @item a
  4798. same as @var{iw} / @var{ih}
  4799. @item sar
  4800. input sample aspect ratio
  4801. @item dar
  4802. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4803. @item hsub
  4804. @item vsub
  4805. horizontal and vertical chroma subsample values. For example for the
  4806. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4807. @item n
  4808. The number of the input frame, starting from 0.
  4809. @item pos
  4810. the position in the file of the input frame, NAN if unknown
  4811. @item t
  4812. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  4813. @end table
  4814. The expression for @var{out_w} may depend on the value of @var{out_h},
  4815. and the expression for @var{out_h} may depend on @var{out_w}, but they
  4816. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  4817. evaluated after @var{out_w} and @var{out_h}.
  4818. The @var{x} and @var{y} parameters specify the expressions for the
  4819. position of the top-left corner of the output (non-cropped) area. They
  4820. are evaluated for each frame. If the evaluated value is not valid, it
  4821. is approximated to the nearest valid value.
  4822. The expression for @var{x} may depend on @var{y}, and the expression
  4823. for @var{y} may depend on @var{x}.
  4824. @subsection Examples
  4825. @itemize
  4826. @item
  4827. Crop area with size 100x100 at position (12,34).
  4828. @example
  4829. crop=100:100:12:34
  4830. @end example
  4831. Using named options, the example above becomes:
  4832. @example
  4833. crop=w=100:h=100:x=12:y=34
  4834. @end example
  4835. @item
  4836. Crop the central input area with size 100x100:
  4837. @example
  4838. crop=100:100
  4839. @end example
  4840. @item
  4841. Crop the central input area with size 2/3 of the input video:
  4842. @example
  4843. crop=2/3*in_w:2/3*in_h
  4844. @end example
  4845. @item
  4846. Crop the input video central square:
  4847. @example
  4848. crop=out_w=in_h
  4849. crop=in_h
  4850. @end example
  4851. @item
  4852. Delimit the rectangle with the top-left corner placed at position
  4853. 100:100 and the right-bottom corner corresponding to the right-bottom
  4854. corner of the input image.
  4855. @example
  4856. crop=in_w-100:in_h-100:100:100
  4857. @end example
  4858. @item
  4859. Crop 10 pixels from the left and right borders, and 20 pixels from
  4860. the top and bottom borders
  4861. @example
  4862. crop=in_w-2*10:in_h-2*20
  4863. @end example
  4864. @item
  4865. Keep only the bottom right quarter of the input image:
  4866. @example
  4867. crop=in_w/2:in_h/2:in_w/2:in_h/2
  4868. @end example
  4869. @item
  4870. Crop height for getting Greek harmony:
  4871. @example
  4872. crop=in_w:1/PHI*in_w
  4873. @end example
  4874. @item
  4875. Apply trembling effect:
  4876. @example
  4877. 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)
  4878. @end example
  4879. @item
  4880. Apply erratic camera effect depending on timestamp:
  4881. @example
  4882. 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)"
  4883. @end example
  4884. @item
  4885. Set x depending on the value of y:
  4886. @example
  4887. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  4888. @end example
  4889. @end itemize
  4890. @subsection Commands
  4891. This filter supports the following commands:
  4892. @table @option
  4893. @item w, out_w
  4894. @item h, out_h
  4895. @item x
  4896. @item y
  4897. Set width/height of the output video and the horizontal/vertical position
  4898. in the input video.
  4899. The command accepts the same syntax of the corresponding option.
  4900. If the specified expression is not valid, it is kept at its current
  4901. value.
  4902. @end table
  4903. @section cropdetect
  4904. Auto-detect the crop size.
  4905. It calculates the necessary cropping parameters and prints the
  4906. recommended parameters via the logging system. The detected dimensions
  4907. correspond to the non-black area of the input video.
  4908. It accepts the following parameters:
  4909. @table @option
  4910. @item limit
  4911. Set higher black value threshold, which can be optionally specified
  4912. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  4913. value greater to the set value is considered non-black. It defaults to 24.
  4914. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  4915. on the bitdepth of the pixel format.
  4916. @item round
  4917. The value which the width/height should be divisible by. It defaults to
  4918. 16. The offset is automatically adjusted to center the video. Use 2 to
  4919. get only even dimensions (needed for 4:2:2 video). 16 is best when
  4920. encoding to most video codecs.
  4921. @item reset_count, reset
  4922. Set the counter that determines after how many frames cropdetect will
  4923. reset the previously detected largest video area and start over to
  4924. detect the current optimal crop area. Default value is 0.
  4925. This can be useful when channel logos distort the video area. 0
  4926. indicates 'never reset', and returns the largest area encountered during
  4927. playback.
  4928. @end table
  4929. @anchor{curves}
  4930. @section curves
  4931. Apply color adjustments using curves.
  4932. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  4933. component (red, green and blue) has its values defined by @var{N} key points
  4934. tied from each other using a smooth curve. The x-axis represents the pixel
  4935. values from the input frame, and the y-axis the new pixel values to be set for
  4936. the output frame.
  4937. By default, a component curve is defined by the two points @var{(0;0)} and
  4938. @var{(1;1)}. This creates a straight line where each original pixel value is
  4939. "adjusted" to its own value, which means no change to the image.
  4940. The filter allows you to redefine these two points and add some more. A new
  4941. curve (using a natural cubic spline interpolation) will be define to pass
  4942. smoothly through all these new coordinates. The new defined points needs to be
  4943. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  4944. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  4945. the vector spaces, the values will be clipped accordingly.
  4946. The filter accepts the following options:
  4947. @table @option
  4948. @item preset
  4949. Select one of the available color presets. This option can be used in addition
  4950. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  4951. options takes priority on the preset values.
  4952. Available presets are:
  4953. @table @samp
  4954. @item none
  4955. @item color_negative
  4956. @item cross_process
  4957. @item darker
  4958. @item increase_contrast
  4959. @item lighter
  4960. @item linear_contrast
  4961. @item medium_contrast
  4962. @item negative
  4963. @item strong_contrast
  4964. @item vintage
  4965. @end table
  4966. Default is @code{none}.
  4967. @item master, m
  4968. Set the master key points. These points will define a second pass mapping. It
  4969. is sometimes called a "luminance" or "value" mapping. It can be used with
  4970. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  4971. post-processing LUT.
  4972. @item red, r
  4973. Set the key points for the red component.
  4974. @item green, g
  4975. Set the key points for the green component.
  4976. @item blue, b
  4977. Set the key points for the blue component.
  4978. @item all
  4979. Set the key points for all components (not including master).
  4980. Can be used in addition to the other key points component
  4981. options. In this case, the unset component(s) will fallback on this
  4982. @option{all} setting.
  4983. @item psfile
  4984. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  4985. @item plot
  4986. Save Gnuplot script of the curves in specified file.
  4987. @end table
  4988. To avoid some filtergraph syntax conflicts, each key points list need to be
  4989. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  4990. @subsection Examples
  4991. @itemize
  4992. @item
  4993. Increase slightly the middle level of blue:
  4994. @example
  4995. curves=blue='0/0 0.5/0.58 1/1'
  4996. @end example
  4997. @item
  4998. Vintage effect:
  4999. @example
  5000. 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'
  5001. @end example
  5002. Here we obtain the following coordinates for each components:
  5003. @table @var
  5004. @item red
  5005. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  5006. @item green
  5007. @code{(0;0) (0.50;0.48) (1;1)}
  5008. @item blue
  5009. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  5010. @end table
  5011. @item
  5012. The previous example can also be achieved with the associated built-in preset:
  5013. @example
  5014. curves=preset=vintage
  5015. @end example
  5016. @item
  5017. Or simply:
  5018. @example
  5019. curves=vintage
  5020. @end example
  5021. @item
  5022. Use a Photoshop preset and redefine the points of the green component:
  5023. @example
  5024. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  5025. @end example
  5026. @item
  5027. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  5028. and @command{gnuplot}:
  5029. @example
  5030. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  5031. gnuplot -p /tmp/curves.plt
  5032. @end example
  5033. @end itemize
  5034. @section datascope
  5035. Video data analysis filter.
  5036. This filter shows hexadecimal pixel values of part of video.
  5037. The filter accepts the following options:
  5038. @table @option
  5039. @item size, s
  5040. Set output video size.
  5041. @item x
  5042. Set x offset from where to pick pixels.
  5043. @item y
  5044. Set y offset from where to pick pixels.
  5045. @item mode
  5046. Set scope mode, can be one of the following:
  5047. @table @samp
  5048. @item mono
  5049. Draw hexadecimal pixel values with white color on black background.
  5050. @item color
  5051. Draw hexadecimal pixel values with input video pixel color on black
  5052. background.
  5053. @item color2
  5054. Draw hexadecimal pixel values on color background picked from input video,
  5055. the text color is picked in such way so its always visible.
  5056. @end table
  5057. @item axis
  5058. Draw rows and columns numbers on left and top of video.
  5059. @item opacity
  5060. Set background opacity.
  5061. @end table
  5062. @section dctdnoiz
  5063. Denoise frames using 2D DCT (frequency domain filtering).
  5064. This filter is not designed for real time.
  5065. The filter accepts the following options:
  5066. @table @option
  5067. @item sigma, s
  5068. Set the noise sigma constant.
  5069. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  5070. coefficient (absolute value) below this threshold with be dropped.
  5071. If you need a more advanced filtering, see @option{expr}.
  5072. Default is @code{0}.
  5073. @item overlap
  5074. Set number overlapping pixels for each block. Since the filter can be slow, you
  5075. may want to reduce this value, at the cost of a less effective filter and the
  5076. risk of various artefacts.
  5077. If the overlapping value doesn't permit processing the whole input width or
  5078. height, a warning will be displayed and according borders won't be denoised.
  5079. Default value is @var{blocksize}-1, which is the best possible setting.
  5080. @item expr, e
  5081. Set the coefficient factor expression.
  5082. For each coefficient of a DCT block, this expression will be evaluated as a
  5083. multiplier value for the coefficient.
  5084. If this is option is set, the @option{sigma} option will be ignored.
  5085. The absolute value of the coefficient can be accessed through the @var{c}
  5086. variable.
  5087. @item n
  5088. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  5089. @var{blocksize}, which is the width and height of the processed blocks.
  5090. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  5091. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5092. on the speed processing. Also, a larger block size does not necessarily means a
  5093. better de-noising.
  5094. @end table
  5095. @subsection Examples
  5096. Apply a denoise with a @option{sigma} of @code{4.5}:
  5097. @example
  5098. dctdnoiz=4.5
  5099. @end example
  5100. The same operation can be achieved using the expression system:
  5101. @example
  5102. dctdnoiz=e='gte(c, 4.5*3)'
  5103. @end example
  5104. Violent denoise using a block size of @code{16x16}:
  5105. @example
  5106. dctdnoiz=15:n=4
  5107. @end example
  5108. @section deband
  5109. Remove banding artifacts from input video.
  5110. It works by replacing banded pixels with average value of referenced pixels.
  5111. The filter accepts the following options:
  5112. @table @option
  5113. @item 1thr
  5114. @item 2thr
  5115. @item 3thr
  5116. @item 4thr
  5117. Set banding detection threshold for each plane. Default is 0.02.
  5118. Valid range is 0.00003 to 0.5.
  5119. If difference between current pixel and reference pixel is less than threshold,
  5120. it will be considered as banded.
  5121. @item range, r
  5122. Banding detection range in pixels. Default is 16. If positive, random number
  5123. in range 0 to set value will be used. If negative, exact absolute value
  5124. will be used.
  5125. The range defines square of four pixels around current pixel.
  5126. @item direction, d
  5127. Set direction in radians from which four pixel will be compared. If positive,
  5128. random direction from 0 to set direction will be picked. If negative, exact of
  5129. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5130. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5131. column.
  5132. @item blur, b
  5133. If enabled, current pixel is compared with average value of all four
  5134. surrounding pixels. The default is enabled. If disabled current pixel is
  5135. compared with all four surrounding pixels. The pixel is considered banded
  5136. if only all four differences with surrounding pixels are less than threshold.
  5137. @item coupling, c
  5138. If enabled, current pixel is changed if and only if all pixel components are banded,
  5139. e.g. banding detection threshold is triggered for all color components.
  5140. The default is disabled.
  5141. @end table
  5142. @anchor{decimate}
  5143. @section decimate
  5144. Drop duplicated frames at regular intervals.
  5145. The filter accepts the following options:
  5146. @table @option
  5147. @item cycle
  5148. Set the number of frames from which one will be dropped. Setting this to
  5149. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  5150. Default is @code{5}.
  5151. @item dupthresh
  5152. Set the threshold for duplicate detection. If the difference metric for a frame
  5153. is less than or equal to this value, then it is declared as duplicate. Default
  5154. is @code{1.1}
  5155. @item scthresh
  5156. Set scene change threshold. Default is @code{15}.
  5157. @item blockx
  5158. @item blocky
  5159. Set the size of the x and y-axis blocks used during metric calculations.
  5160. Larger blocks give better noise suppression, but also give worse detection of
  5161. small movements. Must be a power of two. Default is @code{32}.
  5162. @item ppsrc
  5163. Mark main input as a pre-processed input and activate clean source input
  5164. stream. This allows the input to be pre-processed with various filters to help
  5165. the metrics calculation while keeping the frame selection lossless. When set to
  5166. @code{1}, the first stream is for the pre-processed input, and the second
  5167. stream is the clean source from where the kept frames are chosen. Default is
  5168. @code{0}.
  5169. @item chroma
  5170. Set whether or not chroma is considered in the metric calculations. Default is
  5171. @code{1}.
  5172. @end table
  5173. @section deflate
  5174. Apply deflate effect to the video.
  5175. This filter replaces the pixel by the local(3x3) average by taking into account
  5176. only values lower than the pixel.
  5177. It accepts the following options:
  5178. @table @option
  5179. @item threshold0
  5180. @item threshold1
  5181. @item threshold2
  5182. @item threshold3
  5183. Limit the maximum change for each plane, default is 65535.
  5184. If 0, plane will remain unchanged.
  5185. @end table
  5186. @section deflicker
  5187. Remove temporal frame luminance variations.
  5188. It accepts the following options:
  5189. @table @option
  5190. @item size, s
  5191. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  5192. @item mode, m
  5193. Set averaging mode to smooth temporal luminance variations.
  5194. Available values are:
  5195. @table @samp
  5196. @item am
  5197. Arithmetic mean
  5198. @item gm
  5199. Geometric mean
  5200. @item hm
  5201. Harmonic mean
  5202. @item qm
  5203. Quadratic mean
  5204. @item cm
  5205. Cubic mean
  5206. @item pm
  5207. Power mean
  5208. @item median
  5209. Median
  5210. @end table
  5211. @item bypass
  5212. Do not actually modify frame. Useful when one only wants metadata.
  5213. @end table
  5214. @section dejudder
  5215. Remove judder produced by partially interlaced telecined content.
  5216. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  5217. source was partially telecined content then the output of @code{pullup,dejudder}
  5218. will have a variable frame rate. May change the recorded frame rate of the
  5219. container. Aside from that change, this filter will not affect constant frame
  5220. rate video.
  5221. The option available in this filter is:
  5222. @table @option
  5223. @item cycle
  5224. Specify the length of the window over which the judder repeats.
  5225. Accepts any integer greater than 1. Useful values are:
  5226. @table @samp
  5227. @item 4
  5228. If the original was telecined from 24 to 30 fps (Film to NTSC).
  5229. @item 5
  5230. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  5231. @item 20
  5232. If a mixture of the two.
  5233. @end table
  5234. The default is @samp{4}.
  5235. @end table
  5236. @section delogo
  5237. Suppress a TV station logo by a simple interpolation of the surrounding
  5238. pixels. Just set a rectangle covering the logo and watch it disappear
  5239. (and sometimes something even uglier appear - your mileage may vary).
  5240. It accepts the following parameters:
  5241. @table @option
  5242. @item x
  5243. @item y
  5244. Specify the top left corner coordinates of the logo. They must be
  5245. specified.
  5246. @item w
  5247. @item h
  5248. Specify the width and height of the logo to clear. They must be
  5249. specified.
  5250. @item band, t
  5251. Specify the thickness of the fuzzy edge of the rectangle (added to
  5252. @var{w} and @var{h}). The default value is 1. This option is
  5253. deprecated, setting higher values should no longer be necessary and
  5254. is not recommended.
  5255. @item show
  5256. When set to 1, a green rectangle is drawn on the screen to simplify
  5257. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  5258. The default value is 0.
  5259. The rectangle is drawn on the outermost pixels which will be (partly)
  5260. replaced with interpolated values. The values of the next pixels
  5261. immediately outside this rectangle in each direction will be used to
  5262. compute the interpolated pixel values inside the rectangle.
  5263. @end table
  5264. @subsection Examples
  5265. @itemize
  5266. @item
  5267. Set a rectangle covering the area with top left corner coordinates 0,0
  5268. and size 100x77, and a band of size 10:
  5269. @example
  5270. delogo=x=0:y=0:w=100:h=77:band=10
  5271. @end example
  5272. @end itemize
  5273. @section deshake
  5274. Attempt to fix small changes in horizontal and/or vertical shift. This
  5275. filter helps remove camera shake from hand-holding a camera, bumping a
  5276. tripod, moving on a vehicle, etc.
  5277. The filter accepts the following options:
  5278. @table @option
  5279. @item x
  5280. @item y
  5281. @item w
  5282. @item h
  5283. Specify a rectangular area where to limit the search for motion
  5284. vectors.
  5285. If desired the search for motion vectors can be limited to a
  5286. rectangular area of the frame defined by its top left corner, width
  5287. and height. These parameters have the same meaning as the drawbox
  5288. filter which can be used to visualise the position of the bounding
  5289. box.
  5290. This is useful when simultaneous movement of subjects within the frame
  5291. might be confused for camera motion by the motion vector search.
  5292. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  5293. then the full frame is used. This allows later options to be set
  5294. without specifying the bounding box for the motion vector search.
  5295. Default - search the whole frame.
  5296. @item rx
  5297. @item ry
  5298. Specify the maximum extent of movement in x and y directions in the
  5299. range 0-64 pixels. Default 16.
  5300. @item edge
  5301. Specify how to generate pixels to fill blanks at the edge of the
  5302. frame. Available values are:
  5303. @table @samp
  5304. @item blank, 0
  5305. Fill zeroes at blank locations
  5306. @item original, 1
  5307. Original image at blank locations
  5308. @item clamp, 2
  5309. Extruded edge value at blank locations
  5310. @item mirror, 3
  5311. Mirrored edge at blank locations
  5312. @end table
  5313. Default value is @samp{mirror}.
  5314. @item blocksize
  5315. Specify the blocksize to use for motion search. Range 4-128 pixels,
  5316. default 8.
  5317. @item contrast
  5318. Specify the contrast threshold for blocks. Only blocks with more than
  5319. the specified contrast (difference between darkest and lightest
  5320. pixels) will be considered. Range 1-255, default 125.
  5321. @item search
  5322. Specify the search strategy. Available values are:
  5323. @table @samp
  5324. @item exhaustive, 0
  5325. Set exhaustive search
  5326. @item less, 1
  5327. Set less exhaustive search.
  5328. @end table
  5329. Default value is @samp{exhaustive}.
  5330. @item filename
  5331. If set then a detailed log of the motion search is written to the
  5332. specified file.
  5333. @item opencl
  5334. If set to 1, specify using OpenCL capabilities, only available if
  5335. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  5336. @end table
  5337. @section despill
  5338. Remove unwanted contamination of foreground colors, caused by reflected color of
  5339. greenscreen or bluescreen.
  5340. This filter accepts the following options:
  5341. @table @option
  5342. @item type
  5343. Set what type of despill to use.
  5344. @item mix
  5345. Set how spillmap will be generated.
  5346. @item expand
  5347. Set how much to get rid of still remaining spill.
  5348. @item red
  5349. Controls amount of red in spill area.
  5350. @item green
  5351. Controls amount of green in spill area.
  5352. Should be -1 for greenscreen.
  5353. @item blue
  5354. Controls amount of blue in spill area.
  5355. Should be -1 for bluescreen.
  5356. @item brightness
  5357. Controls brightness of spill area, preserving colors.
  5358. @item alpha
  5359. Modify alpha from generated spillmap.
  5360. @end table
  5361. @section detelecine
  5362. Apply an exact inverse of the telecine operation. It requires a predefined
  5363. pattern specified using the pattern option which must be the same as that passed
  5364. to the telecine filter.
  5365. This filter accepts the following options:
  5366. @table @option
  5367. @item first_field
  5368. @table @samp
  5369. @item top, t
  5370. top field first
  5371. @item bottom, b
  5372. bottom field first
  5373. The default value is @code{top}.
  5374. @end table
  5375. @item pattern
  5376. A string of numbers representing the pulldown pattern you wish to apply.
  5377. The default value is @code{23}.
  5378. @item start_frame
  5379. A number representing position of the first frame with respect to the telecine
  5380. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  5381. @end table
  5382. @section dilation
  5383. Apply dilation effect to the video.
  5384. This filter replaces the pixel by the local(3x3) maximum.
  5385. It accepts the following options:
  5386. @table @option
  5387. @item threshold0
  5388. @item threshold1
  5389. @item threshold2
  5390. @item threshold3
  5391. Limit the maximum change for each plane, default is 65535.
  5392. If 0, plane will remain unchanged.
  5393. @item coordinates
  5394. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5395. pixels are used.
  5396. Flags to local 3x3 coordinates maps like this:
  5397. 1 2 3
  5398. 4 5
  5399. 6 7 8
  5400. @end table
  5401. @section displace
  5402. Displace pixels as indicated by second and third input stream.
  5403. It takes three input streams and outputs one stream, the first input is the
  5404. source, and second and third input are displacement maps.
  5405. The second input specifies how much to displace pixels along the
  5406. x-axis, while the third input specifies how much to displace pixels
  5407. along the y-axis.
  5408. If one of displacement map streams terminates, last frame from that
  5409. displacement map will be used.
  5410. Note that once generated, displacements maps can be reused over and over again.
  5411. A description of the accepted options follows.
  5412. @table @option
  5413. @item edge
  5414. Set displace behavior for pixels that are out of range.
  5415. Available values are:
  5416. @table @samp
  5417. @item blank
  5418. Missing pixels are replaced by black pixels.
  5419. @item smear
  5420. Adjacent pixels will spread out to replace missing pixels.
  5421. @item wrap
  5422. Out of range pixels are wrapped so they point to pixels of other side.
  5423. @item mirror
  5424. Out of range pixels will be replaced with mirrored pixels.
  5425. @end table
  5426. Default is @samp{smear}.
  5427. @end table
  5428. @subsection Examples
  5429. @itemize
  5430. @item
  5431. Add ripple effect to rgb input of video size hd720:
  5432. @example
  5433. 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
  5434. @end example
  5435. @item
  5436. Add wave effect to rgb input of video size hd720:
  5437. @example
  5438. 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
  5439. @end example
  5440. @end itemize
  5441. @section drawbox
  5442. Draw a colored box on the input image.
  5443. It accepts the following parameters:
  5444. @table @option
  5445. @item x
  5446. @item y
  5447. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5448. @item width, w
  5449. @item height, h
  5450. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5451. the input width and height. It defaults to 0.
  5452. @item color, c
  5453. Specify the color of the box to write. For the general syntax of this option,
  5454. check the "Color" section in the ffmpeg-utils manual. If the special
  5455. value @code{invert} is used, the box edge color is the same as the
  5456. video with inverted luma.
  5457. @item thickness, t
  5458. The expression which sets the thickness of the box edge. Default value is @code{3}.
  5459. See below for the list of accepted constants.
  5460. @end table
  5461. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5462. following constants:
  5463. @table @option
  5464. @item dar
  5465. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5466. @item hsub
  5467. @item vsub
  5468. horizontal and vertical chroma subsample values. For example for the
  5469. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5470. @item in_h, ih
  5471. @item in_w, iw
  5472. The input width and height.
  5473. @item sar
  5474. The input sample aspect ratio.
  5475. @item x
  5476. @item y
  5477. The x and y offset coordinates where the box is drawn.
  5478. @item w
  5479. @item h
  5480. The width and height of the drawn box.
  5481. @item t
  5482. The thickness of the drawn box.
  5483. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5484. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5485. @end table
  5486. @subsection Examples
  5487. @itemize
  5488. @item
  5489. Draw a black box around the edge of the input image:
  5490. @example
  5491. drawbox
  5492. @end example
  5493. @item
  5494. Draw a box with color red and an opacity of 50%:
  5495. @example
  5496. drawbox=10:20:200:60:red@@0.5
  5497. @end example
  5498. The previous example can be specified as:
  5499. @example
  5500. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5501. @end example
  5502. @item
  5503. Fill the box with pink color:
  5504. @example
  5505. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  5506. @end example
  5507. @item
  5508. Draw a 2-pixel red 2.40:1 mask:
  5509. @example
  5510. 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
  5511. @end example
  5512. @end itemize
  5513. @section drawgrid
  5514. Draw a grid on the input image.
  5515. It accepts the following parameters:
  5516. @table @option
  5517. @item x
  5518. @item y
  5519. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5520. @item width, w
  5521. @item height, h
  5522. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5523. input width and height, respectively, minus @code{thickness}, so image gets
  5524. framed. Default to 0.
  5525. @item color, c
  5526. Specify the color of the grid. For the general syntax of this option,
  5527. check the "Color" section in the ffmpeg-utils manual. If the special
  5528. value @code{invert} is used, the grid color is the same as the
  5529. video with inverted luma.
  5530. @item thickness, t
  5531. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5532. See below for the list of accepted constants.
  5533. @end table
  5534. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5535. following constants:
  5536. @table @option
  5537. @item dar
  5538. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5539. @item hsub
  5540. @item vsub
  5541. horizontal and vertical chroma subsample values. For example for the
  5542. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5543. @item in_h, ih
  5544. @item in_w, iw
  5545. The input grid cell width and height.
  5546. @item sar
  5547. The input sample aspect ratio.
  5548. @item x
  5549. @item y
  5550. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5551. @item w
  5552. @item h
  5553. The width and height of the drawn cell.
  5554. @item t
  5555. The thickness of the drawn cell.
  5556. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5557. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5558. @end table
  5559. @subsection Examples
  5560. @itemize
  5561. @item
  5562. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5563. @example
  5564. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5565. @end example
  5566. @item
  5567. Draw a white 3x3 grid with an opacity of 50%:
  5568. @example
  5569. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5570. @end example
  5571. @end itemize
  5572. @anchor{drawtext}
  5573. @section drawtext
  5574. Draw a text string or text from a specified file on top of a video, using the
  5575. libfreetype library.
  5576. To enable compilation of this filter, you need to configure FFmpeg with
  5577. @code{--enable-libfreetype}.
  5578. To enable default font fallback and the @var{font} option you need to
  5579. configure FFmpeg with @code{--enable-libfontconfig}.
  5580. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5581. @code{--enable-libfribidi}.
  5582. @subsection Syntax
  5583. It accepts the following parameters:
  5584. @table @option
  5585. @item box
  5586. Used to draw a box around text using the background color.
  5587. The value must be either 1 (enable) or 0 (disable).
  5588. The default value of @var{box} is 0.
  5589. @item boxborderw
  5590. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5591. The default value of @var{boxborderw} is 0.
  5592. @item boxcolor
  5593. The color to be used for drawing box around text. For the syntax of this
  5594. option, check the "Color" section in the ffmpeg-utils manual.
  5595. The default value of @var{boxcolor} is "white".
  5596. @item line_spacing
  5597. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  5598. The default value of @var{line_spacing} is 0.
  5599. @item borderw
  5600. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5601. The default value of @var{borderw} is 0.
  5602. @item bordercolor
  5603. Set the color to be used for drawing border around text. For the syntax of this
  5604. option, check the "Color" section in the ffmpeg-utils manual.
  5605. The default value of @var{bordercolor} is "black".
  5606. @item expansion
  5607. Select how the @var{text} is expanded. Can be either @code{none},
  5608. @code{strftime} (deprecated) or
  5609. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5610. below for details.
  5611. @item basetime
  5612. Set a start time for the count. Value is in microseconds. Only applied
  5613. in the deprecated strftime expansion mode. To emulate in normal expansion
  5614. mode use the @code{pts} function, supplying the start time (in seconds)
  5615. as the second argument.
  5616. @item fix_bounds
  5617. If true, check and fix text coords to avoid clipping.
  5618. @item fontcolor
  5619. The color to be used for drawing fonts. For the syntax of this option, check
  5620. the "Color" section in the ffmpeg-utils manual.
  5621. The default value of @var{fontcolor} is "black".
  5622. @item fontcolor_expr
  5623. String which is expanded the same way as @var{text} to obtain dynamic
  5624. @var{fontcolor} value. By default this option has empty value and is not
  5625. processed. When this option is set, it overrides @var{fontcolor} option.
  5626. @item font
  5627. The font family to be used for drawing text. By default Sans.
  5628. @item fontfile
  5629. The font file to be used for drawing text. The path must be included.
  5630. This parameter is mandatory if the fontconfig support is disabled.
  5631. @item alpha
  5632. Draw the text applying alpha blending. The value can
  5633. be a number between 0.0 and 1.0.
  5634. The expression accepts the same variables @var{x, y} as well.
  5635. The default value is 1.
  5636. Please see @var{fontcolor_expr}.
  5637. @item fontsize
  5638. The font size to be used for drawing text.
  5639. The default value of @var{fontsize} is 16.
  5640. @item text_shaping
  5641. If set to 1, attempt to shape the text (for example, reverse the order of
  5642. right-to-left text and join Arabic characters) before drawing it.
  5643. Otherwise, just draw the text exactly as given.
  5644. By default 1 (if supported).
  5645. @item ft_load_flags
  5646. The flags to be used for loading the fonts.
  5647. The flags map the corresponding flags supported by libfreetype, and are
  5648. a combination of the following values:
  5649. @table @var
  5650. @item default
  5651. @item no_scale
  5652. @item no_hinting
  5653. @item render
  5654. @item no_bitmap
  5655. @item vertical_layout
  5656. @item force_autohint
  5657. @item crop_bitmap
  5658. @item pedantic
  5659. @item ignore_global_advance_width
  5660. @item no_recurse
  5661. @item ignore_transform
  5662. @item monochrome
  5663. @item linear_design
  5664. @item no_autohint
  5665. @end table
  5666. Default value is "default".
  5667. For more information consult the documentation for the FT_LOAD_*
  5668. libfreetype flags.
  5669. @item shadowcolor
  5670. The color to be used for drawing a shadow behind the drawn text. For the
  5671. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  5672. The default value of @var{shadowcolor} is "black".
  5673. @item shadowx
  5674. @item shadowy
  5675. The x and y offsets for the text shadow position with respect to the
  5676. position of the text. They can be either positive or negative
  5677. values. The default value for both is "0".
  5678. @item start_number
  5679. The starting frame number for the n/frame_num variable. The default value
  5680. is "0".
  5681. @item tabsize
  5682. The size in number of spaces to use for rendering the tab.
  5683. Default value is 4.
  5684. @item timecode
  5685. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5686. format. It can be used with or without text parameter. @var{timecode_rate}
  5687. option must be specified.
  5688. @item timecode_rate, rate, r
  5689. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  5690. integer. Minimum value is "1".
  5691. Drop-frame timecode is supported for frame rates 30 & 60.
  5692. @item tc24hmax
  5693. If set to 1, the output of the timecode option will wrap around at 24 hours.
  5694. Default is 0 (disabled).
  5695. @item text
  5696. The text string to be drawn. The text must be a sequence of UTF-8
  5697. encoded characters.
  5698. This parameter is mandatory if no file is specified with the parameter
  5699. @var{textfile}.
  5700. @item textfile
  5701. A text file containing text to be drawn. The text must be a sequence
  5702. of UTF-8 encoded characters.
  5703. This parameter is mandatory if no text string is specified with the
  5704. parameter @var{text}.
  5705. If both @var{text} and @var{textfile} are specified, an error is thrown.
  5706. @item reload
  5707. If set to 1, the @var{textfile} will be reloaded before each frame.
  5708. Be sure to update it atomically, or it may be read partially, or even fail.
  5709. @item x
  5710. @item y
  5711. The expressions which specify the offsets where text will be drawn
  5712. within the video frame. They are relative to the top/left border of the
  5713. output image.
  5714. The default value of @var{x} and @var{y} is "0".
  5715. See below for the list of accepted constants and functions.
  5716. @end table
  5717. The parameters for @var{x} and @var{y} are expressions containing the
  5718. following constants and functions:
  5719. @table @option
  5720. @item dar
  5721. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  5722. @item hsub
  5723. @item vsub
  5724. horizontal and vertical chroma subsample values. For example for the
  5725. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5726. @item line_h, lh
  5727. the height of each text line
  5728. @item main_h, h, H
  5729. the input height
  5730. @item main_w, w, W
  5731. the input width
  5732. @item max_glyph_a, ascent
  5733. the maximum distance from the baseline to the highest/upper grid
  5734. coordinate used to place a glyph outline point, for all the rendered
  5735. glyphs.
  5736. It is a positive value, due to the grid's orientation with the Y axis
  5737. upwards.
  5738. @item max_glyph_d, descent
  5739. the maximum distance from the baseline to the lowest grid coordinate
  5740. used to place a glyph outline point, for all the rendered glyphs.
  5741. This is a negative value, due to the grid's orientation, with the Y axis
  5742. upwards.
  5743. @item max_glyph_h
  5744. maximum glyph height, that is the maximum height for all the glyphs
  5745. contained in the rendered text, it is equivalent to @var{ascent} -
  5746. @var{descent}.
  5747. @item max_glyph_w
  5748. maximum glyph width, that is the maximum width for all the glyphs
  5749. contained in the rendered text
  5750. @item n
  5751. the number of input frame, starting from 0
  5752. @item rand(min, max)
  5753. return a random number included between @var{min} and @var{max}
  5754. @item sar
  5755. The input sample aspect ratio.
  5756. @item t
  5757. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5758. @item text_h, th
  5759. the height of the rendered text
  5760. @item text_w, tw
  5761. the width of the rendered text
  5762. @item x
  5763. @item y
  5764. the x and y offset coordinates where the text is drawn.
  5765. These parameters allow the @var{x} and @var{y} expressions to refer
  5766. each other, so you can for example specify @code{y=x/dar}.
  5767. @end table
  5768. @anchor{drawtext_expansion}
  5769. @subsection Text expansion
  5770. If @option{expansion} is set to @code{strftime},
  5771. the filter recognizes strftime() sequences in the provided text and
  5772. expands them accordingly. Check the documentation of strftime(). This
  5773. feature is deprecated.
  5774. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  5775. If @option{expansion} is set to @code{normal} (which is the default),
  5776. the following expansion mechanism is used.
  5777. The backslash character @samp{\}, followed by any character, always expands to
  5778. the second character.
  5779. Sequences of the form @code{%@{...@}} are expanded. The text between the
  5780. braces is a function name, possibly followed by arguments separated by ':'.
  5781. If the arguments contain special characters or delimiters (':' or '@}'),
  5782. they should be escaped.
  5783. Note that they probably must also be escaped as the value for the
  5784. @option{text} option in the filter argument string and as the filter
  5785. argument in the filtergraph description, and possibly also for the shell,
  5786. that makes up to four levels of escaping; using a text file avoids these
  5787. problems.
  5788. The following functions are available:
  5789. @table @command
  5790. @item expr, e
  5791. The expression evaluation result.
  5792. It must take one argument specifying the expression to be evaluated,
  5793. which accepts the same constants and functions as the @var{x} and
  5794. @var{y} values. Note that not all constants should be used, for
  5795. example the text size is not known when evaluating the expression, so
  5796. the constants @var{text_w} and @var{text_h} will have an undefined
  5797. value.
  5798. @item expr_int_format, eif
  5799. Evaluate the expression's value and output as formatted integer.
  5800. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  5801. The second argument specifies the output format. Allowed values are @samp{x},
  5802. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  5803. @code{printf} function.
  5804. The third parameter is optional and sets the number of positions taken by the output.
  5805. It can be used to add padding with zeros from the left.
  5806. @item gmtime
  5807. The time at which the filter is running, expressed in UTC.
  5808. It can accept an argument: a strftime() format string.
  5809. @item localtime
  5810. The time at which the filter is running, expressed in the local time zone.
  5811. It can accept an argument: a strftime() format string.
  5812. @item metadata
  5813. Frame metadata. Takes one or two arguments.
  5814. The first argument is mandatory and specifies the metadata key.
  5815. The second argument is optional and specifies a default value, used when the
  5816. metadata key is not found or empty.
  5817. @item n, frame_num
  5818. The frame number, starting from 0.
  5819. @item pict_type
  5820. A 1 character description of the current picture type.
  5821. @item pts
  5822. The timestamp of the current frame.
  5823. It can take up to three arguments.
  5824. The first argument is the format of the timestamp; it defaults to @code{flt}
  5825. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  5826. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  5827. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  5828. @code{localtime} stands for the timestamp of the frame formatted as
  5829. local time zone time.
  5830. The second argument is an offset added to the timestamp.
  5831. If the format is set to @code{localtime} or @code{gmtime},
  5832. a third argument may be supplied: a strftime() format string.
  5833. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  5834. @end table
  5835. @subsection Examples
  5836. @itemize
  5837. @item
  5838. Draw "Test Text" with font FreeSerif, using the default values for the
  5839. optional parameters.
  5840. @example
  5841. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  5842. @end example
  5843. @item
  5844. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  5845. and y=50 (counting from the top-left corner of the screen), text is
  5846. yellow with a red box around it. Both the text and the box have an
  5847. opacity of 20%.
  5848. @example
  5849. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  5850. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  5851. @end example
  5852. Note that the double quotes are not necessary if spaces are not used
  5853. within the parameter list.
  5854. @item
  5855. Show the text at the center of the video frame:
  5856. @example
  5857. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  5858. @end example
  5859. @item
  5860. Show the text at a random position, switching to a new position every 30 seconds:
  5861. @example
  5862. 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)"
  5863. @end example
  5864. @item
  5865. Show a text line sliding from right to left in the last row of the video
  5866. frame. The file @file{LONG_LINE} is assumed to contain a single line
  5867. with no newlines.
  5868. @example
  5869. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  5870. @end example
  5871. @item
  5872. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  5873. @example
  5874. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  5875. @end example
  5876. @item
  5877. Draw a single green letter "g", at the center of the input video.
  5878. The glyph baseline is placed at half screen height.
  5879. @example
  5880. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  5881. @end example
  5882. @item
  5883. Show text for 1 second every 3 seconds:
  5884. @example
  5885. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  5886. @end example
  5887. @item
  5888. Use fontconfig to set the font. Note that the colons need to be escaped.
  5889. @example
  5890. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  5891. @end example
  5892. @item
  5893. Print the date of a real-time encoding (see strftime(3)):
  5894. @example
  5895. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  5896. @end example
  5897. @item
  5898. Show text fading in and out (appearing/disappearing):
  5899. @example
  5900. #!/bin/sh
  5901. DS=1.0 # display start
  5902. DE=10.0 # display end
  5903. FID=1.5 # fade in duration
  5904. FOD=5 # fade out duration
  5905. 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 @}"
  5906. @end example
  5907. @item
  5908. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  5909. and the @option{fontsize} value are included in the @option{y} offset.
  5910. @example
  5911. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  5912. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  5913. @end example
  5914. @end itemize
  5915. For more information about libfreetype, check:
  5916. @url{http://www.freetype.org/}.
  5917. For more information about fontconfig, check:
  5918. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  5919. For more information about libfribidi, check:
  5920. @url{http://fribidi.org/}.
  5921. @section edgedetect
  5922. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  5923. The filter accepts the following options:
  5924. @table @option
  5925. @item low
  5926. @item high
  5927. Set low and high threshold values used by the Canny thresholding
  5928. algorithm.
  5929. The high threshold selects the "strong" edge pixels, which are then
  5930. connected through 8-connectivity with the "weak" edge pixels selected
  5931. by the low threshold.
  5932. @var{low} and @var{high} threshold values must be chosen in the range
  5933. [0,1], and @var{low} should be lesser or equal to @var{high}.
  5934. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  5935. is @code{50/255}.
  5936. @item mode
  5937. Define the drawing mode.
  5938. @table @samp
  5939. @item wires
  5940. Draw white/gray wires on black background.
  5941. @item colormix
  5942. Mix the colors to create a paint/cartoon effect.
  5943. @end table
  5944. Default value is @var{wires}.
  5945. @end table
  5946. @subsection Examples
  5947. @itemize
  5948. @item
  5949. Standard edge detection with custom values for the hysteresis thresholding:
  5950. @example
  5951. edgedetect=low=0.1:high=0.4
  5952. @end example
  5953. @item
  5954. Painting effect without thresholding:
  5955. @example
  5956. edgedetect=mode=colormix:high=0
  5957. @end example
  5958. @end itemize
  5959. @section eq
  5960. Set brightness, contrast, saturation and approximate gamma adjustment.
  5961. The filter accepts the following options:
  5962. @table @option
  5963. @item contrast
  5964. Set the contrast expression. The value must be a float value in range
  5965. @code{-2.0} to @code{2.0}. The default value is "1".
  5966. @item brightness
  5967. Set the brightness expression. The value must be a float value in
  5968. range @code{-1.0} to @code{1.0}. The default value is "0".
  5969. @item saturation
  5970. Set the saturation expression. The value must be a float in
  5971. range @code{0.0} to @code{3.0}. The default value is "1".
  5972. @item gamma
  5973. Set the gamma expression. The value must be a float in range
  5974. @code{0.1} to @code{10.0}. The default value is "1".
  5975. @item gamma_r
  5976. Set the gamma expression for red. The value must be a float in
  5977. range @code{0.1} to @code{10.0}. The default value is "1".
  5978. @item gamma_g
  5979. Set the gamma expression for green. The value must be a float in range
  5980. @code{0.1} to @code{10.0}. The default value is "1".
  5981. @item gamma_b
  5982. Set the gamma expression for blue. The value must be a float in range
  5983. @code{0.1} to @code{10.0}. The default value is "1".
  5984. @item gamma_weight
  5985. Set the gamma weight expression. It can be used to reduce the effect
  5986. of a high gamma value on bright image areas, e.g. keep them from
  5987. getting overamplified and just plain white. The value must be a float
  5988. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  5989. gamma correction all the way down while @code{1.0} leaves it at its
  5990. full strength. Default is "1".
  5991. @item eval
  5992. Set when the expressions for brightness, contrast, saturation and
  5993. gamma expressions are evaluated.
  5994. It accepts the following values:
  5995. @table @samp
  5996. @item init
  5997. only evaluate expressions once during the filter initialization or
  5998. when a command is processed
  5999. @item frame
  6000. evaluate expressions for each incoming frame
  6001. @end table
  6002. Default value is @samp{init}.
  6003. @end table
  6004. The expressions accept the following parameters:
  6005. @table @option
  6006. @item n
  6007. frame count of the input frame starting from 0
  6008. @item pos
  6009. byte position of the corresponding packet in the input file, NAN if
  6010. unspecified
  6011. @item r
  6012. frame rate of the input video, NAN if the input frame rate is unknown
  6013. @item t
  6014. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6015. @end table
  6016. @subsection Commands
  6017. The filter supports the following commands:
  6018. @table @option
  6019. @item contrast
  6020. Set the contrast expression.
  6021. @item brightness
  6022. Set the brightness expression.
  6023. @item saturation
  6024. Set the saturation expression.
  6025. @item gamma
  6026. Set the gamma expression.
  6027. @item gamma_r
  6028. Set the gamma_r expression.
  6029. @item gamma_g
  6030. Set gamma_g expression.
  6031. @item gamma_b
  6032. Set gamma_b expression.
  6033. @item gamma_weight
  6034. Set gamma_weight expression.
  6035. The command accepts the same syntax of the corresponding option.
  6036. If the specified expression is not valid, it is kept at its current
  6037. value.
  6038. @end table
  6039. @section erosion
  6040. Apply erosion effect to the video.
  6041. This filter replaces the pixel by the local(3x3) minimum.
  6042. It accepts the following options:
  6043. @table @option
  6044. @item threshold0
  6045. @item threshold1
  6046. @item threshold2
  6047. @item threshold3
  6048. Limit the maximum change for each plane, default is 65535.
  6049. If 0, plane will remain unchanged.
  6050. @item coordinates
  6051. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6052. pixels are used.
  6053. Flags to local 3x3 coordinates maps like this:
  6054. 1 2 3
  6055. 4 5
  6056. 6 7 8
  6057. @end table
  6058. @section extractplanes
  6059. Extract color channel components from input video stream into
  6060. separate grayscale video streams.
  6061. The filter accepts the following option:
  6062. @table @option
  6063. @item planes
  6064. Set plane(s) to extract.
  6065. Available values for planes are:
  6066. @table @samp
  6067. @item y
  6068. @item u
  6069. @item v
  6070. @item a
  6071. @item r
  6072. @item g
  6073. @item b
  6074. @end table
  6075. Choosing planes not available in the input will result in an error.
  6076. That means you cannot select @code{r}, @code{g}, @code{b} planes
  6077. with @code{y}, @code{u}, @code{v} planes at same time.
  6078. @end table
  6079. @subsection Examples
  6080. @itemize
  6081. @item
  6082. Extract luma, u and v color channel component from input video frame
  6083. into 3 grayscale outputs:
  6084. @example
  6085. 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
  6086. @end example
  6087. @end itemize
  6088. @section elbg
  6089. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  6090. For each input image, the filter will compute the optimal mapping from
  6091. the input to the output given the codebook length, that is the number
  6092. of distinct output colors.
  6093. This filter accepts the following options.
  6094. @table @option
  6095. @item codebook_length, l
  6096. Set codebook length. The value must be a positive integer, and
  6097. represents the number of distinct output colors. Default value is 256.
  6098. @item nb_steps, n
  6099. Set the maximum number of iterations to apply for computing the optimal
  6100. mapping. The higher the value the better the result and the higher the
  6101. computation time. Default value is 1.
  6102. @item seed, s
  6103. Set a random seed, must be an integer included between 0 and
  6104. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  6105. will try to use a good random seed on a best effort basis.
  6106. @item pal8
  6107. Set pal8 output pixel format. This option does not work with codebook
  6108. length greater than 256.
  6109. @end table
  6110. @section fade
  6111. Apply a fade-in/out effect to the input video.
  6112. It accepts the following parameters:
  6113. @table @option
  6114. @item type, t
  6115. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  6116. effect.
  6117. Default is @code{in}.
  6118. @item start_frame, s
  6119. Specify the number of the frame to start applying the fade
  6120. effect at. Default is 0.
  6121. @item nb_frames, n
  6122. The number of frames that the fade effect lasts. At the end of the
  6123. fade-in effect, the output video will have the same intensity as the input video.
  6124. At the end of the fade-out transition, the output video will be filled with the
  6125. selected @option{color}.
  6126. Default is 25.
  6127. @item alpha
  6128. If set to 1, fade only alpha channel, if one exists on the input.
  6129. Default value is 0.
  6130. @item start_time, st
  6131. Specify the timestamp (in seconds) of the frame to start to apply the fade
  6132. effect. If both start_frame and start_time are specified, the fade will start at
  6133. whichever comes last. Default is 0.
  6134. @item duration, d
  6135. The number of seconds for which the fade effect has to last. At the end of the
  6136. fade-in effect the output video will have the same intensity as the input video,
  6137. at the end of the fade-out transition the output video will be filled with the
  6138. selected @option{color}.
  6139. If both duration and nb_frames are specified, duration is used. Default is 0
  6140. (nb_frames is used by default).
  6141. @item color, c
  6142. Specify the color of the fade. Default is "black".
  6143. @end table
  6144. @subsection Examples
  6145. @itemize
  6146. @item
  6147. Fade in the first 30 frames of video:
  6148. @example
  6149. fade=in:0:30
  6150. @end example
  6151. The command above is equivalent to:
  6152. @example
  6153. fade=t=in:s=0:n=30
  6154. @end example
  6155. @item
  6156. Fade out the last 45 frames of a 200-frame video:
  6157. @example
  6158. fade=out:155:45
  6159. fade=type=out:start_frame=155:nb_frames=45
  6160. @end example
  6161. @item
  6162. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  6163. @example
  6164. fade=in:0:25, fade=out:975:25
  6165. @end example
  6166. @item
  6167. Make the first 5 frames yellow, then fade in from frame 5-24:
  6168. @example
  6169. fade=in:5:20:color=yellow
  6170. @end example
  6171. @item
  6172. Fade in alpha over first 25 frames of video:
  6173. @example
  6174. fade=in:0:25:alpha=1
  6175. @end example
  6176. @item
  6177. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  6178. @example
  6179. fade=t=in:st=5.5:d=0.5
  6180. @end example
  6181. @end itemize
  6182. @section fftfilt
  6183. Apply arbitrary expressions to samples in frequency domain
  6184. @table @option
  6185. @item dc_Y
  6186. Adjust the dc value (gain) of the luma plane of the image. The filter
  6187. accepts an integer value in range @code{0} to @code{1000}. The default
  6188. value is set to @code{0}.
  6189. @item dc_U
  6190. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  6191. filter accepts an integer value in range @code{0} to @code{1000}. The
  6192. default value is set to @code{0}.
  6193. @item dc_V
  6194. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  6195. filter accepts an integer value in range @code{0} to @code{1000}. The
  6196. default value is set to @code{0}.
  6197. @item weight_Y
  6198. Set the frequency domain weight expression for the luma plane.
  6199. @item weight_U
  6200. Set the frequency domain weight expression for the 1st chroma plane.
  6201. @item weight_V
  6202. Set the frequency domain weight expression for the 2nd chroma plane.
  6203. @item eval
  6204. Set when the expressions are evaluated.
  6205. It accepts the following values:
  6206. @table @samp
  6207. @item init
  6208. Only evaluate expressions once during the filter initialization.
  6209. @item frame
  6210. Evaluate expressions for each incoming frame.
  6211. @end table
  6212. Default value is @samp{init}.
  6213. The filter accepts the following variables:
  6214. @item X
  6215. @item Y
  6216. The coordinates of the current sample.
  6217. @item W
  6218. @item H
  6219. The width and height of the image.
  6220. @item N
  6221. The number of input frame, starting from 0.
  6222. @end table
  6223. @subsection Examples
  6224. @itemize
  6225. @item
  6226. High-pass:
  6227. @example
  6228. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  6229. @end example
  6230. @item
  6231. Low-pass:
  6232. @example
  6233. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  6234. @end example
  6235. @item
  6236. Sharpen:
  6237. @example
  6238. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  6239. @end example
  6240. @item
  6241. Blur:
  6242. @example
  6243. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  6244. @end example
  6245. @end itemize
  6246. @section field
  6247. Extract a single field from an interlaced image using stride
  6248. arithmetic to avoid wasting CPU time. The output frames are marked as
  6249. non-interlaced.
  6250. The filter accepts the following options:
  6251. @table @option
  6252. @item type
  6253. Specify whether to extract the top (if the value is @code{0} or
  6254. @code{top}) or the bottom field (if the value is @code{1} or
  6255. @code{bottom}).
  6256. @end table
  6257. @section fieldhint
  6258. Create new frames by copying the top and bottom fields from surrounding frames
  6259. supplied as numbers by the hint file.
  6260. @table @option
  6261. @item hint
  6262. Set file containing hints: absolute/relative frame numbers.
  6263. There must be one line for each frame in a clip. Each line must contain two
  6264. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  6265. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  6266. is current frame number for @code{absolute} mode or out of [-1, 1] range
  6267. for @code{relative} mode. First number tells from which frame to pick up top
  6268. field and second number tells from which frame to pick up bottom field.
  6269. If optionally followed by @code{+} output frame will be marked as interlaced,
  6270. else if followed by @code{-} output frame will be marked as progressive, else
  6271. it will be marked same as input frame.
  6272. If line starts with @code{#} or @code{;} that line is skipped.
  6273. @item mode
  6274. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  6275. @end table
  6276. Example of first several lines of @code{hint} file for @code{relative} mode:
  6277. @example
  6278. 0,0 - # first frame
  6279. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  6280. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  6281. 1,0 -
  6282. 0,0 -
  6283. 0,0 -
  6284. 1,0 -
  6285. 1,0 -
  6286. 1,0 -
  6287. 0,0 -
  6288. 0,0 -
  6289. 1,0 -
  6290. 1,0 -
  6291. 1,0 -
  6292. 0,0 -
  6293. @end example
  6294. @section fieldmatch
  6295. Field matching filter for inverse telecine. It is meant to reconstruct the
  6296. progressive frames from a telecined stream. The filter does not drop duplicated
  6297. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  6298. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  6299. The separation of the field matching and the decimation is notably motivated by
  6300. the possibility of inserting a de-interlacing filter fallback between the two.
  6301. If the source has mixed telecined and real interlaced content,
  6302. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  6303. But these remaining combed frames will be marked as interlaced, and thus can be
  6304. de-interlaced by a later filter such as @ref{yadif} before decimation.
  6305. In addition to the various configuration options, @code{fieldmatch} can take an
  6306. optional second stream, activated through the @option{ppsrc} option. If
  6307. enabled, the frames reconstruction will be based on the fields and frames from
  6308. this second stream. This allows the first input to be pre-processed in order to
  6309. help the various algorithms of the filter, while keeping the output lossless
  6310. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  6311. or brightness/contrast adjustments can help.
  6312. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  6313. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  6314. which @code{fieldmatch} is based on. While the semantic and usage are very
  6315. close, some behaviour and options names can differ.
  6316. The @ref{decimate} filter currently only works for constant frame rate input.
  6317. If your input has mixed telecined (30fps) and progressive content with a lower
  6318. framerate like 24fps use the following filterchain to produce the necessary cfr
  6319. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  6320. The filter accepts the following options:
  6321. @table @option
  6322. @item order
  6323. Specify the assumed field order of the input stream. Available values are:
  6324. @table @samp
  6325. @item auto
  6326. Auto detect parity (use FFmpeg's internal parity value).
  6327. @item bff
  6328. Assume bottom field first.
  6329. @item tff
  6330. Assume top field first.
  6331. @end table
  6332. Note that it is sometimes recommended not to trust the parity announced by the
  6333. stream.
  6334. Default value is @var{auto}.
  6335. @item mode
  6336. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  6337. sense that it won't risk creating jerkiness due to duplicate frames when
  6338. possible, but if there are bad edits or blended fields it will end up
  6339. outputting combed frames when a good match might actually exist. On the other
  6340. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  6341. but will almost always find a good frame if there is one. The other values are
  6342. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  6343. jerkiness and creating duplicate frames versus finding good matches in sections
  6344. with bad edits, orphaned fields, blended fields, etc.
  6345. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  6346. Available values are:
  6347. @table @samp
  6348. @item pc
  6349. 2-way matching (p/c)
  6350. @item pc_n
  6351. 2-way matching, and trying 3rd match if still combed (p/c + n)
  6352. @item pc_u
  6353. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  6354. @item pc_n_ub
  6355. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  6356. still combed (p/c + n + u/b)
  6357. @item pcn
  6358. 3-way matching (p/c/n)
  6359. @item pcn_ub
  6360. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  6361. detected as combed (p/c/n + u/b)
  6362. @end table
  6363. The parenthesis at the end indicate the matches that would be used for that
  6364. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  6365. @var{top}).
  6366. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  6367. the slowest.
  6368. Default value is @var{pc_n}.
  6369. @item ppsrc
  6370. Mark the main input stream as a pre-processed input, and enable the secondary
  6371. input stream as the clean source to pick the fields from. See the filter
  6372. introduction for more details. It is similar to the @option{clip2} feature from
  6373. VFM/TFM.
  6374. Default value is @code{0} (disabled).
  6375. @item field
  6376. Set the field to match from. It is recommended to set this to the same value as
  6377. @option{order} unless you experience matching failures with that setting. In
  6378. certain circumstances changing the field that is used to match from can have a
  6379. large impact on matching performance. Available values are:
  6380. @table @samp
  6381. @item auto
  6382. Automatic (same value as @option{order}).
  6383. @item bottom
  6384. Match from the bottom field.
  6385. @item top
  6386. Match from the top field.
  6387. @end table
  6388. Default value is @var{auto}.
  6389. @item mchroma
  6390. Set whether or not chroma is included during the match comparisons. In most
  6391. cases it is recommended to leave this enabled. You should set this to @code{0}
  6392. only if your clip has bad chroma problems such as heavy rainbowing or other
  6393. artifacts. Setting this to @code{0} could also be used to speed things up at
  6394. the cost of some accuracy.
  6395. Default value is @code{1}.
  6396. @item y0
  6397. @item y1
  6398. These define an exclusion band which excludes the lines between @option{y0} and
  6399. @option{y1} from being included in the field matching decision. An exclusion
  6400. band can be used to ignore subtitles, a logo, or other things that may
  6401. interfere with the matching. @option{y0} sets the starting scan line and
  6402. @option{y1} sets the ending line; all lines in between @option{y0} and
  6403. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6404. @option{y0} and @option{y1} to the same value will disable the feature.
  6405. @option{y0} and @option{y1} defaults to @code{0}.
  6406. @item scthresh
  6407. Set the scene change detection threshold as a percentage of maximum change on
  6408. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6409. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6410. @option{scthresh} is @code{[0.0, 100.0]}.
  6411. Default value is @code{12.0}.
  6412. @item combmatch
  6413. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6414. account the combed scores of matches when deciding what match to use as the
  6415. final match. Available values are:
  6416. @table @samp
  6417. @item none
  6418. No final matching based on combed scores.
  6419. @item sc
  6420. Combed scores are only used when a scene change is detected.
  6421. @item full
  6422. Use combed scores all the time.
  6423. @end table
  6424. Default is @var{sc}.
  6425. @item combdbg
  6426. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  6427. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  6428. Available values are:
  6429. @table @samp
  6430. @item none
  6431. No forced calculation.
  6432. @item pcn
  6433. Force p/c/n calculations.
  6434. @item pcnub
  6435. Force p/c/n/u/b calculations.
  6436. @end table
  6437. Default value is @var{none}.
  6438. @item cthresh
  6439. This is the area combing threshold used for combed frame detection. This
  6440. essentially controls how "strong" or "visible" combing must be to be detected.
  6441. Larger values mean combing must be more visible and smaller values mean combing
  6442. can be less visible or strong and still be detected. Valid settings are from
  6443. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6444. be detected as combed). This is basically a pixel difference value. A good
  6445. range is @code{[8, 12]}.
  6446. Default value is @code{9}.
  6447. @item chroma
  6448. Sets whether or not chroma is considered in the combed frame decision. Only
  6449. disable this if your source has chroma problems (rainbowing, etc.) that are
  6450. causing problems for the combed frame detection with chroma enabled. Actually,
  6451. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6452. where there is chroma only combing in the source.
  6453. Default value is @code{0}.
  6454. @item blockx
  6455. @item blocky
  6456. Respectively set the x-axis and y-axis size of the window used during combed
  6457. frame detection. This has to do with the size of the area in which
  6458. @option{combpel} pixels are required to be detected as combed for a frame to be
  6459. declared combed. See the @option{combpel} parameter description for more info.
  6460. Possible values are any number that is a power of 2 starting at 4 and going up
  6461. to 512.
  6462. Default value is @code{16}.
  6463. @item combpel
  6464. The number of combed pixels inside any of the @option{blocky} by
  6465. @option{blockx} size blocks on the frame for the frame to be detected as
  6466. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6467. setting controls "how much" combing there must be in any localized area (a
  6468. window defined by the @option{blockx} and @option{blocky} settings) on the
  6469. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6470. which point no frames will ever be detected as combed). This setting is known
  6471. as @option{MI} in TFM/VFM vocabulary.
  6472. Default value is @code{80}.
  6473. @end table
  6474. @anchor{p/c/n/u/b meaning}
  6475. @subsection p/c/n/u/b meaning
  6476. @subsubsection p/c/n
  6477. We assume the following telecined stream:
  6478. @example
  6479. Top fields: 1 2 2 3 4
  6480. Bottom fields: 1 2 3 4 4
  6481. @end example
  6482. The numbers correspond to the progressive frame the fields relate to. Here, the
  6483. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6484. When @code{fieldmatch} is configured to run a matching from bottom
  6485. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6486. @example
  6487. Input stream:
  6488. T 1 2 2 3 4
  6489. B 1 2 3 4 4 <-- matching reference
  6490. Matches: c c n n c
  6491. Output stream:
  6492. T 1 2 3 4 4
  6493. B 1 2 3 4 4
  6494. @end example
  6495. As a result of the field matching, we can see that some frames get duplicated.
  6496. To perform a complete inverse telecine, you need to rely on a decimation filter
  6497. after this operation. See for instance the @ref{decimate} filter.
  6498. The same operation now matching from top fields (@option{field}=@var{top})
  6499. looks like this:
  6500. @example
  6501. Input stream:
  6502. T 1 2 2 3 4 <-- matching reference
  6503. B 1 2 3 4 4
  6504. Matches: c c p p c
  6505. Output stream:
  6506. T 1 2 2 3 4
  6507. B 1 2 2 3 4
  6508. @end example
  6509. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6510. basically, they refer to the frame and field of the opposite parity:
  6511. @itemize
  6512. @item @var{p} matches the field of the opposite parity in the previous frame
  6513. @item @var{c} matches the field of the opposite parity in the current frame
  6514. @item @var{n} matches the field of the opposite parity in the next frame
  6515. @end itemize
  6516. @subsubsection u/b
  6517. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6518. from the opposite parity flag. In the following examples, we assume that we are
  6519. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6520. 'x' is placed above and below each matched fields.
  6521. With bottom matching (@option{field}=@var{bottom}):
  6522. @example
  6523. Match: c p n b u
  6524. x x x x x
  6525. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6526. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6527. x x x x x
  6528. Output frames:
  6529. 2 1 2 2 2
  6530. 2 2 2 1 3
  6531. @end example
  6532. With top matching (@option{field}=@var{top}):
  6533. @example
  6534. Match: c p n b u
  6535. x x x x x
  6536. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6537. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6538. x x x x x
  6539. Output frames:
  6540. 2 2 2 1 2
  6541. 2 1 3 2 2
  6542. @end example
  6543. @subsection Examples
  6544. Simple IVTC of a top field first telecined stream:
  6545. @example
  6546. fieldmatch=order=tff:combmatch=none, decimate
  6547. @end example
  6548. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6549. @example
  6550. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6551. @end example
  6552. @section fieldorder
  6553. Transform the field order of the input video.
  6554. It accepts the following parameters:
  6555. @table @option
  6556. @item order
  6557. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6558. for bottom field first.
  6559. @end table
  6560. The default value is @samp{tff}.
  6561. The transformation is done by shifting the picture content up or down
  6562. by one line, and filling the remaining line with appropriate picture content.
  6563. This method is consistent with most broadcast field order converters.
  6564. If the input video is not flagged as being interlaced, or it is already
  6565. flagged as being of the required output field order, then this filter does
  6566. not alter the incoming video.
  6567. It is very useful when converting to or from PAL DV material,
  6568. which is bottom field first.
  6569. For example:
  6570. @example
  6571. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6572. @end example
  6573. @section fifo, afifo
  6574. Buffer input images and send them when they are requested.
  6575. It is mainly useful when auto-inserted by the libavfilter
  6576. framework.
  6577. It does not take parameters.
  6578. @section find_rect
  6579. Find a rectangular object
  6580. It accepts the following options:
  6581. @table @option
  6582. @item object
  6583. Filepath of the object image, needs to be in gray8.
  6584. @item threshold
  6585. Detection threshold, default is 0.5.
  6586. @item mipmaps
  6587. Number of mipmaps, default is 3.
  6588. @item xmin, ymin, xmax, ymax
  6589. Specifies the rectangle in which to search.
  6590. @end table
  6591. @subsection Examples
  6592. @itemize
  6593. @item
  6594. Generate a representative palette of a given video using @command{ffmpeg}:
  6595. @example
  6596. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6597. @end example
  6598. @end itemize
  6599. @section cover_rect
  6600. Cover a rectangular object
  6601. It accepts the following options:
  6602. @table @option
  6603. @item cover
  6604. Filepath of the optional cover image, needs to be in yuv420.
  6605. @item mode
  6606. Set covering mode.
  6607. It accepts the following values:
  6608. @table @samp
  6609. @item cover
  6610. cover it by the supplied image
  6611. @item blur
  6612. cover it by interpolating the surrounding pixels
  6613. @end table
  6614. Default value is @var{blur}.
  6615. @end table
  6616. @subsection Examples
  6617. @itemize
  6618. @item
  6619. Generate a representative palette of a given video using @command{ffmpeg}:
  6620. @example
  6621. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6622. @end example
  6623. @end itemize
  6624. @section floodfill
  6625. Flood area with values of same pixel components with another values.
  6626. It accepts the following options:
  6627. @table @option
  6628. @item x
  6629. Set pixel x coordinate.
  6630. @item y
  6631. Set pixel y coordinate.
  6632. @item s0
  6633. Set source #0 component value.
  6634. @item s1
  6635. Set source #1 component value.
  6636. @item s2
  6637. Set source #2 component value.
  6638. @item s3
  6639. Set source #3 component value.
  6640. @item d0
  6641. Set destination #0 component value.
  6642. @item d1
  6643. Set destination #1 component value.
  6644. @item d2
  6645. Set destination #2 component value.
  6646. @item d3
  6647. Set destination #3 component value.
  6648. @end table
  6649. @anchor{format}
  6650. @section format
  6651. Convert the input video to one of the specified pixel formats.
  6652. Libavfilter will try to pick one that is suitable as input to
  6653. the next filter.
  6654. It accepts the following parameters:
  6655. @table @option
  6656. @item pix_fmts
  6657. A '|'-separated list of pixel format names, such as
  6658. "pix_fmts=yuv420p|monow|rgb24".
  6659. @end table
  6660. @subsection Examples
  6661. @itemize
  6662. @item
  6663. Convert the input video to the @var{yuv420p} format
  6664. @example
  6665. format=pix_fmts=yuv420p
  6666. @end example
  6667. Convert the input video to any of the formats in the list
  6668. @example
  6669. format=pix_fmts=yuv420p|yuv444p|yuv410p
  6670. @end example
  6671. @end itemize
  6672. @anchor{fps}
  6673. @section fps
  6674. Convert the video to specified constant frame rate by duplicating or dropping
  6675. frames as necessary.
  6676. It accepts the following parameters:
  6677. @table @option
  6678. @item fps
  6679. The desired output frame rate. The default is @code{25}.
  6680. @item start_time
  6681. Assume the first PTS should be the given value, in seconds. This allows for
  6682. padding/trimming at the start of stream. By default, no assumption is made
  6683. about the first frame's expected PTS, so no padding or trimming is done.
  6684. For example, this could be set to 0 to pad the beginning with duplicates of
  6685. the first frame if a video stream starts after the audio stream or to trim any
  6686. frames with a negative PTS.
  6687. @item round
  6688. Timestamp (PTS) rounding method.
  6689. Possible values are:
  6690. @table @option
  6691. @item zero
  6692. round towards 0
  6693. @item inf
  6694. round away from 0
  6695. @item down
  6696. round towards -infinity
  6697. @item up
  6698. round towards +infinity
  6699. @item near
  6700. round to nearest
  6701. @end table
  6702. The default is @code{near}.
  6703. @item eof_action
  6704. Action performed when reading the last frame.
  6705. Possible values are:
  6706. @table @option
  6707. @item round
  6708. Use same timestamp rounding method as used for other frames.
  6709. @item pass
  6710. Pass through last frame if input duration has not been reached yet.
  6711. @end table
  6712. The default is @code{round}.
  6713. @end table
  6714. Alternatively, the options can be specified as a flat string:
  6715. @var{fps}[:@var{start_time}[:@var{round}]].
  6716. See also the @ref{setpts} filter.
  6717. @subsection Examples
  6718. @itemize
  6719. @item
  6720. A typical usage in order to set the fps to 25:
  6721. @example
  6722. fps=fps=25
  6723. @end example
  6724. @item
  6725. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  6726. @example
  6727. fps=fps=film:round=near
  6728. @end example
  6729. @end itemize
  6730. @section framepack
  6731. Pack two different video streams into a stereoscopic video, setting proper
  6732. metadata on supported codecs. The two views should have the same size and
  6733. framerate and processing will stop when the shorter video ends. Please note
  6734. that you may conveniently adjust view properties with the @ref{scale} and
  6735. @ref{fps} filters.
  6736. It accepts the following parameters:
  6737. @table @option
  6738. @item format
  6739. The desired packing format. Supported values are:
  6740. @table @option
  6741. @item sbs
  6742. The views are next to each other (default).
  6743. @item tab
  6744. The views are on top of each other.
  6745. @item lines
  6746. The views are packed by line.
  6747. @item columns
  6748. The views are packed by column.
  6749. @item frameseq
  6750. The views are temporally interleaved.
  6751. @end table
  6752. @end table
  6753. Some examples:
  6754. @example
  6755. # Convert left and right views into a frame-sequential video
  6756. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  6757. # Convert views into a side-by-side video with the same output resolution as the input
  6758. 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
  6759. @end example
  6760. @section framerate
  6761. Change the frame rate by interpolating new video output frames from the source
  6762. frames.
  6763. This filter is not designed to function correctly with interlaced media. If
  6764. you wish to change the frame rate of interlaced media then you are required
  6765. to deinterlace before this filter and re-interlace after this filter.
  6766. A description of the accepted options follows.
  6767. @table @option
  6768. @item fps
  6769. Specify the output frames per second. This option can also be specified
  6770. as a value alone. The default is @code{50}.
  6771. @item interp_start
  6772. Specify the start of a range where the output frame will be created as a
  6773. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6774. the default is @code{15}.
  6775. @item interp_end
  6776. Specify the end of a range where the output frame will be created as a
  6777. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6778. the default is @code{240}.
  6779. @item scene
  6780. Specify the level at which a scene change is detected as a value between
  6781. 0 and 100 to indicate a new scene; a low value reflects a low
  6782. probability for the current frame to introduce a new scene, while a higher
  6783. value means the current frame is more likely to be one.
  6784. The default is @code{7}.
  6785. @item flags
  6786. Specify flags influencing the filter process.
  6787. Available value for @var{flags} is:
  6788. @table @option
  6789. @item scene_change_detect, scd
  6790. Enable scene change detection using the value of the option @var{scene}.
  6791. This flag is enabled by default.
  6792. @end table
  6793. @end table
  6794. @section framestep
  6795. Select one frame every N-th frame.
  6796. This filter accepts the following option:
  6797. @table @option
  6798. @item step
  6799. Select frame after every @code{step} frames.
  6800. Allowed values are positive integers higher than 0. Default value is @code{1}.
  6801. @end table
  6802. @anchor{frei0r}
  6803. @section frei0r
  6804. Apply a frei0r effect to the input video.
  6805. To enable the compilation of this filter, you need to install the frei0r
  6806. header and configure FFmpeg with @code{--enable-frei0r}.
  6807. It accepts the following parameters:
  6808. @table @option
  6809. @item filter_name
  6810. The name of the frei0r effect to load. If the environment variable
  6811. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  6812. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  6813. Otherwise, the standard frei0r paths are searched, in this order:
  6814. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  6815. @file{/usr/lib/frei0r-1/}.
  6816. @item filter_params
  6817. A '|'-separated list of parameters to pass to the frei0r effect.
  6818. @end table
  6819. A frei0r effect parameter can be a boolean (its value is either
  6820. "y" or "n"), a double, a color (specified as
  6821. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  6822. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  6823. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  6824. @var{X} and @var{Y} are floating point numbers) and/or a string.
  6825. The number and types of parameters depend on the loaded effect. If an
  6826. effect parameter is not specified, the default value is set.
  6827. @subsection Examples
  6828. @itemize
  6829. @item
  6830. Apply the distort0r effect, setting the first two double parameters:
  6831. @example
  6832. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  6833. @end example
  6834. @item
  6835. Apply the colordistance effect, taking a color as the first parameter:
  6836. @example
  6837. frei0r=colordistance:0.2/0.3/0.4
  6838. frei0r=colordistance:violet
  6839. frei0r=colordistance:0x112233
  6840. @end example
  6841. @item
  6842. Apply the perspective effect, specifying the top left and top right image
  6843. positions:
  6844. @example
  6845. frei0r=perspective:0.2/0.2|0.8/0.2
  6846. @end example
  6847. @end itemize
  6848. For more information, see
  6849. @url{http://frei0r.dyne.org}
  6850. @section fspp
  6851. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  6852. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  6853. processing filter, one of them is performed once per block, not per pixel.
  6854. This allows for much higher speed.
  6855. The filter accepts the following options:
  6856. @table @option
  6857. @item quality
  6858. Set quality. This option defines the number of levels for averaging. It accepts
  6859. an integer in the range 4-5. Default value is @code{4}.
  6860. @item qp
  6861. Force a constant quantization parameter. It accepts an integer in range 0-63.
  6862. If not set, the filter will use the QP from the video stream (if available).
  6863. @item strength
  6864. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  6865. more details but also more artifacts, while higher values make the image smoother
  6866. but also blurrier. Default value is @code{0} − PSNR optimal.
  6867. @item use_bframe_qp
  6868. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  6869. option may cause flicker since the B-Frames have often larger QP. Default is
  6870. @code{0} (not enabled).
  6871. @end table
  6872. @section gblur
  6873. Apply Gaussian blur filter.
  6874. The filter accepts the following options:
  6875. @table @option
  6876. @item sigma
  6877. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  6878. @item steps
  6879. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  6880. @item planes
  6881. Set which planes to filter. By default all planes are filtered.
  6882. @item sigmaV
  6883. Set vertical sigma, if negative it will be same as @code{sigma}.
  6884. Default is @code{-1}.
  6885. @end table
  6886. @section geq
  6887. The filter accepts the following options:
  6888. @table @option
  6889. @item lum_expr, lum
  6890. Set the luminance expression.
  6891. @item cb_expr, cb
  6892. Set the chrominance blue expression.
  6893. @item cr_expr, cr
  6894. Set the chrominance red expression.
  6895. @item alpha_expr, a
  6896. Set the alpha expression.
  6897. @item red_expr, r
  6898. Set the red expression.
  6899. @item green_expr, g
  6900. Set the green expression.
  6901. @item blue_expr, b
  6902. Set the blue expression.
  6903. @end table
  6904. The colorspace is selected according to the specified options. If one
  6905. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  6906. options is specified, the filter will automatically select a YCbCr
  6907. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  6908. @option{blue_expr} options is specified, it will select an RGB
  6909. colorspace.
  6910. If one of the chrominance expression is not defined, it falls back on the other
  6911. one. If no alpha expression is specified it will evaluate to opaque value.
  6912. If none of chrominance expressions are specified, they will evaluate
  6913. to the luminance expression.
  6914. The expressions can use the following variables and functions:
  6915. @table @option
  6916. @item N
  6917. The sequential number of the filtered frame, starting from @code{0}.
  6918. @item X
  6919. @item Y
  6920. The coordinates of the current sample.
  6921. @item W
  6922. @item H
  6923. The width and height of the image.
  6924. @item SW
  6925. @item SH
  6926. Width and height scale depending on the currently filtered plane. It is the
  6927. ratio between the corresponding luma plane number of pixels and the current
  6928. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  6929. @code{0.5,0.5} for chroma planes.
  6930. @item T
  6931. Time of the current frame, expressed in seconds.
  6932. @item p(x, y)
  6933. Return the value of the pixel at location (@var{x},@var{y}) of the current
  6934. plane.
  6935. @item lum(x, y)
  6936. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  6937. plane.
  6938. @item cb(x, y)
  6939. Return the value of the pixel at location (@var{x},@var{y}) of the
  6940. blue-difference chroma plane. Return 0 if there is no such plane.
  6941. @item cr(x, y)
  6942. Return the value of the pixel at location (@var{x},@var{y}) of the
  6943. red-difference chroma plane. Return 0 if there is no such plane.
  6944. @item r(x, y)
  6945. @item g(x, y)
  6946. @item b(x, y)
  6947. Return the value of the pixel at location (@var{x},@var{y}) of the
  6948. red/green/blue component. Return 0 if there is no such component.
  6949. @item alpha(x, y)
  6950. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  6951. plane. Return 0 if there is no such plane.
  6952. @end table
  6953. For functions, if @var{x} and @var{y} are outside the area, the value will be
  6954. automatically clipped to the closer edge.
  6955. @subsection Examples
  6956. @itemize
  6957. @item
  6958. Flip the image horizontally:
  6959. @example
  6960. geq=p(W-X\,Y)
  6961. @end example
  6962. @item
  6963. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  6964. wavelength of 100 pixels:
  6965. @example
  6966. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  6967. @end example
  6968. @item
  6969. Generate a fancy enigmatic moving light:
  6970. @example
  6971. 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
  6972. @end example
  6973. @item
  6974. Generate a quick emboss effect:
  6975. @example
  6976. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  6977. @end example
  6978. @item
  6979. Modify RGB components depending on pixel position:
  6980. @example
  6981. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  6982. @end example
  6983. @item
  6984. Create a radial gradient that is the same size as the input (also see
  6985. the @ref{vignette} filter):
  6986. @example
  6987. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  6988. @end example
  6989. @end itemize
  6990. @section gradfun
  6991. Fix the banding artifacts that are sometimes introduced into nearly flat
  6992. regions by truncation to 8-bit color depth.
  6993. Interpolate the gradients that should go where the bands are, and
  6994. dither them.
  6995. It is designed for playback only. Do not use it prior to
  6996. lossy compression, because compression tends to lose the dither and
  6997. bring back the bands.
  6998. It accepts the following parameters:
  6999. @table @option
  7000. @item strength
  7001. The maximum amount by which the filter will change any one pixel. This is also
  7002. the threshold for detecting nearly flat regions. Acceptable values range from
  7003. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  7004. valid range.
  7005. @item radius
  7006. The neighborhood to fit the gradient to. A larger radius makes for smoother
  7007. gradients, but also prevents the filter from modifying the pixels near detailed
  7008. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  7009. values will be clipped to the valid range.
  7010. @end table
  7011. Alternatively, the options can be specified as a flat string:
  7012. @var{strength}[:@var{radius}]
  7013. @subsection Examples
  7014. @itemize
  7015. @item
  7016. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  7017. @example
  7018. gradfun=3.5:8
  7019. @end example
  7020. @item
  7021. Specify radius, omitting the strength (which will fall-back to the default
  7022. value):
  7023. @example
  7024. gradfun=radius=8
  7025. @end example
  7026. @end itemize
  7027. @anchor{haldclut}
  7028. @section haldclut
  7029. Apply a Hald CLUT to a video stream.
  7030. First input is the video stream to process, and second one is the Hald CLUT.
  7031. The Hald CLUT input can be a simple picture or a complete video stream.
  7032. The filter accepts the following options:
  7033. @table @option
  7034. @item shortest
  7035. Force termination when the shortest input terminates. Default is @code{0}.
  7036. @item repeatlast
  7037. Continue applying the last CLUT after the end of the stream. A value of
  7038. @code{0} disable the filter after the last frame of the CLUT is reached.
  7039. Default is @code{1}.
  7040. @end table
  7041. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  7042. filters share the same internals).
  7043. More information about the Hald CLUT can be found on Eskil Steenberg's website
  7044. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  7045. @subsection Workflow examples
  7046. @subsubsection Hald CLUT video stream
  7047. Generate an identity Hald CLUT stream altered with various effects:
  7048. @example
  7049. 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
  7050. @end example
  7051. Note: make sure you use a lossless codec.
  7052. Then use it with @code{haldclut} to apply it on some random stream:
  7053. @example
  7054. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  7055. @end example
  7056. The Hald CLUT will be applied to the 10 first seconds (duration of
  7057. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  7058. to the remaining frames of the @code{mandelbrot} stream.
  7059. @subsubsection Hald CLUT with preview
  7060. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  7061. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  7062. biggest possible square starting at the top left of the picture. The remaining
  7063. padding pixels (bottom or right) will be ignored. This area can be used to add
  7064. a preview of the Hald CLUT.
  7065. Typically, the following generated Hald CLUT will be supported by the
  7066. @code{haldclut} filter:
  7067. @example
  7068. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  7069. pad=iw+320 [padded_clut];
  7070. smptebars=s=320x256, split [a][b];
  7071. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  7072. [main][b] overlay=W-320" -frames:v 1 clut.png
  7073. @end example
  7074. It contains the original and a preview of the effect of the CLUT: SMPTE color
  7075. bars are displayed on the right-top, and below the same color bars processed by
  7076. the color changes.
  7077. Then, the effect of this Hald CLUT can be visualized with:
  7078. @example
  7079. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  7080. @end example
  7081. @section hflip
  7082. Flip the input video horizontally.
  7083. For example, to horizontally flip the input video with @command{ffmpeg}:
  7084. @example
  7085. ffmpeg -i in.avi -vf "hflip" out.avi
  7086. @end example
  7087. @section histeq
  7088. This filter applies a global color histogram equalization on a
  7089. per-frame basis.
  7090. It can be used to correct video that has a compressed range of pixel
  7091. intensities. The filter redistributes the pixel intensities to
  7092. equalize their distribution across the intensity range. It may be
  7093. viewed as an "automatically adjusting contrast filter". This filter is
  7094. useful only for correcting degraded or poorly captured source
  7095. video.
  7096. The filter accepts the following options:
  7097. @table @option
  7098. @item strength
  7099. Determine the amount of equalization to be applied. As the strength
  7100. is reduced, the distribution of pixel intensities more-and-more
  7101. approaches that of the input frame. The value must be a float number
  7102. in the range [0,1] and defaults to 0.200.
  7103. @item intensity
  7104. Set the maximum intensity that can generated and scale the output
  7105. values appropriately. The strength should be set as desired and then
  7106. the intensity can be limited if needed to avoid washing-out. The value
  7107. must be a float number in the range [0,1] and defaults to 0.210.
  7108. @item antibanding
  7109. Set the antibanding level. If enabled the filter will randomly vary
  7110. the luminance of output pixels by a small amount to avoid banding of
  7111. the histogram. Possible values are @code{none}, @code{weak} or
  7112. @code{strong}. It defaults to @code{none}.
  7113. @end table
  7114. @section histogram
  7115. Compute and draw a color distribution histogram for the input video.
  7116. The computed histogram is a representation of the color component
  7117. distribution in an image.
  7118. Standard histogram displays the color components distribution in an image.
  7119. Displays color graph for each color component. Shows distribution of
  7120. the Y, U, V, A or R, G, B components, depending on input format, in the
  7121. current frame. Below each graph a color component scale meter is shown.
  7122. The filter accepts the following options:
  7123. @table @option
  7124. @item level_height
  7125. Set height of level. Default value is @code{200}.
  7126. Allowed range is [50, 2048].
  7127. @item scale_height
  7128. Set height of color scale. Default value is @code{12}.
  7129. Allowed range is [0, 40].
  7130. @item display_mode
  7131. Set display mode.
  7132. It accepts the following values:
  7133. @table @samp
  7134. @item stack
  7135. Per color component graphs are placed below each other.
  7136. @item parade
  7137. Per color component graphs are placed side by side.
  7138. @item overlay
  7139. Presents information identical to that in the @code{parade}, except
  7140. that the graphs representing color components are superimposed directly
  7141. over one another.
  7142. @end table
  7143. Default is @code{stack}.
  7144. @item levels_mode
  7145. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  7146. Default is @code{linear}.
  7147. @item components
  7148. Set what color components to display.
  7149. Default is @code{7}.
  7150. @item fgopacity
  7151. Set foreground opacity. Default is @code{0.7}.
  7152. @item bgopacity
  7153. Set background opacity. Default is @code{0.5}.
  7154. @end table
  7155. @subsection Examples
  7156. @itemize
  7157. @item
  7158. Calculate and draw histogram:
  7159. @example
  7160. ffplay -i input -vf histogram
  7161. @end example
  7162. @end itemize
  7163. @anchor{hqdn3d}
  7164. @section hqdn3d
  7165. This is a high precision/quality 3d denoise filter. It aims to reduce
  7166. image noise, producing smooth images and making still images really
  7167. still. It should enhance compressibility.
  7168. It accepts the following optional parameters:
  7169. @table @option
  7170. @item luma_spatial
  7171. A non-negative floating point number which specifies spatial luma strength.
  7172. It defaults to 4.0.
  7173. @item chroma_spatial
  7174. A non-negative floating point number which specifies spatial chroma strength.
  7175. It defaults to 3.0*@var{luma_spatial}/4.0.
  7176. @item luma_tmp
  7177. A floating point number which specifies luma temporal strength. It defaults to
  7178. 6.0*@var{luma_spatial}/4.0.
  7179. @item chroma_tmp
  7180. A floating point number which specifies chroma temporal strength. It defaults to
  7181. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  7182. @end table
  7183. @section hwdownload
  7184. Download hardware frames to system memory.
  7185. The input must be in hardware frames, and the output a non-hardware format.
  7186. Not all formats will be supported on the output - it may be necessary to insert
  7187. an additional @option{format} filter immediately following in the graph to get
  7188. the output in a supported format.
  7189. @section hwmap
  7190. Map hardware frames to system memory or to another device.
  7191. This filter has several different modes of operation; which one is used depends
  7192. on the input and output formats:
  7193. @itemize
  7194. @item
  7195. Hardware frame input, normal frame output
  7196. Map the input frames to system memory and pass them to the output. If the
  7197. original hardware frame is later required (for example, after overlaying
  7198. something else on part of it), the @option{hwmap} filter can be used again
  7199. in the next mode to retrieve it.
  7200. @item
  7201. Normal frame input, hardware frame output
  7202. If the input is actually a software-mapped hardware frame, then unmap it -
  7203. that is, return the original hardware frame.
  7204. Otherwise, a device must be provided. Create new hardware surfaces on that
  7205. device for the output, then map them back to the software format at the input
  7206. and give those frames to the preceding filter. This will then act like the
  7207. @option{hwupload} filter, but may be able to avoid an additional copy when
  7208. the input is already in a compatible format.
  7209. @item
  7210. Hardware frame input and output
  7211. A device must be supplied for the output, either directly or with the
  7212. @option{derive_device} option. The input and output devices must be of
  7213. different types and compatible - the exact meaning of this is
  7214. system-dependent, but typically it means that they must refer to the same
  7215. underlying hardware context (for example, refer to the same graphics card).
  7216. If the input frames were originally created on the output device, then unmap
  7217. to retrieve the original frames.
  7218. Otherwise, map the frames to the output device - create new hardware frames
  7219. on the output corresponding to the frames on the input.
  7220. @end itemize
  7221. The following additional parameters are accepted:
  7222. @table @option
  7223. @item mode
  7224. Set the frame mapping mode. Some combination of:
  7225. @table @var
  7226. @item read
  7227. The mapped frame should be readable.
  7228. @item write
  7229. The mapped frame should be writeable.
  7230. @item overwrite
  7231. The mapping will always overwrite the entire frame.
  7232. This may improve performance in some cases, as the original contents of the
  7233. frame need not be loaded.
  7234. @item direct
  7235. The mapping must not involve any copying.
  7236. Indirect mappings to copies of frames are created in some cases where either
  7237. direct mapping is not possible or it would have unexpected properties.
  7238. Setting this flag ensures that the mapping is direct and will fail if that is
  7239. not possible.
  7240. @end table
  7241. Defaults to @var{read+write} if not specified.
  7242. @item derive_device @var{type}
  7243. Rather than using the device supplied at initialisation, instead derive a new
  7244. device of type @var{type} from the device the input frames exist on.
  7245. @item reverse
  7246. In a hardware to hardware mapping, map in reverse - create frames in the sink
  7247. and map them back to the source. This may be necessary in some cases where
  7248. a mapping in one direction is required but only the opposite direction is
  7249. supported by the devices being used.
  7250. This option is dangerous - it may break the preceding filter in undefined
  7251. ways if there are any additional constraints on that filter's output.
  7252. Do not use it without fully understanding the implications of its use.
  7253. @end table
  7254. @section hwupload
  7255. Upload system memory frames to hardware surfaces.
  7256. The device to upload to must be supplied when the filter is initialised. If
  7257. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  7258. option.
  7259. @anchor{hwupload_cuda}
  7260. @section hwupload_cuda
  7261. Upload system memory frames to a CUDA device.
  7262. It accepts the following optional parameters:
  7263. @table @option
  7264. @item device
  7265. The number of the CUDA device to use
  7266. @end table
  7267. @section hqx
  7268. Apply a high-quality magnification filter designed for pixel art. This filter
  7269. was originally created by Maxim Stepin.
  7270. It accepts the following option:
  7271. @table @option
  7272. @item n
  7273. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  7274. @code{hq3x} and @code{4} for @code{hq4x}.
  7275. Default is @code{3}.
  7276. @end table
  7277. @section hstack
  7278. Stack input videos horizontally.
  7279. All streams must be of same pixel format and of same height.
  7280. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  7281. to create same output.
  7282. The filter accept the following option:
  7283. @table @option
  7284. @item inputs
  7285. Set number of input streams. Default is 2.
  7286. @item shortest
  7287. If set to 1, force the output to terminate when the shortest input
  7288. terminates. Default value is 0.
  7289. @end table
  7290. @section hue
  7291. Modify the hue and/or the saturation of the input.
  7292. It accepts the following parameters:
  7293. @table @option
  7294. @item h
  7295. Specify the hue angle as a number of degrees. It accepts an expression,
  7296. and defaults to "0".
  7297. @item s
  7298. Specify the saturation in the [-10,10] range. It accepts an expression and
  7299. defaults to "1".
  7300. @item H
  7301. Specify the hue angle as a number of radians. It accepts an
  7302. expression, and defaults to "0".
  7303. @item b
  7304. Specify the brightness in the [-10,10] range. It accepts an expression and
  7305. defaults to "0".
  7306. @end table
  7307. @option{h} and @option{H} are mutually exclusive, and can't be
  7308. specified at the same time.
  7309. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  7310. expressions containing the following constants:
  7311. @table @option
  7312. @item n
  7313. frame count of the input frame starting from 0
  7314. @item pts
  7315. presentation timestamp of the input frame expressed in time base units
  7316. @item r
  7317. frame rate of the input video, NAN if the input frame rate is unknown
  7318. @item t
  7319. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7320. @item tb
  7321. time base of the input video
  7322. @end table
  7323. @subsection Examples
  7324. @itemize
  7325. @item
  7326. Set the hue to 90 degrees and the saturation to 1.0:
  7327. @example
  7328. hue=h=90:s=1
  7329. @end example
  7330. @item
  7331. Same command but expressing the hue in radians:
  7332. @example
  7333. hue=H=PI/2:s=1
  7334. @end example
  7335. @item
  7336. Rotate hue and make the saturation swing between 0
  7337. and 2 over a period of 1 second:
  7338. @example
  7339. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  7340. @end example
  7341. @item
  7342. Apply a 3 seconds saturation fade-in effect starting at 0:
  7343. @example
  7344. hue="s=min(t/3\,1)"
  7345. @end example
  7346. The general fade-in expression can be written as:
  7347. @example
  7348. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  7349. @end example
  7350. @item
  7351. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  7352. @example
  7353. hue="s=max(0\, min(1\, (8-t)/3))"
  7354. @end example
  7355. The general fade-out expression can be written as:
  7356. @example
  7357. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  7358. @end example
  7359. @end itemize
  7360. @subsection Commands
  7361. This filter supports the following commands:
  7362. @table @option
  7363. @item b
  7364. @item s
  7365. @item h
  7366. @item H
  7367. Modify the hue and/or the saturation and/or brightness of the input video.
  7368. The command accepts the same syntax of the corresponding option.
  7369. If the specified expression is not valid, it is kept at its current
  7370. value.
  7371. @end table
  7372. @section hysteresis
  7373. Grow first stream into second stream by connecting components.
  7374. This makes it possible to build more robust edge masks.
  7375. This filter accepts the following options:
  7376. @table @option
  7377. @item planes
  7378. Set which planes will be processed as bitmap, unprocessed planes will be
  7379. copied from first stream.
  7380. By default value 0xf, all planes will be processed.
  7381. @item threshold
  7382. Set threshold which is used in filtering. If pixel component value is higher than
  7383. this value filter algorithm for connecting components is activated.
  7384. By default value is 0.
  7385. @end table
  7386. @section idet
  7387. Detect video interlacing type.
  7388. This filter tries to detect if the input frames are interlaced, progressive,
  7389. top or bottom field first. It will also try to detect fields that are
  7390. repeated between adjacent frames (a sign of telecine).
  7391. Single frame detection considers only immediately adjacent frames when classifying each frame.
  7392. Multiple frame detection incorporates the classification history of previous frames.
  7393. The filter will log these metadata values:
  7394. @table @option
  7395. @item single.current_frame
  7396. Detected type of current frame using single-frame detection. One of:
  7397. ``tff'' (top field first), ``bff'' (bottom field first),
  7398. ``progressive'', or ``undetermined''
  7399. @item single.tff
  7400. Cumulative number of frames detected as top field first using single-frame detection.
  7401. @item multiple.tff
  7402. Cumulative number of frames detected as top field first using multiple-frame detection.
  7403. @item single.bff
  7404. Cumulative number of frames detected as bottom field first using single-frame detection.
  7405. @item multiple.current_frame
  7406. Detected type of current frame using multiple-frame detection. One of:
  7407. ``tff'' (top field first), ``bff'' (bottom field first),
  7408. ``progressive'', or ``undetermined''
  7409. @item multiple.bff
  7410. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  7411. @item single.progressive
  7412. Cumulative number of frames detected as progressive using single-frame detection.
  7413. @item multiple.progressive
  7414. Cumulative number of frames detected as progressive using multiple-frame detection.
  7415. @item single.undetermined
  7416. Cumulative number of frames that could not be classified using single-frame detection.
  7417. @item multiple.undetermined
  7418. Cumulative number of frames that could not be classified using multiple-frame detection.
  7419. @item repeated.current_frame
  7420. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  7421. @item repeated.neither
  7422. Cumulative number of frames with no repeated field.
  7423. @item repeated.top
  7424. Cumulative number of frames with the top field repeated from the previous frame's top field.
  7425. @item repeated.bottom
  7426. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  7427. @end table
  7428. The filter accepts the following options:
  7429. @table @option
  7430. @item intl_thres
  7431. Set interlacing threshold.
  7432. @item prog_thres
  7433. Set progressive threshold.
  7434. @item rep_thres
  7435. Threshold for repeated field detection.
  7436. @item half_life
  7437. Number of frames after which a given frame's contribution to the
  7438. statistics is halved (i.e., it contributes only 0.5 to its
  7439. classification). The default of 0 means that all frames seen are given
  7440. full weight of 1.0 forever.
  7441. @item analyze_interlaced_flag
  7442. When this is not 0 then idet will use the specified number of frames to determine
  7443. if the interlaced flag is accurate, it will not count undetermined frames.
  7444. If the flag is found to be accurate it will be used without any further
  7445. computations, if it is found to be inaccurate it will be cleared without any
  7446. further computations. This allows inserting the idet filter as a low computational
  7447. method to clean up the interlaced flag
  7448. @end table
  7449. @section il
  7450. Deinterleave or interleave fields.
  7451. This filter allows one to process interlaced images fields without
  7452. deinterlacing them. Deinterleaving splits the input frame into 2
  7453. fields (so called half pictures). Odd lines are moved to the top
  7454. half of the output image, even lines to the bottom half.
  7455. You can process (filter) them independently and then re-interleave them.
  7456. The filter accepts the following options:
  7457. @table @option
  7458. @item luma_mode, l
  7459. @item chroma_mode, c
  7460. @item alpha_mode, a
  7461. Available values for @var{luma_mode}, @var{chroma_mode} and
  7462. @var{alpha_mode} are:
  7463. @table @samp
  7464. @item none
  7465. Do nothing.
  7466. @item deinterleave, d
  7467. Deinterleave fields, placing one above the other.
  7468. @item interleave, i
  7469. Interleave fields. Reverse the effect of deinterleaving.
  7470. @end table
  7471. Default value is @code{none}.
  7472. @item luma_swap, ls
  7473. @item chroma_swap, cs
  7474. @item alpha_swap, as
  7475. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  7476. @end table
  7477. @section inflate
  7478. Apply inflate effect to the video.
  7479. This filter replaces the pixel by the local(3x3) average by taking into account
  7480. only values higher than the pixel.
  7481. It accepts the following options:
  7482. @table @option
  7483. @item threshold0
  7484. @item threshold1
  7485. @item threshold2
  7486. @item threshold3
  7487. Limit the maximum change for each plane, default is 65535.
  7488. If 0, plane will remain unchanged.
  7489. @end table
  7490. @section interlace
  7491. Simple interlacing filter from progressive contents. This interleaves upper (or
  7492. lower) lines from odd frames with lower (or upper) lines from even frames,
  7493. halving the frame rate and preserving image height.
  7494. @example
  7495. Original Original New Frame
  7496. Frame 'j' Frame 'j+1' (tff)
  7497. ========== =========== ==================
  7498. Line 0 --------------------> Frame 'j' Line 0
  7499. Line 1 Line 1 ----> Frame 'j+1' Line 1
  7500. Line 2 ---------------------> Frame 'j' Line 2
  7501. Line 3 Line 3 ----> Frame 'j+1' Line 3
  7502. ... ... ...
  7503. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  7504. @end example
  7505. It accepts the following optional parameters:
  7506. @table @option
  7507. @item scan
  7508. This determines whether the interlaced frame is taken from the even
  7509. (tff - default) or odd (bff) lines of the progressive frame.
  7510. @item lowpass
  7511. Vertical lowpass filter to avoid twitter interlacing and
  7512. reduce moire patterns.
  7513. @table @samp
  7514. @item 0, off
  7515. Disable vertical lowpass filter
  7516. @item 1, linear
  7517. Enable linear filter (default)
  7518. @item 2, complex
  7519. Enable complex filter. This will slightly less reduce twitter and moire
  7520. but better retain detail and subjective sharpness impression.
  7521. @end table
  7522. @end table
  7523. @section kerndeint
  7524. Deinterlace input video by applying Donald Graft's adaptive kernel
  7525. deinterling. Work on interlaced parts of a video to produce
  7526. progressive frames.
  7527. The description of the accepted parameters follows.
  7528. @table @option
  7529. @item thresh
  7530. Set the threshold which affects the filter's tolerance when
  7531. determining if a pixel line must be processed. It must be an integer
  7532. in the range [0,255] and defaults to 10. A value of 0 will result in
  7533. applying the process on every pixels.
  7534. @item map
  7535. Paint pixels exceeding the threshold value to white if set to 1.
  7536. Default is 0.
  7537. @item order
  7538. Set the fields order. Swap fields if set to 1, leave fields alone if
  7539. 0. Default is 0.
  7540. @item sharp
  7541. Enable additional sharpening if set to 1. Default is 0.
  7542. @item twoway
  7543. Enable twoway sharpening if set to 1. Default is 0.
  7544. @end table
  7545. @subsection Examples
  7546. @itemize
  7547. @item
  7548. Apply default values:
  7549. @example
  7550. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  7551. @end example
  7552. @item
  7553. Enable additional sharpening:
  7554. @example
  7555. kerndeint=sharp=1
  7556. @end example
  7557. @item
  7558. Paint processed pixels in white:
  7559. @example
  7560. kerndeint=map=1
  7561. @end example
  7562. @end itemize
  7563. @section lenscorrection
  7564. Correct radial lens distortion
  7565. This filter can be used to correct for radial distortion as can result from the use
  7566. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  7567. one can use tools available for example as part of opencv or simply trial-and-error.
  7568. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  7569. and extract the k1 and k2 coefficients from the resulting matrix.
  7570. Note that effectively the same filter is available in the open-source tools Krita and
  7571. Digikam from the KDE project.
  7572. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  7573. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  7574. brightness distribution, so you may want to use both filters together in certain
  7575. cases, though you will have to take care of ordering, i.e. whether vignetting should
  7576. be applied before or after lens correction.
  7577. @subsection Options
  7578. The filter accepts the following options:
  7579. @table @option
  7580. @item cx
  7581. Relative x-coordinate of the focal point of the image, and thereby the center of the
  7582. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7583. width.
  7584. @item cy
  7585. Relative y-coordinate of the focal point of the image, and thereby the center of the
  7586. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7587. height.
  7588. @item k1
  7589. Coefficient of the quadratic correction term. 0.5 means no correction.
  7590. @item k2
  7591. Coefficient of the double quadratic correction term. 0.5 means no correction.
  7592. @end table
  7593. The formula that generates the correction is:
  7594. @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)
  7595. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  7596. distances from the focal point in the source and target images, respectively.
  7597. @section libvmaf
  7598. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  7599. score between two input videos.
  7600. The obtained VMAF score is printed through the logging system.
  7601. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  7602. After installing the library it can be enabled using:
  7603. @code{./configure --enable-libvmaf}.
  7604. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  7605. The filter has following options:
  7606. @table @option
  7607. @item model_path
  7608. Set the model path which is to be used for SVM.
  7609. Default value: @code{"vmaf_v0.6.1.pkl"}
  7610. @item log_path
  7611. Set the file path to be used to store logs.
  7612. @item log_fmt
  7613. Set the format of the log file (xml or json).
  7614. @item enable_transform
  7615. Enables transform for computing vmaf.
  7616. @item phone_model
  7617. Invokes the phone model which will generate VMAF scores higher than in the
  7618. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  7619. @item psnr
  7620. Enables computing psnr along with vmaf.
  7621. @item ssim
  7622. Enables computing ssim along with vmaf.
  7623. @item ms_ssim
  7624. Enables computing ms_ssim along with vmaf.
  7625. @item pool
  7626. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  7627. @end table
  7628. This filter also supports the @ref{framesync} options.
  7629. On the below examples the input file @file{main.mpg} being processed is
  7630. compared with the reference file @file{ref.mpg}.
  7631. @example
  7632. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  7633. @end example
  7634. Example with options:
  7635. @example
  7636. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
  7637. @end example
  7638. @section limiter
  7639. Limits the pixel components values to the specified range [min, max].
  7640. The filter accepts the following options:
  7641. @table @option
  7642. @item min
  7643. Lower bound. Defaults to the lowest allowed value for the input.
  7644. @item max
  7645. Upper bound. Defaults to the highest allowed value for the input.
  7646. @item planes
  7647. Specify which planes will be processed. Defaults to all available.
  7648. @end table
  7649. @section loop
  7650. Loop video frames.
  7651. The filter accepts the following options:
  7652. @table @option
  7653. @item loop
  7654. Set the number of loops.
  7655. @item size
  7656. Set maximal size in number of frames.
  7657. @item start
  7658. Set first frame of loop.
  7659. @end table
  7660. @anchor{lut3d}
  7661. @section lut3d
  7662. Apply a 3D LUT to an input video.
  7663. The filter accepts the following options:
  7664. @table @option
  7665. @item file
  7666. Set the 3D LUT file name.
  7667. Currently supported formats:
  7668. @table @samp
  7669. @item 3dl
  7670. AfterEffects
  7671. @item cube
  7672. Iridas
  7673. @item dat
  7674. DaVinci
  7675. @item m3d
  7676. Pandora
  7677. @end table
  7678. @item interp
  7679. Select interpolation mode.
  7680. Available values are:
  7681. @table @samp
  7682. @item nearest
  7683. Use values from the nearest defined point.
  7684. @item trilinear
  7685. Interpolate values using the 8 points defining a cube.
  7686. @item tetrahedral
  7687. Interpolate values using a tetrahedron.
  7688. @end table
  7689. @end table
  7690. This filter also supports the @ref{framesync} options.
  7691. @section lumakey
  7692. Turn certain luma values into transparency.
  7693. The filter accepts the following options:
  7694. @table @option
  7695. @item threshold
  7696. Set the luma which will be used as base for transparency.
  7697. Default value is @code{0}.
  7698. @item tolerance
  7699. Set the range of luma values to be keyed out.
  7700. Default value is @code{0}.
  7701. @item softness
  7702. Set the range of softness. Default value is @code{0}.
  7703. Use this to control gradual transition from zero to full transparency.
  7704. @end table
  7705. @section lut, lutrgb, lutyuv
  7706. Compute a look-up table for binding each pixel component input value
  7707. to an output value, and apply it to the input video.
  7708. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  7709. to an RGB input video.
  7710. These filters accept the following parameters:
  7711. @table @option
  7712. @item c0
  7713. set first pixel component expression
  7714. @item c1
  7715. set second pixel component expression
  7716. @item c2
  7717. set third pixel component expression
  7718. @item c3
  7719. set fourth pixel component expression, corresponds to the alpha component
  7720. @item r
  7721. set red component expression
  7722. @item g
  7723. set green component expression
  7724. @item b
  7725. set blue component expression
  7726. @item a
  7727. alpha component expression
  7728. @item y
  7729. set Y/luminance component expression
  7730. @item u
  7731. set U/Cb component expression
  7732. @item v
  7733. set V/Cr component expression
  7734. @end table
  7735. Each of them specifies the expression to use for computing the lookup table for
  7736. the corresponding pixel component values.
  7737. The exact component associated to each of the @var{c*} options depends on the
  7738. format in input.
  7739. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  7740. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  7741. The expressions can contain the following constants and functions:
  7742. @table @option
  7743. @item w
  7744. @item h
  7745. The input width and height.
  7746. @item val
  7747. The input value for the pixel component.
  7748. @item clipval
  7749. The input value, clipped to the @var{minval}-@var{maxval} range.
  7750. @item maxval
  7751. The maximum value for the pixel component.
  7752. @item minval
  7753. The minimum value for the pixel component.
  7754. @item negval
  7755. The negated value for the pixel component value, clipped to the
  7756. @var{minval}-@var{maxval} range; it corresponds to the expression
  7757. "maxval-clipval+minval".
  7758. @item clip(val)
  7759. The computed value in @var{val}, clipped to the
  7760. @var{minval}-@var{maxval} range.
  7761. @item gammaval(gamma)
  7762. The computed gamma correction value of the pixel component value,
  7763. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  7764. expression
  7765. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  7766. @end table
  7767. All expressions default to "val".
  7768. @subsection Examples
  7769. @itemize
  7770. @item
  7771. Negate input video:
  7772. @example
  7773. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  7774. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  7775. @end example
  7776. The above is the same as:
  7777. @example
  7778. lutrgb="r=negval:g=negval:b=negval"
  7779. lutyuv="y=negval:u=negval:v=negval"
  7780. @end example
  7781. @item
  7782. Negate luminance:
  7783. @example
  7784. lutyuv=y=negval
  7785. @end example
  7786. @item
  7787. Remove chroma components, turning the video into a graytone image:
  7788. @example
  7789. lutyuv="u=128:v=128"
  7790. @end example
  7791. @item
  7792. Apply a luma burning effect:
  7793. @example
  7794. lutyuv="y=2*val"
  7795. @end example
  7796. @item
  7797. Remove green and blue components:
  7798. @example
  7799. lutrgb="g=0:b=0"
  7800. @end example
  7801. @item
  7802. Set a constant alpha channel value on input:
  7803. @example
  7804. format=rgba,lutrgb=a="maxval-minval/2"
  7805. @end example
  7806. @item
  7807. Correct luminance gamma by a factor of 0.5:
  7808. @example
  7809. lutyuv=y=gammaval(0.5)
  7810. @end example
  7811. @item
  7812. Discard least significant bits of luma:
  7813. @example
  7814. lutyuv=y='bitand(val, 128+64+32)'
  7815. @end example
  7816. @item
  7817. Technicolor like effect:
  7818. @example
  7819. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  7820. @end example
  7821. @end itemize
  7822. @section lut2, tlut2
  7823. The @code{lut2} filter takes two input streams and outputs one
  7824. stream.
  7825. The @code{tlut2} (time lut2) filter takes two consecutive frames
  7826. from one single stream.
  7827. This filter accepts the following parameters:
  7828. @table @option
  7829. @item c0
  7830. set first pixel component expression
  7831. @item c1
  7832. set second pixel component expression
  7833. @item c2
  7834. set third pixel component expression
  7835. @item c3
  7836. set fourth pixel component expression, corresponds to the alpha component
  7837. @end table
  7838. Each of them specifies the expression to use for computing the lookup table for
  7839. the corresponding pixel component values.
  7840. The exact component associated to each of the @var{c*} options depends on the
  7841. format in inputs.
  7842. The expressions can contain the following constants:
  7843. @table @option
  7844. @item w
  7845. @item h
  7846. The input width and height.
  7847. @item x
  7848. The first input value for the pixel component.
  7849. @item y
  7850. The second input value for the pixel component.
  7851. @item bdx
  7852. The first input video bit depth.
  7853. @item bdy
  7854. The second input video bit depth.
  7855. @end table
  7856. All expressions default to "x".
  7857. @subsection Examples
  7858. @itemize
  7859. @item
  7860. Highlight differences between two RGB video streams:
  7861. @example
  7862. 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)'
  7863. @end example
  7864. @item
  7865. Highlight differences between two YUV video streams:
  7866. @example
  7867. 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)'
  7868. @end example
  7869. @item
  7870. Show max difference between two video streams:
  7871. @example
  7872. 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)))'
  7873. @end example
  7874. @end itemize
  7875. @section maskedclamp
  7876. Clamp the first input stream with the second input and third input stream.
  7877. Returns the value of first stream to be between second input
  7878. stream - @code{undershoot} and third input stream + @code{overshoot}.
  7879. This filter accepts the following options:
  7880. @table @option
  7881. @item undershoot
  7882. Default value is @code{0}.
  7883. @item overshoot
  7884. Default value is @code{0}.
  7885. @item planes
  7886. Set which planes will be processed as bitmap, unprocessed planes will be
  7887. copied from first stream.
  7888. By default value 0xf, all planes will be processed.
  7889. @end table
  7890. @section maskedmerge
  7891. Merge the first input stream with the second input stream using per pixel
  7892. weights in the third input stream.
  7893. A value of 0 in the third stream pixel component means that pixel component
  7894. from first stream is returned unchanged, while maximum value (eg. 255 for
  7895. 8-bit videos) means that pixel component from second stream is returned
  7896. unchanged. Intermediate values define the amount of merging between both
  7897. input stream's pixel components.
  7898. This filter accepts the following options:
  7899. @table @option
  7900. @item planes
  7901. Set which planes will be processed as bitmap, unprocessed planes will be
  7902. copied from first stream.
  7903. By default value 0xf, all planes will be processed.
  7904. @end table
  7905. @section mcdeint
  7906. Apply motion-compensation deinterlacing.
  7907. It needs one field per frame as input and must thus be used together
  7908. with yadif=1/3 or equivalent.
  7909. This filter accepts the following options:
  7910. @table @option
  7911. @item mode
  7912. Set the deinterlacing mode.
  7913. It accepts one of the following values:
  7914. @table @samp
  7915. @item fast
  7916. @item medium
  7917. @item slow
  7918. use iterative motion estimation
  7919. @item extra_slow
  7920. like @samp{slow}, but use multiple reference frames.
  7921. @end table
  7922. Default value is @samp{fast}.
  7923. @item parity
  7924. Set the picture field parity assumed for the input video. It must be
  7925. one of the following values:
  7926. @table @samp
  7927. @item 0, tff
  7928. assume top field first
  7929. @item 1, bff
  7930. assume bottom field first
  7931. @end table
  7932. Default value is @samp{bff}.
  7933. @item qp
  7934. Set per-block quantization parameter (QP) used by the internal
  7935. encoder.
  7936. Higher values should result in a smoother motion vector field but less
  7937. optimal individual vectors. Default value is 1.
  7938. @end table
  7939. @section mergeplanes
  7940. Merge color channel components from several video streams.
  7941. The filter accepts up to 4 input streams, and merge selected input
  7942. planes to the output video.
  7943. This filter accepts the following options:
  7944. @table @option
  7945. @item mapping
  7946. Set input to output plane mapping. Default is @code{0}.
  7947. The mappings is specified as a bitmap. It should be specified as a
  7948. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  7949. mapping for the first plane of the output stream. 'A' sets the number of
  7950. the input stream to use (from 0 to 3), and 'a' the plane number of the
  7951. corresponding input to use (from 0 to 3). The rest of the mappings is
  7952. similar, 'Bb' describes the mapping for the output stream second
  7953. plane, 'Cc' describes the mapping for the output stream third plane and
  7954. 'Dd' describes the mapping for the output stream fourth plane.
  7955. @item format
  7956. Set output pixel format. Default is @code{yuva444p}.
  7957. @end table
  7958. @subsection Examples
  7959. @itemize
  7960. @item
  7961. Merge three gray video streams of same width and height into single video stream:
  7962. @example
  7963. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  7964. @end example
  7965. @item
  7966. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  7967. @example
  7968. [a0][a1]mergeplanes=0x00010210:yuva444p
  7969. @end example
  7970. @item
  7971. Swap Y and A plane in yuva444p stream:
  7972. @example
  7973. format=yuva444p,mergeplanes=0x03010200:yuva444p
  7974. @end example
  7975. @item
  7976. Swap U and V plane in yuv420p stream:
  7977. @example
  7978. format=yuv420p,mergeplanes=0x000201:yuv420p
  7979. @end example
  7980. @item
  7981. Cast a rgb24 clip to yuv444p:
  7982. @example
  7983. format=rgb24,mergeplanes=0x000102:yuv444p
  7984. @end example
  7985. @end itemize
  7986. @section mestimate
  7987. Estimate and export motion vectors using block matching algorithms.
  7988. Motion vectors are stored in frame side data to be used by other filters.
  7989. This filter accepts the following options:
  7990. @table @option
  7991. @item method
  7992. Specify the motion estimation method. Accepts one of the following values:
  7993. @table @samp
  7994. @item esa
  7995. Exhaustive search algorithm.
  7996. @item tss
  7997. Three step search algorithm.
  7998. @item tdls
  7999. Two dimensional logarithmic search algorithm.
  8000. @item ntss
  8001. New three step search algorithm.
  8002. @item fss
  8003. Four step search algorithm.
  8004. @item ds
  8005. Diamond search algorithm.
  8006. @item hexbs
  8007. Hexagon-based search algorithm.
  8008. @item epzs
  8009. Enhanced predictive zonal search algorithm.
  8010. @item umh
  8011. Uneven multi-hexagon search algorithm.
  8012. @end table
  8013. Default value is @samp{esa}.
  8014. @item mb_size
  8015. Macroblock size. Default @code{16}.
  8016. @item search_param
  8017. Search parameter. Default @code{7}.
  8018. @end table
  8019. @section midequalizer
  8020. Apply Midway Image Equalization effect using two video streams.
  8021. Midway Image Equalization adjusts a pair of images to have the same
  8022. histogram, while maintaining their dynamics as much as possible. It's
  8023. useful for e.g. matching exposures from a pair of stereo cameras.
  8024. This filter has two inputs and one output, which must be of same pixel format, but
  8025. may be of different sizes. The output of filter is first input adjusted with
  8026. midway histogram of both inputs.
  8027. This filter accepts the following option:
  8028. @table @option
  8029. @item planes
  8030. Set which planes to process. Default is @code{15}, which is all available planes.
  8031. @end table
  8032. @section minterpolate
  8033. Convert the video to specified frame rate using motion interpolation.
  8034. This filter accepts the following options:
  8035. @table @option
  8036. @item fps
  8037. 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}.
  8038. @item mi_mode
  8039. Motion interpolation mode. Following values are accepted:
  8040. @table @samp
  8041. @item dup
  8042. Duplicate previous or next frame for interpolating new ones.
  8043. @item blend
  8044. Blend source frames. Interpolated frame is mean of previous and next frames.
  8045. @item mci
  8046. Motion compensated interpolation. Following options are effective when this mode is selected:
  8047. @table @samp
  8048. @item mc_mode
  8049. Motion compensation mode. Following values are accepted:
  8050. @table @samp
  8051. @item obmc
  8052. Overlapped block motion compensation.
  8053. @item aobmc
  8054. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  8055. @end table
  8056. Default mode is @samp{obmc}.
  8057. @item me_mode
  8058. Motion estimation mode. Following values are accepted:
  8059. @table @samp
  8060. @item bidir
  8061. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  8062. @item bilat
  8063. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  8064. @end table
  8065. Default mode is @samp{bilat}.
  8066. @item me
  8067. The algorithm to be used for motion estimation. Following values are accepted:
  8068. @table @samp
  8069. @item esa
  8070. Exhaustive search algorithm.
  8071. @item tss
  8072. Three step search algorithm.
  8073. @item tdls
  8074. Two dimensional logarithmic search algorithm.
  8075. @item ntss
  8076. New three step search algorithm.
  8077. @item fss
  8078. Four step search algorithm.
  8079. @item ds
  8080. Diamond search algorithm.
  8081. @item hexbs
  8082. Hexagon-based search algorithm.
  8083. @item epzs
  8084. Enhanced predictive zonal search algorithm.
  8085. @item umh
  8086. Uneven multi-hexagon search algorithm.
  8087. @end table
  8088. Default algorithm is @samp{epzs}.
  8089. @item mb_size
  8090. Macroblock size. Default @code{16}.
  8091. @item search_param
  8092. Motion estimation search parameter. Default @code{32}.
  8093. @item vsbmc
  8094. 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).
  8095. @end table
  8096. @end table
  8097. @item scd
  8098. 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:
  8099. @table @samp
  8100. @item none
  8101. Disable scene change detection.
  8102. @item fdiff
  8103. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  8104. @end table
  8105. Default method is @samp{fdiff}.
  8106. @item scd_threshold
  8107. Scene change detection threshold. Default is @code{5.0}.
  8108. @end table
  8109. @section mpdecimate
  8110. Drop frames that do not differ greatly from the previous frame in
  8111. order to reduce frame rate.
  8112. The main use of this filter is for very-low-bitrate encoding
  8113. (e.g. streaming over dialup modem), but it could in theory be used for
  8114. fixing movies that were inverse-telecined incorrectly.
  8115. A description of the accepted options follows.
  8116. @table @option
  8117. @item max
  8118. Set the maximum number of consecutive frames which can be dropped (if
  8119. positive), or the minimum interval between dropped frames (if
  8120. negative). If the value is 0, the frame is dropped disregarding the
  8121. number of previous sequentially dropped frames.
  8122. Default value is 0.
  8123. @item hi
  8124. @item lo
  8125. @item frac
  8126. Set the dropping threshold values.
  8127. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  8128. represent actual pixel value differences, so a threshold of 64
  8129. corresponds to 1 unit of difference for each pixel, or the same spread
  8130. out differently over the block.
  8131. A frame is a candidate for dropping if no 8x8 blocks differ by more
  8132. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  8133. meaning the whole image) differ by more than a threshold of @option{lo}.
  8134. Default value for @option{hi} is 64*12, default value for @option{lo} is
  8135. 64*5, and default value for @option{frac} is 0.33.
  8136. @end table
  8137. @section negate
  8138. Negate input video.
  8139. It accepts an integer in input; if non-zero it negates the
  8140. alpha component (if available). The default value in input is 0.
  8141. @section nlmeans
  8142. Denoise frames using Non-Local Means algorithm.
  8143. Each pixel is adjusted by looking for other pixels with similar contexts. This
  8144. context similarity is defined by comparing their surrounding patches of size
  8145. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  8146. around the pixel.
  8147. Note that the research area defines centers for patches, which means some
  8148. patches will be made of pixels outside that research area.
  8149. The filter accepts the following options.
  8150. @table @option
  8151. @item s
  8152. Set denoising strength.
  8153. @item p
  8154. Set patch size.
  8155. @item pc
  8156. Same as @option{p} but for chroma planes.
  8157. The default value is @var{0} and means automatic.
  8158. @item r
  8159. Set research size.
  8160. @item rc
  8161. Same as @option{r} but for chroma planes.
  8162. The default value is @var{0} and means automatic.
  8163. @end table
  8164. @section nnedi
  8165. Deinterlace video using neural network edge directed interpolation.
  8166. This filter accepts the following options:
  8167. @table @option
  8168. @item weights
  8169. Mandatory option, without binary file filter can not work.
  8170. Currently file can be found here:
  8171. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  8172. @item deint
  8173. Set which frames to deinterlace, by default it is @code{all}.
  8174. Can be @code{all} or @code{interlaced}.
  8175. @item field
  8176. Set mode of operation.
  8177. Can be one of the following:
  8178. @table @samp
  8179. @item af
  8180. Use frame flags, both fields.
  8181. @item a
  8182. Use frame flags, single field.
  8183. @item t
  8184. Use top field only.
  8185. @item b
  8186. Use bottom field only.
  8187. @item tf
  8188. Use both fields, top first.
  8189. @item bf
  8190. Use both fields, bottom first.
  8191. @end table
  8192. @item planes
  8193. Set which planes to process, by default filter process all frames.
  8194. @item nsize
  8195. Set size of local neighborhood around each pixel, used by the predictor neural
  8196. network.
  8197. Can be one of the following:
  8198. @table @samp
  8199. @item s8x6
  8200. @item s16x6
  8201. @item s32x6
  8202. @item s48x6
  8203. @item s8x4
  8204. @item s16x4
  8205. @item s32x4
  8206. @end table
  8207. @item nns
  8208. Set the number of neurons in predictor neural network.
  8209. Can be one of the following:
  8210. @table @samp
  8211. @item n16
  8212. @item n32
  8213. @item n64
  8214. @item n128
  8215. @item n256
  8216. @end table
  8217. @item qual
  8218. Controls the number of different neural network predictions that are blended
  8219. together to compute the final output value. Can be @code{fast}, default or
  8220. @code{slow}.
  8221. @item etype
  8222. Set which set of weights to use in the predictor.
  8223. Can be one of the following:
  8224. @table @samp
  8225. @item a
  8226. weights trained to minimize absolute error
  8227. @item s
  8228. weights trained to minimize squared error
  8229. @end table
  8230. @item pscrn
  8231. Controls whether or not the prescreener neural network is used to decide
  8232. which pixels should be processed by the predictor neural network and which
  8233. can be handled by simple cubic interpolation.
  8234. The prescreener is trained to know whether cubic interpolation will be
  8235. sufficient for a pixel or whether it should be predicted by the predictor nn.
  8236. The computational complexity of the prescreener nn is much less than that of
  8237. the predictor nn. Since most pixels can be handled by cubic interpolation,
  8238. using the prescreener generally results in much faster processing.
  8239. The prescreener is pretty accurate, so the difference between using it and not
  8240. using it is almost always unnoticeable.
  8241. Can be one of the following:
  8242. @table @samp
  8243. @item none
  8244. @item original
  8245. @item new
  8246. @end table
  8247. Default is @code{new}.
  8248. @item fapprox
  8249. Set various debugging flags.
  8250. @end table
  8251. @section noformat
  8252. Force libavfilter not to use any of the specified pixel formats for the
  8253. input to the next filter.
  8254. It accepts the following parameters:
  8255. @table @option
  8256. @item pix_fmts
  8257. A '|'-separated list of pixel format names, such as
  8258. pix_fmts=yuv420p|monow|rgb24".
  8259. @end table
  8260. @subsection Examples
  8261. @itemize
  8262. @item
  8263. Force libavfilter to use a format different from @var{yuv420p} for the
  8264. input to the vflip filter:
  8265. @example
  8266. noformat=pix_fmts=yuv420p,vflip
  8267. @end example
  8268. @item
  8269. Convert the input video to any of the formats not contained in the list:
  8270. @example
  8271. noformat=yuv420p|yuv444p|yuv410p
  8272. @end example
  8273. @end itemize
  8274. @section noise
  8275. Add noise on video input frame.
  8276. The filter accepts the following options:
  8277. @table @option
  8278. @item all_seed
  8279. @item c0_seed
  8280. @item c1_seed
  8281. @item c2_seed
  8282. @item c3_seed
  8283. Set noise seed for specific pixel component or all pixel components in case
  8284. of @var{all_seed}. Default value is @code{123457}.
  8285. @item all_strength, alls
  8286. @item c0_strength, c0s
  8287. @item c1_strength, c1s
  8288. @item c2_strength, c2s
  8289. @item c3_strength, c3s
  8290. Set noise strength for specific pixel component or all pixel components in case
  8291. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  8292. @item all_flags, allf
  8293. @item c0_flags, c0f
  8294. @item c1_flags, c1f
  8295. @item c2_flags, c2f
  8296. @item c3_flags, c3f
  8297. Set pixel component flags or set flags for all components if @var{all_flags}.
  8298. Available values for component flags are:
  8299. @table @samp
  8300. @item a
  8301. averaged temporal noise (smoother)
  8302. @item p
  8303. mix random noise with a (semi)regular pattern
  8304. @item t
  8305. temporal noise (noise pattern changes between frames)
  8306. @item u
  8307. uniform noise (gaussian otherwise)
  8308. @end table
  8309. @end table
  8310. @subsection Examples
  8311. Add temporal and uniform noise to input video:
  8312. @example
  8313. noise=alls=20:allf=t+u
  8314. @end example
  8315. @section null
  8316. Pass the video source unchanged to the output.
  8317. @section ocr
  8318. Optical Character Recognition
  8319. This filter uses Tesseract for optical character recognition.
  8320. It accepts the following options:
  8321. @table @option
  8322. @item datapath
  8323. Set datapath to tesseract data. Default is to use whatever was
  8324. set at installation.
  8325. @item language
  8326. Set language, default is "eng".
  8327. @item whitelist
  8328. Set character whitelist.
  8329. @item blacklist
  8330. Set character blacklist.
  8331. @end table
  8332. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  8333. @section ocv
  8334. Apply a video transform using libopencv.
  8335. To enable this filter, install the libopencv library and headers and
  8336. configure FFmpeg with @code{--enable-libopencv}.
  8337. It accepts the following parameters:
  8338. @table @option
  8339. @item filter_name
  8340. The name of the libopencv filter to apply.
  8341. @item filter_params
  8342. The parameters to pass to the libopencv filter. If not specified, the default
  8343. values are assumed.
  8344. @end table
  8345. Refer to the official libopencv documentation for more precise
  8346. information:
  8347. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  8348. Several libopencv filters are supported; see the following subsections.
  8349. @anchor{dilate}
  8350. @subsection dilate
  8351. Dilate an image by using a specific structuring element.
  8352. It corresponds to the libopencv function @code{cvDilate}.
  8353. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  8354. @var{struct_el} represents a structuring element, and has the syntax:
  8355. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  8356. @var{cols} and @var{rows} represent the number of columns and rows of
  8357. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  8358. point, and @var{shape} the shape for the structuring element. @var{shape}
  8359. must be "rect", "cross", "ellipse", or "custom".
  8360. If the value for @var{shape} is "custom", it must be followed by a
  8361. string of the form "=@var{filename}". The file with name
  8362. @var{filename} is assumed to represent a binary image, with each
  8363. printable character corresponding to a bright pixel. When a custom
  8364. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  8365. or columns and rows of the read file are assumed instead.
  8366. The default value for @var{struct_el} is "3x3+0x0/rect".
  8367. @var{nb_iterations} specifies the number of times the transform is
  8368. applied to the image, and defaults to 1.
  8369. Some examples:
  8370. @example
  8371. # Use the default values
  8372. ocv=dilate
  8373. # Dilate using a structuring element with a 5x5 cross, iterating two times
  8374. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  8375. # Read the shape from the file diamond.shape, iterating two times.
  8376. # The file diamond.shape may contain a pattern of characters like this
  8377. # *
  8378. # ***
  8379. # *****
  8380. # ***
  8381. # *
  8382. # The specified columns and rows are ignored
  8383. # but the anchor point coordinates are not
  8384. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  8385. @end example
  8386. @subsection erode
  8387. Erode an image by using a specific structuring element.
  8388. It corresponds to the libopencv function @code{cvErode}.
  8389. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  8390. with the same syntax and semantics as the @ref{dilate} filter.
  8391. @subsection smooth
  8392. Smooth the input video.
  8393. The filter takes the following parameters:
  8394. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  8395. @var{type} is the type of smooth filter to apply, and must be one of
  8396. the following values: "blur", "blur_no_scale", "median", "gaussian",
  8397. or "bilateral". The default value is "gaussian".
  8398. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  8399. depend on the smooth type. @var{param1} and
  8400. @var{param2} accept integer positive values or 0. @var{param3} and
  8401. @var{param4} accept floating point values.
  8402. The default value for @var{param1} is 3. The default value for the
  8403. other parameters is 0.
  8404. These parameters correspond to the parameters assigned to the
  8405. libopencv function @code{cvSmooth}.
  8406. @section oscilloscope
  8407. 2D Video Oscilloscope.
  8408. Useful to measure spatial impulse, step responses, chroma delays, etc.
  8409. It accepts the following parameters:
  8410. @table @option
  8411. @item x
  8412. Set scope center x position.
  8413. @item y
  8414. Set scope center y position.
  8415. @item s
  8416. Set scope size, relative to frame diagonal.
  8417. @item t
  8418. Set scope tilt/rotation.
  8419. @item o
  8420. Set trace opacity.
  8421. @item tx
  8422. Set trace center x position.
  8423. @item ty
  8424. Set trace center y position.
  8425. @item tw
  8426. Set trace width, relative to width of frame.
  8427. @item th
  8428. Set trace height, relative to height of frame.
  8429. @item c
  8430. Set which components to trace. By default it traces first three components.
  8431. @item g
  8432. Draw trace grid. By default is enabled.
  8433. @item st
  8434. Draw some statistics. By default is enabled.
  8435. @item sc
  8436. Draw scope. By default is enabled.
  8437. @end table
  8438. @subsection Examples
  8439. @itemize
  8440. @item
  8441. Inspect full first row of video frame.
  8442. @example
  8443. oscilloscope=x=0.5:y=0:s=1
  8444. @end example
  8445. @item
  8446. Inspect full last row of video frame.
  8447. @example
  8448. oscilloscope=x=0.5:y=1:s=1
  8449. @end example
  8450. @item
  8451. Inspect full 5th line of video frame of height 1080.
  8452. @example
  8453. oscilloscope=x=0.5:y=5/1080:s=1
  8454. @end example
  8455. @item
  8456. Inspect full last column of video frame.
  8457. @example
  8458. oscilloscope=x=1:y=0.5:s=1:t=1
  8459. @end example
  8460. @end itemize
  8461. @anchor{overlay}
  8462. @section overlay
  8463. Overlay one video on top of another.
  8464. It takes two inputs and has one output. The first input is the "main"
  8465. video on which the second input is overlaid.
  8466. It accepts the following parameters:
  8467. A description of the accepted options follows.
  8468. @table @option
  8469. @item x
  8470. @item y
  8471. Set the expression for the x and y coordinates of the overlaid video
  8472. on the main video. Default value is "0" for both expressions. In case
  8473. the expression is invalid, it is set to a huge value (meaning that the
  8474. overlay will not be displayed within the output visible area).
  8475. @item eof_action
  8476. See @ref{framesync}.
  8477. @item eval
  8478. Set when the expressions for @option{x}, and @option{y} are evaluated.
  8479. It accepts the following values:
  8480. @table @samp
  8481. @item init
  8482. only evaluate expressions once during the filter initialization or
  8483. when a command is processed
  8484. @item frame
  8485. evaluate expressions for each incoming frame
  8486. @end table
  8487. Default value is @samp{frame}.
  8488. @item shortest
  8489. See @ref{framesync}.
  8490. @item format
  8491. Set the format for the output video.
  8492. It accepts the following values:
  8493. @table @samp
  8494. @item yuv420
  8495. force YUV420 output
  8496. @item yuv422
  8497. force YUV422 output
  8498. @item yuv444
  8499. force YUV444 output
  8500. @item rgb
  8501. force packed RGB output
  8502. @item gbrp
  8503. force planar RGB output
  8504. @item auto
  8505. automatically pick format
  8506. @end table
  8507. Default value is @samp{yuv420}.
  8508. @item repeatlast
  8509. See @ref{framesync}.
  8510. @end table
  8511. The @option{x}, and @option{y} expressions can contain the following
  8512. parameters.
  8513. @table @option
  8514. @item main_w, W
  8515. @item main_h, H
  8516. The main input width and height.
  8517. @item overlay_w, w
  8518. @item overlay_h, h
  8519. The overlay input width and height.
  8520. @item x
  8521. @item y
  8522. The computed values for @var{x} and @var{y}. They are evaluated for
  8523. each new frame.
  8524. @item hsub
  8525. @item vsub
  8526. horizontal and vertical chroma subsample values of the output
  8527. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  8528. @var{vsub} is 1.
  8529. @item n
  8530. the number of input frame, starting from 0
  8531. @item pos
  8532. the position in the file of the input frame, NAN if unknown
  8533. @item t
  8534. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  8535. @end table
  8536. This filter also supports the @ref{framesync} options.
  8537. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  8538. when evaluation is done @emph{per frame}, and will evaluate to NAN
  8539. when @option{eval} is set to @samp{init}.
  8540. Be aware that frames are taken from each input video in timestamp
  8541. order, hence, if their initial timestamps differ, it is a good idea
  8542. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  8543. have them begin in the same zero timestamp, as the example for
  8544. the @var{movie} filter does.
  8545. You can chain together more overlays but you should test the
  8546. efficiency of such approach.
  8547. @subsection Commands
  8548. This filter supports the following commands:
  8549. @table @option
  8550. @item x
  8551. @item y
  8552. Modify the x and y of the overlay input.
  8553. The command accepts the same syntax of the corresponding option.
  8554. If the specified expression is not valid, it is kept at its current
  8555. value.
  8556. @end table
  8557. @subsection Examples
  8558. @itemize
  8559. @item
  8560. Draw the overlay at 10 pixels from the bottom right corner of the main
  8561. video:
  8562. @example
  8563. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  8564. @end example
  8565. Using named options the example above becomes:
  8566. @example
  8567. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  8568. @end example
  8569. @item
  8570. Insert a transparent PNG logo in the bottom left corner of the input,
  8571. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  8572. @example
  8573. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  8574. @end example
  8575. @item
  8576. Insert 2 different transparent PNG logos (second logo on bottom
  8577. right corner) using the @command{ffmpeg} tool:
  8578. @example
  8579. 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
  8580. @end example
  8581. @item
  8582. Add a transparent color layer on top of the main video; @code{WxH}
  8583. must specify the size of the main input to the overlay filter:
  8584. @example
  8585. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  8586. @end example
  8587. @item
  8588. Play an original video and a filtered version (here with the deshake
  8589. filter) side by side using the @command{ffplay} tool:
  8590. @example
  8591. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  8592. @end example
  8593. The above command is the same as:
  8594. @example
  8595. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  8596. @end example
  8597. @item
  8598. Make a sliding overlay appearing from the left to the right top part of the
  8599. screen starting since time 2:
  8600. @example
  8601. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  8602. @end example
  8603. @item
  8604. Compose output by putting two input videos side to side:
  8605. @example
  8606. ffmpeg -i left.avi -i right.avi -filter_complex "
  8607. nullsrc=size=200x100 [background];
  8608. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  8609. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  8610. [background][left] overlay=shortest=1 [background+left];
  8611. [background+left][right] overlay=shortest=1:x=100 [left+right]
  8612. "
  8613. @end example
  8614. @item
  8615. Mask 10-20 seconds of a video by applying the delogo filter to a section
  8616. @example
  8617. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  8618. -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]'
  8619. masked.avi
  8620. @end example
  8621. @item
  8622. Chain several overlays in cascade:
  8623. @example
  8624. nullsrc=s=200x200 [bg];
  8625. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  8626. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  8627. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  8628. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  8629. [in3] null, [mid2] overlay=100:100 [out0]
  8630. @end example
  8631. @end itemize
  8632. @section owdenoise
  8633. Apply Overcomplete Wavelet denoiser.
  8634. The filter accepts the following options:
  8635. @table @option
  8636. @item depth
  8637. Set depth.
  8638. Larger depth values will denoise lower frequency components more, but
  8639. slow down filtering.
  8640. Must be an int in the range 8-16, default is @code{8}.
  8641. @item luma_strength, ls
  8642. Set luma strength.
  8643. Must be a double value in the range 0-1000, default is @code{1.0}.
  8644. @item chroma_strength, cs
  8645. Set chroma strength.
  8646. Must be a double value in the range 0-1000, default is @code{1.0}.
  8647. @end table
  8648. @anchor{pad}
  8649. @section pad
  8650. Add paddings to the input image, and place the original input at the
  8651. provided @var{x}, @var{y} coordinates.
  8652. It accepts the following parameters:
  8653. @table @option
  8654. @item width, w
  8655. @item height, h
  8656. Specify an expression for the size of the output image with the
  8657. paddings added. If the value for @var{width} or @var{height} is 0, the
  8658. corresponding input size is used for the output.
  8659. The @var{width} expression can reference the value set by the
  8660. @var{height} expression, and vice versa.
  8661. The default value of @var{width} and @var{height} is 0.
  8662. @item x
  8663. @item y
  8664. Specify the offsets to place the input image at within the padded area,
  8665. with respect to the top/left border of the output image.
  8666. The @var{x} expression can reference the value set by the @var{y}
  8667. expression, and vice versa.
  8668. The default value of @var{x} and @var{y} is 0.
  8669. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  8670. so the input image is centered on the padded area.
  8671. @item color
  8672. Specify the color of the padded area. For the syntax of this option,
  8673. check the "Color" section in the ffmpeg-utils manual.
  8674. The default value of @var{color} is "black".
  8675. @item eval
  8676. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  8677. It accepts the following values:
  8678. @table @samp
  8679. @item init
  8680. Only evaluate expressions once during the filter initialization or when
  8681. a command is processed.
  8682. @item frame
  8683. Evaluate expressions for each incoming frame.
  8684. @end table
  8685. Default value is @samp{init}.
  8686. @item aspect
  8687. Pad to aspect instead to a resolution.
  8688. @end table
  8689. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  8690. options are expressions containing the following constants:
  8691. @table @option
  8692. @item in_w
  8693. @item in_h
  8694. The input video width and height.
  8695. @item iw
  8696. @item ih
  8697. These are the same as @var{in_w} and @var{in_h}.
  8698. @item out_w
  8699. @item out_h
  8700. The output width and height (the size of the padded area), as
  8701. specified by the @var{width} and @var{height} expressions.
  8702. @item ow
  8703. @item oh
  8704. These are the same as @var{out_w} and @var{out_h}.
  8705. @item x
  8706. @item y
  8707. The x and y offsets as specified by the @var{x} and @var{y}
  8708. expressions, or NAN if not yet specified.
  8709. @item a
  8710. same as @var{iw} / @var{ih}
  8711. @item sar
  8712. input sample aspect ratio
  8713. @item dar
  8714. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  8715. @item hsub
  8716. @item vsub
  8717. The horizontal and vertical chroma subsample values. For example for the
  8718. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8719. @end table
  8720. @subsection Examples
  8721. @itemize
  8722. @item
  8723. Add paddings with the color "violet" to the input video. The output video
  8724. size is 640x480, and the top-left corner of the input video is placed at
  8725. column 0, row 40
  8726. @example
  8727. pad=640:480:0:40:violet
  8728. @end example
  8729. The example above is equivalent to the following command:
  8730. @example
  8731. pad=width=640:height=480:x=0:y=40:color=violet
  8732. @end example
  8733. @item
  8734. Pad the input to get an output with dimensions increased by 3/2,
  8735. and put the input video at the center of the padded area:
  8736. @example
  8737. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  8738. @end example
  8739. @item
  8740. Pad the input to get a squared output with size equal to the maximum
  8741. value between the input width and height, and put the input video at
  8742. the center of the padded area:
  8743. @example
  8744. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  8745. @end example
  8746. @item
  8747. Pad the input to get a final w/h ratio of 16:9:
  8748. @example
  8749. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  8750. @end example
  8751. @item
  8752. In case of anamorphic video, in order to set the output display aspect
  8753. correctly, it is necessary to use @var{sar} in the expression,
  8754. according to the relation:
  8755. @example
  8756. (ih * X / ih) * sar = output_dar
  8757. X = output_dar / sar
  8758. @end example
  8759. Thus the previous example needs to be modified to:
  8760. @example
  8761. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  8762. @end example
  8763. @item
  8764. Double the output size and put the input video in the bottom-right
  8765. corner of the output padded area:
  8766. @example
  8767. pad="2*iw:2*ih:ow-iw:oh-ih"
  8768. @end example
  8769. @end itemize
  8770. @anchor{palettegen}
  8771. @section palettegen
  8772. Generate one palette for a whole video stream.
  8773. It accepts the following options:
  8774. @table @option
  8775. @item max_colors
  8776. Set the maximum number of colors to quantize in the palette.
  8777. Note: the palette will still contain 256 colors; the unused palette entries
  8778. will be black.
  8779. @item reserve_transparent
  8780. Create a palette of 255 colors maximum and reserve the last one for
  8781. transparency. Reserving the transparency color is useful for GIF optimization.
  8782. If not set, the maximum of colors in the palette will be 256. You probably want
  8783. to disable this option for a standalone image.
  8784. Set by default.
  8785. @item transparency_color
  8786. Set the color that will be used as background for transparency.
  8787. @item stats_mode
  8788. Set statistics mode.
  8789. It accepts the following values:
  8790. @table @samp
  8791. @item full
  8792. Compute full frame histograms.
  8793. @item diff
  8794. Compute histograms only for the part that differs from previous frame. This
  8795. might be relevant to give more importance to the moving part of your input if
  8796. the background is static.
  8797. @item single
  8798. Compute new histogram for each frame.
  8799. @end table
  8800. Default value is @var{full}.
  8801. @end table
  8802. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  8803. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  8804. color quantization of the palette. This information is also visible at
  8805. @var{info} logging level.
  8806. @subsection Examples
  8807. @itemize
  8808. @item
  8809. Generate a representative palette of a given video using @command{ffmpeg}:
  8810. @example
  8811. ffmpeg -i input.mkv -vf palettegen palette.png
  8812. @end example
  8813. @end itemize
  8814. @section paletteuse
  8815. Use a palette to downsample an input video stream.
  8816. The filter takes two inputs: one video stream and a palette. The palette must
  8817. be a 256 pixels image.
  8818. It accepts the following options:
  8819. @table @option
  8820. @item dither
  8821. Select dithering mode. Available algorithms are:
  8822. @table @samp
  8823. @item bayer
  8824. Ordered 8x8 bayer dithering (deterministic)
  8825. @item heckbert
  8826. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  8827. Note: this dithering is sometimes considered "wrong" and is included as a
  8828. reference.
  8829. @item floyd_steinberg
  8830. Floyd and Steingberg dithering (error diffusion)
  8831. @item sierra2
  8832. Frankie Sierra dithering v2 (error diffusion)
  8833. @item sierra2_4a
  8834. Frankie Sierra dithering v2 "Lite" (error diffusion)
  8835. @end table
  8836. Default is @var{sierra2_4a}.
  8837. @item bayer_scale
  8838. When @var{bayer} dithering is selected, this option defines the scale of the
  8839. pattern (how much the crosshatch pattern is visible). A low value means more
  8840. visible pattern for less banding, and higher value means less visible pattern
  8841. at the cost of more banding.
  8842. The option must be an integer value in the range [0,5]. Default is @var{2}.
  8843. @item diff_mode
  8844. If set, define the zone to process
  8845. @table @samp
  8846. @item rectangle
  8847. Only the changing rectangle will be reprocessed. This is similar to GIF
  8848. cropping/offsetting compression mechanism. This option can be useful for speed
  8849. if only a part of the image is changing, and has use cases such as limiting the
  8850. scope of the error diffusal @option{dither} to the rectangle that bounds the
  8851. moving scene (it leads to more deterministic output if the scene doesn't change
  8852. much, and as a result less moving noise and better GIF compression).
  8853. @end table
  8854. Default is @var{none}.
  8855. @item new
  8856. Take new palette for each output frame.
  8857. @item alpha_threshold
  8858. Sets the alpha threshold for transparency. Alpha values above this threshold
  8859. will be treated as completely opaque, and values below this threshold will be
  8860. treated as completely transparent.
  8861. The option must be an integer value in the range [0,255]. Default is @var{128}.
  8862. @end table
  8863. @subsection Examples
  8864. @itemize
  8865. @item
  8866. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  8867. using @command{ffmpeg}:
  8868. @example
  8869. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  8870. @end example
  8871. @end itemize
  8872. @section perspective
  8873. Correct perspective of video not recorded perpendicular to the screen.
  8874. A description of the accepted parameters follows.
  8875. @table @option
  8876. @item x0
  8877. @item y0
  8878. @item x1
  8879. @item y1
  8880. @item x2
  8881. @item y2
  8882. @item x3
  8883. @item y3
  8884. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  8885. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  8886. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  8887. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  8888. then the corners of the source will be sent to the specified coordinates.
  8889. The expressions can use the following variables:
  8890. @table @option
  8891. @item W
  8892. @item H
  8893. the width and height of video frame.
  8894. @item in
  8895. Input frame count.
  8896. @item on
  8897. Output frame count.
  8898. @end table
  8899. @item interpolation
  8900. Set interpolation for perspective correction.
  8901. It accepts the following values:
  8902. @table @samp
  8903. @item linear
  8904. @item cubic
  8905. @end table
  8906. Default value is @samp{linear}.
  8907. @item sense
  8908. Set interpretation of coordinate options.
  8909. It accepts the following values:
  8910. @table @samp
  8911. @item 0, source
  8912. Send point in the source specified by the given coordinates to
  8913. the corners of the destination.
  8914. @item 1, destination
  8915. Send the corners of the source to the point in the destination specified
  8916. by the given coordinates.
  8917. Default value is @samp{source}.
  8918. @end table
  8919. @item eval
  8920. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  8921. It accepts the following values:
  8922. @table @samp
  8923. @item init
  8924. only evaluate expressions once during the filter initialization or
  8925. when a command is processed
  8926. @item frame
  8927. evaluate expressions for each incoming frame
  8928. @end table
  8929. Default value is @samp{init}.
  8930. @end table
  8931. @section phase
  8932. Delay interlaced video by one field time so that the field order changes.
  8933. The intended use is to fix PAL movies that have been captured with the
  8934. opposite field order to the film-to-video transfer.
  8935. A description of the accepted parameters follows.
  8936. @table @option
  8937. @item mode
  8938. Set phase mode.
  8939. It accepts the following values:
  8940. @table @samp
  8941. @item t
  8942. Capture field order top-first, transfer bottom-first.
  8943. Filter will delay the bottom field.
  8944. @item b
  8945. Capture field order bottom-first, transfer top-first.
  8946. Filter will delay the top field.
  8947. @item p
  8948. Capture and transfer with the same field order. This mode only exists
  8949. for the documentation of the other options to refer to, but if you
  8950. actually select it, the filter will faithfully do nothing.
  8951. @item a
  8952. Capture field order determined automatically by field flags, transfer
  8953. opposite.
  8954. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  8955. basis using field flags. If no field information is available,
  8956. then this works just like @samp{u}.
  8957. @item u
  8958. Capture unknown or varying, transfer opposite.
  8959. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  8960. analyzing the images and selecting the alternative that produces best
  8961. match between the fields.
  8962. @item T
  8963. Capture top-first, transfer unknown or varying.
  8964. Filter selects among @samp{t} and @samp{p} using image analysis.
  8965. @item B
  8966. Capture bottom-first, transfer unknown or varying.
  8967. Filter selects among @samp{b} and @samp{p} using image analysis.
  8968. @item A
  8969. Capture determined by field flags, transfer unknown or varying.
  8970. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  8971. image analysis. If no field information is available, then this works just
  8972. like @samp{U}. This is the default mode.
  8973. @item U
  8974. Both capture and transfer unknown or varying.
  8975. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  8976. @end table
  8977. @end table
  8978. @section pixdesctest
  8979. Pixel format descriptor test filter, mainly useful for internal
  8980. testing. The output video should be equal to the input video.
  8981. For example:
  8982. @example
  8983. format=monow, pixdesctest
  8984. @end example
  8985. can be used to test the monowhite pixel format descriptor definition.
  8986. @section pixscope
  8987. Display sample values of color channels. Mainly useful for checking color
  8988. and levels. Minimum supported resolution is 640x480.
  8989. The filters accept the following options:
  8990. @table @option
  8991. @item x
  8992. Set scope X position, relative offset on X axis.
  8993. @item y
  8994. Set scope Y position, relative offset on Y axis.
  8995. @item w
  8996. Set scope width.
  8997. @item h
  8998. Set scope height.
  8999. @item o
  9000. Set window opacity. This window also holds statistics about pixel area.
  9001. @item wx
  9002. Set window X position, relative offset on X axis.
  9003. @item wy
  9004. Set window Y position, relative offset on Y axis.
  9005. @end table
  9006. @section pp
  9007. Enable the specified chain of postprocessing subfilters using libpostproc. This
  9008. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  9009. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  9010. Each subfilter and some options have a short and a long name that can be used
  9011. interchangeably, i.e. dr/dering are the same.
  9012. The filters accept the following options:
  9013. @table @option
  9014. @item subfilters
  9015. Set postprocessing subfilters string.
  9016. @end table
  9017. All subfilters share common options to determine their scope:
  9018. @table @option
  9019. @item a/autoq
  9020. Honor the quality commands for this subfilter.
  9021. @item c/chrom
  9022. Do chrominance filtering, too (default).
  9023. @item y/nochrom
  9024. Do luminance filtering only (no chrominance).
  9025. @item n/noluma
  9026. Do chrominance filtering only (no luminance).
  9027. @end table
  9028. These options can be appended after the subfilter name, separated by a '|'.
  9029. Available subfilters are:
  9030. @table @option
  9031. @item hb/hdeblock[|difference[|flatness]]
  9032. Horizontal deblocking filter
  9033. @table @option
  9034. @item difference
  9035. Difference factor where higher values mean more deblocking (default: @code{32}).
  9036. @item flatness
  9037. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9038. @end table
  9039. @item vb/vdeblock[|difference[|flatness]]
  9040. Vertical deblocking filter
  9041. @table @option
  9042. @item difference
  9043. Difference factor where higher values mean more deblocking (default: @code{32}).
  9044. @item flatness
  9045. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9046. @end table
  9047. @item ha/hadeblock[|difference[|flatness]]
  9048. Accurate horizontal deblocking filter
  9049. @table @option
  9050. @item difference
  9051. Difference factor where higher values mean more deblocking (default: @code{32}).
  9052. @item flatness
  9053. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9054. @end table
  9055. @item va/vadeblock[|difference[|flatness]]
  9056. Accurate vertical deblocking filter
  9057. @table @option
  9058. @item difference
  9059. Difference factor where higher values mean more deblocking (default: @code{32}).
  9060. @item flatness
  9061. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9062. @end table
  9063. @end table
  9064. The horizontal and vertical deblocking filters share the difference and
  9065. flatness values so you cannot set different horizontal and vertical
  9066. thresholds.
  9067. @table @option
  9068. @item h1/x1hdeblock
  9069. Experimental horizontal deblocking filter
  9070. @item v1/x1vdeblock
  9071. Experimental vertical deblocking filter
  9072. @item dr/dering
  9073. Deringing filter
  9074. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  9075. @table @option
  9076. @item threshold1
  9077. larger -> stronger filtering
  9078. @item threshold2
  9079. larger -> stronger filtering
  9080. @item threshold3
  9081. larger -> stronger filtering
  9082. @end table
  9083. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  9084. @table @option
  9085. @item f/fullyrange
  9086. Stretch luminance to @code{0-255}.
  9087. @end table
  9088. @item lb/linblenddeint
  9089. Linear blend deinterlacing filter that deinterlaces the given block by
  9090. filtering all lines with a @code{(1 2 1)} filter.
  9091. @item li/linipoldeint
  9092. Linear interpolating deinterlacing filter that deinterlaces the given block by
  9093. linearly interpolating every second line.
  9094. @item ci/cubicipoldeint
  9095. Cubic interpolating deinterlacing filter deinterlaces the given block by
  9096. cubically interpolating every second line.
  9097. @item md/mediandeint
  9098. Median deinterlacing filter that deinterlaces the given block by applying a
  9099. median filter to every second line.
  9100. @item fd/ffmpegdeint
  9101. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  9102. second line with a @code{(-1 4 2 4 -1)} filter.
  9103. @item l5/lowpass5
  9104. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  9105. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  9106. @item fq/forceQuant[|quantizer]
  9107. Overrides the quantizer table from the input with the constant quantizer you
  9108. specify.
  9109. @table @option
  9110. @item quantizer
  9111. Quantizer to use
  9112. @end table
  9113. @item de/default
  9114. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  9115. @item fa/fast
  9116. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  9117. @item ac
  9118. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  9119. @end table
  9120. @subsection Examples
  9121. @itemize
  9122. @item
  9123. Apply horizontal and vertical deblocking, deringing and automatic
  9124. brightness/contrast:
  9125. @example
  9126. pp=hb/vb/dr/al
  9127. @end example
  9128. @item
  9129. Apply default filters without brightness/contrast correction:
  9130. @example
  9131. pp=de/-al
  9132. @end example
  9133. @item
  9134. Apply default filters and temporal denoiser:
  9135. @example
  9136. pp=default/tmpnoise|1|2|3
  9137. @end example
  9138. @item
  9139. Apply deblocking on luminance only, and switch vertical deblocking on or off
  9140. automatically depending on available CPU time:
  9141. @example
  9142. pp=hb|y/vb|a
  9143. @end example
  9144. @end itemize
  9145. @section pp7
  9146. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  9147. similar to spp = 6 with 7 point DCT, where only the center sample is
  9148. used after IDCT.
  9149. The filter accepts the following options:
  9150. @table @option
  9151. @item qp
  9152. Force a constant quantization parameter. It accepts an integer in range
  9153. 0 to 63. If not set, the filter will use the QP from the video stream
  9154. (if available).
  9155. @item mode
  9156. Set thresholding mode. Available modes are:
  9157. @table @samp
  9158. @item hard
  9159. Set hard thresholding.
  9160. @item soft
  9161. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9162. @item medium
  9163. Set medium thresholding (good results, default).
  9164. @end table
  9165. @end table
  9166. @section premultiply
  9167. Apply alpha premultiply effect to input video stream using first plane
  9168. of second stream as alpha.
  9169. Both streams must have same dimensions and same pixel format.
  9170. The filter accepts the following option:
  9171. @table @option
  9172. @item planes
  9173. Set which planes will be processed, unprocessed planes will be copied.
  9174. By default value 0xf, all planes will be processed.
  9175. @item inplace
  9176. Do not require 2nd input for processing, instead use alpha plane from input stream.
  9177. @end table
  9178. @section prewitt
  9179. Apply prewitt operator to input video stream.
  9180. The filter accepts the following option:
  9181. @table @option
  9182. @item planes
  9183. Set which planes will be processed, unprocessed planes will be copied.
  9184. By default value 0xf, all planes will be processed.
  9185. @item scale
  9186. Set value which will be multiplied with filtered result.
  9187. @item delta
  9188. Set value which will be added to filtered result.
  9189. @end table
  9190. @section pseudocolor
  9191. Alter frame colors in video with pseudocolors.
  9192. This filter accept the following options:
  9193. @table @option
  9194. @item c0
  9195. set pixel first component expression
  9196. @item c1
  9197. set pixel second component expression
  9198. @item c2
  9199. set pixel third component expression
  9200. @item c3
  9201. set pixel fourth component expression, corresponds to the alpha component
  9202. @item i
  9203. set component to use as base for altering colors
  9204. @end table
  9205. Each of them specifies the expression to use for computing the lookup table for
  9206. the corresponding pixel component values.
  9207. The expressions can contain the following constants and functions:
  9208. @table @option
  9209. @item w
  9210. @item h
  9211. The input width and height.
  9212. @item val
  9213. The input value for the pixel component.
  9214. @item ymin, umin, vmin, amin
  9215. The minimum allowed component value.
  9216. @item ymax, umax, vmax, amax
  9217. The maximum allowed component value.
  9218. @end table
  9219. All expressions default to "val".
  9220. @subsection Examples
  9221. @itemize
  9222. @item
  9223. Change too high luma values to gradient:
  9224. @example
  9225. 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'"
  9226. @end example
  9227. @end itemize
  9228. @section psnr
  9229. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  9230. Ratio) between two input videos.
  9231. This filter takes in input two input videos, the first input is
  9232. considered the "main" source and is passed unchanged to the
  9233. output. The second input is used as a "reference" video for computing
  9234. the PSNR.
  9235. Both video inputs must have the same resolution and pixel format for
  9236. this filter to work correctly. Also it assumes that both inputs
  9237. have the same number of frames, which are compared one by one.
  9238. The obtained average PSNR is printed through the logging system.
  9239. The filter stores the accumulated MSE (mean squared error) of each
  9240. frame, and at the end of the processing it is averaged across all frames
  9241. equally, and the following formula is applied to obtain the PSNR:
  9242. @example
  9243. PSNR = 10*log10(MAX^2/MSE)
  9244. @end example
  9245. Where MAX is the average of the maximum values of each component of the
  9246. image.
  9247. The description of the accepted parameters follows.
  9248. @table @option
  9249. @item stats_file, f
  9250. If specified the filter will use the named file to save the PSNR of
  9251. each individual frame. When filename equals "-" the data is sent to
  9252. standard output.
  9253. @item stats_version
  9254. Specifies which version of the stats file format to use. Details of
  9255. each format are written below.
  9256. Default value is 1.
  9257. @item stats_add_max
  9258. Determines whether the max value is output to the stats log.
  9259. Default value is 0.
  9260. Requires stats_version >= 2. If this is set and stats_version < 2,
  9261. the filter will return an error.
  9262. @end table
  9263. This filter also supports the @ref{framesync} options.
  9264. The file printed if @var{stats_file} is selected, contains a sequence of
  9265. key/value pairs of the form @var{key}:@var{value} for each compared
  9266. couple of frames.
  9267. If a @var{stats_version} greater than 1 is specified, a header line precedes
  9268. the list of per-frame-pair stats, with key value pairs following the frame
  9269. format with the following parameters:
  9270. @table @option
  9271. @item psnr_log_version
  9272. The version of the log file format. Will match @var{stats_version}.
  9273. @item fields
  9274. A comma separated list of the per-frame-pair parameters included in
  9275. the log.
  9276. @end table
  9277. A description of each shown per-frame-pair parameter follows:
  9278. @table @option
  9279. @item n
  9280. sequential number of the input frame, starting from 1
  9281. @item mse_avg
  9282. Mean Square Error pixel-by-pixel average difference of the compared
  9283. frames, averaged over all the image components.
  9284. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  9285. Mean Square Error pixel-by-pixel average difference of the compared
  9286. frames for the component specified by the suffix.
  9287. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  9288. Peak Signal to Noise ratio of the compared frames for the component
  9289. specified by the suffix.
  9290. @item max_avg, max_y, max_u, max_v
  9291. Maximum allowed value for each channel, and average over all
  9292. channels.
  9293. @end table
  9294. For example:
  9295. @example
  9296. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9297. [main][ref] psnr="stats_file=stats.log" [out]
  9298. @end example
  9299. On this example the input file being processed is compared with the
  9300. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  9301. is stored in @file{stats.log}.
  9302. @anchor{pullup}
  9303. @section pullup
  9304. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  9305. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  9306. content.
  9307. The pullup filter is designed to take advantage of future context in making
  9308. its decisions. This filter is stateless in the sense that it does not lock
  9309. onto a pattern to follow, but it instead looks forward to the following
  9310. fields in order to identify matches and rebuild progressive frames.
  9311. To produce content with an even framerate, insert the fps filter after
  9312. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  9313. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  9314. The filter accepts the following options:
  9315. @table @option
  9316. @item jl
  9317. @item jr
  9318. @item jt
  9319. @item jb
  9320. These options set the amount of "junk" to ignore at the left, right, top, and
  9321. bottom of the image, respectively. Left and right are in units of 8 pixels,
  9322. while top and bottom are in units of 2 lines.
  9323. The default is 8 pixels on each side.
  9324. @item sb
  9325. Set the strict breaks. Setting this option to 1 will reduce the chances of
  9326. filter generating an occasional mismatched frame, but it may also cause an
  9327. excessive number of frames to be dropped during high motion sequences.
  9328. Conversely, setting it to -1 will make filter match fields more easily.
  9329. This may help processing of video where there is slight blurring between
  9330. the fields, but may also cause there to be interlaced frames in the output.
  9331. Default value is @code{0}.
  9332. @item mp
  9333. Set the metric plane to use. It accepts the following values:
  9334. @table @samp
  9335. @item l
  9336. Use luma plane.
  9337. @item u
  9338. Use chroma blue plane.
  9339. @item v
  9340. Use chroma red plane.
  9341. @end table
  9342. This option may be set to use chroma plane instead of the default luma plane
  9343. for doing filter's computations. This may improve accuracy on very clean
  9344. source material, but more likely will decrease accuracy, especially if there
  9345. is chroma noise (rainbow effect) or any grayscale video.
  9346. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  9347. load and make pullup usable in realtime on slow machines.
  9348. @end table
  9349. For best results (without duplicated frames in the output file) it is
  9350. necessary to change the output frame rate. For example, to inverse
  9351. telecine NTSC input:
  9352. @example
  9353. ffmpeg -i input -vf pullup -r 24000/1001 ...
  9354. @end example
  9355. @section qp
  9356. Change video quantization parameters (QP).
  9357. The filter accepts the following option:
  9358. @table @option
  9359. @item qp
  9360. Set expression for quantization parameter.
  9361. @end table
  9362. The expression is evaluated through the eval API and can contain, among others,
  9363. the following constants:
  9364. @table @var
  9365. @item known
  9366. 1 if index is not 129, 0 otherwise.
  9367. @item qp
  9368. Sequential index starting from -129 to 128.
  9369. @end table
  9370. @subsection Examples
  9371. @itemize
  9372. @item
  9373. Some equation like:
  9374. @example
  9375. qp=2+2*sin(PI*qp)
  9376. @end example
  9377. @end itemize
  9378. @section random
  9379. Flush video frames from internal cache of frames into a random order.
  9380. No frame is discarded.
  9381. Inspired by @ref{frei0r} nervous filter.
  9382. @table @option
  9383. @item frames
  9384. Set size in number of frames of internal cache, in range from @code{2} to
  9385. @code{512}. Default is @code{30}.
  9386. @item seed
  9387. Set seed for random number generator, must be an integer included between
  9388. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  9389. less than @code{0}, the filter will try to use a good random seed on a
  9390. best effort basis.
  9391. @end table
  9392. @section readeia608
  9393. Read closed captioning (EIA-608) information from the top lines of a video frame.
  9394. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  9395. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  9396. with EIA-608 data (starting from 0). A description of each metadata value follows:
  9397. @table @option
  9398. @item lavfi.readeia608.X.cc
  9399. The two bytes stored as EIA-608 data (printed in hexadecimal).
  9400. @item lavfi.readeia608.X.line
  9401. The number of the line on which the EIA-608 data was identified and read.
  9402. @end table
  9403. This filter accepts the following options:
  9404. @table @option
  9405. @item scan_min
  9406. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  9407. @item scan_max
  9408. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  9409. @item mac
  9410. Set minimal acceptable amplitude change for sync codes detection.
  9411. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  9412. @item spw
  9413. Set the ratio of width reserved for sync code detection.
  9414. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  9415. @item mhd
  9416. Set the max peaks height difference for sync code detection.
  9417. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9418. @item mpd
  9419. Set max peaks period difference for sync code detection.
  9420. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9421. @item msd
  9422. Set the first two max start code bits differences.
  9423. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  9424. @item bhd
  9425. Set the minimum ratio of bits height compared to 3rd start code bit.
  9426. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  9427. @item th_w
  9428. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  9429. @item th_b
  9430. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  9431. @item chp
  9432. Enable checking the parity bit. In the event of a parity error, the filter will output
  9433. @code{0x00} for that character. Default is false.
  9434. @end table
  9435. @subsection Examples
  9436. @itemize
  9437. @item
  9438. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  9439. @example
  9440. 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
  9441. @end example
  9442. @end itemize
  9443. @section readvitc
  9444. Read vertical interval timecode (VITC) information from the top lines of a
  9445. video frame.
  9446. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  9447. timecode value, if a valid timecode has been detected. Further metadata key
  9448. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  9449. timecode data has been found or not.
  9450. This filter accepts the following options:
  9451. @table @option
  9452. @item scan_max
  9453. Set the maximum number of lines to scan for VITC data. If the value is set to
  9454. @code{-1} the full video frame is scanned. Default is @code{45}.
  9455. @item thr_b
  9456. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  9457. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  9458. @item thr_w
  9459. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  9460. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  9461. @end table
  9462. @subsection Examples
  9463. @itemize
  9464. @item
  9465. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  9466. draw @code{--:--:--:--} as a placeholder:
  9467. @example
  9468. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  9469. @end example
  9470. @end itemize
  9471. @section remap
  9472. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  9473. Destination pixel at position (X, Y) will be picked from source (x, y) position
  9474. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  9475. value for pixel will be used for destination pixel.
  9476. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  9477. will have Xmap/Ymap video stream dimensions.
  9478. Xmap and Ymap input video streams are 16bit depth, single channel.
  9479. @section removegrain
  9480. The removegrain filter is a spatial denoiser for progressive video.
  9481. @table @option
  9482. @item m0
  9483. Set mode for the first plane.
  9484. @item m1
  9485. Set mode for the second plane.
  9486. @item m2
  9487. Set mode for the third plane.
  9488. @item m3
  9489. Set mode for the fourth plane.
  9490. @end table
  9491. Range of mode is from 0 to 24. Description of each mode follows:
  9492. @table @var
  9493. @item 0
  9494. Leave input plane unchanged. Default.
  9495. @item 1
  9496. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  9497. @item 2
  9498. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  9499. @item 3
  9500. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  9501. @item 4
  9502. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  9503. This is equivalent to a median filter.
  9504. @item 5
  9505. Line-sensitive clipping giving the minimal change.
  9506. @item 6
  9507. Line-sensitive clipping, intermediate.
  9508. @item 7
  9509. Line-sensitive clipping, intermediate.
  9510. @item 8
  9511. Line-sensitive clipping, intermediate.
  9512. @item 9
  9513. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  9514. @item 10
  9515. Replaces the target pixel with the closest neighbour.
  9516. @item 11
  9517. [1 2 1] horizontal and vertical kernel blur.
  9518. @item 12
  9519. Same as mode 11.
  9520. @item 13
  9521. Bob mode, interpolates top field from the line where the neighbours
  9522. pixels are the closest.
  9523. @item 14
  9524. Bob mode, interpolates bottom field from the line where the neighbours
  9525. pixels are the closest.
  9526. @item 15
  9527. Bob mode, interpolates top field. Same as 13 but with a more complicated
  9528. interpolation formula.
  9529. @item 16
  9530. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  9531. interpolation formula.
  9532. @item 17
  9533. Clips the pixel with the minimum and maximum of respectively the maximum and
  9534. minimum of each pair of opposite neighbour pixels.
  9535. @item 18
  9536. Line-sensitive clipping using opposite neighbours whose greatest distance from
  9537. the current pixel is minimal.
  9538. @item 19
  9539. Replaces the pixel with the average of its 8 neighbours.
  9540. @item 20
  9541. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  9542. @item 21
  9543. Clips pixels using the averages of opposite neighbour.
  9544. @item 22
  9545. Same as mode 21 but simpler and faster.
  9546. @item 23
  9547. Small edge and halo removal, but reputed useless.
  9548. @item 24
  9549. Similar as 23.
  9550. @end table
  9551. @section removelogo
  9552. Suppress a TV station logo, using an image file to determine which
  9553. pixels comprise the logo. It works by filling in the pixels that
  9554. comprise the logo with neighboring pixels.
  9555. The filter accepts the following options:
  9556. @table @option
  9557. @item filename, f
  9558. Set the filter bitmap file, which can be any image format supported by
  9559. libavformat. The width and height of the image file must match those of the
  9560. video stream being processed.
  9561. @end table
  9562. Pixels in the provided bitmap image with a value of zero are not
  9563. considered part of the logo, non-zero pixels are considered part of
  9564. the logo. If you use white (255) for the logo and black (0) for the
  9565. rest, you will be safe. For making the filter bitmap, it is
  9566. recommended to take a screen capture of a black frame with the logo
  9567. visible, and then using a threshold filter followed by the erode
  9568. filter once or twice.
  9569. If needed, little splotches can be fixed manually. Remember that if
  9570. logo pixels are not covered, the filter quality will be much
  9571. reduced. Marking too many pixels as part of the logo does not hurt as
  9572. much, but it will increase the amount of blurring needed to cover over
  9573. the image and will destroy more information than necessary, and extra
  9574. pixels will slow things down on a large logo.
  9575. @section repeatfields
  9576. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  9577. fields based on its value.
  9578. @section reverse
  9579. Reverse a video clip.
  9580. Warning: This filter requires memory to buffer the entire clip, so trimming
  9581. is suggested.
  9582. @subsection Examples
  9583. @itemize
  9584. @item
  9585. Take the first 5 seconds of a clip, and reverse it.
  9586. @example
  9587. trim=end=5,reverse
  9588. @end example
  9589. @end itemize
  9590. @section roberts
  9591. Apply roberts cross operator to input video stream.
  9592. The filter accepts the following option:
  9593. @table @option
  9594. @item planes
  9595. Set which planes will be processed, unprocessed planes will be copied.
  9596. By default value 0xf, all planes will be processed.
  9597. @item scale
  9598. Set value which will be multiplied with filtered result.
  9599. @item delta
  9600. Set value which will be added to filtered result.
  9601. @end table
  9602. @section rotate
  9603. Rotate video by an arbitrary angle expressed in radians.
  9604. The filter accepts the following options:
  9605. A description of the optional parameters follows.
  9606. @table @option
  9607. @item angle, a
  9608. Set an expression for the angle by which to rotate the input video
  9609. clockwise, expressed as a number of radians. A negative value will
  9610. result in a counter-clockwise rotation. By default it is set to "0".
  9611. This expression is evaluated for each frame.
  9612. @item out_w, ow
  9613. Set the output width expression, default value is "iw".
  9614. This expression is evaluated just once during configuration.
  9615. @item out_h, oh
  9616. Set the output height expression, default value is "ih".
  9617. This expression is evaluated just once during configuration.
  9618. @item bilinear
  9619. Enable bilinear interpolation if set to 1, a value of 0 disables
  9620. it. Default value is 1.
  9621. @item fillcolor, c
  9622. Set the color used to fill the output area not covered by the rotated
  9623. image. For the general syntax of this option, check the "Color" section in the
  9624. ffmpeg-utils manual. If the special value "none" is selected then no
  9625. background is printed (useful for example if the background is never shown).
  9626. Default value is "black".
  9627. @end table
  9628. The expressions for the angle and the output size can contain the
  9629. following constants and functions:
  9630. @table @option
  9631. @item n
  9632. sequential number of the input frame, starting from 0. It is always NAN
  9633. before the first frame is filtered.
  9634. @item t
  9635. time in seconds of the input frame, it is set to 0 when the filter is
  9636. configured. It is always NAN before the first frame is filtered.
  9637. @item hsub
  9638. @item vsub
  9639. horizontal and vertical chroma subsample values. For example for the
  9640. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9641. @item in_w, iw
  9642. @item in_h, ih
  9643. the input video width and height
  9644. @item out_w, ow
  9645. @item out_h, oh
  9646. the output width and height, that is the size of the padded area as
  9647. specified by the @var{width} and @var{height} expressions
  9648. @item rotw(a)
  9649. @item roth(a)
  9650. the minimal width/height required for completely containing the input
  9651. video rotated by @var{a} radians.
  9652. These are only available when computing the @option{out_w} and
  9653. @option{out_h} expressions.
  9654. @end table
  9655. @subsection Examples
  9656. @itemize
  9657. @item
  9658. Rotate the input by PI/6 radians clockwise:
  9659. @example
  9660. rotate=PI/6
  9661. @end example
  9662. @item
  9663. Rotate the input by PI/6 radians counter-clockwise:
  9664. @example
  9665. rotate=-PI/6
  9666. @end example
  9667. @item
  9668. Rotate the input by 45 degrees clockwise:
  9669. @example
  9670. rotate=45*PI/180
  9671. @end example
  9672. @item
  9673. Apply a constant rotation with period T, starting from an angle of PI/3:
  9674. @example
  9675. rotate=PI/3+2*PI*t/T
  9676. @end example
  9677. @item
  9678. Make the input video rotation oscillating with a period of T
  9679. seconds and an amplitude of A radians:
  9680. @example
  9681. rotate=A*sin(2*PI/T*t)
  9682. @end example
  9683. @item
  9684. Rotate the video, output size is chosen so that the whole rotating
  9685. input video is always completely contained in the output:
  9686. @example
  9687. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  9688. @end example
  9689. @item
  9690. Rotate the video, reduce the output size so that no background is ever
  9691. shown:
  9692. @example
  9693. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  9694. @end example
  9695. @end itemize
  9696. @subsection Commands
  9697. The filter supports the following commands:
  9698. @table @option
  9699. @item a, angle
  9700. Set the angle expression.
  9701. The command accepts the same syntax of the corresponding option.
  9702. If the specified expression is not valid, it is kept at its current
  9703. value.
  9704. @end table
  9705. @section sab
  9706. Apply Shape Adaptive Blur.
  9707. The filter accepts the following options:
  9708. @table @option
  9709. @item luma_radius, lr
  9710. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  9711. value is 1.0. A greater value will result in a more blurred image, and
  9712. in slower processing.
  9713. @item luma_pre_filter_radius, lpfr
  9714. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  9715. value is 1.0.
  9716. @item luma_strength, ls
  9717. Set luma maximum difference between pixels to still be considered, must
  9718. be a value in the 0.1-100.0 range, default value is 1.0.
  9719. @item chroma_radius, cr
  9720. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  9721. greater value will result in a more blurred image, and in slower
  9722. processing.
  9723. @item chroma_pre_filter_radius, cpfr
  9724. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  9725. @item chroma_strength, cs
  9726. Set chroma maximum difference between pixels to still be considered,
  9727. must be a value in the -0.9-100.0 range.
  9728. @end table
  9729. Each chroma option value, if not explicitly specified, is set to the
  9730. corresponding luma option value.
  9731. @anchor{scale}
  9732. @section scale
  9733. Scale (resize) the input video, using the libswscale library.
  9734. The scale filter forces the output display aspect ratio to be the same
  9735. of the input, by changing the output sample aspect ratio.
  9736. If the input image format is different from the format requested by
  9737. the next filter, the scale filter will convert the input to the
  9738. requested format.
  9739. @subsection Options
  9740. The filter accepts the following options, or any of the options
  9741. supported by the libswscale scaler.
  9742. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  9743. the complete list of scaler options.
  9744. @table @option
  9745. @item width, w
  9746. @item height, h
  9747. Set the output video dimension expression. Default value is the input
  9748. dimension.
  9749. If the @var{width} or @var{w} value is 0, the input width is used for
  9750. the output. If the @var{height} or @var{h} value is 0, the input height
  9751. is used for the output.
  9752. If one and only one of the values is -n with n >= 1, the scale filter
  9753. will use a value that maintains the aspect ratio of the input image,
  9754. calculated from the other specified dimension. After that it will,
  9755. however, make sure that the calculated dimension is divisible by n and
  9756. adjust the value if necessary.
  9757. If both values are -n with n >= 1, the behavior will be identical to
  9758. both values being set to 0 as previously detailed.
  9759. See below for the list of accepted constants for use in the dimension
  9760. expression.
  9761. @item eval
  9762. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  9763. @table @samp
  9764. @item init
  9765. Only evaluate expressions once during the filter initialization or when a command is processed.
  9766. @item frame
  9767. Evaluate expressions for each incoming frame.
  9768. @end table
  9769. Default value is @samp{init}.
  9770. @item interl
  9771. Set the interlacing mode. It accepts the following values:
  9772. @table @samp
  9773. @item 1
  9774. Force interlaced aware scaling.
  9775. @item 0
  9776. Do not apply interlaced scaling.
  9777. @item -1
  9778. Select interlaced aware scaling depending on whether the source frames
  9779. are flagged as interlaced or not.
  9780. @end table
  9781. Default value is @samp{0}.
  9782. @item flags
  9783. Set libswscale scaling flags. See
  9784. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9785. complete list of values. If not explicitly specified the filter applies
  9786. the default flags.
  9787. @item param0, param1
  9788. Set libswscale input parameters for scaling algorithms that need them. See
  9789. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9790. complete documentation. If not explicitly specified the filter applies
  9791. empty parameters.
  9792. @item size, s
  9793. Set the video size. For the syntax of this option, check the
  9794. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9795. @item in_color_matrix
  9796. @item out_color_matrix
  9797. Set in/output YCbCr color space type.
  9798. This allows the autodetected value to be overridden as well as allows forcing
  9799. a specific value used for the output and encoder.
  9800. If not specified, the color space type depends on the pixel format.
  9801. Possible values:
  9802. @table @samp
  9803. @item auto
  9804. Choose automatically.
  9805. @item bt709
  9806. Format conforming to International Telecommunication Union (ITU)
  9807. Recommendation BT.709.
  9808. @item fcc
  9809. Set color space conforming to the United States Federal Communications
  9810. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  9811. @item bt601
  9812. Set color space conforming to:
  9813. @itemize
  9814. @item
  9815. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  9816. @item
  9817. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  9818. @item
  9819. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  9820. @end itemize
  9821. @item smpte240m
  9822. Set color space conforming to SMPTE ST 240:1999.
  9823. @end table
  9824. @item in_range
  9825. @item out_range
  9826. Set in/output YCbCr sample range.
  9827. This allows the autodetected value to be overridden as well as allows forcing
  9828. a specific value used for the output and encoder. If not specified, the
  9829. range depends on the pixel format. Possible values:
  9830. @table @samp
  9831. @item auto
  9832. Choose automatically.
  9833. @item jpeg/full/pc
  9834. Set full range (0-255 in case of 8-bit luma).
  9835. @item mpeg/tv
  9836. Set "MPEG" range (16-235 in case of 8-bit luma).
  9837. @end table
  9838. @item force_original_aspect_ratio
  9839. Enable decreasing or increasing output video width or height if necessary to
  9840. keep the original aspect ratio. Possible values:
  9841. @table @samp
  9842. @item disable
  9843. Scale the video as specified and disable this feature.
  9844. @item decrease
  9845. The output video dimensions will automatically be decreased if needed.
  9846. @item increase
  9847. The output video dimensions will automatically be increased if needed.
  9848. @end table
  9849. One useful instance of this option is that when you know a specific device's
  9850. maximum allowed resolution, you can use this to limit the output video to
  9851. that, while retaining the aspect ratio. For example, device A allows
  9852. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  9853. decrease) and specifying 1280x720 to the command line makes the output
  9854. 1280x533.
  9855. Please note that this is a different thing than specifying -1 for @option{w}
  9856. or @option{h}, you still need to specify the output resolution for this option
  9857. to work.
  9858. @end table
  9859. The values of the @option{w} and @option{h} options are expressions
  9860. containing the following constants:
  9861. @table @var
  9862. @item in_w
  9863. @item in_h
  9864. The input width and height
  9865. @item iw
  9866. @item ih
  9867. These are the same as @var{in_w} and @var{in_h}.
  9868. @item out_w
  9869. @item out_h
  9870. The output (scaled) width and height
  9871. @item ow
  9872. @item oh
  9873. These are the same as @var{out_w} and @var{out_h}
  9874. @item a
  9875. The same as @var{iw} / @var{ih}
  9876. @item sar
  9877. input sample aspect ratio
  9878. @item dar
  9879. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  9880. @item hsub
  9881. @item vsub
  9882. horizontal and vertical input chroma subsample values. For example for the
  9883. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9884. @item ohsub
  9885. @item ovsub
  9886. horizontal and vertical output chroma subsample values. For example for the
  9887. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9888. @end table
  9889. @subsection Examples
  9890. @itemize
  9891. @item
  9892. Scale the input video to a size of 200x100
  9893. @example
  9894. scale=w=200:h=100
  9895. @end example
  9896. This is equivalent to:
  9897. @example
  9898. scale=200:100
  9899. @end example
  9900. or:
  9901. @example
  9902. scale=200x100
  9903. @end example
  9904. @item
  9905. Specify a size abbreviation for the output size:
  9906. @example
  9907. scale=qcif
  9908. @end example
  9909. which can also be written as:
  9910. @example
  9911. scale=size=qcif
  9912. @end example
  9913. @item
  9914. Scale the input to 2x:
  9915. @example
  9916. scale=w=2*iw:h=2*ih
  9917. @end example
  9918. @item
  9919. The above is the same as:
  9920. @example
  9921. scale=2*in_w:2*in_h
  9922. @end example
  9923. @item
  9924. Scale the input to 2x with forced interlaced scaling:
  9925. @example
  9926. scale=2*iw:2*ih:interl=1
  9927. @end example
  9928. @item
  9929. Scale the input to half size:
  9930. @example
  9931. scale=w=iw/2:h=ih/2
  9932. @end example
  9933. @item
  9934. Increase the width, and set the height to the same size:
  9935. @example
  9936. scale=3/2*iw:ow
  9937. @end example
  9938. @item
  9939. Seek Greek harmony:
  9940. @example
  9941. scale=iw:1/PHI*iw
  9942. scale=ih*PHI:ih
  9943. @end example
  9944. @item
  9945. Increase the height, and set the width to 3/2 of the height:
  9946. @example
  9947. scale=w=3/2*oh:h=3/5*ih
  9948. @end example
  9949. @item
  9950. Increase the size, making the size a multiple of the chroma
  9951. subsample values:
  9952. @example
  9953. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  9954. @end example
  9955. @item
  9956. Increase the width to a maximum of 500 pixels,
  9957. keeping the same aspect ratio as the input:
  9958. @example
  9959. scale=w='min(500\, iw*3/2):h=-1'
  9960. @end example
  9961. @end itemize
  9962. @subsection Commands
  9963. This filter supports the following commands:
  9964. @table @option
  9965. @item width, w
  9966. @item height, h
  9967. Set the output video dimension expression.
  9968. The command accepts the same syntax of the corresponding option.
  9969. If the specified expression is not valid, it is kept at its current
  9970. value.
  9971. @end table
  9972. @section scale_npp
  9973. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  9974. format conversion on CUDA video frames. Setting the output width and height
  9975. works in the same way as for the @var{scale} filter.
  9976. The following additional options are accepted:
  9977. @table @option
  9978. @item format
  9979. The pixel format of the output CUDA frames. If set to the string "same" (the
  9980. default), the input format will be kept. Note that automatic format negotiation
  9981. and conversion is not yet supported for hardware frames
  9982. @item interp_algo
  9983. The interpolation algorithm used for resizing. One of the following:
  9984. @table @option
  9985. @item nn
  9986. Nearest neighbour.
  9987. @item linear
  9988. @item cubic
  9989. @item cubic2p_bspline
  9990. 2-parameter cubic (B=1, C=0)
  9991. @item cubic2p_catmullrom
  9992. 2-parameter cubic (B=0, C=1/2)
  9993. @item cubic2p_b05c03
  9994. 2-parameter cubic (B=1/2, C=3/10)
  9995. @item super
  9996. Supersampling
  9997. @item lanczos
  9998. @end table
  9999. @end table
  10000. @section scale2ref
  10001. Scale (resize) the input video, based on a reference video.
  10002. See the scale filter for available options, scale2ref supports the same but
  10003. uses the reference video instead of the main input as basis. scale2ref also
  10004. supports the following additional constants for the @option{w} and
  10005. @option{h} options:
  10006. @table @var
  10007. @item main_w
  10008. @item main_h
  10009. The main input video's width and height
  10010. @item main_a
  10011. The same as @var{main_w} / @var{main_h}
  10012. @item main_sar
  10013. The main input video's sample aspect ratio
  10014. @item main_dar, mdar
  10015. The main input video's display aspect ratio. Calculated from
  10016. @code{(main_w / main_h) * main_sar}.
  10017. @item main_hsub
  10018. @item main_vsub
  10019. The main input video's horizontal and vertical chroma subsample values.
  10020. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  10021. is 1.
  10022. @end table
  10023. @subsection Examples
  10024. @itemize
  10025. @item
  10026. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  10027. @example
  10028. 'scale2ref[b][a];[a][b]overlay'
  10029. @end example
  10030. @end itemize
  10031. @anchor{selectivecolor}
  10032. @section selectivecolor
  10033. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  10034. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  10035. by the "purity" of the color (that is, how saturated it already is).
  10036. This filter is similar to the Adobe Photoshop Selective Color tool.
  10037. The filter accepts the following options:
  10038. @table @option
  10039. @item correction_method
  10040. Select color correction method.
  10041. Available values are:
  10042. @table @samp
  10043. @item absolute
  10044. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  10045. component value).
  10046. @item relative
  10047. Specified adjustments are relative to the original component value.
  10048. @end table
  10049. Default is @code{absolute}.
  10050. @item reds
  10051. Adjustments for red pixels (pixels where the red component is the maximum)
  10052. @item yellows
  10053. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  10054. @item greens
  10055. Adjustments for green pixels (pixels where the green component is the maximum)
  10056. @item cyans
  10057. Adjustments for cyan pixels (pixels where the red component is the minimum)
  10058. @item blues
  10059. Adjustments for blue pixels (pixels where the blue component is the maximum)
  10060. @item magentas
  10061. Adjustments for magenta pixels (pixels where the green component is the minimum)
  10062. @item whites
  10063. Adjustments for white pixels (pixels where all components are greater than 128)
  10064. @item neutrals
  10065. Adjustments for all pixels except pure black and pure white
  10066. @item blacks
  10067. Adjustments for black pixels (pixels where all components are lesser than 128)
  10068. @item psfile
  10069. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  10070. @end table
  10071. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  10072. 4 space separated floating point adjustment values in the [-1,1] range,
  10073. respectively to adjust the amount of cyan, magenta, yellow and black for the
  10074. pixels of its range.
  10075. @subsection Examples
  10076. @itemize
  10077. @item
  10078. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  10079. increase magenta by 27% in blue areas:
  10080. @example
  10081. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  10082. @end example
  10083. @item
  10084. Use a Photoshop selective color preset:
  10085. @example
  10086. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  10087. @end example
  10088. @end itemize
  10089. @anchor{separatefields}
  10090. @section separatefields
  10091. The @code{separatefields} takes a frame-based video input and splits
  10092. each frame into its components fields, producing a new half height clip
  10093. with twice the frame rate and twice the frame count.
  10094. This filter use field-dominance information in frame to decide which
  10095. of each pair of fields to place first in the output.
  10096. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  10097. @section setdar, setsar
  10098. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  10099. output video.
  10100. This is done by changing the specified Sample (aka Pixel) Aspect
  10101. Ratio, according to the following equation:
  10102. @example
  10103. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  10104. @end example
  10105. Keep in mind that the @code{setdar} filter does not modify the pixel
  10106. dimensions of the video frame. Also, the display aspect ratio set by
  10107. this filter may be changed by later filters in the filterchain,
  10108. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  10109. applied.
  10110. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  10111. the filter output video.
  10112. Note that as a consequence of the application of this filter, the
  10113. output display aspect ratio will change according to the equation
  10114. above.
  10115. Keep in mind that the sample aspect ratio set by the @code{setsar}
  10116. filter may be changed by later filters in the filterchain, e.g. if
  10117. another "setsar" or a "setdar" filter is applied.
  10118. It accepts the following parameters:
  10119. @table @option
  10120. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  10121. Set the aspect ratio used by the filter.
  10122. The parameter can be a floating point number string, an expression, or
  10123. a string of the form @var{num}:@var{den}, where @var{num} and
  10124. @var{den} are the numerator and denominator of the aspect ratio. If
  10125. the parameter is not specified, it is assumed the value "0".
  10126. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  10127. should be escaped.
  10128. @item max
  10129. Set the maximum integer value to use for expressing numerator and
  10130. denominator when reducing the expressed aspect ratio to a rational.
  10131. Default value is @code{100}.
  10132. @end table
  10133. The parameter @var{sar} is an expression containing
  10134. the following constants:
  10135. @table @option
  10136. @item E, PI, PHI
  10137. These are approximated values for the mathematical constants e
  10138. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  10139. @item w, h
  10140. The input width and height.
  10141. @item a
  10142. These are the same as @var{w} / @var{h}.
  10143. @item sar
  10144. The input sample aspect ratio.
  10145. @item dar
  10146. The input display aspect ratio. It is the same as
  10147. (@var{w} / @var{h}) * @var{sar}.
  10148. @item hsub, vsub
  10149. Horizontal and vertical chroma subsample values. For example, for the
  10150. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10151. @end table
  10152. @subsection Examples
  10153. @itemize
  10154. @item
  10155. To change the display aspect ratio to 16:9, specify one of the following:
  10156. @example
  10157. setdar=dar=1.77777
  10158. setdar=dar=16/9
  10159. @end example
  10160. @item
  10161. To change the sample aspect ratio to 10:11, specify:
  10162. @example
  10163. setsar=sar=10/11
  10164. @end example
  10165. @item
  10166. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  10167. 1000 in the aspect ratio reduction, use the command:
  10168. @example
  10169. setdar=ratio=16/9:max=1000
  10170. @end example
  10171. @end itemize
  10172. @anchor{setfield}
  10173. @section setfield
  10174. Force field for the output video frame.
  10175. The @code{setfield} filter marks the interlace type field for the
  10176. output frames. It does not change the input frame, but only sets the
  10177. corresponding property, which affects how the frame is treated by
  10178. following filters (e.g. @code{fieldorder} or @code{yadif}).
  10179. The filter accepts the following options:
  10180. @table @option
  10181. @item mode
  10182. Available values are:
  10183. @table @samp
  10184. @item auto
  10185. Keep the same field property.
  10186. @item bff
  10187. Mark the frame as bottom-field-first.
  10188. @item tff
  10189. Mark the frame as top-field-first.
  10190. @item prog
  10191. Mark the frame as progressive.
  10192. @end table
  10193. @end table
  10194. @section showinfo
  10195. Show a line containing various information for each input video frame.
  10196. The input video is not modified.
  10197. The shown line contains a sequence of key/value pairs of the form
  10198. @var{key}:@var{value}.
  10199. The following values are shown in the output:
  10200. @table @option
  10201. @item n
  10202. The (sequential) number of the input frame, starting from 0.
  10203. @item pts
  10204. The Presentation TimeStamp of the input frame, expressed as a number of
  10205. time base units. The time base unit depends on the filter input pad.
  10206. @item pts_time
  10207. The Presentation TimeStamp of the input frame, expressed as a number of
  10208. seconds.
  10209. @item pos
  10210. The position of the frame in the input stream, or -1 if this information is
  10211. unavailable and/or meaningless (for example in case of synthetic video).
  10212. @item fmt
  10213. The pixel format name.
  10214. @item sar
  10215. The sample aspect ratio of the input frame, expressed in the form
  10216. @var{num}/@var{den}.
  10217. @item s
  10218. The size of the input frame. For the syntax of this option, check the
  10219. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10220. @item i
  10221. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  10222. for bottom field first).
  10223. @item iskey
  10224. This is 1 if the frame is a key frame, 0 otherwise.
  10225. @item type
  10226. The picture type of the input frame ("I" for an I-frame, "P" for a
  10227. P-frame, "B" for a B-frame, or "?" for an unknown type).
  10228. Also refer to the documentation of the @code{AVPictureType} enum and of
  10229. the @code{av_get_picture_type_char} function defined in
  10230. @file{libavutil/avutil.h}.
  10231. @item checksum
  10232. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  10233. @item plane_checksum
  10234. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  10235. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  10236. @end table
  10237. @section showpalette
  10238. Displays the 256 colors palette of each frame. This filter is only relevant for
  10239. @var{pal8} pixel format frames.
  10240. It accepts the following option:
  10241. @table @option
  10242. @item s
  10243. Set the size of the box used to represent one palette color entry. Default is
  10244. @code{30} (for a @code{30x30} pixel box).
  10245. @end table
  10246. @section shuffleframes
  10247. Reorder and/or duplicate and/or drop video frames.
  10248. It accepts the following parameters:
  10249. @table @option
  10250. @item mapping
  10251. Set the destination indexes of input frames.
  10252. This is space or '|' separated list of indexes that maps input frames to output
  10253. frames. Number of indexes also sets maximal value that each index may have.
  10254. '-1' index have special meaning and that is to drop frame.
  10255. @end table
  10256. The first frame has the index 0. The default is to keep the input unchanged.
  10257. @subsection Examples
  10258. @itemize
  10259. @item
  10260. Swap second and third frame of every three frames of the input:
  10261. @example
  10262. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  10263. @end example
  10264. @item
  10265. Swap 10th and 1st frame of every ten frames of the input:
  10266. @example
  10267. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  10268. @end example
  10269. @end itemize
  10270. @section shuffleplanes
  10271. Reorder and/or duplicate video planes.
  10272. It accepts the following parameters:
  10273. @table @option
  10274. @item map0
  10275. The index of the input plane to be used as the first output plane.
  10276. @item map1
  10277. The index of the input plane to be used as the second output plane.
  10278. @item map2
  10279. The index of the input plane to be used as the third output plane.
  10280. @item map3
  10281. The index of the input plane to be used as the fourth output plane.
  10282. @end table
  10283. The first plane has the index 0. The default is to keep the input unchanged.
  10284. @subsection Examples
  10285. @itemize
  10286. @item
  10287. Swap the second and third planes of the input:
  10288. @example
  10289. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  10290. @end example
  10291. @end itemize
  10292. @anchor{signalstats}
  10293. @section signalstats
  10294. Evaluate various visual metrics that assist in determining issues associated
  10295. with the digitization of analog video media.
  10296. By default the filter will log these metadata values:
  10297. @table @option
  10298. @item YMIN
  10299. Display the minimal Y value contained within the input frame. Expressed in
  10300. range of [0-255].
  10301. @item YLOW
  10302. Display the Y value at the 10% percentile within the input frame. Expressed in
  10303. range of [0-255].
  10304. @item YAVG
  10305. Display the average Y value within the input frame. Expressed in range of
  10306. [0-255].
  10307. @item YHIGH
  10308. Display the Y value at the 90% percentile within the input frame. Expressed in
  10309. range of [0-255].
  10310. @item YMAX
  10311. Display the maximum Y value contained within the input frame. Expressed in
  10312. range of [0-255].
  10313. @item UMIN
  10314. Display the minimal U value contained within the input frame. Expressed in
  10315. range of [0-255].
  10316. @item ULOW
  10317. Display the U value at the 10% percentile within the input frame. Expressed in
  10318. range of [0-255].
  10319. @item UAVG
  10320. Display the average U value within the input frame. Expressed in range of
  10321. [0-255].
  10322. @item UHIGH
  10323. Display the U value at the 90% percentile within the input frame. Expressed in
  10324. range of [0-255].
  10325. @item UMAX
  10326. Display the maximum U value contained within the input frame. Expressed in
  10327. range of [0-255].
  10328. @item VMIN
  10329. Display the minimal V value contained within the input frame. Expressed in
  10330. range of [0-255].
  10331. @item VLOW
  10332. Display the V value at the 10% percentile within the input frame. Expressed in
  10333. range of [0-255].
  10334. @item VAVG
  10335. Display the average V value within the input frame. Expressed in range of
  10336. [0-255].
  10337. @item VHIGH
  10338. Display the V value at the 90% percentile within the input frame. Expressed in
  10339. range of [0-255].
  10340. @item VMAX
  10341. Display the maximum V value contained within the input frame. Expressed in
  10342. range of [0-255].
  10343. @item SATMIN
  10344. Display the minimal saturation value contained within the input frame.
  10345. Expressed in range of [0-~181.02].
  10346. @item SATLOW
  10347. Display the saturation value at the 10% percentile within the input frame.
  10348. Expressed in range of [0-~181.02].
  10349. @item SATAVG
  10350. Display the average saturation value within the input frame. Expressed in range
  10351. of [0-~181.02].
  10352. @item SATHIGH
  10353. Display the saturation value at the 90% percentile within the input frame.
  10354. Expressed in range of [0-~181.02].
  10355. @item SATMAX
  10356. Display the maximum saturation value contained within the input frame.
  10357. Expressed in range of [0-~181.02].
  10358. @item HUEMED
  10359. Display the median value for hue within the input frame. Expressed in range of
  10360. [0-360].
  10361. @item HUEAVG
  10362. Display the average value for hue within the input frame. Expressed in range of
  10363. [0-360].
  10364. @item YDIF
  10365. Display the average of sample value difference between all values of the Y
  10366. plane in the current frame and corresponding values of the previous input frame.
  10367. Expressed in range of [0-255].
  10368. @item UDIF
  10369. Display the average of sample value difference between all values of the U
  10370. plane in the current frame and corresponding values of the previous input frame.
  10371. Expressed in range of [0-255].
  10372. @item VDIF
  10373. Display the average of sample value difference between all values of the V
  10374. plane in the current frame and corresponding values of the previous input frame.
  10375. Expressed in range of [0-255].
  10376. @item YBITDEPTH
  10377. Display bit depth of Y plane in current frame.
  10378. Expressed in range of [0-16].
  10379. @item UBITDEPTH
  10380. Display bit depth of U plane in current frame.
  10381. Expressed in range of [0-16].
  10382. @item VBITDEPTH
  10383. Display bit depth of V plane in current frame.
  10384. Expressed in range of [0-16].
  10385. @end table
  10386. The filter accepts the following options:
  10387. @table @option
  10388. @item stat
  10389. @item out
  10390. @option{stat} specify an additional form of image analysis.
  10391. @option{out} output video with the specified type of pixel highlighted.
  10392. Both options accept the following values:
  10393. @table @samp
  10394. @item tout
  10395. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  10396. unlike the neighboring pixels of the same field. Examples of temporal outliers
  10397. include the results of video dropouts, head clogs, or tape tracking issues.
  10398. @item vrep
  10399. Identify @var{vertical line repetition}. Vertical line repetition includes
  10400. similar rows of pixels within a frame. In born-digital video vertical line
  10401. repetition is common, but this pattern is uncommon in video digitized from an
  10402. analog source. When it occurs in video that results from the digitization of an
  10403. analog source it can indicate concealment from a dropout compensator.
  10404. @item brng
  10405. Identify pixels that fall outside of legal broadcast range.
  10406. @end table
  10407. @item color, c
  10408. Set the highlight color for the @option{out} option. The default color is
  10409. yellow.
  10410. @end table
  10411. @subsection Examples
  10412. @itemize
  10413. @item
  10414. Output data of various video metrics:
  10415. @example
  10416. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  10417. @end example
  10418. @item
  10419. Output specific data about the minimum and maximum values of the Y plane per frame:
  10420. @example
  10421. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  10422. @end example
  10423. @item
  10424. Playback video while highlighting pixels that are outside of broadcast range in red.
  10425. @example
  10426. ffplay example.mov -vf signalstats="out=brng:color=red"
  10427. @end example
  10428. @item
  10429. Playback video with signalstats metadata drawn over the frame.
  10430. @example
  10431. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  10432. @end example
  10433. The contents of signalstat_drawtext.txt used in the command are:
  10434. @example
  10435. time %@{pts:hms@}
  10436. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  10437. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  10438. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  10439. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  10440. @end example
  10441. @end itemize
  10442. @anchor{signature}
  10443. @section signature
  10444. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  10445. input. In this case the matching between the inputs can be calculated additionally.
  10446. The filter always passes through the first input. The signature of each stream can
  10447. be written into a file.
  10448. It accepts the following options:
  10449. @table @option
  10450. @item detectmode
  10451. Enable or disable the matching process.
  10452. Available values are:
  10453. @table @samp
  10454. @item off
  10455. Disable the calculation of a matching (default).
  10456. @item full
  10457. Calculate the matching for the whole video and output whether the whole video
  10458. matches or only parts.
  10459. @item fast
  10460. Calculate only until a matching is found or the video ends. Should be faster in
  10461. some cases.
  10462. @end table
  10463. @item nb_inputs
  10464. Set the number of inputs. The option value must be a non negative integer.
  10465. Default value is 1.
  10466. @item filename
  10467. Set the path to which the output is written. If there is more than one input,
  10468. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  10469. integer), that will be replaced with the input number. If no filename is
  10470. specified, no output will be written. This is the default.
  10471. @item format
  10472. Choose the output format.
  10473. Available values are:
  10474. @table @samp
  10475. @item binary
  10476. Use the specified binary representation (default).
  10477. @item xml
  10478. Use the specified xml representation.
  10479. @end table
  10480. @item th_d
  10481. Set threshold to detect one word as similar. The option value must be an integer
  10482. greater than zero. The default value is 9000.
  10483. @item th_dc
  10484. Set threshold to detect all words as similar. The option value must be an integer
  10485. greater than zero. The default value is 60000.
  10486. @item th_xh
  10487. Set threshold to detect frames as similar. The option value must be an integer
  10488. greater than zero. The default value is 116.
  10489. @item th_di
  10490. Set the minimum length of a sequence in frames to recognize it as matching
  10491. sequence. The option value must be a non negative integer value.
  10492. The default value is 0.
  10493. @item th_it
  10494. Set the minimum relation, that matching frames to all frames must have.
  10495. The option value must be a double value between 0 and 1. The default value is 0.5.
  10496. @end table
  10497. @subsection Examples
  10498. @itemize
  10499. @item
  10500. To calculate the signature of an input video and store it in signature.bin:
  10501. @example
  10502. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  10503. @end example
  10504. @item
  10505. To detect whether two videos match and store the signatures in XML format in
  10506. signature0.xml and signature1.xml:
  10507. @example
  10508. 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 -
  10509. @end example
  10510. @end itemize
  10511. @anchor{smartblur}
  10512. @section smartblur
  10513. Blur the input video without impacting the outlines.
  10514. It accepts the following options:
  10515. @table @option
  10516. @item luma_radius, lr
  10517. Set the luma radius. The option value must be a float number in
  10518. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10519. used to blur the image (slower if larger). Default value is 1.0.
  10520. @item luma_strength, ls
  10521. Set the luma strength. The option value must be a float number
  10522. in the range [-1.0,1.0] that configures the blurring. A value included
  10523. in [0.0,1.0] will blur the image whereas a value included in
  10524. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  10525. @item luma_threshold, lt
  10526. Set the luma threshold used as a coefficient to determine
  10527. whether a pixel should be blurred or not. The option value must be an
  10528. integer in the range [-30,30]. A value of 0 will filter all the image,
  10529. a value included in [0,30] will filter flat areas and a value included
  10530. in [-30,0] will filter edges. Default value is 0.
  10531. @item chroma_radius, cr
  10532. Set the chroma radius. The option value must be a float number in
  10533. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10534. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  10535. @item chroma_strength, cs
  10536. Set the chroma strength. The option value must be a float number
  10537. in the range [-1.0,1.0] that configures the blurring. A value included
  10538. in [0.0,1.0] will blur the image whereas a value included in
  10539. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  10540. @item chroma_threshold, ct
  10541. Set the chroma threshold used as a coefficient to determine
  10542. whether a pixel should be blurred or not. The option value must be an
  10543. integer in the range [-30,30]. A value of 0 will filter all the image,
  10544. a value included in [0,30] will filter flat areas and a value included
  10545. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  10546. @end table
  10547. If a chroma option is not explicitly set, the corresponding luma value
  10548. is set.
  10549. @section ssim
  10550. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  10551. This filter takes in input two input videos, the first input is
  10552. considered the "main" source and is passed unchanged to the
  10553. output. The second input is used as a "reference" video for computing
  10554. the SSIM.
  10555. Both video inputs must have the same resolution and pixel format for
  10556. this filter to work correctly. Also it assumes that both inputs
  10557. have the same number of frames, which are compared one by one.
  10558. The filter stores the calculated SSIM of each frame.
  10559. The description of the accepted parameters follows.
  10560. @table @option
  10561. @item stats_file, f
  10562. If specified the filter will use the named file to save the SSIM of
  10563. each individual frame. When filename equals "-" the data is sent to
  10564. standard output.
  10565. @end table
  10566. The file printed if @var{stats_file} is selected, contains a sequence of
  10567. key/value pairs of the form @var{key}:@var{value} for each compared
  10568. couple of frames.
  10569. A description of each shown parameter follows:
  10570. @table @option
  10571. @item n
  10572. sequential number of the input frame, starting from 1
  10573. @item Y, U, V, R, G, B
  10574. SSIM of the compared frames for the component specified by the suffix.
  10575. @item All
  10576. SSIM of the compared frames for the whole frame.
  10577. @item dB
  10578. Same as above but in dB representation.
  10579. @end table
  10580. This filter also supports the @ref{framesync} options.
  10581. For example:
  10582. @example
  10583. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10584. [main][ref] ssim="stats_file=stats.log" [out]
  10585. @end example
  10586. On this example the input file being processed is compared with the
  10587. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  10588. is stored in @file{stats.log}.
  10589. Another example with both psnr and ssim at same time:
  10590. @example
  10591. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  10592. @end example
  10593. @section stereo3d
  10594. Convert between different stereoscopic image formats.
  10595. The filters accept the following options:
  10596. @table @option
  10597. @item in
  10598. Set stereoscopic image format of input.
  10599. Available values for input image formats are:
  10600. @table @samp
  10601. @item sbsl
  10602. side by side parallel (left eye left, right eye right)
  10603. @item sbsr
  10604. side by side crosseye (right eye left, left eye right)
  10605. @item sbs2l
  10606. side by side parallel with half width resolution
  10607. (left eye left, right eye right)
  10608. @item sbs2r
  10609. side by side crosseye with half width resolution
  10610. (right eye left, left eye right)
  10611. @item abl
  10612. above-below (left eye above, right eye below)
  10613. @item abr
  10614. above-below (right eye above, left eye below)
  10615. @item ab2l
  10616. above-below with half height resolution
  10617. (left eye above, right eye below)
  10618. @item ab2r
  10619. above-below with half height resolution
  10620. (right eye above, left eye below)
  10621. @item al
  10622. alternating frames (left eye first, right eye second)
  10623. @item ar
  10624. alternating frames (right eye first, left eye second)
  10625. @item irl
  10626. interleaved rows (left eye has top row, right eye starts on next row)
  10627. @item irr
  10628. interleaved rows (right eye has top row, left eye starts on next row)
  10629. @item icl
  10630. interleaved columns, left eye first
  10631. @item icr
  10632. interleaved columns, right eye first
  10633. Default value is @samp{sbsl}.
  10634. @end table
  10635. @item out
  10636. Set stereoscopic image format of output.
  10637. @table @samp
  10638. @item sbsl
  10639. side by side parallel (left eye left, right eye right)
  10640. @item sbsr
  10641. side by side crosseye (right eye left, left eye right)
  10642. @item sbs2l
  10643. side by side parallel with half width resolution
  10644. (left eye left, right eye right)
  10645. @item sbs2r
  10646. side by side crosseye with half width resolution
  10647. (right eye left, left eye right)
  10648. @item abl
  10649. above-below (left eye above, right eye below)
  10650. @item abr
  10651. above-below (right eye above, left eye below)
  10652. @item ab2l
  10653. above-below with half height resolution
  10654. (left eye above, right eye below)
  10655. @item ab2r
  10656. above-below with half height resolution
  10657. (right eye above, left eye below)
  10658. @item al
  10659. alternating frames (left eye first, right eye second)
  10660. @item ar
  10661. alternating frames (right eye first, left eye second)
  10662. @item irl
  10663. interleaved rows (left eye has top row, right eye starts on next row)
  10664. @item irr
  10665. interleaved rows (right eye has top row, left eye starts on next row)
  10666. @item arbg
  10667. anaglyph red/blue gray
  10668. (red filter on left eye, blue filter on right eye)
  10669. @item argg
  10670. anaglyph red/green gray
  10671. (red filter on left eye, green filter on right eye)
  10672. @item arcg
  10673. anaglyph red/cyan gray
  10674. (red filter on left eye, cyan filter on right eye)
  10675. @item arch
  10676. anaglyph red/cyan half colored
  10677. (red filter on left eye, cyan filter on right eye)
  10678. @item arcc
  10679. anaglyph red/cyan color
  10680. (red filter on left eye, cyan filter on right eye)
  10681. @item arcd
  10682. anaglyph red/cyan color optimized with the least squares projection of dubois
  10683. (red filter on left eye, cyan filter on right eye)
  10684. @item agmg
  10685. anaglyph green/magenta gray
  10686. (green filter on left eye, magenta filter on right eye)
  10687. @item agmh
  10688. anaglyph green/magenta half colored
  10689. (green filter on left eye, magenta filter on right eye)
  10690. @item agmc
  10691. anaglyph green/magenta colored
  10692. (green filter on left eye, magenta filter on right eye)
  10693. @item agmd
  10694. anaglyph green/magenta color optimized with the least squares projection of dubois
  10695. (green filter on left eye, magenta filter on right eye)
  10696. @item aybg
  10697. anaglyph yellow/blue gray
  10698. (yellow filter on left eye, blue filter on right eye)
  10699. @item aybh
  10700. anaglyph yellow/blue half colored
  10701. (yellow filter on left eye, blue filter on right eye)
  10702. @item aybc
  10703. anaglyph yellow/blue colored
  10704. (yellow filter on left eye, blue filter on right eye)
  10705. @item aybd
  10706. anaglyph yellow/blue color optimized with the least squares projection of dubois
  10707. (yellow filter on left eye, blue filter on right eye)
  10708. @item ml
  10709. mono output (left eye only)
  10710. @item mr
  10711. mono output (right eye only)
  10712. @item chl
  10713. checkerboard, left eye first
  10714. @item chr
  10715. checkerboard, right eye first
  10716. @item icl
  10717. interleaved columns, left eye first
  10718. @item icr
  10719. interleaved columns, right eye first
  10720. @item hdmi
  10721. HDMI frame pack
  10722. @end table
  10723. Default value is @samp{arcd}.
  10724. @end table
  10725. @subsection Examples
  10726. @itemize
  10727. @item
  10728. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  10729. @example
  10730. stereo3d=sbsl:aybd
  10731. @end example
  10732. @item
  10733. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  10734. @example
  10735. stereo3d=abl:sbsr
  10736. @end example
  10737. @end itemize
  10738. @section streamselect, astreamselect
  10739. Select video or audio streams.
  10740. The filter accepts the following options:
  10741. @table @option
  10742. @item inputs
  10743. Set number of inputs. Default is 2.
  10744. @item map
  10745. Set input indexes to remap to outputs.
  10746. @end table
  10747. @subsection Commands
  10748. The @code{streamselect} and @code{astreamselect} filter supports the following
  10749. commands:
  10750. @table @option
  10751. @item map
  10752. Set input indexes to remap to outputs.
  10753. @end table
  10754. @subsection Examples
  10755. @itemize
  10756. @item
  10757. Select first 5 seconds 1st stream and rest of time 2nd stream:
  10758. @example
  10759. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  10760. @end example
  10761. @item
  10762. Same as above, but for audio:
  10763. @example
  10764. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  10765. @end example
  10766. @end itemize
  10767. @section sobel
  10768. Apply sobel operator to input video stream.
  10769. The filter accepts the following option:
  10770. @table @option
  10771. @item planes
  10772. Set which planes will be processed, unprocessed planes will be copied.
  10773. By default value 0xf, all planes will be processed.
  10774. @item scale
  10775. Set value which will be multiplied with filtered result.
  10776. @item delta
  10777. Set value which will be added to filtered result.
  10778. @end table
  10779. @anchor{spp}
  10780. @section spp
  10781. Apply a simple postprocessing filter that compresses and decompresses the image
  10782. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  10783. and average the results.
  10784. The filter accepts the following options:
  10785. @table @option
  10786. @item quality
  10787. Set quality. This option defines the number of levels for averaging. It accepts
  10788. an integer in the range 0-6. If set to @code{0}, the filter will have no
  10789. effect. A value of @code{6} means the higher quality. For each increment of
  10790. that value the speed drops by a factor of approximately 2. Default value is
  10791. @code{3}.
  10792. @item qp
  10793. Force a constant quantization parameter. If not set, the filter will use the QP
  10794. from the video stream (if available).
  10795. @item mode
  10796. Set thresholding mode. Available modes are:
  10797. @table @samp
  10798. @item hard
  10799. Set hard thresholding (default).
  10800. @item soft
  10801. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10802. @end table
  10803. @item use_bframe_qp
  10804. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  10805. option may cause flicker since the B-Frames have often larger QP. Default is
  10806. @code{0} (not enabled).
  10807. @end table
  10808. @anchor{subtitles}
  10809. @section subtitles
  10810. Draw subtitles on top of input video using the libass library.
  10811. To enable compilation of this filter you need to configure FFmpeg with
  10812. @code{--enable-libass}. This filter also requires a build with libavcodec and
  10813. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  10814. Alpha) subtitles format.
  10815. The filter accepts the following options:
  10816. @table @option
  10817. @item filename, f
  10818. Set the filename of the subtitle file to read. It must be specified.
  10819. @item original_size
  10820. Specify the size of the original video, the video for which the ASS file
  10821. was composed. For the syntax of this option, check the
  10822. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10823. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  10824. correctly scale the fonts if the aspect ratio has been changed.
  10825. @item fontsdir
  10826. Set a directory path containing fonts that can be used by the filter.
  10827. These fonts will be used in addition to whatever the font provider uses.
  10828. @item alpha
  10829. Process alpha channel, by default alpha channel is untouched.
  10830. @item charenc
  10831. Set subtitles input character encoding. @code{subtitles} filter only. Only
  10832. useful if not UTF-8.
  10833. @item stream_index, si
  10834. Set subtitles stream index. @code{subtitles} filter only.
  10835. @item force_style
  10836. Override default style or script info parameters of the subtitles. It accepts a
  10837. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  10838. @end table
  10839. If the first key is not specified, it is assumed that the first value
  10840. specifies the @option{filename}.
  10841. For example, to render the file @file{sub.srt} on top of the input
  10842. video, use the command:
  10843. @example
  10844. subtitles=sub.srt
  10845. @end example
  10846. which is equivalent to:
  10847. @example
  10848. subtitles=filename=sub.srt
  10849. @end example
  10850. To render the default subtitles stream from file @file{video.mkv}, use:
  10851. @example
  10852. subtitles=video.mkv
  10853. @end example
  10854. To render the second subtitles stream from that file, use:
  10855. @example
  10856. subtitles=video.mkv:si=1
  10857. @end example
  10858. To make the subtitles stream from @file{sub.srt} appear in transparent green
  10859. @code{DejaVu Serif}, use:
  10860. @example
  10861. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  10862. @end example
  10863. @section super2xsai
  10864. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  10865. Interpolate) pixel art scaling algorithm.
  10866. Useful for enlarging pixel art images without reducing sharpness.
  10867. @section swaprect
  10868. Swap two rectangular objects in video.
  10869. This filter accepts the following options:
  10870. @table @option
  10871. @item w
  10872. Set object width.
  10873. @item h
  10874. Set object height.
  10875. @item x1
  10876. Set 1st rect x coordinate.
  10877. @item y1
  10878. Set 1st rect y coordinate.
  10879. @item x2
  10880. Set 2nd rect x coordinate.
  10881. @item y2
  10882. Set 2nd rect y coordinate.
  10883. All expressions are evaluated once for each frame.
  10884. @end table
  10885. The all options are expressions containing the following constants:
  10886. @table @option
  10887. @item w
  10888. @item h
  10889. The input width and height.
  10890. @item a
  10891. same as @var{w} / @var{h}
  10892. @item sar
  10893. input sample aspect ratio
  10894. @item dar
  10895. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  10896. @item n
  10897. The number of the input frame, starting from 0.
  10898. @item t
  10899. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  10900. @item pos
  10901. the position in the file of the input frame, NAN if unknown
  10902. @end table
  10903. @section swapuv
  10904. Swap U & V plane.
  10905. @section telecine
  10906. Apply telecine process to the video.
  10907. This filter accepts the following options:
  10908. @table @option
  10909. @item first_field
  10910. @table @samp
  10911. @item top, t
  10912. top field first
  10913. @item bottom, b
  10914. bottom field first
  10915. The default value is @code{top}.
  10916. @end table
  10917. @item pattern
  10918. A string of numbers representing the pulldown pattern you wish to apply.
  10919. The default value is @code{23}.
  10920. @end table
  10921. @example
  10922. Some typical patterns:
  10923. NTSC output (30i):
  10924. 27.5p: 32222
  10925. 24p: 23 (classic)
  10926. 24p: 2332 (preferred)
  10927. 20p: 33
  10928. 18p: 334
  10929. 16p: 3444
  10930. PAL output (25i):
  10931. 27.5p: 12222
  10932. 24p: 222222222223 ("Euro pulldown")
  10933. 16.67p: 33
  10934. 16p: 33333334
  10935. @end example
  10936. @section threshold
  10937. Apply threshold effect to video stream.
  10938. This filter needs four video streams to perform thresholding.
  10939. First stream is stream we are filtering.
  10940. Second stream is holding threshold values, third stream is holding min values,
  10941. and last, fourth stream is holding max values.
  10942. The filter accepts the following option:
  10943. @table @option
  10944. @item planes
  10945. Set which planes will be processed, unprocessed planes will be copied.
  10946. By default value 0xf, all planes will be processed.
  10947. @end table
  10948. For example if first stream pixel's component value is less then threshold value
  10949. of pixel component from 2nd threshold stream, third stream value will picked,
  10950. otherwise fourth stream pixel component value will be picked.
  10951. Using color source filter one can perform various types of thresholding:
  10952. @subsection Examples
  10953. @itemize
  10954. @item
  10955. Binary threshold, using gray color as threshold:
  10956. @example
  10957. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  10958. @end example
  10959. @item
  10960. Inverted binary threshold, using gray color as threshold:
  10961. @example
  10962. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  10963. @end example
  10964. @item
  10965. Truncate binary threshold, using gray color as threshold:
  10966. @example
  10967. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  10968. @end example
  10969. @item
  10970. Threshold to zero, using gray color as threshold:
  10971. @example
  10972. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  10973. @end example
  10974. @item
  10975. Inverted threshold to zero, using gray color as threshold:
  10976. @example
  10977. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  10978. @end example
  10979. @end itemize
  10980. @section thumbnail
  10981. Select the most representative frame in a given sequence of consecutive frames.
  10982. The filter accepts the following options:
  10983. @table @option
  10984. @item n
  10985. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  10986. will pick one of them, and then handle the next batch of @var{n} frames until
  10987. the end. Default is @code{100}.
  10988. @end table
  10989. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  10990. value will result in a higher memory usage, so a high value is not recommended.
  10991. @subsection Examples
  10992. @itemize
  10993. @item
  10994. Extract one picture each 50 frames:
  10995. @example
  10996. thumbnail=50
  10997. @end example
  10998. @item
  10999. Complete example of a thumbnail creation with @command{ffmpeg}:
  11000. @example
  11001. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  11002. @end example
  11003. @end itemize
  11004. @section tile
  11005. Tile several successive frames together.
  11006. The filter accepts the following options:
  11007. @table @option
  11008. @item layout
  11009. Set the grid size (i.e. the number of lines and columns). For the syntax of
  11010. this option, check the
  11011. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11012. @item nb_frames
  11013. Set the maximum number of frames to render in the given area. It must be less
  11014. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  11015. the area will be used.
  11016. @item margin
  11017. Set the outer border margin in pixels.
  11018. @item padding
  11019. Set the inner border thickness (i.e. the number of pixels between frames). For
  11020. more advanced padding options (such as having different values for the edges),
  11021. refer to the pad video filter.
  11022. @item color
  11023. Specify the color of the unused area. For the syntax of this option, check the
  11024. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  11025. is "black".
  11026. @item overlap
  11027. Set the number of frames to overlap when tiling several successive frames together.
  11028. The value must be between @code{0} and @var{nb_frames - 1}.
  11029. @end table
  11030. @subsection Examples
  11031. @itemize
  11032. @item
  11033. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  11034. @example
  11035. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  11036. @end example
  11037. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  11038. duplicating each output frame to accommodate the originally detected frame
  11039. rate.
  11040. @item
  11041. Display @code{5} pictures in an area of @code{3x2} frames,
  11042. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  11043. mixed flat and named options:
  11044. @example
  11045. tile=3x2:nb_frames=5:padding=7:margin=2
  11046. @end example
  11047. @end itemize
  11048. @section tinterlace
  11049. Perform various types of temporal field interlacing.
  11050. Frames are counted starting from 1, so the first input frame is
  11051. considered odd.
  11052. The filter accepts the following options:
  11053. @table @option
  11054. @item mode
  11055. Specify the mode of the interlacing. This option can also be specified
  11056. as a value alone. See below for a list of values for this option.
  11057. Available values are:
  11058. @table @samp
  11059. @item merge, 0
  11060. Move odd frames into the upper field, even into the lower field,
  11061. generating a double height frame at half frame rate.
  11062. @example
  11063. ------> time
  11064. Input:
  11065. Frame 1 Frame 2 Frame 3 Frame 4
  11066. 11111 22222 33333 44444
  11067. 11111 22222 33333 44444
  11068. 11111 22222 33333 44444
  11069. 11111 22222 33333 44444
  11070. Output:
  11071. 11111 33333
  11072. 22222 44444
  11073. 11111 33333
  11074. 22222 44444
  11075. 11111 33333
  11076. 22222 44444
  11077. 11111 33333
  11078. 22222 44444
  11079. @end example
  11080. @item drop_even, 1
  11081. Only output odd frames, even frames are dropped, generating a frame with
  11082. unchanged height at half frame rate.
  11083. @example
  11084. ------> time
  11085. Input:
  11086. Frame 1 Frame 2 Frame 3 Frame 4
  11087. 11111 22222 33333 44444
  11088. 11111 22222 33333 44444
  11089. 11111 22222 33333 44444
  11090. 11111 22222 33333 44444
  11091. Output:
  11092. 11111 33333
  11093. 11111 33333
  11094. 11111 33333
  11095. 11111 33333
  11096. @end example
  11097. @item drop_odd, 2
  11098. Only output even frames, odd frames are dropped, generating a frame with
  11099. unchanged height at half frame rate.
  11100. @example
  11101. ------> time
  11102. Input:
  11103. Frame 1 Frame 2 Frame 3 Frame 4
  11104. 11111 22222 33333 44444
  11105. 11111 22222 33333 44444
  11106. 11111 22222 33333 44444
  11107. 11111 22222 33333 44444
  11108. Output:
  11109. 22222 44444
  11110. 22222 44444
  11111. 22222 44444
  11112. 22222 44444
  11113. @end example
  11114. @item pad, 3
  11115. Expand each frame to full height, but pad alternate lines with black,
  11116. generating a frame with double height at the same input frame rate.
  11117. @example
  11118. ------> time
  11119. Input:
  11120. Frame 1 Frame 2 Frame 3 Frame 4
  11121. 11111 22222 33333 44444
  11122. 11111 22222 33333 44444
  11123. 11111 22222 33333 44444
  11124. 11111 22222 33333 44444
  11125. Output:
  11126. 11111 ..... 33333 .....
  11127. ..... 22222 ..... 44444
  11128. 11111 ..... 33333 .....
  11129. ..... 22222 ..... 44444
  11130. 11111 ..... 33333 .....
  11131. ..... 22222 ..... 44444
  11132. 11111 ..... 33333 .....
  11133. ..... 22222 ..... 44444
  11134. @end example
  11135. @item interleave_top, 4
  11136. Interleave the upper field from odd frames with the lower field from
  11137. even frames, generating a frame with unchanged height at half frame rate.
  11138. @example
  11139. ------> time
  11140. Input:
  11141. Frame 1 Frame 2 Frame 3 Frame 4
  11142. 11111<- 22222 33333<- 44444
  11143. 11111 22222<- 33333 44444<-
  11144. 11111<- 22222 33333<- 44444
  11145. 11111 22222<- 33333 44444<-
  11146. Output:
  11147. 11111 33333
  11148. 22222 44444
  11149. 11111 33333
  11150. 22222 44444
  11151. @end example
  11152. @item interleave_bottom, 5
  11153. Interleave the lower field from odd frames with the upper field from
  11154. even frames, generating a frame with unchanged height at half frame rate.
  11155. @example
  11156. ------> time
  11157. Input:
  11158. Frame 1 Frame 2 Frame 3 Frame 4
  11159. 11111 22222<- 33333 44444<-
  11160. 11111<- 22222 33333<- 44444
  11161. 11111 22222<- 33333 44444<-
  11162. 11111<- 22222 33333<- 44444
  11163. Output:
  11164. 22222 44444
  11165. 11111 33333
  11166. 22222 44444
  11167. 11111 33333
  11168. @end example
  11169. @item interlacex2, 6
  11170. Double frame rate with unchanged height. Frames are inserted each
  11171. containing the second temporal field from the previous input frame and
  11172. the first temporal field from the next input frame. This mode relies on
  11173. the top_field_first flag. Useful for interlaced video displays with no
  11174. field synchronisation.
  11175. @example
  11176. ------> time
  11177. Input:
  11178. Frame 1 Frame 2 Frame 3 Frame 4
  11179. 11111 22222 33333 44444
  11180. 11111 22222 33333 44444
  11181. 11111 22222 33333 44444
  11182. 11111 22222 33333 44444
  11183. Output:
  11184. 11111 22222 22222 33333 33333 44444 44444
  11185. 11111 11111 22222 22222 33333 33333 44444
  11186. 11111 22222 22222 33333 33333 44444 44444
  11187. 11111 11111 22222 22222 33333 33333 44444
  11188. @end example
  11189. @item mergex2, 7
  11190. Move odd frames into the upper field, even into the lower field,
  11191. generating a double height frame at same frame rate.
  11192. @example
  11193. ------> time
  11194. Input:
  11195. Frame 1 Frame 2 Frame 3 Frame 4
  11196. 11111 22222 33333 44444
  11197. 11111 22222 33333 44444
  11198. 11111 22222 33333 44444
  11199. 11111 22222 33333 44444
  11200. Output:
  11201. 11111 33333 33333 55555
  11202. 22222 22222 44444 44444
  11203. 11111 33333 33333 55555
  11204. 22222 22222 44444 44444
  11205. 11111 33333 33333 55555
  11206. 22222 22222 44444 44444
  11207. 11111 33333 33333 55555
  11208. 22222 22222 44444 44444
  11209. @end example
  11210. @end table
  11211. Numeric values are deprecated but are accepted for backward
  11212. compatibility reasons.
  11213. Default mode is @code{merge}.
  11214. @item flags
  11215. Specify flags influencing the filter process.
  11216. Available value for @var{flags} is:
  11217. @table @option
  11218. @item low_pass_filter, vlfp
  11219. Enable linear vertical low-pass filtering in the filter.
  11220. Vertical low-pass filtering is required when creating an interlaced
  11221. destination from a progressive source which contains high-frequency
  11222. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  11223. patterning.
  11224. @item complex_filter, cvlfp
  11225. Enable complex vertical low-pass filtering.
  11226. This will slightly less reduce interlace 'twitter' and Moire
  11227. patterning but better retain detail and subjective sharpness impression.
  11228. @end table
  11229. Vertical low-pass filtering can only be enabled for @option{mode}
  11230. @var{interleave_top} and @var{interleave_bottom}.
  11231. @end table
  11232. @section tonemap
  11233. Tone map colors from different dynamic ranges.
  11234. This filter expects data in single precision floating point, as it needs to
  11235. operate on (and can output) out-of-range values. Another filter, such as
  11236. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  11237. The tonemapping algorithms implemented only work on linear light, so input
  11238. data should be linearized beforehand (and possibly correctly tagged).
  11239. @example
  11240. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  11241. @end example
  11242. @subsection Options
  11243. The filter accepts the following options.
  11244. @table @option
  11245. @item tonemap
  11246. Set the tone map algorithm to use.
  11247. Possible values are:
  11248. @table @var
  11249. @item none
  11250. Do not apply any tone map, only desaturate overbright pixels.
  11251. @item clip
  11252. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  11253. in-range values, while distorting out-of-range values.
  11254. @item linear
  11255. Stretch the entire reference gamut to a linear multiple of the display.
  11256. @item gamma
  11257. Fit a logarithmic transfer between the tone curves.
  11258. @item reinhard
  11259. Preserve overall image brightness with a simple curve, using nonlinear
  11260. contrast, which results in flattening details and degrading color accuracy.
  11261. @item hable
  11262. Preserve both dark and bright details better than @var{reinhard}, at the cost
  11263. of slightly darkening everything. Use it when detail preservation is more
  11264. important than color and brightness accuracy.
  11265. @item mobius
  11266. Smoothly map out-of-range values, while retaining contrast and colors for
  11267. in-range material as much as possible. Use it when color accuracy is more
  11268. important than detail preservation.
  11269. @end table
  11270. Default is none.
  11271. @item param
  11272. Tune the tone mapping algorithm.
  11273. This affects the following algorithms:
  11274. @table @var
  11275. @item none
  11276. Ignored.
  11277. @item linear
  11278. Specifies the scale factor to use while stretching.
  11279. Default to 1.0.
  11280. @item gamma
  11281. Specifies the exponent of the function.
  11282. Default to 1.8.
  11283. @item clip
  11284. Specify an extra linear coefficient to multiply into the signal before clipping.
  11285. Default to 1.0.
  11286. @item reinhard
  11287. Specify the local contrast coefficient at the display peak.
  11288. Default to 0.5, which means that in-gamut values will be about half as bright
  11289. as when clipping.
  11290. @item hable
  11291. Ignored.
  11292. @item mobius
  11293. Specify the transition point from linear to mobius transform. Every value
  11294. below this point is guaranteed to be mapped 1:1. The higher the value, the
  11295. more accurate the result will be, at the cost of losing bright details.
  11296. Default to 0.3, which due to the steep initial slope still preserves in-range
  11297. colors fairly accurately.
  11298. @end table
  11299. @item desat
  11300. Apply desaturation for highlights that exceed this level of brightness. The
  11301. higher the parameter, the more color information will be preserved. This
  11302. setting helps prevent unnaturally blown-out colors for super-highlights, by
  11303. (smoothly) turning into white instead. This makes images feel more natural,
  11304. at the cost of reducing information about out-of-range colors.
  11305. The default of 2.0 is somewhat conservative and will mostly just apply to
  11306. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  11307. This option works only if the input frame has a supported color tag.
  11308. @item peak
  11309. Override signal/nominal/reference peak with this value. Useful when the
  11310. embedded peak information in display metadata is not reliable or when tone
  11311. mapping from a lower range to a higher range.
  11312. @end table
  11313. @section transpose
  11314. Transpose rows with columns in the input video and optionally flip it.
  11315. It accepts the following parameters:
  11316. @table @option
  11317. @item dir
  11318. Specify the transposition direction.
  11319. Can assume the following values:
  11320. @table @samp
  11321. @item 0, 4, cclock_flip
  11322. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  11323. @example
  11324. L.R L.l
  11325. . . -> . .
  11326. l.r R.r
  11327. @end example
  11328. @item 1, 5, clock
  11329. Rotate by 90 degrees clockwise, that is:
  11330. @example
  11331. L.R l.L
  11332. . . -> . .
  11333. l.r r.R
  11334. @end example
  11335. @item 2, 6, cclock
  11336. Rotate by 90 degrees counterclockwise, that is:
  11337. @example
  11338. L.R R.r
  11339. . . -> . .
  11340. l.r L.l
  11341. @end example
  11342. @item 3, 7, clock_flip
  11343. Rotate by 90 degrees clockwise and vertically flip, that is:
  11344. @example
  11345. L.R r.R
  11346. . . -> . .
  11347. l.r l.L
  11348. @end example
  11349. @end table
  11350. For values between 4-7, the transposition is only done if the input
  11351. video geometry is portrait and not landscape. These values are
  11352. deprecated, the @code{passthrough} option should be used instead.
  11353. Numerical values are deprecated, and should be dropped in favor of
  11354. symbolic constants.
  11355. @item passthrough
  11356. Do not apply the transposition if the input geometry matches the one
  11357. specified by the specified value. It accepts the following values:
  11358. @table @samp
  11359. @item none
  11360. Always apply transposition.
  11361. @item portrait
  11362. Preserve portrait geometry (when @var{height} >= @var{width}).
  11363. @item landscape
  11364. Preserve landscape geometry (when @var{width} >= @var{height}).
  11365. @end table
  11366. Default value is @code{none}.
  11367. @end table
  11368. For example to rotate by 90 degrees clockwise and preserve portrait
  11369. layout:
  11370. @example
  11371. transpose=dir=1:passthrough=portrait
  11372. @end example
  11373. The command above can also be specified as:
  11374. @example
  11375. transpose=1:portrait
  11376. @end example
  11377. @section trim
  11378. Trim the input so that the output contains one continuous subpart of the input.
  11379. It accepts the following parameters:
  11380. @table @option
  11381. @item start
  11382. Specify the time of the start of the kept section, i.e. the frame with the
  11383. timestamp @var{start} will be the first frame in the output.
  11384. @item end
  11385. Specify the time of the first frame that will be dropped, i.e. the frame
  11386. immediately preceding the one with the timestamp @var{end} will be the last
  11387. frame in the output.
  11388. @item start_pts
  11389. This is the same as @var{start}, except this option sets the start timestamp
  11390. in timebase units instead of seconds.
  11391. @item end_pts
  11392. This is the same as @var{end}, except this option sets the end timestamp
  11393. in timebase units instead of seconds.
  11394. @item duration
  11395. The maximum duration of the output in seconds.
  11396. @item start_frame
  11397. The number of the first frame that should be passed to the output.
  11398. @item end_frame
  11399. The number of the first frame that should be dropped.
  11400. @end table
  11401. @option{start}, @option{end}, and @option{duration} are expressed as time
  11402. duration specifications; see
  11403. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11404. for the accepted syntax.
  11405. Note that the first two sets of the start/end options and the @option{duration}
  11406. option look at the frame timestamp, while the _frame variants simply count the
  11407. frames that pass through the filter. Also note that this filter does not modify
  11408. the timestamps. If you wish for the output timestamps to start at zero, insert a
  11409. setpts filter after the trim filter.
  11410. If multiple start or end options are set, this filter tries to be greedy and
  11411. keep all the frames that match at least one of the specified constraints. To keep
  11412. only the part that matches all the constraints at once, chain multiple trim
  11413. filters.
  11414. The defaults are such that all the input is kept. So it is possible to set e.g.
  11415. just the end values to keep everything before the specified time.
  11416. Examples:
  11417. @itemize
  11418. @item
  11419. Drop everything except the second minute of input:
  11420. @example
  11421. ffmpeg -i INPUT -vf trim=60:120
  11422. @end example
  11423. @item
  11424. Keep only the first second:
  11425. @example
  11426. ffmpeg -i INPUT -vf trim=duration=1
  11427. @end example
  11428. @end itemize
  11429. @section unpremultiply
  11430. Apply alpha unpremultiply effect to input video stream using first plane
  11431. of second stream as alpha.
  11432. Both streams must have same dimensions and same pixel format.
  11433. The filter accepts the following option:
  11434. @table @option
  11435. @item planes
  11436. Set which planes will be processed, unprocessed planes will be copied.
  11437. By default value 0xf, all planes will be processed.
  11438. If the format has 1 or 2 components, then luma is bit 0.
  11439. If the format has 3 or 4 components:
  11440. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  11441. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  11442. If present, the alpha channel is always the last bit.
  11443. @item inplace
  11444. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11445. @end table
  11446. @anchor{unsharp}
  11447. @section unsharp
  11448. Sharpen or blur the input video.
  11449. It accepts the following parameters:
  11450. @table @option
  11451. @item luma_msize_x, lx
  11452. Set the luma matrix horizontal size. It must be an odd integer between
  11453. 3 and 23. The default value is 5.
  11454. @item luma_msize_y, ly
  11455. Set the luma matrix vertical size. It must be an odd integer between 3
  11456. and 23. The default value is 5.
  11457. @item luma_amount, la
  11458. Set the luma effect strength. It must be a floating point number, reasonable
  11459. values lay between -1.5 and 1.5.
  11460. Negative values will blur the input video, while positive values will
  11461. sharpen it, a value of zero will disable the effect.
  11462. Default value is 1.0.
  11463. @item chroma_msize_x, cx
  11464. Set the chroma matrix horizontal size. It must be an odd integer
  11465. between 3 and 23. The default value is 5.
  11466. @item chroma_msize_y, cy
  11467. Set the chroma matrix vertical size. It must be an odd integer
  11468. between 3 and 23. The default value is 5.
  11469. @item chroma_amount, ca
  11470. Set the chroma effect strength. It must be a floating point number, reasonable
  11471. values lay between -1.5 and 1.5.
  11472. Negative values will blur the input video, while positive values will
  11473. sharpen it, a value of zero will disable the effect.
  11474. Default value is 0.0.
  11475. @item opencl
  11476. If set to 1, specify using OpenCL capabilities, only available if
  11477. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  11478. @end table
  11479. All parameters are optional and default to the equivalent of the
  11480. string '5:5:1.0:5:5:0.0'.
  11481. @subsection Examples
  11482. @itemize
  11483. @item
  11484. Apply strong luma sharpen effect:
  11485. @example
  11486. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  11487. @end example
  11488. @item
  11489. Apply a strong blur of both luma and chroma parameters:
  11490. @example
  11491. unsharp=7:7:-2:7:7:-2
  11492. @end example
  11493. @end itemize
  11494. @section uspp
  11495. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  11496. the image at several (or - in the case of @option{quality} level @code{8} - all)
  11497. shifts and average the results.
  11498. The way this differs from the behavior of spp is that uspp actually encodes &
  11499. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  11500. DCT similar to MJPEG.
  11501. The filter accepts the following options:
  11502. @table @option
  11503. @item quality
  11504. Set quality. This option defines the number of levels for averaging. It accepts
  11505. an integer in the range 0-8. If set to @code{0}, the filter will have no
  11506. effect. A value of @code{8} means the higher quality. For each increment of
  11507. that value the speed drops by a factor of approximately 2. Default value is
  11508. @code{3}.
  11509. @item qp
  11510. Force a constant quantization parameter. If not set, the filter will use the QP
  11511. from the video stream (if available).
  11512. @end table
  11513. @section vaguedenoiser
  11514. Apply a wavelet based denoiser.
  11515. It transforms each frame from the video input into the wavelet domain,
  11516. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  11517. the obtained coefficients. It does an inverse wavelet transform after.
  11518. Due to wavelet properties, it should give a nice smoothed result, and
  11519. reduced noise, without blurring picture features.
  11520. This filter accepts the following options:
  11521. @table @option
  11522. @item threshold
  11523. The filtering strength. The higher, the more filtered the video will be.
  11524. Hard thresholding can use a higher threshold than soft thresholding
  11525. before the video looks overfiltered. Default value is 2.
  11526. @item method
  11527. The filtering method the filter will use.
  11528. It accepts the following values:
  11529. @table @samp
  11530. @item hard
  11531. All values under the threshold will be zeroed.
  11532. @item soft
  11533. All values under the threshold will be zeroed. All values above will be
  11534. reduced by the threshold.
  11535. @item garrote
  11536. Scales or nullifies coefficients - intermediary between (more) soft and
  11537. (less) hard thresholding.
  11538. @end table
  11539. Default is garrote.
  11540. @item nsteps
  11541. Number of times, the wavelet will decompose the picture. Picture can't
  11542. be decomposed beyond a particular point (typically, 8 for a 640x480
  11543. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  11544. @item percent
  11545. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  11546. @item planes
  11547. A list of the planes to process. By default all planes are processed.
  11548. @end table
  11549. @section vectorscope
  11550. Display 2 color component values in the two dimensional graph (which is called
  11551. a vectorscope).
  11552. This filter accepts the following options:
  11553. @table @option
  11554. @item mode, m
  11555. Set vectorscope mode.
  11556. It accepts the following values:
  11557. @table @samp
  11558. @item gray
  11559. Gray values are displayed on graph, higher brightness means more pixels have
  11560. same component color value on location in graph. This is the default mode.
  11561. @item color
  11562. Gray values are displayed on graph. Surrounding pixels values which are not
  11563. present in video frame are drawn in gradient of 2 color components which are
  11564. set by option @code{x} and @code{y}. The 3rd color component is static.
  11565. @item color2
  11566. Actual color components values present in video frame are displayed on graph.
  11567. @item color3
  11568. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  11569. on graph increases value of another color component, which is luminance by
  11570. default values of @code{x} and @code{y}.
  11571. @item color4
  11572. Actual colors present in video frame are displayed on graph. If two different
  11573. colors map to same position on graph then color with higher value of component
  11574. not present in graph is picked.
  11575. @item color5
  11576. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  11577. component picked from radial gradient.
  11578. @end table
  11579. @item x
  11580. Set which color component will be represented on X-axis. Default is @code{1}.
  11581. @item y
  11582. Set which color component will be represented on Y-axis. Default is @code{2}.
  11583. @item intensity, i
  11584. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  11585. of color component which represents frequency of (X, Y) location in graph.
  11586. @item envelope, e
  11587. @table @samp
  11588. @item none
  11589. No envelope, this is default.
  11590. @item instant
  11591. Instant envelope, even darkest single pixel will be clearly highlighted.
  11592. @item peak
  11593. Hold maximum and minimum values presented in graph over time. This way you
  11594. can still spot out of range values without constantly looking at vectorscope.
  11595. @item peak+instant
  11596. Peak and instant envelope combined together.
  11597. @end table
  11598. @item graticule, g
  11599. Set what kind of graticule to draw.
  11600. @table @samp
  11601. @item none
  11602. @item green
  11603. @item color
  11604. @end table
  11605. @item opacity, o
  11606. Set graticule opacity.
  11607. @item flags, f
  11608. Set graticule flags.
  11609. @table @samp
  11610. @item white
  11611. Draw graticule for white point.
  11612. @item black
  11613. Draw graticule for black point.
  11614. @item name
  11615. Draw color points short names.
  11616. @end table
  11617. @item bgopacity, b
  11618. Set background opacity.
  11619. @item lthreshold, l
  11620. Set low threshold for color component not represented on X or Y axis.
  11621. Values lower than this value will be ignored. Default is 0.
  11622. Note this value is multiplied with actual max possible value one pixel component
  11623. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  11624. is 0.1 * 255 = 25.
  11625. @item hthreshold, h
  11626. Set high threshold for color component not represented on X or Y axis.
  11627. Values higher than this value will be ignored. Default is 1.
  11628. Note this value is multiplied with actual max possible value one pixel component
  11629. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  11630. is 0.9 * 255 = 230.
  11631. @item colorspace, c
  11632. Set what kind of colorspace to use when drawing graticule.
  11633. @table @samp
  11634. @item auto
  11635. @item 601
  11636. @item 709
  11637. @end table
  11638. Default is auto.
  11639. @end table
  11640. @anchor{vidstabdetect}
  11641. @section vidstabdetect
  11642. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  11643. @ref{vidstabtransform} for pass 2.
  11644. This filter generates a file with relative translation and rotation
  11645. transform information about subsequent frames, which is then used by
  11646. the @ref{vidstabtransform} filter.
  11647. To enable compilation of this filter you need to configure FFmpeg with
  11648. @code{--enable-libvidstab}.
  11649. This filter accepts the following options:
  11650. @table @option
  11651. @item result
  11652. Set the path to the file used to write the transforms information.
  11653. Default value is @file{transforms.trf}.
  11654. @item shakiness
  11655. Set how shaky the video is and how quick the camera is. It accepts an
  11656. integer in the range 1-10, a value of 1 means little shakiness, a
  11657. value of 10 means strong shakiness. Default value is 5.
  11658. @item accuracy
  11659. Set the accuracy of the detection process. It must be a value in the
  11660. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  11661. accuracy. Default value is 15.
  11662. @item stepsize
  11663. Set stepsize of the search process. The region around minimum is
  11664. scanned with 1 pixel resolution. Default value is 6.
  11665. @item mincontrast
  11666. Set minimum contrast. Below this value a local measurement field is
  11667. discarded. Must be a floating point value in the range 0-1. Default
  11668. value is 0.3.
  11669. @item tripod
  11670. Set reference frame number for tripod mode.
  11671. If enabled, the motion of the frames is compared to a reference frame
  11672. in the filtered stream, identified by the specified number. The idea
  11673. is to compensate all movements in a more-or-less static scene and keep
  11674. the camera view absolutely still.
  11675. If set to 0, it is disabled. The frames are counted starting from 1.
  11676. @item show
  11677. Show fields and transforms in the resulting frames. It accepts an
  11678. integer in the range 0-2. Default value is 0, which disables any
  11679. visualization.
  11680. @end table
  11681. @subsection Examples
  11682. @itemize
  11683. @item
  11684. Use default values:
  11685. @example
  11686. vidstabdetect
  11687. @end example
  11688. @item
  11689. Analyze strongly shaky movie and put the results in file
  11690. @file{mytransforms.trf}:
  11691. @example
  11692. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  11693. @end example
  11694. @item
  11695. Visualize the result of internal transformations in the resulting
  11696. video:
  11697. @example
  11698. vidstabdetect=show=1
  11699. @end example
  11700. @item
  11701. Analyze a video with medium shakiness using @command{ffmpeg}:
  11702. @example
  11703. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  11704. @end example
  11705. @end itemize
  11706. @anchor{vidstabtransform}
  11707. @section vidstabtransform
  11708. Video stabilization/deshaking: pass 2 of 2,
  11709. see @ref{vidstabdetect} for pass 1.
  11710. Read a file with transform information for each frame and
  11711. apply/compensate them. Together with the @ref{vidstabdetect}
  11712. filter this can be used to deshake videos. See also
  11713. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  11714. the @ref{unsharp} filter, see below.
  11715. To enable compilation of this filter you need to configure FFmpeg with
  11716. @code{--enable-libvidstab}.
  11717. @subsection Options
  11718. @table @option
  11719. @item input
  11720. Set path to the file used to read the transforms. Default value is
  11721. @file{transforms.trf}.
  11722. @item smoothing
  11723. Set the number of frames (value*2 + 1) used for lowpass filtering the
  11724. camera movements. Default value is 10.
  11725. For example a number of 10 means that 21 frames are used (10 in the
  11726. past and 10 in the future) to smoothen the motion in the video. A
  11727. larger value leads to a smoother video, but limits the acceleration of
  11728. the camera (pan/tilt movements). 0 is a special case where a static
  11729. camera is simulated.
  11730. @item optalgo
  11731. Set the camera path optimization algorithm.
  11732. Accepted values are:
  11733. @table @samp
  11734. @item gauss
  11735. gaussian kernel low-pass filter on camera motion (default)
  11736. @item avg
  11737. averaging on transformations
  11738. @end table
  11739. @item maxshift
  11740. Set maximal number of pixels to translate frames. Default value is -1,
  11741. meaning no limit.
  11742. @item maxangle
  11743. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  11744. value is -1, meaning no limit.
  11745. @item crop
  11746. Specify how to deal with borders that may be visible due to movement
  11747. compensation.
  11748. Available values are:
  11749. @table @samp
  11750. @item keep
  11751. keep image information from previous frame (default)
  11752. @item black
  11753. fill the border black
  11754. @end table
  11755. @item invert
  11756. Invert transforms if set to 1. Default value is 0.
  11757. @item relative
  11758. Consider transforms as relative to previous frame if set to 1,
  11759. absolute if set to 0. Default value is 0.
  11760. @item zoom
  11761. Set percentage to zoom. A positive value will result in a zoom-in
  11762. effect, a negative value in a zoom-out effect. Default value is 0 (no
  11763. zoom).
  11764. @item optzoom
  11765. Set optimal zooming to avoid borders.
  11766. Accepted values are:
  11767. @table @samp
  11768. @item 0
  11769. disabled
  11770. @item 1
  11771. optimal static zoom value is determined (only very strong movements
  11772. will lead to visible borders) (default)
  11773. @item 2
  11774. optimal adaptive zoom value is determined (no borders will be
  11775. visible), see @option{zoomspeed}
  11776. @end table
  11777. Note that the value given at zoom is added to the one calculated here.
  11778. @item zoomspeed
  11779. Set percent to zoom maximally each frame (enabled when
  11780. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  11781. 0.25.
  11782. @item interpol
  11783. Specify type of interpolation.
  11784. Available values are:
  11785. @table @samp
  11786. @item no
  11787. no interpolation
  11788. @item linear
  11789. linear only horizontal
  11790. @item bilinear
  11791. linear in both directions (default)
  11792. @item bicubic
  11793. cubic in both directions (slow)
  11794. @end table
  11795. @item tripod
  11796. Enable virtual tripod mode if set to 1, which is equivalent to
  11797. @code{relative=0:smoothing=0}. Default value is 0.
  11798. Use also @code{tripod} option of @ref{vidstabdetect}.
  11799. @item debug
  11800. Increase log verbosity if set to 1. Also the detected global motions
  11801. are written to the temporary file @file{global_motions.trf}. Default
  11802. value is 0.
  11803. @end table
  11804. @subsection Examples
  11805. @itemize
  11806. @item
  11807. Use @command{ffmpeg} for a typical stabilization with default values:
  11808. @example
  11809. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  11810. @end example
  11811. Note the use of the @ref{unsharp} filter which is always recommended.
  11812. @item
  11813. Zoom in a bit more and load transform data from a given file:
  11814. @example
  11815. vidstabtransform=zoom=5:input="mytransforms.trf"
  11816. @end example
  11817. @item
  11818. Smoothen the video even more:
  11819. @example
  11820. vidstabtransform=smoothing=30
  11821. @end example
  11822. @end itemize
  11823. @section vflip
  11824. Flip the input video vertically.
  11825. For example, to vertically flip a video with @command{ffmpeg}:
  11826. @example
  11827. ffmpeg -i in.avi -vf "vflip" out.avi
  11828. @end example
  11829. @anchor{vignette}
  11830. @section vignette
  11831. Make or reverse a natural vignetting effect.
  11832. The filter accepts the following options:
  11833. @table @option
  11834. @item angle, a
  11835. Set lens angle expression as a number of radians.
  11836. The value is clipped in the @code{[0,PI/2]} range.
  11837. Default value: @code{"PI/5"}
  11838. @item x0
  11839. @item y0
  11840. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  11841. by default.
  11842. @item mode
  11843. Set forward/backward mode.
  11844. Available modes are:
  11845. @table @samp
  11846. @item forward
  11847. The larger the distance from the central point, the darker the image becomes.
  11848. @item backward
  11849. The larger the distance from the central point, the brighter the image becomes.
  11850. This can be used to reverse a vignette effect, though there is no automatic
  11851. detection to extract the lens @option{angle} and other settings (yet). It can
  11852. also be used to create a burning effect.
  11853. @end table
  11854. Default value is @samp{forward}.
  11855. @item eval
  11856. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  11857. It accepts the following values:
  11858. @table @samp
  11859. @item init
  11860. Evaluate expressions only once during the filter initialization.
  11861. @item frame
  11862. Evaluate expressions for each incoming frame. This is way slower than the
  11863. @samp{init} mode since it requires all the scalers to be re-computed, but it
  11864. allows advanced dynamic expressions.
  11865. @end table
  11866. Default value is @samp{init}.
  11867. @item dither
  11868. Set dithering to reduce the circular banding effects. Default is @code{1}
  11869. (enabled).
  11870. @item aspect
  11871. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  11872. Setting this value to the SAR of the input will make a rectangular vignetting
  11873. following the dimensions of the video.
  11874. Default is @code{1/1}.
  11875. @end table
  11876. @subsection Expressions
  11877. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  11878. following parameters.
  11879. @table @option
  11880. @item w
  11881. @item h
  11882. input width and height
  11883. @item n
  11884. the number of input frame, starting from 0
  11885. @item pts
  11886. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  11887. @var{TB} units, NAN if undefined
  11888. @item r
  11889. frame rate of the input video, NAN if the input frame rate is unknown
  11890. @item t
  11891. the PTS (Presentation TimeStamp) of the filtered video frame,
  11892. expressed in seconds, NAN if undefined
  11893. @item tb
  11894. time base of the input video
  11895. @end table
  11896. @subsection Examples
  11897. @itemize
  11898. @item
  11899. Apply simple strong vignetting effect:
  11900. @example
  11901. vignette=PI/4
  11902. @end example
  11903. @item
  11904. Make a flickering vignetting:
  11905. @example
  11906. vignette='PI/4+random(1)*PI/50':eval=frame
  11907. @end example
  11908. @end itemize
  11909. @section vmafmotion
  11910. Obtain the average vmaf motion score of a video.
  11911. It is one of the component filters of VMAF.
  11912. The obtained average motion score is printed through the logging system.
  11913. In the below example the input file @file{ref.mpg} is being processed and score
  11914. is computed.
  11915. @example
  11916. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  11917. @end example
  11918. @section vstack
  11919. Stack input videos vertically.
  11920. All streams must be of same pixel format and of same width.
  11921. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  11922. to create same output.
  11923. The filter accept the following option:
  11924. @table @option
  11925. @item inputs
  11926. Set number of input streams. Default is 2.
  11927. @item shortest
  11928. If set to 1, force the output to terminate when the shortest input
  11929. terminates. Default value is 0.
  11930. @end table
  11931. @section w3fdif
  11932. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  11933. Deinterlacing Filter").
  11934. Based on the process described by Martin Weston for BBC R&D, and
  11935. implemented based on the de-interlace algorithm written by Jim
  11936. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  11937. uses filter coefficients calculated by BBC R&D.
  11938. There are two sets of filter coefficients, so called "simple":
  11939. and "complex". Which set of filter coefficients is used can
  11940. be set by passing an optional parameter:
  11941. @table @option
  11942. @item filter
  11943. Set the interlacing filter coefficients. Accepts one of the following values:
  11944. @table @samp
  11945. @item simple
  11946. Simple filter coefficient set.
  11947. @item complex
  11948. More-complex filter coefficient set.
  11949. @end table
  11950. Default value is @samp{complex}.
  11951. @item deint
  11952. Specify which frames to deinterlace. Accept one of the following values:
  11953. @table @samp
  11954. @item all
  11955. Deinterlace all frames,
  11956. @item interlaced
  11957. Only deinterlace frames marked as interlaced.
  11958. @end table
  11959. Default value is @samp{all}.
  11960. @end table
  11961. @section waveform
  11962. Video waveform monitor.
  11963. The waveform monitor plots color component intensity. By default luminance
  11964. only. Each column of the waveform corresponds to a column of pixels in the
  11965. source video.
  11966. It accepts the following options:
  11967. @table @option
  11968. @item mode, m
  11969. Can be either @code{row}, or @code{column}. Default is @code{column}.
  11970. In row mode, the graph on the left side represents color component value 0 and
  11971. the right side represents value = 255. In column mode, the top side represents
  11972. color component value = 0 and bottom side represents value = 255.
  11973. @item intensity, i
  11974. Set intensity. Smaller values are useful to find out how many values of the same
  11975. luminance are distributed across input rows/columns.
  11976. Default value is @code{0.04}. Allowed range is [0, 1].
  11977. @item mirror, r
  11978. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  11979. In mirrored mode, higher values will be represented on the left
  11980. side for @code{row} mode and at the top for @code{column} mode. Default is
  11981. @code{1} (mirrored).
  11982. @item display, d
  11983. Set display mode.
  11984. It accepts the following values:
  11985. @table @samp
  11986. @item overlay
  11987. Presents information identical to that in the @code{parade}, except
  11988. that the graphs representing color components are superimposed directly
  11989. over one another.
  11990. This display mode makes it easier to spot relative differences or similarities
  11991. in overlapping areas of the color components that are supposed to be identical,
  11992. such as neutral whites, grays, or blacks.
  11993. @item stack
  11994. Display separate graph for the color components side by side in
  11995. @code{row} mode or one below the other in @code{column} mode.
  11996. @item parade
  11997. Display separate graph for the color components side by side in
  11998. @code{column} mode or one below the other in @code{row} mode.
  11999. Using this display mode makes it easy to spot color casts in the highlights
  12000. and shadows of an image, by comparing the contours of the top and the bottom
  12001. graphs of each waveform. Since whites, grays, and blacks are characterized
  12002. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  12003. should display three waveforms of roughly equal width/height. If not, the
  12004. correction is easy to perform by making level adjustments the three waveforms.
  12005. @end table
  12006. Default is @code{stack}.
  12007. @item components, c
  12008. Set which color components to display. Default is 1, which means only luminance
  12009. or red color component if input is in RGB colorspace. If is set for example to
  12010. 7 it will display all 3 (if) available color components.
  12011. @item envelope, e
  12012. @table @samp
  12013. @item none
  12014. No envelope, this is default.
  12015. @item instant
  12016. Instant envelope, minimum and maximum values presented in graph will be easily
  12017. visible even with small @code{step} value.
  12018. @item peak
  12019. Hold minimum and maximum values presented in graph across time. This way you
  12020. can still spot out of range values without constantly looking at waveforms.
  12021. @item peak+instant
  12022. Peak and instant envelope combined together.
  12023. @end table
  12024. @item filter, f
  12025. @table @samp
  12026. @item lowpass
  12027. No filtering, this is default.
  12028. @item flat
  12029. Luma and chroma combined together.
  12030. @item aflat
  12031. Similar as above, but shows difference between blue and red chroma.
  12032. @item chroma
  12033. Displays only chroma.
  12034. @item color
  12035. Displays actual color value on waveform.
  12036. @item acolor
  12037. Similar as above, but with luma showing frequency of chroma values.
  12038. @end table
  12039. @item graticule, g
  12040. Set which graticule to display.
  12041. @table @samp
  12042. @item none
  12043. Do not display graticule.
  12044. @item green
  12045. Display green graticule showing legal broadcast ranges.
  12046. @end table
  12047. @item opacity, o
  12048. Set graticule opacity.
  12049. @item flags, fl
  12050. Set graticule flags.
  12051. @table @samp
  12052. @item numbers
  12053. Draw numbers above lines. By default enabled.
  12054. @item dots
  12055. Draw dots instead of lines.
  12056. @end table
  12057. @item scale, s
  12058. Set scale used for displaying graticule.
  12059. @table @samp
  12060. @item digital
  12061. @item millivolts
  12062. @item ire
  12063. @end table
  12064. Default is digital.
  12065. @item bgopacity, b
  12066. Set background opacity.
  12067. @end table
  12068. @section weave, doubleweave
  12069. The @code{weave} takes a field-based video input and join
  12070. each two sequential fields into single frame, producing a new double
  12071. height clip with half the frame rate and half the frame count.
  12072. The @code{doubleweave} works same as @code{weave} but without
  12073. halving frame rate and frame count.
  12074. It accepts the following option:
  12075. @table @option
  12076. @item first_field
  12077. Set first field. Available values are:
  12078. @table @samp
  12079. @item top, t
  12080. Set the frame as top-field-first.
  12081. @item bottom, b
  12082. Set the frame as bottom-field-first.
  12083. @end table
  12084. @end table
  12085. @subsection Examples
  12086. @itemize
  12087. @item
  12088. Interlace video using @ref{select} and @ref{separatefields} filter:
  12089. @example
  12090. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  12091. @end example
  12092. @end itemize
  12093. @section xbr
  12094. Apply the xBR high-quality magnification filter which is designed for pixel
  12095. art. It follows a set of edge-detection rules, see
  12096. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  12097. It accepts the following option:
  12098. @table @option
  12099. @item n
  12100. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  12101. @code{3xBR} and @code{4} for @code{4xBR}.
  12102. Default is @code{3}.
  12103. @end table
  12104. @anchor{yadif}
  12105. @section yadif
  12106. Deinterlace the input video ("yadif" means "yet another deinterlacing
  12107. filter").
  12108. It accepts the following parameters:
  12109. @table @option
  12110. @item mode
  12111. The interlacing mode to adopt. It accepts one of the following values:
  12112. @table @option
  12113. @item 0, send_frame
  12114. Output one frame for each frame.
  12115. @item 1, send_field
  12116. Output one frame for each field.
  12117. @item 2, send_frame_nospatial
  12118. Like @code{send_frame}, but it skips the spatial interlacing check.
  12119. @item 3, send_field_nospatial
  12120. Like @code{send_field}, but it skips the spatial interlacing check.
  12121. @end table
  12122. The default value is @code{send_frame}.
  12123. @item parity
  12124. The picture field parity assumed for the input interlaced video. It accepts one
  12125. of the following values:
  12126. @table @option
  12127. @item 0, tff
  12128. Assume the top field is first.
  12129. @item 1, bff
  12130. Assume the bottom field is first.
  12131. @item -1, auto
  12132. Enable automatic detection of field parity.
  12133. @end table
  12134. The default value is @code{auto}.
  12135. If the interlacing is unknown or the decoder does not export this information,
  12136. top field first will be assumed.
  12137. @item deint
  12138. Specify which frames to deinterlace. Accept one of the following
  12139. values:
  12140. @table @option
  12141. @item 0, all
  12142. Deinterlace all frames.
  12143. @item 1, interlaced
  12144. Only deinterlace frames marked as interlaced.
  12145. @end table
  12146. The default value is @code{all}.
  12147. @end table
  12148. @section zoompan
  12149. Apply Zoom & Pan effect.
  12150. This filter accepts the following options:
  12151. @table @option
  12152. @item zoom, z
  12153. Set the zoom expression. Default is 1.
  12154. @item x
  12155. @item y
  12156. Set the x and y expression. Default is 0.
  12157. @item d
  12158. Set the duration expression in number of frames.
  12159. This sets for how many number of frames effect will last for
  12160. single input image.
  12161. @item s
  12162. Set the output image size, default is 'hd720'.
  12163. @item fps
  12164. Set the output frame rate, default is '25'.
  12165. @end table
  12166. Each expression can contain the following constants:
  12167. @table @option
  12168. @item in_w, iw
  12169. Input width.
  12170. @item in_h, ih
  12171. Input height.
  12172. @item out_w, ow
  12173. Output width.
  12174. @item out_h, oh
  12175. Output height.
  12176. @item in
  12177. Input frame count.
  12178. @item on
  12179. Output frame count.
  12180. @item x
  12181. @item y
  12182. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  12183. for current input frame.
  12184. @item px
  12185. @item py
  12186. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  12187. not yet such frame (first input frame).
  12188. @item zoom
  12189. Last calculated zoom from 'z' expression for current input frame.
  12190. @item pzoom
  12191. Last calculated zoom of last output frame of previous input frame.
  12192. @item duration
  12193. Number of output frames for current input frame. Calculated from 'd' expression
  12194. for each input frame.
  12195. @item pduration
  12196. number of output frames created for previous input frame
  12197. @item a
  12198. Rational number: input width / input height
  12199. @item sar
  12200. sample aspect ratio
  12201. @item dar
  12202. display aspect ratio
  12203. @end table
  12204. @subsection Examples
  12205. @itemize
  12206. @item
  12207. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  12208. @example
  12209. 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
  12210. @end example
  12211. @item
  12212. Zoom-in up to 1.5 and pan always at center of picture:
  12213. @example
  12214. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12215. @end example
  12216. @item
  12217. Same as above but without pausing:
  12218. @example
  12219. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12220. @end example
  12221. @end itemize
  12222. @anchor{zscale}
  12223. @section zscale
  12224. Scale (resize) the input video, using the z.lib library:
  12225. https://github.com/sekrit-twc/zimg.
  12226. The zscale filter forces the output display aspect ratio to be the same
  12227. as the input, by changing the output sample aspect ratio.
  12228. If the input image format is different from the format requested by
  12229. the next filter, the zscale filter will convert the input to the
  12230. requested format.
  12231. @subsection Options
  12232. The filter accepts the following options.
  12233. @table @option
  12234. @item width, w
  12235. @item height, h
  12236. Set the output video dimension expression. Default value is the input
  12237. dimension.
  12238. If the @var{width} or @var{w} value is 0, the input width is used for
  12239. the output. If the @var{height} or @var{h} value is 0, the input height
  12240. is used for the output.
  12241. If one and only one of the values is -n with n >= 1, the zscale filter
  12242. will use a value that maintains the aspect ratio of the input image,
  12243. calculated from the other specified dimension. After that it will,
  12244. however, make sure that the calculated dimension is divisible by n and
  12245. adjust the value if necessary.
  12246. If both values are -n with n >= 1, the behavior will be identical to
  12247. both values being set to 0 as previously detailed.
  12248. See below for the list of accepted constants for use in the dimension
  12249. expression.
  12250. @item size, s
  12251. Set the video size. For the syntax of this option, check the
  12252. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12253. @item dither, d
  12254. Set the dither type.
  12255. Possible values are:
  12256. @table @var
  12257. @item none
  12258. @item ordered
  12259. @item random
  12260. @item error_diffusion
  12261. @end table
  12262. Default is none.
  12263. @item filter, f
  12264. Set the resize filter type.
  12265. Possible values are:
  12266. @table @var
  12267. @item point
  12268. @item bilinear
  12269. @item bicubic
  12270. @item spline16
  12271. @item spline36
  12272. @item lanczos
  12273. @end table
  12274. Default is bilinear.
  12275. @item range, r
  12276. Set the color range.
  12277. Possible values are:
  12278. @table @var
  12279. @item input
  12280. @item limited
  12281. @item full
  12282. @end table
  12283. Default is same as input.
  12284. @item primaries, p
  12285. Set the color primaries.
  12286. Possible values are:
  12287. @table @var
  12288. @item input
  12289. @item 709
  12290. @item unspecified
  12291. @item 170m
  12292. @item 240m
  12293. @item 2020
  12294. @end table
  12295. Default is same as input.
  12296. @item transfer, t
  12297. Set the transfer characteristics.
  12298. Possible values are:
  12299. @table @var
  12300. @item input
  12301. @item 709
  12302. @item unspecified
  12303. @item 601
  12304. @item linear
  12305. @item 2020_10
  12306. @item 2020_12
  12307. @item smpte2084
  12308. @item iec61966-2-1
  12309. @item arib-std-b67
  12310. @end table
  12311. Default is same as input.
  12312. @item matrix, m
  12313. Set the colorspace matrix.
  12314. Possible value are:
  12315. @table @var
  12316. @item input
  12317. @item 709
  12318. @item unspecified
  12319. @item 470bg
  12320. @item 170m
  12321. @item 2020_ncl
  12322. @item 2020_cl
  12323. @end table
  12324. Default is same as input.
  12325. @item rangein, rin
  12326. Set the input color range.
  12327. Possible values are:
  12328. @table @var
  12329. @item input
  12330. @item limited
  12331. @item full
  12332. @end table
  12333. Default is same as input.
  12334. @item primariesin, pin
  12335. Set the input color primaries.
  12336. Possible values are:
  12337. @table @var
  12338. @item input
  12339. @item 709
  12340. @item unspecified
  12341. @item 170m
  12342. @item 240m
  12343. @item 2020
  12344. @end table
  12345. Default is same as input.
  12346. @item transferin, tin
  12347. Set the input transfer characteristics.
  12348. Possible values are:
  12349. @table @var
  12350. @item input
  12351. @item 709
  12352. @item unspecified
  12353. @item 601
  12354. @item linear
  12355. @item 2020_10
  12356. @item 2020_12
  12357. @end table
  12358. Default is same as input.
  12359. @item matrixin, min
  12360. Set the input colorspace matrix.
  12361. Possible value are:
  12362. @table @var
  12363. @item input
  12364. @item 709
  12365. @item unspecified
  12366. @item 470bg
  12367. @item 170m
  12368. @item 2020_ncl
  12369. @item 2020_cl
  12370. @end table
  12371. @item chromal, c
  12372. Set the output chroma location.
  12373. Possible values are:
  12374. @table @var
  12375. @item input
  12376. @item left
  12377. @item center
  12378. @item topleft
  12379. @item top
  12380. @item bottomleft
  12381. @item bottom
  12382. @end table
  12383. @item chromalin, cin
  12384. Set the input chroma location.
  12385. Possible values are:
  12386. @table @var
  12387. @item input
  12388. @item left
  12389. @item center
  12390. @item topleft
  12391. @item top
  12392. @item bottomleft
  12393. @item bottom
  12394. @end table
  12395. @item npl
  12396. Set the nominal peak luminance.
  12397. @end table
  12398. The values of the @option{w} and @option{h} options are expressions
  12399. containing the following constants:
  12400. @table @var
  12401. @item in_w
  12402. @item in_h
  12403. The input width and height
  12404. @item iw
  12405. @item ih
  12406. These are the same as @var{in_w} and @var{in_h}.
  12407. @item out_w
  12408. @item out_h
  12409. The output (scaled) width and height
  12410. @item ow
  12411. @item oh
  12412. These are the same as @var{out_w} and @var{out_h}
  12413. @item a
  12414. The same as @var{iw} / @var{ih}
  12415. @item sar
  12416. input sample aspect ratio
  12417. @item dar
  12418. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12419. @item hsub
  12420. @item vsub
  12421. horizontal and vertical input chroma subsample values. For example for the
  12422. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12423. @item ohsub
  12424. @item ovsub
  12425. horizontal and vertical output chroma subsample values. For example for the
  12426. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12427. @end table
  12428. @table @option
  12429. @end table
  12430. @c man end VIDEO FILTERS
  12431. @chapter Video Sources
  12432. @c man begin VIDEO SOURCES
  12433. Below is a description of the currently available video sources.
  12434. @section buffer
  12435. Buffer video frames, and make them available to the filter chain.
  12436. This source is mainly intended for a programmatic use, in particular
  12437. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  12438. It accepts the following parameters:
  12439. @table @option
  12440. @item video_size
  12441. Specify the size (width and height) of the buffered video frames. For the
  12442. syntax of this option, check the
  12443. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12444. @item width
  12445. The input video width.
  12446. @item height
  12447. The input video height.
  12448. @item pix_fmt
  12449. A string representing the pixel format of the buffered video frames.
  12450. It may be a number corresponding to a pixel format, or a pixel format
  12451. name.
  12452. @item time_base
  12453. Specify the timebase assumed by the timestamps of the buffered frames.
  12454. @item frame_rate
  12455. Specify the frame rate expected for the video stream.
  12456. @item pixel_aspect, sar
  12457. The sample (pixel) aspect ratio of the input video.
  12458. @item sws_param
  12459. Specify the optional parameters to be used for the scale filter which
  12460. is automatically inserted when an input change is detected in the
  12461. input size or format.
  12462. @item hw_frames_ctx
  12463. When using a hardware pixel format, this should be a reference to an
  12464. AVHWFramesContext describing input frames.
  12465. @end table
  12466. For example:
  12467. @example
  12468. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  12469. @end example
  12470. will instruct the source to accept video frames with size 320x240 and
  12471. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  12472. square pixels (1:1 sample aspect ratio).
  12473. Since the pixel format with name "yuv410p" corresponds to the number 6
  12474. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  12475. this example corresponds to:
  12476. @example
  12477. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  12478. @end example
  12479. Alternatively, the options can be specified as a flat string, but this
  12480. syntax is deprecated:
  12481. @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}]
  12482. @section cellauto
  12483. Create a pattern generated by an elementary cellular automaton.
  12484. The initial state of the cellular automaton can be defined through the
  12485. @option{filename} and @option{pattern} options. If such options are
  12486. not specified an initial state is created randomly.
  12487. At each new frame a new row in the video is filled with the result of
  12488. the cellular automaton next generation. The behavior when the whole
  12489. frame is filled is defined by the @option{scroll} option.
  12490. This source accepts the following options:
  12491. @table @option
  12492. @item filename, f
  12493. Read the initial cellular automaton state, i.e. the starting row, from
  12494. the specified file.
  12495. In the file, each non-whitespace character is considered an alive
  12496. cell, a newline will terminate the row, and further characters in the
  12497. file will be ignored.
  12498. @item pattern, p
  12499. Read the initial cellular automaton state, i.e. the starting row, from
  12500. the specified string.
  12501. Each non-whitespace character in the string is considered an alive
  12502. cell, a newline will terminate the row, and further characters in the
  12503. string will be ignored.
  12504. @item rate, r
  12505. Set the video rate, that is the number of frames generated per second.
  12506. Default is 25.
  12507. @item random_fill_ratio, ratio
  12508. Set the random fill ratio for the initial cellular automaton row. It
  12509. is a floating point number value ranging from 0 to 1, defaults to
  12510. 1/PHI.
  12511. This option is ignored when a file or a pattern is specified.
  12512. @item random_seed, seed
  12513. Set the seed for filling randomly the initial row, must be an integer
  12514. included between 0 and UINT32_MAX. If not specified, or if explicitly
  12515. set to -1, the filter will try to use a good random seed on a best
  12516. effort basis.
  12517. @item rule
  12518. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  12519. Default value is 110.
  12520. @item size, s
  12521. Set the size of the output video. For the syntax of this option, check the
  12522. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12523. If @option{filename} or @option{pattern} is specified, the size is set
  12524. by default to the width of the specified initial state row, and the
  12525. height is set to @var{width} * PHI.
  12526. If @option{size} is set, it must contain the width of the specified
  12527. pattern string, and the specified pattern will be centered in the
  12528. larger row.
  12529. If a filename or a pattern string is not specified, the size value
  12530. defaults to "320x518" (used for a randomly generated initial state).
  12531. @item scroll
  12532. If set to 1, scroll the output upward when all the rows in the output
  12533. have been already filled. If set to 0, the new generated row will be
  12534. written over the top row just after the bottom row is filled.
  12535. Defaults to 1.
  12536. @item start_full, full
  12537. If set to 1, completely fill the output with generated rows before
  12538. outputting the first frame.
  12539. This is the default behavior, for disabling set the value to 0.
  12540. @item stitch
  12541. If set to 1, stitch the left and right row edges together.
  12542. This is the default behavior, for disabling set the value to 0.
  12543. @end table
  12544. @subsection Examples
  12545. @itemize
  12546. @item
  12547. Read the initial state from @file{pattern}, and specify an output of
  12548. size 200x400.
  12549. @example
  12550. cellauto=f=pattern:s=200x400
  12551. @end example
  12552. @item
  12553. Generate a random initial row with a width of 200 cells, with a fill
  12554. ratio of 2/3:
  12555. @example
  12556. cellauto=ratio=2/3:s=200x200
  12557. @end example
  12558. @item
  12559. Create a pattern generated by rule 18 starting by a single alive cell
  12560. centered on an initial row with width 100:
  12561. @example
  12562. cellauto=p=@@:s=100x400:full=0:rule=18
  12563. @end example
  12564. @item
  12565. Specify a more elaborated initial pattern:
  12566. @example
  12567. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  12568. @end example
  12569. @end itemize
  12570. @anchor{coreimagesrc}
  12571. @section coreimagesrc
  12572. Video source generated on GPU using Apple's CoreImage API on OSX.
  12573. This video source is a specialized version of the @ref{coreimage} video filter.
  12574. Use a core image generator at the beginning of the applied filterchain to
  12575. generate the content.
  12576. The coreimagesrc video source accepts the following options:
  12577. @table @option
  12578. @item list_generators
  12579. List all available generators along with all their respective options as well as
  12580. possible minimum and maximum values along with the default values.
  12581. @example
  12582. list_generators=true
  12583. @end example
  12584. @item size, s
  12585. Specify the size of the sourced video. For the syntax of this option, check the
  12586. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12587. The default value is @code{320x240}.
  12588. @item rate, r
  12589. Specify the frame rate of the sourced video, as the number of frames
  12590. generated per second. It has to be a string in the format
  12591. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12592. number or a valid video frame rate abbreviation. The default value is
  12593. "25".
  12594. @item sar
  12595. Set the sample aspect ratio of the sourced video.
  12596. @item duration, d
  12597. Set the duration of the sourced video. See
  12598. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12599. for the accepted syntax.
  12600. If not specified, or the expressed duration is negative, the video is
  12601. supposed to be generated forever.
  12602. @end table
  12603. Additionally, all options of the @ref{coreimage} video filter are accepted.
  12604. A complete filterchain can be used for further processing of the
  12605. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  12606. and examples for details.
  12607. @subsection Examples
  12608. @itemize
  12609. @item
  12610. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  12611. given as complete and escaped command-line for Apple's standard bash shell:
  12612. @example
  12613. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  12614. @end example
  12615. This example is equivalent to the QRCode example of @ref{coreimage} without the
  12616. need for a nullsrc video source.
  12617. @end itemize
  12618. @section mandelbrot
  12619. Generate a Mandelbrot set fractal, and progressively zoom towards the
  12620. point specified with @var{start_x} and @var{start_y}.
  12621. This source accepts the following options:
  12622. @table @option
  12623. @item end_pts
  12624. Set the terminal pts value. Default value is 400.
  12625. @item end_scale
  12626. Set the terminal scale value.
  12627. Must be a floating point value. Default value is 0.3.
  12628. @item inner
  12629. Set the inner coloring mode, that is the algorithm used to draw the
  12630. Mandelbrot fractal internal region.
  12631. It shall assume one of the following values:
  12632. @table @option
  12633. @item black
  12634. Set black mode.
  12635. @item convergence
  12636. Show time until convergence.
  12637. @item mincol
  12638. Set color based on point closest to the origin of the iterations.
  12639. @item period
  12640. Set period mode.
  12641. @end table
  12642. Default value is @var{mincol}.
  12643. @item bailout
  12644. Set the bailout value. Default value is 10.0.
  12645. @item maxiter
  12646. Set the maximum of iterations performed by the rendering
  12647. algorithm. Default value is 7189.
  12648. @item outer
  12649. Set outer coloring mode.
  12650. It shall assume one of following values:
  12651. @table @option
  12652. @item iteration_count
  12653. Set iteration cound mode.
  12654. @item normalized_iteration_count
  12655. set normalized iteration count mode.
  12656. @end table
  12657. Default value is @var{normalized_iteration_count}.
  12658. @item rate, r
  12659. Set frame rate, expressed as number of frames per second. Default
  12660. value is "25".
  12661. @item size, s
  12662. Set frame size. For the syntax of this option, check the "Video
  12663. size" section in the ffmpeg-utils manual. Default value is "640x480".
  12664. @item start_scale
  12665. Set the initial scale value. Default value is 3.0.
  12666. @item start_x
  12667. Set the initial x position. Must be a floating point value between
  12668. -100 and 100. Default value is -0.743643887037158704752191506114774.
  12669. @item start_y
  12670. Set the initial y position. Must be a floating point value between
  12671. -100 and 100. Default value is -0.131825904205311970493132056385139.
  12672. @end table
  12673. @section mptestsrc
  12674. Generate various test patterns, as generated by the MPlayer test filter.
  12675. The size of the generated video is fixed, and is 256x256.
  12676. This source is useful in particular for testing encoding features.
  12677. This source accepts the following options:
  12678. @table @option
  12679. @item rate, r
  12680. Specify the frame rate of the sourced video, as the number of frames
  12681. generated per second. It has to be a string in the format
  12682. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12683. number or a valid video frame rate abbreviation. The default value is
  12684. "25".
  12685. @item duration, d
  12686. Set the duration of the sourced video. See
  12687. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12688. for the accepted syntax.
  12689. If not specified, or the expressed duration is negative, the video is
  12690. supposed to be generated forever.
  12691. @item test, t
  12692. Set the number or the name of the test to perform. Supported tests are:
  12693. @table @option
  12694. @item dc_luma
  12695. @item dc_chroma
  12696. @item freq_luma
  12697. @item freq_chroma
  12698. @item amp_luma
  12699. @item amp_chroma
  12700. @item cbp
  12701. @item mv
  12702. @item ring1
  12703. @item ring2
  12704. @item all
  12705. @end table
  12706. Default value is "all", which will cycle through the list of all tests.
  12707. @end table
  12708. Some examples:
  12709. @example
  12710. mptestsrc=t=dc_luma
  12711. @end example
  12712. will generate a "dc_luma" test pattern.
  12713. @section frei0r_src
  12714. Provide a frei0r source.
  12715. To enable compilation of this filter you need to install the frei0r
  12716. header and configure FFmpeg with @code{--enable-frei0r}.
  12717. This source accepts the following parameters:
  12718. @table @option
  12719. @item size
  12720. The size of the video to generate. For the syntax of this option, check the
  12721. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12722. @item framerate
  12723. The framerate of the generated video. It may be a string of the form
  12724. @var{num}/@var{den} or a frame rate abbreviation.
  12725. @item filter_name
  12726. The name to the frei0r source to load. For more information regarding frei0r and
  12727. how to set the parameters, read the @ref{frei0r} section in the video filters
  12728. documentation.
  12729. @item filter_params
  12730. A '|'-separated list of parameters to pass to the frei0r source.
  12731. @end table
  12732. For example, to generate a frei0r partik0l source with size 200x200
  12733. and frame rate 10 which is overlaid on the overlay filter main input:
  12734. @example
  12735. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  12736. @end example
  12737. @section life
  12738. Generate a life pattern.
  12739. This source is based on a generalization of John Conway's life game.
  12740. The sourced input represents a life grid, each pixel represents a cell
  12741. which can be in one of two possible states, alive or dead. Every cell
  12742. interacts with its eight neighbours, which are the cells that are
  12743. horizontally, vertically, or diagonally adjacent.
  12744. At each interaction the grid evolves according to the adopted rule,
  12745. which specifies the number of neighbor alive cells which will make a
  12746. cell stay alive or born. The @option{rule} option allows one to specify
  12747. the rule to adopt.
  12748. This source accepts the following options:
  12749. @table @option
  12750. @item filename, f
  12751. Set the file from which to read the initial grid state. In the file,
  12752. each non-whitespace character is considered an alive cell, and newline
  12753. is used to delimit the end of each row.
  12754. If this option is not specified, the initial grid is generated
  12755. randomly.
  12756. @item rate, r
  12757. Set the video rate, that is the number of frames generated per second.
  12758. Default is 25.
  12759. @item random_fill_ratio, ratio
  12760. Set the random fill ratio for the initial random grid. It is a
  12761. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  12762. It is ignored when a file is specified.
  12763. @item random_seed, seed
  12764. Set the seed for filling the initial random grid, must be an integer
  12765. included between 0 and UINT32_MAX. If not specified, or if explicitly
  12766. set to -1, the filter will try to use a good random seed on a best
  12767. effort basis.
  12768. @item rule
  12769. Set the life rule.
  12770. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  12771. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  12772. @var{NS} specifies the number of alive neighbor cells which make a
  12773. live cell stay alive, and @var{NB} the number of alive neighbor cells
  12774. which make a dead cell to become alive (i.e. to "born").
  12775. "s" and "b" can be used in place of "S" and "B", respectively.
  12776. Alternatively a rule can be specified by an 18-bits integer. The 9
  12777. high order bits are used to encode the next cell state if it is alive
  12778. for each number of neighbor alive cells, the low order bits specify
  12779. the rule for "borning" new cells. Higher order bits encode for an
  12780. higher number of neighbor cells.
  12781. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  12782. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  12783. Default value is "S23/B3", which is the original Conway's game of life
  12784. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  12785. cells, and will born a new cell if there are three alive cells around
  12786. a dead cell.
  12787. @item size, s
  12788. Set the size of the output video. For the syntax of this option, check the
  12789. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12790. If @option{filename} is specified, the size is set by default to the
  12791. same size of the input file. If @option{size} is set, it must contain
  12792. the size specified in the input file, and the initial grid defined in
  12793. that file is centered in the larger resulting area.
  12794. If a filename is not specified, the size value defaults to "320x240"
  12795. (used for a randomly generated initial grid).
  12796. @item stitch
  12797. If set to 1, stitch the left and right grid edges together, and the
  12798. top and bottom edges also. Defaults to 1.
  12799. @item mold
  12800. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  12801. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  12802. value from 0 to 255.
  12803. @item life_color
  12804. Set the color of living (or new born) cells.
  12805. @item death_color
  12806. Set the color of dead cells. If @option{mold} is set, this is the first color
  12807. used to represent a dead cell.
  12808. @item mold_color
  12809. Set mold color, for definitely dead and moldy cells.
  12810. For the syntax of these 3 color options, check the "Color" section in the
  12811. ffmpeg-utils manual.
  12812. @end table
  12813. @subsection Examples
  12814. @itemize
  12815. @item
  12816. Read a grid from @file{pattern}, and center it on a grid of size
  12817. 300x300 pixels:
  12818. @example
  12819. life=f=pattern:s=300x300
  12820. @end example
  12821. @item
  12822. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  12823. @example
  12824. life=ratio=2/3:s=200x200
  12825. @end example
  12826. @item
  12827. Specify a custom rule for evolving a randomly generated grid:
  12828. @example
  12829. life=rule=S14/B34
  12830. @end example
  12831. @item
  12832. Full example with slow death effect (mold) using @command{ffplay}:
  12833. @example
  12834. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  12835. @end example
  12836. @end itemize
  12837. @anchor{allrgb}
  12838. @anchor{allyuv}
  12839. @anchor{color}
  12840. @anchor{haldclutsrc}
  12841. @anchor{nullsrc}
  12842. @anchor{rgbtestsrc}
  12843. @anchor{smptebars}
  12844. @anchor{smptehdbars}
  12845. @anchor{testsrc}
  12846. @anchor{testsrc2}
  12847. @anchor{yuvtestsrc}
  12848. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  12849. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  12850. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  12851. The @code{color} source provides an uniformly colored input.
  12852. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  12853. @ref{haldclut} filter.
  12854. The @code{nullsrc} source returns unprocessed video frames. It is
  12855. mainly useful to be employed in analysis / debugging tools, or as the
  12856. source for filters which ignore the input data.
  12857. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  12858. detecting RGB vs BGR issues. You should see a red, green and blue
  12859. stripe from top to bottom.
  12860. The @code{smptebars} source generates a color bars pattern, based on
  12861. the SMPTE Engineering Guideline EG 1-1990.
  12862. The @code{smptehdbars} source generates a color bars pattern, based on
  12863. the SMPTE RP 219-2002.
  12864. The @code{testsrc} source generates a test video pattern, showing a
  12865. color pattern, a scrolling gradient and a timestamp. This is mainly
  12866. intended for testing purposes.
  12867. The @code{testsrc2} source is similar to testsrc, but supports more
  12868. pixel formats instead of just @code{rgb24}. This allows using it as an
  12869. input for other tests without requiring a format conversion.
  12870. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  12871. see a y, cb and cr stripe from top to bottom.
  12872. The sources accept the following parameters:
  12873. @table @option
  12874. @item alpha
  12875. Specify the alpha (opacity) of the background, only available in the
  12876. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  12877. 255 (fully opaque, the default).
  12878. @item color, c
  12879. Specify the color of the source, only available in the @code{color}
  12880. source. For the syntax of this option, check the "Color" section in the
  12881. ffmpeg-utils manual.
  12882. @item level
  12883. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  12884. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  12885. pixels to be used as identity matrix for 3D lookup tables. Each component is
  12886. coded on a @code{1/(N*N)} scale.
  12887. @item size, s
  12888. Specify the size of the sourced video. For the syntax of this option, check the
  12889. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12890. The default value is @code{320x240}.
  12891. This option is not available with the @code{haldclutsrc} filter.
  12892. @item rate, r
  12893. Specify the frame rate of the sourced video, as the number of frames
  12894. generated per second. It has to be a string in the format
  12895. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12896. number or a valid video frame rate abbreviation. The default value is
  12897. "25".
  12898. @item sar
  12899. Set the sample aspect ratio of the sourced video.
  12900. @item duration, d
  12901. Set the duration of the sourced video. See
  12902. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12903. for the accepted syntax.
  12904. If not specified, or the expressed duration is negative, the video is
  12905. supposed to be generated forever.
  12906. @item decimals, n
  12907. Set the number of decimals to show in the timestamp, only available in the
  12908. @code{testsrc} source.
  12909. The displayed timestamp value will correspond to the original
  12910. timestamp value multiplied by the power of 10 of the specified
  12911. value. Default value is 0.
  12912. @end table
  12913. For example the following:
  12914. @example
  12915. testsrc=duration=5.3:size=qcif:rate=10
  12916. @end example
  12917. will generate a video with a duration of 5.3 seconds, with size
  12918. 176x144 and a frame rate of 10 frames per second.
  12919. The following graph description will generate a red source
  12920. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  12921. frames per second.
  12922. @example
  12923. color=c=red@@0.2:s=qcif:r=10
  12924. @end example
  12925. If the input content is to be ignored, @code{nullsrc} can be used. The
  12926. following command generates noise in the luminance plane by employing
  12927. the @code{geq} filter:
  12928. @example
  12929. nullsrc=s=256x256, geq=random(1)*255:128:128
  12930. @end example
  12931. @subsection Commands
  12932. The @code{color} source supports the following commands:
  12933. @table @option
  12934. @item c, color
  12935. Set the color of the created image. Accepts the same syntax of the
  12936. corresponding @option{color} option.
  12937. @end table
  12938. @c man end VIDEO SOURCES
  12939. @chapter Video Sinks
  12940. @c man begin VIDEO SINKS
  12941. Below is a description of the currently available video sinks.
  12942. @section buffersink
  12943. Buffer video frames, and make them available to the end of the filter
  12944. graph.
  12945. This sink is mainly intended for programmatic use, in particular
  12946. through the interface defined in @file{libavfilter/buffersink.h}
  12947. or the options system.
  12948. It accepts a pointer to an AVBufferSinkContext structure, which
  12949. defines the incoming buffers' formats, to be passed as the opaque
  12950. parameter to @code{avfilter_init_filter} for initialization.
  12951. @section nullsink
  12952. Null video sink: do absolutely nothing with the input video. It is
  12953. mainly useful as a template and for use in analysis / debugging
  12954. tools.
  12955. @c man end VIDEO SINKS
  12956. @chapter Multimedia Filters
  12957. @c man begin MULTIMEDIA FILTERS
  12958. Below is a description of the currently available multimedia filters.
  12959. @section abitscope
  12960. Convert input audio to a video output, displaying the audio bit scope.
  12961. The filter accepts the following options:
  12962. @table @option
  12963. @item rate, r
  12964. Set frame rate, expressed as number of frames per second. Default
  12965. value is "25".
  12966. @item size, s
  12967. Specify the video size for the output. For the syntax of this option, check the
  12968. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12969. Default value is @code{1024x256}.
  12970. @item colors
  12971. Specify list of colors separated by space or by '|' which will be used to
  12972. draw channels. Unrecognized or missing colors will be replaced
  12973. by white color.
  12974. @end table
  12975. @section ahistogram
  12976. Convert input audio to a video output, displaying the volume histogram.
  12977. The filter accepts the following options:
  12978. @table @option
  12979. @item dmode
  12980. Specify how histogram is calculated.
  12981. It accepts the following values:
  12982. @table @samp
  12983. @item single
  12984. Use single histogram for all channels.
  12985. @item separate
  12986. Use separate histogram for each channel.
  12987. @end table
  12988. Default is @code{single}.
  12989. @item rate, r
  12990. Set frame rate, expressed as number of frames per second. Default
  12991. value is "25".
  12992. @item size, s
  12993. Specify the video size for the output. For the syntax of this option, check the
  12994. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12995. Default value is @code{hd720}.
  12996. @item scale
  12997. Set display scale.
  12998. It accepts the following values:
  12999. @table @samp
  13000. @item log
  13001. logarithmic
  13002. @item sqrt
  13003. square root
  13004. @item cbrt
  13005. cubic root
  13006. @item lin
  13007. linear
  13008. @item rlog
  13009. reverse logarithmic
  13010. @end table
  13011. Default is @code{log}.
  13012. @item ascale
  13013. Set amplitude scale.
  13014. It accepts the following values:
  13015. @table @samp
  13016. @item log
  13017. logarithmic
  13018. @item lin
  13019. linear
  13020. @end table
  13021. Default is @code{log}.
  13022. @item acount
  13023. Set how much frames to accumulate in histogram.
  13024. Defauls is 1. Setting this to -1 accumulates all frames.
  13025. @item rheight
  13026. Set histogram ratio of window height.
  13027. @item slide
  13028. Set sonogram sliding.
  13029. It accepts the following values:
  13030. @table @samp
  13031. @item replace
  13032. replace old rows with new ones.
  13033. @item scroll
  13034. scroll from top to bottom.
  13035. @end table
  13036. Default is @code{replace}.
  13037. @end table
  13038. @section aphasemeter
  13039. Convert input audio to a video output, displaying the audio phase.
  13040. The filter accepts the following options:
  13041. @table @option
  13042. @item rate, r
  13043. Set the output frame rate. Default value is @code{25}.
  13044. @item size, s
  13045. Set the video size for the output. For the syntax of this option, check the
  13046. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13047. Default value is @code{800x400}.
  13048. @item rc
  13049. @item gc
  13050. @item bc
  13051. Specify the red, green, blue contrast. Default values are @code{2},
  13052. @code{7} and @code{1}.
  13053. Allowed range is @code{[0, 255]}.
  13054. @item mpc
  13055. Set color which will be used for drawing median phase. If color is
  13056. @code{none} which is default, no median phase value will be drawn.
  13057. @item video
  13058. Enable video output. Default is enabled.
  13059. @end table
  13060. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  13061. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  13062. The @code{-1} means left and right channels are completely out of phase and
  13063. @code{1} means channels are in phase.
  13064. @section avectorscope
  13065. Convert input audio to a video output, representing the audio vector
  13066. scope.
  13067. The filter is used to measure the difference between channels of stereo
  13068. audio stream. A monoaural signal, consisting of identical left and right
  13069. signal, results in straight vertical line. Any stereo separation is visible
  13070. as a deviation from this line, creating a Lissajous figure.
  13071. If the straight (or deviation from it) but horizontal line appears this
  13072. indicates that the left and right channels are out of phase.
  13073. The filter accepts the following options:
  13074. @table @option
  13075. @item mode, m
  13076. Set the vectorscope mode.
  13077. Available values are:
  13078. @table @samp
  13079. @item lissajous
  13080. Lissajous rotated by 45 degrees.
  13081. @item lissajous_xy
  13082. Same as above but not rotated.
  13083. @item polar
  13084. Shape resembling half of circle.
  13085. @end table
  13086. Default value is @samp{lissajous}.
  13087. @item size, s
  13088. Set the video size for the output. For the syntax of this option, check the
  13089. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13090. Default value is @code{400x400}.
  13091. @item rate, r
  13092. Set the output frame rate. Default value is @code{25}.
  13093. @item rc
  13094. @item gc
  13095. @item bc
  13096. @item ac
  13097. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  13098. @code{160}, @code{80} and @code{255}.
  13099. Allowed range is @code{[0, 255]}.
  13100. @item rf
  13101. @item gf
  13102. @item bf
  13103. @item af
  13104. Specify the red, green, blue and alpha fade. Default values are @code{15},
  13105. @code{10}, @code{5} and @code{5}.
  13106. Allowed range is @code{[0, 255]}.
  13107. @item zoom
  13108. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  13109. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  13110. @item draw
  13111. Set the vectorscope drawing mode.
  13112. Available values are:
  13113. @table @samp
  13114. @item dot
  13115. Draw dot for each sample.
  13116. @item line
  13117. Draw line between previous and current sample.
  13118. @end table
  13119. Default value is @samp{dot}.
  13120. @item scale
  13121. Specify amplitude scale of audio samples.
  13122. Available values are:
  13123. @table @samp
  13124. @item lin
  13125. Linear.
  13126. @item sqrt
  13127. Square root.
  13128. @item cbrt
  13129. Cubic root.
  13130. @item log
  13131. Logarithmic.
  13132. @end table
  13133. @end table
  13134. @subsection Examples
  13135. @itemize
  13136. @item
  13137. Complete example using @command{ffplay}:
  13138. @example
  13139. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  13140. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  13141. @end example
  13142. @end itemize
  13143. @section bench, abench
  13144. Benchmark part of a filtergraph.
  13145. The filter accepts the following options:
  13146. @table @option
  13147. @item action
  13148. Start or stop a timer.
  13149. Available values are:
  13150. @table @samp
  13151. @item start
  13152. Get the current time, set it as frame metadata (using the key
  13153. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  13154. @item stop
  13155. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  13156. the input frame metadata to get the time difference. Time difference, average,
  13157. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  13158. @code{min}) are then printed. The timestamps are expressed in seconds.
  13159. @end table
  13160. @end table
  13161. @subsection Examples
  13162. @itemize
  13163. @item
  13164. Benchmark @ref{selectivecolor} filter:
  13165. @example
  13166. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  13167. @end example
  13168. @end itemize
  13169. @section concat
  13170. Concatenate audio and video streams, joining them together one after the
  13171. other.
  13172. The filter works on segments of synchronized video and audio streams. All
  13173. segments must have the same number of streams of each type, and that will
  13174. also be the number of streams at output.
  13175. The filter accepts the following options:
  13176. @table @option
  13177. @item n
  13178. Set the number of segments. Default is 2.
  13179. @item v
  13180. Set the number of output video streams, that is also the number of video
  13181. streams in each segment. Default is 1.
  13182. @item a
  13183. Set the number of output audio streams, that is also the number of audio
  13184. streams in each segment. Default is 0.
  13185. @item unsafe
  13186. Activate unsafe mode: do not fail if segments have a different format.
  13187. @end table
  13188. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  13189. @var{a} audio outputs.
  13190. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  13191. segment, in the same order as the outputs, then the inputs for the second
  13192. segment, etc.
  13193. Related streams do not always have exactly the same duration, for various
  13194. reasons including codec frame size or sloppy authoring. For that reason,
  13195. related synchronized streams (e.g. a video and its audio track) should be
  13196. concatenated at once. The concat filter will use the duration of the longest
  13197. stream in each segment (except the last one), and if necessary pad shorter
  13198. audio streams with silence.
  13199. For this filter to work correctly, all segments must start at timestamp 0.
  13200. All corresponding streams must have the same parameters in all segments; the
  13201. filtering system will automatically select a common pixel format for video
  13202. streams, and a common sample format, sample rate and channel layout for
  13203. audio streams, but other settings, such as resolution, must be converted
  13204. explicitly by the user.
  13205. Different frame rates are acceptable but will result in variable frame rate
  13206. at output; be sure to configure the output file to handle it.
  13207. @subsection Examples
  13208. @itemize
  13209. @item
  13210. Concatenate an opening, an episode and an ending, all in bilingual version
  13211. (video in stream 0, audio in streams 1 and 2):
  13212. @example
  13213. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  13214. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  13215. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  13216. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  13217. @end example
  13218. @item
  13219. Concatenate two parts, handling audio and video separately, using the
  13220. (a)movie sources, and adjusting the resolution:
  13221. @example
  13222. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  13223. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  13224. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  13225. @end example
  13226. Note that a desync will happen at the stitch if the audio and video streams
  13227. do not have exactly the same duration in the first file.
  13228. @end itemize
  13229. @section drawgraph, adrawgraph
  13230. Draw a graph using input video or audio metadata.
  13231. It accepts the following parameters:
  13232. @table @option
  13233. @item m1
  13234. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  13235. @item fg1
  13236. Set 1st foreground color expression.
  13237. @item m2
  13238. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  13239. @item fg2
  13240. Set 2nd foreground color expression.
  13241. @item m3
  13242. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  13243. @item fg3
  13244. Set 3rd foreground color expression.
  13245. @item m4
  13246. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  13247. @item fg4
  13248. Set 4th foreground color expression.
  13249. @item min
  13250. Set minimal value of metadata value.
  13251. @item max
  13252. Set maximal value of metadata value.
  13253. @item bg
  13254. Set graph background color. Default is white.
  13255. @item mode
  13256. Set graph mode.
  13257. Available values for mode is:
  13258. @table @samp
  13259. @item bar
  13260. @item dot
  13261. @item line
  13262. @end table
  13263. Default is @code{line}.
  13264. @item slide
  13265. Set slide mode.
  13266. Available values for slide is:
  13267. @table @samp
  13268. @item frame
  13269. Draw new frame when right border is reached.
  13270. @item replace
  13271. Replace old columns with new ones.
  13272. @item scroll
  13273. Scroll from right to left.
  13274. @item rscroll
  13275. Scroll from left to right.
  13276. @item picture
  13277. Draw single picture.
  13278. @end table
  13279. Default is @code{frame}.
  13280. @item size
  13281. Set size of graph video. For the syntax of this option, check the
  13282. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13283. The default value is @code{900x256}.
  13284. The foreground color expressions can use the following variables:
  13285. @table @option
  13286. @item MIN
  13287. Minimal value of metadata value.
  13288. @item MAX
  13289. Maximal value of metadata value.
  13290. @item VAL
  13291. Current metadata key value.
  13292. @end table
  13293. The color is defined as 0xAABBGGRR.
  13294. @end table
  13295. Example using metadata from @ref{signalstats} filter:
  13296. @example
  13297. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  13298. @end example
  13299. Example using metadata from @ref{ebur128} filter:
  13300. @example
  13301. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  13302. @end example
  13303. @anchor{ebur128}
  13304. @section ebur128
  13305. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  13306. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  13307. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  13308. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  13309. The filter also has a video output (see the @var{video} option) with a real
  13310. time graph to observe the loudness evolution. The graphic contains the logged
  13311. message mentioned above, so it is not printed anymore when this option is set,
  13312. unless the verbose logging is set. The main graphing area contains the
  13313. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  13314. the momentary loudness (400 milliseconds).
  13315. More information about the Loudness Recommendation EBU R128 on
  13316. @url{http://tech.ebu.ch/loudness}.
  13317. The filter accepts the following options:
  13318. @table @option
  13319. @item video
  13320. Activate the video output. The audio stream is passed unchanged whether this
  13321. option is set or no. The video stream will be the first output stream if
  13322. activated. Default is @code{0}.
  13323. @item size
  13324. Set the video size. This option is for video only. For the syntax of this
  13325. option, check the
  13326. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13327. Default and minimum resolution is @code{640x480}.
  13328. @item meter
  13329. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  13330. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  13331. other integer value between this range is allowed.
  13332. @item metadata
  13333. Set metadata injection. If set to @code{1}, the audio input will be segmented
  13334. into 100ms output frames, each of them containing various loudness information
  13335. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  13336. Default is @code{0}.
  13337. @item framelog
  13338. Force the frame logging level.
  13339. Available values are:
  13340. @table @samp
  13341. @item info
  13342. information logging level
  13343. @item verbose
  13344. verbose logging level
  13345. @end table
  13346. By default, the logging level is set to @var{info}. If the @option{video} or
  13347. the @option{metadata} options are set, it switches to @var{verbose}.
  13348. @item peak
  13349. Set peak mode(s).
  13350. Available modes can be cumulated (the option is a @code{flag} type). Possible
  13351. values are:
  13352. @table @samp
  13353. @item none
  13354. Disable any peak mode (default).
  13355. @item sample
  13356. Enable sample-peak mode.
  13357. Simple peak mode looking for the higher sample value. It logs a message
  13358. for sample-peak (identified by @code{SPK}).
  13359. @item true
  13360. Enable true-peak mode.
  13361. If enabled, the peak lookup is done on an over-sampled version of the input
  13362. stream for better peak accuracy. It logs a message for true-peak.
  13363. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  13364. This mode requires a build with @code{libswresample}.
  13365. @end table
  13366. @item dualmono
  13367. Treat mono input files as "dual mono". If a mono file is intended for playback
  13368. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  13369. If set to @code{true}, this option will compensate for this effect.
  13370. Multi-channel input files are not affected by this option.
  13371. @item panlaw
  13372. Set a specific pan law to be used for the measurement of dual mono files.
  13373. This parameter is optional, and has a default value of -3.01dB.
  13374. @end table
  13375. @subsection Examples
  13376. @itemize
  13377. @item
  13378. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  13379. @example
  13380. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  13381. @end example
  13382. @item
  13383. Run an analysis with @command{ffmpeg}:
  13384. @example
  13385. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  13386. @end example
  13387. @end itemize
  13388. @section interleave, ainterleave
  13389. Temporally interleave frames from several inputs.
  13390. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  13391. These filters read frames from several inputs and send the oldest
  13392. queued frame to the output.
  13393. Input streams must have well defined, monotonically increasing frame
  13394. timestamp values.
  13395. In order to submit one frame to output, these filters need to enqueue
  13396. at least one frame for each input, so they cannot work in case one
  13397. input is not yet terminated and will not receive incoming frames.
  13398. For example consider the case when one input is a @code{select} filter
  13399. which always drops input frames. The @code{interleave} filter will keep
  13400. reading from that input, but it will never be able to send new frames
  13401. to output until the input sends an end-of-stream signal.
  13402. Also, depending on inputs synchronization, the filters will drop
  13403. frames in case one input receives more frames than the other ones, and
  13404. the queue is already filled.
  13405. These filters accept the following options:
  13406. @table @option
  13407. @item nb_inputs, n
  13408. Set the number of different inputs, it is 2 by default.
  13409. @end table
  13410. @subsection Examples
  13411. @itemize
  13412. @item
  13413. Interleave frames belonging to different streams using @command{ffmpeg}:
  13414. @example
  13415. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  13416. @end example
  13417. @item
  13418. Add flickering blur effect:
  13419. @example
  13420. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  13421. @end example
  13422. @end itemize
  13423. @section metadata, ametadata
  13424. Manipulate frame metadata.
  13425. This filter accepts the following options:
  13426. @table @option
  13427. @item mode
  13428. Set mode of operation of the filter.
  13429. Can be one of the following:
  13430. @table @samp
  13431. @item select
  13432. If both @code{value} and @code{key} is set, select frames
  13433. which have such metadata. If only @code{key} is set, select
  13434. every frame that has such key in metadata.
  13435. @item add
  13436. Add new metadata @code{key} and @code{value}. If key is already available
  13437. do nothing.
  13438. @item modify
  13439. Modify value of already present key.
  13440. @item delete
  13441. If @code{value} is set, delete only keys that have such value.
  13442. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  13443. the frame.
  13444. @item print
  13445. Print key and its value if metadata was found. If @code{key} is not set print all
  13446. metadata values available in frame.
  13447. @end table
  13448. @item key
  13449. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  13450. @item value
  13451. Set metadata value which will be used. This option is mandatory for
  13452. @code{modify} and @code{add} mode.
  13453. @item function
  13454. Which function to use when comparing metadata value and @code{value}.
  13455. Can be one of following:
  13456. @table @samp
  13457. @item same_str
  13458. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  13459. @item starts_with
  13460. Values are interpreted as strings, returns true if metadata value starts with
  13461. the @code{value} option string.
  13462. @item less
  13463. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  13464. @item equal
  13465. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  13466. @item greater
  13467. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  13468. @item expr
  13469. Values are interpreted as floats, returns true if expression from option @code{expr}
  13470. evaluates to true.
  13471. @end table
  13472. @item expr
  13473. Set expression which is used when @code{function} is set to @code{expr}.
  13474. The expression is evaluated through the eval API and can contain the following
  13475. constants:
  13476. @table @option
  13477. @item VALUE1
  13478. Float representation of @code{value} from metadata key.
  13479. @item VALUE2
  13480. Float representation of @code{value} as supplied by user in @code{value} option.
  13481. @end table
  13482. @item file
  13483. If specified in @code{print} mode, output is written to the named file. Instead of
  13484. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  13485. for standard output. If @code{file} option is not set, output is written to the log
  13486. with AV_LOG_INFO loglevel.
  13487. @end table
  13488. @subsection Examples
  13489. @itemize
  13490. @item
  13491. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  13492. between 0 and 1.
  13493. @example
  13494. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  13495. @end example
  13496. @item
  13497. Print silencedetect output to file @file{metadata.txt}.
  13498. @example
  13499. silencedetect,ametadata=mode=print:file=metadata.txt
  13500. @end example
  13501. @item
  13502. Direct all metadata to a pipe with file descriptor 4.
  13503. @example
  13504. metadata=mode=print:file='pipe\:4'
  13505. @end example
  13506. @end itemize
  13507. @section perms, aperms
  13508. Set read/write permissions for the output frames.
  13509. These filters are mainly aimed at developers to test direct path in the
  13510. following filter in the filtergraph.
  13511. The filters accept the following options:
  13512. @table @option
  13513. @item mode
  13514. Select the permissions mode.
  13515. It accepts the following values:
  13516. @table @samp
  13517. @item none
  13518. Do nothing. This is the default.
  13519. @item ro
  13520. Set all the output frames read-only.
  13521. @item rw
  13522. Set all the output frames directly writable.
  13523. @item toggle
  13524. Make the frame read-only if writable, and writable if read-only.
  13525. @item random
  13526. Set each output frame read-only or writable randomly.
  13527. @end table
  13528. @item seed
  13529. Set the seed for the @var{random} mode, must be an integer included between
  13530. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  13531. @code{-1}, the filter will try to use a good random seed on a best effort
  13532. basis.
  13533. @end table
  13534. Note: in case of auto-inserted filter between the permission filter and the
  13535. following one, the permission might not be received as expected in that
  13536. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  13537. perms/aperms filter can avoid this problem.
  13538. @section realtime, arealtime
  13539. Slow down filtering to match real time approximately.
  13540. These filters will pause the filtering for a variable amount of time to
  13541. match the output rate with the input timestamps.
  13542. They are similar to the @option{re} option to @code{ffmpeg}.
  13543. They accept the following options:
  13544. @table @option
  13545. @item limit
  13546. Time limit for the pauses. Any pause longer than that will be considered
  13547. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  13548. @end table
  13549. @anchor{select}
  13550. @section select, aselect
  13551. Select frames to pass in output.
  13552. This filter accepts the following options:
  13553. @table @option
  13554. @item expr, e
  13555. Set expression, which is evaluated for each input frame.
  13556. If the expression is evaluated to zero, the frame is discarded.
  13557. If the evaluation result is negative or NaN, the frame is sent to the
  13558. first output; otherwise it is sent to the output with index
  13559. @code{ceil(val)-1}, assuming that the input index starts from 0.
  13560. For example a value of @code{1.2} corresponds to the output with index
  13561. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  13562. @item outputs, n
  13563. Set the number of outputs. The output to which to send the selected
  13564. frame is based on the result of the evaluation. Default value is 1.
  13565. @end table
  13566. The expression can contain the following constants:
  13567. @table @option
  13568. @item n
  13569. The (sequential) number of the filtered frame, starting from 0.
  13570. @item selected_n
  13571. The (sequential) number of the selected frame, starting from 0.
  13572. @item prev_selected_n
  13573. The sequential number of the last selected frame. It's NAN if undefined.
  13574. @item TB
  13575. The timebase of the input timestamps.
  13576. @item pts
  13577. The PTS (Presentation TimeStamp) of the filtered video frame,
  13578. expressed in @var{TB} units. It's NAN if undefined.
  13579. @item t
  13580. The PTS of the filtered video frame,
  13581. expressed in seconds. It's NAN if undefined.
  13582. @item prev_pts
  13583. The PTS of the previously filtered video frame. It's NAN if undefined.
  13584. @item prev_selected_pts
  13585. The PTS of the last previously filtered video frame. It's NAN if undefined.
  13586. @item prev_selected_t
  13587. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  13588. @item start_pts
  13589. The PTS of the first video frame in the video. It's NAN if undefined.
  13590. @item start_t
  13591. The time of the first video frame in the video. It's NAN if undefined.
  13592. @item pict_type @emph{(video only)}
  13593. The type of the filtered frame. It can assume one of the following
  13594. values:
  13595. @table @option
  13596. @item I
  13597. @item P
  13598. @item B
  13599. @item S
  13600. @item SI
  13601. @item SP
  13602. @item BI
  13603. @end table
  13604. @item interlace_type @emph{(video only)}
  13605. The frame interlace type. It can assume one of the following values:
  13606. @table @option
  13607. @item PROGRESSIVE
  13608. The frame is progressive (not interlaced).
  13609. @item TOPFIRST
  13610. The frame is top-field-first.
  13611. @item BOTTOMFIRST
  13612. The frame is bottom-field-first.
  13613. @end table
  13614. @item consumed_sample_n @emph{(audio only)}
  13615. the number of selected samples before the current frame
  13616. @item samples_n @emph{(audio only)}
  13617. the number of samples in the current frame
  13618. @item sample_rate @emph{(audio only)}
  13619. the input sample rate
  13620. @item key
  13621. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  13622. @item pos
  13623. the position in the file of the filtered frame, -1 if the information
  13624. is not available (e.g. for synthetic video)
  13625. @item scene @emph{(video only)}
  13626. value between 0 and 1 to indicate a new scene; a low value reflects a low
  13627. probability for the current frame to introduce a new scene, while a higher
  13628. value means the current frame is more likely to be one (see the example below)
  13629. @item concatdec_select
  13630. The concat demuxer can select only part of a concat input file by setting an
  13631. inpoint and an outpoint, but the output packets may not be entirely contained
  13632. in the selected interval. By using this variable, it is possible to skip frames
  13633. generated by the concat demuxer which are not exactly contained in the selected
  13634. interval.
  13635. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  13636. and the @var{lavf.concat.duration} packet metadata values which are also
  13637. present in the decoded frames.
  13638. The @var{concatdec_select} variable is -1 if the frame pts is at least
  13639. start_time and either the duration metadata is missing or the frame pts is less
  13640. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  13641. missing.
  13642. That basically means that an input frame is selected if its pts is within the
  13643. interval set by the concat demuxer.
  13644. @end table
  13645. The default value of the select expression is "1".
  13646. @subsection Examples
  13647. @itemize
  13648. @item
  13649. Select all frames in input:
  13650. @example
  13651. select
  13652. @end example
  13653. The example above is the same as:
  13654. @example
  13655. select=1
  13656. @end example
  13657. @item
  13658. Skip all frames:
  13659. @example
  13660. select=0
  13661. @end example
  13662. @item
  13663. Select only I-frames:
  13664. @example
  13665. select='eq(pict_type\,I)'
  13666. @end example
  13667. @item
  13668. Select one frame every 100:
  13669. @example
  13670. select='not(mod(n\,100))'
  13671. @end example
  13672. @item
  13673. Select only frames contained in the 10-20 time interval:
  13674. @example
  13675. select=between(t\,10\,20)
  13676. @end example
  13677. @item
  13678. Select only I-frames contained in the 10-20 time interval:
  13679. @example
  13680. select=between(t\,10\,20)*eq(pict_type\,I)
  13681. @end example
  13682. @item
  13683. Select frames with a minimum distance of 10 seconds:
  13684. @example
  13685. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  13686. @end example
  13687. @item
  13688. Use aselect to select only audio frames with samples number > 100:
  13689. @example
  13690. aselect='gt(samples_n\,100)'
  13691. @end example
  13692. @item
  13693. Create a mosaic of the first scenes:
  13694. @example
  13695. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  13696. @end example
  13697. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  13698. choice.
  13699. @item
  13700. Send even and odd frames to separate outputs, and compose them:
  13701. @example
  13702. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  13703. @end example
  13704. @item
  13705. Select useful frames from an ffconcat file which is using inpoints and
  13706. outpoints but where the source files are not intra frame only.
  13707. @example
  13708. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  13709. @end example
  13710. @end itemize
  13711. @section sendcmd, asendcmd
  13712. Send commands to filters in the filtergraph.
  13713. These filters read commands to be sent to other filters in the
  13714. filtergraph.
  13715. @code{sendcmd} must be inserted between two video filters,
  13716. @code{asendcmd} must be inserted between two audio filters, but apart
  13717. from that they act the same way.
  13718. The specification of commands can be provided in the filter arguments
  13719. with the @var{commands} option, or in a file specified by the
  13720. @var{filename} option.
  13721. These filters accept the following options:
  13722. @table @option
  13723. @item commands, c
  13724. Set the commands to be read and sent to the other filters.
  13725. @item filename, f
  13726. Set the filename of the commands to be read and sent to the other
  13727. filters.
  13728. @end table
  13729. @subsection Commands syntax
  13730. A commands description consists of a sequence of interval
  13731. specifications, comprising a list of commands to be executed when a
  13732. particular event related to that interval occurs. The occurring event
  13733. is typically the current frame time entering or leaving a given time
  13734. interval.
  13735. An interval is specified by the following syntax:
  13736. @example
  13737. @var{START}[-@var{END}] @var{COMMANDS};
  13738. @end example
  13739. The time interval is specified by the @var{START} and @var{END} times.
  13740. @var{END} is optional and defaults to the maximum time.
  13741. The current frame time is considered within the specified interval if
  13742. it is included in the interval [@var{START}, @var{END}), that is when
  13743. the time is greater or equal to @var{START} and is lesser than
  13744. @var{END}.
  13745. @var{COMMANDS} consists of a sequence of one or more command
  13746. specifications, separated by ",", relating to that interval. The
  13747. syntax of a command specification is given by:
  13748. @example
  13749. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  13750. @end example
  13751. @var{FLAGS} is optional and specifies the type of events relating to
  13752. the time interval which enable sending the specified command, and must
  13753. be a non-null sequence of identifier flags separated by "+" or "|" and
  13754. enclosed between "[" and "]".
  13755. The following flags are recognized:
  13756. @table @option
  13757. @item enter
  13758. The command is sent when the current frame timestamp enters the
  13759. specified interval. In other words, the command is sent when the
  13760. previous frame timestamp was not in the given interval, and the
  13761. current is.
  13762. @item leave
  13763. The command is sent when the current frame timestamp leaves the
  13764. specified interval. In other words, the command is sent when the
  13765. previous frame timestamp was in the given interval, and the
  13766. current is not.
  13767. @end table
  13768. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  13769. assumed.
  13770. @var{TARGET} specifies the target of the command, usually the name of
  13771. the filter class or a specific filter instance name.
  13772. @var{COMMAND} specifies the name of the command for the target filter.
  13773. @var{ARG} is optional and specifies the optional list of argument for
  13774. the given @var{COMMAND}.
  13775. Between one interval specification and another, whitespaces, or
  13776. sequences of characters starting with @code{#} until the end of line,
  13777. are ignored and can be used to annotate comments.
  13778. A simplified BNF description of the commands specification syntax
  13779. follows:
  13780. @example
  13781. @var{COMMAND_FLAG} ::= "enter" | "leave"
  13782. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  13783. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  13784. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  13785. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  13786. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  13787. @end example
  13788. @subsection Examples
  13789. @itemize
  13790. @item
  13791. Specify audio tempo change at second 4:
  13792. @example
  13793. asendcmd=c='4.0 atempo tempo 1.5',atempo
  13794. @end example
  13795. @item
  13796. Target a specific filter instance:
  13797. @example
  13798. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  13799. @end example
  13800. @item
  13801. Specify a list of drawtext and hue commands in a file.
  13802. @example
  13803. # show text in the interval 5-10
  13804. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  13805. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  13806. # desaturate the image in the interval 15-20
  13807. 15.0-20.0 [enter] hue s 0,
  13808. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  13809. [leave] hue s 1,
  13810. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  13811. # apply an exponential saturation fade-out effect, starting from time 25
  13812. 25 [enter] hue s exp(25-t)
  13813. @end example
  13814. A filtergraph allowing to read and process the above command list
  13815. stored in a file @file{test.cmd}, can be specified with:
  13816. @example
  13817. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  13818. @end example
  13819. @end itemize
  13820. @anchor{setpts}
  13821. @section setpts, asetpts
  13822. Change the PTS (presentation timestamp) of the input frames.
  13823. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  13824. This filter accepts the following options:
  13825. @table @option
  13826. @item expr
  13827. The expression which is evaluated for each frame to construct its timestamp.
  13828. @end table
  13829. The expression is evaluated through the eval API and can contain the following
  13830. constants:
  13831. @table @option
  13832. @item FRAME_RATE
  13833. frame rate, only defined for constant frame-rate video
  13834. @item PTS
  13835. The presentation timestamp in input
  13836. @item N
  13837. The count of the input frame for video or the number of consumed samples,
  13838. not including the current frame for audio, starting from 0.
  13839. @item NB_CONSUMED_SAMPLES
  13840. The number of consumed samples, not including the current frame (only
  13841. audio)
  13842. @item NB_SAMPLES, S
  13843. The number of samples in the current frame (only audio)
  13844. @item SAMPLE_RATE, SR
  13845. The audio sample rate.
  13846. @item STARTPTS
  13847. The PTS of the first frame.
  13848. @item STARTT
  13849. the time in seconds of the first frame
  13850. @item INTERLACED
  13851. State whether the current frame is interlaced.
  13852. @item T
  13853. the time in seconds of the current frame
  13854. @item POS
  13855. original position in the file of the frame, or undefined if undefined
  13856. for the current frame
  13857. @item PREV_INPTS
  13858. The previous input PTS.
  13859. @item PREV_INT
  13860. previous input time in seconds
  13861. @item PREV_OUTPTS
  13862. The previous output PTS.
  13863. @item PREV_OUTT
  13864. previous output time in seconds
  13865. @item RTCTIME
  13866. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  13867. instead.
  13868. @item RTCSTART
  13869. The wallclock (RTC) time at the start of the movie in microseconds.
  13870. @item TB
  13871. The timebase of the input timestamps.
  13872. @end table
  13873. @subsection Examples
  13874. @itemize
  13875. @item
  13876. Start counting PTS from zero
  13877. @example
  13878. setpts=PTS-STARTPTS
  13879. @end example
  13880. @item
  13881. Apply fast motion effect:
  13882. @example
  13883. setpts=0.5*PTS
  13884. @end example
  13885. @item
  13886. Apply slow motion effect:
  13887. @example
  13888. setpts=2.0*PTS
  13889. @end example
  13890. @item
  13891. Set fixed rate of 25 frames per second:
  13892. @example
  13893. setpts=N/(25*TB)
  13894. @end example
  13895. @item
  13896. Set fixed rate 25 fps with some jitter:
  13897. @example
  13898. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  13899. @end example
  13900. @item
  13901. Apply an offset of 10 seconds to the input PTS:
  13902. @example
  13903. setpts=PTS+10/TB
  13904. @end example
  13905. @item
  13906. Generate timestamps from a "live source" and rebase onto the current timebase:
  13907. @example
  13908. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  13909. @end example
  13910. @item
  13911. Generate timestamps by counting samples:
  13912. @example
  13913. asetpts=N/SR/TB
  13914. @end example
  13915. @end itemize
  13916. @section settb, asettb
  13917. Set the timebase to use for the output frames timestamps.
  13918. It is mainly useful for testing timebase configuration.
  13919. It accepts the following parameters:
  13920. @table @option
  13921. @item expr, tb
  13922. The expression which is evaluated into the output timebase.
  13923. @end table
  13924. The value for @option{tb} is an arithmetic expression representing a
  13925. rational. The expression can contain the constants "AVTB" (the default
  13926. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  13927. audio only). Default value is "intb".
  13928. @subsection Examples
  13929. @itemize
  13930. @item
  13931. Set the timebase to 1/25:
  13932. @example
  13933. settb=expr=1/25
  13934. @end example
  13935. @item
  13936. Set the timebase to 1/10:
  13937. @example
  13938. settb=expr=0.1
  13939. @end example
  13940. @item
  13941. Set the timebase to 1001/1000:
  13942. @example
  13943. settb=1+0.001
  13944. @end example
  13945. @item
  13946. Set the timebase to 2*intb:
  13947. @example
  13948. settb=2*intb
  13949. @end example
  13950. @item
  13951. Set the default timebase value:
  13952. @example
  13953. settb=AVTB
  13954. @end example
  13955. @end itemize
  13956. @section showcqt
  13957. Convert input audio to a video output representing frequency spectrum
  13958. logarithmically using Brown-Puckette constant Q transform algorithm with
  13959. direct frequency domain coefficient calculation (but the transform itself
  13960. is not really constant Q, instead the Q factor is actually variable/clamped),
  13961. with musical tone scale, from E0 to D#10.
  13962. The filter accepts the following options:
  13963. @table @option
  13964. @item size, s
  13965. Specify the video size for the output. It must be even. For the syntax of this option,
  13966. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13967. Default value is @code{1920x1080}.
  13968. @item fps, rate, r
  13969. Set the output frame rate. Default value is @code{25}.
  13970. @item bar_h
  13971. Set the bargraph height. It must be even. Default value is @code{-1} which
  13972. computes the bargraph height automatically.
  13973. @item axis_h
  13974. Set the axis height. It must be even. Default value is @code{-1} which computes
  13975. the axis height automatically.
  13976. @item sono_h
  13977. Set the sonogram height. It must be even. Default value is @code{-1} which
  13978. computes the sonogram height automatically.
  13979. @item fullhd
  13980. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  13981. instead. Default value is @code{1}.
  13982. @item sono_v, volume
  13983. Specify the sonogram volume expression. It can contain variables:
  13984. @table @option
  13985. @item bar_v
  13986. the @var{bar_v} evaluated expression
  13987. @item frequency, freq, f
  13988. the frequency where it is evaluated
  13989. @item timeclamp, tc
  13990. the value of @var{timeclamp} option
  13991. @end table
  13992. and functions:
  13993. @table @option
  13994. @item a_weighting(f)
  13995. A-weighting of equal loudness
  13996. @item b_weighting(f)
  13997. B-weighting of equal loudness
  13998. @item c_weighting(f)
  13999. C-weighting of equal loudness.
  14000. @end table
  14001. Default value is @code{16}.
  14002. @item bar_v, volume2
  14003. Specify the bargraph volume expression. It can contain variables:
  14004. @table @option
  14005. @item sono_v
  14006. the @var{sono_v} evaluated expression
  14007. @item frequency, freq, f
  14008. the frequency where it is evaluated
  14009. @item timeclamp, tc
  14010. the value of @var{timeclamp} option
  14011. @end table
  14012. and functions:
  14013. @table @option
  14014. @item a_weighting(f)
  14015. A-weighting of equal loudness
  14016. @item b_weighting(f)
  14017. B-weighting of equal loudness
  14018. @item c_weighting(f)
  14019. C-weighting of equal loudness.
  14020. @end table
  14021. Default value is @code{sono_v}.
  14022. @item sono_g, gamma
  14023. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  14024. higher gamma makes the spectrum having more range. Default value is @code{3}.
  14025. Acceptable range is @code{[1, 7]}.
  14026. @item bar_g, gamma2
  14027. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  14028. @code{[1, 7]}.
  14029. @item bar_t
  14030. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  14031. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  14032. @item timeclamp, tc
  14033. Specify the transform timeclamp. At low frequency, there is trade-off between
  14034. accuracy in time domain and frequency domain. If timeclamp is lower,
  14035. event in time domain is represented more accurately (such as fast bass drum),
  14036. otherwise event in frequency domain is represented more accurately
  14037. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  14038. @item attack
  14039. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  14040. limits future samples by applying asymmetric windowing in time domain, useful
  14041. when low latency is required. Accepted range is @code{[0, 1]}.
  14042. @item basefreq
  14043. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  14044. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  14045. @item endfreq
  14046. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  14047. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  14048. @item coeffclamp
  14049. This option is deprecated and ignored.
  14050. @item tlength
  14051. Specify the transform length in time domain. Use this option to control accuracy
  14052. trade-off between time domain and frequency domain at every frequency sample.
  14053. It can contain variables:
  14054. @table @option
  14055. @item frequency, freq, f
  14056. the frequency where it is evaluated
  14057. @item timeclamp, tc
  14058. the value of @var{timeclamp} option.
  14059. @end table
  14060. Default value is @code{384*tc/(384+tc*f)}.
  14061. @item count
  14062. Specify the transform count for every video frame. Default value is @code{6}.
  14063. Acceptable range is @code{[1, 30]}.
  14064. @item fcount
  14065. Specify the transform count for every single pixel. Default value is @code{0},
  14066. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  14067. @item fontfile
  14068. Specify font file for use with freetype to draw the axis. If not specified,
  14069. use embedded font. Note that drawing with font file or embedded font is not
  14070. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  14071. option instead.
  14072. @item font
  14073. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  14074. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  14075. @item fontcolor
  14076. Specify font color expression. This is arithmetic expression that should return
  14077. integer value 0xRRGGBB. It can contain variables:
  14078. @table @option
  14079. @item frequency, freq, f
  14080. the frequency where it is evaluated
  14081. @item timeclamp, tc
  14082. the value of @var{timeclamp} option
  14083. @end table
  14084. and functions:
  14085. @table @option
  14086. @item midi(f)
  14087. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  14088. @item r(x), g(x), b(x)
  14089. red, green, and blue value of intensity x.
  14090. @end table
  14091. Default value is @code{st(0, (midi(f)-59.5)/12);
  14092. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  14093. r(1-ld(1)) + b(ld(1))}.
  14094. @item axisfile
  14095. Specify image file to draw the axis. This option override @var{fontfile} and
  14096. @var{fontcolor} option.
  14097. @item axis, text
  14098. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  14099. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  14100. Default value is @code{1}.
  14101. @item csp
  14102. Set colorspace. The accepted values are:
  14103. @table @samp
  14104. @item unspecified
  14105. Unspecified (default)
  14106. @item bt709
  14107. BT.709
  14108. @item fcc
  14109. FCC
  14110. @item bt470bg
  14111. BT.470BG or BT.601-6 625
  14112. @item smpte170m
  14113. SMPTE-170M or BT.601-6 525
  14114. @item smpte240m
  14115. SMPTE-240M
  14116. @item bt2020ncl
  14117. BT.2020 with non-constant luminance
  14118. @end table
  14119. @item cscheme
  14120. Set spectrogram color scheme. This is list of floating point values with format
  14121. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  14122. The default is @code{1|0.5|0|0|0.5|1}.
  14123. @end table
  14124. @subsection Examples
  14125. @itemize
  14126. @item
  14127. Playing audio while showing the spectrum:
  14128. @example
  14129. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  14130. @end example
  14131. @item
  14132. Same as above, but with frame rate 30 fps:
  14133. @example
  14134. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  14135. @end example
  14136. @item
  14137. Playing at 1280x720:
  14138. @example
  14139. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  14140. @end example
  14141. @item
  14142. Disable sonogram display:
  14143. @example
  14144. sono_h=0
  14145. @end example
  14146. @item
  14147. A1 and its harmonics: A1, A2, (near)E3, A3:
  14148. @example
  14149. 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),
  14150. asplit[a][out1]; [a] showcqt [out0]'
  14151. @end example
  14152. @item
  14153. Same as above, but with more accuracy in frequency domain:
  14154. @example
  14155. 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),
  14156. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  14157. @end example
  14158. @item
  14159. Custom volume:
  14160. @example
  14161. bar_v=10:sono_v=bar_v*a_weighting(f)
  14162. @end example
  14163. @item
  14164. Custom gamma, now spectrum is linear to the amplitude.
  14165. @example
  14166. bar_g=2:sono_g=2
  14167. @end example
  14168. @item
  14169. Custom tlength equation:
  14170. @example
  14171. 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)))'
  14172. @end example
  14173. @item
  14174. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  14175. @example
  14176. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  14177. @end example
  14178. @item
  14179. Custom font using fontconfig:
  14180. @example
  14181. font='Courier New,Monospace,mono|bold'
  14182. @end example
  14183. @item
  14184. Custom frequency range with custom axis using image file:
  14185. @example
  14186. axisfile=myaxis.png:basefreq=40:endfreq=10000
  14187. @end example
  14188. @end itemize
  14189. @section showfreqs
  14190. Convert input audio to video output representing the audio power spectrum.
  14191. Audio amplitude is on Y-axis while frequency is on X-axis.
  14192. The filter accepts the following options:
  14193. @table @option
  14194. @item size, s
  14195. Specify size of video. For the syntax of this option, check the
  14196. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14197. Default is @code{1024x512}.
  14198. @item mode
  14199. Set display mode.
  14200. This set how each frequency bin will be represented.
  14201. It accepts the following values:
  14202. @table @samp
  14203. @item line
  14204. @item bar
  14205. @item dot
  14206. @end table
  14207. Default is @code{bar}.
  14208. @item ascale
  14209. Set amplitude scale.
  14210. It accepts the following values:
  14211. @table @samp
  14212. @item lin
  14213. Linear scale.
  14214. @item sqrt
  14215. Square root scale.
  14216. @item cbrt
  14217. Cubic root scale.
  14218. @item log
  14219. Logarithmic scale.
  14220. @end table
  14221. Default is @code{log}.
  14222. @item fscale
  14223. Set frequency scale.
  14224. It accepts the following values:
  14225. @table @samp
  14226. @item lin
  14227. Linear scale.
  14228. @item log
  14229. Logarithmic scale.
  14230. @item rlog
  14231. Reverse logarithmic scale.
  14232. @end table
  14233. Default is @code{lin}.
  14234. @item win_size
  14235. Set window size.
  14236. It accepts the following values:
  14237. @table @samp
  14238. @item w16
  14239. @item w32
  14240. @item w64
  14241. @item w128
  14242. @item w256
  14243. @item w512
  14244. @item w1024
  14245. @item w2048
  14246. @item w4096
  14247. @item w8192
  14248. @item w16384
  14249. @item w32768
  14250. @item w65536
  14251. @end table
  14252. Default is @code{w2048}
  14253. @item win_func
  14254. Set windowing function.
  14255. It accepts the following values:
  14256. @table @samp
  14257. @item rect
  14258. @item bartlett
  14259. @item hanning
  14260. @item hamming
  14261. @item blackman
  14262. @item welch
  14263. @item flattop
  14264. @item bharris
  14265. @item bnuttall
  14266. @item bhann
  14267. @item sine
  14268. @item nuttall
  14269. @item lanczos
  14270. @item gauss
  14271. @item tukey
  14272. @item dolph
  14273. @item cauchy
  14274. @item parzen
  14275. @item poisson
  14276. @end table
  14277. Default is @code{hanning}.
  14278. @item overlap
  14279. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14280. which means optimal overlap for selected window function will be picked.
  14281. @item averaging
  14282. Set time averaging. Setting this to 0 will display current maximal peaks.
  14283. Default is @code{1}, which means time averaging is disabled.
  14284. @item colors
  14285. Specify list of colors separated by space or by '|' which will be used to
  14286. draw channel frequencies. Unrecognized or missing colors will be replaced
  14287. by white color.
  14288. @item cmode
  14289. Set channel display mode.
  14290. It accepts the following values:
  14291. @table @samp
  14292. @item combined
  14293. @item separate
  14294. @end table
  14295. Default is @code{combined}.
  14296. @item minamp
  14297. Set minimum amplitude used in @code{log} amplitude scaler.
  14298. @end table
  14299. @anchor{showspectrum}
  14300. @section showspectrum
  14301. Convert input audio to a video output, representing the audio frequency
  14302. spectrum.
  14303. The filter accepts the following options:
  14304. @table @option
  14305. @item size, s
  14306. Specify the video size for the output. For the syntax of this option, check the
  14307. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14308. Default value is @code{640x512}.
  14309. @item slide
  14310. Specify how the spectrum should slide along the window.
  14311. It accepts the following values:
  14312. @table @samp
  14313. @item replace
  14314. the samples start again on the left when they reach the right
  14315. @item scroll
  14316. the samples scroll from right to left
  14317. @item fullframe
  14318. frames are only produced when the samples reach the right
  14319. @item rscroll
  14320. the samples scroll from left to right
  14321. @end table
  14322. Default value is @code{replace}.
  14323. @item mode
  14324. Specify display mode.
  14325. It accepts the following values:
  14326. @table @samp
  14327. @item combined
  14328. all channels are displayed in the same row
  14329. @item separate
  14330. all channels are displayed in separate rows
  14331. @end table
  14332. Default value is @samp{combined}.
  14333. @item color
  14334. Specify display color mode.
  14335. It accepts the following values:
  14336. @table @samp
  14337. @item channel
  14338. each channel is displayed in a separate color
  14339. @item intensity
  14340. each channel is displayed using the same color scheme
  14341. @item rainbow
  14342. each channel is displayed using the rainbow color scheme
  14343. @item moreland
  14344. each channel is displayed using the moreland color scheme
  14345. @item nebulae
  14346. each channel is displayed using the nebulae color scheme
  14347. @item fire
  14348. each channel is displayed using the fire color scheme
  14349. @item fiery
  14350. each channel is displayed using the fiery color scheme
  14351. @item fruit
  14352. each channel is displayed using the fruit color scheme
  14353. @item cool
  14354. each channel is displayed using the cool color scheme
  14355. @end table
  14356. Default value is @samp{channel}.
  14357. @item scale
  14358. Specify scale used for calculating intensity color values.
  14359. It accepts the following values:
  14360. @table @samp
  14361. @item lin
  14362. linear
  14363. @item sqrt
  14364. square root, default
  14365. @item cbrt
  14366. cubic root
  14367. @item log
  14368. logarithmic
  14369. @item 4thrt
  14370. 4th root
  14371. @item 5thrt
  14372. 5th root
  14373. @end table
  14374. Default value is @samp{sqrt}.
  14375. @item saturation
  14376. Set saturation modifier for displayed colors. Negative values provide
  14377. alternative color scheme. @code{0} is no saturation at all.
  14378. Saturation must be in [-10.0, 10.0] range.
  14379. Default value is @code{1}.
  14380. @item win_func
  14381. Set window function.
  14382. It accepts the following values:
  14383. @table @samp
  14384. @item rect
  14385. @item bartlett
  14386. @item hann
  14387. @item hanning
  14388. @item hamming
  14389. @item blackman
  14390. @item welch
  14391. @item flattop
  14392. @item bharris
  14393. @item bnuttall
  14394. @item bhann
  14395. @item sine
  14396. @item nuttall
  14397. @item lanczos
  14398. @item gauss
  14399. @item tukey
  14400. @item dolph
  14401. @item cauchy
  14402. @item parzen
  14403. @item poisson
  14404. @end table
  14405. Default value is @code{hann}.
  14406. @item orientation
  14407. Set orientation of time vs frequency axis. Can be @code{vertical} or
  14408. @code{horizontal}. Default is @code{vertical}.
  14409. @item overlap
  14410. Set ratio of overlap window. Default value is @code{0}.
  14411. When value is @code{1} overlap is set to recommended size for specific
  14412. window function currently used.
  14413. @item gain
  14414. Set scale gain for calculating intensity color values.
  14415. Default value is @code{1}.
  14416. @item data
  14417. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  14418. @item rotation
  14419. Set color rotation, must be in [-1.0, 1.0] range.
  14420. Default value is @code{0}.
  14421. @end table
  14422. The usage is very similar to the showwaves filter; see the examples in that
  14423. section.
  14424. @subsection Examples
  14425. @itemize
  14426. @item
  14427. Large window with logarithmic color scaling:
  14428. @example
  14429. showspectrum=s=1280x480:scale=log
  14430. @end example
  14431. @item
  14432. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  14433. @example
  14434. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  14435. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  14436. @end example
  14437. @end itemize
  14438. @section showspectrumpic
  14439. Convert input audio to a single video frame, representing the audio frequency
  14440. spectrum.
  14441. The filter accepts the following options:
  14442. @table @option
  14443. @item size, s
  14444. Specify the video size for the output. For the syntax of this option, check the
  14445. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14446. Default value is @code{4096x2048}.
  14447. @item mode
  14448. Specify display mode.
  14449. It accepts the following values:
  14450. @table @samp
  14451. @item combined
  14452. all channels are displayed in the same row
  14453. @item separate
  14454. all channels are displayed in separate rows
  14455. @end table
  14456. Default value is @samp{combined}.
  14457. @item color
  14458. Specify display color mode.
  14459. It accepts the following values:
  14460. @table @samp
  14461. @item channel
  14462. each channel is displayed in a separate color
  14463. @item intensity
  14464. each channel is displayed using the same color scheme
  14465. @item rainbow
  14466. each channel is displayed using the rainbow color scheme
  14467. @item moreland
  14468. each channel is displayed using the moreland color scheme
  14469. @item nebulae
  14470. each channel is displayed using the nebulae color scheme
  14471. @item fire
  14472. each channel is displayed using the fire color scheme
  14473. @item fiery
  14474. each channel is displayed using the fiery color scheme
  14475. @item fruit
  14476. each channel is displayed using the fruit color scheme
  14477. @item cool
  14478. each channel is displayed using the cool color scheme
  14479. @end table
  14480. Default value is @samp{intensity}.
  14481. @item scale
  14482. Specify scale used for calculating intensity color values.
  14483. It accepts the following values:
  14484. @table @samp
  14485. @item lin
  14486. linear
  14487. @item sqrt
  14488. square root, default
  14489. @item cbrt
  14490. cubic root
  14491. @item log
  14492. logarithmic
  14493. @item 4thrt
  14494. 4th root
  14495. @item 5thrt
  14496. 5th root
  14497. @end table
  14498. Default value is @samp{log}.
  14499. @item saturation
  14500. Set saturation modifier for displayed colors. Negative values provide
  14501. alternative color scheme. @code{0} is no saturation at all.
  14502. Saturation must be in [-10.0, 10.0] range.
  14503. Default value is @code{1}.
  14504. @item win_func
  14505. Set window function.
  14506. It accepts the following values:
  14507. @table @samp
  14508. @item rect
  14509. @item bartlett
  14510. @item hann
  14511. @item hanning
  14512. @item hamming
  14513. @item blackman
  14514. @item welch
  14515. @item flattop
  14516. @item bharris
  14517. @item bnuttall
  14518. @item bhann
  14519. @item sine
  14520. @item nuttall
  14521. @item lanczos
  14522. @item gauss
  14523. @item tukey
  14524. @item dolph
  14525. @item cauchy
  14526. @item parzen
  14527. @item poisson
  14528. @end table
  14529. Default value is @code{hann}.
  14530. @item orientation
  14531. Set orientation of time vs frequency axis. Can be @code{vertical} or
  14532. @code{horizontal}. Default is @code{vertical}.
  14533. @item gain
  14534. Set scale gain for calculating intensity color values.
  14535. Default value is @code{1}.
  14536. @item legend
  14537. Draw time and frequency axes and legends. Default is enabled.
  14538. @item rotation
  14539. Set color rotation, must be in [-1.0, 1.0] range.
  14540. Default value is @code{0}.
  14541. @end table
  14542. @subsection Examples
  14543. @itemize
  14544. @item
  14545. Extract an audio spectrogram of a whole audio track
  14546. in a 1024x1024 picture using @command{ffmpeg}:
  14547. @example
  14548. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  14549. @end example
  14550. @end itemize
  14551. @section showvolume
  14552. Convert input audio volume to a video output.
  14553. The filter accepts the following options:
  14554. @table @option
  14555. @item rate, r
  14556. Set video rate.
  14557. @item b
  14558. Set border width, allowed range is [0, 5]. Default is 1.
  14559. @item w
  14560. Set channel width, allowed range is [80, 8192]. Default is 400.
  14561. @item h
  14562. Set channel height, allowed range is [1, 900]. Default is 20.
  14563. @item f
  14564. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  14565. @item c
  14566. Set volume color expression.
  14567. The expression can use the following variables:
  14568. @table @option
  14569. @item VOLUME
  14570. Current max volume of channel in dB.
  14571. @item PEAK
  14572. Current peak.
  14573. @item CHANNEL
  14574. Current channel number, starting from 0.
  14575. @end table
  14576. @item t
  14577. If set, displays channel names. Default is enabled.
  14578. @item v
  14579. If set, displays volume values. Default is enabled.
  14580. @item o
  14581. Set orientation, can be @code{horizontal} or @code{vertical},
  14582. default is @code{horizontal}.
  14583. @item s
  14584. Set step size, allowed range s [0, 5]. Default is 0, which means
  14585. step is disabled.
  14586. @end table
  14587. @section showwaves
  14588. Convert input audio to a video output, representing the samples waves.
  14589. The filter accepts the following options:
  14590. @table @option
  14591. @item size, s
  14592. Specify the video size for the output. For the syntax of this option, check the
  14593. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14594. Default value is @code{600x240}.
  14595. @item mode
  14596. Set display mode.
  14597. Available values are:
  14598. @table @samp
  14599. @item point
  14600. Draw a point for each sample.
  14601. @item line
  14602. Draw a vertical line for each sample.
  14603. @item p2p
  14604. Draw a point for each sample and a line between them.
  14605. @item cline
  14606. Draw a centered vertical line for each sample.
  14607. @end table
  14608. Default value is @code{point}.
  14609. @item n
  14610. Set the number of samples which are printed on the same column. A
  14611. larger value will decrease the frame rate. Must be a positive
  14612. integer. This option can be set only if the value for @var{rate}
  14613. is not explicitly specified.
  14614. @item rate, r
  14615. Set the (approximate) output frame rate. This is done by setting the
  14616. option @var{n}. Default value is "25".
  14617. @item split_channels
  14618. Set if channels should be drawn separately or overlap. Default value is 0.
  14619. @item colors
  14620. Set colors separated by '|' which are going to be used for drawing of each channel.
  14621. @item scale
  14622. Set amplitude scale.
  14623. Available values are:
  14624. @table @samp
  14625. @item lin
  14626. Linear.
  14627. @item log
  14628. Logarithmic.
  14629. @item sqrt
  14630. Square root.
  14631. @item cbrt
  14632. Cubic root.
  14633. @end table
  14634. Default is linear.
  14635. @end table
  14636. @subsection Examples
  14637. @itemize
  14638. @item
  14639. Output the input file audio and the corresponding video representation
  14640. at the same time:
  14641. @example
  14642. amovie=a.mp3,asplit[out0],showwaves[out1]
  14643. @end example
  14644. @item
  14645. Create a synthetic signal and show it with showwaves, forcing a
  14646. frame rate of 30 frames per second:
  14647. @example
  14648. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  14649. @end example
  14650. @end itemize
  14651. @section showwavespic
  14652. Convert input audio to a single video frame, representing the samples waves.
  14653. The filter accepts the following options:
  14654. @table @option
  14655. @item size, s
  14656. Specify the video size for the output. For the syntax of this option, check the
  14657. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14658. Default value is @code{600x240}.
  14659. @item split_channels
  14660. Set if channels should be drawn separately or overlap. Default value is 0.
  14661. @item colors
  14662. Set colors separated by '|' which are going to be used for drawing of each channel.
  14663. @item scale
  14664. Set amplitude scale.
  14665. Available values are:
  14666. @table @samp
  14667. @item lin
  14668. Linear.
  14669. @item log
  14670. Logarithmic.
  14671. @item sqrt
  14672. Square root.
  14673. @item cbrt
  14674. Cubic root.
  14675. @end table
  14676. Default is linear.
  14677. @end table
  14678. @subsection Examples
  14679. @itemize
  14680. @item
  14681. Extract a channel split representation of the wave form of a whole audio track
  14682. in a 1024x800 picture using @command{ffmpeg}:
  14683. @example
  14684. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  14685. @end example
  14686. @end itemize
  14687. @section sidedata, asidedata
  14688. Delete frame side data, or select frames based on it.
  14689. This filter accepts the following options:
  14690. @table @option
  14691. @item mode
  14692. Set mode of operation of the filter.
  14693. Can be one of the following:
  14694. @table @samp
  14695. @item select
  14696. Select every frame with side data of @code{type}.
  14697. @item delete
  14698. Delete side data of @code{type}. If @code{type} is not set, delete all side
  14699. data in the frame.
  14700. @end table
  14701. @item type
  14702. Set side data type used with all modes. Must be set for @code{select} mode. For
  14703. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  14704. in @file{libavutil/frame.h}. For example, to choose
  14705. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  14706. @end table
  14707. @section spectrumsynth
  14708. Sythesize audio from 2 input video spectrums, first input stream represents
  14709. magnitude across time and second represents phase across time.
  14710. The filter will transform from frequency domain as displayed in videos back
  14711. to time domain as presented in audio output.
  14712. This filter is primarily created for reversing processed @ref{showspectrum}
  14713. filter outputs, but can synthesize sound from other spectrograms too.
  14714. But in such case results are going to be poor if the phase data is not
  14715. available, because in such cases phase data need to be recreated, usually
  14716. its just recreated from random noise.
  14717. For best results use gray only output (@code{channel} color mode in
  14718. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  14719. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  14720. @code{data} option. Inputs videos should generally use @code{fullframe}
  14721. slide mode as that saves resources needed for decoding video.
  14722. The filter accepts the following options:
  14723. @table @option
  14724. @item sample_rate
  14725. Specify sample rate of output audio, the sample rate of audio from which
  14726. spectrum was generated may differ.
  14727. @item channels
  14728. Set number of channels represented in input video spectrums.
  14729. @item scale
  14730. Set scale which was used when generating magnitude input spectrum.
  14731. Can be @code{lin} or @code{log}. Default is @code{log}.
  14732. @item slide
  14733. Set slide which was used when generating inputs spectrums.
  14734. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  14735. Default is @code{fullframe}.
  14736. @item win_func
  14737. Set window function used for resynthesis.
  14738. @item overlap
  14739. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14740. which means optimal overlap for selected window function will be picked.
  14741. @item orientation
  14742. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  14743. Default is @code{vertical}.
  14744. @end table
  14745. @subsection Examples
  14746. @itemize
  14747. @item
  14748. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  14749. then resynthesize videos back to audio with spectrumsynth:
  14750. @example
  14751. 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
  14752. 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
  14753. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  14754. @end example
  14755. @end itemize
  14756. @section split, asplit
  14757. Split input into several identical outputs.
  14758. @code{asplit} works with audio input, @code{split} with video.
  14759. The filter accepts a single parameter which specifies the number of outputs. If
  14760. unspecified, it defaults to 2.
  14761. @subsection Examples
  14762. @itemize
  14763. @item
  14764. Create two separate outputs from the same input:
  14765. @example
  14766. [in] split [out0][out1]
  14767. @end example
  14768. @item
  14769. To create 3 or more outputs, you need to specify the number of
  14770. outputs, like in:
  14771. @example
  14772. [in] asplit=3 [out0][out1][out2]
  14773. @end example
  14774. @item
  14775. Create two separate outputs from the same input, one cropped and
  14776. one padded:
  14777. @example
  14778. [in] split [splitout1][splitout2];
  14779. [splitout1] crop=100:100:0:0 [cropout];
  14780. [splitout2] pad=200:200:100:100 [padout];
  14781. @end example
  14782. @item
  14783. Create 5 copies of the input audio with @command{ffmpeg}:
  14784. @example
  14785. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  14786. @end example
  14787. @end itemize
  14788. @section zmq, azmq
  14789. Receive commands sent through a libzmq client, and forward them to
  14790. filters in the filtergraph.
  14791. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  14792. must be inserted between two video filters, @code{azmq} between two
  14793. audio filters.
  14794. To enable these filters you need to install the libzmq library and
  14795. headers and configure FFmpeg with @code{--enable-libzmq}.
  14796. For more information about libzmq see:
  14797. @url{http://www.zeromq.org/}
  14798. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  14799. receives messages sent through a network interface defined by the
  14800. @option{bind_address} option.
  14801. The received message must be in the form:
  14802. @example
  14803. @var{TARGET} @var{COMMAND} [@var{ARG}]
  14804. @end example
  14805. @var{TARGET} specifies the target of the command, usually the name of
  14806. the filter class or a specific filter instance name.
  14807. @var{COMMAND} specifies the name of the command for the target filter.
  14808. @var{ARG} is optional and specifies the optional argument list for the
  14809. given @var{COMMAND}.
  14810. Upon reception, the message is processed and the corresponding command
  14811. is injected into the filtergraph. Depending on the result, the filter
  14812. will send a reply to the client, adopting the format:
  14813. @example
  14814. @var{ERROR_CODE} @var{ERROR_REASON}
  14815. @var{MESSAGE}
  14816. @end example
  14817. @var{MESSAGE} is optional.
  14818. @subsection Examples
  14819. Look at @file{tools/zmqsend} for an example of a zmq client which can
  14820. be used to send commands processed by these filters.
  14821. Consider the following filtergraph generated by @command{ffplay}
  14822. @example
  14823. ffplay -dumpgraph 1 -f lavfi "
  14824. color=s=100x100:c=red [l];
  14825. color=s=100x100:c=blue [r];
  14826. nullsrc=s=200x100, zmq [bg];
  14827. [bg][l] overlay [bg+l];
  14828. [bg+l][r] overlay=x=100 "
  14829. @end example
  14830. To change the color of the left side of the video, the following
  14831. command can be used:
  14832. @example
  14833. echo Parsed_color_0 c yellow | tools/zmqsend
  14834. @end example
  14835. To change the right side:
  14836. @example
  14837. echo Parsed_color_1 c pink | tools/zmqsend
  14838. @end example
  14839. @c man end MULTIMEDIA FILTERS
  14840. @chapter Multimedia Sources
  14841. @c man begin MULTIMEDIA SOURCES
  14842. Below is a description of the currently available multimedia sources.
  14843. @section amovie
  14844. This is the same as @ref{movie} source, except it selects an audio
  14845. stream by default.
  14846. @anchor{movie}
  14847. @section movie
  14848. Read audio and/or video stream(s) from a movie container.
  14849. It accepts the following parameters:
  14850. @table @option
  14851. @item filename
  14852. The name of the resource to read (not necessarily a file; it can also be a
  14853. device or a stream accessed through some protocol).
  14854. @item format_name, f
  14855. Specifies the format assumed for the movie to read, and can be either
  14856. the name of a container or an input device. If not specified, the
  14857. format is guessed from @var{movie_name} or by probing.
  14858. @item seek_point, sp
  14859. Specifies the seek point in seconds. The frames will be output
  14860. starting from this seek point. The parameter is evaluated with
  14861. @code{av_strtod}, so the numerical value may be suffixed by an IS
  14862. postfix. The default value is "0".
  14863. @item streams, s
  14864. Specifies the streams to read. Several streams can be specified,
  14865. separated by "+". The source will then have as many outputs, in the
  14866. same order. The syntax is explained in the ``Stream specifiers''
  14867. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  14868. respectively the default (best suited) video and audio stream. Default
  14869. is "dv", or "da" if the filter is called as "amovie".
  14870. @item stream_index, si
  14871. Specifies the index of the video stream to read. If the value is -1,
  14872. the most suitable video stream will be automatically selected. The default
  14873. value is "-1". Deprecated. If the filter is called "amovie", it will select
  14874. audio instead of video.
  14875. @item loop
  14876. Specifies how many times to read the stream in sequence.
  14877. If the value is 0, the stream will be looped infinitely.
  14878. Default value is "1".
  14879. Note that when the movie is looped the source timestamps are not
  14880. changed, so it will generate non monotonically increasing timestamps.
  14881. @item discontinuity
  14882. Specifies the time difference between frames above which the point is
  14883. considered a timestamp discontinuity which is removed by adjusting the later
  14884. timestamps.
  14885. @end table
  14886. It allows overlaying a second video on top of the main input of
  14887. a filtergraph, as shown in this graph:
  14888. @example
  14889. input -----------> deltapts0 --> overlay --> output
  14890. ^
  14891. |
  14892. movie --> scale--> deltapts1 -------+
  14893. @end example
  14894. @subsection Examples
  14895. @itemize
  14896. @item
  14897. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  14898. on top of the input labelled "in":
  14899. @example
  14900. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  14901. [in] setpts=PTS-STARTPTS [main];
  14902. [main][over] overlay=16:16 [out]
  14903. @end example
  14904. @item
  14905. Read from a video4linux2 device, and overlay it on top of the input
  14906. labelled "in":
  14907. @example
  14908. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  14909. [in] setpts=PTS-STARTPTS [main];
  14910. [main][over] overlay=16:16 [out]
  14911. @end example
  14912. @item
  14913. Read the first video stream and the audio stream with id 0x81 from
  14914. dvd.vob; the video is connected to the pad named "video" and the audio is
  14915. connected to the pad named "audio":
  14916. @example
  14917. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  14918. @end example
  14919. @end itemize
  14920. @subsection Commands
  14921. Both movie and amovie support the following commands:
  14922. @table @option
  14923. @item seek
  14924. Perform seek using "av_seek_frame".
  14925. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  14926. @itemize
  14927. @item
  14928. @var{stream_index}: If stream_index is -1, a default
  14929. stream is selected, and @var{timestamp} is automatically converted
  14930. from AV_TIME_BASE units to the stream specific time_base.
  14931. @item
  14932. @var{timestamp}: Timestamp in AVStream.time_base units
  14933. or, if no stream is specified, in AV_TIME_BASE units.
  14934. @item
  14935. @var{flags}: Flags which select direction and seeking mode.
  14936. @end itemize
  14937. @item get_duration
  14938. Get movie duration in AV_TIME_BASE units.
  14939. @end table
  14940. @c man end MULTIMEDIA SOURCES