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.

19570 lines
519KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @section Notes on filtergraph escaping
  181. Filtergraph description composition entails several levels of
  182. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  183. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  184. information about the employed escaping procedure.
  185. A first level escaping affects the content of each filter option
  186. value, which may contain the special character @code{:} used to
  187. separate values, or one of the escaping characters @code{\'}.
  188. A second level escaping affects the whole filter description, which
  189. may contain the escaping characters @code{\'} or the special
  190. characters @code{[],;} used by the filtergraph description.
  191. Finally, when you specify a filtergraph on a shell commandline, you
  192. need to perform a third level escaping for the shell special
  193. characters contained within it.
  194. For example, consider the following string to be embedded in
  195. the @ref{drawtext} filter description @option{text} value:
  196. @example
  197. this is a 'string': may contain one, or more, special characters
  198. @end example
  199. This string contains the @code{'} special escaping character, and the
  200. @code{:} special character, so it needs to be escaped in this way:
  201. @example
  202. text=this is a \'string\'\: may contain one, or more, special characters
  203. @end example
  204. A second level of escaping is required when embedding the filter
  205. description in a filtergraph description, in order to escape all the
  206. filtergraph special characters. Thus the example above becomes:
  207. @example
  208. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  209. @end example
  210. (note that in addition to the @code{\'} escaping special characters,
  211. also @code{,} needs to be escaped).
  212. Finally an additional level of escaping is needed when writing the
  213. filtergraph description in a shell command, which depends on the
  214. escaping rules of the adopted shell. For example, assuming that
  215. @code{\} is special and needs to be escaped with another @code{\}, the
  216. previous string will finally result in:
  217. @example
  218. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  219. @end example
  220. @chapter Timeline editing
  221. Some filters support a generic @option{enable} option. For the filters
  222. supporting timeline editing, this option can be set to an expression which is
  223. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  224. the filter will be enabled, otherwise the frame will be sent unchanged to the
  225. next filter in the filtergraph.
  226. The expression accepts the following values:
  227. @table @samp
  228. @item t
  229. timestamp expressed in seconds, NAN if the input timestamp is unknown
  230. @item n
  231. sequential number of the input frame, starting from 0
  232. @item pos
  233. the position in the file of the input frame, NAN if unknown
  234. @item w
  235. @item h
  236. width and height of the input frame if video
  237. @end table
  238. Additionally, these filters support an @option{enable} command that can be used
  239. to re-define the expression.
  240. Like any other filtering option, the @option{enable} option follows the same
  241. rules.
  242. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  243. minutes, and a @ref{curves} filter starting at 3 seconds:
  244. @example
  245. smartblur = enable='between(t,10,3*60)',
  246. curves = enable='gte(t,3)' : preset=cross_process
  247. @end example
  248. See @code{ffmpeg -filters} to view which filters have timeline support.
  249. @c man end FILTERGRAPH DESCRIPTION
  250. @anchor{framesync}
  251. @chapter Options for filters with several inputs (framesync)
  252. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  253. Some filters with several inputs support a common set of options.
  254. These options can only be set by name, not with the short notation.
  255. @table @option
  256. @item eof_action
  257. The action to take when EOF is encountered on the secondary input; it accepts
  258. one of the following values:
  259. @table @option
  260. @item repeat
  261. Repeat the last frame (the default).
  262. @item endall
  263. End both streams.
  264. @item pass
  265. Pass the main input through.
  266. @end table
  267. @item shortest
  268. If set to 1, force the output to terminate when the shortest input
  269. terminates. Default value is 0.
  270. @item repeatlast
  271. If set to 1, force the filter to extend the last frame of secondary streams
  272. until the end of the primary stream. A value of 0 disables this behavior.
  273. Default value is 1.
  274. @end table
  275. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  276. @chapter Audio Filters
  277. @c man begin AUDIO FILTERS
  278. When you configure your FFmpeg build, you can disable any of the
  279. existing filters using @code{--disable-filters}.
  280. The configure output will show the audio filters included in your
  281. build.
  282. Below is a description of the currently available audio filters.
  283. @section acompressor
  284. A compressor is mainly used to reduce the dynamic range of a signal.
  285. Especially modern music is mostly compressed at a high ratio to
  286. improve the overall loudness. It's done to get the highest attention
  287. of a listener, "fatten" the sound and bring more "power" to the track.
  288. If a signal is compressed too much it may sound dull or "dead"
  289. afterwards or it may start to "pump" (which could be a powerful effect
  290. but can also destroy a track completely).
  291. The right compression is the key to reach a professional sound and is
  292. the high art of mixing and mastering. Because of its complex settings
  293. it may take a long time to get the right feeling for this kind of effect.
  294. Compression is done by detecting the volume above a chosen level
  295. @code{threshold} and dividing it by the factor set with @code{ratio}.
  296. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  297. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  298. the signal would cause distortion of the waveform the reduction can be
  299. levelled over the time. This is done by setting "Attack" and "Release".
  300. @code{attack} determines how long the signal has to rise above the threshold
  301. before any reduction will occur and @code{release} sets the time the signal
  302. has to fall below the threshold to reduce the reduction again. Shorter signals
  303. than the chosen attack time will be left untouched.
  304. The overall reduction of the signal can be made up afterwards with the
  305. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  306. raising the makeup to this level results in a signal twice as loud than the
  307. source. To gain a softer entry in the compression the @code{knee} flattens the
  308. hard edge at the threshold in the range of the chosen decibels.
  309. The filter accepts the following options:
  310. @table @option
  311. @item level_in
  312. Set input gain. Default is 1. Range is between 0.015625 and 64.
  313. @item threshold
  314. If a signal of stream rises above this level it will affect the gain
  315. reduction.
  316. By default it is 0.125. Range is between 0.00097563 and 1.
  317. @item ratio
  318. Set a ratio by which the signal is reduced. 1:2 means that if the level
  319. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  320. Default is 2. Range is between 1 and 20.
  321. @item attack
  322. Amount of milliseconds the signal has to rise above the threshold before gain
  323. reduction starts. Default is 20. Range is between 0.01 and 2000.
  324. @item release
  325. Amount of milliseconds the signal has to fall below the threshold before
  326. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  327. @item makeup
  328. Set the amount by how much signal will be amplified after processing.
  329. Default is 1. Range is from 1 to 64.
  330. @item knee
  331. Curve the sharp knee around the threshold to enter gain reduction more softly.
  332. Default is 2.82843. Range is between 1 and 8.
  333. @item link
  334. Choose if the @code{average} level between all channels of input stream
  335. or the louder(@code{maximum}) channel of input stream affects the
  336. reduction. Default is @code{average}.
  337. @item detection
  338. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  339. of @code{rms}. Default is @code{rms} which is mostly smoother.
  340. @item mix
  341. How much to use compressed signal in output. Default is 1.
  342. Range is between 0 and 1.
  343. @end table
  344. @section acontrast
  345. Simple audio dynamic range commpression/expansion filter.
  346. The filter accepts the following options:
  347. @table @option
  348. @item contrast
  349. Set contrast. Default is 33. Allowed range is between 0 and 100.
  350. @end table
  351. @section acopy
  352. Copy the input audio source unchanged to the output. This is mainly useful for
  353. testing purposes.
  354. @section acrossfade
  355. Apply cross fade from one input audio stream to another input audio stream.
  356. The cross fade is applied for specified duration near the end of first stream.
  357. The filter accepts the following options:
  358. @table @option
  359. @item nb_samples, ns
  360. Specify the number of samples for which the cross fade effect has to last.
  361. At the end of the cross fade effect the first input audio will be completely
  362. silent. Default is 44100.
  363. @item duration, d
  364. Specify the duration of the cross fade effect. See
  365. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  366. for the accepted syntax.
  367. By default the duration is determined by @var{nb_samples}.
  368. If set this option is used instead of @var{nb_samples}.
  369. @item overlap, o
  370. Should first stream end overlap with second stream start. Default is enabled.
  371. @item curve1
  372. Set curve for cross fade transition for first stream.
  373. @item curve2
  374. Set curve for cross fade transition for second stream.
  375. For description of available curve types see @ref{afade} filter description.
  376. @end table
  377. @subsection Examples
  378. @itemize
  379. @item
  380. Cross fade from one input to another:
  381. @example
  382. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  383. @end example
  384. @item
  385. Cross fade from one input to another but without overlapping:
  386. @example
  387. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  388. @end example
  389. @end itemize
  390. @section acrusher
  391. Reduce audio bit resolution.
  392. This filter is bit crusher with enhanced functionality. A bit crusher
  393. is used to audibly reduce number of bits an audio signal is sampled
  394. with. This doesn't change the bit depth at all, it just produces the
  395. effect. Material reduced in bit depth sounds more harsh and "digital".
  396. This filter is able to even round to continuous values instead of discrete
  397. bit depths.
  398. Additionally it has a D/C offset which results in different crushing of
  399. the lower and the upper half of the signal.
  400. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  401. Another feature of this filter is the logarithmic mode.
  402. This setting switches from linear distances between bits to logarithmic ones.
  403. The result is a much more "natural" sounding crusher which doesn't gate low
  404. signals for example. The human ear has a logarithmic perception, too
  405. so this kind of crushing is much more pleasant.
  406. Logarithmic crushing is also able to get anti-aliased.
  407. The filter accepts the following options:
  408. @table @option
  409. @item level_in
  410. Set level in.
  411. @item level_out
  412. Set level out.
  413. @item bits
  414. Set bit reduction.
  415. @item mix
  416. Set mixing amount.
  417. @item mode
  418. Can be linear: @code{lin} or logarithmic: @code{log}.
  419. @item dc
  420. Set DC.
  421. @item aa
  422. Set anti-aliasing.
  423. @item samples
  424. Set sample reduction.
  425. @item lfo
  426. Enable LFO. By default disabled.
  427. @item lforange
  428. Set LFO range.
  429. @item lforate
  430. Set LFO rate.
  431. @end table
  432. @section adelay
  433. Delay one or more audio channels.
  434. Samples in delayed channel are filled with silence.
  435. The filter accepts the following option:
  436. @table @option
  437. @item delays
  438. Set list of delays in milliseconds for each channel separated by '|'.
  439. Unused delays will be silently ignored. If number of given delays is
  440. smaller than number of channels all remaining channels will not be delayed.
  441. If you want to delay exact number of samples, append 'S' to number.
  442. @end table
  443. @subsection Examples
  444. @itemize
  445. @item
  446. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  447. the second channel (and any other channels that may be present) unchanged.
  448. @example
  449. adelay=1500|0|500
  450. @end example
  451. @item
  452. Delay second channel by 500 samples, the third channel by 700 samples and leave
  453. the first channel (and any other channels that may be present) unchanged.
  454. @example
  455. adelay=0|500S|700S
  456. @end example
  457. @end itemize
  458. @section aecho
  459. Apply echoing to the input audio.
  460. Echoes are reflected sound and can occur naturally amongst mountains
  461. (and sometimes large buildings) when talking or shouting; digital echo
  462. effects emulate this behaviour and are often used to help fill out the
  463. sound of a single instrument or vocal. The time difference between the
  464. original signal and the reflection is the @code{delay}, and the
  465. loudness of the reflected signal is the @code{decay}.
  466. Multiple echoes can have different delays and decays.
  467. A description of the accepted parameters follows.
  468. @table @option
  469. @item in_gain
  470. Set input gain of reflected signal. Default is @code{0.6}.
  471. @item out_gain
  472. Set output gain of reflected signal. Default is @code{0.3}.
  473. @item delays
  474. Set list of time intervals in milliseconds between original signal and reflections
  475. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  476. Default is @code{1000}.
  477. @item decays
  478. Set list of loudness of reflected signals separated by '|'.
  479. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  480. Default is @code{0.5}.
  481. @end table
  482. @subsection Examples
  483. @itemize
  484. @item
  485. Make it sound as if there are twice as many instruments as are actually playing:
  486. @example
  487. aecho=0.8:0.88:60:0.4
  488. @end example
  489. @item
  490. If delay is very short, then it sound like a (metallic) robot playing music:
  491. @example
  492. aecho=0.8:0.88:6:0.4
  493. @end example
  494. @item
  495. A longer delay will sound like an open air concert in the mountains:
  496. @example
  497. aecho=0.8:0.9:1000:0.3
  498. @end example
  499. @item
  500. Same as above but with one more mountain:
  501. @example
  502. aecho=0.8:0.9:1000|1800:0.3|0.25
  503. @end example
  504. @end itemize
  505. @section aemphasis
  506. Audio emphasis filter creates or restores material directly taken from LPs or
  507. emphased CDs with different filter curves. E.g. to store music on vinyl the
  508. signal has to be altered by a filter first to even out the disadvantages of
  509. this recording medium.
  510. Once the material is played back the inverse filter has to be applied to
  511. restore the distortion of the frequency response.
  512. The filter accepts the following options:
  513. @table @option
  514. @item level_in
  515. Set input gain.
  516. @item level_out
  517. Set output gain.
  518. @item mode
  519. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  520. use @code{production} mode. Default is @code{reproduction} mode.
  521. @item type
  522. Set filter type. Selects medium. Can be one of the following:
  523. @table @option
  524. @item col
  525. select Columbia.
  526. @item emi
  527. select EMI.
  528. @item bsi
  529. select BSI (78RPM).
  530. @item riaa
  531. select RIAA.
  532. @item cd
  533. select Compact Disc (CD).
  534. @item 50fm
  535. select 50µs (FM).
  536. @item 75fm
  537. select 75µs (FM).
  538. @item 50kf
  539. select 50µs (FM-KF).
  540. @item 75kf
  541. select 75µs (FM-KF).
  542. @end table
  543. @end table
  544. @section aeval
  545. Modify an audio signal according to the specified expressions.
  546. This filter accepts one or more expressions (one for each channel),
  547. which are evaluated and used to modify a corresponding audio signal.
  548. It accepts the following parameters:
  549. @table @option
  550. @item exprs
  551. Set the '|'-separated expressions list for each separate channel. If
  552. the number of input channels is greater than the number of
  553. expressions, the last specified expression is used for the remaining
  554. output channels.
  555. @item channel_layout, c
  556. Set output channel layout. If not specified, the channel layout is
  557. specified by the number of expressions. If set to @samp{same}, it will
  558. use by default the same input channel layout.
  559. @end table
  560. Each expression in @var{exprs} can contain the following constants and functions:
  561. @table @option
  562. @item ch
  563. channel number of the current expression
  564. @item n
  565. number of the evaluated sample, starting from 0
  566. @item s
  567. sample rate
  568. @item t
  569. time of the evaluated sample expressed in seconds
  570. @item nb_in_channels
  571. @item nb_out_channels
  572. input and output number of channels
  573. @item val(CH)
  574. the value of input channel with number @var{CH}
  575. @end table
  576. Note: this filter is slow. For faster processing you should use a
  577. dedicated filter.
  578. @subsection Examples
  579. @itemize
  580. @item
  581. Half volume:
  582. @example
  583. aeval=val(ch)/2:c=same
  584. @end example
  585. @item
  586. Invert phase of the second channel:
  587. @example
  588. aeval=val(0)|-val(1)
  589. @end example
  590. @end itemize
  591. @anchor{afade}
  592. @section afade
  593. Apply fade-in/out effect to input audio.
  594. A description of the accepted parameters follows.
  595. @table @option
  596. @item type, t
  597. Specify the effect type, can be either @code{in} for fade-in, or
  598. @code{out} for a fade-out effect. Default is @code{in}.
  599. @item start_sample, ss
  600. Specify the number of the start sample for starting to apply the fade
  601. effect. Default is 0.
  602. @item nb_samples, ns
  603. Specify the number of samples for which the fade effect has to last. At
  604. the end of the fade-in effect the output audio will have the same
  605. volume as the input audio, at the end of the fade-out transition
  606. the output audio will be silence. Default is 44100.
  607. @item start_time, st
  608. Specify the start time of the fade effect. Default is 0.
  609. The value must be specified as a time duration; see
  610. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  611. for the accepted syntax.
  612. If set this option is used instead of @var{start_sample}.
  613. @item duration, d
  614. Specify the duration of the fade effect. See
  615. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  616. for the accepted syntax.
  617. At the end of the fade-in effect the output audio will have the same
  618. volume as the input audio, at the end of the fade-out transition
  619. the output audio will be silence.
  620. By default the duration is determined by @var{nb_samples}.
  621. If set this option is used instead of @var{nb_samples}.
  622. @item curve
  623. Set curve for fade transition.
  624. It accepts the following values:
  625. @table @option
  626. @item tri
  627. select triangular, linear slope (default)
  628. @item qsin
  629. select quarter of sine wave
  630. @item hsin
  631. select half of sine wave
  632. @item esin
  633. select exponential sine wave
  634. @item log
  635. select logarithmic
  636. @item ipar
  637. select inverted parabola
  638. @item qua
  639. select quadratic
  640. @item cub
  641. select cubic
  642. @item squ
  643. select square root
  644. @item cbr
  645. select cubic root
  646. @item par
  647. select parabola
  648. @item exp
  649. select exponential
  650. @item iqsin
  651. select inverted quarter of sine wave
  652. @item ihsin
  653. select inverted half of sine wave
  654. @item dese
  655. select double-exponential seat
  656. @item desi
  657. select double-exponential sigmoid
  658. @end table
  659. @end table
  660. @subsection Examples
  661. @itemize
  662. @item
  663. Fade in first 15 seconds of audio:
  664. @example
  665. afade=t=in:ss=0:d=15
  666. @end example
  667. @item
  668. Fade out last 25 seconds of a 900 seconds audio:
  669. @example
  670. afade=t=out:st=875:d=25
  671. @end example
  672. @end itemize
  673. @section afftfilt
  674. Apply arbitrary expressions to samples in frequency domain.
  675. @table @option
  676. @item real
  677. Set frequency domain real expression for each separate channel separated
  678. by '|'. Default is "1".
  679. If the number of input channels is greater than the number of
  680. expressions, the last specified expression is used for the remaining
  681. output channels.
  682. @item imag
  683. Set frequency domain imaginary expression for each separate channel
  684. separated by '|'. If not set, @var{real} option is used.
  685. Each expression in @var{real} and @var{imag} can contain the following
  686. constants:
  687. @table @option
  688. @item sr
  689. sample rate
  690. @item b
  691. current frequency bin number
  692. @item nb
  693. number of available bins
  694. @item ch
  695. channel number of the current expression
  696. @item chs
  697. number of channels
  698. @item pts
  699. current frame pts
  700. @end table
  701. @item win_size
  702. Set window size.
  703. It accepts the following values:
  704. @table @samp
  705. @item w16
  706. @item w32
  707. @item w64
  708. @item w128
  709. @item w256
  710. @item w512
  711. @item w1024
  712. @item w2048
  713. @item w4096
  714. @item w8192
  715. @item w16384
  716. @item w32768
  717. @item w65536
  718. @end table
  719. Default is @code{w4096}
  720. @item win_func
  721. Set window function. Default is @code{hann}.
  722. @item overlap
  723. Set window overlap. If set to 1, the recommended overlap for selected
  724. window function will be picked. Default is @code{0.75}.
  725. @end table
  726. @subsection Examples
  727. @itemize
  728. @item
  729. Leave almost only low frequencies in audio:
  730. @example
  731. afftfilt="1-clip((b/nb)*b,0,1)"
  732. @end example
  733. @end itemize
  734. @section afir
  735. Apply an arbitrary Frequency Impulse Response filter.
  736. This filter is designed for applying long FIR filters,
  737. up to 30 seconds long.
  738. It can be used as component for digital crossover filters,
  739. room equalization, cross talk cancellation, wavefield synthesis,
  740. auralization, ambiophonics and ambisonics.
  741. This filter uses second stream as FIR coefficients.
  742. If second stream holds single channel, it will be used
  743. for all input channels in first stream, otherwise
  744. number of channels in second stream must be same as
  745. number of channels in first stream.
  746. It accepts the following parameters:
  747. @table @option
  748. @item dry
  749. Set dry gain. This sets input gain.
  750. @item wet
  751. Set wet gain. This sets final output gain.
  752. @item length
  753. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  754. @item again
  755. Enable applying gain measured from power of IR.
  756. @end table
  757. @subsection Examples
  758. @itemize
  759. @item
  760. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  761. @example
  762. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  763. @end example
  764. @end itemize
  765. @anchor{aformat}
  766. @section aformat
  767. Set output format constraints for the input audio. The framework will
  768. negotiate the most appropriate format to minimize conversions.
  769. It accepts the following parameters:
  770. @table @option
  771. @item sample_fmts
  772. A '|'-separated list of requested sample formats.
  773. @item sample_rates
  774. A '|'-separated list of requested sample rates.
  775. @item channel_layouts
  776. A '|'-separated list of requested channel layouts.
  777. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  778. for the required syntax.
  779. @end table
  780. If a parameter is omitted, all values are allowed.
  781. Force the output to either unsigned 8-bit or signed 16-bit stereo
  782. @example
  783. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  784. @end example
  785. @section agate
  786. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  787. processing reduces disturbing noise between useful signals.
  788. Gating is done by detecting the volume below a chosen level @var{threshold}
  789. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  790. floor is set via @var{range}. Because an exact manipulation of the signal
  791. would cause distortion of the waveform the reduction can be levelled over
  792. time. This is done by setting @var{attack} and @var{release}.
  793. @var{attack} determines how long the signal has to fall below the threshold
  794. before any reduction will occur and @var{release} sets the time the signal
  795. has to rise above the threshold to reduce the reduction again.
  796. Shorter signals than the chosen attack time will be left untouched.
  797. @table @option
  798. @item level_in
  799. Set input level before filtering.
  800. Default is 1. Allowed range is from 0.015625 to 64.
  801. @item range
  802. Set the level of gain reduction when the signal is below the threshold.
  803. Default is 0.06125. Allowed range is from 0 to 1.
  804. @item threshold
  805. If a signal rises above this level the gain reduction is released.
  806. Default is 0.125. Allowed range is from 0 to 1.
  807. @item ratio
  808. Set a ratio by which the signal is reduced.
  809. Default is 2. Allowed range is from 1 to 9000.
  810. @item attack
  811. Amount of milliseconds the signal has to rise above the threshold before gain
  812. reduction stops.
  813. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  814. @item release
  815. Amount of milliseconds the signal has to fall below the threshold before the
  816. reduction is increased again. Default is 250 milliseconds.
  817. Allowed range is from 0.01 to 9000.
  818. @item makeup
  819. Set amount of amplification of signal after processing.
  820. Default is 1. Allowed range is from 1 to 64.
  821. @item knee
  822. Curve the sharp knee around the threshold to enter gain reduction more softly.
  823. Default is 2.828427125. Allowed range is from 1 to 8.
  824. @item detection
  825. Choose if exact signal should be taken for detection or an RMS like one.
  826. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  827. @item link
  828. Choose if the average level between all channels or the louder channel affects
  829. the reduction.
  830. Default is @code{average}. Can be @code{average} or @code{maximum}.
  831. @end table
  832. @section alimiter
  833. The limiter prevents an input signal from rising over a desired threshold.
  834. This limiter uses lookahead technology to prevent your signal from distorting.
  835. It means that there is a small delay after the signal is processed. Keep in mind
  836. that the delay it produces is the attack time you set.
  837. The filter accepts the following options:
  838. @table @option
  839. @item level_in
  840. Set input gain. Default is 1.
  841. @item level_out
  842. Set output gain. Default is 1.
  843. @item limit
  844. Don't let signals above this level pass the limiter. Default is 1.
  845. @item attack
  846. The limiter will reach its attenuation level in this amount of time in
  847. milliseconds. Default is 5 milliseconds.
  848. @item release
  849. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  850. Default is 50 milliseconds.
  851. @item asc
  852. When gain reduction is always needed ASC takes care of releasing to an
  853. average reduction level rather than reaching a reduction of 0 in the release
  854. time.
  855. @item asc_level
  856. Select how much the release time is affected by ASC, 0 means nearly no changes
  857. in release time while 1 produces higher release times.
  858. @item level
  859. Auto level output signal. Default is enabled.
  860. This normalizes audio back to 0dB if enabled.
  861. @end table
  862. Depending on picked setting it is recommended to upsample input 2x or 4x times
  863. with @ref{aresample} before applying this filter.
  864. @section allpass
  865. Apply a two-pole all-pass filter with central frequency (in Hz)
  866. @var{frequency}, and filter-width @var{width}.
  867. An all-pass filter changes the audio's frequency to phase relationship
  868. without changing its frequency to amplitude relationship.
  869. The filter accepts the following options:
  870. @table @option
  871. @item frequency, f
  872. Set frequency in Hz.
  873. @item width_type, t
  874. Set method to specify band-width of filter.
  875. @table @option
  876. @item h
  877. Hz
  878. @item q
  879. Q-Factor
  880. @item o
  881. octave
  882. @item s
  883. slope
  884. @end table
  885. @item width, w
  886. Specify the band-width of a filter in width_type units.
  887. @item channels, c
  888. Specify which channels to filter, by default all available are filtered.
  889. @end table
  890. @section aloop
  891. Loop audio samples.
  892. The filter accepts the following options:
  893. @table @option
  894. @item loop
  895. Set the number of loops.
  896. @item size
  897. Set maximal number of samples.
  898. @item start
  899. Set first sample of loop.
  900. @end table
  901. @anchor{amerge}
  902. @section amerge
  903. Merge two or more audio streams into a single multi-channel stream.
  904. The filter accepts the following options:
  905. @table @option
  906. @item inputs
  907. Set the number of inputs. Default is 2.
  908. @end table
  909. If the channel layouts of the inputs are disjoint, and therefore compatible,
  910. the channel layout of the output will be set accordingly and the channels
  911. will be reordered as necessary. If the channel layouts of the inputs are not
  912. disjoint, the output will have all the channels of the first input then all
  913. the channels of the second input, in that order, and the channel layout of
  914. the output will be the default value corresponding to the total number of
  915. channels.
  916. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  917. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  918. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  919. first input, b1 is the first channel of the second input).
  920. On the other hand, if both input are in stereo, the output channels will be
  921. in the default order: a1, a2, b1, b2, and the channel layout will be
  922. arbitrarily set to 4.0, which may or may not be the expected value.
  923. All inputs must have the same sample rate, and format.
  924. If inputs do not have the same duration, the output will stop with the
  925. shortest.
  926. @subsection Examples
  927. @itemize
  928. @item
  929. Merge two mono files into a stereo stream:
  930. @example
  931. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  932. @end example
  933. @item
  934. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  935. @example
  936. 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
  937. @end example
  938. @end itemize
  939. @section amix
  940. Mixes multiple audio inputs into a single output.
  941. Note that this filter only supports float samples (the @var{amerge}
  942. and @var{pan} audio filters support many formats). If the @var{amix}
  943. input has integer samples then @ref{aresample} will be automatically
  944. inserted to perform the conversion to float samples.
  945. For example
  946. @example
  947. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  948. @end example
  949. will mix 3 input audio streams to a single output with the same duration as the
  950. first input and a dropout transition time of 3 seconds.
  951. It accepts the following parameters:
  952. @table @option
  953. @item inputs
  954. The number of inputs. If unspecified, it defaults to 2.
  955. @item duration
  956. How to determine the end-of-stream.
  957. @table @option
  958. @item longest
  959. The duration of the longest input. (default)
  960. @item shortest
  961. The duration of the shortest input.
  962. @item first
  963. The duration of the first input.
  964. @end table
  965. @item dropout_transition
  966. The transition time, in seconds, for volume renormalization when an input
  967. stream ends. The default value is 2 seconds.
  968. @end table
  969. @section anequalizer
  970. High-order parametric multiband equalizer for each channel.
  971. It accepts the following parameters:
  972. @table @option
  973. @item params
  974. This option string is in format:
  975. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  976. Each equalizer band is separated by '|'.
  977. @table @option
  978. @item chn
  979. Set channel number to which equalization will be applied.
  980. If input doesn't have that channel the entry is ignored.
  981. @item f
  982. Set central frequency for band.
  983. If input doesn't have that frequency the entry is ignored.
  984. @item w
  985. Set band width in hertz.
  986. @item g
  987. Set band gain in dB.
  988. @item t
  989. Set filter type for band, optional, can be:
  990. @table @samp
  991. @item 0
  992. Butterworth, this is default.
  993. @item 1
  994. Chebyshev type 1.
  995. @item 2
  996. Chebyshev type 2.
  997. @end table
  998. @end table
  999. @item curves
  1000. With this option activated frequency response of anequalizer is displayed
  1001. in video stream.
  1002. @item size
  1003. Set video stream size. Only useful if curves option is activated.
  1004. @item mgain
  1005. Set max gain that will be displayed. Only useful if curves option is activated.
  1006. Setting this to a reasonable value makes it possible to display gain which is derived from
  1007. neighbour bands which are too close to each other and thus produce higher gain
  1008. when both are activated.
  1009. @item fscale
  1010. Set frequency scale used to draw frequency response in video output.
  1011. Can be linear or logarithmic. Default is logarithmic.
  1012. @item colors
  1013. Set color for each channel curve which is going to be displayed in video stream.
  1014. This is list of color names separated by space or by '|'.
  1015. Unrecognised or missing colors will be replaced by white color.
  1016. @end table
  1017. @subsection Examples
  1018. @itemize
  1019. @item
  1020. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1021. for first 2 channels using Chebyshev type 1 filter:
  1022. @example
  1023. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1024. @end example
  1025. @end itemize
  1026. @subsection Commands
  1027. This filter supports the following commands:
  1028. @table @option
  1029. @item change
  1030. Alter existing filter parameters.
  1031. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1032. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1033. error is returned.
  1034. @var{freq} set new frequency parameter.
  1035. @var{width} set new width parameter in herz.
  1036. @var{gain} set new gain parameter in dB.
  1037. Full filter invocation with asendcmd may look like this:
  1038. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1039. @end table
  1040. @section anull
  1041. Pass the audio source unchanged to the output.
  1042. @section apad
  1043. Pad the end of an audio stream with silence.
  1044. This can be used together with @command{ffmpeg} @option{-shortest} to
  1045. extend audio streams to the same length as the video stream.
  1046. A description of the accepted options follows.
  1047. @table @option
  1048. @item packet_size
  1049. Set silence packet size. Default value is 4096.
  1050. @item pad_len
  1051. Set the number of samples of silence to add to the end. After the
  1052. value is reached, the stream is terminated. This option is mutually
  1053. exclusive with @option{whole_len}.
  1054. @item whole_len
  1055. Set the minimum total number of samples in the output audio stream. If
  1056. the value is longer than the input audio length, silence is added to
  1057. the end, until the value is reached. This option is mutually exclusive
  1058. with @option{pad_len}.
  1059. @end table
  1060. If neither the @option{pad_len} nor the @option{whole_len} option is
  1061. set, the filter will add silence to the end of the input stream
  1062. indefinitely.
  1063. @subsection Examples
  1064. @itemize
  1065. @item
  1066. Add 1024 samples of silence to the end of the input:
  1067. @example
  1068. apad=pad_len=1024
  1069. @end example
  1070. @item
  1071. Make sure the audio output will contain at least 10000 samples, pad
  1072. the input with silence if required:
  1073. @example
  1074. apad=whole_len=10000
  1075. @end example
  1076. @item
  1077. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1078. video stream will always result the shortest and will be converted
  1079. until the end in the output file when using the @option{shortest}
  1080. option:
  1081. @example
  1082. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1083. @end example
  1084. @end itemize
  1085. @section aphaser
  1086. Add a phasing effect to the input audio.
  1087. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1088. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1089. A description of the accepted parameters follows.
  1090. @table @option
  1091. @item in_gain
  1092. Set input gain. Default is 0.4.
  1093. @item out_gain
  1094. Set output gain. Default is 0.74
  1095. @item delay
  1096. Set delay in milliseconds. Default is 3.0.
  1097. @item decay
  1098. Set decay. Default is 0.4.
  1099. @item speed
  1100. Set modulation speed in Hz. Default is 0.5.
  1101. @item type
  1102. Set modulation type. Default is triangular.
  1103. It accepts the following values:
  1104. @table @samp
  1105. @item triangular, t
  1106. @item sinusoidal, s
  1107. @end table
  1108. @end table
  1109. @section apulsator
  1110. Audio pulsator is something between an autopanner and a tremolo.
  1111. But it can produce funny stereo effects as well. Pulsator changes the volume
  1112. of the left and right channel based on a LFO (low frequency oscillator) with
  1113. different waveforms and shifted phases.
  1114. This filter have the ability to define an offset between left and right
  1115. channel. An offset of 0 means that both LFO shapes match each other.
  1116. The left and right channel are altered equally - a conventional tremolo.
  1117. An offset of 50% means that the shape of the right channel is exactly shifted
  1118. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1119. an autopanner. At 1 both curves match again. Every setting in between moves the
  1120. phase shift gapless between all stages and produces some "bypassing" sounds with
  1121. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1122. the 0.5) the faster the signal passes from the left to the right speaker.
  1123. The filter accepts the following options:
  1124. @table @option
  1125. @item level_in
  1126. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1127. @item level_out
  1128. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1129. @item mode
  1130. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1131. sawup or sawdown. Default is sine.
  1132. @item amount
  1133. Set modulation. Define how much of original signal is affected by the LFO.
  1134. @item offset_l
  1135. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1136. @item offset_r
  1137. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1138. @item width
  1139. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1140. @item timing
  1141. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1142. @item bpm
  1143. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1144. is set to bpm.
  1145. @item ms
  1146. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1147. is set to ms.
  1148. @item hz
  1149. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1150. if timing is set to hz.
  1151. @end table
  1152. @anchor{aresample}
  1153. @section aresample
  1154. Resample the input audio to the specified parameters, using the
  1155. libswresample library. If none are specified then the filter will
  1156. automatically convert between its input and output.
  1157. This filter is also able to stretch/squeeze the audio data to make it match
  1158. the timestamps or to inject silence / cut out audio to make it match the
  1159. timestamps, do a combination of both or do neither.
  1160. The filter accepts the syntax
  1161. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1162. expresses a sample rate and @var{resampler_options} is a list of
  1163. @var{key}=@var{value} pairs, separated by ":". See the
  1164. @ref{Resampler Options,,the "Resampler Options" section in the
  1165. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1166. for the complete list of supported options.
  1167. @subsection Examples
  1168. @itemize
  1169. @item
  1170. Resample the input audio to 44100Hz:
  1171. @example
  1172. aresample=44100
  1173. @end example
  1174. @item
  1175. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1176. samples per second compensation:
  1177. @example
  1178. aresample=async=1000
  1179. @end example
  1180. @end itemize
  1181. @section areverse
  1182. Reverse an audio clip.
  1183. Warning: This filter requires memory to buffer the entire clip, so trimming
  1184. is suggested.
  1185. @subsection Examples
  1186. @itemize
  1187. @item
  1188. Take the first 5 seconds of a clip, and reverse it.
  1189. @example
  1190. atrim=end=5,areverse
  1191. @end example
  1192. @end itemize
  1193. @section asetnsamples
  1194. Set the number of samples per each output audio frame.
  1195. The last output packet may contain a different number of samples, as
  1196. the filter will flush all the remaining samples when the input audio
  1197. signals its end.
  1198. The filter accepts the following options:
  1199. @table @option
  1200. @item nb_out_samples, n
  1201. Set the number of frames per each output audio frame. The number is
  1202. intended as the number of samples @emph{per each channel}.
  1203. Default value is 1024.
  1204. @item pad, p
  1205. If set to 1, the filter will pad the last audio frame with zeroes, so
  1206. that the last frame will contain the same number of samples as the
  1207. previous ones. Default value is 1.
  1208. @end table
  1209. For example, to set the number of per-frame samples to 1234 and
  1210. disable padding for the last frame, use:
  1211. @example
  1212. asetnsamples=n=1234:p=0
  1213. @end example
  1214. @section asetrate
  1215. Set the sample rate without altering the PCM data.
  1216. This will result in a change of speed and pitch.
  1217. The filter accepts the following options:
  1218. @table @option
  1219. @item sample_rate, r
  1220. Set the output sample rate. Default is 44100 Hz.
  1221. @end table
  1222. @section ashowinfo
  1223. Show a line containing various information for each input audio frame.
  1224. The input audio is not modified.
  1225. The shown line contains a sequence of key/value pairs of the form
  1226. @var{key}:@var{value}.
  1227. The following values are shown in the output:
  1228. @table @option
  1229. @item n
  1230. The (sequential) number of the input frame, starting from 0.
  1231. @item pts
  1232. The presentation timestamp of the input frame, in time base units; the time base
  1233. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1234. @item pts_time
  1235. The presentation timestamp of the input frame in seconds.
  1236. @item pos
  1237. position of the frame in the input stream, -1 if this information in
  1238. unavailable and/or meaningless (for example in case of synthetic audio)
  1239. @item fmt
  1240. The sample format.
  1241. @item chlayout
  1242. The channel layout.
  1243. @item rate
  1244. The sample rate for the audio frame.
  1245. @item nb_samples
  1246. The number of samples (per channel) in the frame.
  1247. @item checksum
  1248. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1249. audio, the data is treated as if all the planes were concatenated.
  1250. @item plane_checksums
  1251. A list of Adler-32 checksums for each data plane.
  1252. @end table
  1253. @anchor{astats}
  1254. @section astats
  1255. Display time domain statistical information about the audio channels.
  1256. Statistics are calculated and displayed for each audio channel and,
  1257. where applicable, an overall figure is also given.
  1258. It accepts the following option:
  1259. @table @option
  1260. @item length
  1261. Short window length in seconds, used for peak and trough RMS measurement.
  1262. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  1263. @item metadata
  1264. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1265. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1266. disabled.
  1267. Available keys for each channel are:
  1268. DC_offset
  1269. Min_level
  1270. Max_level
  1271. Min_difference
  1272. Max_difference
  1273. Mean_difference
  1274. RMS_difference
  1275. Peak_level
  1276. RMS_peak
  1277. RMS_trough
  1278. Crest_factor
  1279. Flat_factor
  1280. Peak_count
  1281. Bit_depth
  1282. Dynamic_range
  1283. and for Overall:
  1284. DC_offset
  1285. Min_level
  1286. Max_level
  1287. Min_difference
  1288. Max_difference
  1289. Mean_difference
  1290. RMS_difference
  1291. Peak_level
  1292. RMS_level
  1293. RMS_peak
  1294. RMS_trough
  1295. Flat_factor
  1296. Peak_count
  1297. Bit_depth
  1298. Number_of_samples
  1299. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1300. this @code{lavfi.astats.Overall.Peak_count}.
  1301. For description what each key means read below.
  1302. @item reset
  1303. Set number of frame after which stats are going to be recalculated.
  1304. Default is disabled.
  1305. @end table
  1306. A description of each shown parameter follows:
  1307. @table @option
  1308. @item DC offset
  1309. Mean amplitude displacement from zero.
  1310. @item Min level
  1311. Minimal sample level.
  1312. @item Max level
  1313. Maximal sample level.
  1314. @item Min difference
  1315. Minimal difference between two consecutive samples.
  1316. @item Max difference
  1317. Maximal difference between two consecutive samples.
  1318. @item Mean difference
  1319. Mean difference between two consecutive samples.
  1320. The average of each difference between two consecutive samples.
  1321. @item RMS difference
  1322. Root Mean Square difference between two consecutive samples.
  1323. @item Peak level dB
  1324. @item RMS level dB
  1325. Standard peak and RMS level measured in dBFS.
  1326. @item RMS peak dB
  1327. @item RMS trough dB
  1328. Peak and trough values for RMS level measured over a short window.
  1329. @item Crest factor
  1330. Standard ratio of peak to RMS level (note: not in dB).
  1331. @item Flat factor
  1332. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1333. (i.e. either @var{Min level} or @var{Max level}).
  1334. @item Peak count
  1335. Number of occasions (not the number of samples) that the signal attained either
  1336. @var{Min level} or @var{Max level}.
  1337. @item Bit depth
  1338. Overall bit depth of audio. Number of bits used for each sample.
  1339. @item Dynamic range
  1340. Measured dynamic range of audio in dB.
  1341. @end table
  1342. @section atempo
  1343. Adjust audio tempo.
  1344. The filter accepts exactly one parameter, the audio tempo. If not
  1345. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1346. be in the [0.5, 2.0] range.
  1347. @subsection Examples
  1348. @itemize
  1349. @item
  1350. Slow down audio to 80% tempo:
  1351. @example
  1352. atempo=0.8
  1353. @end example
  1354. @item
  1355. To speed up audio to 125% tempo:
  1356. @example
  1357. atempo=1.25
  1358. @end example
  1359. @end itemize
  1360. @section atrim
  1361. Trim the input so that the output contains one continuous subpart of the input.
  1362. It accepts the following parameters:
  1363. @table @option
  1364. @item start
  1365. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1366. sample with the timestamp @var{start} will be the first sample in the output.
  1367. @item end
  1368. Specify time of the first audio sample that will be dropped, i.e. the
  1369. audio sample immediately preceding the one with the timestamp @var{end} will be
  1370. the last sample in the output.
  1371. @item start_pts
  1372. Same as @var{start}, except this option sets the start timestamp in samples
  1373. instead of seconds.
  1374. @item end_pts
  1375. Same as @var{end}, except this option sets the end timestamp in samples instead
  1376. of seconds.
  1377. @item duration
  1378. The maximum duration of the output in seconds.
  1379. @item start_sample
  1380. The number of the first sample that should be output.
  1381. @item end_sample
  1382. The number of the first sample that should be dropped.
  1383. @end table
  1384. @option{start}, @option{end}, and @option{duration} are expressed as time
  1385. duration specifications; see
  1386. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1387. Note that the first two sets of the start/end options and the @option{duration}
  1388. option look at the frame timestamp, while the _sample options simply count the
  1389. samples that pass through the filter. So start/end_pts and start/end_sample will
  1390. give different results when the timestamps are wrong, inexact or do not start at
  1391. zero. Also note that this filter does not modify the timestamps. If you wish
  1392. to have the output timestamps start at zero, insert the asetpts filter after the
  1393. atrim filter.
  1394. If multiple start or end options are set, this filter tries to be greedy and
  1395. keep all samples that match at least one of the specified constraints. To keep
  1396. only the part that matches all the constraints at once, chain multiple atrim
  1397. filters.
  1398. The defaults are such that all the input is kept. So it is possible to set e.g.
  1399. just the end values to keep everything before the specified time.
  1400. Examples:
  1401. @itemize
  1402. @item
  1403. Drop everything except the second minute of input:
  1404. @example
  1405. ffmpeg -i INPUT -af atrim=60:120
  1406. @end example
  1407. @item
  1408. Keep only the first 1000 samples:
  1409. @example
  1410. ffmpeg -i INPUT -af atrim=end_sample=1000
  1411. @end example
  1412. @end itemize
  1413. @section bandpass
  1414. Apply a two-pole Butterworth band-pass filter with central
  1415. frequency @var{frequency}, and (3dB-point) band-width width.
  1416. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1417. instead of the default: constant 0dB peak gain.
  1418. The filter roll off at 6dB per octave (20dB per decade).
  1419. The filter accepts the following options:
  1420. @table @option
  1421. @item frequency, f
  1422. Set the filter's central frequency. Default is @code{3000}.
  1423. @item csg
  1424. Constant skirt gain if set to 1. Defaults to 0.
  1425. @item width_type, t
  1426. Set method to specify band-width of filter.
  1427. @table @option
  1428. @item h
  1429. Hz
  1430. @item q
  1431. Q-Factor
  1432. @item o
  1433. octave
  1434. @item s
  1435. slope
  1436. @end table
  1437. @item width, w
  1438. Specify the band-width of a filter in width_type units.
  1439. @item channels, c
  1440. Specify which channels to filter, by default all available are filtered.
  1441. @end table
  1442. @section bandreject
  1443. Apply a two-pole Butterworth band-reject filter with central
  1444. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1445. The filter roll off at 6dB per octave (20dB per decade).
  1446. The filter accepts the following options:
  1447. @table @option
  1448. @item frequency, f
  1449. Set the filter's central frequency. Default is @code{3000}.
  1450. @item width_type, t
  1451. Set method to specify band-width of filter.
  1452. @table @option
  1453. @item h
  1454. Hz
  1455. @item q
  1456. Q-Factor
  1457. @item o
  1458. octave
  1459. @item s
  1460. slope
  1461. @end table
  1462. @item width, w
  1463. Specify the band-width of a filter in width_type units.
  1464. @item channels, c
  1465. Specify which channels to filter, by default all available are filtered.
  1466. @end table
  1467. @section bass
  1468. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1469. shelving filter with a response similar to that of a standard
  1470. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1471. The filter accepts the following options:
  1472. @table @option
  1473. @item gain, g
  1474. Give the gain at 0 Hz. Its useful range is about -20
  1475. (for a large cut) to +20 (for a large boost).
  1476. Beware of clipping when using a positive gain.
  1477. @item frequency, f
  1478. Set the filter's central frequency and so can be used
  1479. to extend or reduce the frequency range to be boosted or cut.
  1480. The default value is @code{100} Hz.
  1481. @item width_type, t
  1482. Set method to specify band-width of filter.
  1483. @table @option
  1484. @item h
  1485. Hz
  1486. @item q
  1487. Q-Factor
  1488. @item o
  1489. octave
  1490. @item s
  1491. slope
  1492. @end table
  1493. @item width, w
  1494. Determine how steep is the filter's shelf transition.
  1495. @item channels, c
  1496. Specify which channels to filter, by default all available are filtered.
  1497. @end table
  1498. @section biquad
  1499. Apply a biquad IIR filter with the given coefficients.
  1500. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1501. are the numerator and denominator coefficients respectively.
  1502. and @var{channels}, @var{c} specify which channels to filter, by default all
  1503. available are filtered.
  1504. @section bs2b
  1505. Bauer stereo to binaural transformation, which improves headphone listening of
  1506. stereo audio records.
  1507. To enable compilation of this filter you need to configure FFmpeg with
  1508. @code{--enable-libbs2b}.
  1509. It accepts the following parameters:
  1510. @table @option
  1511. @item profile
  1512. Pre-defined crossfeed level.
  1513. @table @option
  1514. @item default
  1515. Default level (fcut=700, feed=50).
  1516. @item cmoy
  1517. Chu Moy circuit (fcut=700, feed=60).
  1518. @item jmeier
  1519. Jan Meier circuit (fcut=650, feed=95).
  1520. @end table
  1521. @item fcut
  1522. Cut frequency (in Hz).
  1523. @item feed
  1524. Feed level (in Hz).
  1525. @end table
  1526. @section channelmap
  1527. Remap input channels to new locations.
  1528. It accepts the following parameters:
  1529. @table @option
  1530. @item map
  1531. Map channels from input to output. The argument is a '|'-separated list of
  1532. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1533. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1534. channel (e.g. FL for front left) or its index in the input channel layout.
  1535. @var{out_channel} is the name of the output channel or its index in the output
  1536. channel layout. If @var{out_channel} is not given then it is implicitly an
  1537. index, starting with zero and increasing by one for each mapping.
  1538. @item channel_layout
  1539. The channel layout of the output stream.
  1540. @end table
  1541. If no mapping is present, the filter will implicitly map input channels to
  1542. output channels, preserving indices.
  1543. For example, assuming a 5.1+downmix input MOV file,
  1544. @example
  1545. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1546. @end example
  1547. will create an output WAV file tagged as stereo from the downmix channels of
  1548. the input.
  1549. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1550. @example
  1551. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1552. @end example
  1553. @section channelsplit
  1554. Split each channel from an input audio stream into a separate output stream.
  1555. It accepts the following parameters:
  1556. @table @option
  1557. @item channel_layout
  1558. The channel layout of the input stream. The default is "stereo".
  1559. @end table
  1560. For example, assuming a stereo input MP3 file,
  1561. @example
  1562. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1563. @end example
  1564. will create an output Matroska file with two audio streams, one containing only
  1565. the left channel and the other the right channel.
  1566. Split a 5.1 WAV file into per-channel files:
  1567. @example
  1568. ffmpeg -i in.wav -filter_complex
  1569. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1570. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1571. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1572. side_right.wav
  1573. @end example
  1574. @section chorus
  1575. Add a chorus effect to the audio.
  1576. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1577. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1578. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1579. The modulation depth defines the range the modulated delay is played before or after
  1580. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1581. sound tuned around the original one, like in a chorus where some vocals are slightly
  1582. off key.
  1583. It accepts the following parameters:
  1584. @table @option
  1585. @item in_gain
  1586. Set input gain. Default is 0.4.
  1587. @item out_gain
  1588. Set output gain. Default is 0.4.
  1589. @item delays
  1590. Set delays. A typical delay is around 40ms to 60ms.
  1591. @item decays
  1592. Set decays.
  1593. @item speeds
  1594. Set speeds.
  1595. @item depths
  1596. Set depths.
  1597. @end table
  1598. @subsection Examples
  1599. @itemize
  1600. @item
  1601. A single delay:
  1602. @example
  1603. chorus=0.7:0.9:55:0.4:0.25:2
  1604. @end example
  1605. @item
  1606. Two delays:
  1607. @example
  1608. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1609. @end example
  1610. @item
  1611. Fuller sounding chorus with three delays:
  1612. @example
  1613. 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
  1614. @end example
  1615. @end itemize
  1616. @section compand
  1617. Compress or expand the audio's dynamic range.
  1618. It accepts the following parameters:
  1619. @table @option
  1620. @item attacks
  1621. @item decays
  1622. A list of times in seconds for each channel over which the instantaneous level
  1623. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1624. increase of volume and @var{decays} refers to decrease of volume. For most
  1625. situations, the attack time (response to the audio getting louder) should be
  1626. shorter than the decay time, because the human ear is more sensitive to sudden
  1627. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1628. a typical value for decay is 0.8 seconds.
  1629. If specified number of attacks & decays is lower than number of channels, the last
  1630. set attack/decay will be used for all remaining channels.
  1631. @item points
  1632. A list of points for the transfer function, specified in dB relative to the
  1633. maximum possible signal amplitude. Each key points list must be defined using
  1634. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1635. @code{x0/y0 x1/y1 x2/y2 ....}
  1636. The input values must be in strictly increasing order but the transfer function
  1637. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1638. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1639. function are @code{-70/-70|-60/-20|1/0}.
  1640. @item soft-knee
  1641. Set the curve radius in dB for all joints. It defaults to 0.01.
  1642. @item gain
  1643. Set the additional gain in dB to be applied at all points on the transfer
  1644. function. This allows for easy adjustment of the overall gain.
  1645. It defaults to 0.
  1646. @item volume
  1647. Set an initial volume, in dB, to be assumed for each channel when filtering
  1648. starts. This permits the user to supply a nominal level initially, so that, for
  1649. example, a very large gain is not applied to initial signal levels before the
  1650. companding has begun to operate. A typical value for audio which is initially
  1651. quiet is -90 dB. It defaults to 0.
  1652. @item delay
  1653. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1654. delayed before being fed to the volume adjuster. Specifying a delay
  1655. approximately equal to the attack/decay times allows the filter to effectively
  1656. operate in predictive rather than reactive mode. It defaults to 0.
  1657. @end table
  1658. @subsection Examples
  1659. @itemize
  1660. @item
  1661. Make music with both quiet and loud passages suitable for listening to in a
  1662. noisy environment:
  1663. @example
  1664. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1665. @end example
  1666. Another example for audio with whisper and explosion parts:
  1667. @example
  1668. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1669. @end example
  1670. @item
  1671. A noise gate for when the noise is at a lower level than the signal:
  1672. @example
  1673. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1674. @end example
  1675. @item
  1676. Here is another noise gate, this time for when the noise is at a higher level
  1677. than the signal (making it, in some ways, similar to squelch):
  1678. @example
  1679. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1680. @end example
  1681. @item
  1682. 2:1 compression starting at -6dB:
  1683. @example
  1684. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1685. @end example
  1686. @item
  1687. 2:1 compression starting at -9dB:
  1688. @example
  1689. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1690. @end example
  1691. @item
  1692. 2:1 compression starting at -12dB:
  1693. @example
  1694. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1695. @end example
  1696. @item
  1697. 2:1 compression starting at -18dB:
  1698. @example
  1699. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1700. @end example
  1701. @item
  1702. 3:1 compression starting at -15dB:
  1703. @example
  1704. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1705. @end example
  1706. @item
  1707. Compressor/Gate:
  1708. @example
  1709. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1710. @end example
  1711. @item
  1712. Expander:
  1713. @example
  1714. 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
  1715. @end example
  1716. @item
  1717. Hard limiter at -6dB:
  1718. @example
  1719. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1720. @end example
  1721. @item
  1722. Hard limiter at -12dB:
  1723. @example
  1724. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1725. @end example
  1726. @item
  1727. Hard noise gate at -35 dB:
  1728. @example
  1729. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1730. @end example
  1731. @item
  1732. Soft limiter:
  1733. @example
  1734. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1735. @end example
  1736. @end itemize
  1737. @section compensationdelay
  1738. Compensation Delay Line is a metric based delay to compensate differing
  1739. positions of microphones or speakers.
  1740. For example, you have recorded guitar with two microphones placed in
  1741. different location. Because the front of sound wave has fixed speed in
  1742. normal conditions, the phasing of microphones can vary and depends on
  1743. their location and interposition. The best sound mix can be achieved when
  1744. these microphones are in phase (synchronized). Note that distance of
  1745. ~30 cm between microphones makes one microphone to capture signal in
  1746. antiphase to another microphone. That makes the final mix sounding moody.
  1747. This filter helps to solve phasing problems by adding different delays
  1748. to each microphone track and make them synchronized.
  1749. The best result can be reached when you take one track as base and
  1750. synchronize other tracks one by one with it.
  1751. Remember that synchronization/delay tolerance depends on sample rate, too.
  1752. Higher sample rates will give more tolerance.
  1753. It accepts the following parameters:
  1754. @table @option
  1755. @item mm
  1756. Set millimeters distance. This is compensation distance for fine tuning.
  1757. Default is 0.
  1758. @item cm
  1759. Set cm distance. This is compensation distance for tightening distance setup.
  1760. Default is 0.
  1761. @item m
  1762. Set meters distance. This is compensation distance for hard distance setup.
  1763. Default is 0.
  1764. @item dry
  1765. Set dry amount. Amount of unprocessed (dry) signal.
  1766. Default is 0.
  1767. @item wet
  1768. Set wet amount. Amount of processed (wet) signal.
  1769. Default is 1.
  1770. @item temp
  1771. Set temperature degree in Celsius. This is the temperature of the environment.
  1772. Default is 20.
  1773. @end table
  1774. @section crossfeed
  1775. Apply headphone crossfeed filter.
  1776. Crossfeed is the process of blending the left and right channels of stereo
  1777. audio recording.
  1778. It is mainly used to reduce extreme stereo separation of low frequencies.
  1779. The intent is to produce more speaker like sound to the listener.
  1780. The filter accepts the following options:
  1781. @table @option
  1782. @item strength
  1783. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  1784. This sets gain of low shelf filter for side part of stereo image.
  1785. Default is -6dB. Max allowed is -30db when strength is set to 1.
  1786. @item range
  1787. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  1788. This sets cut off frequency of low shelf filter. Default is cut off near
  1789. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  1790. @item level_in
  1791. Set input gain. Default is 0.9.
  1792. @item level_out
  1793. Set output gain. Default is 1.
  1794. @end table
  1795. @section crystalizer
  1796. Simple algorithm to expand audio dynamic range.
  1797. The filter accepts the following options:
  1798. @table @option
  1799. @item i
  1800. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  1801. (unchanged sound) to 10.0 (maximum effect).
  1802. @item c
  1803. Enable clipping. By default is enabled.
  1804. @end table
  1805. @section dcshift
  1806. Apply a DC shift to the audio.
  1807. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1808. in the recording chain) from the audio. The effect of a DC offset is reduced
  1809. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1810. a signal has a DC offset.
  1811. @table @option
  1812. @item shift
  1813. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1814. the audio.
  1815. @item limitergain
  1816. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1817. used to prevent clipping.
  1818. @end table
  1819. @section dynaudnorm
  1820. Dynamic Audio Normalizer.
  1821. This filter applies a certain amount of gain to the input audio in order
  1822. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1823. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1824. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1825. This allows for applying extra gain to the "quiet" sections of the audio
  1826. while avoiding distortions or clipping the "loud" sections. In other words:
  1827. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1828. sections, in the sense that the volume of each section is brought to the
  1829. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1830. this goal *without* applying "dynamic range compressing". It will retain 100%
  1831. of the dynamic range *within* each section of the audio file.
  1832. @table @option
  1833. @item f
  1834. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1835. Default is 500 milliseconds.
  1836. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1837. referred to as frames. This is required, because a peak magnitude has no
  1838. meaning for just a single sample value. Instead, we need to determine the
  1839. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1840. normalizer would simply use the peak magnitude of the complete file, the
  1841. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1842. frame. The length of a frame is specified in milliseconds. By default, the
  1843. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1844. been found to give good results with most files.
  1845. Note that the exact frame length, in number of samples, will be determined
  1846. automatically, based on the sampling rate of the individual input audio file.
  1847. @item g
  1848. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1849. number. Default is 31.
  1850. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1851. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1852. is specified in frames, centered around the current frame. For the sake of
  1853. simplicity, this must be an odd number. Consequently, the default value of 31
  1854. takes into account the current frame, as well as the 15 preceding frames and
  1855. the 15 subsequent frames. Using a larger window results in a stronger
  1856. smoothing effect and thus in less gain variation, i.e. slower gain
  1857. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1858. effect and thus in more gain variation, i.e. faster gain adaptation.
  1859. In other words, the more you increase this value, the more the Dynamic Audio
  1860. Normalizer will behave like a "traditional" normalization filter. On the
  1861. contrary, the more you decrease this value, the more the Dynamic Audio
  1862. Normalizer will behave like a dynamic range compressor.
  1863. @item p
  1864. Set the target peak value. This specifies the highest permissible magnitude
  1865. level for the normalized audio input. This filter will try to approach the
  1866. target peak magnitude as closely as possible, but at the same time it also
  1867. makes sure that the normalized signal will never exceed the peak magnitude.
  1868. A frame's maximum local gain factor is imposed directly by the target peak
  1869. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1870. It is not recommended to go above this value.
  1871. @item m
  1872. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1873. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1874. factor for each input frame, i.e. the maximum gain factor that does not
  1875. result in clipping or distortion. The maximum gain factor is determined by
  1876. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1877. additionally bounds the frame's maximum gain factor by a predetermined
  1878. (global) maximum gain factor. This is done in order to avoid excessive gain
  1879. factors in "silent" or almost silent frames. By default, the maximum gain
  1880. factor is 10.0, For most inputs the default value should be sufficient and
  1881. it usually is not recommended to increase this value. Though, for input
  1882. with an extremely low overall volume level, it may be necessary to allow even
  1883. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1884. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1885. Instead, a "sigmoid" threshold function will be applied. This way, the
  1886. gain factors will smoothly approach the threshold value, but never exceed that
  1887. value.
  1888. @item r
  1889. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1890. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1891. This means that the maximum local gain factor for each frame is defined
  1892. (only) by the frame's highest magnitude sample. This way, the samples can
  1893. be amplified as much as possible without exceeding the maximum signal
  1894. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1895. Normalizer can also take into account the frame's root mean square,
  1896. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1897. determine the power of a time-varying signal. It is therefore considered
  1898. that the RMS is a better approximation of the "perceived loudness" than
  1899. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1900. frames to a constant RMS value, a uniform "perceived loudness" can be
  1901. established. If a target RMS value has been specified, a frame's local gain
  1902. factor is defined as the factor that would result in exactly that RMS value.
  1903. Note, however, that the maximum local gain factor is still restricted by the
  1904. frame's highest magnitude sample, in order to prevent clipping.
  1905. @item n
  1906. Enable channels coupling. By default is enabled.
  1907. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1908. amount. This means the same gain factor will be applied to all channels, i.e.
  1909. the maximum possible gain factor is determined by the "loudest" channel.
  1910. However, in some recordings, it may happen that the volume of the different
  1911. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1912. In this case, this option can be used to disable the channel coupling. This way,
  1913. the gain factor will be determined independently for each channel, depending
  1914. only on the individual channel's highest magnitude sample. This allows for
  1915. harmonizing the volume of the different channels.
  1916. @item c
  1917. Enable DC bias correction. By default is disabled.
  1918. An audio signal (in the time domain) is a sequence of sample values.
  1919. In the Dynamic Audio Normalizer these sample values are represented in the
  1920. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1921. audio signal, or "waveform", should be centered around the zero point.
  1922. That means if we calculate the mean value of all samples in a file, or in a
  1923. single frame, then the result should be 0.0 or at least very close to that
  1924. value. If, however, there is a significant deviation of the mean value from
  1925. 0.0, in either positive or negative direction, this is referred to as a
  1926. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1927. Audio Normalizer provides optional DC bias correction.
  1928. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1929. the mean value, or "DC correction" offset, of each input frame and subtract
  1930. that value from all of the frame's sample values which ensures those samples
  1931. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1932. boundaries, the DC correction offset values will be interpolated smoothly
  1933. between neighbouring frames.
  1934. @item b
  1935. Enable alternative boundary mode. By default is disabled.
  1936. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1937. around each frame. This includes the preceding frames as well as the
  1938. subsequent frames. However, for the "boundary" frames, located at the very
  1939. beginning and at the very end of the audio file, not all neighbouring
  1940. frames are available. In particular, for the first few frames in the audio
  1941. file, the preceding frames are not known. And, similarly, for the last few
  1942. frames in the audio file, the subsequent frames are not known. Thus, the
  1943. question arises which gain factors should be assumed for the missing frames
  1944. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1945. to deal with this situation. The default boundary mode assumes a gain factor
  1946. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1947. "fade out" at the beginning and at the end of the input, respectively.
  1948. @item s
  1949. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1950. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1951. compression. This means that signal peaks will not be pruned and thus the
  1952. full dynamic range will be retained within each local neighbourhood. However,
  1953. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1954. normalization algorithm with a more "traditional" compression.
  1955. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1956. (thresholding) function. If (and only if) the compression feature is enabled,
  1957. all input frames will be processed by a soft knee thresholding function prior
  1958. to the actual normalization process. Put simply, the thresholding function is
  1959. going to prune all samples whose magnitude exceeds a certain threshold value.
  1960. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1961. value. Instead, the threshold value will be adjusted for each individual
  1962. frame.
  1963. In general, smaller parameters result in stronger compression, and vice versa.
  1964. Values below 3.0 are not recommended, because audible distortion may appear.
  1965. @end table
  1966. @section earwax
  1967. Make audio easier to listen to on headphones.
  1968. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1969. so that when listened to on headphones the stereo image is moved from
  1970. inside your head (standard for headphones) to outside and in front of
  1971. the listener (standard for speakers).
  1972. Ported from SoX.
  1973. @section equalizer
  1974. Apply a two-pole peaking equalisation (EQ) filter. With this
  1975. filter, the signal-level at and around a selected frequency can
  1976. be increased or decreased, whilst (unlike bandpass and bandreject
  1977. filters) that at all other frequencies is unchanged.
  1978. In order to produce complex equalisation curves, this filter can
  1979. be given several times, each with a different central frequency.
  1980. The filter accepts the following options:
  1981. @table @option
  1982. @item frequency, f
  1983. Set the filter's central frequency in Hz.
  1984. @item width_type, t
  1985. Set method to specify band-width of filter.
  1986. @table @option
  1987. @item h
  1988. Hz
  1989. @item q
  1990. Q-Factor
  1991. @item o
  1992. octave
  1993. @item s
  1994. slope
  1995. @end table
  1996. @item width, w
  1997. Specify the band-width of a filter in width_type units.
  1998. @item gain, g
  1999. Set the required gain or attenuation in dB.
  2000. Beware of clipping when using a positive gain.
  2001. @item channels, c
  2002. Specify which channels to filter, by default all available are filtered.
  2003. @end table
  2004. @subsection Examples
  2005. @itemize
  2006. @item
  2007. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2008. @example
  2009. equalizer=f=1000:t=h:width=200:g=-10
  2010. @end example
  2011. @item
  2012. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2013. @example
  2014. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2015. @end example
  2016. @end itemize
  2017. @section extrastereo
  2018. Linearly increases the difference between left and right channels which
  2019. adds some sort of "live" effect to playback.
  2020. The filter accepts the following options:
  2021. @table @option
  2022. @item m
  2023. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2024. (average of both channels), with 1.0 sound will be unchanged, with
  2025. -1.0 left and right channels will be swapped.
  2026. @item c
  2027. Enable clipping. By default is enabled.
  2028. @end table
  2029. @section firequalizer
  2030. Apply FIR Equalization using arbitrary frequency response.
  2031. The filter accepts the following option:
  2032. @table @option
  2033. @item gain
  2034. Set gain curve equation (in dB). The expression can contain variables:
  2035. @table @option
  2036. @item f
  2037. the evaluated frequency
  2038. @item sr
  2039. sample rate
  2040. @item ch
  2041. channel number, set to 0 when multichannels evaluation is disabled
  2042. @item chid
  2043. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2044. multichannels evaluation is disabled
  2045. @item chs
  2046. number of channels
  2047. @item chlayout
  2048. channel_layout, see libavutil/channel_layout.h
  2049. @end table
  2050. and functions:
  2051. @table @option
  2052. @item gain_interpolate(f)
  2053. interpolate gain on frequency f based on gain_entry
  2054. @item cubic_interpolate(f)
  2055. same as gain_interpolate, but smoother
  2056. @end table
  2057. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2058. @item gain_entry
  2059. Set gain entry for gain_interpolate function. The expression can
  2060. contain functions:
  2061. @table @option
  2062. @item entry(f, g)
  2063. store gain entry at frequency f with value g
  2064. @end table
  2065. This option is also available as command.
  2066. @item delay
  2067. Set filter delay in seconds. Higher value means more accurate.
  2068. Default is @code{0.01}.
  2069. @item accuracy
  2070. Set filter accuracy in Hz. Lower value means more accurate.
  2071. Default is @code{5}.
  2072. @item wfunc
  2073. Set window function. Acceptable values are:
  2074. @table @option
  2075. @item rectangular
  2076. rectangular window, useful when gain curve is already smooth
  2077. @item hann
  2078. hann window (default)
  2079. @item hamming
  2080. hamming window
  2081. @item blackman
  2082. blackman window
  2083. @item nuttall3
  2084. 3-terms continuous 1st derivative nuttall window
  2085. @item mnuttall3
  2086. minimum 3-terms discontinuous nuttall window
  2087. @item nuttall
  2088. 4-terms continuous 1st derivative nuttall window
  2089. @item bnuttall
  2090. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2091. @item bharris
  2092. blackman-harris window
  2093. @item tukey
  2094. tukey window
  2095. @end table
  2096. @item fixed
  2097. If enabled, use fixed number of audio samples. This improves speed when
  2098. filtering with large delay. Default is disabled.
  2099. @item multi
  2100. Enable multichannels evaluation on gain. Default is disabled.
  2101. @item zero_phase
  2102. Enable zero phase mode by subtracting timestamp to compensate delay.
  2103. Default is disabled.
  2104. @item scale
  2105. Set scale used by gain. Acceptable values are:
  2106. @table @option
  2107. @item linlin
  2108. linear frequency, linear gain
  2109. @item linlog
  2110. linear frequency, logarithmic (in dB) gain (default)
  2111. @item loglin
  2112. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2113. @item loglog
  2114. logarithmic frequency, logarithmic gain
  2115. @end table
  2116. @item dumpfile
  2117. Set file for dumping, suitable for gnuplot.
  2118. @item dumpscale
  2119. Set scale for dumpfile. Acceptable values are same with scale option.
  2120. Default is linlog.
  2121. @item fft2
  2122. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2123. Default is disabled.
  2124. @item min_phase
  2125. Enable minimum phase impulse response. Default is disabled.
  2126. @end table
  2127. @subsection Examples
  2128. @itemize
  2129. @item
  2130. lowpass at 1000 Hz:
  2131. @example
  2132. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2133. @end example
  2134. @item
  2135. lowpass at 1000 Hz with gain_entry:
  2136. @example
  2137. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2138. @end example
  2139. @item
  2140. custom equalization:
  2141. @example
  2142. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2143. @end example
  2144. @item
  2145. higher delay with zero phase to compensate delay:
  2146. @example
  2147. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2148. @end example
  2149. @item
  2150. lowpass on left channel, highpass on right channel:
  2151. @example
  2152. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2153. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2154. @end example
  2155. @end itemize
  2156. @section flanger
  2157. Apply a flanging effect to the audio.
  2158. The filter accepts the following options:
  2159. @table @option
  2160. @item delay
  2161. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2162. @item depth
  2163. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2164. @item regen
  2165. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2166. Default value is 0.
  2167. @item width
  2168. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2169. Default value is 71.
  2170. @item speed
  2171. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2172. @item shape
  2173. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2174. Default value is @var{sinusoidal}.
  2175. @item phase
  2176. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2177. Default value is 25.
  2178. @item interp
  2179. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2180. Default is @var{linear}.
  2181. @end table
  2182. @section haas
  2183. Apply Haas effect to audio.
  2184. Note that this makes most sense to apply on mono signals.
  2185. With this filter applied to mono signals it give some directionality and
  2186. stretches its stereo image.
  2187. The filter accepts the following options:
  2188. @table @option
  2189. @item level_in
  2190. Set input level. By default is @var{1}, or 0dB
  2191. @item level_out
  2192. Set output level. By default is @var{1}, or 0dB.
  2193. @item side_gain
  2194. Set gain applied to side part of signal. By default is @var{1}.
  2195. @item middle_source
  2196. Set kind of middle source. Can be one of the following:
  2197. @table @samp
  2198. @item left
  2199. Pick left channel.
  2200. @item right
  2201. Pick right channel.
  2202. @item mid
  2203. Pick middle part signal of stereo image.
  2204. @item side
  2205. Pick side part signal of stereo image.
  2206. @end table
  2207. @item middle_phase
  2208. Change middle phase. By default is disabled.
  2209. @item left_delay
  2210. Set left channel delay. By default is @var{2.05} milliseconds.
  2211. @item left_balance
  2212. Set left channel balance. By default is @var{-1}.
  2213. @item left_gain
  2214. Set left channel gain. By default is @var{1}.
  2215. @item left_phase
  2216. Change left phase. By default is disabled.
  2217. @item right_delay
  2218. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2219. @item right_balance
  2220. Set right channel balance. By default is @var{1}.
  2221. @item right_gain
  2222. Set right channel gain. By default is @var{1}.
  2223. @item right_phase
  2224. Change right phase. By default is enabled.
  2225. @end table
  2226. @section hdcd
  2227. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2228. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2229. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2230. of HDCD, and detects the Transient Filter flag.
  2231. @example
  2232. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2233. @end example
  2234. When using the filter with wav, note the default encoding for wav is 16-bit,
  2235. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2236. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2237. @example
  2238. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2239. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2240. @end example
  2241. The filter accepts the following options:
  2242. @table @option
  2243. @item disable_autoconvert
  2244. Disable any automatic format conversion or resampling in the filter graph.
  2245. @item process_stereo
  2246. Process the stereo channels together. If target_gain does not match between
  2247. channels, consider it invalid and use the last valid target_gain.
  2248. @item cdt_ms
  2249. Set the code detect timer period in ms.
  2250. @item force_pe
  2251. Always extend peaks above -3dBFS even if PE isn't signaled.
  2252. @item analyze_mode
  2253. Replace audio with a solid tone and adjust the amplitude to signal some
  2254. specific aspect of the decoding process. The output file can be loaded in
  2255. an audio editor alongside the original to aid analysis.
  2256. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2257. Modes are:
  2258. @table @samp
  2259. @item 0, off
  2260. Disabled
  2261. @item 1, lle
  2262. Gain adjustment level at each sample
  2263. @item 2, pe
  2264. Samples where peak extend occurs
  2265. @item 3, cdt
  2266. Samples where the code detect timer is active
  2267. @item 4, tgm
  2268. Samples where the target gain does not match between channels
  2269. @end table
  2270. @end table
  2271. @section headphone
  2272. Apply head-related transfer functions (HRTFs) to create virtual
  2273. loudspeakers around the user for binaural listening via headphones.
  2274. The HRIRs are provided via additional streams, for each channel
  2275. one stereo input stream is needed.
  2276. The filter accepts the following options:
  2277. @table @option
  2278. @item map
  2279. Set mapping of input streams for convolution.
  2280. The argument is a '|'-separated list of channel names in order as they
  2281. are given as additional stream inputs for filter.
  2282. This also specify number of input streams. Number of input streams
  2283. must be not less than number of channels in first stream plus one.
  2284. @item gain
  2285. Set gain applied to audio. Value is in dB. Default is 0.
  2286. @item type
  2287. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2288. processing audio in time domain which is slow.
  2289. @var{freq} is processing audio in frequency domain which is fast.
  2290. Default is @var{freq}.
  2291. @item lfe
  2292. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2293. @end table
  2294. @subsection Examples
  2295. @itemize
  2296. @item
  2297. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2298. each amovie filter use stereo file with IR coefficients as input.
  2299. The files give coefficients for each position of virtual loudspeaker:
  2300. @example
  2301. 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"
  2302. output.wav
  2303. @end example
  2304. @end itemize
  2305. @section highpass
  2306. Apply a high-pass filter with 3dB point frequency.
  2307. The filter can be either single-pole, or double-pole (the default).
  2308. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2309. The filter accepts the following options:
  2310. @table @option
  2311. @item frequency, f
  2312. Set frequency in Hz. Default is 3000.
  2313. @item poles, p
  2314. Set number of poles. Default is 2.
  2315. @item width_type, t
  2316. Set method to specify band-width of filter.
  2317. @table @option
  2318. @item h
  2319. Hz
  2320. @item q
  2321. Q-Factor
  2322. @item o
  2323. octave
  2324. @item s
  2325. slope
  2326. @end table
  2327. @item width, w
  2328. Specify the band-width of a filter in width_type units.
  2329. Applies only to double-pole filter.
  2330. The default is 0.707q and gives a Butterworth response.
  2331. @item channels, c
  2332. Specify which channels to filter, by default all available are filtered.
  2333. @end table
  2334. @section join
  2335. Join multiple input streams into one multi-channel stream.
  2336. It accepts the following parameters:
  2337. @table @option
  2338. @item inputs
  2339. The number of input streams. It defaults to 2.
  2340. @item channel_layout
  2341. The desired output channel layout. It defaults to stereo.
  2342. @item map
  2343. Map channels from inputs to output. The argument is a '|'-separated list of
  2344. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2345. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2346. can be either the name of the input channel (e.g. FL for front left) or its
  2347. index in the specified input stream. @var{out_channel} is the name of the output
  2348. channel.
  2349. @end table
  2350. The filter will attempt to guess the mappings when they are not specified
  2351. explicitly. It does so by first trying to find an unused matching input channel
  2352. and if that fails it picks the first unused input channel.
  2353. Join 3 inputs (with properly set channel layouts):
  2354. @example
  2355. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2356. @end example
  2357. Build a 5.1 output from 6 single-channel streams:
  2358. @example
  2359. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2360. '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'
  2361. out
  2362. @end example
  2363. @section ladspa
  2364. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2365. To enable compilation of this filter you need to configure FFmpeg with
  2366. @code{--enable-ladspa}.
  2367. @table @option
  2368. @item file, f
  2369. Specifies the name of LADSPA plugin library to load. If the environment
  2370. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2371. each one of the directories specified by the colon separated list in
  2372. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2373. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2374. @file{/usr/lib/ladspa/}.
  2375. @item plugin, p
  2376. Specifies the plugin within the library. Some libraries contain only
  2377. one plugin, but others contain many of them. If this is not set filter
  2378. will list all available plugins within the specified library.
  2379. @item controls, c
  2380. Set the '|' separated list of controls which are zero or more floating point
  2381. values that determine the behavior of the loaded plugin (for example delay,
  2382. threshold or gain).
  2383. Controls need to be defined using the following syntax:
  2384. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2385. @var{valuei} is the value set on the @var{i}-th control.
  2386. Alternatively they can be also defined using the following syntax:
  2387. @var{value0}|@var{value1}|@var{value2}|..., where
  2388. @var{valuei} is the value set on the @var{i}-th control.
  2389. If @option{controls} is set to @code{help}, all available controls and
  2390. their valid ranges are printed.
  2391. @item sample_rate, s
  2392. Specify the sample rate, default to 44100. Only used if plugin have
  2393. zero inputs.
  2394. @item nb_samples, n
  2395. Set the number of samples per channel per each output frame, default
  2396. is 1024. Only used if plugin have zero inputs.
  2397. @item duration, d
  2398. Set the minimum duration of the sourced audio. See
  2399. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2400. for the accepted syntax.
  2401. Note that the resulting duration may be greater than the specified duration,
  2402. as the generated audio is always cut at the end of a complete frame.
  2403. If not specified, or the expressed duration is negative, the audio is
  2404. supposed to be generated forever.
  2405. Only used if plugin have zero inputs.
  2406. @end table
  2407. @subsection Examples
  2408. @itemize
  2409. @item
  2410. List all available plugins within amp (LADSPA example plugin) library:
  2411. @example
  2412. ladspa=file=amp
  2413. @end example
  2414. @item
  2415. List all available controls and their valid ranges for @code{vcf_notch}
  2416. plugin from @code{VCF} library:
  2417. @example
  2418. ladspa=f=vcf:p=vcf_notch:c=help
  2419. @end example
  2420. @item
  2421. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2422. plugin library:
  2423. @example
  2424. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2425. @end example
  2426. @item
  2427. Add reverberation to the audio using TAP-plugins
  2428. (Tom's Audio Processing plugins):
  2429. @example
  2430. ladspa=file=tap_reverb:tap_reverb
  2431. @end example
  2432. @item
  2433. Generate white noise, with 0.2 amplitude:
  2434. @example
  2435. ladspa=file=cmt:noise_source_white:c=c0=.2
  2436. @end example
  2437. @item
  2438. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2439. @code{C* Audio Plugin Suite} (CAPS) library:
  2440. @example
  2441. ladspa=file=caps:Click:c=c1=20'
  2442. @end example
  2443. @item
  2444. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2445. @example
  2446. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2447. @end example
  2448. @item
  2449. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2450. @code{SWH Plugins} collection:
  2451. @example
  2452. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2453. @end example
  2454. @item
  2455. Attenuate low frequencies using Multiband EQ from Steve Harris
  2456. @code{SWH Plugins} collection:
  2457. @example
  2458. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2459. @end example
  2460. @item
  2461. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2462. (CAPS) library:
  2463. @example
  2464. ladspa=caps:Narrower
  2465. @end example
  2466. @item
  2467. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2468. @example
  2469. ladspa=caps:White:.2
  2470. @end example
  2471. @item
  2472. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2473. @example
  2474. ladspa=caps:Fractal:c=c1=1
  2475. @end example
  2476. @item
  2477. Dynamic volume normalization using @code{VLevel} plugin:
  2478. @example
  2479. ladspa=vlevel-ladspa:vlevel_mono
  2480. @end example
  2481. @end itemize
  2482. @subsection Commands
  2483. This filter supports the following commands:
  2484. @table @option
  2485. @item cN
  2486. Modify the @var{N}-th control value.
  2487. If the specified value is not valid, it is ignored and prior one is kept.
  2488. @end table
  2489. @section loudnorm
  2490. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2491. Support for both single pass (livestreams, files) and double pass (files) modes.
  2492. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  2493. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  2494. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  2495. The filter accepts the following options:
  2496. @table @option
  2497. @item I, i
  2498. Set integrated loudness target.
  2499. Range is -70.0 - -5.0. Default value is -24.0.
  2500. @item LRA, lra
  2501. Set loudness range target.
  2502. Range is 1.0 - 20.0. Default value is 7.0.
  2503. @item TP, tp
  2504. Set maximum true peak.
  2505. Range is -9.0 - +0.0. Default value is -2.0.
  2506. @item measured_I, measured_i
  2507. Measured IL of input file.
  2508. Range is -99.0 - +0.0.
  2509. @item measured_LRA, measured_lra
  2510. Measured LRA of input file.
  2511. Range is 0.0 - 99.0.
  2512. @item measured_TP, measured_tp
  2513. Measured true peak of input file.
  2514. Range is -99.0 - +99.0.
  2515. @item measured_thresh
  2516. Measured threshold of input file.
  2517. Range is -99.0 - +0.0.
  2518. @item offset
  2519. Set offset gain. Gain is applied before the true-peak limiter.
  2520. Range is -99.0 - +99.0. Default is +0.0.
  2521. @item linear
  2522. Normalize linearly if possible.
  2523. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2524. to be specified in order to use this mode.
  2525. Options are true or false. Default is true.
  2526. @item dual_mono
  2527. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2528. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2529. If set to @code{true}, this option will compensate for this effect.
  2530. Multi-channel input files are not affected by this option.
  2531. Options are true or false. Default is false.
  2532. @item print_format
  2533. Set print format for stats. Options are summary, json, or none.
  2534. Default value is none.
  2535. @end table
  2536. @section lowpass
  2537. Apply a low-pass filter with 3dB point frequency.
  2538. The filter can be either single-pole or double-pole (the default).
  2539. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2540. The filter accepts the following options:
  2541. @table @option
  2542. @item frequency, f
  2543. Set frequency in Hz. Default is 500.
  2544. @item poles, p
  2545. Set number of poles. Default is 2.
  2546. @item width_type, t
  2547. Set method to specify band-width of filter.
  2548. @table @option
  2549. @item h
  2550. Hz
  2551. @item q
  2552. Q-Factor
  2553. @item o
  2554. octave
  2555. @item s
  2556. slope
  2557. @end table
  2558. @item width, w
  2559. Specify the band-width of a filter in width_type units.
  2560. Applies only to double-pole filter.
  2561. The default is 0.707q and gives a Butterworth response.
  2562. @item channels, c
  2563. Specify which channels to filter, by default all available are filtered.
  2564. @end table
  2565. @subsection Examples
  2566. @itemize
  2567. @item
  2568. Lowpass only LFE channel, it LFE is not present it does nothing:
  2569. @example
  2570. lowpass=c=LFE
  2571. @end example
  2572. @end itemize
  2573. @section mcompand
  2574. Multiband Compress or expand the audio's dynamic range.
  2575. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  2576. This is akin to the crossover of a loudspeaker, and results in flat frequency
  2577. response when absent compander action.
  2578. It accepts the following parameters:
  2579. @table @option
  2580. @item args
  2581. This option syntax is:
  2582. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  2583. For explanation of each item refer to compand filter documentation.
  2584. @end table
  2585. @anchor{pan}
  2586. @section pan
  2587. Mix channels with specific gain levels. The filter accepts the output
  2588. channel layout followed by a set of channels definitions.
  2589. This filter is also designed to efficiently remap the channels of an audio
  2590. stream.
  2591. The filter accepts parameters of the form:
  2592. "@var{l}|@var{outdef}|@var{outdef}|..."
  2593. @table @option
  2594. @item l
  2595. output channel layout or number of channels
  2596. @item outdef
  2597. output channel specification, of the form:
  2598. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  2599. @item out_name
  2600. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2601. number (c0, c1, etc.)
  2602. @item gain
  2603. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2604. @item in_name
  2605. input channel to use, see out_name for details; it is not possible to mix
  2606. named and numbered input channels
  2607. @end table
  2608. If the `=' in a channel specification is replaced by `<', then the gains for
  2609. that specification will be renormalized so that the total is 1, thus
  2610. avoiding clipping noise.
  2611. @subsection Mixing examples
  2612. For example, if you want to down-mix from stereo to mono, but with a bigger
  2613. factor for the left channel:
  2614. @example
  2615. pan=1c|c0=0.9*c0+0.1*c1
  2616. @end example
  2617. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2618. 7-channels surround:
  2619. @example
  2620. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2621. @end example
  2622. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2623. that should be preferred (see "-ac" option) unless you have very specific
  2624. needs.
  2625. @subsection Remapping examples
  2626. The channel remapping will be effective if, and only if:
  2627. @itemize
  2628. @item gain coefficients are zeroes or ones,
  2629. @item only one input per channel output,
  2630. @end itemize
  2631. If all these conditions are satisfied, the filter will notify the user ("Pure
  2632. channel mapping detected"), and use an optimized and lossless method to do the
  2633. remapping.
  2634. For example, if you have a 5.1 source and want a stereo audio stream by
  2635. dropping the extra channels:
  2636. @example
  2637. pan="stereo| c0=FL | c1=FR"
  2638. @end example
  2639. Given the same source, you can also switch front left and front right channels
  2640. and keep the input channel layout:
  2641. @example
  2642. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2643. @end example
  2644. If the input is a stereo audio stream, you can mute the front left channel (and
  2645. still keep the stereo channel layout) with:
  2646. @example
  2647. pan="stereo|c1=c1"
  2648. @end example
  2649. Still with a stereo audio stream input, you can copy the right channel in both
  2650. front left and right:
  2651. @example
  2652. pan="stereo| c0=FR | c1=FR"
  2653. @end example
  2654. @section replaygain
  2655. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2656. outputs it unchanged.
  2657. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2658. @section resample
  2659. Convert the audio sample format, sample rate and channel layout. It is
  2660. not meant to be used directly.
  2661. @section rubberband
  2662. Apply time-stretching and pitch-shifting with librubberband.
  2663. The filter accepts the following options:
  2664. @table @option
  2665. @item tempo
  2666. Set tempo scale factor.
  2667. @item pitch
  2668. Set pitch scale factor.
  2669. @item transients
  2670. Set transients detector.
  2671. Possible values are:
  2672. @table @var
  2673. @item crisp
  2674. @item mixed
  2675. @item smooth
  2676. @end table
  2677. @item detector
  2678. Set detector.
  2679. Possible values are:
  2680. @table @var
  2681. @item compound
  2682. @item percussive
  2683. @item soft
  2684. @end table
  2685. @item phase
  2686. Set phase.
  2687. Possible values are:
  2688. @table @var
  2689. @item laminar
  2690. @item independent
  2691. @end table
  2692. @item window
  2693. Set processing window size.
  2694. Possible values are:
  2695. @table @var
  2696. @item standard
  2697. @item short
  2698. @item long
  2699. @end table
  2700. @item smoothing
  2701. Set smoothing.
  2702. Possible values are:
  2703. @table @var
  2704. @item off
  2705. @item on
  2706. @end table
  2707. @item formant
  2708. Enable formant preservation when shift pitching.
  2709. Possible values are:
  2710. @table @var
  2711. @item shifted
  2712. @item preserved
  2713. @end table
  2714. @item pitchq
  2715. Set pitch quality.
  2716. Possible values are:
  2717. @table @var
  2718. @item quality
  2719. @item speed
  2720. @item consistency
  2721. @end table
  2722. @item channels
  2723. Set channels.
  2724. Possible values are:
  2725. @table @var
  2726. @item apart
  2727. @item together
  2728. @end table
  2729. @end table
  2730. @section sidechaincompress
  2731. This filter acts like normal compressor but has the ability to compress
  2732. detected signal using second input signal.
  2733. It needs two input streams and returns one output stream.
  2734. First input stream will be processed depending on second stream signal.
  2735. The filtered signal then can be filtered with other filters in later stages of
  2736. processing. See @ref{pan} and @ref{amerge} filter.
  2737. The filter accepts the following options:
  2738. @table @option
  2739. @item level_in
  2740. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2741. @item threshold
  2742. If a signal of second stream raises above this level it will affect the gain
  2743. reduction of first stream.
  2744. By default is 0.125. Range is between 0.00097563 and 1.
  2745. @item ratio
  2746. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2747. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2748. Default is 2. Range is between 1 and 20.
  2749. @item attack
  2750. Amount of milliseconds the signal has to rise above the threshold before gain
  2751. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2752. @item release
  2753. Amount of milliseconds the signal has to fall below the threshold before
  2754. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2755. @item makeup
  2756. Set the amount by how much signal will be amplified after processing.
  2757. Default is 1. Range is from 1 to 64.
  2758. @item knee
  2759. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2760. Default is 2.82843. Range is between 1 and 8.
  2761. @item link
  2762. Choose if the @code{average} level between all channels of side-chain stream
  2763. or the louder(@code{maximum}) channel of side-chain stream affects the
  2764. reduction. Default is @code{average}.
  2765. @item detection
  2766. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2767. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2768. @item level_sc
  2769. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2770. @item mix
  2771. How much to use compressed signal in output. Default is 1.
  2772. Range is between 0 and 1.
  2773. @end table
  2774. @subsection Examples
  2775. @itemize
  2776. @item
  2777. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2778. depending on the signal of 2nd input and later compressed signal to be
  2779. merged with 2nd input:
  2780. @example
  2781. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2782. @end example
  2783. @end itemize
  2784. @section sidechaingate
  2785. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2786. filter the detected signal before sending it to the gain reduction stage.
  2787. Normally a gate uses the full range signal to detect a level above the
  2788. threshold.
  2789. For example: If you cut all lower frequencies from your sidechain signal
  2790. the gate will decrease the volume of your track only if not enough highs
  2791. appear. With this technique you are able to reduce the resonation of a
  2792. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2793. guitar.
  2794. It needs two input streams and returns one output stream.
  2795. First input stream will be processed depending on second stream signal.
  2796. The filter accepts the following options:
  2797. @table @option
  2798. @item level_in
  2799. Set input level before filtering.
  2800. Default is 1. Allowed range is from 0.015625 to 64.
  2801. @item range
  2802. Set the level of gain reduction when the signal is below the threshold.
  2803. Default is 0.06125. Allowed range is from 0 to 1.
  2804. @item threshold
  2805. If a signal rises above this level the gain reduction is released.
  2806. Default is 0.125. Allowed range is from 0 to 1.
  2807. @item ratio
  2808. Set a ratio about which the signal is reduced.
  2809. Default is 2. Allowed range is from 1 to 9000.
  2810. @item attack
  2811. Amount of milliseconds the signal has to rise above the threshold before gain
  2812. reduction stops.
  2813. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2814. @item release
  2815. Amount of milliseconds the signal has to fall below the threshold before the
  2816. reduction is increased again. Default is 250 milliseconds.
  2817. Allowed range is from 0.01 to 9000.
  2818. @item makeup
  2819. Set amount of amplification of signal after processing.
  2820. Default is 1. Allowed range is from 1 to 64.
  2821. @item knee
  2822. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2823. Default is 2.828427125. Allowed range is from 1 to 8.
  2824. @item detection
  2825. Choose if exact signal should be taken for detection or an RMS like one.
  2826. Default is rms. Can be peak or rms.
  2827. @item link
  2828. Choose if the average level between all channels or the louder channel affects
  2829. the reduction.
  2830. Default is average. Can be average or maximum.
  2831. @item level_sc
  2832. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2833. @end table
  2834. @section silencedetect
  2835. Detect silence in an audio stream.
  2836. This filter logs a message when it detects that the input audio volume is less
  2837. or equal to a noise tolerance value for a duration greater or equal to the
  2838. minimum detected noise duration.
  2839. The printed times and duration are expressed in seconds.
  2840. The filter accepts the following options:
  2841. @table @option
  2842. @item duration, d
  2843. Set silence duration until notification (default is 2 seconds).
  2844. @item noise, n
  2845. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2846. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2847. @end table
  2848. @subsection Examples
  2849. @itemize
  2850. @item
  2851. Detect 5 seconds of silence with -50dB noise tolerance:
  2852. @example
  2853. silencedetect=n=-50dB:d=5
  2854. @end example
  2855. @item
  2856. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2857. tolerance in @file{silence.mp3}:
  2858. @example
  2859. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2860. @end example
  2861. @end itemize
  2862. @section silenceremove
  2863. Remove silence from the beginning, middle or end of the audio.
  2864. The filter accepts the following options:
  2865. @table @option
  2866. @item start_periods
  2867. This value is used to indicate if audio should be trimmed at beginning of
  2868. the audio. A value of zero indicates no silence should be trimmed from the
  2869. beginning. When specifying a non-zero value, it trims audio up until it
  2870. finds non-silence. Normally, when trimming silence from beginning of audio
  2871. the @var{start_periods} will be @code{1} but it can be increased to higher
  2872. values to trim all audio up to specific count of non-silence periods.
  2873. Default value is @code{0}.
  2874. @item start_duration
  2875. Specify the amount of time that non-silence must be detected before it stops
  2876. trimming audio. By increasing the duration, bursts of noises can be treated
  2877. as silence and trimmed off. Default value is @code{0}.
  2878. @item start_threshold
  2879. This indicates what sample value should be treated as silence. For digital
  2880. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2881. you may wish to increase the value to account for background noise.
  2882. Can be specified in dB (in case "dB" is appended to the specified value)
  2883. or amplitude ratio. Default value is @code{0}.
  2884. @item stop_periods
  2885. Set the count for trimming silence from the end of audio.
  2886. To remove silence from the middle of a file, specify a @var{stop_periods}
  2887. that is negative. This value is then treated as a positive value and is
  2888. used to indicate the effect should restart processing as specified by
  2889. @var{start_periods}, making it suitable for removing periods of silence
  2890. in the middle of the audio.
  2891. Default value is @code{0}.
  2892. @item stop_duration
  2893. Specify a duration of silence that must exist before audio is not copied any
  2894. more. By specifying a higher duration, silence that is wanted can be left in
  2895. the audio.
  2896. Default value is @code{0}.
  2897. @item stop_threshold
  2898. This is the same as @option{start_threshold} but for trimming silence from
  2899. the end of audio.
  2900. Can be specified in dB (in case "dB" is appended to the specified value)
  2901. or amplitude ratio. Default value is @code{0}.
  2902. @item leave_silence
  2903. This indicates that @var{stop_duration} length of audio should be left intact
  2904. at the beginning of each period of silence.
  2905. For example, if you want to remove long pauses between words but do not want
  2906. to remove the pauses completely. Default value is @code{0}.
  2907. @item detection
  2908. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  2909. and works better with digital silence which is exactly 0.
  2910. Default value is @code{rms}.
  2911. @item window
  2912. Set ratio used to calculate size of window for detecting silence.
  2913. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  2914. @end table
  2915. @subsection Examples
  2916. @itemize
  2917. @item
  2918. The following example shows how this filter can be used to start a recording
  2919. that does not contain the delay at the start which usually occurs between
  2920. pressing the record button and the start of the performance:
  2921. @example
  2922. silenceremove=1:5:0.02
  2923. @end example
  2924. @item
  2925. Trim all silence encountered from beginning to end where there is more than 1
  2926. second of silence in audio:
  2927. @example
  2928. silenceremove=0:0:0:-1:1:-90dB
  2929. @end example
  2930. @end itemize
  2931. @section sofalizer
  2932. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  2933. loudspeakers around the user for binaural listening via headphones (audio
  2934. formats up to 9 channels supported).
  2935. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  2936. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  2937. Austrian Academy of Sciences.
  2938. To enable compilation of this filter you need to configure FFmpeg with
  2939. @code{--enable-libmysofa}.
  2940. The filter accepts the following options:
  2941. @table @option
  2942. @item sofa
  2943. Set the SOFA file used for rendering.
  2944. @item gain
  2945. Set gain applied to audio. Value is in dB. Default is 0.
  2946. @item rotation
  2947. Set rotation of virtual loudspeakers in deg. Default is 0.
  2948. @item elevation
  2949. Set elevation of virtual speakers in deg. Default is 0.
  2950. @item radius
  2951. Set distance in meters between loudspeakers and the listener with near-field
  2952. HRTFs. Default is 1.
  2953. @item type
  2954. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2955. processing audio in time domain which is slow.
  2956. @var{freq} is processing audio in frequency domain which is fast.
  2957. Default is @var{freq}.
  2958. @item speakers
  2959. Set custom positions of virtual loudspeakers. Syntax for this option is:
  2960. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  2961. Each virtual loudspeaker is described with short channel name following with
  2962. azimuth and elevation in degrees.
  2963. Each virtual loudspeaker description is separated by '|'.
  2964. For example to override front left and front right channel positions use:
  2965. 'speakers=FL 45 15|FR 345 15'.
  2966. Descriptions with unrecognised channel names are ignored.
  2967. @item lfegain
  2968. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2969. @end table
  2970. @subsection Examples
  2971. @itemize
  2972. @item
  2973. Using ClubFritz6 sofa file:
  2974. @example
  2975. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  2976. @end example
  2977. @item
  2978. Using ClubFritz12 sofa file and bigger radius with small rotation:
  2979. @example
  2980. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  2981. @end example
  2982. @item
  2983. Similar as above but with custom speaker positions for front left, front right, back left and back right
  2984. and also with custom gain:
  2985. @example
  2986. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  2987. @end example
  2988. @end itemize
  2989. @section stereotools
  2990. This filter has some handy utilities to manage stereo signals, for converting
  2991. M/S stereo recordings to L/R signal while having control over the parameters
  2992. or spreading the stereo image of master track.
  2993. The filter accepts the following options:
  2994. @table @option
  2995. @item level_in
  2996. Set input level before filtering for both channels. Defaults is 1.
  2997. Allowed range is from 0.015625 to 64.
  2998. @item level_out
  2999. Set output level after filtering for both channels. Defaults is 1.
  3000. Allowed range is from 0.015625 to 64.
  3001. @item balance_in
  3002. Set input balance between both channels. Default is 0.
  3003. Allowed range is from -1 to 1.
  3004. @item balance_out
  3005. Set output balance between both channels. Default is 0.
  3006. Allowed range is from -1 to 1.
  3007. @item softclip
  3008. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3009. clipping. Disabled by default.
  3010. @item mutel
  3011. Mute the left channel. Disabled by default.
  3012. @item muter
  3013. Mute the right channel. Disabled by default.
  3014. @item phasel
  3015. Change the phase of the left channel. Disabled by default.
  3016. @item phaser
  3017. Change the phase of the right channel. Disabled by default.
  3018. @item mode
  3019. Set stereo mode. Available values are:
  3020. @table @samp
  3021. @item lr>lr
  3022. Left/Right to Left/Right, this is default.
  3023. @item lr>ms
  3024. Left/Right to Mid/Side.
  3025. @item ms>lr
  3026. Mid/Side to Left/Right.
  3027. @item lr>ll
  3028. Left/Right to Left/Left.
  3029. @item lr>rr
  3030. Left/Right to Right/Right.
  3031. @item lr>l+r
  3032. Left/Right to Left + Right.
  3033. @item lr>rl
  3034. Left/Right to Right/Left.
  3035. @item ms>ll
  3036. Mid/Side to Left/Left.
  3037. @item ms>rr
  3038. Mid/Side to Right/Right.
  3039. @end table
  3040. @item slev
  3041. Set level of side signal. Default is 1.
  3042. Allowed range is from 0.015625 to 64.
  3043. @item sbal
  3044. Set balance of side signal. Default is 0.
  3045. Allowed range is from -1 to 1.
  3046. @item mlev
  3047. Set level of the middle signal. Default is 1.
  3048. Allowed range is from 0.015625 to 64.
  3049. @item mpan
  3050. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3051. @item base
  3052. Set stereo base between mono and inversed channels. Default is 0.
  3053. Allowed range is from -1 to 1.
  3054. @item delay
  3055. Set delay in milliseconds how much to delay left from right channel and
  3056. vice versa. Default is 0. Allowed range is from -20 to 20.
  3057. @item sclevel
  3058. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3059. @item phase
  3060. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3061. @item bmode_in, bmode_out
  3062. Set balance mode for balance_in/balance_out option.
  3063. Can be one of the following:
  3064. @table @samp
  3065. @item balance
  3066. Classic balance mode. Attenuate one channel at time.
  3067. Gain is raised up to 1.
  3068. @item amplitude
  3069. Similar as classic mode above but gain is raised up to 2.
  3070. @item power
  3071. Equal power distribution, from -6dB to +6dB range.
  3072. @end table
  3073. @end table
  3074. @subsection Examples
  3075. @itemize
  3076. @item
  3077. Apply karaoke like effect:
  3078. @example
  3079. stereotools=mlev=0.015625
  3080. @end example
  3081. @item
  3082. Convert M/S signal to L/R:
  3083. @example
  3084. "stereotools=mode=ms>lr"
  3085. @end example
  3086. @end itemize
  3087. @section stereowiden
  3088. This filter enhance the stereo effect by suppressing signal common to both
  3089. channels and by delaying the signal of left into right and vice versa,
  3090. thereby widening the stereo effect.
  3091. The filter accepts the following options:
  3092. @table @option
  3093. @item delay
  3094. Time in milliseconds of the delay of left signal into right and vice versa.
  3095. Default is 20 milliseconds.
  3096. @item feedback
  3097. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3098. effect of left signal in right output and vice versa which gives widening
  3099. effect. Default is 0.3.
  3100. @item crossfeed
  3101. Cross feed of left into right with inverted phase. This helps in suppressing
  3102. the mono. If the value is 1 it will cancel all the signal common to both
  3103. channels. Default is 0.3.
  3104. @item drymix
  3105. Set level of input signal of original channel. Default is 0.8.
  3106. @end table
  3107. @section superequalizer
  3108. Apply 18 band equalizer.
  3109. The filter accepts the following options:
  3110. @table @option
  3111. @item 1b
  3112. Set 65Hz band gain.
  3113. @item 2b
  3114. Set 92Hz band gain.
  3115. @item 3b
  3116. Set 131Hz band gain.
  3117. @item 4b
  3118. Set 185Hz band gain.
  3119. @item 5b
  3120. Set 262Hz band gain.
  3121. @item 6b
  3122. Set 370Hz band gain.
  3123. @item 7b
  3124. Set 523Hz band gain.
  3125. @item 8b
  3126. Set 740Hz band gain.
  3127. @item 9b
  3128. Set 1047Hz band gain.
  3129. @item 10b
  3130. Set 1480Hz band gain.
  3131. @item 11b
  3132. Set 2093Hz band gain.
  3133. @item 12b
  3134. Set 2960Hz band gain.
  3135. @item 13b
  3136. Set 4186Hz band gain.
  3137. @item 14b
  3138. Set 5920Hz band gain.
  3139. @item 15b
  3140. Set 8372Hz band gain.
  3141. @item 16b
  3142. Set 11840Hz band gain.
  3143. @item 17b
  3144. Set 16744Hz band gain.
  3145. @item 18b
  3146. Set 20000Hz band gain.
  3147. @end table
  3148. @section surround
  3149. Apply audio surround upmix filter.
  3150. This filter allows to produce multichannel output from audio stream.
  3151. The filter accepts the following options:
  3152. @table @option
  3153. @item chl_out
  3154. Set output channel layout. By default, this is @var{5.1}.
  3155. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3156. for the required syntax.
  3157. @item chl_in
  3158. Set input channel layout. By default, this is @var{stereo}.
  3159. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3160. for the required syntax.
  3161. @item level_in
  3162. Set input volume level. By default, this is @var{1}.
  3163. @item level_out
  3164. Set output volume level. By default, this is @var{1}.
  3165. @item lfe
  3166. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3167. @item lfe_low
  3168. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3169. @item lfe_high
  3170. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3171. @item fc_in
  3172. Set front center input volume. By default, this is @var{1}.
  3173. @item fc_out
  3174. Set front center output volume. By default, this is @var{1}.
  3175. @item lfe_in
  3176. Set LFE input volume. By default, this is @var{1}.
  3177. @item lfe_out
  3178. Set LFE output volume. By default, this is @var{1}.
  3179. @end table
  3180. @section treble
  3181. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3182. shelving filter with a response similar to that of a standard
  3183. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3184. The filter accepts the following options:
  3185. @table @option
  3186. @item gain, g
  3187. Give the gain at whichever is the lower of ~22 kHz and the
  3188. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3189. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3190. @item frequency, f
  3191. Set the filter's central frequency and so can be used
  3192. to extend or reduce the frequency range to be boosted or cut.
  3193. The default value is @code{3000} Hz.
  3194. @item width_type, t
  3195. Set method to specify band-width of filter.
  3196. @table @option
  3197. @item h
  3198. Hz
  3199. @item q
  3200. Q-Factor
  3201. @item o
  3202. octave
  3203. @item s
  3204. slope
  3205. @end table
  3206. @item width, w
  3207. Determine how steep is the filter's shelf transition.
  3208. @item channels, c
  3209. Specify which channels to filter, by default all available are filtered.
  3210. @end table
  3211. @section tremolo
  3212. Sinusoidal amplitude modulation.
  3213. The filter accepts the following options:
  3214. @table @option
  3215. @item f
  3216. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3217. (20 Hz or lower) will result in a tremolo effect.
  3218. This filter may also be used as a ring modulator by specifying
  3219. a modulation frequency higher than 20 Hz.
  3220. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3221. @item d
  3222. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3223. Default value is 0.5.
  3224. @end table
  3225. @section vibrato
  3226. Sinusoidal phase modulation.
  3227. The filter accepts the following options:
  3228. @table @option
  3229. @item f
  3230. Modulation frequency in Hertz.
  3231. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3232. @item d
  3233. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3234. Default value is 0.5.
  3235. @end table
  3236. @section volume
  3237. Adjust the input audio volume.
  3238. It accepts the following parameters:
  3239. @table @option
  3240. @item volume
  3241. Set audio volume expression.
  3242. Output values are clipped to the maximum value.
  3243. The output audio volume is given by the relation:
  3244. @example
  3245. @var{output_volume} = @var{volume} * @var{input_volume}
  3246. @end example
  3247. The default value for @var{volume} is "1.0".
  3248. @item precision
  3249. This parameter represents the mathematical precision.
  3250. It determines which input sample formats will be allowed, which affects the
  3251. precision of the volume scaling.
  3252. @table @option
  3253. @item fixed
  3254. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3255. @item float
  3256. 32-bit floating-point; this limits input sample format to FLT. (default)
  3257. @item double
  3258. 64-bit floating-point; this limits input sample format to DBL.
  3259. @end table
  3260. @item replaygain
  3261. Choose the behaviour on encountering ReplayGain side data in input frames.
  3262. @table @option
  3263. @item drop
  3264. Remove ReplayGain side data, ignoring its contents (the default).
  3265. @item ignore
  3266. Ignore ReplayGain side data, but leave it in the frame.
  3267. @item track
  3268. Prefer the track gain, if present.
  3269. @item album
  3270. Prefer the album gain, if present.
  3271. @end table
  3272. @item replaygain_preamp
  3273. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3274. Default value for @var{replaygain_preamp} is 0.0.
  3275. @item eval
  3276. Set when the volume expression is evaluated.
  3277. It accepts the following values:
  3278. @table @samp
  3279. @item once
  3280. only evaluate expression once during the filter initialization, or
  3281. when the @samp{volume} command is sent
  3282. @item frame
  3283. evaluate expression for each incoming frame
  3284. @end table
  3285. Default value is @samp{once}.
  3286. @end table
  3287. The volume expression can contain the following parameters.
  3288. @table @option
  3289. @item n
  3290. frame number (starting at zero)
  3291. @item nb_channels
  3292. number of channels
  3293. @item nb_consumed_samples
  3294. number of samples consumed by the filter
  3295. @item nb_samples
  3296. number of samples in the current frame
  3297. @item pos
  3298. original frame position in the file
  3299. @item pts
  3300. frame PTS
  3301. @item sample_rate
  3302. sample rate
  3303. @item startpts
  3304. PTS at start of stream
  3305. @item startt
  3306. time at start of stream
  3307. @item t
  3308. frame time
  3309. @item tb
  3310. timestamp timebase
  3311. @item volume
  3312. last set volume value
  3313. @end table
  3314. Note that when @option{eval} is set to @samp{once} only the
  3315. @var{sample_rate} and @var{tb} variables are available, all other
  3316. variables will evaluate to NAN.
  3317. @subsection Commands
  3318. This filter supports the following commands:
  3319. @table @option
  3320. @item volume
  3321. Modify the volume expression.
  3322. The command accepts the same syntax of the corresponding option.
  3323. If the specified expression is not valid, it is kept at its current
  3324. value.
  3325. @item replaygain_noclip
  3326. Prevent clipping by limiting the gain applied.
  3327. Default value for @var{replaygain_noclip} is 1.
  3328. @end table
  3329. @subsection Examples
  3330. @itemize
  3331. @item
  3332. Halve the input audio volume:
  3333. @example
  3334. volume=volume=0.5
  3335. volume=volume=1/2
  3336. volume=volume=-6.0206dB
  3337. @end example
  3338. In all the above example the named key for @option{volume} can be
  3339. omitted, for example like in:
  3340. @example
  3341. volume=0.5
  3342. @end example
  3343. @item
  3344. Increase input audio power by 6 decibels using fixed-point precision:
  3345. @example
  3346. volume=volume=6dB:precision=fixed
  3347. @end example
  3348. @item
  3349. Fade volume after time 10 with an annihilation period of 5 seconds:
  3350. @example
  3351. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3352. @end example
  3353. @end itemize
  3354. @section volumedetect
  3355. Detect the volume of the input video.
  3356. The filter has no parameters. The input is not modified. Statistics about
  3357. the volume will be printed in the log when the input stream end is reached.
  3358. In particular it will show the mean volume (root mean square), maximum
  3359. volume (on a per-sample basis), and the beginning of a histogram of the
  3360. registered volume values (from the maximum value to a cumulated 1/1000 of
  3361. the samples).
  3362. All volumes are in decibels relative to the maximum PCM value.
  3363. @subsection Examples
  3364. Here is an excerpt of the output:
  3365. @example
  3366. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3367. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3368. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3369. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3370. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3371. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3372. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3373. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3374. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3375. @end example
  3376. It means that:
  3377. @itemize
  3378. @item
  3379. The mean square energy is approximately -27 dB, or 10^-2.7.
  3380. @item
  3381. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3382. @item
  3383. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3384. @end itemize
  3385. In other words, raising the volume by +4 dB does not cause any clipping,
  3386. raising it by +5 dB causes clipping for 6 samples, etc.
  3387. @c man end AUDIO FILTERS
  3388. @chapter Audio Sources
  3389. @c man begin AUDIO SOURCES
  3390. Below is a description of the currently available audio sources.
  3391. @section abuffer
  3392. Buffer audio frames, and make them available to the filter chain.
  3393. This source is mainly intended for a programmatic use, in particular
  3394. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3395. It accepts the following parameters:
  3396. @table @option
  3397. @item time_base
  3398. The timebase which will be used for timestamps of submitted frames. It must be
  3399. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3400. @item sample_rate
  3401. The sample rate of the incoming audio buffers.
  3402. @item sample_fmt
  3403. The sample format of the incoming audio buffers.
  3404. Either a sample format name or its corresponding integer representation from
  3405. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3406. @item channel_layout
  3407. The channel layout of the incoming audio buffers.
  3408. Either a channel layout name from channel_layout_map in
  3409. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3410. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3411. @item channels
  3412. The number of channels of the incoming audio buffers.
  3413. If both @var{channels} and @var{channel_layout} are specified, then they
  3414. must be consistent.
  3415. @end table
  3416. @subsection Examples
  3417. @example
  3418. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3419. @end example
  3420. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3421. Since the sample format with name "s16p" corresponds to the number
  3422. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3423. equivalent to:
  3424. @example
  3425. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3426. @end example
  3427. @section aevalsrc
  3428. Generate an audio signal specified by an expression.
  3429. This source accepts in input one or more expressions (one for each
  3430. channel), which are evaluated and used to generate a corresponding
  3431. audio signal.
  3432. This source accepts the following options:
  3433. @table @option
  3434. @item exprs
  3435. Set the '|'-separated expressions list for each separate channel. In case the
  3436. @option{channel_layout} option is not specified, the selected channel layout
  3437. depends on the number of provided expressions. Otherwise the last
  3438. specified expression is applied to the remaining output channels.
  3439. @item channel_layout, c
  3440. Set the channel layout. The number of channels in the specified layout
  3441. must be equal to the number of specified expressions.
  3442. @item duration, d
  3443. Set the minimum duration of the sourced audio. See
  3444. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3445. for the accepted syntax.
  3446. Note that the resulting duration may be greater than the specified
  3447. duration, as the generated audio is always cut at the end of a
  3448. complete frame.
  3449. If not specified, or the expressed duration is negative, the audio is
  3450. supposed to be generated forever.
  3451. @item nb_samples, n
  3452. Set the number of samples per channel per each output frame,
  3453. default to 1024.
  3454. @item sample_rate, s
  3455. Specify the sample rate, default to 44100.
  3456. @end table
  3457. Each expression in @var{exprs} can contain the following constants:
  3458. @table @option
  3459. @item n
  3460. number of the evaluated sample, starting from 0
  3461. @item t
  3462. time of the evaluated sample expressed in seconds, starting from 0
  3463. @item s
  3464. sample rate
  3465. @end table
  3466. @subsection Examples
  3467. @itemize
  3468. @item
  3469. Generate silence:
  3470. @example
  3471. aevalsrc=0
  3472. @end example
  3473. @item
  3474. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3475. 8000 Hz:
  3476. @example
  3477. aevalsrc="sin(440*2*PI*t):s=8000"
  3478. @end example
  3479. @item
  3480. Generate a two channels signal, specify the channel layout (Front
  3481. Center + Back Center) explicitly:
  3482. @example
  3483. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3484. @end example
  3485. @item
  3486. Generate white noise:
  3487. @example
  3488. aevalsrc="-2+random(0)"
  3489. @end example
  3490. @item
  3491. Generate an amplitude modulated signal:
  3492. @example
  3493. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3494. @end example
  3495. @item
  3496. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3497. @example
  3498. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3499. @end example
  3500. @end itemize
  3501. @section anullsrc
  3502. The null audio source, return unprocessed audio frames. It is mainly useful
  3503. as a template and to be employed in analysis / debugging tools, or as
  3504. the source for filters which ignore the input data (for example the sox
  3505. synth filter).
  3506. This source accepts the following options:
  3507. @table @option
  3508. @item channel_layout, cl
  3509. Specifies the channel layout, and can be either an integer or a string
  3510. representing a channel layout. The default value of @var{channel_layout}
  3511. is "stereo".
  3512. Check the channel_layout_map definition in
  3513. @file{libavutil/channel_layout.c} for the mapping between strings and
  3514. channel layout values.
  3515. @item sample_rate, r
  3516. Specifies the sample rate, and defaults to 44100.
  3517. @item nb_samples, n
  3518. Set the number of samples per requested frames.
  3519. @end table
  3520. @subsection Examples
  3521. @itemize
  3522. @item
  3523. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3524. @example
  3525. anullsrc=r=48000:cl=4
  3526. @end example
  3527. @item
  3528. Do the same operation with a more obvious syntax:
  3529. @example
  3530. anullsrc=r=48000:cl=mono
  3531. @end example
  3532. @end itemize
  3533. All the parameters need to be explicitly defined.
  3534. @section flite
  3535. Synthesize a voice utterance using the libflite library.
  3536. To enable compilation of this filter you need to configure FFmpeg with
  3537. @code{--enable-libflite}.
  3538. Note that versions of the flite library prior to 2.0 are not thread-safe.
  3539. The filter accepts the following options:
  3540. @table @option
  3541. @item list_voices
  3542. If set to 1, list the names of the available voices and exit
  3543. immediately. Default value is 0.
  3544. @item nb_samples, n
  3545. Set the maximum number of samples per frame. Default value is 512.
  3546. @item textfile
  3547. Set the filename containing the text to speak.
  3548. @item text
  3549. Set the text to speak.
  3550. @item voice, v
  3551. Set the voice to use for the speech synthesis. Default value is
  3552. @code{kal}. See also the @var{list_voices} option.
  3553. @end table
  3554. @subsection Examples
  3555. @itemize
  3556. @item
  3557. Read from file @file{speech.txt}, and synthesize the text using the
  3558. standard flite voice:
  3559. @example
  3560. flite=textfile=speech.txt
  3561. @end example
  3562. @item
  3563. Read the specified text selecting the @code{slt} voice:
  3564. @example
  3565. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3566. @end example
  3567. @item
  3568. Input text to ffmpeg:
  3569. @example
  3570. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3571. @end example
  3572. @item
  3573. Make @file{ffplay} speak the specified text, using @code{flite} and
  3574. the @code{lavfi} device:
  3575. @example
  3576. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3577. @end example
  3578. @end itemize
  3579. For more information about libflite, check:
  3580. @url{http://www.festvox.org/flite/}
  3581. @section anoisesrc
  3582. Generate a noise audio signal.
  3583. The filter accepts the following options:
  3584. @table @option
  3585. @item sample_rate, r
  3586. Specify the sample rate. Default value is 48000 Hz.
  3587. @item amplitude, a
  3588. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3589. is 1.0.
  3590. @item duration, d
  3591. Specify the duration of the generated audio stream. Not specifying this option
  3592. results in noise with an infinite length.
  3593. @item color, colour, c
  3594. Specify the color of noise. Available noise colors are white, pink, brown,
  3595. blue and violet. Default color is white.
  3596. @item seed, s
  3597. Specify a value used to seed the PRNG.
  3598. @item nb_samples, n
  3599. Set the number of samples per each output frame, default is 1024.
  3600. @end table
  3601. @subsection Examples
  3602. @itemize
  3603. @item
  3604. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3605. @example
  3606. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3607. @end example
  3608. @end itemize
  3609. @section sine
  3610. Generate an audio signal made of a sine wave with amplitude 1/8.
  3611. The audio signal is bit-exact.
  3612. The filter accepts the following options:
  3613. @table @option
  3614. @item frequency, f
  3615. Set the carrier frequency. Default is 440 Hz.
  3616. @item beep_factor, b
  3617. Enable a periodic beep every second with frequency @var{beep_factor} times
  3618. the carrier frequency. Default is 0, meaning the beep is disabled.
  3619. @item sample_rate, r
  3620. Specify the sample rate, default is 44100.
  3621. @item duration, d
  3622. Specify the duration of the generated audio stream.
  3623. @item samples_per_frame
  3624. Set the number of samples per output frame.
  3625. The expression can contain the following constants:
  3626. @table @option
  3627. @item n
  3628. The (sequential) number of the output audio frame, starting from 0.
  3629. @item pts
  3630. The PTS (Presentation TimeStamp) of the output audio frame,
  3631. expressed in @var{TB} units.
  3632. @item t
  3633. The PTS of the output audio frame, expressed in seconds.
  3634. @item TB
  3635. The timebase of the output audio frames.
  3636. @end table
  3637. Default is @code{1024}.
  3638. @end table
  3639. @subsection Examples
  3640. @itemize
  3641. @item
  3642. Generate a simple 440 Hz sine wave:
  3643. @example
  3644. sine
  3645. @end example
  3646. @item
  3647. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3648. @example
  3649. sine=220:4:d=5
  3650. sine=f=220:b=4:d=5
  3651. sine=frequency=220:beep_factor=4:duration=5
  3652. @end example
  3653. @item
  3654. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3655. pattern:
  3656. @example
  3657. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3658. @end example
  3659. @end itemize
  3660. @c man end AUDIO SOURCES
  3661. @chapter Audio Sinks
  3662. @c man begin AUDIO SINKS
  3663. Below is a description of the currently available audio sinks.
  3664. @section abuffersink
  3665. Buffer audio frames, and make them available to the end of filter chain.
  3666. This sink is mainly intended for programmatic use, in particular
  3667. through the interface defined in @file{libavfilter/buffersink.h}
  3668. or the options system.
  3669. It accepts a pointer to an AVABufferSinkContext structure, which
  3670. defines the incoming buffers' formats, to be passed as the opaque
  3671. parameter to @code{avfilter_init_filter} for initialization.
  3672. @section anullsink
  3673. Null audio sink; do absolutely nothing with the input audio. It is
  3674. mainly useful as a template and for use in analysis / debugging
  3675. tools.
  3676. @c man end AUDIO SINKS
  3677. @chapter Video Filters
  3678. @c man begin VIDEO FILTERS
  3679. When you configure your FFmpeg build, you can disable any of the
  3680. existing filters using @code{--disable-filters}.
  3681. The configure output will show the video filters included in your
  3682. build.
  3683. Below is a description of the currently available video filters.
  3684. @section alphaextract
  3685. Extract the alpha component from the input as a grayscale video. This
  3686. is especially useful with the @var{alphamerge} filter.
  3687. @section alphamerge
  3688. Add or replace the alpha component of the primary input with the
  3689. grayscale value of a second input. This is intended for use with
  3690. @var{alphaextract} to allow the transmission or storage of frame
  3691. sequences that have alpha in a format that doesn't support an alpha
  3692. channel.
  3693. For example, to reconstruct full frames from a normal YUV-encoded video
  3694. and a separate video created with @var{alphaextract}, you might use:
  3695. @example
  3696. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3697. @end example
  3698. Since this filter is designed for reconstruction, it operates on frame
  3699. sequences without considering timestamps, and terminates when either
  3700. input reaches end of stream. This will cause problems if your encoding
  3701. pipeline drops frames. If you're trying to apply an image as an
  3702. overlay to a video stream, consider the @var{overlay} filter instead.
  3703. @section ass
  3704. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3705. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3706. Substation Alpha) subtitles files.
  3707. This filter accepts the following option in addition to the common options from
  3708. the @ref{subtitles} filter:
  3709. @table @option
  3710. @item shaping
  3711. Set the shaping engine
  3712. Available values are:
  3713. @table @samp
  3714. @item auto
  3715. The default libass shaping engine, which is the best available.
  3716. @item simple
  3717. Fast, font-agnostic shaper that can do only substitutions
  3718. @item complex
  3719. Slower shaper using OpenType for substitutions and positioning
  3720. @end table
  3721. The default is @code{auto}.
  3722. @end table
  3723. @section atadenoise
  3724. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3725. The filter accepts the following options:
  3726. @table @option
  3727. @item 0a
  3728. Set threshold A for 1st plane. Default is 0.02.
  3729. Valid range is 0 to 0.3.
  3730. @item 0b
  3731. Set threshold B for 1st plane. Default is 0.04.
  3732. Valid range is 0 to 5.
  3733. @item 1a
  3734. Set threshold A for 2nd plane. Default is 0.02.
  3735. Valid range is 0 to 0.3.
  3736. @item 1b
  3737. Set threshold B for 2nd plane. Default is 0.04.
  3738. Valid range is 0 to 5.
  3739. @item 2a
  3740. Set threshold A for 3rd plane. Default is 0.02.
  3741. Valid range is 0 to 0.3.
  3742. @item 2b
  3743. Set threshold B for 3rd plane. Default is 0.04.
  3744. Valid range is 0 to 5.
  3745. Threshold A is designed to react on abrupt changes in the input signal and
  3746. threshold B is designed to react on continuous changes in the input signal.
  3747. @item s
  3748. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3749. number in range [5, 129].
  3750. @item p
  3751. Set what planes of frame filter will use for averaging. Default is all.
  3752. @end table
  3753. @section avgblur
  3754. Apply average blur filter.
  3755. The filter accepts the following options:
  3756. @table @option
  3757. @item sizeX
  3758. Set horizontal kernel size.
  3759. @item planes
  3760. Set which planes to filter. By default all planes are filtered.
  3761. @item sizeY
  3762. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  3763. Default is @code{0}.
  3764. @end table
  3765. @section bbox
  3766. Compute the bounding box for the non-black pixels in the input frame
  3767. luminance plane.
  3768. This filter computes the bounding box containing all the pixels with a
  3769. luminance value greater than the minimum allowed value.
  3770. The parameters describing the bounding box are printed on the filter
  3771. log.
  3772. The filter accepts the following option:
  3773. @table @option
  3774. @item min_val
  3775. Set the minimal luminance value. Default is @code{16}.
  3776. @end table
  3777. @section bitplanenoise
  3778. Show and measure bit plane noise.
  3779. The filter accepts the following options:
  3780. @table @option
  3781. @item bitplane
  3782. Set which plane to analyze. Default is @code{1}.
  3783. @item filter
  3784. Filter out noisy pixels from @code{bitplane} set above.
  3785. Default is disabled.
  3786. @end table
  3787. @section blackdetect
  3788. Detect video intervals that are (almost) completely black. Can be
  3789. useful to detect chapter transitions, commercials, or invalid
  3790. recordings. Output lines contains the time for the start, end and
  3791. duration of the detected black interval expressed in seconds.
  3792. In order to display the output lines, you need to set the loglevel at
  3793. least to the AV_LOG_INFO value.
  3794. The filter accepts the following options:
  3795. @table @option
  3796. @item black_min_duration, d
  3797. Set the minimum detected black duration expressed in seconds. It must
  3798. be a non-negative floating point number.
  3799. Default value is 2.0.
  3800. @item picture_black_ratio_th, pic_th
  3801. Set the threshold for considering a picture "black".
  3802. Express the minimum value for the ratio:
  3803. @example
  3804. @var{nb_black_pixels} / @var{nb_pixels}
  3805. @end example
  3806. for which a picture is considered black.
  3807. Default value is 0.98.
  3808. @item pixel_black_th, pix_th
  3809. Set the threshold for considering a pixel "black".
  3810. The threshold expresses the maximum pixel luminance value for which a
  3811. pixel is considered "black". The provided value is scaled according to
  3812. the following equation:
  3813. @example
  3814. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  3815. @end example
  3816. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  3817. the input video format, the range is [0-255] for YUV full-range
  3818. formats and [16-235] for YUV non full-range formats.
  3819. Default value is 0.10.
  3820. @end table
  3821. The following example sets the maximum pixel threshold to the minimum
  3822. value, and detects only black intervals of 2 or more seconds:
  3823. @example
  3824. blackdetect=d=2:pix_th=0.00
  3825. @end example
  3826. @section blackframe
  3827. Detect frames that are (almost) completely black. Can be useful to
  3828. detect chapter transitions or commercials. Output lines consist of
  3829. the frame number of the detected frame, the percentage of blackness,
  3830. the position in the file if known or -1 and the timestamp in seconds.
  3831. In order to display the output lines, you need to set the loglevel at
  3832. least to the AV_LOG_INFO value.
  3833. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  3834. The value represents the percentage of pixels in the picture that
  3835. are below the threshold value.
  3836. It accepts the following parameters:
  3837. @table @option
  3838. @item amount
  3839. The percentage of the pixels that have to be below the threshold; it defaults to
  3840. @code{98}.
  3841. @item threshold, thresh
  3842. The threshold below which a pixel value is considered black; it defaults to
  3843. @code{32}.
  3844. @end table
  3845. @section blend, tblend
  3846. Blend two video frames into each other.
  3847. The @code{blend} filter takes two input streams and outputs one
  3848. stream, the first input is the "top" layer and second input is
  3849. "bottom" layer. By default, the output terminates when the longest input terminates.
  3850. The @code{tblend} (time blend) filter takes two consecutive frames
  3851. from one single stream, and outputs the result obtained by blending
  3852. the new frame on top of the old frame.
  3853. A description of the accepted options follows.
  3854. @table @option
  3855. @item c0_mode
  3856. @item c1_mode
  3857. @item c2_mode
  3858. @item c3_mode
  3859. @item all_mode
  3860. Set blend mode for specific pixel component or all pixel components in case
  3861. of @var{all_mode}. Default value is @code{normal}.
  3862. Available values for component modes are:
  3863. @table @samp
  3864. @item addition
  3865. @item grainmerge
  3866. @item and
  3867. @item average
  3868. @item burn
  3869. @item darken
  3870. @item difference
  3871. @item grainextract
  3872. @item divide
  3873. @item dodge
  3874. @item freeze
  3875. @item exclusion
  3876. @item extremity
  3877. @item glow
  3878. @item hardlight
  3879. @item hardmix
  3880. @item heat
  3881. @item lighten
  3882. @item linearlight
  3883. @item multiply
  3884. @item multiply128
  3885. @item negation
  3886. @item normal
  3887. @item or
  3888. @item overlay
  3889. @item phoenix
  3890. @item pinlight
  3891. @item reflect
  3892. @item screen
  3893. @item softlight
  3894. @item subtract
  3895. @item vividlight
  3896. @item xor
  3897. @end table
  3898. @item c0_opacity
  3899. @item c1_opacity
  3900. @item c2_opacity
  3901. @item c3_opacity
  3902. @item all_opacity
  3903. Set blend opacity for specific pixel component or all pixel components in case
  3904. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  3905. @item c0_expr
  3906. @item c1_expr
  3907. @item c2_expr
  3908. @item c3_expr
  3909. @item all_expr
  3910. Set blend expression for specific pixel component or all pixel components in case
  3911. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3912. The expressions can use the following variables:
  3913. @table @option
  3914. @item N
  3915. The sequential number of the filtered frame, starting from @code{0}.
  3916. @item X
  3917. @item Y
  3918. the coordinates of the current sample
  3919. @item W
  3920. @item H
  3921. the width and height of currently filtered plane
  3922. @item SW
  3923. @item SH
  3924. Width and height scale depending on the currently filtered plane. It is the
  3925. ratio between the corresponding luma plane number of pixels and the current
  3926. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3927. @code{0.5,0.5} for chroma planes.
  3928. @item T
  3929. Time of the current frame, expressed in seconds.
  3930. @item TOP, A
  3931. Value of pixel component at current location for first video frame (top layer).
  3932. @item BOTTOM, B
  3933. Value of pixel component at current location for second video frame (bottom layer).
  3934. @end table
  3935. @end table
  3936. The @code{blend} filter also supports the @ref{framesync} options.
  3937. @subsection Examples
  3938. @itemize
  3939. @item
  3940. Apply transition from bottom layer to top layer in first 10 seconds:
  3941. @example
  3942. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3943. @end example
  3944. @item
  3945. Apply linear horizontal transition from top layer to bottom layer:
  3946. @example
  3947. blend=all_expr='A*(X/W)+B*(1-X/W)'
  3948. @end example
  3949. @item
  3950. Apply 1x1 checkerboard effect:
  3951. @example
  3952. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  3953. @end example
  3954. @item
  3955. Apply uncover left effect:
  3956. @example
  3957. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  3958. @end example
  3959. @item
  3960. Apply uncover down effect:
  3961. @example
  3962. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  3963. @end example
  3964. @item
  3965. Apply uncover up-left effect:
  3966. @example
  3967. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  3968. @end example
  3969. @item
  3970. Split diagonally video and shows top and bottom layer on each side:
  3971. @example
  3972. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  3973. @end example
  3974. @item
  3975. Display differences between the current and the previous frame:
  3976. @example
  3977. tblend=all_mode=grainextract
  3978. @end example
  3979. @end itemize
  3980. @section boxblur
  3981. Apply a boxblur algorithm to the input video.
  3982. It accepts the following parameters:
  3983. @table @option
  3984. @item luma_radius, lr
  3985. @item luma_power, lp
  3986. @item chroma_radius, cr
  3987. @item chroma_power, cp
  3988. @item alpha_radius, ar
  3989. @item alpha_power, ap
  3990. @end table
  3991. A description of the accepted options follows.
  3992. @table @option
  3993. @item luma_radius, lr
  3994. @item chroma_radius, cr
  3995. @item alpha_radius, ar
  3996. Set an expression for the box radius in pixels used for blurring the
  3997. corresponding input plane.
  3998. The radius value must be a non-negative number, and must not be
  3999. greater than the value of the expression @code{min(w,h)/2} for the
  4000. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4001. planes.
  4002. Default value for @option{luma_radius} is "2". If not specified,
  4003. @option{chroma_radius} and @option{alpha_radius} default to the
  4004. corresponding value set for @option{luma_radius}.
  4005. The expressions can contain the following constants:
  4006. @table @option
  4007. @item w
  4008. @item h
  4009. The input width and height in pixels.
  4010. @item cw
  4011. @item ch
  4012. The input chroma image width and height in pixels.
  4013. @item hsub
  4014. @item vsub
  4015. The horizontal and vertical chroma subsample values. For example, for the
  4016. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4017. @end table
  4018. @item luma_power, lp
  4019. @item chroma_power, cp
  4020. @item alpha_power, ap
  4021. Specify how many times the boxblur filter is applied to the
  4022. corresponding plane.
  4023. Default value for @option{luma_power} is 2. If not specified,
  4024. @option{chroma_power} and @option{alpha_power} default to the
  4025. corresponding value set for @option{luma_power}.
  4026. A value of 0 will disable the effect.
  4027. @end table
  4028. @subsection Examples
  4029. @itemize
  4030. @item
  4031. Apply a boxblur filter with the luma, chroma, and alpha radii
  4032. set to 2:
  4033. @example
  4034. boxblur=luma_radius=2:luma_power=1
  4035. boxblur=2:1
  4036. @end example
  4037. @item
  4038. Set the luma radius to 2, and alpha and chroma radius to 0:
  4039. @example
  4040. boxblur=2:1:cr=0:ar=0
  4041. @end example
  4042. @item
  4043. Set the luma and chroma radii to a fraction of the video dimension:
  4044. @example
  4045. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4046. @end example
  4047. @end itemize
  4048. @section bwdif
  4049. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4050. Deinterlacing Filter").
  4051. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4052. interpolation algorithms.
  4053. It accepts the following parameters:
  4054. @table @option
  4055. @item mode
  4056. The interlacing mode to adopt. It accepts one of the following values:
  4057. @table @option
  4058. @item 0, send_frame
  4059. Output one frame for each frame.
  4060. @item 1, send_field
  4061. Output one frame for each field.
  4062. @end table
  4063. The default value is @code{send_field}.
  4064. @item parity
  4065. The picture field parity assumed for the input interlaced video. It accepts one
  4066. of the following values:
  4067. @table @option
  4068. @item 0, tff
  4069. Assume the top field is first.
  4070. @item 1, bff
  4071. Assume the bottom field is first.
  4072. @item -1, auto
  4073. Enable automatic detection of field parity.
  4074. @end table
  4075. The default value is @code{auto}.
  4076. If the interlacing is unknown or the decoder does not export this information,
  4077. top field first will be assumed.
  4078. @item deint
  4079. Specify which frames to deinterlace. Accept one of the following
  4080. values:
  4081. @table @option
  4082. @item 0, all
  4083. Deinterlace all frames.
  4084. @item 1, interlaced
  4085. Only deinterlace frames marked as interlaced.
  4086. @end table
  4087. The default value is @code{all}.
  4088. @end table
  4089. @section chromakey
  4090. YUV colorspace color/chroma keying.
  4091. The filter accepts the following options:
  4092. @table @option
  4093. @item color
  4094. The color which will be replaced with transparency.
  4095. @item similarity
  4096. Similarity percentage with the key color.
  4097. 0.01 matches only the exact key color, while 1.0 matches everything.
  4098. @item blend
  4099. Blend percentage.
  4100. 0.0 makes pixels either fully transparent, or not transparent at all.
  4101. Higher values result in semi-transparent pixels, with a higher transparency
  4102. the more similar the pixels color is to the key color.
  4103. @item yuv
  4104. Signals that the color passed is already in YUV instead of RGB.
  4105. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4106. This can be used to pass exact YUV values as hexadecimal numbers.
  4107. @end table
  4108. @subsection Examples
  4109. @itemize
  4110. @item
  4111. Make every green pixel in the input image transparent:
  4112. @example
  4113. ffmpeg -i input.png -vf chromakey=green out.png
  4114. @end example
  4115. @item
  4116. Overlay a greenscreen-video on top of a static black background.
  4117. @example
  4118. 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
  4119. @end example
  4120. @end itemize
  4121. @section ciescope
  4122. Display CIE color diagram with pixels overlaid onto it.
  4123. The filter accepts the following options:
  4124. @table @option
  4125. @item system
  4126. Set color system.
  4127. @table @samp
  4128. @item ntsc, 470m
  4129. @item ebu, 470bg
  4130. @item smpte
  4131. @item 240m
  4132. @item apple
  4133. @item widergb
  4134. @item cie1931
  4135. @item rec709, hdtv
  4136. @item uhdtv, rec2020
  4137. @end table
  4138. @item cie
  4139. Set CIE system.
  4140. @table @samp
  4141. @item xyy
  4142. @item ucs
  4143. @item luv
  4144. @end table
  4145. @item gamuts
  4146. Set what gamuts to draw.
  4147. See @code{system} option for available values.
  4148. @item size, s
  4149. Set ciescope size, by default set to 512.
  4150. @item intensity, i
  4151. Set intensity used to map input pixel values to CIE diagram.
  4152. @item contrast
  4153. Set contrast used to draw tongue colors that are out of active color system gamut.
  4154. @item corrgamma
  4155. Correct gamma displayed on scope, by default enabled.
  4156. @item showwhite
  4157. Show white point on CIE diagram, by default disabled.
  4158. @item gamma
  4159. Set input gamma. Used only with XYZ input color space.
  4160. @end table
  4161. @section codecview
  4162. Visualize information exported by some codecs.
  4163. Some codecs can export information through frames using side-data or other
  4164. means. For example, some MPEG based codecs export motion vectors through the
  4165. @var{export_mvs} flag in the codec @option{flags2} option.
  4166. The filter accepts the following option:
  4167. @table @option
  4168. @item mv
  4169. Set motion vectors to visualize.
  4170. Available flags for @var{mv} are:
  4171. @table @samp
  4172. @item pf
  4173. forward predicted MVs of P-frames
  4174. @item bf
  4175. forward predicted MVs of B-frames
  4176. @item bb
  4177. backward predicted MVs of B-frames
  4178. @end table
  4179. @item qp
  4180. Display quantization parameters using the chroma planes.
  4181. @item mv_type, mvt
  4182. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4183. Available flags for @var{mv_type} are:
  4184. @table @samp
  4185. @item fp
  4186. forward predicted MVs
  4187. @item bp
  4188. backward predicted MVs
  4189. @end table
  4190. @item frame_type, ft
  4191. Set frame type to visualize motion vectors of.
  4192. Available flags for @var{frame_type} are:
  4193. @table @samp
  4194. @item if
  4195. intra-coded frames (I-frames)
  4196. @item pf
  4197. predicted frames (P-frames)
  4198. @item bf
  4199. bi-directionally predicted frames (B-frames)
  4200. @end table
  4201. @end table
  4202. @subsection Examples
  4203. @itemize
  4204. @item
  4205. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4206. @example
  4207. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4208. @end example
  4209. @item
  4210. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4211. @example
  4212. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4213. @end example
  4214. @end itemize
  4215. @section colorbalance
  4216. Modify intensity of primary colors (red, green and blue) of input frames.
  4217. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4218. regions for the red-cyan, green-magenta or blue-yellow balance.
  4219. A positive adjustment value shifts the balance towards the primary color, a negative
  4220. value towards the complementary color.
  4221. The filter accepts the following options:
  4222. @table @option
  4223. @item rs
  4224. @item gs
  4225. @item bs
  4226. Adjust red, green and blue shadows (darkest pixels).
  4227. @item rm
  4228. @item gm
  4229. @item bm
  4230. Adjust red, green and blue midtones (medium pixels).
  4231. @item rh
  4232. @item gh
  4233. @item bh
  4234. Adjust red, green and blue highlights (brightest pixels).
  4235. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4236. @end table
  4237. @subsection Examples
  4238. @itemize
  4239. @item
  4240. Add red color cast to shadows:
  4241. @example
  4242. colorbalance=rs=.3
  4243. @end example
  4244. @end itemize
  4245. @section colorkey
  4246. RGB colorspace color keying.
  4247. The filter accepts the following options:
  4248. @table @option
  4249. @item color
  4250. The color which will be replaced with transparency.
  4251. @item similarity
  4252. Similarity percentage with the key color.
  4253. 0.01 matches only the exact key color, while 1.0 matches everything.
  4254. @item blend
  4255. Blend percentage.
  4256. 0.0 makes pixels either fully transparent, or not transparent at all.
  4257. Higher values result in semi-transparent pixels, with a higher transparency
  4258. the more similar the pixels color is to the key color.
  4259. @end table
  4260. @subsection Examples
  4261. @itemize
  4262. @item
  4263. Make every green pixel in the input image transparent:
  4264. @example
  4265. ffmpeg -i input.png -vf colorkey=green out.png
  4266. @end example
  4267. @item
  4268. Overlay a greenscreen-video on top of a static background image.
  4269. @example
  4270. 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
  4271. @end example
  4272. @end itemize
  4273. @section colorlevels
  4274. Adjust video input frames using levels.
  4275. The filter accepts the following options:
  4276. @table @option
  4277. @item rimin
  4278. @item gimin
  4279. @item bimin
  4280. @item aimin
  4281. Adjust red, green, blue and alpha input black point.
  4282. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4283. @item rimax
  4284. @item gimax
  4285. @item bimax
  4286. @item aimax
  4287. Adjust red, green, blue and alpha input white point.
  4288. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  4289. Input levels are used to lighten highlights (bright tones), darken shadows
  4290. (dark tones), change the balance of bright and dark tones.
  4291. @item romin
  4292. @item gomin
  4293. @item bomin
  4294. @item aomin
  4295. Adjust red, green, blue and alpha output black point.
  4296. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  4297. @item romax
  4298. @item gomax
  4299. @item bomax
  4300. @item aomax
  4301. Adjust red, green, blue and alpha output white point.
  4302. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  4303. Output levels allows manual selection of a constrained output level range.
  4304. @end table
  4305. @subsection Examples
  4306. @itemize
  4307. @item
  4308. Make video output darker:
  4309. @example
  4310. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4311. @end example
  4312. @item
  4313. Increase contrast:
  4314. @example
  4315. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4316. @end example
  4317. @item
  4318. Make video output lighter:
  4319. @example
  4320. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4321. @end example
  4322. @item
  4323. Increase brightness:
  4324. @example
  4325. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4326. @end example
  4327. @end itemize
  4328. @section colorchannelmixer
  4329. Adjust video input frames by re-mixing color channels.
  4330. This filter modifies a color channel by adding the values associated to
  4331. the other channels of the same pixels. For example if the value to
  4332. modify is red, the output value will be:
  4333. @example
  4334. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4335. @end example
  4336. The filter accepts the following options:
  4337. @table @option
  4338. @item rr
  4339. @item rg
  4340. @item rb
  4341. @item ra
  4342. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4343. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4344. @item gr
  4345. @item gg
  4346. @item gb
  4347. @item ga
  4348. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4349. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4350. @item br
  4351. @item bg
  4352. @item bb
  4353. @item ba
  4354. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4355. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4356. @item ar
  4357. @item ag
  4358. @item ab
  4359. @item aa
  4360. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4361. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4362. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4363. @end table
  4364. @subsection Examples
  4365. @itemize
  4366. @item
  4367. Convert source to grayscale:
  4368. @example
  4369. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4370. @end example
  4371. @item
  4372. Simulate sepia tones:
  4373. @example
  4374. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4375. @end example
  4376. @end itemize
  4377. @section colormatrix
  4378. Convert color matrix.
  4379. The filter accepts the following options:
  4380. @table @option
  4381. @item src
  4382. @item dst
  4383. Specify the source and destination color matrix. Both values must be
  4384. specified.
  4385. The accepted values are:
  4386. @table @samp
  4387. @item bt709
  4388. BT.709
  4389. @item fcc
  4390. FCC
  4391. @item bt601
  4392. BT.601
  4393. @item bt470
  4394. BT.470
  4395. @item bt470bg
  4396. BT.470BG
  4397. @item smpte170m
  4398. SMPTE-170M
  4399. @item smpte240m
  4400. SMPTE-240M
  4401. @item bt2020
  4402. BT.2020
  4403. @end table
  4404. @end table
  4405. For example to convert from BT.601 to SMPTE-240M, use the command:
  4406. @example
  4407. colormatrix=bt601:smpte240m
  4408. @end example
  4409. @section colorspace
  4410. Convert colorspace, transfer characteristics or color primaries.
  4411. Input video needs to have an even size.
  4412. The filter accepts the following options:
  4413. @table @option
  4414. @anchor{all}
  4415. @item all
  4416. Specify all color properties at once.
  4417. The accepted values are:
  4418. @table @samp
  4419. @item bt470m
  4420. BT.470M
  4421. @item bt470bg
  4422. BT.470BG
  4423. @item bt601-6-525
  4424. BT.601-6 525
  4425. @item bt601-6-625
  4426. BT.601-6 625
  4427. @item bt709
  4428. BT.709
  4429. @item smpte170m
  4430. SMPTE-170M
  4431. @item smpte240m
  4432. SMPTE-240M
  4433. @item bt2020
  4434. BT.2020
  4435. @end table
  4436. @anchor{space}
  4437. @item space
  4438. Specify output colorspace.
  4439. The accepted values are:
  4440. @table @samp
  4441. @item bt709
  4442. BT.709
  4443. @item fcc
  4444. FCC
  4445. @item bt470bg
  4446. BT.470BG or BT.601-6 625
  4447. @item smpte170m
  4448. SMPTE-170M or BT.601-6 525
  4449. @item smpte240m
  4450. SMPTE-240M
  4451. @item ycgco
  4452. YCgCo
  4453. @item bt2020ncl
  4454. BT.2020 with non-constant luminance
  4455. @end table
  4456. @anchor{trc}
  4457. @item trc
  4458. Specify output transfer characteristics.
  4459. The accepted values are:
  4460. @table @samp
  4461. @item bt709
  4462. BT.709
  4463. @item bt470m
  4464. BT.470M
  4465. @item bt470bg
  4466. BT.470BG
  4467. @item gamma22
  4468. Constant gamma of 2.2
  4469. @item gamma28
  4470. Constant gamma of 2.8
  4471. @item smpte170m
  4472. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4473. @item smpte240m
  4474. SMPTE-240M
  4475. @item srgb
  4476. SRGB
  4477. @item iec61966-2-1
  4478. iec61966-2-1
  4479. @item iec61966-2-4
  4480. iec61966-2-4
  4481. @item xvycc
  4482. xvycc
  4483. @item bt2020-10
  4484. BT.2020 for 10-bits content
  4485. @item bt2020-12
  4486. BT.2020 for 12-bits content
  4487. @end table
  4488. @anchor{primaries}
  4489. @item primaries
  4490. Specify output color primaries.
  4491. The accepted values are:
  4492. @table @samp
  4493. @item bt709
  4494. BT.709
  4495. @item bt470m
  4496. BT.470M
  4497. @item bt470bg
  4498. BT.470BG or BT.601-6 625
  4499. @item smpte170m
  4500. SMPTE-170M or BT.601-6 525
  4501. @item smpte240m
  4502. SMPTE-240M
  4503. @item film
  4504. film
  4505. @item smpte431
  4506. SMPTE-431
  4507. @item smpte432
  4508. SMPTE-432
  4509. @item bt2020
  4510. BT.2020
  4511. @item jedec-p22
  4512. JEDEC P22 phosphors
  4513. @end table
  4514. @anchor{range}
  4515. @item range
  4516. Specify output color range.
  4517. The accepted values are:
  4518. @table @samp
  4519. @item tv
  4520. TV (restricted) range
  4521. @item mpeg
  4522. MPEG (restricted) range
  4523. @item pc
  4524. PC (full) range
  4525. @item jpeg
  4526. JPEG (full) range
  4527. @end table
  4528. @item format
  4529. Specify output color format.
  4530. The accepted values are:
  4531. @table @samp
  4532. @item yuv420p
  4533. YUV 4:2:0 planar 8-bits
  4534. @item yuv420p10
  4535. YUV 4:2:0 planar 10-bits
  4536. @item yuv420p12
  4537. YUV 4:2:0 planar 12-bits
  4538. @item yuv422p
  4539. YUV 4:2:2 planar 8-bits
  4540. @item yuv422p10
  4541. YUV 4:2:2 planar 10-bits
  4542. @item yuv422p12
  4543. YUV 4:2:2 planar 12-bits
  4544. @item yuv444p
  4545. YUV 4:4:4 planar 8-bits
  4546. @item yuv444p10
  4547. YUV 4:4:4 planar 10-bits
  4548. @item yuv444p12
  4549. YUV 4:4:4 planar 12-bits
  4550. @end table
  4551. @item fast
  4552. Do a fast conversion, which skips gamma/primary correction. This will take
  4553. significantly less CPU, but will be mathematically incorrect. To get output
  4554. compatible with that produced by the colormatrix filter, use fast=1.
  4555. @item dither
  4556. Specify dithering mode.
  4557. The accepted values are:
  4558. @table @samp
  4559. @item none
  4560. No dithering
  4561. @item fsb
  4562. Floyd-Steinberg dithering
  4563. @end table
  4564. @item wpadapt
  4565. Whitepoint adaptation mode.
  4566. The accepted values are:
  4567. @table @samp
  4568. @item bradford
  4569. Bradford whitepoint adaptation
  4570. @item vonkries
  4571. von Kries whitepoint adaptation
  4572. @item identity
  4573. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4574. @end table
  4575. @item iall
  4576. Override all input properties at once. Same accepted values as @ref{all}.
  4577. @item ispace
  4578. Override input colorspace. Same accepted values as @ref{space}.
  4579. @item iprimaries
  4580. Override input color primaries. Same accepted values as @ref{primaries}.
  4581. @item itrc
  4582. Override input transfer characteristics. Same accepted values as @ref{trc}.
  4583. @item irange
  4584. Override input color range. Same accepted values as @ref{range}.
  4585. @end table
  4586. The filter converts the transfer characteristics, color space and color
  4587. primaries to the specified user values. The output value, if not specified,
  4588. is set to a default value based on the "all" property. If that property is
  4589. also not specified, the filter will log an error. The output color range and
  4590. format default to the same value as the input color range and format. The
  4591. input transfer characteristics, color space, color primaries and color range
  4592. should be set on the input data. If any of these are missing, the filter will
  4593. log an error and no conversion will take place.
  4594. For example to convert the input to SMPTE-240M, use the command:
  4595. @example
  4596. colorspace=smpte240m
  4597. @end example
  4598. @section convolution
  4599. Apply convolution 3x3 or 5x5 filter.
  4600. The filter accepts the following options:
  4601. @table @option
  4602. @item 0m
  4603. @item 1m
  4604. @item 2m
  4605. @item 3m
  4606. Set matrix for each plane.
  4607. Matrix is sequence of 9 or 25 signed integers.
  4608. @item 0rdiv
  4609. @item 1rdiv
  4610. @item 2rdiv
  4611. @item 3rdiv
  4612. Set multiplier for calculated value for each plane.
  4613. @item 0bias
  4614. @item 1bias
  4615. @item 2bias
  4616. @item 3bias
  4617. Set bias for each plane. This value is added to the result of the multiplication.
  4618. Useful for making the overall image brighter or darker. Default is 0.0.
  4619. @end table
  4620. @subsection Examples
  4621. @itemize
  4622. @item
  4623. Apply sharpen:
  4624. @example
  4625. 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"
  4626. @end example
  4627. @item
  4628. Apply blur:
  4629. @example
  4630. 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"
  4631. @end example
  4632. @item
  4633. Apply edge enhance:
  4634. @example
  4635. 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"
  4636. @end example
  4637. @item
  4638. Apply edge detect:
  4639. @example
  4640. 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"
  4641. @end example
  4642. @item
  4643. Apply laplacian edge detector which includes diagonals:
  4644. @example
  4645. 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"
  4646. @end example
  4647. @item
  4648. Apply emboss:
  4649. @example
  4650. 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"
  4651. @end example
  4652. @end itemize
  4653. @section convolve
  4654. Apply 2D convolution of video stream in frequency domain using second stream
  4655. as impulse.
  4656. The filter accepts the following options:
  4657. @table @option
  4658. @item planes
  4659. Set which planes to process.
  4660. @item impulse
  4661. Set which impulse video frames will be processed, can be @var{first}
  4662. or @var{all}. Default is @var{all}.
  4663. @end table
  4664. The @code{convolve} filter also supports the @ref{framesync} options.
  4665. @section copy
  4666. Copy the input video source unchanged to the output. This is mainly useful for
  4667. testing purposes.
  4668. @anchor{coreimage}
  4669. @section coreimage
  4670. Video filtering on GPU using Apple's CoreImage API on OSX.
  4671. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4672. processed by video hardware. However, software-based OpenGL implementations
  4673. exist which means there is no guarantee for hardware processing. It depends on
  4674. the respective OSX.
  4675. There are many filters and image generators provided by Apple that come with a
  4676. large variety of options. The filter has to be referenced by its name along
  4677. with its options.
  4678. The coreimage filter accepts the following options:
  4679. @table @option
  4680. @item list_filters
  4681. List all available filters and generators along with all their respective
  4682. options as well as possible minimum and maximum values along with the default
  4683. values.
  4684. @example
  4685. list_filters=true
  4686. @end example
  4687. @item filter
  4688. Specify all filters by their respective name and options.
  4689. Use @var{list_filters} to determine all valid filter names and options.
  4690. Numerical options are specified by a float value and are automatically clamped
  4691. to their respective value range. Vector and color options have to be specified
  4692. by a list of space separated float values. Character escaping has to be done.
  4693. A special option name @code{default} is available to use default options for a
  4694. filter.
  4695. It is required to specify either @code{default} or at least one of the filter options.
  4696. All omitted options are used with their default values.
  4697. The syntax of the filter string is as follows:
  4698. @example
  4699. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  4700. @end example
  4701. @item output_rect
  4702. Specify a rectangle where the output of the filter chain is copied into the
  4703. input image. It is given by a list of space separated float values:
  4704. @example
  4705. output_rect=x\ y\ width\ height
  4706. @end example
  4707. If not given, the output rectangle equals the dimensions of the input image.
  4708. The output rectangle is automatically cropped at the borders of the input
  4709. image. Negative values are valid for each component.
  4710. @example
  4711. output_rect=25\ 25\ 100\ 100
  4712. @end example
  4713. @end table
  4714. Several filters can be chained for successive processing without GPU-HOST
  4715. transfers allowing for fast processing of complex filter chains.
  4716. Currently, only filters with zero (generators) or exactly one (filters) input
  4717. image and one output image are supported. Also, transition filters are not yet
  4718. usable as intended.
  4719. Some filters generate output images with additional padding depending on the
  4720. respective filter kernel. The padding is automatically removed to ensure the
  4721. filter output has the same size as the input image.
  4722. For image generators, the size of the output image is determined by the
  4723. previous output image of the filter chain or the input image of the whole
  4724. filterchain, respectively. The generators do not use the pixel information of
  4725. this image to generate their output. However, the generated output is
  4726. blended onto this image, resulting in partial or complete coverage of the
  4727. output image.
  4728. The @ref{coreimagesrc} video source can be used for generating input images
  4729. which are directly fed into the filter chain. By using it, providing input
  4730. images by another video source or an input video is not required.
  4731. @subsection Examples
  4732. @itemize
  4733. @item
  4734. List all filters available:
  4735. @example
  4736. coreimage=list_filters=true
  4737. @end example
  4738. @item
  4739. Use the CIBoxBlur filter with default options to blur an image:
  4740. @example
  4741. coreimage=filter=CIBoxBlur@@default
  4742. @end example
  4743. @item
  4744. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  4745. its center at 100x100 and a radius of 50 pixels:
  4746. @example
  4747. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  4748. @end example
  4749. @item
  4750. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  4751. given as complete and escaped command-line for Apple's standard bash shell:
  4752. @example
  4753. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  4754. @end example
  4755. @end itemize
  4756. @section crop
  4757. Crop the input video to given dimensions.
  4758. It accepts the following parameters:
  4759. @table @option
  4760. @item w, out_w
  4761. The width of the output video. It defaults to @code{iw}.
  4762. This expression is evaluated only once during the filter
  4763. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  4764. @item h, out_h
  4765. The height of the output video. It defaults to @code{ih}.
  4766. This expression is evaluated only once during the filter
  4767. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  4768. @item x
  4769. The horizontal position, in the input video, of the left edge of the output
  4770. video. It defaults to @code{(in_w-out_w)/2}.
  4771. This expression is evaluated per-frame.
  4772. @item y
  4773. The vertical position, in the input video, of the top edge of the output video.
  4774. It defaults to @code{(in_h-out_h)/2}.
  4775. This expression is evaluated per-frame.
  4776. @item keep_aspect
  4777. If set to 1 will force the output display aspect ratio
  4778. to be the same of the input, by changing the output sample aspect
  4779. ratio. It defaults to 0.
  4780. @item exact
  4781. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  4782. width/height/x/y as specified and will not be rounded to nearest smaller value.
  4783. It defaults to 0.
  4784. @end table
  4785. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  4786. expressions containing the following constants:
  4787. @table @option
  4788. @item x
  4789. @item y
  4790. The computed values for @var{x} and @var{y}. They are evaluated for
  4791. each new frame.
  4792. @item in_w
  4793. @item in_h
  4794. The input width and height.
  4795. @item iw
  4796. @item ih
  4797. These are the same as @var{in_w} and @var{in_h}.
  4798. @item out_w
  4799. @item out_h
  4800. The output (cropped) width and height.
  4801. @item ow
  4802. @item oh
  4803. These are the same as @var{out_w} and @var{out_h}.
  4804. @item a
  4805. same as @var{iw} / @var{ih}
  4806. @item sar
  4807. input sample aspect ratio
  4808. @item dar
  4809. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4810. @item hsub
  4811. @item vsub
  4812. horizontal and vertical chroma subsample values. For example for the
  4813. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4814. @item n
  4815. The number of the input frame, starting from 0.
  4816. @item pos
  4817. the position in the file of the input frame, NAN if unknown
  4818. @item t
  4819. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  4820. @end table
  4821. The expression for @var{out_w} may depend on the value of @var{out_h},
  4822. and the expression for @var{out_h} may depend on @var{out_w}, but they
  4823. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  4824. evaluated after @var{out_w} and @var{out_h}.
  4825. The @var{x} and @var{y} parameters specify the expressions for the
  4826. position of the top-left corner of the output (non-cropped) area. They
  4827. are evaluated for each frame. If the evaluated value is not valid, it
  4828. is approximated to the nearest valid value.
  4829. The expression for @var{x} may depend on @var{y}, and the expression
  4830. for @var{y} may depend on @var{x}.
  4831. @subsection Examples
  4832. @itemize
  4833. @item
  4834. Crop area with size 100x100 at position (12,34).
  4835. @example
  4836. crop=100:100:12:34
  4837. @end example
  4838. Using named options, the example above becomes:
  4839. @example
  4840. crop=w=100:h=100:x=12:y=34
  4841. @end example
  4842. @item
  4843. Crop the central input area with size 100x100:
  4844. @example
  4845. crop=100:100
  4846. @end example
  4847. @item
  4848. Crop the central input area with size 2/3 of the input video:
  4849. @example
  4850. crop=2/3*in_w:2/3*in_h
  4851. @end example
  4852. @item
  4853. Crop the input video central square:
  4854. @example
  4855. crop=out_w=in_h
  4856. crop=in_h
  4857. @end example
  4858. @item
  4859. Delimit the rectangle with the top-left corner placed at position
  4860. 100:100 and the right-bottom corner corresponding to the right-bottom
  4861. corner of the input image.
  4862. @example
  4863. crop=in_w-100:in_h-100:100:100
  4864. @end example
  4865. @item
  4866. Crop 10 pixels from the left and right borders, and 20 pixels from
  4867. the top and bottom borders
  4868. @example
  4869. crop=in_w-2*10:in_h-2*20
  4870. @end example
  4871. @item
  4872. Keep only the bottom right quarter of the input image:
  4873. @example
  4874. crop=in_w/2:in_h/2:in_w/2:in_h/2
  4875. @end example
  4876. @item
  4877. Crop height for getting Greek harmony:
  4878. @example
  4879. crop=in_w:1/PHI*in_w
  4880. @end example
  4881. @item
  4882. Apply trembling effect:
  4883. @example
  4884. 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)
  4885. @end example
  4886. @item
  4887. Apply erratic camera effect depending on timestamp:
  4888. @example
  4889. 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)"
  4890. @end example
  4891. @item
  4892. Set x depending on the value of y:
  4893. @example
  4894. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  4895. @end example
  4896. @end itemize
  4897. @subsection Commands
  4898. This filter supports the following commands:
  4899. @table @option
  4900. @item w, out_w
  4901. @item h, out_h
  4902. @item x
  4903. @item y
  4904. Set width/height of the output video and the horizontal/vertical position
  4905. in the input video.
  4906. The command accepts the same syntax of the corresponding option.
  4907. If the specified expression is not valid, it is kept at its current
  4908. value.
  4909. @end table
  4910. @section cropdetect
  4911. Auto-detect the crop size.
  4912. It calculates the necessary cropping parameters and prints the
  4913. recommended parameters via the logging system. The detected dimensions
  4914. correspond to the non-black area of the input video.
  4915. It accepts the following parameters:
  4916. @table @option
  4917. @item limit
  4918. Set higher black value threshold, which can be optionally specified
  4919. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  4920. value greater to the set value is considered non-black. It defaults to 24.
  4921. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  4922. on the bitdepth of the pixel format.
  4923. @item round
  4924. The value which the width/height should be divisible by. It defaults to
  4925. 16. The offset is automatically adjusted to center the video. Use 2 to
  4926. get only even dimensions (needed for 4:2:2 video). 16 is best when
  4927. encoding to most video codecs.
  4928. @item reset_count, reset
  4929. Set the counter that determines after how many frames cropdetect will
  4930. reset the previously detected largest video area and start over to
  4931. detect the current optimal crop area. Default value is 0.
  4932. This can be useful when channel logos distort the video area. 0
  4933. indicates 'never reset', and returns the largest area encountered during
  4934. playback.
  4935. @end table
  4936. @anchor{curves}
  4937. @section curves
  4938. Apply color adjustments using curves.
  4939. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  4940. component (red, green and blue) has its values defined by @var{N} key points
  4941. tied from each other using a smooth curve. The x-axis represents the pixel
  4942. values from the input frame, and the y-axis the new pixel values to be set for
  4943. the output frame.
  4944. By default, a component curve is defined by the two points @var{(0;0)} and
  4945. @var{(1;1)}. This creates a straight line where each original pixel value is
  4946. "adjusted" to its own value, which means no change to the image.
  4947. The filter allows you to redefine these two points and add some more. A new
  4948. curve (using a natural cubic spline interpolation) will be define to pass
  4949. smoothly through all these new coordinates. The new defined points needs to be
  4950. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  4951. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  4952. the vector spaces, the values will be clipped accordingly.
  4953. The filter accepts the following options:
  4954. @table @option
  4955. @item preset
  4956. Select one of the available color presets. This option can be used in addition
  4957. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  4958. options takes priority on the preset values.
  4959. Available presets are:
  4960. @table @samp
  4961. @item none
  4962. @item color_negative
  4963. @item cross_process
  4964. @item darker
  4965. @item increase_contrast
  4966. @item lighter
  4967. @item linear_contrast
  4968. @item medium_contrast
  4969. @item negative
  4970. @item strong_contrast
  4971. @item vintage
  4972. @end table
  4973. Default is @code{none}.
  4974. @item master, m
  4975. Set the master key points. These points will define a second pass mapping. It
  4976. is sometimes called a "luminance" or "value" mapping. It can be used with
  4977. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  4978. post-processing LUT.
  4979. @item red, r
  4980. Set the key points for the red component.
  4981. @item green, g
  4982. Set the key points for the green component.
  4983. @item blue, b
  4984. Set the key points for the blue component.
  4985. @item all
  4986. Set the key points for all components (not including master).
  4987. Can be used in addition to the other key points component
  4988. options. In this case, the unset component(s) will fallback on this
  4989. @option{all} setting.
  4990. @item psfile
  4991. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  4992. @item plot
  4993. Save Gnuplot script of the curves in specified file.
  4994. @end table
  4995. To avoid some filtergraph syntax conflicts, each key points list need to be
  4996. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  4997. @subsection Examples
  4998. @itemize
  4999. @item
  5000. Increase slightly the middle level of blue:
  5001. @example
  5002. curves=blue='0/0 0.5/0.58 1/1'
  5003. @end example
  5004. @item
  5005. Vintage effect:
  5006. @example
  5007. 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'
  5008. @end example
  5009. Here we obtain the following coordinates for each components:
  5010. @table @var
  5011. @item red
  5012. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  5013. @item green
  5014. @code{(0;0) (0.50;0.48) (1;1)}
  5015. @item blue
  5016. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  5017. @end table
  5018. @item
  5019. The previous example can also be achieved with the associated built-in preset:
  5020. @example
  5021. curves=preset=vintage
  5022. @end example
  5023. @item
  5024. Or simply:
  5025. @example
  5026. curves=vintage
  5027. @end example
  5028. @item
  5029. Use a Photoshop preset and redefine the points of the green component:
  5030. @example
  5031. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  5032. @end example
  5033. @item
  5034. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  5035. and @command{gnuplot}:
  5036. @example
  5037. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  5038. gnuplot -p /tmp/curves.plt
  5039. @end example
  5040. @end itemize
  5041. @section datascope
  5042. Video data analysis filter.
  5043. This filter shows hexadecimal pixel values of part of video.
  5044. The filter accepts the following options:
  5045. @table @option
  5046. @item size, s
  5047. Set output video size.
  5048. @item x
  5049. Set x offset from where to pick pixels.
  5050. @item y
  5051. Set y offset from where to pick pixels.
  5052. @item mode
  5053. Set scope mode, can be one of the following:
  5054. @table @samp
  5055. @item mono
  5056. Draw hexadecimal pixel values with white color on black background.
  5057. @item color
  5058. Draw hexadecimal pixel values with input video pixel color on black
  5059. background.
  5060. @item color2
  5061. Draw hexadecimal pixel values on color background picked from input video,
  5062. the text color is picked in such way so its always visible.
  5063. @end table
  5064. @item axis
  5065. Draw rows and columns numbers on left and top of video.
  5066. @item opacity
  5067. Set background opacity.
  5068. @end table
  5069. @section dctdnoiz
  5070. Denoise frames using 2D DCT (frequency domain filtering).
  5071. This filter is not designed for real time.
  5072. The filter accepts the following options:
  5073. @table @option
  5074. @item sigma, s
  5075. Set the noise sigma constant.
  5076. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  5077. coefficient (absolute value) below this threshold with be dropped.
  5078. If you need a more advanced filtering, see @option{expr}.
  5079. Default is @code{0}.
  5080. @item overlap
  5081. Set number overlapping pixels for each block. Since the filter can be slow, you
  5082. may want to reduce this value, at the cost of a less effective filter and the
  5083. risk of various artefacts.
  5084. If the overlapping value doesn't permit processing the whole input width or
  5085. height, a warning will be displayed and according borders won't be denoised.
  5086. Default value is @var{blocksize}-1, which is the best possible setting.
  5087. @item expr, e
  5088. Set the coefficient factor expression.
  5089. For each coefficient of a DCT block, this expression will be evaluated as a
  5090. multiplier value for the coefficient.
  5091. If this is option is set, the @option{sigma} option will be ignored.
  5092. The absolute value of the coefficient can be accessed through the @var{c}
  5093. variable.
  5094. @item n
  5095. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  5096. @var{blocksize}, which is the width and height of the processed blocks.
  5097. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  5098. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5099. on the speed processing. Also, a larger block size does not necessarily means a
  5100. better de-noising.
  5101. @end table
  5102. @subsection Examples
  5103. Apply a denoise with a @option{sigma} of @code{4.5}:
  5104. @example
  5105. dctdnoiz=4.5
  5106. @end example
  5107. The same operation can be achieved using the expression system:
  5108. @example
  5109. dctdnoiz=e='gte(c, 4.5*3)'
  5110. @end example
  5111. Violent denoise using a block size of @code{16x16}:
  5112. @example
  5113. dctdnoiz=15:n=4
  5114. @end example
  5115. @section deband
  5116. Remove banding artifacts from input video.
  5117. It works by replacing banded pixels with average value of referenced pixels.
  5118. The filter accepts the following options:
  5119. @table @option
  5120. @item 1thr
  5121. @item 2thr
  5122. @item 3thr
  5123. @item 4thr
  5124. Set banding detection threshold for each plane. Default is 0.02.
  5125. Valid range is 0.00003 to 0.5.
  5126. If difference between current pixel and reference pixel is less than threshold,
  5127. it will be considered as banded.
  5128. @item range, r
  5129. Banding detection range in pixels. Default is 16. If positive, random number
  5130. in range 0 to set value will be used. If negative, exact absolute value
  5131. will be used.
  5132. The range defines square of four pixels around current pixel.
  5133. @item direction, d
  5134. Set direction in radians from which four pixel will be compared. If positive,
  5135. random direction from 0 to set direction will be picked. If negative, exact of
  5136. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5137. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5138. column.
  5139. @item blur, b
  5140. If enabled, current pixel is compared with average value of all four
  5141. surrounding pixels. The default is enabled. If disabled current pixel is
  5142. compared with all four surrounding pixels. The pixel is considered banded
  5143. if only all four differences with surrounding pixels are less than threshold.
  5144. @item coupling, c
  5145. If enabled, current pixel is changed if and only if all pixel components are banded,
  5146. e.g. banding detection threshold is triggered for all color components.
  5147. The default is disabled.
  5148. @end table
  5149. @anchor{decimate}
  5150. @section decimate
  5151. Drop duplicated frames at regular intervals.
  5152. The filter accepts the following options:
  5153. @table @option
  5154. @item cycle
  5155. Set the number of frames from which one will be dropped. Setting this to
  5156. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  5157. Default is @code{5}.
  5158. @item dupthresh
  5159. Set the threshold for duplicate detection. If the difference metric for a frame
  5160. is less than or equal to this value, then it is declared as duplicate. Default
  5161. is @code{1.1}
  5162. @item scthresh
  5163. Set scene change threshold. Default is @code{15}.
  5164. @item blockx
  5165. @item blocky
  5166. Set the size of the x and y-axis blocks used during metric calculations.
  5167. Larger blocks give better noise suppression, but also give worse detection of
  5168. small movements. Must be a power of two. Default is @code{32}.
  5169. @item ppsrc
  5170. Mark main input as a pre-processed input and activate clean source input
  5171. stream. This allows the input to be pre-processed with various filters to help
  5172. the metrics calculation while keeping the frame selection lossless. When set to
  5173. @code{1}, the first stream is for the pre-processed input, and the second
  5174. stream is the clean source from where the kept frames are chosen. Default is
  5175. @code{0}.
  5176. @item chroma
  5177. Set whether or not chroma is considered in the metric calculations. Default is
  5178. @code{1}.
  5179. @end table
  5180. @section deflate
  5181. Apply deflate effect to the video.
  5182. This filter replaces the pixel by the local(3x3) average by taking into account
  5183. only values lower than the pixel.
  5184. It accepts the following options:
  5185. @table @option
  5186. @item threshold0
  5187. @item threshold1
  5188. @item threshold2
  5189. @item threshold3
  5190. Limit the maximum change for each plane, default is 65535.
  5191. If 0, plane will remain unchanged.
  5192. @end table
  5193. @section deflicker
  5194. Remove temporal frame luminance variations.
  5195. It accepts the following options:
  5196. @table @option
  5197. @item size, s
  5198. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  5199. @item mode, m
  5200. Set averaging mode to smooth temporal luminance variations.
  5201. Available values are:
  5202. @table @samp
  5203. @item am
  5204. Arithmetic mean
  5205. @item gm
  5206. Geometric mean
  5207. @item hm
  5208. Harmonic mean
  5209. @item qm
  5210. Quadratic mean
  5211. @item cm
  5212. Cubic mean
  5213. @item pm
  5214. Power mean
  5215. @item median
  5216. Median
  5217. @end table
  5218. @item bypass
  5219. Do not actually modify frame. Useful when one only wants metadata.
  5220. @end table
  5221. @section dejudder
  5222. Remove judder produced by partially interlaced telecined content.
  5223. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  5224. source was partially telecined content then the output of @code{pullup,dejudder}
  5225. will have a variable frame rate. May change the recorded frame rate of the
  5226. container. Aside from that change, this filter will not affect constant frame
  5227. rate video.
  5228. The option available in this filter is:
  5229. @table @option
  5230. @item cycle
  5231. Specify the length of the window over which the judder repeats.
  5232. Accepts any integer greater than 1. Useful values are:
  5233. @table @samp
  5234. @item 4
  5235. If the original was telecined from 24 to 30 fps (Film to NTSC).
  5236. @item 5
  5237. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  5238. @item 20
  5239. If a mixture of the two.
  5240. @end table
  5241. The default is @samp{4}.
  5242. @end table
  5243. @section delogo
  5244. Suppress a TV station logo by a simple interpolation of the surrounding
  5245. pixels. Just set a rectangle covering the logo and watch it disappear
  5246. (and sometimes something even uglier appear - your mileage may vary).
  5247. It accepts the following parameters:
  5248. @table @option
  5249. @item x
  5250. @item y
  5251. Specify the top left corner coordinates of the logo. They must be
  5252. specified.
  5253. @item w
  5254. @item h
  5255. Specify the width and height of the logo to clear. They must be
  5256. specified.
  5257. @item band, t
  5258. Specify the thickness of the fuzzy edge of the rectangle (added to
  5259. @var{w} and @var{h}). The default value is 1. This option is
  5260. deprecated, setting higher values should no longer be necessary and
  5261. is not recommended.
  5262. @item show
  5263. When set to 1, a green rectangle is drawn on the screen to simplify
  5264. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  5265. The default value is 0.
  5266. The rectangle is drawn on the outermost pixels which will be (partly)
  5267. replaced with interpolated values. The values of the next pixels
  5268. immediately outside this rectangle in each direction will be used to
  5269. compute the interpolated pixel values inside the rectangle.
  5270. @end table
  5271. @subsection Examples
  5272. @itemize
  5273. @item
  5274. Set a rectangle covering the area with top left corner coordinates 0,0
  5275. and size 100x77, and a band of size 10:
  5276. @example
  5277. delogo=x=0:y=0:w=100:h=77:band=10
  5278. @end example
  5279. @end itemize
  5280. @section deshake
  5281. Attempt to fix small changes in horizontal and/or vertical shift. This
  5282. filter helps remove camera shake from hand-holding a camera, bumping a
  5283. tripod, moving on a vehicle, etc.
  5284. The filter accepts the following options:
  5285. @table @option
  5286. @item x
  5287. @item y
  5288. @item w
  5289. @item h
  5290. Specify a rectangular area where to limit the search for motion
  5291. vectors.
  5292. If desired the search for motion vectors can be limited to a
  5293. rectangular area of the frame defined by its top left corner, width
  5294. and height. These parameters have the same meaning as the drawbox
  5295. filter which can be used to visualise the position of the bounding
  5296. box.
  5297. This is useful when simultaneous movement of subjects within the frame
  5298. might be confused for camera motion by the motion vector search.
  5299. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  5300. then the full frame is used. This allows later options to be set
  5301. without specifying the bounding box for the motion vector search.
  5302. Default - search the whole frame.
  5303. @item rx
  5304. @item ry
  5305. Specify the maximum extent of movement in x and y directions in the
  5306. range 0-64 pixels. Default 16.
  5307. @item edge
  5308. Specify how to generate pixels to fill blanks at the edge of the
  5309. frame. Available values are:
  5310. @table @samp
  5311. @item blank, 0
  5312. Fill zeroes at blank locations
  5313. @item original, 1
  5314. Original image at blank locations
  5315. @item clamp, 2
  5316. Extruded edge value at blank locations
  5317. @item mirror, 3
  5318. Mirrored edge at blank locations
  5319. @end table
  5320. Default value is @samp{mirror}.
  5321. @item blocksize
  5322. Specify the blocksize to use for motion search. Range 4-128 pixels,
  5323. default 8.
  5324. @item contrast
  5325. Specify the contrast threshold for blocks. Only blocks with more than
  5326. the specified contrast (difference between darkest and lightest
  5327. pixels) will be considered. Range 1-255, default 125.
  5328. @item search
  5329. Specify the search strategy. Available values are:
  5330. @table @samp
  5331. @item exhaustive, 0
  5332. Set exhaustive search
  5333. @item less, 1
  5334. Set less exhaustive search.
  5335. @end table
  5336. Default value is @samp{exhaustive}.
  5337. @item filename
  5338. If set then a detailed log of the motion search is written to the
  5339. specified file.
  5340. @end table
  5341. @section despill
  5342. Remove unwanted contamination of foreground colors, caused by reflected color of
  5343. greenscreen or bluescreen.
  5344. This filter accepts the following options:
  5345. @table @option
  5346. @item type
  5347. Set what type of despill to use.
  5348. @item mix
  5349. Set how spillmap will be generated.
  5350. @item expand
  5351. Set how much to get rid of still remaining spill.
  5352. @item red
  5353. Controls amount of red in spill area.
  5354. @item green
  5355. Controls amount of green in spill area.
  5356. Should be -1 for greenscreen.
  5357. @item blue
  5358. Controls amount of blue in spill area.
  5359. Should be -1 for bluescreen.
  5360. @item brightness
  5361. Controls brightness of spill area, preserving colors.
  5362. @item alpha
  5363. Modify alpha from generated spillmap.
  5364. @end table
  5365. @section detelecine
  5366. Apply an exact inverse of the telecine operation. It requires a predefined
  5367. pattern specified using the pattern option which must be the same as that passed
  5368. to the telecine filter.
  5369. This filter accepts the following options:
  5370. @table @option
  5371. @item first_field
  5372. @table @samp
  5373. @item top, t
  5374. top field first
  5375. @item bottom, b
  5376. bottom field first
  5377. The default value is @code{top}.
  5378. @end table
  5379. @item pattern
  5380. A string of numbers representing the pulldown pattern you wish to apply.
  5381. The default value is @code{23}.
  5382. @item start_frame
  5383. A number representing position of the first frame with respect to the telecine
  5384. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  5385. @end table
  5386. @section dilation
  5387. Apply dilation effect to the video.
  5388. This filter replaces the pixel by the local(3x3) maximum.
  5389. It accepts the following options:
  5390. @table @option
  5391. @item threshold0
  5392. @item threshold1
  5393. @item threshold2
  5394. @item threshold3
  5395. Limit the maximum change for each plane, default is 65535.
  5396. If 0, plane will remain unchanged.
  5397. @item coordinates
  5398. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5399. pixels are used.
  5400. Flags to local 3x3 coordinates maps like this:
  5401. 1 2 3
  5402. 4 5
  5403. 6 7 8
  5404. @end table
  5405. @section displace
  5406. Displace pixels as indicated by second and third input stream.
  5407. It takes three input streams and outputs one stream, the first input is the
  5408. source, and second and third input are displacement maps.
  5409. The second input specifies how much to displace pixels along the
  5410. x-axis, while the third input specifies how much to displace pixels
  5411. along the y-axis.
  5412. If one of displacement map streams terminates, last frame from that
  5413. displacement map will be used.
  5414. Note that once generated, displacements maps can be reused over and over again.
  5415. A description of the accepted options follows.
  5416. @table @option
  5417. @item edge
  5418. Set displace behavior for pixels that are out of range.
  5419. Available values are:
  5420. @table @samp
  5421. @item blank
  5422. Missing pixels are replaced by black pixels.
  5423. @item smear
  5424. Adjacent pixels will spread out to replace missing pixels.
  5425. @item wrap
  5426. Out of range pixels are wrapped so they point to pixels of other side.
  5427. @item mirror
  5428. Out of range pixels will be replaced with mirrored pixels.
  5429. @end table
  5430. Default is @samp{smear}.
  5431. @end table
  5432. @subsection Examples
  5433. @itemize
  5434. @item
  5435. Add ripple effect to rgb input of video size hd720:
  5436. @example
  5437. 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
  5438. @end example
  5439. @item
  5440. Add wave effect to rgb input of video size hd720:
  5441. @example
  5442. 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
  5443. @end example
  5444. @end itemize
  5445. @section drawbox
  5446. Draw a colored box on the input image.
  5447. It accepts the following parameters:
  5448. @table @option
  5449. @item x
  5450. @item y
  5451. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5452. @item width, w
  5453. @item height, h
  5454. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5455. the input width and height. It defaults to 0.
  5456. @item color, c
  5457. Specify the color of the box to write. For the general syntax of this option,
  5458. check the "Color" section in the ffmpeg-utils manual. If the special
  5459. value @code{invert} is used, the box edge color is the same as the
  5460. video with inverted luma.
  5461. @item thickness, t
  5462. The expression which sets the thickness of the box edge. Default value is @code{3}.
  5463. See below for the list of accepted constants.
  5464. @end table
  5465. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5466. following constants:
  5467. @table @option
  5468. @item dar
  5469. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5470. @item hsub
  5471. @item vsub
  5472. horizontal and vertical chroma subsample values. For example for the
  5473. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5474. @item in_h, ih
  5475. @item in_w, iw
  5476. The input width and height.
  5477. @item sar
  5478. The input sample aspect ratio.
  5479. @item x
  5480. @item y
  5481. The x and y offset coordinates where the box is drawn.
  5482. @item w
  5483. @item h
  5484. The width and height of the drawn box.
  5485. @item t
  5486. The thickness of the drawn box.
  5487. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5488. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5489. @end table
  5490. @subsection Examples
  5491. @itemize
  5492. @item
  5493. Draw a black box around the edge of the input image:
  5494. @example
  5495. drawbox
  5496. @end example
  5497. @item
  5498. Draw a box with color red and an opacity of 50%:
  5499. @example
  5500. drawbox=10:20:200:60:red@@0.5
  5501. @end example
  5502. The previous example can be specified as:
  5503. @example
  5504. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5505. @end example
  5506. @item
  5507. Fill the box with pink color:
  5508. @example
  5509. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  5510. @end example
  5511. @item
  5512. Draw a 2-pixel red 2.40:1 mask:
  5513. @example
  5514. 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
  5515. @end example
  5516. @end itemize
  5517. @section drawgrid
  5518. Draw a grid on the input image.
  5519. It accepts the following parameters:
  5520. @table @option
  5521. @item x
  5522. @item y
  5523. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5524. @item width, w
  5525. @item height, h
  5526. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5527. input width and height, respectively, minus @code{thickness}, so image gets
  5528. framed. Default to 0.
  5529. @item color, c
  5530. Specify the color of the grid. For the general syntax of this option,
  5531. check the "Color" section in the ffmpeg-utils manual. If the special
  5532. value @code{invert} is used, the grid color is the same as the
  5533. video with inverted luma.
  5534. @item thickness, t
  5535. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5536. See below for the list of accepted constants.
  5537. @end table
  5538. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5539. following constants:
  5540. @table @option
  5541. @item dar
  5542. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5543. @item hsub
  5544. @item vsub
  5545. horizontal and vertical chroma subsample values. For example for the
  5546. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5547. @item in_h, ih
  5548. @item in_w, iw
  5549. The input grid cell width and height.
  5550. @item sar
  5551. The input sample aspect ratio.
  5552. @item x
  5553. @item y
  5554. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5555. @item w
  5556. @item h
  5557. The width and height of the drawn cell.
  5558. @item t
  5559. The thickness of the drawn cell.
  5560. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5561. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5562. @end table
  5563. @subsection Examples
  5564. @itemize
  5565. @item
  5566. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5567. @example
  5568. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5569. @end example
  5570. @item
  5571. Draw a white 3x3 grid with an opacity of 50%:
  5572. @example
  5573. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5574. @end example
  5575. @end itemize
  5576. @anchor{drawtext}
  5577. @section drawtext
  5578. Draw a text string or text from a specified file on top of a video, using the
  5579. libfreetype library.
  5580. To enable compilation of this filter, you need to configure FFmpeg with
  5581. @code{--enable-libfreetype}.
  5582. To enable default font fallback and the @var{font} option you need to
  5583. configure FFmpeg with @code{--enable-libfontconfig}.
  5584. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5585. @code{--enable-libfribidi}.
  5586. @subsection Syntax
  5587. It accepts the following parameters:
  5588. @table @option
  5589. @item box
  5590. Used to draw a box around text using the background color.
  5591. The value must be either 1 (enable) or 0 (disable).
  5592. The default value of @var{box} is 0.
  5593. @item boxborderw
  5594. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5595. The default value of @var{boxborderw} is 0.
  5596. @item boxcolor
  5597. The color to be used for drawing box around text. For the syntax of this
  5598. option, check the "Color" section in the ffmpeg-utils manual.
  5599. The default value of @var{boxcolor} is "white".
  5600. @item line_spacing
  5601. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  5602. The default value of @var{line_spacing} is 0.
  5603. @item borderw
  5604. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5605. The default value of @var{borderw} is 0.
  5606. @item bordercolor
  5607. Set the color to be used for drawing border around text. For the syntax of this
  5608. option, check the "Color" section in the ffmpeg-utils manual.
  5609. The default value of @var{bordercolor} is "black".
  5610. @item expansion
  5611. Select how the @var{text} is expanded. Can be either @code{none},
  5612. @code{strftime} (deprecated) or
  5613. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5614. below for details.
  5615. @item basetime
  5616. Set a start time for the count. Value is in microseconds. Only applied
  5617. in the deprecated strftime expansion mode. To emulate in normal expansion
  5618. mode use the @code{pts} function, supplying the start time (in seconds)
  5619. as the second argument.
  5620. @item fix_bounds
  5621. If true, check and fix text coords to avoid clipping.
  5622. @item fontcolor
  5623. The color to be used for drawing fonts. For the syntax of this option, check
  5624. the "Color" section in the ffmpeg-utils manual.
  5625. The default value of @var{fontcolor} is "black".
  5626. @item fontcolor_expr
  5627. String which is expanded the same way as @var{text} to obtain dynamic
  5628. @var{fontcolor} value. By default this option has empty value and is not
  5629. processed. When this option is set, it overrides @var{fontcolor} option.
  5630. @item font
  5631. The font family to be used for drawing text. By default Sans.
  5632. @item fontfile
  5633. The font file to be used for drawing text. The path must be included.
  5634. This parameter is mandatory if the fontconfig support is disabled.
  5635. @item alpha
  5636. Draw the text applying alpha blending. The value can
  5637. be a number between 0.0 and 1.0.
  5638. The expression accepts the same variables @var{x, y} as well.
  5639. The default value is 1.
  5640. Please see @var{fontcolor_expr}.
  5641. @item fontsize
  5642. The font size to be used for drawing text.
  5643. The default value of @var{fontsize} is 16.
  5644. @item text_shaping
  5645. If set to 1, attempt to shape the text (for example, reverse the order of
  5646. right-to-left text and join Arabic characters) before drawing it.
  5647. Otherwise, just draw the text exactly as given.
  5648. By default 1 (if supported).
  5649. @item ft_load_flags
  5650. The flags to be used for loading the fonts.
  5651. The flags map the corresponding flags supported by libfreetype, and are
  5652. a combination of the following values:
  5653. @table @var
  5654. @item default
  5655. @item no_scale
  5656. @item no_hinting
  5657. @item render
  5658. @item no_bitmap
  5659. @item vertical_layout
  5660. @item force_autohint
  5661. @item crop_bitmap
  5662. @item pedantic
  5663. @item ignore_global_advance_width
  5664. @item no_recurse
  5665. @item ignore_transform
  5666. @item monochrome
  5667. @item linear_design
  5668. @item no_autohint
  5669. @end table
  5670. Default value is "default".
  5671. For more information consult the documentation for the FT_LOAD_*
  5672. libfreetype flags.
  5673. @item shadowcolor
  5674. The color to be used for drawing a shadow behind the drawn text. For the
  5675. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  5676. The default value of @var{shadowcolor} is "black".
  5677. @item shadowx
  5678. @item shadowy
  5679. The x and y offsets for the text shadow position with respect to the
  5680. position of the text. They can be either positive or negative
  5681. values. The default value for both is "0".
  5682. @item start_number
  5683. The starting frame number for the n/frame_num variable. The default value
  5684. is "0".
  5685. @item tabsize
  5686. The size in number of spaces to use for rendering the tab.
  5687. Default value is 4.
  5688. @item timecode
  5689. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5690. format. It can be used with or without text parameter. @var{timecode_rate}
  5691. option must be specified.
  5692. @item timecode_rate, rate, r
  5693. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  5694. integer. Minimum value is "1".
  5695. Drop-frame timecode is supported for frame rates 30 & 60.
  5696. @item tc24hmax
  5697. If set to 1, the output of the timecode option will wrap around at 24 hours.
  5698. Default is 0 (disabled).
  5699. @item text
  5700. The text string to be drawn. The text must be a sequence of UTF-8
  5701. encoded characters.
  5702. This parameter is mandatory if no file is specified with the parameter
  5703. @var{textfile}.
  5704. @item textfile
  5705. A text file containing text to be drawn. The text must be a sequence
  5706. of UTF-8 encoded characters.
  5707. This parameter is mandatory if no text string is specified with the
  5708. parameter @var{text}.
  5709. If both @var{text} and @var{textfile} are specified, an error is thrown.
  5710. @item reload
  5711. If set to 1, the @var{textfile} will be reloaded before each frame.
  5712. Be sure to update it atomically, or it may be read partially, or even fail.
  5713. @item x
  5714. @item y
  5715. The expressions which specify the offsets where text will be drawn
  5716. within the video frame. They are relative to the top/left border of the
  5717. output image.
  5718. The default value of @var{x} and @var{y} is "0".
  5719. See below for the list of accepted constants and functions.
  5720. @end table
  5721. The parameters for @var{x} and @var{y} are expressions containing the
  5722. following constants and functions:
  5723. @table @option
  5724. @item dar
  5725. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  5726. @item hsub
  5727. @item vsub
  5728. horizontal and vertical chroma subsample values. For example for the
  5729. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5730. @item line_h, lh
  5731. the height of each text line
  5732. @item main_h, h, H
  5733. the input height
  5734. @item main_w, w, W
  5735. the input width
  5736. @item max_glyph_a, ascent
  5737. the maximum distance from the baseline to the highest/upper grid
  5738. coordinate used to place a glyph outline point, for all the rendered
  5739. glyphs.
  5740. It is a positive value, due to the grid's orientation with the Y axis
  5741. upwards.
  5742. @item max_glyph_d, descent
  5743. the maximum distance from the baseline to the lowest grid coordinate
  5744. used to place a glyph outline point, for all the rendered glyphs.
  5745. This is a negative value, due to the grid's orientation, with the Y axis
  5746. upwards.
  5747. @item max_glyph_h
  5748. maximum glyph height, that is the maximum height for all the glyphs
  5749. contained in the rendered text, it is equivalent to @var{ascent} -
  5750. @var{descent}.
  5751. @item max_glyph_w
  5752. maximum glyph width, that is the maximum width for all the glyphs
  5753. contained in the rendered text
  5754. @item n
  5755. the number of input frame, starting from 0
  5756. @item rand(min, max)
  5757. return a random number included between @var{min} and @var{max}
  5758. @item sar
  5759. The input sample aspect ratio.
  5760. @item t
  5761. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5762. @item text_h, th
  5763. the height of the rendered text
  5764. @item text_w, tw
  5765. the width of the rendered text
  5766. @item x
  5767. @item y
  5768. the x and y offset coordinates where the text is drawn.
  5769. These parameters allow the @var{x} and @var{y} expressions to refer
  5770. each other, so you can for example specify @code{y=x/dar}.
  5771. @end table
  5772. @anchor{drawtext_expansion}
  5773. @subsection Text expansion
  5774. If @option{expansion} is set to @code{strftime},
  5775. the filter recognizes strftime() sequences in the provided text and
  5776. expands them accordingly. Check the documentation of strftime(). This
  5777. feature is deprecated.
  5778. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  5779. If @option{expansion} is set to @code{normal} (which is the default),
  5780. the following expansion mechanism is used.
  5781. The backslash character @samp{\}, followed by any character, always expands to
  5782. the second character.
  5783. Sequences of the form @code{%@{...@}} are expanded. The text between the
  5784. braces is a function name, possibly followed by arguments separated by ':'.
  5785. If the arguments contain special characters or delimiters (':' or '@}'),
  5786. they should be escaped.
  5787. Note that they probably must also be escaped as the value for the
  5788. @option{text} option in the filter argument string and as the filter
  5789. argument in the filtergraph description, and possibly also for the shell,
  5790. that makes up to four levels of escaping; using a text file avoids these
  5791. problems.
  5792. The following functions are available:
  5793. @table @command
  5794. @item expr, e
  5795. The expression evaluation result.
  5796. It must take one argument specifying the expression to be evaluated,
  5797. which accepts the same constants and functions as the @var{x} and
  5798. @var{y} values. Note that not all constants should be used, for
  5799. example the text size is not known when evaluating the expression, so
  5800. the constants @var{text_w} and @var{text_h} will have an undefined
  5801. value.
  5802. @item expr_int_format, eif
  5803. Evaluate the expression's value and output as formatted integer.
  5804. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  5805. The second argument specifies the output format. Allowed values are @samp{x},
  5806. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  5807. @code{printf} function.
  5808. The third parameter is optional and sets the number of positions taken by the output.
  5809. It can be used to add padding with zeros from the left.
  5810. @item gmtime
  5811. The time at which the filter is running, expressed in UTC.
  5812. It can accept an argument: a strftime() format string.
  5813. @item localtime
  5814. The time at which the filter is running, expressed in the local time zone.
  5815. It can accept an argument: a strftime() format string.
  5816. @item metadata
  5817. Frame metadata. Takes one or two arguments.
  5818. The first argument is mandatory and specifies the metadata key.
  5819. The second argument is optional and specifies a default value, used when the
  5820. metadata key is not found or empty.
  5821. @item n, frame_num
  5822. The frame number, starting from 0.
  5823. @item pict_type
  5824. A 1 character description of the current picture type.
  5825. @item pts
  5826. The timestamp of the current frame.
  5827. It can take up to three arguments.
  5828. The first argument is the format of the timestamp; it defaults to @code{flt}
  5829. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  5830. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  5831. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  5832. @code{localtime} stands for the timestamp of the frame formatted as
  5833. local time zone time.
  5834. The second argument is an offset added to the timestamp.
  5835. If the format is set to @code{localtime} or @code{gmtime},
  5836. a third argument may be supplied: a strftime() format string.
  5837. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  5838. @end table
  5839. @subsection Examples
  5840. @itemize
  5841. @item
  5842. Draw "Test Text" with font FreeSerif, using the default values for the
  5843. optional parameters.
  5844. @example
  5845. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  5846. @end example
  5847. @item
  5848. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  5849. and y=50 (counting from the top-left corner of the screen), text is
  5850. yellow with a red box around it. Both the text and the box have an
  5851. opacity of 20%.
  5852. @example
  5853. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  5854. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  5855. @end example
  5856. Note that the double quotes are not necessary if spaces are not used
  5857. within the parameter list.
  5858. @item
  5859. Show the text at the center of the video frame:
  5860. @example
  5861. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  5862. @end example
  5863. @item
  5864. Show the text at a random position, switching to a new position every 30 seconds:
  5865. @example
  5866. 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)"
  5867. @end example
  5868. @item
  5869. Show a text line sliding from right to left in the last row of the video
  5870. frame. The file @file{LONG_LINE} is assumed to contain a single line
  5871. with no newlines.
  5872. @example
  5873. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  5874. @end example
  5875. @item
  5876. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  5877. @example
  5878. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  5879. @end example
  5880. @item
  5881. Draw a single green letter "g", at the center of the input video.
  5882. The glyph baseline is placed at half screen height.
  5883. @example
  5884. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  5885. @end example
  5886. @item
  5887. Show text for 1 second every 3 seconds:
  5888. @example
  5889. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  5890. @end example
  5891. @item
  5892. Use fontconfig to set the font. Note that the colons need to be escaped.
  5893. @example
  5894. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  5895. @end example
  5896. @item
  5897. Print the date of a real-time encoding (see strftime(3)):
  5898. @example
  5899. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  5900. @end example
  5901. @item
  5902. Show text fading in and out (appearing/disappearing):
  5903. @example
  5904. #!/bin/sh
  5905. DS=1.0 # display start
  5906. DE=10.0 # display end
  5907. FID=1.5 # fade in duration
  5908. FOD=5 # fade out duration
  5909. 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 @}"
  5910. @end example
  5911. @item
  5912. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  5913. and the @option{fontsize} value are included in the @option{y} offset.
  5914. @example
  5915. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  5916. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  5917. @end example
  5918. @end itemize
  5919. For more information about libfreetype, check:
  5920. @url{http://www.freetype.org/}.
  5921. For more information about fontconfig, check:
  5922. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  5923. For more information about libfribidi, check:
  5924. @url{http://fribidi.org/}.
  5925. @section edgedetect
  5926. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  5927. The filter accepts the following options:
  5928. @table @option
  5929. @item low
  5930. @item high
  5931. Set low and high threshold values used by the Canny thresholding
  5932. algorithm.
  5933. The high threshold selects the "strong" edge pixels, which are then
  5934. connected through 8-connectivity with the "weak" edge pixels selected
  5935. by the low threshold.
  5936. @var{low} and @var{high} threshold values must be chosen in the range
  5937. [0,1], and @var{low} should be lesser or equal to @var{high}.
  5938. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  5939. is @code{50/255}.
  5940. @item mode
  5941. Define the drawing mode.
  5942. @table @samp
  5943. @item wires
  5944. Draw white/gray wires on black background.
  5945. @item colormix
  5946. Mix the colors to create a paint/cartoon effect.
  5947. @end table
  5948. Default value is @var{wires}.
  5949. @end table
  5950. @subsection Examples
  5951. @itemize
  5952. @item
  5953. Standard edge detection with custom values for the hysteresis thresholding:
  5954. @example
  5955. edgedetect=low=0.1:high=0.4
  5956. @end example
  5957. @item
  5958. Painting effect without thresholding:
  5959. @example
  5960. edgedetect=mode=colormix:high=0
  5961. @end example
  5962. @end itemize
  5963. @section eq
  5964. Set brightness, contrast, saturation and approximate gamma adjustment.
  5965. The filter accepts the following options:
  5966. @table @option
  5967. @item contrast
  5968. Set the contrast expression. The value must be a float value in range
  5969. @code{-2.0} to @code{2.0}. The default value is "1".
  5970. @item brightness
  5971. Set the brightness expression. The value must be a float value in
  5972. range @code{-1.0} to @code{1.0}. The default value is "0".
  5973. @item saturation
  5974. Set the saturation expression. The value must be a float in
  5975. range @code{0.0} to @code{3.0}. The default value is "1".
  5976. @item gamma
  5977. Set the gamma expression. The value must be a float in range
  5978. @code{0.1} to @code{10.0}. The default value is "1".
  5979. @item gamma_r
  5980. Set the gamma expression for red. The value must be a float in
  5981. range @code{0.1} to @code{10.0}. The default value is "1".
  5982. @item gamma_g
  5983. Set the gamma expression for green. The value must be a float in range
  5984. @code{0.1} to @code{10.0}. The default value is "1".
  5985. @item gamma_b
  5986. Set the gamma expression for blue. The value must be a float in range
  5987. @code{0.1} to @code{10.0}. The default value is "1".
  5988. @item gamma_weight
  5989. Set the gamma weight expression. It can be used to reduce the effect
  5990. of a high gamma value on bright image areas, e.g. keep them from
  5991. getting overamplified and just plain white. The value must be a float
  5992. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  5993. gamma correction all the way down while @code{1.0} leaves it at its
  5994. full strength. Default is "1".
  5995. @item eval
  5996. Set when the expressions for brightness, contrast, saturation and
  5997. gamma expressions are evaluated.
  5998. It accepts the following values:
  5999. @table @samp
  6000. @item init
  6001. only evaluate expressions once during the filter initialization or
  6002. when a command is processed
  6003. @item frame
  6004. evaluate expressions for each incoming frame
  6005. @end table
  6006. Default value is @samp{init}.
  6007. @end table
  6008. The expressions accept the following parameters:
  6009. @table @option
  6010. @item n
  6011. frame count of the input frame starting from 0
  6012. @item pos
  6013. byte position of the corresponding packet in the input file, NAN if
  6014. unspecified
  6015. @item r
  6016. frame rate of the input video, NAN if the input frame rate is unknown
  6017. @item t
  6018. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6019. @end table
  6020. @subsection Commands
  6021. The filter supports the following commands:
  6022. @table @option
  6023. @item contrast
  6024. Set the contrast expression.
  6025. @item brightness
  6026. Set the brightness expression.
  6027. @item saturation
  6028. Set the saturation expression.
  6029. @item gamma
  6030. Set the gamma expression.
  6031. @item gamma_r
  6032. Set the gamma_r expression.
  6033. @item gamma_g
  6034. Set gamma_g expression.
  6035. @item gamma_b
  6036. Set gamma_b expression.
  6037. @item gamma_weight
  6038. Set gamma_weight expression.
  6039. The command accepts the same syntax of the corresponding option.
  6040. If the specified expression is not valid, it is kept at its current
  6041. value.
  6042. @end table
  6043. @section erosion
  6044. Apply erosion effect to the video.
  6045. This filter replaces the pixel by the local(3x3) minimum.
  6046. It accepts the following options:
  6047. @table @option
  6048. @item threshold0
  6049. @item threshold1
  6050. @item threshold2
  6051. @item threshold3
  6052. Limit the maximum change for each plane, default is 65535.
  6053. If 0, plane will remain unchanged.
  6054. @item coordinates
  6055. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6056. pixels are used.
  6057. Flags to local 3x3 coordinates maps like this:
  6058. 1 2 3
  6059. 4 5
  6060. 6 7 8
  6061. @end table
  6062. @section extractplanes
  6063. Extract color channel components from input video stream into
  6064. separate grayscale video streams.
  6065. The filter accepts the following option:
  6066. @table @option
  6067. @item planes
  6068. Set plane(s) to extract.
  6069. Available values for planes are:
  6070. @table @samp
  6071. @item y
  6072. @item u
  6073. @item v
  6074. @item a
  6075. @item r
  6076. @item g
  6077. @item b
  6078. @end table
  6079. Choosing planes not available in the input will result in an error.
  6080. That means you cannot select @code{r}, @code{g}, @code{b} planes
  6081. with @code{y}, @code{u}, @code{v} planes at same time.
  6082. @end table
  6083. @subsection Examples
  6084. @itemize
  6085. @item
  6086. Extract luma, u and v color channel component from input video frame
  6087. into 3 grayscale outputs:
  6088. @example
  6089. 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
  6090. @end example
  6091. @end itemize
  6092. @section elbg
  6093. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  6094. For each input image, the filter will compute the optimal mapping from
  6095. the input to the output given the codebook length, that is the number
  6096. of distinct output colors.
  6097. This filter accepts the following options.
  6098. @table @option
  6099. @item codebook_length, l
  6100. Set codebook length. The value must be a positive integer, and
  6101. represents the number of distinct output colors. Default value is 256.
  6102. @item nb_steps, n
  6103. Set the maximum number of iterations to apply for computing the optimal
  6104. mapping. The higher the value the better the result and the higher the
  6105. computation time. Default value is 1.
  6106. @item seed, s
  6107. Set a random seed, must be an integer included between 0 and
  6108. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  6109. will try to use a good random seed on a best effort basis.
  6110. @item pal8
  6111. Set pal8 output pixel format. This option does not work with codebook
  6112. length greater than 256.
  6113. @end table
  6114. @section fade
  6115. Apply a fade-in/out effect to the input video.
  6116. It accepts the following parameters:
  6117. @table @option
  6118. @item type, t
  6119. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  6120. effect.
  6121. Default is @code{in}.
  6122. @item start_frame, s
  6123. Specify the number of the frame to start applying the fade
  6124. effect at. Default is 0.
  6125. @item nb_frames, n
  6126. The number of frames that the fade effect lasts. At the end of the
  6127. fade-in effect, the output video will have the same intensity as the input video.
  6128. At the end of the fade-out transition, the output video will be filled with the
  6129. selected @option{color}.
  6130. Default is 25.
  6131. @item alpha
  6132. If set to 1, fade only alpha channel, if one exists on the input.
  6133. Default value is 0.
  6134. @item start_time, st
  6135. Specify the timestamp (in seconds) of the frame to start to apply the fade
  6136. effect. If both start_frame and start_time are specified, the fade will start at
  6137. whichever comes last. Default is 0.
  6138. @item duration, d
  6139. The number of seconds for which the fade effect has to last. At the end of the
  6140. fade-in effect the output video will have the same intensity as the input video,
  6141. at the end of the fade-out transition the output video will be filled with the
  6142. selected @option{color}.
  6143. If both duration and nb_frames are specified, duration is used. Default is 0
  6144. (nb_frames is used by default).
  6145. @item color, c
  6146. Specify the color of the fade. Default is "black".
  6147. @end table
  6148. @subsection Examples
  6149. @itemize
  6150. @item
  6151. Fade in the first 30 frames of video:
  6152. @example
  6153. fade=in:0:30
  6154. @end example
  6155. The command above is equivalent to:
  6156. @example
  6157. fade=t=in:s=0:n=30
  6158. @end example
  6159. @item
  6160. Fade out the last 45 frames of a 200-frame video:
  6161. @example
  6162. fade=out:155:45
  6163. fade=type=out:start_frame=155:nb_frames=45
  6164. @end example
  6165. @item
  6166. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  6167. @example
  6168. fade=in:0:25, fade=out:975:25
  6169. @end example
  6170. @item
  6171. Make the first 5 frames yellow, then fade in from frame 5-24:
  6172. @example
  6173. fade=in:5:20:color=yellow
  6174. @end example
  6175. @item
  6176. Fade in alpha over first 25 frames of video:
  6177. @example
  6178. fade=in:0:25:alpha=1
  6179. @end example
  6180. @item
  6181. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  6182. @example
  6183. fade=t=in:st=5.5:d=0.5
  6184. @end example
  6185. @end itemize
  6186. @section fftfilt
  6187. Apply arbitrary expressions to samples in frequency domain
  6188. @table @option
  6189. @item dc_Y
  6190. Adjust the dc value (gain) of the luma plane of the image. The filter
  6191. accepts an integer value in range @code{0} to @code{1000}. The default
  6192. value is set to @code{0}.
  6193. @item dc_U
  6194. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  6195. filter accepts an integer value in range @code{0} to @code{1000}. The
  6196. default value is set to @code{0}.
  6197. @item dc_V
  6198. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  6199. filter accepts an integer value in range @code{0} to @code{1000}. The
  6200. default value is set to @code{0}.
  6201. @item weight_Y
  6202. Set the frequency domain weight expression for the luma plane.
  6203. @item weight_U
  6204. Set the frequency domain weight expression for the 1st chroma plane.
  6205. @item weight_V
  6206. Set the frequency domain weight expression for the 2nd chroma plane.
  6207. @item eval
  6208. Set when the expressions are evaluated.
  6209. It accepts the following values:
  6210. @table @samp
  6211. @item init
  6212. Only evaluate expressions once during the filter initialization.
  6213. @item frame
  6214. Evaluate expressions for each incoming frame.
  6215. @end table
  6216. Default value is @samp{init}.
  6217. The filter accepts the following variables:
  6218. @item X
  6219. @item Y
  6220. The coordinates of the current sample.
  6221. @item W
  6222. @item H
  6223. The width and height of the image.
  6224. @item N
  6225. The number of input frame, starting from 0.
  6226. @end table
  6227. @subsection Examples
  6228. @itemize
  6229. @item
  6230. High-pass:
  6231. @example
  6232. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  6233. @end example
  6234. @item
  6235. Low-pass:
  6236. @example
  6237. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  6238. @end example
  6239. @item
  6240. Sharpen:
  6241. @example
  6242. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  6243. @end example
  6244. @item
  6245. Blur:
  6246. @example
  6247. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  6248. @end example
  6249. @end itemize
  6250. @section field
  6251. Extract a single field from an interlaced image using stride
  6252. arithmetic to avoid wasting CPU time. The output frames are marked as
  6253. non-interlaced.
  6254. The filter accepts the following options:
  6255. @table @option
  6256. @item type
  6257. Specify whether to extract the top (if the value is @code{0} or
  6258. @code{top}) or the bottom field (if the value is @code{1} or
  6259. @code{bottom}).
  6260. @end table
  6261. @section fieldhint
  6262. Create new frames by copying the top and bottom fields from surrounding frames
  6263. supplied as numbers by the hint file.
  6264. @table @option
  6265. @item hint
  6266. Set file containing hints: absolute/relative frame numbers.
  6267. There must be one line for each frame in a clip. Each line must contain two
  6268. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  6269. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  6270. is current frame number for @code{absolute} mode or out of [-1, 1] range
  6271. for @code{relative} mode. First number tells from which frame to pick up top
  6272. field and second number tells from which frame to pick up bottom field.
  6273. If optionally followed by @code{+} output frame will be marked as interlaced,
  6274. else if followed by @code{-} output frame will be marked as progressive, else
  6275. it will be marked same as input frame.
  6276. If line starts with @code{#} or @code{;} that line is skipped.
  6277. @item mode
  6278. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  6279. @end table
  6280. Example of first several lines of @code{hint} file for @code{relative} mode:
  6281. @example
  6282. 0,0 - # first frame
  6283. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  6284. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  6285. 1,0 -
  6286. 0,0 -
  6287. 0,0 -
  6288. 1,0 -
  6289. 1,0 -
  6290. 1,0 -
  6291. 0,0 -
  6292. 0,0 -
  6293. 1,0 -
  6294. 1,0 -
  6295. 1,0 -
  6296. 0,0 -
  6297. @end example
  6298. @section fieldmatch
  6299. Field matching filter for inverse telecine. It is meant to reconstruct the
  6300. progressive frames from a telecined stream. The filter does not drop duplicated
  6301. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  6302. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  6303. The separation of the field matching and the decimation is notably motivated by
  6304. the possibility of inserting a de-interlacing filter fallback between the two.
  6305. If the source has mixed telecined and real interlaced content,
  6306. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  6307. But these remaining combed frames will be marked as interlaced, and thus can be
  6308. de-interlaced by a later filter such as @ref{yadif} before decimation.
  6309. In addition to the various configuration options, @code{fieldmatch} can take an
  6310. optional second stream, activated through the @option{ppsrc} option. If
  6311. enabled, the frames reconstruction will be based on the fields and frames from
  6312. this second stream. This allows the first input to be pre-processed in order to
  6313. help the various algorithms of the filter, while keeping the output lossless
  6314. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  6315. or brightness/contrast adjustments can help.
  6316. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  6317. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  6318. which @code{fieldmatch} is based on. While the semantic and usage are very
  6319. close, some behaviour and options names can differ.
  6320. The @ref{decimate} filter currently only works for constant frame rate input.
  6321. If your input has mixed telecined (30fps) and progressive content with a lower
  6322. framerate like 24fps use the following filterchain to produce the necessary cfr
  6323. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  6324. The filter accepts the following options:
  6325. @table @option
  6326. @item order
  6327. Specify the assumed field order of the input stream. Available values are:
  6328. @table @samp
  6329. @item auto
  6330. Auto detect parity (use FFmpeg's internal parity value).
  6331. @item bff
  6332. Assume bottom field first.
  6333. @item tff
  6334. Assume top field first.
  6335. @end table
  6336. Note that it is sometimes recommended not to trust the parity announced by the
  6337. stream.
  6338. Default value is @var{auto}.
  6339. @item mode
  6340. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  6341. sense that it won't risk creating jerkiness due to duplicate frames when
  6342. possible, but if there are bad edits or blended fields it will end up
  6343. outputting combed frames when a good match might actually exist. On the other
  6344. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  6345. but will almost always find a good frame if there is one. The other values are
  6346. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  6347. jerkiness and creating duplicate frames versus finding good matches in sections
  6348. with bad edits, orphaned fields, blended fields, etc.
  6349. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  6350. Available values are:
  6351. @table @samp
  6352. @item pc
  6353. 2-way matching (p/c)
  6354. @item pc_n
  6355. 2-way matching, and trying 3rd match if still combed (p/c + n)
  6356. @item pc_u
  6357. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  6358. @item pc_n_ub
  6359. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  6360. still combed (p/c + n + u/b)
  6361. @item pcn
  6362. 3-way matching (p/c/n)
  6363. @item pcn_ub
  6364. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  6365. detected as combed (p/c/n + u/b)
  6366. @end table
  6367. The parenthesis at the end indicate the matches that would be used for that
  6368. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  6369. @var{top}).
  6370. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  6371. the slowest.
  6372. Default value is @var{pc_n}.
  6373. @item ppsrc
  6374. Mark the main input stream as a pre-processed input, and enable the secondary
  6375. input stream as the clean source to pick the fields from. See the filter
  6376. introduction for more details. It is similar to the @option{clip2} feature from
  6377. VFM/TFM.
  6378. Default value is @code{0} (disabled).
  6379. @item field
  6380. Set the field to match from. It is recommended to set this to the same value as
  6381. @option{order} unless you experience matching failures with that setting. In
  6382. certain circumstances changing the field that is used to match from can have a
  6383. large impact on matching performance. Available values are:
  6384. @table @samp
  6385. @item auto
  6386. Automatic (same value as @option{order}).
  6387. @item bottom
  6388. Match from the bottom field.
  6389. @item top
  6390. Match from the top field.
  6391. @end table
  6392. Default value is @var{auto}.
  6393. @item mchroma
  6394. Set whether or not chroma is included during the match comparisons. In most
  6395. cases it is recommended to leave this enabled. You should set this to @code{0}
  6396. only if your clip has bad chroma problems such as heavy rainbowing or other
  6397. artifacts. Setting this to @code{0} could also be used to speed things up at
  6398. the cost of some accuracy.
  6399. Default value is @code{1}.
  6400. @item y0
  6401. @item y1
  6402. These define an exclusion band which excludes the lines between @option{y0} and
  6403. @option{y1} from being included in the field matching decision. An exclusion
  6404. band can be used to ignore subtitles, a logo, or other things that may
  6405. interfere with the matching. @option{y0} sets the starting scan line and
  6406. @option{y1} sets the ending line; all lines in between @option{y0} and
  6407. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6408. @option{y0} and @option{y1} to the same value will disable the feature.
  6409. @option{y0} and @option{y1} defaults to @code{0}.
  6410. @item scthresh
  6411. Set the scene change detection threshold as a percentage of maximum change on
  6412. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6413. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6414. @option{scthresh} is @code{[0.0, 100.0]}.
  6415. Default value is @code{12.0}.
  6416. @item combmatch
  6417. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6418. account the combed scores of matches when deciding what match to use as the
  6419. final match. Available values are:
  6420. @table @samp
  6421. @item none
  6422. No final matching based on combed scores.
  6423. @item sc
  6424. Combed scores are only used when a scene change is detected.
  6425. @item full
  6426. Use combed scores all the time.
  6427. @end table
  6428. Default is @var{sc}.
  6429. @item combdbg
  6430. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  6431. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  6432. Available values are:
  6433. @table @samp
  6434. @item none
  6435. No forced calculation.
  6436. @item pcn
  6437. Force p/c/n calculations.
  6438. @item pcnub
  6439. Force p/c/n/u/b calculations.
  6440. @end table
  6441. Default value is @var{none}.
  6442. @item cthresh
  6443. This is the area combing threshold used for combed frame detection. This
  6444. essentially controls how "strong" or "visible" combing must be to be detected.
  6445. Larger values mean combing must be more visible and smaller values mean combing
  6446. can be less visible or strong and still be detected. Valid settings are from
  6447. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6448. be detected as combed). This is basically a pixel difference value. A good
  6449. range is @code{[8, 12]}.
  6450. Default value is @code{9}.
  6451. @item chroma
  6452. Sets whether or not chroma is considered in the combed frame decision. Only
  6453. disable this if your source has chroma problems (rainbowing, etc.) that are
  6454. causing problems for the combed frame detection with chroma enabled. Actually,
  6455. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6456. where there is chroma only combing in the source.
  6457. Default value is @code{0}.
  6458. @item blockx
  6459. @item blocky
  6460. Respectively set the x-axis and y-axis size of the window used during combed
  6461. frame detection. This has to do with the size of the area in which
  6462. @option{combpel} pixels are required to be detected as combed for a frame to be
  6463. declared combed. See the @option{combpel} parameter description for more info.
  6464. Possible values are any number that is a power of 2 starting at 4 and going up
  6465. to 512.
  6466. Default value is @code{16}.
  6467. @item combpel
  6468. The number of combed pixels inside any of the @option{blocky} by
  6469. @option{blockx} size blocks on the frame for the frame to be detected as
  6470. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6471. setting controls "how much" combing there must be in any localized area (a
  6472. window defined by the @option{blockx} and @option{blocky} settings) on the
  6473. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6474. which point no frames will ever be detected as combed). This setting is known
  6475. as @option{MI} in TFM/VFM vocabulary.
  6476. Default value is @code{80}.
  6477. @end table
  6478. @anchor{p/c/n/u/b meaning}
  6479. @subsection p/c/n/u/b meaning
  6480. @subsubsection p/c/n
  6481. We assume the following telecined stream:
  6482. @example
  6483. Top fields: 1 2 2 3 4
  6484. Bottom fields: 1 2 3 4 4
  6485. @end example
  6486. The numbers correspond to the progressive frame the fields relate to. Here, the
  6487. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6488. When @code{fieldmatch} is configured to run a matching from bottom
  6489. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6490. @example
  6491. Input stream:
  6492. T 1 2 2 3 4
  6493. B 1 2 3 4 4 <-- matching reference
  6494. Matches: c c n n c
  6495. Output stream:
  6496. T 1 2 3 4 4
  6497. B 1 2 3 4 4
  6498. @end example
  6499. As a result of the field matching, we can see that some frames get duplicated.
  6500. To perform a complete inverse telecine, you need to rely on a decimation filter
  6501. after this operation. See for instance the @ref{decimate} filter.
  6502. The same operation now matching from top fields (@option{field}=@var{top})
  6503. looks like this:
  6504. @example
  6505. Input stream:
  6506. T 1 2 2 3 4 <-- matching reference
  6507. B 1 2 3 4 4
  6508. Matches: c c p p c
  6509. Output stream:
  6510. T 1 2 2 3 4
  6511. B 1 2 2 3 4
  6512. @end example
  6513. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6514. basically, they refer to the frame and field of the opposite parity:
  6515. @itemize
  6516. @item @var{p} matches the field of the opposite parity in the previous frame
  6517. @item @var{c} matches the field of the opposite parity in the current frame
  6518. @item @var{n} matches the field of the opposite parity in the next frame
  6519. @end itemize
  6520. @subsubsection u/b
  6521. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6522. from the opposite parity flag. In the following examples, we assume that we are
  6523. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6524. 'x' is placed above and below each matched fields.
  6525. With bottom matching (@option{field}=@var{bottom}):
  6526. @example
  6527. Match: c p n b u
  6528. x x x x x
  6529. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6530. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6531. x x x x x
  6532. Output frames:
  6533. 2 1 2 2 2
  6534. 2 2 2 1 3
  6535. @end example
  6536. With top matching (@option{field}=@var{top}):
  6537. @example
  6538. Match: c p n b u
  6539. x x x x x
  6540. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6541. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6542. x x x x x
  6543. Output frames:
  6544. 2 2 2 1 2
  6545. 2 1 3 2 2
  6546. @end example
  6547. @subsection Examples
  6548. Simple IVTC of a top field first telecined stream:
  6549. @example
  6550. fieldmatch=order=tff:combmatch=none, decimate
  6551. @end example
  6552. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6553. @example
  6554. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6555. @end example
  6556. @section fieldorder
  6557. Transform the field order of the input video.
  6558. It accepts the following parameters:
  6559. @table @option
  6560. @item order
  6561. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6562. for bottom field first.
  6563. @end table
  6564. The default value is @samp{tff}.
  6565. The transformation is done by shifting the picture content up or down
  6566. by one line, and filling the remaining line with appropriate picture content.
  6567. This method is consistent with most broadcast field order converters.
  6568. If the input video is not flagged as being interlaced, or it is already
  6569. flagged as being of the required output field order, then this filter does
  6570. not alter the incoming video.
  6571. It is very useful when converting to or from PAL DV material,
  6572. which is bottom field first.
  6573. For example:
  6574. @example
  6575. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6576. @end example
  6577. @section fifo, afifo
  6578. Buffer input images and send them when they are requested.
  6579. It is mainly useful when auto-inserted by the libavfilter
  6580. framework.
  6581. It does not take parameters.
  6582. @section find_rect
  6583. Find a rectangular object
  6584. It accepts the following options:
  6585. @table @option
  6586. @item object
  6587. Filepath of the object image, needs to be in gray8.
  6588. @item threshold
  6589. Detection threshold, default is 0.5.
  6590. @item mipmaps
  6591. Number of mipmaps, default is 3.
  6592. @item xmin, ymin, xmax, ymax
  6593. Specifies the rectangle in which to search.
  6594. @end table
  6595. @subsection Examples
  6596. @itemize
  6597. @item
  6598. Generate a representative palette of a given video using @command{ffmpeg}:
  6599. @example
  6600. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6601. @end example
  6602. @end itemize
  6603. @section cover_rect
  6604. Cover a rectangular object
  6605. It accepts the following options:
  6606. @table @option
  6607. @item cover
  6608. Filepath of the optional cover image, needs to be in yuv420.
  6609. @item mode
  6610. Set covering mode.
  6611. It accepts the following values:
  6612. @table @samp
  6613. @item cover
  6614. cover it by the supplied image
  6615. @item blur
  6616. cover it by interpolating the surrounding pixels
  6617. @end table
  6618. Default value is @var{blur}.
  6619. @end table
  6620. @subsection Examples
  6621. @itemize
  6622. @item
  6623. Generate a representative palette of a given video using @command{ffmpeg}:
  6624. @example
  6625. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6626. @end example
  6627. @end itemize
  6628. @section floodfill
  6629. Flood area with values of same pixel components with another values.
  6630. It accepts the following options:
  6631. @table @option
  6632. @item x
  6633. Set pixel x coordinate.
  6634. @item y
  6635. Set pixel y coordinate.
  6636. @item s0
  6637. Set source #0 component value.
  6638. @item s1
  6639. Set source #1 component value.
  6640. @item s2
  6641. Set source #2 component value.
  6642. @item s3
  6643. Set source #3 component value.
  6644. @item d0
  6645. Set destination #0 component value.
  6646. @item d1
  6647. Set destination #1 component value.
  6648. @item d2
  6649. Set destination #2 component value.
  6650. @item d3
  6651. Set destination #3 component value.
  6652. @end table
  6653. @anchor{format}
  6654. @section format
  6655. Convert the input video to one of the specified pixel formats.
  6656. Libavfilter will try to pick one that is suitable as input to
  6657. the next filter.
  6658. It accepts the following parameters:
  6659. @table @option
  6660. @item pix_fmts
  6661. A '|'-separated list of pixel format names, such as
  6662. "pix_fmts=yuv420p|monow|rgb24".
  6663. @end table
  6664. @subsection Examples
  6665. @itemize
  6666. @item
  6667. Convert the input video to the @var{yuv420p} format
  6668. @example
  6669. format=pix_fmts=yuv420p
  6670. @end example
  6671. Convert the input video to any of the formats in the list
  6672. @example
  6673. format=pix_fmts=yuv420p|yuv444p|yuv410p
  6674. @end example
  6675. @end itemize
  6676. @anchor{fps}
  6677. @section fps
  6678. Convert the video to specified constant frame rate by duplicating or dropping
  6679. frames as necessary.
  6680. It accepts the following parameters:
  6681. @table @option
  6682. @item fps
  6683. The desired output frame rate. The default is @code{25}.
  6684. @item start_time
  6685. Assume the first PTS should be the given value, in seconds. This allows for
  6686. padding/trimming at the start of stream. By default, no assumption is made
  6687. about the first frame's expected PTS, so no padding or trimming is done.
  6688. For example, this could be set to 0 to pad the beginning with duplicates of
  6689. the first frame if a video stream starts after the audio stream or to trim any
  6690. frames with a negative PTS.
  6691. @item round
  6692. Timestamp (PTS) rounding method.
  6693. Possible values are:
  6694. @table @option
  6695. @item zero
  6696. round towards 0
  6697. @item inf
  6698. round away from 0
  6699. @item down
  6700. round towards -infinity
  6701. @item up
  6702. round towards +infinity
  6703. @item near
  6704. round to nearest
  6705. @end table
  6706. The default is @code{near}.
  6707. @item eof_action
  6708. Action performed when reading the last frame.
  6709. Possible values are:
  6710. @table @option
  6711. @item round
  6712. Use same timestamp rounding method as used for other frames.
  6713. @item pass
  6714. Pass through last frame if input duration has not been reached yet.
  6715. @end table
  6716. The default is @code{round}.
  6717. @end table
  6718. Alternatively, the options can be specified as a flat string:
  6719. @var{fps}[:@var{start_time}[:@var{round}]].
  6720. See also the @ref{setpts} filter.
  6721. @subsection Examples
  6722. @itemize
  6723. @item
  6724. A typical usage in order to set the fps to 25:
  6725. @example
  6726. fps=fps=25
  6727. @end example
  6728. @item
  6729. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  6730. @example
  6731. fps=fps=film:round=near
  6732. @end example
  6733. @end itemize
  6734. @section framepack
  6735. Pack two different video streams into a stereoscopic video, setting proper
  6736. metadata on supported codecs. The two views should have the same size and
  6737. framerate and processing will stop when the shorter video ends. Please note
  6738. that you may conveniently adjust view properties with the @ref{scale} and
  6739. @ref{fps} filters.
  6740. It accepts the following parameters:
  6741. @table @option
  6742. @item format
  6743. The desired packing format. Supported values are:
  6744. @table @option
  6745. @item sbs
  6746. The views are next to each other (default).
  6747. @item tab
  6748. The views are on top of each other.
  6749. @item lines
  6750. The views are packed by line.
  6751. @item columns
  6752. The views are packed by column.
  6753. @item frameseq
  6754. The views are temporally interleaved.
  6755. @end table
  6756. @end table
  6757. Some examples:
  6758. @example
  6759. # Convert left and right views into a frame-sequential video
  6760. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  6761. # Convert views into a side-by-side video with the same output resolution as the input
  6762. 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
  6763. @end example
  6764. @section framerate
  6765. Change the frame rate by interpolating new video output frames from the source
  6766. frames.
  6767. This filter is not designed to function correctly with interlaced media. If
  6768. you wish to change the frame rate of interlaced media then you are required
  6769. to deinterlace before this filter and re-interlace after this filter.
  6770. A description of the accepted options follows.
  6771. @table @option
  6772. @item fps
  6773. Specify the output frames per second. This option can also be specified
  6774. as a value alone. The default is @code{50}.
  6775. @item interp_start
  6776. Specify the start of a range where the output frame will be created as a
  6777. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6778. the default is @code{15}.
  6779. @item interp_end
  6780. Specify the end of a range where the output frame will be created as a
  6781. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6782. the default is @code{240}.
  6783. @item scene
  6784. Specify the level at which a scene change is detected as a value between
  6785. 0 and 100 to indicate a new scene; a low value reflects a low
  6786. probability for the current frame to introduce a new scene, while a higher
  6787. value means the current frame is more likely to be one.
  6788. The default is @code{7}.
  6789. @item flags
  6790. Specify flags influencing the filter process.
  6791. Available value for @var{flags} is:
  6792. @table @option
  6793. @item scene_change_detect, scd
  6794. Enable scene change detection using the value of the option @var{scene}.
  6795. This flag is enabled by default.
  6796. @end table
  6797. @end table
  6798. @section framestep
  6799. Select one frame every N-th frame.
  6800. This filter accepts the following option:
  6801. @table @option
  6802. @item step
  6803. Select frame after every @code{step} frames.
  6804. Allowed values are positive integers higher than 0. Default value is @code{1}.
  6805. @end table
  6806. @anchor{frei0r}
  6807. @section frei0r
  6808. Apply a frei0r effect to the input video.
  6809. To enable the compilation of this filter, you need to install the frei0r
  6810. header and configure FFmpeg with @code{--enable-frei0r}.
  6811. It accepts the following parameters:
  6812. @table @option
  6813. @item filter_name
  6814. The name of the frei0r effect to load. If the environment variable
  6815. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  6816. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  6817. Otherwise, the standard frei0r paths are searched, in this order:
  6818. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  6819. @file{/usr/lib/frei0r-1/}.
  6820. @item filter_params
  6821. A '|'-separated list of parameters to pass to the frei0r effect.
  6822. @end table
  6823. A frei0r effect parameter can be a boolean (its value is either
  6824. "y" or "n"), a double, a color (specified as
  6825. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  6826. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  6827. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  6828. @var{X} and @var{Y} are floating point numbers) and/or a string.
  6829. The number and types of parameters depend on the loaded effect. If an
  6830. effect parameter is not specified, the default value is set.
  6831. @subsection Examples
  6832. @itemize
  6833. @item
  6834. Apply the distort0r effect, setting the first two double parameters:
  6835. @example
  6836. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  6837. @end example
  6838. @item
  6839. Apply the colordistance effect, taking a color as the first parameter:
  6840. @example
  6841. frei0r=colordistance:0.2/0.3/0.4
  6842. frei0r=colordistance:violet
  6843. frei0r=colordistance:0x112233
  6844. @end example
  6845. @item
  6846. Apply the perspective effect, specifying the top left and top right image
  6847. positions:
  6848. @example
  6849. frei0r=perspective:0.2/0.2|0.8/0.2
  6850. @end example
  6851. @end itemize
  6852. For more information, see
  6853. @url{http://frei0r.dyne.org}
  6854. @section fspp
  6855. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  6856. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  6857. processing filter, one of them is performed once per block, not per pixel.
  6858. This allows for much higher speed.
  6859. The filter accepts the following options:
  6860. @table @option
  6861. @item quality
  6862. Set quality. This option defines the number of levels for averaging. It accepts
  6863. an integer in the range 4-5. Default value is @code{4}.
  6864. @item qp
  6865. Force a constant quantization parameter. It accepts an integer in range 0-63.
  6866. If not set, the filter will use the QP from the video stream (if available).
  6867. @item strength
  6868. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  6869. more details but also more artifacts, while higher values make the image smoother
  6870. but also blurrier. Default value is @code{0} − PSNR optimal.
  6871. @item use_bframe_qp
  6872. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  6873. option may cause flicker since the B-Frames have often larger QP. Default is
  6874. @code{0} (not enabled).
  6875. @end table
  6876. @section gblur
  6877. Apply Gaussian blur filter.
  6878. The filter accepts the following options:
  6879. @table @option
  6880. @item sigma
  6881. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  6882. @item steps
  6883. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  6884. @item planes
  6885. Set which planes to filter. By default all planes are filtered.
  6886. @item sigmaV
  6887. Set vertical sigma, if negative it will be same as @code{sigma}.
  6888. Default is @code{-1}.
  6889. @end table
  6890. @section geq
  6891. The filter accepts the following options:
  6892. @table @option
  6893. @item lum_expr, lum
  6894. Set the luminance expression.
  6895. @item cb_expr, cb
  6896. Set the chrominance blue expression.
  6897. @item cr_expr, cr
  6898. Set the chrominance red expression.
  6899. @item alpha_expr, a
  6900. Set the alpha expression.
  6901. @item red_expr, r
  6902. Set the red expression.
  6903. @item green_expr, g
  6904. Set the green expression.
  6905. @item blue_expr, b
  6906. Set the blue expression.
  6907. @end table
  6908. The colorspace is selected according to the specified options. If one
  6909. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  6910. options is specified, the filter will automatically select a YCbCr
  6911. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  6912. @option{blue_expr} options is specified, it will select an RGB
  6913. colorspace.
  6914. If one of the chrominance expression is not defined, it falls back on the other
  6915. one. If no alpha expression is specified it will evaluate to opaque value.
  6916. If none of chrominance expressions are specified, they will evaluate
  6917. to the luminance expression.
  6918. The expressions can use the following variables and functions:
  6919. @table @option
  6920. @item N
  6921. The sequential number of the filtered frame, starting from @code{0}.
  6922. @item X
  6923. @item Y
  6924. The coordinates of the current sample.
  6925. @item W
  6926. @item H
  6927. The width and height of the image.
  6928. @item SW
  6929. @item SH
  6930. Width and height scale depending on the currently filtered plane. It is the
  6931. ratio between the corresponding luma plane number of pixels and the current
  6932. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  6933. @code{0.5,0.5} for chroma planes.
  6934. @item T
  6935. Time of the current frame, expressed in seconds.
  6936. @item p(x, y)
  6937. Return the value of the pixel at location (@var{x},@var{y}) of the current
  6938. plane.
  6939. @item lum(x, y)
  6940. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  6941. plane.
  6942. @item cb(x, y)
  6943. Return the value of the pixel at location (@var{x},@var{y}) of the
  6944. blue-difference chroma plane. Return 0 if there is no such plane.
  6945. @item cr(x, y)
  6946. Return the value of the pixel at location (@var{x},@var{y}) of the
  6947. red-difference chroma plane. Return 0 if there is no such plane.
  6948. @item r(x, y)
  6949. @item g(x, y)
  6950. @item b(x, y)
  6951. Return the value of the pixel at location (@var{x},@var{y}) of the
  6952. red/green/blue component. Return 0 if there is no such component.
  6953. @item alpha(x, y)
  6954. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  6955. plane. Return 0 if there is no such plane.
  6956. @end table
  6957. For functions, if @var{x} and @var{y} are outside the area, the value will be
  6958. automatically clipped to the closer edge.
  6959. @subsection Examples
  6960. @itemize
  6961. @item
  6962. Flip the image horizontally:
  6963. @example
  6964. geq=p(W-X\,Y)
  6965. @end example
  6966. @item
  6967. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  6968. wavelength of 100 pixels:
  6969. @example
  6970. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  6971. @end example
  6972. @item
  6973. Generate a fancy enigmatic moving light:
  6974. @example
  6975. 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
  6976. @end example
  6977. @item
  6978. Generate a quick emboss effect:
  6979. @example
  6980. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  6981. @end example
  6982. @item
  6983. Modify RGB components depending on pixel position:
  6984. @example
  6985. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  6986. @end example
  6987. @item
  6988. Create a radial gradient that is the same size as the input (also see
  6989. the @ref{vignette} filter):
  6990. @example
  6991. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  6992. @end example
  6993. @end itemize
  6994. @section gradfun
  6995. Fix the banding artifacts that are sometimes introduced into nearly flat
  6996. regions by truncation to 8-bit color depth.
  6997. Interpolate the gradients that should go where the bands are, and
  6998. dither them.
  6999. It is designed for playback only. Do not use it prior to
  7000. lossy compression, because compression tends to lose the dither and
  7001. bring back the bands.
  7002. It accepts the following parameters:
  7003. @table @option
  7004. @item strength
  7005. The maximum amount by which the filter will change any one pixel. This is also
  7006. the threshold for detecting nearly flat regions. Acceptable values range from
  7007. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  7008. valid range.
  7009. @item radius
  7010. The neighborhood to fit the gradient to. A larger radius makes for smoother
  7011. gradients, but also prevents the filter from modifying the pixels near detailed
  7012. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  7013. values will be clipped to the valid range.
  7014. @end table
  7015. Alternatively, the options can be specified as a flat string:
  7016. @var{strength}[:@var{radius}]
  7017. @subsection Examples
  7018. @itemize
  7019. @item
  7020. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  7021. @example
  7022. gradfun=3.5:8
  7023. @end example
  7024. @item
  7025. Specify radius, omitting the strength (which will fall-back to the default
  7026. value):
  7027. @example
  7028. gradfun=radius=8
  7029. @end example
  7030. @end itemize
  7031. @anchor{haldclut}
  7032. @section haldclut
  7033. Apply a Hald CLUT to a video stream.
  7034. First input is the video stream to process, and second one is the Hald CLUT.
  7035. The Hald CLUT input can be a simple picture or a complete video stream.
  7036. The filter accepts the following options:
  7037. @table @option
  7038. @item shortest
  7039. Force termination when the shortest input terminates. Default is @code{0}.
  7040. @item repeatlast
  7041. Continue applying the last CLUT after the end of the stream. A value of
  7042. @code{0} disable the filter after the last frame of the CLUT is reached.
  7043. Default is @code{1}.
  7044. @end table
  7045. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  7046. filters share the same internals).
  7047. More information about the Hald CLUT can be found on Eskil Steenberg's website
  7048. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  7049. @subsection Workflow examples
  7050. @subsubsection Hald CLUT video stream
  7051. Generate an identity Hald CLUT stream altered with various effects:
  7052. @example
  7053. 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
  7054. @end example
  7055. Note: make sure you use a lossless codec.
  7056. Then use it with @code{haldclut} to apply it on some random stream:
  7057. @example
  7058. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  7059. @end example
  7060. The Hald CLUT will be applied to the 10 first seconds (duration of
  7061. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  7062. to the remaining frames of the @code{mandelbrot} stream.
  7063. @subsubsection Hald CLUT with preview
  7064. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  7065. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  7066. biggest possible square starting at the top left of the picture. The remaining
  7067. padding pixels (bottom or right) will be ignored. This area can be used to add
  7068. a preview of the Hald CLUT.
  7069. Typically, the following generated Hald CLUT will be supported by the
  7070. @code{haldclut} filter:
  7071. @example
  7072. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  7073. pad=iw+320 [padded_clut];
  7074. smptebars=s=320x256, split [a][b];
  7075. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  7076. [main][b] overlay=W-320" -frames:v 1 clut.png
  7077. @end example
  7078. It contains the original and a preview of the effect of the CLUT: SMPTE color
  7079. bars are displayed on the right-top, and below the same color bars processed by
  7080. the color changes.
  7081. Then, the effect of this Hald CLUT can be visualized with:
  7082. @example
  7083. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  7084. @end example
  7085. @section hflip
  7086. Flip the input video horizontally.
  7087. For example, to horizontally flip the input video with @command{ffmpeg}:
  7088. @example
  7089. ffmpeg -i in.avi -vf "hflip" out.avi
  7090. @end example
  7091. @section histeq
  7092. This filter applies a global color histogram equalization on a
  7093. per-frame basis.
  7094. It can be used to correct video that has a compressed range of pixel
  7095. intensities. The filter redistributes the pixel intensities to
  7096. equalize their distribution across the intensity range. It may be
  7097. viewed as an "automatically adjusting contrast filter". This filter is
  7098. useful only for correcting degraded or poorly captured source
  7099. video.
  7100. The filter accepts the following options:
  7101. @table @option
  7102. @item strength
  7103. Determine the amount of equalization to be applied. As the strength
  7104. is reduced, the distribution of pixel intensities more-and-more
  7105. approaches that of the input frame. The value must be a float number
  7106. in the range [0,1] and defaults to 0.200.
  7107. @item intensity
  7108. Set the maximum intensity that can generated and scale the output
  7109. values appropriately. The strength should be set as desired and then
  7110. the intensity can be limited if needed to avoid washing-out. The value
  7111. must be a float number in the range [0,1] and defaults to 0.210.
  7112. @item antibanding
  7113. Set the antibanding level. If enabled the filter will randomly vary
  7114. the luminance of output pixels by a small amount to avoid banding of
  7115. the histogram. Possible values are @code{none}, @code{weak} or
  7116. @code{strong}. It defaults to @code{none}.
  7117. @end table
  7118. @section histogram
  7119. Compute and draw a color distribution histogram for the input video.
  7120. The computed histogram is a representation of the color component
  7121. distribution in an image.
  7122. Standard histogram displays the color components distribution in an image.
  7123. Displays color graph for each color component. Shows distribution of
  7124. the Y, U, V, A or R, G, B components, depending on input format, in the
  7125. current frame. Below each graph a color component scale meter is shown.
  7126. The filter accepts the following options:
  7127. @table @option
  7128. @item level_height
  7129. Set height of level. Default value is @code{200}.
  7130. Allowed range is [50, 2048].
  7131. @item scale_height
  7132. Set height of color scale. Default value is @code{12}.
  7133. Allowed range is [0, 40].
  7134. @item display_mode
  7135. Set display mode.
  7136. It accepts the following values:
  7137. @table @samp
  7138. @item stack
  7139. Per color component graphs are placed below each other.
  7140. @item parade
  7141. Per color component graphs are placed side by side.
  7142. @item overlay
  7143. Presents information identical to that in the @code{parade}, except
  7144. that the graphs representing color components are superimposed directly
  7145. over one another.
  7146. @end table
  7147. Default is @code{stack}.
  7148. @item levels_mode
  7149. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  7150. Default is @code{linear}.
  7151. @item components
  7152. Set what color components to display.
  7153. Default is @code{7}.
  7154. @item fgopacity
  7155. Set foreground opacity. Default is @code{0.7}.
  7156. @item bgopacity
  7157. Set background opacity. Default is @code{0.5}.
  7158. @end table
  7159. @subsection Examples
  7160. @itemize
  7161. @item
  7162. Calculate and draw histogram:
  7163. @example
  7164. ffplay -i input -vf histogram
  7165. @end example
  7166. @end itemize
  7167. @anchor{hqdn3d}
  7168. @section hqdn3d
  7169. This is a high precision/quality 3d denoise filter. It aims to reduce
  7170. image noise, producing smooth images and making still images really
  7171. still. It should enhance compressibility.
  7172. It accepts the following optional parameters:
  7173. @table @option
  7174. @item luma_spatial
  7175. A non-negative floating point number which specifies spatial luma strength.
  7176. It defaults to 4.0.
  7177. @item chroma_spatial
  7178. A non-negative floating point number which specifies spatial chroma strength.
  7179. It defaults to 3.0*@var{luma_spatial}/4.0.
  7180. @item luma_tmp
  7181. A floating point number which specifies luma temporal strength. It defaults to
  7182. 6.0*@var{luma_spatial}/4.0.
  7183. @item chroma_tmp
  7184. A floating point number which specifies chroma temporal strength. It defaults to
  7185. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  7186. @end table
  7187. @section hwdownload
  7188. Download hardware frames to system memory.
  7189. The input must be in hardware frames, and the output a non-hardware format.
  7190. Not all formats will be supported on the output - it may be necessary to insert
  7191. an additional @option{format} filter immediately following in the graph to get
  7192. the output in a supported format.
  7193. @section hwmap
  7194. Map hardware frames to system memory or to another device.
  7195. This filter has several different modes of operation; which one is used depends
  7196. on the input and output formats:
  7197. @itemize
  7198. @item
  7199. Hardware frame input, normal frame output
  7200. Map the input frames to system memory and pass them to the output. If the
  7201. original hardware frame is later required (for example, after overlaying
  7202. something else on part of it), the @option{hwmap} filter can be used again
  7203. in the next mode to retrieve it.
  7204. @item
  7205. Normal frame input, hardware frame output
  7206. If the input is actually a software-mapped hardware frame, then unmap it -
  7207. that is, return the original hardware frame.
  7208. Otherwise, a device must be provided. Create new hardware surfaces on that
  7209. device for the output, then map them back to the software format at the input
  7210. and give those frames to the preceding filter. This will then act like the
  7211. @option{hwupload} filter, but may be able to avoid an additional copy when
  7212. the input is already in a compatible format.
  7213. @item
  7214. Hardware frame input and output
  7215. A device must be supplied for the output, either directly or with the
  7216. @option{derive_device} option. The input and output devices must be of
  7217. different types and compatible - the exact meaning of this is
  7218. system-dependent, but typically it means that they must refer to the same
  7219. underlying hardware context (for example, refer to the same graphics card).
  7220. If the input frames were originally created on the output device, then unmap
  7221. to retrieve the original frames.
  7222. Otherwise, map the frames to the output device - create new hardware frames
  7223. on the output corresponding to the frames on the input.
  7224. @end itemize
  7225. The following additional parameters are accepted:
  7226. @table @option
  7227. @item mode
  7228. Set the frame mapping mode. Some combination of:
  7229. @table @var
  7230. @item read
  7231. The mapped frame should be readable.
  7232. @item write
  7233. The mapped frame should be writeable.
  7234. @item overwrite
  7235. The mapping will always overwrite the entire frame.
  7236. This may improve performance in some cases, as the original contents of the
  7237. frame need not be loaded.
  7238. @item direct
  7239. The mapping must not involve any copying.
  7240. Indirect mappings to copies of frames are created in some cases where either
  7241. direct mapping is not possible or it would have unexpected properties.
  7242. Setting this flag ensures that the mapping is direct and will fail if that is
  7243. not possible.
  7244. @end table
  7245. Defaults to @var{read+write} if not specified.
  7246. @item derive_device @var{type}
  7247. Rather than using the device supplied at initialisation, instead derive a new
  7248. device of type @var{type} from the device the input frames exist on.
  7249. @item reverse
  7250. In a hardware to hardware mapping, map in reverse - create frames in the sink
  7251. and map them back to the source. This may be necessary in some cases where
  7252. a mapping in one direction is required but only the opposite direction is
  7253. supported by the devices being used.
  7254. This option is dangerous - it may break the preceding filter in undefined
  7255. ways if there are any additional constraints on that filter's output.
  7256. Do not use it without fully understanding the implications of its use.
  7257. @end table
  7258. @section hwupload
  7259. Upload system memory frames to hardware surfaces.
  7260. The device to upload to must be supplied when the filter is initialised. If
  7261. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  7262. option.
  7263. @anchor{hwupload_cuda}
  7264. @section hwupload_cuda
  7265. Upload system memory frames to a CUDA device.
  7266. It accepts the following optional parameters:
  7267. @table @option
  7268. @item device
  7269. The number of the CUDA device to use
  7270. @end table
  7271. @section hqx
  7272. Apply a high-quality magnification filter designed for pixel art. This filter
  7273. was originally created by Maxim Stepin.
  7274. It accepts the following option:
  7275. @table @option
  7276. @item n
  7277. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  7278. @code{hq3x} and @code{4} for @code{hq4x}.
  7279. Default is @code{3}.
  7280. @end table
  7281. @section hstack
  7282. Stack input videos horizontally.
  7283. All streams must be of same pixel format and of same height.
  7284. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  7285. to create same output.
  7286. The filter accept the following option:
  7287. @table @option
  7288. @item inputs
  7289. Set number of input streams. Default is 2.
  7290. @item shortest
  7291. If set to 1, force the output to terminate when the shortest input
  7292. terminates. Default value is 0.
  7293. @end table
  7294. @section hue
  7295. Modify the hue and/or the saturation of the input.
  7296. It accepts the following parameters:
  7297. @table @option
  7298. @item h
  7299. Specify the hue angle as a number of degrees. It accepts an expression,
  7300. and defaults to "0".
  7301. @item s
  7302. Specify the saturation in the [-10,10] range. It accepts an expression and
  7303. defaults to "1".
  7304. @item H
  7305. Specify the hue angle as a number of radians. It accepts an
  7306. expression, and defaults to "0".
  7307. @item b
  7308. Specify the brightness in the [-10,10] range. It accepts an expression and
  7309. defaults to "0".
  7310. @end table
  7311. @option{h} and @option{H} are mutually exclusive, and can't be
  7312. specified at the same time.
  7313. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  7314. expressions containing the following constants:
  7315. @table @option
  7316. @item n
  7317. frame count of the input frame starting from 0
  7318. @item pts
  7319. presentation timestamp of the input frame expressed in time base units
  7320. @item r
  7321. frame rate of the input video, NAN if the input frame rate is unknown
  7322. @item t
  7323. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7324. @item tb
  7325. time base of the input video
  7326. @end table
  7327. @subsection Examples
  7328. @itemize
  7329. @item
  7330. Set the hue to 90 degrees and the saturation to 1.0:
  7331. @example
  7332. hue=h=90:s=1
  7333. @end example
  7334. @item
  7335. Same command but expressing the hue in radians:
  7336. @example
  7337. hue=H=PI/2:s=1
  7338. @end example
  7339. @item
  7340. Rotate hue and make the saturation swing between 0
  7341. and 2 over a period of 1 second:
  7342. @example
  7343. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  7344. @end example
  7345. @item
  7346. Apply a 3 seconds saturation fade-in effect starting at 0:
  7347. @example
  7348. hue="s=min(t/3\,1)"
  7349. @end example
  7350. The general fade-in expression can be written as:
  7351. @example
  7352. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  7353. @end example
  7354. @item
  7355. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  7356. @example
  7357. hue="s=max(0\, min(1\, (8-t)/3))"
  7358. @end example
  7359. The general fade-out expression can be written as:
  7360. @example
  7361. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  7362. @end example
  7363. @end itemize
  7364. @subsection Commands
  7365. This filter supports the following commands:
  7366. @table @option
  7367. @item b
  7368. @item s
  7369. @item h
  7370. @item H
  7371. Modify the hue and/or the saturation and/or brightness of the input video.
  7372. The command accepts the same syntax of the corresponding option.
  7373. If the specified expression is not valid, it is kept at its current
  7374. value.
  7375. @end table
  7376. @section hysteresis
  7377. Grow first stream into second stream by connecting components.
  7378. This makes it possible to build more robust edge masks.
  7379. This filter accepts the following options:
  7380. @table @option
  7381. @item planes
  7382. Set which planes will be processed as bitmap, unprocessed planes will be
  7383. copied from first stream.
  7384. By default value 0xf, all planes will be processed.
  7385. @item threshold
  7386. Set threshold which is used in filtering. If pixel component value is higher than
  7387. this value filter algorithm for connecting components is activated.
  7388. By default value is 0.
  7389. @end table
  7390. @section idet
  7391. Detect video interlacing type.
  7392. This filter tries to detect if the input frames are interlaced, progressive,
  7393. top or bottom field first. It will also try to detect fields that are
  7394. repeated between adjacent frames (a sign of telecine).
  7395. Single frame detection considers only immediately adjacent frames when classifying each frame.
  7396. Multiple frame detection incorporates the classification history of previous frames.
  7397. The filter will log these metadata values:
  7398. @table @option
  7399. @item single.current_frame
  7400. Detected type of current frame using single-frame detection. One of:
  7401. ``tff'' (top field first), ``bff'' (bottom field first),
  7402. ``progressive'', or ``undetermined''
  7403. @item single.tff
  7404. Cumulative number of frames detected as top field first using single-frame detection.
  7405. @item multiple.tff
  7406. Cumulative number of frames detected as top field first using multiple-frame detection.
  7407. @item single.bff
  7408. Cumulative number of frames detected as bottom field first using single-frame detection.
  7409. @item multiple.current_frame
  7410. Detected type of current frame using multiple-frame detection. One of:
  7411. ``tff'' (top field first), ``bff'' (bottom field first),
  7412. ``progressive'', or ``undetermined''
  7413. @item multiple.bff
  7414. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  7415. @item single.progressive
  7416. Cumulative number of frames detected as progressive using single-frame detection.
  7417. @item multiple.progressive
  7418. Cumulative number of frames detected as progressive using multiple-frame detection.
  7419. @item single.undetermined
  7420. Cumulative number of frames that could not be classified using single-frame detection.
  7421. @item multiple.undetermined
  7422. Cumulative number of frames that could not be classified using multiple-frame detection.
  7423. @item repeated.current_frame
  7424. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  7425. @item repeated.neither
  7426. Cumulative number of frames with no repeated field.
  7427. @item repeated.top
  7428. Cumulative number of frames with the top field repeated from the previous frame's top field.
  7429. @item repeated.bottom
  7430. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  7431. @end table
  7432. The filter accepts the following options:
  7433. @table @option
  7434. @item intl_thres
  7435. Set interlacing threshold.
  7436. @item prog_thres
  7437. Set progressive threshold.
  7438. @item rep_thres
  7439. Threshold for repeated field detection.
  7440. @item half_life
  7441. Number of frames after which a given frame's contribution to the
  7442. statistics is halved (i.e., it contributes only 0.5 to its
  7443. classification). The default of 0 means that all frames seen are given
  7444. full weight of 1.0 forever.
  7445. @item analyze_interlaced_flag
  7446. When this is not 0 then idet will use the specified number of frames to determine
  7447. if the interlaced flag is accurate, it will not count undetermined frames.
  7448. If the flag is found to be accurate it will be used without any further
  7449. computations, if it is found to be inaccurate it will be cleared without any
  7450. further computations. This allows inserting the idet filter as a low computational
  7451. method to clean up the interlaced flag
  7452. @end table
  7453. @section il
  7454. Deinterleave or interleave fields.
  7455. This filter allows one to process interlaced images fields without
  7456. deinterlacing them. Deinterleaving splits the input frame into 2
  7457. fields (so called half pictures). Odd lines are moved to the top
  7458. half of the output image, even lines to the bottom half.
  7459. You can process (filter) them independently and then re-interleave them.
  7460. The filter accepts the following options:
  7461. @table @option
  7462. @item luma_mode, l
  7463. @item chroma_mode, c
  7464. @item alpha_mode, a
  7465. Available values for @var{luma_mode}, @var{chroma_mode} and
  7466. @var{alpha_mode} are:
  7467. @table @samp
  7468. @item none
  7469. Do nothing.
  7470. @item deinterleave, d
  7471. Deinterleave fields, placing one above the other.
  7472. @item interleave, i
  7473. Interleave fields. Reverse the effect of deinterleaving.
  7474. @end table
  7475. Default value is @code{none}.
  7476. @item luma_swap, ls
  7477. @item chroma_swap, cs
  7478. @item alpha_swap, as
  7479. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  7480. @end table
  7481. @section inflate
  7482. Apply inflate effect to the video.
  7483. This filter replaces the pixel by the local(3x3) average by taking into account
  7484. only values higher than the pixel.
  7485. It accepts the following options:
  7486. @table @option
  7487. @item threshold0
  7488. @item threshold1
  7489. @item threshold2
  7490. @item threshold3
  7491. Limit the maximum change for each plane, default is 65535.
  7492. If 0, plane will remain unchanged.
  7493. @end table
  7494. @section interlace
  7495. Simple interlacing filter from progressive contents. This interleaves upper (or
  7496. lower) lines from odd frames with lower (or upper) lines from even frames,
  7497. halving the frame rate and preserving image height.
  7498. @example
  7499. Original Original New Frame
  7500. Frame 'j' Frame 'j+1' (tff)
  7501. ========== =========== ==================
  7502. Line 0 --------------------> Frame 'j' Line 0
  7503. Line 1 Line 1 ----> Frame 'j+1' Line 1
  7504. Line 2 ---------------------> Frame 'j' Line 2
  7505. Line 3 Line 3 ----> Frame 'j+1' Line 3
  7506. ... ... ...
  7507. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  7508. @end example
  7509. It accepts the following optional parameters:
  7510. @table @option
  7511. @item scan
  7512. This determines whether the interlaced frame is taken from the even
  7513. (tff - default) or odd (bff) lines of the progressive frame.
  7514. @item lowpass
  7515. Vertical lowpass filter to avoid twitter interlacing and
  7516. reduce moire patterns.
  7517. @table @samp
  7518. @item 0, off
  7519. Disable vertical lowpass filter
  7520. @item 1, linear
  7521. Enable linear filter (default)
  7522. @item 2, complex
  7523. Enable complex filter. This will slightly less reduce twitter and moire
  7524. but better retain detail and subjective sharpness impression.
  7525. @end table
  7526. @end table
  7527. @section kerndeint
  7528. Deinterlace input video by applying Donald Graft's adaptive kernel
  7529. deinterling. Work on interlaced parts of a video to produce
  7530. progressive frames.
  7531. The description of the accepted parameters follows.
  7532. @table @option
  7533. @item thresh
  7534. Set the threshold which affects the filter's tolerance when
  7535. determining if a pixel line must be processed. It must be an integer
  7536. in the range [0,255] and defaults to 10. A value of 0 will result in
  7537. applying the process on every pixels.
  7538. @item map
  7539. Paint pixels exceeding the threshold value to white if set to 1.
  7540. Default is 0.
  7541. @item order
  7542. Set the fields order. Swap fields if set to 1, leave fields alone if
  7543. 0. Default is 0.
  7544. @item sharp
  7545. Enable additional sharpening if set to 1. Default is 0.
  7546. @item twoway
  7547. Enable twoway sharpening if set to 1. Default is 0.
  7548. @end table
  7549. @subsection Examples
  7550. @itemize
  7551. @item
  7552. Apply default values:
  7553. @example
  7554. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  7555. @end example
  7556. @item
  7557. Enable additional sharpening:
  7558. @example
  7559. kerndeint=sharp=1
  7560. @end example
  7561. @item
  7562. Paint processed pixels in white:
  7563. @example
  7564. kerndeint=map=1
  7565. @end example
  7566. @end itemize
  7567. @section lenscorrection
  7568. Correct radial lens distortion
  7569. This filter can be used to correct for radial distortion as can result from the use
  7570. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  7571. one can use tools available for example as part of opencv or simply trial-and-error.
  7572. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  7573. and extract the k1 and k2 coefficients from the resulting matrix.
  7574. Note that effectively the same filter is available in the open-source tools Krita and
  7575. Digikam from the KDE project.
  7576. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  7577. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  7578. brightness distribution, so you may want to use both filters together in certain
  7579. cases, though you will have to take care of ordering, i.e. whether vignetting should
  7580. be applied before or after lens correction.
  7581. @subsection Options
  7582. The filter accepts the following options:
  7583. @table @option
  7584. @item cx
  7585. Relative x-coordinate of the focal point of the image, and thereby the center of the
  7586. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7587. width.
  7588. @item cy
  7589. Relative y-coordinate of the focal point of the image, and thereby the center of the
  7590. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7591. height.
  7592. @item k1
  7593. Coefficient of the quadratic correction term. 0.5 means no correction.
  7594. @item k2
  7595. Coefficient of the double quadratic correction term. 0.5 means no correction.
  7596. @end table
  7597. The formula that generates the correction is:
  7598. @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)
  7599. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  7600. distances from the focal point in the source and target images, respectively.
  7601. @section libvmaf
  7602. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  7603. score between two input videos.
  7604. The obtained VMAF score is printed through the logging system.
  7605. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  7606. After installing the library it can be enabled using:
  7607. @code{./configure --enable-libvmaf}.
  7608. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  7609. The filter has following options:
  7610. @table @option
  7611. @item model_path
  7612. Set the model path which is to be used for SVM.
  7613. Default value: @code{"vmaf_v0.6.1.pkl"}
  7614. @item log_path
  7615. Set the file path to be used to store logs.
  7616. @item log_fmt
  7617. Set the format of the log file (xml or json).
  7618. @item enable_transform
  7619. Enables transform for computing vmaf.
  7620. @item phone_model
  7621. Invokes the phone model which will generate VMAF scores higher than in the
  7622. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  7623. @item psnr
  7624. Enables computing psnr along with vmaf.
  7625. @item ssim
  7626. Enables computing ssim along with vmaf.
  7627. @item ms_ssim
  7628. Enables computing ms_ssim along with vmaf.
  7629. @item pool
  7630. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  7631. @end table
  7632. This filter also supports the @ref{framesync} options.
  7633. On the below examples the input file @file{main.mpg} being processed is
  7634. compared with the reference file @file{ref.mpg}.
  7635. @example
  7636. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  7637. @end example
  7638. Example with options:
  7639. @example
  7640. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
  7641. @end example
  7642. @section limiter
  7643. Limits the pixel components values to the specified range [min, max].
  7644. The filter accepts the following options:
  7645. @table @option
  7646. @item min
  7647. Lower bound. Defaults to the lowest allowed value for the input.
  7648. @item max
  7649. Upper bound. Defaults to the highest allowed value for the input.
  7650. @item planes
  7651. Specify which planes will be processed. Defaults to all available.
  7652. @end table
  7653. @section loop
  7654. Loop video frames.
  7655. The filter accepts the following options:
  7656. @table @option
  7657. @item loop
  7658. Set the number of loops.
  7659. @item size
  7660. Set maximal size in number of frames.
  7661. @item start
  7662. Set first frame of loop.
  7663. @end table
  7664. @anchor{lut3d}
  7665. @section lut3d
  7666. Apply a 3D LUT to an input video.
  7667. The filter accepts the following options:
  7668. @table @option
  7669. @item file
  7670. Set the 3D LUT file name.
  7671. Currently supported formats:
  7672. @table @samp
  7673. @item 3dl
  7674. AfterEffects
  7675. @item cube
  7676. Iridas
  7677. @item dat
  7678. DaVinci
  7679. @item m3d
  7680. Pandora
  7681. @end table
  7682. @item interp
  7683. Select interpolation mode.
  7684. Available values are:
  7685. @table @samp
  7686. @item nearest
  7687. Use values from the nearest defined point.
  7688. @item trilinear
  7689. Interpolate values using the 8 points defining a cube.
  7690. @item tetrahedral
  7691. Interpolate values using a tetrahedron.
  7692. @end table
  7693. @end table
  7694. This filter also supports the @ref{framesync} options.
  7695. @section lumakey
  7696. Turn certain luma values into transparency.
  7697. The filter accepts the following options:
  7698. @table @option
  7699. @item threshold
  7700. Set the luma which will be used as base for transparency.
  7701. Default value is @code{0}.
  7702. @item tolerance
  7703. Set the range of luma values to be keyed out.
  7704. Default value is @code{0}.
  7705. @item softness
  7706. Set the range of softness. Default value is @code{0}.
  7707. Use this to control gradual transition from zero to full transparency.
  7708. @end table
  7709. @section lut, lutrgb, lutyuv
  7710. Compute a look-up table for binding each pixel component input value
  7711. to an output value, and apply it to the input video.
  7712. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  7713. to an RGB input video.
  7714. These filters accept the following parameters:
  7715. @table @option
  7716. @item c0
  7717. set first pixel component expression
  7718. @item c1
  7719. set second pixel component expression
  7720. @item c2
  7721. set third pixel component expression
  7722. @item c3
  7723. set fourth pixel component expression, corresponds to the alpha component
  7724. @item r
  7725. set red component expression
  7726. @item g
  7727. set green component expression
  7728. @item b
  7729. set blue component expression
  7730. @item a
  7731. alpha component expression
  7732. @item y
  7733. set Y/luminance component expression
  7734. @item u
  7735. set U/Cb component expression
  7736. @item v
  7737. set V/Cr component expression
  7738. @end table
  7739. Each of them specifies the expression to use for computing the lookup table for
  7740. the corresponding pixel component values.
  7741. The exact component associated to each of the @var{c*} options depends on the
  7742. format in input.
  7743. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  7744. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  7745. The expressions can contain the following constants and functions:
  7746. @table @option
  7747. @item w
  7748. @item h
  7749. The input width and height.
  7750. @item val
  7751. The input value for the pixel component.
  7752. @item clipval
  7753. The input value, clipped to the @var{minval}-@var{maxval} range.
  7754. @item maxval
  7755. The maximum value for the pixel component.
  7756. @item minval
  7757. The minimum value for the pixel component.
  7758. @item negval
  7759. The negated value for the pixel component value, clipped to the
  7760. @var{minval}-@var{maxval} range; it corresponds to the expression
  7761. "maxval-clipval+minval".
  7762. @item clip(val)
  7763. The computed value in @var{val}, clipped to the
  7764. @var{minval}-@var{maxval} range.
  7765. @item gammaval(gamma)
  7766. The computed gamma correction value of the pixel component value,
  7767. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  7768. expression
  7769. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  7770. @end table
  7771. All expressions default to "val".
  7772. @subsection Examples
  7773. @itemize
  7774. @item
  7775. Negate input video:
  7776. @example
  7777. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  7778. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  7779. @end example
  7780. The above is the same as:
  7781. @example
  7782. lutrgb="r=negval:g=negval:b=negval"
  7783. lutyuv="y=negval:u=negval:v=negval"
  7784. @end example
  7785. @item
  7786. Negate luminance:
  7787. @example
  7788. lutyuv=y=negval
  7789. @end example
  7790. @item
  7791. Remove chroma components, turning the video into a graytone image:
  7792. @example
  7793. lutyuv="u=128:v=128"
  7794. @end example
  7795. @item
  7796. Apply a luma burning effect:
  7797. @example
  7798. lutyuv="y=2*val"
  7799. @end example
  7800. @item
  7801. Remove green and blue components:
  7802. @example
  7803. lutrgb="g=0:b=0"
  7804. @end example
  7805. @item
  7806. Set a constant alpha channel value on input:
  7807. @example
  7808. format=rgba,lutrgb=a="maxval-minval/2"
  7809. @end example
  7810. @item
  7811. Correct luminance gamma by a factor of 0.5:
  7812. @example
  7813. lutyuv=y=gammaval(0.5)
  7814. @end example
  7815. @item
  7816. Discard least significant bits of luma:
  7817. @example
  7818. lutyuv=y='bitand(val, 128+64+32)'
  7819. @end example
  7820. @item
  7821. Technicolor like effect:
  7822. @example
  7823. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  7824. @end example
  7825. @end itemize
  7826. @section lut2, tlut2
  7827. The @code{lut2} filter takes two input streams and outputs one
  7828. stream.
  7829. The @code{tlut2} (time lut2) filter takes two consecutive frames
  7830. from one single stream.
  7831. This filter accepts the following parameters:
  7832. @table @option
  7833. @item c0
  7834. set first pixel component expression
  7835. @item c1
  7836. set second pixel component expression
  7837. @item c2
  7838. set third pixel component expression
  7839. @item c3
  7840. set fourth pixel component expression, corresponds to the alpha component
  7841. @end table
  7842. Each of them specifies the expression to use for computing the lookup table for
  7843. the corresponding pixel component values.
  7844. The exact component associated to each of the @var{c*} options depends on the
  7845. format in inputs.
  7846. The expressions can contain the following constants:
  7847. @table @option
  7848. @item w
  7849. @item h
  7850. The input width and height.
  7851. @item x
  7852. The first input value for the pixel component.
  7853. @item y
  7854. The second input value for the pixel component.
  7855. @item bdx
  7856. The first input video bit depth.
  7857. @item bdy
  7858. The second input video bit depth.
  7859. @end table
  7860. All expressions default to "x".
  7861. @subsection Examples
  7862. @itemize
  7863. @item
  7864. Highlight differences between two RGB video streams:
  7865. @example
  7866. 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)'
  7867. @end example
  7868. @item
  7869. Highlight differences between two YUV video streams:
  7870. @example
  7871. 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)'
  7872. @end example
  7873. @item
  7874. Show max difference between two video streams:
  7875. @example
  7876. 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)))'
  7877. @end example
  7878. @end itemize
  7879. @section maskedclamp
  7880. Clamp the first input stream with the second input and third input stream.
  7881. Returns the value of first stream to be between second input
  7882. stream - @code{undershoot} and third input stream + @code{overshoot}.
  7883. This filter accepts the following options:
  7884. @table @option
  7885. @item undershoot
  7886. Default value is @code{0}.
  7887. @item overshoot
  7888. Default value is @code{0}.
  7889. @item planes
  7890. Set which planes will be processed as bitmap, unprocessed planes will be
  7891. copied from first stream.
  7892. By default value 0xf, all planes will be processed.
  7893. @end table
  7894. @section maskedmerge
  7895. Merge the first input stream with the second input stream using per pixel
  7896. weights in the third input stream.
  7897. A value of 0 in the third stream pixel component means that pixel component
  7898. from first stream is returned unchanged, while maximum value (eg. 255 for
  7899. 8-bit videos) means that pixel component from second stream is returned
  7900. unchanged. Intermediate values define the amount of merging between both
  7901. input stream's pixel components.
  7902. This filter accepts the following options:
  7903. @table @option
  7904. @item planes
  7905. Set which planes will be processed as bitmap, unprocessed planes will be
  7906. copied from first stream.
  7907. By default value 0xf, all planes will be processed.
  7908. @end table
  7909. @section mcdeint
  7910. Apply motion-compensation deinterlacing.
  7911. It needs one field per frame as input and must thus be used together
  7912. with yadif=1/3 or equivalent.
  7913. This filter accepts the following options:
  7914. @table @option
  7915. @item mode
  7916. Set the deinterlacing mode.
  7917. It accepts one of the following values:
  7918. @table @samp
  7919. @item fast
  7920. @item medium
  7921. @item slow
  7922. use iterative motion estimation
  7923. @item extra_slow
  7924. like @samp{slow}, but use multiple reference frames.
  7925. @end table
  7926. Default value is @samp{fast}.
  7927. @item parity
  7928. Set the picture field parity assumed for the input video. It must be
  7929. one of the following values:
  7930. @table @samp
  7931. @item 0, tff
  7932. assume top field first
  7933. @item 1, bff
  7934. assume bottom field first
  7935. @end table
  7936. Default value is @samp{bff}.
  7937. @item qp
  7938. Set per-block quantization parameter (QP) used by the internal
  7939. encoder.
  7940. Higher values should result in a smoother motion vector field but less
  7941. optimal individual vectors. Default value is 1.
  7942. @end table
  7943. @section mergeplanes
  7944. Merge color channel components from several video streams.
  7945. The filter accepts up to 4 input streams, and merge selected input
  7946. planes to the output video.
  7947. This filter accepts the following options:
  7948. @table @option
  7949. @item mapping
  7950. Set input to output plane mapping. Default is @code{0}.
  7951. The mappings is specified as a bitmap. It should be specified as a
  7952. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  7953. mapping for the first plane of the output stream. 'A' sets the number of
  7954. the input stream to use (from 0 to 3), and 'a' the plane number of the
  7955. corresponding input to use (from 0 to 3). The rest of the mappings is
  7956. similar, 'Bb' describes the mapping for the output stream second
  7957. plane, 'Cc' describes the mapping for the output stream third plane and
  7958. 'Dd' describes the mapping for the output stream fourth plane.
  7959. @item format
  7960. Set output pixel format. Default is @code{yuva444p}.
  7961. @end table
  7962. @subsection Examples
  7963. @itemize
  7964. @item
  7965. Merge three gray video streams of same width and height into single video stream:
  7966. @example
  7967. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  7968. @end example
  7969. @item
  7970. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  7971. @example
  7972. [a0][a1]mergeplanes=0x00010210:yuva444p
  7973. @end example
  7974. @item
  7975. Swap Y and A plane in yuva444p stream:
  7976. @example
  7977. format=yuva444p,mergeplanes=0x03010200:yuva444p
  7978. @end example
  7979. @item
  7980. Swap U and V plane in yuv420p stream:
  7981. @example
  7982. format=yuv420p,mergeplanes=0x000201:yuv420p
  7983. @end example
  7984. @item
  7985. Cast a rgb24 clip to yuv444p:
  7986. @example
  7987. format=rgb24,mergeplanes=0x000102:yuv444p
  7988. @end example
  7989. @end itemize
  7990. @section mestimate
  7991. Estimate and export motion vectors using block matching algorithms.
  7992. Motion vectors are stored in frame side data to be used by other filters.
  7993. This filter accepts the following options:
  7994. @table @option
  7995. @item method
  7996. Specify the motion estimation method. Accepts one of the following values:
  7997. @table @samp
  7998. @item esa
  7999. Exhaustive search algorithm.
  8000. @item tss
  8001. Three step search algorithm.
  8002. @item tdls
  8003. Two dimensional logarithmic search algorithm.
  8004. @item ntss
  8005. New three step search algorithm.
  8006. @item fss
  8007. Four step search algorithm.
  8008. @item ds
  8009. Diamond search algorithm.
  8010. @item hexbs
  8011. Hexagon-based search algorithm.
  8012. @item epzs
  8013. Enhanced predictive zonal search algorithm.
  8014. @item umh
  8015. Uneven multi-hexagon search algorithm.
  8016. @end table
  8017. Default value is @samp{esa}.
  8018. @item mb_size
  8019. Macroblock size. Default @code{16}.
  8020. @item search_param
  8021. Search parameter. Default @code{7}.
  8022. @end table
  8023. @section midequalizer
  8024. Apply Midway Image Equalization effect using two video streams.
  8025. Midway Image Equalization adjusts a pair of images to have the same
  8026. histogram, while maintaining their dynamics as much as possible. It's
  8027. useful for e.g. matching exposures from a pair of stereo cameras.
  8028. This filter has two inputs and one output, which must be of same pixel format, but
  8029. may be of different sizes. The output of filter is first input adjusted with
  8030. midway histogram of both inputs.
  8031. This filter accepts the following option:
  8032. @table @option
  8033. @item planes
  8034. Set which planes to process. Default is @code{15}, which is all available planes.
  8035. @end table
  8036. @section minterpolate
  8037. Convert the video to specified frame rate using motion interpolation.
  8038. This filter accepts the following options:
  8039. @table @option
  8040. @item fps
  8041. 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}.
  8042. @item mi_mode
  8043. Motion interpolation mode. Following values are accepted:
  8044. @table @samp
  8045. @item dup
  8046. Duplicate previous or next frame for interpolating new ones.
  8047. @item blend
  8048. Blend source frames. Interpolated frame is mean of previous and next frames.
  8049. @item mci
  8050. Motion compensated interpolation. Following options are effective when this mode is selected:
  8051. @table @samp
  8052. @item mc_mode
  8053. Motion compensation mode. Following values are accepted:
  8054. @table @samp
  8055. @item obmc
  8056. Overlapped block motion compensation.
  8057. @item aobmc
  8058. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  8059. @end table
  8060. Default mode is @samp{obmc}.
  8061. @item me_mode
  8062. Motion estimation mode. Following values are accepted:
  8063. @table @samp
  8064. @item bidir
  8065. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  8066. @item bilat
  8067. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  8068. @end table
  8069. Default mode is @samp{bilat}.
  8070. @item me
  8071. The algorithm to be used for motion estimation. Following values are accepted:
  8072. @table @samp
  8073. @item esa
  8074. Exhaustive search algorithm.
  8075. @item tss
  8076. Three step search algorithm.
  8077. @item tdls
  8078. Two dimensional logarithmic search algorithm.
  8079. @item ntss
  8080. New three step search algorithm.
  8081. @item fss
  8082. Four step search algorithm.
  8083. @item ds
  8084. Diamond search algorithm.
  8085. @item hexbs
  8086. Hexagon-based search algorithm.
  8087. @item epzs
  8088. Enhanced predictive zonal search algorithm.
  8089. @item umh
  8090. Uneven multi-hexagon search algorithm.
  8091. @end table
  8092. Default algorithm is @samp{epzs}.
  8093. @item mb_size
  8094. Macroblock size. Default @code{16}.
  8095. @item search_param
  8096. Motion estimation search parameter. Default @code{32}.
  8097. @item vsbmc
  8098. 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).
  8099. @end table
  8100. @end table
  8101. @item scd
  8102. 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:
  8103. @table @samp
  8104. @item none
  8105. Disable scene change detection.
  8106. @item fdiff
  8107. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  8108. @end table
  8109. Default method is @samp{fdiff}.
  8110. @item scd_threshold
  8111. Scene change detection threshold. Default is @code{5.0}.
  8112. @end table
  8113. @section mpdecimate
  8114. Drop frames that do not differ greatly from the previous frame in
  8115. order to reduce frame rate.
  8116. The main use of this filter is for very-low-bitrate encoding
  8117. (e.g. streaming over dialup modem), but it could in theory be used for
  8118. fixing movies that were inverse-telecined incorrectly.
  8119. A description of the accepted options follows.
  8120. @table @option
  8121. @item max
  8122. Set the maximum number of consecutive frames which can be dropped (if
  8123. positive), or the minimum interval between dropped frames (if
  8124. negative). If the value is 0, the frame is dropped disregarding the
  8125. number of previous sequentially dropped frames.
  8126. Default value is 0.
  8127. @item hi
  8128. @item lo
  8129. @item frac
  8130. Set the dropping threshold values.
  8131. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  8132. represent actual pixel value differences, so a threshold of 64
  8133. corresponds to 1 unit of difference for each pixel, or the same spread
  8134. out differently over the block.
  8135. A frame is a candidate for dropping if no 8x8 blocks differ by more
  8136. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  8137. meaning the whole image) differ by more than a threshold of @option{lo}.
  8138. Default value for @option{hi} is 64*12, default value for @option{lo} is
  8139. 64*5, and default value for @option{frac} is 0.33.
  8140. @end table
  8141. @section negate
  8142. Negate input video.
  8143. It accepts an integer in input; if non-zero it negates the
  8144. alpha component (if available). The default value in input is 0.
  8145. @section nlmeans
  8146. Denoise frames using Non-Local Means algorithm.
  8147. Each pixel is adjusted by looking for other pixels with similar contexts. This
  8148. context similarity is defined by comparing their surrounding patches of size
  8149. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  8150. around the pixel.
  8151. Note that the research area defines centers for patches, which means some
  8152. patches will be made of pixels outside that research area.
  8153. The filter accepts the following options.
  8154. @table @option
  8155. @item s
  8156. Set denoising strength.
  8157. @item p
  8158. Set patch size.
  8159. @item pc
  8160. Same as @option{p} but for chroma planes.
  8161. The default value is @var{0} and means automatic.
  8162. @item r
  8163. Set research size.
  8164. @item rc
  8165. Same as @option{r} but for chroma planes.
  8166. The default value is @var{0} and means automatic.
  8167. @end table
  8168. @section nnedi
  8169. Deinterlace video using neural network edge directed interpolation.
  8170. This filter accepts the following options:
  8171. @table @option
  8172. @item weights
  8173. Mandatory option, without binary file filter can not work.
  8174. Currently file can be found here:
  8175. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  8176. @item deint
  8177. Set which frames to deinterlace, by default it is @code{all}.
  8178. Can be @code{all} or @code{interlaced}.
  8179. @item field
  8180. Set mode of operation.
  8181. Can be one of the following:
  8182. @table @samp
  8183. @item af
  8184. Use frame flags, both fields.
  8185. @item a
  8186. Use frame flags, single field.
  8187. @item t
  8188. Use top field only.
  8189. @item b
  8190. Use bottom field only.
  8191. @item tf
  8192. Use both fields, top first.
  8193. @item bf
  8194. Use both fields, bottom first.
  8195. @end table
  8196. @item planes
  8197. Set which planes to process, by default filter process all frames.
  8198. @item nsize
  8199. Set size of local neighborhood around each pixel, used by the predictor neural
  8200. network.
  8201. Can be one of the following:
  8202. @table @samp
  8203. @item s8x6
  8204. @item s16x6
  8205. @item s32x6
  8206. @item s48x6
  8207. @item s8x4
  8208. @item s16x4
  8209. @item s32x4
  8210. @end table
  8211. @item nns
  8212. Set the number of neurons in predictor neural network.
  8213. Can be one of the following:
  8214. @table @samp
  8215. @item n16
  8216. @item n32
  8217. @item n64
  8218. @item n128
  8219. @item n256
  8220. @end table
  8221. @item qual
  8222. Controls the number of different neural network predictions that are blended
  8223. together to compute the final output value. Can be @code{fast}, default or
  8224. @code{slow}.
  8225. @item etype
  8226. Set which set of weights to use in the predictor.
  8227. Can be one of the following:
  8228. @table @samp
  8229. @item a
  8230. weights trained to minimize absolute error
  8231. @item s
  8232. weights trained to minimize squared error
  8233. @end table
  8234. @item pscrn
  8235. Controls whether or not the prescreener neural network is used to decide
  8236. which pixels should be processed by the predictor neural network and which
  8237. can be handled by simple cubic interpolation.
  8238. The prescreener is trained to know whether cubic interpolation will be
  8239. sufficient for a pixel or whether it should be predicted by the predictor nn.
  8240. The computational complexity of the prescreener nn is much less than that of
  8241. the predictor nn. Since most pixels can be handled by cubic interpolation,
  8242. using the prescreener generally results in much faster processing.
  8243. The prescreener is pretty accurate, so the difference between using it and not
  8244. using it is almost always unnoticeable.
  8245. Can be one of the following:
  8246. @table @samp
  8247. @item none
  8248. @item original
  8249. @item new
  8250. @end table
  8251. Default is @code{new}.
  8252. @item fapprox
  8253. Set various debugging flags.
  8254. @end table
  8255. @section noformat
  8256. Force libavfilter not to use any of the specified pixel formats for the
  8257. input to the next filter.
  8258. It accepts the following parameters:
  8259. @table @option
  8260. @item pix_fmts
  8261. A '|'-separated list of pixel format names, such as
  8262. pix_fmts=yuv420p|monow|rgb24".
  8263. @end table
  8264. @subsection Examples
  8265. @itemize
  8266. @item
  8267. Force libavfilter to use a format different from @var{yuv420p} for the
  8268. input to the vflip filter:
  8269. @example
  8270. noformat=pix_fmts=yuv420p,vflip
  8271. @end example
  8272. @item
  8273. Convert the input video to any of the formats not contained in the list:
  8274. @example
  8275. noformat=yuv420p|yuv444p|yuv410p
  8276. @end example
  8277. @end itemize
  8278. @section noise
  8279. Add noise on video input frame.
  8280. The filter accepts the following options:
  8281. @table @option
  8282. @item all_seed
  8283. @item c0_seed
  8284. @item c1_seed
  8285. @item c2_seed
  8286. @item c3_seed
  8287. Set noise seed for specific pixel component or all pixel components in case
  8288. of @var{all_seed}. Default value is @code{123457}.
  8289. @item all_strength, alls
  8290. @item c0_strength, c0s
  8291. @item c1_strength, c1s
  8292. @item c2_strength, c2s
  8293. @item c3_strength, c3s
  8294. Set noise strength for specific pixel component or all pixel components in case
  8295. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  8296. @item all_flags, allf
  8297. @item c0_flags, c0f
  8298. @item c1_flags, c1f
  8299. @item c2_flags, c2f
  8300. @item c3_flags, c3f
  8301. Set pixel component flags or set flags for all components if @var{all_flags}.
  8302. Available values for component flags are:
  8303. @table @samp
  8304. @item a
  8305. averaged temporal noise (smoother)
  8306. @item p
  8307. mix random noise with a (semi)regular pattern
  8308. @item t
  8309. temporal noise (noise pattern changes between frames)
  8310. @item u
  8311. uniform noise (gaussian otherwise)
  8312. @end table
  8313. @end table
  8314. @subsection Examples
  8315. Add temporal and uniform noise to input video:
  8316. @example
  8317. noise=alls=20:allf=t+u
  8318. @end example
  8319. @section null
  8320. Pass the video source unchanged to the output.
  8321. @section ocr
  8322. Optical Character Recognition
  8323. This filter uses Tesseract for optical character recognition.
  8324. It accepts the following options:
  8325. @table @option
  8326. @item datapath
  8327. Set datapath to tesseract data. Default is to use whatever was
  8328. set at installation.
  8329. @item language
  8330. Set language, default is "eng".
  8331. @item whitelist
  8332. Set character whitelist.
  8333. @item blacklist
  8334. Set character blacklist.
  8335. @end table
  8336. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  8337. @section ocv
  8338. Apply a video transform using libopencv.
  8339. To enable this filter, install the libopencv library and headers and
  8340. configure FFmpeg with @code{--enable-libopencv}.
  8341. It accepts the following parameters:
  8342. @table @option
  8343. @item filter_name
  8344. The name of the libopencv filter to apply.
  8345. @item filter_params
  8346. The parameters to pass to the libopencv filter. If not specified, the default
  8347. values are assumed.
  8348. @end table
  8349. Refer to the official libopencv documentation for more precise
  8350. information:
  8351. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  8352. Several libopencv filters are supported; see the following subsections.
  8353. @anchor{dilate}
  8354. @subsection dilate
  8355. Dilate an image by using a specific structuring element.
  8356. It corresponds to the libopencv function @code{cvDilate}.
  8357. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  8358. @var{struct_el} represents a structuring element, and has the syntax:
  8359. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  8360. @var{cols} and @var{rows} represent the number of columns and rows of
  8361. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  8362. point, and @var{shape} the shape for the structuring element. @var{shape}
  8363. must be "rect", "cross", "ellipse", or "custom".
  8364. If the value for @var{shape} is "custom", it must be followed by a
  8365. string of the form "=@var{filename}". The file with name
  8366. @var{filename} is assumed to represent a binary image, with each
  8367. printable character corresponding to a bright pixel. When a custom
  8368. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  8369. or columns and rows of the read file are assumed instead.
  8370. The default value for @var{struct_el} is "3x3+0x0/rect".
  8371. @var{nb_iterations} specifies the number of times the transform is
  8372. applied to the image, and defaults to 1.
  8373. Some examples:
  8374. @example
  8375. # Use the default values
  8376. ocv=dilate
  8377. # Dilate using a structuring element with a 5x5 cross, iterating two times
  8378. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  8379. # Read the shape from the file diamond.shape, iterating two times.
  8380. # The file diamond.shape may contain a pattern of characters like this
  8381. # *
  8382. # ***
  8383. # *****
  8384. # ***
  8385. # *
  8386. # The specified columns and rows are ignored
  8387. # but the anchor point coordinates are not
  8388. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  8389. @end example
  8390. @subsection erode
  8391. Erode an image by using a specific structuring element.
  8392. It corresponds to the libopencv function @code{cvErode}.
  8393. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  8394. with the same syntax and semantics as the @ref{dilate} filter.
  8395. @subsection smooth
  8396. Smooth the input video.
  8397. The filter takes the following parameters:
  8398. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  8399. @var{type} is the type of smooth filter to apply, and must be one of
  8400. the following values: "blur", "blur_no_scale", "median", "gaussian",
  8401. or "bilateral". The default value is "gaussian".
  8402. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  8403. depend on the smooth type. @var{param1} and
  8404. @var{param2} accept integer positive values or 0. @var{param3} and
  8405. @var{param4} accept floating point values.
  8406. The default value for @var{param1} is 3. The default value for the
  8407. other parameters is 0.
  8408. These parameters correspond to the parameters assigned to the
  8409. libopencv function @code{cvSmooth}.
  8410. @section oscilloscope
  8411. 2D Video Oscilloscope.
  8412. Useful to measure spatial impulse, step responses, chroma delays, etc.
  8413. It accepts the following parameters:
  8414. @table @option
  8415. @item x
  8416. Set scope center x position.
  8417. @item y
  8418. Set scope center y position.
  8419. @item s
  8420. Set scope size, relative to frame diagonal.
  8421. @item t
  8422. Set scope tilt/rotation.
  8423. @item o
  8424. Set trace opacity.
  8425. @item tx
  8426. Set trace center x position.
  8427. @item ty
  8428. Set trace center y position.
  8429. @item tw
  8430. Set trace width, relative to width of frame.
  8431. @item th
  8432. Set trace height, relative to height of frame.
  8433. @item c
  8434. Set which components to trace. By default it traces first three components.
  8435. @item g
  8436. Draw trace grid. By default is enabled.
  8437. @item st
  8438. Draw some statistics. By default is enabled.
  8439. @item sc
  8440. Draw scope. By default is enabled.
  8441. @end table
  8442. @subsection Examples
  8443. @itemize
  8444. @item
  8445. Inspect full first row of video frame.
  8446. @example
  8447. oscilloscope=x=0.5:y=0:s=1
  8448. @end example
  8449. @item
  8450. Inspect full last row of video frame.
  8451. @example
  8452. oscilloscope=x=0.5:y=1:s=1
  8453. @end example
  8454. @item
  8455. Inspect full 5th line of video frame of height 1080.
  8456. @example
  8457. oscilloscope=x=0.5:y=5/1080:s=1
  8458. @end example
  8459. @item
  8460. Inspect full last column of video frame.
  8461. @example
  8462. oscilloscope=x=1:y=0.5:s=1:t=1
  8463. @end example
  8464. @end itemize
  8465. @anchor{overlay}
  8466. @section overlay
  8467. Overlay one video on top of another.
  8468. It takes two inputs and has one output. The first input is the "main"
  8469. video on which the second input is overlaid.
  8470. It accepts the following parameters:
  8471. A description of the accepted options follows.
  8472. @table @option
  8473. @item x
  8474. @item y
  8475. Set the expression for the x and y coordinates of the overlaid video
  8476. on the main video. Default value is "0" for both expressions. In case
  8477. the expression is invalid, it is set to a huge value (meaning that the
  8478. overlay will not be displayed within the output visible area).
  8479. @item eof_action
  8480. See @ref{framesync}.
  8481. @item eval
  8482. Set when the expressions for @option{x}, and @option{y} are evaluated.
  8483. It accepts the following values:
  8484. @table @samp
  8485. @item init
  8486. only evaluate expressions once during the filter initialization or
  8487. when a command is processed
  8488. @item frame
  8489. evaluate expressions for each incoming frame
  8490. @end table
  8491. Default value is @samp{frame}.
  8492. @item shortest
  8493. See @ref{framesync}.
  8494. @item format
  8495. Set the format for the output video.
  8496. It accepts the following values:
  8497. @table @samp
  8498. @item yuv420
  8499. force YUV420 output
  8500. @item yuv422
  8501. force YUV422 output
  8502. @item yuv444
  8503. force YUV444 output
  8504. @item rgb
  8505. force packed RGB output
  8506. @item gbrp
  8507. force planar RGB output
  8508. @item auto
  8509. automatically pick format
  8510. @end table
  8511. Default value is @samp{yuv420}.
  8512. @item repeatlast
  8513. See @ref{framesync}.
  8514. @end table
  8515. The @option{x}, and @option{y} expressions can contain the following
  8516. parameters.
  8517. @table @option
  8518. @item main_w, W
  8519. @item main_h, H
  8520. The main input width and height.
  8521. @item overlay_w, w
  8522. @item overlay_h, h
  8523. The overlay input width and height.
  8524. @item x
  8525. @item y
  8526. The computed values for @var{x} and @var{y}. They are evaluated for
  8527. each new frame.
  8528. @item hsub
  8529. @item vsub
  8530. horizontal and vertical chroma subsample values of the output
  8531. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  8532. @var{vsub} is 1.
  8533. @item n
  8534. the number of input frame, starting from 0
  8535. @item pos
  8536. the position in the file of the input frame, NAN if unknown
  8537. @item t
  8538. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  8539. @end table
  8540. This filter also supports the @ref{framesync} options.
  8541. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  8542. when evaluation is done @emph{per frame}, and will evaluate to NAN
  8543. when @option{eval} is set to @samp{init}.
  8544. Be aware that frames are taken from each input video in timestamp
  8545. order, hence, if their initial timestamps differ, it is a good idea
  8546. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  8547. have them begin in the same zero timestamp, as the example for
  8548. the @var{movie} filter does.
  8549. You can chain together more overlays but you should test the
  8550. efficiency of such approach.
  8551. @subsection Commands
  8552. This filter supports the following commands:
  8553. @table @option
  8554. @item x
  8555. @item y
  8556. Modify the x and y of the overlay input.
  8557. The command accepts the same syntax of the corresponding option.
  8558. If the specified expression is not valid, it is kept at its current
  8559. value.
  8560. @end table
  8561. @subsection Examples
  8562. @itemize
  8563. @item
  8564. Draw the overlay at 10 pixels from the bottom right corner of the main
  8565. video:
  8566. @example
  8567. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  8568. @end example
  8569. Using named options the example above becomes:
  8570. @example
  8571. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  8572. @end example
  8573. @item
  8574. Insert a transparent PNG logo in the bottom left corner of the input,
  8575. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  8576. @example
  8577. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  8578. @end example
  8579. @item
  8580. Insert 2 different transparent PNG logos (second logo on bottom
  8581. right corner) using the @command{ffmpeg} tool:
  8582. @example
  8583. 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
  8584. @end example
  8585. @item
  8586. Add a transparent color layer on top of the main video; @code{WxH}
  8587. must specify the size of the main input to the overlay filter:
  8588. @example
  8589. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  8590. @end example
  8591. @item
  8592. Play an original video and a filtered version (here with the deshake
  8593. filter) side by side using the @command{ffplay} tool:
  8594. @example
  8595. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  8596. @end example
  8597. The above command is the same as:
  8598. @example
  8599. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  8600. @end example
  8601. @item
  8602. Make a sliding overlay appearing from the left to the right top part of the
  8603. screen starting since time 2:
  8604. @example
  8605. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  8606. @end example
  8607. @item
  8608. Compose output by putting two input videos side to side:
  8609. @example
  8610. ffmpeg -i left.avi -i right.avi -filter_complex "
  8611. nullsrc=size=200x100 [background];
  8612. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  8613. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  8614. [background][left] overlay=shortest=1 [background+left];
  8615. [background+left][right] overlay=shortest=1:x=100 [left+right]
  8616. "
  8617. @end example
  8618. @item
  8619. Mask 10-20 seconds of a video by applying the delogo filter to a section
  8620. @example
  8621. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  8622. -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]'
  8623. masked.avi
  8624. @end example
  8625. @item
  8626. Chain several overlays in cascade:
  8627. @example
  8628. nullsrc=s=200x200 [bg];
  8629. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  8630. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  8631. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  8632. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  8633. [in3] null, [mid2] overlay=100:100 [out0]
  8634. @end example
  8635. @end itemize
  8636. @section owdenoise
  8637. Apply Overcomplete Wavelet denoiser.
  8638. The filter accepts the following options:
  8639. @table @option
  8640. @item depth
  8641. Set depth.
  8642. Larger depth values will denoise lower frequency components more, but
  8643. slow down filtering.
  8644. Must be an int in the range 8-16, default is @code{8}.
  8645. @item luma_strength, ls
  8646. Set luma strength.
  8647. Must be a double value in the range 0-1000, default is @code{1.0}.
  8648. @item chroma_strength, cs
  8649. Set chroma strength.
  8650. Must be a double value in the range 0-1000, default is @code{1.0}.
  8651. @end table
  8652. @anchor{pad}
  8653. @section pad
  8654. Add paddings to the input image, and place the original input at the
  8655. provided @var{x}, @var{y} coordinates.
  8656. It accepts the following parameters:
  8657. @table @option
  8658. @item width, w
  8659. @item height, h
  8660. Specify an expression for the size of the output image with the
  8661. paddings added. If the value for @var{width} or @var{height} is 0, the
  8662. corresponding input size is used for the output.
  8663. The @var{width} expression can reference the value set by the
  8664. @var{height} expression, and vice versa.
  8665. The default value of @var{width} and @var{height} is 0.
  8666. @item x
  8667. @item y
  8668. Specify the offsets to place the input image at within the padded area,
  8669. with respect to the top/left border of the output image.
  8670. The @var{x} expression can reference the value set by the @var{y}
  8671. expression, and vice versa.
  8672. The default value of @var{x} and @var{y} is 0.
  8673. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  8674. so the input image is centered on the padded area.
  8675. @item color
  8676. Specify the color of the padded area. For the syntax of this option,
  8677. check the "Color" section in the ffmpeg-utils manual.
  8678. The default value of @var{color} is "black".
  8679. @item eval
  8680. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  8681. It accepts the following values:
  8682. @table @samp
  8683. @item init
  8684. Only evaluate expressions once during the filter initialization or when
  8685. a command is processed.
  8686. @item frame
  8687. Evaluate expressions for each incoming frame.
  8688. @end table
  8689. Default value is @samp{init}.
  8690. @item aspect
  8691. Pad to aspect instead to a resolution.
  8692. @end table
  8693. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  8694. options are expressions containing the following constants:
  8695. @table @option
  8696. @item in_w
  8697. @item in_h
  8698. The input video width and height.
  8699. @item iw
  8700. @item ih
  8701. These are the same as @var{in_w} and @var{in_h}.
  8702. @item out_w
  8703. @item out_h
  8704. The output width and height (the size of the padded area), as
  8705. specified by the @var{width} and @var{height} expressions.
  8706. @item ow
  8707. @item oh
  8708. These are the same as @var{out_w} and @var{out_h}.
  8709. @item x
  8710. @item y
  8711. The x and y offsets as specified by the @var{x} and @var{y}
  8712. expressions, or NAN if not yet specified.
  8713. @item a
  8714. same as @var{iw} / @var{ih}
  8715. @item sar
  8716. input sample aspect ratio
  8717. @item dar
  8718. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  8719. @item hsub
  8720. @item vsub
  8721. The horizontal and vertical chroma subsample values. For example for the
  8722. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8723. @end table
  8724. @subsection Examples
  8725. @itemize
  8726. @item
  8727. Add paddings with the color "violet" to the input video. The output video
  8728. size is 640x480, and the top-left corner of the input video is placed at
  8729. column 0, row 40
  8730. @example
  8731. pad=640:480:0:40:violet
  8732. @end example
  8733. The example above is equivalent to the following command:
  8734. @example
  8735. pad=width=640:height=480:x=0:y=40:color=violet
  8736. @end example
  8737. @item
  8738. Pad the input to get an output with dimensions increased by 3/2,
  8739. and put the input video at the center of the padded area:
  8740. @example
  8741. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  8742. @end example
  8743. @item
  8744. Pad the input to get a squared output with size equal to the maximum
  8745. value between the input width and height, and put the input video at
  8746. the center of the padded area:
  8747. @example
  8748. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  8749. @end example
  8750. @item
  8751. Pad the input to get a final w/h ratio of 16:9:
  8752. @example
  8753. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  8754. @end example
  8755. @item
  8756. In case of anamorphic video, in order to set the output display aspect
  8757. correctly, it is necessary to use @var{sar} in the expression,
  8758. according to the relation:
  8759. @example
  8760. (ih * X / ih) * sar = output_dar
  8761. X = output_dar / sar
  8762. @end example
  8763. Thus the previous example needs to be modified to:
  8764. @example
  8765. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  8766. @end example
  8767. @item
  8768. Double the output size and put the input video in the bottom-right
  8769. corner of the output padded area:
  8770. @example
  8771. pad="2*iw:2*ih:ow-iw:oh-ih"
  8772. @end example
  8773. @end itemize
  8774. @anchor{palettegen}
  8775. @section palettegen
  8776. Generate one palette for a whole video stream.
  8777. It accepts the following options:
  8778. @table @option
  8779. @item max_colors
  8780. Set the maximum number of colors to quantize in the palette.
  8781. Note: the palette will still contain 256 colors; the unused palette entries
  8782. will be black.
  8783. @item reserve_transparent
  8784. Create a palette of 255 colors maximum and reserve the last one for
  8785. transparency. Reserving the transparency color is useful for GIF optimization.
  8786. If not set, the maximum of colors in the palette will be 256. You probably want
  8787. to disable this option for a standalone image.
  8788. Set by default.
  8789. @item transparency_color
  8790. Set the color that will be used as background for transparency.
  8791. @item stats_mode
  8792. Set statistics mode.
  8793. It accepts the following values:
  8794. @table @samp
  8795. @item full
  8796. Compute full frame histograms.
  8797. @item diff
  8798. Compute histograms only for the part that differs from previous frame. This
  8799. might be relevant to give more importance to the moving part of your input if
  8800. the background is static.
  8801. @item single
  8802. Compute new histogram for each frame.
  8803. @end table
  8804. Default value is @var{full}.
  8805. @end table
  8806. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  8807. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  8808. color quantization of the palette. This information is also visible at
  8809. @var{info} logging level.
  8810. @subsection Examples
  8811. @itemize
  8812. @item
  8813. Generate a representative palette of a given video using @command{ffmpeg}:
  8814. @example
  8815. ffmpeg -i input.mkv -vf palettegen palette.png
  8816. @end example
  8817. @end itemize
  8818. @section paletteuse
  8819. Use a palette to downsample an input video stream.
  8820. The filter takes two inputs: one video stream and a palette. The palette must
  8821. be a 256 pixels image.
  8822. It accepts the following options:
  8823. @table @option
  8824. @item dither
  8825. Select dithering mode. Available algorithms are:
  8826. @table @samp
  8827. @item bayer
  8828. Ordered 8x8 bayer dithering (deterministic)
  8829. @item heckbert
  8830. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  8831. Note: this dithering is sometimes considered "wrong" and is included as a
  8832. reference.
  8833. @item floyd_steinberg
  8834. Floyd and Steingberg dithering (error diffusion)
  8835. @item sierra2
  8836. Frankie Sierra dithering v2 (error diffusion)
  8837. @item sierra2_4a
  8838. Frankie Sierra dithering v2 "Lite" (error diffusion)
  8839. @end table
  8840. Default is @var{sierra2_4a}.
  8841. @item bayer_scale
  8842. When @var{bayer} dithering is selected, this option defines the scale of the
  8843. pattern (how much the crosshatch pattern is visible). A low value means more
  8844. visible pattern for less banding, and higher value means less visible pattern
  8845. at the cost of more banding.
  8846. The option must be an integer value in the range [0,5]. Default is @var{2}.
  8847. @item diff_mode
  8848. If set, define the zone to process
  8849. @table @samp
  8850. @item rectangle
  8851. Only the changing rectangle will be reprocessed. This is similar to GIF
  8852. cropping/offsetting compression mechanism. This option can be useful for speed
  8853. if only a part of the image is changing, and has use cases such as limiting the
  8854. scope of the error diffusal @option{dither} to the rectangle that bounds the
  8855. moving scene (it leads to more deterministic output if the scene doesn't change
  8856. much, and as a result less moving noise and better GIF compression).
  8857. @end table
  8858. Default is @var{none}.
  8859. @item new
  8860. Take new palette for each output frame.
  8861. @item alpha_threshold
  8862. Sets the alpha threshold for transparency. Alpha values above this threshold
  8863. will be treated as completely opaque, and values below this threshold will be
  8864. treated as completely transparent.
  8865. The option must be an integer value in the range [0,255]. Default is @var{128}.
  8866. @end table
  8867. @subsection Examples
  8868. @itemize
  8869. @item
  8870. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  8871. using @command{ffmpeg}:
  8872. @example
  8873. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  8874. @end example
  8875. @end itemize
  8876. @section perspective
  8877. Correct perspective of video not recorded perpendicular to the screen.
  8878. A description of the accepted parameters follows.
  8879. @table @option
  8880. @item x0
  8881. @item y0
  8882. @item x1
  8883. @item y1
  8884. @item x2
  8885. @item y2
  8886. @item x3
  8887. @item y3
  8888. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  8889. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  8890. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  8891. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  8892. then the corners of the source will be sent to the specified coordinates.
  8893. The expressions can use the following variables:
  8894. @table @option
  8895. @item W
  8896. @item H
  8897. the width and height of video frame.
  8898. @item in
  8899. Input frame count.
  8900. @item on
  8901. Output frame count.
  8902. @end table
  8903. @item interpolation
  8904. Set interpolation for perspective correction.
  8905. It accepts the following values:
  8906. @table @samp
  8907. @item linear
  8908. @item cubic
  8909. @end table
  8910. Default value is @samp{linear}.
  8911. @item sense
  8912. Set interpretation of coordinate options.
  8913. It accepts the following values:
  8914. @table @samp
  8915. @item 0, source
  8916. Send point in the source specified by the given coordinates to
  8917. the corners of the destination.
  8918. @item 1, destination
  8919. Send the corners of the source to the point in the destination specified
  8920. by the given coordinates.
  8921. Default value is @samp{source}.
  8922. @end table
  8923. @item eval
  8924. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  8925. It accepts the following values:
  8926. @table @samp
  8927. @item init
  8928. only evaluate expressions once during the filter initialization or
  8929. when a command is processed
  8930. @item frame
  8931. evaluate expressions for each incoming frame
  8932. @end table
  8933. Default value is @samp{init}.
  8934. @end table
  8935. @section phase
  8936. Delay interlaced video by one field time so that the field order changes.
  8937. The intended use is to fix PAL movies that have been captured with the
  8938. opposite field order to the film-to-video transfer.
  8939. A description of the accepted parameters follows.
  8940. @table @option
  8941. @item mode
  8942. Set phase mode.
  8943. It accepts the following values:
  8944. @table @samp
  8945. @item t
  8946. Capture field order top-first, transfer bottom-first.
  8947. Filter will delay the bottom field.
  8948. @item b
  8949. Capture field order bottom-first, transfer top-first.
  8950. Filter will delay the top field.
  8951. @item p
  8952. Capture and transfer with the same field order. This mode only exists
  8953. for the documentation of the other options to refer to, but if you
  8954. actually select it, the filter will faithfully do nothing.
  8955. @item a
  8956. Capture field order determined automatically by field flags, transfer
  8957. opposite.
  8958. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  8959. basis using field flags. If no field information is available,
  8960. then this works just like @samp{u}.
  8961. @item u
  8962. Capture unknown or varying, transfer opposite.
  8963. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  8964. analyzing the images and selecting the alternative that produces best
  8965. match between the fields.
  8966. @item T
  8967. Capture top-first, transfer unknown or varying.
  8968. Filter selects among @samp{t} and @samp{p} using image analysis.
  8969. @item B
  8970. Capture bottom-first, transfer unknown or varying.
  8971. Filter selects among @samp{b} and @samp{p} using image analysis.
  8972. @item A
  8973. Capture determined by field flags, transfer unknown or varying.
  8974. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  8975. image analysis. If no field information is available, then this works just
  8976. like @samp{U}. This is the default mode.
  8977. @item U
  8978. Both capture and transfer unknown or varying.
  8979. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  8980. @end table
  8981. @end table
  8982. @section pixdesctest
  8983. Pixel format descriptor test filter, mainly useful for internal
  8984. testing. The output video should be equal to the input video.
  8985. For example:
  8986. @example
  8987. format=monow, pixdesctest
  8988. @end example
  8989. can be used to test the monowhite pixel format descriptor definition.
  8990. @section pixscope
  8991. Display sample values of color channels. Mainly useful for checking color
  8992. and levels. Minimum supported resolution is 640x480.
  8993. The filters accept the following options:
  8994. @table @option
  8995. @item x
  8996. Set scope X position, relative offset on X axis.
  8997. @item y
  8998. Set scope Y position, relative offset on Y axis.
  8999. @item w
  9000. Set scope width.
  9001. @item h
  9002. Set scope height.
  9003. @item o
  9004. Set window opacity. This window also holds statistics about pixel area.
  9005. @item wx
  9006. Set window X position, relative offset on X axis.
  9007. @item wy
  9008. Set window Y position, relative offset on Y axis.
  9009. @end table
  9010. @section pp
  9011. Enable the specified chain of postprocessing subfilters using libpostproc. This
  9012. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  9013. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  9014. Each subfilter and some options have a short and a long name that can be used
  9015. interchangeably, i.e. dr/dering are the same.
  9016. The filters accept the following options:
  9017. @table @option
  9018. @item subfilters
  9019. Set postprocessing subfilters string.
  9020. @end table
  9021. All subfilters share common options to determine their scope:
  9022. @table @option
  9023. @item a/autoq
  9024. Honor the quality commands for this subfilter.
  9025. @item c/chrom
  9026. Do chrominance filtering, too (default).
  9027. @item y/nochrom
  9028. Do luminance filtering only (no chrominance).
  9029. @item n/noluma
  9030. Do chrominance filtering only (no luminance).
  9031. @end table
  9032. These options can be appended after the subfilter name, separated by a '|'.
  9033. Available subfilters are:
  9034. @table @option
  9035. @item hb/hdeblock[|difference[|flatness]]
  9036. 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 vb/vdeblock[|difference[|flatness]]
  9044. 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. @item ha/hadeblock[|difference[|flatness]]
  9052. Accurate horizontal deblocking filter
  9053. @table @option
  9054. @item difference
  9055. Difference factor where higher values mean more deblocking (default: @code{32}).
  9056. @item flatness
  9057. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9058. @end table
  9059. @item va/vadeblock[|difference[|flatness]]
  9060. Accurate vertical deblocking filter
  9061. @table @option
  9062. @item difference
  9063. Difference factor where higher values mean more deblocking (default: @code{32}).
  9064. @item flatness
  9065. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9066. @end table
  9067. @end table
  9068. The horizontal and vertical deblocking filters share the difference and
  9069. flatness values so you cannot set different horizontal and vertical
  9070. thresholds.
  9071. @table @option
  9072. @item h1/x1hdeblock
  9073. Experimental horizontal deblocking filter
  9074. @item v1/x1vdeblock
  9075. Experimental vertical deblocking filter
  9076. @item dr/dering
  9077. Deringing filter
  9078. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  9079. @table @option
  9080. @item threshold1
  9081. larger -> stronger filtering
  9082. @item threshold2
  9083. larger -> stronger filtering
  9084. @item threshold3
  9085. larger -> stronger filtering
  9086. @end table
  9087. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  9088. @table @option
  9089. @item f/fullyrange
  9090. Stretch luminance to @code{0-255}.
  9091. @end table
  9092. @item lb/linblenddeint
  9093. Linear blend deinterlacing filter that deinterlaces the given block by
  9094. filtering all lines with a @code{(1 2 1)} filter.
  9095. @item li/linipoldeint
  9096. Linear interpolating deinterlacing filter that deinterlaces the given block by
  9097. linearly interpolating every second line.
  9098. @item ci/cubicipoldeint
  9099. Cubic interpolating deinterlacing filter deinterlaces the given block by
  9100. cubically interpolating every second line.
  9101. @item md/mediandeint
  9102. Median deinterlacing filter that deinterlaces the given block by applying a
  9103. median filter to every second line.
  9104. @item fd/ffmpegdeint
  9105. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  9106. second line with a @code{(-1 4 2 4 -1)} filter.
  9107. @item l5/lowpass5
  9108. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  9109. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  9110. @item fq/forceQuant[|quantizer]
  9111. Overrides the quantizer table from the input with the constant quantizer you
  9112. specify.
  9113. @table @option
  9114. @item quantizer
  9115. Quantizer to use
  9116. @end table
  9117. @item de/default
  9118. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  9119. @item fa/fast
  9120. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  9121. @item ac
  9122. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  9123. @end table
  9124. @subsection Examples
  9125. @itemize
  9126. @item
  9127. Apply horizontal and vertical deblocking, deringing and automatic
  9128. brightness/contrast:
  9129. @example
  9130. pp=hb/vb/dr/al
  9131. @end example
  9132. @item
  9133. Apply default filters without brightness/contrast correction:
  9134. @example
  9135. pp=de/-al
  9136. @end example
  9137. @item
  9138. Apply default filters and temporal denoiser:
  9139. @example
  9140. pp=default/tmpnoise|1|2|3
  9141. @end example
  9142. @item
  9143. Apply deblocking on luminance only, and switch vertical deblocking on or off
  9144. automatically depending on available CPU time:
  9145. @example
  9146. pp=hb|y/vb|a
  9147. @end example
  9148. @end itemize
  9149. @section pp7
  9150. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  9151. similar to spp = 6 with 7 point DCT, where only the center sample is
  9152. used after IDCT.
  9153. The filter accepts the following options:
  9154. @table @option
  9155. @item qp
  9156. Force a constant quantization parameter. It accepts an integer in range
  9157. 0 to 63. If not set, the filter will use the QP from the video stream
  9158. (if available).
  9159. @item mode
  9160. Set thresholding mode. Available modes are:
  9161. @table @samp
  9162. @item hard
  9163. Set hard thresholding.
  9164. @item soft
  9165. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9166. @item medium
  9167. Set medium thresholding (good results, default).
  9168. @end table
  9169. @end table
  9170. @section premultiply
  9171. Apply alpha premultiply effect to input video stream using first plane
  9172. of second stream as alpha.
  9173. Both streams must have same dimensions and same pixel format.
  9174. The filter accepts the following option:
  9175. @table @option
  9176. @item planes
  9177. Set which planes will be processed, unprocessed planes will be copied.
  9178. By default value 0xf, all planes will be processed.
  9179. @item inplace
  9180. Do not require 2nd input for processing, instead use alpha plane from input stream.
  9181. @end table
  9182. @section prewitt
  9183. Apply prewitt operator to input video stream.
  9184. The filter accepts the following option:
  9185. @table @option
  9186. @item planes
  9187. Set which planes will be processed, unprocessed planes will be copied.
  9188. By default value 0xf, all planes will be processed.
  9189. @item scale
  9190. Set value which will be multiplied with filtered result.
  9191. @item delta
  9192. Set value which will be added to filtered result.
  9193. @end table
  9194. @section pseudocolor
  9195. Alter frame colors in video with pseudocolors.
  9196. This filter accept the following options:
  9197. @table @option
  9198. @item c0
  9199. set pixel first component expression
  9200. @item c1
  9201. set pixel second component expression
  9202. @item c2
  9203. set pixel third component expression
  9204. @item c3
  9205. set pixel fourth component expression, corresponds to the alpha component
  9206. @item i
  9207. set component to use as base for altering colors
  9208. @end table
  9209. Each of them specifies the expression to use for computing the lookup table for
  9210. the corresponding pixel component values.
  9211. The expressions can contain the following constants and functions:
  9212. @table @option
  9213. @item w
  9214. @item h
  9215. The input width and height.
  9216. @item val
  9217. The input value for the pixel component.
  9218. @item ymin, umin, vmin, amin
  9219. The minimum allowed component value.
  9220. @item ymax, umax, vmax, amax
  9221. The maximum allowed component value.
  9222. @end table
  9223. All expressions default to "val".
  9224. @subsection Examples
  9225. @itemize
  9226. @item
  9227. Change too high luma values to gradient:
  9228. @example
  9229. 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'"
  9230. @end example
  9231. @end itemize
  9232. @section psnr
  9233. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  9234. Ratio) between two input videos.
  9235. This filter takes in input two input videos, the first input is
  9236. considered the "main" source and is passed unchanged to the
  9237. output. The second input is used as a "reference" video for computing
  9238. the PSNR.
  9239. Both video inputs must have the same resolution and pixel format for
  9240. this filter to work correctly. Also it assumes that both inputs
  9241. have the same number of frames, which are compared one by one.
  9242. The obtained average PSNR is printed through the logging system.
  9243. The filter stores the accumulated MSE (mean squared error) of each
  9244. frame, and at the end of the processing it is averaged across all frames
  9245. equally, and the following formula is applied to obtain the PSNR:
  9246. @example
  9247. PSNR = 10*log10(MAX^2/MSE)
  9248. @end example
  9249. Where MAX is the average of the maximum values of each component of the
  9250. image.
  9251. The description of the accepted parameters follows.
  9252. @table @option
  9253. @item stats_file, f
  9254. If specified the filter will use the named file to save the PSNR of
  9255. each individual frame. When filename equals "-" the data is sent to
  9256. standard output.
  9257. @item stats_version
  9258. Specifies which version of the stats file format to use. Details of
  9259. each format are written below.
  9260. Default value is 1.
  9261. @item stats_add_max
  9262. Determines whether the max value is output to the stats log.
  9263. Default value is 0.
  9264. Requires stats_version >= 2. If this is set and stats_version < 2,
  9265. the filter will return an error.
  9266. @end table
  9267. This filter also supports the @ref{framesync} options.
  9268. The file printed if @var{stats_file} is selected, contains a sequence of
  9269. key/value pairs of the form @var{key}:@var{value} for each compared
  9270. couple of frames.
  9271. If a @var{stats_version} greater than 1 is specified, a header line precedes
  9272. the list of per-frame-pair stats, with key value pairs following the frame
  9273. format with the following parameters:
  9274. @table @option
  9275. @item psnr_log_version
  9276. The version of the log file format. Will match @var{stats_version}.
  9277. @item fields
  9278. A comma separated list of the per-frame-pair parameters included in
  9279. the log.
  9280. @end table
  9281. A description of each shown per-frame-pair parameter follows:
  9282. @table @option
  9283. @item n
  9284. sequential number of the input frame, starting from 1
  9285. @item mse_avg
  9286. Mean Square Error pixel-by-pixel average difference of the compared
  9287. frames, averaged over all the image components.
  9288. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  9289. Mean Square Error pixel-by-pixel average difference of the compared
  9290. frames for the component specified by the suffix.
  9291. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  9292. Peak Signal to Noise ratio of the compared frames for the component
  9293. specified by the suffix.
  9294. @item max_avg, max_y, max_u, max_v
  9295. Maximum allowed value for each channel, and average over all
  9296. channels.
  9297. @end table
  9298. For example:
  9299. @example
  9300. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9301. [main][ref] psnr="stats_file=stats.log" [out]
  9302. @end example
  9303. On this example the input file being processed is compared with the
  9304. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  9305. is stored in @file{stats.log}.
  9306. @anchor{pullup}
  9307. @section pullup
  9308. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  9309. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  9310. content.
  9311. The pullup filter is designed to take advantage of future context in making
  9312. its decisions. This filter is stateless in the sense that it does not lock
  9313. onto a pattern to follow, but it instead looks forward to the following
  9314. fields in order to identify matches and rebuild progressive frames.
  9315. To produce content with an even framerate, insert the fps filter after
  9316. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  9317. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  9318. The filter accepts the following options:
  9319. @table @option
  9320. @item jl
  9321. @item jr
  9322. @item jt
  9323. @item jb
  9324. These options set the amount of "junk" to ignore at the left, right, top, and
  9325. bottom of the image, respectively. Left and right are in units of 8 pixels,
  9326. while top and bottom are in units of 2 lines.
  9327. The default is 8 pixels on each side.
  9328. @item sb
  9329. Set the strict breaks. Setting this option to 1 will reduce the chances of
  9330. filter generating an occasional mismatched frame, but it may also cause an
  9331. excessive number of frames to be dropped during high motion sequences.
  9332. Conversely, setting it to -1 will make filter match fields more easily.
  9333. This may help processing of video where there is slight blurring between
  9334. the fields, but may also cause there to be interlaced frames in the output.
  9335. Default value is @code{0}.
  9336. @item mp
  9337. Set the metric plane to use. It accepts the following values:
  9338. @table @samp
  9339. @item l
  9340. Use luma plane.
  9341. @item u
  9342. Use chroma blue plane.
  9343. @item v
  9344. Use chroma red plane.
  9345. @end table
  9346. This option may be set to use chroma plane instead of the default luma plane
  9347. for doing filter's computations. This may improve accuracy on very clean
  9348. source material, but more likely will decrease accuracy, especially if there
  9349. is chroma noise (rainbow effect) or any grayscale video.
  9350. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  9351. load and make pullup usable in realtime on slow machines.
  9352. @end table
  9353. For best results (without duplicated frames in the output file) it is
  9354. necessary to change the output frame rate. For example, to inverse
  9355. telecine NTSC input:
  9356. @example
  9357. ffmpeg -i input -vf pullup -r 24000/1001 ...
  9358. @end example
  9359. @section qp
  9360. Change video quantization parameters (QP).
  9361. The filter accepts the following option:
  9362. @table @option
  9363. @item qp
  9364. Set expression for quantization parameter.
  9365. @end table
  9366. The expression is evaluated through the eval API and can contain, among others,
  9367. the following constants:
  9368. @table @var
  9369. @item known
  9370. 1 if index is not 129, 0 otherwise.
  9371. @item qp
  9372. Sequential index starting from -129 to 128.
  9373. @end table
  9374. @subsection Examples
  9375. @itemize
  9376. @item
  9377. Some equation like:
  9378. @example
  9379. qp=2+2*sin(PI*qp)
  9380. @end example
  9381. @end itemize
  9382. @section random
  9383. Flush video frames from internal cache of frames into a random order.
  9384. No frame is discarded.
  9385. Inspired by @ref{frei0r} nervous filter.
  9386. @table @option
  9387. @item frames
  9388. Set size in number of frames of internal cache, in range from @code{2} to
  9389. @code{512}. Default is @code{30}.
  9390. @item seed
  9391. Set seed for random number generator, must be an integer included between
  9392. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  9393. less than @code{0}, the filter will try to use a good random seed on a
  9394. best effort basis.
  9395. @end table
  9396. @section readeia608
  9397. Read closed captioning (EIA-608) information from the top lines of a video frame.
  9398. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  9399. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  9400. with EIA-608 data (starting from 0). A description of each metadata value follows:
  9401. @table @option
  9402. @item lavfi.readeia608.X.cc
  9403. The two bytes stored as EIA-608 data (printed in hexadecimal).
  9404. @item lavfi.readeia608.X.line
  9405. The number of the line on which the EIA-608 data was identified and read.
  9406. @end table
  9407. This filter accepts the following options:
  9408. @table @option
  9409. @item scan_min
  9410. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  9411. @item scan_max
  9412. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  9413. @item mac
  9414. Set minimal acceptable amplitude change for sync codes detection.
  9415. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  9416. @item spw
  9417. Set the ratio of width reserved for sync code detection.
  9418. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  9419. @item mhd
  9420. Set the max peaks height difference for sync code detection.
  9421. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9422. @item mpd
  9423. Set max peaks period difference for sync code detection.
  9424. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9425. @item msd
  9426. Set the first two max start code bits differences.
  9427. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  9428. @item bhd
  9429. Set the minimum ratio of bits height compared to 3rd start code bit.
  9430. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  9431. @item th_w
  9432. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  9433. @item th_b
  9434. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  9435. @item chp
  9436. Enable checking the parity bit. In the event of a parity error, the filter will output
  9437. @code{0x00} for that character. Default is false.
  9438. @end table
  9439. @subsection Examples
  9440. @itemize
  9441. @item
  9442. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  9443. @example
  9444. 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
  9445. @end example
  9446. @end itemize
  9447. @section readvitc
  9448. Read vertical interval timecode (VITC) information from the top lines of a
  9449. video frame.
  9450. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  9451. timecode value, if a valid timecode has been detected. Further metadata key
  9452. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  9453. timecode data has been found or not.
  9454. This filter accepts the following options:
  9455. @table @option
  9456. @item scan_max
  9457. Set the maximum number of lines to scan for VITC data. If the value is set to
  9458. @code{-1} the full video frame is scanned. Default is @code{45}.
  9459. @item thr_b
  9460. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  9461. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  9462. @item thr_w
  9463. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  9464. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  9465. @end table
  9466. @subsection Examples
  9467. @itemize
  9468. @item
  9469. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  9470. draw @code{--:--:--:--} as a placeholder:
  9471. @example
  9472. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  9473. @end example
  9474. @end itemize
  9475. @section remap
  9476. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  9477. Destination pixel at position (X, Y) will be picked from source (x, y) position
  9478. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  9479. value for pixel will be used for destination pixel.
  9480. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  9481. will have Xmap/Ymap video stream dimensions.
  9482. Xmap and Ymap input video streams are 16bit depth, single channel.
  9483. @section removegrain
  9484. The removegrain filter is a spatial denoiser for progressive video.
  9485. @table @option
  9486. @item m0
  9487. Set mode for the first plane.
  9488. @item m1
  9489. Set mode for the second plane.
  9490. @item m2
  9491. Set mode for the third plane.
  9492. @item m3
  9493. Set mode for the fourth plane.
  9494. @end table
  9495. Range of mode is from 0 to 24. Description of each mode follows:
  9496. @table @var
  9497. @item 0
  9498. Leave input plane unchanged. Default.
  9499. @item 1
  9500. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  9501. @item 2
  9502. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  9503. @item 3
  9504. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  9505. @item 4
  9506. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  9507. This is equivalent to a median filter.
  9508. @item 5
  9509. Line-sensitive clipping giving the minimal change.
  9510. @item 6
  9511. Line-sensitive clipping, intermediate.
  9512. @item 7
  9513. Line-sensitive clipping, intermediate.
  9514. @item 8
  9515. Line-sensitive clipping, intermediate.
  9516. @item 9
  9517. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  9518. @item 10
  9519. Replaces the target pixel with the closest neighbour.
  9520. @item 11
  9521. [1 2 1] horizontal and vertical kernel blur.
  9522. @item 12
  9523. Same as mode 11.
  9524. @item 13
  9525. Bob mode, interpolates top field from the line where the neighbours
  9526. pixels are the closest.
  9527. @item 14
  9528. Bob mode, interpolates bottom field from the line where the neighbours
  9529. pixels are the closest.
  9530. @item 15
  9531. Bob mode, interpolates top field. Same as 13 but with a more complicated
  9532. interpolation formula.
  9533. @item 16
  9534. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  9535. interpolation formula.
  9536. @item 17
  9537. Clips the pixel with the minimum and maximum of respectively the maximum and
  9538. minimum of each pair of opposite neighbour pixels.
  9539. @item 18
  9540. Line-sensitive clipping using opposite neighbours whose greatest distance from
  9541. the current pixel is minimal.
  9542. @item 19
  9543. Replaces the pixel with the average of its 8 neighbours.
  9544. @item 20
  9545. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  9546. @item 21
  9547. Clips pixels using the averages of opposite neighbour.
  9548. @item 22
  9549. Same as mode 21 but simpler and faster.
  9550. @item 23
  9551. Small edge and halo removal, but reputed useless.
  9552. @item 24
  9553. Similar as 23.
  9554. @end table
  9555. @section removelogo
  9556. Suppress a TV station logo, using an image file to determine which
  9557. pixels comprise the logo. It works by filling in the pixels that
  9558. comprise the logo with neighboring pixels.
  9559. The filter accepts the following options:
  9560. @table @option
  9561. @item filename, f
  9562. Set the filter bitmap file, which can be any image format supported by
  9563. libavformat. The width and height of the image file must match those of the
  9564. video stream being processed.
  9565. @end table
  9566. Pixels in the provided bitmap image with a value of zero are not
  9567. considered part of the logo, non-zero pixels are considered part of
  9568. the logo. If you use white (255) for the logo and black (0) for the
  9569. rest, you will be safe. For making the filter bitmap, it is
  9570. recommended to take a screen capture of a black frame with the logo
  9571. visible, and then using a threshold filter followed by the erode
  9572. filter once or twice.
  9573. If needed, little splotches can be fixed manually. Remember that if
  9574. logo pixels are not covered, the filter quality will be much
  9575. reduced. Marking too many pixels as part of the logo does not hurt as
  9576. much, but it will increase the amount of blurring needed to cover over
  9577. the image and will destroy more information than necessary, and extra
  9578. pixels will slow things down on a large logo.
  9579. @section repeatfields
  9580. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  9581. fields based on its value.
  9582. @section reverse
  9583. Reverse a video clip.
  9584. Warning: This filter requires memory to buffer the entire clip, so trimming
  9585. is suggested.
  9586. @subsection Examples
  9587. @itemize
  9588. @item
  9589. Take the first 5 seconds of a clip, and reverse it.
  9590. @example
  9591. trim=end=5,reverse
  9592. @end example
  9593. @end itemize
  9594. @section roberts
  9595. Apply roberts cross operator to input video stream.
  9596. The filter accepts the following option:
  9597. @table @option
  9598. @item planes
  9599. Set which planes will be processed, unprocessed planes will be copied.
  9600. By default value 0xf, all planes will be processed.
  9601. @item scale
  9602. Set value which will be multiplied with filtered result.
  9603. @item delta
  9604. Set value which will be added to filtered result.
  9605. @end table
  9606. @section rotate
  9607. Rotate video by an arbitrary angle expressed in radians.
  9608. The filter accepts the following options:
  9609. A description of the optional parameters follows.
  9610. @table @option
  9611. @item angle, a
  9612. Set an expression for the angle by which to rotate the input video
  9613. clockwise, expressed as a number of radians. A negative value will
  9614. result in a counter-clockwise rotation. By default it is set to "0".
  9615. This expression is evaluated for each frame.
  9616. @item out_w, ow
  9617. Set the output width expression, default value is "iw".
  9618. This expression is evaluated just once during configuration.
  9619. @item out_h, oh
  9620. Set the output height expression, default value is "ih".
  9621. This expression is evaluated just once during configuration.
  9622. @item bilinear
  9623. Enable bilinear interpolation if set to 1, a value of 0 disables
  9624. it. Default value is 1.
  9625. @item fillcolor, c
  9626. Set the color used to fill the output area not covered by the rotated
  9627. image. For the general syntax of this option, check the "Color" section in the
  9628. ffmpeg-utils manual. If the special value "none" is selected then no
  9629. background is printed (useful for example if the background is never shown).
  9630. Default value is "black".
  9631. @end table
  9632. The expressions for the angle and the output size can contain the
  9633. following constants and functions:
  9634. @table @option
  9635. @item n
  9636. sequential number of the input frame, starting from 0. It is always NAN
  9637. before the first frame is filtered.
  9638. @item t
  9639. time in seconds of the input frame, it is set to 0 when the filter is
  9640. configured. It is always NAN before the first frame is filtered.
  9641. @item hsub
  9642. @item vsub
  9643. horizontal and vertical chroma subsample values. For example for the
  9644. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9645. @item in_w, iw
  9646. @item in_h, ih
  9647. the input video width and height
  9648. @item out_w, ow
  9649. @item out_h, oh
  9650. the output width and height, that is the size of the padded area as
  9651. specified by the @var{width} and @var{height} expressions
  9652. @item rotw(a)
  9653. @item roth(a)
  9654. the minimal width/height required for completely containing the input
  9655. video rotated by @var{a} radians.
  9656. These are only available when computing the @option{out_w} and
  9657. @option{out_h} expressions.
  9658. @end table
  9659. @subsection Examples
  9660. @itemize
  9661. @item
  9662. Rotate the input by PI/6 radians clockwise:
  9663. @example
  9664. rotate=PI/6
  9665. @end example
  9666. @item
  9667. Rotate the input by PI/6 radians counter-clockwise:
  9668. @example
  9669. rotate=-PI/6
  9670. @end example
  9671. @item
  9672. Rotate the input by 45 degrees clockwise:
  9673. @example
  9674. rotate=45*PI/180
  9675. @end example
  9676. @item
  9677. Apply a constant rotation with period T, starting from an angle of PI/3:
  9678. @example
  9679. rotate=PI/3+2*PI*t/T
  9680. @end example
  9681. @item
  9682. Make the input video rotation oscillating with a period of T
  9683. seconds and an amplitude of A radians:
  9684. @example
  9685. rotate=A*sin(2*PI/T*t)
  9686. @end example
  9687. @item
  9688. Rotate the video, output size is chosen so that the whole rotating
  9689. input video is always completely contained in the output:
  9690. @example
  9691. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  9692. @end example
  9693. @item
  9694. Rotate the video, reduce the output size so that no background is ever
  9695. shown:
  9696. @example
  9697. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  9698. @end example
  9699. @end itemize
  9700. @subsection Commands
  9701. The filter supports the following commands:
  9702. @table @option
  9703. @item a, angle
  9704. Set the angle expression.
  9705. The command accepts the same syntax of the corresponding option.
  9706. If the specified expression is not valid, it is kept at its current
  9707. value.
  9708. @end table
  9709. @section sab
  9710. Apply Shape Adaptive Blur.
  9711. The filter accepts the following options:
  9712. @table @option
  9713. @item luma_radius, lr
  9714. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  9715. value is 1.0. A greater value will result in a more blurred image, and
  9716. in slower processing.
  9717. @item luma_pre_filter_radius, lpfr
  9718. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  9719. value is 1.0.
  9720. @item luma_strength, ls
  9721. Set luma maximum difference between pixels to still be considered, must
  9722. be a value in the 0.1-100.0 range, default value is 1.0.
  9723. @item chroma_radius, cr
  9724. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  9725. greater value will result in a more blurred image, and in slower
  9726. processing.
  9727. @item chroma_pre_filter_radius, cpfr
  9728. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  9729. @item chroma_strength, cs
  9730. Set chroma maximum difference between pixels to still be considered,
  9731. must be a value in the -0.9-100.0 range.
  9732. @end table
  9733. Each chroma option value, if not explicitly specified, is set to the
  9734. corresponding luma option value.
  9735. @anchor{scale}
  9736. @section scale
  9737. Scale (resize) the input video, using the libswscale library.
  9738. The scale filter forces the output display aspect ratio to be the same
  9739. of the input, by changing the output sample aspect ratio.
  9740. If the input image format is different from the format requested by
  9741. the next filter, the scale filter will convert the input to the
  9742. requested format.
  9743. @subsection Options
  9744. The filter accepts the following options, or any of the options
  9745. supported by the libswscale scaler.
  9746. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  9747. the complete list of scaler options.
  9748. @table @option
  9749. @item width, w
  9750. @item height, h
  9751. Set the output video dimension expression. Default value is the input
  9752. dimension.
  9753. If the @var{width} or @var{w} value is 0, the input width is used for
  9754. the output. If the @var{height} or @var{h} value is 0, the input height
  9755. is used for the output.
  9756. If one and only one of the values is -n with n >= 1, the scale filter
  9757. will use a value that maintains the aspect ratio of the input image,
  9758. calculated from the other specified dimension. After that it will,
  9759. however, make sure that the calculated dimension is divisible by n and
  9760. adjust the value if necessary.
  9761. If both values are -n with n >= 1, the behavior will be identical to
  9762. both values being set to 0 as previously detailed.
  9763. See below for the list of accepted constants for use in the dimension
  9764. expression.
  9765. @item eval
  9766. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  9767. @table @samp
  9768. @item init
  9769. Only evaluate expressions once during the filter initialization or when a command is processed.
  9770. @item frame
  9771. Evaluate expressions for each incoming frame.
  9772. @end table
  9773. Default value is @samp{init}.
  9774. @item interl
  9775. Set the interlacing mode. It accepts the following values:
  9776. @table @samp
  9777. @item 1
  9778. Force interlaced aware scaling.
  9779. @item 0
  9780. Do not apply interlaced scaling.
  9781. @item -1
  9782. Select interlaced aware scaling depending on whether the source frames
  9783. are flagged as interlaced or not.
  9784. @end table
  9785. Default value is @samp{0}.
  9786. @item flags
  9787. Set libswscale scaling flags. See
  9788. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9789. complete list of values. If not explicitly specified the filter applies
  9790. the default flags.
  9791. @item param0, param1
  9792. Set libswscale input parameters for scaling algorithms that need them. See
  9793. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9794. complete documentation. If not explicitly specified the filter applies
  9795. empty parameters.
  9796. @item size, s
  9797. Set the video size. For the syntax of this option, check the
  9798. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9799. @item in_color_matrix
  9800. @item out_color_matrix
  9801. Set in/output YCbCr color space type.
  9802. This allows the autodetected value to be overridden as well as allows forcing
  9803. a specific value used for the output and encoder.
  9804. If not specified, the color space type depends on the pixel format.
  9805. Possible values:
  9806. @table @samp
  9807. @item auto
  9808. Choose automatically.
  9809. @item bt709
  9810. Format conforming to International Telecommunication Union (ITU)
  9811. Recommendation BT.709.
  9812. @item fcc
  9813. Set color space conforming to the United States Federal Communications
  9814. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  9815. @item bt601
  9816. Set color space conforming to:
  9817. @itemize
  9818. @item
  9819. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  9820. @item
  9821. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  9822. @item
  9823. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  9824. @end itemize
  9825. @item smpte240m
  9826. Set color space conforming to SMPTE ST 240:1999.
  9827. @end table
  9828. @item in_range
  9829. @item out_range
  9830. Set in/output YCbCr sample range.
  9831. This allows the autodetected value to be overridden as well as allows forcing
  9832. a specific value used for the output and encoder. If not specified, the
  9833. range depends on the pixel format. Possible values:
  9834. @table @samp
  9835. @item auto
  9836. Choose automatically.
  9837. @item jpeg/full/pc
  9838. Set full range (0-255 in case of 8-bit luma).
  9839. @item mpeg/tv
  9840. Set "MPEG" range (16-235 in case of 8-bit luma).
  9841. @end table
  9842. @item force_original_aspect_ratio
  9843. Enable decreasing or increasing output video width or height if necessary to
  9844. keep the original aspect ratio. Possible values:
  9845. @table @samp
  9846. @item disable
  9847. Scale the video as specified and disable this feature.
  9848. @item decrease
  9849. The output video dimensions will automatically be decreased if needed.
  9850. @item increase
  9851. The output video dimensions will automatically be increased if needed.
  9852. @end table
  9853. One useful instance of this option is that when you know a specific device's
  9854. maximum allowed resolution, you can use this to limit the output video to
  9855. that, while retaining the aspect ratio. For example, device A allows
  9856. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  9857. decrease) and specifying 1280x720 to the command line makes the output
  9858. 1280x533.
  9859. Please note that this is a different thing than specifying -1 for @option{w}
  9860. or @option{h}, you still need to specify the output resolution for this option
  9861. to work.
  9862. @end table
  9863. The values of the @option{w} and @option{h} options are expressions
  9864. containing the following constants:
  9865. @table @var
  9866. @item in_w
  9867. @item in_h
  9868. The input width and height
  9869. @item iw
  9870. @item ih
  9871. These are the same as @var{in_w} and @var{in_h}.
  9872. @item out_w
  9873. @item out_h
  9874. The output (scaled) width and height
  9875. @item ow
  9876. @item oh
  9877. These are the same as @var{out_w} and @var{out_h}
  9878. @item a
  9879. The same as @var{iw} / @var{ih}
  9880. @item sar
  9881. input sample aspect ratio
  9882. @item dar
  9883. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  9884. @item hsub
  9885. @item vsub
  9886. horizontal and vertical input chroma subsample values. For example for the
  9887. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9888. @item ohsub
  9889. @item ovsub
  9890. horizontal and vertical output chroma subsample values. For example for the
  9891. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9892. @end table
  9893. @subsection Examples
  9894. @itemize
  9895. @item
  9896. Scale the input video to a size of 200x100
  9897. @example
  9898. scale=w=200:h=100
  9899. @end example
  9900. This is equivalent to:
  9901. @example
  9902. scale=200:100
  9903. @end example
  9904. or:
  9905. @example
  9906. scale=200x100
  9907. @end example
  9908. @item
  9909. Specify a size abbreviation for the output size:
  9910. @example
  9911. scale=qcif
  9912. @end example
  9913. which can also be written as:
  9914. @example
  9915. scale=size=qcif
  9916. @end example
  9917. @item
  9918. Scale the input to 2x:
  9919. @example
  9920. scale=w=2*iw:h=2*ih
  9921. @end example
  9922. @item
  9923. The above is the same as:
  9924. @example
  9925. scale=2*in_w:2*in_h
  9926. @end example
  9927. @item
  9928. Scale the input to 2x with forced interlaced scaling:
  9929. @example
  9930. scale=2*iw:2*ih:interl=1
  9931. @end example
  9932. @item
  9933. Scale the input to half size:
  9934. @example
  9935. scale=w=iw/2:h=ih/2
  9936. @end example
  9937. @item
  9938. Increase the width, and set the height to the same size:
  9939. @example
  9940. scale=3/2*iw:ow
  9941. @end example
  9942. @item
  9943. Seek Greek harmony:
  9944. @example
  9945. scale=iw:1/PHI*iw
  9946. scale=ih*PHI:ih
  9947. @end example
  9948. @item
  9949. Increase the height, and set the width to 3/2 of the height:
  9950. @example
  9951. scale=w=3/2*oh:h=3/5*ih
  9952. @end example
  9953. @item
  9954. Increase the size, making the size a multiple of the chroma
  9955. subsample values:
  9956. @example
  9957. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  9958. @end example
  9959. @item
  9960. Increase the width to a maximum of 500 pixels,
  9961. keeping the same aspect ratio as the input:
  9962. @example
  9963. scale=w='min(500\, iw*3/2):h=-1'
  9964. @end example
  9965. @end itemize
  9966. @subsection Commands
  9967. This filter supports the following commands:
  9968. @table @option
  9969. @item width, w
  9970. @item height, h
  9971. Set the output video dimension expression.
  9972. The command accepts the same syntax of the corresponding option.
  9973. If the specified expression is not valid, it is kept at its current
  9974. value.
  9975. @end table
  9976. @section scale_npp
  9977. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  9978. format conversion on CUDA video frames. Setting the output width and height
  9979. works in the same way as for the @var{scale} filter.
  9980. The following additional options are accepted:
  9981. @table @option
  9982. @item format
  9983. The pixel format of the output CUDA frames. If set to the string "same" (the
  9984. default), the input format will be kept. Note that automatic format negotiation
  9985. and conversion is not yet supported for hardware frames
  9986. @item interp_algo
  9987. The interpolation algorithm used for resizing. One of the following:
  9988. @table @option
  9989. @item nn
  9990. Nearest neighbour.
  9991. @item linear
  9992. @item cubic
  9993. @item cubic2p_bspline
  9994. 2-parameter cubic (B=1, C=0)
  9995. @item cubic2p_catmullrom
  9996. 2-parameter cubic (B=0, C=1/2)
  9997. @item cubic2p_b05c03
  9998. 2-parameter cubic (B=1/2, C=3/10)
  9999. @item super
  10000. Supersampling
  10001. @item lanczos
  10002. @end table
  10003. @end table
  10004. @section scale2ref
  10005. Scale (resize) the input video, based on a reference video.
  10006. See the scale filter for available options, scale2ref supports the same but
  10007. uses the reference video instead of the main input as basis. scale2ref also
  10008. supports the following additional constants for the @option{w} and
  10009. @option{h} options:
  10010. @table @var
  10011. @item main_w
  10012. @item main_h
  10013. The main input video's width and height
  10014. @item main_a
  10015. The same as @var{main_w} / @var{main_h}
  10016. @item main_sar
  10017. The main input video's sample aspect ratio
  10018. @item main_dar, mdar
  10019. The main input video's display aspect ratio. Calculated from
  10020. @code{(main_w / main_h) * main_sar}.
  10021. @item main_hsub
  10022. @item main_vsub
  10023. The main input video's horizontal and vertical chroma subsample values.
  10024. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  10025. is 1.
  10026. @end table
  10027. @subsection Examples
  10028. @itemize
  10029. @item
  10030. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  10031. @example
  10032. 'scale2ref[b][a];[a][b]overlay'
  10033. @end example
  10034. @end itemize
  10035. @anchor{selectivecolor}
  10036. @section selectivecolor
  10037. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  10038. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  10039. by the "purity" of the color (that is, how saturated it already is).
  10040. This filter is similar to the Adobe Photoshop Selective Color tool.
  10041. The filter accepts the following options:
  10042. @table @option
  10043. @item correction_method
  10044. Select color correction method.
  10045. Available values are:
  10046. @table @samp
  10047. @item absolute
  10048. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  10049. component value).
  10050. @item relative
  10051. Specified adjustments are relative to the original component value.
  10052. @end table
  10053. Default is @code{absolute}.
  10054. @item reds
  10055. Adjustments for red pixels (pixels where the red component is the maximum)
  10056. @item yellows
  10057. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  10058. @item greens
  10059. Adjustments for green pixels (pixels where the green component is the maximum)
  10060. @item cyans
  10061. Adjustments for cyan pixels (pixels where the red component is the minimum)
  10062. @item blues
  10063. Adjustments for blue pixels (pixels where the blue component is the maximum)
  10064. @item magentas
  10065. Adjustments for magenta pixels (pixels where the green component is the minimum)
  10066. @item whites
  10067. Adjustments for white pixels (pixels where all components are greater than 128)
  10068. @item neutrals
  10069. Adjustments for all pixels except pure black and pure white
  10070. @item blacks
  10071. Adjustments for black pixels (pixels where all components are lesser than 128)
  10072. @item psfile
  10073. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  10074. @end table
  10075. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  10076. 4 space separated floating point adjustment values in the [-1,1] range,
  10077. respectively to adjust the amount of cyan, magenta, yellow and black for the
  10078. pixels of its range.
  10079. @subsection Examples
  10080. @itemize
  10081. @item
  10082. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  10083. increase magenta by 27% in blue areas:
  10084. @example
  10085. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  10086. @end example
  10087. @item
  10088. Use a Photoshop selective color preset:
  10089. @example
  10090. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  10091. @end example
  10092. @end itemize
  10093. @anchor{separatefields}
  10094. @section separatefields
  10095. The @code{separatefields} takes a frame-based video input and splits
  10096. each frame into its components fields, producing a new half height clip
  10097. with twice the frame rate and twice the frame count.
  10098. This filter use field-dominance information in frame to decide which
  10099. of each pair of fields to place first in the output.
  10100. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  10101. @section setdar, setsar
  10102. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  10103. output video.
  10104. This is done by changing the specified Sample (aka Pixel) Aspect
  10105. Ratio, according to the following equation:
  10106. @example
  10107. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  10108. @end example
  10109. Keep in mind that the @code{setdar} filter does not modify the pixel
  10110. dimensions of the video frame. Also, the display aspect ratio set by
  10111. this filter may be changed by later filters in the filterchain,
  10112. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  10113. applied.
  10114. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  10115. the filter output video.
  10116. Note that as a consequence of the application of this filter, the
  10117. output display aspect ratio will change according to the equation
  10118. above.
  10119. Keep in mind that the sample aspect ratio set by the @code{setsar}
  10120. filter may be changed by later filters in the filterchain, e.g. if
  10121. another "setsar" or a "setdar" filter is applied.
  10122. It accepts the following parameters:
  10123. @table @option
  10124. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  10125. Set the aspect ratio used by the filter.
  10126. The parameter can be a floating point number string, an expression, or
  10127. a string of the form @var{num}:@var{den}, where @var{num} and
  10128. @var{den} are the numerator and denominator of the aspect ratio. If
  10129. the parameter is not specified, it is assumed the value "0".
  10130. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  10131. should be escaped.
  10132. @item max
  10133. Set the maximum integer value to use for expressing numerator and
  10134. denominator when reducing the expressed aspect ratio to a rational.
  10135. Default value is @code{100}.
  10136. @end table
  10137. The parameter @var{sar} is an expression containing
  10138. the following constants:
  10139. @table @option
  10140. @item E, PI, PHI
  10141. These are approximated values for the mathematical constants e
  10142. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  10143. @item w, h
  10144. The input width and height.
  10145. @item a
  10146. These are the same as @var{w} / @var{h}.
  10147. @item sar
  10148. The input sample aspect ratio.
  10149. @item dar
  10150. The input display aspect ratio. It is the same as
  10151. (@var{w} / @var{h}) * @var{sar}.
  10152. @item hsub, vsub
  10153. Horizontal and vertical chroma subsample values. For example, for the
  10154. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10155. @end table
  10156. @subsection Examples
  10157. @itemize
  10158. @item
  10159. To change the display aspect ratio to 16:9, specify one of the following:
  10160. @example
  10161. setdar=dar=1.77777
  10162. setdar=dar=16/9
  10163. @end example
  10164. @item
  10165. To change the sample aspect ratio to 10:11, specify:
  10166. @example
  10167. setsar=sar=10/11
  10168. @end example
  10169. @item
  10170. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  10171. 1000 in the aspect ratio reduction, use the command:
  10172. @example
  10173. setdar=ratio=16/9:max=1000
  10174. @end example
  10175. @end itemize
  10176. @anchor{setfield}
  10177. @section setfield
  10178. Force field for the output video frame.
  10179. The @code{setfield} filter marks the interlace type field for the
  10180. output frames. It does not change the input frame, but only sets the
  10181. corresponding property, which affects how the frame is treated by
  10182. following filters (e.g. @code{fieldorder} or @code{yadif}).
  10183. The filter accepts the following options:
  10184. @table @option
  10185. @item mode
  10186. Available values are:
  10187. @table @samp
  10188. @item auto
  10189. Keep the same field property.
  10190. @item bff
  10191. Mark the frame as bottom-field-first.
  10192. @item tff
  10193. Mark the frame as top-field-first.
  10194. @item prog
  10195. Mark the frame as progressive.
  10196. @end table
  10197. @end table
  10198. @section showinfo
  10199. Show a line containing various information for each input video frame.
  10200. The input video is not modified.
  10201. The shown line contains a sequence of key/value pairs of the form
  10202. @var{key}:@var{value}.
  10203. The following values are shown in the output:
  10204. @table @option
  10205. @item n
  10206. The (sequential) number of the input frame, starting from 0.
  10207. @item pts
  10208. The Presentation TimeStamp of the input frame, expressed as a number of
  10209. time base units. The time base unit depends on the filter input pad.
  10210. @item pts_time
  10211. The Presentation TimeStamp of the input frame, expressed as a number of
  10212. seconds.
  10213. @item pos
  10214. The position of the frame in the input stream, or -1 if this information is
  10215. unavailable and/or meaningless (for example in case of synthetic video).
  10216. @item fmt
  10217. The pixel format name.
  10218. @item sar
  10219. The sample aspect ratio of the input frame, expressed in the form
  10220. @var{num}/@var{den}.
  10221. @item s
  10222. The size of the input frame. For the syntax of this option, check the
  10223. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10224. @item i
  10225. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  10226. for bottom field first).
  10227. @item iskey
  10228. This is 1 if the frame is a key frame, 0 otherwise.
  10229. @item type
  10230. The picture type of the input frame ("I" for an I-frame, "P" for a
  10231. P-frame, "B" for a B-frame, or "?" for an unknown type).
  10232. Also refer to the documentation of the @code{AVPictureType} enum and of
  10233. the @code{av_get_picture_type_char} function defined in
  10234. @file{libavutil/avutil.h}.
  10235. @item checksum
  10236. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  10237. @item plane_checksum
  10238. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  10239. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  10240. @end table
  10241. @section showpalette
  10242. Displays the 256 colors palette of each frame. This filter is only relevant for
  10243. @var{pal8} pixel format frames.
  10244. It accepts the following option:
  10245. @table @option
  10246. @item s
  10247. Set the size of the box used to represent one palette color entry. Default is
  10248. @code{30} (for a @code{30x30} pixel box).
  10249. @end table
  10250. @section shuffleframes
  10251. Reorder and/or duplicate and/or drop video frames.
  10252. It accepts the following parameters:
  10253. @table @option
  10254. @item mapping
  10255. Set the destination indexes of input frames.
  10256. This is space or '|' separated list of indexes that maps input frames to output
  10257. frames. Number of indexes also sets maximal value that each index may have.
  10258. '-1' index have special meaning and that is to drop frame.
  10259. @end table
  10260. The first frame has the index 0. The default is to keep the input unchanged.
  10261. @subsection Examples
  10262. @itemize
  10263. @item
  10264. Swap second and third frame of every three frames of the input:
  10265. @example
  10266. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  10267. @end example
  10268. @item
  10269. Swap 10th and 1st frame of every ten frames of the input:
  10270. @example
  10271. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  10272. @end example
  10273. @end itemize
  10274. @section shuffleplanes
  10275. Reorder and/or duplicate video planes.
  10276. It accepts the following parameters:
  10277. @table @option
  10278. @item map0
  10279. The index of the input plane to be used as the first output plane.
  10280. @item map1
  10281. The index of the input plane to be used as the second output plane.
  10282. @item map2
  10283. The index of the input plane to be used as the third output plane.
  10284. @item map3
  10285. The index of the input plane to be used as the fourth output plane.
  10286. @end table
  10287. The first plane has the index 0. The default is to keep the input unchanged.
  10288. @subsection Examples
  10289. @itemize
  10290. @item
  10291. Swap the second and third planes of the input:
  10292. @example
  10293. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  10294. @end example
  10295. @end itemize
  10296. @anchor{signalstats}
  10297. @section signalstats
  10298. Evaluate various visual metrics that assist in determining issues associated
  10299. with the digitization of analog video media.
  10300. By default the filter will log these metadata values:
  10301. @table @option
  10302. @item YMIN
  10303. Display the minimal Y value contained within the input frame. Expressed in
  10304. range of [0-255].
  10305. @item YLOW
  10306. Display the Y value at the 10% percentile within the input frame. Expressed in
  10307. range of [0-255].
  10308. @item YAVG
  10309. Display the average Y value within the input frame. Expressed in range of
  10310. [0-255].
  10311. @item YHIGH
  10312. Display the Y value at the 90% percentile within the input frame. Expressed in
  10313. range of [0-255].
  10314. @item YMAX
  10315. Display the maximum Y value contained within the input frame. Expressed in
  10316. range of [0-255].
  10317. @item UMIN
  10318. Display the minimal U value contained within the input frame. Expressed in
  10319. range of [0-255].
  10320. @item ULOW
  10321. Display the U value at the 10% percentile within the input frame. Expressed in
  10322. range of [0-255].
  10323. @item UAVG
  10324. Display the average U value within the input frame. Expressed in range of
  10325. [0-255].
  10326. @item UHIGH
  10327. Display the U value at the 90% percentile within the input frame. Expressed in
  10328. range of [0-255].
  10329. @item UMAX
  10330. Display the maximum U value contained within the input frame. Expressed in
  10331. range of [0-255].
  10332. @item VMIN
  10333. Display the minimal V value contained within the input frame. Expressed in
  10334. range of [0-255].
  10335. @item VLOW
  10336. Display the V value at the 10% percentile within the input frame. Expressed in
  10337. range of [0-255].
  10338. @item VAVG
  10339. Display the average V value within the input frame. Expressed in range of
  10340. [0-255].
  10341. @item VHIGH
  10342. Display the V value at the 90% percentile within the input frame. Expressed in
  10343. range of [0-255].
  10344. @item VMAX
  10345. Display the maximum V value contained within the input frame. Expressed in
  10346. range of [0-255].
  10347. @item SATMIN
  10348. Display the minimal saturation value contained within the input frame.
  10349. Expressed in range of [0-~181.02].
  10350. @item SATLOW
  10351. Display the saturation value at the 10% percentile within the input frame.
  10352. Expressed in range of [0-~181.02].
  10353. @item SATAVG
  10354. Display the average saturation value within the input frame. Expressed in range
  10355. of [0-~181.02].
  10356. @item SATHIGH
  10357. Display the saturation value at the 90% percentile within the input frame.
  10358. Expressed in range of [0-~181.02].
  10359. @item SATMAX
  10360. Display the maximum saturation value contained within the input frame.
  10361. Expressed in range of [0-~181.02].
  10362. @item HUEMED
  10363. Display the median value for hue within the input frame. Expressed in range of
  10364. [0-360].
  10365. @item HUEAVG
  10366. Display the average value for hue within the input frame. Expressed in range of
  10367. [0-360].
  10368. @item YDIF
  10369. Display the average of sample value difference between all values of the Y
  10370. plane in the current frame and corresponding values of the previous input frame.
  10371. Expressed in range of [0-255].
  10372. @item UDIF
  10373. Display the average of sample value difference between all values of the U
  10374. plane in the current frame and corresponding values of the previous input frame.
  10375. Expressed in range of [0-255].
  10376. @item VDIF
  10377. Display the average of sample value difference between all values of the V
  10378. plane in the current frame and corresponding values of the previous input frame.
  10379. Expressed in range of [0-255].
  10380. @item YBITDEPTH
  10381. Display bit depth of Y plane in current frame.
  10382. Expressed in range of [0-16].
  10383. @item UBITDEPTH
  10384. Display bit depth of U plane in current frame.
  10385. Expressed in range of [0-16].
  10386. @item VBITDEPTH
  10387. Display bit depth of V plane in current frame.
  10388. Expressed in range of [0-16].
  10389. @end table
  10390. The filter accepts the following options:
  10391. @table @option
  10392. @item stat
  10393. @item out
  10394. @option{stat} specify an additional form of image analysis.
  10395. @option{out} output video with the specified type of pixel highlighted.
  10396. Both options accept the following values:
  10397. @table @samp
  10398. @item tout
  10399. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  10400. unlike the neighboring pixels of the same field. Examples of temporal outliers
  10401. include the results of video dropouts, head clogs, or tape tracking issues.
  10402. @item vrep
  10403. Identify @var{vertical line repetition}. Vertical line repetition includes
  10404. similar rows of pixels within a frame. In born-digital video vertical line
  10405. repetition is common, but this pattern is uncommon in video digitized from an
  10406. analog source. When it occurs in video that results from the digitization of an
  10407. analog source it can indicate concealment from a dropout compensator.
  10408. @item brng
  10409. Identify pixels that fall outside of legal broadcast range.
  10410. @end table
  10411. @item color, c
  10412. Set the highlight color for the @option{out} option. The default color is
  10413. yellow.
  10414. @end table
  10415. @subsection Examples
  10416. @itemize
  10417. @item
  10418. Output data of various video metrics:
  10419. @example
  10420. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  10421. @end example
  10422. @item
  10423. Output specific data about the minimum and maximum values of the Y plane per frame:
  10424. @example
  10425. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  10426. @end example
  10427. @item
  10428. Playback video while highlighting pixels that are outside of broadcast range in red.
  10429. @example
  10430. ffplay example.mov -vf signalstats="out=brng:color=red"
  10431. @end example
  10432. @item
  10433. Playback video with signalstats metadata drawn over the frame.
  10434. @example
  10435. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  10436. @end example
  10437. The contents of signalstat_drawtext.txt used in the command are:
  10438. @example
  10439. time %@{pts:hms@}
  10440. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  10441. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  10442. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  10443. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  10444. @end example
  10445. @end itemize
  10446. @anchor{signature}
  10447. @section signature
  10448. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  10449. input. In this case the matching between the inputs can be calculated additionally.
  10450. The filter always passes through the first input. The signature of each stream can
  10451. be written into a file.
  10452. It accepts the following options:
  10453. @table @option
  10454. @item detectmode
  10455. Enable or disable the matching process.
  10456. Available values are:
  10457. @table @samp
  10458. @item off
  10459. Disable the calculation of a matching (default).
  10460. @item full
  10461. Calculate the matching for the whole video and output whether the whole video
  10462. matches or only parts.
  10463. @item fast
  10464. Calculate only until a matching is found or the video ends. Should be faster in
  10465. some cases.
  10466. @end table
  10467. @item nb_inputs
  10468. Set the number of inputs. The option value must be a non negative integer.
  10469. Default value is 1.
  10470. @item filename
  10471. Set the path to which the output is written. If there is more than one input,
  10472. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  10473. integer), that will be replaced with the input number. If no filename is
  10474. specified, no output will be written. This is the default.
  10475. @item format
  10476. Choose the output format.
  10477. Available values are:
  10478. @table @samp
  10479. @item binary
  10480. Use the specified binary representation (default).
  10481. @item xml
  10482. Use the specified xml representation.
  10483. @end table
  10484. @item th_d
  10485. Set threshold to detect one word as similar. The option value must be an integer
  10486. greater than zero. The default value is 9000.
  10487. @item th_dc
  10488. Set threshold to detect all words as similar. The option value must be an integer
  10489. greater than zero. The default value is 60000.
  10490. @item th_xh
  10491. Set threshold to detect frames as similar. The option value must be an integer
  10492. greater than zero. The default value is 116.
  10493. @item th_di
  10494. Set the minimum length of a sequence in frames to recognize it as matching
  10495. sequence. The option value must be a non negative integer value.
  10496. The default value is 0.
  10497. @item th_it
  10498. Set the minimum relation, that matching frames to all frames must have.
  10499. The option value must be a double value between 0 and 1. The default value is 0.5.
  10500. @end table
  10501. @subsection Examples
  10502. @itemize
  10503. @item
  10504. To calculate the signature of an input video and store it in signature.bin:
  10505. @example
  10506. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  10507. @end example
  10508. @item
  10509. To detect whether two videos match and store the signatures in XML format in
  10510. signature0.xml and signature1.xml:
  10511. @example
  10512. 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 -
  10513. @end example
  10514. @end itemize
  10515. @anchor{smartblur}
  10516. @section smartblur
  10517. Blur the input video without impacting the outlines.
  10518. It accepts the following options:
  10519. @table @option
  10520. @item luma_radius, lr
  10521. Set the luma radius. The option value must be a float number in
  10522. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10523. used to blur the image (slower if larger). Default value is 1.0.
  10524. @item luma_strength, ls
  10525. Set the luma strength. The option value must be a float number
  10526. in the range [-1.0,1.0] that configures the blurring. A value included
  10527. in [0.0,1.0] will blur the image whereas a value included in
  10528. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  10529. @item luma_threshold, lt
  10530. Set the luma threshold used as a coefficient to determine
  10531. whether a pixel should be blurred or not. The option value must be an
  10532. integer in the range [-30,30]. A value of 0 will filter all the image,
  10533. a value included in [0,30] will filter flat areas and a value included
  10534. in [-30,0] will filter edges. Default value is 0.
  10535. @item chroma_radius, cr
  10536. Set the chroma radius. The option value must be a float number in
  10537. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10538. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  10539. @item chroma_strength, cs
  10540. Set the chroma strength. The option value must be a float number
  10541. in the range [-1.0,1.0] that configures the blurring. A value included
  10542. in [0.0,1.0] will blur the image whereas a value included in
  10543. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  10544. @item chroma_threshold, ct
  10545. Set the chroma threshold used as a coefficient to determine
  10546. whether a pixel should be blurred or not. The option value must be an
  10547. integer in the range [-30,30]. A value of 0 will filter all the image,
  10548. a value included in [0,30] will filter flat areas and a value included
  10549. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  10550. @end table
  10551. If a chroma option is not explicitly set, the corresponding luma value
  10552. is set.
  10553. @section ssim
  10554. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  10555. This filter takes in input two input videos, the first input is
  10556. considered the "main" source and is passed unchanged to the
  10557. output. The second input is used as a "reference" video for computing
  10558. the SSIM.
  10559. Both video inputs must have the same resolution and pixel format for
  10560. this filter to work correctly. Also it assumes that both inputs
  10561. have the same number of frames, which are compared one by one.
  10562. The filter stores the calculated SSIM of each frame.
  10563. The description of the accepted parameters follows.
  10564. @table @option
  10565. @item stats_file, f
  10566. If specified the filter will use the named file to save the SSIM of
  10567. each individual frame. When filename equals "-" the data is sent to
  10568. standard output.
  10569. @end table
  10570. The file printed if @var{stats_file} is selected, contains a sequence of
  10571. key/value pairs of the form @var{key}:@var{value} for each compared
  10572. couple of frames.
  10573. A description of each shown parameter follows:
  10574. @table @option
  10575. @item n
  10576. sequential number of the input frame, starting from 1
  10577. @item Y, U, V, R, G, B
  10578. SSIM of the compared frames for the component specified by the suffix.
  10579. @item All
  10580. SSIM of the compared frames for the whole frame.
  10581. @item dB
  10582. Same as above but in dB representation.
  10583. @end table
  10584. This filter also supports the @ref{framesync} options.
  10585. For example:
  10586. @example
  10587. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10588. [main][ref] ssim="stats_file=stats.log" [out]
  10589. @end example
  10590. On this example the input file being processed is compared with the
  10591. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  10592. is stored in @file{stats.log}.
  10593. Another example with both psnr and ssim at same time:
  10594. @example
  10595. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  10596. @end example
  10597. @section stereo3d
  10598. Convert between different stereoscopic image formats.
  10599. The filters accept the following options:
  10600. @table @option
  10601. @item in
  10602. Set stereoscopic image format of input.
  10603. Available values for input image formats are:
  10604. @table @samp
  10605. @item sbsl
  10606. side by side parallel (left eye left, right eye right)
  10607. @item sbsr
  10608. side by side crosseye (right eye left, left eye right)
  10609. @item sbs2l
  10610. side by side parallel with half width resolution
  10611. (left eye left, right eye right)
  10612. @item sbs2r
  10613. side by side crosseye with half width resolution
  10614. (right eye left, left eye right)
  10615. @item abl
  10616. above-below (left eye above, right eye below)
  10617. @item abr
  10618. above-below (right eye above, left eye below)
  10619. @item ab2l
  10620. above-below with half height resolution
  10621. (left eye above, right eye below)
  10622. @item ab2r
  10623. above-below with half height resolution
  10624. (right eye above, left eye below)
  10625. @item al
  10626. alternating frames (left eye first, right eye second)
  10627. @item ar
  10628. alternating frames (right eye first, left eye second)
  10629. @item irl
  10630. interleaved rows (left eye has top row, right eye starts on next row)
  10631. @item irr
  10632. interleaved rows (right eye has top row, left eye starts on next row)
  10633. @item icl
  10634. interleaved columns, left eye first
  10635. @item icr
  10636. interleaved columns, right eye first
  10637. Default value is @samp{sbsl}.
  10638. @end table
  10639. @item out
  10640. Set stereoscopic image format of output.
  10641. @table @samp
  10642. @item sbsl
  10643. side by side parallel (left eye left, right eye right)
  10644. @item sbsr
  10645. side by side crosseye (right eye left, left eye right)
  10646. @item sbs2l
  10647. side by side parallel with half width resolution
  10648. (left eye left, right eye right)
  10649. @item sbs2r
  10650. side by side crosseye with half width resolution
  10651. (right eye left, left eye right)
  10652. @item abl
  10653. above-below (left eye above, right eye below)
  10654. @item abr
  10655. above-below (right eye above, left eye below)
  10656. @item ab2l
  10657. above-below with half height resolution
  10658. (left eye above, right eye below)
  10659. @item ab2r
  10660. above-below with half height resolution
  10661. (right eye above, left eye below)
  10662. @item al
  10663. alternating frames (left eye first, right eye second)
  10664. @item ar
  10665. alternating frames (right eye first, left eye second)
  10666. @item irl
  10667. interleaved rows (left eye has top row, right eye starts on next row)
  10668. @item irr
  10669. interleaved rows (right eye has top row, left eye starts on next row)
  10670. @item arbg
  10671. anaglyph red/blue gray
  10672. (red filter on left eye, blue filter on right eye)
  10673. @item argg
  10674. anaglyph red/green gray
  10675. (red filter on left eye, green filter on right eye)
  10676. @item arcg
  10677. anaglyph red/cyan gray
  10678. (red filter on left eye, cyan filter on right eye)
  10679. @item arch
  10680. anaglyph red/cyan half colored
  10681. (red filter on left eye, cyan filter on right eye)
  10682. @item arcc
  10683. anaglyph red/cyan color
  10684. (red filter on left eye, cyan filter on right eye)
  10685. @item arcd
  10686. anaglyph red/cyan color optimized with the least squares projection of dubois
  10687. (red filter on left eye, cyan filter on right eye)
  10688. @item agmg
  10689. anaglyph green/magenta gray
  10690. (green filter on left eye, magenta filter on right eye)
  10691. @item agmh
  10692. anaglyph green/magenta half colored
  10693. (green filter on left eye, magenta filter on right eye)
  10694. @item agmc
  10695. anaglyph green/magenta colored
  10696. (green filter on left eye, magenta filter on right eye)
  10697. @item agmd
  10698. anaglyph green/magenta color optimized with the least squares projection of dubois
  10699. (green filter on left eye, magenta filter on right eye)
  10700. @item aybg
  10701. anaglyph yellow/blue gray
  10702. (yellow filter on left eye, blue filter on right eye)
  10703. @item aybh
  10704. anaglyph yellow/blue half colored
  10705. (yellow filter on left eye, blue filter on right eye)
  10706. @item aybc
  10707. anaglyph yellow/blue colored
  10708. (yellow filter on left eye, blue filter on right eye)
  10709. @item aybd
  10710. anaglyph yellow/blue color optimized with the least squares projection of dubois
  10711. (yellow filter on left eye, blue filter on right eye)
  10712. @item ml
  10713. mono output (left eye only)
  10714. @item mr
  10715. mono output (right eye only)
  10716. @item chl
  10717. checkerboard, left eye first
  10718. @item chr
  10719. checkerboard, right eye first
  10720. @item icl
  10721. interleaved columns, left eye first
  10722. @item icr
  10723. interleaved columns, right eye first
  10724. @item hdmi
  10725. HDMI frame pack
  10726. @end table
  10727. Default value is @samp{arcd}.
  10728. @end table
  10729. @subsection Examples
  10730. @itemize
  10731. @item
  10732. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  10733. @example
  10734. stereo3d=sbsl:aybd
  10735. @end example
  10736. @item
  10737. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  10738. @example
  10739. stereo3d=abl:sbsr
  10740. @end example
  10741. @end itemize
  10742. @section streamselect, astreamselect
  10743. Select video or audio streams.
  10744. The filter accepts the following options:
  10745. @table @option
  10746. @item inputs
  10747. Set number of inputs. Default is 2.
  10748. @item map
  10749. Set input indexes to remap to outputs.
  10750. @end table
  10751. @subsection Commands
  10752. The @code{streamselect} and @code{astreamselect} filter supports the following
  10753. commands:
  10754. @table @option
  10755. @item map
  10756. Set input indexes to remap to outputs.
  10757. @end table
  10758. @subsection Examples
  10759. @itemize
  10760. @item
  10761. Select first 5 seconds 1st stream and rest of time 2nd stream:
  10762. @example
  10763. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  10764. @end example
  10765. @item
  10766. Same as above, but for audio:
  10767. @example
  10768. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  10769. @end example
  10770. @end itemize
  10771. @section sobel
  10772. Apply sobel operator to input video stream.
  10773. The filter accepts the following option:
  10774. @table @option
  10775. @item planes
  10776. Set which planes will be processed, unprocessed planes will be copied.
  10777. By default value 0xf, all planes will be processed.
  10778. @item scale
  10779. Set value which will be multiplied with filtered result.
  10780. @item delta
  10781. Set value which will be added to filtered result.
  10782. @end table
  10783. @anchor{spp}
  10784. @section spp
  10785. Apply a simple postprocessing filter that compresses and decompresses the image
  10786. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  10787. and average the results.
  10788. The filter accepts the following options:
  10789. @table @option
  10790. @item quality
  10791. Set quality. This option defines the number of levels for averaging. It accepts
  10792. an integer in the range 0-6. If set to @code{0}, the filter will have no
  10793. effect. A value of @code{6} means the higher quality. For each increment of
  10794. that value the speed drops by a factor of approximately 2. Default value is
  10795. @code{3}.
  10796. @item qp
  10797. Force a constant quantization parameter. If not set, the filter will use the QP
  10798. from the video stream (if available).
  10799. @item mode
  10800. Set thresholding mode. Available modes are:
  10801. @table @samp
  10802. @item hard
  10803. Set hard thresholding (default).
  10804. @item soft
  10805. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10806. @end table
  10807. @item use_bframe_qp
  10808. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  10809. option may cause flicker since the B-Frames have often larger QP. Default is
  10810. @code{0} (not enabled).
  10811. @end table
  10812. @anchor{subtitles}
  10813. @section subtitles
  10814. Draw subtitles on top of input video using the libass library.
  10815. To enable compilation of this filter you need to configure FFmpeg with
  10816. @code{--enable-libass}. This filter also requires a build with libavcodec and
  10817. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  10818. Alpha) subtitles format.
  10819. The filter accepts the following options:
  10820. @table @option
  10821. @item filename, f
  10822. Set the filename of the subtitle file to read. It must be specified.
  10823. @item original_size
  10824. Specify the size of the original video, the video for which the ASS file
  10825. was composed. For the syntax of this option, check the
  10826. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10827. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  10828. correctly scale the fonts if the aspect ratio has been changed.
  10829. @item fontsdir
  10830. Set a directory path containing fonts that can be used by the filter.
  10831. These fonts will be used in addition to whatever the font provider uses.
  10832. @item alpha
  10833. Process alpha channel, by default alpha channel is untouched.
  10834. @item charenc
  10835. Set subtitles input character encoding. @code{subtitles} filter only. Only
  10836. useful if not UTF-8.
  10837. @item stream_index, si
  10838. Set subtitles stream index. @code{subtitles} filter only.
  10839. @item force_style
  10840. Override default style or script info parameters of the subtitles. It accepts a
  10841. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  10842. @end table
  10843. If the first key is not specified, it is assumed that the first value
  10844. specifies the @option{filename}.
  10845. For example, to render the file @file{sub.srt} on top of the input
  10846. video, use the command:
  10847. @example
  10848. subtitles=sub.srt
  10849. @end example
  10850. which is equivalent to:
  10851. @example
  10852. subtitles=filename=sub.srt
  10853. @end example
  10854. To render the default subtitles stream from file @file{video.mkv}, use:
  10855. @example
  10856. subtitles=video.mkv
  10857. @end example
  10858. To render the second subtitles stream from that file, use:
  10859. @example
  10860. subtitles=video.mkv:si=1
  10861. @end example
  10862. To make the subtitles stream from @file{sub.srt} appear in transparent green
  10863. @code{DejaVu Serif}, use:
  10864. @example
  10865. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  10866. @end example
  10867. @section super2xsai
  10868. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  10869. Interpolate) pixel art scaling algorithm.
  10870. Useful for enlarging pixel art images without reducing sharpness.
  10871. @section swaprect
  10872. Swap two rectangular objects in video.
  10873. This filter accepts the following options:
  10874. @table @option
  10875. @item w
  10876. Set object width.
  10877. @item h
  10878. Set object height.
  10879. @item x1
  10880. Set 1st rect x coordinate.
  10881. @item y1
  10882. Set 1st rect y coordinate.
  10883. @item x2
  10884. Set 2nd rect x coordinate.
  10885. @item y2
  10886. Set 2nd rect y coordinate.
  10887. All expressions are evaluated once for each frame.
  10888. @end table
  10889. The all options are expressions containing the following constants:
  10890. @table @option
  10891. @item w
  10892. @item h
  10893. The input width and height.
  10894. @item a
  10895. same as @var{w} / @var{h}
  10896. @item sar
  10897. input sample aspect ratio
  10898. @item dar
  10899. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  10900. @item n
  10901. The number of the input frame, starting from 0.
  10902. @item t
  10903. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  10904. @item pos
  10905. the position in the file of the input frame, NAN if unknown
  10906. @end table
  10907. @section swapuv
  10908. Swap U & V plane.
  10909. @section telecine
  10910. Apply telecine process to the video.
  10911. This filter accepts the following options:
  10912. @table @option
  10913. @item first_field
  10914. @table @samp
  10915. @item top, t
  10916. top field first
  10917. @item bottom, b
  10918. bottom field first
  10919. The default value is @code{top}.
  10920. @end table
  10921. @item pattern
  10922. A string of numbers representing the pulldown pattern you wish to apply.
  10923. The default value is @code{23}.
  10924. @end table
  10925. @example
  10926. Some typical patterns:
  10927. NTSC output (30i):
  10928. 27.5p: 32222
  10929. 24p: 23 (classic)
  10930. 24p: 2332 (preferred)
  10931. 20p: 33
  10932. 18p: 334
  10933. 16p: 3444
  10934. PAL output (25i):
  10935. 27.5p: 12222
  10936. 24p: 222222222223 ("Euro pulldown")
  10937. 16.67p: 33
  10938. 16p: 33333334
  10939. @end example
  10940. @section threshold
  10941. Apply threshold effect to video stream.
  10942. This filter needs four video streams to perform thresholding.
  10943. First stream is stream we are filtering.
  10944. Second stream is holding threshold values, third stream is holding min values,
  10945. and last, fourth stream is holding max values.
  10946. The filter accepts the following option:
  10947. @table @option
  10948. @item planes
  10949. Set which planes will be processed, unprocessed planes will be copied.
  10950. By default value 0xf, all planes will be processed.
  10951. @end table
  10952. For example if first stream pixel's component value is less then threshold value
  10953. of pixel component from 2nd threshold stream, third stream value will picked,
  10954. otherwise fourth stream pixel component value will be picked.
  10955. Using color source filter one can perform various types of thresholding:
  10956. @subsection Examples
  10957. @itemize
  10958. @item
  10959. Binary threshold, using gray color as threshold:
  10960. @example
  10961. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  10962. @end example
  10963. @item
  10964. Inverted binary threshold, using gray color as threshold:
  10965. @example
  10966. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  10967. @end example
  10968. @item
  10969. Truncate binary threshold, using gray color as threshold:
  10970. @example
  10971. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  10972. @end example
  10973. @item
  10974. Threshold to zero, using gray color as threshold:
  10975. @example
  10976. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  10977. @end example
  10978. @item
  10979. Inverted threshold to zero, using gray color as threshold:
  10980. @example
  10981. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  10982. @end example
  10983. @end itemize
  10984. @section thumbnail
  10985. Select the most representative frame in a given sequence of consecutive frames.
  10986. The filter accepts the following options:
  10987. @table @option
  10988. @item n
  10989. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  10990. will pick one of them, and then handle the next batch of @var{n} frames until
  10991. the end. Default is @code{100}.
  10992. @end table
  10993. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  10994. value will result in a higher memory usage, so a high value is not recommended.
  10995. @subsection Examples
  10996. @itemize
  10997. @item
  10998. Extract one picture each 50 frames:
  10999. @example
  11000. thumbnail=50
  11001. @end example
  11002. @item
  11003. Complete example of a thumbnail creation with @command{ffmpeg}:
  11004. @example
  11005. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  11006. @end example
  11007. @end itemize
  11008. @section tile
  11009. Tile several successive frames together.
  11010. The filter accepts the following options:
  11011. @table @option
  11012. @item layout
  11013. Set the grid size (i.e. the number of lines and columns). For the syntax of
  11014. this option, check the
  11015. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11016. @item nb_frames
  11017. Set the maximum number of frames to render in the given area. It must be less
  11018. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  11019. the area will be used.
  11020. @item margin
  11021. Set the outer border margin in pixels.
  11022. @item padding
  11023. Set the inner border thickness (i.e. the number of pixels between frames). For
  11024. more advanced padding options (such as having different values for the edges),
  11025. refer to the pad video filter.
  11026. @item color
  11027. Specify the color of the unused area. For the syntax of this option, check the
  11028. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  11029. is "black".
  11030. @item overlap
  11031. Set the number of frames to overlap when tiling several successive frames together.
  11032. The value must be between @code{0} and @var{nb_frames - 1}.
  11033. @end table
  11034. @subsection Examples
  11035. @itemize
  11036. @item
  11037. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  11038. @example
  11039. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  11040. @end example
  11041. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  11042. duplicating each output frame to accommodate the originally detected frame
  11043. rate.
  11044. @item
  11045. Display @code{5} pictures in an area of @code{3x2} frames,
  11046. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  11047. mixed flat and named options:
  11048. @example
  11049. tile=3x2:nb_frames=5:padding=7:margin=2
  11050. @end example
  11051. @end itemize
  11052. @section tinterlace
  11053. Perform various types of temporal field interlacing.
  11054. Frames are counted starting from 1, so the first input frame is
  11055. considered odd.
  11056. The filter accepts the following options:
  11057. @table @option
  11058. @item mode
  11059. Specify the mode of the interlacing. This option can also be specified
  11060. as a value alone. See below for a list of values for this option.
  11061. Available values are:
  11062. @table @samp
  11063. @item merge, 0
  11064. Move odd frames into the upper field, even into the lower field,
  11065. generating a double height frame at half frame rate.
  11066. @example
  11067. ------> time
  11068. Input:
  11069. Frame 1 Frame 2 Frame 3 Frame 4
  11070. 11111 22222 33333 44444
  11071. 11111 22222 33333 44444
  11072. 11111 22222 33333 44444
  11073. 11111 22222 33333 44444
  11074. Output:
  11075. 11111 33333
  11076. 22222 44444
  11077. 11111 33333
  11078. 22222 44444
  11079. 11111 33333
  11080. 22222 44444
  11081. 11111 33333
  11082. 22222 44444
  11083. @end example
  11084. @item drop_even, 1
  11085. Only output odd frames, even frames are dropped, generating a frame with
  11086. unchanged height at half frame rate.
  11087. @example
  11088. ------> time
  11089. Input:
  11090. Frame 1 Frame 2 Frame 3 Frame 4
  11091. 11111 22222 33333 44444
  11092. 11111 22222 33333 44444
  11093. 11111 22222 33333 44444
  11094. 11111 22222 33333 44444
  11095. Output:
  11096. 11111 33333
  11097. 11111 33333
  11098. 11111 33333
  11099. 11111 33333
  11100. @end example
  11101. @item drop_odd, 2
  11102. Only output even frames, odd frames are dropped, generating a frame with
  11103. unchanged height at half frame rate.
  11104. @example
  11105. ------> time
  11106. Input:
  11107. Frame 1 Frame 2 Frame 3 Frame 4
  11108. 11111 22222 33333 44444
  11109. 11111 22222 33333 44444
  11110. 11111 22222 33333 44444
  11111. 11111 22222 33333 44444
  11112. Output:
  11113. 22222 44444
  11114. 22222 44444
  11115. 22222 44444
  11116. 22222 44444
  11117. @end example
  11118. @item pad, 3
  11119. Expand each frame to full height, but pad alternate lines with black,
  11120. generating a frame with double height at the same input frame rate.
  11121. @example
  11122. ------> time
  11123. Input:
  11124. Frame 1 Frame 2 Frame 3 Frame 4
  11125. 11111 22222 33333 44444
  11126. 11111 22222 33333 44444
  11127. 11111 22222 33333 44444
  11128. 11111 22222 33333 44444
  11129. Output:
  11130. 11111 ..... 33333 .....
  11131. ..... 22222 ..... 44444
  11132. 11111 ..... 33333 .....
  11133. ..... 22222 ..... 44444
  11134. 11111 ..... 33333 .....
  11135. ..... 22222 ..... 44444
  11136. 11111 ..... 33333 .....
  11137. ..... 22222 ..... 44444
  11138. @end example
  11139. @item interleave_top, 4
  11140. Interleave the upper field from odd frames with the lower field from
  11141. even frames, generating a frame with unchanged height at half frame rate.
  11142. @example
  11143. ------> time
  11144. Input:
  11145. Frame 1 Frame 2 Frame 3 Frame 4
  11146. 11111<- 22222 33333<- 44444
  11147. 11111 22222<- 33333 44444<-
  11148. 11111<- 22222 33333<- 44444
  11149. 11111 22222<- 33333 44444<-
  11150. Output:
  11151. 11111 33333
  11152. 22222 44444
  11153. 11111 33333
  11154. 22222 44444
  11155. @end example
  11156. @item interleave_bottom, 5
  11157. Interleave the lower field from odd frames with the upper field from
  11158. even frames, generating a frame with unchanged height at half frame rate.
  11159. @example
  11160. ------> time
  11161. Input:
  11162. Frame 1 Frame 2 Frame 3 Frame 4
  11163. 11111 22222<- 33333 44444<-
  11164. 11111<- 22222 33333<- 44444
  11165. 11111 22222<- 33333 44444<-
  11166. 11111<- 22222 33333<- 44444
  11167. Output:
  11168. 22222 44444
  11169. 11111 33333
  11170. 22222 44444
  11171. 11111 33333
  11172. @end example
  11173. @item interlacex2, 6
  11174. Double frame rate with unchanged height. Frames are inserted each
  11175. containing the second temporal field from the previous input frame and
  11176. the first temporal field from the next input frame. This mode relies on
  11177. the top_field_first flag. Useful for interlaced video displays with no
  11178. field synchronisation.
  11179. @example
  11180. ------> time
  11181. Input:
  11182. Frame 1 Frame 2 Frame 3 Frame 4
  11183. 11111 22222 33333 44444
  11184. 11111 22222 33333 44444
  11185. 11111 22222 33333 44444
  11186. 11111 22222 33333 44444
  11187. Output:
  11188. 11111 22222 22222 33333 33333 44444 44444
  11189. 11111 11111 22222 22222 33333 33333 44444
  11190. 11111 22222 22222 33333 33333 44444 44444
  11191. 11111 11111 22222 22222 33333 33333 44444
  11192. @end example
  11193. @item mergex2, 7
  11194. Move odd frames into the upper field, even into the lower field,
  11195. generating a double height frame at same frame rate.
  11196. @example
  11197. ------> time
  11198. Input:
  11199. Frame 1 Frame 2 Frame 3 Frame 4
  11200. 11111 22222 33333 44444
  11201. 11111 22222 33333 44444
  11202. 11111 22222 33333 44444
  11203. 11111 22222 33333 44444
  11204. Output:
  11205. 11111 33333 33333 55555
  11206. 22222 22222 44444 44444
  11207. 11111 33333 33333 55555
  11208. 22222 22222 44444 44444
  11209. 11111 33333 33333 55555
  11210. 22222 22222 44444 44444
  11211. 11111 33333 33333 55555
  11212. 22222 22222 44444 44444
  11213. @end example
  11214. @end table
  11215. Numeric values are deprecated but are accepted for backward
  11216. compatibility reasons.
  11217. Default mode is @code{merge}.
  11218. @item flags
  11219. Specify flags influencing the filter process.
  11220. Available value for @var{flags} is:
  11221. @table @option
  11222. @item low_pass_filter, vlfp
  11223. Enable linear vertical low-pass filtering in the filter.
  11224. Vertical low-pass filtering is required when creating an interlaced
  11225. destination from a progressive source which contains high-frequency
  11226. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  11227. patterning.
  11228. @item complex_filter, cvlfp
  11229. Enable complex vertical low-pass filtering.
  11230. This will slightly less reduce interlace 'twitter' and Moire
  11231. patterning but better retain detail and subjective sharpness impression.
  11232. @end table
  11233. Vertical low-pass filtering can only be enabled for @option{mode}
  11234. @var{interleave_top} and @var{interleave_bottom}.
  11235. @end table
  11236. @section tonemap
  11237. Tone map colors from different dynamic ranges.
  11238. This filter expects data in single precision floating point, as it needs to
  11239. operate on (and can output) out-of-range values. Another filter, such as
  11240. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  11241. The tonemapping algorithms implemented only work on linear light, so input
  11242. data should be linearized beforehand (and possibly correctly tagged).
  11243. @example
  11244. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  11245. @end example
  11246. @subsection Options
  11247. The filter accepts the following options.
  11248. @table @option
  11249. @item tonemap
  11250. Set the tone map algorithm to use.
  11251. Possible values are:
  11252. @table @var
  11253. @item none
  11254. Do not apply any tone map, only desaturate overbright pixels.
  11255. @item clip
  11256. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  11257. in-range values, while distorting out-of-range values.
  11258. @item linear
  11259. Stretch the entire reference gamut to a linear multiple of the display.
  11260. @item gamma
  11261. Fit a logarithmic transfer between the tone curves.
  11262. @item reinhard
  11263. Preserve overall image brightness with a simple curve, using nonlinear
  11264. contrast, which results in flattening details and degrading color accuracy.
  11265. @item hable
  11266. Preserve both dark and bright details better than @var{reinhard}, at the cost
  11267. of slightly darkening everything. Use it when detail preservation is more
  11268. important than color and brightness accuracy.
  11269. @item mobius
  11270. Smoothly map out-of-range values, while retaining contrast and colors for
  11271. in-range material as much as possible. Use it when color accuracy is more
  11272. important than detail preservation.
  11273. @end table
  11274. Default is none.
  11275. @item param
  11276. Tune the tone mapping algorithm.
  11277. This affects the following algorithms:
  11278. @table @var
  11279. @item none
  11280. Ignored.
  11281. @item linear
  11282. Specifies the scale factor to use while stretching.
  11283. Default to 1.0.
  11284. @item gamma
  11285. Specifies the exponent of the function.
  11286. Default to 1.8.
  11287. @item clip
  11288. Specify an extra linear coefficient to multiply into the signal before clipping.
  11289. Default to 1.0.
  11290. @item reinhard
  11291. Specify the local contrast coefficient at the display peak.
  11292. Default to 0.5, which means that in-gamut values will be about half as bright
  11293. as when clipping.
  11294. @item hable
  11295. Ignored.
  11296. @item mobius
  11297. Specify the transition point from linear to mobius transform. Every value
  11298. below this point is guaranteed to be mapped 1:1. The higher the value, the
  11299. more accurate the result will be, at the cost of losing bright details.
  11300. Default to 0.3, which due to the steep initial slope still preserves in-range
  11301. colors fairly accurately.
  11302. @end table
  11303. @item desat
  11304. Apply desaturation for highlights that exceed this level of brightness. The
  11305. higher the parameter, the more color information will be preserved. This
  11306. setting helps prevent unnaturally blown-out colors for super-highlights, by
  11307. (smoothly) turning into white instead. This makes images feel more natural,
  11308. at the cost of reducing information about out-of-range colors.
  11309. The default of 2.0 is somewhat conservative and will mostly just apply to
  11310. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  11311. This option works only if the input frame has a supported color tag.
  11312. @item peak
  11313. Override signal/nominal/reference peak with this value. Useful when the
  11314. embedded peak information in display metadata is not reliable or when tone
  11315. mapping from a lower range to a higher range.
  11316. @end table
  11317. @section transpose
  11318. Transpose rows with columns in the input video and optionally flip it.
  11319. It accepts the following parameters:
  11320. @table @option
  11321. @item dir
  11322. Specify the transposition direction.
  11323. Can assume the following values:
  11324. @table @samp
  11325. @item 0, 4, cclock_flip
  11326. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  11327. @example
  11328. L.R L.l
  11329. . . -> . .
  11330. l.r R.r
  11331. @end example
  11332. @item 1, 5, clock
  11333. Rotate by 90 degrees clockwise, that is:
  11334. @example
  11335. L.R l.L
  11336. . . -> . .
  11337. l.r r.R
  11338. @end example
  11339. @item 2, 6, cclock
  11340. Rotate by 90 degrees counterclockwise, that is:
  11341. @example
  11342. L.R R.r
  11343. . . -> . .
  11344. l.r L.l
  11345. @end example
  11346. @item 3, 7, clock_flip
  11347. Rotate by 90 degrees clockwise and vertically flip, that is:
  11348. @example
  11349. L.R r.R
  11350. . . -> . .
  11351. l.r l.L
  11352. @end example
  11353. @end table
  11354. For values between 4-7, the transposition is only done if the input
  11355. video geometry is portrait and not landscape. These values are
  11356. deprecated, the @code{passthrough} option should be used instead.
  11357. Numerical values are deprecated, and should be dropped in favor of
  11358. symbolic constants.
  11359. @item passthrough
  11360. Do not apply the transposition if the input geometry matches the one
  11361. specified by the specified value. It accepts the following values:
  11362. @table @samp
  11363. @item none
  11364. Always apply transposition.
  11365. @item portrait
  11366. Preserve portrait geometry (when @var{height} >= @var{width}).
  11367. @item landscape
  11368. Preserve landscape geometry (when @var{width} >= @var{height}).
  11369. @end table
  11370. Default value is @code{none}.
  11371. @end table
  11372. For example to rotate by 90 degrees clockwise and preserve portrait
  11373. layout:
  11374. @example
  11375. transpose=dir=1:passthrough=portrait
  11376. @end example
  11377. The command above can also be specified as:
  11378. @example
  11379. transpose=1:portrait
  11380. @end example
  11381. @section trim
  11382. Trim the input so that the output contains one continuous subpart of the input.
  11383. It accepts the following parameters:
  11384. @table @option
  11385. @item start
  11386. Specify the time of the start of the kept section, i.e. the frame with the
  11387. timestamp @var{start} will be the first frame in the output.
  11388. @item end
  11389. Specify the time of the first frame that will be dropped, i.e. the frame
  11390. immediately preceding the one with the timestamp @var{end} will be the last
  11391. frame in the output.
  11392. @item start_pts
  11393. This is the same as @var{start}, except this option sets the start timestamp
  11394. in timebase units instead of seconds.
  11395. @item end_pts
  11396. This is the same as @var{end}, except this option sets the end timestamp
  11397. in timebase units instead of seconds.
  11398. @item duration
  11399. The maximum duration of the output in seconds.
  11400. @item start_frame
  11401. The number of the first frame that should be passed to the output.
  11402. @item end_frame
  11403. The number of the first frame that should be dropped.
  11404. @end table
  11405. @option{start}, @option{end}, and @option{duration} are expressed as time
  11406. duration specifications; see
  11407. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11408. for the accepted syntax.
  11409. Note that the first two sets of the start/end options and the @option{duration}
  11410. option look at the frame timestamp, while the _frame variants simply count the
  11411. frames that pass through the filter. Also note that this filter does not modify
  11412. the timestamps. If you wish for the output timestamps to start at zero, insert a
  11413. setpts filter after the trim filter.
  11414. If multiple start or end options are set, this filter tries to be greedy and
  11415. keep all the frames that match at least one of the specified constraints. To keep
  11416. only the part that matches all the constraints at once, chain multiple trim
  11417. filters.
  11418. The defaults are such that all the input is kept. So it is possible to set e.g.
  11419. just the end values to keep everything before the specified time.
  11420. Examples:
  11421. @itemize
  11422. @item
  11423. Drop everything except the second minute of input:
  11424. @example
  11425. ffmpeg -i INPUT -vf trim=60:120
  11426. @end example
  11427. @item
  11428. Keep only the first second:
  11429. @example
  11430. ffmpeg -i INPUT -vf trim=duration=1
  11431. @end example
  11432. @end itemize
  11433. @section unpremultiply
  11434. Apply alpha unpremultiply effect to input video stream using first plane
  11435. of second stream as alpha.
  11436. Both streams must have same dimensions and same pixel format.
  11437. The filter accepts the following option:
  11438. @table @option
  11439. @item planes
  11440. Set which planes will be processed, unprocessed planes will be copied.
  11441. By default value 0xf, all planes will be processed.
  11442. If the format has 1 or 2 components, then luma is bit 0.
  11443. If the format has 3 or 4 components:
  11444. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  11445. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  11446. If present, the alpha channel is always the last bit.
  11447. @item inplace
  11448. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11449. @end table
  11450. @anchor{unsharp}
  11451. @section unsharp
  11452. Sharpen or blur the input video.
  11453. It accepts the following parameters:
  11454. @table @option
  11455. @item luma_msize_x, lx
  11456. Set the luma matrix horizontal size. It must be an odd integer between
  11457. 3 and 23. The default value is 5.
  11458. @item luma_msize_y, ly
  11459. Set the luma matrix vertical size. It must be an odd integer between 3
  11460. and 23. The default value is 5.
  11461. @item luma_amount, la
  11462. Set the luma effect strength. It must be a floating point number, reasonable
  11463. values lay between -1.5 and 1.5.
  11464. Negative values will blur the input video, while positive values will
  11465. sharpen it, a value of zero will disable the effect.
  11466. Default value is 1.0.
  11467. @item chroma_msize_x, cx
  11468. Set the chroma matrix horizontal size. It must be an odd integer
  11469. between 3 and 23. The default value is 5.
  11470. @item chroma_msize_y, cy
  11471. Set the chroma matrix vertical size. It must be an odd integer
  11472. between 3 and 23. The default value is 5.
  11473. @item chroma_amount, ca
  11474. Set the chroma effect strength. It must be a floating point number, reasonable
  11475. values lay between -1.5 and 1.5.
  11476. Negative values will blur the input video, while positive values will
  11477. sharpen it, a value of zero will disable the effect.
  11478. Default value is 0.0.
  11479. @end table
  11480. All parameters are optional and default to the equivalent of the
  11481. string '5:5:1.0:5:5:0.0'.
  11482. @subsection Examples
  11483. @itemize
  11484. @item
  11485. Apply strong luma sharpen effect:
  11486. @example
  11487. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  11488. @end example
  11489. @item
  11490. Apply a strong blur of both luma and chroma parameters:
  11491. @example
  11492. unsharp=7:7:-2:7:7:-2
  11493. @end example
  11494. @end itemize
  11495. @section uspp
  11496. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  11497. the image at several (or - in the case of @option{quality} level @code{8} - all)
  11498. shifts and average the results.
  11499. The way this differs from the behavior of spp is that uspp actually encodes &
  11500. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  11501. DCT similar to MJPEG.
  11502. The filter accepts the following options:
  11503. @table @option
  11504. @item quality
  11505. Set quality. This option defines the number of levels for averaging. It accepts
  11506. an integer in the range 0-8. If set to @code{0}, the filter will have no
  11507. effect. A value of @code{8} means the higher quality. For each increment of
  11508. that value the speed drops by a factor of approximately 2. Default value is
  11509. @code{3}.
  11510. @item qp
  11511. Force a constant quantization parameter. If not set, the filter will use the QP
  11512. from the video stream (if available).
  11513. @end table
  11514. @section vaguedenoiser
  11515. Apply a wavelet based denoiser.
  11516. It transforms each frame from the video input into the wavelet domain,
  11517. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  11518. the obtained coefficients. It does an inverse wavelet transform after.
  11519. Due to wavelet properties, it should give a nice smoothed result, and
  11520. reduced noise, without blurring picture features.
  11521. This filter accepts the following options:
  11522. @table @option
  11523. @item threshold
  11524. The filtering strength. The higher, the more filtered the video will be.
  11525. Hard thresholding can use a higher threshold than soft thresholding
  11526. before the video looks overfiltered. Default value is 2.
  11527. @item method
  11528. The filtering method the filter will use.
  11529. It accepts the following values:
  11530. @table @samp
  11531. @item hard
  11532. All values under the threshold will be zeroed.
  11533. @item soft
  11534. All values under the threshold will be zeroed. All values above will be
  11535. reduced by the threshold.
  11536. @item garrote
  11537. Scales or nullifies coefficients - intermediary between (more) soft and
  11538. (less) hard thresholding.
  11539. @end table
  11540. Default is garrote.
  11541. @item nsteps
  11542. Number of times, the wavelet will decompose the picture. Picture can't
  11543. be decomposed beyond a particular point (typically, 8 for a 640x480
  11544. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  11545. @item percent
  11546. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  11547. @item planes
  11548. A list of the planes to process. By default all planes are processed.
  11549. @end table
  11550. @section vectorscope
  11551. Display 2 color component values in the two dimensional graph (which is called
  11552. a vectorscope).
  11553. This filter accepts the following options:
  11554. @table @option
  11555. @item mode, m
  11556. Set vectorscope mode.
  11557. It accepts the following values:
  11558. @table @samp
  11559. @item gray
  11560. Gray values are displayed on graph, higher brightness means more pixels have
  11561. same component color value on location in graph. This is the default mode.
  11562. @item color
  11563. Gray values are displayed on graph. Surrounding pixels values which are not
  11564. present in video frame are drawn in gradient of 2 color components which are
  11565. set by option @code{x} and @code{y}. The 3rd color component is static.
  11566. @item color2
  11567. Actual color components values present in video frame are displayed on graph.
  11568. @item color3
  11569. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  11570. on graph increases value of another color component, which is luminance by
  11571. default values of @code{x} and @code{y}.
  11572. @item color4
  11573. Actual colors present in video frame are displayed on graph. If two different
  11574. colors map to same position on graph then color with higher value of component
  11575. not present in graph is picked.
  11576. @item color5
  11577. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  11578. component picked from radial gradient.
  11579. @end table
  11580. @item x
  11581. Set which color component will be represented on X-axis. Default is @code{1}.
  11582. @item y
  11583. Set which color component will be represented on Y-axis. Default is @code{2}.
  11584. @item intensity, i
  11585. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  11586. of color component which represents frequency of (X, Y) location in graph.
  11587. @item envelope, e
  11588. @table @samp
  11589. @item none
  11590. No envelope, this is default.
  11591. @item instant
  11592. Instant envelope, even darkest single pixel will be clearly highlighted.
  11593. @item peak
  11594. Hold maximum and minimum values presented in graph over time. This way you
  11595. can still spot out of range values without constantly looking at vectorscope.
  11596. @item peak+instant
  11597. Peak and instant envelope combined together.
  11598. @end table
  11599. @item graticule, g
  11600. Set what kind of graticule to draw.
  11601. @table @samp
  11602. @item none
  11603. @item green
  11604. @item color
  11605. @end table
  11606. @item opacity, o
  11607. Set graticule opacity.
  11608. @item flags, f
  11609. Set graticule flags.
  11610. @table @samp
  11611. @item white
  11612. Draw graticule for white point.
  11613. @item black
  11614. Draw graticule for black point.
  11615. @item name
  11616. Draw color points short names.
  11617. @end table
  11618. @item bgopacity, b
  11619. Set background opacity.
  11620. @item lthreshold, l
  11621. Set low threshold for color component not represented on X or Y axis.
  11622. Values lower than this value will be ignored. Default is 0.
  11623. Note this value is multiplied with actual max possible value one pixel component
  11624. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  11625. is 0.1 * 255 = 25.
  11626. @item hthreshold, h
  11627. Set high threshold for color component not represented on X or Y axis.
  11628. Values higher than this value will be ignored. Default is 1.
  11629. Note this value is multiplied with actual max possible value one pixel component
  11630. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  11631. is 0.9 * 255 = 230.
  11632. @item colorspace, c
  11633. Set what kind of colorspace to use when drawing graticule.
  11634. @table @samp
  11635. @item auto
  11636. @item 601
  11637. @item 709
  11638. @end table
  11639. Default is auto.
  11640. @end table
  11641. @anchor{vidstabdetect}
  11642. @section vidstabdetect
  11643. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  11644. @ref{vidstabtransform} for pass 2.
  11645. This filter generates a file with relative translation and rotation
  11646. transform information about subsequent frames, which is then used by
  11647. the @ref{vidstabtransform} filter.
  11648. To enable compilation of this filter you need to configure FFmpeg with
  11649. @code{--enable-libvidstab}.
  11650. This filter accepts the following options:
  11651. @table @option
  11652. @item result
  11653. Set the path to the file used to write the transforms information.
  11654. Default value is @file{transforms.trf}.
  11655. @item shakiness
  11656. Set how shaky the video is and how quick the camera is. It accepts an
  11657. integer in the range 1-10, a value of 1 means little shakiness, a
  11658. value of 10 means strong shakiness. Default value is 5.
  11659. @item accuracy
  11660. Set the accuracy of the detection process. It must be a value in the
  11661. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  11662. accuracy. Default value is 15.
  11663. @item stepsize
  11664. Set stepsize of the search process. The region around minimum is
  11665. scanned with 1 pixel resolution. Default value is 6.
  11666. @item mincontrast
  11667. Set minimum contrast. Below this value a local measurement field is
  11668. discarded. Must be a floating point value in the range 0-1. Default
  11669. value is 0.3.
  11670. @item tripod
  11671. Set reference frame number for tripod mode.
  11672. If enabled, the motion of the frames is compared to a reference frame
  11673. in the filtered stream, identified by the specified number. The idea
  11674. is to compensate all movements in a more-or-less static scene and keep
  11675. the camera view absolutely still.
  11676. If set to 0, it is disabled. The frames are counted starting from 1.
  11677. @item show
  11678. Show fields and transforms in the resulting frames. It accepts an
  11679. integer in the range 0-2. Default value is 0, which disables any
  11680. visualization.
  11681. @end table
  11682. @subsection Examples
  11683. @itemize
  11684. @item
  11685. Use default values:
  11686. @example
  11687. vidstabdetect
  11688. @end example
  11689. @item
  11690. Analyze strongly shaky movie and put the results in file
  11691. @file{mytransforms.trf}:
  11692. @example
  11693. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  11694. @end example
  11695. @item
  11696. Visualize the result of internal transformations in the resulting
  11697. video:
  11698. @example
  11699. vidstabdetect=show=1
  11700. @end example
  11701. @item
  11702. Analyze a video with medium shakiness using @command{ffmpeg}:
  11703. @example
  11704. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  11705. @end example
  11706. @end itemize
  11707. @anchor{vidstabtransform}
  11708. @section vidstabtransform
  11709. Video stabilization/deshaking: pass 2 of 2,
  11710. see @ref{vidstabdetect} for pass 1.
  11711. Read a file with transform information for each frame and
  11712. apply/compensate them. Together with the @ref{vidstabdetect}
  11713. filter this can be used to deshake videos. See also
  11714. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  11715. the @ref{unsharp} filter, see below.
  11716. To enable compilation of this filter you need to configure FFmpeg with
  11717. @code{--enable-libvidstab}.
  11718. @subsection Options
  11719. @table @option
  11720. @item input
  11721. Set path to the file used to read the transforms. Default value is
  11722. @file{transforms.trf}.
  11723. @item smoothing
  11724. Set the number of frames (value*2 + 1) used for lowpass filtering the
  11725. camera movements. Default value is 10.
  11726. For example a number of 10 means that 21 frames are used (10 in the
  11727. past and 10 in the future) to smoothen the motion in the video. A
  11728. larger value leads to a smoother video, but limits the acceleration of
  11729. the camera (pan/tilt movements). 0 is a special case where a static
  11730. camera is simulated.
  11731. @item optalgo
  11732. Set the camera path optimization algorithm.
  11733. Accepted values are:
  11734. @table @samp
  11735. @item gauss
  11736. gaussian kernel low-pass filter on camera motion (default)
  11737. @item avg
  11738. averaging on transformations
  11739. @end table
  11740. @item maxshift
  11741. Set maximal number of pixels to translate frames. Default value is -1,
  11742. meaning no limit.
  11743. @item maxangle
  11744. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  11745. value is -1, meaning no limit.
  11746. @item crop
  11747. Specify how to deal with borders that may be visible due to movement
  11748. compensation.
  11749. Available values are:
  11750. @table @samp
  11751. @item keep
  11752. keep image information from previous frame (default)
  11753. @item black
  11754. fill the border black
  11755. @end table
  11756. @item invert
  11757. Invert transforms if set to 1. Default value is 0.
  11758. @item relative
  11759. Consider transforms as relative to previous frame if set to 1,
  11760. absolute if set to 0. Default value is 0.
  11761. @item zoom
  11762. Set percentage to zoom. A positive value will result in a zoom-in
  11763. effect, a negative value in a zoom-out effect. Default value is 0 (no
  11764. zoom).
  11765. @item optzoom
  11766. Set optimal zooming to avoid borders.
  11767. Accepted values are:
  11768. @table @samp
  11769. @item 0
  11770. disabled
  11771. @item 1
  11772. optimal static zoom value is determined (only very strong movements
  11773. will lead to visible borders) (default)
  11774. @item 2
  11775. optimal adaptive zoom value is determined (no borders will be
  11776. visible), see @option{zoomspeed}
  11777. @end table
  11778. Note that the value given at zoom is added to the one calculated here.
  11779. @item zoomspeed
  11780. Set percent to zoom maximally each frame (enabled when
  11781. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  11782. 0.25.
  11783. @item interpol
  11784. Specify type of interpolation.
  11785. Available values are:
  11786. @table @samp
  11787. @item no
  11788. no interpolation
  11789. @item linear
  11790. linear only horizontal
  11791. @item bilinear
  11792. linear in both directions (default)
  11793. @item bicubic
  11794. cubic in both directions (slow)
  11795. @end table
  11796. @item tripod
  11797. Enable virtual tripod mode if set to 1, which is equivalent to
  11798. @code{relative=0:smoothing=0}. Default value is 0.
  11799. Use also @code{tripod} option of @ref{vidstabdetect}.
  11800. @item debug
  11801. Increase log verbosity if set to 1. Also the detected global motions
  11802. are written to the temporary file @file{global_motions.trf}. Default
  11803. value is 0.
  11804. @end table
  11805. @subsection Examples
  11806. @itemize
  11807. @item
  11808. Use @command{ffmpeg} for a typical stabilization with default values:
  11809. @example
  11810. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  11811. @end example
  11812. Note the use of the @ref{unsharp} filter which is always recommended.
  11813. @item
  11814. Zoom in a bit more and load transform data from a given file:
  11815. @example
  11816. vidstabtransform=zoom=5:input="mytransforms.trf"
  11817. @end example
  11818. @item
  11819. Smoothen the video even more:
  11820. @example
  11821. vidstabtransform=smoothing=30
  11822. @end example
  11823. @end itemize
  11824. @section vflip
  11825. Flip the input video vertically.
  11826. For example, to vertically flip a video with @command{ffmpeg}:
  11827. @example
  11828. ffmpeg -i in.avi -vf "vflip" out.avi
  11829. @end example
  11830. @anchor{vignette}
  11831. @section vignette
  11832. Make or reverse a natural vignetting effect.
  11833. The filter accepts the following options:
  11834. @table @option
  11835. @item angle, a
  11836. Set lens angle expression as a number of radians.
  11837. The value is clipped in the @code{[0,PI/2]} range.
  11838. Default value: @code{"PI/5"}
  11839. @item x0
  11840. @item y0
  11841. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  11842. by default.
  11843. @item mode
  11844. Set forward/backward mode.
  11845. Available modes are:
  11846. @table @samp
  11847. @item forward
  11848. The larger the distance from the central point, the darker the image becomes.
  11849. @item backward
  11850. The larger the distance from the central point, the brighter the image becomes.
  11851. This can be used to reverse a vignette effect, though there is no automatic
  11852. detection to extract the lens @option{angle} and other settings (yet). It can
  11853. also be used to create a burning effect.
  11854. @end table
  11855. Default value is @samp{forward}.
  11856. @item eval
  11857. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  11858. It accepts the following values:
  11859. @table @samp
  11860. @item init
  11861. Evaluate expressions only once during the filter initialization.
  11862. @item frame
  11863. Evaluate expressions for each incoming frame. This is way slower than the
  11864. @samp{init} mode since it requires all the scalers to be re-computed, but it
  11865. allows advanced dynamic expressions.
  11866. @end table
  11867. Default value is @samp{init}.
  11868. @item dither
  11869. Set dithering to reduce the circular banding effects. Default is @code{1}
  11870. (enabled).
  11871. @item aspect
  11872. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  11873. Setting this value to the SAR of the input will make a rectangular vignetting
  11874. following the dimensions of the video.
  11875. Default is @code{1/1}.
  11876. @end table
  11877. @subsection Expressions
  11878. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  11879. following parameters.
  11880. @table @option
  11881. @item w
  11882. @item h
  11883. input width and height
  11884. @item n
  11885. the number of input frame, starting from 0
  11886. @item pts
  11887. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  11888. @var{TB} units, NAN if undefined
  11889. @item r
  11890. frame rate of the input video, NAN if the input frame rate is unknown
  11891. @item t
  11892. the PTS (Presentation TimeStamp) of the filtered video frame,
  11893. expressed in seconds, NAN if undefined
  11894. @item tb
  11895. time base of the input video
  11896. @end table
  11897. @subsection Examples
  11898. @itemize
  11899. @item
  11900. Apply simple strong vignetting effect:
  11901. @example
  11902. vignette=PI/4
  11903. @end example
  11904. @item
  11905. Make a flickering vignetting:
  11906. @example
  11907. vignette='PI/4+random(1)*PI/50':eval=frame
  11908. @end example
  11909. @end itemize
  11910. @section vmafmotion
  11911. Obtain the average vmaf motion score of a video.
  11912. It is one of the component filters of VMAF.
  11913. The obtained average motion score is printed through the logging system.
  11914. In the below example the input file @file{ref.mpg} is being processed and score
  11915. is computed.
  11916. @example
  11917. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  11918. @end example
  11919. @section vstack
  11920. Stack input videos vertically.
  11921. All streams must be of same pixel format and of same width.
  11922. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  11923. to create same output.
  11924. The filter accept the following option:
  11925. @table @option
  11926. @item inputs
  11927. Set number of input streams. Default is 2.
  11928. @item shortest
  11929. If set to 1, force the output to terminate when the shortest input
  11930. terminates. Default value is 0.
  11931. @end table
  11932. @section w3fdif
  11933. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  11934. Deinterlacing Filter").
  11935. Based on the process described by Martin Weston for BBC R&D, and
  11936. implemented based on the de-interlace algorithm written by Jim
  11937. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  11938. uses filter coefficients calculated by BBC R&D.
  11939. There are two sets of filter coefficients, so called "simple":
  11940. and "complex". Which set of filter coefficients is used can
  11941. be set by passing an optional parameter:
  11942. @table @option
  11943. @item filter
  11944. Set the interlacing filter coefficients. Accepts one of the following values:
  11945. @table @samp
  11946. @item simple
  11947. Simple filter coefficient set.
  11948. @item complex
  11949. More-complex filter coefficient set.
  11950. @end table
  11951. Default value is @samp{complex}.
  11952. @item deint
  11953. Specify which frames to deinterlace. Accept one of the following values:
  11954. @table @samp
  11955. @item all
  11956. Deinterlace all frames,
  11957. @item interlaced
  11958. Only deinterlace frames marked as interlaced.
  11959. @end table
  11960. Default value is @samp{all}.
  11961. @end table
  11962. @section waveform
  11963. Video waveform monitor.
  11964. The waveform monitor plots color component intensity. By default luminance
  11965. only. Each column of the waveform corresponds to a column of pixels in the
  11966. source video.
  11967. It accepts the following options:
  11968. @table @option
  11969. @item mode, m
  11970. Can be either @code{row}, or @code{column}. Default is @code{column}.
  11971. In row mode, the graph on the left side represents color component value 0 and
  11972. the right side represents value = 255. In column mode, the top side represents
  11973. color component value = 0 and bottom side represents value = 255.
  11974. @item intensity, i
  11975. Set intensity. Smaller values are useful to find out how many values of the same
  11976. luminance are distributed across input rows/columns.
  11977. Default value is @code{0.04}. Allowed range is [0, 1].
  11978. @item mirror, r
  11979. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  11980. In mirrored mode, higher values will be represented on the left
  11981. side for @code{row} mode and at the top for @code{column} mode. Default is
  11982. @code{1} (mirrored).
  11983. @item display, d
  11984. Set display mode.
  11985. It accepts the following values:
  11986. @table @samp
  11987. @item overlay
  11988. Presents information identical to that in the @code{parade}, except
  11989. that the graphs representing color components are superimposed directly
  11990. over one another.
  11991. This display mode makes it easier to spot relative differences or similarities
  11992. in overlapping areas of the color components that are supposed to be identical,
  11993. such as neutral whites, grays, or blacks.
  11994. @item stack
  11995. Display separate graph for the color components side by side in
  11996. @code{row} mode or one below the other in @code{column} mode.
  11997. @item parade
  11998. Display separate graph for the color components side by side in
  11999. @code{column} mode or one below the other in @code{row} mode.
  12000. Using this display mode makes it easy to spot color casts in the highlights
  12001. and shadows of an image, by comparing the contours of the top and the bottom
  12002. graphs of each waveform. Since whites, grays, and blacks are characterized
  12003. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  12004. should display three waveforms of roughly equal width/height. If not, the
  12005. correction is easy to perform by making level adjustments the three waveforms.
  12006. @end table
  12007. Default is @code{stack}.
  12008. @item components, c
  12009. Set which color components to display. Default is 1, which means only luminance
  12010. or red color component if input is in RGB colorspace. If is set for example to
  12011. 7 it will display all 3 (if) available color components.
  12012. @item envelope, e
  12013. @table @samp
  12014. @item none
  12015. No envelope, this is default.
  12016. @item instant
  12017. Instant envelope, minimum and maximum values presented in graph will be easily
  12018. visible even with small @code{step} value.
  12019. @item peak
  12020. Hold minimum and maximum values presented in graph across time. This way you
  12021. can still spot out of range values without constantly looking at waveforms.
  12022. @item peak+instant
  12023. Peak and instant envelope combined together.
  12024. @end table
  12025. @item filter, f
  12026. @table @samp
  12027. @item lowpass
  12028. No filtering, this is default.
  12029. @item flat
  12030. Luma and chroma combined together.
  12031. @item aflat
  12032. Similar as above, but shows difference between blue and red chroma.
  12033. @item chroma
  12034. Displays only chroma.
  12035. @item color
  12036. Displays actual color value on waveform.
  12037. @item acolor
  12038. Similar as above, but with luma showing frequency of chroma values.
  12039. @end table
  12040. @item graticule, g
  12041. Set which graticule to display.
  12042. @table @samp
  12043. @item none
  12044. Do not display graticule.
  12045. @item green
  12046. Display green graticule showing legal broadcast ranges.
  12047. @end table
  12048. @item opacity, o
  12049. Set graticule opacity.
  12050. @item flags, fl
  12051. Set graticule flags.
  12052. @table @samp
  12053. @item numbers
  12054. Draw numbers above lines. By default enabled.
  12055. @item dots
  12056. Draw dots instead of lines.
  12057. @end table
  12058. @item scale, s
  12059. Set scale used for displaying graticule.
  12060. @table @samp
  12061. @item digital
  12062. @item millivolts
  12063. @item ire
  12064. @end table
  12065. Default is digital.
  12066. @item bgopacity, b
  12067. Set background opacity.
  12068. @end table
  12069. @section weave, doubleweave
  12070. The @code{weave} takes a field-based video input and join
  12071. each two sequential fields into single frame, producing a new double
  12072. height clip with half the frame rate and half the frame count.
  12073. The @code{doubleweave} works same as @code{weave} but without
  12074. halving frame rate and frame count.
  12075. It accepts the following option:
  12076. @table @option
  12077. @item first_field
  12078. Set first field. Available values are:
  12079. @table @samp
  12080. @item top, t
  12081. Set the frame as top-field-first.
  12082. @item bottom, b
  12083. Set the frame as bottom-field-first.
  12084. @end table
  12085. @end table
  12086. @subsection Examples
  12087. @itemize
  12088. @item
  12089. Interlace video using @ref{select} and @ref{separatefields} filter:
  12090. @example
  12091. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  12092. @end example
  12093. @end itemize
  12094. @section xbr
  12095. Apply the xBR high-quality magnification filter which is designed for pixel
  12096. art. It follows a set of edge-detection rules, see
  12097. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  12098. It accepts the following option:
  12099. @table @option
  12100. @item n
  12101. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  12102. @code{3xBR} and @code{4} for @code{4xBR}.
  12103. Default is @code{3}.
  12104. @end table
  12105. @anchor{yadif}
  12106. @section yadif
  12107. Deinterlace the input video ("yadif" means "yet another deinterlacing
  12108. filter").
  12109. It accepts the following parameters:
  12110. @table @option
  12111. @item mode
  12112. The interlacing mode to adopt. It accepts one of the following values:
  12113. @table @option
  12114. @item 0, send_frame
  12115. Output one frame for each frame.
  12116. @item 1, send_field
  12117. Output one frame for each field.
  12118. @item 2, send_frame_nospatial
  12119. Like @code{send_frame}, but it skips the spatial interlacing check.
  12120. @item 3, send_field_nospatial
  12121. Like @code{send_field}, but it skips the spatial interlacing check.
  12122. @end table
  12123. The default value is @code{send_frame}.
  12124. @item parity
  12125. The picture field parity assumed for the input interlaced video. It accepts one
  12126. of the following values:
  12127. @table @option
  12128. @item 0, tff
  12129. Assume the top field is first.
  12130. @item 1, bff
  12131. Assume the bottom field is first.
  12132. @item -1, auto
  12133. Enable automatic detection of field parity.
  12134. @end table
  12135. The default value is @code{auto}.
  12136. If the interlacing is unknown or the decoder does not export this information,
  12137. top field first will be assumed.
  12138. @item deint
  12139. Specify which frames to deinterlace. Accept one of the following
  12140. values:
  12141. @table @option
  12142. @item 0, all
  12143. Deinterlace all frames.
  12144. @item 1, interlaced
  12145. Only deinterlace frames marked as interlaced.
  12146. @end table
  12147. The default value is @code{all}.
  12148. @end table
  12149. @section zoompan
  12150. Apply Zoom & Pan effect.
  12151. This filter accepts the following options:
  12152. @table @option
  12153. @item zoom, z
  12154. Set the zoom expression. Default is 1.
  12155. @item x
  12156. @item y
  12157. Set the x and y expression. Default is 0.
  12158. @item d
  12159. Set the duration expression in number of frames.
  12160. This sets for how many number of frames effect will last for
  12161. single input image.
  12162. @item s
  12163. Set the output image size, default is 'hd720'.
  12164. @item fps
  12165. Set the output frame rate, default is '25'.
  12166. @end table
  12167. Each expression can contain the following constants:
  12168. @table @option
  12169. @item in_w, iw
  12170. Input width.
  12171. @item in_h, ih
  12172. Input height.
  12173. @item out_w, ow
  12174. Output width.
  12175. @item out_h, oh
  12176. Output height.
  12177. @item in
  12178. Input frame count.
  12179. @item on
  12180. Output frame count.
  12181. @item x
  12182. @item y
  12183. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  12184. for current input frame.
  12185. @item px
  12186. @item py
  12187. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  12188. not yet such frame (first input frame).
  12189. @item zoom
  12190. Last calculated zoom from 'z' expression for current input frame.
  12191. @item pzoom
  12192. Last calculated zoom of last output frame of previous input frame.
  12193. @item duration
  12194. Number of output frames for current input frame. Calculated from 'd' expression
  12195. for each input frame.
  12196. @item pduration
  12197. number of output frames created for previous input frame
  12198. @item a
  12199. Rational number: input width / input height
  12200. @item sar
  12201. sample aspect ratio
  12202. @item dar
  12203. display aspect ratio
  12204. @end table
  12205. @subsection Examples
  12206. @itemize
  12207. @item
  12208. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  12209. @example
  12210. 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
  12211. @end example
  12212. @item
  12213. Zoom-in up to 1.5 and pan always at center of picture:
  12214. @example
  12215. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12216. @end example
  12217. @item
  12218. Same as above but without pausing:
  12219. @example
  12220. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12221. @end example
  12222. @end itemize
  12223. @anchor{zscale}
  12224. @section zscale
  12225. Scale (resize) the input video, using the z.lib library:
  12226. https://github.com/sekrit-twc/zimg.
  12227. The zscale filter forces the output display aspect ratio to be the same
  12228. as the input, by changing the output sample aspect ratio.
  12229. If the input image format is different from the format requested by
  12230. the next filter, the zscale filter will convert the input to the
  12231. requested format.
  12232. @subsection Options
  12233. The filter accepts the following options.
  12234. @table @option
  12235. @item width, w
  12236. @item height, h
  12237. Set the output video dimension expression. Default value is the input
  12238. dimension.
  12239. If the @var{width} or @var{w} value is 0, the input width is used for
  12240. the output. If the @var{height} or @var{h} value is 0, the input height
  12241. is used for the output.
  12242. If one and only one of the values is -n with n >= 1, the zscale filter
  12243. will use a value that maintains the aspect ratio of the input image,
  12244. calculated from the other specified dimension. After that it will,
  12245. however, make sure that the calculated dimension is divisible by n and
  12246. adjust the value if necessary.
  12247. If both values are -n with n >= 1, the behavior will be identical to
  12248. both values being set to 0 as previously detailed.
  12249. See below for the list of accepted constants for use in the dimension
  12250. expression.
  12251. @item size, s
  12252. Set the video size. For the syntax of this option, check the
  12253. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12254. @item dither, d
  12255. Set the dither type.
  12256. Possible values are:
  12257. @table @var
  12258. @item none
  12259. @item ordered
  12260. @item random
  12261. @item error_diffusion
  12262. @end table
  12263. Default is none.
  12264. @item filter, f
  12265. Set the resize filter type.
  12266. Possible values are:
  12267. @table @var
  12268. @item point
  12269. @item bilinear
  12270. @item bicubic
  12271. @item spline16
  12272. @item spline36
  12273. @item lanczos
  12274. @end table
  12275. Default is bilinear.
  12276. @item range, r
  12277. Set the color range.
  12278. Possible values are:
  12279. @table @var
  12280. @item input
  12281. @item limited
  12282. @item full
  12283. @end table
  12284. Default is same as input.
  12285. @item primaries, p
  12286. Set the color primaries.
  12287. Possible values are:
  12288. @table @var
  12289. @item input
  12290. @item 709
  12291. @item unspecified
  12292. @item 170m
  12293. @item 240m
  12294. @item 2020
  12295. @end table
  12296. Default is same as input.
  12297. @item transfer, t
  12298. Set the transfer characteristics.
  12299. Possible values are:
  12300. @table @var
  12301. @item input
  12302. @item 709
  12303. @item unspecified
  12304. @item 601
  12305. @item linear
  12306. @item 2020_10
  12307. @item 2020_12
  12308. @item smpte2084
  12309. @item iec61966-2-1
  12310. @item arib-std-b67
  12311. @end table
  12312. Default is same as input.
  12313. @item matrix, m
  12314. Set the colorspace matrix.
  12315. Possible value are:
  12316. @table @var
  12317. @item input
  12318. @item 709
  12319. @item unspecified
  12320. @item 470bg
  12321. @item 170m
  12322. @item 2020_ncl
  12323. @item 2020_cl
  12324. @end table
  12325. Default is same as input.
  12326. @item rangein, rin
  12327. Set the input color range.
  12328. Possible values are:
  12329. @table @var
  12330. @item input
  12331. @item limited
  12332. @item full
  12333. @end table
  12334. Default is same as input.
  12335. @item primariesin, pin
  12336. Set the input color primaries.
  12337. Possible values are:
  12338. @table @var
  12339. @item input
  12340. @item 709
  12341. @item unspecified
  12342. @item 170m
  12343. @item 240m
  12344. @item 2020
  12345. @end table
  12346. Default is same as input.
  12347. @item transferin, tin
  12348. Set the input transfer characteristics.
  12349. Possible values are:
  12350. @table @var
  12351. @item input
  12352. @item 709
  12353. @item unspecified
  12354. @item 601
  12355. @item linear
  12356. @item 2020_10
  12357. @item 2020_12
  12358. @end table
  12359. Default is same as input.
  12360. @item matrixin, min
  12361. Set the input colorspace matrix.
  12362. Possible value are:
  12363. @table @var
  12364. @item input
  12365. @item 709
  12366. @item unspecified
  12367. @item 470bg
  12368. @item 170m
  12369. @item 2020_ncl
  12370. @item 2020_cl
  12371. @end table
  12372. @item chromal, c
  12373. Set the output chroma location.
  12374. Possible values are:
  12375. @table @var
  12376. @item input
  12377. @item left
  12378. @item center
  12379. @item topleft
  12380. @item top
  12381. @item bottomleft
  12382. @item bottom
  12383. @end table
  12384. @item chromalin, cin
  12385. Set the input chroma location.
  12386. Possible values are:
  12387. @table @var
  12388. @item input
  12389. @item left
  12390. @item center
  12391. @item topleft
  12392. @item top
  12393. @item bottomleft
  12394. @item bottom
  12395. @end table
  12396. @item npl
  12397. Set the nominal peak luminance.
  12398. @end table
  12399. The values of the @option{w} and @option{h} options are expressions
  12400. containing the following constants:
  12401. @table @var
  12402. @item in_w
  12403. @item in_h
  12404. The input width and height
  12405. @item iw
  12406. @item ih
  12407. These are the same as @var{in_w} and @var{in_h}.
  12408. @item out_w
  12409. @item out_h
  12410. The output (scaled) width and height
  12411. @item ow
  12412. @item oh
  12413. These are the same as @var{out_w} and @var{out_h}
  12414. @item a
  12415. The same as @var{iw} / @var{ih}
  12416. @item sar
  12417. input sample aspect ratio
  12418. @item dar
  12419. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12420. @item hsub
  12421. @item vsub
  12422. horizontal and vertical input chroma subsample values. For example for the
  12423. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12424. @item ohsub
  12425. @item ovsub
  12426. horizontal and vertical output chroma subsample values. For example for the
  12427. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12428. @end table
  12429. @table @option
  12430. @end table
  12431. @c man end VIDEO FILTERS
  12432. @chapter Video Sources
  12433. @c man begin VIDEO SOURCES
  12434. Below is a description of the currently available video sources.
  12435. @section buffer
  12436. Buffer video frames, and make them available to the filter chain.
  12437. This source is mainly intended for a programmatic use, in particular
  12438. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  12439. It accepts the following parameters:
  12440. @table @option
  12441. @item video_size
  12442. Specify the size (width and height) of the buffered video frames. For the
  12443. syntax of this option, check the
  12444. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12445. @item width
  12446. The input video width.
  12447. @item height
  12448. The input video height.
  12449. @item pix_fmt
  12450. A string representing the pixel format of the buffered video frames.
  12451. It may be a number corresponding to a pixel format, or a pixel format
  12452. name.
  12453. @item time_base
  12454. Specify the timebase assumed by the timestamps of the buffered frames.
  12455. @item frame_rate
  12456. Specify the frame rate expected for the video stream.
  12457. @item pixel_aspect, sar
  12458. The sample (pixel) aspect ratio of the input video.
  12459. @item sws_param
  12460. Specify the optional parameters to be used for the scale filter which
  12461. is automatically inserted when an input change is detected in the
  12462. input size or format.
  12463. @item hw_frames_ctx
  12464. When using a hardware pixel format, this should be a reference to an
  12465. AVHWFramesContext describing input frames.
  12466. @end table
  12467. For example:
  12468. @example
  12469. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  12470. @end example
  12471. will instruct the source to accept video frames with size 320x240 and
  12472. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  12473. square pixels (1:1 sample aspect ratio).
  12474. Since the pixel format with name "yuv410p" corresponds to the number 6
  12475. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  12476. this example corresponds to:
  12477. @example
  12478. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  12479. @end example
  12480. Alternatively, the options can be specified as a flat string, but this
  12481. syntax is deprecated:
  12482. @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}]
  12483. @section cellauto
  12484. Create a pattern generated by an elementary cellular automaton.
  12485. The initial state of the cellular automaton can be defined through the
  12486. @option{filename} and @option{pattern} options. If such options are
  12487. not specified an initial state is created randomly.
  12488. At each new frame a new row in the video is filled with the result of
  12489. the cellular automaton next generation. The behavior when the whole
  12490. frame is filled is defined by the @option{scroll} option.
  12491. This source accepts the following options:
  12492. @table @option
  12493. @item filename, f
  12494. Read the initial cellular automaton state, i.e. the starting row, from
  12495. the specified file.
  12496. In the file, each non-whitespace character is considered an alive
  12497. cell, a newline will terminate the row, and further characters in the
  12498. file will be ignored.
  12499. @item pattern, p
  12500. Read the initial cellular automaton state, i.e. the starting row, from
  12501. the specified string.
  12502. Each non-whitespace character in the string is considered an alive
  12503. cell, a newline will terminate the row, and further characters in the
  12504. string will be ignored.
  12505. @item rate, r
  12506. Set the video rate, that is the number of frames generated per second.
  12507. Default is 25.
  12508. @item random_fill_ratio, ratio
  12509. Set the random fill ratio for the initial cellular automaton row. It
  12510. is a floating point number value ranging from 0 to 1, defaults to
  12511. 1/PHI.
  12512. This option is ignored when a file or a pattern is specified.
  12513. @item random_seed, seed
  12514. Set the seed for filling randomly the initial row, must be an integer
  12515. included between 0 and UINT32_MAX. If not specified, or if explicitly
  12516. set to -1, the filter will try to use a good random seed on a best
  12517. effort basis.
  12518. @item rule
  12519. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  12520. Default value is 110.
  12521. @item size, s
  12522. Set the size of the output video. For the syntax of this option, check the
  12523. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12524. If @option{filename} or @option{pattern} is specified, the size is set
  12525. by default to the width of the specified initial state row, and the
  12526. height is set to @var{width} * PHI.
  12527. If @option{size} is set, it must contain the width of the specified
  12528. pattern string, and the specified pattern will be centered in the
  12529. larger row.
  12530. If a filename or a pattern string is not specified, the size value
  12531. defaults to "320x518" (used for a randomly generated initial state).
  12532. @item scroll
  12533. If set to 1, scroll the output upward when all the rows in the output
  12534. have been already filled. If set to 0, the new generated row will be
  12535. written over the top row just after the bottom row is filled.
  12536. Defaults to 1.
  12537. @item start_full, full
  12538. If set to 1, completely fill the output with generated rows before
  12539. outputting the first frame.
  12540. This is the default behavior, for disabling set the value to 0.
  12541. @item stitch
  12542. If set to 1, stitch the left and right row edges together.
  12543. This is the default behavior, for disabling set the value to 0.
  12544. @end table
  12545. @subsection Examples
  12546. @itemize
  12547. @item
  12548. Read the initial state from @file{pattern}, and specify an output of
  12549. size 200x400.
  12550. @example
  12551. cellauto=f=pattern:s=200x400
  12552. @end example
  12553. @item
  12554. Generate a random initial row with a width of 200 cells, with a fill
  12555. ratio of 2/3:
  12556. @example
  12557. cellauto=ratio=2/3:s=200x200
  12558. @end example
  12559. @item
  12560. Create a pattern generated by rule 18 starting by a single alive cell
  12561. centered on an initial row with width 100:
  12562. @example
  12563. cellauto=p=@@:s=100x400:full=0:rule=18
  12564. @end example
  12565. @item
  12566. Specify a more elaborated initial pattern:
  12567. @example
  12568. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  12569. @end example
  12570. @end itemize
  12571. @anchor{coreimagesrc}
  12572. @section coreimagesrc
  12573. Video source generated on GPU using Apple's CoreImage API on OSX.
  12574. This video source is a specialized version of the @ref{coreimage} video filter.
  12575. Use a core image generator at the beginning of the applied filterchain to
  12576. generate the content.
  12577. The coreimagesrc video source accepts the following options:
  12578. @table @option
  12579. @item list_generators
  12580. List all available generators along with all their respective options as well as
  12581. possible minimum and maximum values along with the default values.
  12582. @example
  12583. list_generators=true
  12584. @end example
  12585. @item size, s
  12586. Specify the size of the sourced video. For the syntax of this option, check the
  12587. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12588. The default value is @code{320x240}.
  12589. @item rate, r
  12590. Specify the frame rate of the sourced video, as the number of frames
  12591. generated per second. It has to be a string in the format
  12592. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12593. number or a valid video frame rate abbreviation. The default value is
  12594. "25".
  12595. @item sar
  12596. Set the sample aspect ratio of the sourced video.
  12597. @item duration, d
  12598. Set the duration of the sourced video. See
  12599. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12600. for the accepted syntax.
  12601. If not specified, or the expressed duration is negative, the video is
  12602. supposed to be generated forever.
  12603. @end table
  12604. Additionally, all options of the @ref{coreimage} video filter are accepted.
  12605. A complete filterchain can be used for further processing of the
  12606. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  12607. and examples for details.
  12608. @subsection Examples
  12609. @itemize
  12610. @item
  12611. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  12612. given as complete and escaped command-line for Apple's standard bash shell:
  12613. @example
  12614. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  12615. @end example
  12616. This example is equivalent to the QRCode example of @ref{coreimage} without the
  12617. need for a nullsrc video source.
  12618. @end itemize
  12619. @section mandelbrot
  12620. Generate a Mandelbrot set fractal, and progressively zoom towards the
  12621. point specified with @var{start_x} and @var{start_y}.
  12622. This source accepts the following options:
  12623. @table @option
  12624. @item end_pts
  12625. Set the terminal pts value. Default value is 400.
  12626. @item end_scale
  12627. Set the terminal scale value.
  12628. Must be a floating point value. Default value is 0.3.
  12629. @item inner
  12630. Set the inner coloring mode, that is the algorithm used to draw the
  12631. Mandelbrot fractal internal region.
  12632. It shall assume one of the following values:
  12633. @table @option
  12634. @item black
  12635. Set black mode.
  12636. @item convergence
  12637. Show time until convergence.
  12638. @item mincol
  12639. Set color based on point closest to the origin of the iterations.
  12640. @item period
  12641. Set period mode.
  12642. @end table
  12643. Default value is @var{mincol}.
  12644. @item bailout
  12645. Set the bailout value. Default value is 10.0.
  12646. @item maxiter
  12647. Set the maximum of iterations performed by the rendering
  12648. algorithm. Default value is 7189.
  12649. @item outer
  12650. Set outer coloring mode.
  12651. It shall assume one of following values:
  12652. @table @option
  12653. @item iteration_count
  12654. Set iteration cound mode.
  12655. @item normalized_iteration_count
  12656. set normalized iteration count mode.
  12657. @end table
  12658. Default value is @var{normalized_iteration_count}.
  12659. @item rate, r
  12660. Set frame rate, expressed as number of frames per second. Default
  12661. value is "25".
  12662. @item size, s
  12663. Set frame size. For the syntax of this option, check the "Video
  12664. size" section in the ffmpeg-utils manual. Default value is "640x480".
  12665. @item start_scale
  12666. Set the initial scale value. Default value is 3.0.
  12667. @item start_x
  12668. Set the initial x position. Must be a floating point value between
  12669. -100 and 100. Default value is -0.743643887037158704752191506114774.
  12670. @item start_y
  12671. Set the initial y position. Must be a floating point value between
  12672. -100 and 100. Default value is -0.131825904205311970493132056385139.
  12673. @end table
  12674. @section mptestsrc
  12675. Generate various test patterns, as generated by the MPlayer test filter.
  12676. The size of the generated video is fixed, and is 256x256.
  12677. This source is useful in particular for testing encoding features.
  12678. This source accepts the following options:
  12679. @table @option
  12680. @item rate, r
  12681. Specify the frame rate of the sourced video, as the number of frames
  12682. generated per second. It has to be a string in the format
  12683. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12684. number or a valid video frame rate abbreviation. The default value is
  12685. "25".
  12686. @item duration, d
  12687. Set the duration of the sourced video. See
  12688. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12689. for the accepted syntax.
  12690. If not specified, or the expressed duration is negative, the video is
  12691. supposed to be generated forever.
  12692. @item test, t
  12693. Set the number or the name of the test to perform. Supported tests are:
  12694. @table @option
  12695. @item dc_luma
  12696. @item dc_chroma
  12697. @item freq_luma
  12698. @item freq_chroma
  12699. @item amp_luma
  12700. @item amp_chroma
  12701. @item cbp
  12702. @item mv
  12703. @item ring1
  12704. @item ring2
  12705. @item all
  12706. @end table
  12707. Default value is "all", which will cycle through the list of all tests.
  12708. @end table
  12709. Some examples:
  12710. @example
  12711. mptestsrc=t=dc_luma
  12712. @end example
  12713. will generate a "dc_luma" test pattern.
  12714. @section frei0r_src
  12715. Provide a frei0r source.
  12716. To enable compilation of this filter you need to install the frei0r
  12717. header and configure FFmpeg with @code{--enable-frei0r}.
  12718. This source accepts the following parameters:
  12719. @table @option
  12720. @item size
  12721. The size of the video to generate. For the syntax of this option, check the
  12722. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12723. @item framerate
  12724. The framerate of the generated video. It may be a string of the form
  12725. @var{num}/@var{den} or a frame rate abbreviation.
  12726. @item filter_name
  12727. The name to the frei0r source to load. For more information regarding frei0r and
  12728. how to set the parameters, read the @ref{frei0r} section in the video filters
  12729. documentation.
  12730. @item filter_params
  12731. A '|'-separated list of parameters to pass to the frei0r source.
  12732. @end table
  12733. For example, to generate a frei0r partik0l source with size 200x200
  12734. and frame rate 10 which is overlaid on the overlay filter main input:
  12735. @example
  12736. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  12737. @end example
  12738. @section life
  12739. Generate a life pattern.
  12740. This source is based on a generalization of John Conway's life game.
  12741. The sourced input represents a life grid, each pixel represents a cell
  12742. which can be in one of two possible states, alive or dead. Every cell
  12743. interacts with its eight neighbours, which are the cells that are
  12744. horizontally, vertically, or diagonally adjacent.
  12745. At each interaction the grid evolves according to the adopted rule,
  12746. which specifies the number of neighbor alive cells which will make a
  12747. cell stay alive or born. The @option{rule} option allows one to specify
  12748. the rule to adopt.
  12749. This source accepts the following options:
  12750. @table @option
  12751. @item filename, f
  12752. Set the file from which to read the initial grid state. In the file,
  12753. each non-whitespace character is considered an alive cell, and newline
  12754. is used to delimit the end of each row.
  12755. If this option is not specified, the initial grid is generated
  12756. randomly.
  12757. @item rate, r
  12758. Set the video rate, that is the number of frames generated per second.
  12759. Default is 25.
  12760. @item random_fill_ratio, ratio
  12761. Set the random fill ratio for the initial random grid. It is a
  12762. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  12763. It is ignored when a file is specified.
  12764. @item random_seed, seed
  12765. Set the seed for filling the initial random grid, must be an integer
  12766. included between 0 and UINT32_MAX. If not specified, or if explicitly
  12767. set to -1, the filter will try to use a good random seed on a best
  12768. effort basis.
  12769. @item rule
  12770. Set the life rule.
  12771. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  12772. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  12773. @var{NS} specifies the number of alive neighbor cells which make a
  12774. live cell stay alive, and @var{NB} the number of alive neighbor cells
  12775. which make a dead cell to become alive (i.e. to "born").
  12776. "s" and "b" can be used in place of "S" and "B", respectively.
  12777. Alternatively a rule can be specified by an 18-bits integer. The 9
  12778. high order bits are used to encode the next cell state if it is alive
  12779. for each number of neighbor alive cells, the low order bits specify
  12780. the rule for "borning" new cells. Higher order bits encode for an
  12781. higher number of neighbor cells.
  12782. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  12783. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  12784. Default value is "S23/B3", which is the original Conway's game of life
  12785. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  12786. cells, and will born a new cell if there are three alive cells around
  12787. a dead cell.
  12788. @item size, s
  12789. Set the size of the output video. For the syntax of this option, check the
  12790. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12791. If @option{filename} is specified, the size is set by default to the
  12792. same size of the input file. If @option{size} is set, it must contain
  12793. the size specified in the input file, and the initial grid defined in
  12794. that file is centered in the larger resulting area.
  12795. If a filename is not specified, the size value defaults to "320x240"
  12796. (used for a randomly generated initial grid).
  12797. @item stitch
  12798. If set to 1, stitch the left and right grid edges together, and the
  12799. top and bottom edges also. Defaults to 1.
  12800. @item mold
  12801. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  12802. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  12803. value from 0 to 255.
  12804. @item life_color
  12805. Set the color of living (or new born) cells.
  12806. @item death_color
  12807. Set the color of dead cells. If @option{mold} is set, this is the first color
  12808. used to represent a dead cell.
  12809. @item mold_color
  12810. Set mold color, for definitely dead and moldy cells.
  12811. For the syntax of these 3 color options, check the "Color" section in the
  12812. ffmpeg-utils manual.
  12813. @end table
  12814. @subsection Examples
  12815. @itemize
  12816. @item
  12817. Read a grid from @file{pattern}, and center it on a grid of size
  12818. 300x300 pixels:
  12819. @example
  12820. life=f=pattern:s=300x300
  12821. @end example
  12822. @item
  12823. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  12824. @example
  12825. life=ratio=2/3:s=200x200
  12826. @end example
  12827. @item
  12828. Specify a custom rule for evolving a randomly generated grid:
  12829. @example
  12830. life=rule=S14/B34
  12831. @end example
  12832. @item
  12833. Full example with slow death effect (mold) using @command{ffplay}:
  12834. @example
  12835. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  12836. @end example
  12837. @end itemize
  12838. @anchor{allrgb}
  12839. @anchor{allyuv}
  12840. @anchor{color}
  12841. @anchor{haldclutsrc}
  12842. @anchor{nullsrc}
  12843. @anchor{rgbtestsrc}
  12844. @anchor{smptebars}
  12845. @anchor{smptehdbars}
  12846. @anchor{testsrc}
  12847. @anchor{testsrc2}
  12848. @anchor{yuvtestsrc}
  12849. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  12850. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  12851. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  12852. The @code{color} source provides an uniformly colored input.
  12853. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  12854. @ref{haldclut} filter.
  12855. The @code{nullsrc} source returns unprocessed video frames. It is
  12856. mainly useful to be employed in analysis / debugging tools, or as the
  12857. source for filters which ignore the input data.
  12858. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  12859. detecting RGB vs BGR issues. You should see a red, green and blue
  12860. stripe from top to bottom.
  12861. The @code{smptebars} source generates a color bars pattern, based on
  12862. the SMPTE Engineering Guideline EG 1-1990.
  12863. The @code{smptehdbars} source generates a color bars pattern, based on
  12864. the SMPTE RP 219-2002.
  12865. The @code{testsrc} source generates a test video pattern, showing a
  12866. color pattern, a scrolling gradient and a timestamp. This is mainly
  12867. intended for testing purposes.
  12868. The @code{testsrc2} source is similar to testsrc, but supports more
  12869. pixel formats instead of just @code{rgb24}. This allows using it as an
  12870. input for other tests without requiring a format conversion.
  12871. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  12872. see a y, cb and cr stripe from top to bottom.
  12873. The sources accept the following parameters:
  12874. @table @option
  12875. @item alpha
  12876. Specify the alpha (opacity) of the background, only available in the
  12877. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  12878. 255 (fully opaque, the default).
  12879. @item color, c
  12880. Specify the color of the source, only available in the @code{color}
  12881. source. For the syntax of this option, check the "Color" section in the
  12882. ffmpeg-utils manual.
  12883. @item level
  12884. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  12885. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  12886. pixels to be used as identity matrix for 3D lookup tables. Each component is
  12887. coded on a @code{1/(N*N)} scale.
  12888. @item size, s
  12889. Specify the size of the sourced video. For the syntax of this option, check the
  12890. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12891. The default value is @code{320x240}.
  12892. This option is not available with the @code{haldclutsrc} filter.
  12893. @item rate, r
  12894. Specify the frame rate of the sourced video, as the number of frames
  12895. generated per second. It has to be a string in the format
  12896. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12897. number or a valid video frame rate abbreviation. The default value is
  12898. "25".
  12899. @item sar
  12900. Set the sample aspect ratio of the sourced video.
  12901. @item duration, d
  12902. Set the duration of the sourced video. See
  12903. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12904. for the accepted syntax.
  12905. If not specified, or the expressed duration is negative, the video is
  12906. supposed to be generated forever.
  12907. @item decimals, n
  12908. Set the number of decimals to show in the timestamp, only available in the
  12909. @code{testsrc} source.
  12910. The displayed timestamp value will correspond to the original
  12911. timestamp value multiplied by the power of 10 of the specified
  12912. value. Default value is 0.
  12913. @end table
  12914. For example the following:
  12915. @example
  12916. testsrc=duration=5.3:size=qcif:rate=10
  12917. @end example
  12918. will generate a video with a duration of 5.3 seconds, with size
  12919. 176x144 and a frame rate of 10 frames per second.
  12920. The following graph description will generate a red source
  12921. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  12922. frames per second.
  12923. @example
  12924. color=c=red@@0.2:s=qcif:r=10
  12925. @end example
  12926. If the input content is to be ignored, @code{nullsrc} can be used. The
  12927. following command generates noise in the luminance plane by employing
  12928. the @code{geq} filter:
  12929. @example
  12930. nullsrc=s=256x256, geq=random(1)*255:128:128
  12931. @end example
  12932. @subsection Commands
  12933. The @code{color} source supports the following commands:
  12934. @table @option
  12935. @item c, color
  12936. Set the color of the created image. Accepts the same syntax of the
  12937. corresponding @option{color} option.
  12938. @end table
  12939. @c man end VIDEO SOURCES
  12940. @chapter Video Sinks
  12941. @c man begin VIDEO SINKS
  12942. Below is a description of the currently available video sinks.
  12943. @section buffersink
  12944. Buffer video frames, and make them available to the end of the filter
  12945. graph.
  12946. This sink is mainly intended for programmatic use, in particular
  12947. through the interface defined in @file{libavfilter/buffersink.h}
  12948. or the options system.
  12949. It accepts a pointer to an AVBufferSinkContext structure, which
  12950. defines the incoming buffers' formats, to be passed as the opaque
  12951. parameter to @code{avfilter_init_filter} for initialization.
  12952. @section nullsink
  12953. Null video sink: do absolutely nothing with the input video. It is
  12954. mainly useful as a template and for use in analysis / debugging
  12955. tools.
  12956. @c man end VIDEO SINKS
  12957. @chapter Multimedia Filters
  12958. @c man begin MULTIMEDIA FILTERS
  12959. Below is a description of the currently available multimedia filters.
  12960. @section abitscope
  12961. Convert input audio to a video output, displaying the audio bit scope.
  12962. The filter accepts the following options:
  12963. @table @option
  12964. @item rate, r
  12965. Set frame rate, expressed as number of frames per second. Default
  12966. value is "25".
  12967. @item size, s
  12968. Specify the video size for the output. For the syntax of this option, check the
  12969. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12970. Default value is @code{1024x256}.
  12971. @item colors
  12972. Specify list of colors separated by space or by '|' which will be used to
  12973. draw channels. Unrecognized or missing colors will be replaced
  12974. by white color.
  12975. @end table
  12976. @section ahistogram
  12977. Convert input audio to a video output, displaying the volume histogram.
  12978. The filter accepts the following options:
  12979. @table @option
  12980. @item dmode
  12981. Specify how histogram is calculated.
  12982. It accepts the following values:
  12983. @table @samp
  12984. @item single
  12985. Use single histogram for all channels.
  12986. @item separate
  12987. Use separate histogram for each channel.
  12988. @end table
  12989. Default is @code{single}.
  12990. @item rate, r
  12991. Set frame rate, expressed as number of frames per second. Default
  12992. value is "25".
  12993. @item size, s
  12994. Specify the video size for the output. For the syntax of this option, check the
  12995. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12996. Default value is @code{hd720}.
  12997. @item scale
  12998. Set display scale.
  12999. It accepts the following values:
  13000. @table @samp
  13001. @item log
  13002. logarithmic
  13003. @item sqrt
  13004. square root
  13005. @item cbrt
  13006. cubic root
  13007. @item lin
  13008. linear
  13009. @item rlog
  13010. reverse logarithmic
  13011. @end table
  13012. Default is @code{log}.
  13013. @item ascale
  13014. Set amplitude scale.
  13015. It accepts the following values:
  13016. @table @samp
  13017. @item log
  13018. logarithmic
  13019. @item lin
  13020. linear
  13021. @end table
  13022. Default is @code{log}.
  13023. @item acount
  13024. Set how much frames to accumulate in histogram.
  13025. Defauls is 1. Setting this to -1 accumulates all frames.
  13026. @item rheight
  13027. Set histogram ratio of window height.
  13028. @item slide
  13029. Set sonogram sliding.
  13030. It accepts the following values:
  13031. @table @samp
  13032. @item replace
  13033. replace old rows with new ones.
  13034. @item scroll
  13035. scroll from top to bottom.
  13036. @end table
  13037. Default is @code{replace}.
  13038. @end table
  13039. @section aphasemeter
  13040. Convert input audio to a video output, displaying the audio phase.
  13041. The filter accepts the following options:
  13042. @table @option
  13043. @item rate, r
  13044. Set the output frame rate. Default value is @code{25}.
  13045. @item size, s
  13046. Set the video size for the output. For the syntax of this option, check the
  13047. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13048. Default value is @code{800x400}.
  13049. @item rc
  13050. @item gc
  13051. @item bc
  13052. Specify the red, green, blue contrast. Default values are @code{2},
  13053. @code{7} and @code{1}.
  13054. Allowed range is @code{[0, 255]}.
  13055. @item mpc
  13056. Set color which will be used for drawing median phase. If color is
  13057. @code{none} which is default, no median phase value will be drawn.
  13058. @item video
  13059. Enable video output. Default is enabled.
  13060. @end table
  13061. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  13062. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  13063. The @code{-1} means left and right channels are completely out of phase and
  13064. @code{1} means channels are in phase.
  13065. @section avectorscope
  13066. Convert input audio to a video output, representing the audio vector
  13067. scope.
  13068. The filter is used to measure the difference between channels of stereo
  13069. audio stream. A monoaural signal, consisting of identical left and right
  13070. signal, results in straight vertical line. Any stereo separation is visible
  13071. as a deviation from this line, creating a Lissajous figure.
  13072. If the straight (or deviation from it) but horizontal line appears this
  13073. indicates that the left and right channels are out of phase.
  13074. The filter accepts the following options:
  13075. @table @option
  13076. @item mode, m
  13077. Set the vectorscope mode.
  13078. Available values are:
  13079. @table @samp
  13080. @item lissajous
  13081. Lissajous rotated by 45 degrees.
  13082. @item lissajous_xy
  13083. Same as above but not rotated.
  13084. @item polar
  13085. Shape resembling half of circle.
  13086. @end table
  13087. Default value is @samp{lissajous}.
  13088. @item size, s
  13089. Set the video size for the output. For the syntax of this option, check the
  13090. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13091. Default value is @code{400x400}.
  13092. @item rate, r
  13093. Set the output frame rate. Default value is @code{25}.
  13094. @item rc
  13095. @item gc
  13096. @item bc
  13097. @item ac
  13098. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  13099. @code{160}, @code{80} and @code{255}.
  13100. Allowed range is @code{[0, 255]}.
  13101. @item rf
  13102. @item gf
  13103. @item bf
  13104. @item af
  13105. Specify the red, green, blue and alpha fade. Default values are @code{15},
  13106. @code{10}, @code{5} and @code{5}.
  13107. Allowed range is @code{[0, 255]}.
  13108. @item zoom
  13109. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  13110. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  13111. @item draw
  13112. Set the vectorscope drawing mode.
  13113. Available values are:
  13114. @table @samp
  13115. @item dot
  13116. Draw dot for each sample.
  13117. @item line
  13118. Draw line between previous and current sample.
  13119. @end table
  13120. Default value is @samp{dot}.
  13121. @item scale
  13122. Specify amplitude scale of audio samples.
  13123. Available values are:
  13124. @table @samp
  13125. @item lin
  13126. Linear.
  13127. @item sqrt
  13128. Square root.
  13129. @item cbrt
  13130. Cubic root.
  13131. @item log
  13132. Logarithmic.
  13133. @end table
  13134. @item swap
  13135. Swap left channel axis with right channel axis.
  13136. @item mirror
  13137. Mirror axis.
  13138. @table @samp
  13139. @item none
  13140. No mirror.
  13141. @item x
  13142. Mirror only x axis.
  13143. @item y
  13144. Mirror only y axis.
  13145. @item xy
  13146. Mirror both axis.
  13147. @end table
  13148. @end table
  13149. @subsection Examples
  13150. @itemize
  13151. @item
  13152. Complete example using @command{ffplay}:
  13153. @example
  13154. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  13155. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  13156. @end example
  13157. @end itemize
  13158. @section bench, abench
  13159. Benchmark part of a filtergraph.
  13160. The filter accepts the following options:
  13161. @table @option
  13162. @item action
  13163. Start or stop a timer.
  13164. Available values are:
  13165. @table @samp
  13166. @item start
  13167. Get the current time, set it as frame metadata (using the key
  13168. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  13169. @item stop
  13170. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  13171. the input frame metadata to get the time difference. Time difference, average,
  13172. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  13173. @code{min}) are then printed. The timestamps are expressed in seconds.
  13174. @end table
  13175. @end table
  13176. @subsection Examples
  13177. @itemize
  13178. @item
  13179. Benchmark @ref{selectivecolor} filter:
  13180. @example
  13181. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  13182. @end example
  13183. @end itemize
  13184. @section concat
  13185. Concatenate audio and video streams, joining them together one after the
  13186. other.
  13187. The filter works on segments of synchronized video and audio streams. All
  13188. segments must have the same number of streams of each type, and that will
  13189. also be the number of streams at output.
  13190. The filter accepts the following options:
  13191. @table @option
  13192. @item n
  13193. Set the number of segments. Default is 2.
  13194. @item v
  13195. Set the number of output video streams, that is also the number of video
  13196. streams in each segment. Default is 1.
  13197. @item a
  13198. Set the number of output audio streams, that is also the number of audio
  13199. streams in each segment. Default is 0.
  13200. @item unsafe
  13201. Activate unsafe mode: do not fail if segments have a different format.
  13202. @end table
  13203. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  13204. @var{a} audio outputs.
  13205. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  13206. segment, in the same order as the outputs, then the inputs for the second
  13207. segment, etc.
  13208. Related streams do not always have exactly the same duration, for various
  13209. reasons including codec frame size or sloppy authoring. For that reason,
  13210. related synchronized streams (e.g. a video and its audio track) should be
  13211. concatenated at once. The concat filter will use the duration of the longest
  13212. stream in each segment (except the last one), and if necessary pad shorter
  13213. audio streams with silence.
  13214. For this filter to work correctly, all segments must start at timestamp 0.
  13215. All corresponding streams must have the same parameters in all segments; the
  13216. filtering system will automatically select a common pixel format for video
  13217. streams, and a common sample format, sample rate and channel layout for
  13218. audio streams, but other settings, such as resolution, must be converted
  13219. explicitly by the user.
  13220. Different frame rates are acceptable but will result in variable frame rate
  13221. at output; be sure to configure the output file to handle it.
  13222. @subsection Examples
  13223. @itemize
  13224. @item
  13225. Concatenate an opening, an episode and an ending, all in bilingual version
  13226. (video in stream 0, audio in streams 1 and 2):
  13227. @example
  13228. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  13229. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  13230. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  13231. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  13232. @end example
  13233. @item
  13234. Concatenate two parts, handling audio and video separately, using the
  13235. (a)movie sources, and adjusting the resolution:
  13236. @example
  13237. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  13238. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  13239. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  13240. @end example
  13241. Note that a desync will happen at the stitch if the audio and video streams
  13242. do not have exactly the same duration in the first file.
  13243. @end itemize
  13244. @section drawgraph, adrawgraph
  13245. Draw a graph using input video or audio metadata.
  13246. It accepts the following parameters:
  13247. @table @option
  13248. @item m1
  13249. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  13250. @item fg1
  13251. Set 1st foreground color expression.
  13252. @item m2
  13253. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  13254. @item fg2
  13255. Set 2nd foreground color expression.
  13256. @item m3
  13257. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  13258. @item fg3
  13259. Set 3rd foreground color expression.
  13260. @item m4
  13261. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  13262. @item fg4
  13263. Set 4th foreground color expression.
  13264. @item min
  13265. Set minimal value of metadata value.
  13266. @item max
  13267. Set maximal value of metadata value.
  13268. @item bg
  13269. Set graph background color. Default is white.
  13270. @item mode
  13271. Set graph mode.
  13272. Available values for mode is:
  13273. @table @samp
  13274. @item bar
  13275. @item dot
  13276. @item line
  13277. @end table
  13278. Default is @code{line}.
  13279. @item slide
  13280. Set slide mode.
  13281. Available values for slide is:
  13282. @table @samp
  13283. @item frame
  13284. Draw new frame when right border is reached.
  13285. @item replace
  13286. Replace old columns with new ones.
  13287. @item scroll
  13288. Scroll from right to left.
  13289. @item rscroll
  13290. Scroll from left to right.
  13291. @item picture
  13292. Draw single picture.
  13293. @end table
  13294. Default is @code{frame}.
  13295. @item size
  13296. Set size of graph video. For the syntax of this option, check the
  13297. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13298. The default value is @code{900x256}.
  13299. The foreground color expressions can use the following variables:
  13300. @table @option
  13301. @item MIN
  13302. Minimal value of metadata value.
  13303. @item MAX
  13304. Maximal value of metadata value.
  13305. @item VAL
  13306. Current metadata key value.
  13307. @end table
  13308. The color is defined as 0xAABBGGRR.
  13309. @end table
  13310. Example using metadata from @ref{signalstats} filter:
  13311. @example
  13312. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  13313. @end example
  13314. Example using metadata from @ref{ebur128} filter:
  13315. @example
  13316. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  13317. @end example
  13318. @anchor{ebur128}
  13319. @section ebur128
  13320. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  13321. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  13322. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  13323. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  13324. The filter also has a video output (see the @var{video} option) with a real
  13325. time graph to observe the loudness evolution. The graphic contains the logged
  13326. message mentioned above, so it is not printed anymore when this option is set,
  13327. unless the verbose logging is set. The main graphing area contains the
  13328. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  13329. the momentary loudness (400 milliseconds).
  13330. More information about the Loudness Recommendation EBU R128 on
  13331. @url{http://tech.ebu.ch/loudness}.
  13332. The filter accepts the following options:
  13333. @table @option
  13334. @item video
  13335. Activate the video output. The audio stream is passed unchanged whether this
  13336. option is set or no. The video stream will be the first output stream if
  13337. activated. Default is @code{0}.
  13338. @item size
  13339. Set the video size. This option is for video only. For the syntax of this
  13340. option, check the
  13341. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13342. Default and minimum resolution is @code{640x480}.
  13343. @item meter
  13344. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  13345. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  13346. other integer value between this range is allowed.
  13347. @item metadata
  13348. Set metadata injection. If set to @code{1}, the audio input will be segmented
  13349. into 100ms output frames, each of them containing various loudness information
  13350. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  13351. Default is @code{0}.
  13352. @item framelog
  13353. Force the frame logging level.
  13354. Available values are:
  13355. @table @samp
  13356. @item info
  13357. information logging level
  13358. @item verbose
  13359. verbose logging level
  13360. @end table
  13361. By default, the logging level is set to @var{info}. If the @option{video} or
  13362. the @option{metadata} options are set, it switches to @var{verbose}.
  13363. @item peak
  13364. Set peak mode(s).
  13365. Available modes can be cumulated (the option is a @code{flag} type). Possible
  13366. values are:
  13367. @table @samp
  13368. @item none
  13369. Disable any peak mode (default).
  13370. @item sample
  13371. Enable sample-peak mode.
  13372. Simple peak mode looking for the higher sample value. It logs a message
  13373. for sample-peak (identified by @code{SPK}).
  13374. @item true
  13375. Enable true-peak mode.
  13376. If enabled, the peak lookup is done on an over-sampled version of the input
  13377. stream for better peak accuracy. It logs a message for true-peak.
  13378. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  13379. This mode requires a build with @code{libswresample}.
  13380. @end table
  13381. @item dualmono
  13382. Treat mono input files as "dual mono". If a mono file is intended for playback
  13383. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  13384. If set to @code{true}, this option will compensate for this effect.
  13385. Multi-channel input files are not affected by this option.
  13386. @item panlaw
  13387. Set a specific pan law to be used for the measurement of dual mono files.
  13388. This parameter is optional, and has a default value of -3.01dB.
  13389. @end table
  13390. @subsection Examples
  13391. @itemize
  13392. @item
  13393. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  13394. @example
  13395. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  13396. @end example
  13397. @item
  13398. Run an analysis with @command{ffmpeg}:
  13399. @example
  13400. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  13401. @end example
  13402. @end itemize
  13403. @section interleave, ainterleave
  13404. Temporally interleave frames from several inputs.
  13405. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  13406. These filters read frames from several inputs and send the oldest
  13407. queued frame to the output.
  13408. Input streams must have well defined, monotonically increasing frame
  13409. timestamp values.
  13410. In order to submit one frame to output, these filters need to enqueue
  13411. at least one frame for each input, so they cannot work in case one
  13412. input is not yet terminated and will not receive incoming frames.
  13413. For example consider the case when one input is a @code{select} filter
  13414. which always drops input frames. The @code{interleave} filter will keep
  13415. reading from that input, but it will never be able to send new frames
  13416. to output until the input sends an end-of-stream signal.
  13417. Also, depending on inputs synchronization, the filters will drop
  13418. frames in case one input receives more frames than the other ones, and
  13419. the queue is already filled.
  13420. These filters accept the following options:
  13421. @table @option
  13422. @item nb_inputs, n
  13423. Set the number of different inputs, it is 2 by default.
  13424. @end table
  13425. @subsection Examples
  13426. @itemize
  13427. @item
  13428. Interleave frames belonging to different streams using @command{ffmpeg}:
  13429. @example
  13430. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  13431. @end example
  13432. @item
  13433. Add flickering blur effect:
  13434. @example
  13435. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  13436. @end example
  13437. @end itemize
  13438. @section metadata, ametadata
  13439. Manipulate frame metadata.
  13440. This filter accepts the following options:
  13441. @table @option
  13442. @item mode
  13443. Set mode of operation of the filter.
  13444. Can be one of the following:
  13445. @table @samp
  13446. @item select
  13447. If both @code{value} and @code{key} is set, select frames
  13448. which have such metadata. If only @code{key} is set, select
  13449. every frame that has such key in metadata.
  13450. @item add
  13451. Add new metadata @code{key} and @code{value}. If key is already available
  13452. do nothing.
  13453. @item modify
  13454. Modify value of already present key.
  13455. @item delete
  13456. If @code{value} is set, delete only keys that have such value.
  13457. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  13458. the frame.
  13459. @item print
  13460. Print key and its value if metadata was found. If @code{key} is not set print all
  13461. metadata values available in frame.
  13462. @end table
  13463. @item key
  13464. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  13465. @item value
  13466. Set metadata value which will be used. This option is mandatory for
  13467. @code{modify} and @code{add} mode.
  13468. @item function
  13469. Which function to use when comparing metadata value and @code{value}.
  13470. Can be one of following:
  13471. @table @samp
  13472. @item same_str
  13473. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  13474. @item starts_with
  13475. Values are interpreted as strings, returns true if metadata value starts with
  13476. the @code{value} option string.
  13477. @item less
  13478. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  13479. @item equal
  13480. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  13481. @item greater
  13482. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  13483. @item expr
  13484. Values are interpreted as floats, returns true if expression from option @code{expr}
  13485. evaluates to true.
  13486. @end table
  13487. @item expr
  13488. Set expression which is used when @code{function} is set to @code{expr}.
  13489. The expression is evaluated through the eval API and can contain the following
  13490. constants:
  13491. @table @option
  13492. @item VALUE1
  13493. Float representation of @code{value} from metadata key.
  13494. @item VALUE2
  13495. Float representation of @code{value} as supplied by user in @code{value} option.
  13496. @end table
  13497. @item file
  13498. If specified in @code{print} mode, output is written to the named file. Instead of
  13499. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  13500. for standard output. If @code{file} option is not set, output is written to the log
  13501. with AV_LOG_INFO loglevel.
  13502. @end table
  13503. @subsection Examples
  13504. @itemize
  13505. @item
  13506. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  13507. between 0 and 1.
  13508. @example
  13509. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  13510. @end example
  13511. @item
  13512. Print silencedetect output to file @file{metadata.txt}.
  13513. @example
  13514. silencedetect,ametadata=mode=print:file=metadata.txt
  13515. @end example
  13516. @item
  13517. Direct all metadata to a pipe with file descriptor 4.
  13518. @example
  13519. metadata=mode=print:file='pipe\:4'
  13520. @end example
  13521. @end itemize
  13522. @section perms, aperms
  13523. Set read/write permissions for the output frames.
  13524. These filters are mainly aimed at developers to test direct path in the
  13525. following filter in the filtergraph.
  13526. The filters accept the following options:
  13527. @table @option
  13528. @item mode
  13529. Select the permissions mode.
  13530. It accepts the following values:
  13531. @table @samp
  13532. @item none
  13533. Do nothing. This is the default.
  13534. @item ro
  13535. Set all the output frames read-only.
  13536. @item rw
  13537. Set all the output frames directly writable.
  13538. @item toggle
  13539. Make the frame read-only if writable, and writable if read-only.
  13540. @item random
  13541. Set each output frame read-only or writable randomly.
  13542. @end table
  13543. @item seed
  13544. Set the seed for the @var{random} mode, must be an integer included between
  13545. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  13546. @code{-1}, the filter will try to use a good random seed on a best effort
  13547. basis.
  13548. @end table
  13549. Note: in case of auto-inserted filter between the permission filter and the
  13550. following one, the permission might not be received as expected in that
  13551. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  13552. perms/aperms filter can avoid this problem.
  13553. @section realtime, arealtime
  13554. Slow down filtering to match real time approximately.
  13555. These filters will pause the filtering for a variable amount of time to
  13556. match the output rate with the input timestamps.
  13557. They are similar to the @option{re} option to @code{ffmpeg}.
  13558. They accept the following options:
  13559. @table @option
  13560. @item limit
  13561. Time limit for the pauses. Any pause longer than that will be considered
  13562. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  13563. @end table
  13564. @anchor{select}
  13565. @section select, aselect
  13566. Select frames to pass in output.
  13567. This filter accepts the following options:
  13568. @table @option
  13569. @item expr, e
  13570. Set expression, which is evaluated for each input frame.
  13571. If the expression is evaluated to zero, the frame is discarded.
  13572. If the evaluation result is negative or NaN, the frame is sent to the
  13573. first output; otherwise it is sent to the output with index
  13574. @code{ceil(val)-1}, assuming that the input index starts from 0.
  13575. For example a value of @code{1.2} corresponds to the output with index
  13576. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  13577. @item outputs, n
  13578. Set the number of outputs. The output to which to send the selected
  13579. frame is based on the result of the evaluation. Default value is 1.
  13580. @end table
  13581. The expression can contain the following constants:
  13582. @table @option
  13583. @item n
  13584. The (sequential) number of the filtered frame, starting from 0.
  13585. @item selected_n
  13586. The (sequential) number of the selected frame, starting from 0.
  13587. @item prev_selected_n
  13588. The sequential number of the last selected frame. It's NAN if undefined.
  13589. @item TB
  13590. The timebase of the input timestamps.
  13591. @item pts
  13592. The PTS (Presentation TimeStamp) of the filtered video frame,
  13593. expressed in @var{TB} units. It's NAN if undefined.
  13594. @item t
  13595. The PTS of the filtered video frame,
  13596. expressed in seconds. It's NAN if undefined.
  13597. @item prev_pts
  13598. The PTS of the previously filtered video frame. It's NAN if undefined.
  13599. @item prev_selected_pts
  13600. The PTS of the last previously filtered video frame. It's NAN if undefined.
  13601. @item prev_selected_t
  13602. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  13603. @item start_pts
  13604. The PTS of the first video frame in the video. It's NAN if undefined.
  13605. @item start_t
  13606. The time of the first video frame in the video. It's NAN if undefined.
  13607. @item pict_type @emph{(video only)}
  13608. The type of the filtered frame. It can assume one of the following
  13609. values:
  13610. @table @option
  13611. @item I
  13612. @item P
  13613. @item B
  13614. @item S
  13615. @item SI
  13616. @item SP
  13617. @item BI
  13618. @end table
  13619. @item interlace_type @emph{(video only)}
  13620. The frame interlace type. It can assume one of the following values:
  13621. @table @option
  13622. @item PROGRESSIVE
  13623. The frame is progressive (not interlaced).
  13624. @item TOPFIRST
  13625. The frame is top-field-first.
  13626. @item BOTTOMFIRST
  13627. The frame is bottom-field-first.
  13628. @end table
  13629. @item consumed_sample_n @emph{(audio only)}
  13630. the number of selected samples before the current frame
  13631. @item samples_n @emph{(audio only)}
  13632. the number of samples in the current frame
  13633. @item sample_rate @emph{(audio only)}
  13634. the input sample rate
  13635. @item key
  13636. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  13637. @item pos
  13638. the position in the file of the filtered frame, -1 if the information
  13639. is not available (e.g. for synthetic video)
  13640. @item scene @emph{(video only)}
  13641. value between 0 and 1 to indicate a new scene; a low value reflects a low
  13642. probability for the current frame to introduce a new scene, while a higher
  13643. value means the current frame is more likely to be one (see the example below)
  13644. @item concatdec_select
  13645. The concat demuxer can select only part of a concat input file by setting an
  13646. inpoint and an outpoint, but the output packets may not be entirely contained
  13647. in the selected interval. By using this variable, it is possible to skip frames
  13648. generated by the concat demuxer which are not exactly contained in the selected
  13649. interval.
  13650. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  13651. and the @var{lavf.concat.duration} packet metadata values which are also
  13652. present in the decoded frames.
  13653. The @var{concatdec_select} variable is -1 if the frame pts is at least
  13654. start_time and either the duration metadata is missing or the frame pts is less
  13655. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  13656. missing.
  13657. That basically means that an input frame is selected if its pts is within the
  13658. interval set by the concat demuxer.
  13659. @end table
  13660. The default value of the select expression is "1".
  13661. @subsection Examples
  13662. @itemize
  13663. @item
  13664. Select all frames in input:
  13665. @example
  13666. select
  13667. @end example
  13668. The example above is the same as:
  13669. @example
  13670. select=1
  13671. @end example
  13672. @item
  13673. Skip all frames:
  13674. @example
  13675. select=0
  13676. @end example
  13677. @item
  13678. Select only I-frames:
  13679. @example
  13680. select='eq(pict_type\,I)'
  13681. @end example
  13682. @item
  13683. Select one frame every 100:
  13684. @example
  13685. select='not(mod(n\,100))'
  13686. @end example
  13687. @item
  13688. Select only frames contained in the 10-20 time interval:
  13689. @example
  13690. select=between(t\,10\,20)
  13691. @end example
  13692. @item
  13693. Select only I-frames contained in the 10-20 time interval:
  13694. @example
  13695. select=between(t\,10\,20)*eq(pict_type\,I)
  13696. @end example
  13697. @item
  13698. Select frames with a minimum distance of 10 seconds:
  13699. @example
  13700. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  13701. @end example
  13702. @item
  13703. Use aselect to select only audio frames with samples number > 100:
  13704. @example
  13705. aselect='gt(samples_n\,100)'
  13706. @end example
  13707. @item
  13708. Create a mosaic of the first scenes:
  13709. @example
  13710. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  13711. @end example
  13712. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  13713. choice.
  13714. @item
  13715. Send even and odd frames to separate outputs, and compose them:
  13716. @example
  13717. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  13718. @end example
  13719. @item
  13720. Select useful frames from an ffconcat file which is using inpoints and
  13721. outpoints but where the source files are not intra frame only.
  13722. @example
  13723. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  13724. @end example
  13725. @end itemize
  13726. @section sendcmd, asendcmd
  13727. Send commands to filters in the filtergraph.
  13728. These filters read commands to be sent to other filters in the
  13729. filtergraph.
  13730. @code{sendcmd} must be inserted between two video filters,
  13731. @code{asendcmd} must be inserted between two audio filters, but apart
  13732. from that they act the same way.
  13733. The specification of commands can be provided in the filter arguments
  13734. with the @var{commands} option, or in a file specified by the
  13735. @var{filename} option.
  13736. These filters accept the following options:
  13737. @table @option
  13738. @item commands, c
  13739. Set the commands to be read and sent to the other filters.
  13740. @item filename, f
  13741. Set the filename of the commands to be read and sent to the other
  13742. filters.
  13743. @end table
  13744. @subsection Commands syntax
  13745. A commands description consists of a sequence of interval
  13746. specifications, comprising a list of commands to be executed when a
  13747. particular event related to that interval occurs. The occurring event
  13748. is typically the current frame time entering or leaving a given time
  13749. interval.
  13750. An interval is specified by the following syntax:
  13751. @example
  13752. @var{START}[-@var{END}] @var{COMMANDS};
  13753. @end example
  13754. The time interval is specified by the @var{START} and @var{END} times.
  13755. @var{END} is optional and defaults to the maximum time.
  13756. The current frame time is considered within the specified interval if
  13757. it is included in the interval [@var{START}, @var{END}), that is when
  13758. the time is greater or equal to @var{START} and is lesser than
  13759. @var{END}.
  13760. @var{COMMANDS} consists of a sequence of one or more command
  13761. specifications, separated by ",", relating to that interval. The
  13762. syntax of a command specification is given by:
  13763. @example
  13764. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  13765. @end example
  13766. @var{FLAGS} is optional and specifies the type of events relating to
  13767. the time interval which enable sending the specified command, and must
  13768. be a non-null sequence of identifier flags separated by "+" or "|" and
  13769. enclosed between "[" and "]".
  13770. The following flags are recognized:
  13771. @table @option
  13772. @item enter
  13773. The command is sent when the current frame timestamp enters the
  13774. specified interval. In other words, the command is sent when the
  13775. previous frame timestamp was not in the given interval, and the
  13776. current is.
  13777. @item leave
  13778. The command is sent when the current frame timestamp leaves the
  13779. specified interval. In other words, the command is sent when the
  13780. previous frame timestamp was in the given interval, and the
  13781. current is not.
  13782. @end table
  13783. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  13784. assumed.
  13785. @var{TARGET} specifies the target of the command, usually the name of
  13786. the filter class or a specific filter instance name.
  13787. @var{COMMAND} specifies the name of the command for the target filter.
  13788. @var{ARG} is optional and specifies the optional list of argument for
  13789. the given @var{COMMAND}.
  13790. Between one interval specification and another, whitespaces, or
  13791. sequences of characters starting with @code{#} until the end of line,
  13792. are ignored and can be used to annotate comments.
  13793. A simplified BNF description of the commands specification syntax
  13794. follows:
  13795. @example
  13796. @var{COMMAND_FLAG} ::= "enter" | "leave"
  13797. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  13798. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  13799. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  13800. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  13801. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  13802. @end example
  13803. @subsection Examples
  13804. @itemize
  13805. @item
  13806. Specify audio tempo change at second 4:
  13807. @example
  13808. asendcmd=c='4.0 atempo tempo 1.5',atempo
  13809. @end example
  13810. @item
  13811. Target a specific filter instance:
  13812. @example
  13813. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  13814. @end example
  13815. @item
  13816. Specify a list of drawtext and hue commands in a file.
  13817. @example
  13818. # show text in the interval 5-10
  13819. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  13820. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  13821. # desaturate the image in the interval 15-20
  13822. 15.0-20.0 [enter] hue s 0,
  13823. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  13824. [leave] hue s 1,
  13825. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  13826. # apply an exponential saturation fade-out effect, starting from time 25
  13827. 25 [enter] hue s exp(25-t)
  13828. @end example
  13829. A filtergraph allowing to read and process the above command list
  13830. stored in a file @file{test.cmd}, can be specified with:
  13831. @example
  13832. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  13833. @end example
  13834. @end itemize
  13835. @anchor{setpts}
  13836. @section setpts, asetpts
  13837. Change the PTS (presentation timestamp) of the input frames.
  13838. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  13839. This filter accepts the following options:
  13840. @table @option
  13841. @item expr
  13842. The expression which is evaluated for each frame to construct its timestamp.
  13843. @end table
  13844. The expression is evaluated through the eval API and can contain the following
  13845. constants:
  13846. @table @option
  13847. @item FRAME_RATE
  13848. frame rate, only defined for constant frame-rate video
  13849. @item PTS
  13850. The presentation timestamp in input
  13851. @item N
  13852. The count of the input frame for video or the number of consumed samples,
  13853. not including the current frame for audio, starting from 0.
  13854. @item NB_CONSUMED_SAMPLES
  13855. The number of consumed samples, not including the current frame (only
  13856. audio)
  13857. @item NB_SAMPLES, S
  13858. The number of samples in the current frame (only audio)
  13859. @item SAMPLE_RATE, SR
  13860. The audio sample rate.
  13861. @item STARTPTS
  13862. The PTS of the first frame.
  13863. @item STARTT
  13864. the time in seconds of the first frame
  13865. @item INTERLACED
  13866. State whether the current frame is interlaced.
  13867. @item T
  13868. the time in seconds of the current frame
  13869. @item POS
  13870. original position in the file of the frame, or undefined if undefined
  13871. for the current frame
  13872. @item PREV_INPTS
  13873. The previous input PTS.
  13874. @item PREV_INT
  13875. previous input time in seconds
  13876. @item PREV_OUTPTS
  13877. The previous output PTS.
  13878. @item PREV_OUTT
  13879. previous output time in seconds
  13880. @item RTCTIME
  13881. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  13882. instead.
  13883. @item RTCSTART
  13884. The wallclock (RTC) time at the start of the movie in microseconds.
  13885. @item TB
  13886. The timebase of the input timestamps.
  13887. @end table
  13888. @subsection Examples
  13889. @itemize
  13890. @item
  13891. Start counting PTS from zero
  13892. @example
  13893. setpts=PTS-STARTPTS
  13894. @end example
  13895. @item
  13896. Apply fast motion effect:
  13897. @example
  13898. setpts=0.5*PTS
  13899. @end example
  13900. @item
  13901. Apply slow motion effect:
  13902. @example
  13903. setpts=2.0*PTS
  13904. @end example
  13905. @item
  13906. Set fixed rate of 25 frames per second:
  13907. @example
  13908. setpts=N/(25*TB)
  13909. @end example
  13910. @item
  13911. Set fixed rate 25 fps with some jitter:
  13912. @example
  13913. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  13914. @end example
  13915. @item
  13916. Apply an offset of 10 seconds to the input PTS:
  13917. @example
  13918. setpts=PTS+10/TB
  13919. @end example
  13920. @item
  13921. Generate timestamps from a "live source" and rebase onto the current timebase:
  13922. @example
  13923. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  13924. @end example
  13925. @item
  13926. Generate timestamps by counting samples:
  13927. @example
  13928. asetpts=N/SR/TB
  13929. @end example
  13930. @end itemize
  13931. @section settb, asettb
  13932. Set the timebase to use for the output frames timestamps.
  13933. It is mainly useful for testing timebase configuration.
  13934. It accepts the following parameters:
  13935. @table @option
  13936. @item expr, tb
  13937. The expression which is evaluated into the output timebase.
  13938. @end table
  13939. The value for @option{tb} is an arithmetic expression representing a
  13940. rational. The expression can contain the constants "AVTB" (the default
  13941. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  13942. audio only). Default value is "intb".
  13943. @subsection Examples
  13944. @itemize
  13945. @item
  13946. Set the timebase to 1/25:
  13947. @example
  13948. settb=expr=1/25
  13949. @end example
  13950. @item
  13951. Set the timebase to 1/10:
  13952. @example
  13953. settb=expr=0.1
  13954. @end example
  13955. @item
  13956. Set the timebase to 1001/1000:
  13957. @example
  13958. settb=1+0.001
  13959. @end example
  13960. @item
  13961. Set the timebase to 2*intb:
  13962. @example
  13963. settb=2*intb
  13964. @end example
  13965. @item
  13966. Set the default timebase value:
  13967. @example
  13968. settb=AVTB
  13969. @end example
  13970. @end itemize
  13971. @section showcqt
  13972. Convert input audio to a video output representing frequency spectrum
  13973. logarithmically using Brown-Puckette constant Q transform algorithm with
  13974. direct frequency domain coefficient calculation (but the transform itself
  13975. is not really constant Q, instead the Q factor is actually variable/clamped),
  13976. with musical tone scale, from E0 to D#10.
  13977. The filter accepts the following options:
  13978. @table @option
  13979. @item size, s
  13980. Specify the video size for the output. It must be even. For the syntax of this option,
  13981. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13982. Default value is @code{1920x1080}.
  13983. @item fps, rate, r
  13984. Set the output frame rate. Default value is @code{25}.
  13985. @item bar_h
  13986. Set the bargraph height. It must be even. Default value is @code{-1} which
  13987. computes the bargraph height automatically.
  13988. @item axis_h
  13989. Set the axis height. It must be even. Default value is @code{-1} which computes
  13990. the axis height automatically.
  13991. @item sono_h
  13992. Set the sonogram height. It must be even. Default value is @code{-1} which
  13993. computes the sonogram height automatically.
  13994. @item fullhd
  13995. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  13996. instead. Default value is @code{1}.
  13997. @item sono_v, volume
  13998. Specify the sonogram volume expression. It can contain variables:
  13999. @table @option
  14000. @item bar_v
  14001. the @var{bar_v} evaluated expression
  14002. @item frequency, freq, f
  14003. the frequency where it is evaluated
  14004. @item timeclamp, tc
  14005. the value of @var{timeclamp} option
  14006. @end table
  14007. and functions:
  14008. @table @option
  14009. @item a_weighting(f)
  14010. A-weighting of equal loudness
  14011. @item b_weighting(f)
  14012. B-weighting of equal loudness
  14013. @item c_weighting(f)
  14014. C-weighting of equal loudness.
  14015. @end table
  14016. Default value is @code{16}.
  14017. @item bar_v, volume2
  14018. Specify the bargraph volume expression. It can contain variables:
  14019. @table @option
  14020. @item sono_v
  14021. the @var{sono_v} evaluated expression
  14022. @item frequency, freq, f
  14023. the frequency where it is evaluated
  14024. @item timeclamp, tc
  14025. the value of @var{timeclamp} option
  14026. @end table
  14027. and functions:
  14028. @table @option
  14029. @item a_weighting(f)
  14030. A-weighting of equal loudness
  14031. @item b_weighting(f)
  14032. B-weighting of equal loudness
  14033. @item c_weighting(f)
  14034. C-weighting of equal loudness.
  14035. @end table
  14036. Default value is @code{sono_v}.
  14037. @item sono_g, gamma
  14038. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  14039. higher gamma makes the spectrum having more range. Default value is @code{3}.
  14040. Acceptable range is @code{[1, 7]}.
  14041. @item bar_g, gamma2
  14042. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  14043. @code{[1, 7]}.
  14044. @item bar_t
  14045. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  14046. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  14047. @item timeclamp, tc
  14048. Specify the transform timeclamp. At low frequency, there is trade-off between
  14049. accuracy in time domain and frequency domain. If timeclamp is lower,
  14050. event in time domain is represented more accurately (such as fast bass drum),
  14051. otherwise event in frequency domain is represented more accurately
  14052. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  14053. @item attack
  14054. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  14055. limits future samples by applying asymmetric windowing in time domain, useful
  14056. when low latency is required. Accepted range is @code{[0, 1]}.
  14057. @item basefreq
  14058. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  14059. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  14060. @item endfreq
  14061. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  14062. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  14063. @item coeffclamp
  14064. This option is deprecated and ignored.
  14065. @item tlength
  14066. Specify the transform length in time domain. Use this option to control accuracy
  14067. trade-off between time domain and frequency domain at every frequency sample.
  14068. It can contain variables:
  14069. @table @option
  14070. @item frequency, freq, f
  14071. the frequency where it is evaluated
  14072. @item timeclamp, tc
  14073. the value of @var{timeclamp} option.
  14074. @end table
  14075. Default value is @code{384*tc/(384+tc*f)}.
  14076. @item count
  14077. Specify the transform count for every video frame. Default value is @code{6}.
  14078. Acceptable range is @code{[1, 30]}.
  14079. @item fcount
  14080. Specify the transform count for every single pixel. Default value is @code{0},
  14081. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  14082. @item fontfile
  14083. Specify font file for use with freetype to draw the axis. If not specified,
  14084. use embedded font. Note that drawing with font file or embedded font is not
  14085. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  14086. option instead.
  14087. @item font
  14088. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  14089. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  14090. @item fontcolor
  14091. Specify font color expression. This is arithmetic expression that should return
  14092. integer value 0xRRGGBB. It can contain variables:
  14093. @table @option
  14094. @item frequency, freq, f
  14095. the frequency where it is evaluated
  14096. @item timeclamp, tc
  14097. the value of @var{timeclamp} option
  14098. @end table
  14099. and functions:
  14100. @table @option
  14101. @item midi(f)
  14102. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  14103. @item r(x), g(x), b(x)
  14104. red, green, and blue value of intensity x.
  14105. @end table
  14106. Default value is @code{st(0, (midi(f)-59.5)/12);
  14107. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  14108. r(1-ld(1)) + b(ld(1))}.
  14109. @item axisfile
  14110. Specify image file to draw the axis. This option override @var{fontfile} and
  14111. @var{fontcolor} option.
  14112. @item axis, text
  14113. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  14114. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  14115. Default value is @code{1}.
  14116. @item csp
  14117. Set colorspace. The accepted values are:
  14118. @table @samp
  14119. @item unspecified
  14120. Unspecified (default)
  14121. @item bt709
  14122. BT.709
  14123. @item fcc
  14124. FCC
  14125. @item bt470bg
  14126. BT.470BG or BT.601-6 625
  14127. @item smpte170m
  14128. SMPTE-170M or BT.601-6 525
  14129. @item smpte240m
  14130. SMPTE-240M
  14131. @item bt2020ncl
  14132. BT.2020 with non-constant luminance
  14133. @end table
  14134. @item cscheme
  14135. Set spectrogram color scheme. This is list of floating point values with format
  14136. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  14137. The default is @code{1|0.5|0|0|0.5|1}.
  14138. @end table
  14139. @subsection Examples
  14140. @itemize
  14141. @item
  14142. Playing audio while showing the spectrum:
  14143. @example
  14144. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  14145. @end example
  14146. @item
  14147. Same as above, but with frame rate 30 fps:
  14148. @example
  14149. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  14150. @end example
  14151. @item
  14152. Playing at 1280x720:
  14153. @example
  14154. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  14155. @end example
  14156. @item
  14157. Disable sonogram display:
  14158. @example
  14159. sono_h=0
  14160. @end example
  14161. @item
  14162. A1 and its harmonics: A1, A2, (near)E3, A3:
  14163. @example
  14164. 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),
  14165. asplit[a][out1]; [a] showcqt [out0]'
  14166. @end example
  14167. @item
  14168. Same as above, but with more accuracy in frequency domain:
  14169. @example
  14170. 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),
  14171. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  14172. @end example
  14173. @item
  14174. Custom volume:
  14175. @example
  14176. bar_v=10:sono_v=bar_v*a_weighting(f)
  14177. @end example
  14178. @item
  14179. Custom gamma, now spectrum is linear to the amplitude.
  14180. @example
  14181. bar_g=2:sono_g=2
  14182. @end example
  14183. @item
  14184. Custom tlength equation:
  14185. @example
  14186. 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)))'
  14187. @end example
  14188. @item
  14189. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  14190. @example
  14191. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  14192. @end example
  14193. @item
  14194. Custom font using fontconfig:
  14195. @example
  14196. font='Courier New,Monospace,mono|bold'
  14197. @end example
  14198. @item
  14199. Custom frequency range with custom axis using image file:
  14200. @example
  14201. axisfile=myaxis.png:basefreq=40:endfreq=10000
  14202. @end example
  14203. @end itemize
  14204. @section showfreqs
  14205. Convert input audio to video output representing the audio power spectrum.
  14206. Audio amplitude is on Y-axis while frequency is on X-axis.
  14207. The filter accepts the following options:
  14208. @table @option
  14209. @item size, s
  14210. Specify size of video. For the syntax of this option, check the
  14211. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14212. Default is @code{1024x512}.
  14213. @item mode
  14214. Set display mode.
  14215. This set how each frequency bin will be represented.
  14216. It accepts the following values:
  14217. @table @samp
  14218. @item line
  14219. @item bar
  14220. @item dot
  14221. @end table
  14222. Default is @code{bar}.
  14223. @item ascale
  14224. Set amplitude scale.
  14225. It accepts the following values:
  14226. @table @samp
  14227. @item lin
  14228. Linear scale.
  14229. @item sqrt
  14230. Square root scale.
  14231. @item cbrt
  14232. Cubic root scale.
  14233. @item log
  14234. Logarithmic scale.
  14235. @end table
  14236. Default is @code{log}.
  14237. @item fscale
  14238. Set frequency scale.
  14239. It accepts the following values:
  14240. @table @samp
  14241. @item lin
  14242. Linear scale.
  14243. @item log
  14244. Logarithmic scale.
  14245. @item rlog
  14246. Reverse logarithmic scale.
  14247. @end table
  14248. Default is @code{lin}.
  14249. @item win_size
  14250. Set window size.
  14251. It accepts the following values:
  14252. @table @samp
  14253. @item w16
  14254. @item w32
  14255. @item w64
  14256. @item w128
  14257. @item w256
  14258. @item w512
  14259. @item w1024
  14260. @item w2048
  14261. @item w4096
  14262. @item w8192
  14263. @item w16384
  14264. @item w32768
  14265. @item w65536
  14266. @end table
  14267. Default is @code{w2048}
  14268. @item win_func
  14269. Set windowing function.
  14270. It accepts the following values:
  14271. @table @samp
  14272. @item rect
  14273. @item bartlett
  14274. @item hanning
  14275. @item hamming
  14276. @item blackman
  14277. @item welch
  14278. @item flattop
  14279. @item bharris
  14280. @item bnuttall
  14281. @item bhann
  14282. @item sine
  14283. @item nuttall
  14284. @item lanczos
  14285. @item gauss
  14286. @item tukey
  14287. @item dolph
  14288. @item cauchy
  14289. @item parzen
  14290. @item poisson
  14291. @end table
  14292. Default is @code{hanning}.
  14293. @item overlap
  14294. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14295. which means optimal overlap for selected window function will be picked.
  14296. @item averaging
  14297. Set time averaging. Setting this to 0 will display current maximal peaks.
  14298. Default is @code{1}, which means time averaging is disabled.
  14299. @item colors
  14300. Specify list of colors separated by space or by '|' which will be used to
  14301. draw channel frequencies. Unrecognized or missing colors will be replaced
  14302. by white color.
  14303. @item cmode
  14304. Set channel display mode.
  14305. It accepts the following values:
  14306. @table @samp
  14307. @item combined
  14308. @item separate
  14309. @end table
  14310. Default is @code{combined}.
  14311. @item minamp
  14312. Set minimum amplitude used in @code{log} amplitude scaler.
  14313. @end table
  14314. @anchor{showspectrum}
  14315. @section showspectrum
  14316. Convert input audio to a video output, representing the audio frequency
  14317. spectrum.
  14318. The filter accepts the following options:
  14319. @table @option
  14320. @item size, s
  14321. Specify the video size for the output. For the syntax of this option, check the
  14322. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14323. Default value is @code{640x512}.
  14324. @item slide
  14325. Specify how the spectrum should slide along the window.
  14326. It accepts the following values:
  14327. @table @samp
  14328. @item replace
  14329. the samples start again on the left when they reach the right
  14330. @item scroll
  14331. the samples scroll from right to left
  14332. @item fullframe
  14333. frames are only produced when the samples reach the right
  14334. @item rscroll
  14335. the samples scroll from left to right
  14336. @end table
  14337. Default value is @code{replace}.
  14338. @item mode
  14339. Specify display mode.
  14340. It accepts the following values:
  14341. @table @samp
  14342. @item combined
  14343. all channels are displayed in the same row
  14344. @item separate
  14345. all channels are displayed in separate rows
  14346. @end table
  14347. Default value is @samp{combined}.
  14348. @item color
  14349. Specify display color mode.
  14350. It accepts the following values:
  14351. @table @samp
  14352. @item channel
  14353. each channel is displayed in a separate color
  14354. @item intensity
  14355. each channel is displayed using the same color scheme
  14356. @item rainbow
  14357. each channel is displayed using the rainbow color scheme
  14358. @item moreland
  14359. each channel is displayed using the moreland color scheme
  14360. @item nebulae
  14361. each channel is displayed using the nebulae color scheme
  14362. @item fire
  14363. each channel is displayed using the fire color scheme
  14364. @item fiery
  14365. each channel is displayed using the fiery color scheme
  14366. @item fruit
  14367. each channel is displayed using the fruit color scheme
  14368. @item cool
  14369. each channel is displayed using the cool color scheme
  14370. @end table
  14371. Default value is @samp{channel}.
  14372. @item scale
  14373. Specify scale used for calculating intensity color values.
  14374. It accepts the following values:
  14375. @table @samp
  14376. @item lin
  14377. linear
  14378. @item sqrt
  14379. square root, default
  14380. @item cbrt
  14381. cubic root
  14382. @item log
  14383. logarithmic
  14384. @item 4thrt
  14385. 4th root
  14386. @item 5thrt
  14387. 5th root
  14388. @end table
  14389. Default value is @samp{sqrt}.
  14390. @item saturation
  14391. Set saturation modifier for displayed colors. Negative values provide
  14392. alternative color scheme. @code{0} is no saturation at all.
  14393. Saturation must be in [-10.0, 10.0] range.
  14394. Default value is @code{1}.
  14395. @item win_func
  14396. Set window function.
  14397. It accepts the following values:
  14398. @table @samp
  14399. @item rect
  14400. @item bartlett
  14401. @item hann
  14402. @item hanning
  14403. @item hamming
  14404. @item blackman
  14405. @item welch
  14406. @item flattop
  14407. @item bharris
  14408. @item bnuttall
  14409. @item bhann
  14410. @item sine
  14411. @item nuttall
  14412. @item lanczos
  14413. @item gauss
  14414. @item tukey
  14415. @item dolph
  14416. @item cauchy
  14417. @item parzen
  14418. @item poisson
  14419. @end table
  14420. Default value is @code{hann}.
  14421. @item orientation
  14422. Set orientation of time vs frequency axis. Can be @code{vertical} or
  14423. @code{horizontal}. Default is @code{vertical}.
  14424. @item overlap
  14425. Set ratio of overlap window. Default value is @code{0}.
  14426. When value is @code{1} overlap is set to recommended size for specific
  14427. window function currently used.
  14428. @item gain
  14429. Set scale gain for calculating intensity color values.
  14430. Default value is @code{1}.
  14431. @item data
  14432. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  14433. @item rotation
  14434. Set color rotation, must be in [-1.0, 1.0] range.
  14435. Default value is @code{0}.
  14436. @end table
  14437. The usage is very similar to the showwaves filter; see the examples in that
  14438. section.
  14439. @subsection Examples
  14440. @itemize
  14441. @item
  14442. Large window with logarithmic color scaling:
  14443. @example
  14444. showspectrum=s=1280x480:scale=log
  14445. @end example
  14446. @item
  14447. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  14448. @example
  14449. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  14450. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  14451. @end example
  14452. @end itemize
  14453. @section showspectrumpic
  14454. Convert input audio to a single video frame, representing the audio frequency
  14455. spectrum.
  14456. The filter accepts the following options:
  14457. @table @option
  14458. @item size, s
  14459. Specify the video size for the output. For the syntax of this option, check the
  14460. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14461. Default value is @code{4096x2048}.
  14462. @item mode
  14463. Specify display mode.
  14464. It accepts the following values:
  14465. @table @samp
  14466. @item combined
  14467. all channels are displayed in the same row
  14468. @item separate
  14469. all channels are displayed in separate rows
  14470. @end table
  14471. Default value is @samp{combined}.
  14472. @item color
  14473. Specify display color mode.
  14474. It accepts the following values:
  14475. @table @samp
  14476. @item channel
  14477. each channel is displayed in a separate color
  14478. @item intensity
  14479. each channel is displayed using the same color scheme
  14480. @item rainbow
  14481. each channel is displayed using the rainbow color scheme
  14482. @item moreland
  14483. each channel is displayed using the moreland color scheme
  14484. @item nebulae
  14485. each channel is displayed using the nebulae color scheme
  14486. @item fire
  14487. each channel is displayed using the fire color scheme
  14488. @item fiery
  14489. each channel is displayed using the fiery color scheme
  14490. @item fruit
  14491. each channel is displayed using the fruit color scheme
  14492. @item cool
  14493. each channel is displayed using the cool color scheme
  14494. @end table
  14495. Default value is @samp{intensity}.
  14496. @item scale
  14497. Specify scale used for calculating intensity color values.
  14498. It accepts the following values:
  14499. @table @samp
  14500. @item lin
  14501. linear
  14502. @item sqrt
  14503. square root, default
  14504. @item cbrt
  14505. cubic root
  14506. @item log
  14507. logarithmic
  14508. @item 4thrt
  14509. 4th root
  14510. @item 5thrt
  14511. 5th root
  14512. @end table
  14513. Default value is @samp{log}.
  14514. @item saturation
  14515. Set saturation modifier for displayed colors. Negative values provide
  14516. alternative color scheme. @code{0} is no saturation at all.
  14517. Saturation must be in [-10.0, 10.0] range.
  14518. Default value is @code{1}.
  14519. @item win_func
  14520. Set window function.
  14521. It accepts the following values:
  14522. @table @samp
  14523. @item rect
  14524. @item bartlett
  14525. @item hann
  14526. @item hanning
  14527. @item hamming
  14528. @item blackman
  14529. @item welch
  14530. @item flattop
  14531. @item bharris
  14532. @item bnuttall
  14533. @item bhann
  14534. @item sine
  14535. @item nuttall
  14536. @item lanczos
  14537. @item gauss
  14538. @item tukey
  14539. @item dolph
  14540. @item cauchy
  14541. @item parzen
  14542. @item poisson
  14543. @end table
  14544. Default value is @code{hann}.
  14545. @item orientation
  14546. Set orientation of time vs frequency axis. Can be @code{vertical} or
  14547. @code{horizontal}. Default is @code{vertical}.
  14548. @item gain
  14549. Set scale gain for calculating intensity color values.
  14550. Default value is @code{1}.
  14551. @item legend
  14552. Draw time and frequency axes and legends. Default is enabled.
  14553. @item rotation
  14554. Set color rotation, must be in [-1.0, 1.0] range.
  14555. Default value is @code{0}.
  14556. @end table
  14557. @subsection Examples
  14558. @itemize
  14559. @item
  14560. Extract an audio spectrogram of a whole audio track
  14561. in a 1024x1024 picture using @command{ffmpeg}:
  14562. @example
  14563. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  14564. @end example
  14565. @end itemize
  14566. @section showvolume
  14567. Convert input audio volume to a video output.
  14568. The filter accepts the following options:
  14569. @table @option
  14570. @item rate, r
  14571. Set video rate.
  14572. @item b
  14573. Set border width, allowed range is [0, 5]. Default is 1.
  14574. @item w
  14575. Set channel width, allowed range is [80, 8192]. Default is 400.
  14576. @item h
  14577. Set channel height, allowed range is [1, 900]. Default is 20.
  14578. @item f
  14579. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  14580. @item c
  14581. Set volume color expression.
  14582. The expression can use the following variables:
  14583. @table @option
  14584. @item VOLUME
  14585. Current max volume of channel in dB.
  14586. @item PEAK
  14587. Current peak.
  14588. @item CHANNEL
  14589. Current channel number, starting from 0.
  14590. @end table
  14591. @item t
  14592. If set, displays channel names. Default is enabled.
  14593. @item v
  14594. If set, displays volume values. Default is enabled.
  14595. @item o
  14596. Set orientation, can be @code{horizontal} or @code{vertical},
  14597. default is @code{horizontal}.
  14598. @item s
  14599. Set step size, allowed range s [0, 5]. Default is 0, which means
  14600. step is disabled.
  14601. @end table
  14602. @section showwaves
  14603. Convert input audio to a video output, representing the samples waves.
  14604. The filter accepts the following options:
  14605. @table @option
  14606. @item size, s
  14607. Specify the video size for the output. For the syntax of this option, check the
  14608. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14609. Default value is @code{600x240}.
  14610. @item mode
  14611. Set display mode.
  14612. Available values are:
  14613. @table @samp
  14614. @item point
  14615. Draw a point for each sample.
  14616. @item line
  14617. Draw a vertical line for each sample.
  14618. @item p2p
  14619. Draw a point for each sample and a line between them.
  14620. @item cline
  14621. Draw a centered vertical line for each sample.
  14622. @end table
  14623. Default value is @code{point}.
  14624. @item n
  14625. Set the number of samples which are printed on the same column. A
  14626. larger value will decrease the frame rate. Must be a positive
  14627. integer. This option can be set only if the value for @var{rate}
  14628. is not explicitly specified.
  14629. @item rate, r
  14630. Set the (approximate) output frame rate. This is done by setting the
  14631. option @var{n}. Default value is "25".
  14632. @item split_channels
  14633. Set if channels should be drawn separately or overlap. Default value is 0.
  14634. @item colors
  14635. Set colors separated by '|' which are going to be used for drawing of each channel.
  14636. @item scale
  14637. Set amplitude scale.
  14638. Available values are:
  14639. @table @samp
  14640. @item lin
  14641. Linear.
  14642. @item log
  14643. Logarithmic.
  14644. @item sqrt
  14645. Square root.
  14646. @item cbrt
  14647. Cubic root.
  14648. @end table
  14649. Default is linear.
  14650. @end table
  14651. @subsection Examples
  14652. @itemize
  14653. @item
  14654. Output the input file audio and the corresponding video representation
  14655. at the same time:
  14656. @example
  14657. amovie=a.mp3,asplit[out0],showwaves[out1]
  14658. @end example
  14659. @item
  14660. Create a synthetic signal and show it with showwaves, forcing a
  14661. frame rate of 30 frames per second:
  14662. @example
  14663. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  14664. @end example
  14665. @end itemize
  14666. @section showwavespic
  14667. Convert input audio to a single video frame, representing the samples waves.
  14668. The filter accepts the following options:
  14669. @table @option
  14670. @item size, s
  14671. Specify the video size for the output. For the syntax of this option, check the
  14672. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14673. Default value is @code{600x240}.
  14674. @item split_channels
  14675. Set if channels should be drawn separately or overlap. Default value is 0.
  14676. @item colors
  14677. Set colors separated by '|' which are going to be used for drawing of each channel.
  14678. @item scale
  14679. Set amplitude scale.
  14680. Available values are:
  14681. @table @samp
  14682. @item lin
  14683. Linear.
  14684. @item log
  14685. Logarithmic.
  14686. @item sqrt
  14687. Square root.
  14688. @item cbrt
  14689. Cubic root.
  14690. @end table
  14691. Default is linear.
  14692. @end table
  14693. @subsection Examples
  14694. @itemize
  14695. @item
  14696. Extract a channel split representation of the wave form of a whole audio track
  14697. in a 1024x800 picture using @command{ffmpeg}:
  14698. @example
  14699. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  14700. @end example
  14701. @end itemize
  14702. @section sidedata, asidedata
  14703. Delete frame side data, or select frames based on it.
  14704. This filter accepts the following options:
  14705. @table @option
  14706. @item mode
  14707. Set mode of operation of the filter.
  14708. Can be one of the following:
  14709. @table @samp
  14710. @item select
  14711. Select every frame with side data of @code{type}.
  14712. @item delete
  14713. Delete side data of @code{type}. If @code{type} is not set, delete all side
  14714. data in the frame.
  14715. @end table
  14716. @item type
  14717. Set side data type used with all modes. Must be set for @code{select} mode. For
  14718. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  14719. in @file{libavutil/frame.h}. For example, to choose
  14720. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  14721. @end table
  14722. @section spectrumsynth
  14723. Sythesize audio from 2 input video spectrums, first input stream represents
  14724. magnitude across time and second represents phase across time.
  14725. The filter will transform from frequency domain as displayed in videos back
  14726. to time domain as presented in audio output.
  14727. This filter is primarily created for reversing processed @ref{showspectrum}
  14728. filter outputs, but can synthesize sound from other spectrograms too.
  14729. But in such case results are going to be poor if the phase data is not
  14730. available, because in such cases phase data need to be recreated, usually
  14731. its just recreated from random noise.
  14732. For best results use gray only output (@code{channel} color mode in
  14733. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  14734. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  14735. @code{data} option. Inputs videos should generally use @code{fullframe}
  14736. slide mode as that saves resources needed for decoding video.
  14737. The filter accepts the following options:
  14738. @table @option
  14739. @item sample_rate
  14740. Specify sample rate of output audio, the sample rate of audio from which
  14741. spectrum was generated may differ.
  14742. @item channels
  14743. Set number of channels represented in input video spectrums.
  14744. @item scale
  14745. Set scale which was used when generating magnitude input spectrum.
  14746. Can be @code{lin} or @code{log}. Default is @code{log}.
  14747. @item slide
  14748. Set slide which was used when generating inputs spectrums.
  14749. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  14750. Default is @code{fullframe}.
  14751. @item win_func
  14752. Set window function used for resynthesis.
  14753. @item overlap
  14754. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14755. which means optimal overlap for selected window function will be picked.
  14756. @item orientation
  14757. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  14758. Default is @code{vertical}.
  14759. @end table
  14760. @subsection Examples
  14761. @itemize
  14762. @item
  14763. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  14764. then resynthesize videos back to audio with spectrumsynth:
  14765. @example
  14766. 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
  14767. 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
  14768. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  14769. @end example
  14770. @end itemize
  14771. @section split, asplit
  14772. Split input into several identical outputs.
  14773. @code{asplit} works with audio input, @code{split} with video.
  14774. The filter accepts a single parameter which specifies the number of outputs. If
  14775. unspecified, it defaults to 2.
  14776. @subsection Examples
  14777. @itemize
  14778. @item
  14779. Create two separate outputs from the same input:
  14780. @example
  14781. [in] split [out0][out1]
  14782. @end example
  14783. @item
  14784. To create 3 or more outputs, you need to specify the number of
  14785. outputs, like in:
  14786. @example
  14787. [in] asplit=3 [out0][out1][out2]
  14788. @end example
  14789. @item
  14790. Create two separate outputs from the same input, one cropped and
  14791. one padded:
  14792. @example
  14793. [in] split [splitout1][splitout2];
  14794. [splitout1] crop=100:100:0:0 [cropout];
  14795. [splitout2] pad=200:200:100:100 [padout];
  14796. @end example
  14797. @item
  14798. Create 5 copies of the input audio with @command{ffmpeg}:
  14799. @example
  14800. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  14801. @end example
  14802. @end itemize
  14803. @section zmq, azmq
  14804. Receive commands sent through a libzmq client, and forward them to
  14805. filters in the filtergraph.
  14806. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  14807. must be inserted between two video filters, @code{azmq} between two
  14808. audio filters.
  14809. To enable these filters you need to install the libzmq library and
  14810. headers and configure FFmpeg with @code{--enable-libzmq}.
  14811. For more information about libzmq see:
  14812. @url{http://www.zeromq.org/}
  14813. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  14814. receives messages sent through a network interface defined by the
  14815. @option{bind_address} option.
  14816. The received message must be in the form:
  14817. @example
  14818. @var{TARGET} @var{COMMAND} [@var{ARG}]
  14819. @end example
  14820. @var{TARGET} specifies the target of the command, usually the name of
  14821. the filter class or a specific filter instance name.
  14822. @var{COMMAND} specifies the name of the command for the target filter.
  14823. @var{ARG} is optional and specifies the optional argument list for the
  14824. given @var{COMMAND}.
  14825. Upon reception, the message is processed and the corresponding command
  14826. is injected into the filtergraph. Depending on the result, the filter
  14827. will send a reply to the client, adopting the format:
  14828. @example
  14829. @var{ERROR_CODE} @var{ERROR_REASON}
  14830. @var{MESSAGE}
  14831. @end example
  14832. @var{MESSAGE} is optional.
  14833. @subsection Examples
  14834. Look at @file{tools/zmqsend} for an example of a zmq client which can
  14835. be used to send commands processed by these filters.
  14836. Consider the following filtergraph generated by @command{ffplay}
  14837. @example
  14838. ffplay -dumpgraph 1 -f lavfi "
  14839. color=s=100x100:c=red [l];
  14840. color=s=100x100:c=blue [r];
  14841. nullsrc=s=200x100, zmq [bg];
  14842. [bg][l] overlay [bg+l];
  14843. [bg+l][r] overlay=x=100 "
  14844. @end example
  14845. To change the color of the left side of the video, the following
  14846. command can be used:
  14847. @example
  14848. echo Parsed_color_0 c yellow | tools/zmqsend
  14849. @end example
  14850. To change the right side:
  14851. @example
  14852. echo Parsed_color_1 c pink | tools/zmqsend
  14853. @end example
  14854. @c man end MULTIMEDIA FILTERS
  14855. @chapter Multimedia Sources
  14856. @c man begin MULTIMEDIA SOURCES
  14857. Below is a description of the currently available multimedia sources.
  14858. @section amovie
  14859. This is the same as @ref{movie} source, except it selects an audio
  14860. stream by default.
  14861. @anchor{movie}
  14862. @section movie
  14863. Read audio and/or video stream(s) from a movie container.
  14864. It accepts the following parameters:
  14865. @table @option
  14866. @item filename
  14867. The name of the resource to read (not necessarily a file; it can also be a
  14868. device or a stream accessed through some protocol).
  14869. @item format_name, f
  14870. Specifies the format assumed for the movie to read, and can be either
  14871. the name of a container or an input device. If not specified, the
  14872. format is guessed from @var{movie_name} or by probing.
  14873. @item seek_point, sp
  14874. Specifies the seek point in seconds. The frames will be output
  14875. starting from this seek point. The parameter is evaluated with
  14876. @code{av_strtod}, so the numerical value may be suffixed by an IS
  14877. postfix. The default value is "0".
  14878. @item streams, s
  14879. Specifies the streams to read. Several streams can be specified,
  14880. separated by "+". The source will then have as many outputs, in the
  14881. same order. The syntax is explained in the ``Stream specifiers''
  14882. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  14883. respectively the default (best suited) video and audio stream. Default
  14884. is "dv", or "da" if the filter is called as "amovie".
  14885. @item stream_index, si
  14886. Specifies the index of the video stream to read. If the value is -1,
  14887. the most suitable video stream will be automatically selected. The default
  14888. value is "-1". Deprecated. If the filter is called "amovie", it will select
  14889. audio instead of video.
  14890. @item loop
  14891. Specifies how many times to read the stream in sequence.
  14892. If the value is 0, the stream will be looped infinitely.
  14893. Default value is "1".
  14894. Note that when the movie is looped the source timestamps are not
  14895. changed, so it will generate non monotonically increasing timestamps.
  14896. @item discontinuity
  14897. Specifies the time difference between frames above which the point is
  14898. considered a timestamp discontinuity which is removed by adjusting the later
  14899. timestamps.
  14900. @end table
  14901. It allows overlaying a second video on top of the main input of
  14902. a filtergraph, as shown in this graph:
  14903. @example
  14904. input -----------> deltapts0 --> overlay --> output
  14905. ^
  14906. |
  14907. movie --> scale--> deltapts1 -------+
  14908. @end example
  14909. @subsection Examples
  14910. @itemize
  14911. @item
  14912. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  14913. on top of the input labelled "in":
  14914. @example
  14915. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  14916. [in] setpts=PTS-STARTPTS [main];
  14917. [main][over] overlay=16:16 [out]
  14918. @end example
  14919. @item
  14920. Read from a video4linux2 device, and overlay it on top of the input
  14921. labelled "in":
  14922. @example
  14923. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  14924. [in] setpts=PTS-STARTPTS [main];
  14925. [main][over] overlay=16:16 [out]
  14926. @end example
  14927. @item
  14928. Read the first video stream and the audio stream with id 0x81 from
  14929. dvd.vob; the video is connected to the pad named "video" and the audio is
  14930. connected to the pad named "audio":
  14931. @example
  14932. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  14933. @end example
  14934. @end itemize
  14935. @subsection Commands
  14936. Both movie and amovie support the following commands:
  14937. @table @option
  14938. @item seek
  14939. Perform seek using "av_seek_frame".
  14940. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  14941. @itemize
  14942. @item
  14943. @var{stream_index}: If stream_index is -1, a default
  14944. stream is selected, and @var{timestamp} is automatically converted
  14945. from AV_TIME_BASE units to the stream specific time_base.
  14946. @item
  14947. @var{timestamp}: Timestamp in AVStream.time_base units
  14948. or, if no stream is specified, in AV_TIME_BASE units.
  14949. @item
  14950. @var{flags}: Flags which select direction and seeking mode.
  14951. @end itemize
  14952. @item get_duration
  14953. Get movie duration in AV_TIME_BASE units.
  14954. @end table
  14955. @c man end MULTIMEDIA SOURCES