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.

19528 lines
518KB

  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. @anchor{pan}
  2567. @section pan
  2568. Mix channels with specific gain levels. The filter accepts the output
  2569. channel layout followed by a set of channels definitions.
  2570. This filter is also designed to efficiently remap the channels of an audio
  2571. stream.
  2572. The filter accepts parameters of the form:
  2573. "@var{l}|@var{outdef}|@var{outdef}|..."
  2574. @table @option
  2575. @item l
  2576. output channel layout or number of channels
  2577. @item outdef
  2578. output channel specification, of the form:
  2579. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  2580. @item out_name
  2581. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2582. number (c0, c1, etc.)
  2583. @item gain
  2584. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2585. @item in_name
  2586. input channel to use, see out_name for details; it is not possible to mix
  2587. named and numbered input channels
  2588. @end table
  2589. If the `=' in a channel specification is replaced by `<', then the gains for
  2590. that specification will be renormalized so that the total is 1, thus
  2591. avoiding clipping noise.
  2592. @subsection Mixing examples
  2593. For example, if you want to down-mix from stereo to mono, but with a bigger
  2594. factor for the left channel:
  2595. @example
  2596. pan=1c|c0=0.9*c0+0.1*c1
  2597. @end example
  2598. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2599. 7-channels surround:
  2600. @example
  2601. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2602. @end example
  2603. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2604. that should be preferred (see "-ac" option) unless you have very specific
  2605. needs.
  2606. @subsection Remapping examples
  2607. The channel remapping will be effective if, and only if:
  2608. @itemize
  2609. @item gain coefficients are zeroes or ones,
  2610. @item only one input per channel output,
  2611. @end itemize
  2612. If all these conditions are satisfied, the filter will notify the user ("Pure
  2613. channel mapping detected"), and use an optimized and lossless method to do the
  2614. remapping.
  2615. For example, if you have a 5.1 source and want a stereo audio stream by
  2616. dropping the extra channels:
  2617. @example
  2618. pan="stereo| c0=FL | c1=FR"
  2619. @end example
  2620. Given the same source, you can also switch front left and front right channels
  2621. and keep the input channel layout:
  2622. @example
  2623. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2624. @end example
  2625. If the input is a stereo audio stream, you can mute the front left channel (and
  2626. still keep the stereo channel layout) with:
  2627. @example
  2628. pan="stereo|c1=c1"
  2629. @end example
  2630. Still with a stereo audio stream input, you can copy the right channel in both
  2631. front left and right:
  2632. @example
  2633. pan="stereo| c0=FR | c1=FR"
  2634. @end example
  2635. @section replaygain
  2636. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2637. outputs it unchanged.
  2638. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2639. @section resample
  2640. Convert the audio sample format, sample rate and channel layout. It is
  2641. not meant to be used directly.
  2642. @section rubberband
  2643. Apply time-stretching and pitch-shifting with librubberband.
  2644. The filter accepts the following options:
  2645. @table @option
  2646. @item tempo
  2647. Set tempo scale factor.
  2648. @item pitch
  2649. Set pitch scale factor.
  2650. @item transients
  2651. Set transients detector.
  2652. Possible values are:
  2653. @table @var
  2654. @item crisp
  2655. @item mixed
  2656. @item smooth
  2657. @end table
  2658. @item detector
  2659. Set detector.
  2660. Possible values are:
  2661. @table @var
  2662. @item compound
  2663. @item percussive
  2664. @item soft
  2665. @end table
  2666. @item phase
  2667. Set phase.
  2668. Possible values are:
  2669. @table @var
  2670. @item laminar
  2671. @item independent
  2672. @end table
  2673. @item window
  2674. Set processing window size.
  2675. Possible values are:
  2676. @table @var
  2677. @item standard
  2678. @item short
  2679. @item long
  2680. @end table
  2681. @item smoothing
  2682. Set smoothing.
  2683. Possible values are:
  2684. @table @var
  2685. @item off
  2686. @item on
  2687. @end table
  2688. @item formant
  2689. Enable formant preservation when shift pitching.
  2690. Possible values are:
  2691. @table @var
  2692. @item shifted
  2693. @item preserved
  2694. @end table
  2695. @item pitchq
  2696. Set pitch quality.
  2697. Possible values are:
  2698. @table @var
  2699. @item quality
  2700. @item speed
  2701. @item consistency
  2702. @end table
  2703. @item channels
  2704. Set channels.
  2705. Possible values are:
  2706. @table @var
  2707. @item apart
  2708. @item together
  2709. @end table
  2710. @end table
  2711. @section sidechaincompress
  2712. This filter acts like normal compressor but has the ability to compress
  2713. detected signal using second input signal.
  2714. It needs two input streams and returns one output stream.
  2715. First input stream will be processed depending on second stream signal.
  2716. The filtered signal then can be filtered with other filters in later stages of
  2717. processing. See @ref{pan} and @ref{amerge} filter.
  2718. The filter accepts the following options:
  2719. @table @option
  2720. @item level_in
  2721. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2722. @item threshold
  2723. If a signal of second stream raises above this level it will affect the gain
  2724. reduction of first stream.
  2725. By default is 0.125. Range is between 0.00097563 and 1.
  2726. @item ratio
  2727. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2728. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2729. Default is 2. Range is between 1 and 20.
  2730. @item attack
  2731. Amount of milliseconds the signal has to rise above the threshold before gain
  2732. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2733. @item release
  2734. Amount of milliseconds the signal has to fall below the threshold before
  2735. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2736. @item makeup
  2737. Set the amount by how much signal will be amplified after processing.
  2738. Default is 1. Range is from 1 to 64.
  2739. @item knee
  2740. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2741. Default is 2.82843. Range is between 1 and 8.
  2742. @item link
  2743. Choose if the @code{average} level between all channels of side-chain stream
  2744. or the louder(@code{maximum}) channel of side-chain stream affects the
  2745. reduction. Default is @code{average}.
  2746. @item detection
  2747. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2748. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2749. @item level_sc
  2750. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2751. @item mix
  2752. How much to use compressed signal in output. Default is 1.
  2753. Range is between 0 and 1.
  2754. @end table
  2755. @subsection Examples
  2756. @itemize
  2757. @item
  2758. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2759. depending on the signal of 2nd input and later compressed signal to be
  2760. merged with 2nd input:
  2761. @example
  2762. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2763. @end example
  2764. @end itemize
  2765. @section sidechaingate
  2766. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2767. filter the detected signal before sending it to the gain reduction stage.
  2768. Normally a gate uses the full range signal to detect a level above the
  2769. threshold.
  2770. For example: If you cut all lower frequencies from your sidechain signal
  2771. the gate will decrease the volume of your track only if not enough highs
  2772. appear. With this technique you are able to reduce the resonation of a
  2773. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2774. guitar.
  2775. It needs two input streams and returns one output stream.
  2776. First input stream will be processed depending on second stream signal.
  2777. The filter accepts the following options:
  2778. @table @option
  2779. @item level_in
  2780. Set input level before filtering.
  2781. Default is 1. Allowed range is from 0.015625 to 64.
  2782. @item range
  2783. Set the level of gain reduction when the signal is below the threshold.
  2784. Default is 0.06125. Allowed range is from 0 to 1.
  2785. @item threshold
  2786. If a signal rises above this level the gain reduction is released.
  2787. Default is 0.125. Allowed range is from 0 to 1.
  2788. @item ratio
  2789. Set a ratio about which the signal is reduced.
  2790. Default is 2. Allowed range is from 1 to 9000.
  2791. @item attack
  2792. Amount of milliseconds the signal has to rise above the threshold before gain
  2793. reduction stops.
  2794. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2795. @item release
  2796. Amount of milliseconds the signal has to fall below the threshold before the
  2797. reduction is increased again. Default is 250 milliseconds.
  2798. Allowed range is from 0.01 to 9000.
  2799. @item makeup
  2800. Set amount of amplification of signal after processing.
  2801. Default is 1. Allowed range is from 1 to 64.
  2802. @item knee
  2803. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2804. Default is 2.828427125. Allowed range is from 1 to 8.
  2805. @item detection
  2806. Choose if exact signal should be taken for detection or an RMS like one.
  2807. Default is rms. Can be peak or rms.
  2808. @item link
  2809. Choose if the average level between all channels or the louder channel affects
  2810. the reduction.
  2811. Default is average. Can be average or maximum.
  2812. @item level_sc
  2813. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2814. @end table
  2815. @section silencedetect
  2816. Detect silence in an audio stream.
  2817. This filter logs a message when it detects that the input audio volume is less
  2818. or equal to a noise tolerance value for a duration greater or equal to the
  2819. minimum detected noise duration.
  2820. The printed times and duration are expressed in seconds.
  2821. The filter accepts the following options:
  2822. @table @option
  2823. @item duration, d
  2824. Set silence duration until notification (default is 2 seconds).
  2825. @item noise, n
  2826. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2827. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2828. @end table
  2829. @subsection Examples
  2830. @itemize
  2831. @item
  2832. Detect 5 seconds of silence with -50dB noise tolerance:
  2833. @example
  2834. silencedetect=n=-50dB:d=5
  2835. @end example
  2836. @item
  2837. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2838. tolerance in @file{silence.mp3}:
  2839. @example
  2840. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2841. @end example
  2842. @end itemize
  2843. @section silenceremove
  2844. Remove silence from the beginning, middle or end of the audio.
  2845. The filter accepts the following options:
  2846. @table @option
  2847. @item start_periods
  2848. This value is used to indicate if audio should be trimmed at beginning of
  2849. the audio. A value of zero indicates no silence should be trimmed from the
  2850. beginning. When specifying a non-zero value, it trims audio up until it
  2851. finds non-silence. Normally, when trimming silence from beginning of audio
  2852. the @var{start_periods} will be @code{1} but it can be increased to higher
  2853. values to trim all audio up to specific count of non-silence periods.
  2854. Default value is @code{0}.
  2855. @item start_duration
  2856. Specify the amount of time that non-silence must be detected before it stops
  2857. trimming audio. By increasing the duration, bursts of noises can be treated
  2858. as silence and trimmed off. Default value is @code{0}.
  2859. @item start_threshold
  2860. This indicates what sample value should be treated as silence. For digital
  2861. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2862. you may wish to increase the value to account for background noise.
  2863. Can be specified in dB (in case "dB" is appended to the specified value)
  2864. or amplitude ratio. Default value is @code{0}.
  2865. @item stop_periods
  2866. Set the count for trimming silence from the end of audio.
  2867. To remove silence from the middle of a file, specify a @var{stop_periods}
  2868. that is negative. This value is then treated as a positive value and is
  2869. used to indicate the effect should restart processing as specified by
  2870. @var{start_periods}, making it suitable for removing periods of silence
  2871. in the middle of the audio.
  2872. Default value is @code{0}.
  2873. @item stop_duration
  2874. Specify a duration of silence that must exist before audio is not copied any
  2875. more. By specifying a higher duration, silence that is wanted can be left in
  2876. the audio.
  2877. Default value is @code{0}.
  2878. @item stop_threshold
  2879. This is the same as @option{start_threshold} but for trimming silence from
  2880. the end of audio.
  2881. Can be specified in dB (in case "dB" is appended to the specified value)
  2882. or amplitude ratio. Default value is @code{0}.
  2883. @item leave_silence
  2884. This indicates that @var{stop_duration} length of audio should be left intact
  2885. at the beginning of each period of silence.
  2886. For example, if you want to remove long pauses between words but do not want
  2887. to remove the pauses completely. Default value is @code{0}.
  2888. @item detection
  2889. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  2890. and works better with digital silence which is exactly 0.
  2891. Default value is @code{rms}.
  2892. @item window
  2893. Set ratio used to calculate size of window for detecting silence.
  2894. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  2895. @end table
  2896. @subsection Examples
  2897. @itemize
  2898. @item
  2899. The following example shows how this filter can be used to start a recording
  2900. that does not contain the delay at the start which usually occurs between
  2901. pressing the record button and the start of the performance:
  2902. @example
  2903. silenceremove=1:5:0.02
  2904. @end example
  2905. @item
  2906. Trim all silence encountered from beginning to end where there is more than 1
  2907. second of silence in audio:
  2908. @example
  2909. silenceremove=0:0:0:-1:1:-90dB
  2910. @end example
  2911. @end itemize
  2912. @section sofalizer
  2913. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  2914. loudspeakers around the user for binaural listening via headphones (audio
  2915. formats up to 9 channels supported).
  2916. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  2917. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  2918. Austrian Academy of Sciences.
  2919. To enable compilation of this filter you need to configure FFmpeg with
  2920. @code{--enable-libmysofa}.
  2921. The filter accepts the following options:
  2922. @table @option
  2923. @item sofa
  2924. Set the SOFA file used for rendering.
  2925. @item gain
  2926. Set gain applied to audio. Value is in dB. Default is 0.
  2927. @item rotation
  2928. Set rotation of virtual loudspeakers in deg. Default is 0.
  2929. @item elevation
  2930. Set elevation of virtual speakers in deg. Default is 0.
  2931. @item radius
  2932. Set distance in meters between loudspeakers and the listener with near-field
  2933. HRTFs. Default is 1.
  2934. @item type
  2935. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2936. processing audio in time domain which is slow.
  2937. @var{freq} is processing audio in frequency domain which is fast.
  2938. Default is @var{freq}.
  2939. @item speakers
  2940. Set custom positions of virtual loudspeakers. Syntax for this option is:
  2941. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  2942. Each virtual loudspeaker is described with short channel name following with
  2943. azimuth and elevation in degrees.
  2944. Each virtual loudspeaker description is separated by '|'.
  2945. For example to override front left and front right channel positions use:
  2946. 'speakers=FL 45 15|FR 345 15'.
  2947. Descriptions with unrecognised channel names are ignored.
  2948. @item lfegain
  2949. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2950. @end table
  2951. @subsection Examples
  2952. @itemize
  2953. @item
  2954. Using ClubFritz6 sofa file:
  2955. @example
  2956. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  2957. @end example
  2958. @item
  2959. Using ClubFritz12 sofa file and bigger radius with small rotation:
  2960. @example
  2961. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  2962. @end example
  2963. @item
  2964. Similar as above but with custom speaker positions for front left, front right, back left and back right
  2965. and also with custom gain:
  2966. @example
  2967. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  2968. @end example
  2969. @end itemize
  2970. @section stereotools
  2971. This filter has some handy utilities to manage stereo signals, for converting
  2972. M/S stereo recordings to L/R signal while having control over the parameters
  2973. or spreading the stereo image of master track.
  2974. The filter accepts the following options:
  2975. @table @option
  2976. @item level_in
  2977. Set input level before filtering for both channels. Defaults is 1.
  2978. Allowed range is from 0.015625 to 64.
  2979. @item level_out
  2980. Set output level after filtering for both channels. Defaults is 1.
  2981. Allowed range is from 0.015625 to 64.
  2982. @item balance_in
  2983. Set input balance between both channels. Default is 0.
  2984. Allowed range is from -1 to 1.
  2985. @item balance_out
  2986. Set output balance between both channels. Default is 0.
  2987. Allowed range is from -1 to 1.
  2988. @item softclip
  2989. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  2990. clipping. Disabled by default.
  2991. @item mutel
  2992. Mute the left channel. Disabled by default.
  2993. @item muter
  2994. Mute the right channel. Disabled by default.
  2995. @item phasel
  2996. Change the phase of the left channel. Disabled by default.
  2997. @item phaser
  2998. Change the phase of the right channel. Disabled by default.
  2999. @item mode
  3000. Set stereo mode. Available values are:
  3001. @table @samp
  3002. @item lr>lr
  3003. Left/Right to Left/Right, this is default.
  3004. @item lr>ms
  3005. Left/Right to Mid/Side.
  3006. @item ms>lr
  3007. Mid/Side to Left/Right.
  3008. @item lr>ll
  3009. Left/Right to Left/Left.
  3010. @item lr>rr
  3011. Left/Right to Right/Right.
  3012. @item lr>l+r
  3013. Left/Right to Left + Right.
  3014. @item lr>rl
  3015. Left/Right to Right/Left.
  3016. @item ms>ll
  3017. Mid/Side to Left/Left.
  3018. @item ms>rr
  3019. Mid/Side to Right/Right.
  3020. @end table
  3021. @item slev
  3022. Set level of side signal. Default is 1.
  3023. Allowed range is from 0.015625 to 64.
  3024. @item sbal
  3025. Set balance of side signal. Default is 0.
  3026. Allowed range is from -1 to 1.
  3027. @item mlev
  3028. Set level of the middle signal. Default is 1.
  3029. Allowed range is from 0.015625 to 64.
  3030. @item mpan
  3031. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3032. @item base
  3033. Set stereo base between mono and inversed channels. Default is 0.
  3034. Allowed range is from -1 to 1.
  3035. @item delay
  3036. Set delay in milliseconds how much to delay left from right channel and
  3037. vice versa. Default is 0. Allowed range is from -20 to 20.
  3038. @item sclevel
  3039. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3040. @item phase
  3041. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3042. @item bmode_in, bmode_out
  3043. Set balance mode for balance_in/balance_out option.
  3044. Can be one of the following:
  3045. @table @samp
  3046. @item balance
  3047. Classic balance mode. Attenuate one channel at time.
  3048. Gain is raised up to 1.
  3049. @item amplitude
  3050. Similar as classic mode above but gain is raised up to 2.
  3051. @item power
  3052. Equal power distribution, from -6dB to +6dB range.
  3053. @end table
  3054. @end table
  3055. @subsection Examples
  3056. @itemize
  3057. @item
  3058. Apply karaoke like effect:
  3059. @example
  3060. stereotools=mlev=0.015625
  3061. @end example
  3062. @item
  3063. Convert M/S signal to L/R:
  3064. @example
  3065. "stereotools=mode=ms>lr"
  3066. @end example
  3067. @end itemize
  3068. @section stereowiden
  3069. This filter enhance the stereo effect by suppressing signal common to both
  3070. channels and by delaying the signal of left into right and vice versa,
  3071. thereby widening the stereo effect.
  3072. The filter accepts the following options:
  3073. @table @option
  3074. @item delay
  3075. Time in milliseconds of the delay of left signal into right and vice versa.
  3076. Default is 20 milliseconds.
  3077. @item feedback
  3078. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3079. effect of left signal in right output and vice versa which gives widening
  3080. effect. Default is 0.3.
  3081. @item crossfeed
  3082. Cross feed of left into right with inverted phase. This helps in suppressing
  3083. the mono. If the value is 1 it will cancel all the signal common to both
  3084. channels. Default is 0.3.
  3085. @item drymix
  3086. Set level of input signal of original channel. Default is 0.8.
  3087. @end table
  3088. @section superequalizer
  3089. Apply 18 band equalizer.
  3090. The filter accepts the following options:
  3091. @table @option
  3092. @item 1b
  3093. Set 65Hz band gain.
  3094. @item 2b
  3095. Set 92Hz band gain.
  3096. @item 3b
  3097. Set 131Hz band gain.
  3098. @item 4b
  3099. Set 185Hz band gain.
  3100. @item 5b
  3101. Set 262Hz band gain.
  3102. @item 6b
  3103. Set 370Hz band gain.
  3104. @item 7b
  3105. Set 523Hz band gain.
  3106. @item 8b
  3107. Set 740Hz band gain.
  3108. @item 9b
  3109. Set 1047Hz band gain.
  3110. @item 10b
  3111. Set 1480Hz band gain.
  3112. @item 11b
  3113. Set 2093Hz band gain.
  3114. @item 12b
  3115. Set 2960Hz band gain.
  3116. @item 13b
  3117. Set 4186Hz band gain.
  3118. @item 14b
  3119. Set 5920Hz band gain.
  3120. @item 15b
  3121. Set 8372Hz band gain.
  3122. @item 16b
  3123. Set 11840Hz band gain.
  3124. @item 17b
  3125. Set 16744Hz band gain.
  3126. @item 18b
  3127. Set 20000Hz band gain.
  3128. @end table
  3129. @section surround
  3130. Apply audio surround upmix filter.
  3131. This filter allows to produce multichannel output from audio stream.
  3132. The filter accepts the following options:
  3133. @table @option
  3134. @item chl_out
  3135. Set output channel layout. By default, this is @var{5.1}.
  3136. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3137. for the required syntax.
  3138. @item chl_in
  3139. Set input channel layout. By default, this is @var{stereo}.
  3140. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3141. for the required syntax.
  3142. @item level_in
  3143. Set input volume level. By default, this is @var{1}.
  3144. @item level_out
  3145. Set output volume level. By default, this is @var{1}.
  3146. @item lfe
  3147. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3148. @item lfe_low
  3149. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3150. @item lfe_high
  3151. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3152. @item fc_in
  3153. Set front center input volume. By default, this is @var{1}.
  3154. @item fc_out
  3155. Set front center output volume. By default, this is @var{1}.
  3156. @item lfe_in
  3157. Set LFE input volume. By default, this is @var{1}.
  3158. @item lfe_out
  3159. Set LFE output volume. By default, this is @var{1}.
  3160. @end table
  3161. @section treble
  3162. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3163. shelving filter with a response similar to that of a standard
  3164. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3165. The filter accepts the following options:
  3166. @table @option
  3167. @item gain, g
  3168. Give the gain at whichever is the lower of ~22 kHz and the
  3169. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3170. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3171. @item frequency, f
  3172. Set the filter's central frequency and so can be used
  3173. to extend or reduce the frequency range to be boosted or cut.
  3174. The default value is @code{3000} Hz.
  3175. @item width_type, t
  3176. Set method to specify band-width of filter.
  3177. @table @option
  3178. @item h
  3179. Hz
  3180. @item q
  3181. Q-Factor
  3182. @item o
  3183. octave
  3184. @item s
  3185. slope
  3186. @end table
  3187. @item width, w
  3188. Determine how steep is the filter's shelf transition.
  3189. @item channels, c
  3190. Specify which channels to filter, by default all available are filtered.
  3191. @end table
  3192. @section tremolo
  3193. Sinusoidal amplitude modulation.
  3194. The filter accepts the following options:
  3195. @table @option
  3196. @item f
  3197. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3198. (20 Hz or lower) will result in a tremolo effect.
  3199. This filter may also be used as a ring modulator by specifying
  3200. a modulation frequency higher than 20 Hz.
  3201. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3202. @item d
  3203. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3204. Default value is 0.5.
  3205. @end table
  3206. @section vibrato
  3207. Sinusoidal phase modulation.
  3208. The filter accepts the following options:
  3209. @table @option
  3210. @item f
  3211. Modulation frequency in Hertz.
  3212. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3213. @item d
  3214. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3215. Default value is 0.5.
  3216. @end table
  3217. @section volume
  3218. Adjust the input audio volume.
  3219. It accepts the following parameters:
  3220. @table @option
  3221. @item volume
  3222. Set audio volume expression.
  3223. Output values are clipped to the maximum value.
  3224. The output audio volume is given by the relation:
  3225. @example
  3226. @var{output_volume} = @var{volume} * @var{input_volume}
  3227. @end example
  3228. The default value for @var{volume} is "1.0".
  3229. @item precision
  3230. This parameter represents the mathematical precision.
  3231. It determines which input sample formats will be allowed, which affects the
  3232. precision of the volume scaling.
  3233. @table @option
  3234. @item fixed
  3235. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3236. @item float
  3237. 32-bit floating-point; this limits input sample format to FLT. (default)
  3238. @item double
  3239. 64-bit floating-point; this limits input sample format to DBL.
  3240. @end table
  3241. @item replaygain
  3242. Choose the behaviour on encountering ReplayGain side data in input frames.
  3243. @table @option
  3244. @item drop
  3245. Remove ReplayGain side data, ignoring its contents (the default).
  3246. @item ignore
  3247. Ignore ReplayGain side data, but leave it in the frame.
  3248. @item track
  3249. Prefer the track gain, if present.
  3250. @item album
  3251. Prefer the album gain, if present.
  3252. @end table
  3253. @item replaygain_preamp
  3254. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3255. Default value for @var{replaygain_preamp} is 0.0.
  3256. @item eval
  3257. Set when the volume expression is evaluated.
  3258. It accepts the following values:
  3259. @table @samp
  3260. @item once
  3261. only evaluate expression once during the filter initialization, or
  3262. when the @samp{volume} command is sent
  3263. @item frame
  3264. evaluate expression for each incoming frame
  3265. @end table
  3266. Default value is @samp{once}.
  3267. @end table
  3268. The volume expression can contain the following parameters.
  3269. @table @option
  3270. @item n
  3271. frame number (starting at zero)
  3272. @item nb_channels
  3273. number of channels
  3274. @item nb_consumed_samples
  3275. number of samples consumed by the filter
  3276. @item nb_samples
  3277. number of samples in the current frame
  3278. @item pos
  3279. original frame position in the file
  3280. @item pts
  3281. frame PTS
  3282. @item sample_rate
  3283. sample rate
  3284. @item startpts
  3285. PTS at start of stream
  3286. @item startt
  3287. time at start of stream
  3288. @item t
  3289. frame time
  3290. @item tb
  3291. timestamp timebase
  3292. @item volume
  3293. last set volume value
  3294. @end table
  3295. Note that when @option{eval} is set to @samp{once} only the
  3296. @var{sample_rate} and @var{tb} variables are available, all other
  3297. variables will evaluate to NAN.
  3298. @subsection Commands
  3299. This filter supports the following commands:
  3300. @table @option
  3301. @item volume
  3302. Modify the volume expression.
  3303. The command accepts the same syntax of the corresponding option.
  3304. If the specified expression is not valid, it is kept at its current
  3305. value.
  3306. @item replaygain_noclip
  3307. Prevent clipping by limiting the gain applied.
  3308. Default value for @var{replaygain_noclip} is 1.
  3309. @end table
  3310. @subsection Examples
  3311. @itemize
  3312. @item
  3313. Halve the input audio volume:
  3314. @example
  3315. volume=volume=0.5
  3316. volume=volume=1/2
  3317. volume=volume=-6.0206dB
  3318. @end example
  3319. In all the above example the named key for @option{volume} can be
  3320. omitted, for example like in:
  3321. @example
  3322. volume=0.5
  3323. @end example
  3324. @item
  3325. Increase input audio power by 6 decibels using fixed-point precision:
  3326. @example
  3327. volume=volume=6dB:precision=fixed
  3328. @end example
  3329. @item
  3330. Fade volume after time 10 with an annihilation period of 5 seconds:
  3331. @example
  3332. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3333. @end example
  3334. @end itemize
  3335. @section volumedetect
  3336. Detect the volume of the input video.
  3337. The filter has no parameters. The input is not modified. Statistics about
  3338. the volume will be printed in the log when the input stream end is reached.
  3339. In particular it will show the mean volume (root mean square), maximum
  3340. volume (on a per-sample basis), and the beginning of a histogram of the
  3341. registered volume values (from the maximum value to a cumulated 1/1000 of
  3342. the samples).
  3343. All volumes are in decibels relative to the maximum PCM value.
  3344. @subsection Examples
  3345. Here is an excerpt of the output:
  3346. @example
  3347. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3348. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3349. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3350. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3351. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3352. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3353. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3354. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3355. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3356. @end example
  3357. It means that:
  3358. @itemize
  3359. @item
  3360. The mean square energy is approximately -27 dB, or 10^-2.7.
  3361. @item
  3362. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3363. @item
  3364. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3365. @end itemize
  3366. In other words, raising the volume by +4 dB does not cause any clipping,
  3367. raising it by +5 dB causes clipping for 6 samples, etc.
  3368. @c man end AUDIO FILTERS
  3369. @chapter Audio Sources
  3370. @c man begin AUDIO SOURCES
  3371. Below is a description of the currently available audio sources.
  3372. @section abuffer
  3373. Buffer audio frames, and make them available to the filter chain.
  3374. This source is mainly intended for a programmatic use, in particular
  3375. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3376. It accepts the following parameters:
  3377. @table @option
  3378. @item time_base
  3379. The timebase which will be used for timestamps of submitted frames. It must be
  3380. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3381. @item sample_rate
  3382. The sample rate of the incoming audio buffers.
  3383. @item sample_fmt
  3384. The sample format of the incoming audio buffers.
  3385. Either a sample format name or its corresponding integer representation from
  3386. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3387. @item channel_layout
  3388. The channel layout of the incoming audio buffers.
  3389. Either a channel layout name from channel_layout_map in
  3390. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3391. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3392. @item channels
  3393. The number of channels of the incoming audio buffers.
  3394. If both @var{channels} and @var{channel_layout} are specified, then they
  3395. must be consistent.
  3396. @end table
  3397. @subsection Examples
  3398. @example
  3399. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3400. @end example
  3401. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3402. Since the sample format with name "s16p" corresponds to the number
  3403. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3404. equivalent to:
  3405. @example
  3406. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3407. @end example
  3408. @section aevalsrc
  3409. Generate an audio signal specified by an expression.
  3410. This source accepts in input one or more expressions (one for each
  3411. channel), which are evaluated and used to generate a corresponding
  3412. audio signal.
  3413. This source accepts the following options:
  3414. @table @option
  3415. @item exprs
  3416. Set the '|'-separated expressions list for each separate channel. In case the
  3417. @option{channel_layout} option is not specified, the selected channel layout
  3418. depends on the number of provided expressions. Otherwise the last
  3419. specified expression is applied to the remaining output channels.
  3420. @item channel_layout, c
  3421. Set the channel layout. The number of channels in the specified layout
  3422. must be equal to the number of specified expressions.
  3423. @item duration, d
  3424. Set the minimum duration of the sourced audio. See
  3425. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3426. for the accepted syntax.
  3427. Note that the resulting duration may be greater than the specified
  3428. duration, as the generated audio is always cut at the end of a
  3429. complete frame.
  3430. If not specified, or the expressed duration is negative, the audio is
  3431. supposed to be generated forever.
  3432. @item nb_samples, n
  3433. Set the number of samples per channel per each output frame,
  3434. default to 1024.
  3435. @item sample_rate, s
  3436. Specify the sample rate, default to 44100.
  3437. @end table
  3438. Each expression in @var{exprs} can contain the following constants:
  3439. @table @option
  3440. @item n
  3441. number of the evaluated sample, starting from 0
  3442. @item t
  3443. time of the evaluated sample expressed in seconds, starting from 0
  3444. @item s
  3445. sample rate
  3446. @end table
  3447. @subsection Examples
  3448. @itemize
  3449. @item
  3450. Generate silence:
  3451. @example
  3452. aevalsrc=0
  3453. @end example
  3454. @item
  3455. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3456. 8000 Hz:
  3457. @example
  3458. aevalsrc="sin(440*2*PI*t):s=8000"
  3459. @end example
  3460. @item
  3461. Generate a two channels signal, specify the channel layout (Front
  3462. Center + Back Center) explicitly:
  3463. @example
  3464. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3465. @end example
  3466. @item
  3467. Generate white noise:
  3468. @example
  3469. aevalsrc="-2+random(0)"
  3470. @end example
  3471. @item
  3472. Generate an amplitude modulated signal:
  3473. @example
  3474. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3475. @end example
  3476. @item
  3477. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3478. @example
  3479. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3480. @end example
  3481. @end itemize
  3482. @section anullsrc
  3483. The null audio source, return unprocessed audio frames. It is mainly useful
  3484. as a template and to be employed in analysis / debugging tools, or as
  3485. the source for filters which ignore the input data (for example the sox
  3486. synth filter).
  3487. This source accepts the following options:
  3488. @table @option
  3489. @item channel_layout, cl
  3490. Specifies the channel layout, and can be either an integer or a string
  3491. representing a channel layout. The default value of @var{channel_layout}
  3492. is "stereo".
  3493. Check the channel_layout_map definition in
  3494. @file{libavutil/channel_layout.c} for the mapping between strings and
  3495. channel layout values.
  3496. @item sample_rate, r
  3497. Specifies the sample rate, and defaults to 44100.
  3498. @item nb_samples, n
  3499. Set the number of samples per requested frames.
  3500. @end table
  3501. @subsection Examples
  3502. @itemize
  3503. @item
  3504. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3505. @example
  3506. anullsrc=r=48000:cl=4
  3507. @end example
  3508. @item
  3509. Do the same operation with a more obvious syntax:
  3510. @example
  3511. anullsrc=r=48000:cl=mono
  3512. @end example
  3513. @end itemize
  3514. All the parameters need to be explicitly defined.
  3515. @section flite
  3516. Synthesize a voice utterance using the libflite library.
  3517. To enable compilation of this filter you need to configure FFmpeg with
  3518. @code{--enable-libflite}.
  3519. Note that versions of the flite library prior to 2.0 are not thread-safe.
  3520. The filter accepts the following options:
  3521. @table @option
  3522. @item list_voices
  3523. If set to 1, list the names of the available voices and exit
  3524. immediately. Default value is 0.
  3525. @item nb_samples, n
  3526. Set the maximum number of samples per frame. Default value is 512.
  3527. @item textfile
  3528. Set the filename containing the text to speak.
  3529. @item text
  3530. Set the text to speak.
  3531. @item voice, v
  3532. Set the voice to use for the speech synthesis. Default value is
  3533. @code{kal}. See also the @var{list_voices} option.
  3534. @end table
  3535. @subsection Examples
  3536. @itemize
  3537. @item
  3538. Read from file @file{speech.txt}, and synthesize the text using the
  3539. standard flite voice:
  3540. @example
  3541. flite=textfile=speech.txt
  3542. @end example
  3543. @item
  3544. Read the specified text selecting the @code{slt} voice:
  3545. @example
  3546. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3547. @end example
  3548. @item
  3549. Input text to ffmpeg:
  3550. @example
  3551. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3552. @end example
  3553. @item
  3554. Make @file{ffplay} speak the specified text, using @code{flite} and
  3555. the @code{lavfi} device:
  3556. @example
  3557. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3558. @end example
  3559. @end itemize
  3560. For more information about libflite, check:
  3561. @url{http://www.festvox.org/flite/}
  3562. @section anoisesrc
  3563. Generate a noise audio signal.
  3564. The filter accepts the following options:
  3565. @table @option
  3566. @item sample_rate, r
  3567. Specify the sample rate. Default value is 48000 Hz.
  3568. @item amplitude, a
  3569. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3570. is 1.0.
  3571. @item duration, d
  3572. Specify the duration of the generated audio stream. Not specifying this option
  3573. results in noise with an infinite length.
  3574. @item color, colour, c
  3575. Specify the color of noise. Available noise colors are white, pink, brown,
  3576. blue and violet. Default color is white.
  3577. @item seed, s
  3578. Specify a value used to seed the PRNG.
  3579. @item nb_samples, n
  3580. Set the number of samples per each output frame, default is 1024.
  3581. @end table
  3582. @subsection Examples
  3583. @itemize
  3584. @item
  3585. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3586. @example
  3587. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3588. @end example
  3589. @end itemize
  3590. @section sine
  3591. Generate an audio signal made of a sine wave with amplitude 1/8.
  3592. The audio signal is bit-exact.
  3593. The filter accepts the following options:
  3594. @table @option
  3595. @item frequency, f
  3596. Set the carrier frequency. Default is 440 Hz.
  3597. @item beep_factor, b
  3598. Enable a periodic beep every second with frequency @var{beep_factor} times
  3599. the carrier frequency. Default is 0, meaning the beep is disabled.
  3600. @item sample_rate, r
  3601. Specify the sample rate, default is 44100.
  3602. @item duration, d
  3603. Specify the duration of the generated audio stream.
  3604. @item samples_per_frame
  3605. Set the number of samples per output frame.
  3606. The expression can contain the following constants:
  3607. @table @option
  3608. @item n
  3609. The (sequential) number of the output audio frame, starting from 0.
  3610. @item pts
  3611. The PTS (Presentation TimeStamp) of the output audio frame,
  3612. expressed in @var{TB} units.
  3613. @item t
  3614. The PTS of the output audio frame, expressed in seconds.
  3615. @item TB
  3616. The timebase of the output audio frames.
  3617. @end table
  3618. Default is @code{1024}.
  3619. @end table
  3620. @subsection Examples
  3621. @itemize
  3622. @item
  3623. Generate a simple 440 Hz sine wave:
  3624. @example
  3625. sine
  3626. @end example
  3627. @item
  3628. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3629. @example
  3630. sine=220:4:d=5
  3631. sine=f=220:b=4:d=5
  3632. sine=frequency=220:beep_factor=4:duration=5
  3633. @end example
  3634. @item
  3635. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3636. pattern:
  3637. @example
  3638. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3639. @end example
  3640. @end itemize
  3641. @c man end AUDIO SOURCES
  3642. @chapter Audio Sinks
  3643. @c man begin AUDIO SINKS
  3644. Below is a description of the currently available audio sinks.
  3645. @section abuffersink
  3646. Buffer audio frames, and make them available to the end of filter chain.
  3647. This sink is mainly intended for programmatic use, in particular
  3648. through the interface defined in @file{libavfilter/buffersink.h}
  3649. or the options system.
  3650. It accepts a pointer to an AVABufferSinkContext structure, which
  3651. defines the incoming buffers' formats, to be passed as the opaque
  3652. parameter to @code{avfilter_init_filter} for initialization.
  3653. @section anullsink
  3654. Null audio sink; do absolutely nothing with the input audio. It is
  3655. mainly useful as a template and for use in analysis / debugging
  3656. tools.
  3657. @c man end AUDIO SINKS
  3658. @chapter Video Filters
  3659. @c man begin VIDEO FILTERS
  3660. When you configure your FFmpeg build, you can disable any of the
  3661. existing filters using @code{--disable-filters}.
  3662. The configure output will show the video filters included in your
  3663. build.
  3664. Below is a description of the currently available video filters.
  3665. @section alphaextract
  3666. Extract the alpha component from the input as a grayscale video. This
  3667. is especially useful with the @var{alphamerge} filter.
  3668. @section alphamerge
  3669. Add or replace the alpha component of the primary input with the
  3670. grayscale value of a second input. This is intended for use with
  3671. @var{alphaextract} to allow the transmission or storage of frame
  3672. sequences that have alpha in a format that doesn't support an alpha
  3673. channel.
  3674. For example, to reconstruct full frames from a normal YUV-encoded video
  3675. and a separate video created with @var{alphaextract}, you might use:
  3676. @example
  3677. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3678. @end example
  3679. Since this filter is designed for reconstruction, it operates on frame
  3680. sequences without considering timestamps, and terminates when either
  3681. input reaches end of stream. This will cause problems if your encoding
  3682. pipeline drops frames. If you're trying to apply an image as an
  3683. overlay to a video stream, consider the @var{overlay} filter instead.
  3684. @section ass
  3685. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3686. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3687. Substation Alpha) subtitles files.
  3688. This filter accepts the following option in addition to the common options from
  3689. the @ref{subtitles} filter:
  3690. @table @option
  3691. @item shaping
  3692. Set the shaping engine
  3693. Available values are:
  3694. @table @samp
  3695. @item auto
  3696. The default libass shaping engine, which is the best available.
  3697. @item simple
  3698. Fast, font-agnostic shaper that can do only substitutions
  3699. @item complex
  3700. Slower shaper using OpenType for substitutions and positioning
  3701. @end table
  3702. The default is @code{auto}.
  3703. @end table
  3704. @section atadenoise
  3705. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3706. The filter accepts the following options:
  3707. @table @option
  3708. @item 0a
  3709. Set threshold A for 1st plane. Default is 0.02.
  3710. Valid range is 0 to 0.3.
  3711. @item 0b
  3712. Set threshold B for 1st plane. Default is 0.04.
  3713. Valid range is 0 to 5.
  3714. @item 1a
  3715. Set threshold A for 2nd plane. Default is 0.02.
  3716. Valid range is 0 to 0.3.
  3717. @item 1b
  3718. Set threshold B for 2nd plane. Default is 0.04.
  3719. Valid range is 0 to 5.
  3720. @item 2a
  3721. Set threshold A for 3rd plane. Default is 0.02.
  3722. Valid range is 0 to 0.3.
  3723. @item 2b
  3724. Set threshold B for 3rd plane. Default is 0.04.
  3725. Valid range is 0 to 5.
  3726. Threshold A is designed to react on abrupt changes in the input signal and
  3727. threshold B is designed to react on continuous changes in the input signal.
  3728. @item s
  3729. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3730. number in range [5, 129].
  3731. @item p
  3732. Set what planes of frame filter will use for averaging. Default is all.
  3733. @end table
  3734. @section avgblur
  3735. Apply average blur filter.
  3736. The filter accepts the following options:
  3737. @table @option
  3738. @item sizeX
  3739. Set horizontal kernel size.
  3740. @item planes
  3741. Set which planes to filter. By default all planes are filtered.
  3742. @item sizeY
  3743. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  3744. Default is @code{0}.
  3745. @end table
  3746. @section bbox
  3747. Compute the bounding box for the non-black pixels in the input frame
  3748. luminance plane.
  3749. This filter computes the bounding box containing all the pixels with a
  3750. luminance value greater than the minimum allowed value.
  3751. The parameters describing the bounding box are printed on the filter
  3752. log.
  3753. The filter accepts the following option:
  3754. @table @option
  3755. @item min_val
  3756. Set the minimal luminance value. Default is @code{16}.
  3757. @end table
  3758. @section bitplanenoise
  3759. Show and measure bit plane noise.
  3760. The filter accepts the following options:
  3761. @table @option
  3762. @item bitplane
  3763. Set which plane to analyze. Default is @code{1}.
  3764. @item filter
  3765. Filter out noisy pixels from @code{bitplane} set above.
  3766. Default is disabled.
  3767. @end table
  3768. @section blackdetect
  3769. Detect video intervals that are (almost) completely black. Can be
  3770. useful to detect chapter transitions, commercials, or invalid
  3771. recordings. Output lines contains the time for the start, end and
  3772. duration of the detected black interval expressed in seconds.
  3773. In order to display the output lines, you need to set the loglevel at
  3774. least to the AV_LOG_INFO value.
  3775. The filter accepts the following options:
  3776. @table @option
  3777. @item black_min_duration, d
  3778. Set the minimum detected black duration expressed in seconds. It must
  3779. be a non-negative floating point number.
  3780. Default value is 2.0.
  3781. @item picture_black_ratio_th, pic_th
  3782. Set the threshold for considering a picture "black".
  3783. Express the minimum value for the ratio:
  3784. @example
  3785. @var{nb_black_pixels} / @var{nb_pixels}
  3786. @end example
  3787. for which a picture is considered black.
  3788. Default value is 0.98.
  3789. @item pixel_black_th, pix_th
  3790. Set the threshold for considering a pixel "black".
  3791. The threshold expresses the maximum pixel luminance value for which a
  3792. pixel is considered "black". The provided value is scaled according to
  3793. the following equation:
  3794. @example
  3795. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  3796. @end example
  3797. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  3798. the input video format, the range is [0-255] for YUV full-range
  3799. formats and [16-235] for YUV non full-range formats.
  3800. Default value is 0.10.
  3801. @end table
  3802. The following example sets the maximum pixel threshold to the minimum
  3803. value, and detects only black intervals of 2 or more seconds:
  3804. @example
  3805. blackdetect=d=2:pix_th=0.00
  3806. @end example
  3807. @section blackframe
  3808. Detect frames that are (almost) completely black. Can be useful to
  3809. detect chapter transitions or commercials. Output lines consist of
  3810. the frame number of the detected frame, the percentage of blackness,
  3811. the position in the file if known or -1 and the timestamp in seconds.
  3812. In order to display the output lines, you need to set the loglevel at
  3813. least to the AV_LOG_INFO value.
  3814. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  3815. The value represents the percentage of pixels in the picture that
  3816. are below the threshold value.
  3817. It accepts the following parameters:
  3818. @table @option
  3819. @item amount
  3820. The percentage of the pixels that have to be below the threshold; it defaults to
  3821. @code{98}.
  3822. @item threshold, thresh
  3823. The threshold below which a pixel value is considered black; it defaults to
  3824. @code{32}.
  3825. @end table
  3826. @section blend, tblend
  3827. Blend two video frames into each other.
  3828. The @code{blend} filter takes two input streams and outputs one
  3829. stream, the first input is the "top" layer and second input is
  3830. "bottom" layer. By default, the output terminates when the longest input terminates.
  3831. The @code{tblend} (time blend) filter takes two consecutive frames
  3832. from one single stream, and outputs the result obtained by blending
  3833. the new frame on top of the old frame.
  3834. A description of the accepted options follows.
  3835. @table @option
  3836. @item c0_mode
  3837. @item c1_mode
  3838. @item c2_mode
  3839. @item c3_mode
  3840. @item all_mode
  3841. Set blend mode for specific pixel component or all pixel components in case
  3842. of @var{all_mode}. Default value is @code{normal}.
  3843. Available values for component modes are:
  3844. @table @samp
  3845. @item addition
  3846. @item grainmerge
  3847. @item and
  3848. @item average
  3849. @item burn
  3850. @item darken
  3851. @item difference
  3852. @item grainextract
  3853. @item divide
  3854. @item dodge
  3855. @item freeze
  3856. @item exclusion
  3857. @item extremity
  3858. @item glow
  3859. @item hardlight
  3860. @item hardmix
  3861. @item heat
  3862. @item lighten
  3863. @item linearlight
  3864. @item multiply
  3865. @item multiply128
  3866. @item negation
  3867. @item normal
  3868. @item or
  3869. @item overlay
  3870. @item phoenix
  3871. @item pinlight
  3872. @item reflect
  3873. @item screen
  3874. @item softlight
  3875. @item subtract
  3876. @item vividlight
  3877. @item xor
  3878. @end table
  3879. @item c0_opacity
  3880. @item c1_opacity
  3881. @item c2_opacity
  3882. @item c3_opacity
  3883. @item all_opacity
  3884. Set blend opacity for specific pixel component or all pixel components in case
  3885. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  3886. @item c0_expr
  3887. @item c1_expr
  3888. @item c2_expr
  3889. @item c3_expr
  3890. @item all_expr
  3891. Set blend expression for specific pixel component or all pixel components in case
  3892. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3893. The expressions can use the following variables:
  3894. @table @option
  3895. @item N
  3896. The sequential number of the filtered frame, starting from @code{0}.
  3897. @item X
  3898. @item Y
  3899. the coordinates of the current sample
  3900. @item W
  3901. @item H
  3902. the width and height of currently filtered plane
  3903. @item SW
  3904. @item SH
  3905. Width and height scale depending on the currently filtered plane. It is the
  3906. ratio between the corresponding luma plane number of pixels and the current
  3907. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3908. @code{0.5,0.5} for chroma planes.
  3909. @item T
  3910. Time of the current frame, expressed in seconds.
  3911. @item TOP, A
  3912. Value of pixel component at current location for first video frame (top layer).
  3913. @item BOTTOM, B
  3914. Value of pixel component at current location for second video frame (bottom layer).
  3915. @end table
  3916. @end table
  3917. The @code{blend} filter also supports the @ref{framesync} options.
  3918. @subsection Examples
  3919. @itemize
  3920. @item
  3921. Apply transition from bottom layer to top layer in first 10 seconds:
  3922. @example
  3923. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3924. @end example
  3925. @item
  3926. Apply linear horizontal transition from top layer to bottom layer:
  3927. @example
  3928. blend=all_expr='A*(X/W)+B*(1-X/W)'
  3929. @end example
  3930. @item
  3931. Apply 1x1 checkerboard effect:
  3932. @example
  3933. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  3934. @end example
  3935. @item
  3936. Apply uncover left effect:
  3937. @example
  3938. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  3939. @end example
  3940. @item
  3941. Apply uncover down effect:
  3942. @example
  3943. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  3944. @end example
  3945. @item
  3946. Apply uncover up-left effect:
  3947. @example
  3948. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  3949. @end example
  3950. @item
  3951. Split diagonally video and shows top and bottom layer on each side:
  3952. @example
  3953. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  3954. @end example
  3955. @item
  3956. Display differences between the current and the previous frame:
  3957. @example
  3958. tblend=all_mode=grainextract
  3959. @end example
  3960. @end itemize
  3961. @section boxblur
  3962. Apply a boxblur algorithm to the input video.
  3963. It accepts the following parameters:
  3964. @table @option
  3965. @item luma_radius, lr
  3966. @item luma_power, lp
  3967. @item chroma_radius, cr
  3968. @item chroma_power, cp
  3969. @item alpha_radius, ar
  3970. @item alpha_power, ap
  3971. @end table
  3972. A description of the accepted options follows.
  3973. @table @option
  3974. @item luma_radius, lr
  3975. @item chroma_radius, cr
  3976. @item alpha_radius, ar
  3977. Set an expression for the box radius in pixels used for blurring the
  3978. corresponding input plane.
  3979. The radius value must be a non-negative number, and must not be
  3980. greater than the value of the expression @code{min(w,h)/2} for the
  3981. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  3982. planes.
  3983. Default value for @option{luma_radius} is "2". If not specified,
  3984. @option{chroma_radius} and @option{alpha_radius} default to the
  3985. corresponding value set for @option{luma_radius}.
  3986. The expressions can contain the following constants:
  3987. @table @option
  3988. @item w
  3989. @item h
  3990. The input width and height in pixels.
  3991. @item cw
  3992. @item ch
  3993. The input chroma image width and height in pixels.
  3994. @item hsub
  3995. @item vsub
  3996. The horizontal and vertical chroma subsample values. For example, for the
  3997. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  3998. @end table
  3999. @item luma_power, lp
  4000. @item chroma_power, cp
  4001. @item alpha_power, ap
  4002. Specify how many times the boxblur filter is applied to the
  4003. corresponding plane.
  4004. Default value for @option{luma_power} is 2. If not specified,
  4005. @option{chroma_power} and @option{alpha_power} default to the
  4006. corresponding value set for @option{luma_power}.
  4007. A value of 0 will disable the effect.
  4008. @end table
  4009. @subsection Examples
  4010. @itemize
  4011. @item
  4012. Apply a boxblur filter with the luma, chroma, and alpha radii
  4013. set to 2:
  4014. @example
  4015. boxblur=luma_radius=2:luma_power=1
  4016. boxblur=2:1
  4017. @end example
  4018. @item
  4019. Set the luma radius to 2, and alpha and chroma radius to 0:
  4020. @example
  4021. boxblur=2:1:cr=0:ar=0
  4022. @end example
  4023. @item
  4024. Set the luma and chroma radii to a fraction of the video dimension:
  4025. @example
  4026. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4027. @end example
  4028. @end itemize
  4029. @section bwdif
  4030. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4031. Deinterlacing Filter").
  4032. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4033. interpolation algorithms.
  4034. It accepts the following parameters:
  4035. @table @option
  4036. @item mode
  4037. The interlacing mode to adopt. It accepts one of the following values:
  4038. @table @option
  4039. @item 0, send_frame
  4040. Output one frame for each frame.
  4041. @item 1, send_field
  4042. Output one frame for each field.
  4043. @end table
  4044. The default value is @code{send_field}.
  4045. @item parity
  4046. The picture field parity assumed for the input interlaced video. It accepts one
  4047. of the following values:
  4048. @table @option
  4049. @item 0, tff
  4050. Assume the top field is first.
  4051. @item 1, bff
  4052. Assume the bottom field is first.
  4053. @item -1, auto
  4054. Enable automatic detection of field parity.
  4055. @end table
  4056. The default value is @code{auto}.
  4057. If the interlacing is unknown or the decoder does not export this information,
  4058. top field first will be assumed.
  4059. @item deint
  4060. Specify which frames to deinterlace. Accept one of the following
  4061. values:
  4062. @table @option
  4063. @item 0, all
  4064. Deinterlace all frames.
  4065. @item 1, interlaced
  4066. Only deinterlace frames marked as interlaced.
  4067. @end table
  4068. The default value is @code{all}.
  4069. @end table
  4070. @section chromakey
  4071. YUV colorspace color/chroma keying.
  4072. The filter accepts the following options:
  4073. @table @option
  4074. @item color
  4075. The color which will be replaced with transparency.
  4076. @item similarity
  4077. Similarity percentage with the key color.
  4078. 0.01 matches only the exact key color, while 1.0 matches everything.
  4079. @item blend
  4080. Blend percentage.
  4081. 0.0 makes pixels either fully transparent, or not transparent at all.
  4082. Higher values result in semi-transparent pixels, with a higher transparency
  4083. the more similar the pixels color is to the key color.
  4084. @item yuv
  4085. Signals that the color passed is already in YUV instead of RGB.
  4086. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4087. This can be used to pass exact YUV values as hexadecimal numbers.
  4088. @end table
  4089. @subsection Examples
  4090. @itemize
  4091. @item
  4092. Make every green pixel in the input image transparent:
  4093. @example
  4094. ffmpeg -i input.png -vf chromakey=green out.png
  4095. @end example
  4096. @item
  4097. Overlay a greenscreen-video on top of a static black background.
  4098. @example
  4099. 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
  4100. @end example
  4101. @end itemize
  4102. @section ciescope
  4103. Display CIE color diagram with pixels overlaid onto it.
  4104. The filter accepts the following options:
  4105. @table @option
  4106. @item system
  4107. Set color system.
  4108. @table @samp
  4109. @item ntsc, 470m
  4110. @item ebu, 470bg
  4111. @item smpte
  4112. @item 240m
  4113. @item apple
  4114. @item widergb
  4115. @item cie1931
  4116. @item rec709, hdtv
  4117. @item uhdtv, rec2020
  4118. @end table
  4119. @item cie
  4120. Set CIE system.
  4121. @table @samp
  4122. @item xyy
  4123. @item ucs
  4124. @item luv
  4125. @end table
  4126. @item gamuts
  4127. Set what gamuts to draw.
  4128. See @code{system} option for available values.
  4129. @item size, s
  4130. Set ciescope size, by default set to 512.
  4131. @item intensity, i
  4132. Set intensity used to map input pixel values to CIE diagram.
  4133. @item contrast
  4134. Set contrast used to draw tongue colors that are out of active color system gamut.
  4135. @item corrgamma
  4136. Correct gamma displayed on scope, by default enabled.
  4137. @item showwhite
  4138. Show white point on CIE diagram, by default disabled.
  4139. @item gamma
  4140. Set input gamma. Used only with XYZ input color space.
  4141. @end table
  4142. @section codecview
  4143. Visualize information exported by some codecs.
  4144. Some codecs can export information through frames using side-data or other
  4145. means. For example, some MPEG based codecs export motion vectors through the
  4146. @var{export_mvs} flag in the codec @option{flags2} option.
  4147. The filter accepts the following option:
  4148. @table @option
  4149. @item mv
  4150. Set motion vectors to visualize.
  4151. Available flags for @var{mv} are:
  4152. @table @samp
  4153. @item pf
  4154. forward predicted MVs of P-frames
  4155. @item bf
  4156. forward predicted MVs of B-frames
  4157. @item bb
  4158. backward predicted MVs of B-frames
  4159. @end table
  4160. @item qp
  4161. Display quantization parameters using the chroma planes.
  4162. @item mv_type, mvt
  4163. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4164. Available flags for @var{mv_type} are:
  4165. @table @samp
  4166. @item fp
  4167. forward predicted MVs
  4168. @item bp
  4169. backward predicted MVs
  4170. @end table
  4171. @item frame_type, ft
  4172. Set frame type to visualize motion vectors of.
  4173. Available flags for @var{frame_type} are:
  4174. @table @samp
  4175. @item if
  4176. intra-coded frames (I-frames)
  4177. @item pf
  4178. predicted frames (P-frames)
  4179. @item bf
  4180. bi-directionally predicted frames (B-frames)
  4181. @end table
  4182. @end table
  4183. @subsection Examples
  4184. @itemize
  4185. @item
  4186. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4187. @example
  4188. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4189. @end example
  4190. @item
  4191. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4192. @example
  4193. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4194. @end example
  4195. @end itemize
  4196. @section colorbalance
  4197. Modify intensity of primary colors (red, green and blue) of input frames.
  4198. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4199. regions for the red-cyan, green-magenta or blue-yellow balance.
  4200. A positive adjustment value shifts the balance towards the primary color, a negative
  4201. value towards the complementary color.
  4202. The filter accepts the following options:
  4203. @table @option
  4204. @item rs
  4205. @item gs
  4206. @item bs
  4207. Adjust red, green and blue shadows (darkest pixels).
  4208. @item rm
  4209. @item gm
  4210. @item bm
  4211. Adjust red, green and blue midtones (medium pixels).
  4212. @item rh
  4213. @item gh
  4214. @item bh
  4215. Adjust red, green and blue highlights (brightest pixels).
  4216. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4217. @end table
  4218. @subsection Examples
  4219. @itemize
  4220. @item
  4221. Add red color cast to shadows:
  4222. @example
  4223. colorbalance=rs=.3
  4224. @end example
  4225. @end itemize
  4226. @section colorkey
  4227. RGB colorspace color keying.
  4228. The filter accepts the following options:
  4229. @table @option
  4230. @item color
  4231. The color which will be replaced with transparency.
  4232. @item similarity
  4233. Similarity percentage with the key color.
  4234. 0.01 matches only the exact key color, while 1.0 matches everything.
  4235. @item blend
  4236. Blend percentage.
  4237. 0.0 makes pixels either fully transparent, or not transparent at all.
  4238. Higher values result in semi-transparent pixels, with a higher transparency
  4239. the more similar the pixels color is to the key color.
  4240. @end table
  4241. @subsection Examples
  4242. @itemize
  4243. @item
  4244. Make every green pixel in the input image transparent:
  4245. @example
  4246. ffmpeg -i input.png -vf colorkey=green out.png
  4247. @end example
  4248. @item
  4249. Overlay a greenscreen-video on top of a static background image.
  4250. @example
  4251. 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
  4252. @end example
  4253. @end itemize
  4254. @section colorlevels
  4255. Adjust video input frames using levels.
  4256. The filter accepts the following options:
  4257. @table @option
  4258. @item rimin
  4259. @item gimin
  4260. @item bimin
  4261. @item aimin
  4262. Adjust red, green, blue and alpha input black point.
  4263. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4264. @item rimax
  4265. @item gimax
  4266. @item bimax
  4267. @item aimax
  4268. Adjust red, green, blue and alpha input white point.
  4269. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  4270. Input levels are used to lighten highlights (bright tones), darken shadows
  4271. (dark tones), change the balance of bright and dark tones.
  4272. @item romin
  4273. @item gomin
  4274. @item bomin
  4275. @item aomin
  4276. Adjust red, green, blue and alpha output black point.
  4277. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  4278. @item romax
  4279. @item gomax
  4280. @item bomax
  4281. @item aomax
  4282. Adjust red, green, blue and alpha output white point.
  4283. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  4284. Output levels allows manual selection of a constrained output level range.
  4285. @end table
  4286. @subsection Examples
  4287. @itemize
  4288. @item
  4289. Make video output darker:
  4290. @example
  4291. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4292. @end example
  4293. @item
  4294. Increase contrast:
  4295. @example
  4296. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4297. @end example
  4298. @item
  4299. Make video output lighter:
  4300. @example
  4301. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4302. @end example
  4303. @item
  4304. Increase brightness:
  4305. @example
  4306. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4307. @end example
  4308. @end itemize
  4309. @section colorchannelmixer
  4310. Adjust video input frames by re-mixing color channels.
  4311. This filter modifies a color channel by adding the values associated to
  4312. the other channels of the same pixels. For example if the value to
  4313. modify is red, the output value will be:
  4314. @example
  4315. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4316. @end example
  4317. The filter accepts the following options:
  4318. @table @option
  4319. @item rr
  4320. @item rg
  4321. @item rb
  4322. @item ra
  4323. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4324. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4325. @item gr
  4326. @item gg
  4327. @item gb
  4328. @item ga
  4329. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4330. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4331. @item br
  4332. @item bg
  4333. @item bb
  4334. @item ba
  4335. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4336. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4337. @item ar
  4338. @item ag
  4339. @item ab
  4340. @item aa
  4341. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4342. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4343. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4344. @end table
  4345. @subsection Examples
  4346. @itemize
  4347. @item
  4348. Convert source to grayscale:
  4349. @example
  4350. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4351. @end example
  4352. @item
  4353. Simulate sepia tones:
  4354. @example
  4355. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4356. @end example
  4357. @end itemize
  4358. @section colormatrix
  4359. Convert color matrix.
  4360. The filter accepts the following options:
  4361. @table @option
  4362. @item src
  4363. @item dst
  4364. Specify the source and destination color matrix. Both values must be
  4365. specified.
  4366. The accepted values are:
  4367. @table @samp
  4368. @item bt709
  4369. BT.709
  4370. @item fcc
  4371. FCC
  4372. @item bt601
  4373. BT.601
  4374. @item bt470
  4375. BT.470
  4376. @item bt470bg
  4377. BT.470BG
  4378. @item smpte170m
  4379. SMPTE-170M
  4380. @item smpte240m
  4381. SMPTE-240M
  4382. @item bt2020
  4383. BT.2020
  4384. @end table
  4385. @end table
  4386. For example to convert from BT.601 to SMPTE-240M, use the command:
  4387. @example
  4388. colormatrix=bt601:smpte240m
  4389. @end example
  4390. @section colorspace
  4391. Convert colorspace, transfer characteristics or color primaries.
  4392. Input video needs to have an even size.
  4393. The filter accepts the following options:
  4394. @table @option
  4395. @anchor{all}
  4396. @item all
  4397. Specify all color properties at once.
  4398. The accepted values are:
  4399. @table @samp
  4400. @item bt470m
  4401. BT.470M
  4402. @item bt470bg
  4403. BT.470BG
  4404. @item bt601-6-525
  4405. BT.601-6 525
  4406. @item bt601-6-625
  4407. BT.601-6 625
  4408. @item bt709
  4409. BT.709
  4410. @item smpte170m
  4411. SMPTE-170M
  4412. @item smpte240m
  4413. SMPTE-240M
  4414. @item bt2020
  4415. BT.2020
  4416. @end table
  4417. @anchor{space}
  4418. @item space
  4419. Specify output colorspace.
  4420. The accepted values are:
  4421. @table @samp
  4422. @item bt709
  4423. BT.709
  4424. @item fcc
  4425. FCC
  4426. @item bt470bg
  4427. BT.470BG or BT.601-6 625
  4428. @item smpte170m
  4429. SMPTE-170M or BT.601-6 525
  4430. @item smpte240m
  4431. SMPTE-240M
  4432. @item ycgco
  4433. YCgCo
  4434. @item bt2020ncl
  4435. BT.2020 with non-constant luminance
  4436. @end table
  4437. @anchor{trc}
  4438. @item trc
  4439. Specify output transfer characteristics.
  4440. The accepted values are:
  4441. @table @samp
  4442. @item bt709
  4443. BT.709
  4444. @item bt470m
  4445. BT.470M
  4446. @item bt470bg
  4447. BT.470BG
  4448. @item gamma22
  4449. Constant gamma of 2.2
  4450. @item gamma28
  4451. Constant gamma of 2.8
  4452. @item smpte170m
  4453. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4454. @item smpte240m
  4455. SMPTE-240M
  4456. @item srgb
  4457. SRGB
  4458. @item iec61966-2-1
  4459. iec61966-2-1
  4460. @item iec61966-2-4
  4461. iec61966-2-4
  4462. @item xvycc
  4463. xvycc
  4464. @item bt2020-10
  4465. BT.2020 for 10-bits content
  4466. @item bt2020-12
  4467. BT.2020 for 12-bits content
  4468. @end table
  4469. @anchor{primaries}
  4470. @item primaries
  4471. Specify output color primaries.
  4472. The accepted values are:
  4473. @table @samp
  4474. @item bt709
  4475. BT.709
  4476. @item bt470m
  4477. BT.470M
  4478. @item bt470bg
  4479. BT.470BG or BT.601-6 625
  4480. @item smpte170m
  4481. SMPTE-170M or BT.601-6 525
  4482. @item smpte240m
  4483. SMPTE-240M
  4484. @item film
  4485. film
  4486. @item smpte431
  4487. SMPTE-431
  4488. @item smpte432
  4489. SMPTE-432
  4490. @item bt2020
  4491. BT.2020
  4492. @item jedec-p22
  4493. JEDEC P22 phosphors
  4494. @end table
  4495. @anchor{range}
  4496. @item range
  4497. Specify output color range.
  4498. The accepted values are:
  4499. @table @samp
  4500. @item tv
  4501. TV (restricted) range
  4502. @item mpeg
  4503. MPEG (restricted) range
  4504. @item pc
  4505. PC (full) range
  4506. @item jpeg
  4507. JPEG (full) range
  4508. @end table
  4509. @item format
  4510. Specify output color format.
  4511. The accepted values are:
  4512. @table @samp
  4513. @item yuv420p
  4514. YUV 4:2:0 planar 8-bits
  4515. @item yuv420p10
  4516. YUV 4:2:0 planar 10-bits
  4517. @item yuv420p12
  4518. YUV 4:2:0 planar 12-bits
  4519. @item yuv422p
  4520. YUV 4:2:2 planar 8-bits
  4521. @item yuv422p10
  4522. YUV 4:2:2 planar 10-bits
  4523. @item yuv422p12
  4524. YUV 4:2:2 planar 12-bits
  4525. @item yuv444p
  4526. YUV 4:4:4 planar 8-bits
  4527. @item yuv444p10
  4528. YUV 4:4:4 planar 10-bits
  4529. @item yuv444p12
  4530. YUV 4:4:4 planar 12-bits
  4531. @end table
  4532. @item fast
  4533. Do a fast conversion, which skips gamma/primary correction. This will take
  4534. significantly less CPU, but will be mathematically incorrect. To get output
  4535. compatible with that produced by the colormatrix filter, use fast=1.
  4536. @item dither
  4537. Specify dithering mode.
  4538. The accepted values are:
  4539. @table @samp
  4540. @item none
  4541. No dithering
  4542. @item fsb
  4543. Floyd-Steinberg dithering
  4544. @end table
  4545. @item wpadapt
  4546. Whitepoint adaptation mode.
  4547. The accepted values are:
  4548. @table @samp
  4549. @item bradford
  4550. Bradford whitepoint adaptation
  4551. @item vonkries
  4552. von Kries whitepoint adaptation
  4553. @item identity
  4554. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4555. @end table
  4556. @item iall
  4557. Override all input properties at once. Same accepted values as @ref{all}.
  4558. @item ispace
  4559. Override input colorspace. Same accepted values as @ref{space}.
  4560. @item iprimaries
  4561. Override input color primaries. Same accepted values as @ref{primaries}.
  4562. @item itrc
  4563. Override input transfer characteristics. Same accepted values as @ref{trc}.
  4564. @item irange
  4565. Override input color range. Same accepted values as @ref{range}.
  4566. @end table
  4567. The filter converts the transfer characteristics, color space and color
  4568. primaries to the specified user values. The output value, if not specified,
  4569. is set to a default value based on the "all" property. If that property is
  4570. also not specified, the filter will log an error. The output color range and
  4571. format default to the same value as the input color range and format. The
  4572. input transfer characteristics, color space, color primaries and color range
  4573. should be set on the input data. If any of these are missing, the filter will
  4574. log an error and no conversion will take place.
  4575. For example to convert the input to SMPTE-240M, use the command:
  4576. @example
  4577. colorspace=smpte240m
  4578. @end example
  4579. @section convolution
  4580. Apply convolution 3x3 or 5x5 filter.
  4581. The filter accepts the following options:
  4582. @table @option
  4583. @item 0m
  4584. @item 1m
  4585. @item 2m
  4586. @item 3m
  4587. Set matrix for each plane.
  4588. Matrix is sequence of 9 or 25 signed integers.
  4589. @item 0rdiv
  4590. @item 1rdiv
  4591. @item 2rdiv
  4592. @item 3rdiv
  4593. Set multiplier for calculated value for each plane.
  4594. @item 0bias
  4595. @item 1bias
  4596. @item 2bias
  4597. @item 3bias
  4598. Set bias for each plane. This value is added to the result of the multiplication.
  4599. Useful for making the overall image brighter or darker. Default is 0.0.
  4600. @end table
  4601. @subsection Examples
  4602. @itemize
  4603. @item
  4604. Apply sharpen:
  4605. @example
  4606. 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"
  4607. @end example
  4608. @item
  4609. Apply blur:
  4610. @example
  4611. 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"
  4612. @end example
  4613. @item
  4614. Apply edge enhance:
  4615. @example
  4616. 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"
  4617. @end example
  4618. @item
  4619. Apply edge detect:
  4620. @example
  4621. 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"
  4622. @end example
  4623. @item
  4624. Apply laplacian edge detector which includes diagonals:
  4625. @example
  4626. 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"
  4627. @end example
  4628. @item
  4629. Apply emboss:
  4630. @example
  4631. 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"
  4632. @end example
  4633. @end itemize
  4634. @section convolve
  4635. Apply 2D convolution of video stream in frequency domain using second stream
  4636. as impulse.
  4637. The filter accepts the following options:
  4638. @table @option
  4639. @item planes
  4640. Set which planes to process.
  4641. @item impulse
  4642. Set which impulse video frames will be processed, can be @var{first}
  4643. or @var{all}. Default is @var{all}.
  4644. @end table
  4645. The @code{convolve} filter also supports the @ref{framesync} options.
  4646. @section copy
  4647. Copy the input video source unchanged to the output. This is mainly useful for
  4648. testing purposes.
  4649. @anchor{coreimage}
  4650. @section coreimage
  4651. Video filtering on GPU using Apple's CoreImage API on OSX.
  4652. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4653. processed by video hardware. However, software-based OpenGL implementations
  4654. exist which means there is no guarantee for hardware processing. It depends on
  4655. the respective OSX.
  4656. There are many filters and image generators provided by Apple that come with a
  4657. large variety of options. The filter has to be referenced by its name along
  4658. with its options.
  4659. The coreimage filter accepts the following options:
  4660. @table @option
  4661. @item list_filters
  4662. List all available filters and generators along with all their respective
  4663. options as well as possible minimum and maximum values along with the default
  4664. values.
  4665. @example
  4666. list_filters=true
  4667. @end example
  4668. @item filter
  4669. Specify all filters by their respective name and options.
  4670. Use @var{list_filters} to determine all valid filter names and options.
  4671. Numerical options are specified by a float value and are automatically clamped
  4672. to their respective value range. Vector and color options have to be specified
  4673. by a list of space separated float values. Character escaping has to be done.
  4674. A special option name @code{default} is available to use default options for a
  4675. filter.
  4676. It is required to specify either @code{default} or at least one of the filter options.
  4677. All omitted options are used with their default values.
  4678. The syntax of the filter string is as follows:
  4679. @example
  4680. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  4681. @end example
  4682. @item output_rect
  4683. Specify a rectangle where the output of the filter chain is copied into the
  4684. input image. It is given by a list of space separated float values:
  4685. @example
  4686. output_rect=x\ y\ width\ height
  4687. @end example
  4688. If not given, the output rectangle equals the dimensions of the input image.
  4689. The output rectangle is automatically cropped at the borders of the input
  4690. image. Negative values are valid for each component.
  4691. @example
  4692. output_rect=25\ 25\ 100\ 100
  4693. @end example
  4694. @end table
  4695. Several filters can be chained for successive processing without GPU-HOST
  4696. transfers allowing for fast processing of complex filter chains.
  4697. Currently, only filters with zero (generators) or exactly one (filters) input
  4698. image and one output image are supported. Also, transition filters are not yet
  4699. usable as intended.
  4700. Some filters generate output images with additional padding depending on the
  4701. respective filter kernel. The padding is automatically removed to ensure the
  4702. filter output has the same size as the input image.
  4703. For image generators, the size of the output image is determined by the
  4704. previous output image of the filter chain or the input image of the whole
  4705. filterchain, respectively. The generators do not use the pixel information of
  4706. this image to generate their output. However, the generated output is
  4707. blended onto this image, resulting in partial or complete coverage of the
  4708. output image.
  4709. The @ref{coreimagesrc} video source can be used for generating input images
  4710. which are directly fed into the filter chain. By using it, providing input
  4711. images by another video source or an input video is not required.
  4712. @subsection Examples
  4713. @itemize
  4714. @item
  4715. List all filters available:
  4716. @example
  4717. coreimage=list_filters=true
  4718. @end example
  4719. @item
  4720. Use the CIBoxBlur filter with default options to blur an image:
  4721. @example
  4722. coreimage=filter=CIBoxBlur@@default
  4723. @end example
  4724. @item
  4725. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  4726. its center at 100x100 and a radius of 50 pixels:
  4727. @example
  4728. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  4729. @end example
  4730. @item
  4731. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  4732. given as complete and escaped command-line for Apple's standard bash shell:
  4733. @example
  4734. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  4735. @end example
  4736. @end itemize
  4737. @section crop
  4738. Crop the input video to given dimensions.
  4739. It accepts the following parameters:
  4740. @table @option
  4741. @item w, out_w
  4742. The width of the output video. It defaults to @code{iw}.
  4743. This expression is evaluated only once during the filter
  4744. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  4745. @item h, out_h
  4746. The height of the output video. It defaults to @code{ih}.
  4747. This expression is evaluated only once during the filter
  4748. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  4749. @item x
  4750. The horizontal position, in the input video, of the left edge of the output
  4751. video. It defaults to @code{(in_w-out_w)/2}.
  4752. This expression is evaluated per-frame.
  4753. @item y
  4754. The vertical position, in the input video, of the top edge of the output video.
  4755. It defaults to @code{(in_h-out_h)/2}.
  4756. This expression is evaluated per-frame.
  4757. @item keep_aspect
  4758. If set to 1 will force the output display aspect ratio
  4759. to be the same of the input, by changing the output sample aspect
  4760. ratio. It defaults to 0.
  4761. @item exact
  4762. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  4763. width/height/x/y as specified and will not be rounded to nearest smaller value.
  4764. It defaults to 0.
  4765. @end table
  4766. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  4767. expressions containing the following constants:
  4768. @table @option
  4769. @item x
  4770. @item y
  4771. The computed values for @var{x} and @var{y}. They are evaluated for
  4772. each new frame.
  4773. @item in_w
  4774. @item in_h
  4775. The input width and height.
  4776. @item iw
  4777. @item ih
  4778. These are the same as @var{in_w} and @var{in_h}.
  4779. @item out_w
  4780. @item out_h
  4781. The output (cropped) width and height.
  4782. @item ow
  4783. @item oh
  4784. These are the same as @var{out_w} and @var{out_h}.
  4785. @item a
  4786. same as @var{iw} / @var{ih}
  4787. @item sar
  4788. input sample aspect ratio
  4789. @item dar
  4790. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4791. @item hsub
  4792. @item vsub
  4793. horizontal and vertical chroma subsample values. For example for the
  4794. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4795. @item n
  4796. The number of the input frame, starting from 0.
  4797. @item pos
  4798. the position in the file of the input frame, NAN if unknown
  4799. @item t
  4800. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  4801. @end table
  4802. The expression for @var{out_w} may depend on the value of @var{out_h},
  4803. and the expression for @var{out_h} may depend on @var{out_w}, but they
  4804. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  4805. evaluated after @var{out_w} and @var{out_h}.
  4806. The @var{x} and @var{y} parameters specify the expressions for the
  4807. position of the top-left corner of the output (non-cropped) area. They
  4808. are evaluated for each frame. If the evaluated value is not valid, it
  4809. is approximated to the nearest valid value.
  4810. The expression for @var{x} may depend on @var{y}, and the expression
  4811. for @var{y} may depend on @var{x}.
  4812. @subsection Examples
  4813. @itemize
  4814. @item
  4815. Crop area with size 100x100 at position (12,34).
  4816. @example
  4817. crop=100:100:12:34
  4818. @end example
  4819. Using named options, the example above becomes:
  4820. @example
  4821. crop=w=100:h=100:x=12:y=34
  4822. @end example
  4823. @item
  4824. Crop the central input area with size 100x100:
  4825. @example
  4826. crop=100:100
  4827. @end example
  4828. @item
  4829. Crop the central input area with size 2/3 of the input video:
  4830. @example
  4831. crop=2/3*in_w:2/3*in_h
  4832. @end example
  4833. @item
  4834. Crop the input video central square:
  4835. @example
  4836. crop=out_w=in_h
  4837. crop=in_h
  4838. @end example
  4839. @item
  4840. Delimit the rectangle with the top-left corner placed at position
  4841. 100:100 and the right-bottom corner corresponding to the right-bottom
  4842. corner of the input image.
  4843. @example
  4844. crop=in_w-100:in_h-100:100:100
  4845. @end example
  4846. @item
  4847. Crop 10 pixels from the left and right borders, and 20 pixels from
  4848. the top and bottom borders
  4849. @example
  4850. crop=in_w-2*10:in_h-2*20
  4851. @end example
  4852. @item
  4853. Keep only the bottom right quarter of the input image:
  4854. @example
  4855. crop=in_w/2:in_h/2:in_w/2:in_h/2
  4856. @end example
  4857. @item
  4858. Crop height for getting Greek harmony:
  4859. @example
  4860. crop=in_w:1/PHI*in_w
  4861. @end example
  4862. @item
  4863. Apply trembling effect:
  4864. @example
  4865. 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)
  4866. @end example
  4867. @item
  4868. Apply erratic camera effect depending on timestamp:
  4869. @example
  4870. 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)"
  4871. @end example
  4872. @item
  4873. Set x depending on the value of y:
  4874. @example
  4875. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  4876. @end example
  4877. @end itemize
  4878. @subsection Commands
  4879. This filter supports the following commands:
  4880. @table @option
  4881. @item w, out_w
  4882. @item h, out_h
  4883. @item x
  4884. @item y
  4885. Set width/height of the output video and the horizontal/vertical position
  4886. in the input video.
  4887. The command accepts the same syntax of the corresponding option.
  4888. If the specified expression is not valid, it is kept at its current
  4889. value.
  4890. @end table
  4891. @section cropdetect
  4892. Auto-detect the crop size.
  4893. It calculates the necessary cropping parameters and prints the
  4894. recommended parameters via the logging system. The detected dimensions
  4895. correspond to the non-black area of the input video.
  4896. It accepts the following parameters:
  4897. @table @option
  4898. @item limit
  4899. Set higher black value threshold, which can be optionally specified
  4900. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  4901. value greater to the set value is considered non-black. It defaults to 24.
  4902. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  4903. on the bitdepth of the pixel format.
  4904. @item round
  4905. The value which the width/height should be divisible by. It defaults to
  4906. 16. The offset is automatically adjusted to center the video. Use 2 to
  4907. get only even dimensions (needed for 4:2:2 video). 16 is best when
  4908. encoding to most video codecs.
  4909. @item reset_count, reset
  4910. Set the counter that determines after how many frames cropdetect will
  4911. reset the previously detected largest video area and start over to
  4912. detect the current optimal crop area. Default value is 0.
  4913. This can be useful when channel logos distort the video area. 0
  4914. indicates 'never reset', and returns the largest area encountered during
  4915. playback.
  4916. @end table
  4917. @anchor{curves}
  4918. @section curves
  4919. Apply color adjustments using curves.
  4920. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  4921. component (red, green and blue) has its values defined by @var{N} key points
  4922. tied from each other using a smooth curve. The x-axis represents the pixel
  4923. values from the input frame, and the y-axis the new pixel values to be set for
  4924. the output frame.
  4925. By default, a component curve is defined by the two points @var{(0;0)} and
  4926. @var{(1;1)}. This creates a straight line where each original pixel value is
  4927. "adjusted" to its own value, which means no change to the image.
  4928. The filter allows you to redefine these two points and add some more. A new
  4929. curve (using a natural cubic spline interpolation) will be define to pass
  4930. smoothly through all these new coordinates. The new defined points needs to be
  4931. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  4932. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  4933. the vector spaces, the values will be clipped accordingly.
  4934. The filter accepts the following options:
  4935. @table @option
  4936. @item preset
  4937. Select one of the available color presets. This option can be used in addition
  4938. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  4939. options takes priority on the preset values.
  4940. Available presets are:
  4941. @table @samp
  4942. @item none
  4943. @item color_negative
  4944. @item cross_process
  4945. @item darker
  4946. @item increase_contrast
  4947. @item lighter
  4948. @item linear_contrast
  4949. @item medium_contrast
  4950. @item negative
  4951. @item strong_contrast
  4952. @item vintage
  4953. @end table
  4954. Default is @code{none}.
  4955. @item master, m
  4956. Set the master key points. These points will define a second pass mapping. It
  4957. is sometimes called a "luminance" or "value" mapping. It can be used with
  4958. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  4959. post-processing LUT.
  4960. @item red, r
  4961. Set the key points for the red component.
  4962. @item green, g
  4963. Set the key points for the green component.
  4964. @item blue, b
  4965. Set the key points for the blue component.
  4966. @item all
  4967. Set the key points for all components (not including master).
  4968. Can be used in addition to the other key points component
  4969. options. In this case, the unset component(s) will fallback on this
  4970. @option{all} setting.
  4971. @item psfile
  4972. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  4973. @item plot
  4974. Save Gnuplot script of the curves in specified file.
  4975. @end table
  4976. To avoid some filtergraph syntax conflicts, each key points list need to be
  4977. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  4978. @subsection Examples
  4979. @itemize
  4980. @item
  4981. Increase slightly the middle level of blue:
  4982. @example
  4983. curves=blue='0/0 0.5/0.58 1/1'
  4984. @end example
  4985. @item
  4986. Vintage effect:
  4987. @example
  4988. 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'
  4989. @end example
  4990. Here we obtain the following coordinates for each components:
  4991. @table @var
  4992. @item red
  4993. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  4994. @item green
  4995. @code{(0;0) (0.50;0.48) (1;1)}
  4996. @item blue
  4997. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  4998. @end table
  4999. @item
  5000. The previous example can also be achieved with the associated built-in preset:
  5001. @example
  5002. curves=preset=vintage
  5003. @end example
  5004. @item
  5005. Or simply:
  5006. @example
  5007. curves=vintage
  5008. @end example
  5009. @item
  5010. Use a Photoshop preset and redefine the points of the green component:
  5011. @example
  5012. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  5013. @end example
  5014. @item
  5015. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  5016. and @command{gnuplot}:
  5017. @example
  5018. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  5019. gnuplot -p /tmp/curves.plt
  5020. @end example
  5021. @end itemize
  5022. @section datascope
  5023. Video data analysis filter.
  5024. This filter shows hexadecimal pixel values of part of video.
  5025. The filter accepts the following options:
  5026. @table @option
  5027. @item size, s
  5028. Set output video size.
  5029. @item x
  5030. Set x offset from where to pick pixels.
  5031. @item y
  5032. Set y offset from where to pick pixels.
  5033. @item mode
  5034. Set scope mode, can be one of the following:
  5035. @table @samp
  5036. @item mono
  5037. Draw hexadecimal pixel values with white color on black background.
  5038. @item color
  5039. Draw hexadecimal pixel values with input video pixel color on black
  5040. background.
  5041. @item color2
  5042. Draw hexadecimal pixel values on color background picked from input video,
  5043. the text color is picked in such way so its always visible.
  5044. @end table
  5045. @item axis
  5046. Draw rows and columns numbers on left and top of video.
  5047. @item opacity
  5048. Set background opacity.
  5049. @end table
  5050. @section dctdnoiz
  5051. Denoise frames using 2D DCT (frequency domain filtering).
  5052. This filter is not designed for real time.
  5053. The filter accepts the following options:
  5054. @table @option
  5055. @item sigma, s
  5056. Set the noise sigma constant.
  5057. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  5058. coefficient (absolute value) below this threshold with be dropped.
  5059. If you need a more advanced filtering, see @option{expr}.
  5060. Default is @code{0}.
  5061. @item overlap
  5062. Set number overlapping pixels for each block. Since the filter can be slow, you
  5063. may want to reduce this value, at the cost of a less effective filter and the
  5064. risk of various artefacts.
  5065. If the overlapping value doesn't permit processing the whole input width or
  5066. height, a warning will be displayed and according borders won't be denoised.
  5067. Default value is @var{blocksize}-1, which is the best possible setting.
  5068. @item expr, e
  5069. Set the coefficient factor expression.
  5070. For each coefficient of a DCT block, this expression will be evaluated as a
  5071. multiplier value for the coefficient.
  5072. If this is option is set, the @option{sigma} option will be ignored.
  5073. The absolute value of the coefficient can be accessed through the @var{c}
  5074. variable.
  5075. @item n
  5076. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  5077. @var{blocksize}, which is the width and height of the processed blocks.
  5078. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  5079. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5080. on the speed processing. Also, a larger block size does not necessarily means a
  5081. better de-noising.
  5082. @end table
  5083. @subsection Examples
  5084. Apply a denoise with a @option{sigma} of @code{4.5}:
  5085. @example
  5086. dctdnoiz=4.5
  5087. @end example
  5088. The same operation can be achieved using the expression system:
  5089. @example
  5090. dctdnoiz=e='gte(c, 4.5*3)'
  5091. @end example
  5092. Violent denoise using a block size of @code{16x16}:
  5093. @example
  5094. dctdnoiz=15:n=4
  5095. @end example
  5096. @section deband
  5097. Remove banding artifacts from input video.
  5098. It works by replacing banded pixels with average value of referenced pixels.
  5099. The filter accepts the following options:
  5100. @table @option
  5101. @item 1thr
  5102. @item 2thr
  5103. @item 3thr
  5104. @item 4thr
  5105. Set banding detection threshold for each plane. Default is 0.02.
  5106. Valid range is 0.00003 to 0.5.
  5107. If difference between current pixel and reference pixel is less than threshold,
  5108. it will be considered as banded.
  5109. @item range, r
  5110. Banding detection range in pixels. Default is 16. If positive, random number
  5111. in range 0 to set value will be used. If negative, exact absolute value
  5112. will be used.
  5113. The range defines square of four pixels around current pixel.
  5114. @item direction, d
  5115. Set direction in radians from which four pixel will be compared. If positive,
  5116. random direction from 0 to set direction will be picked. If negative, exact of
  5117. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5118. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5119. column.
  5120. @item blur, b
  5121. If enabled, current pixel is compared with average value of all four
  5122. surrounding pixels. The default is enabled. If disabled current pixel is
  5123. compared with all four surrounding pixels. The pixel is considered banded
  5124. if only all four differences with surrounding pixels are less than threshold.
  5125. @item coupling, c
  5126. If enabled, current pixel is changed if and only if all pixel components are banded,
  5127. e.g. banding detection threshold is triggered for all color components.
  5128. The default is disabled.
  5129. @end table
  5130. @anchor{decimate}
  5131. @section decimate
  5132. Drop duplicated frames at regular intervals.
  5133. The filter accepts the following options:
  5134. @table @option
  5135. @item cycle
  5136. Set the number of frames from which one will be dropped. Setting this to
  5137. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  5138. Default is @code{5}.
  5139. @item dupthresh
  5140. Set the threshold for duplicate detection. If the difference metric for a frame
  5141. is less than or equal to this value, then it is declared as duplicate. Default
  5142. is @code{1.1}
  5143. @item scthresh
  5144. Set scene change threshold. Default is @code{15}.
  5145. @item blockx
  5146. @item blocky
  5147. Set the size of the x and y-axis blocks used during metric calculations.
  5148. Larger blocks give better noise suppression, but also give worse detection of
  5149. small movements. Must be a power of two. Default is @code{32}.
  5150. @item ppsrc
  5151. Mark main input as a pre-processed input and activate clean source input
  5152. stream. This allows the input to be pre-processed with various filters to help
  5153. the metrics calculation while keeping the frame selection lossless. When set to
  5154. @code{1}, the first stream is for the pre-processed input, and the second
  5155. stream is the clean source from where the kept frames are chosen. Default is
  5156. @code{0}.
  5157. @item chroma
  5158. Set whether or not chroma is considered in the metric calculations. Default is
  5159. @code{1}.
  5160. @end table
  5161. @section deflate
  5162. Apply deflate effect to the video.
  5163. This filter replaces the pixel by the local(3x3) average by taking into account
  5164. only values lower than the pixel.
  5165. It accepts the following options:
  5166. @table @option
  5167. @item threshold0
  5168. @item threshold1
  5169. @item threshold2
  5170. @item threshold3
  5171. Limit the maximum change for each plane, default is 65535.
  5172. If 0, plane will remain unchanged.
  5173. @end table
  5174. @section deflicker
  5175. Remove temporal frame luminance variations.
  5176. It accepts the following options:
  5177. @table @option
  5178. @item size, s
  5179. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  5180. @item mode, m
  5181. Set averaging mode to smooth temporal luminance variations.
  5182. Available values are:
  5183. @table @samp
  5184. @item am
  5185. Arithmetic mean
  5186. @item gm
  5187. Geometric mean
  5188. @item hm
  5189. Harmonic mean
  5190. @item qm
  5191. Quadratic mean
  5192. @item cm
  5193. Cubic mean
  5194. @item pm
  5195. Power mean
  5196. @item median
  5197. Median
  5198. @end table
  5199. @item bypass
  5200. Do not actually modify frame. Useful when one only wants metadata.
  5201. @end table
  5202. @section dejudder
  5203. Remove judder produced by partially interlaced telecined content.
  5204. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  5205. source was partially telecined content then the output of @code{pullup,dejudder}
  5206. will have a variable frame rate. May change the recorded frame rate of the
  5207. container. Aside from that change, this filter will not affect constant frame
  5208. rate video.
  5209. The option available in this filter is:
  5210. @table @option
  5211. @item cycle
  5212. Specify the length of the window over which the judder repeats.
  5213. Accepts any integer greater than 1. Useful values are:
  5214. @table @samp
  5215. @item 4
  5216. If the original was telecined from 24 to 30 fps (Film to NTSC).
  5217. @item 5
  5218. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  5219. @item 20
  5220. If a mixture of the two.
  5221. @end table
  5222. The default is @samp{4}.
  5223. @end table
  5224. @section delogo
  5225. Suppress a TV station logo by a simple interpolation of the surrounding
  5226. pixels. Just set a rectangle covering the logo and watch it disappear
  5227. (and sometimes something even uglier appear - your mileage may vary).
  5228. It accepts the following parameters:
  5229. @table @option
  5230. @item x
  5231. @item y
  5232. Specify the top left corner coordinates of the logo. They must be
  5233. specified.
  5234. @item w
  5235. @item h
  5236. Specify the width and height of the logo to clear. They must be
  5237. specified.
  5238. @item band, t
  5239. Specify the thickness of the fuzzy edge of the rectangle (added to
  5240. @var{w} and @var{h}). The default value is 1. This option is
  5241. deprecated, setting higher values should no longer be necessary and
  5242. is not recommended.
  5243. @item show
  5244. When set to 1, a green rectangle is drawn on the screen to simplify
  5245. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  5246. The default value is 0.
  5247. The rectangle is drawn on the outermost pixels which will be (partly)
  5248. replaced with interpolated values. The values of the next pixels
  5249. immediately outside this rectangle in each direction will be used to
  5250. compute the interpolated pixel values inside the rectangle.
  5251. @end table
  5252. @subsection Examples
  5253. @itemize
  5254. @item
  5255. Set a rectangle covering the area with top left corner coordinates 0,0
  5256. and size 100x77, and a band of size 10:
  5257. @example
  5258. delogo=x=0:y=0:w=100:h=77:band=10
  5259. @end example
  5260. @end itemize
  5261. @section deshake
  5262. Attempt to fix small changes in horizontal and/or vertical shift. This
  5263. filter helps remove camera shake from hand-holding a camera, bumping a
  5264. tripod, moving on a vehicle, etc.
  5265. The filter accepts the following options:
  5266. @table @option
  5267. @item x
  5268. @item y
  5269. @item w
  5270. @item h
  5271. Specify a rectangular area where to limit the search for motion
  5272. vectors.
  5273. If desired the search for motion vectors can be limited to a
  5274. rectangular area of the frame defined by its top left corner, width
  5275. and height. These parameters have the same meaning as the drawbox
  5276. filter which can be used to visualise the position of the bounding
  5277. box.
  5278. This is useful when simultaneous movement of subjects within the frame
  5279. might be confused for camera motion by the motion vector search.
  5280. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  5281. then the full frame is used. This allows later options to be set
  5282. without specifying the bounding box for the motion vector search.
  5283. Default - search the whole frame.
  5284. @item rx
  5285. @item ry
  5286. Specify the maximum extent of movement in x and y directions in the
  5287. range 0-64 pixels. Default 16.
  5288. @item edge
  5289. Specify how to generate pixels to fill blanks at the edge of the
  5290. frame. Available values are:
  5291. @table @samp
  5292. @item blank, 0
  5293. Fill zeroes at blank locations
  5294. @item original, 1
  5295. Original image at blank locations
  5296. @item clamp, 2
  5297. Extruded edge value at blank locations
  5298. @item mirror, 3
  5299. Mirrored edge at blank locations
  5300. @end table
  5301. Default value is @samp{mirror}.
  5302. @item blocksize
  5303. Specify the blocksize to use for motion search. Range 4-128 pixels,
  5304. default 8.
  5305. @item contrast
  5306. Specify the contrast threshold for blocks. Only blocks with more than
  5307. the specified contrast (difference between darkest and lightest
  5308. pixels) will be considered. Range 1-255, default 125.
  5309. @item search
  5310. Specify the search strategy. Available values are:
  5311. @table @samp
  5312. @item exhaustive, 0
  5313. Set exhaustive search
  5314. @item less, 1
  5315. Set less exhaustive search.
  5316. @end table
  5317. Default value is @samp{exhaustive}.
  5318. @item filename
  5319. If set then a detailed log of the motion search is written to the
  5320. specified file.
  5321. @item opencl
  5322. If set to 1, specify using OpenCL capabilities, only available if
  5323. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  5324. @end table
  5325. @section despill
  5326. Remove unwanted contamination of foreground colors, caused by reflected color of
  5327. greenscreen or bluescreen.
  5328. This filter accepts the following options:
  5329. @table @option
  5330. @item type
  5331. Set what type of despill to use.
  5332. @item mix
  5333. Set how spillmap will be generated.
  5334. @item expand
  5335. Set how much to get rid of still remaining spill.
  5336. @item red
  5337. Controls amount of red in spill area.
  5338. @item green
  5339. Controls amount of green in spill area.
  5340. Should be -1 for greenscreen.
  5341. @item blue
  5342. Controls amount of blue in spill area.
  5343. Should be -1 for bluescreen.
  5344. @item brightness
  5345. Controls brightness of spill area, preserving colors.
  5346. @item alpha
  5347. Modify alpha from generated spillmap.
  5348. @end table
  5349. @section detelecine
  5350. Apply an exact inverse of the telecine operation. It requires a predefined
  5351. pattern specified using the pattern option which must be the same as that passed
  5352. to the telecine filter.
  5353. This filter accepts the following options:
  5354. @table @option
  5355. @item first_field
  5356. @table @samp
  5357. @item top, t
  5358. top field first
  5359. @item bottom, b
  5360. bottom field first
  5361. The default value is @code{top}.
  5362. @end table
  5363. @item pattern
  5364. A string of numbers representing the pulldown pattern you wish to apply.
  5365. The default value is @code{23}.
  5366. @item start_frame
  5367. A number representing position of the first frame with respect to the telecine
  5368. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  5369. @end table
  5370. @section dilation
  5371. Apply dilation effect to the video.
  5372. This filter replaces the pixel by the local(3x3) maximum.
  5373. It accepts the following options:
  5374. @table @option
  5375. @item threshold0
  5376. @item threshold1
  5377. @item threshold2
  5378. @item threshold3
  5379. Limit the maximum change for each plane, default is 65535.
  5380. If 0, plane will remain unchanged.
  5381. @item coordinates
  5382. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5383. pixels are used.
  5384. Flags to local 3x3 coordinates maps like this:
  5385. 1 2 3
  5386. 4 5
  5387. 6 7 8
  5388. @end table
  5389. @section displace
  5390. Displace pixels as indicated by second and third input stream.
  5391. It takes three input streams and outputs one stream, the first input is the
  5392. source, and second and third input are displacement maps.
  5393. The second input specifies how much to displace pixels along the
  5394. x-axis, while the third input specifies how much to displace pixels
  5395. along the y-axis.
  5396. If one of displacement map streams terminates, last frame from that
  5397. displacement map will be used.
  5398. Note that once generated, displacements maps can be reused over and over again.
  5399. A description of the accepted options follows.
  5400. @table @option
  5401. @item edge
  5402. Set displace behavior for pixels that are out of range.
  5403. Available values are:
  5404. @table @samp
  5405. @item blank
  5406. Missing pixels are replaced by black pixels.
  5407. @item smear
  5408. Adjacent pixels will spread out to replace missing pixels.
  5409. @item wrap
  5410. Out of range pixels are wrapped so they point to pixels of other side.
  5411. @item mirror
  5412. Out of range pixels will be replaced with mirrored pixels.
  5413. @end table
  5414. Default is @samp{smear}.
  5415. @end table
  5416. @subsection Examples
  5417. @itemize
  5418. @item
  5419. Add ripple effect to rgb input of video size hd720:
  5420. @example
  5421. 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
  5422. @end example
  5423. @item
  5424. Add wave effect to rgb input of video size hd720:
  5425. @example
  5426. 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
  5427. @end example
  5428. @end itemize
  5429. @section drawbox
  5430. Draw a colored box on the input image.
  5431. It accepts the following parameters:
  5432. @table @option
  5433. @item x
  5434. @item y
  5435. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5436. @item width, w
  5437. @item height, h
  5438. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5439. the input width and height. It defaults to 0.
  5440. @item color, c
  5441. Specify the color of the box to write. For the general syntax of this option,
  5442. check the "Color" section in the ffmpeg-utils manual. If the special
  5443. value @code{invert} is used, the box edge color is the same as the
  5444. video with inverted luma.
  5445. @item thickness, t
  5446. The expression which sets the thickness of the box edge. Default value is @code{3}.
  5447. See below for the list of accepted constants.
  5448. @end table
  5449. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5450. following constants:
  5451. @table @option
  5452. @item dar
  5453. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5454. @item hsub
  5455. @item vsub
  5456. horizontal and vertical chroma subsample values. For example for the
  5457. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5458. @item in_h, ih
  5459. @item in_w, iw
  5460. The input width and height.
  5461. @item sar
  5462. The input sample aspect ratio.
  5463. @item x
  5464. @item y
  5465. The x and y offset coordinates where the box is drawn.
  5466. @item w
  5467. @item h
  5468. The width and height of the drawn box.
  5469. @item t
  5470. The thickness of the drawn box.
  5471. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5472. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5473. @end table
  5474. @subsection Examples
  5475. @itemize
  5476. @item
  5477. Draw a black box around the edge of the input image:
  5478. @example
  5479. drawbox
  5480. @end example
  5481. @item
  5482. Draw a box with color red and an opacity of 50%:
  5483. @example
  5484. drawbox=10:20:200:60:red@@0.5
  5485. @end example
  5486. The previous example can be specified as:
  5487. @example
  5488. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5489. @end example
  5490. @item
  5491. Fill the box with pink color:
  5492. @example
  5493. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  5494. @end example
  5495. @item
  5496. Draw a 2-pixel red 2.40:1 mask:
  5497. @example
  5498. 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
  5499. @end example
  5500. @end itemize
  5501. @section drawgrid
  5502. Draw a grid on the input image.
  5503. It accepts the following parameters:
  5504. @table @option
  5505. @item x
  5506. @item y
  5507. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5508. @item width, w
  5509. @item height, h
  5510. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5511. input width and height, respectively, minus @code{thickness}, so image gets
  5512. framed. Default to 0.
  5513. @item color, c
  5514. Specify the color of the grid. For the general syntax of this option,
  5515. check the "Color" section in the ffmpeg-utils manual. If the special
  5516. value @code{invert} is used, the grid color is the same as the
  5517. video with inverted luma.
  5518. @item thickness, t
  5519. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5520. See below for the list of accepted constants.
  5521. @end table
  5522. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5523. following constants:
  5524. @table @option
  5525. @item dar
  5526. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5527. @item hsub
  5528. @item vsub
  5529. horizontal and vertical chroma subsample values. For example for the
  5530. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5531. @item in_h, ih
  5532. @item in_w, iw
  5533. The input grid cell width and height.
  5534. @item sar
  5535. The input sample aspect ratio.
  5536. @item x
  5537. @item y
  5538. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5539. @item w
  5540. @item h
  5541. The width and height of the drawn cell.
  5542. @item t
  5543. The thickness of the drawn cell.
  5544. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5545. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5546. @end table
  5547. @subsection Examples
  5548. @itemize
  5549. @item
  5550. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5551. @example
  5552. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5553. @end example
  5554. @item
  5555. Draw a white 3x3 grid with an opacity of 50%:
  5556. @example
  5557. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5558. @end example
  5559. @end itemize
  5560. @anchor{drawtext}
  5561. @section drawtext
  5562. Draw a text string or text from a specified file on top of a video, using the
  5563. libfreetype library.
  5564. To enable compilation of this filter, you need to configure FFmpeg with
  5565. @code{--enable-libfreetype}.
  5566. To enable default font fallback and the @var{font} option you need to
  5567. configure FFmpeg with @code{--enable-libfontconfig}.
  5568. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5569. @code{--enable-libfribidi}.
  5570. @subsection Syntax
  5571. It accepts the following parameters:
  5572. @table @option
  5573. @item box
  5574. Used to draw a box around text using the background color.
  5575. The value must be either 1 (enable) or 0 (disable).
  5576. The default value of @var{box} is 0.
  5577. @item boxborderw
  5578. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5579. The default value of @var{boxborderw} is 0.
  5580. @item boxcolor
  5581. The color to be used for drawing box around text. For the syntax of this
  5582. option, check the "Color" section in the ffmpeg-utils manual.
  5583. The default value of @var{boxcolor} is "white".
  5584. @item line_spacing
  5585. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  5586. The default value of @var{line_spacing} is 0.
  5587. @item borderw
  5588. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5589. The default value of @var{borderw} is 0.
  5590. @item bordercolor
  5591. Set the color to be used for drawing border around text. For the syntax of this
  5592. option, check the "Color" section in the ffmpeg-utils manual.
  5593. The default value of @var{bordercolor} is "black".
  5594. @item expansion
  5595. Select how the @var{text} is expanded. Can be either @code{none},
  5596. @code{strftime} (deprecated) or
  5597. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5598. below for details.
  5599. @item basetime
  5600. Set a start time for the count. Value is in microseconds. Only applied
  5601. in the deprecated strftime expansion mode. To emulate in normal expansion
  5602. mode use the @code{pts} function, supplying the start time (in seconds)
  5603. as the second argument.
  5604. @item fix_bounds
  5605. If true, check and fix text coords to avoid clipping.
  5606. @item fontcolor
  5607. The color to be used for drawing fonts. For the syntax of this option, check
  5608. the "Color" section in the ffmpeg-utils manual.
  5609. The default value of @var{fontcolor} is "black".
  5610. @item fontcolor_expr
  5611. String which is expanded the same way as @var{text} to obtain dynamic
  5612. @var{fontcolor} value. By default this option has empty value and is not
  5613. processed. When this option is set, it overrides @var{fontcolor} option.
  5614. @item font
  5615. The font family to be used for drawing text. By default Sans.
  5616. @item fontfile
  5617. The font file to be used for drawing text. The path must be included.
  5618. This parameter is mandatory if the fontconfig support is disabled.
  5619. @item alpha
  5620. Draw the text applying alpha blending. The value can
  5621. be a number between 0.0 and 1.0.
  5622. The expression accepts the same variables @var{x, y} as well.
  5623. The default value is 1.
  5624. Please see @var{fontcolor_expr}.
  5625. @item fontsize
  5626. The font size to be used for drawing text.
  5627. The default value of @var{fontsize} is 16.
  5628. @item text_shaping
  5629. If set to 1, attempt to shape the text (for example, reverse the order of
  5630. right-to-left text and join Arabic characters) before drawing it.
  5631. Otherwise, just draw the text exactly as given.
  5632. By default 1 (if supported).
  5633. @item ft_load_flags
  5634. The flags to be used for loading the fonts.
  5635. The flags map the corresponding flags supported by libfreetype, and are
  5636. a combination of the following values:
  5637. @table @var
  5638. @item default
  5639. @item no_scale
  5640. @item no_hinting
  5641. @item render
  5642. @item no_bitmap
  5643. @item vertical_layout
  5644. @item force_autohint
  5645. @item crop_bitmap
  5646. @item pedantic
  5647. @item ignore_global_advance_width
  5648. @item no_recurse
  5649. @item ignore_transform
  5650. @item monochrome
  5651. @item linear_design
  5652. @item no_autohint
  5653. @end table
  5654. Default value is "default".
  5655. For more information consult the documentation for the FT_LOAD_*
  5656. libfreetype flags.
  5657. @item shadowcolor
  5658. The color to be used for drawing a shadow behind the drawn text. For the
  5659. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  5660. The default value of @var{shadowcolor} is "black".
  5661. @item shadowx
  5662. @item shadowy
  5663. The x and y offsets for the text shadow position with respect to the
  5664. position of the text. They can be either positive or negative
  5665. values. The default value for both is "0".
  5666. @item start_number
  5667. The starting frame number for the n/frame_num variable. The default value
  5668. is "0".
  5669. @item tabsize
  5670. The size in number of spaces to use for rendering the tab.
  5671. Default value is 4.
  5672. @item timecode
  5673. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5674. format. It can be used with or without text parameter. @var{timecode_rate}
  5675. option must be specified.
  5676. @item timecode_rate, rate, r
  5677. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  5678. integer. Minimum value is "1".
  5679. Drop-frame timecode is supported for frame rates 30 & 60.
  5680. @item tc24hmax
  5681. If set to 1, the output of the timecode option will wrap around at 24 hours.
  5682. Default is 0 (disabled).
  5683. @item text
  5684. The text string to be drawn. The text must be a sequence of UTF-8
  5685. encoded characters.
  5686. This parameter is mandatory if no file is specified with the parameter
  5687. @var{textfile}.
  5688. @item textfile
  5689. A text file containing text to be drawn. The text must be a sequence
  5690. of UTF-8 encoded characters.
  5691. This parameter is mandatory if no text string is specified with the
  5692. parameter @var{text}.
  5693. If both @var{text} and @var{textfile} are specified, an error is thrown.
  5694. @item reload
  5695. If set to 1, the @var{textfile} will be reloaded before each frame.
  5696. Be sure to update it atomically, or it may be read partially, or even fail.
  5697. @item x
  5698. @item y
  5699. The expressions which specify the offsets where text will be drawn
  5700. within the video frame. They are relative to the top/left border of the
  5701. output image.
  5702. The default value of @var{x} and @var{y} is "0".
  5703. See below for the list of accepted constants and functions.
  5704. @end table
  5705. The parameters for @var{x} and @var{y} are expressions containing the
  5706. following constants and functions:
  5707. @table @option
  5708. @item dar
  5709. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  5710. @item hsub
  5711. @item vsub
  5712. horizontal and vertical chroma subsample values. For example for the
  5713. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5714. @item line_h, lh
  5715. the height of each text line
  5716. @item main_h, h, H
  5717. the input height
  5718. @item main_w, w, W
  5719. the input width
  5720. @item max_glyph_a, ascent
  5721. the maximum distance from the baseline to the highest/upper grid
  5722. coordinate used to place a glyph outline point, for all the rendered
  5723. glyphs.
  5724. It is a positive value, due to the grid's orientation with the Y axis
  5725. upwards.
  5726. @item max_glyph_d, descent
  5727. the maximum distance from the baseline to the lowest grid coordinate
  5728. used to place a glyph outline point, for all the rendered glyphs.
  5729. This is a negative value, due to the grid's orientation, with the Y axis
  5730. upwards.
  5731. @item max_glyph_h
  5732. maximum glyph height, that is the maximum height for all the glyphs
  5733. contained in the rendered text, it is equivalent to @var{ascent} -
  5734. @var{descent}.
  5735. @item max_glyph_w
  5736. maximum glyph width, that is the maximum width for all the glyphs
  5737. contained in the rendered text
  5738. @item n
  5739. the number of input frame, starting from 0
  5740. @item rand(min, max)
  5741. return a random number included between @var{min} and @var{max}
  5742. @item sar
  5743. The input sample aspect ratio.
  5744. @item t
  5745. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5746. @item text_h, th
  5747. the height of the rendered text
  5748. @item text_w, tw
  5749. the width of the rendered text
  5750. @item x
  5751. @item y
  5752. the x and y offset coordinates where the text is drawn.
  5753. These parameters allow the @var{x} and @var{y} expressions to refer
  5754. each other, so you can for example specify @code{y=x/dar}.
  5755. @end table
  5756. @anchor{drawtext_expansion}
  5757. @subsection Text expansion
  5758. If @option{expansion} is set to @code{strftime},
  5759. the filter recognizes strftime() sequences in the provided text and
  5760. expands them accordingly. Check the documentation of strftime(). This
  5761. feature is deprecated.
  5762. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  5763. If @option{expansion} is set to @code{normal} (which is the default),
  5764. the following expansion mechanism is used.
  5765. The backslash character @samp{\}, followed by any character, always expands to
  5766. the second character.
  5767. Sequences of the form @code{%@{...@}} are expanded. The text between the
  5768. braces is a function name, possibly followed by arguments separated by ':'.
  5769. If the arguments contain special characters or delimiters (':' or '@}'),
  5770. they should be escaped.
  5771. Note that they probably must also be escaped as the value for the
  5772. @option{text} option in the filter argument string and as the filter
  5773. argument in the filtergraph description, and possibly also for the shell,
  5774. that makes up to four levels of escaping; using a text file avoids these
  5775. problems.
  5776. The following functions are available:
  5777. @table @command
  5778. @item expr, e
  5779. The expression evaluation result.
  5780. It must take one argument specifying the expression to be evaluated,
  5781. which accepts the same constants and functions as the @var{x} and
  5782. @var{y} values. Note that not all constants should be used, for
  5783. example the text size is not known when evaluating the expression, so
  5784. the constants @var{text_w} and @var{text_h} will have an undefined
  5785. value.
  5786. @item expr_int_format, eif
  5787. Evaluate the expression's value and output as formatted integer.
  5788. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  5789. The second argument specifies the output format. Allowed values are @samp{x},
  5790. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  5791. @code{printf} function.
  5792. The third parameter is optional and sets the number of positions taken by the output.
  5793. It can be used to add padding with zeros from the left.
  5794. @item gmtime
  5795. The time at which the filter is running, expressed in UTC.
  5796. It can accept an argument: a strftime() format string.
  5797. @item localtime
  5798. The time at which the filter is running, expressed in the local time zone.
  5799. It can accept an argument: a strftime() format string.
  5800. @item metadata
  5801. Frame metadata. Takes one or two arguments.
  5802. The first argument is mandatory and specifies the metadata key.
  5803. The second argument is optional and specifies a default value, used when the
  5804. metadata key is not found or empty.
  5805. @item n, frame_num
  5806. The frame number, starting from 0.
  5807. @item pict_type
  5808. A 1 character description of the current picture type.
  5809. @item pts
  5810. The timestamp of the current frame.
  5811. It can take up to three arguments.
  5812. The first argument is the format of the timestamp; it defaults to @code{flt}
  5813. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  5814. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  5815. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  5816. @code{localtime} stands for the timestamp of the frame formatted as
  5817. local time zone time.
  5818. The second argument is an offset added to the timestamp.
  5819. If the format is set to @code{localtime} or @code{gmtime},
  5820. a third argument may be supplied: a strftime() format string.
  5821. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  5822. @end table
  5823. @subsection Examples
  5824. @itemize
  5825. @item
  5826. Draw "Test Text" with font FreeSerif, using the default values for the
  5827. optional parameters.
  5828. @example
  5829. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  5830. @end example
  5831. @item
  5832. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  5833. and y=50 (counting from the top-left corner of the screen), text is
  5834. yellow with a red box around it. Both the text and the box have an
  5835. opacity of 20%.
  5836. @example
  5837. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  5838. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  5839. @end example
  5840. Note that the double quotes are not necessary if spaces are not used
  5841. within the parameter list.
  5842. @item
  5843. Show the text at the center of the video frame:
  5844. @example
  5845. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  5846. @end example
  5847. @item
  5848. Show the text at a random position, switching to a new position every 30 seconds:
  5849. @example
  5850. 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)"
  5851. @end example
  5852. @item
  5853. Show a text line sliding from right to left in the last row of the video
  5854. frame. The file @file{LONG_LINE} is assumed to contain a single line
  5855. with no newlines.
  5856. @example
  5857. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  5858. @end example
  5859. @item
  5860. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  5861. @example
  5862. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  5863. @end example
  5864. @item
  5865. Draw a single green letter "g", at the center of the input video.
  5866. The glyph baseline is placed at half screen height.
  5867. @example
  5868. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  5869. @end example
  5870. @item
  5871. Show text for 1 second every 3 seconds:
  5872. @example
  5873. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  5874. @end example
  5875. @item
  5876. Use fontconfig to set the font. Note that the colons need to be escaped.
  5877. @example
  5878. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  5879. @end example
  5880. @item
  5881. Print the date of a real-time encoding (see strftime(3)):
  5882. @example
  5883. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  5884. @end example
  5885. @item
  5886. Show text fading in and out (appearing/disappearing):
  5887. @example
  5888. #!/bin/sh
  5889. DS=1.0 # display start
  5890. DE=10.0 # display end
  5891. FID=1.5 # fade in duration
  5892. FOD=5 # fade out duration
  5893. 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 @}"
  5894. @end example
  5895. @item
  5896. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  5897. and the @option{fontsize} value are included in the @option{y} offset.
  5898. @example
  5899. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  5900. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  5901. @end example
  5902. @end itemize
  5903. For more information about libfreetype, check:
  5904. @url{http://www.freetype.org/}.
  5905. For more information about fontconfig, check:
  5906. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  5907. For more information about libfribidi, check:
  5908. @url{http://fribidi.org/}.
  5909. @section edgedetect
  5910. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  5911. The filter accepts the following options:
  5912. @table @option
  5913. @item low
  5914. @item high
  5915. Set low and high threshold values used by the Canny thresholding
  5916. algorithm.
  5917. The high threshold selects the "strong" edge pixels, which are then
  5918. connected through 8-connectivity with the "weak" edge pixels selected
  5919. by the low threshold.
  5920. @var{low} and @var{high} threshold values must be chosen in the range
  5921. [0,1], and @var{low} should be lesser or equal to @var{high}.
  5922. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  5923. is @code{50/255}.
  5924. @item mode
  5925. Define the drawing mode.
  5926. @table @samp
  5927. @item wires
  5928. Draw white/gray wires on black background.
  5929. @item colormix
  5930. Mix the colors to create a paint/cartoon effect.
  5931. @end table
  5932. Default value is @var{wires}.
  5933. @end table
  5934. @subsection Examples
  5935. @itemize
  5936. @item
  5937. Standard edge detection with custom values for the hysteresis thresholding:
  5938. @example
  5939. edgedetect=low=0.1:high=0.4
  5940. @end example
  5941. @item
  5942. Painting effect without thresholding:
  5943. @example
  5944. edgedetect=mode=colormix:high=0
  5945. @end example
  5946. @end itemize
  5947. @section eq
  5948. Set brightness, contrast, saturation and approximate gamma adjustment.
  5949. The filter accepts the following options:
  5950. @table @option
  5951. @item contrast
  5952. Set the contrast expression. The value must be a float value in range
  5953. @code{-2.0} to @code{2.0}. The default value is "1".
  5954. @item brightness
  5955. Set the brightness expression. The value must be a float value in
  5956. range @code{-1.0} to @code{1.0}. The default value is "0".
  5957. @item saturation
  5958. Set the saturation expression. The value must be a float in
  5959. range @code{0.0} to @code{3.0}. The default value is "1".
  5960. @item gamma
  5961. Set the gamma expression. The value must be a float in range
  5962. @code{0.1} to @code{10.0}. The default value is "1".
  5963. @item gamma_r
  5964. Set the gamma expression for red. The value must be a float in
  5965. range @code{0.1} to @code{10.0}. The default value is "1".
  5966. @item gamma_g
  5967. Set the gamma expression for green. The value must be a float in range
  5968. @code{0.1} to @code{10.0}. The default value is "1".
  5969. @item gamma_b
  5970. Set the gamma expression for blue. The value must be a float in range
  5971. @code{0.1} to @code{10.0}. The default value is "1".
  5972. @item gamma_weight
  5973. Set the gamma weight expression. It can be used to reduce the effect
  5974. of a high gamma value on bright image areas, e.g. keep them from
  5975. getting overamplified and just plain white. The value must be a float
  5976. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  5977. gamma correction all the way down while @code{1.0} leaves it at its
  5978. full strength. Default is "1".
  5979. @item eval
  5980. Set when the expressions for brightness, contrast, saturation and
  5981. gamma expressions are evaluated.
  5982. It accepts the following values:
  5983. @table @samp
  5984. @item init
  5985. only evaluate expressions once during the filter initialization or
  5986. when a command is processed
  5987. @item frame
  5988. evaluate expressions for each incoming frame
  5989. @end table
  5990. Default value is @samp{init}.
  5991. @end table
  5992. The expressions accept the following parameters:
  5993. @table @option
  5994. @item n
  5995. frame count of the input frame starting from 0
  5996. @item pos
  5997. byte position of the corresponding packet in the input file, NAN if
  5998. unspecified
  5999. @item r
  6000. frame rate of the input video, NAN if the input frame rate is unknown
  6001. @item t
  6002. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6003. @end table
  6004. @subsection Commands
  6005. The filter supports the following commands:
  6006. @table @option
  6007. @item contrast
  6008. Set the contrast expression.
  6009. @item brightness
  6010. Set the brightness expression.
  6011. @item saturation
  6012. Set the saturation expression.
  6013. @item gamma
  6014. Set the gamma expression.
  6015. @item gamma_r
  6016. Set the gamma_r expression.
  6017. @item gamma_g
  6018. Set gamma_g expression.
  6019. @item gamma_b
  6020. Set gamma_b expression.
  6021. @item gamma_weight
  6022. Set gamma_weight expression.
  6023. The command accepts the same syntax of the corresponding option.
  6024. If the specified expression is not valid, it is kept at its current
  6025. value.
  6026. @end table
  6027. @section erosion
  6028. Apply erosion effect to the video.
  6029. This filter replaces the pixel by the local(3x3) minimum.
  6030. It accepts the following options:
  6031. @table @option
  6032. @item threshold0
  6033. @item threshold1
  6034. @item threshold2
  6035. @item threshold3
  6036. Limit the maximum change for each plane, default is 65535.
  6037. If 0, plane will remain unchanged.
  6038. @item coordinates
  6039. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6040. pixels are used.
  6041. Flags to local 3x3 coordinates maps like this:
  6042. 1 2 3
  6043. 4 5
  6044. 6 7 8
  6045. @end table
  6046. @section extractplanes
  6047. Extract color channel components from input video stream into
  6048. separate grayscale video streams.
  6049. The filter accepts the following option:
  6050. @table @option
  6051. @item planes
  6052. Set plane(s) to extract.
  6053. Available values for planes are:
  6054. @table @samp
  6055. @item y
  6056. @item u
  6057. @item v
  6058. @item a
  6059. @item r
  6060. @item g
  6061. @item b
  6062. @end table
  6063. Choosing planes not available in the input will result in an error.
  6064. That means you cannot select @code{r}, @code{g}, @code{b} planes
  6065. with @code{y}, @code{u}, @code{v} planes at same time.
  6066. @end table
  6067. @subsection Examples
  6068. @itemize
  6069. @item
  6070. Extract luma, u and v color channel component from input video frame
  6071. into 3 grayscale outputs:
  6072. @example
  6073. 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
  6074. @end example
  6075. @end itemize
  6076. @section elbg
  6077. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  6078. For each input image, the filter will compute the optimal mapping from
  6079. the input to the output given the codebook length, that is the number
  6080. of distinct output colors.
  6081. This filter accepts the following options.
  6082. @table @option
  6083. @item codebook_length, l
  6084. Set codebook length. The value must be a positive integer, and
  6085. represents the number of distinct output colors. Default value is 256.
  6086. @item nb_steps, n
  6087. Set the maximum number of iterations to apply for computing the optimal
  6088. mapping. The higher the value the better the result and the higher the
  6089. computation time. Default value is 1.
  6090. @item seed, s
  6091. Set a random seed, must be an integer included between 0 and
  6092. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  6093. will try to use a good random seed on a best effort basis.
  6094. @item pal8
  6095. Set pal8 output pixel format. This option does not work with codebook
  6096. length greater than 256.
  6097. @end table
  6098. @section fade
  6099. Apply a fade-in/out effect to the input video.
  6100. It accepts the following parameters:
  6101. @table @option
  6102. @item type, t
  6103. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  6104. effect.
  6105. Default is @code{in}.
  6106. @item start_frame, s
  6107. Specify the number of the frame to start applying the fade
  6108. effect at. Default is 0.
  6109. @item nb_frames, n
  6110. The number of frames that the fade effect lasts. At the end of the
  6111. fade-in effect, the output video will have the same intensity as the input video.
  6112. At the end of the fade-out transition, the output video will be filled with the
  6113. selected @option{color}.
  6114. Default is 25.
  6115. @item alpha
  6116. If set to 1, fade only alpha channel, if one exists on the input.
  6117. Default value is 0.
  6118. @item start_time, st
  6119. Specify the timestamp (in seconds) of the frame to start to apply the fade
  6120. effect. If both start_frame and start_time are specified, the fade will start at
  6121. whichever comes last. Default is 0.
  6122. @item duration, d
  6123. The number of seconds for which the fade effect has to last. At the end of the
  6124. fade-in effect the output video will have the same intensity as the input video,
  6125. at the end of the fade-out transition the output video will be filled with the
  6126. selected @option{color}.
  6127. If both duration and nb_frames are specified, duration is used. Default is 0
  6128. (nb_frames is used by default).
  6129. @item color, c
  6130. Specify the color of the fade. Default is "black".
  6131. @end table
  6132. @subsection Examples
  6133. @itemize
  6134. @item
  6135. Fade in the first 30 frames of video:
  6136. @example
  6137. fade=in:0:30
  6138. @end example
  6139. The command above is equivalent to:
  6140. @example
  6141. fade=t=in:s=0:n=30
  6142. @end example
  6143. @item
  6144. Fade out the last 45 frames of a 200-frame video:
  6145. @example
  6146. fade=out:155:45
  6147. fade=type=out:start_frame=155:nb_frames=45
  6148. @end example
  6149. @item
  6150. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  6151. @example
  6152. fade=in:0:25, fade=out:975:25
  6153. @end example
  6154. @item
  6155. Make the first 5 frames yellow, then fade in from frame 5-24:
  6156. @example
  6157. fade=in:5:20:color=yellow
  6158. @end example
  6159. @item
  6160. Fade in alpha over first 25 frames of video:
  6161. @example
  6162. fade=in:0:25:alpha=1
  6163. @end example
  6164. @item
  6165. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  6166. @example
  6167. fade=t=in:st=5.5:d=0.5
  6168. @end example
  6169. @end itemize
  6170. @section fftfilt
  6171. Apply arbitrary expressions to samples in frequency domain
  6172. @table @option
  6173. @item dc_Y
  6174. Adjust the dc value (gain) of the luma plane of the image. The filter
  6175. accepts an integer value in range @code{0} to @code{1000}. The default
  6176. value is set to @code{0}.
  6177. @item dc_U
  6178. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  6179. filter accepts an integer value in range @code{0} to @code{1000}. The
  6180. default value is set to @code{0}.
  6181. @item dc_V
  6182. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  6183. filter accepts an integer value in range @code{0} to @code{1000}. The
  6184. default value is set to @code{0}.
  6185. @item weight_Y
  6186. Set the frequency domain weight expression for the luma plane.
  6187. @item weight_U
  6188. Set the frequency domain weight expression for the 1st chroma plane.
  6189. @item weight_V
  6190. Set the frequency domain weight expression for the 2nd chroma plane.
  6191. @item eval
  6192. Set when the expressions are evaluated.
  6193. It accepts the following values:
  6194. @table @samp
  6195. @item init
  6196. Only evaluate expressions once during the filter initialization.
  6197. @item frame
  6198. Evaluate expressions for each incoming frame.
  6199. @end table
  6200. Default value is @samp{init}.
  6201. The filter accepts the following variables:
  6202. @item X
  6203. @item Y
  6204. The coordinates of the current sample.
  6205. @item W
  6206. @item H
  6207. The width and height of the image.
  6208. @item N
  6209. The number of input frame, starting from 0.
  6210. @end table
  6211. @subsection Examples
  6212. @itemize
  6213. @item
  6214. High-pass:
  6215. @example
  6216. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  6217. @end example
  6218. @item
  6219. Low-pass:
  6220. @example
  6221. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  6222. @end example
  6223. @item
  6224. Sharpen:
  6225. @example
  6226. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  6227. @end example
  6228. @item
  6229. Blur:
  6230. @example
  6231. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  6232. @end example
  6233. @end itemize
  6234. @section field
  6235. Extract a single field from an interlaced image using stride
  6236. arithmetic to avoid wasting CPU time. The output frames are marked as
  6237. non-interlaced.
  6238. The filter accepts the following options:
  6239. @table @option
  6240. @item type
  6241. Specify whether to extract the top (if the value is @code{0} or
  6242. @code{top}) or the bottom field (if the value is @code{1} or
  6243. @code{bottom}).
  6244. @end table
  6245. @section fieldhint
  6246. Create new frames by copying the top and bottom fields from surrounding frames
  6247. supplied as numbers by the hint file.
  6248. @table @option
  6249. @item hint
  6250. Set file containing hints: absolute/relative frame numbers.
  6251. There must be one line for each frame in a clip. Each line must contain two
  6252. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  6253. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  6254. is current frame number for @code{absolute} mode or out of [-1, 1] range
  6255. for @code{relative} mode. First number tells from which frame to pick up top
  6256. field and second number tells from which frame to pick up bottom field.
  6257. If optionally followed by @code{+} output frame will be marked as interlaced,
  6258. else if followed by @code{-} output frame will be marked as progressive, else
  6259. it will be marked same as input frame.
  6260. If line starts with @code{#} or @code{;} that line is skipped.
  6261. @item mode
  6262. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  6263. @end table
  6264. Example of first several lines of @code{hint} file for @code{relative} mode:
  6265. @example
  6266. 0,0 - # first frame
  6267. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  6268. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  6269. 1,0 -
  6270. 0,0 -
  6271. 0,0 -
  6272. 1,0 -
  6273. 1,0 -
  6274. 1,0 -
  6275. 0,0 -
  6276. 0,0 -
  6277. 1,0 -
  6278. 1,0 -
  6279. 1,0 -
  6280. 0,0 -
  6281. @end example
  6282. @section fieldmatch
  6283. Field matching filter for inverse telecine. It is meant to reconstruct the
  6284. progressive frames from a telecined stream. The filter does not drop duplicated
  6285. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  6286. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  6287. The separation of the field matching and the decimation is notably motivated by
  6288. the possibility of inserting a de-interlacing filter fallback between the two.
  6289. If the source has mixed telecined and real interlaced content,
  6290. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  6291. But these remaining combed frames will be marked as interlaced, and thus can be
  6292. de-interlaced by a later filter such as @ref{yadif} before decimation.
  6293. In addition to the various configuration options, @code{fieldmatch} can take an
  6294. optional second stream, activated through the @option{ppsrc} option. If
  6295. enabled, the frames reconstruction will be based on the fields and frames from
  6296. this second stream. This allows the first input to be pre-processed in order to
  6297. help the various algorithms of the filter, while keeping the output lossless
  6298. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  6299. or brightness/contrast adjustments can help.
  6300. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  6301. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  6302. which @code{fieldmatch} is based on. While the semantic and usage are very
  6303. close, some behaviour and options names can differ.
  6304. The @ref{decimate} filter currently only works for constant frame rate input.
  6305. If your input has mixed telecined (30fps) and progressive content with a lower
  6306. framerate like 24fps use the following filterchain to produce the necessary cfr
  6307. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  6308. The filter accepts the following options:
  6309. @table @option
  6310. @item order
  6311. Specify the assumed field order of the input stream. Available values are:
  6312. @table @samp
  6313. @item auto
  6314. Auto detect parity (use FFmpeg's internal parity value).
  6315. @item bff
  6316. Assume bottom field first.
  6317. @item tff
  6318. Assume top field first.
  6319. @end table
  6320. Note that it is sometimes recommended not to trust the parity announced by the
  6321. stream.
  6322. Default value is @var{auto}.
  6323. @item mode
  6324. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  6325. sense that it won't risk creating jerkiness due to duplicate frames when
  6326. possible, but if there are bad edits or blended fields it will end up
  6327. outputting combed frames when a good match might actually exist. On the other
  6328. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  6329. but will almost always find a good frame if there is one. The other values are
  6330. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  6331. jerkiness and creating duplicate frames versus finding good matches in sections
  6332. with bad edits, orphaned fields, blended fields, etc.
  6333. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  6334. Available values are:
  6335. @table @samp
  6336. @item pc
  6337. 2-way matching (p/c)
  6338. @item pc_n
  6339. 2-way matching, and trying 3rd match if still combed (p/c + n)
  6340. @item pc_u
  6341. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  6342. @item pc_n_ub
  6343. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  6344. still combed (p/c + n + u/b)
  6345. @item pcn
  6346. 3-way matching (p/c/n)
  6347. @item pcn_ub
  6348. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  6349. detected as combed (p/c/n + u/b)
  6350. @end table
  6351. The parenthesis at the end indicate the matches that would be used for that
  6352. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  6353. @var{top}).
  6354. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  6355. the slowest.
  6356. Default value is @var{pc_n}.
  6357. @item ppsrc
  6358. Mark the main input stream as a pre-processed input, and enable the secondary
  6359. input stream as the clean source to pick the fields from. See the filter
  6360. introduction for more details. It is similar to the @option{clip2} feature from
  6361. VFM/TFM.
  6362. Default value is @code{0} (disabled).
  6363. @item field
  6364. Set the field to match from. It is recommended to set this to the same value as
  6365. @option{order} unless you experience matching failures with that setting. In
  6366. certain circumstances changing the field that is used to match from can have a
  6367. large impact on matching performance. Available values are:
  6368. @table @samp
  6369. @item auto
  6370. Automatic (same value as @option{order}).
  6371. @item bottom
  6372. Match from the bottom field.
  6373. @item top
  6374. Match from the top field.
  6375. @end table
  6376. Default value is @var{auto}.
  6377. @item mchroma
  6378. Set whether or not chroma is included during the match comparisons. In most
  6379. cases it is recommended to leave this enabled. You should set this to @code{0}
  6380. only if your clip has bad chroma problems such as heavy rainbowing or other
  6381. artifacts. Setting this to @code{0} could also be used to speed things up at
  6382. the cost of some accuracy.
  6383. Default value is @code{1}.
  6384. @item y0
  6385. @item y1
  6386. These define an exclusion band which excludes the lines between @option{y0} and
  6387. @option{y1} from being included in the field matching decision. An exclusion
  6388. band can be used to ignore subtitles, a logo, or other things that may
  6389. interfere with the matching. @option{y0} sets the starting scan line and
  6390. @option{y1} sets the ending line; all lines in between @option{y0} and
  6391. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6392. @option{y0} and @option{y1} to the same value will disable the feature.
  6393. @option{y0} and @option{y1} defaults to @code{0}.
  6394. @item scthresh
  6395. Set the scene change detection threshold as a percentage of maximum change on
  6396. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6397. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6398. @option{scthresh} is @code{[0.0, 100.0]}.
  6399. Default value is @code{12.0}.
  6400. @item combmatch
  6401. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6402. account the combed scores of matches when deciding what match to use as the
  6403. final match. Available values are:
  6404. @table @samp
  6405. @item none
  6406. No final matching based on combed scores.
  6407. @item sc
  6408. Combed scores are only used when a scene change is detected.
  6409. @item full
  6410. Use combed scores all the time.
  6411. @end table
  6412. Default is @var{sc}.
  6413. @item combdbg
  6414. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  6415. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  6416. Available values are:
  6417. @table @samp
  6418. @item none
  6419. No forced calculation.
  6420. @item pcn
  6421. Force p/c/n calculations.
  6422. @item pcnub
  6423. Force p/c/n/u/b calculations.
  6424. @end table
  6425. Default value is @var{none}.
  6426. @item cthresh
  6427. This is the area combing threshold used for combed frame detection. This
  6428. essentially controls how "strong" or "visible" combing must be to be detected.
  6429. Larger values mean combing must be more visible and smaller values mean combing
  6430. can be less visible or strong and still be detected. Valid settings are from
  6431. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6432. be detected as combed). This is basically a pixel difference value. A good
  6433. range is @code{[8, 12]}.
  6434. Default value is @code{9}.
  6435. @item chroma
  6436. Sets whether or not chroma is considered in the combed frame decision. Only
  6437. disable this if your source has chroma problems (rainbowing, etc.) that are
  6438. causing problems for the combed frame detection with chroma enabled. Actually,
  6439. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6440. where there is chroma only combing in the source.
  6441. Default value is @code{0}.
  6442. @item blockx
  6443. @item blocky
  6444. Respectively set the x-axis and y-axis size of the window used during combed
  6445. frame detection. This has to do with the size of the area in which
  6446. @option{combpel} pixels are required to be detected as combed for a frame to be
  6447. declared combed. See the @option{combpel} parameter description for more info.
  6448. Possible values are any number that is a power of 2 starting at 4 and going up
  6449. to 512.
  6450. Default value is @code{16}.
  6451. @item combpel
  6452. The number of combed pixels inside any of the @option{blocky} by
  6453. @option{blockx} size blocks on the frame for the frame to be detected as
  6454. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6455. setting controls "how much" combing there must be in any localized area (a
  6456. window defined by the @option{blockx} and @option{blocky} settings) on the
  6457. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6458. which point no frames will ever be detected as combed). This setting is known
  6459. as @option{MI} in TFM/VFM vocabulary.
  6460. Default value is @code{80}.
  6461. @end table
  6462. @anchor{p/c/n/u/b meaning}
  6463. @subsection p/c/n/u/b meaning
  6464. @subsubsection p/c/n
  6465. We assume the following telecined stream:
  6466. @example
  6467. Top fields: 1 2 2 3 4
  6468. Bottom fields: 1 2 3 4 4
  6469. @end example
  6470. The numbers correspond to the progressive frame the fields relate to. Here, the
  6471. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6472. When @code{fieldmatch} is configured to run a matching from bottom
  6473. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6474. @example
  6475. Input stream:
  6476. T 1 2 2 3 4
  6477. B 1 2 3 4 4 <-- matching reference
  6478. Matches: c c n n c
  6479. Output stream:
  6480. T 1 2 3 4 4
  6481. B 1 2 3 4 4
  6482. @end example
  6483. As a result of the field matching, we can see that some frames get duplicated.
  6484. To perform a complete inverse telecine, you need to rely on a decimation filter
  6485. after this operation. See for instance the @ref{decimate} filter.
  6486. The same operation now matching from top fields (@option{field}=@var{top})
  6487. looks like this:
  6488. @example
  6489. Input stream:
  6490. T 1 2 2 3 4 <-- matching reference
  6491. B 1 2 3 4 4
  6492. Matches: c c p p c
  6493. Output stream:
  6494. T 1 2 2 3 4
  6495. B 1 2 2 3 4
  6496. @end example
  6497. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6498. basically, they refer to the frame and field of the opposite parity:
  6499. @itemize
  6500. @item @var{p} matches the field of the opposite parity in the previous frame
  6501. @item @var{c} matches the field of the opposite parity in the current frame
  6502. @item @var{n} matches the field of the opposite parity in the next frame
  6503. @end itemize
  6504. @subsubsection u/b
  6505. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6506. from the opposite parity flag. In the following examples, we assume that we are
  6507. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6508. 'x' is placed above and below each matched fields.
  6509. With bottom matching (@option{field}=@var{bottom}):
  6510. @example
  6511. Match: c p n b u
  6512. x x x x x
  6513. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6514. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6515. x x x x x
  6516. Output frames:
  6517. 2 1 2 2 2
  6518. 2 2 2 1 3
  6519. @end example
  6520. With top matching (@option{field}=@var{top}):
  6521. @example
  6522. Match: c p n b u
  6523. x x x x x
  6524. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6525. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6526. x x x x x
  6527. Output frames:
  6528. 2 2 2 1 2
  6529. 2 1 3 2 2
  6530. @end example
  6531. @subsection Examples
  6532. Simple IVTC of a top field first telecined stream:
  6533. @example
  6534. fieldmatch=order=tff:combmatch=none, decimate
  6535. @end example
  6536. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6537. @example
  6538. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6539. @end example
  6540. @section fieldorder
  6541. Transform the field order of the input video.
  6542. It accepts the following parameters:
  6543. @table @option
  6544. @item order
  6545. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6546. for bottom field first.
  6547. @end table
  6548. The default value is @samp{tff}.
  6549. The transformation is done by shifting the picture content up or down
  6550. by one line, and filling the remaining line with appropriate picture content.
  6551. This method is consistent with most broadcast field order converters.
  6552. If the input video is not flagged as being interlaced, or it is already
  6553. flagged as being of the required output field order, then this filter does
  6554. not alter the incoming video.
  6555. It is very useful when converting to or from PAL DV material,
  6556. which is bottom field first.
  6557. For example:
  6558. @example
  6559. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6560. @end example
  6561. @section fifo, afifo
  6562. Buffer input images and send them when they are requested.
  6563. It is mainly useful when auto-inserted by the libavfilter
  6564. framework.
  6565. It does not take parameters.
  6566. @section find_rect
  6567. Find a rectangular object
  6568. It accepts the following options:
  6569. @table @option
  6570. @item object
  6571. Filepath of the object image, needs to be in gray8.
  6572. @item threshold
  6573. Detection threshold, default is 0.5.
  6574. @item mipmaps
  6575. Number of mipmaps, default is 3.
  6576. @item xmin, ymin, xmax, ymax
  6577. Specifies the rectangle in which to search.
  6578. @end table
  6579. @subsection Examples
  6580. @itemize
  6581. @item
  6582. Generate a representative palette of a given video using @command{ffmpeg}:
  6583. @example
  6584. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6585. @end example
  6586. @end itemize
  6587. @section cover_rect
  6588. Cover a rectangular object
  6589. It accepts the following options:
  6590. @table @option
  6591. @item cover
  6592. Filepath of the optional cover image, needs to be in yuv420.
  6593. @item mode
  6594. Set covering mode.
  6595. It accepts the following values:
  6596. @table @samp
  6597. @item cover
  6598. cover it by the supplied image
  6599. @item blur
  6600. cover it by interpolating the surrounding pixels
  6601. @end table
  6602. Default value is @var{blur}.
  6603. @end table
  6604. @subsection Examples
  6605. @itemize
  6606. @item
  6607. Generate a representative palette of a given video using @command{ffmpeg}:
  6608. @example
  6609. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6610. @end example
  6611. @end itemize
  6612. @section floodfill
  6613. Flood area with values of same pixel components with another values.
  6614. It accepts the following options:
  6615. @table @option
  6616. @item x
  6617. Set pixel x coordinate.
  6618. @item y
  6619. Set pixel y coordinate.
  6620. @item s0
  6621. Set source #0 component value.
  6622. @item s1
  6623. Set source #1 component value.
  6624. @item s2
  6625. Set source #2 component value.
  6626. @item s3
  6627. Set source #3 component value.
  6628. @item d0
  6629. Set destination #0 component value.
  6630. @item d1
  6631. Set destination #1 component value.
  6632. @item d2
  6633. Set destination #2 component value.
  6634. @item d3
  6635. Set destination #3 component value.
  6636. @end table
  6637. @anchor{format}
  6638. @section format
  6639. Convert the input video to one of the specified pixel formats.
  6640. Libavfilter will try to pick one that is suitable as input to
  6641. the next filter.
  6642. It accepts the following parameters:
  6643. @table @option
  6644. @item pix_fmts
  6645. A '|'-separated list of pixel format names, such as
  6646. "pix_fmts=yuv420p|monow|rgb24".
  6647. @end table
  6648. @subsection Examples
  6649. @itemize
  6650. @item
  6651. Convert the input video to the @var{yuv420p} format
  6652. @example
  6653. format=pix_fmts=yuv420p
  6654. @end example
  6655. Convert the input video to any of the formats in the list
  6656. @example
  6657. format=pix_fmts=yuv420p|yuv444p|yuv410p
  6658. @end example
  6659. @end itemize
  6660. @anchor{fps}
  6661. @section fps
  6662. Convert the video to specified constant frame rate by duplicating or dropping
  6663. frames as necessary.
  6664. It accepts the following parameters:
  6665. @table @option
  6666. @item fps
  6667. The desired output frame rate. The default is @code{25}.
  6668. @item start_time
  6669. Assume the first PTS should be the given value, in seconds. This allows for
  6670. padding/trimming at the start of stream. By default, no assumption is made
  6671. about the first frame's expected PTS, so no padding or trimming is done.
  6672. For example, this could be set to 0 to pad the beginning with duplicates of
  6673. the first frame if a video stream starts after the audio stream or to trim any
  6674. frames with a negative PTS.
  6675. @item round
  6676. Timestamp (PTS) rounding method.
  6677. Possible values are:
  6678. @table @option
  6679. @item zero
  6680. round towards 0
  6681. @item inf
  6682. round away from 0
  6683. @item down
  6684. round towards -infinity
  6685. @item up
  6686. round towards +infinity
  6687. @item near
  6688. round to nearest
  6689. @end table
  6690. The default is @code{near}.
  6691. @item eof_action
  6692. Action performed when reading the last frame.
  6693. Possible values are:
  6694. @table @option
  6695. @item round
  6696. Use same timestamp rounding method as used for other frames.
  6697. @item pass
  6698. Pass through last frame if input duration has not been reached yet.
  6699. @end table
  6700. The default is @code{round}.
  6701. @end table
  6702. Alternatively, the options can be specified as a flat string:
  6703. @var{fps}[:@var{start_time}[:@var{round}]].
  6704. See also the @ref{setpts} filter.
  6705. @subsection Examples
  6706. @itemize
  6707. @item
  6708. A typical usage in order to set the fps to 25:
  6709. @example
  6710. fps=fps=25
  6711. @end example
  6712. @item
  6713. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  6714. @example
  6715. fps=fps=film:round=near
  6716. @end example
  6717. @end itemize
  6718. @section framepack
  6719. Pack two different video streams into a stereoscopic video, setting proper
  6720. metadata on supported codecs. The two views should have the same size and
  6721. framerate and processing will stop when the shorter video ends. Please note
  6722. that you may conveniently adjust view properties with the @ref{scale} and
  6723. @ref{fps} filters.
  6724. It accepts the following parameters:
  6725. @table @option
  6726. @item format
  6727. The desired packing format. Supported values are:
  6728. @table @option
  6729. @item sbs
  6730. The views are next to each other (default).
  6731. @item tab
  6732. The views are on top of each other.
  6733. @item lines
  6734. The views are packed by line.
  6735. @item columns
  6736. The views are packed by column.
  6737. @item frameseq
  6738. The views are temporally interleaved.
  6739. @end table
  6740. @end table
  6741. Some examples:
  6742. @example
  6743. # Convert left and right views into a frame-sequential video
  6744. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  6745. # Convert views into a side-by-side video with the same output resolution as the input
  6746. 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
  6747. @end example
  6748. @section framerate
  6749. Change the frame rate by interpolating new video output frames from the source
  6750. frames.
  6751. This filter is not designed to function correctly with interlaced media. If
  6752. you wish to change the frame rate of interlaced media then you are required
  6753. to deinterlace before this filter and re-interlace after this filter.
  6754. A description of the accepted options follows.
  6755. @table @option
  6756. @item fps
  6757. Specify the output frames per second. This option can also be specified
  6758. as a value alone. The default is @code{50}.
  6759. @item interp_start
  6760. Specify the start of a range where the output frame will be created as a
  6761. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6762. the default is @code{15}.
  6763. @item interp_end
  6764. Specify the end of a range where the output frame will be created as a
  6765. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6766. the default is @code{240}.
  6767. @item scene
  6768. Specify the level at which a scene change is detected as a value between
  6769. 0 and 100 to indicate a new scene; a low value reflects a low
  6770. probability for the current frame to introduce a new scene, while a higher
  6771. value means the current frame is more likely to be one.
  6772. The default is @code{7}.
  6773. @item flags
  6774. Specify flags influencing the filter process.
  6775. Available value for @var{flags} is:
  6776. @table @option
  6777. @item scene_change_detect, scd
  6778. Enable scene change detection using the value of the option @var{scene}.
  6779. This flag is enabled by default.
  6780. @end table
  6781. @end table
  6782. @section framestep
  6783. Select one frame every N-th frame.
  6784. This filter accepts the following option:
  6785. @table @option
  6786. @item step
  6787. Select frame after every @code{step} frames.
  6788. Allowed values are positive integers higher than 0. Default value is @code{1}.
  6789. @end table
  6790. @anchor{frei0r}
  6791. @section frei0r
  6792. Apply a frei0r effect to the input video.
  6793. To enable the compilation of this filter, you need to install the frei0r
  6794. header and configure FFmpeg with @code{--enable-frei0r}.
  6795. It accepts the following parameters:
  6796. @table @option
  6797. @item filter_name
  6798. The name of the frei0r effect to load. If the environment variable
  6799. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  6800. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  6801. Otherwise, the standard frei0r paths are searched, in this order:
  6802. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  6803. @file{/usr/lib/frei0r-1/}.
  6804. @item filter_params
  6805. A '|'-separated list of parameters to pass to the frei0r effect.
  6806. @end table
  6807. A frei0r effect parameter can be a boolean (its value is either
  6808. "y" or "n"), a double, a color (specified as
  6809. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  6810. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  6811. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  6812. @var{X} and @var{Y} are floating point numbers) and/or a string.
  6813. The number and types of parameters depend on the loaded effect. If an
  6814. effect parameter is not specified, the default value is set.
  6815. @subsection Examples
  6816. @itemize
  6817. @item
  6818. Apply the distort0r effect, setting the first two double parameters:
  6819. @example
  6820. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  6821. @end example
  6822. @item
  6823. Apply the colordistance effect, taking a color as the first parameter:
  6824. @example
  6825. frei0r=colordistance:0.2/0.3/0.4
  6826. frei0r=colordistance:violet
  6827. frei0r=colordistance:0x112233
  6828. @end example
  6829. @item
  6830. Apply the perspective effect, specifying the top left and top right image
  6831. positions:
  6832. @example
  6833. frei0r=perspective:0.2/0.2|0.8/0.2
  6834. @end example
  6835. @end itemize
  6836. For more information, see
  6837. @url{http://frei0r.dyne.org}
  6838. @section fspp
  6839. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  6840. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  6841. processing filter, one of them is performed once per block, not per pixel.
  6842. This allows for much higher speed.
  6843. The filter accepts the following options:
  6844. @table @option
  6845. @item quality
  6846. Set quality. This option defines the number of levels for averaging. It accepts
  6847. an integer in the range 4-5. Default value is @code{4}.
  6848. @item qp
  6849. Force a constant quantization parameter. It accepts an integer in range 0-63.
  6850. If not set, the filter will use the QP from the video stream (if available).
  6851. @item strength
  6852. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  6853. more details but also more artifacts, while higher values make the image smoother
  6854. but also blurrier. Default value is @code{0} − PSNR optimal.
  6855. @item use_bframe_qp
  6856. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  6857. option may cause flicker since the B-Frames have often larger QP. Default is
  6858. @code{0} (not enabled).
  6859. @end table
  6860. @section gblur
  6861. Apply Gaussian blur filter.
  6862. The filter accepts the following options:
  6863. @table @option
  6864. @item sigma
  6865. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  6866. @item steps
  6867. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  6868. @item planes
  6869. Set which planes to filter. By default all planes are filtered.
  6870. @item sigmaV
  6871. Set vertical sigma, if negative it will be same as @code{sigma}.
  6872. Default is @code{-1}.
  6873. @end table
  6874. @section geq
  6875. The filter accepts the following options:
  6876. @table @option
  6877. @item lum_expr, lum
  6878. Set the luminance expression.
  6879. @item cb_expr, cb
  6880. Set the chrominance blue expression.
  6881. @item cr_expr, cr
  6882. Set the chrominance red expression.
  6883. @item alpha_expr, a
  6884. Set the alpha expression.
  6885. @item red_expr, r
  6886. Set the red expression.
  6887. @item green_expr, g
  6888. Set the green expression.
  6889. @item blue_expr, b
  6890. Set the blue expression.
  6891. @end table
  6892. The colorspace is selected according to the specified options. If one
  6893. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  6894. options is specified, the filter will automatically select a YCbCr
  6895. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  6896. @option{blue_expr} options is specified, it will select an RGB
  6897. colorspace.
  6898. If one of the chrominance expression is not defined, it falls back on the other
  6899. one. If no alpha expression is specified it will evaluate to opaque value.
  6900. If none of chrominance expressions are specified, they will evaluate
  6901. to the luminance expression.
  6902. The expressions can use the following variables and functions:
  6903. @table @option
  6904. @item N
  6905. The sequential number of the filtered frame, starting from @code{0}.
  6906. @item X
  6907. @item Y
  6908. The coordinates of the current sample.
  6909. @item W
  6910. @item H
  6911. The width and height of the image.
  6912. @item SW
  6913. @item SH
  6914. Width and height scale depending on the currently filtered plane. It is the
  6915. ratio between the corresponding luma plane number of pixels and the current
  6916. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  6917. @code{0.5,0.5} for chroma planes.
  6918. @item T
  6919. Time of the current frame, expressed in seconds.
  6920. @item p(x, y)
  6921. Return the value of the pixel at location (@var{x},@var{y}) of the current
  6922. plane.
  6923. @item lum(x, y)
  6924. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  6925. plane.
  6926. @item cb(x, y)
  6927. Return the value of the pixel at location (@var{x},@var{y}) of the
  6928. blue-difference chroma plane. Return 0 if there is no such plane.
  6929. @item cr(x, y)
  6930. Return the value of the pixel at location (@var{x},@var{y}) of the
  6931. red-difference chroma plane. Return 0 if there is no such plane.
  6932. @item r(x, y)
  6933. @item g(x, y)
  6934. @item b(x, y)
  6935. Return the value of the pixel at location (@var{x},@var{y}) of the
  6936. red/green/blue component. Return 0 if there is no such component.
  6937. @item alpha(x, y)
  6938. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  6939. plane. Return 0 if there is no such plane.
  6940. @end table
  6941. For functions, if @var{x} and @var{y} are outside the area, the value will be
  6942. automatically clipped to the closer edge.
  6943. @subsection Examples
  6944. @itemize
  6945. @item
  6946. Flip the image horizontally:
  6947. @example
  6948. geq=p(W-X\,Y)
  6949. @end example
  6950. @item
  6951. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  6952. wavelength of 100 pixels:
  6953. @example
  6954. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  6955. @end example
  6956. @item
  6957. Generate a fancy enigmatic moving light:
  6958. @example
  6959. 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
  6960. @end example
  6961. @item
  6962. Generate a quick emboss effect:
  6963. @example
  6964. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  6965. @end example
  6966. @item
  6967. Modify RGB components depending on pixel position:
  6968. @example
  6969. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  6970. @end example
  6971. @item
  6972. Create a radial gradient that is the same size as the input (also see
  6973. the @ref{vignette} filter):
  6974. @example
  6975. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  6976. @end example
  6977. @end itemize
  6978. @section gradfun
  6979. Fix the banding artifacts that are sometimes introduced into nearly flat
  6980. regions by truncation to 8-bit color depth.
  6981. Interpolate the gradients that should go where the bands are, and
  6982. dither them.
  6983. It is designed for playback only. Do not use it prior to
  6984. lossy compression, because compression tends to lose the dither and
  6985. bring back the bands.
  6986. It accepts the following parameters:
  6987. @table @option
  6988. @item strength
  6989. The maximum amount by which the filter will change any one pixel. This is also
  6990. the threshold for detecting nearly flat regions. Acceptable values range from
  6991. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  6992. valid range.
  6993. @item radius
  6994. The neighborhood to fit the gradient to. A larger radius makes for smoother
  6995. gradients, but also prevents the filter from modifying the pixels near detailed
  6996. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  6997. values will be clipped to the valid range.
  6998. @end table
  6999. Alternatively, the options can be specified as a flat string:
  7000. @var{strength}[:@var{radius}]
  7001. @subsection Examples
  7002. @itemize
  7003. @item
  7004. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  7005. @example
  7006. gradfun=3.5:8
  7007. @end example
  7008. @item
  7009. Specify radius, omitting the strength (which will fall-back to the default
  7010. value):
  7011. @example
  7012. gradfun=radius=8
  7013. @end example
  7014. @end itemize
  7015. @anchor{haldclut}
  7016. @section haldclut
  7017. Apply a Hald CLUT to a video stream.
  7018. First input is the video stream to process, and second one is the Hald CLUT.
  7019. The Hald CLUT input can be a simple picture or a complete video stream.
  7020. The filter accepts the following options:
  7021. @table @option
  7022. @item shortest
  7023. Force termination when the shortest input terminates. Default is @code{0}.
  7024. @item repeatlast
  7025. Continue applying the last CLUT after the end of the stream. A value of
  7026. @code{0} disable the filter after the last frame of the CLUT is reached.
  7027. Default is @code{1}.
  7028. @end table
  7029. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  7030. filters share the same internals).
  7031. More information about the Hald CLUT can be found on Eskil Steenberg's website
  7032. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  7033. @subsection Workflow examples
  7034. @subsubsection Hald CLUT video stream
  7035. Generate an identity Hald CLUT stream altered with various effects:
  7036. @example
  7037. 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
  7038. @end example
  7039. Note: make sure you use a lossless codec.
  7040. Then use it with @code{haldclut} to apply it on some random stream:
  7041. @example
  7042. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  7043. @end example
  7044. The Hald CLUT will be applied to the 10 first seconds (duration of
  7045. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  7046. to the remaining frames of the @code{mandelbrot} stream.
  7047. @subsubsection Hald CLUT with preview
  7048. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  7049. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  7050. biggest possible square starting at the top left of the picture. The remaining
  7051. padding pixels (bottom or right) will be ignored. This area can be used to add
  7052. a preview of the Hald CLUT.
  7053. Typically, the following generated Hald CLUT will be supported by the
  7054. @code{haldclut} filter:
  7055. @example
  7056. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  7057. pad=iw+320 [padded_clut];
  7058. smptebars=s=320x256, split [a][b];
  7059. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  7060. [main][b] overlay=W-320" -frames:v 1 clut.png
  7061. @end example
  7062. It contains the original and a preview of the effect of the CLUT: SMPTE color
  7063. bars are displayed on the right-top, and below the same color bars processed by
  7064. the color changes.
  7065. Then, the effect of this Hald CLUT can be visualized with:
  7066. @example
  7067. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  7068. @end example
  7069. @section hflip
  7070. Flip the input video horizontally.
  7071. For example, to horizontally flip the input video with @command{ffmpeg}:
  7072. @example
  7073. ffmpeg -i in.avi -vf "hflip" out.avi
  7074. @end example
  7075. @section histeq
  7076. This filter applies a global color histogram equalization on a
  7077. per-frame basis.
  7078. It can be used to correct video that has a compressed range of pixel
  7079. intensities. The filter redistributes the pixel intensities to
  7080. equalize their distribution across the intensity range. It may be
  7081. viewed as an "automatically adjusting contrast filter". This filter is
  7082. useful only for correcting degraded or poorly captured source
  7083. video.
  7084. The filter accepts the following options:
  7085. @table @option
  7086. @item strength
  7087. Determine the amount of equalization to be applied. As the strength
  7088. is reduced, the distribution of pixel intensities more-and-more
  7089. approaches that of the input frame. The value must be a float number
  7090. in the range [0,1] and defaults to 0.200.
  7091. @item intensity
  7092. Set the maximum intensity that can generated and scale the output
  7093. values appropriately. The strength should be set as desired and then
  7094. the intensity can be limited if needed to avoid washing-out. The value
  7095. must be a float number in the range [0,1] and defaults to 0.210.
  7096. @item antibanding
  7097. Set the antibanding level. If enabled the filter will randomly vary
  7098. the luminance of output pixels by a small amount to avoid banding of
  7099. the histogram. Possible values are @code{none}, @code{weak} or
  7100. @code{strong}. It defaults to @code{none}.
  7101. @end table
  7102. @section histogram
  7103. Compute and draw a color distribution histogram for the input video.
  7104. The computed histogram is a representation of the color component
  7105. distribution in an image.
  7106. Standard histogram displays the color components distribution in an image.
  7107. Displays color graph for each color component. Shows distribution of
  7108. the Y, U, V, A or R, G, B components, depending on input format, in the
  7109. current frame. Below each graph a color component scale meter is shown.
  7110. The filter accepts the following options:
  7111. @table @option
  7112. @item level_height
  7113. Set height of level. Default value is @code{200}.
  7114. Allowed range is [50, 2048].
  7115. @item scale_height
  7116. Set height of color scale. Default value is @code{12}.
  7117. Allowed range is [0, 40].
  7118. @item display_mode
  7119. Set display mode.
  7120. It accepts the following values:
  7121. @table @samp
  7122. @item stack
  7123. Per color component graphs are placed below each other.
  7124. @item parade
  7125. Per color component graphs are placed side by side.
  7126. @item overlay
  7127. Presents information identical to that in the @code{parade}, except
  7128. that the graphs representing color components are superimposed directly
  7129. over one another.
  7130. @end table
  7131. Default is @code{stack}.
  7132. @item levels_mode
  7133. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  7134. Default is @code{linear}.
  7135. @item components
  7136. Set what color components to display.
  7137. Default is @code{7}.
  7138. @item fgopacity
  7139. Set foreground opacity. Default is @code{0.7}.
  7140. @item bgopacity
  7141. Set background opacity. Default is @code{0.5}.
  7142. @end table
  7143. @subsection Examples
  7144. @itemize
  7145. @item
  7146. Calculate and draw histogram:
  7147. @example
  7148. ffplay -i input -vf histogram
  7149. @end example
  7150. @end itemize
  7151. @anchor{hqdn3d}
  7152. @section hqdn3d
  7153. This is a high precision/quality 3d denoise filter. It aims to reduce
  7154. image noise, producing smooth images and making still images really
  7155. still. It should enhance compressibility.
  7156. It accepts the following optional parameters:
  7157. @table @option
  7158. @item luma_spatial
  7159. A non-negative floating point number which specifies spatial luma strength.
  7160. It defaults to 4.0.
  7161. @item chroma_spatial
  7162. A non-negative floating point number which specifies spatial chroma strength.
  7163. It defaults to 3.0*@var{luma_spatial}/4.0.
  7164. @item luma_tmp
  7165. A floating point number which specifies luma temporal strength. It defaults to
  7166. 6.0*@var{luma_spatial}/4.0.
  7167. @item chroma_tmp
  7168. A floating point number which specifies chroma temporal strength. It defaults to
  7169. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  7170. @end table
  7171. @section hwdownload
  7172. Download hardware frames to system memory.
  7173. The input must be in hardware frames, and the output a non-hardware format.
  7174. Not all formats will be supported on the output - it may be necessary to insert
  7175. an additional @option{format} filter immediately following in the graph to get
  7176. the output in a supported format.
  7177. @section hwmap
  7178. Map hardware frames to system memory or to another device.
  7179. This filter has several different modes of operation; which one is used depends
  7180. on the input and output formats:
  7181. @itemize
  7182. @item
  7183. Hardware frame input, normal frame output
  7184. Map the input frames to system memory and pass them to the output. If the
  7185. original hardware frame is later required (for example, after overlaying
  7186. something else on part of it), the @option{hwmap} filter can be used again
  7187. in the next mode to retrieve it.
  7188. @item
  7189. Normal frame input, hardware frame output
  7190. If the input is actually a software-mapped hardware frame, then unmap it -
  7191. that is, return the original hardware frame.
  7192. Otherwise, a device must be provided. Create new hardware surfaces on that
  7193. device for the output, then map them back to the software format at the input
  7194. and give those frames to the preceding filter. This will then act like the
  7195. @option{hwupload} filter, but may be able to avoid an additional copy when
  7196. the input is already in a compatible format.
  7197. @item
  7198. Hardware frame input and output
  7199. A device must be supplied for the output, either directly or with the
  7200. @option{derive_device} option. The input and output devices must be of
  7201. different types and compatible - the exact meaning of this is
  7202. system-dependent, but typically it means that they must refer to the same
  7203. underlying hardware context (for example, refer to the same graphics card).
  7204. If the input frames were originally created on the output device, then unmap
  7205. to retrieve the original frames.
  7206. Otherwise, map the frames to the output device - create new hardware frames
  7207. on the output corresponding to the frames on the input.
  7208. @end itemize
  7209. The following additional parameters are accepted:
  7210. @table @option
  7211. @item mode
  7212. Set the frame mapping mode. Some combination of:
  7213. @table @var
  7214. @item read
  7215. The mapped frame should be readable.
  7216. @item write
  7217. The mapped frame should be writeable.
  7218. @item overwrite
  7219. The mapping will always overwrite the entire frame.
  7220. This may improve performance in some cases, as the original contents of the
  7221. frame need not be loaded.
  7222. @item direct
  7223. The mapping must not involve any copying.
  7224. Indirect mappings to copies of frames are created in some cases where either
  7225. direct mapping is not possible or it would have unexpected properties.
  7226. Setting this flag ensures that the mapping is direct and will fail if that is
  7227. not possible.
  7228. @end table
  7229. Defaults to @var{read+write} if not specified.
  7230. @item derive_device @var{type}
  7231. Rather than using the device supplied at initialisation, instead derive a new
  7232. device of type @var{type} from the device the input frames exist on.
  7233. @item reverse
  7234. In a hardware to hardware mapping, map in reverse - create frames in the sink
  7235. and map them back to the source. This may be necessary in some cases where
  7236. a mapping in one direction is required but only the opposite direction is
  7237. supported by the devices being used.
  7238. This option is dangerous - it may break the preceding filter in undefined
  7239. ways if there are any additional constraints on that filter's output.
  7240. Do not use it without fully understanding the implications of its use.
  7241. @end table
  7242. @section hwupload
  7243. Upload system memory frames to hardware surfaces.
  7244. The device to upload to must be supplied when the filter is initialised. If
  7245. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  7246. option.
  7247. @anchor{hwupload_cuda}
  7248. @section hwupload_cuda
  7249. Upload system memory frames to a CUDA device.
  7250. It accepts the following optional parameters:
  7251. @table @option
  7252. @item device
  7253. The number of the CUDA device to use
  7254. @end table
  7255. @section hqx
  7256. Apply a high-quality magnification filter designed for pixel art. This filter
  7257. was originally created by Maxim Stepin.
  7258. It accepts the following option:
  7259. @table @option
  7260. @item n
  7261. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  7262. @code{hq3x} and @code{4} for @code{hq4x}.
  7263. Default is @code{3}.
  7264. @end table
  7265. @section hstack
  7266. Stack input videos horizontally.
  7267. All streams must be of same pixel format and of same height.
  7268. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  7269. to create same output.
  7270. The filter accept the following option:
  7271. @table @option
  7272. @item inputs
  7273. Set number of input streams. Default is 2.
  7274. @item shortest
  7275. If set to 1, force the output to terminate when the shortest input
  7276. terminates. Default value is 0.
  7277. @end table
  7278. @section hue
  7279. Modify the hue and/or the saturation of the input.
  7280. It accepts the following parameters:
  7281. @table @option
  7282. @item h
  7283. Specify the hue angle as a number of degrees. It accepts an expression,
  7284. and defaults to "0".
  7285. @item s
  7286. Specify the saturation in the [-10,10] range. It accepts an expression and
  7287. defaults to "1".
  7288. @item H
  7289. Specify the hue angle as a number of radians. It accepts an
  7290. expression, and defaults to "0".
  7291. @item b
  7292. Specify the brightness in the [-10,10] range. It accepts an expression and
  7293. defaults to "0".
  7294. @end table
  7295. @option{h} and @option{H} are mutually exclusive, and can't be
  7296. specified at the same time.
  7297. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  7298. expressions containing the following constants:
  7299. @table @option
  7300. @item n
  7301. frame count of the input frame starting from 0
  7302. @item pts
  7303. presentation timestamp of the input frame expressed in time base units
  7304. @item r
  7305. frame rate of the input video, NAN if the input frame rate is unknown
  7306. @item t
  7307. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7308. @item tb
  7309. time base of the input video
  7310. @end table
  7311. @subsection Examples
  7312. @itemize
  7313. @item
  7314. Set the hue to 90 degrees and the saturation to 1.0:
  7315. @example
  7316. hue=h=90:s=1
  7317. @end example
  7318. @item
  7319. Same command but expressing the hue in radians:
  7320. @example
  7321. hue=H=PI/2:s=1
  7322. @end example
  7323. @item
  7324. Rotate hue and make the saturation swing between 0
  7325. and 2 over a period of 1 second:
  7326. @example
  7327. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  7328. @end example
  7329. @item
  7330. Apply a 3 seconds saturation fade-in effect starting at 0:
  7331. @example
  7332. hue="s=min(t/3\,1)"
  7333. @end example
  7334. The general fade-in expression can be written as:
  7335. @example
  7336. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  7337. @end example
  7338. @item
  7339. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  7340. @example
  7341. hue="s=max(0\, min(1\, (8-t)/3))"
  7342. @end example
  7343. The general fade-out expression can be written as:
  7344. @example
  7345. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  7346. @end example
  7347. @end itemize
  7348. @subsection Commands
  7349. This filter supports the following commands:
  7350. @table @option
  7351. @item b
  7352. @item s
  7353. @item h
  7354. @item H
  7355. Modify the hue and/or the saturation and/or brightness of the input video.
  7356. The command accepts the same syntax of the corresponding option.
  7357. If the specified expression is not valid, it is kept at its current
  7358. value.
  7359. @end table
  7360. @section hysteresis
  7361. Grow first stream into second stream by connecting components.
  7362. This makes it possible to build more robust edge masks.
  7363. This filter accepts the following options:
  7364. @table @option
  7365. @item planes
  7366. Set which planes will be processed as bitmap, unprocessed planes will be
  7367. copied from first stream.
  7368. By default value 0xf, all planes will be processed.
  7369. @item threshold
  7370. Set threshold which is used in filtering. If pixel component value is higher than
  7371. this value filter algorithm for connecting components is activated.
  7372. By default value is 0.
  7373. @end table
  7374. @section idet
  7375. Detect video interlacing type.
  7376. This filter tries to detect if the input frames are interlaced, progressive,
  7377. top or bottom field first. It will also try to detect fields that are
  7378. repeated between adjacent frames (a sign of telecine).
  7379. Single frame detection considers only immediately adjacent frames when classifying each frame.
  7380. Multiple frame detection incorporates the classification history of previous frames.
  7381. The filter will log these metadata values:
  7382. @table @option
  7383. @item single.current_frame
  7384. Detected type of current frame using single-frame detection. One of:
  7385. ``tff'' (top field first), ``bff'' (bottom field first),
  7386. ``progressive'', or ``undetermined''
  7387. @item single.tff
  7388. Cumulative number of frames detected as top field first using single-frame detection.
  7389. @item multiple.tff
  7390. Cumulative number of frames detected as top field first using multiple-frame detection.
  7391. @item single.bff
  7392. Cumulative number of frames detected as bottom field first using single-frame detection.
  7393. @item multiple.current_frame
  7394. Detected type of current frame using multiple-frame detection. One of:
  7395. ``tff'' (top field first), ``bff'' (bottom field first),
  7396. ``progressive'', or ``undetermined''
  7397. @item multiple.bff
  7398. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  7399. @item single.progressive
  7400. Cumulative number of frames detected as progressive using single-frame detection.
  7401. @item multiple.progressive
  7402. Cumulative number of frames detected as progressive using multiple-frame detection.
  7403. @item single.undetermined
  7404. Cumulative number of frames that could not be classified using single-frame detection.
  7405. @item multiple.undetermined
  7406. Cumulative number of frames that could not be classified using multiple-frame detection.
  7407. @item repeated.current_frame
  7408. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  7409. @item repeated.neither
  7410. Cumulative number of frames with no repeated field.
  7411. @item repeated.top
  7412. Cumulative number of frames with the top field repeated from the previous frame's top field.
  7413. @item repeated.bottom
  7414. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  7415. @end table
  7416. The filter accepts the following options:
  7417. @table @option
  7418. @item intl_thres
  7419. Set interlacing threshold.
  7420. @item prog_thres
  7421. Set progressive threshold.
  7422. @item rep_thres
  7423. Threshold for repeated field detection.
  7424. @item half_life
  7425. Number of frames after which a given frame's contribution to the
  7426. statistics is halved (i.e., it contributes only 0.5 to its
  7427. classification). The default of 0 means that all frames seen are given
  7428. full weight of 1.0 forever.
  7429. @item analyze_interlaced_flag
  7430. When this is not 0 then idet will use the specified number of frames to determine
  7431. if the interlaced flag is accurate, it will not count undetermined frames.
  7432. If the flag is found to be accurate it will be used without any further
  7433. computations, if it is found to be inaccurate it will be cleared without any
  7434. further computations. This allows inserting the idet filter as a low computational
  7435. method to clean up the interlaced flag
  7436. @end table
  7437. @section il
  7438. Deinterleave or interleave fields.
  7439. This filter allows one to process interlaced images fields without
  7440. deinterlacing them. Deinterleaving splits the input frame into 2
  7441. fields (so called half pictures). Odd lines are moved to the top
  7442. half of the output image, even lines to the bottom half.
  7443. You can process (filter) them independently and then re-interleave them.
  7444. The filter accepts the following options:
  7445. @table @option
  7446. @item luma_mode, l
  7447. @item chroma_mode, c
  7448. @item alpha_mode, a
  7449. Available values for @var{luma_mode}, @var{chroma_mode} and
  7450. @var{alpha_mode} are:
  7451. @table @samp
  7452. @item none
  7453. Do nothing.
  7454. @item deinterleave, d
  7455. Deinterleave fields, placing one above the other.
  7456. @item interleave, i
  7457. Interleave fields. Reverse the effect of deinterleaving.
  7458. @end table
  7459. Default value is @code{none}.
  7460. @item luma_swap, ls
  7461. @item chroma_swap, cs
  7462. @item alpha_swap, as
  7463. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  7464. @end table
  7465. @section inflate
  7466. Apply inflate effect to the video.
  7467. This filter replaces the pixel by the local(3x3) average by taking into account
  7468. only values higher than the pixel.
  7469. It accepts the following options:
  7470. @table @option
  7471. @item threshold0
  7472. @item threshold1
  7473. @item threshold2
  7474. @item threshold3
  7475. Limit the maximum change for each plane, default is 65535.
  7476. If 0, plane will remain unchanged.
  7477. @end table
  7478. @section interlace
  7479. Simple interlacing filter from progressive contents. This interleaves upper (or
  7480. lower) lines from odd frames with lower (or upper) lines from even frames,
  7481. halving the frame rate and preserving image height.
  7482. @example
  7483. Original Original New Frame
  7484. Frame 'j' Frame 'j+1' (tff)
  7485. ========== =========== ==================
  7486. Line 0 --------------------> Frame 'j' Line 0
  7487. Line 1 Line 1 ----> Frame 'j+1' Line 1
  7488. Line 2 ---------------------> Frame 'j' Line 2
  7489. Line 3 Line 3 ----> Frame 'j+1' Line 3
  7490. ... ... ...
  7491. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  7492. @end example
  7493. It accepts the following optional parameters:
  7494. @table @option
  7495. @item scan
  7496. This determines whether the interlaced frame is taken from the even
  7497. (tff - default) or odd (bff) lines of the progressive frame.
  7498. @item lowpass
  7499. Vertical lowpass filter to avoid twitter interlacing and
  7500. reduce moire patterns.
  7501. @table @samp
  7502. @item 0, off
  7503. Disable vertical lowpass filter
  7504. @item 1, linear
  7505. Enable linear filter (default)
  7506. @item 2, complex
  7507. Enable complex filter. This will slightly less reduce twitter and moire
  7508. but better retain detail and subjective sharpness impression.
  7509. @end table
  7510. @end table
  7511. @section kerndeint
  7512. Deinterlace input video by applying Donald Graft's adaptive kernel
  7513. deinterling. Work on interlaced parts of a video to produce
  7514. progressive frames.
  7515. The description of the accepted parameters follows.
  7516. @table @option
  7517. @item thresh
  7518. Set the threshold which affects the filter's tolerance when
  7519. determining if a pixel line must be processed. It must be an integer
  7520. in the range [0,255] and defaults to 10. A value of 0 will result in
  7521. applying the process on every pixels.
  7522. @item map
  7523. Paint pixels exceeding the threshold value to white if set to 1.
  7524. Default is 0.
  7525. @item order
  7526. Set the fields order. Swap fields if set to 1, leave fields alone if
  7527. 0. Default is 0.
  7528. @item sharp
  7529. Enable additional sharpening if set to 1. Default is 0.
  7530. @item twoway
  7531. Enable twoway sharpening if set to 1. Default is 0.
  7532. @end table
  7533. @subsection Examples
  7534. @itemize
  7535. @item
  7536. Apply default values:
  7537. @example
  7538. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  7539. @end example
  7540. @item
  7541. Enable additional sharpening:
  7542. @example
  7543. kerndeint=sharp=1
  7544. @end example
  7545. @item
  7546. Paint processed pixels in white:
  7547. @example
  7548. kerndeint=map=1
  7549. @end example
  7550. @end itemize
  7551. @section lenscorrection
  7552. Correct radial lens distortion
  7553. This filter can be used to correct for radial distortion as can result from the use
  7554. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  7555. one can use tools available for example as part of opencv or simply trial-and-error.
  7556. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  7557. and extract the k1 and k2 coefficients from the resulting matrix.
  7558. Note that effectively the same filter is available in the open-source tools Krita and
  7559. Digikam from the KDE project.
  7560. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  7561. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  7562. brightness distribution, so you may want to use both filters together in certain
  7563. cases, though you will have to take care of ordering, i.e. whether vignetting should
  7564. be applied before or after lens correction.
  7565. @subsection Options
  7566. The filter accepts the following options:
  7567. @table @option
  7568. @item cx
  7569. Relative x-coordinate of the focal point of the image, and thereby the center of the
  7570. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7571. width.
  7572. @item cy
  7573. Relative y-coordinate of the focal point of the image, and thereby the center of the
  7574. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7575. height.
  7576. @item k1
  7577. Coefficient of the quadratic correction term. 0.5 means no correction.
  7578. @item k2
  7579. Coefficient of the double quadratic correction term. 0.5 means no correction.
  7580. @end table
  7581. The formula that generates the correction is:
  7582. @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)
  7583. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  7584. distances from the focal point in the source and target images, respectively.
  7585. @section libvmaf
  7586. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  7587. score between two input videos.
  7588. The obtained VMAF score is printed through the logging system.
  7589. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  7590. After installing the library it can be enabled using:
  7591. @code{./configure --enable-libvmaf}.
  7592. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  7593. The filter has following options:
  7594. @table @option
  7595. @item model_path
  7596. Set the model path which is to be used for SVM.
  7597. Default value: @code{"vmaf_v0.6.1.pkl"}
  7598. @item log_path
  7599. Set the file path to be used to store logs.
  7600. @item log_fmt
  7601. Set the format of the log file (xml or json).
  7602. @item enable_transform
  7603. Enables transform for computing vmaf.
  7604. @item phone_model
  7605. Invokes the phone model which will generate VMAF scores higher than in the
  7606. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  7607. @item psnr
  7608. Enables computing psnr along with vmaf.
  7609. @item ssim
  7610. Enables computing ssim along with vmaf.
  7611. @item ms_ssim
  7612. Enables computing ms_ssim along with vmaf.
  7613. @item pool
  7614. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  7615. @end table
  7616. This filter also supports the @ref{framesync} options.
  7617. On the below examples the input file @file{main.mpg} being processed is
  7618. compared with the reference file @file{ref.mpg}.
  7619. @example
  7620. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  7621. @end example
  7622. Example with options:
  7623. @example
  7624. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
  7625. @end example
  7626. @section limiter
  7627. Limits the pixel components values to the specified range [min, max].
  7628. The filter accepts the following options:
  7629. @table @option
  7630. @item min
  7631. Lower bound. Defaults to the lowest allowed value for the input.
  7632. @item max
  7633. Upper bound. Defaults to the highest allowed value for the input.
  7634. @item planes
  7635. Specify which planes will be processed. Defaults to all available.
  7636. @end table
  7637. @section loop
  7638. Loop video frames.
  7639. The filter accepts the following options:
  7640. @table @option
  7641. @item loop
  7642. Set the number of loops.
  7643. @item size
  7644. Set maximal size in number of frames.
  7645. @item start
  7646. Set first frame of loop.
  7647. @end table
  7648. @anchor{lut3d}
  7649. @section lut3d
  7650. Apply a 3D LUT to an input video.
  7651. The filter accepts the following options:
  7652. @table @option
  7653. @item file
  7654. Set the 3D LUT file name.
  7655. Currently supported formats:
  7656. @table @samp
  7657. @item 3dl
  7658. AfterEffects
  7659. @item cube
  7660. Iridas
  7661. @item dat
  7662. DaVinci
  7663. @item m3d
  7664. Pandora
  7665. @end table
  7666. @item interp
  7667. Select interpolation mode.
  7668. Available values are:
  7669. @table @samp
  7670. @item nearest
  7671. Use values from the nearest defined point.
  7672. @item trilinear
  7673. Interpolate values using the 8 points defining a cube.
  7674. @item tetrahedral
  7675. Interpolate values using a tetrahedron.
  7676. @end table
  7677. @end table
  7678. This filter also supports the @ref{framesync} options.
  7679. @section lumakey
  7680. Turn certain luma values into transparency.
  7681. The filter accepts the following options:
  7682. @table @option
  7683. @item threshold
  7684. Set the luma which will be used as base for transparency.
  7685. Default value is @code{0}.
  7686. @item tolerance
  7687. Set the range of luma values to be keyed out.
  7688. Default value is @code{0}.
  7689. @item softness
  7690. Set the range of softness. Default value is @code{0}.
  7691. Use this to control gradual transition from zero to full transparency.
  7692. @end table
  7693. @section lut, lutrgb, lutyuv
  7694. Compute a look-up table for binding each pixel component input value
  7695. to an output value, and apply it to the input video.
  7696. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  7697. to an RGB input video.
  7698. These filters accept the following parameters:
  7699. @table @option
  7700. @item c0
  7701. set first pixel component expression
  7702. @item c1
  7703. set second pixel component expression
  7704. @item c2
  7705. set third pixel component expression
  7706. @item c3
  7707. set fourth pixel component expression, corresponds to the alpha component
  7708. @item r
  7709. set red component expression
  7710. @item g
  7711. set green component expression
  7712. @item b
  7713. set blue component expression
  7714. @item a
  7715. alpha component expression
  7716. @item y
  7717. set Y/luminance component expression
  7718. @item u
  7719. set U/Cb component expression
  7720. @item v
  7721. set V/Cr component expression
  7722. @end table
  7723. Each of them specifies the expression to use for computing the lookup table for
  7724. the corresponding pixel component values.
  7725. The exact component associated to each of the @var{c*} options depends on the
  7726. format in input.
  7727. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  7728. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  7729. The expressions can contain the following constants and functions:
  7730. @table @option
  7731. @item w
  7732. @item h
  7733. The input width and height.
  7734. @item val
  7735. The input value for the pixel component.
  7736. @item clipval
  7737. The input value, clipped to the @var{minval}-@var{maxval} range.
  7738. @item maxval
  7739. The maximum value for the pixel component.
  7740. @item minval
  7741. The minimum value for the pixel component.
  7742. @item negval
  7743. The negated value for the pixel component value, clipped to the
  7744. @var{minval}-@var{maxval} range; it corresponds to the expression
  7745. "maxval-clipval+minval".
  7746. @item clip(val)
  7747. The computed value in @var{val}, clipped to the
  7748. @var{minval}-@var{maxval} range.
  7749. @item gammaval(gamma)
  7750. The computed gamma correction value of the pixel component value,
  7751. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  7752. expression
  7753. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  7754. @end table
  7755. All expressions default to "val".
  7756. @subsection Examples
  7757. @itemize
  7758. @item
  7759. Negate input video:
  7760. @example
  7761. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  7762. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  7763. @end example
  7764. The above is the same as:
  7765. @example
  7766. lutrgb="r=negval:g=negval:b=negval"
  7767. lutyuv="y=negval:u=negval:v=negval"
  7768. @end example
  7769. @item
  7770. Negate luminance:
  7771. @example
  7772. lutyuv=y=negval
  7773. @end example
  7774. @item
  7775. Remove chroma components, turning the video into a graytone image:
  7776. @example
  7777. lutyuv="u=128:v=128"
  7778. @end example
  7779. @item
  7780. Apply a luma burning effect:
  7781. @example
  7782. lutyuv="y=2*val"
  7783. @end example
  7784. @item
  7785. Remove green and blue components:
  7786. @example
  7787. lutrgb="g=0:b=0"
  7788. @end example
  7789. @item
  7790. Set a constant alpha channel value on input:
  7791. @example
  7792. format=rgba,lutrgb=a="maxval-minval/2"
  7793. @end example
  7794. @item
  7795. Correct luminance gamma by a factor of 0.5:
  7796. @example
  7797. lutyuv=y=gammaval(0.5)
  7798. @end example
  7799. @item
  7800. Discard least significant bits of luma:
  7801. @example
  7802. lutyuv=y='bitand(val, 128+64+32)'
  7803. @end example
  7804. @item
  7805. Technicolor like effect:
  7806. @example
  7807. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  7808. @end example
  7809. @end itemize
  7810. @section lut2, tlut2
  7811. The @code{lut2} filter takes two input streams and outputs one
  7812. stream.
  7813. The @code{tlut2} (time lut2) filter takes two consecutive frames
  7814. from one single stream.
  7815. This filter accepts the following parameters:
  7816. @table @option
  7817. @item c0
  7818. set first pixel component expression
  7819. @item c1
  7820. set second pixel component expression
  7821. @item c2
  7822. set third pixel component expression
  7823. @item c3
  7824. set fourth pixel component expression, corresponds to the alpha component
  7825. @end table
  7826. Each of them specifies the expression to use for computing the lookup table for
  7827. the corresponding pixel component values.
  7828. The exact component associated to each of the @var{c*} options depends on the
  7829. format in inputs.
  7830. The expressions can contain the following constants:
  7831. @table @option
  7832. @item w
  7833. @item h
  7834. The input width and height.
  7835. @item x
  7836. The first input value for the pixel component.
  7837. @item y
  7838. The second input value for the pixel component.
  7839. @item bdx
  7840. The first input video bit depth.
  7841. @item bdy
  7842. The second input video bit depth.
  7843. @end table
  7844. All expressions default to "x".
  7845. @subsection Examples
  7846. @itemize
  7847. @item
  7848. Highlight differences between two RGB video streams:
  7849. @example
  7850. 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)'
  7851. @end example
  7852. @item
  7853. Highlight differences between two YUV video streams:
  7854. @example
  7855. 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)'
  7856. @end example
  7857. @item
  7858. Show max difference between two video streams:
  7859. @example
  7860. 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)))'
  7861. @end example
  7862. @end itemize
  7863. @section maskedclamp
  7864. Clamp the first input stream with the second input and third input stream.
  7865. Returns the value of first stream to be between second input
  7866. stream - @code{undershoot} and third input stream + @code{overshoot}.
  7867. This filter accepts the following options:
  7868. @table @option
  7869. @item undershoot
  7870. Default value is @code{0}.
  7871. @item overshoot
  7872. Default value is @code{0}.
  7873. @item planes
  7874. Set which planes will be processed as bitmap, unprocessed planes will be
  7875. copied from first stream.
  7876. By default value 0xf, all planes will be processed.
  7877. @end table
  7878. @section maskedmerge
  7879. Merge the first input stream with the second input stream using per pixel
  7880. weights in the third input stream.
  7881. A value of 0 in the third stream pixel component means that pixel component
  7882. from first stream is returned unchanged, while maximum value (eg. 255 for
  7883. 8-bit videos) means that pixel component from second stream is returned
  7884. unchanged. Intermediate values define the amount of merging between both
  7885. input stream's pixel components.
  7886. This filter accepts the following options:
  7887. @table @option
  7888. @item planes
  7889. Set which planes will be processed as bitmap, unprocessed planes will be
  7890. copied from first stream.
  7891. By default value 0xf, all planes will be processed.
  7892. @end table
  7893. @section mcdeint
  7894. Apply motion-compensation deinterlacing.
  7895. It needs one field per frame as input and must thus be used together
  7896. with yadif=1/3 or equivalent.
  7897. This filter accepts the following options:
  7898. @table @option
  7899. @item mode
  7900. Set the deinterlacing mode.
  7901. It accepts one of the following values:
  7902. @table @samp
  7903. @item fast
  7904. @item medium
  7905. @item slow
  7906. use iterative motion estimation
  7907. @item extra_slow
  7908. like @samp{slow}, but use multiple reference frames.
  7909. @end table
  7910. Default value is @samp{fast}.
  7911. @item parity
  7912. Set the picture field parity assumed for the input video. It must be
  7913. one of the following values:
  7914. @table @samp
  7915. @item 0, tff
  7916. assume top field first
  7917. @item 1, bff
  7918. assume bottom field first
  7919. @end table
  7920. Default value is @samp{bff}.
  7921. @item qp
  7922. Set per-block quantization parameter (QP) used by the internal
  7923. encoder.
  7924. Higher values should result in a smoother motion vector field but less
  7925. optimal individual vectors. Default value is 1.
  7926. @end table
  7927. @section mergeplanes
  7928. Merge color channel components from several video streams.
  7929. The filter accepts up to 4 input streams, and merge selected input
  7930. planes to the output video.
  7931. This filter accepts the following options:
  7932. @table @option
  7933. @item mapping
  7934. Set input to output plane mapping. Default is @code{0}.
  7935. The mappings is specified as a bitmap. It should be specified as a
  7936. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  7937. mapping for the first plane of the output stream. 'A' sets the number of
  7938. the input stream to use (from 0 to 3), and 'a' the plane number of the
  7939. corresponding input to use (from 0 to 3). The rest of the mappings is
  7940. similar, 'Bb' describes the mapping for the output stream second
  7941. plane, 'Cc' describes the mapping for the output stream third plane and
  7942. 'Dd' describes the mapping for the output stream fourth plane.
  7943. @item format
  7944. Set output pixel format. Default is @code{yuva444p}.
  7945. @end table
  7946. @subsection Examples
  7947. @itemize
  7948. @item
  7949. Merge three gray video streams of same width and height into single video stream:
  7950. @example
  7951. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  7952. @end example
  7953. @item
  7954. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  7955. @example
  7956. [a0][a1]mergeplanes=0x00010210:yuva444p
  7957. @end example
  7958. @item
  7959. Swap Y and A plane in yuva444p stream:
  7960. @example
  7961. format=yuva444p,mergeplanes=0x03010200:yuva444p
  7962. @end example
  7963. @item
  7964. Swap U and V plane in yuv420p stream:
  7965. @example
  7966. format=yuv420p,mergeplanes=0x000201:yuv420p
  7967. @end example
  7968. @item
  7969. Cast a rgb24 clip to yuv444p:
  7970. @example
  7971. format=rgb24,mergeplanes=0x000102:yuv444p
  7972. @end example
  7973. @end itemize
  7974. @section mestimate
  7975. Estimate and export motion vectors using block matching algorithms.
  7976. Motion vectors are stored in frame side data to be used by other filters.
  7977. This filter accepts the following options:
  7978. @table @option
  7979. @item method
  7980. Specify the motion estimation method. Accepts one of the following values:
  7981. @table @samp
  7982. @item esa
  7983. Exhaustive search algorithm.
  7984. @item tss
  7985. Three step search algorithm.
  7986. @item tdls
  7987. Two dimensional logarithmic search algorithm.
  7988. @item ntss
  7989. New three step search algorithm.
  7990. @item fss
  7991. Four step search algorithm.
  7992. @item ds
  7993. Diamond search algorithm.
  7994. @item hexbs
  7995. Hexagon-based search algorithm.
  7996. @item epzs
  7997. Enhanced predictive zonal search algorithm.
  7998. @item umh
  7999. Uneven multi-hexagon search algorithm.
  8000. @end table
  8001. Default value is @samp{esa}.
  8002. @item mb_size
  8003. Macroblock size. Default @code{16}.
  8004. @item search_param
  8005. Search parameter. Default @code{7}.
  8006. @end table
  8007. @section midequalizer
  8008. Apply Midway Image Equalization effect using two video streams.
  8009. Midway Image Equalization adjusts a pair of images to have the same
  8010. histogram, while maintaining their dynamics as much as possible. It's
  8011. useful for e.g. matching exposures from a pair of stereo cameras.
  8012. This filter has two inputs and one output, which must be of same pixel format, but
  8013. may be of different sizes. The output of filter is first input adjusted with
  8014. midway histogram of both inputs.
  8015. This filter accepts the following option:
  8016. @table @option
  8017. @item planes
  8018. Set which planes to process. Default is @code{15}, which is all available planes.
  8019. @end table
  8020. @section minterpolate
  8021. Convert the video to specified frame rate using motion interpolation.
  8022. This filter accepts the following options:
  8023. @table @option
  8024. @item fps
  8025. 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}.
  8026. @item mi_mode
  8027. Motion interpolation mode. Following values are accepted:
  8028. @table @samp
  8029. @item dup
  8030. Duplicate previous or next frame for interpolating new ones.
  8031. @item blend
  8032. Blend source frames. Interpolated frame is mean of previous and next frames.
  8033. @item mci
  8034. Motion compensated interpolation. Following options are effective when this mode is selected:
  8035. @table @samp
  8036. @item mc_mode
  8037. Motion compensation mode. Following values are accepted:
  8038. @table @samp
  8039. @item obmc
  8040. Overlapped block motion compensation.
  8041. @item aobmc
  8042. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  8043. @end table
  8044. Default mode is @samp{obmc}.
  8045. @item me_mode
  8046. Motion estimation mode. Following values are accepted:
  8047. @table @samp
  8048. @item bidir
  8049. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  8050. @item bilat
  8051. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  8052. @end table
  8053. Default mode is @samp{bilat}.
  8054. @item me
  8055. The algorithm to be used for motion estimation. Following values are accepted:
  8056. @table @samp
  8057. @item esa
  8058. Exhaustive search algorithm.
  8059. @item tss
  8060. Three step search algorithm.
  8061. @item tdls
  8062. Two dimensional logarithmic search algorithm.
  8063. @item ntss
  8064. New three step search algorithm.
  8065. @item fss
  8066. Four step search algorithm.
  8067. @item ds
  8068. Diamond search algorithm.
  8069. @item hexbs
  8070. Hexagon-based search algorithm.
  8071. @item epzs
  8072. Enhanced predictive zonal search algorithm.
  8073. @item umh
  8074. Uneven multi-hexagon search algorithm.
  8075. @end table
  8076. Default algorithm is @samp{epzs}.
  8077. @item mb_size
  8078. Macroblock size. Default @code{16}.
  8079. @item search_param
  8080. Motion estimation search parameter. Default @code{32}.
  8081. @item vsbmc
  8082. 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).
  8083. @end table
  8084. @end table
  8085. @item scd
  8086. 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:
  8087. @table @samp
  8088. @item none
  8089. Disable scene change detection.
  8090. @item fdiff
  8091. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  8092. @end table
  8093. Default method is @samp{fdiff}.
  8094. @item scd_threshold
  8095. Scene change detection threshold. Default is @code{5.0}.
  8096. @end table
  8097. @section mpdecimate
  8098. Drop frames that do not differ greatly from the previous frame in
  8099. order to reduce frame rate.
  8100. The main use of this filter is for very-low-bitrate encoding
  8101. (e.g. streaming over dialup modem), but it could in theory be used for
  8102. fixing movies that were inverse-telecined incorrectly.
  8103. A description of the accepted options follows.
  8104. @table @option
  8105. @item max
  8106. Set the maximum number of consecutive frames which can be dropped (if
  8107. positive), or the minimum interval between dropped frames (if
  8108. negative). If the value is 0, the frame is dropped disregarding the
  8109. number of previous sequentially dropped frames.
  8110. Default value is 0.
  8111. @item hi
  8112. @item lo
  8113. @item frac
  8114. Set the dropping threshold values.
  8115. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  8116. represent actual pixel value differences, so a threshold of 64
  8117. corresponds to 1 unit of difference for each pixel, or the same spread
  8118. out differently over the block.
  8119. A frame is a candidate for dropping if no 8x8 blocks differ by more
  8120. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  8121. meaning the whole image) differ by more than a threshold of @option{lo}.
  8122. Default value for @option{hi} is 64*12, default value for @option{lo} is
  8123. 64*5, and default value for @option{frac} is 0.33.
  8124. @end table
  8125. @section negate
  8126. Negate input video.
  8127. It accepts an integer in input; if non-zero it negates the
  8128. alpha component (if available). The default value in input is 0.
  8129. @section nlmeans
  8130. Denoise frames using Non-Local Means algorithm.
  8131. Each pixel is adjusted by looking for other pixels with similar contexts. This
  8132. context similarity is defined by comparing their surrounding patches of size
  8133. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  8134. around the pixel.
  8135. Note that the research area defines centers for patches, which means some
  8136. patches will be made of pixels outside that research area.
  8137. The filter accepts the following options.
  8138. @table @option
  8139. @item s
  8140. Set denoising strength.
  8141. @item p
  8142. Set patch size.
  8143. @item pc
  8144. Same as @option{p} but for chroma planes.
  8145. The default value is @var{0} and means automatic.
  8146. @item r
  8147. Set research size.
  8148. @item rc
  8149. Same as @option{r} but for chroma planes.
  8150. The default value is @var{0} and means automatic.
  8151. @end table
  8152. @section nnedi
  8153. Deinterlace video using neural network edge directed interpolation.
  8154. This filter accepts the following options:
  8155. @table @option
  8156. @item weights
  8157. Mandatory option, without binary file filter can not work.
  8158. Currently file can be found here:
  8159. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  8160. @item deint
  8161. Set which frames to deinterlace, by default it is @code{all}.
  8162. Can be @code{all} or @code{interlaced}.
  8163. @item field
  8164. Set mode of operation.
  8165. Can be one of the following:
  8166. @table @samp
  8167. @item af
  8168. Use frame flags, both fields.
  8169. @item a
  8170. Use frame flags, single field.
  8171. @item t
  8172. Use top field only.
  8173. @item b
  8174. Use bottom field only.
  8175. @item tf
  8176. Use both fields, top first.
  8177. @item bf
  8178. Use both fields, bottom first.
  8179. @end table
  8180. @item planes
  8181. Set which planes to process, by default filter process all frames.
  8182. @item nsize
  8183. Set size of local neighborhood around each pixel, used by the predictor neural
  8184. network.
  8185. Can be one of the following:
  8186. @table @samp
  8187. @item s8x6
  8188. @item s16x6
  8189. @item s32x6
  8190. @item s48x6
  8191. @item s8x4
  8192. @item s16x4
  8193. @item s32x4
  8194. @end table
  8195. @item nns
  8196. Set the number of neurons in predictor neural network.
  8197. Can be one of the following:
  8198. @table @samp
  8199. @item n16
  8200. @item n32
  8201. @item n64
  8202. @item n128
  8203. @item n256
  8204. @end table
  8205. @item qual
  8206. Controls the number of different neural network predictions that are blended
  8207. together to compute the final output value. Can be @code{fast}, default or
  8208. @code{slow}.
  8209. @item etype
  8210. Set which set of weights to use in the predictor.
  8211. Can be one of the following:
  8212. @table @samp
  8213. @item a
  8214. weights trained to minimize absolute error
  8215. @item s
  8216. weights trained to minimize squared error
  8217. @end table
  8218. @item pscrn
  8219. Controls whether or not the prescreener neural network is used to decide
  8220. which pixels should be processed by the predictor neural network and which
  8221. can be handled by simple cubic interpolation.
  8222. The prescreener is trained to know whether cubic interpolation will be
  8223. sufficient for a pixel or whether it should be predicted by the predictor nn.
  8224. The computational complexity of the prescreener nn is much less than that of
  8225. the predictor nn. Since most pixels can be handled by cubic interpolation,
  8226. using the prescreener generally results in much faster processing.
  8227. The prescreener is pretty accurate, so the difference between using it and not
  8228. using it is almost always unnoticeable.
  8229. Can be one of the following:
  8230. @table @samp
  8231. @item none
  8232. @item original
  8233. @item new
  8234. @end table
  8235. Default is @code{new}.
  8236. @item fapprox
  8237. Set various debugging flags.
  8238. @end table
  8239. @section noformat
  8240. Force libavfilter not to use any of the specified pixel formats for the
  8241. input to the next filter.
  8242. It accepts the following parameters:
  8243. @table @option
  8244. @item pix_fmts
  8245. A '|'-separated list of pixel format names, such as
  8246. pix_fmts=yuv420p|monow|rgb24".
  8247. @end table
  8248. @subsection Examples
  8249. @itemize
  8250. @item
  8251. Force libavfilter to use a format different from @var{yuv420p} for the
  8252. input to the vflip filter:
  8253. @example
  8254. noformat=pix_fmts=yuv420p,vflip
  8255. @end example
  8256. @item
  8257. Convert the input video to any of the formats not contained in the list:
  8258. @example
  8259. noformat=yuv420p|yuv444p|yuv410p
  8260. @end example
  8261. @end itemize
  8262. @section noise
  8263. Add noise on video input frame.
  8264. The filter accepts the following options:
  8265. @table @option
  8266. @item all_seed
  8267. @item c0_seed
  8268. @item c1_seed
  8269. @item c2_seed
  8270. @item c3_seed
  8271. Set noise seed for specific pixel component or all pixel components in case
  8272. of @var{all_seed}. Default value is @code{123457}.
  8273. @item all_strength, alls
  8274. @item c0_strength, c0s
  8275. @item c1_strength, c1s
  8276. @item c2_strength, c2s
  8277. @item c3_strength, c3s
  8278. Set noise strength for specific pixel component or all pixel components in case
  8279. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  8280. @item all_flags, allf
  8281. @item c0_flags, c0f
  8282. @item c1_flags, c1f
  8283. @item c2_flags, c2f
  8284. @item c3_flags, c3f
  8285. Set pixel component flags or set flags for all components if @var{all_flags}.
  8286. Available values for component flags are:
  8287. @table @samp
  8288. @item a
  8289. averaged temporal noise (smoother)
  8290. @item p
  8291. mix random noise with a (semi)regular pattern
  8292. @item t
  8293. temporal noise (noise pattern changes between frames)
  8294. @item u
  8295. uniform noise (gaussian otherwise)
  8296. @end table
  8297. @end table
  8298. @subsection Examples
  8299. Add temporal and uniform noise to input video:
  8300. @example
  8301. noise=alls=20:allf=t+u
  8302. @end example
  8303. @section null
  8304. Pass the video source unchanged to the output.
  8305. @section ocr
  8306. Optical Character Recognition
  8307. This filter uses Tesseract for optical character recognition.
  8308. It accepts the following options:
  8309. @table @option
  8310. @item datapath
  8311. Set datapath to tesseract data. Default is to use whatever was
  8312. set at installation.
  8313. @item language
  8314. Set language, default is "eng".
  8315. @item whitelist
  8316. Set character whitelist.
  8317. @item blacklist
  8318. Set character blacklist.
  8319. @end table
  8320. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  8321. @section ocv
  8322. Apply a video transform using libopencv.
  8323. To enable this filter, install the libopencv library and headers and
  8324. configure FFmpeg with @code{--enable-libopencv}.
  8325. It accepts the following parameters:
  8326. @table @option
  8327. @item filter_name
  8328. The name of the libopencv filter to apply.
  8329. @item filter_params
  8330. The parameters to pass to the libopencv filter. If not specified, the default
  8331. values are assumed.
  8332. @end table
  8333. Refer to the official libopencv documentation for more precise
  8334. information:
  8335. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  8336. Several libopencv filters are supported; see the following subsections.
  8337. @anchor{dilate}
  8338. @subsection dilate
  8339. Dilate an image by using a specific structuring element.
  8340. It corresponds to the libopencv function @code{cvDilate}.
  8341. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  8342. @var{struct_el} represents a structuring element, and has the syntax:
  8343. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  8344. @var{cols} and @var{rows} represent the number of columns and rows of
  8345. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  8346. point, and @var{shape} the shape for the structuring element. @var{shape}
  8347. must be "rect", "cross", "ellipse", or "custom".
  8348. If the value for @var{shape} is "custom", it must be followed by a
  8349. string of the form "=@var{filename}". The file with name
  8350. @var{filename} is assumed to represent a binary image, with each
  8351. printable character corresponding to a bright pixel. When a custom
  8352. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  8353. or columns and rows of the read file are assumed instead.
  8354. The default value for @var{struct_el} is "3x3+0x0/rect".
  8355. @var{nb_iterations} specifies the number of times the transform is
  8356. applied to the image, and defaults to 1.
  8357. Some examples:
  8358. @example
  8359. # Use the default values
  8360. ocv=dilate
  8361. # Dilate using a structuring element with a 5x5 cross, iterating two times
  8362. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  8363. # Read the shape from the file diamond.shape, iterating two times.
  8364. # The file diamond.shape may contain a pattern of characters like this
  8365. # *
  8366. # ***
  8367. # *****
  8368. # ***
  8369. # *
  8370. # The specified columns and rows are ignored
  8371. # but the anchor point coordinates are not
  8372. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  8373. @end example
  8374. @subsection erode
  8375. Erode an image by using a specific structuring element.
  8376. It corresponds to the libopencv function @code{cvErode}.
  8377. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  8378. with the same syntax and semantics as the @ref{dilate} filter.
  8379. @subsection smooth
  8380. Smooth the input video.
  8381. The filter takes the following parameters:
  8382. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  8383. @var{type} is the type of smooth filter to apply, and must be one of
  8384. the following values: "blur", "blur_no_scale", "median", "gaussian",
  8385. or "bilateral". The default value is "gaussian".
  8386. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  8387. depend on the smooth type. @var{param1} and
  8388. @var{param2} accept integer positive values or 0. @var{param3} and
  8389. @var{param4} accept floating point values.
  8390. The default value for @var{param1} is 3. The default value for the
  8391. other parameters is 0.
  8392. These parameters correspond to the parameters assigned to the
  8393. libopencv function @code{cvSmooth}.
  8394. @section oscilloscope
  8395. 2D Video Oscilloscope.
  8396. Useful to measure spatial impulse, step responses, chroma delays, etc.
  8397. It accepts the following parameters:
  8398. @table @option
  8399. @item x
  8400. Set scope center x position.
  8401. @item y
  8402. Set scope center y position.
  8403. @item s
  8404. Set scope size, relative to frame diagonal.
  8405. @item t
  8406. Set scope tilt/rotation.
  8407. @item o
  8408. Set trace opacity.
  8409. @item tx
  8410. Set trace center x position.
  8411. @item ty
  8412. Set trace center y position.
  8413. @item tw
  8414. Set trace width, relative to width of frame.
  8415. @item th
  8416. Set trace height, relative to height of frame.
  8417. @item c
  8418. Set which components to trace. By default it traces first three components.
  8419. @item g
  8420. Draw trace grid. By default is enabled.
  8421. @item st
  8422. Draw some statistics. By default is enabled.
  8423. @item sc
  8424. Draw scope. By default is enabled.
  8425. @end table
  8426. @subsection Examples
  8427. @itemize
  8428. @item
  8429. Inspect full first row of video frame.
  8430. @example
  8431. oscilloscope=x=0.5:y=0:s=1
  8432. @end example
  8433. @item
  8434. Inspect full last row of video frame.
  8435. @example
  8436. oscilloscope=x=0.5:y=1:s=1
  8437. @end example
  8438. @item
  8439. Inspect full 5th line of video frame of height 1080.
  8440. @example
  8441. oscilloscope=x=0.5:y=5/1080:s=1
  8442. @end example
  8443. @item
  8444. Inspect full last column of video frame.
  8445. @example
  8446. oscilloscope=x=1:y=0.5:s=1:t=1
  8447. @end example
  8448. @end itemize
  8449. @anchor{overlay}
  8450. @section overlay
  8451. Overlay one video on top of another.
  8452. It takes two inputs and has one output. The first input is the "main"
  8453. video on which the second input is overlaid.
  8454. It accepts the following parameters:
  8455. A description of the accepted options follows.
  8456. @table @option
  8457. @item x
  8458. @item y
  8459. Set the expression for the x and y coordinates of the overlaid video
  8460. on the main video. Default value is "0" for both expressions. In case
  8461. the expression is invalid, it is set to a huge value (meaning that the
  8462. overlay will not be displayed within the output visible area).
  8463. @item eof_action
  8464. See @ref{framesync}.
  8465. @item eval
  8466. Set when the expressions for @option{x}, and @option{y} are evaluated.
  8467. It accepts the following values:
  8468. @table @samp
  8469. @item init
  8470. only evaluate expressions once during the filter initialization or
  8471. when a command is processed
  8472. @item frame
  8473. evaluate expressions for each incoming frame
  8474. @end table
  8475. Default value is @samp{frame}.
  8476. @item shortest
  8477. See @ref{framesync}.
  8478. @item format
  8479. Set the format for the output video.
  8480. It accepts the following values:
  8481. @table @samp
  8482. @item yuv420
  8483. force YUV420 output
  8484. @item yuv422
  8485. force YUV422 output
  8486. @item yuv444
  8487. force YUV444 output
  8488. @item rgb
  8489. force packed RGB output
  8490. @item gbrp
  8491. force planar RGB output
  8492. @item auto
  8493. automatically pick format
  8494. @end table
  8495. Default value is @samp{yuv420}.
  8496. @item repeatlast
  8497. See @ref{framesync}.
  8498. @end table
  8499. The @option{x}, and @option{y} expressions can contain the following
  8500. parameters.
  8501. @table @option
  8502. @item main_w, W
  8503. @item main_h, H
  8504. The main input width and height.
  8505. @item overlay_w, w
  8506. @item overlay_h, h
  8507. The overlay input width and height.
  8508. @item x
  8509. @item y
  8510. The computed values for @var{x} and @var{y}. They are evaluated for
  8511. each new frame.
  8512. @item hsub
  8513. @item vsub
  8514. horizontal and vertical chroma subsample values of the output
  8515. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  8516. @var{vsub} is 1.
  8517. @item n
  8518. the number of input frame, starting from 0
  8519. @item pos
  8520. the position in the file of the input frame, NAN if unknown
  8521. @item t
  8522. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  8523. @end table
  8524. This filter also supports the @ref{framesync} options.
  8525. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  8526. when evaluation is done @emph{per frame}, and will evaluate to NAN
  8527. when @option{eval} is set to @samp{init}.
  8528. Be aware that frames are taken from each input video in timestamp
  8529. order, hence, if their initial timestamps differ, it is a good idea
  8530. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  8531. have them begin in the same zero timestamp, as the example for
  8532. the @var{movie} filter does.
  8533. You can chain together more overlays but you should test the
  8534. efficiency of such approach.
  8535. @subsection Commands
  8536. This filter supports the following commands:
  8537. @table @option
  8538. @item x
  8539. @item y
  8540. Modify the x and y of the overlay input.
  8541. The command accepts the same syntax of the corresponding option.
  8542. If the specified expression is not valid, it is kept at its current
  8543. value.
  8544. @end table
  8545. @subsection Examples
  8546. @itemize
  8547. @item
  8548. Draw the overlay at 10 pixels from the bottom right corner of the main
  8549. video:
  8550. @example
  8551. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  8552. @end example
  8553. Using named options the example above becomes:
  8554. @example
  8555. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  8556. @end example
  8557. @item
  8558. Insert a transparent PNG logo in the bottom left corner of the input,
  8559. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  8560. @example
  8561. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  8562. @end example
  8563. @item
  8564. Insert 2 different transparent PNG logos (second logo on bottom
  8565. right corner) using the @command{ffmpeg} tool:
  8566. @example
  8567. 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
  8568. @end example
  8569. @item
  8570. Add a transparent color layer on top of the main video; @code{WxH}
  8571. must specify the size of the main input to the overlay filter:
  8572. @example
  8573. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  8574. @end example
  8575. @item
  8576. Play an original video and a filtered version (here with the deshake
  8577. filter) side by side using the @command{ffplay} tool:
  8578. @example
  8579. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  8580. @end example
  8581. The above command is the same as:
  8582. @example
  8583. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  8584. @end example
  8585. @item
  8586. Make a sliding overlay appearing from the left to the right top part of the
  8587. screen starting since time 2:
  8588. @example
  8589. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  8590. @end example
  8591. @item
  8592. Compose output by putting two input videos side to side:
  8593. @example
  8594. ffmpeg -i left.avi -i right.avi -filter_complex "
  8595. nullsrc=size=200x100 [background];
  8596. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  8597. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  8598. [background][left] overlay=shortest=1 [background+left];
  8599. [background+left][right] overlay=shortest=1:x=100 [left+right]
  8600. "
  8601. @end example
  8602. @item
  8603. Mask 10-20 seconds of a video by applying the delogo filter to a section
  8604. @example
  8605. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  8606. -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]'
  8607. masked.avi
  8608. @end example
  8609. @item
  8610. Chain several overlays in cascade:
  8611. @example
  8612. nullsrc=s=200x200 [bg];
  8613. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  8614. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  8615. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  8616. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  8617. [in3] null, [mid2] overlay=100:100 [out0]
  8618. @end example
  8619. @end itemize
  8620. @section owdenoise
  8621. Apply Overcomplete Wavelet denoiser.
  8622. The filter accepts the following options:
  8623. @table @option
  8624. @item depth
  8625. Set depth.
  8626. Larger depth values will denoise lower frequency components more, but
  8627. slow down filtering.
  8628. Must be an int in the range 8-16, default is @code{8}.
  8629. @item luma_strength, ls
  8630. Set luma strength.
  8631. Must be a double value in the range 0-1000, default is @code{1.0}.
  8632. @item chroma_strength, cs
  8633. Set chroma strength.
  8634. Must be a double value in the range 0-1000, default is @code{1.0}.
  8635. @end table
  8636. @anchor{pad}
  8637. @section pad
  8638. Add paddings to the input image, and place the original input at the
  8639. provided @var{x}, @var{y} coordinates.
  8640. It accepts the following parameters:
  8641. @table @option
  8642. @item width, w
  8643. @item height, h
  8644. Specify an expression for the size of the output image with the
  8645. paddings added. If the value for @var{width} or @var{height} is 0, the
  8646. corresponding input size is used for the output.
  8647. The @var{width} expression can reference the value set by the
  8648. @var{height} expression, and vice versa.
  8649. The default value of @var{width} and @var{height} is 0.
  8650. @item x
  8651. @item y
  8652. Specify the offsets to place the input image at within the padded area,
  8653. with respect to the top/left border of the output image.
  8654. The @var{x} expression can reference the value set by the @var{y}
  8655. expression, and vice versa.
  8656. The default value of @var{x} and @var{y} is 0.
  8657. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  8658. so the input image is centered on the padded area.
  8659. @item color
  8660. Specify the color of the padded area. For the syntax of this option,
  8661. check the "Color" section in the ffmpeg-utils manual.
  8662. The default value of @var{color} is "black".
  8663. @item eval
  8664. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  8665. It accepts the following values:
  8666. @table @samp
  8667. @item init
  8668. Only evaluate expressions once during the filter initialization or when
  8669. a command is processed.
  8670. @item frame
  8671. Evaluate expressions for each incoming frame.
  8672. @end table
  8673. Default value is @samp{init}.
  8674. @item aspect
  8675. Pad to aspect instead to a resolution.
  8676. @end table
  8677. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  8678. options are expressions containing the following constants:
  8679. @table @option
  8680. @item in_w
  8681. @item in_h
  8682. The input video width and height.
  8683. @item iw
  8684. @item ih
  8685. These are the same as @var{in_w} and @var{in_h}.
  8686. @item out_w
  8687. @item out_h
  8688. The output width and height (the size of the padded area), as
  8689. specified by the @var{width} and @var{height} expressions.
  8690. @item ow
  8691. @item oh
  8692. These are the same as @var{out_w} and @var{out_h}.
  8693. @item x
  8694. @item y
  8695. The x and y offsets as specified by the @var{x} and @var{y}
  8696. expressions, or NAN if not yet specified.
  8697. @item a
  8698. same as @var{iw} / @var{ih}
  8699. @item sar
  8700. input sample aspect ratio
  8701. @item dar
  8702. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  8703. @item hsub
  8704. @item vsub
  8705. The horizontal and vertical chroma subsample values. For example for the
  8706. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8707. @end table
  8708. @subsection Examples
  8709. @itemize
  8710. @item
  8711. Add paddings with the color "violet" to the input video. The output video
  8712. size is 640x480, and the top-left corner of the input video is placed at
  8713. column 0, row 40
  8714. @example
  8715. pad=640:480:0:40:violet
  8716. @end example
  8717. The example above is equivalent to the following command:
  8718. @example
  8719. pad=width=640:height=480:x=0:y=40:color=violet
  8720. @end example
  8721. @item
  8722. Pad the input to get an output with dimensions increased by 3/2,
  8723. and put the input video at the center of the padded area:
  8724. @example
  8725. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  8726. @end example
  8727. @item
  8728. Pad the input to get a squared output with size equal to the maximum
  8729. value between the input width and height, and put the input video at
  8730. the center of the padded area:
  8731. @example
  8732. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  8733. @end example
  8734. @item
  8735. Pad the input to get a final w/h ratio of 16:9:
  8736. @example
  8737. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  8738. @end example
  8739. @item
  8740. In case of anamorphic video, in order to set the output display aspect
  8741. correctly, it is necessary to use @var{sar} in the expression,
  8742. according to the relation:
  8743. @example
  8744. (ih * X / ih) * sar = output_dar
  8745. X = output_dar / sar
  8746. @end example
  8747. Thus the previous example needs to be modified to:
  8748. @example
  8749. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  8750. @end example
  8751. @item
  8752. Double the output size and put the input video in the bottom-right
  8753. corner of the output padded area:
  8754. @example
  8755. pad="2*iw:2*ih:ow-iw:oh-ih"
  8756. @end example
  8757. @end itemize
  8758. @anchor{palettegen}
  8759. @section palettegen
  8760. Generate one palette for a whole video stream.
  8761. It accepts the following options:
  8762. @table @option
  8763. @item max_colors
  8764. Set the maximum number of colors to quantize in the palette.
  8765. Note: the palette will still contain 256 colors; the unused palette entries
  8766. will be black.
  8767. @item reserve_transparent
  8768. Create a palette of 255 colors maximum and reserve the last one for
  8769. transparency. Reserving the transparency color is useful for GIF optimization.
  8770. If not set, the maximum of colors in the palette will be 256. You probably want
  8771. to disable this option for a standalone image.
  8772. Set by default.
  8773. @item transparency_color
  8774. Set the color that will be used as background for transparency.
  8775. @item stats_mode
  8776. Set statistics mode.
  8777. It accepts the following values:
  8778. @table @samp
  8779. @item full
  8780. Compute full frame histograms.
  8781. @item diff
  8782. Compute histograms only for the part that differs from previous frame. This
  8783. might be relevant to give more importance to the moving part of your input if
  8784. the background is static.
  8785. @item single
  8786. Compute new histogram for each frame.
  8787. @end table
  8788. Default value is @var{full}.
  8789. @end table
  8790. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  8791. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  8792. color quantization of the palette. This information is also visible at
  8793. @var{info} logging level.
  8794. @subsection Examples
  8795. @itemize
  8796. @item
  8797. Generate a representative palette of a given video using @command{ffmpeg}:
  8798. @example
  8799. ffmpeg -i input.mkv -vf palettegen palette.png
  8800. @end example
  8801. @end itemize
  8802. @section paletteuse
  8803. Use a palette to downsample an input video stream.
  8804. The filter takes two inputs: one video stream and a palette. The palette must
  8805. be a 256 pixels image.
  8806. It accepts the following options:
  8807. @table @option
  8808. @item dither
  8809. Select dithering mode. Available algorithms are:
  8810. @table @samp
  8811. @item bayer
  8812. Ordered 8x8 bayer dithering (deterministic)
  8813. @item heckbert
  8814. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  8815. Note: this dithering is sometimes considered "wrong" and is included as a
  8816. reference.
  8817. @item floyd_steinberg
  8818. Floyd and Steingberg dithering (error diffusion)
  8819. @item sierra2
  8820. Frankie Sierra dithering v2 (error diffusion)
  8821. @item sierra2_4a
  8822. Frankie Sierra dithering v2 "Lite" (error diffusion)
  8823. @end table
  8824. Default is @var{sierra2_4a}.
  8825. @item bayer_scale
  8826. When @var{bayer} dithering is selected, this option defines the scale of the
  8827. pattern (how much the crosshatch pattern is visible). A low value means more
  8828. visible pattern for less banding, and higher value means less visible pattern
  8829. at the cost of more banding.
  8830. The option must be an integer value in the range [0,5]. Default is @var{2}.
  8831. @item diff_mode
  8832. If set, define the zone to process
  8833. @table @samp
  8834. @item rectangle
  8835. Only the changing rectangle will be reprocessed. This is similar to GIF
  8836. cropping/offsetting compression mechanism. This option can be useful for speed
  8837. if only a part of the image is changing, and has use cases such as limiting the
  8838. scope of the error diffusal @option{dither} to the rectangle that bounds the
  8839. moving scene (it leads to more deterministic output if the scene doesn't change
  8840. much, and as a result less moving noise and better GIF compression).
  8841. @end table
  8842. Default is @var{none}.
  8843. @item new
  8844. Take new palette for each output frame.
  8845. @item alpha_threshold
  8846. Sets the alpha threshold for transparency. Alpha values above this threshold
  8847. will be treated as completely opaque, and values below this threshold will be
  8848. treated as completely transparent.
  8849. The option must be an integer value in the range [0,255]. Default is @var{128}.
  8850. @end table
  8851. @subsection Examples
  8852. @itemize
  8853. @item
  8854. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  8855. using @command{ffmpeg}:
  8856. @example
  8857. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  8858. @end example
  8859. @end itemize
  8860. @section perspective
  8861. Correct perspective of video not recorded perpendicular to the screen.
  8862. A description of the accepted parameters follows.
  8863. @table @option
  8864. @item x0
  8865. @item y0
  8866. @item x1
  8867. @item y1
  8868. @item x2
  8869. @item y2
  8870. @item x3
  8871. @item y3
  8872. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  8873. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  8874. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  8875. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  8876. then the corners of the source will be sent to the specified coordinates.
  8877. The expressions can use the following variables:
  8878. @table @option
  8879. @item W
  8880. @item H
  8881. the width and height of video frame.
  8882. @item in
  8883. Input frame count.
  8884. @item on
  8885. Output frame count.
  8886. @end table
  8887. @item interpolation
  8888. Set interpolation for perspective correction.
  8889. It accepts the following values:
  8890. @table @samp
  8891. @item linear
  8892. @item cubic
  8893. @end table
  8894. Default value is @samp{linear}.
  8895. @item sense
  8896. Set interpretation of coordinate options.
  8897. It accepts the following values:
  8898. @table @samp
  8899. @item 0, source
  8900. Send point in the source specified by the given coordinates to
  8901. the corners of the destination.
  8902. @item 1, destination
  8903. Send the corners of the source to the point in the destination specified
  8904. by the given coordinates.
  8905. Default value is @samp{source}.
  8906. @end table
  8907. @item eval
  8908. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  8909. It accepts the following values:
  8910. @table @samp
  8911. @item init
  8912. only evaluate expressions once during the filter initialization or
  8913. when a command is processed
  8914. @item frame
  8915. evaluate expressions for each incoming frame
  8916. @end table
  8917. Default value is @samp{init}.
  8918. @end table
  8919. @section phase
  8920. Delay interlaced video by one field time so that the field order changes.
  8921. The intended use is to fix PAL movies that have been captured with the
  8922. opposite field order to the film-to-video transfer.
  8923. A description of the accepted parameters follows.
  8924. @table @option
  8925. @item mode
  8926. Set phase mode.
  8927. It accepts the following values:
  8928. @table @samp
  8929. @item t
  8930. Capture field order top-first, transfer bottom-first.
  8931. Filter will delay the bottom field.
  8932. @item b
  8933. Capture field order bottom-first, transfer top-first.
  8934. Filter will delay the top field.
  8935. @item p
  8936. Capture and transfer with the same field order. This mode only exists
  8937. for the documentation of the other options to refer to, but if you
  8938. actually select it, the filter will faithfully do nothing.
  8939. @item a
  8940. Capture field order determined automatically by field flags, transfer
  8941. opposite.
  8942. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  8943. basis using field flags. If no field information is available,
  8944. then this works just like @samp{u}.
  8945. @item u
  8946. Capture unknown or varying, transfer opposite.
  8947. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  8948. analyzing the images and selecting the alternative that produces best
  8949. match between the fields.
  8950. @item T
  8951. Capture top-first, transfer unknown or varying.
  8952. Filter selects among @samp{t} and @samp{p} using image analysis.
  8953. @item B
  8954. Capture bottom-first, transfer unknown or varying.
  8955. Filter selects among @samp{b} and @samp{p} using image analysis.
  8956. @item A
  8957. Capture determined by field flags, transfer unknown or varying.
  8958. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  8959. image analysis. If no field information is available, then this works just
  8960. like @samp{U}. This is the default mode.
  8961. @item U
  8962. Both capture and transfer unknown or varying.
  8963. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  8964. @end table
  8965. @end table
  8966. @section pixdesctest
  8967. Pixel format descriptor test filter, mainly useful for internal
  8968. testing. The output video should be equal to the input video.
  8969. For example:
  8970. @example
  8971. format=monow, pixdesctest
  8972. @end example
  8973. can be used to test the monowhite pixel format descriptor definition.
  8974. @section pixscope
  8975. Display sample values of color channels. Mainly useful for checking color
  8976. and levels. Minimum supported resolution is 640x480.
  8977. The filters accept the following options:
  8978. @table @option
  8979. @item x
  8980. Set scope X position, relative offset on X axis.
  8981. @item y
  8982. Set scope Y position, relative offset on Y axis.
  8983. @item w
  8984. Set scope width.
  8985. @item h
  8986. Set scope height.
  8987. @item o
  8988. Set window opacity. This window also holds statistics about pixel area.
  8989. @item wx
  8990. Set window X position, relative offset on X axis.
  8991. @item wy
  8992. Set window Y position, relative offset on Y axis.
  8993. @end table
  8994. @section pp
  8995. Enable the specified chain of postprocessing subfilters using libpostproc. This
  8996. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  8997. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  8998. Each subfilter and some options have a short and a long name that can be used
  8999. interchangeably, i.e. dr/dering are the same.
  9000. The filters accept the following options:
  9001. @table @option
  9002. @item subfilters
  9003. Set postprocessing subfilters string.
  9004. @end table
  9005. All subfilters share common options to determine their scope:
  9006. @table @option
  9007. @item a/autoq
  9008. Honor the quality commands for this subfilter.
  9009. @item c/chrom
  9010. Do chrominance filtering, too (default).
  9011. @item y/nochrom
  9012. Do luminance filtering only (no chrominance).
  9013. @item n/noluma
  9014. Do chrominance filtering only (no luminance).
  9015. @end table
  9016. These options can be appended after the subfilter name, separated by a '|'.
  9017. Available subfilters are:
  9018. @table @option
  9019. @item hb/hdeblock[|difference[|flatness]]
  9020. Horizontal deblocking filter
  9021. @table @option
  9022. @item difference
  9023. Difference factor where higher values mean more deblocking (default: @code{32}).
  9024. @item flatness
  9025. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9026. @end table
  9027. @item vb/vdeblock[|difference[|flatness]]
  9028. Vertical deblocking filter
  9029. @table @option
  9030. @item difference
  9031. Difference factor where higher values mean more deblocking (default: @code{32}).
  9032. @item flatness
  9033. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9034. @end table
  9035. @item ha/hadeblock[|difference[|flatness]]
  9036. Accurate horizontal deblocking filter
  9037. @table @option
  9038. @item difference
  9039. Difference factor where higher values mean more deblocking (default: @code{32}).
  9040. @item flatness
  9041. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9042. @end table
  9043. @item va/vadeblock[|difference[|flatness]]
  9044. Accurate vertical deblocking filter
  9045. @table @option
  9046. @item difference
  9047. Difference factor where higher values mean more deblocking (default: @code{32}).
  9048. @item flatness
  9049. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9050. @end table
  9051. @end table
  9052. The horizontal and vertical deblocking filters share the difference and
  9053. flatness values so you cannot set different horizontal and vertical
  9054. thresholds.
  9055. @table @option
  9056. @item h1/x1hdeblock
  9057. Experimental horizontal deblocking filter
  9058. @item v1/x1vdeblock
  9059. Experimental vertical deblocking filter
  9060. @item dr/dering
  9061. Deringing filter
  9062. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  9063. @table @option
  9064. @item threshold1
  9065. larger -> stronger filtering
  9066. @item threshold2
  9067. larger -> stronger filtering
  9068. @item threshold3
  9069. larger -> stronger filtering
  9070. @end table
  9071. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  9072. @table @option
  9073. @item f/fullyrange
  9074. Stretch luminance to @code{0-255}.
  9075. @end table
  9076. @item lb/linblenddeint
  9077. Linear blend deinterlacing filter that deinterlaces the given block by
  9078. filtering all lines with a @code{(1 2 1)} filter.
  9079. @item li/linipoldeint
  9080. Linear interpolating deinterlacing filter that deinterlaces the given block by
  9081. linearly interpolating every second line.
  9082. @item ci/cubicipoldeint
  9083. Cubic interpolating deinterlacing filter deinterlaces the given block by
  9084. cubically interpolating every second line.
  9085. @item md/mediandeint
  9086. Median deinterlacing filter that deinterlaces the given block by applying a
  9087. median filter to every second line.
  9088. @item fd/ffmpegdeint
  9089. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  9090. second line with a @code{(-1 4 2 4 -1)} filter.
  9091. @item l5/lowpass5
  9092. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  9093. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  9094. @item fq/forceQuant[|quantizer]
  9095. Overrides the quantizer table from the input with the constant quantizer you
  9096. specify.
  9097. @table @option
  9098. @item quantizer
  9099. Quantizer to use
  9100. @end table
  9101. @item de/default
  9102. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  9103. @item fa/fast
  9104. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  9105. @item ac
  9106. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  9107. @end table
  9108. @subsection Examples
  9109. @itemize
  9110. @item
  9111. Apply horizontal and vertical deblocking, deringing and automatic
  9112. brightness/contrast:
  9113. @example
  9114. pp=hb/vb/dr/al
  9115. @end example
  9116. @item
  9117. Apply default filters without brightness/contrast correction:
  9118. @example
  9119. pp=de/-al
  9120. @end example
  9121. @item
  9122. Apply default filters and temporal denoiser:
  9123. @example
  9124. pp=default/tmpnoise|1|2|3
  9125. @end example
  9126. @item
  9127. Apply deblocking on luminance only, and switch vertical deblocking on or off
  9128. automatically depending on available CPU time:
  9129. @example
  9130. pp=hb|y/vb|a
  9131. @end example
  9132. @end itemize
  9133. @section pp7
  9134. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  9135. similar to spp = 6 with 7 point DCT, where only the center sample is
  9136. used after IDCT.
  9137. The filter accepts the following options:
  9138. @table @option
  9139. @item qp
  9140. Force a constant quantization parameter. It accepts an integer in range
  9141. 0 to 63. If not set, the filter will use the QP from the video stream
  9142. (if available).
  9143. @item mode
  9144. Set thresholding mode. Available modes are:
  9145. @table @samp
  9146. @item hard
  9147. Set hard thresholding.
  9148. @item soft
  9149. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9150. @item medium
  9151. Set medium thresholding (good results, default).
  9152. @end table
  9153. @end table
  9154. @section premultiply
  9155. Apply alpha premultiply effect to input video stream using first plane
  9156. of second stream as alpha.
  9157. Both streams must have same dimensions and same pixel format.
  9158. The filter accepts the following option:
  9159. @table @option
  9160. @item planes
  9161. Set which planes will be processed, unprocessed planes will be copied.
  9162. By default value 0xf, all planes will be processed.
  9163. @item inplace
  9164. Do not require 2nd input for processing, instead use alpha plane from input stream.
  9165. @end table
  9166. @section prewitt
  9167. Apply prewitt operator to input video stream.
  9168. The filter accepts the following option:
  9169. @table @option
  9170. @item planes
  9171. Set which planes will be processed, unprocessed planes will be copied.
  9172. By default value 0xf, all planes will be processed.
  9173. @item scale
  9174. Set value which will be multiplied with filtered result.
  9175. @item delta
  9176. Set value which will be added to filtered result.
  9177. @end table
  9178. @section pseudocolor
  9179. Alter frame colors in video with pseudocolors.
  9180. This filter accept the following options:
  9181. @table @option
  9182. @item c0
  9183. set pixel first component expression
  9184. @item c1
  9185. set pixel second component expression
  9186. @item c2
  9187. set pixel third component expression
  9188. @item c3
  9189. set pixel fourth component expression, corresponds to the alpha component
  9190. @item i
  9191. set component to use as base for altering colors
  9192. @end table
  9193. Each of them specifies the expression to use for computing the lookup table for
  9194. the corresponding pixel component values.
  9195. The expressions can contain the following constants and functions:
  9196. @table @option
  9197. @item w
  9198. @item h
  9199. The input width and height.
  9200. @item val
  9201. The input value for the pixel component.
  9202. @item ymin, umin, vmin, amin
  9203. The minimum allowed component value.
  9204. @item ymax, umax, vmax, amax
  9205. The maximum allowed component value.
  9206. @end table
  9207. All expressions default to "val".
  9208. @subsection Examples
  9209. @itemize
  9210. @item
  9211. Change too high luma values to gradient:
  9212. @example
  9213. 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'"
  9214. @end example
  9215. @end itemize
  9216. @section psnr
  9217. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  9218. Ratio) between two input videos.
  9219. This filter takes in input two input videos, the first input is
  9220. considered the "main" source and is passed unchanged to the
  9221. output. The second input is used as a "reference" video for computing
  9222. the PSNR.
  9223. Both video inputs must have the same resolution and pixel format for
  9224. this filter to work correctly. Also it assumes that both inputs
  9225. have the same number of frames, which are compared one by one.
  9226. The obtained average PSNR is printed through the logging system.
  9227. The filter stores the accumulated MSE (mean squared error) of each
  9228. frame, and at the end of the processing it is averaged across all frames
  9229. equally, and the following formula is applied to obtain the PSNR:
  9230. @example
  9231. PSNR = 10*log10(MAX^2/MSE)
  9232. @end example
  9233. Where MAX is the average of the maximum values of each component of the
  9234. image.
  9235. The description of the accepted parameters follows.
  9236. @table @option
  9237. @item stats_file, f
  9238. If specified the filter will use the named file to save the PSNR of
  9239. each individual frame. When filename equals "-" the data is sent to
  9240. standard output.
  9241. @item stats_version
  9242. Specifies which version of the stats file format to use. Details of
  9243. each format are written below.
  9244. Default value is 1.
  9245. @item stats_add_max
  9246. Determines whether the max value is output to the stats log.
  9247. Default value is 0.
  9248. Requires stats_version >= 2. If this is set and stats_version < 2,
  9249. the filter will return an error.
  9250. @end table
  9251. This filter also supports the @ref{framesync} options.
  9252. The file printed if @var{stats_file} is selected, contains a sequence of
  9253. key/value pairs of the form @var{key}:@var{value} for each compared
  9254. couple of frames.
  9255. If a @var{stats_version} greater than 1 is specified, a header line precedes
  9256. the list of per-frame-pair stats, with key value pairs following the frame
  9257. format with the following parameters:
  9258. @table @option
  9259. @item psnr_log_version
  9260. The version of the log file format. Will match @var{stats_version}.
  9261. @item fields
  9262. A comma separated list of the per-frame-pair parameters included in
  9263. the log.
  9264. @end table
  9265. A description of each shown per-frame-pair parameter follows:
  9266. @table @option
  9267. @item n
  9268. sequential number of the input frame, starting from 1
  9269. @item mse_avg
  9270. Mean Square Error pixel-by-pixel average difference of the compared
  9271. frames, averaged over all the image components.
  9272. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  9273. Mean Square Error pixel-by-pixel average difference of the compared
  9274. frames for the component specified by the suffix.
  9275. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  9276. Peak Signal to Noise ratio of the compared frames for the component
  9277. specified by the suffix.
  9278. @item max_avg, max_y, max_u, max_v
  9279. Maximum allowed value for each channel, and average over all
  9280. channels.
  9281. @end table
  9282. For example:
  9283. @example
  9284. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9285. [main][ref] psnr="stats_file=stats.log" [out]
  9286. @end example
  9287. On this example the input file being processed is compared with the
  9288. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  9289. is stored in @file{stats.log}.
  9290. @anchor{pullup}
  9291. @section pullup
  9292. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  9293. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  9294. content.
  9295. The pullup filter is designed to take advantage of future context in making
  9296. its decisions. This filter is stateless in the sense that it does not lock
  9297. onto a pattern to follow, but it instead looks forward to the following
  9298. fields in order to identify matches and rebuild progressive frames.
  9299. To produce content with an even framerate, insert the fps filter after
  9300. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  9301. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  9302. The filter accepts the following options:
  9303. @table @option
  9304. @item jl
  9305. @item jr
  9306. @item jt
  9307. @item jb
  9308. These options set the amount of "junk" to ignore at the left, right, top, and
  9309. bottom of the image, respectively. Left and right are in units of 8 pixels,
  9310. while top and bottom are in units of 2 lines.
  9311. The default is 8 pixels on each side.
  9312. @item sb
  9313. Set the strict breaks. Setting this option to 1 will reduce the chances of
  9314. filter generating an occasional mismatched frame, but it may also cause an
  9315. excessive number of frames to be dropped during high motion sequences.
  9316. Conversely, setting it to -1 will make filter match fields more easily.
  9317. This may help processing of video where there is slight blurring between
  9318. the fields, but may also cause there to be interlaced frames in the output.
  9319. Default value is @code{0}.
  9320. @item mp
  9321. Set the metric plane to use. It accepts the following values:
  9322. @table @samp
  9323. @item l
  9324. Use luma plane.
  9325. @item u
  9326. Use chroma blue plane.
  9327. @item v
  9328. Use chroma red plane.
  9329. @end table
  9330. This option may be set to use chroma plane instead of the default luma plane
  9331. for doing filter's computations. This may improve accuracy on very clean
  9332. source material, but more likely will decrease accuracy, especially if there
  9333. is chroma noise (rainbow effect) or any grayscale video.
  9334. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  9335. load and make pullup usable in realtime on slow machines.
  9336. @end table
  9337. For best results (without duplicated frames in the output file) it is
  9338. necessary to change the output frame rate. For example, to inverse
  9339. telecine NTSC input:
  9340. @example
  9341. ffmpeg -i input -vf pullup -r 24000/1001 ...
  9342. @end example
  9343. @section qp
  9344. Change video quantization parameters (QP).
  9345. The filter accepts the following option:
  9346. @table @option
  9347. @item qp
  9348. Set expression for quantization parameter.
  9349. @end table
  9350. The expression is evaluated through the eval API and can contain, among others,
  9351. the following constants:
  9352. @table @var
  9353. @item known
  9354. 1 if index is not 129, 0 otherwise.
  9355. @item qp
  9356. Sequential index starting from -129 to 128.
  9357. @end table
  9358. @subsection Examples
  9359. @itemize
  9360. @item
  9361. Some equation like:
  9362. @example
  9363. qp=2+2*sin(PI*qp)
  9364. @end example
  9365. @end itemize
  9366. @section random
  9367. Flush video frames from internal cache of frames into a random order.
  9368. No frame is discarded.
  9369. Inspired by @ref{frei0r} nervous filter.
  9370. @table @option
  9371. @item frames
  9372. Set size in number of frames of internal cache, in range from @code{2} to
  9373. @code{512}. Default is @code{30}.
  9374. @item seed
  9375. Set seed for random number generator, must be an integer included between
  9376. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  9377. less than @code{0}, the filter will try to use a good random seed on a
  9378. best effort basis.
  9379. @end table
  9380. @section readeia608
  9381. Read closed captioning (EIA-608) information from the top lines of a video frame.
  9382. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  9383. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  9384. with EIA-608 data (starting from 0). A description of each metadata value follows:
  9385. @table @option
  9386. @item lavfi.readeia608.X.cc
  9387. The two bytes stored as EIA-608 data (printed in hexadecimal).
  9388. @item lavfi.readeia608.X.line
  9389. The number of the line on which the EIA-608 data was identified and read.
  9390. @end table
  9391. This filter accepts the following options:
  9392. @table @option
  9393. @item scan_min
  9394. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  9395. @item scan_max
  9396. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  9397. @item mac
  9398. Set minimal acceptable amplitude change for sync codes detection.
  9399. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  9400. @item spw
  9401. Set the ratio of width reserved for sync code detection.
  9402. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  9403. @item mhd
  9404. Set the max peaks height difference for sync code detection.
  9405. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9406. @item mpd
  9407. Set max peaks period difference for sync code detection.
  9408. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9409. @item msd
  9410. Set the first two max start code bits differences.
  9411. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  9412. @item bhd
  9413. Set the minimum ratio of bits height compared to 3rd start code bit.
  9414. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  9415. @item th_w
  9416. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  9417. @item th_b
  9418. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  9419. @item chp
  9420. Enable checking the parity bit. In the event of a parity error, the filter will output
  9421. @code{0x00} for that character. Default is false.
  9422. @end table
  9423. @subsection Examples
  9424. @itemize
  9425. @item
  9426. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  9427. @example
  9428. 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
  9429. @end example
  9430. @end itemize
  9431. @section readvitc
  9432. Read vertical interval timecode (VITC) information from the top lines of a
  9433. video frame.
  9434. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  9435. timecode value, if a valid timecode has been detected. Further metadata key
  9436. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  9437. timecode data has been found or not.
  9438. This filter accepts the following options:
  9439. @table @option
  9440. @item scan_max
  9441. Set the maximum number of lines to scan for VITC data. If the value is set to
  9442. @code{-1} the full video frame is scanned. Default is @code{45}.
  9443. @item thr_b
  9444. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  9445. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  9446. @item thr_w
  9447. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  9448. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  9449. @end table
  9450. @subsection Examples
  9451. @itemize
  9452. @item
  9453. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  9454. draw @code{--:--:--:--} as a placeholder:
  9455. @example
  9456. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  9457. @end example
  9458. @end itemize
  9459. @section remap
  9460. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  9461. Destination pixel at position (X, Y) will be picked from source (x, y) position
  9462. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  9463. value for pixel will be used for destination pixel.
  9464. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  9465. will have Xmap/Ymap video stream dimensions.
  9466. Xmap and Ymap input video streams are 16bit depth, single channel.
  9467. @section removegrain
  9468. The removegrain filter is a spatial denoiser for progressive video.
  9469. @table @option
  9470. @item m0
  9471. Set mode for the first plane.
  9472. @item m1
  9473. Set mode for the second plane.
  9474. @item m2
  9475. Set mode for the third plane.
  9476. @item m3
  9477. Set mode for the fourth plane.
  9478. @end table
  9479. Range of mode is from 0 to 24. Description of each mode follows:
  9480. @table @var
  9481. @item 0
  9482. Leave input plane unchanged. Default.
  9483. @item 1
  9484. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  9485. @item 2
  9486. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  9487. @item 3
  9488. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  9489. @item 4
  9490. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  9491. This is equivalent to a median filter.
  9492. @item 5
  9493. Line-sensitive clipping giving the minimal change.
  9494. @item 6
  9495. Line-sensitive clipping, intermediate.
  9496. @item 7
  9497. Line-sensitive clipping, intermediate.
  9498. @item 8
  9499. Line-sensitive clipping, intermediate.
  9500. @item 9
  9501. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  9502. @item 10
  9503. Replaces the target pixel with the closest neighbour.
  9504. @item 11
  9505. [1 2 1] horizontal and vertical kernel blur.
  9506. @item 12
  9507. Same as mode 11.
  9508. @item 13
  9509. Bob mode, interpolates top field from the line where the neighbours
  9510. pixels are the closest.
  9511. @item 14
  9512. Bob mode, interpolates bottom field from the line where the neighbours
  9513. pixels are the closest.
  9514. @item 15
  9515. Bob mode, interpolates top field. Same as 13 but with a more complicated
  9516. interpolation formula.
  9517. @item 16
  9518. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  9519. interpolation formula.
  9520. @item 17
  9521. Clips the pixel with the minimum and maximum of respectively the maximum and
  9522. minimum of each pair of opposite neighbour pixels.
  9523. @item 18
  9524. Line-sensitive clipping using opposite neighbours whose greatest distance from
  9525. the current pixel is minimal.
  9526. @item 19
  9527. Replaces the pixel with the average of its 8 neighbours.
  9528. @item 20
  9529. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  9530. @item 21
  9531. Clips pixels using the averages of opposite neighbour.
  9532. @item 22
  9533. Same as mode 21 but simpler and faster.
  9534. @item 23
  9535. Small edge and halo removal, but reputed useless.
  9536. @item 24
  9537. Similar as 23.
  9538. @end table
  9539. @section removelogo
  9540. Suppress a TV station logo, using an image file to determine which
  9541. pixels comprise the logo. It works by filling in the pixels that
  9542. comprise the logo with neighboring pixels.
  9543. The filter accepts the following options:
  9544. @table @option
  9545. @item filename, f
  9546. Set the filter bitmap file, which can be any image format supported by
  9547. libavformat. The width and height of the image file must match those of the
  9548. video stream being processed.
  9549. @end table
  9550. Pixels in the provided bitmap image with a value of zero are not
  9551. considered part of the logo, non-zero pixels are considered part of
  9552. the logo. If you use white (255) for the logo and black (0) for the
  9553. rest, you will be safe. For making the filter bitmap, it is
  9554. recommended to take a screen capture of a black frame with the logo
  9555. visible, and then using a threshold filter followed by the erode
  9556. filter once or twice.
  9557. If needed, little splotches can be fixed manually. Remember that if
  9558. logo pixels are not covered, the filter quality will be much
  9559. reduced. Marking too many pixels as part of the logo does not hurt as
  9560. much, but it will increase the amount of blurring needed to cover over
  9561. the image and will destroy more information than necessary, and extra
  9562. pixels will slow things down on a large logo.
  9563. @section repeatfields
  9564. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  9565. fields based on its value.
  9566. @section reverse
  9567. Reverse a video clip.
  9568. Warning: This filter requires memory to buffer the entire clip, so trimming
  9569. is suggested.
  9570. @subsection Examples
  9571. @itemize
  9572. @item
  9573. Take the first 5 seconds of a clip, and reverse it.
  9574. @example
  9575. trim=end=5,reverse
  9576. @end example
  9577. @end itemize
  9578. @section roberts
  9579. Apply roberts cross operator to input video stream.
  9580. The filter accepts the following option:
  9581. @table @option
  9582. @item planes
  9583. Set which planes will be processed, unprocessed planes will be copied.
  9584. By default value 0xf, all planes will be processed.
  9585. @item scale
  9586. Set value which will be multiplied with filtered result.
  9587. @item delta
  9588. Set value which will be added to filtered result.
  9589. @end table
  9590. @section rotate
  9591. Rotate video by an arbitrary angle expressed in radians.
  9592. The filter accepts the following options:
  9593. A description of the optional parameters follows.
  9594. @table @option
  9595. @item angle, a
  9596. Set an expression for the angle by which to rotate the input video
  9597. clockwise, expressed as a number of radians. A negative value will
  9598. result in a counter-clockwise rotation. By default it is set to "0".
  9599. This expression is evaluated for each frame.
  9600. @item out_w, ow
  9601. Set the output width expression, default value is "iw".
  9602. This expression is evaluated just once during configuration.
  9603. @item out_h, oh
  9604. Set the output height expression, default value is "ih".
  9605. This expression is evaluated just once during configuration.
  9606. @item bilinear
  9607. Enable bilinear interpolation if set to 1, a value of 0 disables
  9608. it. Default value is 1.
  9609. @item fillcolor, c
  9610. Set the color used to fill the output area not covered by the rotated
  9611. image. For the general syntax of this option, check the "Color" section in the
  9612. ffmpeg-utils manual. If the special value "none" is selected then no
  9613. background is printed (useful for example if the background is never shown).
  9614. Default value is "black".
  9615. @end table
  9616. The expressions for the angle and the output size can contain the
  9617. following constants and functions:
  9618. @table @option
  9619. @item n
  9620. sequential number of the input frame, starting from 0. It is always NAN
  9621. before the first frame is filtered.
  9622. @item t
  9623. time in seconds of the input frame, it is set to 0 when the filter is
  9624. configured. It is always NAN before the first frame is filtered.
  9625. @item hsub
  9626. @item vsub
  9627. horizontal and vertical chroma subsample values. For example for the
  9628. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9629. @item in_w, iw
  9630. @item in_h, ih
  9631. the input video width and height
  9632. @item out_w, ow
  9633. @item out_h, oh
  9634. the output width and height, that is the size of the padded area as
  9635. specified by the @var{width} and @var{height} expressions
  9636. @item rotw(a)
  9637. @item roth(a)
  9638. the minimal width/height required for completely containing the input
  9639. video rotated by @var{a} radians.
  9640. These are only available when computing the @option{out_w} and
  9641. @option{out_h} expressions.
  9642. @end table
  9643. @subsection Examples
  9644. @itemize
  9645. @item
  9646. Rotate the input by PI/6 radians clockwise:
  9647. @example
  9648. rotate=PI/6
  9649. @end example
  9650. @item
  9651. Rotate the input by PI/6 radians counter-clockwise:
  9652. @example
  9653. rotate=-PI/6
  9654. @end example
  9655. @item
  9656. Rotate the input by 45 degrees clockwise:
  9657. @example
  9658. rotate=45*PI/180
  9659. @end example
  9660. @item
  9661. Apply a constant rotation with period T, starting from an angle of PI/3:
  9662. @example
  9663. rotate=PI/3+2*PI*t/T
  9664. @end example
  9665. @item
  9666. Make the input video rotation oscillating with a period of T
  9667. seconds and an amplitude of A radians:
  9668. @example
  9669. rotate=A*sin(2*PI/T*t)
  9670. @end example
  9671. @item
  9672. Rotate the video, output size is chosen so that the whole rotating
  9673. input video is always completely contained in the output:
  9674. @example
  9675. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  9676. @end example
  9677. @item
  9678. Rotate the video, reduce the output size so that no background is ever
  9679. shown:
  9680. @example
  9681. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  9682. @end example
  9683. @end itemize
  9684. @subsection Commands
  9685. The filter supports the following commands:
  9686. @table @option
  9687. @item a, angle
  9688. Set the angle expression.
  9689. The command accepts the same syntax of the corresponding option.
  9690. If the specified expression is not valid, it is kept at its current
  9691. value.
  9692. @end table
  9693. @section sab
  9694. Apply Shape Adaptive Blur.
  9695. The filter accepts the following options:
  9696. @table @option
  9697. @item luma_radius, lr
  9698. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  9699. value is 1.0. A greater value will result in a more blurred image, and
  9700. in slower processing.
  9701. @item luma_pre_filter_radius, lpfr
  9702. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  9703. value is 1.0.
  9704. @item luma_strength, ls
  9705. Set luma maximum difference between pixels to still be considered, must
  9706. be a value in the 0.1-100.0 range, default value is 1.0.
  9707. @item chroma_radius, cr
  9708. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  9709. greater value will result in a more blurred image, and in slower
  9710. processing.
  9711. @item chroma_pre_filter_radius, cpfr
  9712. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  9713. @item chroma_strength, cs
  9714. Set chroma maximum difference between pixels to still be considered,
  9715. must be a value in the -0.9-100.0 range.
  9716. @end table
  9717. Each chroma option value, if not explicitly specified, is set to the
  9718. corresponding luma option value.
  9719. @anchor{scale}
  9720. @section scale
  9721. Scale (resize) the input video, using the libswscale library.
  9722. The scale filter forces the output display aspect ratio to be the same
  9723. of the input, by changing the output sample aspect ratio.
  9724. If the input image format is different from the format requested by
  9725. the next filter, the scale filter will convert the input to the
  9726. requested format.
  9727. @subsection Options
  9728. The filter accepts the following options, or any of the options
  9729. supported by the libswscale scaler.
  9730. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  9731. the complete list of scaler options.
  9732. @table @option
  9733. @item width, w
  9734. @item height, h
  9735. Set the output video dimension expression. Default value is the input
  9736. dimension.
  9737. If the @var{width} or @var{w} value is 0, the input width is used for
  9738. the output. If the @var{height} or @var{h} value is 0, the input height
  9739. is used for the output.
  9740. If one and only one of the values is -n with n >= 1, the scale filter
  9741. will use a value that maintains the aspect ratio of the input image,
  9742. calculated from the other specified dimension. After that it will,
  9743. however, make sure that the calculated dimension is divisible by n and
  9744. adjust the value if necessary.
  9745. If both values are -n with n >= 1, the behavior will be identical to
  9746. both values being set to 0 as previously detailed.
  9747. See below for the list of accepted constants for use in the dimension
  9748. expression.
  9749. @item eval
  9750. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  9751. @table @samp
  9752. @item init
  9753. Only evaluate expressions once during the filter initialization or when a command is processed.
  9754. @item frame
  9755. Evaluate expressions for each incoming frame.
  9756. @end table
  9757. Default value is @samp{init}.
  9758. @item interl
  9759. Set the interlacing mode. It accepts the following values:
  9760. @table @samp
  9761. @item 1
  9762. Force interlaced aware scaling.
  9763. @item 0
  9764. Do not apply interlaced scaling.
  9765. @item -1
  9766. Select interlaced aware scaling depending on whether the source frames
  9767. are flagged as interlaced or not.
  9768. @end table
  9769. Default value is @samp{0}.
  9770. @item flags
  9771. Set libswscale scaling flags. See
  9772. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9773. complete list of values. If not explicitly specified the filter applies
  9774. the default flags.
  9775. @item param0, param1
  9776. Set libswscale input parameters for scaling algorithms that need them. See
  9777. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9778. complete documentation. If not explicitly specified the filter applies
  9779. empty parameters.
  9780. @item size, s
  9781. Set the video size. For the syntax of this option, check the
  9782. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9783. @item in_color_matrix
  9784. @item out_color_matrix
  9785. Set in/output YCbCr color space type.
  9786. This allows the autodetected value to be overridden as well as allows forcing
  9787. a specific value used for the output and encoder.
  9788. If not specified, the color space type depends on the pixel format.
  9789. Possible values:
  9790. @table @samp
  9791. @item auto
  9792. Choose automatically.
  9793. @item bt709
  9794. Format conforming to International Telecommunication Union (ITU)
  9795. Recommendation BT.709.
  9796. @item fcc
  9797. Set color space conforming to the United States Federal Communications
  9798. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  9799. @item bt601
  9800. Set color space conforming to:
  9801. @itemize
  9802. @item
  9803. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  9804. @item
  9805. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  9806. @item
  9807. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  9808. @end itemize
  9809. @item smpte240m
  9810. Set color space conforming to SMPTE ST 240:1999.
  9811. @end table
  9812. @item in_range
  9813. @item out_range
  9814. Set in/output YCbCr sample range.
  9815. This allows the autodetected value to be overridden as well as allows forcing
  9816. a specific value used for the output and encoder. If not specified, the
  9817. range depends on the pixel format. Possible values:
  9818. @table @samp
  9819. @item auto
  9820. Choose automatically.
  9821. @item jpeg/full/pc
  9822. Set full range (0-255 in case of 8-bit luma).
  9823. @item mpeg/tv
  9824. Set "MPEG" range (16-235 in case of 8-bit luma).
  9825. @end table
  9826. @item force_original_aspect_ratio
  9827. Enable decreasing or increasing output video width or height if necessary to
  9828. keep the original aspect ratio. Possible values:
  9829. @table @samp
  9830. @item disable
  9831. Scale the video as specified and disable this feature.
  9832. @item decrease
  9833. The output video dimensions will automatically be decreased if needed.
  9834. @item increase
  9835. The output video dimensions will automatically be increased if needed.
  9836. @end table
  9837. One useful instance of this option is that when you know a specific device's
  9838. maximum allowed resolution, you can use this to limit the output video to
  9839. that, while retaining the aspect ratio. For example, device A allows
  9840. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  9841. decrease) and specifying 1280x720 to the command line makes the output
  9842. 1280x533.
  9843. Please note that this is a different thing than specifying -1 for @option{w}
  9844. or @option{h}, you still need to specify the output resolution for this option
  9845. to work.
  9846. @end table
  9847. The values of the @option{w} and @option{h} options are expressions
  9848. containing the following constants:
  9849. @table @var
  9850. @item in_w
  9851. @item in_h
  9852. The input width and height
  9853. @item iw
  9854. @item ih
  9855. These are the same as @var{in_w} and @var{in_h}.
  9856. @item out_w
  9857. @item out_h
  9858. The output (scaled) width and height
  9859. @item ow
  9860. @item oh
  9861. These are the same as @var{out_w} and @var{out_h}
  9862. @item a
  9863. The same as @var{iw} / @var{ih}
  9864. @item sar
  9865. input sample aspect ratio
  9866. @item dar
  9867. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  9868. @item hsub
  9869. @item vsub
  9870. horizontal and vertical input chroma subsample values. For example for the
  9871. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9872. @item ohsub
  9873. @item ovsub
  9874. horizontal and vertical output chroma subsample values. For example for the
  9875. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9876. @end table
  9877. @subsection Examples
  9878. @itemize
  9879. @item
  9880. Scale the input video to a size of 200x100
  9881. @example
  9882. scale=w=200:h=100
  9883. @end example
  9884. This is equivalent to:
  9885. @example
  9886. scale=200:100
  9887. @end example
  9888. or:
  9889. @example
  9890. scale=200x100
  9891. @end example
  9892. @item
  9893. Specify a size abbreviation for the output size:
  9894. @example
  9895. scale=qcif
  9896. @end example
  9897. which can also be written as:
  9898. @example
  9899. scale=size=qcif
  9900. @end example
  9901. @item
  9902. Scale the input to 2x:
  9903. @example
  9904. scale=w=2*iw:h=2*ih
  9905. @end example
  9906. @item
  9907. The above is the same as:
  9908. @example
  9909. scale=2*in_w:2*in_h
  9910. @end example
  9911. @item
  9912. Scale the input to 2x with forced interlaced scaling:
  9913. @example
  9914. scale=2*iw:2*ih:interl=1
  9915. @end example
  9916. @item
  9917. Scale the input to half size:
  9918. @example
  9919. scale=w=iw/2:h=ih/2
  9920. @end example
  9921. @item
  9922. Increase the width, and set the height to the same size:
  9923. @example
  9924. scale=3/2*iw:ow
  9925. @end example
  9926. @item
  9927. Seek Greek harmony:
  9928. @example
  9929. scale=iw:1/PHI*iw
  9930. scale=ih*PHI:ih
  9931. @end example
  9932. @item
  9933. Increase the height, and set the width to 3/2 of the height:
  9934. @example
  9935. scale=w=3/2*oh:h=3/5*ih
  9936. @end example
  9937. @item
  9938. Increase the size, making the size a multiple of the chroma
  9939. subsample values:
  9940. @example
  9941. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  9942. @end example
  9943. @item
  9944. Increase the width to a maximum of 500 pixels,
  9945. keeping the same aspect ratio as the input:
  9946. @example
  9947. scale=w='min(500\, iw*3/2):h=-1'
  9948. @end example
  9949. @end itemize
  9950. @subsection Commands
  9951. This filter supports the following commands:
  9952. @table @option
  9953. @item width, w
  9954. @item height, h
  9955. Set the output video dimension expression.
  9956. The command accepts the same syntax of the corresponding option.
  9957. If the specified expression is not valid, it is kept at its current
  9958. value.
  9959. @end table
  9960. @section scale_npp
  9961. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  9962. format conversion on CUDA video frames. Setting the output width and height
  9963. works in the same way as for the @var{scale} filter.
  9964. The following additional options are accepted:
  9965. @table @option
  9966. @item format
  9967. The pixel format of the output CUDA frames. If set to the string "same" (the
  9968. default), the input format will be kept. Note that automatic format negotiation
  9969. and conversion is not yet supported for hardware frames
  9970. @item interp_algo
  9971. The interpolation algorithm used for resizing. One of the following:
  9972. @table @option
  9973. @item nn
  9974. Nearest neighbour.
  9975. @item linear
  9976. @item cubic
  9977. @item cubic2p_bspline
  9978. 2-parameter cubic (B=1, C=0)
  9979. @item cubic2p_catmullrom
  9980. 2-parameter cubic (B=0, C=1/2)
  9981. @item cubic2p_b05c03
  9982. 2-parameter cubic (B=1/2, C=3/10)
  9983. @item super
  9984. Supersampling
  9985. @item lanczos
  9986. @end table
  9987. @end table
  9988. @section scale2ref
  9989. Scale (resize) the input video, based on a reference video.
  9990. See the scale filter for available options, scale2ref supports the same but
  9991. uses the reference video instead of the main input as basis. scale2ref also
  9992. supports the following additional constants for the @option{w} and
  9993. @option{h} options:
  9994. @table @var
  9995. @item main_w
  9996. @item main_h
  9997. The main input video's width and height
  9998. @item main_a
  9999. The same as @var{main_w} / @var{main_h}
  10000. @item main_sar
  10001. The main input video's sample aspect ratio
  10002. @item main_dar, mdar
  10003. The main input video's display aspect ratio. Calculated from
  10004. @code{(main_w / main_h) * main_sar}.
  10005. @item main_hsub
  10006. @item main_vsub
  10007. The main input video's horizontal and vertical chroma subsample values.
  10008. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  10009. is 1.
  10010. @end table
  10011. @subsection Examples
  10012. @itemize
  10013. @item
  10014. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  10015. @example
  10016. 'scale2ref[b][a];[a][b]overlay'
  10017. @end example
  10018. @end itemize
  10019. @anchor{selectivecolor}
  10020. @section selectivecolor
  10021. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  10022. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  10023. by the "purity" of the color (that is, how saturated it already is).
  10024. This filter is similar to the Adobe Photoshop Selective Color tool.
  10025. The filter accepts the following options:
  10026. @table @option
  10027. @item correction_method
  10028. Select color correction method.
  10029. Available values are:
  10030. @table @samp
  10031. @item absolute
  10032. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  10033. component value).
  10034. @item relative
  10035. Specified adjustments are relative to the original component value.
  10036. @end table
  10037. Default is @code{absolute}.
  10038. @item reds
  10039. Adjustments for red pixels (pixels where the red component is the maximum)
  10040. @item yellows
  10041. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  10042. @item greens
  10043. Adjustments for green pixels (pixels where the green component is the maximum)
  10044. @item cyans
  10045. Adjustments for cyan pixels (pixels where the red component is the minimum)
  10046. @item blues
  10047. Adjustments for blue pixels (pixels where the blue component is the maximum)
  10048. @item magentas
  10049. Adjustments for magenta pixels (pixels where the green component is the minimum)
  10050. @item whites
  10051. Adjustments for white pixels (pixels where all components are greater than 128)
  10052. @item neutrals
  10053. Adjustments for all pixels except pure black and pure white
  10054. @item blacks
  10055. Adjustments for black pixels (pixels where all components are lesser than 128)
  10056. @item psfile
  10057. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  10058. @end table
  10059. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  10060. 4 space separated floating point adjustment values in the [-1,1] range,
  10061. respectively to adjust the amount of cyan, magenta, yellow and black for the
  10062. pixels of its range.
  10063. @subsection Examples
  10064. @itemize
  10065. @item
  10066. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  10067. increase magenta by 27% in blue areas:
  10068. @example
  10069. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  10070. @end example
  10071. @item
  10072. Use a Photoshop selective color preset:
  10073. @example
  10074. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  10075. @end example
  10076. @end itemize
  10077. @anchor{separatefields}
  10078. @section separatefields
  10079. The @code{separatefields} takes a frame-based video input and splits
  10080. each frame into its components fields, producing a new half height clip
  10081. with twice the frame rate and twice the frame count.
  10082. This filter use field-dominance information in frame to decide which
  10083. of each pair of fields to place first in the output.
  10084. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  10085. @section setdar, setsar
  10086. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  10087. output video.
  10088. This is done by changing the specified Sample (aka Pixel) Aspect
  10089. Ratio, according to the following equation:
  10090. @example
  10091. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  10092. @end example
  10093. Keep in mind that the @code{setdar} filter does not modify the pixel
  10094. dimensions of the video frame. Also, the display aspect ratio set by
  10095. this filter may be changed by later filters in the filterchain,
  10096. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  10097. applied.
  10098. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  10099. the filter output video.
  10100. Note that as a consequence of the application of this filter, the
  10101. output display aspect ratio will change according to the equation
  10102. above.
  10103. Keep in mind that the sample aspect ratio set by the @code{setsar}
  10104. filter may be changed by later filters in the filterchain, e.g. if
  10105. another "setsar" or a "setdar" filter is applied.
  10106. It accepts the following parameters:
  10107. @table @option
  10108. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  10109. Set the aspect ratio used by the filter.
  10110. The parameter can be a floating point number string, an expression, or
  10111. a string of the form @var{num}:@var{den}, where @var{num} and
  10112. @var{den} are the numerator and denominator of the aspect ratio. If
  10113. the parameter is not specified, it is assumed the value "0".
  10114. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  10115. should be escaped.
  10116. @item max
  10117. Set the maximum integer value to use for expressing numerator and
  10118. denominator when reducing the expressed aspect ratio to a rational.
  10119. Default value is @code{100}.
  10120. @end table
  10121. The parameter @var{sar} is an expression containing
  10122. the following constants:
  10123. @table @option
  10124. @item E, PI, PHI
  10125. These are approximated values for the mathematical constants e
  10126. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  10127. @item w, h
  10128. The input width and height.
  10129. @item a
  10130. These are the same as @var{w} / @var{h}.
  10131. @item sar
  10132. The input sample aspect ratio.
  10133. @item dar
  10134. The input display aspect ratio. It is the same as
  10135. (@var{w} / @var{h}) * @var{sar}.
  10136. @item hsub, vsub
  10137. Horizontal and vertical chroma subsample values. For example, for the
  10138. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10139. @end table
  10140. @subsection Examples
  10141. @itemize
  10142. @item
  10143. To change the display aspect ratio to 16:9, specify one of the following:
  10144. @example
  10145. setdar=dar=1.77777
  10146. setdar=dar=16/9
  10147. @end example
  10148. @item
  10149. To change the sample aspect ratio to 10:11, specify:
  10150. @example
  10151. setsar=sar=10/11
  10152. @end example
  10153. @item
  10154. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  10155. 1000 in the aspect ratio reduction, use the command:
  10156. @example
  10157. setdar=ratio=16/9:max=1000
  10158. @end example
  10159. @end itemize
  10160. @anchor{setfield}
  10161. @section setfield
  10162. Force field for the output video frame.
  10163. The @code{setfield} filter marks the interlace type field for the
  10164. output frames. It does not change the input frame, but only sets the
  10165. corresponding property, which affects how the frame is treated by
  10166. following filters (e.g. @code{fieldorder} or @code{yadif}).
  10167. The filter accepts the following options:
  10168. @table @option
  10169. @item mode
  10170. Available values are:
  10171. @table @samp
  10172. @item auto
  10173. Keep the same field property.
  10174. @item bff
  10175. Mark the frame as bottom-field-first.
  10176. @item tff
  10177. Mark the frame as top-field-first.
  10178. @item prog
  10179. Mark the frame as progressive.
  10180. @end table
  10181. @end table
  10182. @section showinfo
  10183. Show a line containing various information for each input video frame.
  10184. The input video is not modified.
  10185. The shown line contains a sequence of key/value pairs of the form
  10186. @var{key}:@var{value}.
  10187. The following values are shown in the output:
  10188. @table @option
  10189. @item n
  10190. The (sequential) number of the input frame, starting from 0.
  10191. @item pts
  10192. The Presentation TimeStamp of the input frame, expressed as a number of
  10193. time base units. The time base unit depends on the filter input pad.
  10194. @item pts_time
  10195. The Presentation TimeStamp of the input frame, expressed as a number of
  10196. seconds.
  10197. @item pos
  10198. The position of the frame in the input stream, or -1 if this information is
  10199. unavailable and/or meaningless (for example in case of synthetic video).
  10200. @item fmt
  10201. The pixel format name.
  10202. @item sar
  10203. The sample aspect ratio of the input frame, expressed in the form
  10204. @var{num}/@var{den}.
  10205. @item s
  10206. The size of the input frame. For the syntax of this option, check the
  10207. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10208. @item i
  10209. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  10210. for bottom field first).
  10211. @item iskey
  10212. This is 1 if the frame is a key frame, 0 otherwise.
  10213. @item type
  10214. The picture type of the input frame ("I" for an I-frame, "P" for a
  10215. P-frame, "B" for a B-frame, or "?" for an unknown type).
  10216. Also refer to the documentation of the @code{AVPictureType} enum and of
  10217. the @code{av_get_picture_type_char} function defined in
  10218. @file{libavutil/avutil.h}.
  10219. @item checksum
  10220. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  10221. @item plane_checksum
  10222. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  10223. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  10224. @end table
  10225. @section showpalette
  10226. Displays the 256 colors palette of each frame. This filter is only relevant for
  10227. @var{pal8} pixel format frames.
  10228. It accepts the following option:
  10229. @table @option
  10230. @item s
  10231. Set the size of the box used to represent one palette color entry. Default is
  10232. @code{30} (for a @code{30x30} pixel box).
  10233. @end table
  10234. @section shuffleframes
  10235. Reorder and/or duplicate and/or drop video frames.
  10236. It accepts the following parameters:
  10237. @table @option
  10238. @item mapping
  10239. Set the destination indexes of input frames.
  10240. This is space or '|' separated list of indexes that maps input frames to output
  10241. frames. Number of indexes also sets maximal value that each index may have.
  10242. '-1' index have special meaning and that is to drop frame.
  10243. @end table
  10244. The first frame has the index 0. The default is to keep the input unchanged.
  10245. @subsection Examples
  10246. @itemize
  10247. @item
  10248. Swap second and third frame of every three frames of the input:
  10249. @example
  10250. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  10251. @end example
  10252. @item
  10253. Swap 10th and 1st frame of every ten frames of the input:
  10254. @example
  10255. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  10256. @end example
  10257. @end itemize
  10258. @section shuffleplanes
  10259. Reorder and/or duplicate video planes.
  10260. It accepts the following parameters:
  10261. @table @option
  10262. @item map0
  10263. The index of the input plane to be used as the first output plane.
  10264. @item map1
  10265. The index of the input plane to be used as the second output plane.
  10266. @item map2
  10267. The index of the input plane to be used as the third output plane.
  10268. @item map3
  10269. The index of the input plane to be used as the fourth output plane.
  10270. @end table
  10271. The first plane has the index 0. The default is to keep the input unchanged.
  10272. @subsection Examples
  10273. @itemize
  10274. @item
  10275. Swap the second and third planes of the input:
  10276. @example
  10277. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  10278. @end example
  10279. @end itemize
  10280. @anchor{signalstats}
  10281. @section signalstats
  10282. Evaluate various visual metrics that assist in determining issues associated
  10283. with the digitization of analog video media.
  10284. By default the filter will log these metadata values:
  10285. @table @option
  10286. @item YMIN
  10287. Display the minimal Y value contained within the input frame. Expressed in
  10288. range of [0-255].
  10289. @item YLOW
  10290. Display the Y value at the 10% percentile within the input frame. Expressed in
  10291. range of [0-255].
  10292. @item YAVG
  10293. Display the average Y value within the input frame. Expressed in range of
  10294. [0-255].
  10295. @item YHIGH
  10296. Display the Y value at the 90% percentile within the input frame. Expressed in
  10297. range of [0-255].
  10298. @item YMAX
  10299. Display the maximum Y value contained within the input frame. Expressed in
  10300. range of [0-255].
  10301. @item UMIN
  10302. Display the minimal U value contained within the input frame. Expressed in
  10303. range of [0-255].
  10304. @item ULOW
  10305. Display the U value at the 10% percentile within the input frame. Expressed in
  10306. range of [0-255].
  10307. @item UAVG
  10308. Display the average U value within the input frame. Expressed in range of
  10309. [0-255].
  10310. @item UHIGH
  10311. Display the U value at the 90% percentile within the input frame. Expressed in
  10312. range of [0-255].
  10313. @item UMAX
  10314. Display the maximum U value contained within the input frame. Expressed in
  10315. range of [0-255].
  10316. @item VMIN
  10317. Display the minimal V value contained within the input frame. Expressed in
  10318. range of [0-255].
  10319. @item VLOW
  10320. Display the V value at the 10% percentile within the input frame. Expressed in
  10321. range of [0-255].
  10322. @item VAVG
  10323. Display the average V value within the input frame. Expressed in range of
  10324. [0-255].
  10325. @item VHIGH
  10326. Display the V value at the 90% percentile within the input frame. Expressed in
  10327. range of [0-255].
  10328. @item VMAX
  10329. Display the maximum V value contained within the input frame. Expressed in
  10330. range of [0-255].
  10331. @item SATMIN
  10332. Display the minimal saturation value contained within the input frame.
  10333. Expressed in range of [0-~181.02].
  10334. @item SATLOW
  10335. Display the saturation value at the 10% percentile within the input frame.
  10336. Expressed in range of [0-~181.02].
  10337. @item SATAVG
  10338. Display the average saturation value within the input frame. Expressed in range
  10339. of [0-~181.02].
  10340. @item SATHIGH
  10341. Display the saturation value at the 90% percentile within the input frame.
  10342. Expressed in range of [0-~181.02].
  10343. @item SATMAX
  10344. Display the maximum saturation value contained within the input frame.
  10345. Expressed in range of [0-~181.02].
  10346. @item HUEMED
  10347. Display the median value for hue within the input frame. Expressed in range of
  10348. [0-360].
  10349. @item HUEAVG
  10350. Display the average value for hue within the input frame. Expressed in range of
  10351. [0-360].
  10352. @item YDIF
  10353. Display the average of sample value difference between all values of the Y
  10354. plane in the current frame and corresponding values of the previous input frame.
  10355. Expressed in range of [0-255].
  10356. @item UDIF
  10357. Display the average of sample value difference between all values of the U
  10358. plane in the current frame and corresponding values of the previous input frame.
  10359. Expressed in range of [0-255].
  10360. @item VDIF
  10361. Display the average of sample value difference between all values of the V
  10362. plane in the current frame and corresponding values of the previous input frame.
  10363. Expressed in range of [0-255].
  10364. @item YBITDEPTH
  10365. Display bit depth of Y plane in current frame.
  10366. Expressed in range of [0-16].
  10367. @item UBITDEPTH
  10368. Display bit depth of U plane in current frame.
  10369. Expressed in range of [0-16].
  10370. @item VBITDEPTH
  10371. Display bit depth of V plane in current frame.
  10372. Expressed in range of [0-16].
  10373. @end table
  10374. The filter accepts the following options:
  10375. @table @option
  10376. @item stat
  10377. @item out
  10378. @option{stat} specify an additional form of image analysis.
  10379. @option{out} output video with the specified type of pixel highlighted.
  10380. Both options accept the following values:
  10381. @table @samp
  10382. @item tout
  10383. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  10384. unlike the neighboring pixels of the same field. Examples of temporal outliers
  10385. include the results of video dropouts, head clogs, or tape tracking issues.
  10386. @item vrep
  10387. Identify @var{vertical line repetition}. Vertical line repetition includes
  10388. similar rows of pixels within a frame. In born-digital video vertical line
  10389. repetition is common, but this pattern is uncommon in video digitized from an
  10390. analog source. When it occurs in video that results from the digitization of an
  10391. analog source it can indicate concealment from a dropout compensator.
  10392. @item brng
  10393. Identify pixels that fall outside of legal broadcast range.
  10394. @end table
  10395. @item color, c
  10396. Set the highlight color for the @option{out} option. The default color is
  10397. yellow.
  10398. @end table
  10399. @subsection Examples
  10400. @itemize
  10401. @item
  10402. Output data of various video metrics:
  10403. @example
  10404. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  10405. @end example
  10406. @item
  10407. Output specific data about the minimum and maximum values of the Y plane per frame:
  10408. @example
  10409. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  10410. @end example
  10411. @item
  10412. Playback video while highlighting pixels that are outside of broadcast range in red.
  10413. @example
  10414. ffplay example.mov -vf signalstats="out=brng:color=red"
  10415. @end example
  10416. @item
  10417. Playback video with signalstats metadata drawn over the frame.
  10418. @example
  10419. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  10420. @end example
  10421. The contents of signalstat_drawtext.txt used in the command are:
  10422. @example
  10423. time %@{pts:hms@}
  10424. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  10425. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  10426. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  10427. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  10428. @end example
  10429. @end itemize
  10430. @anchor{signature}
  10431. @section signature
  10432. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  10433. input. In this case the matching between the inputs can be calculated additionally.
  10434. The filter always passes through the first input. The signature of each stream can
  10435. be written into a file.
  10436. It accepts the following options:
  10437. @table @option
  10438. @item detectmode
  10439. Enable or disable the matching process.
  10440. Available values are:
  10441. @table @samp
  10442. @item off
  10443. Disable the calculation of a matching (default).
  10444. @item full
  10445. Calculate the matching for the whole video and output whether the whole video
  10446. matches or only parts.
  10447. @item fast
  10448. Calculate only until a matching is found or the video ends. Should be faster in
  10449. some cases.
  10450. @end table
  10451. @item nb_inputs
  10452. Set the number of inputs. The option value must be a non negative integer.
  10453. Default value is 1.
  10454. @item filename
  10455. Set the path to which the output is written. If there is more than one input,
  10456. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  10457. integer), that will be replaced with the input number. If no filename is
  10458. specified, no output will be written. This is the default.
  10459. @item format
  10460. Choose the output format.
  10461. Available values are:
  10462. @table @samp
  10463. @item binary
  10464. Use the specified binary representation (default).
  10465. @item xml
  10466. Use the specified xml representation.
  10467. @end table
  10468. @item th_d
  10469. Set threshold to detect one word as similar. The option value must be an integer
  10470. greater than zero. The default value is 9000.
  10471. @item th_dc
  10472. Set threshold to detect all words as similar. The option value must be an integer
  10473. greater than zero. The default value is 60000.
  10474. @item th_xh
  10475. Set threshold to detect frames as similar. The option value must be an integer
  10476. greater than zero. The default value is 116.
  10477. @item th_di
  10478. Set the minimum length of a sequence in frames to recognize it as matching
  10479. sequence. The option value must be a non negative integer value.
  10480. The default value is 0.
  10481. @item th_it
  10482. Set the minimum relation, that matching frames to all frames must have.
  10483. The option value must be a double value between 0 and 1. The default value is 0.5.
  10484. @end table
  10485. @subsection Examples
  10486. @itemize
  10487. @item
  10488. To calculate the signature of an input video and store it in signature.bin:
  10489. @example
  10490. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  10491. @end example
  10492. @item
  10493. To detect whether two videos match and store the signatures in XML format in
  10494. signature0.xml and signature1.xml:
  10495. @example
  10496. 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 -
  10497. @end example
  10498. @end itemize
  10499. @anchor{smartblur}
  10500. @section smartblur
  10501. Blur the input video without impacting the outlines.
  10502. It accepts the following options:
  10503. @table @option
  10504. @item luma_radius, lr
  10505. Set the luma radius. The option value must be a float number in
  10506. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10507. used to blur the image (slower if larger). Default value is 1.0.
  10508. @item luma_strength, ls
  10509. Set the luma strength. The option value must be a float number
  10510. in the range [-1.0,1.0] that configures the blurring. A value included
  10511. in [0.0,1.0] will blur the image whereas a value included in
  10512. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  10513. @item luma_threshold, lt
  10514. Set the luma threshold used as a coefficient to determine
  10515. whether a pixel should be blurred or not. The option value must be an
  10516. integer in the range [-30,30]. A value of 0 will filter all the image,
  10517. a value included in [0,30] will filter flat areas and a value included
  10518. in [-30,0] will filter edges. Default value is 0.
  10519. @item chroma_radius, cr
  10520. Set the chroma radius. The option value must be a float number in
  10521. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10522. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  10523. @item chroma_strength, cs
  10524. Set the chroma strength. The option value must be a float number
  10525. in the range [-1.0,1.0] that configures the blurring. A value included
  10526. in [0.0,1.0] will blur the image whereas a value included in
  10527. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  10528. @item chroma_threshold, ct
  10529. Set the chroma threshold used as a coefficient to determine
  10530. whether a pixel should be blurred or not. The option value must be an
  10531. integer in the range [-30,30]. A value of 0 will filter all the image,
  10532. a value included in [0,30] will filter flat areas and a value included
  10533. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  10534. @end table
  10535. If a chroma option is not explicitly set, the corresponding luma value
  10536. is set.
  10537. @section ssim
  10538. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  10539. This filter takes in input two input videos, the first input is
  10540. considered the "main" source and is passed unchanged to the
  10541. output. The second input is used as a "reference" video for computing
  10542. the SSIM.
  10543. Both video inputs must have the same resolution and pixel format for
  10544. this filter to work correctly. Also it assumes that both inputs
  10545. have the same number of frames, which are compared one by one.
  10546. The filter stores the calculated SSIM of each frame.
  10547. The description of the accepted parameters follows.
  10548. @table @option
  10549. @item stats_file, f
  10550. If specified the filter will use the named file to save the SSIM of
  10551. each individual frame. When filename equals "-" the data is sent to
  10552. standard output.
  10553. @end table
  10554. The file printed if @var{stats_file} is selected, contains a sequence of
  10555. key/value pairs of the form @var{key}:@var{value} for each compared
  10556. couple of frames.
  10557. A description of each shown parameter follows:
  10558. @table @option
  10559. @item n
  10560. sequential number of the input frame, starting from 1
  10561. @item Y, U, V, R, G, B
  10562. SSIM of the compared frames for the component specified by the suffix.
  10563. @item All
  10564. SSIM of the compared frames for the whole frame.
  10565. @item dB
  10566. Same as above but in dB representation.
  10567. @end table
  10568. This filter also supports the @ref{framesync} options.
  10569. For example:
  10570. @example
  10571. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10572. [main][ref] ssim="stats_file=stats.log" [out]
  10573. @end example
  10574. On this example the input file being processed is compared with the
  10575. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  10576. is stored in @file{stats.log}.
  10577. Another example with both psnr and ssim at same time:
  10578. @example
  10579. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  10580. @end example
  10581. @section stereo3d
  10582. Convert between different stereoscopic image formats.
  10583. The filters accept the following options:
  10584. @table @option
  10585. @item in
  10586. Set stereoscopic image format of input.
  10587. Available values for input image formats are:
  10588. @table @samp
  10589. @item sbsl
  10590. side by side parallel (left eye left, right eye right)
  10591. @item sbsr
  10592. side by side crosseye (right eye left, left eye right)
  10593. @item sbs2l
  10594. side by side parallel with half width resolution
  10595. (left eye left, right eye right)
  10596. @item sbs2r
  10597. side by side crosseye with half width resolution
  10598. (right eye left, left eye right)
  10599. @item abl
  10600. above-below (left eye above, right eye below)
  10601. @item abr
  10602. above-below (right eye above, left eye below)
  10603. @item ab2l
  10604. above-below with half height resolution
  10605. (left eye above, right eye below)
  10606. @item ab2r
  10607. above-below with half height resolution
  10608. (right eye above, left eye below)
  10609. @item al
  10610. alternating frames (left eye first, right eye second)
  10611. @item ar
  10612. alternating frames (right eye first, left eye second)
  10613. @item irl
  10614. interleaved rows (left eye has top row, right eye starts on next row)
  10615. @item irr
  10616. interleaved rows (right eye has top row, left eye starts on next row)
  10617. @item icl
  10618. interleaved columns, left eye first
  10619. @item icr
  10620. interleaved columns, right eye first
  10621. Default value is @samp{sbsl}.
  10622. @end table
  10623. @item out
  10624. Set stereoscopic image format of output.
  10625. @table @samp
  10626. @item sbsl
  10627. side by side parallel (left eye left, right eye right)
  10628. @item sbsr
  10629. side by side crosseye (right eye left, left eye right)
  10630. @item sbs2l
  10631. side by side parallel with half width resolution
  10632. (left eye left, right eye right)
  10633. @item sbs2r
  10634. side by side crosseye with half width resolution
  10635. (right eye left, left eye right)
  10636. @item abl
  10637. above-below (left eye above, right eye below)
  10638. @item abr
  10639. above-below (right eye above, left eye below)
  10640. @item ab2l
  10641. above-below with half height resolution
  10642. (left eye above, right eye below)
  10643. @item ab2r
  10644. above-below with half height resolution
  10645. (right eye above, left eye below)
  10646. @item al
  10647. alternating frames (left eye first, right eye second)
  10648. @item ar
  10649. alternating frames (right eye first, left eye second)
  10650. @item irl
  10651. interleaved rows (left eye has top row, right eye starts on next row)
  10652. @item irr
  10653. interleaved rows (right eye has top row, left eye starts on next row)
  10654. @item arbg
  10655. anaglyph red/blue gray
  10656. (red filter on left eye, blue filter on right eye)
  10657. @item argg
  10658. anaglyph red/green gray
  10659. (red filter on left eye, green filter on right eye)
  10660. @item arcg
  10661. anaglyph red/cyan gray
  10662. (red filter on left eye, cyan filter on right eye)
  10663. @item arch
  10664. anaglyph red/cyan half colored
  10665. (red filter on left eye, cyan filter on right eye)
  10666. @item arcc
  10667. anaglyph red/cyan color
  10668. (red filter on left eye, cyan filter on right eye)
  10669. @item arcd
  10670. anaglyph red/cyan color optimized with the least squares projection of dubois
  10671. (red filter on left eye, cyan filter on right eye)
  10672. @item agmg
  10673. anaglyph green/magenta gray
  10674. (green filter on left eye, magenta filter on right eye)
  10675. @item agmh
  10676. anaglyph green/magenta half colored
  10677. (green filter on left eye, magenta filter on right eye)
  10678. @item agmc
  10679. anaglyph green/magenta colored
  10680. (green filter on left eye, magenta filter on right eye)
  10681. @item agmd
  10682. anaglyph green/magenta color optimized with the least squares projection of dubois
  10683. (green filter on left eye, magenta filter on right eye)
  10684. @item aybg
  10685. anaglyph yellow/blue gray
  10686. (yellow filter on left eye, blue filter on right eye)
  10687. @item aybh
  10688. anaglyph yellow/blue half colored
  10689. (yellow filter on left eye, blue filter on right eye)
  10690. @item aybc
  10691. anaglyph yellow/blue colored
  10692. (yellow filter on left eye, blue filter on right eye)
  10693. @item aybd
  10694. anaglyph yellow/blue color optimized with the least squares projection of dubois
  10695. (yellow filter on left eye, blue filter on right eye)
  10696. @item ml
  10697. mono output (left eye only)
  10698. @item mr
  10699. mono output (right eye only)
  10700. @item chl
  10701. checkerboard, left eye first
  10702. @item chr
  10703. checkerboard, right eye first
  10704. @item icl
  10705. interleaved columns, left eye first
  10706. @item icr
  10707. interleaved columns, right eye first
  10708. @item hdmi
  10709. HDMI frame pack
  10710. @end table
  10711. Default value is @samp{arcd}.
  10712. @end table
  10713. @subsection Examples
  10714. @itemize
  10715. @item
  10716. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  10717. @example
  10718. stereo3d=sbsl:aybd
  10719. @end example
  10720. @item
  10721. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  10722. @example
  10723. stereo3d=abl:sbsr
  10724. @end example
  10725. @end itemize
  10726. @section streamselect, astreamselect
  10727. Select video or audio streams.
  10728. The filter accepts the following options:
  10729. @table @option
  10730. @item inputs
  10731. Set number of inputs. Default is 2.
  10732. @item map
  10733. Set input indexes to remap to outputs.
  10734. @end table
  10735. @subsection Commands
  10736. The @code{streamselect} and @code{astreamselect} filter supports the following
  10737. commands:
  10738. @table @option
  10739. @item map
  10740. Set input indexes to remap to outputs.
  10741. @end table
  10742. @subsection Examples
  10743. @itemize
  10744. @item
  10745. Select first 5 seconds 1st stream and rest of time 2nd stream:
  10746. @example
  10747. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  10748. @end example
  10749. @item
  10750. Same as above, but for audio:
  10751. @example
  10752. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  10753. @end example
  10754. @end itemize
  10755. @section sobel
  10756. Apply sobel operator to input video stream.
  10757. The filter accepts the following option:
  10758. @table @option
  10759. @item planes
  10760. Set which planes will be processed, unprocessed planes will be copied.
  10761. By default value 0xf, all planes will be processed.
  10762. @item scale
  10763. Set value which will be multiplied with filtered result.
  10764. @item delta
  10765. Set value which will be added to filtered result.
  10766. @end table
  10767. @anchor{spp}
  10768. @section spp
  10769. Apply a simple postprocessing filter that compresses and decompresses the image
  10770. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  10771. and average the results.
  10772. The filter accepts the following options:
  10773. @table @option
  10774. @item quality
  10775. Set quality. This option defines the number of levels for averaging. It accepts
  10776. an integer in the range 0-6. If set to @code{0}, the filter will have no
  10777. effect. A value of @code{6} means the higher quality. For each increment of
  10778. that value the speed drops by a factor of approximately 2. Default value is
  10779. @code{3}.
  10780. @item qp
  10781. Force a constant quantization parameter. If not set, the filter will use the QP
  10782. from the video stream (if available).
  10783. @item mode
  10784. Set thresholding mode. Available modes are:
  10785. @table @samp
  10786. @item hard
  10787. Set hard thresholding (default).
  10788. @item soft
  10789. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10790. @end table
  10791. @item use_bframe_qp
  10792. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  10793. option may cause flicker since the B-Frames have often larger QP. Default is
  10794. @code{0} (not enabled).
  10795. @end table
  10796. @anchor{subtitles}
  10797. @section subtitles
  10798. Draw subtitles on top of input video using the libass library.
  10799. To enable compilation of this filter you need to configure FFmpeg with
  10800. @code{--enable-libass}. This filter also requires a build with libavcodec and
  10801. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  10802. Alpha) subtitles format.
  10803. The filter accepts the following options:
  10804. @table @option
  10805. @item filename, f
  10806. Set the filename of the subtitle file to read. It must be specified.
  10807. @item original_size
  10808. Specify the size of the original video, the video for which the ASS file
  10809. was composed. For the syntax of this option, check the
  10810. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10811. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  10812. correctly scale the fonts if the aspect ratio has been changed.
  10813. @item fontsdir
  10814. Set a directory path containing fonts that can be used by the filter.
  10815. These fonts will be used in addition to whatever the font provider uses.
  10816. @item alpha
  10817. Process alpha channel, by default alpha channel is untouched.
  10818. @item charenc
  10819. Set subtitles input character encoding. @code{subtitles} filter only. Only
  10820. useful if not UTF-8.
  10821. @item stream_index, si
  10822. Set subtitles stream index. @code{subtitles} filter only.
  10823. @item force_style
  10824. Override default style or script info parameters of the subtitles. It accepts a
  10825. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  10826. @end table
  10827. If the first key is not specified, it is assumed that the first value
  10828. specifies the @option{filename}.
  10829. For example, to render the file @file{sub.srt} on top of the input
  10830. video, use the command:
  10831. @example
  10832. subtitles=sub.srt
  10833. @end example
  10834. which is equivalent to:
  10835. @example
  10836. subtitles=filename=sub.srt
  10837. @end example
  10838. To render the default subtitles stream from file @file{video.mkv}, use:
  10839. @example
  10840. subtitles=video.mkv
  10841. @end example
  10842. To render the second subtitles stream from that file, use:
  10843. @example
  10844. subtitles=video.mkv:si=1
  10845. @end example
  10846. To make the subtitles stream from @file{sub.srt} appear in transparent green
  10847. @code{DejaVu Serif}, use:
  10848. @example
  10849. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  10850. @end example
  10851. @section super2xsai
  10852. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  10853. Interpolate) pixel art scaling algorithm.
  10854. Useful for enlarging pixel art images without reducing sharpness.
  10855. @section swaprect
  10856. Swap two rectangular objects in video.
  10857. This filter accepts the following options:
  10858. @table @option
  10859. @item w
  10860. Set object width.
  10861. @item h
  10862. Set object height.
  10863. @item x1
  10864. Set 1st rect x coordinate.
  10865. @item y1
  10866. Set 1st rect y coordinate.
  10867. @item x2
  10868. Set 2nd rect x coordinate.
  10869. @item y2
  10870. Set 2nd rect y coordinate.
  10871. All expressions are evaluated once for each frame.
  10872. @end table
  10873. The all options are expressions containing the following constants:
  10874. @table @option
  10875. @item w
  10876. @item h
  10877. The input width and height.
  10878. @item a
  10879. same as @var{w} / @var{h}
  10880. @item sar
  10881. input sample aspect ratio
  10882. @item dar
  10883. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  10884. @item n
  10885. The number of the input frame, starting from 0.
  10886. @item t
  10887. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  10888. @item pos
  10889. the position in the file of the input frame, NAN if unknown
  10890. @end table
  10891. @section swapuv
  10892. Swap U & V plane.
  10893. @section telecine
  10894. Apply telecine process to the video.
  10895. This filter accepts the following options:
  10896. @table @option
  10897. @item first_field
  10898. @table @samp
  10899. @item top, t
  10900. top field first
  10901. @item bottom, b
  10902. bottom field first
  10903. The default value is @code{top}.
  10904. @end table
  10905. @item pattern
  10906. A string of numbers representing the pulldown pattern you wish to apply.
  10907. The default value is @code{23}.
  10908. @end table
  10909. @example
  10910. Some typical patterns:
  10911. NTSC output (30i):
  10912. 27.5p: 32222
  10913. 24p: 23 (classic)
  10914. 24p: 2332 (preferred)
  10915. 20p: 33
  10916. 18p: 334
  10917. 16p: 3444
  10918. PAL output (25i):
  10919. 27.5p: 12222
  10920. 24p: 222222222223 ("Euro pulldown")
  10921. 16.67p: 33
  10922. 16p: 33333334
  10923. @end example
  10924. @section threshold
  10925. Apply threshold effect to video stream.
  10926. This filter needs four video streams to perform thresholding.
  10927. First stream is stream we are filtering.
  10928. Second stream is holding threshold values, third stream is holding min values,
  10929. and last, fourth stream is holding max values.
  10930. The filter accepts the following option:
  10931. @table @option
  10932. @item planes
  10933. Set which planes will be processed, unprocessed planes will be copied.
  10934. By default value 0xf, all planes will be processed.
  10935. @end table
  10936. For example if first stream pixel's component value is less then threshold value
  10937. of pixel component from 2nd threshold stream, third stream value will picked,
  10938. otherwise fourth stream pixel component value will be picked.
  10939. Using color source filter one can perform various types of thresholding:
  10940. @subsection Examples
  10941. @itemize
  10942. @item
  10943. Binary threshold, using gray color as threshold:
  10944. @example
  10945. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  10946. @end example
  10947. @item
  10948. Inverted binary threshold, using gray color as threshold:
  10949. @example
  10950. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  10951. @end example
  10952. @item
  10953. Truncate binary threshold, using gray color as threshold:
  10954. @example
  10955. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  10956. @end example
  10957. @item
  10958. Threshold to zero, using gray color as threshold:
  10959. @example
  10960. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  10961. @end example
  10962. @item
  10963. Inverted threshold to zero, using gray color as threshold:
  10964. @example
  10965. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  10966. @end example
  10967. @end itemize
  10968. @section thumbnail
  10969. Select the most representative frame in a given sequence of consecutive frames.
  10970. The filter accepts the following options:
  10971. @table @option
  10972. @item n
  10973. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  10974. will pick one of them, and then handle the next batch of @var{n} frames until
  10975. the end. Default is @code{100}.
  10976. @end table
  10977. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  10978. value will result in a higher memory usage, so a high value is not recommended.
  10979. @subsection Examples
  10980. @itemize
  10981. @item
  10982. Extract one picture each 50 frames:
  10983. @example
  10984. thumbnail=50
  10985. @end example
  10986. @item
  10987. Complete example of a thumbnail creation with @command{ffmpeg}:
  10988. @example
  10989. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  10990. @end example
  10991. @end itemize
  10992. @section tile
  10993. Tile several successive frames together.
  10994. The filter accepts the following options:
  10995. @table @option
  10996. @item layout
  10997. Set the grid size (i.e. the number of lines and columns). For the syntax of
  10998. this option, check the
  10999. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11000. @item nb_frames
  11001. Set the maximum number of frames to render in the given area. It must be less
  11002. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  11003. the area will be used.
  11004. @item margin
  11005. Set the outer border margin in pixels.
  11006. @item padding
  11007. Set the inner border thickness (i.e. the number of pixels between frames). For
  11008. more advanced padding options (such as having different values for the edges),
  11009. refer to the pad video filter.
  11010. @item color
  11011. Specify the color of the unused area. For the syntax of this option, check the
  11012. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  11013. is "black".
  11014. @end table
  11015. @subsection Examples
  11016. @itemize
  11017. @item
  11018. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  11019. @example
  11020. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  11021. @end example
  11022. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  11023. duplicating each output frame to accommodate the originally detected frame
  11024. rate.
  11025. @item
  11026. Display @code{5} pictures in an area of @code{3x2} frames,
  11027. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  11028. mixed flat and named options:
  11029. @example
  11030. tile=3x2:nb_frames=5:padding=7:margin=2
  11031. @end example
  11032. @end itemize
  11033. @section tinterlace
  11034. Perform various types of temporal field interlacing.
  11035. Frames are counted starting from 1, so the first input frame is
  11036. considered odd.
  11037. The filter accepts the following options:
  11038. @table @option
  11039. @item mode
  11040. Specify the mode of the interlacing. This option can also be specified
  11041. as a value alone. See below for a list of values for this option.
  11042. Available values are:
  11043. @table @samp
  11044. @item merge, 0
  11045. Move odd frames into the upper field, even into the lower field,
  11046. generating a double height frame at half frame rate.
  11047. @example
  11048. ------> time
  11049. Input:
  11050. Frame 1 Frame 2 Frame 3 Frame 4
  11051. 11111 22222 33333 44444
  11052. 11111 22222 33333 44444
  11053. 11111 22222 33333 44444
  11054. 11111 22222 33333 44444
  11055. Output:
  11056. 11111 33333
  11057. 22222 44444
  11058. 11111 33333
  11059. 22222 44444
  11060. 11111 33333
  11061. 22222 44444
  11062. 11111 33333
  11063. 22222 44444
  11064. @end example
  11065. @item drop_even, 1
  11066. Only output odd frames, even frames are dropped, generating a frame with
  11067. unchanged height at half frame rate.
  11068. @example
  11069. ------> time
  11070. Input:
  11071. Frame 1 Frame 2 Frame 3 Frame 4
  11072. 11111 22222 33333 44444
  11073. 11111 22222 33333 44444
  11074. 11111 22222 33333 44444
  11075. 11111 22222 33333 44444
  11076. Output:
  11077. 11111 33333
  11078. 11111 33333
  11079. 11111 33333
  11080. 11111 33333
  11081. @end example
  11082. @item drop_odd, 2
  11083. Only output even frames, odd frames are dropped, generating a frame with
  11084. unchanged height at half frame rate.
  11085. @example
  11086. ------> time
  11087. Input:
  11088. Frame 1 Frame 2 Frame 3 Frame 4
  11089. 11111 22222 33333 44444
  11090. 11111 22222 33333 44444
  11091. 11111 22222 33333 44444
  11092. 11111 22222 33333 44444
  11093. Output:
  11094. 22222 44444
  11095. 22222 44444
  11096. 22222 44444
  11097. 22222 44444
  11098. @end example
  11099. @item pad, 3
  11100. Expand each frame to full height, but pad alternate lines with black,
  11101. generating a frame with double height at the same input frame rate.
  11102. @example
  11103. ------> time
  11104. Input:
  11105. Frame 1 Frame 2 Frame 3 Frame 4
  11106. 11111 22222 33333 44444
  11107. 11111 22222 33333 44444
  11108. 11111 22222 33333 44444
  11109. 11111 22222 33333 44444
  11110. Output:
  11111. 11111 ..... 33333 .....
  11112. ..... 22222 ..... 44444
  11113. 11111 ..... 33333 .....
  11114. ..... 22222 ..... 44444
  11115. 11111 ..... 33333 .....
  11116. ..... 22222 ..... 44444
  11117. 11111 ..... 33333 .....
  11118. ..... 22222 ..... 44444
  11119. @end example
  11120. @item interleave_top, 4
  11121. Interleave the upper field from odd frames with the lower field from
  11122. even frames, generating a frame with unchanged height at half frame rate.
  11123. @example
  11124. ------> time
  11125. Input:
  11126. Frame 1 Frame 2 Frame 3 Frame 4
  11127. 11111<- 22222 33333<- 44444
  11128. 11111 22222<- 33333 44444<-
  11129. 11111<- 22222 33333<- 44444
  11130. 11111 22222<- 33333 44444<-
  11131. Output:
  11132. 11111 33333
  11133. 22222 44444
  11134. 11111 33333
  11135. 22222 44444
  11136. @end example
  11137. @item interleave_bottom, 5
  11138. Interleave the lower field from odd frames with the upper field from
  11139. even frames, generating a frame with unchanged height at half frame rate.
  11140. @example
  11141. ------> time
  11142. Input:
  11143. Frame 1 Frame 2 Frame 3 Frame 4
  11144. 11111 22222<- 33333 44444<-
  11145. 11111<- 22222 33333<- 44444
  11146. 11111 22222<- 33333 44444<-
  11147. 11111<- 22222 33333<- 44444
  11148. Output:
  11149. 22222 44444
  11150. 11111 33333
  11151. 22222 44444
  11152. 11111 33333
  11153. @end example
  11154. @item interlacex2, 6
  11155. Double frame rate with unchanged height. Frames are inserted each
  11156. containing the second temporal field from the previous input frame and
  11157. the first temporal field from the next input frame. This mode relies on
  11158. the top_field_first flag. Useful for interlaced video displays with no
  11159. field synchronisation.
  11160. @example
  11161. ------> time
  11162. Input:
  11163. Frame 1 Frame 2 Frame 3 Frame 4
  11164. 11111 22222 33333 44444
  11165. 11111 22222 33333 44444
  11166. 11111 22222 33333 44444
  11167. 11111 22222 33333 44444
  11168. Output:
  11169. 11111 22222 22222 33333 33333 44444 44444
  11170. 11111 11111 22222 22222 33333 33333 44444
  11171. 11111 22222 22222 33333 33333 44444 44444
  11172. 11111 11111 22222 22222 33333 33333 44444
  11173. @end example
  11174. @item mergex2, 7
  11175. Move odd frames into the upper field, even into the lower field,
  11176. generating a double height frame at same frame rate.
  11177. @example
  11178. ------> time
  11179. Input:
  11180. Frame 1 Frame 2 Frame 3 Frame 4
  11181. 11111 22222 33333 44444
  11182. 11111 22222 33333 44444
  11183. 11111 22222 33333 44444
  11184. 11111 22222 33333 44444
  11185. Output:
  11186. 11111 33333 33333 55555
  11187. 22222 22222 44444 44444
  11188. 11111 33333 33333 55555
  11189. 22222 22222 44444 44444
  11190. 11111 33333 33333 55555
  11191. 22222 22222 44444 44444
  11192. 11111 33333 33333 55555
  11193. 22222 22222 44444 44444
  11194. @end example
  11195. @end table
  11196. Numeric values are deprecated but are accepted for backward
  11197. compatibility reasons.
  11198. Default mode is @code{merge}.
  11199. @item flags
  11200. Specify flags influencing the filter process.
  11201. Available value for @var{flags} is:
  11202. @table @option
  11203. @item low_pass_filter, vlfp
  11204. Enable linear vertical low-pass filtering in the filter.
  11205. Vertical low-pass filtering is required when creating an interlaced
  11206. destination from a progressive source which contains high-frequency
  11207. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  11208. patterning.
  11209. @item complex_filter, cvlfp
  11210. Enable complex vertical low-pass filtering.
  11211. This will slightly less reduce interlace 'twitter' and Moire
  11212. patterning but better retain detail and subjective sharpness impression.
  11213. @end table
  11214. Vertical low-pass filtering can only be enabled for @option{mode}
  11215. @var{interleave_top} and @var{interleave_bottom}.
  11216. @end table
  11217. @section tonemap
  11218. Tone map colors from different dynamic ranges.
  11219. This filter expects data in single precision floating point, as it needs to
  11220. operate on (and can output) out-of-range values. Another filter, such as
  11221. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  11222. The tonemapping algorithms implemented only work on linear light, so input
  11223. data should be linearized beforehand (and possibly correctly tagged).
  11224. @example
  11225. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  11226. @end example
  11227. @subsection Options
  11228. The filter accepts the following options.
  11229. @table @option
  11230. @item tonemap
  11231. Set the tone map algorithm to use.
  11232. Possible values are:
  11233. @table @var
  11234. @item none
  11235. Do not apply any tone map, only desaturate overbright pixels.
  11236. @item clip
  11237. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  11238. in-range values, while distorting out-of-range values.
  11239. @item linear
  11240. Stretch the entire reference gamut to a linear multiple of the display.
  11241. @item gamma
  11242. Fit a logarithmic transfer between the tone curves.
  11243. @item reinhard
  11244. Preserve overall image brightness with a simple curve, using nonlinear
  11245. contrast, which results in flattening details and degrading color accuracy.
  11246. @item hable
  11247. Preserve both dark and bright details better than @var{reinhard}, at the cost
  11248. of slightly darkening everything. Use it when detail preservation is more
  11249. important than color and brightness accuracy.
  11250. @item mobius
  11251. Smoothly map out-of-range values, while retaining contrast and colors for
  11252. in-range material as much as possible. Use it when color accuracy is more
  11253. important than detail preservation.
  11254. @end table
  11255. Default is none.
  11256. @item param
  11257. Tune the tone mapping algorithm.
  11258. This affects the following algorithms:
  11259. @table @var
  11260. @item none
  11261. Ignored.
  11262. @item linear
  11263. Specifies the scale factor to use while stretching.
  11264. Default to 1.0.
  11265. @item gamma
  11266. Specifies the exponent of the function.
  11267. Default to 1.8.
  11268. @item clip
  11269. Specify an extra linear coefficient to multiply into the signal before clipping.
  11270. Default to 1.0.
  11271. @item reinhard
  11272. Specify the local contrast coefficient at the display peak.
  11273. Default to 0.5, which means that in-gamut values will be about half as bright
  11274. as when clipping.
  11275. @item hable
  11276. Ignored.
  11277. @item mobius
  11278. Specify the transition point from linear to mobius transform. Every value
  11279. below this point is guaranteed to be mapped 1:1. The higher the value, the
  11280. more accurate the result will be, at the cost of losing bright details.
  11281. Default to 0.3, which due to the steep initial slope still preserves in-range
  11282. colors fairly accurately.
  11283. @end table
  11284. @item desat
  11285. Apply desaturation for highlights that exceed this level of brightness. The
  11286. higher the parameter, the more color information will be preserved. This
  11287. setting helps prevent unnaturally blown-out colors for super-highlights, by
  11288. (smoothly) turning into white instead. This makes images feel more natural,
  11289. at the cost of reducing information about out-of-range colors.
  11290. The default of 2.0 is somewhat conservative and will mostly just apply to
  11291. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  11292. This option works only if the input frame has a supported color tag.
  11293. @item peak
  11294. Override signal/nominal/reference peak with this value. Useful when the
  11295. embedded peak information in display metadata is not reliable or when tone
  11296. mapping from a lower range to a higher range.
  11297. @end table
  11298. @section transpose
  11299. Transpose rows with columns in the input video and optionally flip it.
  11300. It accepts the following parameters:
  11301. @table @option
  11302. @item dir
  11303. Specify the transposition direction.
  11304. Can assume the following values:
  11305. @table @samp
  11306. @item 0, 4, cclock_flip
  11307. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  11308. @example
  11309. L.R L.l
  11310. . . -> . .
  11311. l.r R.r
  11312. @end example
  11313. @item 1, 5, clock
  11314. Rotate by 90 degrees clockwise, that is:
  11315. @example
  11316. L.R l.L
  11317. . . -> . .
  11318. l.r r.R
  11319. @end example
  11320. @item 2, 6, cclock
  11321. Rotate by 90 degrees counterclockwise, that is:
  11322. @example
  11323. L.R R.r
  11324. . . -> . .
  11325. l.r L.l
  11326. @end example
  11327. @item 3, 7, clock_flip
  11328. Rotate by 90 degrees clockwise and vertically flip, that is:
  11329. @example
  11330. L.R r.R
  11331. . . -> . .
  11332. l.r l.L
  11333. @end example
  11334. @end table
  11335. For values between 4-7, the transposition is only done if the input
  11336. video geometry is portrait and not landscape. These values are
  11337. deprecated, the @code{passthrough} option should be used instead.
  11338. Numerical values are deprecated, and should be dropped in favor of
  11339. symbolic constants.
  11340. @item passthrough
  11341. Do not apply the transposition if the input geometry matches the one
  11342. specified by the specified value. It accepts the following values:
  11343. @table @samp
  11344. @item none
  11345. Always apply transposition.
  11346. @item portrait
  11347. Preserve portrait geometry (when @var{height} >= @var{width}).
  11348. @item landscape
  11349. Preserve landscape geometry (when @var{width} >= @var{height}).
  11350. @end table
  11351. Default value is @code{none}.
  11352. @end table
  11353. For example to rotate by 90 degrees clockwise and preserve portrait
  11354. layout:
  11355. @example
  11356. transpose=dir=1:passthrough=portrait
  11357. @end example
  11358. The command above can also be specified as:
  11359. @example
  11360. transpose=1:portrait
  11361. @end example
  11362. @section trim
  11363. Trim the input so that the output contains one continuous subpart of the input.
  11364. It accepts the following parameters:
  11365. @table @option
  11366. @item start
  11367. Specify the time of the start of the kept section, i.e. the frame with the
  11368. timestamp @var{start} will be the first frame in the output.
  11369. @item end
  11370. Specify the time of the first frame that will be dropped, i.e. the frame
  11371. immediately preceding the one with the timestamp @var{end} will be the last
  11372. frame in the output.
  11373. @item start_pts
  11374. This is the same as @var{start}, except this option sets the start timestamp
  11375. in timebase units instead of seconds.
  11376. @item end_pts
  11377. This is the same as @var{end}, except this option sets the end timestamp
  11378. in timebase units instead of seconds.
  11379. @item duration
  11380. The maximum duration of the output in seconds.
  11381. @item start_frame
  11382. The number of the first frame that should be passed to the output.
  11383. @item end_frame
  11384. The number of the first frame that should be dropped.
  11385. @end table
  11386. @option{start}, @option{end}, and @option{duration} are expressed as time
  11387. duration specifications; see
  11388. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11389. for the accepted syntax.
  11390. Note that the first two sets of the start/end options and the @option{duration}
  11391. option look at the frame timestamp, while the _frame variants simply count the
  11392. frames that pass through the filter. Also note that this filter does not modify
  11393. the timestamps. If you wish for the output timestamps to start at zero, insert a
  11394. setpts filter after the trim filter.
  11395. If multiple start or end options are set, this filter tries to be greedy and
  11396. keep all the frames that match at least one of the specified constraints. To keep
  11397. only the part that matches all the constraints at once, chain multiple trim
  11398. filters.
  11399. The defaults are such that all the input is kept. So it is possible to set e.g.
  11400. just the end values to keep everything before the specified time.
  11401. Examples:
  11402. @itemize
  11403. @item
  11404. Drop everything except the second minute of input:
  11405. @example
  11406. ffmpeg -i INPUT -vf trim=60:120
  11407. @end example
  11408. @item
  11409. Keep only the first second:
  11410. @example
  11411. ffmpeg -i INPUT -vf trim=duration=1
  11412. @end example
  11413. @end itemize
  11414. @section unpremultiply
  11415. Apply alpha unpremultiply effect to input video stream using first plane
  11416. of second stream as alpha.
  11417. Both streams must have same dimensions and same pixel format.
  11418. The filter accepts the following option:
  11419. @table @option
  11420. @item planes
  11421. Set which planes will be processed, unprocessed planes will be copied.
  11422. By default value 0xf, all planes will be processed.
  11423. If the format has 1 or 2 components, then luma is bit 0.
  11424. If the format has 3 or 4 components:
  11425. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  11426. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  11427. If present, the alpha channel is always the last bit.
  11428. @item inplace
  11429. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11430. @end table
  11431. @anchor{unsharp}
  11432. @section unsharp
  11433. Sharpen or blur the input video.
  11434. It accepts the following parameters:
  11435. @table @option
  11436. @item luma_msize_x, lx
  11437. Set the luma matrix horizontal size. It must be an odd integer between
  11438. 3 and 23. The default value is 5.
  11439. @item luma_msize_y, ly
  11440. Set the luma matrix vertical size. It must be an odd integer between 3
  11441. and 23. The default value is 5.
  11442. @item luma_amount, la
  11443. Set the luma effect strength. It must be a floating point number, reasonable
  11444. values lay between -1.5 and 1.5.
  11445. Negative values will blur the input video, while positive values will
  11446. sharpen it, a value of zero will disable the effect.
  11447. Default value is 1.0.
  11448. @item chroma_msize_x, cx
  11449. Set the chroma matrix horizontal size. It must be an odd integer
  11450. between 3 and 23. The default value is 5.
  11451. @item chroma_msize_y, cy
  11452. Set the chroma matrix vertical size. It must be an odd integer
  11453. between 3 and 23. The default value is 5.
  11454. @item chroma_amount, ca
  11455. Set the chroma effect strength. It must be a floating point number, reasonable
  11456. values lay between -1.5 and 1.5.
  11457. Negative values will blur the input video, while positive values will
  11458. sharpen it, a value of zero will disable the effect.
  11459. Default value is 0.0.
  11460. @item opencl
  11461. If set to 1, specify using OpenCL capabilities, only available if
  11462. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  11463. @end table
  11464. All parameters are optional and default to the equivalent of the
  11465. string '5:5:1.0:5:5:0.0'.
  11466. @subsection Examples
  11467. @itemize
  11468. @item
  11469. Apply strong luma sharpen effect:
  11470. @example
  11471. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  11472. @end example
  11473. @item
  11474. Apply a strong blur of both luma and chroma parameters:
  11475. @example
  11476. unsharp=7:7:-2:7:7:-2
  11477. @end example
  11478. @end itemize
  11479. @section uspp
  11480. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  11481. the image at several (or - in the case of @option{quality} level @code{8} - all)
  11482. shifts and average the results.
  11483. The way this differs from the behavior of spp is that uspp actually encodes &
  11484. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  11485. DCT similar to MJPEG.
  11486. The filter accepts the following options:
  11487. @table @option
  11488. @item quality
  11489. Set quality. This option defines the number of levels for averaging. It accepts
  11490. an integer in the range 0-8. If set to @code{0}, the filter will have no
  11491. effect. A value of @code{8} means the higher quality. For each increment of
  11492. that value the speed drops by a factor of approximately 2. Default value is
  11493. @code{3}.
  11494. @item qp
  11495. Force a constant quantization parameter. If not set, the filter will use the QP
  11496. from the video stream (if available).
  11497. @end table
  11498. @section vaguedenoiser
  11499. Apply a wavelet based denoiser.
  11500. It transforms each frame from the video input into the wavelet domain,
  11501. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  11502. the obtained coefficients. It does an inverse wavelet transform after.
  11503. Due to wavelet properties, it should give a nice smoothed result, and
  11504. reduced noise, without blurring picture features.
  11505. This filter accepts the following options:
  11506. @table @option
  11507. @item threshold
  11508. The filtering strength. The higher, the more filtered the video will be.
  11509. Hard thresholding can use a higher threshold than soft thresholding
  11510. before the video looks overfiltered. Default value is 2.
  11511. @item method
  11512. The filtering method the filter will use.
  11513. It accepts the following values:
  11514. @table @samp
  11515. @item hard
  11516. All values under the threshold will be zeroed.
  11517. @item soft
  11518. All values under the threshold will be zeroed. All values above will be
  11519. reduced by the threshold.
  11520. @item garrote
  11521. Scales or nullifies coefficients - intermediary between (more) soft and
  11522. (less) hard thresholding.
  11523. @end table
  11524. Default is garrote.
  11525. @item nsteps
  11526. Number of times, the wavelet will decompose the picture. Picture can't
  11527. be decomposed beyond a particular point (typically, 8 for a 640x480
  11528. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  11529. @item percent
  11530. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  11531. @item planes
  11532. A list of the planes to process. By default all planes are processed.
  11533. @end table
  11534. @section vectorscope
  11535. Display 2 color component values in the two dimensional graph (which is called
  11536. a vectorscope).
  11537. This filter accepts the following options:
  11538. @table @option
  11539. @item mode, m
  11540. Set vectorscope mode.
  11541. It accepts the following values:
  11542. @table @samp
  11543. @item gray
  11544. Gray values are displayed on graph, higher brightness means more pixels have
  11545. same component color value on location in graph. This is the default mode.
  11546. @item color
  11547. Gray values are displayed on graph. Surrounding pixels values which are not
  11548. present in video frame are drawn in gradient of 2 color components which are
  11549. set by option @code{x} and @code{y}. The 3rd color component is static.
  11550. @item color2
  11551. Actual color components values present in video frame are displayed on graph.
  11552. @item color3
  11553. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  11554. on graph increases value of another color component, which is luminance by
  11555. default values of @code{x} and @code{y}.
  11556. @item color4
  11557. Actual colors present in video frame are displayed on graph. If two different
  11558. colors map to same position on graph then color with higher value of component
  11559. not present in graph is picked.
  11560. @item color5
  11561. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  11562. component picked from radial gradient.
  11563. @end table
  11564. @item x
  11565. Set which color component will be represented on X-axis. Default is @code{1}.
  11566. @item y
  11567. Set which color component will be represented on Y-axis. Default is @code{2}.
  11568. @item intensity, i
  11569. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  11570. of color component which represents frequency of (X, Y) location in graph.
  11571. @item envelope, e
  11572. @table @samp
  11573. @item none
  11574. No envelope, this is default.
  11575. @item instant
  11576. Instant envelope, even darkest single pixel will be clearly highlighted.
  11577. @item peak
  11578. Hold maximum and minimum values presented in graph over time. This way you
  11579. can still spot out of range values without constantly looking at vectorscope.
  11580. @item peak+instant
  11581. Peak and instant envelope combined together.
  11582. @end table
  11583. @item graticule, g
  11584. Set what kind of graticule to draw.
  11585. @table @samp
  11586. @item none
  11587. @item green
  11588. @item color
  11589. @end table
  11590. @item opacity, o
  11591. Set graticule opacity.
  11592. @item flags, f
  11593. Set graticule flags.
  11594. @table @samp
  11595. @item white
  11596. Draw graticule for white point.
  11597. @item black
  11598. Draw graticule for black point.
  11599. @item name
  11600. Draw color points short names.
  11601. @end table
  11602. @item bgopacity, b
  11603. Set background opacity.
  11604. @item lthreshold, l
  11605. Set low threshold for color component not represented on X or Y axis.
  11606. Values lower than this value will be ignored. Default is 0.
  11607. Note this value is multiplied with actual max possible value one pixel component
  11608. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  11609. is 0.1 * 255 = 25.
  11610. @item hthreshold, h
  11611. Set high threshold for color component not represented on X or Y axis.
  11612. Values higher than this value will be ignored. Default is 1.
  11613. Note this value is multiplied with actual max possible value one pixel component
  11614. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  11615. is 0.9 * 255 = 230.
  11616. @item colorspace, c
  11617. Set what kind of colorspace to use when drawing graticule.
  11618. @table @samp
  11619. @item auto
  11620. @item 601
  11621. @item 709
  11622. @end table
  11623. Default is auto.
  11624. @end table
  11625. @anchor{vidstabdetect}
  11626. @section vidstabdetect
  11627. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  11628. @ref{vidstabtransform} for pass 2.
  11629. This filter generates a file with relative translation and rotation
  11630. transform information about subsequent frames, which is then used by
  11631. the @ref{vidstabtransform} filter.
  11632. To enable compilation of this filter you need to configure FFmpeg with
  11633. @code{--enable-libvidstab}.
  11634. This filter accepts the following options:
  11635. @table @option
  11636. @item result
  11637. Set the path to the file used to write the transforms information.
  11638. Default value is @file{transforms.trf}.
  11639. @item shakiness
  11640. Set how shaky the video is and how quick the camera is. It accepts an
  11641. integer in the range 1-10, a value of 1 means little shakiness, a
  11642. value of 10 means strong shakiness. Default value is 5.
  11643. @item accuracy
  11644. Set the accuracy of the detection process. It must be a value in the
  11645. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  11646. accuracy. Default value is 15.
  11647. @item stepsize
  11648. Set stepsize of the search process. The region around minimum is
  11649. scanned with 1 pixel resolution. Default value is 6.
  11650. @item mincontrast
  11651. Set minimum contrast. Below this value a local measurement field is
  11652. discarded. Must be a floating point value in the range 0-1. Default
  11653. value is 0.3.
  11654. @item tripod
  11655. Set reference frame number for tripod mode.
  11656. If enabled, the motion of the frames is compared to a reference frame
  11657. in the filtered stream, identified by the specified number. The idea
  11658. is to compensate all movements in a more-or-less static scene and keep
  11659. the camera view absolutely still.
  11660. If set to 0, it is disabled. The frames are counted starting from 1.
  11661. @item show
  11662. Show fields and transforms in the resulting frames. It accepts an
  11663. integer in the range 0-2. Default value is 0, which disables any
  11664. visualization.
  11665. @end table
  11666. @subsection Examples
  11667. @itemize
  11668. @item
  11669. Use default values:
  11670. @example
  11671. vidstabdetect
  11672. @end example
  11673. @item
  11674. Analyze strongly shaky movie and put the results in file
  11675. @file{mytransforms.trf}:
  11676. @example
  11677. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  11678. @end example
  11679. @item
  11680. Visualize the result of internal transformations in the resulting
  11681. video:
  11682. @example
  11683. vidstabdetect=show=1
  11684. @end example
  11685. @item
  11686. Analyze a video with medium shakiness using @command{ffmpeg}:
  11687. @example
  11688. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  11689. @end example
  11690. @end itemize
  11691. @anchor{vidstabtransform}
  11692. @section vidstabtransform
  11693. Video stabilization/deshaking: pass 2 of 2,
  11694. see @ref{vidstabdetect} for pass 1.
  11695. Read a file with transform information for each frame and
  11696. apply/compensate them. Together with the @ref{vidstabdetect}
  11697. filter this can be used to deshake videos. See also
  11698. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  11699. the @ref{unsharp} filter, see below.
  11700. To enable compilation of this filter you need to configure FFmpeg with
  11701. @code{--enable-libvidstab}.
  11702. @subsection Options
  11703. @table @option
  11704. @item input
  11705. Set path to the file used to read the transforms. Default value is
  11706. @file{transforms.trf}.
  11707. @item smoothing
  11708. Set the number of frames (value*2 + 1) used for lowpass filtering the
  11709. camera movements. Default value is 10.
  11710. For example a number of 10 means that 21 frames are used (10 in the
  11711. past and 10 in the future) to smoothen the motion in the video. A
  11712. larger value leads to a smoother video, but limits the acceleration of
  11713. the camera (pan/tilt movements). 0 is a special case where a static
  11714. camera is simulated.
  11715. @item optalgo
  11716. Set the camera path optimization algorithm.
  11717. Accepted values are:
  11718. @table @samp
  11719. @item gauss
  11720. gaussian kernel low-pass filter on camera motion (default)
  11721. @item avg
  11722. averaging on transformations
  11723. @end table
  11724. @item maxshift
  11725. Set maximal number of pixels to translate frames. Default value is -1,
  11726. meaning no limit.
  11727. @item maxangle
  11728. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  11729. value is -1, meaning no limit.
  11730. @item crop
  11731. Specify how to deal with borders that may be visible due to movement
  11732. compensation.
  11733. Available values are:
  11734. @table @samp
  11735. @item keep
  11736. keep image information from previous frame (default)
  11737. @item black
  11738. fill the border black
  11739. @end table
  11740. @item invert
  11741. Invert transforms if set to 1. Default value is 0.
  11742. @item relative
  11743. Consider transforms as relative to previous frame if set to 1,
  11744. absolute if set to 0. Default value is 0.
  11745. @item zoom
  11746. Set percentage to zoom. A positive value will result in a zoom-in
  11747. effect, a negative value in a zoom-out effect. Default value is 0 (no
  11748. zoom).
  11749. @item optzoom
  11750. Set optimal zooming to avoid borders.
  11751. Accepted values are:
  11752. @table @samp
  11753. @item 0
  11754. disabled
  11755. @item 1
  11756. optimal static zoom value is determined (only very strong movements
  11757. will lead to visible borders) (default)
  11758. @item 2
  11759. optimal adaptive zoom value is determined (no borders will be
  11760. visible), see @option{zoomspeed}
  11761. @end table
  11762. Note that the value given at zoom is added to the one calculated here.
  11763. @item zoomspeed
  11764. Set percent to zoom maximally each frame (enabled when
  11765. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  11766. 0.25.
  11767. @item interpol
  11768. Specify type of interpolation.
  11769. Available values are:
  11770. @table @samp
  11771. @item no
  11772. no interpolation
  11773. @item linear
  11774. linear only horizontal
  11775. @item bilinear
  11776. linear in both directions (default)
  11777. @item bicubic
  11778. cubic in both directions (slow)
  11779. @end table
  11780. @item tripod
  11781. Enable virtual tripod mode if set to 1, which is equivalent to
  11782. @code{relative=0:smoothing=0}. Default value is 0.
  11783. Use also @code{tripod} option of @ref{vidstabdetect}.
  11784. @item debug
  11785. Increase log verbosity if set to 1. Also the detected global motions
  11786. are written to the temporary file @file{global_motions.trf}. Default
  11787. value is 0.
  11788. @end table
  11789. @subsection Examples
  11790. @itemize
  11791. @item
  11792. Use @command{ffmpeg} for a typical stabilization with default values:
  11793. @example
  11794. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  11795. @end example
  11796. Note the use of the @ref{unsharp} filter which is always recommended.
  11797. @item
  11798. Zoom in a bit more and load transform data from a given file:
  11799. @example
  11800. vidstabtransform=zoom=5:input="mytransforms.trf"
  11801. @end example
  11802. @item
  11803. Smoothen the video even more:
  11804. @example
  11805. vidstabtransform=smoothing=30
  11806. @end example
  11807. @end itemize
  11808. @section vflip
  11809. Flip the input video vertically.
  11810. For example, to vertically flip a video with @command{ffmpeg}:
  11811. @example
  11812. ffmpeg -i in.avi -vf "vflip" out.avi
  11813. @end example
  11814. @anchor{vignette}
  11815. @section vignette
  11816. Make or reverse a natural vignetting effect.
  11817. The filter accepts the following options:
  11818. @table @option
  11819. @item angle, a
  11820. Set lens angle expression as a number of radians.
  11821. The value is clipped in the @code{[0,PI/2]} range.
  11822. Default value: @code{"PI/5"}
  11823. @item x0
  11824. @item y0
  11825. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  11826. by default.
  11827. @item mode
  11828. Set forward/backward mode.
  11829. Available modes are:
  11830. @table @samp
  11831. @item forward
  11832. The larger the distance from the central point, the darker the image becomes.
  11833. @item backward
  11834. The larger the distance from the central point, the brighter the image becomes.
  11835. This can be used to reverse a vignette effect, though there is no automatic
  11836. detection to extract the lens @option{angle} and other settings (yet). It can
  11837. also be used to create a burning effect.
  11838. @end table
  11839. Default value is @samp{forward}.
  11840. @item eval
  11841. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  11842. It accepts the following values:
  11843. @table @samp
  11844. @item init
  11845. Evaluate expressions only once during the filter initialization.
  11846. @item frame
  11847. Evaluate expressions for each incoming frame. This is way slower than the
  11848. @samp{init} mode since it requires all the scalers to be re-computed, but it
  11849. allows advanced dynamic expressions.
  11850. @end table
  11851. Default value is @samp{init}.
  11852. @item dither
  11853. Set dithering to reduce the circular banding effects. Default is @code{1}
  11854. (enabled).
  11855. @item aspect
  11856. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  11857. Setting this value to the SAR of the input will make a rectangular vignetting
  11858. following the dimensions of the video.
  11859. Default is @code{1/1}.
  11860. @end table
  11861. @subsection Expressions
  11862. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  11863. following parameters.
  11864. @table @option
  11865. @item w
  11866. @item h
  11867. input width and height
  11868. @item n
  11869. the number of input frame, starting from 0
  11870. @item pts
  11871. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  11872. @var{TB} units, NAN if undefined
  11873. @item r
  11874. frame rate of the input video, NAN if the input frame rate is unknown
  11875. @item t
  11876. the PTS (Presentation TimeStamp) of the filtered video frame,
  11877. expressed in seconds, NAN if undefined
  11878. @item tb
  11879. time base of the input video
  11880. @end table
  11881. @subsection Examples
  11882. @itemize
  11883. @item
  11884. Apply simple strong vignetting effect:
  11885. @example
  11886. vignette=PI/4
  11887. @end example
  11888. @item
  11889. Make a flickering vignetting:
  11890. @example
  11891. vignette='PI/4+random(1)*PI/50':eval=frame
  11892. @end example
  11893. @end itemize
  11894. @section vmafmotion
  11895. Obtain the average vmaf motion score of a video.
  11896. It is one of the component filters of VMAF.
  11897. The obtained average motion score is printed through the logging system.
  11898. In the below example the input file @file{ref.mpg} is being processed and score
  11899. is computed.
  11900. @example
  11901. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  11902. @end example
  11903. @section vstack
  11904. Stack input videos vertically.
  11905. All streams must be of same pixel format and of same width.
  11906. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  11907. to create same output.
  11908. The filter accept the following option:
  11909. @table @option
  11910. @item inputs
  11911. Set number of input streams. Default is 2.
  11912. @item shortest
  11913. If set to 1, force the output to terminate when the shortest input
  11914. terminates. Default value is 0.
  11915. @end table
  11916. @section w3fdif
  11917. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  11918. Deinterlacing Filter").
  11919. Based on the process described by Martin Weston for BBC R&D, and
  11920. implemented based on the de-interlace algorithm written by Jim
  11921. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  11922. uses filter coefficients calculated by BBC R&D.
  11923. There are two sets of filter coefficients, so called "simple":
  11924. and "complex". Which set of filter coefficients is used can
  11925. be set by passing an optional parameter:
  11926. @table @option
  11927. @item filter
  11928. Set the interlacing filter coefficients. Accepts one of the following values:
  11929. @table @samp
  11930. @item simple
  11931. Simple filter coefficient set.
  11932. @item complex
  11933. More-complex filter coefficient set.
  11934. @end table
  11935. Default value is @samp{complex}.
  11936. @item deint
  11937. Specify which frames to deinterlace. Accept one of the following values:
  11938. @table @samp
  11939. @item all
  11940. Deinterlace all frames,
  11941. @item interlaced
  11942. Only deinterlace frames marked as interlaced.
  11943. @end table
  11944. Default value is @samp{all}.
  11945. @end table
  11946. @section waveform
  11947. Video waveform monitor.
  11948. The waveform monitor plots color component intensity. By default luminance
  11949. only. Each column of the waveform corresponds to a column of pixels in the
  11950. source video.
  11951. It accepts the following options:
  11952. @table @option
  11953. @item mode, m
  11954. Can be either @code{row}, or @code{column}. Default is @code{column}.
  11955. In row mode, the graph on the left side represents color component value 0 and
  11956. the right side represents value = 255. In column mode, the top side represents
  11957. color component value = 0 and bottom side represents value = 255.
  11958. @item intensity, i
  11959. Set intensity. Smaller values are useful to find out how many values of the same
  11960. luminance are distributed across input rows/columns.
  11961. Default value is @code{0.04}. Allowed range is [0, 1].
  11962. @item mirror, r
  11963. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  11964. In mirrored mode, higher values will be represented on the left
  11965. side for @code{row} mode and at the top for @code{column} mode. Default is
  11966. @code{1} (mirrored).
  11967. @item display, d
  11968. Set display mode.
  11969. It accepts the following values:
  11970. @table @samp
  11971. @item overlay
  11972. Presents information identical to that in the @code{parade}, except
  11973. that the graphs representing color components are superimposed directly
  11974. over one another.
  11975. This display mode makes it easier to spot relative differences or similarities
  11976. in overlapping areas of the color components that are supposed to be identical,
  11977. such as neutral whites, grays, or blacks.
  11978. @item stack
  11979. Display separate graph for the color components side by side in
  11980. @code{row} mode or one below the other in @code{column} mode.
  11981. @item parade
  11982. Display separate graph for the color components side by side in
  11983. @code{column} mode or one below the other in @code{row} mode.
  11984. Using this display mode makes it easy to spot color casts in the highlights
  11985. and shadows of an image, by comparing the contours of the top and the bottom
  11986. graphs of each waveform. Since whites, grays, and blacks are characterized
  11987. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  11988. should display three waveforms of roughly equal width/height. If not, the
  11989. correction is easy to perform by making level adjustments the three waveforms.
  11990. @end table
  11991. Default is @code{stack}.
  11992. @item components, c
  11993. Set which color components to display. Default is 1, which means only luminance
  11994. or red color component if input is in RGB colorspace. If is set for example to
  11995. 7 it will display all 3 (if) available color components.
  11996. @item envelope, e
  11997. @table @samp
  11998. @item none
  11999. No envelope, this is default.
  12000. @item instant
  12001. Instant envelope, minimum and maximum values presented in graph will be easily
  12002. visible even with small @code{step} value.
  12003. @item peak
  12004. Hold minimum and maximum values presented in graph across time. This way you
  12005. can still spot out of range values without constantly looking at waveforms.
  12006. @item peak+instant
  12007. Peak and instant envelope combined together.
  12008. @end table
  12009. @item filter, f
  12010. @table @samp
  12011. @item lowpass
  12012. No filtering, this is default.
  12013. @item flat
  12014. Luma and chroma combined together.
  12015. @item aflat
  12016. Similar as above, but shows difference between blue and red chroma.
  12017. @item chroma
  12018. Displays only chroma.
  12019. @item color
  12020. Displays actual color value on waveform.
  12021. @item acolor
  12022. Similar as above, but with luma showing frequency of chroma values.
  12023. @end table
  12024. @item graticule, g
  12025. Set which graticule to display.
  12026. @table @samp
  12027. @item none
  12028. Do not display graticule.
  12029. @item green
  12030. Display green graticule showing legal broadcast ranges.
  12031. @end table
  12032. @item opacity, o
  12033. Set graticule opacity.
  12034. @item flags, fl
  12035. Set graticule flags.
  12036. @table @samp
  12037. @item numbers
  12038. Draw numbers above lines. By default enabled.
  12039. @item dots
  12040. Draw dots instead of lines.
  12041. @end table
  12042. @item scale, s
  12043. Set scale used for displaying graticule.
  12044. @table @samp
  12045. @item digital
  12046. @item millivolts
  12047. @item ire
  12048. @end table
  12049. Default is digital.
  12050. @item bgopacity, b
  12051. Set background opacity.
  12052. @end table
  12053. @section weave, doubleweave
  12054. The @code{weave} takes a field-based video input and join
  12055. each two sequential fields into single frame, producing a new double
  12056. height clip with half the frame rate and half the frame count.
  12057. The @code{doubleweave} works same as @code{weave} but without
  12058. halving frame rate and frame count.
  12059. It accepts the following option:
  12060. @table @option
  12061. @item first_field
  12062. Set first field. Available values are:
  12063. @table @samp
  12064. @item top, t
  12065. Set the frame as top-field-first.
  12066. @item bottom, b
  12067. Set the frame as bottom-field-first.
  12068. @end table
  12069. @end table
  12070. @subsection Examples
  12071. @itemize
  12072. @item
  12073. Interlace video using @ref{select} and @ref{separatefields} filter:
  12074. @example
  12075. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  12076. @end example
  12077. @end itemize
  12078. @section xbr
  12079. Apply the xBR high-quality magnification filter which is designed for pixel
  12080. art. It follows a set of edge-detection rules, see
  12081. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  12082. It accepts the following option:
  12083. @table @option
  12084. @item n
  12085. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  12086. @code{3xBR} and @code{4} for @code{4xBR}.
  12087. Default is @code{3}.
  12088. @end table
  12089. @anchor{yadif}
  12090. @section yadif
  12091. Deinterlace the input video ("yadif" means "yet another deinterlacing
  12092. filter").
  12093. It accepts the following parameters:
  12094. @table @option
  12095. @item mode
  12096. The interlacing mode to adopt. It accepts one of the following values:
  12097. @table @option
  12098. @item 0, send_frame
  12099. Output one frame for each frame.
  12100. @item 1, send_field
  12101. Output one frame for each field.
  12102. @item 2, send_frame_nospatial
  12103. Like @code{send_frame}, but it skips the spatial interlacing check.
  12104. @item 3, send_field_nospatial
  12105. Like @code{send_field}, but it skips the spatial interlacing check.
  12106. @end table
  12107. The default value is @code{send_frame}.
  12108. @item parity
  12109. The picture field parity assumed for the input interlaced video. It accepts one
  12110. of the following values:
  12111. @table @option
  12112. @item 0, tff
  12113. Assume the top field is first.
  12114. @item 1, bff
  12115. Assume the bottom field is first.
  12116. @item -1, auto
  12117. Enable automatic detection of field parity.
  12118. @end table
  12119. The default value is @code{auto}.
  12120. If the interlacing is unknown or the decoder does not export this information,
  12121. top field first will be assumed.
  12122. @item deint
  12123. Specify which frames to deinterlace. Accept one of the following
  12124. values:
  12125. @table @option
  12126. @item 0, all
  12127. Deinterlace all frames.
  12128. @item 1, interlaced
  12129. Only deinterlace frames marked as interlaced.
  12130. @end table
  12131. The default value is @code{all}.
  12132. @end table
  12133. @section zoompan
  12134. Apply Zoom & Pan effect.
  12135. This filter accepts the following options:
  12136. @table @option
  12137. @item zoom, z
  12138. Set the zoom expression. Default is 1.
  12139. @item x
  12140. @item y
  12141. Set the x and y expression. Default is 0.
  12142. @item d
  12143. Set the duration expression in number of frames.
  12144. This sets for how many number of frames effect will last for
  12145. single input image.
  12146. @item s
  12147. Set the output image size, default is 'hd720'.
  12148. @item fps
  12149. Set the output frame rate, default is '25'.
  12150. @end table
  12151. Each expression can contain the following constants:
  12152. @table @option
  12153. @item in_w, iw
  12154. Input width.
  12155. @item in_h, ih
  12156. Input height.
  12157. @item out_w, ow
  12158. Output width.
  12159. @item out_h, oh
  12160. Output height.
  12161. @item in
  12162. Input frame count.
  12163. @item on
  12164. Output frame count.
  12165. @item x
  12166. @item y
  12167. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  12168. for current input frame.
  12169. @item px
  12170. @item py
  12171. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  12172. not yet such frame (first input frame).
  12173. @item zoom
  12174. Last calculated zoom from 'z' expression for current input frame.
  12175. @item pzoom
  12176. Last calculated zoom of last output frame of previous input frame.
  12177. @item duration
  12178. Number of output frames for current input frame. Calculated from 'd' expression
  12179. for each input frame.
  12180. @item pduration
  12181. number of output frames created for previous input frame
  12182. @item a
  12183. Rational number: input width / input height
  12184. @item sar
  12185. sample aspect ratio
  12186. @item dar
  12187. display aspect ratio
  12188. @end table
  12189. @subsection Examples
  12190. @itemize
  12191. @item
  12192. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  12193. @example
  12194. 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
  12195. @end example
  12196. @item
  12197. Zoom-in up to 1.5 and pan always at center of picture:
  12198. @example
  12199. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12200. @end example
  12201. @item
  12202. Same as above but without pausing:
  12203. @example
  12204. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12205. @end example
  12206. @end itemize
  12207. @anchor{zscale}
  12208. @section zscale
  12209. Scale (resize) the input video, using the z.lib library:
  12210. https://github.com/sekrit-twc/zimg.
  12211. The zscale filter forces the output display aspect ratio to be the same
  12212. as the input, by changing the output sample aspect ratio.
  12213. If the input image format is different from the format requested by
  12214. the next filter, the zscale filter will convert the input to the
  12215. requested format.
  12216. @subsection Options
  12217. The filter accepts the following options.
  12218. @table @option
  12219. @item width, w
  12220. @item height, h
  12221. Set the output video dimension expression. Default value is the input
  12222. dimension.
  12223. If the @var{width} or @var{w} value is 0, the input width is used for
  12224. the output. If the @var{height} or @var{h} value is 0, the input height
  12225. is used for the output.
  12226. If one and only one of the values is -n with n >= 1, the zscale filter
  12227. will use a value that maintains the aspect ratio of the input image,
  12228. calculated from the other specified dimension. After that it will,
  12229. however, make sure that the calculated dimension is divisible by n and
  12230. adjust the value if necessary.
  12231. If both values are -n with n >= 1, the behavior will be identical to
  12232. both values being set to 0 as previously detailed.
  12233. See below for the list of accepted constants for use in the dimension
  12234. expression.
  12235. @item size, s
  12236. Set the video size. For the syntax of this option, check the
  12237. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12238. @item dither, d
  12239. Set the dither type.
  12240. Possible values are:
  12241. @table @var
  12242. @item none
  12243. @item ordered
  12244. @item random
  12245. @item error_diffusion
  12246. @end table
  12247. Default is none.
  12248. @item filter, f
  12249. Set the resize filter type.
  12250. Possible values are:
  12251. @table @var
  12252. @item point
  12253. @item bilinear
  12254. @item bicubic
  12255. @item spline16
  12256. @item spline36
  12257. @item lanczos
  12258. @end table
  12259. Default is bilinear.
  12260. @item range, r
  12261. Set the color range.
  12262. Possible values are:
  12263. @table @var
  12264. @item input
  12265. @item limited
  12266. @item full
  12267. @end table
  12268. Default is same as input.
  12269. @item primaries, p
  12270. Set the color primaries.
  12271. Possible values are:
  12272. @table @var
  12273. @item input
  12274. @item 709
  12275. @item unspecified
  12276. @item 170m
  12277. @item 240m
  12278. @item 2020
  12279. @end table
  12280. Default is same as input.
  12281. @item transfer, t
  12282. Set the transfer characteristics.
  12283. Possible values are:
  12284. @table @var
  12285. @item input
  12286. @item 709
  12287. @item unspecified
  12288. @item 601
  12289. @item linear
  12290. @item 2020_10
  12291. @item 2020_12
  12292. @item smpte2084
  12293. @item iec61966-2-1
  12294. @item arib-std-b67
  12295. @end table
  12296. Default is same as input.
  12297. @item matrix, m
  12298. Set the colorspace matrix.
  12299. Possible value are:
  12300. @table @var
  12301. @item input
  12302. @item 709
  12303. @item unspecified
  12304. @item 470bg
  12305. @item 170m
  12306. @item 2020_ncl
  12307. @item 2020_cl
  12308. @end table
  12309. Default is same as input.
  12310. @item rangein, rin
  12311. Set the input color range.
  12312. Possible values are:
  12313. @table @var
  12314. @item input
  12315. @item limited
  12316. @item full
  12317. @end table
  12318. Default is same as input.
  12319. @item primariesin, pin
  12320. Set the input color primaries.
  12321. Possible values are:
  12322. @table @var
  12323. @item input
  12324. @item 709
  12325. @item unspecified
  12326. @item 170m
  12327. @item 240m
  12328. @item 2020
  12329. @end table
  12330. Default is same as input.
  12331. @item transferin, tin
  12332. Set the input transfer characteristics.
  12333. Possible values are:
  12334. @table @var
  12335. @item input
  12336. @item 709
  12337. @item unspecified
  12338. @item 601
  12339. @item linear
  12340. @item 2020_10
  12341. @item 2020_12
  12342. @end table
  12343. Default is same as input.
  12344. @item matrixin, min
  12345. Set the input colorspace matrix.
  12346. Possible value are:
  12347. @table @var
  12348. @item input
  12349. @item 709
  12350. @item unspecified
  12351. @item 470bg
  12352. @item 170m
  12353. @item 2020_ncl
  12354. @item 2020_cl
  12355. @end table
  12356. @item chromal, c
  12357. Set the output chroma location.
  12358. Possible values are:
  12359. @table @var
  12360. @item input
  12361. @item left
  12362. @item center
  12363. @item topleft
  12364. @item top
  12365. @item bottomleft
  12366. @item bottom
  12367. @end table
  12368. @item chromalin, cin
  12369. Set the input chroma location.
  12370. Possible values are:
  12371. @table @var
  12372. @item input
  12373. @item left
  12374. @item center
  12375. @item topleft
  12376. @item top
  12377. @item bottomleft
  12378. @item bottom
  12379. @end table
  12380. @item npl
  12381. Set the nominal peak luminance.
  12382. @end table
  12383. The values of the @option{w} and @option{h} options are expressions
  12384. containing the following constants:
  12385. @table @var
  12386. @item in_w
  12387. @item in_h
  12388. The input width and height
  12389. @item iw
  12390. @item ih
  12391. These are the same as @var{in_w} and @var{in_h}.
  12392. @item out_w
  12393. @item out_h
  12394. The output (scaled) width and height
  12395. @item ow
  12396. @item oh
  12397. These are the same as @var{out_w} and @var{out_h}
  12398. @item a
  12399. The same as @var{iw} / @var{ih}
  12400. @item sar
  12401. input sample aspect ratio
  12402. @item dar
  12403. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12404. @item hsub
  12405. @item vsub
  12406. horizontal and vertical input chroma subsample values. For example for the
  12407. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12408. @item ohsub
  12409. @item ovsub
  12410. horizontal and vertical output chroma subsample values. For example for the
  12411. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12412. @end table
  12413. @table @option
  12414. @end table
  12415. @c man end VIDEO FILTERS
  12416. @chapter Video Sources
  12417. @c man begin VIDEO SOURCES
  12418. Below is a description of the currently available video sources.
  12419. @section buffer
  12420. Buffer video frames, and make them available to the filter chain.
  12421. This source is mainly intended for a programmatic use, in particular
  12422. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  12423. It accepts the following parameters:
  12424. @table @option
  12425. @item video_size
  12426. Specify the size (width and height) of the buffered video frames. For the
  12427. syntax of this option, check the
  12428. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12429. @item width
  12430. The input video width.
  12431. @item height
  12432. The input video height.
  12433. @item pix_fmt
  12434. A string representing the pixel format of the buffered video frames.
  12435. It may be a number corresponding to a pixel format, or a pixel format
  12436. name.
  12437. @item time_base
  12438. Specify the timebase assumed by the timestamps of the buffered frames.
  12439. @item frame_rate
  12440. Specify the frame rate expected for the video stream.
  12441. @item pixel_aspect, sar
  12442. The sample (pixel) aspect ratio of the input video.
  12443. @item sws_param
  12444. Specify the optional parameters to be used for the scale filter which
  12445. is automatically inserted when an input change is detected in the
  12446. input size or format.
  12447. @item hw_frames_ctx
  12448. When using a hardware pixel format, this should be a reference to an
  12449. AVHWFramesContext describing input frames.
  12450. @end table
  12451. For example:
  12452. @example
  12453. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  12454. @end example
  12455. will instruct the source to accept video frames with size 320x240 and
  12456. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  12457. square pixels (1:1 sample aspect ratio).
  12458. Since the pixel format with name "yuv410p" corresponds to the number 6
  12459. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  12460. this example corresponds to:
  12461. @example
  12462. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  12463. @end example
  12464. Alternatively, the options can be specified as a flat string, but this
  12465. syntax is deprecated:
  12466. @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}]
  12467. @section cellauto
  12468. Create a pattern generated by an elementary cellular automaton.
  12469. The initial state of the cellular automaton can be defined through the
  12470. @option{filename} and @option{pattern} options. If such options are
  12471. not specified an initial state is created randomly.
  12472. At each new frame a new row in the video is filled with the result of
  12473. the cellular automaton next generation. The behavior when the whole
  12474. frame is filled is defined by the @option{scroll} option.
  12475. This source accepts the following options:
  12476. @table @option
  12477. @item filename, f
  12478. Read the initial cellular automaton state, i.e. the starting row, from
  12479. the specified file.
  12480. In the file, each non-whitespace character is considered an alive
  12481. cell, a newline will terminate the row, and further characters in the
  12482. file will be ignored.
  12483. @item pattern, p
  12484. Read the initial cellular automaton state, i.e. the starting row, from
  12485. the specified string.
  12486. Each non-whitespace character in the string is considered an alive
  12487. cell, a newline will terminate the row, and further characters in the
  12488. string will be ignored.
  12489. @item rate, r
  12490. Set the video rate, that is the number of frames generated per second.
  12491. Default is 25.
  12492. @item random_fill_ratio, ratio
  12493. Set the random fill ratio for the initial cellular automaton row. It
  12494. is a floating point number value ranging from 0 to 1, defaults to
  12495. 1/PHI.
  12496. This option is ignored when a file or a pattern is specified.
  12497. @item random_seed, seed
  12498. Set the seed for filling randomly the initial row, must be an integer
  12499. included between 0 and UINT32_MAX. If not specified, or if explicitly
  12500. set to -1, the filter will try to use a good random seed on a best
  12501. effort basis.
  12502. @item rule
  12503. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  12504. Default value is 110.
  12505. @item size, s
  12506. Set the size of the output video. For the syntax of this option, check the
  12507. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12508. If @option{filename} or @option{pattern} is specified, the size is set
  12509. by default to the width of the specified initial state row, and the
  12510. height is set to @var{width} * PHI.
  12511. If @option{size} is set, it must contain the width of the specified
  12512. pattern string, and the specified pattern will be centered in the
  12513. larger row.
  12514. If a filename or a pattern string is not specified, the size value
  12515. defaults to "320x518" (used for a randomly generated initial state).
  12516. @item scroll
  12517. If set to 1, scroll the output upward when all the rows in the output
  12518. have been already filled. If set to 0, the new generated row will be
  12519. written over the top row just after the bottom row is filled.
  12520. Defaults to 1.
  12521. @item start_full, full
  12522. If set to 1, completely fill the output with generated rows before
  12523. outputting the first frame.
  12524. This is the default behavior, for disabling set the value to 0.
  12525. @item stitch
  12526. If set to 1, stitch the left and right row edges together.
  12527. This is the default behavior, for disabling set the value to 0.
  12528. @end table
  12529. @subsection Examples
  12530. @itemize
  12531. @item
  12532. Read the initial state from @file{pattern}, and specify an output of
  12533. size 200x400.
  12534. @example
  12535. cellauto=f=pattern:s=200x400
  12536. @end example
  12537. @item
  12538. Generate a random initial row with a width of 200 cells, with a fill
  12539. ratio of 2/3:
  12540. @example
  12541. cellauto=ratio=2/3:s=200x200
  12542. @end example
  12543. @item
  12544. Create a pattern generated by rule 18 starting by a single alive cell
  12545. centered on an initial row with width 100:
  12546. @example
  12547. cellauto=p=@@:s=100x400:full=0:rule=18
  12548. @end example
  12549. @item
  12550. Specify a more elaborated initial pattern:
  12551. @example
  12552. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  12553. @end example
  12554. @end itemize
  12555. @anchor{coreimagesrc}
  12556. @section coreimagesrc
  12557. Video source generated on GPU using Apple's CoreImage API on OSX.
  12558. This video source is a specialized version of the @ref{coreimage} video filter.
  12559. Use a core image generator at the beginning of the applied filterchain to
  12560. generate the content.
  12561. The coreimagesrc video source accepts the following options:
  12562. @table @option
  12563. @item list_generators
  12564. List all available generators along with all their respective options as well as
  12565. possible minimum and maximum values along with the default values.
  12566. @example
  12567. list_generators=true
  12568. @end example
  12569. @item size, s
  12570. Specify the size of the sourced video. For the syntax of this option, check the
  12571. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12572. The default value is @code{320x240}.
  12573. @item rate, r
  12574. Specify the frame rate of the sourced video, as the number of frames
  12575. generated per second. It has to be a string in the format
  12576. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12577. number or a valid video frame rate abbreviation. The default value is
  12578. "25".
  12579. @item sar
  12580. Set the sample aspect ratio of the sourced video.
  12581. @item duration, d
  12582. Set the duration of the sourced video. See
  12583. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12584. for the accepted syntax.
  12585. If not specified, or the expressed duration is negative, the video is
  12586. supposed to be generated forever.
  12587. @end table
  12588. Additionally, all options of the @ref{coreimage} video filter are accepted.
  12589. A complete filterchain can be used for further processing of the
  12590. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  12591. and examples for details.
  12592. @subsection Examples
  12593. @itemize
  12594. @item
  12595. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  12596. given as complete and escaped command-line for Apple's standard bash shell:
  12597. @example
  12598. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  12599. @end example
  12600. This example is equivalent to the QRCode example of @ref{coreimage} without the
  12601. need for a nullsrc video source.
  12602. @end itemize
  12603. @section mandelbrot
  12604. Generate a Mandelbrot set fractal, and progressively zoom towards the
  12605. point specified with @var{start_x} and @var{start_y}.
  12606. This source accepts the following options:
  12607. @table @option
  12608. @item end_pts
  12609. Set the terminal pts value. Default value is 400.
  12610. @item end_scale
  12611. Set the terminal scale value.
  12612. Must be a floating point value. Default value is 0.3.
  12613. @item inner
  12614. Set the inner coloring mode, that is the algorithm used to draw the
  12615. Mandelbrot fractal internal region.
  12616. It shall assume one of the following values:
  12617. @table @option
  12618. @item black
  12619. Set black mode.
  12620. @item convergence
  12621. Show time until convergence.
  12622. @item mincol
  12623. Set color based on point closest to the origin of the iterations.
  12624. @item period
  12625. Set period mode.
  12626. @end table
  12627. Default value is @var{mincol}.
  12628. @item bailout
  12629. Set the bailout value. Default value is 10.0.
  12630. @item maxiter
  12631. Set the maximum of iterations performed by the rendering
  12632. algorithm. Default value is 7189.
  12633. @item outer
  12634. Set outer coloring mode.
  12635. It shall assume one of following values:
  12636. @table @option
  12637. @item iteration_count
  12638. Set iteration cound mode.
  12639. @item normalized_iteration_count
  12640. set normalized iteration count mode.
  12641. @end table
  12642. Default value is @var{normalized_iteration_count}.
  12643. @item rate, r
  12644. Set frame rate, expressed as number of frames per second. Default
  12645. value is "25".
  12646. @item size, s
  12647. Set frame size. For the syntax of this option, check the "Video
  12648. size" section in the ffmpeg-utils manual. Default value is "640x480".
  12649. @item start_scale
  12650. Set the initial scale value. Default value is 3.0.
  12651. @item start_x
  12652. Set the initial x position. Must be a floating point value between
  12653. -100 and 100. Default value is -0.743643887037158704752191506114774.
  12654. @item start_y
  12655. Set the initial y position. Must be a floating point value between
  12656. -100 and 100. Default value is -0.131825904205311970493132056385139.
  12657. @end table
  12658. @section mptestsrc
  12659. Generate various test patterns, as generated by the MPlayer test filter.
  12660. The size of the generated video is fixed, and is 256x256.
  12661. This source is useful in particular for testing encoding features.
  12662. This source accepts the following options:
  12663. @table @option
  12664. @item rate, r
  12665. Specify the frame rate of the sourced video, as the number of frames
  12666. generated per second. It has to be a string in the format
  12667. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12668. number or a valid video frame rate abbreviation. The default value is
  12669. "25".
  12670. @item duration, d
  12671. Set the duration of the sourced video. See
  12672. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12673. for the accepted syntax.
  12674. If not specified, or the expressed duration is negative, the video is
  12675. supposed to be generated forever.
  12676. @item test, t
  12677. Set the number or the name of the test to perform. Supported tests are:
  12678. @table @option
  12679. @item dc_luma
  12680. @item dc_chroma
  12681. @item freq_luma
  12682. @item freq_chroma
  12683. @item amp_luma
  12684. @item amp_chroma
  12685. @item cbp
  12686. @item mv
  12687. @item ring1
  12688. @item ring2
  12689. @item all
  12690. @end table
  12691. Default value is "all", which will cycle through the list of all tests.
  12692. @end table
  12693. Some examples:
  12694. @example
  12695. mptestsrc=t=dc_luma
  12696. @end example
  12697. will generate a "dc_luma" test pattern.
  12698. @section frei0r_src
  12699. Provide a frei0r source.
  12700. To enable compilation of this filter you need to install the frei0r
  12701. header and configure FFmpeg with @code{--enable-frei0r}.
  12702. This source accepts the following parameters:
  12703. @table @option
  12704. @item size
  12705. The size of the video to generate. For the syntax of this option, check the
  12706. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12707. @item framerate
  12708. The framerate of the generated video. It may be a string of the form
  12709. @var{num}/@var{den} or a frame rate abbreviation.
  12710. @item filter_name
  12711. The name to the frei0r source to load. For more information regarding frei0r and
  12712. how to set the parameters, read the @ref{frei0r} section in the video filters
  12713. documentation.
  12714. @item filter_params
  12715. A '|'-separated list of parameters to pass to the frei0r source.
  12716. @end table
  12717. For example, to generate a frei0r partik0l source with size 200x200
  12718. and frame rate 10 which is overlaid on the overlay filter main input:
  12719. @example
  12720. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  12721. @end example
  12722. @section life
  12723. Generate a life pattern.
  12724. This source is based on a generalization of John Conway's life game.
  12725. The sourced input represents a life grid, each pixel represents a cell
  12726. which can be in one of two possible states, alive or dead. Every cell
  12727. interacts with its eight neighbours, which are the cells that are
  12728. horizontally, vertically, or diagonally adjacent.
  12729. At each interaction the grid evolves according to the adopted rule,
  12730. which specifies the number of neighbor alive cells which will make a
  12731. cell stay alive or born. The @option{rule} option allows one to specify
  12732. the rule to adopt.
  12733. This source accepts the following options:
  12734. @table @option
  12735. @item filename, f
  12736. Set the file from which to read the initial grid state. In the file,
  12737. each non-whitespace character is considered an alive cell, and newline
  12738. is used to delimit the end of each row.
  12739. If this option is not specified, the initial grid is generated
  12740. randomly.
  12741. @item rate, r
  12742. Set the video rate, that is the number of frames generated per second.
  12743. Default is 25.
  12744. @item random_fill_ratio, ratio
  12745. Set the random fill ratio for the initial random grid. It is a
  12746. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  12747. It is ignored when a file is specified.
  12748. @item random_seed, seed
  12749. Set the seed for filling the initial random grid, must be an integer
  12750. included between 0 and UINT32_MAX. If not specified, or if explicitly
  12751. set to -1, the filter will try to use a good random seed on a best
  12752. effort basis.
  12753. @item rule
  12754. Set the life rule.
  12755. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  12756. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  12757. @var{NS} specifies the number of alive neighbor cells which make a
  12758. live cell stay alive, and @var{NB} the number of alive neighbor cells
  12759. which make a dead cell to become alive (i.e. to "born").
  12760. "s" and "b" can be used in place of "S" and "B", respectively.
  12761. Alternatively a rule can be specified by an 18-bits integer. The 9
  12762. high order bits are used to encode the next cell state if it is alive
  12763. for each number of neighbor alive cells, the low order bits specify
  12764. the rule for "borning" new cells. Higher order bits encode for an
  12765. higher number of neighbor cells.
  12766. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  12767. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  12768. Default value is "S23/B3", which is the original Conway's game of life
  12769. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  12770. cells, and will born a new cell if there are three alive cells around
  12771. a dead cell.
  12772. @item size, s
  12773. Set the size of the output video. For the syntax of this option, check the
  12774. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12775. If @option{filename} is specified, the size is set by default to the
  12776. same size of the input file. If @option{size} is set, it must contain
  12777. the size specified in the input file, and the initial grid defined in
  12778. that file is centered in the larger resulting area.
  12779. If a filename is not specified, the size value defaults to "320x240"
  12780. (used for a randomly generated initial grid).
  12781. @item stitch
  12782. If set to 1, stitch the left and right grid edges together, and the
  12783. top and bottom edges also. Defaults to 1.
  12784. @item mold
  12785. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  12786. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  12787. value from 0 to 255.
  12788. @item life_color
  12789. Set the color of living (or new born) cells.
  12790. @item death_color
  12791. Set the color of dead cells. If @option{mold} is set, this is the first color
  12792. used to represent a dead cell.
  12793. @item mold_color
  12794. Set mold color, for definitely dead and moldy cells.
  12795. For the syntax of these 3 color options, check the "Color" section in the
  12796. ffmpeg-utils manual.
  12797. @end table
  12798. @subsection Examples
  12799. @itemize
  12800. @item
  12801. Read a grid from @file{pattern}, and center it on a grid of size
  12802. 300x300 pixels:
  12803. @example
  12804. life=f=pattern:s=300x300
  12805. @end example
  12806. @item
  12807. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  12808. @example
  12809. life=ratio=2/3:s=200x200
  12810. @end example
  12811. @item
  12812. Specify a custom rule for evolving a randomly generated grid:
  12813. @example
  12814. life=rule=S14/B34
  12815. @end example
  12816. @item
  12817. Full example with slow death effect (mold) using @command{ffplay}:
  12818. @example
  12819. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  12820. @end example
  12821. @end itemize
  12822. @anchor{allrgb}
  12823. @anchor{allyuv}
  12824. @anchor{color}
  12825. @anchor{haldclutsrc}
  12826. @anchor{nullsrc}
  12827. @anchor{rgbtestsrc}
  12828. @anchor{smptebars}
  12829. @anchor{smptehdbars}
  12830. @anchor{testsrc}
  12831. @anchor{testsrc2}
  12832. @anchor{yuvtestsrc}
  12833. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  12834. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  12835. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  12836. The @code{color} source provides an uniformly colored input.
  12837. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  12838. @ref{haldclut} filter.
  12839. The @code{nullsrc} source returns unprocessed video frames. It is
  12840. mainly useful to be employed in analysis / debugging tools, or as the
  12841. source for filters which ignore the input data.
  12842. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  12843. detecting RGB vs BGR issues. You should see a red, green and blue
  12844. stripe from top to bottom.
  12845. The @code{smptebars} source generates a color bars pattern, based on
  12846. the SMPTE Engineering Guideline EG 1-1990.
  12847. The @code{smptehdbars} source generates a color bars pattern, based on
  12848. the SMPTE RP 219-2002.
  12849. The @code{testsrc} source generates a test video pattern, showing a
  12850. color pattern, a scrolling gradient and a timestamp. This is mainly
  12851. intended for testing purposes.
  12852. The @code{testsrc2} source is similar to testsrc, but supports more
  12853. pixel formats instead of just @code{rgb24}. This allows using it as an
  12854. input for other tests without requiring a format conversion.
  12855. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  12856. see a y, cb and cr stripe from top to bottom.
  12857. The sources accept the following parameters:
  12858. @table @option
  12859. @item alpha
  12860. Specify the alpha (opacity) of the background, only available in the
  12861. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  12862. 255 (fully opaque, the default).
  12863. @item color, c
  12864. Specify the color of the source, only available in the @code{color}
  12865. source. For the syntax of this option, check the "Color" section in the
  12866. ffmpeg-utils manual.
  12867. @item level
  12868. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  12869. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  12870. pixels to be used as identity matrix for 3D lookup tables. Each component is
  12871. coded on a @code{1/(N*N)} scale.
  12872. @item size, s
  12873. Specify the size of the sourced video. For the syntax of this option, check the
  12874. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12875. The default value is @code{320x240}.
  12876. This option is not available with the @code{haldclutsrc} filter.
  12877. @item rate, r
  12878. Specify the frame rate of the sourced video, as the number of frames
  12879. generated per second. It has to be a string in the format
  12880. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12881. number or a valid video frame rate abbreviation. The default value is
  12882. "25".
  12883. @item sar
  12884. Set the sample aspect ratio of the sourced video.
  12885. @item duration, d
  12886. Set the duration of the sourced video. See
  12887. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12888. for the accepted syntax.
  12889. If not specified, or the expressed duration is negative, the video is
  12890. supposed to be generated forever.
  12891. @item decimals, n
  12892. Set the number of decimals to show in the timestamp, only available in the
  12893. @code{testsrc} source.
  12894. The displayed timestamp value will correspond to the original
  12895. timestamp value multiplied by the power of 10 of the specified
  12896. value. Default value is 0.
  12897. @end table
  12898. For example the following:
  12899. @example
  12900. testsrc=duration=5.3:size=qcif:rate=10
  12901. @end example
  12902. will generate a video with a duration of 5.3 seconds, with size
  12903. 176x144 and a frame rate of 10 frames per second.
  12904. The following graph description will generate a red source
  12905. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  12906. frames per second.
  12907. @example
  12908. color=c=red@@0.2:s=qcif:r=10
  12909. @end example
  12910. If the input content is to be ignored, @code{nullsrc} can be used. The
  12911. following command generates noise in the luminance plane by employing
  12912. the @code{geq} filter:
  12913. @example
  12914. nullsrc=s=256x256, geq=random(1)*255:128:128
  12915. @end example
  12916. @subsection Commands
  12917. The @code{color} source supports the following commands:
  12918. @table @option
  12919. @item c, color
  12920. Set the color of the created image. Accepts the same syntax of the
  12921. corresponding @option{color} option.
  12922. @end table
  12923. @c man end VIDEO SOURCES
  12924. @chapter Video Sinks
  12925. @c man begin VIDEO SINKS
  12926. Below is a description of the currently available video sinks.
  12927. @section buffersink
  12928. Buffer video frames, and make them available to the end of the filter
  12929. graph.
  12930. This sink is mainly intended for programmatic use, in particular
  12931. through the interface defined in @file{libavfilter/buffersink.h}
  12932. or the options system.
  12933. It accepts a pointer to an AVBufferSinkContext structure, which
  12934. defines the incoming buffers' formats, to be passed as the opaque
  12935. parameter to @code{avfilter_init_filter} for initialization.
  12936. @section nullsink
  12937. Null video sink: do absolutely nothing with the input video. It is
  12938. mainly useful as a template and for use in analysis / debugging
  12939. tools.
  12940. @c man end VIDEO SINKS
  12941. @chapter Multimedia Filters
  12942. @c man begin MULTIMEDIA FILTERS
  12943. Below is a description of the currently available multimedia filters.
  12944. @section abitscope
  12945. Convert input audio to a video output, displaying the audio bit scope.
  12946. The filter accepts the following options:
  12947. @table @option
  12948. @item rate, r
  12949. Set frame rate, expressed as number of frames per second. Default
  12950. value is "25".
  12951. @item size, s
  12952. Specify the video size for the output. For the syntax of this option, check the
  12953. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12954. Default value is @code{1024x256}.
  12955. @item colors
  12956. Specify list of colors separated by space or by '|' which will be used to
  12957. draw channels. Unrecognized or missing colors will be replaced
  12958. by white color.
  12959. @end table
  12960. @section ahistogram
  12961. Convert input audio to a video output, displaying the volume histogram.
  12962. The filter accepts the following options:
  12963. @table @option
  12964. @item dmode
  12965. Specify how histogram is calculated.
  12966. It accepts the following values:
  12967. @table @samp
  12968. @item single
  12969. Use single histogram for all channels.
  12970. @item separate
  12971. Use separate histogram for each channel.
  12972. @end table
  12973. Default is @code{single}.
  12974. @item rate, r
  12975. Set frame rate, expressed as number of frames per second. Default
  12976. value is "25".
  12977. @item size, s
  12978. Specify the video size for the output. For the syntax of this option, check the
  12979. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12980. Default value is @code{hd720}.
  12981. @item scale
  12982. Set display scale.
  12983. It accepts the following values:
  12984. @table @samp
  12985. @item log
  12986. logarithmic
  12987. @item sqrt
  12988. square root
  12989. @item cbrt
  12990. cubic root
  12991. @item lin
  12992. linear
  12993. @item rlog
  12994. reverse logarithmic
  12995. @end table
  12996. Default is @code{log}.
  12997. @item ascale
  12998. Set amplitude scale.
  12999. It accepts the following values:
  13000. @table @samp
  13001. @item log
  13002. logarithmic
  13003. @item lin
  13004. linear
  13005. @end table
  13006. Default is @code{log}.
  13007. @item acount
  13008. Set how much frames to accumulate in histogram.
  13009. Defauls is 1. Setting this to -1 accumulates all frames.
  13010. @item rheight
  13011. Set histogram ratio of window height.
  13012. @item slide
  13013. Set sonogram sliding.
  13014. It accepts the following values:
  13015. @table @samp
  13016. @item replace
  13017. replace old rows with new ones.
  13018. @item scroll
  13019. scroll from top to bottom.
  13020. @end table
  13021. Default is @code{replace}.
  13022. @end table
  13023. @section aphasemeter
  13024. Convert input audio to a video output, displaying the audio phase.
  13025. The filter accepts the following options:
  13026. @table @option
  13027. @item rate, r
  13028. Set the output frame rate. Default value is @code{25}.
  13029. @item size, s
  13030. Set the video size for the output. For the syntax of this option, check the
  13031. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13032. Default value is @code{800x400}.
  13033. @item rc
  13034. @item gc
  13035. @item bc
  13036. Specify the red, green, blue contrast. Default values are @code{2},
  13037. @code{7} and @code{1}.
  13038. Allowed range is @code{[0, 255]}.
  13039. @item mpc
  13040. Set color which will be used for drawing median phase. If color is
  13041. @code{none} which is default, no median phase value will be drawn.
  13042. @item video
  13043. Enable video output. Default is enabled.
  13044. @end table
  13045. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  13046. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  13047. The @code{-1} means left and right channels are completely out of phase and
  13048. @code{1} means channels are in phase.
  13049. @section avectorscope
  13050. Convert input audio to a video output, representing the audio vector
  13051. scope.
  13052. The filter is used to measure the difference between channels of stereo
  13053. audio stream. A monoaural signal, consisting of identical left and right
  13054. signal, results in straight vertical line. Any stereo separation is visible
  13055. as a deviation from this line, creating a Lissajous figure.
  13056. If the straight (or deviation from it) but horizontal line appears this
  13057. indicates that the left and right channels are out of phase.
  13058. The filter accepts the following options:
  13059. @table @option
  13060. @item mode, m
  13061. Set the vectorscope mode.
  13062. Available values are:
  13063. @table @samp
  13064. @item lissajous
  13065. Lissajous rotated by 45 degrees.
  13066. @item lissajous_xy
  13067. Same as above but not rotated.
  13068. @item polar
  13069. Shape resembling half of circle.
  13070. @end table
  13071. Default value is @samp{lissajous}.
  13072. @item size, s
  13073. Set the video size for the output. For the syntax of this option, check the
  13074. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13075. Default value is @code{400x400}.
  13076. @item rate, r
  13077. Set the output frame rate. Default value is @code{25}.
  13078. @item rc
  13079. @item gc
  13080. @item bc
  13081. @item ac
  13082. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  13083. @code{160}, @code{80} and @code{255}.
  13084. Allowed range is @code{[0, 255]}.
  13085. @item rf
  13086. @item gf
  13087. @item bf
  13088. @item af
  13089. Specify the red, green, blue and alpha fade. Default values are @code{15},
  13090. @code{10}, @code{5} and @code{5}.
  13091. Allowed range is @code{[0, 255]}.
  13092. @item zoom
  13093. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  13094. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  13095. @item draw
  13096. Set the vectorscope drawing mode.
  13097. Available values are:
  13098. @table @samp
  13099. @item dot
  13100. Draw dot for each sample.
  13101. @item line
  13102. Draw line between previous and current sample.
  13103. @end table
  13104. Default value is @samp{dot}.
  13105. @item scale
  13106. Specify amplitude scale of audio samples.
  13107. Available values are:
  13108. @table @samp
  13109. @item lin
  13110. Linear.
  13111. @item sqrt
  13112. Square root.
  13113. @item cbrt
  13114. Cubic root.
  13115. @item log
  13116. Logarithmic.
  13117. @end table
  13118. @end table
  13119. @subsection Examples
  13120. @itemize
  13121. @item
  13122. Complete example using @command{ffplay}:
  13123. @example
  13124. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  13125. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  13126. @end example
  13127. @end itemize
  13128. @section bench, abench
  13129. Benchmark part of a filtergraph.
  13130. The filter accepts the following options:
  13131. @table @option
  13132. @item action
  13133. Start or stop a timer.
  13134. Available values are:
  13135. @table @samp
  13136. @item start
  13137. Get the current time, set it as frame metadata (using the key
  13138. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  13139. @item stop
  13140. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  13141. the input frame metadata to get the time difference. Time difference, average,
  13142. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  13143. @code{min}) are then printed. The timestamps are expressed in seconds.
  13144. @end table
  13145. @end table
  13146. @subsection Examples
  13147. @itemize
  13148. @item
  13149. Benchmark @ref{selectivecolor} filter:
  13150. @example
  13151. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  13152. @end example
  13153. @end itemize
  13154. @section concat
  13155. Concatenate audio and video streams, joining them together one after the
  13156. other.
  13157. The filter works on segments of synchronized video and audio streams. All
  13158. segments must have the same number of streams of each type, and that will
  13159. also be the number of streams at output.
  13160. The filter accepts the following options:
  13161. @table @option
  13162. @item n
  13163. Set the number of segments. Default is 2.
  13164. @item v
  13165. Set the number of output video streams, that is also the number of video
  13166. streams in each segment. Default is 1.
  13167. @item a
  13168. Set the number of output audio streams, that is also the number of audio
  13169. streams in each segment. Default is 0.
  13170. @item unsafe
  13171. Activate unsafe mode: do not fail if segments have a different format.
  13172. @end table
  13173. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  13174. @var{a} audio outputs.
  13175. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  13176. segment, in the same order as the outputs, then the inputs for the second
  13177. segment, etc.
  13178. Related streams do not always have exactly the same duration, for various
  13179. reasons including codec frame size or sloppy authoring. For that reason,
  13180. related synchronized streams (e.g. a video and its audio track) should be
  13181. concatenated at once. The concat filter will use the duration of the longest
  13182. stream in each segment (except the last one), and if necessary pad shorter
  13183. audio streams with silence.
  13184. For this filter to work correctly, all segments must start at timestamp 0.
  13185. All corresponding streams must have the same parameters in all segments; the
  13186. filtering system will automatically select a common pixel format for video
  13187. streams, and a common sample format, sample rate and channel layout for
  13188. audio streams, but other settings, such as resolution, must be converted
  13189. explicitly by the user.
  13190. Different frame rates are acceptable but will result in variable frame rate
  13191. at output; be sure to configure the output file to handle it.
  13192. @subsection Examples
  13193. @itemize
  13194. @item
  13195. Concatenate an opening, an episode and an ending, all in bilingual version
  13196. (video in stream 0, audio in streams 1 and 2):
  13197. @example
  13198. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  13199. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  13200. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  13201. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  13202. @end example
  13203. @item
  13204. Concatenate two parts, handling audio and video separately, using the
  13205. (a)movie sources, and adjusting the resolution:
  13206. @example
  13207. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  13208. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  13209. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  13210. @end example
  13211. Note that a desync will happen at the stitch if the audio and video streams
  13212. do not have exactly the same duration in the first file.
  13213. @end itemize
  13214. @section drawgraph, adrawgraph
  13215. Draw a graph using input video or audio metadata.
  13216. It accepts the following parameters:
  13217. @table @option
  13218. @item m1
  13219. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  13220. @item fg1
  13221. Set 1st foreground color expression.
  13222. @item m2
  13223. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  13224. @item fg2
  13225. Set 2nd foreground color expression.
  13226. @item m3
  13227. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  13228. @item fg3
  13229. Set 3rd foreground color expression.
  13230. @item m4
  13231. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  13232. @item fg4
  13233. Set 4th foreground color expression.
  13234. @item min
  13235. Set minimal value of metadata value.
  13236. @item max
  13237. Set maximal value of metadata value.
  13238. @item bg
  13239. Set graph background color. Default is white.
  13240. @item mode
  13241. Set graph mode.
  13242. Available values for mode is:
  13243. @table @samp
  13244. @item bar
  13245. @item dot
  13246. @item line
  13247. @end table
  13248. Default is @code{line}.
  13249. @item slide
  13250. Set slide mode.
  13251. Available values for slide is:
  13252. @table @samp
  13253. @item frame
  13254. Draw new frame when right border is reached.
  13255. @item replace
  13256. Replace old columns with new ones.
  13257. @item scroll
  13258. Scroll from right to left.
  13259. @item rscroll
  13260. Scroll from left to right.
  13261. @item picture
  13262. Draw single picture.
  13263. @end table
  13264. Default is @code{frame}.
  13265. @item size
  13266. Set size of graph video. For the syntax of this option, check the
  13267. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13268. The default value is @code{900x256}.
  13269. The foreground color expressions can use the following variables:
  13270. @table @option
  13271. @item MIN
  13272. Minimal value of metadata value.
  13273. @item MAX
  13274. Maximal value of metadata value.
  13275. @item VAL
  13276. Current metadata key value.
  13277. @end table
  13278. The color is defined as 0xAABBGGRR.
  13279. @end table
  13280. Example using metadata from @ref{signalstats} filter:
  13281. @example
  13282. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  13283. @end example
  13284. Example using metadata from @ref{ebur128} filter:
  13285. @example
  13286. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  13287. @end example
  13288. @anchor{ebur128}
  13289. @section ebur128
  13290. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  13291. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  13292. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  13293. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  13294. The filter also has a video output (see the @var{video} option) with a real
  13295. time graph to observe the loudness evolution. The graphic contains the logged
  13296. message mentioned above, so it is not printed anymore when this option is set,
  13297. unless the verbose logging is set. The main graphing area contains the
  13298. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  13299. the momentary loudness (400 milliseconds).
  13300. More information about the Loudness Recommendation EBU R128 on
  13301. @url{http://tech.ebu.ch/loudness}.
  13302. The filter accepts the following options:
  13303. @table @option
  13304. @item video
  13305. Activate the video output. The audio stream is passed unchanged whether this
  13306. option is set or no. The video stream will be the first output stream if
  13307. activated. Default is @code{0}.
  13308. @item size
  13309. Set the video size. This option is for video only. For the syntax of this
  13310. option, check the
  13311. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13312. Default and minimum resolution is @code{640x480}.
  13313. @item meter
  13314. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  13315. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  13316. other integer value between this range is allowed.
  13317. @item metadata
  13318. Set metadata injection. If set to @code{1}, the audio input will be segmented
  13319. into 100ms output frames, each of them containing various loudness information
  13320. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  13321. Default is @code{0}.
  13322. @item framelog
  13323. Force the frame logging level.
  13324. Available values are:
  13325. @table @samp
  13326. @item info
  13327. information logging level
  13328. @item verbose
  13329. verbose logging level
  13330. @end table
  13331. By default, the logging level is set to @var{info}. If the @option{video} or
  13332. the @option{metadata} options are set, it switches to @var{verbose}.
  13333. @item peak
  13334. Set peak mode(s).
  13335. Available modes can be cumulated (the option is a @code{flag} type). Possible
  13336. values are:
  13337. @table @samp
  13338. @item none
  13339. Disable any peak mode (default).
  13340. @item sample
  13341. Enable sample-peak mode.
  13342. Simple peak mode looking for the higher sample value. It logs a message
  13343. for sample-peak (identified by @code{SPK}).
  13344. @item true
  13345. Enable true-peak mode.
  13346. If enabled, the peak lookup is done on an over-sampled version of the input
  13347. stream for better peak accuracy. It logs a message for true-peak.
  13348. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  13349. This mode requires a build with @code{libswresample}.
  13350. @end table
  13351. @item dualmono
  13352. Treat mono input files as "dual mono". If a mono file is intended for playback
  13353. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  13354. If set to @code{true}, this option will compensate for this effect.
  13355. Multi-channel input files are not affected by this option.
  13356. @item panlaw
  13357. Set a specific pan law to be used for the measurement of dual mono files.
  13358. This parameter is optional, and has a default value of -3.01dB.
  13359. @end table
  13360. @subsection Examples
  13361. @itemize
  13362. @item
  13363. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  13364. @example
  13365. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  13366. @end example
  13367. @item
  13368. Run an analysis with @command{ffmpeg}:
  13369. @example
  13370. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  13371. @end example
  13372. @end itemize
  13373. @section interleave, ainterleave
  13374. Temporally interleave frames from several inputs.
  13375. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  13376. These filters read frames from several inputs and send the oldest
  13377. queued frame to the output.
  13378. Input streams must have well defined, monotonically increasing frame
  13379. timestamp values.
  13380. In order to submit one frame to output, these filters need to enqueue
  13381. at least one frame for each input, so they cannot work in case one
  13382. input is not yet terminated and will not receive incoming frames.
  13383. For example consider the case when one input is a @code{select} filter
  13384. which always drops input frames. The @code{interleave} filter will keep
  13385. reading from that input, but it will never be able to send new frames
  13386. to output until the input sends an end-of-stream signal.
  13387. Also, depending on inputs synchronization, the filters will drop
  13388. frames in case one input receives more frames than the other ones, and
  13389. the queue is already filled.
  13390. These filters accept the following options:
  13391. @table @option
  13392. @item nb_inputs, n
  13393. Set the number of different inputs, it is 2 by default.
  13394. @end table
  13395. @subsection Examples
  13396. @itemize
  13397. @item
  13398. Interleave frames belonging to different streams using @command{ffmpeg}:
  13399. @example
  13400. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  13401. @end example
  13402. @item
  13403. Add flickering blur effect:
  13404. @example
  13405. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  13406. @end example
  13407. @end itemize
  13408. @section metadata, ametadata
  13409. Manipulate frame metadata.
  13410. This filter accepts the following options:
  13411. @table @option
  13412. @item mode
  13413. Set mode of operation of the filter.
  13414. Can be one of the following:
  13415. @table @samp
  13416. @item select
  13417. If both @code{value} and @code{key} is set, select frames
  13418. which have such metadata. If only @code{key} is set, select
  13419. every frame that has such key in metadata.
  13420. @item add
  13421. Add new metadata @code{key} and @code{value}. If key is already available
  13422. do nothing.
  13423. @item modify
  13424. Modify value of already present key.
  13425. @item delete
  13426. If @code{value} is set, delete only keys that have such value.
  13427. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  13428. the frame.
  13429. @item print
  13430. Print key and its value if metadata was found. If @code{key} is not set print all
  13431. metadata values available in frame.
  13432. @end table
  13433. @item key
  13434. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  13435. @item value
  13436. Set metadata value which will be used. This option is mandatory for
  13437. @code{modify} and @code{add} mode.
  13438. @item function
  13439. Which function to use when comparing metadata value and @code{value}.
  13440. Can be one of following:
  13441. @table @samp
  13442. @item same_str
  13443. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  13444. @item starts_with
  13445. Values are interpreted as strings, returns true if metadata value starts with
  13446. the @code{value} option string.
  13447. @item less
  13448. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  13449. @item equal
  13450. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  13451. @item greater
  13452. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  13453. @item expr
  13454. Values are interpreted as floats, returns true if expression from option @code{expr}
  13455. evaluates to true.
  13456. @end table
  13457. @item expr
  13458. Set expression which is used when @code{function} is set to @code{expr}.
  13459. The expression is evaluated through the eval API and can contain the following
  13460. constants:
  13461. @table @option
  13462. @item VALUE1
  13463. Float representation of @code{value} from metadata key.
  13464. @item VALUE2
  13465. Float representation of @code{value} as supplied by user in @code{value} option.
  13466. @end table
  13467. @item file
  13468. If specified in @code{print} mode, output is written to the named file. Instead of
  13469. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  13470. for standard output. If @code{file} option is not set, output is written to the log
  13471. with AV_LOG_INFO loglevel.
  13472. @end table
  13473. @subsection Examples
  13474. @itemize
  13475. @item
  13476. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  13477. between 0 and 1.
  13478. @example
  13479. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  13480. @end example
  13481. @item
  13482. Print silencedetect output to file @file{metadata.txt}.
  13483. @example
  13484. silencedetect,ametadata=mode=print:file=metadata.txt
  13485. @end example
  13486. @item
  13487. Direct all metadata to a pipe with file descriptor 4.
  13488. @example
  13489. metadata=mode=print:file='pipe\:4'
  13490. @end example
  13491. @end itemize
  13492. @section perms, aperms
  13493. Set read/write permissions for the output frames.
  13494. These filters are mainly aimed at developers to test direct path in the
  13495. following filter in the filtergraph.
  13496. The filters accept the following options:
  13497. @table @option
  13498. @item mode
  13499. Select the permissions mode.
  13500. It accepts the following values:
  13501. @table @samp
  13502. @item none
  13503. Do nothing. This is the default.
  13504. @item ro
  13505. Set all the output frames read-only.
  13506. @item rw
  13507. Set all the output frames directly writable.
  13508. @item toggle
  13509. Make the frame read-only if writable, and writable if read-only.
  13510. @item random
  13511. Set each output frame read-only or writable randomly.
  13512. @end table
  13513. @item seed
  13514. Set the seed for the @var{random} mode, must be an integer included between
  13515. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  13516. @code{-1}, the filter will try to use a good random seed on a best effort
  13517. basis.
  13518. @end table
  13519. Note: in case of auto-inserted filter between the permission filter and the
  13520. following one, the permission might not be received as expected in that
  13521. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  13522. perms/aperms filter can avoid this problem.
  13523. @section realtime, arealtime
  13524. Slow down filtering to match real time approximately.
  13525. These filters will pause the filtering for a variable amount of time to
  13526. match the output rate with the input timestamps.
  13527. They are similar to the @option{re} option to @code{ffmpeg}.
  13528. They accept the following options:
  13529. @table @option
  13530. @item limit
  13531. Time limit for the pauses. Any pause longer than that will be considered
  13532. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  13533. @end table
  13534. @anchor{select}
  13535. @section select, aselect
  13536. Select frames to pass in output.
  13537. This filter accepts the following options:
  13538. @table @option
  13539. @item expr, e
  13540. Set expression, which is evaluated for each input frame.
  13541. If the expression is evaluated to zero, the frame is discarded.
  13542. If the evaluation result is negative or NaN, the frame is sent to the
  13543. first output; otherwise it is sent to the output with index
  13544. @code{ceil(val)-1}, assuming that the input index starts from 0.
  13545. For example a value of @code{1.2} corresponds to the output with index
  13546. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  13547. @item outputs, n
  13548. Set the number of outputs. The output to which to send the selected
  13549. frame is based on the result of the evaluation. Default value is 1.
  13550. @end table
  13551. The expression can contain the following constants:
  13552. @table @option
  13553. @item n
  13554. The (sequential) number of the filtered frame, starting from 0.
  13555. @item selected_n
  13556. The (sequential) number of the selected frame, starting from 0.
  13557. @item prev_selected_n
  13558. The sequential number of the last selected frame. It's NAN if undefined.
  13559. @item TB
  13560. The timebase of the input timestamps.
  13561. @item pts
  13562. The PTS (Presentation TimeStamp) of the filtered video frame,
  13563. expressed in @var{TB} units. It's NAN if undefined.
  13564. @item t
  13565. The PTS of the filtered video frame,
  13566. expressed in seconds. It's NAN if undefined.
  13567. @item prev_pts
  13568. The PTS of the previously filtered video frame. It's NAN if undefined.
  13569. @item prev_selected_pts
  13570. The PTS of the last previously filtered video frame. It's NAN if undefined.
  13571. @item prev_selected_t
  13572. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  13573. @item start_pts
  13574. The PTS of the first video frame in the video. It's NAN if undefined.
  13575. @item start_t
  13576. The time of the first video frame in the video. It's NAN if undefined.
  13577. @item pict_type @emph{(video only)}
  13578. The type of the filtered frame. It can assume one of the following
  13579. values:
  13580. @table @option
  13581. @item I
  13582. @item P
  13583. @item B
  13584. @item S
  13585. @item SI
  13586. @item SP
  13587. @item BI
  13588. @end table
  13589. @item interlace_type @emph{(video only)}
  13590. The frame interlace type. It can assume one of the following values:
  13591. @table @option
  13592. @item PROGRESSIVE
  13593. The frame is progressive (not interlaced).
  13594. @item TOPFIRST
  13595. The frame is top-field-first.
  13596. @item BOTTOMFIRST
  13597. The frame is bottom-field-first.
  13598. @end table
  13599. @item consumed_sample_n @emph{(audio only)}
  13600. the number of selected samples before the current frame
  13601. @item samples_n @emph{(audio only)}
  13602. the number of samples in the current frame
  13603. @item sample_rate @emph{(audio only)}
  13604. the input sample rate
  13605. @item key
  13606. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  13607. @item pos
  13608. the position in the file of the filtered frame, -1 if the information
  13609. is not available (e.g. for synthetic video)
  13610. @item scene @emph{(video only)}
  13611. value between 0 and 1 to indicate a new scene; a low value reflects a low
  13612. probability for the current frame to introduce a new scene, while a higher
  13613. value means the current frame is more likely to be one (see the example below)
  13614. @item concatdec_select
  13615. The concat demuxer can select only part of a concat input file by setting an
  13616. inpoint and an outpoint, but the output packets may not be entirely contained
  13617. in the selected interval. By using this variable, it is possible to skip frames
  13618. generated by the concat demuxer which are not exactly contained in the selected
  13619. interval.
  13620. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  13621. and the @var{lavf.concat.duration} packet metadata values which are also
  13622. present in the decoded frames.
  13623. The @var{concatdec_select} variable is -1 if the frame pts is at least
  13624. start_time and either the duration metadata is missing or the frame pts is less
  13625. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  13626. missing.
  13627. That basically means that an input frame is selected if its pts is within the
  13628. interval set by the concat demuxer.
  13629. @end table
  13630. The default value of the select expression is "1".
  13631. @subsection Examples
  13632. @itemize
  13633. @item
  13634. Select all frames in input:
  13635. @example
  13636. select
  13637. @end example
  13638. The example above is the same as:
  13639. @example
  13640. select=1
  13641. @end example
  13642. @item
  13643. Skip all frames:
  13644. @example
  13645. select=0
  13646. @end example
  13647. @item
  13648. Select only I-frames:
  13649. @example
  13650. select='eq(pict_type\,I)'
  13651. @end example
  13652. @item
  13653. Select one frame every 100:
  13654. @example
  13655. select='not(mod(n\,100))'
  13656. @end example
  13657. @item
  13658. Select only frames contained in the 10-20 time interval:
  13659. @example
  13660. select=between(t\,10\,20)
  13661. @end example
  13662. @item
  13663. Select only I-frames contained in the 10-20 time interval:
  13664. @example
  13665. select=between(t\,10\,20)*eq(pict_type\,I)
  13666. @end example
  13667. @item
  13668. Select frames with a minimum distance of 10 seconds:
  13669. @example
  13670. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  13671. @end example
  13672. @item
  13673. Use aselect to select only audio frames with samples number > 100:
  13674. @example
  13675. aselect='gt(samples_n\,100)'
  13676. @end example
  13677. @item
  13678. Create a mosaic of the first scenes:
  13679. @example
  13680. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  13681. @end example
  13682. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  13683. choice.
  13684. @item
  13685. Send even and odd frames to separate outputs, and compose them:
  13686. @example
  13687. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  13688. @end example
  13689. @item
  13690. Select useful frames from an ffconcat file which is using inpoints and
  13691. outpoints but where the source files are not intra frame only.
  13692. @example
  13693. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  13694. @end example
  13695. @end itemize
  13696. @section sendcmd, asendcmd
  13697. Send commands to filters in the filtergraph.
  13698. These filters read commands to be sent to other filters in the
  13699. filtergraph.
  13700. @code{sendcmd} must be inserted between two video filters,
  13701. @code{asendcmd} must be inserted between two audio filters, but apart
  13702. from that they act the same way.
  13703. The specification of commands can be provided in the filter arguments
  13704. with the @var{commands} option, or in a file specified by the
  13705. @var{filename} option.
  13706. These filters accept the following options:
  13707. @table @option
  13708. @item commands, c
  13709. Set the commands to be read and sent to the other filters.
  13710. @item filename, f
  13711. Set the filename of the commands to be read and sent to the other
  13712. filters.
  13713. @end table
  13714. @subsection Commands syntax
  13715. A commands description consists of a sequence of interval
  13716. specifications, comprising a list of commands to be executed when a
  13717. particular event related to that interval occurs. The occurring event
  13718. is typically the current frame time entering or leaving a given time
  13719. interval.
  13720. An interval is specified by the following syntax:
  13721. @example
  13722. @var{START}[-@var{END}] @var{COMMANDS};
  13723. @end example
  13724. The time interval is specified by the @var{START} and @var{END} times.
  13725. @var{END} is optional and defaults to the maximum time.
  13726. The current frame time is considered within the specified interval if
  13727. it is included in the interval [@var{START}, @var{END}), that is when
  13728. the time is greater or equal to @var{START} and is lesser than
  13729. @var{END}.
  13730. @var{COMMANDS} consists of a sequence of one or more command
  13731. specifications, separated by ",", relating to that interval. The
  13732. syntax of a command specification is given by:
  13733. @example
  13734. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  13735. @end example
  13736. @var{FLAGS} is optional and specifies the type of events relating to
  13737. the time interval which enable sending the specified command, and must
  13738. be a non-null sequence of identifier flags separated by "+" or "|" and
  13739. enclosed between "[" and "]".
  13740. The following flags are recognized:
  13741. @table @option
  13742. @item enter
  13743. The command is sent when the current frame timestamp enters the
  13744. specified interval. In other words, the command is sent when the
  13745. previous frame timestamp was not in the given interval, and the
  13746. current is.
  13747. @item leave
  13748. The command is sent when the current frame timestamp leaves the
  13749. specified interval. In other words, the command is sent when the
  13750. previous frame timestamp was in the given interval, and the
  13751. current is not.
  13752. @end table
  13753. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  13754. assumed.
  13755. @var{TARGET} specifies the target of the command, usually the name of
  13756. the filter class or a specific filter instance name.
  13757. @var{COMMAND} specifies the name of the command for the target filter.
  13758. @var{ARG} is optional and specifies the optional list of argument for
  13759. the given @var{COMMAND}.
  13760. Between one interval specification and another, whitespaces, or
  13761. sequences of characters starting with @code{#} until the end of line,
  13762. are ignored and can be used to annotate comments.
  13763. A simplified BNF description of the commands specification syntax
  13764. follows:
  13765. @example
  13766. @var{COMMAND_FLAG} ::= "enter" | "leave"
  13767. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  13768. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  13769. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  13770. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  13771. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  13772. @end example
  13773. @subsection Examples
  13774. @itemize
  13775. @item
  13776. Specify audio tempo change at second 4:
  13777. @example
  13778. asendcmd=c='4.0 atempo tempo 1.5',atempo
  13779. @end example
  13780. @item
  13781. Target a specific filter instance:
  13782. @example
  13783. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  13784. @end example
  13785. @item
  13786. Specify a list of drawtext and hue commands in a file.
  13787. @example
  13788. # show text in the interval 5-10
  13789. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  13790. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  13791. # desaturate the image in the interval 15-20
  13792. 15.0-20.0 [enter] hue s 0,
  13793. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  13794. [leave] hue s 1,
  13795. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  13796. # apply an exponential saturation fade-out effect, starting from time 25
  13797. 25 [enter] hue s exp(25-t)
  13798. @end example
  13799. A filtergraph allowing to read and process the above command list
  13800. stored in a file @file{test.cmd}, can be specified with:
  13801. @example
  13802. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  13803. @end example
  13804. @end itemize
  13805. @anchor{setpts}
  13806. @section setpts, asetpts
  13807. Change the PTS (presentation timestamp) of the input frames.
  13808. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  13809. This filter accepts the following options:
  13810. @table @option
  13811. @item expr
  13812. The expression which is evaluated for each frame to construct its timestamp.
  13813. @end table
  13814. The expression is evaluated through the eval API and can contain the following
  13815. constants:
  13816. @table @option
  13817. @item FRAME_RATE
  13818. frame rate, only defined for constant frame-rate video
  13819. @item PTS
  13820. The presentation timestamp in input
  13821. @item N
  13822. The count of the input frame for video or the number of consumed samples,
  13823. not including the current frame for audio, starting from 0.
  13824. @item NB_CONSUMED_SAMPLES
  13825. The number of consumed samples, not including the current frame (only
  13826. audio)
  13827. @item NB_SAMPLES, S
  13828. The number of samples in the current frame (only audio)
  13829. @item SAMPLE_RATE, SR
  13830. The audio sample rate.
  13831. @item STARTPTS
  13832. The PTS of the first frame.
  13833. @item STARTT
  13834. the time in seconds of the first frame
  13835. @item INTERLACED
  13836. State whether the current frame is interlaced.
  13837. @item T
  13838. the time in seconds of the current frame
  13839. @item POS
  13840. original position in the file of the frame, or undefined if undefined
  13841. for the current frame
  13842. @item PREV_INPTS
  13843. The previous input PTS.
  13844. @item PREV_INT
  13845. previous input time in seconds
  13846. @item PREV_OUTPTS
  13847. The previous output PTS.
  13848. @item PREV_OUTT
  13849. previous output time in seconds
  13850. @item RTCTIME
  13851. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  13852. instead.
  13853. @item RTCSTART
  13854. The wallclock (RTC) time at the start of the movie in microseconds.
  13855. @item TB
  13856. The timebase of the input timestamps.
  13857. @end table
  13858. @subsection Examples
  13859. @itemize
  13860. @item
  13861. Start counting PTS from zero
  13862. @example
  13863. setpts=PTS-STARTPTS
  13864. @end example
  13865. @item
  13866. Apply fast motion effect:
  13867. @example
  13868. setpts=0.5*PTS
  13869. @end example
  13870. @item
  13871. Apply slow motion effect:
  13872. @example
  13873. setpts=2.0*PTS
  13874. @end example
  13875. @item
  13876. Set fixed rate of 25 frames per second:
  13877. @example
  13878. setpts=N/(25*TB)
  13879. @end example
  13880. @item
  13881. Set fixed rate 25 fps with some jitter:
  13882. @example
  13883. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  13884. @end example
  13885. @item
  13886. Apply an offset of 10 seconds to the input PTS:
  13887. @example
  13888. setpts=PTS+10/TB
  13889. @end example
  13890. @item
  13891. Generate timestamps from a "live source" and rebase onto the current timebase:
  13892. @example
  13893. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  13894. @end example
  13895. @item
  13896. Generate timestamps by counting samples:
  13897. @example
  13898. asetpts=N/SR/TB
  13899. @end example
  13900. @end itemize
  13901. @section settb, asettb
  13902. Set the timebase to use for the output frames timestamps.
  13903. It is mainly useful for testing timebase configuration.
  13904. It accepts the following parameters:
  13905. @table @option
  13906. @item expr, tb
  13907. The expression which is evaluated into the output timebase.
  13908. @end table
  13909. The value for @option{tb} is an arithmetic expression representing a
  13910. rational. The expression can contain the constants "AVTB" (the default
  13911. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  13912. audio only). Default value is "intb".
  13913. @subsection Examples
  13914. @itemize
  13915. @item
  13916. Set the timebase to 1/25:
  13917. @example
  13918. settb=expr=1/25
  13919. @end example
  13920. @item
  13921. Set the timebase to 1/10:
  13922. @example
  13923. settb=expr=0.1
  13924. @end example
  13925. @item
  13926. Set the timebase to 1001/1000:
  13927. @example
  13928. settb=1+0.001
  13929. @end example
  13930. @item
  13931. Set the timebase to 2*intb:
  13932. @example
  13933. settb=2*intb
  13934. @end example
  13935. @item
  13936. Set the default timebase value:
  13937. @example
  13938. settb=AVTB
  13939. @end example
  13940. @end itemize
  13941. @section showcqt
  13942. Convert input audio to a video output representing frequency spectrum
  13943. logarithmically using Brown-Puckette constant Q transform algorithm with
  13944. direct frequency domain coefficient calculation (but the transform itself
  13945. is not really constant Q, instead the Q factor is actually variable/clamped),
  13946. with musical tone scale, from E0 to D#10.
  13947. The filter accepts the following options:
  13948. @table @option
  13949. @item size, s
  13950. Specify the video size for the output. It must be even. For the syntax of this option,
  13951. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13952. Default value is @code{1920x1080}.
  13953. @item fps, rate, r
  13954. Set the output frame rate. Default value is @code{25}.
  13955. @item bar_h
  13956. Set the bargraph height. It must be even. Default value is @code{-1} which
  13957. computes the bargraph height automatically.
  13958. @item axis_h
  13959. Set the axis height. It must be even. Default value is @code{-1} which computes
  13960. the axis height automatically.
  13961. @item sono_h
  13962. Set the sonogram height. It must be even. Default value is @code{-1} which
  13963. computes the sonogram height automatically.
  13964. @item fullhd
  13965. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  13966. instead. Default value is @code{1}.
  13967. @item sono_v, volume
  13968. Specify the sonogram volume expression. It can contain variables:
  13969. @table @option
  13970. @item bar_v
  13971. the @var{bar_v} evaluated expression
  13972. @item frequency, freq, f
  13973. the frequency where it is evaluated
  13974. @item timeclamp, tc
  13975. the value of @var{timeclamp} option
  13976. @end table
  13977. and functions:
  13978. @table @option
  13979. @item a_weighting(f)
  13980. A-weighting of equal loudness
  13981. @item b_weighting(f)
  13982. B-weighting of equal loudness
  13983. @item c_weighting(f)
  13984. C-weighting of equal loudness.
  13985. @end table
  13986. Default value is @code{16}.
  13987. @item bar_v, volume2
  13988. Specify the bargraph volume expression. It can contain variables:
  13989. @table @option
  13990. @item sono_v
  13991. the @var{sono_v} evaluated expression
  13992. @item frequency, freq, f
  13993. the frequency where it is evaluated
  13994. @item timeclamp, tc
  13995. the value of @var{timeclamp} option
  13996. @end table
  13997. and functions:
  13998. @table @option
  13999. @item a_weighting(f)
  14000. A-weighting of equal loudness
  14001. @item b_weighting(f)
  14002. B-weighting of equal loudness
  14003. @item c_weighting(f)
  14004. C-weighting of equal loudness.
  14005. @end table
  14006. Default value is @code{sono_v}.
  14007. @item sono_g, gamma
  14008. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  14009. higher gamma makes the spectrum having more range. Default value is @code{3}.
  14010. Acceptable range is @code{[1, 7]}.
  14011. @item bar_g, gamma2
  14012. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  14013. @code{[1, 7]}.
  14014. @item bar_t
  14015. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  14016. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  14017. @item timeclamp, tc
  14018. Specify the transform timeclamp. At low frequency, there is trade-off between
  14019. accuracy in time domain and frequency domain. If timeclamp is lower,
  14020. event in time domain is represented more accurately (such as fast bass drum),
  14021. otherwise event in frequency domain is represented more accurately
  14022. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  14023. @item attack
  14024. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  14025. limits future samples by applying asymmetric windowing in time domain, useful
  14026. when low latency is required. Accepted range is @code{[0, 1]}.
  14027. @item basefreq
  14028. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  14029. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  14030. @item endfreq
  14031. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  14032. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  14033. @item coeffclamp
  14034. This option is deprecated and ignored.
  14035. @item tlength
  14036. Specify the transform length in time domain. Use this option to control accuracy
  14037. trade-off between time domain and frequency domain at every frequency sample.
  14038. It can contain variables:
  14039. @table @option
  14040. @item frequency, freq, f
  14041. the frequency where it is evaluated
  14042. @item timeclamp, tc
  14043. the value of @var{timeclamp} option.
  14044. @end table
  14045. Default value is @code{384*tc/(384+tc*f)}.
  14046. @item count
  14047. Specify the transform count for every video frame. Default value is @code{6}.
  14048. Acceptable range is @code{[1, 30]}.
  14049. @item fcount
  14050. Specify the transform count for every single pixel. Default value is @code{0},
  14051. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  14052. @item fontfile
  14053. Specify font file for use with freetype to draw the axis. If not specified,
  14054. use embedded font. Note that drawing with font file or embedded font is not
  14055. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  14056. option instead.
  14057. @item font
  14058. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  14059. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  14060. @item fontcolor
  14061. Specify font color expression. This is arithmetic expression that should return
  14062. integer value 0xRRGGBB. It can contain variables:
  14063. @table @option
  14064. @item frequency, freq, f
  14065. the frequency where it is evaluated
  14066. @item timeclamp, tc
  14067. the value of @var{timeclamp} option
  14068. @end table
  14069. and functions:
  14070. @table @option
  14071. @item midi(f)
  14072. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  14073. @item r(x), g(x), b(x)
  14074. red, green, and blue value of intensity x.
  14075. @end table
  14076. Default value is @code{st(0, (midi(f)-59.5)/12);
  14077. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  14078. r(1-ld(1)) + b(ld(1))}.
  14079. @item axisfile
  14080. Specify image file to draw the axis. This option override @var{fontfile} and
  14081. @var{fontcolor} option.
  14082. @item axis, text
  14083. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  14084. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  14085. Default value is @code{1}.
  14086. @item csp
  14087. Set colorspace. The accepted values are:
  14088. @table @samp
  14089. @item unspecified
  14090. Unspecified (default)
  14091. @item bt709
  14092. BT.709
  14093. @item fcc
  14094. FCC
  14095. @item bt470bg
  14096. BT.470BG or BT.601-6 625
  14097. @item smpte170m
  14098. SMPTE-170M or BT.601-6 525
  14099. @item smpte240m
  14100. SMPTE-240M
  14101. @item bt2020ncl
  14102. BT.2020 with non-constant luminance
  14103. @end table
  14104. @item cscheme
  14105. Set spectrogram color scheme. This is list of floating point values with format
  14106. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  14107. The default is @code{1|0.5|0|0|0.5|1}.
  14108. @end table
  14109. @subsection Examples
  14110. @itemize
  14111. @item
  14112. Playing audio while showing the spectrum:
  14113. @example
  14114. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  14115. @end example
  14116. @item
  14117. Same as above, but with frame rate 30 fps:
  14118. @example
  14119. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  14120. @end example
  14121. @item
  14122. Playing at 1280x720:
  14123. @example
  14124. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  14125. @end example
  14126. @item
  14127. Disable sonogram display:
  14128. @example
  14129. sono_h=0
  14130. @end example
  14131. @item
  14132. A1 and its harmonics: A1, A2, (near)E3, A3:
  14133. @example
  14134. 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),
  14135. asplit[a][out1]; [a] showcqt [out0]'
  14136. @end example
  14137. @item
  14138. Same as above, but with more accuracy in frequency domain:
  14139. @example
  14140. 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),
  14141. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  14142. @end example
  14143. @item
  14144. Custom volume:
  14145. @example
  14146. bar_v=10:sono_v=bar_v*a_weighting(f)
  14147. @end example
  14148. @item
  14149. Custom gamma, now spectrum is linear to the amplitude.
  14150. @example
  14151. bar_g=2:sono_g=2
  14152. @end example
  14153. @item
  14154. Custom tlength equation:
  14155. @example
  14156. 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)))'
  14157. @end example
  14158. @item
  14159. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  14160. @example
  14161. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  14162. @end example
  14163. @item
  14164. Custom font using fontconfig:
  14165. @example
  14166. font='Courier New,Monospace,mono|bold'
  14167. @end example
  14168. @item
  14169. Custom frequency range with custom axis using image file:
  14170. @example
  14171. axisfile=myaxis.png:basefreq=40:endfreq=10000
  14172. @end example
  14173. @end itemize
  14174. @section showfreqs
  14175. Convert input audio to video output representing the audio power spectrum.
  14176. Audio amplitude is on Y-axis while frequency is on X-axis.
  14177. The filter accepts the following options:
  14178. @table @option
  14179. @item size, s
  14180. Specify size of video. For the syntax of this option, check the
  14181. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14182. Default is @code{1024x512}.
  14183. @item mode
  14184. Set display mode.
  14185. This set how each frequency bin will be represented.
  14186. It accepts the following values:
  14187. @table @samp
  14188. @item line
  14189. @item bar
  14190. @item dot
  14191. @end table
  14192. Default is @code{bar}.
  14193. @item ascale
  14194. Set amplitude scale.
  14195. It accepts the following values:
  14196. @table @samp
  14197. @item lin
  14198. Linear scale.
  14199. @item sqrt
  14200. Square root scale.
  14201. @item cbrt
  14202. Cubic root scale.
  14203. @item log
  14204. Logarithmic scale.
  14205. @end table
  14206. Default is @code{log}.
  14207. @item fscale
  14208. Set frequency scale.
  14209. It accepts the following values:
  14210. @table @samp
  14211. @item lin
  14212. Linear scale.
  14213. @item log
  14214. Logarithmic scale.
  14215. @item rlog
  14216. Reverse logarithmic scale.
  14217. @end table
  14218. Default is @code{lin}.
  14219. @item win_size
  14220. Set window size.
  14221. It accepts the following values:
  14222. @table @samp
  14223. @item w16
  14224. @item w32
  14225. @item w64
  14226. @item w128
  14227. @item w256
  14228. @item w512
  14229. @item w1024
  14230. @item w2048
  14231. @item w4096
  14232. @item w8192
  14233. @item w16384
  14234. @item w32768
  14235. @item w65536
  14236. @end table
  14237. Default is @code{w2048}
  14238. @item win_func
  14239. Set windowing function.
  14240. It accepts the following values:
  14241. @table @samp
  14242. @item rect
  14243. @item bartlett
  14244. @item hanning
  14245. @item hamming
  14246. @item blackman
  14247. @item welch
  14248. @item flattop
  14249. @item bharris
  14250. @item bnuttall
  14251. @item bhann
  14252. @item sine
  14253. @item nuttall
  14254. @item lanczos
  14255. @item gauss
  14256. @item tukey
  14257. @item dolph
  14258. @item cauchy
  14259. @item parzen
  14260. @item poisson
  14261. @end table
  14262. Default is @code{hanning}.
  14263. @item overlap
  14264. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14265. which means optimal overlap for selected window function will be picked.
  14266. @item averaging
  14267. Set time averaging. Setting this to 0 will display current maximal peaks.
  14268. Default is @code{1}, which means time averaging is disabled.
  14269. @item colors
  14270. Specify list of colors separated by space or by '|' which will be used to
  14271. draw channel frequencies. Unrecognized or missing colors will be replaced
  14272. by white color.
  14273. @item cmode
  14274. Set channel display mode.
  14275. It accepts the following values:
  14276. @table @samp
  14277. @item combined
  14278. @item separate
  14279. @end table
  14280. Default is @code{combined}.
  14281. @item minamp
  14282. Set minimum amplitude used in @code{log} amplitude scaler.
  14283. @end table
  14284. @anchor{showspectrum}
  14285. @section showspectrum
  14286. Convert input audio to a video output, representing the audio frequency
  14287. spectrum.
  14288. The filter accepts the following options:
  14289. @table @option
  14290. @item size, s
  14291. Specify the video size for the output. For the syntax of this option, check the
  14292. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14293. Default value is @code{640x512}.
  14294. @item slide
  14295. Specify how the spectrum should slide along the window.
  14296. It accepts the following values:
  14297. @table @samp
  14298. @item replace
  14299. the samples start again on the left when they reach the right
  14300. @item scroll
  14301. the samples scroll from right to left
  14302. @item fullframe
  14303. frames are only produced when the samples reach the right
  14304. @item rscroll
  14305. the samples scroll from left to right
  14306. @end table
  14307. Default value is @code{replace}.
  14308. @item mode
  14309. Specify display mode.
  14310. It accepts the following values:
  14311. @table @samp
  14312. @item combined
  14313. all channels are displayed in the same row
  14314. @item separate
  14315. all channels are displayed in separate rows
  14316. @end table
  14317. Default value is @samp{combined}.
  14318. @item color
  14319. Specify display color mode.
  14320. It accepts the following values:
  14321. @table @samp
  14322. @item channel
  14323. each channel is displayed in a separate color
  14324. @item intensity
  14325. each channel is displayed using the same color scheme
  14326. @item rainbow
  14327. each channel is displayed using the rainbow color scheme
  14328. @item moreland
  14329. each channel is displayed using the moreland color scheme
  14330. @item nebulae
  14331. each channel is displayed using the nebulae color scheme
  14332. @item fire
  14333. each channel is displayed using the fire color scheme
  14334. @item fiery
  14335. each channel is displayed using the fiery color scheme
  14336. @item fruit
  14337. each channel is displayed using the fruit color scheme
  14338. @item cool
  14339. each channel is displayed using the cool color scheme
  14340. @end table
  14341. Default value is @samp{channel}.
  14342. @item scale
  14343. Specify scale used for calculating intensity color values.
  14344. It accepts the following values:
  14345. @table @samp
  14346. @item lin
  14347. linear
  14348. @item sqrt
  14349. square root, default
  14350. @item cbrt
  14351. cubic root
  14352. @item log
  14353. logarithmic
  14354. @item 4thrt
  14355. 4th root
  14356. @item 5thrt
  14357. 5th root
  14358. @end table
  14359. Default value is @samp{sqrt}.
  14360. @item saturation
  14361. Set saturation modifier for displayed colors. Negative values provide
  14362. alternative color scheme. @code{0} is no saturation at all.
  14363. Saturation must be in [-10.0, 10.0] range.
  14364. Default value is @code{1}.
  14365. @item win_func
  14366. Set window function.
  14367. It accepts the following values:
  14368. @table @samp
  14369. @item rect
  14370. @item bartlett
  14371. @item hann
  14372. @item hanning
  14373. @item hamming
  14374. @item blackman
  14375. @item welch
  14376. @item flattop
  14377. @item bharris
  14378. @item bnuttall
  14379. @item bhann
  14380. @item sine
  14381. @item nuttall
  14382. @item lanczos
  14383. @item gauss
  14384. @item tukey
  14385. @item dolph
  14386. @item cauchy
  14387. @item parzen
  14388. @item poisson
  14389. @end table
  14390. Default value is @code{hann}.
  14391. @item orientation
  14392. Set orientation of time vs frequency axis. Can be @code{vertical} or
  14393. @code{horizontal}. Default is @code{vertical}.
  14394. @item overlap
  14395. Set ratio of overlap window. Default value is @code{0}.
  14396. When value is @code{1} overlap is set to recommended size for specific
  14397. window function currently used.
  14398. @item gain
  14399. Set scale gain for calculating intensity color values.
  14400. Default value is @code{1}.
  14401. @item data
  14402. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  14403. @item rotation
  14404. Set color rotation, must be in [-1.0, 1.0] range.
  14405. Default value is @code{0}.
  14406. @end table
  14407. The usage is very similar to the showwaves filter; see the examples in that
  14408. section.
  14409. @subsection Examples
  14410. @itemize
  14411. @item
  14412. Large window with logarithmic color scaling:
  14413. @example
  14414. showspectrum=s=1280x480:scale=log
  14415. @end example
  14416. @item
  14417. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  14418. @example
  14419. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  14420. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  14421. @end example
  14422. @end itemize
  14423. @section showspectrumpic
  14424. Convert input audio to a single video frame, representing the audio frequency
  14425. spectrum.
  14426. The filter accepts the following options:
  14427. @table @option
  14428. @item size, s
  14429. Specify the video size for the output. For the syntax of this option, check the
  14430. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14431. Default value is @code{4096x2048}.
  14432. @item mode
  14433. Specify display mode.
  14434. It accepts the following values:
  14435. @table @samp
  14436. @item combined
  14437. all channels are displayed in the same row
  14438. @item separate
  14439. all channels are displayed in separate rows
  14440. @end table
  14441. Default value is @samp{combined}.
  14442. @item color
  14443. Specify display color mode.
  14444. It accepts the following values:
  14445. @table @samp
  14446. @item channel
  14447. each channel is displayed in a separate color
  14448. @item intensity
  14449. each channel is displayed using the same color scheme
  14450. @item rainbow
  14451. each channel is displayed using the rainbow color scheme
  14452. @item moreland
  14453. each channel is displayed using the moreland color scheme
  14454. @item nebulae
  14455. each channel is displayed using the nebulae color scheme
  14456. @item fire
  14457. each channel is displayed using the fire color scheme
  14458. @item fiery
  14459. each channel is displayed using the fiery color scheme
  14460. @item fruit
  14461. each channel is displayed using the fruit color scheme
  14462. @item cool
  14463. each channel is displayed using the cool color scheme
  14464. @end table
  14465. Default value is @samp{intensity}.
  14466. @item scale
  14467. Specify scale used for calculating intensity color values.
  14468. It accepts the following values:
  14469. @table @samp
  14470. @item lin
  14471. linear
  14472. @item sqrt
  14473. square root, default
  14474. @item cbrt
  14475. cubic root
  14476. @item log
  14477. logarithmic
  14478. @item 4thrt
  14479. 4th root
  14480. @item 5thrt
  14481. 5th root
  14482. @end table
  14483. Default value is @samp{log}.
  14484. @item saturation
  14485. Set saturation modifier for displayed colors. Negative values provide
  14486. alternative color scheme. @code{0} is no saturation at all.
  14487. Saturation must be in [-10.0, 10.0] range.
  14488. Default value is @code{1}.
  14489. @item win_func
  14490. Set window function.
  14491. It accepts the following values:
  14492. @table @samp
  14493. @item rect
  14494. @item bartlett
  14495. @item hann
  14496. @item hanning
  14497. @item hamming
  14498. @item blackman
  14499. @item welch
  14500. @item flattop
  14501. @item bharris
  14502. @item bnuttall
  14503. @item bhann
  14504. @item sine
  14505. @item nuttall
  14506. @item lanczos
  14507. @item gauss
  14508. @item tukey
  14509. @item dolph
  14510. @item cauchy
  14511. @item parzen
  14512. @item poisson
  14513. @end table
  14514. Default value is @code{hann}.
  14515. @item orientation
  14516. Set orientation of time vs frequency axis. Can be @code{vertical} or
  14517. @code{horizontal}. Default is @code{vertical}.
  14518. @item gain
  14519. Set scale gain for calculating intensity color values.
  14520. Default value is @code{1}.
  14521. @item legend
  14522. Draw time and frequency axes and legends. Default is enabled.
  14523. @item rotation
  14524. Set color rotation, must be in [-1.0, 1.0] range.
  14525. Default value is @code{0}.
  14526. @end table
  14527. @subsection Examples
  14528. @itemize
  14529. @item
  14530. Extract an audio spectrogram of a whole audio track
  14531. in a 1024x1024 picture using @command{ffmpeg}:
  14532. @example
  14533. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  14534. @end example
  14535. @end itemize
  14536. @section showvolume
  14537. Convert input audio volume to a video output.
  14538. The filter accepts the following options:
  14539. @table @option
  14540. @item rate, r
  14541. Set video rate.
  14542. @item b
  14543. Set border width, allowed range is [0, 5]. Default is 1.
  14544. @item w
  14545. Set channel width, allowed range is [80, 8192]. Default is 400.
  14546. @item h
  14547. Set channel height, allowed range is [1, 900]. Default is 20.
  14548. @item f
  14549. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  14550. @item c
  14551. Set volume color expression.
  14552. The expression can use the following variables:
  14553. @table @option
  14554. @item VOLUME
  14555. Current max volume of channel in dB.
  14556. @item PEAK
  14557. Current peak.
  14558. @item CHANNEL
  14559. Current channel number, starting from 0.
  14560. @end table
  14561. @item t
  14562. If set, displays channel names. Default is enabled.
  14563. @item v
  14564. If set, displays volume values. Default is enabled.
  14565. @item o
  14566. Set orientation, can be @code{horizontal} or @code{vertical},
  14567. default is @code{horizontal}.
  14568. @item s
  14569. Set step size, allowed range s [0, 5]. Default is 0, which means
  14570. step is disabled.
  14571. @end table
  14572. @section showwaves
  14573. Convert input audio to a video output, representing the samples waves.
  14574. The filter accepts the following options:
  14575. @table @option
  14576. @item size, s
  14577. Specify the video size for the output. For the syntax of this option, check the
  14578. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14579. Default value is @code{600x240}.
  14580. @item mode
  14581. Set display mode.
  14582. Available values are:
  14583. @table @samp
  14584. @item point
  14585. Draw a point for each sample.
  14586. @item line
  14587. Draw a vertical line for each sample.
  14588. @item p2p
  14589. Draw a point for each sample and a line between them.
  14590. @item cline
  14591. Draw a centered vertical line for each sample.
  14592. @end table
  14593. Default value is @code{point}.
  14594. @item n
  14595. Set the number of samples which are printed on the same column. A
  14596. larger value will decrease the frame rate. Must be a positive
  14597. integer. This option can be set only if the value for @var{rate}
  14598. is not explicitly specified.
  14599. @item rate, r
  14600. Set the (approximate) output frame rate. This is done by setting the
  14601. option @var{n}. Default value is "25".
  14602. @item split_channels
  14603. Set if channels should be drawn separately or overlap. Default value is 0.
  14604. @item colors
  14605. Set colors separated by '|' which are going to be used for drawing of each channel.
  14606. @item scale
  14607. Set amplitude scale.
  14608. Available values are:
  14609. @table @samp
  14610. @item lin
  14611. Linear.
  14612. @item log
  14613. Logarithmic.
  14614. @item sqrt
  14615. Square root.
  14616. @item cbrt
  14617. Cubic root.
  14618. @end table
  14619. Default is linear.
  14620. @end table
  14621. @subsection Examples
  14622. @itemize
  14623. @item
  14624. Output the input file audio and the corresponding video representation
  14625. at the same time:
  14626. @example
  14627. amovie=a.mp3,asplit[out0],showwaves[out1]
  14628. @end example
  14629. @item
  14630. Create a synthetic signal and show it with showwaves, forcing a
  14631. frame rate of 30 frames per second:
  14632. @example
  14633. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  14634. @end example
  14635. @end itemize
  14636. @section showwavespic
  14637. Convert input audio to a single video frame, representing the samples waves.
  14638. The filter accepts the following options:
  14639. @table @option
  14640. @item size, s
  14641. Specify the video size for the output. For the syntax of this option, check the
  14642. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14643. Default value is @code{600x240}.
  14644. @item split_channels
  14645. Set if channels should be drawn separately or overlap. Default value is 0.
  14646. @item colors
  14647. Set colors separated by '|' which are going to be used for drawing of each channel.
  14648. @item scale
  14649. Set amplitude scale.
  14650. Available values are:
  14651. @table @samp
  14652. @item lin
  14653. Linear.
  14654. @item log
  14655. Logarithmic.
  14656. @item sqrt
  14657. Square root.
  14658. @item cbrt
  14659. Cubic root.
  14660. @end table
  14661. Default is linear.
  14662. @end table
  14663. @subsection Examples
  14664. @itemize
  14665. @item
  14666. Extract a channel split representation of the wave form of a whole audio track
  14667. in a 1024x800 picture using @command{ffmpeg}:
  14668. @example
  14669. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  14670. @end example
  14671. @end itemize
  14672. @section sidedata, asidedata
  14673. Delete frame side data, or select frames based on it.
  14674. This filter accepts the following options:
  14675. @table @option
  14676. @item mode
  14677. Set mode of operation of the filter.
  14678. Can be one of the following:
  14679. @table @samp
  14680. @item select
  14681. Select every frame with side data of @code{type}.
  14682. @item delete
  14683. Delete side data of @code{type}. If @code{type} is not set, delete all side
  14684. data in the frame.
  14685. @end table
  14686. @item type
  14687. Set side data type used with all modes. Must be set for @code{select} mode. For
  14688. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  14689. in @file{libavutil/frame.h}. For example, to choose
  14690. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  14691. @end table
  14692. @section spectrumsynth
  14693. Sythesize audio from 2 input video spectrums, first input stream represents
  14694. magnitude across time and second represents phase across time.
  14695. The filter will transform from frequency domain as displayed in videos back
  14696. to time domain as presented in audio output.
  14697. This filter is primarily created for reversing processed @ref{showspectrum}
  14698. filter outputs, but can synthesize sound from other spectrograms too.
  14699. But in such case results are going to be poor if the phase data is not
  14700. available, because in such cases phase data need to be recreated, usually
  14701. its just recreated from random noise.
  14702. For best results use gray only output (@code{channel} color mode in
  14703. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  14704. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  14705. @code{data} option. Inputs videos should generally use @code{fullframe}
  14706. slide mode as that saves resources needed for decoding video.
  14707. The filter accepts the following options:
  14708. @table @option
  14709. @item sample_rate
  14710. Specify sample rate of output audio, the sample rate of audio from which
  14711. spectrum was generated may differ.
  14712. @item channels
  14713. Set number of channels represented in input video spectrums.
  14714. @item scale
  14715. Set scale which was used when generating magnitude input spectrum.
  14716. Can be @code{lin} or @code{log}. Default is @code{log}.
  14717. @item slide
  14718. Set slide which was used when generating inputs spectrums.
  14719. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  14720. Default is @code{fullframe}.
  14721. @item win_func
  14722. Set window function used for resynthesis.
  14723. @item overlap
  14724. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14725. which means optimal overlap for selected window function will be picked.
  14726. @item orientation
  14727. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  14728. Default is @code{vertical}.
  14729. @end table
  14730. @subsection Examples
  14731. @itemize
  14732. @item
  14733. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  14734. then resynthesize videos back to audio with spectrumsynth:
  14735. @example
  14736. 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
  14737. 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
  14738. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  14739. @end example
  14740. @end itemize
  14741. @section split, asplit
  14742. Split input into several identical outputs.
  14743. @code{asplit} works with audio input, @code{split} with video.
  14744. The filter accepts a single parameter which specifies the number of outputs. If
  14745. unspecified, it defaults to 2.
  14746. @subsection Examples
  14747. @itemize
  14748. @item
  14749. Create two separate outputs from the same input:
  14750. @example
  14751. [in] split [out0][out1]
  14752. @end example
  14753. @item
  14754. To create 3 or more outputs, you need to specify the number of
  14755. outputs, like in:
  14756. @example
  14757. [in] asplit=3 [out0][out1][out2]
  14758. @end example
  14759. @item
  14760. Create two separate outputs from the same input, one cropped and
  14761. one padded:
  14762. @example
  14763. [in] split [splitout1][splitout2];
  14764. [splitout1] crop=100:100:0:0 [cropout];
  14765. [splitout2] pad=200:200:100:100 [padout];
  14766. @end example
  14767. @item
  14768. Create 5 copies of the input audio with @command{ffmpeg}:
  14769. @example
  14770. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  14771. @end example
  14772. @end itemize
  14773. @section zmq, azmq
  14774. Receive commands sent through a libzmq client, and forward them to
  14775. filters in the filtergraph.
  14776. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  14777. must be inserted between two video filters, @code{azmq} between two
  14778. audio filters.
  14779. To enable these filters you need to install the libzmq library and
  14780. headers and configure FFmpeg with @code{--enable-libzmq}.
  14781. For more information about libzmq see:
  14782. @url{http://www.zeromq.org/}
  14783. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  14784. receives messages sent through a network interface defined by the
  14785. @option{bind_address} option.
  14786. The received message must be in the form:
  14787. @example
  14788. @var{TARGET} @var{COMMAND} [@var{ARG}]
  14789. @end example
  14790. @var{TARGET} specifies the target of the command, usually the name of
  14791. the filter class or a specific filter instance name.
  14792. @var{COMMAND} specifies the name of the command for the target filter.
  14793. @var{ARG} is optional and specifies the optional argument list for the
  14794. given @var{COMMAND}.
  14795. Upon reception, the message is processed and the corresponding command
  14796. is injected into the filtergraph. Depending on the result, the filter
  14797. will send a reply to the client, adopting the format:
  14798. @example
  14799. @var{ERROR_CODE} @var{ERROR_REASON}
  14800. @var{MESSAGE}
  14801. @end example
  14802. @var{MESSAGE} is optional.
  14803. @subsection Examples
  14804. Look at @file{tools/zmqsend} for an example of a zmq client which can
  14805. be used to send commands processed by these filters.
  14806. Consider the following filtergraph generated by @command{ffplay}
  14807. @example
  14808. ffplay -dumpgraph 1 -f lavfi "
  14809. color=s=100x100:c=red [l];
  14810. color=s=100x100:c=blue [r];
  14811. nullsrc=s=200x100, zmq [bg];
  14812. [bg][l] overlay [bg+l];
  14813. [bg+l][r] overlay=x=100 "
  14814. @end example
  14815. To change the color of the left side of the video, the following
  14816. command can be used:
  14817. @example
  14818. echo Parsed_color_0 c yellow | tools/zmqsend
  14819. @end example
  14820. To change the right side:
  14821. @example
  14822. echo Parsed_color_1 c pink | tools/zmqsend
  14823. @end example
  14824. @c man end MULTIMEDIA FILTERS
  14825. @chapter Multimedia Sources
  14826. @c man begin MULTIMEDIA SOURCES
  14827. Below is a description of the currently available multimedia sources.
  14828. @section amovie
  14829. This is the same as @ref{movie} source, except it selects an audio
  14830. stream by default.
  14831. @anchor{movie}
  14832. @section movie
  14833. Read audio and/or video stream(s) from a movie container.
  14834. It accepts the following parameters:
  14835. @table @option
  14836. @item filename
  14837. The name of the resource to read (not necessarily a file; it can also be a
  14838. device or a stream accessed through some protocol).
  14839. @item format_name, f
  14840. Specifies the format assumed for the movie to read, and can be either
  14841. the name of a container or an input device. If not specified, the
  14842. format is guessed from @var{movie_name} or by probing.
  14843. @item seek_point, sp
  14844. Specifies the seek point in seconds. The frames will be output
  14845. starting from this seek point. The parameter is evaluated with
  14846. @code{av_strtod}, so the numerical value may be suffixed by an IS
  14847. postfix. The default value is "0".
  14848. @item streams, s
  14849. Specifies the streams to read. Several streams can be specified,
  14850. separated by "+". The source will then have as many outputs, in the
  14851. same order. The syntax is explained in the ``Stream specifiers''
  14852. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  14853. respectively the default (best suited) video and audio stream. Default
  14854. is "dv", or "da" if the filter is called as "amovie".
  14855. @item stream_index, si
  14856. Specifies the index of the video stream to read. If the value is -1,
  14857. the most suitable video stream will be automatically selected. The default
  14858. value is "-1". Deprecated. If the filter is called "amovie", it will select
  14859. audio instead of video.
  14860. @item loop
  14861. Specifies how many times to read the stream in sequence.
  14862. If the value is 0, the stream will be looped infinitely.
  14863. Default value is "1".
  14864. Note that when the movie is looped the source timestamps are not
  14865. changed, so it will generate non monotonically increasing timestamps.
  14866. @item discontinuity
  14867. Specifies the time difference between frames above which the point is
  14868. considered a timestamp discontinuity which is removed by adjusting the later
  14869. timestamps.
  14870. @end table
  14871. It allows overlaying a second video on top of the main input of
  14872. a filtergraph, as shown in this graph:
  14873. @example
  14874. input -----------> deltapts0 --> overlay --> output
  14875. ^
  14876. |
  14877. movie --> scale--> deltapts1 -------+
  14878. @end example
  14879. @subsection Examples
  14880. @itemize
  14881. @item
  14882. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  14883. on top of the input labelled "in":
  14884. @example
  14885. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  14886. [in] setpts=PTS-STARTPTS [main];
  14887. [main][over] overlay=16:16 [out]
  14888. @end example
  14889. @item
  14890. Read from a video4linux2 device, and overlay it on top of the input
  14891. labelled "in":
  14892. @example
  14893. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  14894. [in] setpts=PTS-STARTPTS [main];
  14895. [main][over] overlay=16:16 [out]
  14896. @end example
  14897. @item
  14898. Read the first video stream and the audio stream with id 0x81 from
  14899. dvd.vob; the video is connected to the pad named "video" and the audio is
  14900. connected to the pad named "audio":
  14901. @example
  14902. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  14903. @end example
  14904. @end itemize
  14905. @subsection Commands
  14906. Both movie and amovie support the following commands:
  14907. @table @option
  14908. @item seek
  14909. Perform seek using "av_seek_frame".
  14910. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  14911. @itemize
  14912. @item
  14913. @var{stream_index}: If stream_index is -1, a default
  14914. stream is selected, and @var{timestamp} is automatically converted
  14915. from AV_TIME_BASE units to the stream specific time_base.
  14916. @item
  14917. @var{timestamp}: Timestamp in AVStream.time_base units
  14918. or, if no stream is specified, in AV_TIME_BASE units.
  14919. @item
  14920. @var{flags}: Flags which select direction and seeking mode.
  14921. @end itemize
  14922. @item get_duration
  14923. Get movie duration in AV_TIME_BASE units.
  14924. @end table
  14925. @c man end MULTIMEDIA SOURCES