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.

19533 lines
518KB

  1. @chapter Filtering Introduction
  2. @c man begin FILTERING INTRODUCTION
  3. Filtering in FFmpeg is enabled through the libavfilter library.
  4. In libavfilter, a filter can have multiple inputs and multiple
  5. outputs.
  6. To illustrate the sorts of things that are possible, we consider the
  7. following filtergraph.
  8. @verbatim
  9. [main]
  10. input --> split ---------------------> overlay --> output
  11. | ^
  12. |[tmp] [flip]|
  13. +-----> crop --> vflip -------+
  14. @end verbatim
  15. This filtergraph splits the input stream in two streams, then sends one
  16. stream through the crop filter and the vflip filter, before merging it
  17. back with the other stream by overlaying it on top. You can use the
  18. following command to achieve this:
  19. @example
  20. ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
  21. @end example
  22. The result will be that the top half of the video is mirrored
  23. onto the bottom half of the output video.
  24. Filters in the same linear chain are separated by commas, and distinct
  25. linear chains of filters are separated by semicolons. In our example,
  26. @var{crop,vflip} are in one linear chain, @var{split} and
  27. @var{overlay} are separately in another. The points where the linear
  28. chains join are labelled by names enclosed in square brackets. In the
  29. example, the split filter generates two outputs that are associated to
  30. the labels @var{[main]} and @var{[tmp]}.
  31. The stream sent to the second output of @var{split}, labelled as
  32. @var{[tmp]}, is processed through the @var{crop} filter, which crops
  33. away the lower half part of the video, and then vertically flipped. The
  34. @var{overlay} filter takes in input the first unchanged output of the
  35. split filter (which was labelled as @var{[main]}), and overlay on its
  36. lower half the output generated by the @var{crop,vflip} filterchain.
  37. Some filters take in input a list of parameters: they are specified
  38. after the filter name and an equal sign, and are separated from each other
  39. by a colon.
  40. There exist so-called @var{source filters} that do not have an
  41. audio/video input, and @var{sink filters} that will not have audio/video
  42. output.
  43. @c man end FILTERING INTRODUCTION
  44. @chapter graph2dot
  45. @c man begin GRAPH2DOT
  46. The @file{graph2dot} program included in the FFmpeg @file{tools}
  47. directory can be used to parse a filtergraph description and issue a
  48. corresponding textual representation in the dot language.
  49. Invoke the command:
  50. @example
  51. graph2dot -h
  52. @end example
  53. to see how to use @file{graph2dot}.
  54. You can then pass the dot description to the @file{dot} program (from
  55. the graphviz suite of programs) and obtain a graphical representation
  56. of the filtergraph.
  57. For example the sequence of commands:
  58. @example
  59. echo @var{GRAPH_DESCRIPTION} | \
  60. tools/graph2dot -o graph.tmp && \
  61. dot -Tpng graph.tmp -o graph.png && \
  62. display graph.png
  63. @end example
  64. can be used to create and display an image representing the graph
  65. described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
  66. a complete self-contained graph, with its inputs and outputs explicitly defined.
  67. For example if your command line is of the form:
  68. @example
  69. ffmpeg -i infile -vf scale=640:360 outfile
  70. @end example
  71. your @var{GRAPH_DESCRIPTION} string will need to be of the form:
  72. @example
  73. nullsrc,scale=640:360,nullsink
  74. @end example
  75. you may also need to set the @var{nullsrc} parameters and add a @var{format}
  76. filter in order to simulate a specific input file.
  77. @c man end GRAPH2DOT
  78. @chapter Filtergraph description
  79. @c man begin FILTERGRAPH DESCRIPTION
  80. A filtergraph is a directed graph of connected filters. It can contain
  81. cycles, and there can be multiple links between a pair of
  82. filters. Each link has one input pad on one side connecting it to one
  83. filter from which it takes its input, and one output pad on the other
  84. side connecting it to one filter accepting its output.
  85. Each filter in a filtergraph is an instance of a filter class
  86. registered in the application, which defines the features and the
  87. number of input and output pads of the filter.
  88. A filter with no input pads is called a "source", and a filter with no
  89. output pads is called a "sink".
  90. @anchor{Filtergraph syntax}
  91. @section Filtergraph syntax
  92. A filtergraph has a textual representation, which is recognized by the
  93. @option{-filter}/@option{-vf}/@option{-af} and
  94. @option{-filter_complex} options in @command{ffmpeg} and
  95. @option{-vf}/@option{-af} in @command{ffplay}, and by the
  96. @code{avfilter_graph_parse_ptr()} function defined in
  97. @file{libavfilter/avfilter.h}.
  98. A filterchain consists of a sequence of connected filters, each one
  99. connected to the previous one in the sequence. A filterchain is
  100. represented by a list of ","-separated filter descriptions.
  101. A filtergraph consists of a sequence of filterchains. A sequence of
  102. filterchains is represented by a list of ";"-separated filterchain
  103. descriptions.
  104. A filter is represented by a string of the form:
  105. [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}@@@var{id}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
  106. @var{filter_name} is the name of the filter class of which the
  107. described filter is an instance of, and has to be the name of one of
  108. the filter classes registered in the program optionally followed by "@@@var{id}".
  109. The name of the filter class is optionally followed by a string
  110. "=@var{arguments}".
  111. @var{arguments} is a string which contains the parameters used to
  112. initialize the filter instance. It may have one of two forms:
  113. @itemize
  114. @item
  115. A ':'-separated list of @var{key=value} pairs.
  116. @item
  117. A ':'-separated list of @var{value}. In this case, the keys are assumed to be
  118. the option names in the order they are declared. E.g. the @code{fade} filter
  119. declares three options in this order -- @option{type}, @option{start_frame} and
  120. @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
  121. @var{in} is assigned to the option @option{type}, @var{0} to
  122. @option{start_frame} and @var{30} to @option{nb_frames}.
  123. @item
  124. A ':'-separated list of mixed direct @var{value} and long @var{key=value}
  125. pairs. The direct @var{value} must precede the @var{key=value} pairs, and
  126. follow the same constraints order of the previous point. The following
  127. @var{key=value} pairs can be set in any preferred order.
  128. @end itemize
  129. If the option value itself is a list of items (e.g. the @code{format} filter
  130. takes a list of pixel formats), the items in the list are usually separated by
  131. @samp{|}.
  132. The list of arguments can be quoted using the character @samp{'} as initial
  133. and ending mark, and the character @samp{\} for escaping the characters
  134. within the quoted text; otherwise the argument string is considered
  135. terminated when the next special character (belonging to the set
  136. @samp{[]=;,}) is encountered.
  137. The name and arguments of the filter are optionally preceded and
  138. followed by a list of link labels.
  139. A link label allows one to name a link and associate it to a filter output
  140. or input pad. The preceding labels @var{in_link_1}
  141. ... @var{in_link_N}, are associated to the filter input pads,
  142. the following labels @var{out_link_1} ... @var{out_link_M}, are
  143. associated to the output pads.
  144. When two link labels with the same name are found in the
  145. filtergraph, a link between the corresponding input and output pad is
  146. created.
  147. If an output pad is not labelled, it is linked by default to the first
  148. unlabelled input pad of the next filter in the filterchain.
  149. For example in the filterchain
  150. @example
  151. nullsrc, split[L1], [L2]overlay, nullsink
  152. @end example
  153. the split filter instance has two output pads, and the overlay filter
  154. instance two input pads. The first output pad of split is labelled
  155. "L1", the first input pad of overlay is labelled "L2", and the second
  156. output pad of split is linked to the second input pad of overlay,
  157. which are both unlabelled.
  158. In a filter description, if the input label of the first filter is not
  159. specified, "in" is assumed; if the output label of the last filter is not
  160. specified, "out" is assumed.
  161. In a complete filterchain all the unlabelled filter input and output
  162. pads must be connected. A filtergraph is considered valid if all the
  163. filter input and output pads of all the filterchains are connected.
  164. Libavfilter will automatically insert @ref{scale} filters where format
  165. conversion is required. It is possible to specify swscale flags
  166. for those automatically inserted scalers by prepending
  167. @code{sws_flags=@var{flags};}
  168. to the filtergraph description.
  169. Here is a BNF description of the filtergraph syntax:
  170. @example
  171. @var{NAME} ::= sequence of alphanumeric characters and '_'
  172. @var{FILTER_NAME} ::= @var{NAME}["@@"@var{NAME}]
  173. @var{LINKLABEL} ::= "[" @var{NAME} "]"
  174. @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
  175. @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
  176. @var{FILTER} ::= [@var{LINKLABELS}] @var{FILTER_NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
  177. @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
  178. @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
  179. @end example
  180. @section Notes on filtergraph escaping
  181. Filtergraph description composition entails several levels of
  182. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  183. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  184. information about the employed escaping procedure.
  185. A first level escaping affects the content of each filter option
  186. value, which may contain the special character @code{:} used to
  187. separate values, or one of the escaping characters @code{\'}.
  188. A second level escaping affects the whole filter description, which
  189. may contain the escaping characters @code{\'} or the special
  190. characters @code{[],;} used by the filtergraph description.
  191. Finally, when you specify a filtergraph on a shell commandline, you
  192. need to perform a third level escaping for the shell special
  193. characters contained within it.
  194. For example, consider the following string to be embedded in
  195. the @ref{drawtext} filter description @option{text} value:
  196. @example
  197. this is a 'string': may contain one, or more, special characters
  198. @end example
  199. This string contains the @code{'} special escaping character, and the
  200. @code{:} special character, so it needs to be escaped in this way:
  201. @example
  202. text=this is a \'string\'\: may contain one, or more, special characters
  203. @end example
  204. A second level of escaping is required when embedding the filter
  205. description in a filtergraph description, in order to escape all the
  206. filtergraph special characters. Thus the example above becomes:
  207. @example
  208. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  209. @end example
  210. (note that in addition to the @code{\'} escaping special characters,
  211. also @code{,} needs to be escaped).
  212. Finally an additional level of escaping is needed when writing the
  213. filtergraph description in a shell command, which depends on the
  214. escaping rules of the adopted shell. For example, assuming that
  215. @code{\} is special and needs to be escaped with another @code{\}, the
  216. previous string will finally result in:
  217. @example
  218. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  219. @end example
  220. @chapter Timeline editing
  221. Some filters support a generic @option{enable} option. For the filters
  222. supporting timeline editing, this option can be set to an expression which is
  223. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  224. the filter will be enabled, otherwise the frame will be sent unchanged to the
  225. next filter in the filtergraph.
  226. The expression accepts the following values:
  227. @table @samp
  228. @item t
  229. timestamp expressed in seconds, NAN if the input timestamp is unknown
  230. @item n
  231. sequential number of the input frame, starting from 0
  232. @item pos
  233. the position in the file of the input frame, NAN if unknown
  234. @item w
  235. @item h
  236. width and height of the input frame if video
  237. @end table
  238. Additionally, these filters support an @option{enable} command that can be used
  239. to re-define the expression.
  240. Like any other filtering option, the @option{enable} option follows the same
  241. rules.
  242. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  243. minutes, and a @ref{curves} filter starting at 3 seconds:
  244. @example
  245. smartblur = enable='between(t,10,3*60)',
  246. curves = enable='gte(t,3)' : preset=cross_process
  247. @end example
  248. See @code{ffmpeg -filters} to view which filters have timeline support.
  249. @c man end FILTERGRAPH DESCRIPTION
  250. @anchor{framesync}
  251. @chapter Options for filters with several inputs (framesync)
  252. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  253. Some filters with several inputs support a common set of options.
  254. These options can only be set by name, not with the short notation.
  255. @table @option
  256. @item eof_action
  257. The action to take when EOF is encountered on the secondary input; it accepts
  258. one of the following values:
  259. @table @option
  260. @item repeat
  261. Repeat the last frame (the default).
  262. @item endall
  263. End both streams.
  264. @item pass
  265. Pass the main input through.
  266. @end table
  267. @item shortest
  268. If set to 1, force the output to terminate when the shortest input
  269. terminates. Default value is 0.
  270. @item repeatlast
  271. If set to 1, force the filter to extend the last frame of secondary streams
  272. until the end of the primary stream. A value of 0 disables this behavior.
  273. Default value is 1.
  274. @end table
  275. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  276. @chapter Audio Filters
  277. @c man begin AUDIO FILTERS
  278. When you configure your FFmpeg build, you can disable any of the
  279. existing filters using @code{--disable-filters}.
  280. The configure output will show the audio filters included in your
  281. build.
  282. Below is a description of the currently available audio filters.
  283. @section acompressor
  284. A compressor is mainly used to reduce the dynamic range of a signal.
  285. Especially modern music is mostly compressed at a high ratio to
  286. improve the overall loudness. It's done to get the highest attention
  287. of a listener, "fatten" the sound and bring more "power" to the track.
  288. If a signal is compressed too much it may sound dull or "dead"
  289. afterwards or it may start to "pump" (which could be a powerful effect
  290. but can also destroy a track completely).
  291. The right compression is the key to reach a professional sound and is
  292. the high art of mixing and mastering. Because of its complex settings
  293. it may take a long time to get the right feeling for this kind of effect.
  294. Compression is done by detecting the volume above a chosen level
  295. @code{threshold} and dividing it by the factor set with @code{ratio}.
  296. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  297. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  298. the signal would cause distortion of the waveform the reduction can be
  299. levelled over the time. This is done by setting "Attack" and "Release".
  300. @code{attack} determines how long the signal has to rise above the threshold
  301. before any reduction will occur and @code{release} sets the time the signal
  302. has to fall below the threshold to reduce the reduction again. Shorter signals
  303. than the chosen attack time will be left untouched.
  304. The overall reduction of the signal can be made up afterwards with the
  305. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  306. raising the makeup to this level results in a signal twice as loud than the
  307. source. To gain a softer entry in the compression the @code{knee} flattens the
  308. hard edge at the threshold in the range of the chosen decibels.
  309. The filter accepts the following options:
  310. @table @option
  311. @item level_in
  312. Set input gain. Default is 1. Range is between 0.015625 and 64.
  313. @item threshold
  314. If a signal of stream rises above this level it will affect the gain
  315. reduction.
  316. By default it is 0.125. Range is between 0.00097563 and 1.
  317. @item ratio
  318. Set a ratio by which the signal is reduced. 1:2 means that if the level
  319. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  320. Default is 2. Range is between 1 and 20.
  321. @item attack
  322. Amount of milliseconds the signal has to rise above the threshold before gain
  323. reduction starts. Default is 20. Range is between 0.01 and 2000.
  324. @item release
  325. Amount of milliseconds the signal has to fall below the threshold before
  326. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  327. @item makeup
  328. Set the amount by how much signal will be amplified after processing.
  329. Default is 1. Range is from 1 to 64.
  330. @item knee
  331. Curve the sharp knee around the threshold to enter gain reduction more softly.
  332. Default is 2.82843. Range is between 1 and 8.
  333. @item link
  334. Choose if the @code{average} level between all channels of input stream
  335. or the louder(@code{maximum}) channel of input stream affects the
  336. reduction. Default is @code{average}.
  337. @item detection
  338. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  339. of @code{rms}. Default is @code{rms} which is mostly smoother.
  340. @item mix
  341. How much to use compressed signal in output. Default is 1.
  342. Range is between 0 and 1.
  343. @end table
  344. @section acopy
  345. Copy the input audio source unchanged to the output. This is mainly useful for
  346. testing purposes.
  347. @section acrossfade
  348. Apply cross fade from one input audio stream to another input audio stream.
  349. The cross fade is applied for specified duration near the end of first stream.
  350. The filter accepts the following options:
  351. @table @option
  352. @item nb_samples, ns
  353. Specify the number of samples for which the cross fade effect has to last.
  354. At the end of the cross fade effect the first input audio will be completely
  355. silent. Default is 44100.
  356. @item duration, d
  357. Specify the duration of the cross fade effect. See
  358. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  359. for the accepted syntax.
  360. By default the duration is determined by @var{nb_samples}.
  361. If set this option is used instead of @var{nb_samples}.
  362. @item overlap, o
  363. Should first stream end overlap with second stream start. Default is enabled.
  364. @item curve1
  365. Set curve for cross fade transition for first stream.
  366. @item curve2
  367. Set curve for cross fade transition for second stream.
  368. For description of available curve types see @ref{afade} filter description.
  369. @end table
  370. @subsection Examples
  371. @itemize
  372. @item
  373. Cross fade from one input to another:
  374. @example
  375. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  376. @end example
  377. @item
  378. Cross fade from one input to another but without overlapping:
  379. @example
  380. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  381. @end example
  382. @end itemize
  383. @section acrusher
  384. Reduce audio bit resolution.
  385. This filter is bit crusher with enhanced functionality. A bit crusher
  386. is used to audibly reduce number of bits an audio signal is sampled
  387. with. This doesn't change the bit depth at all, it just produces the
  388. effect. Material reduced in bit depth sounds more harsh and "digital".
  389. This filter is able to even round to continuous values instead of discrete
  390. bit depths.
  391. Additionally it has a D/C offset which results in different crushing of
  392. the lower and the upper half of the signal.
  393. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  394. Another feature of this filter is the logarithmic mode.
  395. This setting switches from linear distances between bits to logarithmic ones.
  396. The result is a much more "natural" sounding crusher which doesn't gate low
  397. signals for example. The human ear has a logarithmic perception, too
  398. so this kind of crushing is much more pleasant.
  399. Logarithmic crushing is also able to get anti-aliased.
  400. The filter accepts the following options:
  401. @table @option
  402. @item level_in
  403. Set level in.
  404. @item level_out
  405. Set level out.
  406. @item bits
  407. Set bit reduction.
  408. @item mix
  409. Set mixing amount.
  410. @item mode
  411. Can be linear: @code{lin} or logarithmic: @code{log}.
  412. @item dc
  413. Set DC.
  414. @item aa
  415. Set anti-aliasing.
  416. @item samples
  417. Set sample reduction.
  418. @item lfo
  419. Enable LFO. By default disabled.
  420. @item lforange
  421. Set LFO range.
  422. @item lforate
  423. Set LFO rate.
  424. @end table
  425. @section adelay
  426. Delay one or more audio channels.
  427. Samples in delayed channel are filled with silence.
  428. The filter accepts the following option:
  429. @table @option
  430. @item delays
  431. Set list of delays in milliseconds for each channel separated by '|'.
  432. Unused delays will be silently ignored. If number of given delays is
  433. smaller than number of channels all remaining channels will not be delayed.
  434. If you want to delay exact number of samples, append 'S' to number.
  435. @end table
  436. @subsection Examples
  437. @itemize
  438. @item
  439. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  440. the second channel (and any other channels that may be present) unchanged.
  441. @example
  442. adelay=1500|0|500
  443. @end example
  444. @item
  445. Delay second channel by 500 samples, the third channel by 700 samples and leave
  446. the first channel (and any other channels that may be present) unchanged.
  447. @example
  448. adelay=0|500S|700S
  449. @end example
  450. @end itemize
  451. @section aecho
  452. Apply echoing to the input audio.
  453. Echoes are reflected sound and can occur naturally amongst mountains
  454. (and sometimes large buildings) when talking or shouting; digital echo
  455. effects emulate this behaviour and are often used to help fill out the
  456. sound of a single instrument or vocal. The time difference between the
  457. original signal and the reflection is the @code{delay}, and the
  458. loudness of the reflected signal is the @code{decay}.
  459. Multiple echoes can have different delays and decays.
  460. A description of the accepted parameters follows.
  461. @table @option
  462. @item in_gain
  463. Set input gain of reflected signal. Default is @code{0.6}.
  464. @item out_gain
  465. Set output gain of reflected signal. Default is @code{0.3}.
  466. @item delays
  467. Set list of time intervals in milliseconds between original signal and reflections
  468. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  469. Default is @code{1000}.
  470. @item decays
  471. Set list of loudness of reflected signals separated by '|'.
  472. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  473. Default is @code{0.5}.
  474. @end table
  475. @subsection Examples
  476. @itemize
  477. @item
  478. Make it sound as if there are twice as many instruments as are actually playing:
  479. @example
  480. aecho=0.8:0.88:60:0.4
  481. @end example
  482. @item
  483. If delay is very short, then it sound like a (metallic) robot playing music:
  484. @example
  485. aecho=0.8:0.88:6:0.4
  486. @end example
  487. @item
  488. A longer delay will sound like an open air concert in the mountains:
  489. @example
  490. aecho=0.8:0.9:1000:0.3
  491. @end example
  492. @item
  493. Same as above but with one more mountain:
  494. @example
  495. aecho=0.8:0.9:1000|1800:0.3|0.25
  496. @end example
  497. @end itemize
  498. @section aemphasis
  499. Audio emphasis filter creates or restores material directly taken from LPs or
  500. emphased CDs with different filter curves. E.g. to store music on vinyl the
  501. signal has to be altered by a filter first to even out the disadvantages of
  502. this recording medium.
  503. Once the material is played back the inverse filter has to be applied to
  504. restore the distortion of the frequency response.
  505. The filter accepts the following options:
  506. @table @option
  507. @item level_in
  508. Set input gain.
  509. @item level_out
  510. Set output gain.
  511. @item mode
  512. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  513. use @code{production} mode. Default is @code{reproduction} mode.
  514. @item type
  515. Set filter type. Selects medium. Can be one of the following:
  516. @table @option
  517. @item col
  518. select Columbia.
  519. @item emi
  520. select EMI.
  521. @item bsi
  522. select BSI (78RPM).
  523. @item riaa
  524. select RIAA.
  525. @item cd
  526. select Compact Disc (CD).
  527. @item 50fm
  528. select 50µs (FM).
  529. @item 75fm
  530. select 75µs (FM).
  531. @item 50kf
  532. select 50µs (FM-KF).
  533. @item 75kf
  534. select 75µs (FM-KF).
  535. @end table
  536. @end table
  537. @section aeval
  538. Modify an audio signal according to the specified expressions.
  539. This filter accepts one or more expressions (one for each channel),
  540. which are evaluated and used to modify a corresponding audio signal.
  541. It accepts the following parameters:
  542. @table @option
  543. @item exprs
  544. Set the '|'-separated expressions list for each separate channel. If
  545. the number of input channels is greater than the number of
  546. expressions, the last specified expression is used for the remaining
  547. output channels.
  548. @item channel_layout, c
  549. Set output channel layout. If not specified, the channel layout is
  550. specified by the number of expressions. If set to @samp{same}, it will
  551. use by default the same input channel layout.
  552. @end table
  553. Each expression in @var{exprs} can contain the following constants and functions:
  554. @table @option
  555. @item ch
  556. channel number of the current expression
  557. @item n
  558. number of the evaluated sample, starting from 0
  559. @item s
  560. sample rate
  561. @item t
  562. time of the evaluated sample expressed in seconds
  563. @item nb_in_channels
  564. @item nb_out_channels
  565. input and output number of channels
  566. @item val(CH)
  567. the value of input channel with number @var{CH}
  568. @end table
  569. Note: this filter is slow. For faster processing you should use a
  570. dedicated filter.
  571. @subsection Examples
  572. @itemize
  573. @item
  574. Half volume:
  575. @example
  576. aeval=val(ch)/2:c=same
  577. @end example
  578. @item
  579. Invert phase of the second channel:
  580. @example
  581. aeval=val(0)|-val(1)
  582. @end example
  583. @end itemize
  584. @anchor{afade}
  585. @section afade
  586. Apply fade-in/out effect to input audio.
  587. A description of the accepted parameters follows.
  588. @table @option
  589. @item type, t
  590. Specify the effect type, can be either @code{in} for fade-in, or
  591. @code{out} for a fade-out effect. Default is @code{in}.
  592. @item start_sample, ss
  593. Specify the number of the start sample for starting to apply the fade
  594. effect. Default is 0.
  595. @item nb_samples, ns
  596. Specify the number of samples for which the fade effect has to last. At
  597. the end of the fade-in effect the output audio will have the same
  598. volume as the input audio, at the end of the fade-out transition
  599. the output audio will be silence. Default is 44100.
  600. @item start_time, st
  601. Specify the start time of the fade effect. Default is 0.
  602. The value must be specified as a time duration; see
  603. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  604. for the accepted syntax.
  605. If set this option is used instead of @var{start_sample}.
  606. @item duration, d
  607. Specify the duration of the fade effect. See
  608. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  609. for the accepted syntax.
  610. At the end of the fade-in effect the output audio will have the same
  611. volume as the input audio, at the end of the fade-out transition
  612. the output audio will be silence.
  613. By default the duration is determined by @var{nb_samples}.
  614. If set this option is used instead of @var{nb_samples}.
  615. @item curve
  616. Set curve for fade transition.
  617. It accepts the following values:
  618. @table @option
  619. @item tri
  620. select triangular, linear slope (default)
  621. @item qsin
  622. select quarter of sine wave
  623. @item hsin
  624. select half of sine wave
  625. @item esin
  626. select exponential sine wave
  627. @item log
  628. select logarithmic
  629. @item ipar
  630. select inverted parabola
  631. @item qua
  632. select quadratic
  633. @item cub
  634. select cubic
  635. @item squ
  636. select square root
  637. @item cbr
  638. select cubic root
  639. @item par
  640. select parabola
  641. @item exp
  642. select exponential
  643. @item iqsin
  644. select inverted quarter of sine wave
  645. @item ihsin
  646. select inverted half of sine wave
  647. @item dese
  648. select double-exponential seat
  649. @item desi
  650. select double-exponential sigmoid
  651. @end table
  652. @end table
  653. @subsection Examples
  654. @itemize
  655. @item
  656. Fade in first 15 seconds of audio:
  657. @example
  658. afade=t=in:ss=0:d=15
  659. @end example
  660. @item
  661. Fade out last 25 seconds of a 900 seconds audio:
  662. @example
  663. afade=t=out:st=875:d=25
  664. @end example
  665. @end itemize
  666. @section afftfilt
  667. Apply arbitrary expressions to samples in frequency domain.
  668. @table @option
  669. @item real
  670. Set frequency domain real expression for each separate channel separated
  671. by '|'. Default is "1".
  672. If the number of input channels is greater than the number of
  673. expressions, the last specified expression is used for the remaining
  674. output channels.
  675. @item imag
  676. Set frequency domain imaginary expression for each separate channel
  677. separated by '|'. If not set, @var{real} option is used.
  678. Each expression in @var{real} and @var{imag} can contain the following
  679. constants:
  680. @table @option
  681. @item sr
  682. sample rate
  683. @item b
  684. current frequency bin number
  685. @item nb
  686. number of available bins
  687. @item ch
  688. channel number of the current expression
  689. @item chs
  690. number of channels
  691. @item pts
  692. current frame pts
  693. @end table
  694. @item win_size
  695. Set window size.
  696. It accepts the following values:
  697. @table @samp
  698. @item w16
  699. @item w32
  700. @item w64
  701. @item w128
  702. @item w256
  703. @item w512
  704. @item w1024
  705. @item w2048
  706. @item w4096
  707. @item w8192
  708. @item w16384
  709. @item w32768
  710. @item w65536
  711. @end table
  712. Default is @code{w4096}
  713. @item win_func
  714. Set window function. Default is @code{hann}.
  715. @item overlap
  716. Set window overlap. If set to 1, the recommended overlap for selected
  717. window function will be picked. Default is @code{0.75}.
  718. @end table
  719. @subsection Examples
  720. @itemize
  721. @item
  722. Leave almost only low frequencies in audio:
  723. @example
  724. afftfilt="1-clip((b/nb)*b,0,1)"
  725. @end example
  726. @end itemize
  727. @section afir
  728. Apply an arbitrary Frequency Impulse Response filter.
  729. This filter is designed for applying long FIR filters,
  730. up to 30 seconds long.
  731. It can be used as component for digital crossover filters,
  732. room equalization, cross talk cancellation, wavefield synthesis,
  733. auralization, ambiophonics and ambisonics.
  734. This filter uses second stream as FIR coefficients.
  735. If second stream holds single channel, it will be used
  736. for all input channels in first stream, otherwise
  737. number of channels in second stream must be same as
  738. number of channels in first stream.
  739. It accepts the following parameters:
  740. @table @option
  741. @item dry
  742. Set dry gain. This sets input gain.
  743. @item wet
  744. Set wet gain. This sets final output gain.
  745. @item length
  746. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  747. @item again
  748. Enable applying gain measured from power of IR.
  749. @end table
  750. @subsection Examples
  751. @itemize
  752. @item
  753. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  754. @example
  755. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  756. @end example
  757. @end itemize
  758. @anchor{aformat}
  759. @section aformat
  760. Set output format constraints for the input audio. The framework will
  761. negotiate the most appropriate format to minimize conversions.
  762. It accepts the following parameters:
  763. @table @option
  764. @item sample_fmts
  765. A '|'-separated list of requested sample formats.
  766. @item sample_rates
  767. A '|'-separated list of requested sample rates.
  768. @item channel_layouts
  769. A '|'-separated list of requested channel layouts.
  770. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  771. for the required syntax.
  772. @end table
  773. If a parameter is omitted, all values are allowed.
  774. Force the output to either unsigned 8-bit or signed 16-bit stereo
  775. @example
  776. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  777. @end example
  778. @section agate
  779. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  780. processing reduces disturbing noise between useful signals.
  781. Gating is done by detecting the volume below a chosen level @var{threshold}
  782. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  783. floor is set via @var{range}. Because an exact manipulation of the signal
  784. would cause distortion of the waveform the reduction can be levelled over
  785. time. This is done by setting @var{attack} and @var{release}.
  786. @var{attack} determines how long the signal has to fall below the threshold
  787. before any reduction will occur and @var{release} sets the time the signal
  788. has to rise above the threshold to reduce the reduction again.
  789. Shorter signals than the chosen attack time will be left untouched.
  790. @table @option
  791. @item level_in
  792. Set input level before filtering.
  793. Default is 1. Allowed range is from 0.015625 to 64.
  794. @item range
  795. Set the level of gain reduction when the signal is below the threshold.
  796. Default is 0.06125. Allowed range is from 0 to 1.
  797. @item threshold
  798. If a signal rises above this level the gain reduction is released.
  799. Default is 0.125. Allowed range is from 0 to 1.
  800. @item ratio
  801. Set a ratio by which the signal is reduced.
  802. Default is 2. Allowed range is from 1 to 9000.
  803. @item attack
  804. Amount of milliseconds the signal has to rise above the threshold before gain
  805. reduction stops.
  806. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  807. @item release
  808. Amount of milliseconds the signal has to fall below the threshold before the
  809. reduction is increased again. Default is 250 milliseconds.
  810. Allowed range is from 0.01 to 9000.
  811. @item makeup
  812. Set amount of amplification of signal after processing.
  813. Default is 1. Allowed range is from 1 to 64.
  814. @item knee
  815. Curve the sharp knee around the threshold to enter gain reduction more softly.
  816. Default is 2.828427125. Allowed range is from 1 to 8.
  817. @item detection
  818. Choose if exact signal should be taken for detection or an RMS like one.
  819. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  820. @item link
  821. Choose if the average level between all channels or the louder channel affects
  822. the reduction.
  823. Default is @code{average}. Can be @code{average} or @code{maximum}.
  824. @end table
  825. @section alimiter
  826. The limiter prevents an input signal from rising over a desired threshold.
  827. This limiter uses lookahead technology to prevent your signal from distorting.
  828. It means that there is a small delay after the signal is processed. Keep in mind
  829. that the delay it produces is the attack time you set.
  830. The filter accepts the following options:
  831. @table @option
  832. @item level_in
  833. Set input gain. Default is 1.
  834. @item level_out
  835. Set output gain. Default is 1.
  836. @item limit
  837. Don't let signals above this level pass the limiter. Default is 1.
  838. @item attack
  839. The limiter will reach its attenuation level in this amount of time in
  840. milliseconds. Default is 5 milliseconds.
  841. @item release
  842. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  843. Default is 50 milliseconds.
  844. @item asc
  845. When gain reduction is always needed ASC takes care of releasing to an
  846. average reduction level rather than reaching a reduction of 0 in the release
  847. time.
  848. @item asc_level
  849. Select how much the release time is affected by ASC, 0 means nearly no changes
  850. in release time while 1 produces higher release times.
  851. @item level
  852. Auto level output signal. Default is enabled.
  853. This normalizes audio back to 0dB if enabled.
  854. @end table
  855. Depending on picked setting it is recommended to upsample input 2x or 4x times
  856. with @ref{aresample} before applying this filter.
  857. @section allpass
  858. Apply a two-pole all-pass filter with central frequency (in Hz)
  859. @var{frequency}, and filter-width @var{width}.
  860. An all-pass filter changes the audio's frequency to phase relationship
  861. without changing its frequency to amplitude relationship.
  862. The filter accepts the following options:
  863. @table @option
  864. @item frequency, f
  865. Set frequency in Hz.
  866. @item width_type, t
  867. Set method to specify band-width of filter.
  868. @table @option
  869. @item h
  870. Hz
  871. @item q
  872. Q-Factor
  873. @item o
  874. octave
  875. @item s
  876. slope
  877. @end table
  878. @item width, w
  879. Specify the band-width of a filter in width_type units.
  880. @item channels, c
  881. Specify which channels to filter, by default all available are filtered.
  882. @end table
  883. @section aloop
  884. Loop audio samples.
  885. The filter accepts the following options:
  886. @table @option
  887. @item loop
  888. Set the number of loops.
  889. @item size
  890. Set maximal number of samples.
  891. @item start
  892. Set first sample of loop.
  893. @end table
  894. @anchor{amerge}
  895. @section amerge
  896. Merge two or more audio streams into a single multi-channel stream.
  897. The filter accepts the following options:
  898. @table @option
  899. @item inputs
  900. Set the number of inputs. Default is 2.
  901. @end table
  902. If the channel layouts of the inputs are disjoint, and therefore compatible,
  903. the channel layout of the output will be set accordingly and the channels
  904. will be reordered as necessary. If the channel layouts of the inputs are not
  905. disjoint, the output will have all the channels of the first input then all
  906. the channels of the second input, in that order, and the channel layout of
  907. the output will be the default value corresponding to the total number of
  908. channels.
  909. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  910. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  911. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  912. first input, b1 is the first channel of the second input).
  913. On the other hand, if both input are in stereo, the output channels will be
  914. in the default order: a1, a2, b1, b2, and the channel layout will be
  915. arbitrarily set to 4.0, which may or may not be the expected value.
  916. All inputs must have the same sample rate, and format.
  917. If inputs do not have the same duration, the output will stop with the
  918. shortest.
  919. @subsection Examples
  920. @itemize
  921. @item
  922. Merge two mono files into a stereo stream:
  923. @example
  924. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  925. @end example
  926. @item
  927. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  928. @example
  929. ffmpeg -i input.mkv -filter_complex "[0:1][0:2][0:3][0:4][0:5][0:6] amerge=inputs=6" -c:a pcm_s16le output.mkv
  930. @end example
  931. @end itemize
  932. @section amix
  933. Mixes multiple audio inputs into a single output.
  934. Note that this filter only supports float samples (the @var{amerge}
  935. and @var{pan} audio filters support many formats). If the @var{amix}
  936. input has integer samples then @ref{aresample} will be automatically
  937. inserted to perform the conversion to float samples.
  938. For example
  939. @example
  940. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  941. @end example
  942. will mix 3 input audio streams to a single output with the same duration as the
  943. first input and a dropout transition time of 3 seconds.
  944. It accepts the following parameters:
  945. @table @option
  946. @item inputs
  947. The number of inputs. If unspecified, it defaults to 2.
  948. @item duration
  949. How to determine the end-of-stream.
  950. @table @option
  951. @item longest
  952. The duration of the longest input. (default)
  953. @item shortest
  954. The duration of the shortest input.
  955. @item first
  956. The duration of the first input.
  957. @end table
  958. @item dropout_transition
  959. The transition time, in seconds, for volume renormalization when an input
  960. stream ends. The default value is 2 seconds.
  961. @end table
  962. @section anequalizer
  963. High-order parametric multiband equalizer for each channel.
  964. It accepts the following parameters:
  965. @table @option
  966. @item params
  967. This option string is in format:
  968. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  969. Each equalizer band is separated by '|'.
  970. @table @option
  971. @item chn
  972. Set channel number to which equalization will be applied.
  973. If input doesn't have that channel the entry is ignored.
  974. @item f
  975. Set central frequency for band.
  976. If input doesn't have that frequency the entry is ignored.
  977. @item w
  978. Set band width in hertz.
  979. @item g
  980. Set band gain in dB.
  981. @item t
  982. Set filter type for band, optional, can be:
  983. @table @samp
  984. @item 0
  985. Butterworth, this is default.
  986. @item 1
  987. Chebyshev type 1.
  988. @item 2
  989. Chebyshev type 2.
  990. @end table
  991. @end table
  992. @item curves
  993. With this option activated frequency response of anequalizer is displayed
  994. in video stream.
  995. @item size
  996. Set video stream size. Only useful if curves option is activated.
  997. @item mgain
  998. Set max gain that will be displayed. Only useful if curves option is activated.
  999. Setting this to a reasonable value makes it possible to display gain which is derived from
  1000. neighbour bands which are too close to each other and thus produce higher gain
  1001. when both are activated.
  1002. @item fscale
  1003. Set frequency scale used to draw frequency response in video output.
  1004. Can be linear or logarithmic. Default is logarithmic.
  1005. @item colors
  1006. Set color for each channel curve which is going to be displayed in video stream.
  1007. This is list of color names separated by space or by '|'.
  1008. Unrecognised or missing colors will be replaced by white color.
  1009. @end table
  1010. @subsection Examples
  1011. @itemize
  1012. @item
  1013. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1014. for first 2 channels using Chebyshev type 1 filter:
  1015. @example
  1016. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1017. @end example
  1018. @end itemize
  1019. @subsection Commands
  1020. This filter supports the following commands:
  1021. @table @option
  1022. @item change
  1023. Alter existing filter parameters.
  1024. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1025. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1026. error is returned.
  1027. @var{freq} set new frequency parameter.
  1028. @var{width} set new width parameter in herz.
  1029. @var{gain} set new gain parameter in dB.
  1030. Full filter invocation with asendcmd may look like this:
  1031. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1032. @end table
  1033. @section anull
  1034. Pass the audio source unchanged to the output.
  1035. @section apad
  1036. Pad the end of an audio stream with silence.
  1037. This can be used together with @command{ffmpeg} @option{-shortest} to
  1038. extend audio streams to the same length as the video stream.
  1039. A description of the accepted options follows.
  1040. @table @option
  1041. @item packet_size
  1042. Set silence packet size. Default value is 4096.
  1043. @item pad_len
  1044. Set the number of samples of silence to add to the end. After the
  1045. value is reached, the stream is terminated. This option is mutually
  1046. exclusive with @option{whole_len}.
  1047. @item whole_len
  1048. Set the minimum total number of samples in the output audio stream. If
  1049. the value is longer than the input audio length, silence is added to
  1050. the end, until the value is reached. This option is mutually exclusive
  1051. with @option{pad_len}.
  1052. @end table
  1053. If neither the @option{pad_len} nor the @option{whole_len} option is
  1054. set, the filter will add silence to the end of the input stream
  1055. indefinitely.
  1056. @subsection Examples
  1057. @itemize
  1058. @item
  1059. Add 1024 samples of silence to the end of the input:
  1060. @example
  1061. apad=pad_len=1024
  1062. @end example
  1063. @item
  1064. Make sure the audio output will contain at least 10000 samples, pad
  1065. the input with silence if required:
  1066. @example
  1067. apad=whole_len=10000
  1068. @end example
  1069. @item
  1070. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1071. video stream will always result the shortest and will be converted
  1072. until the end in the output file when using the @option{shortest}
  1073. option:
  1074. @example
  1075. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1076. @end example
  1077. @end itemize
  1078. @section aphaser
  1079. Add a phasing effect to the input audio.
  1080. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1081. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1082. A description of the accepted parameters follows.
  1083. @table @option
  1084. @item in_gain
  1085. Set input gain. Default is 0.4.
  1086. @item out_gain
  1087. Set output gain. Default is 0.74
  1088. @item delay
  1089. Set delay in milliseconds. Default is 3.0.
  1090. @item decay
  1091. Set decay. Default is 0.4.
  1092. @item speed
  1093. Set modulation speed in Hz. Default is 0.5.
  1094. @item type
  1095. Set modulation type. Default is triangular.
  1096. It accepts the following values:
  1097. @table @samp
  1098. @item triangular, t
  1099. @item sinusoidal, s
  1100. @end table
  1101. @end table
  1102. @section apulsator
  1103. Audio pulsator is something between an autopanner and a tremolo.
  1104. But it can produce funny stereo effects as well. Pulsator changes the volume
  1105. of the left and right channel based on a LFO (low frequency oscillator) with
  1106. different waveforms and shifted phases.
  1107. This filter have the ability to define an offset between left and right
  1108. channel. An offset of 0 means that both LFO shapes match each other.
  1109. The left and right channel are altered equally - a conventional tremolo.
  1110. An offset of 50% means that the shape of the right channel is exactly shifted
  1111. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1112. an autopanner. At 1 both curves match again. Every setting in between moves the
  1113. phase shift gapless between all stages and produces some "bypassing" sounds with
  1114. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1115. the 0.5) the faster the signal passes from the left to the right speaker.
  1116. The filter accepts the following options:
  1117. @table @option
  1118. @item level_in
  1119. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1120. @item level_out
  1121. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1122. @item mode
  1123. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1124. sawup or sawdown. Default is sine.
  1125. @item amount
  1126. Set modulation. Define how much of original signal is affected by the LFO.
  1127. @item offset_l
  1128. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1129. @item offset_r
  1130. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1131. @item width
  1132. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1133. @item timing
  1134. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1135. @item bpm
  1136. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1137. is set to bpm.
  1138. @item ms
  1139. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1140. is set to ms.
  1141. @item hz
  1142. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1143. if timing is set to hz.
  1144. @end table
  1145. @anchor{aresample}
  1146. @section aresample
  1147. Resample the input audio to the specified parameters, using the
  1148. libswresample library. If none are specified then the filter will
  1149. automatically convert between its input and output.
  1150. This filter is also able to stretch/squeeze the audio data to make it match
  1151. the timestamps or to inject silence / cut out audio to make it match the
  1152. timestamps, do a combination of both or do neither.
  1153. The filter accepts the syntax
  1154. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1155. expresses a sample rate and @var{resampler_options} is a list of
  1156. @var{key}=@var{value} pairs, separated by ":". See the
  1157. @ref{Resampler Options,,the "Resampler Options" section in the
  1158. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1159. for the complete list of supported options.
  1160. @subsection Examples
  1161. @itemize
  1162. @item
  1163. Resample the input audio to 44100Hz:
  1164. @example
  1165. aresample=44100
  1166. @end example
  1167. @item
  1168. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1169. samples per second compensation:
  1170. @example
  1171. aresample=async=1000
  1172. @end example
  1173. @end itemize
  1174. @section areverse
  1175. Reverse an audio clip.
  1176. Warning: This filter requires memory to buffer the entire clip, so trimming
  1177. is suggested.
  1178. @subsection Examples
  1179. @itemize
  1180. @item
  1181. Take the first 5 seconds of a clip, and reverse it.
  1182. @example
  1183. atrim=end=5,areverse
  1184. @end example
  1185. @end itemize
  1186. @section asetnsamples
  1187. Set the number of samples per each output audio frame.
  1188. The last output packet may contain a different number of samples, as
  1189. the filter will flush all the remaining samples when the input audio
  1190. signals its end.
  1191. The filter accepts the following options:
  1192. @table @option
  1193. @item nb_out_samples, n
  1194. Set the number of frames per each output audio frame. The number is
  1195. intended as the number of samples @emph{per each channel}.
  1196. Default value is 1024.
  1197. @item pad, p
  1198. If set to 1, the filter will pad the last audio frame with zeroes, so
  1199. that the last frame will contain the same number of samples as the
  1200. previous ones. Default value is 1.
  1201. @end table
  1202. For example, to set the number of per-frame samples to 1234 and
  1203. disable padding for the last frame, use:
  1204. @example
  1205. asetnsamples=n=1234:p=0
  1206. @end example
  1207. @section asetrate
  1208. Set the sample rate without altering the PCM data.
  1209. This will result in a change of speed and pitch.
  1210. The filter accepts the following options:
  1211. @table @option
  1212. @item sample_rate, r
  1213. Set the output sample rate. Default is 44100 Hz.
  1214. @end table
  1215. @section ashowinfo
  1216. Show a line containing various information for each input audio frame.
  1217. The input audio is not modified.
  1218. The shown line contains a sequence of key/value pairs of the form
  1219. @var{key}:@var{value}.
  1220. The following values are shown in the output:
  1221. @table @option
  1222. @item n
  1223. The (sequential) number of the input frame, starting from 0.
  1224. @item pts
  1225. The presentation timestamp of the input frame, in time base units; the time base
  1226. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1227. @item pts_time
  1228. The presentation timestamp of the input frame in seconds.
  1229. @item pos
  1230. position of the frame in the input stream, -1 if this information in
  1231. unavailable and/or meaningless (for example in case of synthetic audio)
  1232. @item fmt
  1233. The sample format.
  1234. @item chlayout
  1235. The channel layout.
  1236. @item rate
  1237. The sample rate for the audio frame.
  1238. @item nb_samples
  1239. The number of samples (per channel) in the frame.
  1240. @item checksum
  1241. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1242. audio, the data is treated as if all the planes were concatenated.
  1243. @item plane_checksums
  1244. A list of Adler-32 checksums for each data plane.
  1245. @end table
  1246. @anchor{astats}
  1247. @section astats
  1248. Display time domain statistical information about the audio channels.
  1249. Statistics are calculated and displayed for each audio channel and,
  1250. where applicable, an overall figure is also given.
  1251. It accepts the following option:
  1252. @table @option
  1253. @item length
  1254. Short window length in seconds, used for peak and trough RMS measurement.
  1255. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.1 - 10]}.
  1256. @item metadata
  1257. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1258. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1259. disabled.
  1260. Available keys for each channel are:
  1261. DC_offset
  1262. Min_level
  1263. Max_level
  1264. Min_difference
  1265. Max_difference
  1266. Mean_difference
  1267. RMS_difference
  1268. Peak_level
  1269. RMS_peak
  1270. RMS_trough
  1271. Crest_factor
  1272. Flat_factor
  1273. Peak_count
  1274. Bit_depth
  1275. Dynamic_range
  1276. and for Overall:
  1277. DC_offset
  1278. Min_level
  1279. Max_level
  1280. Min_difference
  1281. Max_difference
  1282. Mean_difference
  1283. RMS_difference
  1284. Peak_level
  1285. RMS_level
  1286. RMS_peak
  1287. RMS_trough
  1288. Flat_factor
  1289. Peak_count
  1290. Bit_depth
  1291. Number_of_samples
  1292. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1293. this @code{lavfi.astats.Overall.Peak_count}.
  1294. For description what each key means read below.
  1295. @item reset
  1296. Set number of frame after which stats are going to be recalculated.
  1297. Default is disabled.
  1298. @end table
  1299. A description of each shown parameter follows:
  1300. @table @option
  1301. @item DC offset
  1302. Mean amplitude displacement from zero.
  1303. @item Min level
  1304. Minimal sample level.
  1305. @item Max level
  1306. Maximal sample level.
  1307. @item Min difference
  1308. Minimal difference between two consecutive samples.
  1309. @item Max difference
  1310. Maximal difference between two consecutive samples.
  1311. @item Mean difference
  1312. Mean difference between two consecutive samples.
  1313. The average of each difference between two consecutive samples.
  1314. @item RMS difference
  1315. Root Mean Square difference between two consecutive samples.
  1316. @item Peak level dB
  1317. @item RMS level dB
  1318. Standard peak and RMS level measured in dBFS.
  1319. @item RMS peak dB
  1320. @item RMS trough dB
  1321. Peak and trough values for RMS level measured over a short window.
  1322. @item Crest factor
  1323. Standard ratio of peak to RMS level (note: not in dB).
  1324. @item Flat factor
  1325. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1326. (i.e. either @var{Min level} or @var{Max level}).
  1327. @item Peak count
  1328. Number of occasions (not the number of samples) that the signal attained either
  1329. @var{Min level} or @var{Max level}.
  1330. @item Bit depth
  1331. Overall bit depth of audio. Number of bits used for each sample.
  1332. @item Dynamic range
  1333. Measured dynamic range of audio in dB.
  1334. @end table
  1335. @section atempo
  1336. Adjust audio tempo.
  1337. The filter accepts exactly one parameter, the audio tempo. If not
  1338. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1339. be in the [0.5, 2.0] range.
  1340. @subsection Examples
  1341. @itemize
  1342. @item
  1343. Slow down audio to 80% tempo:
  1344. @example
  1345. atempo=0.8
  1346. @end example
  1347. @item
  1348. To speed up audio to 125% tempo:
  1349. @example
  1350. atempo=1.25
  1351. @end example
  1352. @end itemize
  1353. @section atrim
  1354. Trim the input so that the output contains one continuous subpart of the input.
  1355. It accepts the following parameters:
  1356. @table @option
  1357. @item start
  1358. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1359. sample with the timestamp @var{start} will be the first sample in the output.
  1360. @item end
  1361. Specify time of the first audio sample that will be dropped, i.e. the
  1362. audio sample immediately preceding the one with the timestamp @var{end} will be
  1363. the last sample in the output.
  1364. @item start_pts
  1365. Same as @var{start}, except this option sets the start timestamp in samples
  1366. instead of seconds.
  1367. @item end_pts
  1368. Same as @var{end}, except this option sets the end timestamp in samples instead
  1369. of seconds.
  1370. @item duration
  1371. The maximum duration of the output in seconds.
  1372. @item start_sample
  1373. The number of the first sample that should be output.
  1374. @item end_sample
  1375. The number of the first sample that should be dropped.
  1376. @end table
  1377. @option{start}, @option{end}, and @option{duration} are expressed as time
  1378. duration specifications; see
  1379. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1380. Note that the first two sets of the start/end options and the @option{duration}
  1381. option look at the frame timestamp, while the _sample options simply count the
  1382. samples that pass through the filter. So start/end_pts and start/end_sample will
  1383. give different results when the timestamps are wrong, inexact or do not start at
  1384. zero. Also note that this filter does not modify the timestamps. If you wish
  1385. to have the output timestamps start at zero, insert the asetpts filter after the
  1386. atrim filter.
  1387. If multiple start or end options are set, this filter tries to be greedy and
  1388. keep all samples that match at least one of the specified constraints. To keep
  1389. only the part that matches all the constraints at once, chain multiple atrim
  1390. filters.
  1391. The defaults are such that all the input is kept. So it is possible to set e.g.
  1392. just the end values to keep everything before the specified time.
  1393. Examples:
  1394. @itemize
  1395. @item
  1396. Drop everything except the second minute of input:
  1397. @example
  1398. ffmpeg -i INPUT -af atrim=60:120
  1399. @end example
  1400. @item
  1401. Keep only the first 1000 samples:
  1402. @example
  1403. ffmpeg -i INPUT -af atrim=end_sample=1000
  1404. @end example
  1405. @end itemize
  1406. @section bandpass
  1407. Apply a two-pole Butterworth band-pass filter with central
  1408. frequency @var{frequency}, and (3dB-point) band-width width.
  1409. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1410. instead of the default: constant 0dB peak gain.
  1411. The filter roll off at 6dB per octave (20dB per decade).
  1412. The filter accepts the following options:
  1413. @table @option
  1414. @item frequency, f
  1415. Set the filter's central frequency. Default is @code{3000}.
  1416. @item csg
  1417. Constant skirt gain if set to 1. Defaults to 0.
  1418. @item width_type, t
  1419. Set method to specify band-width of filter.
  1420. @table @option
  1421. @item h
  1422. Hz
  1423. @item q
  1424. Q-Factor
  1425. @item o
  1426. octave
  1427. @item s
  1428. slope
  1429. @end table
  1430. @item width, w
  1431. Specify the band-width of a filter in width_type units.
  1432. @item channels, c
  1433. Specify which channels to filter, by default all available are filtered.
  1434. @end table
  1435. @section bandreject
  1436. Apply a two-pole Butterworth band-reject filter with central
  1437. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1438. The filter roll off at 6dB per octave (20dB per decade).
  1439. The filter accepts the following options:
  1440. @table @option
  1441. @item frequency, f
  1442. Set the filter's central frequency. Default is @code{3000}.
  1443. @item width_type, t
  1444. Set method to specify band-width of filter.
  1445. @table @option
  1446. @item h
  1447. Hz
  1448. @item q
  1449. Q-Factor
  1450. @item o
  1451. octave
  1452. @item s
  1453. slope
  1454. @end table
  1455. @item width, w
  1456. Specify the band-width of a filter in width_type units.
  1457. @item channels, c
  1458. Specify which channels to filter, by default all available are filtered.
  1459. @end table
  1460. @section bass
  1461. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1462. shelving filter with a response similar to that of a standard
  1463. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1464. The filter accepts the following options:
  1465. @table @option
  1466. @item gain, g
  1467. Give the gain at 0 Hz. Its useful range is about -20
  1468. (for a large cut) to +20 (for a large boost).
  1469. Beware of clipping when using a positive gain.
  1470. @item frequency, f
  1471. Set the filter's central frequency and so can be used
  1472. to extend or reduce the frequency range to be boosted or cut.
  1473. The default value is @code{100} Hz.
  1474. @item width_type, t
  1475. Set method to specify band-width of filter.
  1476. @table @option
  1477. @item h
  1478. Hz
  1479. @item q
  1480. Q-Factor
  1481. @item o
  1482. octave
  1483. @item s
  1484. slope
  1485. @end table
  1486. @item width, w
  1487. Determine how steep is the filter's shelf transition.
  1488. @item channels, c
  1489. Specify which channels to filter, by default all available are filtered.
  1490. @end table
  1491. @section biquad
  1492. Apply a biquad IIR filter with the given coefficients.
  1493. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1494. are the numerator and denominator coefficients respectively.
  1495. and @var{channels}, @var{c} specify which channels to filter, by default all
  1496. available are filtered.
  1497. @section bs2b
  1498. Bauer stereo to binaural transformation, which improves headphone listening of
  1499. stereo audio records.
  1500. To enable compilation of this filter you need to configure FFmpeg with
  1501. @code{--enable-libbs2b}.
  1502. It accepts the following parameters:
  1503. @table @option
  1504. @item profile
  1505. Pre-defined crossfeed level.
  1506. @table @option
  1507. @item default
  1508. Default level (fcut=700, feed=50).
  1509. @item cmoy
  1510. Chu Moy circuit (fcut=700, feed=60).
  1511. @item jmeier
  1512. Jan Meier circuit (fcut=650, feed=95).
  1513. @end table
  1514. @item fcut
  1515. Cut frequency (in Hz).
  1516. @item feed
  1517. Feed level (in Hz).
  1518. @end table
  1519. @section channelmap
  1520. Remap input channels to new locations.
  1521. It accepts the following parameters:
  1522. @table @option
  1523. @item map
  1524. Map channels from input to output. The argument is a '|'-separated list of
  1525. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1526. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1527. channel (e.g. FL for front left) or its index in the input channel layout.
  1528. @var{out_channel} is the name of the output channel or its index in the output
  1529. channel layout. If @var{out_channel} is not given then it is implicitly an
  1530. index, starting with zero and increasing by one for each mapping.
  1531. @item channel_layout
  1532. The channel layout of the output stream.
  1533. @end table
  1534. If no mapping is present, the filter will implicitly map input channels to
  1535. output channels, preserving indices.
  1536. For example, assuming a 5.1+downmix input MOV file,
  1537. @example
  1538. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1539. @end example
  1540. will create an output WAV file tagged as stereo from the downmix channels of
  1541. the input.
  1542. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1543. @example
  1544. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1545. @end example
  1546. @section channelsplit
  1547. Split each channel from an input audio stream into a separate output stream.
  1548. It accepts the following parameters:
  1549. @table @option
  1550. @item channel_layout
  1551. The channel layout of the input stream. The default is "stereo".
  1552. @end table
  1553. For example, assuming a stereo input MP3 file,
  1554. @example
  1555. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1556. @end example
  1557. will create an output Matroska file with two audio streams, one containing only
  1558. the left channel and the other the right channel.
  1559. Split a 5.1 WAV file into per-channel files:
  1560. @example
  1561. ffmpeg -i in.wav -filter_complex
  1562. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1563. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1564. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1565. side_right.wav
  1566. @end example
  1567. @section chorus
  1568. Add a chorus effect to the audio.
  1569. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1570. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1571. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1572. The modulation depth defines the range the modulated delay is played before or after
  1573. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1574. sound tuned around the original one, like in a chorus where some vocals are slightly
  1575. off key.
  1576. It accepts the following parameters:
  1577. @table @option
  1578. @item in_gain
  1579. Set input gain. Default is 0.4.
  1580. @item out_gain
  1581. Set output gain. Default is 0.4.
  1582. @item delays
  1583. Set delays. A typical delay is around 40ms to 60ms.
  1584. @item decays
  1585. Set decays.
  1586. @item speeds
  1587. Set speeds.
  1588. @item depths
  1589. Set depths.
  1590. @end table
  1591. @subsection Examples
  1592. @itemize
  1593. @item
  1594. A single delay:
  1595. @example
  1596. chorus=0.7:0.9:55:0.4:0.25:2
  1597. @end example
  1598. @item
  1599. Two delays:
  1600. @example
  1601. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1602. @end example
  1603. @item
  1604. Fuller sounding chorus with three delays:
  1605. @example
  1606. chorus=0.5:0.9:50|60|40:0.4|0.32|0.3:0.25|0.4|0.3:2|2.3|1.3
  1607. @end example
  1608. @end itemize
  1609. @section compand
  1610. Compress or expand the audio's dynamic range.
  1611. It accepts the following parameters:
  1612. @table @option
  1613. @item attacks
  1614. @item decays
  1615. A list of times in seconds for each channel over which the instantaneous level
  1616. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1617. increase of volume and @var{decays} refers to decrease of volume. For most
  1618. situations, the attack time (response to the audio getting louder) should be
  1619. shorter than the decay time, because the human ear is more sensitive to sudden
  1620. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1621. a typical value for decay is 0.8 seconds.
  1622. If specified number of attacks & decays is lower than number of channels, the last
  1623. set attack/decay will be used for all remaining channels.
  1624. @item points
  1625. A list of points for the transfer function, specified in dB relative to the
  1626. maximum possible signal amplitude. Each key points list must be defined using
  1627. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1628. @code{x0/y0 x1/y1 x2/y2 ....}
  1629. The input values must be in strictly increasing order but the transfer function
  1630. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1631. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1632. function are @code{-70/-70|-60/-20|1/0}.
  1633. @item soft-knee
  1634. Set the curve radius in dB for all joints. It defaults to 0.01.
  1635. @item gain
  1636. Set the additional gain in dB to be applied at all points on the transfer
  1637. function. This allows for easy adjustment of the overall gain.
  1638. It defaults to 0.
  1639. @item volume
  1640. Set an initial volume, in dB, to be assumed for each channel when filtering
  1641. starts. This permits the user to supply a nominal level initially, so that, for
  1642. example, a very large gain is not applied to initial signal levels before the
  1643. companding has begun to operate. A typical value for audio which is initially
  1644. quiet is -90 dB. It defaults to 0.
  1645. @item delay
  1646. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1647. delayed before being fed to the volume adjuster. Specifying a delay
  1648. approximately equal to the attack/decay times allows the filter to effectively
  1649. operate in predictive rather than reactive mode. It defaults to 0.
  1650. @end table
  1651. @subsection Examples
  1652. @itemize
  1653. @item
  1654. Make music with both quiet and loud passages suitable for listening to in a
  1655. noisy environment:
  1656. @example
  1657. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1658. @end example
  1659. Another example for audio with whisper and explosion parts:
  1660. @example
  1661. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1662. @end example
  1663. @item
  1664. A noise gate for when the noise is at a lower level than the signal:
  1665. @example
  1666. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1667. @end example
  1668. @item
  1669. Here is another noise gate, this time for when the noise is at a higher level
  1670. than the signal (making it, in some ways, similar to squelch):
  1671. @example
  1672. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1673. @end example
  1674. @item
  1675. 2:1 compression starting at -6dB:
  1676. @example
  1677. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1678. @end example
  1679. @item
  1680. 2:1 compression starting at -9dB:
  1681. @example
  1682. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1683. @end example
  1684. @item
  1685. 2:1 compression starting at -12dB:
  1686. @example
  1687. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1688. @end example
  1689. @item
  1690. 2:1 compression starting at -18dB:
  1691. @example
  1692. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1693. @end example
  1694. @item
  1695. 3:1 compression starting at -15dB:
  1696. @example
  1697. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1698. @end example
  1699. @item
  1700. Compressor/Gate:
  1701. @example
  1702. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1703. @end example
  1704. @item
  1705. Expander:
  1706. @example
  1707. compand=attacks=0:points=-80/-169|-54/-80|-49.5/-64.6|-41.1/-41.1|-25.8/-15|-10.8/-4.5|0/0|20/8.3
  1708. @end example
  1709. @item
  1710. Hard limiter at -6dB:
  1711. @example
  1712. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1713. @end example
  1714. @item
  1715. Hard limiter at -12dB:
  1716. @example
  1717. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1718. @end example
  1719. @item
  1720. Hard noise gate at -35 dB:
  1721. @example
  1722. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1723. @end example
  1724. @item
  1725. Soft limiter:
  1726. @example
  1727. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1728. @end example
  1729. @end itemize
  1730. @section compensationdelay
  1731. Compensation Delay Line is a metric based delay to compensate differing
  1732. positions of microphones or speakers.
  1733. For example, you have recorded guitar with two microphones placed in
  1734. different location. Because the front of sound wave has fixed speed in
  1735. normal conditions, the phasing of microphones can vary and depends on
  1736. their location and interposition. The best sound mix can be achieved when
  1737. these microphones are in phase (synchronized). Note that distance of
  1738. ~30 cm between microphones makes one microphone to capture signal in
  1739. antiphase to another microphone. That makes the final mix sounding moody.
  1740. This filter helps to solve phasing problems by adding different delays
  1741. to each microphone track and make them synchronized.
  1742. The best result can be reached when you take one track as base and
  1743. synchronize other tracks one by one with it.
  1744. Remember that synchronization/delay tolerance depends on sample rate, too.
  1745. Higher sample rates will give more tolerance.
  1746. It accepts the following parameters:
  1747. @table @option
  1748. @item mm
  1749. Set millimeters distance. This is compensation distance for fine tuning.
  1750. Default is 0.
  1751. @item cm
  1752. Set cm distance. This is compensation distance for tightening distance setup.
  1753. Default is 0.
  1754. @item m
  1755. Set meters distance. This is compensation distance for hard distance setup.
  1756. Default is 0.
  1757. @item dry
  1758. Set dry amount. Amount of unprocessed (dry) signal.
  1759. Default is 0.
  1760. @item wet
  1761. Set wet amount. Amount of processed (wet) signal.
  1762. Default is 1.
  1763. @item temp
  1764. Set temperature degree in Celsius. This is the temperature of the environment.
  1765. Default is 20.
  1766. @end table
  1767. @section crossfeed
  1768. Apply headphone crossfeed filter.
  1769. Crossfeed is the process of blending the left and right channels of stereo
  1770. audio recording.
  1771. It is mainly used to reduce extreme stereo separation of low frequencies.
  1772. The intent is to produce more speaker like sound to the listener.
  1773. The filter accepts the following options:
  1774. @table @option
  1775. @item strength
  1776. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  1777. This sets gain of low shelf filter for side part of stereo image.
  1778. Default is -6dB. Max allowed is -30db when strength is set to 1.
  1779. @item range
  1780. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  1781. This sets cut off frequency of low shelf filter. Default is cut off near
  1782. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  1783. @item level_in
  1784. Set input gain. Default is 0.9.
  1785. @item level_out
  1786. Set output gain. Default is 1.
  1787. @end table
  1788. @section crystalizer
  1789. Simple algorithm to expand audio dynamic range.
  1790. The filter accepts the following options:
  1791. @table @option
  1792. @item i
  1793. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  1794. (unchanged sound) to 10.0 (maximum effect).
  1795. @item c
  1796. Enable clipping. By default is enabled.
  1797. @end table
  1798. @section dcshift
  1799. Apply a DC shift to the audio.
  1800. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1801. in the recording chain) from the audio. The effect of a DC offset is reduced
  1802. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1803. a signal has a DC offset.
  1804. @table @option
  1805. @item shift
  1806. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1807. the audio.
  1808. @item limitergain
  1809. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1810. used to prevent clipping.
  1811. @end table
  1812. @section dynaudnorm
  1813. Dynamic Audio Normalizer.
  1814. This filter applies a certain amount of gain to the input audio in order
  1815. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  1816. contrast to more "simple" normalization algorithms, the Dynamic Audio
  1817. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  1818. This allows for applying extra gain to the "quiet" sections of the audio
  1819. while avoiding distortions or clipping the "loud" sections. In other words:
  1820. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  1821. sections, in the sense that the volume of each section is brought to the
  1822. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  1823. this goal *without* applying "dynamic range compressing". It will retain 100%
  1824. of the dynamic range *within* each section of the audio file.
  1825. @table @option
  1826. @item f
  1827. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  1828. Default is 500 milliseconds.
  1829. The Dynamic Audio Normalizer processes the input audio in small chunks,
  1830. referred to as frames. This is required, because a peak magnitude has no
  1831. meaning for just a single sample value. Instead, we need to determine the
  1832. peak magnitude for a contiguous sequence of sample values. While a "standard"
  1833. normalizer would simply use the peak magnitude of the complete file, the
  1834. Dynamic Audio Normalizer determines the peak magnitude individually for each
  1835. frame. The length of a frame is specified in milliseconds. By default, the
  1836. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  1837. been found to give good results with most files.
  1838. Note that the exact frame length, in number of samples, will be determined
  1839. automatically, based on the sampling rate of the individual input audio file.
  1840. @item g
  1841. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  1842. number. Default is 31.
  1843. Probably the most important parameter of the Dynamic Audio Normalizer is the
  1844. @code{window size} of the Gaussian smoothing filter. The filter's window size
  1845. is specified in frames, centered around the current frame. For the sake of
  1846. simplicity, this must be an odd number. Consequently, the default value of 31
  1847. takes into account the current frame, as well as the 15 preceding frames and
  1848. the 15 subsequent frames. Using a larger window results in a stronger
  1849. smoothing effect and thus in less gain variation, i.e. slower gain
  1850. adaptation. Conversely, using a smaller window results in a weaker smoothing
  1851. effect and thus in more gain variation, i.e. faster gain adaptation.
  1852. In other words, the more you increase this value, the more the Dynamic Audio
  1853. Normalizer will behave like a "traditional" normalization filter. On the
  1854. contrary, the more you decrease this value, the more the Dynamic Audio
  1855. Normalizer will behave like a dynamic range compressor.
  1856. @item p
  1857. Set the target peak value. This specifies the highest permissible magnitude
  1858. level for the normalized audio input. This filter will try to approach the
  1859. target peak magnitude as closely as possible, but at the same time it also
  1860. makes sure that the normalized signal will never exceed the peak magnitude.
  1861. A frame's maximum local gain factor is imposed directly by the target peak
  1862. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  1863. It is not recommended to go above this value.
  1864. @item m
  1865. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  1866. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  1867. factor for each input frame, i.e. the maximum gain factor that does not
  1868. result in clipping or distortion. The maximum gain factor is determined by
  1869. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  1870. additionally bounds the frame's maximum gain factor by a predetermined
  1871. (global) maximum gain factor. This is done in order to avoid excessive gain
  1872. factors in "silent" or almost silent frames. By default, the maximum gain
  1873. factor is 10.0, For most inputs the default value should be sufficient and
  1874. it usually is not recommended to increase this value. Though, for input
  1875. with an extremely low overall volume level, it may be necessary to allow even
  1876. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  1877. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  1878. Instead, a "sigmoid" threshold function will be applied. This way, the
  1879. gain factors will smoothly approach the threshold value, but never exceed that
  1880. value.
  1881. @item r
  1882. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  1883. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  1884. This means that the maximum local gain factor for each frame is defined
  1885. (only) by the frame's highest magnitude sample. This way, the samples can
  1886. be amplified as much as possible without exceeding the maximum signal
  1887. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  1888. Normalizer can also take into account the frame's root mean square,
  1889. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  1890. determine the power of a time-varying signal. It is therefore considered
  1891. that the RMS is a better approximation of the "perceived loudness" than
  1892. just looking at the signal's peak magnitude. Consequently, by adjusting all
  1893. frames to a constant RMS value, a uniform "perceived loudness" can be
  1894. established. If a target RMS value has been specified, a frame's local gain
  1895. factor is defined as the factor that would result in exactly that RMS value.
  1896. Note, however, that the maximum local gain factor is still restricted by the
  1897. frame's highest magnitude sample, in order to prevent clipping.
  1898. @item n
  1899. Enable channels coupling. By default is enabled.
  1900. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  1901. amount. This means the same gain factor will be applied to all channels, i.e.
  1902. the maximum possible gain factor is determined by the "loudest" channel.
  1903. However, in some recordings, it may happen that the volume of the different
  1904. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  1905. In this case, this option can be used to disable the channel coupling. This way,
  1906. the gain factor will be determined independently for each channel, depending
  1907. only on the individual channel's highest magnitude sample. This allows for
  1908. harmonizing the volume of the different channels.
  1909. @item c
  1910. Enable DC bias correction. By default is disabled.
  1911. An audio signal (in the time domain) is a sequence of sample values.
  1912. In the Dynamic Audio Normalizer these sample values are represented in the
  1913. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  1914. audio signal, or "waveform", should be centered around the zero point.
  1915. That means if we calculate the mean value of all samples in a file, or in a
  1916. single frame, then the result should be 0.0 or at least very close to that
  1917. value. If, however, there is a significant deviation of the mean value from
  1918. 0.0, in either positive or negative direction, this is referred to as a
  1919. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  1920. Audio Normalizer provides optional DC bias correction.
  1921. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  1922. the mean value, or "DC correction" offset, of each input frame and subtract
  1923. that value from all of the frame's sample values which ensures those samples
  1924. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  1925. boundaries, the DC correction offset values will be interpolated smoothly
  1926. between neighbouring frames.
  1927. @item b
  1928. Enable alternative boundary mode. By default is disabled.
  1929. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  1930. around each frame. This includes the preceding frames as well as the
  1931. subsequent frames. However, for the "boundary" frames, located at the very
  1932. beginning and at the very end of the audio file, not all neighbouring
  1933. frames are available. In particular, for the first few frames in the audio
  1934. file, the preceding frames are not known. And, similarly, for the last few
  1935. frames in the audio file, the subsequent frames are not known. Thus, the
  1936. question arises which gain factors should be assumed for the missing frames
  1937. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  1938. to deal with this situation. The default boundary mode assumes a gain factor
  1939. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  1940. "fade out" at the beginning and at the end of the input, respectively.
  1941. @item s
  1942. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  1943. By default, the Dynamic Audio Normalizer does not apply "traditional"
  1944. compression. This means that signal peaks will not be pruned and thus the
  1945. full dynamic range will be retained within each local neighbourhood. However,
  1946. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  1947. normalization algorithm with a more "traditional" compression.
  1948. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  1949. (thresholding) function. If (and only if) the compression feature is enabled,
  1950. all input frames will be processed by a soft knee thresholding function prior
  1951. to the actual normalization process. Put simply, the thresholding function is
  1952. going to prune all samples whose magnitude exceeds a certain threshold value.
  1953. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  1954. value. Instead, the threshold value will be adjusted for each individual
  1955. frame.
  1956. In general, smaller parameters result in stronger compression, and vice versa.
  1957. Values below 3.0 are not recommended, because audible distortion may appear.
  1958. @end table
  1959. @section earwax
  1960. Make audio easier to listen to on headphones.
  1961. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  1962. so that when listened to on headphones the stereo image is moved from
  1963. inside your head (standard for headphones) to outside and in front of
  1964. the listener (standard for speakers).
  1965. Ported from SoX.
  1966. @section equalizer
  1967. Apply a two-pole peaking equalisation (EQ) filter. With this
  1968. filter, the signal-level at and around a selected frequency can
  1969. be increased or decreased, whilst (unlike bandpass and bandreject
  1970. filters) that at all other frequencies is unchanged.
  1971. In order to produce complex equalisation curves, this filter can
  1972. be given several times, each with a different central frequency.
  1973. The filter accepts the following options:
  1974. @table @option
  1975. @item frequency, f
  1976. Set the filter's central frequency in Hz.
  1977. @item width_type, t
  1978. Set method to specify band-width of filter.
  1979. @table @option
  1980. @item h
  1981. Hz
  1982. @item q
  1983. Q-Factor
  1984. @item o
  1985. octave
  1986. @item s
  1987. slope
  1988. @end table
  1989. @item width, w
  1990. Specify the band-width of a filter in width_type units.
  1991. @item gain, g
  1992. Set the required gain or attenuation in dB.
  1993. Beware of clipping when using a positive gain.
  1994. @item channels, c
  1995. Specify which channels to filter, by default all available are filtered.
  1996. @end table
  1997. @subsection Examples
  1998. @itemize
  1999. @item
  2000. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2001. @example
  2002. equalizer=f=1000:t=h:width=200:g=-10
  2003. @end example
  2004. @item
  2005. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2006. @example
  2007. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2008. @end example
  2009. @end itemize
  2010. @section extrastereo
  2011. Linearly increases the difference between left and right channels which
  2012. adds some sort of "live" effect to playback.
  2013. The filter accepts the following options:
  2014. @table @option
  2015. @item m
  2016. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2017. (average of both channels), with 1.0 sound will be unchanged, with
  2018. -1.0 left and right channels will be swapped.
  2019. @item c
  2020. Enable clipping. By default is enabled.
  2021. @end table
  2022. @section firequalizer
  2023. Apply FIR Equalization using arbitrary frequency response.
  2024. The filter accepts the following option:
  2025. @table @option
  2026. @item gain
  2027. Set gain curve equation (in dB). The expression can contain variables:
  2028. @table @option
  2029. @item f
  2030. the evaluated frequency
  2031. @item sr
  2032. sample rate
  2033. @item ch
  2034. channel number, set to 0 when multichannels evaluation is disabled
  2035. @item chid
  2036. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2037. multichannels evaluation is disabled
  2038. @item chs
  2039. number of channels
  2040. @item chlayout
  2041. channel_layout, see libavutil/channel_layout.h
  2042. @end table
  2043. and functions:
  2044. @table @option
  2045. @item gain_interpolate(f)
  2046. interpolate gain on frequency f based on gain_entry
  2047. @item cubic_interpolate(f)
  2048. same as gain_interpolate, but smoother
  2049. @end table
  2050. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2051. @item gain_entry
  2052. Set gain entry for gain_interpolate function. The expression can
  2053. contain functions:
  2054. @table @option
  2055. @item entry(f, g)
  2056. store gain entry at frequency f with value g
  2057. @end table
  2058. This option is also available as command.
  2059. @item delay
  2060. Set filter delay in seconds. Higher value means more accurate.
  2061. Default is @code{0.01}.
  2062. @item accuracy
  2063. Set filter accuracy in Hz. Lower value means more accurate.
  2064. Default is @code{5}.
  2065. @item wfunc
  2066. Set window function. Acceptable values are:
  2067. @table @option
  2068. @item rectangular
  2069. rectangular window, useful when gain curve is already smooth
  2070. @item hann
  2071. hann window (default)
  2072. @item hamming
  2073. hamming window
  2074. @item blackman
  2075. blackman window
  2076. @item nuttall3
  2077. 3-terms continuous 1st derivative nuttall window
  2078. @item mnuttall3
  2079. minimum 3-terms discontinuous nuttall window
  2080. @item nuttall
  2081. 4-terms continuous 1st derivative nuttall window
  2082. @item bnuttall
  2083. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2084. @item bharris
  2085. blackman-harris window
  2086. @item tukey
  2087. tukey window
  2088. @end table
  2089. @item fixed
  2090. If enabled, use fixed number of audio samples. This improves speed when
  2091. filtering with large delay. Default is disabled.
  2092. @item multi
  2093. Enable multichannels evaluation on gain. Default is disabled.
  2094. @item zero_phase
  2095. Enable zero phase mode by subtracting timestamp to compensate delay.
  2096. Default is disabled.
  2097. @item scale
  2098. Set scale used by gain. Acceptable values are:
  2099. @table @option
  2100. @item linlin
  2101. linear frequency, linear gain
  2102. @item linlog
  2103. linear frequency, logarithmic (in dB) gain (default)
  2104. @item loglin
  2105. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2106. @item loglog
  2107. logarithmic frequency, logarithmic gain
  2108. @end table
  2109. @item dumpfile
  2110. Set file for dumping, suitable for gnuplot.
  2111. @item dumpscale
  2112. Set scale for dumpfile. Acceptable values are same with scale option.
  2113. Default is linlog.
  2114. @item fft2
  2115. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2116. Default is disabled.
  2117. @item min_phase
  2118. Enable minimum phase impulse response. Default is disabled.
  2119. @end table
  2120. @subsection Examples
  2121. @itemize
  2122. @item
  2123. lowpass at 1000 Hz:
  2124. @example
  2125. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2126. @end example
  2127. @item
  2128. lowpass at 1000 Hz with gain_entry:
  2129. @example
  2130. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2131. @end example
  2132. @item
  2133. custom equalization:
  2134. @example
  2135. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2136. @end example
  2137. @item
  2138. higher delay with zero phase to compensate delay:
  2139. @example
  2140. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2141. @end example
  2142. @item
  2143. lowpass on left channel, highpass on right channel:
  2144. @example
  2145. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2146. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2147. @end example
  2148. @end itemize
  2149. @section flanger
  2150. Apply a flanging effect to the audio.
  2151. The filter accepts the following options:
  2152. @table @option
  2153. @item delay
  2154. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2155. @item depth
  2156. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2157. @item regen
  2158. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2159. Default value is 0.
  2160. @item width
  2161. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2162. Default value is 71.
  2163. @item speed
  2164. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2165. @item shape
  2166. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2167. Default value is @var{sinusoidal}.
  2168. @item phase
  2169. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2170. Default value is 25.
  2171. @item interp
  2172. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2173. Default is @var{linear}.
  2174. @end table
  2175. @section haas
  2176. Apply Haas effect to audio.
  2177. Note that this makes most sense to apply on mono signals.
  2178. With this filter applied to mono signals it give some directionality and
  2179. stretches its stereo image.
  2180. The filter accepts the following options:
  2181. @table @option
  2182. @item level_in
  2183. Set input level. By default is @var{1}, or 0dB
  2184. @item level_out
  2185. Set output level. By default is @var{1}, or 0dB.
  2186. @item side_gain
  2187. Set gain applied to side part of signal. By default is @var{1}.
  2188. @item middle_source
  2189. Set kind of middle source. Can be one of the following:
  2190. @table @samp
  2191. @item left
  2192. Pick left channel.
  2193. @item right
  2194. Pick right channel.
  2195. @item mid
  2196. Pick middle part signal of stereo image.
  2197. @item side
  2198. Pick side part signal of stereo image.
  2199. @end table
  2200. @item middle_phase
  2201. Change middle phase. By default is disabled.
  2202. @item left_delay
  2203. Set left channel delay. By default is @var{2.05} milliseconds.
  2204. @item left_balance
  2205. Set left channel balance. By default is @var{-1}.
  2206. @item left_gain
  2207. Set left channel gain. By default is @var{1}.
  2208. @item left_phase
  2209. Change left phase. By default is disabled.
  2210. @item right_delay
  2211. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2212. @item right_balance
  2213. Set right channel balance. By default is @var{1}.
  2214. @item right_gain
  2215. Set right channel gain. By default is @var{1}.
  2216. @item right_phase
  2217. Change right phase. By default is enabled.
  2218. @end table
  2219. @section hdcd
  2220. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2221. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2222. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2223. of HDCD, and detects the Transient Filter flag.
  2224. @example
  2225. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2226. @end example
  2227. When using the filter with wav, note the default encoding for wav is 16-bit,
  2228. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2229. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2230. @example
  2231. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2232. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2233. @end example
  2234. The filter accepts the following options:
  2235. @table @option
  2236. @item disable_autoconvert
  2237. Disable any automatic format conversion or resampling in the filter graph.
  2238. @item process_stereo
  2239. Process the stereo channels together. If target_gain does not match between
  2240. channels, consider it invalid and use the last valid target_gain.
  2241. @item cdt_ms
  2242. Set the code detect timer period in ms.
  2243. @item force_pe
  2244. Always extend peaks above -3dBFS even if PE isn't signaled.
  2245. @item analyze_mode
  2246. Replace audio with a solid tone and adjust the amplitude to signal some
  2247. specific aspect of the decoding process. The output file can be loaded in
  2248. an audio editor alongside the original to aid analysis.
  2249. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2250. Modes are:
  2251. @table @samp
  2252. @item 0, off
  2253. Disabled
  2254. @item 1, lle
  2255. Gain adjustment level at each sample
  2256. @item 2, pe
  2257. Samples where peak extend occurs
  2258. @item 3, cdt
  2259. Samples where the code detect timer is active
  2260. @item 4, tgm
  2261. Samples where the target gain does not match between channels
  2262. @end table
  2263. @end table
  2264. @section headphone
  2265. Apply head-related transfer functions (HRTFs) to create virtual
  2266. loudspeakers around the user for binaural listening via headphones.
  2267. The HRIRs are provided via additional streams, for each channel
  2268. one stereo input stream is needed.
  2269. The filter accepts the following options:
  2270. @table @option
  2271. @item map
  2272. Set mapping of input streams for convolution.
  2273. The argument is a '|'-separated list of channel names in order as they
  2274. are given as additional stream inputs for filter.
  2275. This also specify number of input streams. Number of input streams
  2276. must be not less than number of channels in first stream plus one.
  2277. @item gain
  2278. Set gain applied to audio. Value is in dB. Default is 0.
  2279. @item type
  2280. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2281. processing audio in time domain which is slow.
  2282. @var{freq} is processing audio in frequency domain which is fast.
  2283. Default is @var{freq}.
  2284. @item lfe
  2285. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2286. @end table
  2287. @subsection Examples
  2288. @itemize
  2289. @item
  2290. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2291. each amovie filter use stereo file with IR coefficients as input.
  2292. The files give coefficients for each position of virtual loudspeaker:
  2293. @example
  2294. ffmpeg -i input.wav -lavfi-complex "amovie=azi_270_ele_0_DFC.wav[sr],amovie=azi_90_ele_0_DFC.wav[sl],amovie=azi_225_ele_0_DFC.wav[br],amovie=azi_135_ele_0_DFC.wav[bl],amovie=azi_0_ele_0_DFC.wav,asplit[fc][lfe],amovie=azi_35_ele_0_DFC.wav[fl],amovie=azi_325_ele_0_DFC.wav[fr],[a:0][fl][fr][fc][lfe][bl][br][sl][sr]headphone=FL|FR|FC|LFE|BL|BR|SL|SR"
  2295. output.wav
  2296. @end example
  2297. @end itemize
  2298. @section highpass
  2299. Apply a high-pass filter with 3dB point frequency.
  2300. The filter can be either single-pole, or double-pole (the default).
  2301. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2302. The filter accepts the following options:
  2303. @table @option
  2304. @item frequency, f
  2305. Set frequency in Hz. Default is 3000.
  2306. @item poles, p
  2307. Set number of poles. Default is 2.
  2308. @item width_type, t
  2309. Set method to specify band-width of filter.
  2310. @table @option
  2311. @item h
  2312. Hz
  2313. @item q
  2314. Q-Factor
  2315. @item o
  2316. octave
  2317. @item s
  2318. slope
  2319. @end table
  2320. @item width, w
  2321. Specify the band-width of a filter in width_type units.
  2322. Applies only to double-pole filter.
  2323. The default is 0.707q and gives a Butterworth response.
  2324. @item channels, c
  2325. Specify which channels to filter, by default all available are filtered.
  2326. @end table
  2327. @section join
  2328. Join multiple input streams into one multi-channel stream.
  2329. It accepts the following parameters:
  2330. @table @option
  2331. @item inputs
  2332. The number of input streams. It defaults to 2.
  2333. @item channel_layout
  2334. The desired output channel layout. It defaults to stereo.
  2335. @item map
  2336. Map channels from inputs to output. The argument is a '|'-separated list of
  2337. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2338. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2339. can be either the name of the input channel (e.g. FL for front left) or its
  2340. index in the specified input stream. @var{out_channel} is the name of the output
  2341. channel.
  2342. @end table
  2343. The filter will attempt to guess the mappings when they are not specified
  2344. explicitly. It does so by first trying to find an unused matching input channel
  2345. and if that fails it picks the first unused input channel.
  2346. Join 3 inputs (with properly set channel layouts):
  2347. @example
  2348. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2349. @end example
  2350. Build a 5.1 output from 6 single-channel streams:
  2351. @example
  2352. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2353. 'join=inputs=6:channel_layout=5.1:map=0.0-FL|1.0-FR|2.0-FC|3.0-SL|4.0-SR|5.0-LFE'
  2354. out
  2355. @end example
  2356. @section ladspa
  2357. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2358. To enable compilation of this filter you need to configure FFmpeg with
  2359. @code{--enable-ladspa}.
  2360. @table @option
  2361. @item file, f
  2362. Specifies the name of LADSPA plugin library to load. If the environment
  2363. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2364. each one of the directories specified by the colon separated list in
  2365. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2366. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2367. @file{/usr/lib/ladspa/}.
  2368. @item plugin, p
  2369. Specifies the plugin within the library. Some libraries contain only
  2370. one plugin, but others contain many of them. If this is not set filter
  2371. will list all available plugins within the specified library.
  2372. @item controls, c
  2373. Set the '|' separated list of controls which are zero or more floating point
  2374. values that determine the behavior of the loaded plugin (for example delay,
  2375. threshold or gain).
  2376. Controls need to be defined using the following syntax:
  2377. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2378. @var{valuei} is the value set on the @var{i}-th control.
  2379. Alternatively they can be also defined using the following syntax:
  2380. @var{value0}|@var{value1}|@var{value2}|..., where
  2381. @var{valuei} is the value set on the @var{i}-th control.
  2382. If @option{controls} is set to @code{help}, all available controls and
  2383. their valid ranges are printed.
  2384. @item sample_rate, s
  2385. Specify the sample rate, default to 44100. Only used if plugin have
  2386. zero inputs.
  2387. @item nb_samples, n
  2388. Set the number of samples per channel per each output frame, default
  2389. is 1024. Only used if plugin have zero inputs.
  2390. @item duration, d
  2391. Set the minimum duration of the sourced audio. See
  2392. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2393. for the accepted syntax.
  2394. Note that the resulting duration may be greater than the specified duration,
  2395. as the generated audio is always cut at the end of a complete frame.
  2396. If not specified, or the expressed duration is negative, the audio is
  2397. supposed to be generated forever.
  2398. Only used if plugin have zero inputs.
  2399. @end table
  2400. @subsection Examples
  2401. @itemize
  2402. @item
  2403. List all available plugins within amp (LADSPA example plugin) library:
  2404. @example
  2405. ladspa=file=amp
  2406. @end example
  2407. @item
  2408. List all available controls and their valid ranges for @code{vcf_notch}
  2409. plugin from @code{VCF} library:
  2410. @example
  2411. ladspa=f=vcf:p=vcf_notch:c=help
  2412. @end example
  2413. @item
  2414. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2415. plugin library:
  2416. @example
  2417. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2418. @end example
  2419. @item
  2420. Add reverberation to the audio using TAP-plugins
  2421. (Tom's Audio Processing plugins):
  2422. @example
  2423. ladspa=file=tap_reverb:tap_reverb
  2424. @end example
  2425. @item
  2426. Generate white noise, with 0.2 amplitude:
  2427. @example
  2428. ladspa=file=cmt:noise_source_white:c=c0=.2
  2429. @end example
  2430. @item
  2431. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2432. @code{C* Audio Plugin Suite} (CAPS) library:
  2433. @example
  2434. ladspa=file=caps:Click:c=c1=20'
  2435. @end example
  2436. @item
  2437. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2438. @example
  2439. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2440. @end example
  2441. @item
  2442. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2443. @code{SWH Plugins} collection:
  2444. @example
  2445. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2446. @end example
  2447. @item
  2448. Attenuate low frequencies using Multiband EQ from Steve Harris
  2449. @code{SWH Plugins} collection:
  2450. @example
  2451. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2452. @end example
  2453. @item
  2454. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2455. (CAPS) library:
  2456. @example
  2457. ladspa=caps:Narrower
  2458. @end example
  2459. @item
  2460. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2461. @example
  2462. ladspa=caps:White:.2
  2463. @end example
  2464. @item
  2465. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2466. @example
  2467. ladspa=caps:Fractal:c=c1=1
  2468. @end example
  2469. @item
  2470. Dynamic volume normalization using @code{VLevel} plugin:
  2471. @example
  2472. ladspa=vlevel-ladspa:vlevel_mono
  2473. @end example
  2474. @end itemize
  2475. @subsection Commands
  2476. This filter supports the following commands:
  2477. @table @option
  2478. @item cN
  2479. Modify the @var{N}-th control value.
  2480. If the specified value is not valid, it is ignored and prior one is kept.
  2481. @end table
  2482. @section loudnorm
  2483. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2484. Support for both single pass (livestreams, files) and double pass (files) modes.
  2485. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  2486. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  2487. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  2488. The filter accepts the following options:
  2489. @table @option
  2490. @item I, i
  2491. Set integrated loudness target.
  2492. Range is -70.0 - -5.0. Default value is -24.0.
  2493. @item LRA, lra
  2494. Set loudness range target.
  2495. Range is 1.0 - 20.0. Default value is 7.0.
  2496. @item TP, tp
  2497. Set maximum true peak.
  2498. Range is -9.0 - +0.0. Default value is -2.0.
  2499. @item measured_I, measured_i
  2500. Measured IL of input file.
  2501. Range is -99.0 - +0.0.
  2502. @item measured_LRA, measured_lra
  2503. Measured LRA of input file.
  2504. Range is 0.0 - 99.0.
  2505. @item measured_TP, measured_tp
  2506. Measured true peak of input file.
  2507. Range is -99.0 - +99.0.
  2508. @item measured_thresh
  2509. Measured threshold of input file.
  2510. Range is -99.0 - +0.0.
  2511. @item offset
  2512. Set offset gain. Gain is applied before the true-peak limiter.
  2513. Range is -99.0 - +99.0. Default is +0.0.
  2514. @item linear
  2515. Normalize linearly if possible.
  2516. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2517. to be specified in order to use this mode.
  2518. Options are true or false. Default is true.
  2519. @item dual_mono
  2520. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2521. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2522. If set to @code{true}, this option will compensate for this effect.
  2523. Multi-channel input files are not affected by this option.
  2524. Options are true or false. Default is false.
  2525. @item print_format
  2526. Set print format for stats. Options are summary, json, or none.
  2527. Default value is none.
  2528. @end table
  2529. @section lowpass
  2530. Apply a low-pass filter with 3dB point frequency.
  2531. The filter can be either single-pole or double-pole (the default).
  2532. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2533. The filter accepts the following options:
  2534. @table @option
  2535. @item frequency, f
  2536. Set frequency in Hz. Default is 500.
  2537. @item poles, p
  2538. Set number of poles. Default is 2.
  2539. @item width_type, t
  2540. Set method to specify band-width of filter.
  2541. @table @option
  2542. @item h
  2543. Hz
  2544. @item q
  2545. Q-Factor
  2546. @item o
  2547. octave
  2548. @item s
  2549. slope
  2550. @end table
  2551. @item width, w
  2552. Specify the band-width of a filter in width_type units.
  2553. Applies only to double-pole filter.
  2554. The default is 0.707q and gives a Butterworth response.
  2555. @item channels, c
  2556. Specify which channels to filter, by default all available are filtered.
  2557. @end table
  2558. @subsection Examples
  2559. @itemize
  2560. @item
  2561. Lowpass only LFE channel, it LFE is not present it does nothing:
  2562. @example
  2563. lowpass=c=LFE
  2564. @end example
  2565. @end itemize
  2566. @anchor{pan}
  2567. @section pan
  2568. Mix channels with specific gain levels. The filter accepts the output
  2569. channel layout followed by a set of channels definitions.
  2570. This filter is also designed to efficiently remap the channels of an audio
  2571. stream.
  2572. The filter accepts parameters of the form:
  2573. "@var{l}|@var{outdef}|@var{outdef}|..."
  2574. @table @option
  2575. @item l
  2576. output channel layout or number of channels
  2577. @item outdef
  2578. output channel specification, of the form:
  2579. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  2580. @item out_name
  2581. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2582. number (c0, c1, etc.)
  2583. @item gain
  2584. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2585. @item in_name
  2586. input channel to use, see out_name for details; it is not possible to mix
  2587. named and numbered input channels
  2588. @end table
  2589. If the `=' in a channel specification is replaced by `<', then the gains for
  2590. that specification will be renormalized so that the total is 1, thus
  2591. avoiding clipping noise.
  2592. @subsection Mixing examples
  2593. For example, if you want to down-mix from stereo to mono, but with a bigger
  2594. factor for the left channel:
  2595. @example
  2596. pan=1c|c0=0.9*c0+0.1*c1
  2597. @end example
  2598. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2599. 7-channels surround:
  2600. @example
  2601. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2602. @end example
  2603. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2604. that should be preferred (see "-ac" option) unless you have very specific
  2605. needs.
  2606. @subsection Remapping examples
  2607. The channel remapping will be effective if, and only if:
  2608. @itemize
  2609. @item gain coefficients are zeroes or ones,
  2610. @item only one input per channel output,
  2611. @end itemize
  2612. If all these conditions are satisfied, the filter will notify the user ("Pure
  2613. channel mapping detected"), and use an optimized and lossless method to do the
  2614. remapping.
  2615. For example, if you have a 5.1 source and want a stereo audio stream by
  2616. dropping the extra channels:
  2617. @example
  2618. pan="stereo| c0=FL | c1=FR"
  2619. @end example
  2620. Given the same source, you can also switch front left and front right channels
  2621. and keep the input channel layout:
  2622. @example
  2623. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2624. @end example
  2625. If the input is a stereo audio stream, you can mute the front left channel (and
  2626. still keep the stereo channel layout) with:
  2627. @example
  2628. pan="stereo|c1=c1"
  2629. @end example
  2630. Still with a stereo audio stream input, you can copy the right channel in both
  2631. front left and right:
  2632. @example
  2633. pan="stereo| c0=FR | c1=FR"
  2634. @end example
  2635. @section replaygain
  2636. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2637. outputs it unchanged.
  2638. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2639. @section resample
  2640. Convert the audio sample format, sample rate and channel layout. It is
  2641. not meant to be used directly.
  2642. @section rubberband
  2643. Apply time-stretching and pitch-shifting with librubberband.
  2644. The filter accepts the following options:
  2645. @table @option
  2646. @item tempo
  2647. Set tempo scale factor.
  2648. @item pitch
  2649. Set pitch scale factor.
  2650. @item transients
  2651. Set transients detector.
  2652. Possible values are:
  2653. @table @var
  2654. @item crisp
  2655. @item mixed
  2656. @item smooth
  2657. @end table
  2658. @item detector
  2659. Set detector.
  2660. Possible values are:
  2661. @table @var
  2662. @item compound
  2663. @item percussive
  2664. @item soft
  2665. @end table
  2666. @item phase
  2667. Set phase.
  2668. Possible values are:
  2669. @table @var
  2670. @item laminar
  2671. @item independent
  2672. @end table
  2673. @item window
  2674. Set processing window size.
  2675. Possible values are:
  2676. @table @var
  2677. @item standard
  2678. @item short
  2679. @item long
  2680. @end table
  2681. @item smoothing
  2682. Set smoothing.
  2683. Possible values are:
  2684. @table @var
  2685. @item off
  2686. @item on
  2687. @end table
  2688. @item formant
  2689. Enable formant preservation when shift pitching.
  2690. Possible values are:
  2691. @table @var
  2692. @item shifted
  2693. @item preserved
  2694. @end table
  2695. @item pitchq
  2696. Set pitch quality.
  2697. Possible values are:
  2698. @table @var
  2699. @item quality
  2700. @item speed
  2701. @item consistency
  2702. @end table
  2703. @item channels
  2704. Set channels.
  2705. Possible values are:
  2706. @table @var
  2707. @item apart
  2708. @item together
  2709. @end table
  2710. @end table
  2711. @section sidechaincompress
  2712. This filter acts like normal compressor but has the ability to compress
  2713. detected signal using second input signal.
  2714. It needs two input streams and returns one output stream.
  2715. First input stream will be processed depending on second stream signal.
  2716. The filtered signal then can be filtered with other filters in later stages of
  2717. processing. See @ref{pan} and @ref{amerge} filter.
  2718. The filter accepts the following options:
  2719. @table @option
  2720. @item level_in
  2721. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2722. @item threshold
  2723. If a signal of second stream raises above this level it will affect the gain
  2724. reduction of first stream.
  2725. By default is 0.125. Range is between 0.00097563 and 1.
  2726. @item ratio
  2727. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2728. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2729. Default is 2. Range is between 1 and 20.
  2730. @item attack
  2731. Amount of milliseconds the signal has to rise above the threshold before gain
  2732. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2733. @item release
  2734. Amount of milliseconds the signal has to fall below the threshold before
  2735. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2736. @item makeup
  2737. Set the amount by how much signal will be amplified after processing.
  2738. Default is 1. Range is from 1 to 64.
  2739. @item knee
  2740. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2741. Default is 2.82843. Range is between 1 and 8.
  2742. @item link
  2743. Choose if the @code{average} level between all channels of side-chain stream
  2744. or the louder(@code{maximum}) channel of side-chain stream affects the
  2745. reduction. Default is @code{average}.
  2746. @item detection
  2747. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2748. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2749. @item level_sc
  2750. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2751. @item mix
  2752. How much to use compressed signal in output. Default is 1.
  2753. Range is between 0 and 1.
  2754. @end table
  2755. @subsection Examples
  2756. @itemize
  2757. @item
  2758. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2759. depending on the signal of 2nd input and later compressed signal to be
  2760. merged with 2nd input:
  2761. @example
  2762. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2763. @end example
  2764. @end itemize
  2765. @section sidechaingate
  2766. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2767. filter the detected signal before sending it to the gain reduction stage.
  2768. Normally a gate uses the full range signal to detect a level above the
  2769. threshold.
  2770. For example: If you cut all lower frequencies from your sidechain signal
  2771. the gate will decrease the volume of your track only if not enough highs
  2772. appear. With this technique you are able to reduce the resonation of a
  2773. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2774. guitar.
  2775. It needs two input streams and returns one output stream.
  2776. First input stream will be processed depending on second stream signal.
  2777. The filter accepts the following options:
  2778. @table @option
  2779. @item level_in
  2780. Set input level before filtering.
  2781. Default is 1. Allowed range is from 0.015625 to 64.
  2782. @item range
  2783. Set the level of gain reduction when the signal is below the threshold.
  2784. Default is 0.06125. Allowed range is from 0 to 1.
  2785. @item threshold
  2786. If a signal rises above this level the gain reduction is released.
  2787. Default is 0.125. Allowed range is from 0 to 1.
  2788. @item ratio
  2789. Set a ratio about which the signal is reduced.
  2790. Default is 2. Allowed range is from 1 to 9000.
  2791. @item attack
  2792. Amount of milliseconds the signal has to rise above the threshold before gain
  2793. reduction stops.
  2794. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2795. @item release
  2796. Amount of milliseconds the signal has to fall below the threshold before the
  2797. reduction is increased again. Default is 250 milliseconds.
  2798. Allowed range is from 0.01 to 9000.
  2799. @item makeup
  2800. Set amount of amplification of signal after processing.
  2801. Default is 1. Allowed range is from 1 to 64.
  2802. @item knee
  2803. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2804. Default is 2.828427125. Allowed range is from 1 to 8.
  2805. @item detection
  2806. Choose if exact signal should be taken for detection or an RMS like one.
  2807. Default is rms. Can be peak or rms.
  2808. @item link
  2809. Choose if the average level between all channels or the louder channel affects
  2810. the reduction.
  2811. Default is average. Can be average or maximum.
  2812. @item level_sc
  2813. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2814. @end table
  2815. @section silencedetect
  2816. Detect silence in an audio stream.
  2817. This filter logs a message when it detects that the input audio volume is less
  2818. or equal to a noise tolerance value for a duration greater or equal to the
  2819. minimum detected noise duration.
  2820. The printed times and duration are expressed in seconds.
  2821. The filter accepts the following options:
  2822. @table @option
  2823. @item duration, d
  2824. Set silence duration until notification (default is 2 seconds).
  2825. @item noise, n
  2826. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2827. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2828. @end table
  2829. @subsection Examples
  2830. @itemize
  2831. @item
  2832. Detect 5 seconds of silence with -50dB noise tolerance:
  2833. @example
  2834. silencedetect=n=-50dB:d=5
  2835. @end example
  2836. @item
  2837. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2838. tolerance in @file{silence.mp3}:
  2839. @example
  2840. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2841. @end example
  2842. @end itemize
  2843. @section silenceremove
  2844. Remove silence from the beginning, middle or end of the audio.
  2845. The filter accepts the following options:
  2846. @table @option
  2847. @item start_periods
  2848. This value is used to indicate if audio should be trimmed at beginning of
  2849. the audio. A value of zero indicates no silence should be trimmed from the
  2850. beginning. When specifying a non-zero value, it trims audio up until it
  2851. finds non-silence. Normally, when trimming silence from beginning of audio
  2852. the @var{start_periods} will be @code{1} but it can be increased to higher
  2853. values to trim all audio up to specific count of non-silence periods.
  2854. Default value is @code{0}.
  2855. @item start_duration
  2856. Specify the amount of time that non-silence must be detected before it stops
  2857. trimming audio. By increasing the duration, bursts of noises can be treated
  2858. as silence and trimmed off. Default value is @code{0}.
  2859. @item start_threshold
  2860. This indicates what sample value should be treated as silence. For digital
  2861. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2862. you may wish to increase the value to account for background noise.
  2863. Can be specified in dB (in case "dB" is appended to the specified value)
  2864. or amplitude ratio. Default value is @code{0}.
  2865. @item stop_periods
  2866. Set the count for trimming silence from the end of audio.
  2867. To remove silence from the middle of a file, specify a @var{stop_periods}
  2868. that is negative. This value is then treated as a positive value and is
  2869. used to indicate the effect should restart processing as specified by
  2870. @var{start_periods}, making it suitable for removing periods of silence
  2871. in the middle of the audio.
  2872. Default value is @code{0}.
  2873. @item stop_duration
  2874. Specify a duration of silence that must exist before audio is not copied any
  2875. more. By specifying a higher duration, silence that is wanted can be left in
  2876. the audio.
  2877. Default value is @code{0}.
  2878. @item stop_threshold
  2879. This is the same as @option{start_threshold} but for trimming silence from
  2880. the end of audio.
  2881. Can be specified in dB (in case "dB" is appended to the specified value)
  2882. or amplitude ratio. Default value is @code{0}.
  2883. @item leave_silence
  2884. This indicates that @var{stop_duration} length of audio should be left intact
  2885. at the beginning of each period of silence.
  2886. For example, if you want to remove long pauses between words but do not want
  2887. to remove the pauses completely. Default value is @code{0}.
  2888. @item detection
  2889. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  2890. and works better with digital silence which is exactly 0.
  2891. Default value is @code{rms}.
  2892. @item window
  2893. Set ratio used to calculate size of window for detecting silence.
  2894. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  2895. @end table
  2896. @subsection Examples
  2897. @itemize
  2898. @item
  2899. The following example shows how this filter can be used to start a recording
  2900. that does not contain the delay at the start which usually occurs between
  2901. pressing the record button and the start of the performance:
  2902. @example
  2903. silenceremove=1:5:0.02
  2904. @end example
  2905. @item
  2906. Trim all silence encountered from beginning to end where there is more than 1
  2907. second of silence in audio:
  2908. @example
  2909. silenceremove=0:0:0:-1:1:-90dB
  2910. @end example
  2911. @end itemize
  2912. @section sofalizer
  2913. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  2914. loudspeakers around the user for binaural listening via headphones (audio
  2915. formats up to 9 channels supported).
  2916. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  2917. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  2918. Austrian Academy of Sciences.
  2919. To enable compilation of this filter you need to configure FFmpeg with
  2920. @code{--enable-libmysofa}.
  2921. The filter accepts the following options:
  2922. @table @option
  2923. @item sofa
  2924. Set the SOFA file used for rendering.
  2925. @item gain
  2926. Set gain applied to audio. Value is in dB. Default is 0.
  2927. @item rotation
  2928. Set rotation of virtual loudspeakers in deg. Default is 0.
  2929. @item elevation
  2930. Set elevation of virtual speakers in deg. Default is 0.
  2931. @item radius
  2932. Set distance in meters between loudspeakers and the listener with near-field
  2933. HRTFs. Default is 1.
  2934. @item type
  2935. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2936. processing audio in time domain which is slow.
  2937. @var{freq} is processing audio in frequency domain which is fast.
  2938. Default is @var{freq}.
  2939. @item speakers
  2940. Set custom positions of virtual loudspeakers. Syntax for this option is:
  2941. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  2942. Each virtual loudspeaker is described with short channel name following with
  2943. azimuth and elevation in degrees.
  2944. Each virtual loudspeaker description is separated by '|'.
  2945. For example to override front left and front right channel positions use:
  2946. 'speakers=FL 45 15|FR 345 15'.
  2947. Descriptions with unrecognised channel names are ignored.
  2948. @item lfegain
  2949. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2950. @end table
  2951. @subsection Examples
  2952. @itemize
  2953. @item
  2954. Using ClubFritz6 sofa file:
  2955. @example
  2956. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  2957. @end example
  2958. @item
  2959. Using ClubFritz12 sofa file and bigger radius with small rotation:
  2960. @example
  2961. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  2962. @end example
  2963. @item
  2964. Similar as above but with custom speaker positions for front left, front right, back left and back right
  2965. and also with custom gain:
  2966. @example
  2967. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  2968. @end example
  2969. @end itemize
  2970. @section stereotools
  2971. This filter has some handy utilities to manage stereo signals, for converting
  2972. M/S stereo recordings to L/R signal while having control over the parameters
  2973. or spreading the stereo image of master track.
  2974. The filter accepts the following options:
  2975. @table @option
  2976. @item level_in
  2977. Set input level before filtering for both channels. Defaults is 1.
  2978. Allowed range is from 0.015625 to 64.
  2979. @item level_out
  2980. Set output level after filtering for both channels. Defaults is 1.
  2981. Allowed range is from 0.015625 to 64.
  2982. @item balance_in
  2983. Set input balance between both channels. Default is 0.
  2984. Allowed range is from -1 to 1.
  2985. @item balance_out
  2986. Set output balance between both channels. Default is 0.
  2987. Allowed range is from -1 to 1.
  2988. @item softclip
  2989. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  2990. clipping. Disabled by default.
  2991. @item mutel
  2992. Mute the left channel. Disabled by default.
  2993. @item muter
  2994. Mute the right channel. Disabled by default.
  2995. @item phasel
  2996. Change the phase of the left channel. Disabled by default.
  2997. @item phaser
  2998. Change the phase of the right channel. Disabled by default.
  2999. @item mode
  3000. Set stereo mode. Available values are:
  3001. @table @samp
  3002. @item lr>lr
  3003. Left/Right to Left/Right, this is default.
  3004. @item lr>ms
  3005. Left/Right to Mid/Side.
  3006. @item ms>lr
  3007. Mid/Side to Left/Right.
  3008. @item lr>ll
  3009. Left/Right to Left/Left.
  3010. @item lr>rr
  3011. Left/Right to Right/Right.
  3012. @item lr>l+r
  3013. Left/Right to Left + Right.
  3014. @item lr>rl
  3015. Left/Right to Right/Left.
  3016. @item ms>ll
  3017. Mid/Side to Left/Left.
  3018. @item ms>rr
  3019. Mid/Side to Right/Right.
  3020. @end table
  3021. @item slev
  3022. Set level of side signal. Default is 1.
  3023. Allowed range is from 0.015625 to 64.
  3024. @item sbal
  3025. Set balance of side signal. Default is 0.
  3026. Allowed range is from -1 to 1.
  3027. @item mlev
  3028. Set level of the middle signal. Default is 1.
  3029. Allowed range is from 0.015625 to 64.
  3030. @item mpan
  3031. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3032. @item base
  3033. Set stereo base between mono and inversed channels. Default is 0.
  3034. Allowed range is from -1 to 1.
  3035. @item delay
  3036. Set delay in milliseconds how much to delay left from right channel and
  3037. vice versa. Default is 0. Allowed range is from -20 to 20.
  3038. @item sclevel
  3039. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3040. @item phase
  3041. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3042. @item bmode_in, bmode_out
  3043. Set balance mode for balance_in/balance_out option.
  3044. Can be one of the following:
  3045. @table @samp
  3046. @item balance
  3047. Classic balance mode. Attenuate one channel at time.
  3048. Gain is raised up to 1.
  3049. @item amplitude
  3050. Similar as classic mode above but gain is raised up to 2.
  3051. @item power
  3052. Equal power distribution, from -6dB to +6dB range.
  3053. @end table
  3054. @end table
  3055. @subsection Examples
  3056. @itemize
  3057. @item
  3058. Apply karaoke like effect:
  3059. @example
  3060. stereotools=mlev=0.015625
  3061. @end example
  3062. @item
  3063. Convert M/S signal to L/R:
  3064. @example
  3065. "stereotools=mode=ms>lr"
  3066. @end example
  3067. @end itemize
  3068. @section stereowiden
  3069. This filter enhance the stereo effect by suppressing signal common to both
  3070. channels and by delaying the signal of left into right and vice versa,
  3071. thereby widening the stereo effect.
  3072. The filter accepts the following options:
  3073. @table @option
  3074. @item delay
  3075. Time in milliseconds of the delay of left signal into right and vice versa.
  3076. Default is 20 milliseconds.
  3077. @item feedback
  3078. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3079. effect of left signal in right output and vice versa which gives widening
  3080. effect. Default is 0.3.
  3081. @item crossfeed
  3082. Cross feed of left into right with inverted phase. This helps in suppressing
  3083. the mono. If the value is 1 it will cancel all the signal common to both
  3084. channels. Default is 0.3.
  3085. @item drymix
  3086. Set level of input signal of original channel. Default is 0.8.
  3087. @end table
  3088. @section superequalizer
  3089. Apply 18 band equalizer.
  3090. The filter accepts the following options:
  3091. @table @option
  3092. @item 1b
  3093. Set 65Hz band gain.
  3094. @item 2b
  3095. Set 92Hz band gain.
  3096. @item 3b
  3097. Set 131Hz band gain.
  3098. @item 4b
  3099. Set 185Hz band gain.
  3100. @item 5b
  3101. Set 262Hz band gain.
  3102. @item 6b
  3103. Set 370Hz band gain.
  3104. @item 7b
  3105. Set 523Hz band gain.
  3106. @item 8b
  3107. Set 740Hz band gain.
  3108. @item 9b
  3109. Set 1047Hz band gain.
  3110. @item 10b
  3111. Set 1480Hz band gain.
  3112. @item 11b
  3113. Set 2093Hz band gain.
  3114. @item 12b
  3115. Set 2960Hz band gain.
  3116. @item 13b
  3117. Set 4186Hz band gain.
  3118. @item 14b
  3119. Set 5920Hz band gain.
  3120. @item 15b
  3121. Set 8372Hz band gain.
  3122. @item 16b
  3123. Set 11840Hz band gain.
  3124. @item 17b
  3125. Set 16744Hz band gain.
  3126. @item 18b
  3127. Set 20000Hz band gain.
  3128. @end table
  3129. @section surround
  3130. Apply audio surround upmix filter.
  3131. This filter allows to produce multichannel output from audio stream.
  3132. The filter accepts the following options:
  3133. @table @option
  3134. @item chl_out
  3135. Set output channel layout. By default, this is @var{5.1}.
  3136. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3137. for the required syntax.
  3138. @item chl_in
  3139. Set input channel layout. By default, this is @var{stereo}.
  3140. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3141. for the required syntax.
  3142. @item level_in
  3143. Set input volume level. By default, this is @var{1}.
  3144. @item level_out
  3145. Set output volume level. By default, this is @var{1}.
  3146. @item lfe
  3147. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3148. @item lfe_low
  3149. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3150. @item lfe_high
  3151. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3152. @item fc_in
  3153. Set front center input volume. By default, this is @var{1}.
  3154. @item fc_out
  3155. Set front center output volume. By default, this is @var{1}.
  3156. @item lfe_in
  3157. Set LFE input volume. By default, this is @var{1}.
  3158. @item lfe_out
  3159. Set LFE output volume. By default, this is @var{1}.
  3160. @end table
  3161. @section treble
  3162. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3163. shelving filter with a response similar to that of a standard
  3164. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3165. The filter accepts the following options:
  3166. @table @option
  3167. @item gain, g
  3168. Give the gain at whichever is the lower of ~22 kHz and the
  3169. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3170. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3171. @item frequency, f
  3172. Set the filter's central frequency and so can be used
  3173. to extend or reduce the frequency range to be boosted or cut.
  3174. The default value is @code{3000} Hz.
  3175. @item width_type, t
  3176. Set method to specify band-width of filter.
  3177. @table @option
  3178. @item h
  3179. Hz
  3180. @item q
  3181. Q-Factor
  3182. @item o
  3183. octave
  3184. @item s
  3185. slope
  3186. @end table
  3187. @item width, w
  3188. Determine how steep is the filter's shelf transition.
  3189. @item channels, c
  3190. Specify which channels to filter, by default all available are filtered.
  3191. @end table
  3192. @section tremolo
  3193. Sinusoidal amplitude modulation.
  3194. The filter accepts the following options:
  3195. @table @option
  3196. @item f
  3197. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3198. (20 Hz or lower) will result in a tremolo effect.
  3199. This filter may also be used as a ring modulator by specifying
  3200. a modulation frequency higher than 20 Hz.
  3201. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3202. @item d
  3203. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3204. Default value is 0.5.
  3205. @end table
  3206. @section vibrato
  3207. Sinusoidal phase modulation.
  3208. The filter accepts the following options:
  3209. @table @option
  3210. @item f
  3211. Modulation frequency in Hertz.
  3212. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3213. @item d
  3214. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3215. Default value is 0.5.
  3216. @end table
  3217. @section volume
  3218. Adjust the input audio volume.
  3219. It accepts the following parameters:
  3220. @table @option
  3221. @item volume
  3222. Set audio volume expression.
  3223. Output values are clipped to the maximum value.
  3224. The output audio volume is given by the relation:
  3225. @example
  3226. @var{output_volume} = @var{volume} * @var{input_volume}
  3227. @end example
  3228. The default value for @var{volume} is "1.0".
  3229. @item precision
  3230. This parameter represents the mathematical precision.
  3231. It determines which input sample formats will be allowed, which affects the
  3232. precision of the volume scaling.
  3233. @table @option
  3234. @item fixed
  3235. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3236. @item float
  3237. 32-bit floating-point; this limits input sample format to FLT. (default)
  3238. @item double
  3239. 64-bit floating-point; this limits input sample format to DBL.
  3240. @end table
  3241. @item replaygain
  3242. Choose the behaviour on encountering ReplayGain side data in input frames.
  3243. @table @option
  3244. @item drop
  3245. Remove ReplayGain side data, ignoring its contents (the default).
  3246. @item ignore
  3247. Ignore ReplayGain side data, but leave it in the frame.
  3248. @item track
  3249. Prefer the track gain, if present.
  3250. @item album
  3251. Prefer the album gain, if present.
  3252. @end table
  3253. @item replaygain_preamp
  3254. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3255. Default value for @var{replaygain_preamp} is 0.0.
  3256. @item eval
  3257. Set when the volume expression is evaluated.
  3258. It accepts the following values:
  3259. @table @samp
  3260. @item once
  3261. only evaluate expression once during the filter initialization, or
  3262. when the @samp{volume} command is sent
  3263. @item frame
  3264. evaluate expression for each incoming frame
  3265. @end table
  3266. Default value is @samp{once}.
  3267. @end table
  3268. The volume expression can contain the following parameters.
  3269. @table @option
  3270. @item n
  3271. frame number (starting at zero)
  3272. @item nb_channels
  3273. number of channels
  3274. @item nb_consumed_samples
  3275. number of samples consumed by the filter
  3276. @item nb_samples
  3277. number of samples in the current frame
  3278. @item pos
  3279. original frame position in the file
  3280. @item pts
  3281. frame PTS
  3282. @item sample_rate
  3283. sample rate
  3284. @item startpts
  3285. PTS at start of stream
  3286. @item startt
  3287. time at start of stream
  3288. @item t
  3289. frame time
  3290. @item tb
  3291. timestamp timebase
  3292. @item volume
  3293. last set volume value
  3294. @end table
  3295. Note that when @option{eval} is set to @samp{once} only the
  3296. @var{sample_rate} and @var{tb} variables are available, all other
  3297. variables will evaluate to NAN.
  3298. @subsection Commands
  3299. This filter supports the following commands:
  3300. @table @option
  3301. @item volume
  3302. Modify the volume expression.
  3303. The command accepts the same syntax of the corresponding option.
  3304. If the specified expression is not valid, it is kept at its current
  3305. value.
  3306. @item replaygain_noclip
  3307. Prevent clipping by limiting the gain applied.
  3308. Default value for @var{replaygain_noclip} is 1.
  3309. @end table
  3310. @subsection Examples
  3311. @itemize
  3312. @item
  3313. Halve the input audio volume:
  3314. @example
  3315. volume=volume=0.5
  3316. volume=volume=1/2
  3317. volume=volume=-6.0206dB
  3318. @end example
  3319. In all the above example the named key for @option{volume} can be
  3320. omitted, for example like in:
  3321. @example
  3322. volume=0.5
  3323. @end example
  3324. @item
  3325. Increase input audio power by 6 decibels using fixed-point precision:
  3326. @example
  3327. volume=volume=6dB:precision=fixed
  3328. @end example
  3329. @item
  3330. Fade volume after time 10 with an annihilation period of 5 seconds:
  3331. @example
  3332. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3333. @end example
  3334. @end itemize
  3335. @section volumedetect
  3336. Detect the volume of the input video.
  3337. The filter has no parameters. The input is not modified. Statistics about
  3338. the volume will be printed in the log when the input stream end is reached.
  3339. In particular it will show the mean volume (root mean square), maximum
  3340. volume (on a per-sample basis), and the beginning of a histogram of the
  3341. registered volume values (from the maximum value to a cumulated 1/1000 of
  3342. the samples).
  3343. All volumes are in decibels relative to the maximum PCM value.
  3344. @subsection Examples
  3345. Here is an excerpt of the output:
  3346. @example
  3347. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3348. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3349. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3350. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3351. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3352. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3353. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3354. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3355. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3356. @end example
  3357. It means that:
  3358. @itemize
  3359. @item
  3360. The mean square energy is approximately -27 dB, or 10^-2.7.
  3361. @item
  3362. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3363. @item
  3364. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3365. @end itemize
  3366. In other words, raising the volume by +4 dB does not cause any clipping,
  3367. raising it by +5 dB causes clipping for 6 samples, etc.
  3368. @c man end AUDIO FILTERS
  3369. @chapter Audio Sources
  3370. @c man begin AUDIO SOURCES
  3371. Below is a description of the currently available audio sources.
  3372. @section abuffer
  3373. Buffer audio frames, and make them available to the filter chain.
  3374. This source is mainly intended for a programmatic use, in particular
  3375. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3376. It accepts the following parameters:
  3377. @table @option
  3378. @item time_base
  3379. The timebase which will be used for timestamps of submitted frames. It must be
  3380. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3381. @item sample_rate
  3382. The sample rate of the incoming audio buffers.
  3383. @item sample_fmt
  3384. The sample format of the incoming audio buffers.
  3385. Either a sample format name or its corresponding integer representation from
  3386. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3387. @item channel_layout
  3388. The channel layout of the incoming audio buffers.
  3389. Either a channel layout name from channel_layout_map in
  3390. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3391. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3392. @item channels
  3393. The number of channels of the incoming audio buffers.
  3394. If both @var{channels} and @var{channel_layout} are specified, then they
  3395. must be consistent.
  3396. @end table
  3397. @subsection Examples
  3398. @example
  3399. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3400. @end example
  3401. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3402. Since the sample format with name "s16p" corresponds to the number
  3403. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3404. equivalent to:
  3405. @example
  3406. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3407. @end example
  3408. @section aevalsrc
  3409. Generate an audio signal specified by an expression.
  3410. This source accepts in input one or more expressions (one for each
  3411. channel), which are evaluated and used to generate a corresponding
  3412. audio signal.
  3413. This source accepts the following options:
  3414. @table @option
  3415. @item exprs
  3416. Set the '|'-separated expressions list for each separate channel. In case the
  3417. @option{channel_layout} option is not specified, the selected channel layout
  3418. depends on the number of provided expressions. Otherwise the last
  3419. specified expression is applied to the remaining output channels.
  3420. @item channel_layout, c
  3421. Set the channel layout. The number of channels in the specified layout
  3422. must be equal to the number of specified expressions.
  3423. @item duration, d
  3424. Set the minimum duration of the sourced audio. See
  3425. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3426. for the accepted syntax.
  3427. Note that the resulting duration may be greater than the specified
  3428. duration, as the generated audio is always cut at the end of a
  3429. complete frame.
  3430. If not specified, or the expressed duration is negative, the audio is
  3431. supposed to be generated forever.
  3432. @item nb_samples, n
  3433. Set the number of samples per channel per each output frame,
  3434. default to 1024.
  3435. @item sample_rate, s
  3436. Specify the sample rate, default to 44100.
  3437. @end table
  3438. Each expression in @var{exprs} can contain the following constants:
  3439. @table @option
  3440. @item n
  3441. number of the evaluated sample, starting from 0
  3442. @item t
  3443. time of the evaluated sample expressed in seconds, starting from 0
  3444. @item s
  3445. sample rate
  3446. @end table
  3447. @subsection Examples
  3448. @itemize
  3449. @item
  3450. Generate silence:
  3451. @example
  3452. aevalsrc=0
  3453. @end example
  3454. @item
  3455. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3456. 8000 Hz:
  3457. @example
  3458. aevalsrc="sin(440*2*PI*t):s=8000"
  3459. @end example
  3460. @item
  3461. Generate a two channels signal, specify the channel layout (Front
  3462. Center + Back Center) explicitly:
  3463. @example
  3464. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3465. @end example
  3466. @item
  3467. Generate white noise:
  3468. @example
  3469. aevalsrc="-2+random(0)"
  3470. @end example
  3471. @item
  3472. Generate an amplitude modulated signal:
  3473. @example
  3474. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3475. @end example
  3476. @item
  3477. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3478. @example
  3479. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3480. @end example
  3481. @end itemize
  3482. @section anullsrc
  3483. The null audio source, return unprocessed audio frames. It is mainly useful
  3484. as a template and to be employed in analysis / debugging tools, or as
  3485. the source for filters which ignore the input data (for example the sox
  3486. synth filter).
  3487. This source accepts the following options:
  3488. @table @option
  3489. @item channel_layout, cl
  3490. Specifies the channel layout, and can be either an integer or a string
  3491. representing a channel layout. The default value of @var{channel_layout}
  3492. is "stereo".
  3493. Check the channel_layout_map definition in
  3494. @file{libavutil/channel_layout.c} for the mapping between strings and
  3495. channel layout values.
  3496. @item sample_rate, r
  3497. Specifies the sample rate, and defaults to 44100.
  3498. @item nb_samples, n
  3499. Set the number of samples per requested frames.
  3500. @end table
  3501. @subsection Examples
  3502. @itemize
  3503. @item
  3504. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3505. @example
  3506. anullsrc=r=48000:cl=4
  3507. @end example
  3508. @item
  3509. Do the same operation with a more obvious syntax:
  3510. @example
  3511. anullsrc=r=48000:cl=mono
  3512. @end example
  3513. @end itemize
  3514. All the parameters need to be explicitly defined.
  3515. @section flite
  3516. Synthesize a voice utterance using the libflite library.
  3517. To enable compilation of this filter you need to configure FFmpeg with
  3518. @code{--enable-libflite}.
  3519. Note that versions of the flite library prior to 2.0 are not thread-safe.
  3520. The filter accepts the following options:
  3521. @table @option
  3522. @item list_voices
  3523. If set to 1, list the names of the available voices and exit
  3524. immediately. Default value is 0.
  3525. @item nb_samples, n
  3526. Set the maximum number of samples per frame. Default value is 512.
  3527. @item textfile
  3528. Set the filename containing the text to speak.
  3529. @item text
  3530. Set the text to speak.
  3531. @item voice, v
  3532. Set the voice to use for the speech synthesis. Default value is
  3533. @code{kal}. See also the @var{list_voices} option.
  3534. @end table
  3535. @subsection Examples
  3536. @itemize
  3537. @item
  3538. Read from file @file{speech.txt}, and synthesize the text using the
  3539. standard flite voice:
  3540. @example
  3541. flite=textfile=speech.txt
  3542. @end example
  3543. @item
  3544. Read the specified text selecting the @code{slt} voice:
  3545. @example
  3546. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3547. @end example
  3548. @item
  3549. Input text to ffmpeg:
  3550. @example
  3551. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3552. @end example
  3553. @item
  3554. Make @file{ffplay} speak the specified text, using @code{flite} and
  3555. the @code{lavfi} device:
  3556. @example
  3557. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3558. @end example
  3559. @end itemize
  3560. For more information about libflite, check:
  3561. @url{http://www.festvox.org/flite/}
  3562. @section anoisesrc
  3563. Generate a noise audio signal.
  3564. The filter accepts the following options:
  3565. @table @option
  3566. @item sample_rate, r
  3567. Specify the sample rate. Default value is 48000 Hz.
  3568. @item amplitude, a
  3569. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3570. is 1.0.
  3571. @item duration, d
  3572. Specify the duration of the generated audio stream. Not specifying this option
  3573. results in noise with an infinite length.
  3574. @item color, colour, c
  3575. Specify the color of noise. Available noise colors are white, pink, brown,
  3576. blue and violet. Default color is white.
  3577. @item seed, s
  3578. Specify a value used to seed the PRNG.
  3579. @item nb_samples, n
  3580. Set the number of samples per each output frame, default is 1024.
  3581. @end table
  3582. @subsection Examples
  3583. @itemize
  3584. @item
  3585. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3586. @example
  3587. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3588. @end example
  3589. @end itemize
  3590. @section sine
  3591. Generate an audio signal made of a sine wave with amplitude 1/8.
  3592. The audio signal is bit-exact.
  3593. The filter accepts the following options:
  3594. @table @option
  3595. @item frequency, f
  3596. Set the carrier frequency. Default is 440 Hz.
  3597. @item beep_factor, b
  3598. Enable a periodic beep every second with frequency @var{beep_factor} times
  3599. the carrier frequency. Default is 0, meaning the beep is disabled.
  3600. @item sample_rate, r
  3601. Specify the sample rate, default is 44100.
  3602. @item duration, d
  3603. Specify the duration of the generated audio stream.
  3604. @item samples_per_frame
  3605. Set the number of samples per output frame.
  3606. The expression can contain the following constants:
  3607. @table @option
  3608. @item n
  3609. The (sequential) number of the output audio frame, starting from 0.
  3610. @item pts
  3611. The PTS (Presentation TimeStamp) of the output audio frame,
  3612. expressed in @var{TB} units.
  3613. @item t
  3614. The PTS of the output audio frame, expressed in seconds.
  3615. @item TB
  3616. The timebase of the output audio frames.
  3617. @end table
  3618. Default is @code{1024}.
  3619. @end table
  3620. @subsection Examples
  3621. @itemize
  3622. @item
  3623. Generate a simple 440 Hz sine wave:
  3624. @example
  3625. sine
  3626. @end example
  3627. @item
  3628. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3629. @example
  3630. sine=220:4:d=5
  3631. sine=f=220:b=4:d=5
  3632. sine=frequency=220:beep_factor=4:duration=5
  3633. @end example
  3634. @item
  3635. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3636. pattern:
  3637. @example
  3638. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3639. @end example
  3640. @end itemize
  3641. @c man end AUDIO SOURCES
  3642. @chapter Audio Sinks
  3643. @c man begin AUDIO SINKS
  3644. Below is a description of the currently available audio sinks.
  3645. @section abuffersink
  3646. Buffer audio frames, and make them available to the end of filter chain.
  3647. This sink is mainly intended for programmatic use, in particular
  3648. through the interface defined in @file{libavfilter/buffersink.h}
  3649. or the options system.
  3650. It accepts a pointer to an AVABufferSinkContext structure, which
  3651. defines the incoming buffers' formats, to be passed as the opaque
  3652. parameter to @code{avfilter_init_filter} for initialization.
  3653. @section anullsink
  3654. Null audio sink; do absolutely nothing with the input audio. It is
  3655. mainly useful as a template and for use in analysis / debugging
  3656. tools.
  3657. @c man end AUDIO SINKS
  3658. @chapter Video Filters
  3659. @c man begin VIDEO FILTERS
  3660. When you configure your FFmpeg build, you can disable any of the
  3661. existing filters using @code{--disable-filters}.
  3662. The configure output will show the video filters included in your
  3663. build.
  3664. Below is a description of the currently available video filters.
  3665. @section alphaextract
  3666. Extract the alpha component from the input as a grayscale video. This
  3667. is especially useful with the @var{alphamerge} filter.
  3668. @section alphamerge
  3669. Add or replace the alpha component of the primary input with the
  3670. grayscale value of a second input. This is intended for use with
  3671. @var{alphaextract} to allow the transmission or storage of frame
  3672. sequences that have alpha in a format that doesn't support an alpha
  3673. channel.
  3674. For example, to reconstruct full frames from a normal YUV-encoded video
  3675. and a separate video created with @var{alphaextract}, you might use:
  3676. @example
  3677. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3678. @end example
  3679. Since this filter is designed for reconstruction, it operates on frame
  3680. sequences without considering timestamps, and terminates when either
  3681. input reaches end of stream. This will cause problems if your encoding
  3682. pipeline drops frames. If you're trying to apply an image as an
  3683. overlay to a video stream, consider the @var{overlay} filter instead.
  3684. @section ass
  3685. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3686. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3687. Substation Alpha) subtitles files.
  3688. This filter accepts the following option in addition to the common options from
  3689. the @ref{subtitles} filter:
  3690. @table @option
  3691. @item shaping
  3692. Set the shaping engine
  3693. Available values are:
  3694. @table @samp
  3695. @item auto
  3696. The default libass shaping engine, which is the best available.
  3697. @item simple
  3698. Fast, font-agnostic shaper that can do only substitutions
  3699. @item complex
  3700. Slower shaper using OpenType for substitutions and positioning
  3701. @end table
  3702. The default is @code{auto}.
  3703. @end table
  3704. @section atadenoise
  3705. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3706. The filter accepts the following options:
  3707. @table @option
  3708. @item 0a
  3709. Set threshold A for 1st plane. Default is 0.02.
  3710. Valid range is 0 to 0.3.
  3711. @item 0b
  3712. Set threshold B for 1st plane. Default is 0.04.
  3713. Valid range is 0 to 5.
  3714. @item 1a
  3715. Set threshold A for 2nd plane. Default is 0.02.
  3716. Valid range is 0 to 0.3.
  3717. @item 1b
  3718. Set threshold B for 2nd plane. Default is 0.04.
  3719. Valid range is 0 to 5.
  3720. @item 2a
  3721. Set threshold A for 3rd plane. Default is 0.02.
  3722. Valid range is 0 to 0.3.
  3723. @item 2b
  3724. Set threshold B for 3rd plane. Default is 0.04.
  3725. Valid range is 0 to 5.
  3726. Threshold A is designed to react on abrupt changes in the input signal and
  3727. threshold B is designed to react on continuous changes in the input signal.
  3728. @item s
  3729. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3730. number in range [5, 129].
  3731. @item p
  3732. Set what planes of frame filter will use for averaging. Default is all.
  3733. @end table
  3734. @section avgblur
  3735. Apply average blur filter.
  3736. The filter accepts the following options:
  3737. @table @option
  3738. @item sizeX
  3739. Set horizontal kernel size.
  3740. @item planes
  3741. Set which planes to filter. By default all planes are filtered.
  3742. @item sizeY
  3743. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  3744. Default is @code{0}.
  3745. @end table
  3746. @section bbox
  3747. Compute the bounding box for the non-black pixels in the input frame
  3748. luminance plane.
  3749. This filter computes the bounding box containing all the pixels with a
  3750. luminance value greater than the minimum allowed value.
  3751. The parameters describing the bounding box are printed on the filter
  3752. log.
  3753. The filter accepts the following option:
  3754. @table @option
  3755. @item min_val
  3756. Set the minimal luminance value. Default is @code{16}.
  3757. @end table
  3758. @section bitplanenoise
  3759. Show and measure bit plane noise.
  3760. The filter accepts the following options:
  3761. @table @option
  3762. @item bitplane
  3763. Set which plane to analyze. Default is @code{1}.
  3764. @item filter
  3765. Filter out noisy pixels from @code{bitplane} set above.
  3766. Default is disabled.
  3767. @end table
  3768. @section blackdetect
  3769. Detect video intervals that are (almost) completely black. Can be
  3770. useful to detect chapter transitions, commercials, or invalid
  3771. recordings. Output lines contains the time for the start, end and
  3772. duration of the detected black interval expressed in seconds.
  3773. In order to display the output lines, you need to set the loglevel at
  3774. least to the AV_LOG_INFO value.
  3775. The filter accepts the following options:
  3776. @table @option
  3777. @item black_min_duration, d
  3778. Set the minimum detected black duration expressed in seconds. It must
  3779. be a non-negative floating point number.
  3780. Default value is 2.0.
  3781. @item picture_black_ratio_th, pic_th
  3782. Set the threshold for considering a picture "black".
  3783. Express the minimum value for the ratio:
  3784. @example
  3785. @var{nb_black_pixels} / @var{nb_pixels}
  3786. @end example
  3787. for which a picture is considered black.
  3788. Default value is 0.98.
  3789. @item pixel_black_th, pix_th
  3790. Set the threshold for considering a pixel "black".
  3791. The threshold expresses the maximum pixel luminance value for which a
  3792. pixel is considered "black". The provided value is scaled according to
  3793. the following equation:
  3794. @example
  3795. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  3796. @end example
  3797. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  3798. the input video format, the range is [0-255] for YUV full-range
  3799. formats and [16-235] for YUV non full-range formats.
  3800. Default value is 0.10.
  3801. @end table
  3802. The following example sets the maximum pixel threshold to the minimum
  3803. value, and detects only black intervals of 2 or more seconds:
  3804. @example
  3805. blackdetect=d=2:pix_th=0.00
  3806. @end example
  3807. @section blackframe
  3808. Detect frames that are (almost) completely black. Can be useful to
  3809. detect chapter transitions or commercials. Output lines consist of
  3810. the frame number of the detected frame, the percentage of blackness,
  3811. the position in the file if known or -1 and the timestamp in seconds.
  3812. In order to display the output lines, you need to set the loglevel at
  3813. least to the AV_LOG_INFO value.
  3814. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  3815. The value represents the percentage of pixels in the picture that
  3816. are below the threshold value.
  3817. It accepts the following parameters:
  3818. @table @option
  3819. @item amount
  3820. The percentage of the pixels that have to be below the threshold; it defaults to
  3821. @code{98}.
  3822. @item threshold, thresh
  3823. The threshold below which a pixel value is considered black; it defaults to
  3824. @code{32}.
  3825. @end table
  3826. @section blend, tblend
  3827. Blend two video frames into each other.
  3828. The @code{blend} filter takes two input streams and outputs one
  3829. stream, the first input is the "top" layer and second input is
  3830. "bottom" layer. By default, the output terminates when the longest input terminates.
  3831. The @code{tblend} (time blend) filter takes two consecutive frames
  3832. from one single stream, and outputs the result obtained by blending
  3833. the new frame on top of the old frame.
  3834. A description of the accepted options follows.
  3835. @table @option
  3836. @item c0_mode
  3837. @item c1_mode
  3838. @item c2_mode
  3839. @item c3_mode
  3840. @item all_mode
  3841. Set blend mode for specific pixel component or all pixel components in case
  3842. of @var{all_mode}. Default value is @code{normal}.
  3843. Available values for component modes are:
  3844. @table @samp
  3845. @item addition
  3846. @item grainmerge
  3847. @item and
  3848. @item average
  3849. @item burn
  3850. @item darken
  3851. @item difference
  3852. @item grainextract
  3853. @item divide
  3854. @item dodge
  3855. @item freeze
  3856. @item exclusion
  3857. @item extremity
  3858. @item glow
  3859. @item hardlight
  3860. @item hardmix
  3861. @item heat
  3862. @item lighten
  3863. @item linearlight
  3864. @item multiply
  3865. @item multiply128
  3866. @item negation
  3867. @item normal
  3868. @item or
  3869. @item overlay
  3870. @item phoenix
  3871. @item pinlight
  3872. @item reflect
  3873. @item screen
  3874. @item softlight
  3875. @item subtract
  3876. @item vividlight
  3877. @item xor
  3878. @end table
  3879. @item c0_opacity
  3880. @item c1_opacity
  3881. @item c2_opacity
  3882. @item c3_opacity
  3883. @item all_opacity
  3884. Set blend opacity for specific pixel component or all pixel components in case
  3885. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  3886. @item c0_expr
  3887. @item c1_expr
  3888. @item c2_expr
  3889. @item c3_expr
  3890. @item all_expr
  3891. Set blend expression for specific pixel component or all pixel components in case
  3892. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3893. The expressions can use the following variables:
  3894. @table @option
  3895. @item N
  3896. The sequential number of the filtered frame, starting from @code{0}.
  3897. @item X
  3898. @item Y
  3899. the coordinates of the current sample
  3900. @item W
  3901. @item H
  3902. the width and height of currently filtered plane
  3903. @item SW
  3904. @item SH
  3905. Width and height scale depending on the currently filtered plane. It is the
  3906. ratio between the corresponding luma plane number of pixels and the current
  3907. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3908. @code{0.5,0.5} for chroma planes.
  3909. @item T
  3910. Time of the current frame, expressed in seconds.
  3911. @item TOP, A
  3912. Value of pixel component at current location for first video frame (top layer).
  3913. @item BOTTOM, B
  3914. Value of pixel component at current location for second video frame (bottom layer).
  3915. @end table
  3916. @end table
  3917. The @code{blend} filter also supports the @ref{framesync} options.
  3918. @subsection Examples
  3919. @itemize
  3920. @item
  3921. Apply transition from bottom layer to top layer in first 10 seconds:
  3922. @example
  3923. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3924. @end example
  3925. @item
  3926. Apply linear horizontal transition from top layer to bottom layer:
  3927. @example
  3928. blend=all_expr='A*(X/W)+B*(1-X/W)'
  3929. @end example
  3930. @item
  3931. Apply 1x1 checkerboard effect:
  3932. @example
  3933. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  3934. @end example
  3935. @item
  3936. Apply uncover left effect:
  3937. @example
  3938. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  3939. @end example
  3940. @item
  3941. Apply uncover down effect:
  3942. @example
  3943. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  3944. @end example
  3945. @item
  3946. Apply uncover up-left effect:
  3947. @example
  3948. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  3949. @end example
  3950. @item
  3951. Split diagonally video and shows top and bottom layer on each side:
  3952. @example
  3953. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  3954. @end example
  3955. @item
  3956. Display differences between the current and the previous frame:
  3957. @example
  3958. tblend=all_mode=grainextract
  3959. @end example
  3960. @end itemize
  3961. @section boxblur
  3962. Apply a boxblur algorithm to the input video.
  3963. It accepts the following parameters:
  3964. @table @option
  3965. @item luma_radius, lr
  3966. @item luma_power, lp
  3967. @item chroma_radius, cr
  3968. @item chroma_power, cp
  3969. @item alpha_radius, ar
  3970. @item alpha_power, ap
  3971. @end table
  3972. A description of the accepted options follows.
  3973. @table @option
  3974. @item luma_radius, lr
  3975. @item chroma_radius, cr
  3976. @item alpha_radius, ar
  3977. Set an expression for the box radius in pixels used for blurring the
  3978. corresponding input plane.
  3979. The radius value must be a non-negative number, and must not be
  3980. greater than the value of the expression @code{min(w,h)/2} for the
  3981. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  3982. planes.
  3983. Default value for @option{luma_radius} is "2". If not specified,
  3984. @option{chroma_radius} and @option{alpha_radius} default to the
  3985. corresponding value set for @option{luma_radius}.
  3986. The expressions can contain the following constants:
  3987. @table @option
  3988. @item w
  3989. @item h
  3990. The input width and height in pixels.
  3991. @item cw
  3992. @item ch
  3993. The input chroma image width and height in pixels.
  3994. @item hsub
  3995. @item vsub
  3996. The horizontal and vertical chroma subsample values. For example, for the
  3997. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  3998. @end table
  3999. @item luma_power, lp
  4000. @item chroma_power, cp
  4001. @item alpha_power, ap
  4002. Specify how many times the boxblur filter is applied to the
  4003. corresponding plane.
  4004. Default value for @option{luma_power} is 2. If not specified,
  4005. @option{chroma_power} and @option{alpha_power} default to the
  4006. corresponding value set for @option{luma_power}.
  4007. A value of 0 will disable the effect.
  4008. @end table
  4009. @subsection Examples
  4010. @itemize
  4011. @item
  4012. Apply a boxblur filter with the luma, chroma, and alpha radii
  4013. set to 2:
  4014. @example
  4015. boxblur=luma_radius=2:luma_power=1
  4016. boxblur=2:1
  4017. @end example
  4018. @item
  4019. Set the luma radius to 2, and alpha and chroma radius to 0:
  4020. @example
  4021. boxblur=2:1:cr=0:ar=0
  4022. @end example
  4023. @item
  4024. Set the luma and chroma radii to a fraction of the video dimension:
  4025. @example
  4026. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4027. @end example
  4028. @end itemize
  4029. @section bwdif
  4030. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4031. Deinterlacing Filter").
  4032. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4033. interpolation algorithms.
  4034. It accepts the following parameters:
  4035. @table @option
  4036. @item mode
  4037. The interlacing mode to adopt. It accepts one of the following values:
  4038. @table @option
  4039. @item 0, send_frame
  4040. Output one frame for each frame.
  4041. @item 1, send_field
  4042. Output one frame for each field.
  4043. @end table
  4044. The default value is @code{send_field}.
  4045. @item parity
  4046. The picture field parity assumed for the input interlaced video. It accepts one
  4047. of the following values:
  4048. @table @option
  4049. @item 0, tff
  4050. Assume the top field is first.
  4051. @item 1, bff
  4052. Assume the bottom field is first.
  4053. @item -1, auto
  4054. Enable automatic detection of field parity.
  4055. @end table
  4056. The default value is @code{auto}.
  4057. If the interlacing is unknown or the decoder does not export this information,
  4058. top field first will be assumed.
  4059. @item deint
  4060. Specify which frames to deinterlace. Accept one of the following
  4061. values:
  4062. @table @option
  4063. @item 0, all
  4064. Deinterlace all frames.
  4065. @item 1, interlaced
  4066. Only deinterlace frames marked as interlaced.
  4067. @end table
  4068. The default value is @code{all}.
  4069. @end table
  4070. @section chromakey
  4071. YUV colorspace color/chroma keying.
  4072. The filter accepts the following options:
  4073. @table @option
  4074. @item color
  4075. The color which will be replaced with transparency.
  4076. @item similarity
  4077. Similarity percentage with the key color.
  4078. 0.01 matches only the exact key color, while 1.0 matches everything.
  4079. @item blend
  4080. Blend percentage.
  4081. 0.0 makes pixels either fully transparent, or not transparent at all.
  4082. Higher values result in semi-transparent pixels, with a higher transparency
  4083. the more similar the pixels color is to the key color.
  4084. @item yuv
  4085. Signals that the color passed is already in YUV instead of RGB.
  4086. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4087. This can be used to pass exact YUV values as hexadecimal numbers.
  4088. @end table
  4089. @subsection Examples
  4090. @itemize
  4091. @item
  4092. Make every green pixel in the input image transparent:
  4093. @example
  4094. ffmpeg -i input.png -vf chromakey=green out.png
  4095. @end example
  4096. @item
  4097. Overlay a greenscreen-video on top of a static black background.
  4098. @example
  4099. ffmpeg -f lavfi -i color=c=black:s=1280x720 -i video.mp4 -shortest -filter_complex "[1:v]chromakey=0x70de77:0.1:0.2[ckout];[0:v][ckout]overlay[out]" -map "[out]" output.mkv
  4100. @end example
  4101. @end itemize
  4102. @section ciescope
  4103. Display CIE color diagram with pixels overlaid onto it.
  4104. The filter accepts the following options:
  4105. @table @option
  4106. @item system
  4107. Set color system.
  4108. @table @samp
  4109. @item ntsc, 470m
  4110. @item ebu, 470bg
  4111. @item smpte
  4112. @item 240m
  4113. @item apple
  4114. @item widergb
  4115. @item cie1931
  4116. @item rec709, hdtv
  4117. @item uhdtv, rec2020
  4118. @end table
  4119. @item cie
  4120. Set CIE system.
  4121. @table @samp
  4122. @item xyy
  4123. @item ucs
  4124. @item luv
  4125. @end table
  4126. @item gamuts
  4127. Set what gamuts to draw.
  4128. See @code{system} option for available values.
  4129. @item size, s
  4130. Set ciescope size, by default set to 512.
  4131. @item intensity, i
  4132. Set intensity used to map input pixel values to CIE diagram.
  4133. @item contrast
  4134. Set contrast used to draw tongue colors that are out of active color system gamut.
  4135. @item corrgamma
  4136. Correct gamma displayed on scope, by default enabled.
  4137. @item showwhite
  4138. Show white point on CIE diagram, by default disabled.
  4139. @item gamma
  4140. Set input gamma. Used only with XYZ input color space.
  4141. @end table
  4142. @section codecview
  4143. Visualize information exported by some codecs.
  4144. Some codecs can export information through frames using side-data or other
  4145. means. For example, some MPEG based codecs export motion vectors through the
  4146. @var{export_mvs} flag in the codec @option{flags2} option.
  4147. The filter accepts the following option:
  4148. @table @option
  4149. @item mv
  4150. Set motion vectors to visualize.
  4151. Available flags for @var{mv} are:
  4152. @table @samp
  4153. @item pf
  4154. forward predicted MVs of P-frames
  4155. @item bf
  4156. forward predicted MVs of B-frames
  4157. @item bb
  4158. backward predicted MVs of B-frames
  4159. @end table
  4160. @item qp
  4161. Display quantization parameters using the chroma planes.
  4162. @item mv_type, mvt
  4163. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4164. Available flags for @var{mv_type} are:
  4165. @table @samp
  4166. @item fp
  4167. forward predicted MVs
  4168. @item bp
  4169. backward predicted MVs
  4170. @end table
  4171. @item frame_type, ft
  4172. Set frame type to visualize motion vectors of.
  4173. Available flags for @var{frame_type} are:
  4174. @table @samp
  4175. @item if
  4176. intra-coded frames (I-frames)
  4177. @item pf
  4178. predicted frames (P-frames)
  4179. @item bf
  4180. bi-directionally predicted frames (B-frames)
  4181. @end table
  4182. @end table
  4183. @subsection Examples
  4184. @itemize
  4185. @item
  4186. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4187. @example
  4188. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4189. @end example
  4190. @item
  4191. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4192. @example
  4193. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4194. @end example
  4195. @end itemize
  4196. @section colorbalance
  4197. Modify intensity of primary colors (red, green and blue) of input frames.
  4198. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4199. regions for the red-cyan, green-magenta or blue-yellow balance.
  4200. A positive adjustment value shifts the balance towards the primary color, a negative
  4201. value towards the complementary color.
  4202. The filter accepts the following options:
  4203. @table @option
  4204. @item rs
  4205. @item gs
  4206. @item bs
  4207. Adjust red, green and blue shadows (darkest pixels).
  4208. @item rm
  4209. @item gm
  4210. @item bm
  4211. Adjust red, green and blue midtones (medium pixels).
  4212. @item rh
  4213. @item gh
  4214. @item bh
  4215. Adjust red, green and blue highlights (brightest pixels).
  4216. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4217. @end table
  4218. @subsection Examples
  4219. @itemize
  4220. @item
  4221. Add red color cast to shadows:
  4222. @example
  4223. colorbalance=rs=.3
  4224. @end example
  4225. @end itemize
  4226. @section colorkey
  4227. RGB colorspace color keying.
  4228. The filter accepts the following options:
  4229. @table @option
  4230. @item color
  4231. The color which will be replaced with transparency.
  4232. @item similarity
  4233. Similarity percentage with the key color.
  4234. 0.01 matches only the exact key color, while 1.0 matches everything.
  4235. @item blend
  4236. Blend percentage.
  4237. 0.0 makes pixels either fully transparent, or not transparent at all.
  4238. Higher values result in semi-transparent pixels, with a higher transparency
  4239. the more similar the pixels color is to the key color.
  4240. @end table
  4241. @subsection Examples
  4242. @itemize
  4243. @item
  4244. Make every green pixel in the input image transparent:
  4245. @example
  4246. ffmpeg -i input.png -vf colorkey=green out.png
  4247. @end example
  4248. @item
  4249. Overlay a greenscreen-video on top of a static background image.
  4250. @example
  4251. ffmpeg -i background.png -i video.mp4 -filter_complex "[1:v]colorkey=0x3BBD1E:0.3:0.2[ckout];[0:v][ckout]overlay[out]" -map "[out]" output.flv
  4252. @end example
  4253. @end itemize
  4254. @section colorlevels
  4255. Adjust video input frames using levels.
  4256. The filter accepts the following options:
  4257. @table @option
  4258. @item rimin
  4259. @item gimin
  4260. @item bimin
  4261. @item aimin
  4262. Adjust red, green, blue and alpha input black point.
  4263. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4264. @item rimax
  4265. @item gimax
  4266. @item bimax
  4267. @item aimax
  4268. Adjust red, green, blue and alpha input white point.
  4269. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  4270. Input levels are used to lighten highlights (bright tones), darken shadows
  4271. (dark tones), change the balance of bright and dark tones.
  4272. @item romin
  4273. @item gomin
  4274. @item bomin
  4275. @item aomin
  4276. Adjust red, green, blue and alpha output black point.
  4277. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  4278. @item romax
  4279. @item gomax
  4280. @item bomax
  4281. @item aomax
  4282. Adjust red, green, blue and alpha output white point.
  4283. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  4284. Output levels allows manual selection of a constrained output level range.
  4285. @end table
  4286. @subsection Examples
  4287. @itemize
  4288. @item
  4289. Make video output darker:
  4290. @example
  4291. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4292. @end example
  4293. @item
  4294. Increase contrast:
  4295. @example
  4296. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4297. @end example
  4298. @item
  4299. Make video output lighter:
  4300. @example
  4301. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4302. @end example
  4303. @item
  4304. Increase brightness:
  4305. @example
  4306. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4307. @end example
  4308. @end itemize
  4309. @section colorchannelmixer
  4310. Adjust video input frames by re-mixing color channels.
  4311. This filter modifies a color channel by adding the values associated to
  4312. the other channels of the same pixels. For example if the value to
  4313. modify is red, the output value will be:
  4314. @example
  4315. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4316. @end example
  4317. The filter accepts the following options:
  4318. @table @option
  4319. @item rr
  4320. @item rg
  4321. @item rb
  4322. @item ra
  4323. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4324. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4325. @item gr
  4326. @item gg
  4327. @item gb
  4328. @item ga
  4329. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4330. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4331. @item br
  4332. @item bg
  4333. @item bb
  4334. @item ba
  4335. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4336. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4337. @item ar
  4338. @item ag
  4339. @item ab
  4340. @item aa
  4341. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4342. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4343. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4344. @end table
  4345. @subsection Examples
  4346. @itemize
  4347. @item
  4348. Convert source to grayscale:
  4349. @example
  4350. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4351. @end example
  4352. @item
  4353. Simulate sepia tones:
  4354. @example
  4355. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4356. @end example
  4357. @end itemize
  4358. @section colormatrix
  4359. Convert color matrix.
  4360. The filter accepts the following options:
  4361. @table @option
  4362. @item src
  4363. @item dst
  4364. Specify the source and destination color matrix. Both values must be
  4365. specified.
  4366. The accepted values are:
  4367. @table @samp
  4368. @item bt709
  4369. BT.709
  4370. @item fcc
  4371. FCC
  4372. @item bt601
  4373. BT.601
  4374. @item bt470
  4375. BT.470
  4376. @item bt470bg
  4377. BT.470BG
  4378. @item smpte170m
  4379. SMPTE-170M
  4380. @item smpte240m
  4381. SMPTE-240M
  4382. @item bt2020
  4383. BT.2020
  4384. @end table
  4385. @end table
  4386. For example to convert from BT.601 to SMPTE-240M, use the command:
  4387. @example
  4388. colormatrix=bt601:smpte240m
  4389. @end example
  4390. @section colorspace
  4391. Convert colorspace, transfer characteristics or color primaries.
  4392. Input video needs to have an even size.
  4393. The filter accepts the following options:
  4394. @table @option
  4395. @anchor{all}
  4396. @item all
  4397. Specify all color properties at once.
  4398. The accepted values are:
  4399. @table @samp
  4400. @item bt470m
  4401. BT.470M
  4402. @item bt470bg
  4403. BT.470BG
  4404. @item bt601-6-525
  4405. BT.601-6 525
  4406. @item bt601-6-625
  4407. BT.601-6 625
  4408. @item bt709
  4409. BT.709
  4410. @item smpte170m
  4411. SMPTE-170M
  4412. @item smpte240m
  4413. SMPTE-240M
  4414. @item bt2020
  4415. BT.2020
  4416. @end table
  4417. @anchor{space}
  4418. @item space
  4419. Specify output colorspace.
  4420. The accepted values are:
  4421. @table @samp
  4422. @item bt709
  4423. BT.709
  4424. @item fcc
  4425. FCC
  4426. @item bt470bg
  4427. BT.470BG or BT.601-6 625
  4428. @item smpte170m
  4429. SMPTE-170M or BT.601-6 525
  4430. @item smpte240m
  4431. SMPTE-240M
  4432. @item ycgco
  4433. YCgCo
  4434. @item bt2020ncl
  4435. BT.2020 with non-constant luminance
  4436. @end table
  4437. @anchor{trc}
  4438. @item trc
  4439. Specify output transfer characteristics.
  4440. The accepted values are:
  4441. @table @samp
  4442. @item bt709
  4443. BT.709
  4444. @item bt470m
  4445. BT.470M
  4446. @item bt470bg
  4447. BT.470BG
  4448. @item gamma22
  4449. Constant gamma of 2.2
  4450. @item gamma28
  4451. Constant gamma of 2.8
  4452. @item smpte170m
  4453. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4454. @item smpte240m
  4455. SMPTE-240M
  4456. @item srgb
  4457. SRGB
  4458. @item iec61966-2-1
  4459. iec61966-2-1
  4460. @item iec61966-2-4
  4461. iec61966-2-4
  4462. @item xvycc
  4463. xvycc
  4464. @item bt2020-10
  4465. BT.2020 for 10-bits content
  4466. @item bt2020-12
  4467. BT.2020 for 12-bits content
  4468. @end table
  4469. @anchor{primaries}
  4470. @item primaries
  4471. Specify output color primaries.
  4472. The accepted values are:
  4473. @table @samp
  4474. @item bt709
  4475. BT.709
  4476. @item bt470m
  4477. BT.470M
  4478. @item bt470bg
  4479. BT.470BG or BT.601-6 625
  4480. @item smpte170m
  4481. SMPTE-170M or BT.601-6 525
  4482. @item smpte240m
  4483. SMPTE-240M
  4484. @item film
  4485. film
  4486. @item smpte431
  4487. SMPTE-431
  4488. @item smpte432
  4489. SMPTE-432
  4490. @item bt2020
  4491. BT.2020
  4492. @item jedec-p22
  4493. JEDEC P22 phosphors
  4494. @end table
  4495. @anchor{range}
  4496. @item range
  4497. Specify output color range.
  4498. The accepted values are:
  4499. @table @samp
  4500. @item tv
  4501. TV (restricted) range
  4502. @item mpeg
  4503. MPEG (restricted) range
  4504. @item pc
  4505. PC (full) range
  4506. @item jpeg
  4507. JPEG (full) range
  4508. @end table
  4509. @item format
  4510. Specify output color format.
  4511. The accepted values are:
  4512. @table @samp
  4513. @item yuv420p
  4514. YUV 4:2:0 planar 8-bits
  4515. @item yuv420p10
  4516. YUV 4:2:0 planar 10-bits
  4517. @item yuv420p12
  4518. YUV 4:2:0 planar 12-bits
  4519. @item yuv422p
  4520. YUV 4:2:2 planar 8-bits
  4521. @item yuv422p10
  4522. YUV 4:2:2 planar 10-bits
  4523. @item yuv422p12
  4524. YUV 4:2:2 planar 12-bits
  4525. @item yuv444p
  4526. YUV 4:4:4 planar 8-bits
  4527. @item yuv444p10
  4528. YUV 4:4:4 planar 10-bits
  4529. @item yuv444p12
  4530. YUV 4:4:4 planar 12-bits
  4531. @end table
  4532. @item fast
  4533. Do a fast conversion, which skips gamma/primary correction. This will take
  4534. significantly less CPU, but will be mathematically incorrect. To get output
  4535. compatible with that produced by the colormatrix filter, use fast=1.
  4536. @item dither
  4537. Specify dithering mode.
  4538. The accepted values are:
  4539. @table @samp
  4540. @item none
  4541. No dithering
  4542. @item fsb
  4543. Floyd-Steinberg dithering
  4544. @end table
  4545. @item wpadapt
  4546. Whitepoint adaptation mode.
  4547. The accepted values are:
  4548. @table @samp
  4549. @item bradford
  4550. Bradford whitepoint adaptation
  4551. @item vonkries
  4552. von Kries whitepoint adaptation
  4553. @item identity
  4554. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4555. @end table
  4556. @item iall
  4557. Override all input properties at once. Same accepted values as @ref{all}.
  4558. @item ispace
  4559. Override input colorspace. Same accepted values as @ref{space}.
  4560. @item iprimaries
  4561. Override input color primaries. Same accepted values as @ref{primaries}.
  4562. @item itrc
  4563. Override input transfer characteristics. Same accepted values as @ref{trc}.
  4564. @item irange
  4565. Override input color range. Same accepted values as @ref{range}.
  4566. @end table
  4567. The filter converts the transfer characteristics, color space and color
  4568. primaries to the specified user values. The output value, if not specified,
  4569. is set to a default value based on the "all" property. If that property is
  4570. also not specified, the filter will log an error. The output color range and
  4571. format default to the same value as the input color range and format. The
  4572. input transfer characteristics, color space, color primaries and color range
  4573. should be set on the input data. If any of these are missing, the filter will
  4574. log an error and no conversion will take place.
  4575. For example to convert the input to SMPTE-240M, use the command:
  4576. @example
  4577. colorspace=smpte240m
  4578. @end example
  4579. @section convolution
  4580. Apply convolution 3x3 or 5x5 filter.
  4581. The filter accepts the following options:
  4582. @table @option
  4583. @item 0m
  4584. @item 1m
  4585. @item 2m
  4586. @item 3m
  4587. Set matrix for each plane.
  4588. Matrix is sequence of 9 or 25 signed integers.
  4589. @item 0rdiv
  4590. @item 1rdiv
  4591. @item 2rdiv
  4592. @item 3rdiv
  4593. Set multiplier for calculated value for each plane.
  4594. @item 0bias
  4595. @item 1bias
  4596. @item 2bias
  4597. @item 3bias
  4598. Set bias for each plane. This value is added to the result of the multiplication.
  4599. Useful for making the overall image brighter or darker. Default is 0.0.
  4600. @end table
  4601. @subsection Examples
  4602. @itemize
  4603. @item
  4604. Apply sharpen:
  4605. @example
  4606. convolution="0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0"
  4607. @end example
  4608. @item
  4609. Apply blur:
  4610. @example
  4611. convolution="1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1/9:1/9:1/9:1/9"
  4612. @end example
  4613. @item
  4614. Apply edge enhance:
  4615. @example
  4616. convolution="0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:5:1:1:1:0:128:128:128"
  4617. @end example
  4618. @item
  4619. Apply edge detect:
  4620. @example
  4621. convolution="0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:5:5:5:1:0:128:128:128"
  4622. @end example
  4623. @item
  4624. Apply laplacian edge detector which includes diagonals:
  4625. @example
  4626. convolution="1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:1 1 1 1 -8 1 1 1 1:5:5:5:1:0:128:128:0"
  4627. @end example
  4628. @item
  4629. Apply emboss:
  4630. @example
  4631. convolution="-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2"
  4632. @end example
  4633. @end itemize
  4634. @section convolve
  4635. Apply 2D convolution of video stream in frequency domain using second stream
  4636. as impulse.
  4637. The filter accepts the following options:
  4638. @table @option
  4639. @item planes
  4640. Set which planes to process.
  4641. @item impulse
  4642. Set which impulse video frames will be processed, can be @var{first}
  4643. or @var{all}. Default is @var{all}.
  4644. @end table
  4645. The @code{convolve} filter also supports the @ref{framesync} options.
  4646. @section copy
  4647. Copy the input video source unchanged to the output. This is mainly useful for
  4648. testing purposes.
  4649. @anchor{coreimage}
  4650. @section coreimage
  4651. Video filtering on GPU using Apple's CoreImage API on OSX.
  4652. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4653. processed by video hardware. However, software-based OpenGL implementations
  4654. exist which means there is no guarantee for hardware processing. It depends on
  4655. the respective OSX.
  4656. There are many filters and image generators provided by Apple that come with a
  4657. large variety of options. The filter has to be referenced by its name along
  4658. with its options.
  4659. The coreimage filter accepts the following options:
  4660. @table @option
  4661. @item list_filters
  4662. List all available filters and generators along with all their respective
  4663. options as well as possible minimum and maximum values along with the default
  4664. values.
  4665. @example
  4666. list_filters=true
  4667. @end example
  4668. @item filter
  4669. Specify all filters by their respective name and options.
  4670. Use @var{list_filters} to determine all valid filter names and options.
  4671. Numerical options are specified by a float value and are automatically clamped
  4672. to their respective value range. Vector and color options have to be specified
  4673. by a list of space separated float values. Character escaping has to be done.
  4674. A special option name @code{default} is available to use default options for a
  4675. filter.
  4676. It is required to specify either @code{default} or at least one of the filter options.
  4677. All omitted options are used with their default values.
  4678. The syntax of the filter string is as follows:
  4679. @example
  4680. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  4681. @end example
  4682. @item output_rect
  4683. Specify a rectangle where the output of the filter chain is copied into the
  4684. input image. It is given by a list of space separated float values:
  4685. @example
  4686. output_rect=x\ y\ width\ height
  4687. @end example
  4688. If not given, the output rectangle equals the dimensions of the input image.
  4689. The output rectangle is automatically cropped at the borders of the input
  4690. image. Negative values are valid for each component.
  4691. @example
  4692. output_rect=25\ 25\ 100\ 100
  4693. @end example
  4694. @end table
  4695. Several filters can be chained for successive processing without GPU-HOST
  4696. transfers allowing for fast processing of complex filter chains.
  4697. Currently, only filters with zero (generators) or exactly one (filters) input
  4698. image and one output image are supported. Also, transition filters are not yet
  4699. usable as intended.
  4700. Some filters generate output images with additional padding depending on the
  4701. respective filter kernel. The padding is automatically removed to ensure the
  4702. filter output has the same size as the input image.
  4703. For image generators, the size of the output image is determined by the
  4704. previous output image of the filter chain or the input image of the whole
  4705. filterchain, respectively. The generators do not use the pixel information of
  4706. this image to generate their output. However, the generated output is
  4707. blended onto this image, resulting in partial or complete coverage of the
  4708. output image.
  4709. The @ref{coreimagesrc} video source can be used for generating input images
  4710. which are directly fed into the filter chain. By using it, providing input
  4711. images by another video source or an input video is not required.
  4712. @subsection Examples
  4713. @itemize
  4714. @item
  4715. List all filters available:
  4716. @example
  4717. coreimage=list_filters=true
  4718. @end example
  4719. @item
  4720. Use the CIBoxBlur filter with default options to blur an image:
  4721. @example
  4722. coreimage=filter=CIBoxBlur@@default
  4723. @end example
  4724. @item
  4725. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  4726. its center at 100x100 and a radius of 50 pixels:
  4727. @example
  4728. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  4729. @end example
  4730. @item
  4731. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  4732. given as complete and escaped command-line for Apple's standard bash shell:
  4733. @example
  4734. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  4735. @end example
  4736. @end itemize
  4737. @section crop
  4738. Crop the input video to given dimensions.
  4739. It accepts the following parameters:
  4740. @table @option
  4741. @item w, out_w
  4742. The width of the output video. It defaults to @code{iw}.
  4743. This expression is evaluated only once during the filter
  4744. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  4745. @item h, out_h
  4746. The height of the output video. It defaults to @code{ih}.
  4747. This expression is evaluated only once during the filter
  4748. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  4749. @item x
  4750. The horizontal position, in the input video, of the left edge of the output
  4751. video. It defaults to @code{(in_w-out_w)/2}.
  4752. This expression is evaluated per-frame.
  4753. @item y
  4754. The vertical position, in the input video, of the top edge of the output video.
  4755. It defaults to @code{(in_h-out_h)/2}.
  4756. This expression is evaluated per-frame.
  4757. @item keep_aspect
  4758. If set to 1 will force the output display aspect ratio
  4759. to be the same of the input, by changing the output sample aspect
  4760. ratio. It defaults to 0.
  4761. @item exact
  4762. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  4763. width/height/x/y as specified and will not be rounded to nearest smaller value.
  4764. It defaults to 0.
  4765. @end table
  4766. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  4767. expressions containing the following constants:
  4768. @table @option
  4769. @item x
  4770. @item y
  4771. The computed values for @var{x} and @var{y}. They are evaluated for
  4772. each new frame.
  4773. @item in_w
  4774. @item in_h
  4775. The input width and height.
  4776. @item iw
  4777. @item ih
  4778. These are the same as @var{in_w} and @var{in_h}.
  4779. @item out_w
  4780. @item out_h
  4781. The output (cropped) width and height.
  4782. @item ow
  4783. @item oh
  4784. These are the same as @var{out_w} and @var{out_h}.
  4785. @item a
  4786. same as @var{iw} / @var{ih}
  4787. @item sar
  4788. input sample aspect ratio
  4789. @item dar
  4790. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4791. @item hsub
  4792. @item vsub
  4793. horizontal and vertical chroma subsample values. For example for the
  4794. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4795. @item n
  4796. The number of the input frame, starting from 0.
  4797. @item pos
  4798. the position in the file of the input frame, NAN if unknown
  4799. @item t
  4800. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  4801. @end table
  4802. The expression for @var{out_w} may depend on the value of @var{out_h},
  4803. and the expression for @var{out_h} may depend on @var{out_w}, but they
  4804. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  4805. evaluated after @var{out_w} and @var{out_h}.
  4806. The @var{x} and @var{y} parameters specify the expressions for the
  4807. position of the top-left corner of the output (non-cropped) area. They
  4808. are evaluated for each frame. If the evaluated value is not valid, it
  4809. is approximated to the nearest valid value.
  4810. The expression for @var{x} may depend on @var{y}, and the expression
  4811. for @var{y} may depend on @var{x}.
  4812. @subsection Examples
  4813. @itemize
  4814. @item
  4815. Crop area with size 100x100 at position (12,34).
  4816. @example
  4817. crop=100:100:12:34
  4818. @end example
  4819. Using named options, the example above becomes:
  4820. @example
  4821. crop=w=100:h=100:x=12:y=34
  4822. @end example
  4823. @item
  4824. Crop the central input area with size 100x100:
  4825. @example
  4826. crop=100:100
  4827. @end example
  4828. @item
  4829. Crop the central input area with size 2/3 of the input video:
  4830. @example
  4831. crop=2/3*in_w:2/3*in_h
  4832. @end example
  4833. @item
  4834. Crop the input video central square:
  4835. @example
  4836. crop=out_w=in_h
  4837. crop=in_h
  4838. @end example
  4839. @item
  4840. Delimit the rectangle with the top-left corner placed at position
  4841. 100:100 and the right-bottom corner corresponding to the right-bottom
  4842. corner of the input image.
  4843. @example
  4844. crop=in_w-100:in_h-100:100:100
  4845. @end example
  4846. @item
  4847. Crop 10 pixels from the left and right borders, and 20 pixels from
  4848. the top and bottom borders
  4849. @example
  4850. crop=in_w-2*10:in_h-2*20
  4851. @end example
  4852. @item
  4853. Keep only the bottom right quarter of the input image:
  4854. @example
  4855. crop=in_w/2:in_h/2:in_w/2:in_h/2
  4856. @end example
  4857. @item
  4858. Crop height for getting Greek harmony:
  4859. @example
  4860. crop=in_w:1/PHI*in_w
  4861. @end example
  4862. @item
  4863. Apply trembling effect:
  4864. @example
  4865. crop=in_w/2:in_h/2:(in_w-out_w)/2+((in_w-out_w)/2)*sin(n/10):(in_h-out_h)/2 +((in_h-out_h)/2)*sin(n/7)
  4866. @end example
  4867. @item
  4868. Apply erratic camera effect depending on timestamp:
  4869. @example
  4870. crop=in_w/2:in_h/2:(in_w-out_w)/2+((in_w-out_w)/2)*sin(t*10):(in_h-out_h)/2 +((in_h-out_h)/2)*sin(t*13)"
  4871. @end example
  4872. @item
  4873. Set x depending on the value of y:
  4874. @example
  4875. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  4876. @end example
  4877. @end itemize
  4878. @subsection Commands
  4879. This filter supports the following commands:
  4880. @table @option
  4881. @item w, out_w
  4882. @item h, out_h
  4883. @item x
  4884. @item y
  4885. Set width/height of the output video and the horizontal/vertical position
  4886. in the input video.
  4887. The command accepts the same syntax of the corresponding option.
  4888. If the specified expression is not valid, it is kept at its current
  4889. value.
  4890. @end table
  4891. @section cropdetect
  4892. Auto-detect the crop size.
  4893. It calculates the necessary cropping parameters and prints the
  4894. recommended parameters via the logging system. The detected dimensions
  4895. correspond to the non-black area of the input video.
  4896. It accepts the following parameters:
  4897. @table @option
  4898. @item limit
  4899. Set higher black value threshold, which can be optionally specified
  4900. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  4901. value greater to the set value is considered non-black. It defaults to 24.
  4902. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  4903. on the bitdepth of the pixel format.
  4904. @item round
  4905. The value which the width/height should be divisible by. It defaults to
  4906. 16. The offset is automatically adjusted to center the video. Use 2 to
  4907. get only even dimensions (needed for 4:2:2 video). 16 is best when
  4908. encoding to most video codecs.
  4909. @item reset_count, reset
  4910. Set the counter that determines after how many frames cropdetect will
  4911. reset the previously detected largest video area and start over to
  4912. detect the current optimal crop area. Default value is 0.
  4913. This can be useful when channel logos distort the video area. 0
  4914. indicates 'never reset', and returns the largest area encountered during
  4915. playback.
  4916. @end table
  4917. @anchor{curves}
  4918. @section curves
  4919. Apply color adjustments using curves.
  4920. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  4921. component (red, green and blue) has its values defined by @var{N} key points
  4922. tied from each other using a smooth curve. The x-axis represents the pixel
  4923. values from the input frame, and the y-axis the new pixel values to be set for
  4924. the output frame.
  4925. By default, a component curve is defined by the two points @var{(0;0)} and
  4926. @var{(1;1)}. This creates a straight line where each original pixel value is
  4927. "adjusted" to its own value, which means no change to the image.
  4928. The filter allows you to redefine these two points and add some more. A new
  4929. curve (using a natural cubic spline interpolation) will be define to pass
  4930. smoothly through all these new coordinates. The new defined points needs to be
  4931. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  4932. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  4933. the vector spaces, the values will be clipped accordingly.
  4934. The filter accepts the following options:
  4935. @table @option
  4936. @item preset
  4937. Select one of the available color presets. This option can be used in addition
  4938. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  4939. options takes priority on the preset values.
  4940. Available presets are:
  4941. @table @samp
  4942. @item none
  4943. @item color_negative
  4944. @item cross_process
  4945. @item darker
  4946. @item increase_contrast
  4947. @item lighter
  4948. @item linear_contrast
  4949. @item medium_contrast
  4950. @item negative
  4951. @item strong_contrast
  4952. @item vintage
  4953. @end table
  4954. Default is @code{none}.
  4955. @item master, m
  4956. Set the master key points. These points will define a second pass mapping. It
  4957. is sometimes called a "luminance" or "value" mapping. It can be used with
  4958. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  4959. post-processing LUT.
  4960. @item red, r
  4961. Set the key points for the red component.
  4962. @item green, g
  4963. Set the key points for the green component.
  4964. @item blue, b
  4965. Set the key points for the blue component.
  4966. @item all
  4967. Set the key points for all components (not including master).
  4968. Can be used in addition to the other key points component
  4969. options. In this case, the unset component(s) will fallback on this
  4970. @option{all} setting.
  4971. @item psfile
  4972. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  4973. @item plot
  4974. Save Gnuplot script of the curves in specified file.
  4975. @end table
  4976. To avoid some filtergraph syntax conflicts, each key points list need to be
  4977. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  4978. @subsection Examples
  4979. @itemize
  4980. @item
  4981. Increase slightly the middle level of blue:
  4982. @example
  4983. curves=blue='0/0 0.5/0.58 1/1'
  4984. @end example
  4985. @item
  4986. Vintage effect:
  4987. @example
  4988. curves=r='0/0.11 .42/.51 1/0.95':g='0/0 0.50/0.48 1/1':b='0/0.22 .49/.44 1/0.8'
  4989. @end example
  4990. Here we obtain the following coordinates for each components:
  4991. @table @var
  4992. @item red
  4993. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  4994. @item green
  4995. @code{(0;0) (0.50;0.48) (1;1)}
  4996. @item blue
  4997. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  4998. @end table
  4999. @item
  5000. The previous example can also be achieved with the associated built-in preset:
  5001. @example
  5002. curves=preset=vintage
  5003. @end example
  5004. @item
  5005. Or simply:
  5006. @example
  5007. curves=vintage
  5008. @end example
  5009. @item
  5010. Use a Photoshop preset and redefine the points of the green component:
  5011. @example
  5012. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  5013. @end example
  5014. @item
  5015. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  5016. and @command{gnuplot}:
  5017. @example
  5018. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  5019. gnuplot -p /tmp/curves.plt
  5020. @end example
  5021. @end itemize
  5022. @section datascope
  5023. Video data analysis filter.
  5024. This filter shows hexadecimal pixel values of part of video.
  5025. The filter accepts the following options:
  5026. @table @option
  5027. @item size, s
  5028. Set output video size.
  5029. @item x
  5030. Set x offset from where to pick pixels.
  5031. @item y
  5032. Set y offset from where to pick pixels.
  5033. @item mode
  5034. Set scope mode, can be one of the following:
  5035. @table @samp
  5036. @item mono
  5037. Draw hexadecimal pixel values with white color on black background.
  5038. @item color
  5039. Draw hexadecimal pixel values with input video pixel color on black
  5040. background.
  5041. @item color2
  5042. Draw hexadecimal pixel values on color background picked from input video,
  5043. the text color is picked in such way so its always visible.
  5044. @end table
  5045. @item axis
  5046. Draw rows and columns numbers on left and top of video.
  5047. @item opacity
  5048. Set background opacity.
  5049. @end table
  5050. @section dctdnoiz
  5051. Denoise frames using 2D DCT (frequency domain filtering).
  5052. This filter is not designed for real time.
  5053. The filter accepts the following options:
  5054. @table @option
  5055. @item sigma, s
  5056. Set the noise sigma constant.
  5057. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  5058. coefficient (absolute value) below this threshold with be dropped.
  5059. If you need a more advanced filtering, see @option{expr}.
  5060. Default is @code{0}.
  5061. @item overlap
  5062. Set number overlapping pixels for each block. Since the filter can be slow, you
  5063. may want to reduce this value, at the cost of a less effective filter and the
  5064. risk of various artefacts.
  5065. If the overlapping value doesn't permit processing the whole input width or
  5066. height, a warning will be displayed and according borders won't be denoised.
  5067. Default value is @var{blocksize}-1, which is the best possible setting.
  5068. @item expr, e
  5069. Set the coefficient factor expression.
  5070. For each coefficient of a DCT block, this expression will be evaluated as a
  5071. multiplier value for the coefficient.
  5072. If this is option is set, the @option{sigma} option will be ignored.
  5073. The absolute value of the coefficient can be accessed through the @var{c}
  5074. variable.
  5075. @item n
  5076. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  5077. @var{blocksize}, which is the width and height of the processed blocks.
  5078. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  5079. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5080. on the speed processing. Also, a larger block size does not necessarily means a
  5081. better de-noising.
  5082. @end table
  5083. @subsection Examples
  5084. Apply a denoise with a @option{sigma} of @code{4.5}:
  5085. @example
  5086. dctdnoiz=4.5
  5087. @end example
  5088. The same operation can be achieved using the expression system:
  5089. @example
  5090. dctdnoiz=e='gte(c, 4.5*3)'
  5091. @end example
  5092. Violent denoise using a block size of @code{16x16}:
  5093. @example
  5094. dctdnoiz=15:n=4
  5095. @end example
  5096. @section deband
  5097. Remove banding artifacts from input video.
  5098. It works by replacing banded pixels with average value of referenced pixels.
  5099. The filter accepts the following options:
  5100. @table @option
  5101. @item 1thr
  5102. @item 2thr
  5103. @item 3thr
  5104. @item 4thr
  5105. Set banding detection threshold for each plane. Default is 0.02.
  5106. Valid range is 0.00003 to 0.5.
  5107. If difference between current pixel and reference pixel is less than threshold,
  5108. it will be considered as banded.
  5109. @item range, r
  5110. Banding detection range in pixels. Default is 16. If positive, random number
  5111. in range 0 to set value will be used. If negative, exact absolute value
  5112. will be used.
  5113. The range defines square of four pixels around current pixel.
  5114. @item direction, d
  5115. Set direction in radians from which four pixel will be compared. If positive,
  5116. random direction from 0 to set direction will be picked. If negative, exact of
  5117. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5118. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5119. column.
  5120. @item blur, b
  5121. If enabled, current pixel is compared with average value of all four
  5122. surrounding pixels. The default is enabled. If disabled current pixel is
  5123. compared with all four surrounding pixels. The pixel is considered banded
  5124. if only all four differences with surrounding pixels are less than threshold.
  5125. @item coupling, c
  5126. If enabled, current pixel is changed if and only if all pixel components are banded,
  5127. e.g. banding detection threshold is triggered for all color components.
  5128. The default is disabled.
  5129. @end table
  5130. @anchor{decimate}
  5131. @section decimate
  5132. Drop duplicated frames at regular intervals.
  5133. The filter accepts the following options:
  5134. @table @option
  5135. @item cycle
  5136. Set the number of frames from which one will be dropped. Setting this to
  5137. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  5138. Default is @code{5}.
  5139. @item dupthresh
  5140. Set the threshold for duplicate detection. If the difference metric for a frame
  5141. is less than or equal to this value, then it is declared as duplicate. Default
  5142. is @code{1.1}
  5143. @item scthresh
  5144. Set scene change threshold. Default is @code{15}.
  5145. @item blockx
  5146. @item blocky
  5147. Set the size of the x and y-axis blocks used during metric calculations.
  5148. Larger blocks give better noise suppression, but also give worse detection of
  5149. small movements. Must be a power of two. Default is @code{32}.
  5150. @item ppsrc
  5151. Mark main input as a pre-processed input and activate clean source input
  5152. stream. This allows the input to be pre-processed with various filters to help
  5153. the metrics calculation while keeping the frame selection lossless. When set to
  5154. @code{1}, the first stream is for the pre-processed input, and the second
  5155. stream is the clean source from where the kept frames are chosen. Default is
  5156. @code{0}.
  5157. @item chroma
  5158. Set whether or not chroma is considered in the metric calculations. Default is
  5159. @code{1}.
  5160. @end table
  5161. @section deflate
  5162. Apply deflate effect to the video.
  5163. This filter replaces the pixel by the local(3x3) average by taking into account
  5164. only values lower than the pixel.
  5165. It accepts the following options:
  5166. @table @option
  5167. @item threshold0
  5168. @item threshold1
  5169. @item threshold2
  5170. @item threshold3
  5171. Limit the maximum change for each plane, default is 65535.
  5172. If 0, plane will remain unchanged.
  5173. @end table
  5174. @section deflicker
  5175. Remove temporal frame luminance variations.
  5176. It accepts the following options:
  5177. @table @option
  5178. @item size, s
  5179. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  5180. @item mode, m
  5181. Set averaging mode to smooth temporal luminance variations.
  5182. Available values are:
  5183. @table @samp
  5184. @item am
  5185. Arithmetic mean
  5186. @item gm
  5187. Geometric mean
  5188. @item hm
  5189. Harmonic mean
  5190. @item qm
  5191. Quadratic mean
  5192. @item cm
  5193. Cubic mean
  5194. @item pm
  5195. Power mean
  5196. @item median
  5197. Median
  5198. @end table
  5199. @item bypass
  5200. Do not actually modify frame. Useful when one only wants metadata.
  5201. @end table
  5202. @section dejudder
  5203. Remove judder produced by partially interlaced telecined content.
  5204. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  5205. source was partially telecined content then the output of @code{pullup,dejudder}
  5206. will have a variable frame rate. May change the recorded frame rate of the
  5207. container. Aside from that change, this filter will not affect constant frame
  5208. rate video.
  5209. The option available in this filter is:
  5210. @table @option
  5211. @item cycle
  5212. Specify the length of the window over which the judder repeats.
  5213. Accepts any integer greater than 1. Useful values are:
  5214. @table @samp
  5215. @item 4
  5216. If the original was telecined from 24 to 30 fps (Film to NTSC).
  5217. @item 5
  5218. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  5219. @item 20
  5220. If a mixture of the two.
  5221. @end table
  5222. The default is @samp{4}.
  5223. @end table
  5224. @section delogo
  5225. Suppress a TV station logo by a simple interpolation of the surrounding
  5226. pixels. Just set a rectangle covering the logo and watch it disappear
  5227. (and sometimes something even uglier appear - your mileage may vary).
  5228. It accepts the following parameters:
  5229. @table @option
  5230. @item x
  5231. @item y
  5232. Specify the top left corner coordinates of the logo. They must be
  5233. specified.
  5234. @item w
  5235. @item h
  5236. Specify the width and height of the logo to clear. They must be
  5237. specified.
  5238. @item band, t
  5239. Specify the thickness of the fuzzy edge of the rectangle (added to
  5240. @var{w} and @var{h}). The default value is 1. This option is
  5241. deprecated, setting higher values should no longer be necessary and
  5242. is not recommended.
  5243. @item show
  5244. When set to 1, a green rectangle is drawn on the screen to simplify
  5245. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  5246. The default value is 0.
  5247. The rectangle is drawn on the outermost pixels which will be (partly)
  5248. replaced with interpolated values. The values of the next pixels
  5249. immediately outside this rectangle in each direction will be used to
  5250. compute the interpolated pixel values inside the rectangle.
  5251. @end table
  5252. @subsection Examples
  5253. @itemize
  5254. @item
  5255. Set a rectangle covering the area with top left corner coordinates 0,0
  5256. and size 100x77, and a band of size 10:
  5257. @example
  5258. delogo=x=0:y=0:w=100:h=77:band=10
  5259. @end example
  5260. @end itemize
  5261. @section deshake
  5262. Attempt to fix small changes in horizontal and/or vertical shift. This
  5263. filter helps remove camera shake from hand-holding a camera, bumping a
  5264. tripod, moving on a vehicle, etc.
  5265. The filter accepts the following options:
  5266. @table @option
  5267. @item x
  5268. @item y
  5269. @item w
  5270. @item h
  5271. Specify a rectangular area where to limit the search for motion
  5272. vectors.
  5273. If desired the search for motion vectors can be limited to a
  5274. rectangular area of the frame defined by its top left corner, width
  5275. and height. These parameters have the same meaning as the drawbox
  5276. filter which can be used to visualise the position of the bounding
  5277. box.
  5278. This is useful when simultaneous movement of subjects within the frame
  5279. might be confused for camera motion by the motion vector search.
  5280. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  5281. then the full frame is used. This allows later options to be set
  5282. without specifying the bounding box for the motion vector search.
  5283. Default - search the whole frame.
  5284. @item rx
  5285. @item ry
  5286. Specify the maximum extent of movement in x and y directions in the
  5287. range 0-64 pixels. Default 16.
  5288. @item edge
  5289. Specify how to generate pixels to fill blanks at the edge of the
  5290. frame. Available values are:
  5291. @table @samp
  5292. @item blank, 0
  5293. Fill zeroes at blank locations
  5294. @item original, 1
  5295. Original image at blank locations
  5296. @item clamp, 2
  5297. Extruded edge value at blank locations
  5298. @item mirror, 3
  5299. Mirrored edge at blank locations
  5300. @end table
  5301. Default value is @samp{mirror}.
  5302. @item blocksize
  5303. Specify the blocksize to use for motion search. Range 4-128 pixels,
  5304. default 8.
  5305. @item contrast
  5306. Specify the contrast threshold for blocks. Only blocks with more than
  5307. the specified contrast (difference between darkest and lightest
  5308. pixels) will be considered. Range 1-255, default 125.
  5309. @item search
  5310. Specify the search strategy. Available values are:
  5311. @table @samp
  5312. @item exhaustive, 0
  5313. Set exhaustive search
  5314. @item less, 1
  5315. Set less exhaustive search.
  5316. @end table
  5317. Default value is @samp{exhaustive}.
  5318. @item filename
  5319. If set then a detailed log of the motion search is written to the
  5320. specified file.
  5321. @item opencl
  5322. If set to 1, specify using OpenCL capabilities, only available if
  5323. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  5324. @end table
  5325. @section despill
  5326. Remove unwanted contamination of foreground colors, caused by reflected color of
  5327. greenscreen or bluescreen.
  5328. This filter accepts the following options:
  5329. @table @option
  5330. @item type
  5331. Set what type of despill to use.
  5332. @item mix
  5333. Set how spillmap will be generated.
  5334. @item expand
  5335. Set how much to get rid of still remaining spill.
  5336. @item red
  5337. Controls amount of red in spill area.
  5338. @item green
  5339. Controls amount of green in spill area.
  5340. Should be -1 for greenscreen.
  5341. @item blue
  5342. Controls amount of blue in spill area.
  5343. Should be -1 for bluescreen.
  5344. @item brightness
  5345. Controls brightness of spill area, preserving colors.
  5346. @item alpha
  5347. Modify alpha from generated spillmap.
  5348. @end table
  5349. @section detelecine
  5350. Apply an exact inverse of the telecine operation. It requires a predefined
  5351. pattern specified using the pattern option which must be the same as that passed
  5352. to the telecine filter.
  5353. This filter accepts the following options:
  5354. @table @option
  5355. @item first_field
  5356. @table @samp
  5357. @item top, t
  5358. top field first
  5359. @item bottom, b
  5360. bottom field first
  5361. The default value is @code{top}.
  5362. @end table
  5363. @item pattern
  5364. A string of numbers representing the pulldown pattern you wish to apply.
  5365. The default value is @code{23}.
  5366. @item start_frame
  5367. A number representing position of the first frame with respect to the telecine
  5368. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  5369. @end table
  5370. @section dilation
  5371. Apply dilation effect to the video.
  5372. This filter replaces the pixel by the local(3x3) maximum.
  5373. It accepts the following options:
  5374. @table @option
  5375. @item threshold0
  5376. @item threshold1
  5377. @item threshold2
  5378. @item threshold3
  5379. Limit the maximum change for each plane, default is 65535.
  5380. If 0, plane will remain unchanged.
  5381. @item coordinates
  5382. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5383. pixels are used.
  5384. Flags to local 3x3 coordinates maps like this:
  5385. 1 2 3
  5386. 4 5
  5387. 6 7 8
  5388. @end table
  5389. @section displace
  5390. Displace pixels as indicated by second and third input stream.
  5391. It takes three input streams and outputs one stream, the first input is the
  5392. source, and second and third input are displacement maps.
  5393. The second input specifies how much to displace pixels along the
  5394. x-axis, while the third input specifies how much to displace pixels
  5395. along the y-axis.
  5396. If one of displacement map streams terminates, last frame from that
  5397. displacement map will be used.
  5398. Note that once generated, displacements maps can be reused over and over again.
  5399. A description of the accepted options follows.
  5400. @table @option
  5401. @item edge
  5402. Set displace behavior for pixels that are out of range.
  5403. Available values are:
  5404. @table @samp
  5405. @item blank
  5406. Missing pixels are replaced by black pixels.
  5407. @item smear
  5408. Adjacent pixels will spread out to replace missing pixels.
  5409. @item wrap
  5410. Out of range pixels are wrapped so they point to pixels of other side.
  5411. @item mirror
  5412. Out of range pixels will be replaced with mirrored pixels.
  5413. @end table
  5414. Default is @samp{smear}.
  5415. @end table
  5416. @subsection Examples
  5417. @itemize
  5418. @item
  5419. Add ripple effect to rgb input of video size hd720:
  5420. @example
  5421. ffmpeg -i INPUT -f lavfi -i nullsrc=s=hd720,lutrgb=128:128:128 -f lavfi -i nullsrc=s=hd720,geq='r=128+30*sin(2*PI*X/400+T):g=128+30*sin(2*PI*X/400+T):b=128+30*sin(2*PI*X/400+T)' -lavfi '[0][1][2]displace' OUTPUT
  5422. @end example
  5423. @item
  5424. Add wave effect to rgb input of video size hd720:
  5425. @example
  5426. ffmpeg -i INPUT -f lavfi -i nullsrc=hd720,geq='r=128+80*(sin(sqrt((X-W/2)*(X-W/2)+(Y-H/2)*(Y-H/2))/220*2*PI+T)):g=128+80*(sin(sqrt((X-W/2)*(X-W/2)+(Y-H/2)*(Y-H/2))/220*2*PI+T)):b=128+80*(sin(sqrt((X-W/2)*(X-W/2)+(Y-H/2)*(Y-H/2))/220*2*PI+T))' -lavfi '[1]split[x][y],[0][x][y]displace' OUTPUT
  5427. @end example
  5428. @end itemize
  5429. @section drawbox
  5430. Draw a colored box on the input image.
  5431. It accepts the following parameters:
  5432. @table @option
  5433. @item x
  5434. @item y
  5435. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5436. @item width, w
  5437. @item height, h
  5438. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5439. the input width and height. It defaults to 0.
  5440. @item color, c
  5441. Specify the color of the box to write. For the general syntax of this option,
  5442. check the "Color" section in the ffmpeg-utils manual. If the special
  5443. value @code{invert} is used, the box edge color is the same as the
  5444. video with inverted luma.
  5445. @item thickness, t
  5446. The expression which sets the thickness of the box edge. Default value is @code{3}.
  5447. See below for the list of accepted constants.
  5448. @end table
  5449. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5450. following constants:
  5451. @table @option
  5452. @item dar
  5453. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5454. @item hsub
  5455. @item vsub
  5456. horizontal and vertical chroma subsample values. For example for the
  5457. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5458. @item in_h, ih
  5459. @item in_w, iw
  5460. The input width and height.
  5461. @item sar
  5462. The input sample aspect ratio.
  5463. @item x
  5464. @item y
  5465. The x and y offset coordinates where the box is drawn.
  5466. @item w
  5467. @item h
  5468. The width and height of the drawn box.
  5469. @item t
  5470. The thickness of the drawn box.
  5471. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5472. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5473. @end table
  5474. @subsection Examples
  5475. @itemize
  5476. @item
  5477. Draw a black box around the edge of the input image:
  5478. @example
  5479. drawbox
  5480. @end example
  5481. @item
  5482. Draw a box with color red and an opacity of 50%:
  5483. @example
  5484. drawbox=10:20:200:60:red@@0.5
  5485. @end example
  5486. The previous example can be specified as:
  5487. @example
  5488. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5489. @end example
  5490. @item
  5491. Fill the box with pink color:
  5492. @example
  5493. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  5494. @end example
  5495. @item
  5496. Draw a 2-pixel red 2.40:1 mask:
  5497. @example
  5498. drawbox=x=-t:y=0.5*(ih-iw/2.4)-t:w=iw+t*2:h=iw/2.4+t*2:t=2:c=red
  5499. @end example
  5500. @end itemize
  5501. @section drawgrid
  5502. Draw a grid on the input image.
  5503. It accepts the following parameters:
  5504. @table @option
  5505. @item x
  5506. @item y
  5507. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5508. @item width, w
  5509. @item height, h
  5510. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5511. input width and height, respectively, minus @code{thickness}, so image gets
  5512. framed. Default to 0.
  5513. @item color, c
  5514. Specify the color of the grid. For the general syntax of this option,
  5515. check the "Color" section in the ffmpeg-utils manual. If the special
  5516. value @code{invert} is used, the grid color is the same as the
  5517. video with inverted luma.
  5518. @item thickness, t
  5519. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5520. See below for the list of accepted constants.
  5521. @end table
  5522. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5523. following constants:
  5524. @table @option
  5525. @item dar
  5526. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5527. @item hsub
  5528. @item vsub
  5529. horizontal and vertical chroma subsample values. For example for the
  5530. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5531. @item in_h, ih
  5532. @item in_w, iw
  5533. The input grid cell width and height.
  5534. @item sar
  5535. The input sample aspect ratio.
  5536. @item x
  5537. @item y
  5538. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5539. @item w
  5540. @item h
  5541. The width and height of the drawn cell.
  5542. @item t
  5543. The thickness of the drawn cell.
  5544. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5545. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5546. @end table
  5547. @subsection Examples
  5548. @itemize
  5549. @item
  5550. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5551. @example
  5552. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5553. @end example
  5554. @item
  5555. Draw a white 3x3 grid with an opacity of 50%:
  5556. @example
  5557. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5558. @end example
  5559. @end itemize
  5560. @anchor{drawtext}
  5561. @section drawtext
  5562. Draw a text string or text from a specified file on top of a video, using the
  5563. libfreetype library.
  5564. To enable compilation of this filter, you need to configure FFmpeg with
  5565. @code{--enable-libfreetype}.
  5566. To enable default font fallback and the @var{font} option you need to
  5567. configure FFmpeg with @code{--enable-libfontconfig}.
  5568. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5569. @code{--enable-libfribidi}.
  5570. @subsection Syntax
  5571. It accepts the following parameters:
  5572. @table @option
  5573. @item box
  5574. Used to draw a box around text using the background color.
  5575. The value must be either 1 (enable) or 0 (disable).
  5576. The default value of @var{box} is 0.
  5577. @item boxborderw
  5578. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5579. The default value of @var{boxborderw} is 0.
  5580. @item boxcolor
  5581. The color to be used for drawing box around text. For the syntax of this
  5582. option, check the "Color" section in the ffmpeg-utils manual.
  5583. The default value of @var{boxcolor} is "white".
  5584. @item line_spacing
  5585. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  5586. The default value of @var{line_spacing} is 0.
  5587. @item borderw
  5588. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5589. The default value of @var{borderw} is 0.
  5590. @item bordercolor
  5591. Set the color to be used for drawing border around text. For the syntax of this
  5592. option, check the "Color" section in the ffmpeg-utils manual.
  5593. The default value of @var{bordercolor} is "black".
  5594. @item expansion
  5595. Select how the @var{text} is expanded. Can be either @code{none},
  5596. @code{strftime} (deprecated) or
  5597. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5598. below for details.
  5599. @item basetime
  5600. Set a start time for the count. Value is in microseconds. Only applied
  5601. in the deprecated strftime expansion mode. To emulate in normal expansion
  5602. mode use the @code{pts} function, supplying the start time (in seconds)
  5603. as the second argument.
  5604. @item fix_bounds
  5605. If true, check and fix text coords to avoid clipping.
  5606. @item fontcolor
  5607. The color to be used for drawing fonts. For the syntax of this option, check
  5608. the "Color" section in the ffmpeg-utils manual.
  5609. The default value of @var{fontcolor} is "black".
  5610. @item fontcolor_expr
  5611. String which is expanded the same way as @var{text} to obtain dynamic
  5612. @var{fontcolor} value. By default this option has empty value and is not
  5613. processed. When this option is set, it overrides @var{fontcolor} option.
  5614. @item font
  5615. The font family to be used for drawing text. By default Sans.
  5616. @item fontfile
  5617. The font file to be used for drawing text. The path must be included.
  5618. This parameter is mandatory if the fontconfig support is disabled.
  5619. @item alpha
  5620. Draw the text applying alpha blending. The value can
  5621. be a number between 0.0 and 1.0.
  5622. The expression accepts the same variables @var{x, y} as well.
  5623. The default value is 1.
  5624. Please see @var{fontcolor_expr}.
  5625. @item fontsize
  5626. The font size to be used for drawing text.
  5627. The default value of @var{fontsize} is 16.
  5628. @item text_shaping
  5629. If set to 1, attempt to shape the text (for example, reverse the order of
  5630. right-to-left text and join Arabic characters) before drawing it.
  5631. Otherwise, just draw the text exactly as given.
  5632. By default 1 (if supported).
  5633. @item ft_load_flags
  5634. The flags to be used for loading the fonts.
  5635. The flags map the corresponding flags supported by libfreetype, and are
  5636. a combination of the following values:
  5637. @table @var
  5638. @item default
  5639. @item no_scale
  5640. @item no_hinting
  5641. @item render
  5642. @item no_bitmap
  5643. @item vertical_layout
  5644. @item force_autohint
  5645. @item crop_bitmap
  5646. @item pedantic
  5647. @item ignore_global_advance_width
  5648. @item no_recurse
  5649. @item ignore_transform
  5650. @item monochrome
  5651. @item linear_design
  5652. @item no_autohint
  5653. @end table
  5654. Default value is "default".
  5655. For more information consult the documentation for the FT_LOAD_*
  5656. libfreetype flags.
  5657. @item shadowcolor
  5658. The color to be used for drawing a shadow behind the drawn text. For the
  5659. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  5660. The default value of @var{shadowcolor} is "black".
  5661. @item shadowx
  5662. @item shadowy
  5663. The x and y offsets for the text shadow position with respect to the
  5664. position of the text. They can be either positive or negative
  5665. values. The default value for both is "0".
  5666. @item start_number
  5667. The starting frame number for the n/frame_num variable. The default value
  5668. is "0".
  5669. @item tabsize
  5670. The size in number of spaces to use for rendering the tab.
  5671. Default value is 4.
  5672. @item timecode
  5673. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5674. format. It can be used with or without text parameter. @var{timecode_rate}
  5675. option must be specified.
  5676. @item timecode_rate, rate, r
  5677. Set the timecode frame rate (timecode only).
  5678. @item tc24hmax
  5679. If set to 1, the output of the timecode option will wrap around at 24 hours.
  5680. Default is 0 (disabled).
  5681. @item text
  5682. The text string to be drawn. The text must be a sequence of UTF-8
  5683. encoded characters.
  5684. This parameter is mandatory if no file is specified with the parameter
  5685. @var{textfile}.
  5686. @item textfile
  5687. A text file containing text to be drawn. The text must be a sequence
  5688. of UTF-8 encoded characters.
  5689. This parameter is mandatory if no text string is specified with the
  5690. parameter @var{text}.
  5691. If both @var{text} and @var{textfile} are specified, an error is thrown.
  5692. @item reload
  5693. If set to 1, the @var{textfile} will be reloaded before each frame.
  5694. Be sure to update it atomically, or it may be read partially, or even fail.
  5695. @item x
  5696. @item y
  5697. The expressions which specify the offsets where text will be drawn
  5698. within the video frame. They are relative to the top/left border of the
  5699. output image.
  5700. The default value of @var{x} and @var{y} is "0".
  5701. See below for the list of accepted constants and functions.
  5702. @end table
  5703. The parameters for @var{x} and @var{y} are expressions containing the
  5704. following constants and functions:
  5705. @table @option
  5706. @item dar
  5707. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  5708. @item hsub
  5709. @item vsub
  5710. horizontal and vertical chroma subsample values. For example for the
  5711. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5712. @item line_h, lh
  5713. the height of each text line
  5714. @item main_h, h, H
  5715. the input height
  5716. @item main_w, w, W
  5717. the input width
  5718. @item max_glyph_a, ascent
  5719. the maximum distance from the baseline to the highest/upper grid
  5720. coordinate used to place a glyph outline point, for all the rendered
  5721. glyphs.
  5722. It is a positive value, due to the grid's orientation with the Y axis
  5723. upwards.
  5724. @item max_glyph_d, descent
  5725. the maximum distance from the baseline to the lowest grid coordinate
  5726. used to place a glyph outline point, for all the rendered glyphs.
  5727. This is a negative value, due to the grid's orientation, with the Y axis
  5728. upwards.
  5729. @item max_glyph_h
  5730. maximum glyph height, that is the maximum height for all the glyphs
  5731. contained in the rendered text, it is equivalent to @var{ascent} -
  5732. @var{descent}.
  5733. @item max_glyph_w
  5734. maximum glyph width, that is the maximum width for all the glyphs
  5735. contained in the rendered text
  5736. @item n
  5737. the number of input frame, starting from 0
  5738. @item rand(min, max)
  5739. return a random number included between @var{min} and @var{max}
  5740. @item sar
  5741. The input sample aspect ratio.
  5742. @item t
  5743. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5744. @item text_h, th
  5745. the height of the rendered text
  5746. @item text_w, tw
  5747. the width of the rendered text
  5748. @item x
  5749. @item y
  5750. the x and y offset coordinates where the text is drawn.
  5751. These parameters allow the @var{x} and @var{y} expressions to refer
  5752. each other, so you can for example specify @code{y=x/dar}.
  5753. @end table
  5754. @anchor{drawtext_expansion}
  5755. @subsection Text expansion
  5756. If @option{expansion} is set to @code{strftime},
  5757. the filter recognizes strftime() sequences in the provided text and
  5758. expands them accordingly. Check the documentation of strftime(). This
  5759. feature is deprecated.
  5760. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  5761. If @option{expansion} is set to @code{normal} (which is the default),
  5762. the following expansion mechanism is used.
  5763. The backslash character @samp{\}, followed by any character, always expands to
  5764. the second character.
  5765. Sequences of the form @code{%@{...@}} are expanded. The text between the
  5766. braces is a function name, possibly followed by arguments separated by ':'.
  5767. If the arguments contain special characters or delimiters (':' or '@}'),
  5768. they should be escaped.
  5769. Note that they probably must also be escaped as the value for the
  5770. @option{text} option in the filter argument string and as the filter
  5771. argument in the filtergraph description, and possibly also for the shell,
  5772. that makes up to four levels of escaping; using a text file avoids these
  5773. problems.
  5774. The following functions are available:
  5775. @table @command
  5776. @item expr, e
  5777. The expression evaluation result.
  5778. It must take one argument specifying the expression to be evaluated,
  5779. which accepts the same constants and functions as the @var{x} and
  5780. @var{y} values. Note that not all constants should be used, for
  5781. example the text size is not known when evaluating the expression, so
  5782. the constants @var{text_w} and @var{text_h} will have an undefined
  5783. value.
  5784. @item expr_int_format, eif
  5785. Evaluate the expression's value and output as formatted integer.
  5786. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  5787. The second argument specifies the output format. Allowed values are @samp{x},
  5788. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  5789. @code{printf} function.
  5790. The third parameter is optional and sets the number of positions taken by the output.
  5791. It can be used to add padding with zeros from the left.
  5792. @item gmtime
  5793. The time at which the filter is running, expressed in UTC.
  5794. It can accept an argument: a strftime() format string.
  5795. @item localtime
  5796. The time at which the filter is running, expressed in the local time zone.
  5797. It can accept an argument: a strftime() format string.
  5798. @item metadata
  5799. Frame metadata. Takes one or two arguments.
  5800. The first argument is mandatory and specifies the metadata key.
  5801. The second argument is optional and specifies a default value, used when the
  5802. metadata key is not found or empty.
  5803. @item n, frame_num
  5804. The frame number, starting from 0.
  5805. @item pict_type
  5806. A 1 character description of the current picture type.
  5807. @item pts
  5808. The timestamp of the current frame.
  5809. It can take up to three arguments.
  5810. The first argument is the format of the timestamp; it defaults to @code{flt}
  5811. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  5812. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  5813. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  5814. @code{localtime} stands for the timestamp of the frame formatted as
  5815. local time zone time.
  5816. The second argument is an offset added to the timestamp.
  5817. If the format is set to @code{localtime} or @code{gmtime},
  5818. a third argument may be supplied: a strftime() format string.
  5819. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  5820. @end table
  5821. @subsection Examples
  5822. @itemize
  5823. @item
  5824. Draw "Test Text" with font FreeSerif, using the default values for the
  5825. optional parameters.
  5826. @example
  5827. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  5828. @end example
  5829. @item
  5830. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  5831. and y=50 (counting from the top-left corner of the screen), text is
  5832. yellow with a red box around it. Both the text and the box have an
  5833. opacity of 20%.
  5834. @example
  5835. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  5836. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  5837. @end example
  5838. Note that the double quotes are not necessary if spaces are not used
  5839. within the parameter list.
  5840. @item
  5841. Show the text at the center of the video frame:
  5842. @example
  5843. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  5844. @end example
  5845. @item
  5846. Show the text at a random position, switching to a new position every 30 seconds:
  5847. @example
  5848. 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)"
  5849. @end example
  5850. @item
  5851. Show a text line sliding from right to left in the last row of the video
  5852. frame. The file @file{LONG_LINE} is assumed to contain a single line
  5853. with no newlines.
  5854. @example
  5855. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  5856. @end example
  5857. @item
  5858. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  5859. @example
  5860. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  5861. @end example
  5862. @item
  5863. Draw a single green letter "g", at the center of the input video.
  5864. The glyph baseline is placed at half screen height.
  5865. @example
  5866. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  5867. @end example
  5868. @item
  5869. Show text for 1 second every 3 seconds:
  5870. @example
  5871. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  5872. @end example
  5873. @item
  5874. Use fontconfig to set the font. Note that the colons need to be escaped.
  5875. @example
  5876. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  5877. @end example
  5878. @item
  5879. Print the date of a real-time encoding (see strftime(3)):
  5880. @example
  5881. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  5882. @end example
  5883. @item
  5884. Show text fading in and out (appearing/disappearing):
  5885. @example
  5886. #!/bin/sh
  5887. DS=1.0 # display start
  5888. DE=10.0 # display end
  5889. FID=1.5 # fade in duration
  5890. FOD=5 # fade out duration
  5891. 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 @}"
  5892. @end example
  5893. @item
  5894. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  5895. and the @option{fontsize} value are included in the @option{y} offset.
  5896. @example
  5897. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  5898. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  5899. @end example
  5900. @end itemize
  5901. For more information about libfreetype, check:
  5902. @url{http://www.freetype.org/}.
  5903. For more information about fontconfig, check:
  5904. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  5905. For more information about libfribidi, check:
  5906. @url{http://fribidi.org/}.
  5907. @section edgedetect
  5908. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  5909. The filter accepts the following options:
  5910. @table @option
  5911. @item low
  5912. @item high
  5913. Set low and high threshold values used by the Canny thresholding
  5914. algorithm.
  5915. The high threshold selects the "strong" edge pixels, which are then
  5916. connected through 8-connectivity with the "weak" edge pixels selected
  5917. by the low threshold.
  5918. @var{low} and @var{high} threshold values must be chosen in the range
  5919. [0,1], and @var{low} should be lesser or equal to @var{high}.
  5920. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  5921. is @code{50/255}.
  5922. @item mode
  5923. Define the drawing mode.
  5924. @table @samp
  5925. @item wires
  5926. Draw white/gray wires on black background.
  5927. @item colormix
  5928. Mix the colors to create a paint/cartoon effect.
  5929. @end table
  5930. Default value is @var{wires}.
  5931. @end table
  5932. @subsection Examples
  5933. @itemize
  5934. @item
  5935. Standard edge detection with custom values for the hysteresis thresholding:
  5936. @example
  5937. edgedetect=low=0.1:high=0.4
  5938. @end example
  5939. @item
  5940. Painting effect without thresholding:
  5941. @example
  5942. edgedetect=mode=colormix:high=0
  5943. @end example
  5944. @end itemize
  5945. @section eq
  5946. Set brightness, contrast, saturation and approximate gamma adjustment.
  5947. The filter accepts the following options:
  5948. @table @option
  5949. @item contrast
  5950. Set the contrast expression. The value must be a float value in range
  5951. @code{-2.0} to @code{2.0}. The default value is "1".
  5952. @item brightness
  5953. Set the brightness expression. The value must be a float value in
  5954. range @code{-1.0} to @code{1.0}. The default value is "0".
  5955. @item saturation
  5956. Set the saturation expression. The value must be a float in
  5957. range @code{0.0} to @code{3.0}. The default value is "1".
  5958. @item gamma
  5959. Set the gamma expression. The value must be a float in range
  5960. @code{0.1} to @code{10.0}. The default value is "1".
  5961. @item gamma_r
  5962. Set the gamma expression for red. The value must be a float in
  5963. range @code{0.1} to @code{10.0}. The default value is "1".
  5964. @item gamma_g
  5965. Set the gamma expression for green. The value must be a float in range
  5966. @code{0.1} to @code{10.0}. The default value is "1".
  5967. @item gamma_b
  5968. Set the gamma expression for blue. The value must be a float in range
  5969. @code{0.1} to @code{10.0}. The default value is "1".
  5970. @item gamma_weight
  5971. Set the gamma weight expression. It can be used to reduce the effect
  5972. of a high gamma value on bright image areas, e.g. keep them from
  5973. getting overamplified and just plain white. The value must be a float
  5974. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  5975. gamma correction all the way down while @code{1.0} leaves it at its
  5976. full strength. Default is "1".
  5977. @item eval
  5978. Set when the expressions for brightness, contrast, saturation and
  5979. gamma expressions are evaluated.
  5980. It accepts the following values:
  5981. @table @samp
  5982. @item init
  5983. only evaluate expressions once during the filter initialization or
  5984. when a command is processed
  5985. @item frame
  5986. evaluate expressions for each incoming frame
  5987. @end table
  5988. Default value is @samp{init}.
  5989. @end table
  5990. The expressions accept the following parameters:
  5991. @table @option
  5992. @item n
  5993. frame count of the input frame starting from 0
  5994. @item pos
  5995. byte position of the corresponding packet in the input file, NAN if
  5996. unspecified
  5997. @item r
  5998. frame rate of the input video, NAN if the input frame rate is unknown
  5999. @item t
  6000. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6001. @end table
  6002. @subsection Commands
  6003. The filter supports the following commands:
  6004. @table @option
  6005. @item contrast
  6006. Set the contrast expression.
  6007. @item brightness
  6008. Set the brightness expression.
  6009. @item saturation
  6010. Set the saturation expression.
  6011. @item gamma
  6012. Set the gamma expression.
  6013. @item gamma_r
  6014. Set the gamma_r expression.
  6015. @item gamma_g
  6016. Set gamma_g expression.
  6017. @item gamma_b
  6018. Set gamma_b expression.
  6019. @item gamma_weight
  6020. Set gamma_weight expression.
  6021. The command accepts the same syntax of the corresponding option.
  6022. If the specified expression is not valid, it is kept at its current
  6023. value.
  6024. @end table
  6025. @section erosion
  6026. Apply erosion effect to the video.
  6027. This filter replaces the pixel by the local(3x3) minimum.
  6028. It accepts the following options:
  6029. @table @option
  6030. @item threshold0
  6031. @item threshold1
  6032. @item threshold2
  6033. @item threshold3
  6034. Limit the maximum change for each plane, default is 65535.
  6035. If 0, plane will remain unchanged.
  6036. @item coordinates
  6037. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6038. pixels are used.
  6039. Flags to local 3x3 coordinates maps like this:
  6040. 1 2 3
  6041. 4 5
  6042. 6 7 8
  6043. @end table
  6044. @section extractplanes
  6045. Extract color channel components from input video stream into
  6046. separate grayscale video streams.
  6047. The filter accepts the following option:
  6048. @table @option
  6049. @item planes
  6050. Set plane(s) to extract.
  6051. Available values for planes are:
  6052. @table @samp
  6053. @item y
  6054. @item u
  6055. @item v
  6056. @item a
  6057. @item r
  6058. @item g
  6059. @item b
  6060. @end table
  6061. Choosing planes not available in the input will result in an error.
  6062. That means you cannot select @code{r}, @code{g}, @code{b} planes
  6063. with @code{y}, @code{u}, @code{v} planes at same time.
  6064. @end table
  6065. @subsection Examples
  6066. @itemize
  6067. @item
  6068. Extract luma, u and v color channel component from input video frame
  6069. into 3 grayscale outputs:
  6070. @example
  6071. 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
  6072. @end example
  6073. @end itemize
  6074. @section elbg
  6075. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  6076. For each input image, the filter will compute the optimal mapping from
  6077. the input to the output given the codebook length, that is the number
  6078. of distinct output colors.
  6079. This filter accepts the following options.
  6080. @table @option
  6081. @item codebook_length, l
  6082. Set codebook length. The value must be a positive integer, and
  6083. represents the number of distinct output colors. Default value is 256.
  6084. @item nb_steps, n
  6085. Set the maximum number of iterations to apply for computing the optimal
  6086. mapping. The higher the value the better the result and the higher the
  6087. computation time. Default value is 1.
  6088. @item seed, s
  6089. Set a random seed, must be an integer included between 0 and
  6090. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  6091. will try to use a good random seed on a best effort basis.
  6092. @item pal8
  6093. Set pal8 output pixel format. This option does not work with codebook
  6094. length greater than 256.
  6095. @end table
  6096. @section fade
  6097. Apply a fade-in/out effect to the input video.
  6098. It accepts the following parameters:
  6099. @table @option
  6100. @item type, t
  6101. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  6102. effect.
  6103. Default is @code{in}.
  6104. @item start_frame, s
  6105. Specify the number of the frame to start applying the fade
  6106. effect at. Default is 0.
  6107. @item nb_frames, n
  6108. The number of frames that the fade effect lasts. At the end of the
  6109. fade-in effect, the output video will have the same intensity as the input video.
  6110. At the end of the fade-out transition, the output video will be filled with the
  6111. selected @option{color}.
  6112. Default is 25.
  6113. @item alpha
  6114. If set to 1, fade only alpha channel, if one exists on the input.
  6115. Default value is 0.
  6116. @item start_time, st
  6117. Specify the timestamp (in seconds) of the frame to start to apply the fade
  6118. effect. If both start_frame and start_time are specified, the fade will start at
  6119. whichever comes last. Default is 0.
  6120. @item duration, d
  6121. The number of seconds for which the fade effect has to last. At the end of the
  6122. fade-in effect the output video will have the same intensity as the input video,
  6123. at the end of the fade-out transition the output video will be filled with the
  6124. selected @option{color}.
  6125. If both duration and nb_frames are specified, duration is used. Default is 0
  6126. (nb_frames is used by default).
  6127. @item color, c
  6128. Specify the color of the fade. Default is "black".
  6129. @end table
  6130. @subsection Examples
  6131. @itemize
  6132. @item
  6133. Fade in the first 30 frames of video:
  6134. @example
  6135. fade=in:0:30
  6136. @end example
  6137. The command above is equivalent to:
  6138. @example
  6139. fade=t=in:s=0:n=30
  6140. @end example
  6141. @item
  6142. Fade out the last 45 frames of a 200-frame video:
  6143. @example
  6144. fade=out:155:45
  6145. fade=type=out:start_frame=155:nb_frames=45
  6146. @end example
  6147. @item
  6148. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  6149. @example
  6150. fade=in:0:25, fade=out:975:25
  6151. @end example
  6152. @item
  6153. Make the first 5 frames yellow, then fade in from frame 5-24:
  6154. @example
  6155. fade=in:5:20:color=yellow
  6156. @end example
  6157. @item
  6158. Fade in alpha over first 25 frames of video:
  6159. @example
  6160. fade=in:0:25:alpha=1
  6161. @end example
  6162. @item
  6163. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  6164. @example
  6165. fade=t=in:st=5.5:d=0.5
  6166. @end example
  6167. @end itemize
  6168. @section fftfilt
  6169. Apply arbitrary expressions to samples in frequency domain
  6170. @table @option
  6171. @item dc_Y
  6172. Adjust the dc value (gain) of the luma plane of the image. The filter
  6173. accepts an integer value in range @code{0} to @code{1000}. The default
  6174. value is set to @code{0}.
  6175. @item dc_U
  6176. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  6177. filter accepts an integer value in range @code{0} to @code{1000}. The
  6178. default value is set to @code{0}.
  6179. @item dc_V
  6180. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  6181. filter accepts an integer value in range @code{0} to @code{1000}. The
  6182. default value is set to @code{0}.
  6183. @item weight_Y
  6184. Set the frequency domain weight expression for the luma plane.
  6185. @item weight_U
  6186. Set the frequency domain weight expression for the 1st chroma plane.
  6187. @item weight_V
  6188. Set the frequency domain weight expression for the 2nd chroma plane.
  6189. @item eval
  6190. Set when the expressions are evaluated.
  6191. It accepts the following values:
  6192. @table @samp
  6193. @item init
  6194. Only evaluate expressions once during the filter initialization.
  6195. @item frame
  6196. Evaluate expressions for each incoming frame.
  6197. @end table
  6198. Default value is @samp{init}.
  6199. The filter accepts the following variables:
  6200. @item X
  6201. @item Y
  6202. The coordinates of the current sample.
  6203. @item W
  6204. @item H
  6205. The width and height of the image.
  6206. @item N
  6207. The number of input frame, starting from 0.
  6208. @end table
  6209. @subsection Examples
  6210. @itemize
  6211. @item
  6212. High-pass:
  6213. @example
  6214. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  6215. @end example
  6216. @item
  6217. Low-pass:
  6218. @example
  6219. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  6220. @end example
  6221. @item
  6222. Sharpen:
  6223. @example
  6224. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  6225. @end example
  6226. @item
  6227. Blur:
  6228. @example
  6229. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  6230. @end example
  6231. @end itemize
  6232. @section field
  6233. Extract a single field from an interlaced image using stride
  6234. arithmetic to avoid wasting CPU time. The output frames are marked as
  6235. non-interlaced.
  6236. The filter accepts the following options:
  6237. @table @option
  6238. @item type
  6239. Specify whether to extract the top (if the value is @code{0} or
  6240. @code{top}) or the bottom field (if the value is @code{1} or
  6241. @code{bottom}).
  6242. @end table
  6243. @section fieldhint
  6244. Create new frames by copying the top and bottom fields from surrounding frames
  6245. supplied as numbers by the hint file.
  6246. @table @option
  6247. @item hint
  6248. Set file containing hints: absolute/relative frame numbers.
  6249. There must be one line for each frame in a clip. Each line must contain two
  6250. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  6251. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  6252. is current frame number for @code{absolute} mode or out of [-1, 1] range
  6253. for @code{relative} mode. First number tells from which frame to pick up top
  6254. field and second number tells from which frame to pick up bottom field.
  6255. If optionally followed by @code{+} output frame will be marked as interlaced,
  6256. else if followed by @code{-} output frame will be marked as progressive, else
  6257. it will be marked same as input frame.
  6258. If line starts with @code{#} or @code{;} that line is skipped.
  6259. @item mode
  6260. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  6261. @end table
  6262. Example of first several lines of @code{hint} file for @code{relative} mode:
  6263. @example
  6264. 0,0 - # first frame
  6265. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  6266. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  6267. 1,0 -
  6268. 0,0 -
  6269. 0,0 -
  6270. 1,0 -
  6271. 1,0 -
  6272. 1,0 -
  6273. 0,0 -
  6274. 0,0 -
  6275. 1,0 -
  6276. 1,0 -
  6277. 1,0 -
  6278. 0,0 -
  6279. @end example
  6280. @section fieldmatch
  6281. Field matching filter for inverse telecine. It is meant to reconstruct the
  6282. progressive frames from a telecined stream. The filter does not drop duplicated
  6283. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  6284. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  6285. The separation of the field matching and the decimation is notably motivated by
  6286. the possibility of inserting a de-interlacing filter fallback between the two.
  6287. If the source has mixed telecined and real interlaced content,
  6288. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  6289. But these remaining combed frames will be marked as interlaced, and thus can be
  6290. de-interlaced by a later filter such as @ref{yadif} before decimation.
  6291. In addition to the various configuration options, @code{fieldmatch} can take an
  6292. optional second stream, activated through the @option{ppsrc} option. If
  6293. enabled, the frames reconstruction will be based on the fields and frames from
  6294. this second stream. This allows the first input to be pre-processed in order to
  6295. help the various algorithms of the filter, while keeping the output lossless
  6296. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  6297. or brightness/contrast adjustments can help.
  6298. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  6299. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  6300. which @code{fieldmatch} is based on. While the semantic and usage are very
  6301. close, some behaviour and options names can differ.
  6302. The @ref{decimate} filter currently only works for constant frame rate input.
  6303. If your input has mixed telecined (30fps) and progressive content with a lower
  6304. framerate like 24fps use the following filterchain to produce the necessary cfr
  6305. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  6306. The filter accepts the following options:
  6307. @table @option
  6308. @item order
  6309. Specify the assumed field order of the input stream. Available values are:
  6310. @table @samp
  6311. @item auto
  6312. Auto detect parity (use FFmpeg's internal parity value).
  6313. @item bff
  6314. Assume bottom field first.
  6315. @item tff
  6316. Assume top field first.
  6317. @end table
  6318. Note that it is sometimes recommended not to trust the parity announced by the
  6319. stream.
  6320. Default value is @var{auto}.
  6321. @item mode
  6322. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  6323. sense that it won't risk creating jerkiness due to duplicate frames when
  6324. possible, but if there are bad edits or blended fields it will end up
  6325. outputting combed frames when a good match might actually exist. On the other
  6326. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  6327. but will almost always find a good frame if there is one. The other values are
  6328. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  6329. jerkiness and creating duplicate frames versus finding good matches in sections
  6330. with bad edits, orphaned fields, blended fields, etc.
  6331. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  6332. Available values are:
  6333. @table @samp
  6334. @item pc
  6335. 2-way matching (p/c)
  6336. @item pc_n
  6337. 2-way matching, and trying 3rd match if still combed (p/c + n)
  6338. @item pc_u
  6339. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  6340. @item pc_n_ub
  6341. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  6342. still combed (p/c + n + u/b)
  6343. @item pcn
  6344. 3-way matching (p/c/n)
  6345. @item pcn_ub
  6346. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  6347. detected as combed (p/c/n + u/b)
  6348. @end table
  6349. The parenthesis at the end indicate the matches that would be used for that
  6350. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  6351. @var{top}).
  6352. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  6353. the slowest.
  6354. Default value is @var{pc_n}.
  6355. @item ppsrc
  6356. Mark the main input stream as a pre-processed input, and enable the secondary
  6357. input stream as the clean source to pick the fields from. See the filter
  6358. introduction for more details. It is similar to the @option{clip2} feature from
  6359. VFM/TFM.
  6360. Default value is @code{0} (disabled).
  6361. @item field
  6362. Set the field to match from. It is recommended to set this to the same value as
  6363. @option{order} unless you experience matching failures with that setting. In
  6364. certain circumstances changing the field that is used to match from can have a
  6365. large impact on matching performance. Available values are:
  6366. @table @samp
  6367. @item auto
  6368. Automatic (same value as @option{order}).
  6369. @item bottom
  6370. Match from the bottom field.
  6371. @item top
  6372. Match from the top field.
  6373. @end table
  6374. Default value is @var{auto}.
  6375. @item mchroma
  6376. Set whether or not chroma is included during the match comparisons. In most
  6377. cases it is recommended to leave this enabled. You should set this to @code{0}
  6378. only if your clip has bad chroma problems such as heavy rainbowing or other
  6379. artifacts. Setting this to @code{0} could also be used to speed things up at
  6380. the cost of some accuracy.
  6381. Default value is @code{1}.
  6382. @item y0
  6383. @item y1
  6384. These define an exclusion band which excludes the lines between @option{y0} and
  6385. @option{y1} from being included in the field matching decision. An exclusion
  6386. band can be used to ignore subtitles, a logo, or other things that may
  6387. interfere with the matching. @option{y0} sets the starting scan line and
  6388. @option{y1} sets the ending line; all lines in between @option{y0} and
  6389. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6390. @option{y0} and @option{y1} to the same value will disable the feature.
  6391. @option{y0} and @option{y1} defaults to @code{0}.
  6392. @item scthresh
  6393. Set the scene change detection threshold as a percentage of maximum change on
  6394. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6395. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6396. @option{scthresh} is @code{[0.0, 100.0]}.
  6397. Default value is @code{12.0}.
  6398. @item combmatch
  6399. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6400. account the combed scores of matches when deciding what match to use as the
  6401. final match. Available values are:
  6402. @table @samp
  6403. @item none
  6404. No final matching based on combed scores.
  6405. @item sc
  6406. Combed scores are only used when a scene change is detected.
  6407. @item full
  6408. Use combed scores all the time.
  6409. @end table
  6410. Default is @var{sc}.
  6411. @item combdbg
  6412. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  6413. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  6414. Available values are:
  6415. @table @samp
  6416. @item none
  6417. No forced calculation.
  6418. @item pcn
  6419. Force p/c/n calculations.
  6420. @item pcnub
  6421. Force p/c/n/u/b calculations.
  6422. @end table
  6423. Default value is @var{none}.
  6424. @item cthresh
  6425. This is the area combing threshold used for combed frame detection. This
  6426. essentially controls how "strong" or "visible" combing must be to be detected.
  6427. Larger values mean combing must be more visible and smaller values mean combing
  6428. can be less visible or strong and still be detected. Valid settings are from
  6429. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6430. be detected as combed). This is basically a pixel difference value. A good
  6431. range is @code{[8, 12]}.
  6432. Default value is @code{9}.
  6433. @item chroma
  6434. Sets whether or not chroma is considered in the combed frame decision. Only
  6435. disable this if your source has chroma problems (rainbowing, etc.) that are
  6436. causing problems for the combed frame detection with chroma enabled. Actually,
  6437. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6438. where there is chroma only combing in the source.
  6439. Default value is @code{0}.
  6440. @item blockx
  6441. @item blocky
  6442. Respectively set the x-axis and y-axis size of the window used during combed
  6443. frame detection. This has to do with the size of the area in which
  6444. @option{combpel} pixels are required to be detected as combed for a frame to be
  6445. declared combed. See the @option{combpel} parameter description for more info.
  6446. Possible values are any number that is a power of 2 starting at 4 and going up
  6447. to 512.
  6448. Default value is @code{16}.
  6449. @item combpel
  6450. The number of combed pixels inside any of the @option{blocky} by
  6451. @option{blockx} size blocks on the frame for the frame to be detected as
  6452. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6453. setting controls "how much" combing there must be in any localized area (a
  6454. window defined by the @option{blockx} and @option{blocky} settings) on the
  6455. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6456. which point no frames will ever be detected as combed). This setting is known
  6457. as @option{MI} in TFM/VFM vocabulary.
  6458. Default value is @code{80}.
  6459. @end table
  6460. @anchor{p/c/n/u/b meaning}
  6461. @subsection p/c/n/u/b meaning
  6462. @subsubsection p/c/n
  6463. We assume the following telecined stream:
  6464. @example
  6465. Top fields: 1 2 2 3 4
  6466. Bottom fields: 1 2 3 4 4
  6467. @end example
  6468. The numbers correspond to the progressive frame the fields relate to. Here, the
  6469. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6470. When @code{fieldmatch} is configured to run a matching from bottom
  6471. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6472. @example
  6473. Input stream:
  6474. T 1 2 2 3 4
  6475. B 1 2 3 4 4 <-- matching reference
  6476. Matches: c c n n c
  6477. Output stream:
  6478. T 1 2 3 4 4
  6479. B 1 2 3 4 4
  6480. @end example
  6481. As a result of the field matching, we can see that some frames get duplicated.
  6482. To perform a complete inverse telecine, you need to rely on a decimation filter
  6483. after this operation. See for instance the @ref{decimate} filter.
  6484. The same operation now matching from top fields (@option{field}=@var{top})
  6485. looks like this:
  6486. @example
  6487. Input stream:
  6488. T 1 2 2 3 4 <-- matching reference
  6489. B 1 2 3 4 4
  6490. Matches: c c p p c
  6491. Output stream:
  6492. T 1 2 2 3 4
  6493. B 1 2 2 3 4
  6494. @end example
  6495. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6496. basically, they refer to the frame and field of the opposite parity:
  6497. @itemize
  6498. @item @var{p} matches the field of the opposite parity in the previous frame
  6499. @item @var{c} matches the field of the opposite parity in the current frame
  6500. @item @var{n} matches the field of the opposite parity in the next frame
  6501. @end itemize
  6502. @subsubsection u/b
  6503. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6504. from the opposite parity flag. In the following examples, we assume that we are
  6505. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6506. 'x' is placed above and below each matched fields.
  6507. With bottom matching (@option{field}=@var{bottom}):
  6508. @example
  6509. Match: c p n b u
  6510. x x x x x
  6511. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6512. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6513. x x x x x
  6514. Output frames:
  6515. 2 1 2 2 2
  6516. 2 2 2 1 3
  6517. @end example
  6518. With top matching (@option{field}=@var{top}):
  6519. @example
  6520. Match: c p n b u
  6521. x x x x x
  6522. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6523. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6524. x x x x x
  6525. Output frames:
  6526. 2 2 2 1 2
  6527. 2 1 3 2 2
  6528. @end example
  6529. @subsection Examples
  6530. Simple IVTC of a top field first telecined stream:
  6531. @example
  6532. fieldmatch=order=tff:combmatch=none, decimate
  6533. @end example
  6534. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6535. @example
  6536. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6537. @end example
  6538. @section fieldorder
  6539. Transform the field order of the input video.
  6540. It accepts the following parameters:
  6541. @table @option
  6542. @item order
  6543. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6544. for bottom field first.
  6545. @end table
  6546. The default value is @samp{tff}.
  6547. The transformation is done by shifting the picture content up or down
  6548. by one line, and filling the remaining line with appropriate picture content.
  6549. This method is consistent with most broadcast field order converters.
  6550. If the input video is not flagged as being interlaced, or it is already
  6551. flagged as being of the required output field order, then this filter does
  6552. not alter the incoming video.
  6553. It is very useful when converting to or from PAL DV material,
  6554. which is bottom field first.
  6555. For example:
  6556. @example
  6557. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6558. @end example
  6559. @section fifo, afifo
  6560. Buffer input images and send them when they are requested.
  6561. It is mainly useful when auto-inserted by the libavfilter
  6562. framework.
  6563. It does not take parameters.
  6564. @section find_rect
  6565. Find a rectangular object
  6566. It accepts the following options:
  6567. @table @option
  6568. @item object
  6569. Filepath of the object image, needs to be in gray8.
  6570. @item threshold
  6571. Detection threshold, default is 0.5.
  6572. @item mipmaps
  6573. Number of mipmaps, default is 3.
  6574. @item xmin, ymin, xmax, ymax
  6575. Specifies the rectangle in which to search.
  6576. @end table
  6577. @subsection Examples
  6578. @itemize
  6579. @item
  6580. Generate a representative palette of a given video using @command{ffmpeg}:
  6581. @example
  6582. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6583. @end example
  6584. @end itemize
  6585. @section cover_rect
  6586. Cover a rectangular object
  6587. It accepts the following options:
  6588. @table @option
  6589. @item cover
  6590. Filepath of the optional cover image, needs to be in yuv420.
  6591. @item mode
  6592. Set covering mode.
  6593. It accepts the following values:
  6594. @table @samp
  6595. @item cover
  6596. cover it by the supplied image
  6597. @item blur
  6598. cover it by interpolating the surrounding pixels
  6599. @end table
  6600. Default value is @var{blur}.
  6601. @end table
  6602. @subsection Examples
  6603. @itemize
  6604. @item
  6605. Generate a representative palette of a given video using @command{ffmpeg}:
  6606. @example
  6607. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6608. @end example
  6609. @end itemize
  6610. @section floodfill
  6611. Flood area with values of same pixel components with another values.
  6612. It accepts the following options:
  6613. @table @option
  6614. @item x
  6615. Set pixel x coordinate.
  6616. @item y
  6617. Set pixel y coordinate.
  6618. @item s0
  6619. Set source #0 component value.
  6620. @item s1
  6621. Set source #1 component value.
  6622. @item s2
  6623. Set source #2 component value.
  6624. @item s3
  6625. Set source #3 component value.
  6626. @item d0
  6627. Set destination #0 component value.
  6628. @item d1
  6629. Set destination #1 component value.
  6630. @item d2
  6631. Set destination #2 component value.
  6632. @item d3
  6633. Set destination #3 component value.
  6634. @end table
  6635. @anchor{format}
  6636. @section format
  6637. Convert the input video to one of the specified pixel formats.
  6638. Libavfilter will try to pick one that is suitable as input to
  6639. the next filter.
  6640. It accepts the following parameters:
  6641. @table @option
  6642. @item pix_fmts
  6643. A '|'-separated list of pixel format names, such as
  6644. "pix_fmts=yuv420p|monow|rgb24".
  6645. @end table
  6646. @subsection Examples
  6647. @itemize
  6648. @item
  6649. Convert the input video to the @var{yuv420p} format
  6650. @example
  6651. format=pix_fmts=yuv420p
  6652. @end example
  6653. Convert the input video to any of the formats in the list
  6654. @example
  6655. format=pix_fmts=yuv420p|yuv444p|yuv410p
  6656. @end example
  6657. @end itemize
  6658. @anchor{fps}
  6659. @section fps
  6660. Convert the video to specified constant frame rate by duplicating or dropping
  6661. frames as necessary.
  6662. It accepts the following parameters:
  6663. @table @option
  6664. @item fps
  6665. The desired output frame rate. The default is @code{25}.
  6666. @item start_time
  6667. Assume the first PTS should be the given value, in seconds. This allows for
  6668. padding/trimming at the start of stream. By default, no assumption is made
  6669. about the first frame's expected PTS, so no padding or trimming is done.
  6670. For example, this could be set to 0 to pad the beginning with duplicates of
  6671. the first frame if a video stream starts after the audio stream or to trim any
  6672. frames with a negative PTS.
  6673. @item round
  6674. Timestamp (PTS) rounding method.
  6675. Possible values are:
  6676. @table @option
  6677. @item zero
  6678. round towards 0
  6679. @item inf
  6680. round away from 0
  6681. @item down
  6682. round towards -infinity
  6683. @item up
  6684. round towards +infinity
  6685. @item near
  6686. round to nearest
  6687. @end table
  6688. The default is @code{near}.
  6689. @item eof_action
  6690. Action performed when reading the last frame.
  6691. Possible values are:
  6692. @table @option
  6693. @item round
  6694. Use same timestamp rounding method as used for other frames.
  6695. @item pass
  6696. Pass through last frame if input duration has not been reached yet.
  6697. @end table
  6698. The default is @code{round}.
  6699. @end table
  6700. Alternatively, the options can be specified as a flat string:
  6701. @var{fps}[:@var{start_time}[:@var{round}]].
  6702. See also the @ref{setpts} filter.
  6703. @subsection Examples
  6704. @itemize
  6705. @item
  6706. A typical usage in order to set the fps to 25:
  6707. @example
  6708. fps=fps=25
  6709. @end example
  6710. @item
  6711. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  6712. @example
  6713. fps=fps=film:round=near
  6714. @end example
  6715. @end itemize
  6716. @section framepack
  6717. Pack two different video streams into a stereoscopic video, setting proper
  6718. metadata on supported codecs. The two views should have the same size and
  6719. framerate and processing will stop when the shorter video ends. Please note
  6720. that you may conveniently adjust view properties with the @ref{scale} and
  6721. @ref{fps} filters.
  6722. It accepts the following parameters:
  6723. @table @option
  6724. @item format
  6725. The desired packing format. Supported values are:
  6726. @table @option
  6727. @item sbs
  6728. The views are next to each other (default).
  6729. @item tab
  6730. The views are on top of each other.
  6731. @item lines
  6732. The views are packed by line.
  6733. @item columns
  6734. The views are packed by column.
  6735. @item frameseq
  6736. The views are temporally interleaved.
  6737. @end table
  6738. @end table
  6739. Some examples:
  6740. @example
  6741. # Convert left and right views into a frame-sequential video
  6742. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  6743. # Convert views into a side-by-side video with the same output resolution as the input
  6744. 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
  6745. @end example
  6746. @section framerate
  6747. Change the frame rate by interpolating new video output frames from the source
  6748. frames.
  6749. This filter is not designed to function correctly with interlaced media. If
  6750. you wish to change the frame rate of interlaced media then you are required
  6751. to deinterlace before this filter and re-interlace after this filter.
  6752. A description of the accepted options follows.
  6753. @table @option
  6754. @item fps
  6755. Specify the output frames per second. This option can also be specified
  6756. as a value alone. The default is @code{50}.
  6757. @item interp_start
  6758. Specify the start of a range where the output frame will be created as a
  6759. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6760. the default is @code{15}.
  6761. @item interp_end
  6762. Specify the end of a range where the output frame will be created as a
  6763. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6764. the default is @code{240}.
  6765. @item scene
  6766. Specify the level at which a scene change is detected as a value between
  6767. 0 and 100 to indicate a new scene; a low value reflects a low
  6768. probability for the current frame to introduce a new scene, while a higher
  6769. value means the current frame is more likely to be one.
  6770. The default is @code{7}.
  6771. @item flags
  6772. Specify flags influencing the filter process.
  6773. Available value for @var{flags} is:
  6774. @table @option
  6775. @item scene_change_detect, scd
  6776. Enable scene change detection using the value of the option @var{scene}.
  6777. This flag is enabled by default.
  6778. @end table
  6779. @end table
  6780. @section framestep
  6781. Select one frame every N-th frame.
  6782. This filter accepts the following option:
  6783. @table @option
  6784. @item step
  6785. Select frame after every @code{step} frames.
  6786. Allowed values are positive integers higher than 0. Default value is @code{1}.
  6787. @end table
  6788. @anchor{frei0r}
  6789. @section frei0r
  6790. Apply a frei0r effect to the input video.
  6791. To enable the compilation of this filter, you need to install the frei0r
  6792. header and configure FFmpeg with @code{--enable-frei0r}.
  6793. It accepts the following parameters:
  6794. @table @option
  6795. @item filter_name
  6796. The name of the frei0r effect to load. If the environment variable
  6797. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  6798. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  6799. Otherwise, the standard frei0r paths are searched, in this order:
  6800. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  6801. @file{/usr/lib/frei0r-1/}.
  6802. @item filter_params
  6803. A '|'-separated list of parameters to pass to the frei0r effect.
  6804. @end table
  6805. A frei0r effect parameter can be a boolean (its value is either
  6806. "y" or "n"), a double, a color (specified as
  6807. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  6808. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  6809. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  6810. @var{X} and @var{Y} are floating point numbers) and/or a string.
  6811. The number and types of parameters depend on the loaded effect. If an
  6812. effect parameter is not specified, the default value is set.
  6813. @subsection Examples
  6814. @itemize
  6815. @item
  6816. Apply the distort0r effect, setting the first two double parameters:
  6817. @example
  6818. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  6819. @end example
  6820. @item
  6821. Apply the colordistance effect, taking a color as the first parameter:
  6822. @example
  6823. frei0r=colordistance:0.2/0.3/0.4
  6824. frei0r=colordistance:violet
  6825. frei0r=colordistance:0x112233
  6826. @end example
  6827. @item
  6828. Apply the perspective effect, specifying the top left and top right image
  6829. positions:
  6830. @example
  6831. frei0r=perspective:0.2/0.2|0.8/0.2
  6832. @end example
  6833. @end itemize
  6834. For more information, see
  6835. @url{http://frei0r.dyne.org}
  6836. @section fspp
  6837. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  6838. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  6839. processing filter, one of them is performed once per block, not per pixel.
  6840. This allows for much higher speed.
  6841. The filter accepts the following options:
  6842. @table @option
  6843. @item quality
  6844. Set quality. This option defines the number of levels for averaging. It accepts
  6845. an integer in the range 4-5. Default value is @code{4}.
  6846. @item qp
  6847. Force a constant quantization parameter. It accepts an integer in range 0-63.
  6848. If not set, the filter will use the QP from the video stream (if available).
  6849. @item strength
  6850. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  6851. more details but also more artifacts, while higher values make the image smoother
  6852. but also blurrier. Default value is @code{0} − PSNR optimal.
  6853. @item use_bframe_qp
  6854. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  6855. option may cause flicker since the B-Frames have often larger QP. Default is
  6856. @code{0} (not enabled).
  6857. @end table
  6858. @section gblur
  6859. Apply Gaussian blur filter.
  6860. The filter accepts the following options:
  6861. @table @option
  6862. @item sigma
  6863. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  6864. @item steps
  6865. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  6866. @item planes
  6867. Set which planes to filter. By default all planes are filtered.
  6868. @item sigmaV
  6869. Set vertical sigma, if negative it will be same as @code{sigma}.
  6870. Default is @code{-1}.
  6871. @end table
  6872. @section geq
  6873. The filter accepts the following options:
  6874. @table @option
  6875. @item lum_expr, lum
  6876. Set the luminance expression.
  6877. @item cb_expr, cb
  6878. Set the chrominance blue expression.
  6879. @item cr_expr, cr
  6880. Set the chrominance red expression.
  6881. @item alpha_expr, a
  6882. Set the alpha expression.
  6883. @item red_expr, r
  6884. Set the red expression.
  6885. @item green_expr, g
  6886. Set the green expression.
  6887. @item blue_expr, b
  6888. Set the blue expression.
  6889. @end table
  6890. The colorspace is selected according to the specified options. If one
  6891. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  6892. options is specified, the filter will automatically select a YCbCr
  6893. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  6894. @option{blue_expr} options is specified, it will select an RGB
  6895. colorspace.
  6896. If one of the chrominance expression is not defined, it falls back on the other
  6897. one. If no alpha expression is specified it will evaluate to opaque value.
  6898. If none of chrominance expressions are specified, they will evaluate
  6899. to the luminance expression.
  6900. The expressions can use the following variables and functions:
  6901. @table @option
  6902. @item N
  6903. The sequential number of the filtered frame, starting from @code{0}.
  6904. @item X
  6905. @item Y
  6906. The coordinates of the current sample.
  6907. @item W
  6908. @item H
  6909. The width and height of the image.
  6910. @item SW
  6911. @item SH
  6912. Width and height scale depending on the currently filtered plane. It is the
  6913. ratio between the corresponding luma plane number of pixels and the current
  6914. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  6915. @code{0.5,0.5} for chroma planes.
  6916. @item T
  6917. Time of the current frame, expressed in seconds.
  6918. @item p(x, y)
  6919. Return the value of the pixel at location (@var{x},@var{y}) of the current
  6920. plane.
  6921. @item lum(x, y)
  6922. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  6923. plane.
  6924. @item cb(x, y)
  6925. Return the value of the pixel at location (@var{x},@var{y}) of the
  6926. blue-difference chroma plane. Return 0 if there is no such plane.
  6927. @item cr(x, y)
  6928. Return the value of the pixel at location (@var{x},@var{y}) of the
  6929. red-difference chroma plane. Return 0 if there is no such plane.
  6930. @item r(x, y)
  6931. @item g(x, y)
  6932. @item b(x, y)
  6933. Return the value of the pixel at location (@var{x},@var{y}) of the
  6934. red/green/blue component. Return 0 if there is no such component.
  6935. @item alpha(x, y)
  6936. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  6937. plane. Return 0 if there is no such plane.
  6938. @end table
  6939. For functions, if @var{x} and @var{y} are outside the area, the value will be
  6940. automatically clipped to the closer edge.
  6941. @subsection Examples
  6942. @itemize
  6943. @item
  6944. Flip the image horizontally:
  6945. @example
  6946. geq=p(W-X\,Y)
  6947. @end example
  6948. @item
  6949. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  6950. wavelength of 100 pixels:
  6951. @example
  6952. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  6953. @end example
  6954. @item
  6955. Generate a fancy enigmatic moving light:
  6956. @example
  6957. 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
  6958. @end example
  6959. @item
  6960. Generate a quick emboss effect:
  6961. @example
  6962. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  6963. @end example
  6964. @item
  6965. Modify RGB components depending on pixel position:
  6966. @example
  6967. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  6968. @end example
  6969. @item
  6970. Create a radial gradient that is the same size as the input (also see
  6971. the @ref{vignette} filter):
  6972. @example
  6973. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  6974. @end example
  6975. @end itemize
  6976. @section gradfun
  6977. Fix the banding artifacts that are sometimes introduced into nearly flat
  6978. regions by truncation to 8-bit color depth.
  6979. Interpolate the gradients that should go where the bands are, and
  6980. dither them.
  6981. It is designed for playback only. Do not use it prior to
  6982. lossy compression, because compression tends to lose the dither and
  6983. bring back the bands.
  6984. It accepts the following parameters:
  6985. @table @option
  6986. @item strength
  6987. The maximum amount by which the filter will change any one pixel. This is also
  6988. the threshold for detecting nearly flat regions. Acceptable values range from
  6989. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  6990. valid range.
  6991. @item radius
  6992. The neighborhood to fit the gradient to. A larger radius makes for smoother
  6993. gradients, but also prevents the filter from modifying the pixels near detailed
  6994. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  6995. values will be clipped to the valid range.
  6996. @end table
  6997. Alternatively, the options can be specified as a flat string:
  6998. @var{strength}[:@var{radius}]
  6999. @subsection Examples
  7000. @itemize
  7001. @item
  7002. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  7003. @example
  7004. gradfun=3.5:8
  7005. @end example
  7006. @item
  7007. Specify radius, omitting the strength (which will fall-back to the default
  7008. value):
  7009. @example
  7010. gradfun=radius=8
  7011. @end example
  7012. @end itemize
  7013. @anchor{haldclut}
  7014. @section haldclut
  7015. Apply a Hald CLUT to a video stream.
  7016. First input is the video stream to process, and second one is the Hald CLUT.
  7017. The Hald CLUT input can be a simple picture or a complete video stream.
  7018. The filter accepts the following options:
  7019. @table @option
  7020. @item shortest
  7021. Force termination when the shortest input terminates. Default is @code{0}.
  7022. @item repeatlast
  7023. Continue applying the last CLUT after the end of the stream. A value of
  7024. @code{0} disable the filter after the last frame of the CLUT is reached.
  7025. Default is @code{1}.
  7026. @end table
  7027. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  7028. filters share the same internals).
  7029. More information about the Hald CLUT can be found on Eskil Steenberg's website
  7030. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  7031. @subsection Workflow examples
  7032. @subsubsection Hald CLUT video stream
  7033. Generate an identity Hald CLUT stream altered with various effects:
  7034. @example
  7035. 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
  7036. @end example
  7037. Note: make sure you use a lossless codec.
  7038. Then use it with @code{haldclut} to apply it on some random stream:
  7039. @example
  7040. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  7041. @end example
  7042. The Hald CLUT will be applied to the 10 first seconds (duration of
  7043. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  7044. to the remaining frames of the @code{mandelbrot} stream.
  7045. @subsubsection Hald CLUT with preview
  7046. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  7047. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  7048. biggest possible square starting at the top left of the picture. The remaining
  7049. padding pixels (bottom or right) will be ignored. This area can be used to add
  7050. a preview of the Hald CLUT.
  7051. Typically, the following generated Hald CLUT will be supported by the
  7052. @code{haldclut} filter:
  7053. @example
  7054. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  7055. pad=iw+320 [padded_clut];
  7056. smptebars=s=320x256, split [a][b];
  7057. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  7058. [main][b] overlay=W-320" -frames:v 1 clut.png
  7059. @end example
  7060. It contains the original and a preview of the effect of the CLUT: SMPTE color
  7061. bars are displayed on the right-top, and below the same color bars processed by
  7062. the color changes.
  7063. Then, the effect of this Hald CLUT can be visualized with:
  7064. @example
  7065. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  7066. @end example
  7067. @section hflip
  7068. Flip the input video horizontally.
  7069. For example, to horizontally flip the input video with @command{ffmpeg}:
  7070. @example
  7071. ffmpeg -i in.avi -vf "hflip" out.avi
  7072. @end example
  7073. @section histeq
  7074. This filter applies a global color histogram equalization on a
  7075. per-frame basis.
  7076. It can be used to correct video that has a compressed range of pixel
  7077. intensities. The filter redistributes the pixel intensities to
  7078. equalize their distribution across the intensity range. It may be
  7079. viewed as an "automatically adjusting contrast filter". This filter is
  7080. useful only for correcting degraded or poorly captured source
  7081. video.
  7082. The filter accepts the following options:
  7083. @table @option
  7084. @item strength
  7085. Determine the amount of equalization to be applied. As the strength
  7086. is reduced, the distribution of pixel intensities more-and-more
  7087. approaches that of the input frame. The value must be a float number
  7088. in the range [0,1] and defaults to 0.200.
  7089. @item intensity
  7090. Set the maximum intensity that can generated and scale the output
  7091. values appropriately. The strength should be set as desired and then
  7092. the intensity can be limited if needed to avoid washing-out. The value
  7093. must be a float number in the range [0,1] and defaults to 0.210.
  7094. @item antibanding
  7095. Set the antibanding level. If enabled the filter will randomly vary
  7096. the luminance of output pixels by a small amount to avoid banding of
  7097. the histogram. Possible values are @code{none}, @code{weak} or
  7098. @code{strong}. It defaults to @code{none}.
  7099. @end table
  7100. @section histogram
  7101. Compute and draw a color distribution histogram for the input video.
  7102. The computed histogram is a representation of the color component
  7103. distribution in an image.
  7104. Standard histogram displays the color components distribution in an image.
  7105. Displays color graph for each color component. Shows distribution of
  7106. the Y, U, V, A or R, G, B components, depending on input format, in the
  7107. current frame. Below each graph a color component scale meter is shown.
  7108. The filter accepts the following options:
  7109. @table @option
  7110. @item level_height
  7111. Set height of level. Default value is @code{200}.
  7112. Allowed range is [50, 2048].
  7113. @item scale_height
  7114. Set height of color scale. Default value is @code{12}.
  7115. Allowed range is [0, 40].
  7116. @item display_mode
  7117. Set display mode.
  7118. It accepts the following values:
  7119. @table @samp
  7120. @item stack
  7121. Per color component graphs are placed below each other.
  7122. @item parade
  7123. Per color component graphs are placed side by side.
  7124. @item overlay
  7125. Presents information identical to that in the @code{parade}, except
  7126. that the graphs representing color components are superimposed directly
  7127. over one another.
  7128. @end table
  7129. Default is @code{stack}.
  7130. @item levels_mode
  7131. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  7132. Default is @code{linear}.
  7133. @item components
  7134. Set what color components to display.
  7135. Default is @code{7}.
  7136. @item fgopacity
  7137. Set foreground opacity. Default is @code{0.7}.
  7138. @item bgopacity
  7139. Set background opacity. Default is @code{0.5}.
  7140. @end table
  7141. @subsection Examples
  7142. @itemize
  7143. @item
  7144. Calculate and draw histogram:
  7145. @example
  7146. ffplay -i input -vf histogram
  7147. @end example
  7148. @end itemize
  7149. @anchor{hqdn3d}
  7150. @section hqdn3d
  7151. This is a high precision/quality 3d denoise filter. It aims to reduce
  7152. image noise, producing smooth images and making still images really
  7153. still. It should enhance compressibility.
  7154. It accepts the following optional parameters:
  7155. @table @option
  7156. @item luma_spatial
  7157. A non-negative floating point number which specifies spatial luma strength.
  7158. It defaults to 4.0.
  7159. @item chroma_spatial
  7160. A non-negative floating point number which specifies spatial chroma strength.
  7161. It defaults to 3.0*@var{luma_spatial}/4.0.
  7162. @item luma_tmp
  7163. A floating point number which specifies luma temporal strength. It defaults to
  7164. 6.0*@var{luma_spatial}/4.0.
  7165. @item chroma_tmp
  7166. A floating point number which specifies chroma temporal strength. It defaults to
  7167. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  7168. @end table
  7169. @section hwdownload
  7170. Download hardware frames to system memory.
  7171. The input must be in hardware frames, and the output a non-hardware format.
  7172. Not all formats will be supported on the output - it may be necessary to insert
  7173. an additional @option{format} filter immediately following in the graph to get
  7174. the output in a supported format.
  7175. @section hwmap
  7176. Map hardware frames to system memory or to another device.
  7177. This filter has several different modes of operation; which one is used depends
  7178. on the input and output formats:
  7179. @itemize
  7180. @item
  7181. Hardware frame input, normal frame output
  7182. Map the input frames to system memory and pass them to the output. If the
  7183. original hardware frame is later required (for example, after overlaying
  7184. something else on part of it), the @option{hwmap} filter can be used again
  7185. in the next mode to retrieve it.
  7186. @item
  7187. Normal frame input, hardware frame output
  7188. If the input is actually a software-mapped hardware frame, then unmap it -
  7189. that is, return the original hardware frame.
  7190. Otherwise, a device must be provided. Create new hardware surfaces on that
  7191. device for the output, then map them back to the software format at the input
  7192. and give those frames to the preceding filter. This will then act like the
  7193. @option{hwupload} filter, but may be able to avoid an additional copy when
  7194. the input is already in a compatible format.
  7195. @item
  7196. Hardware frame input and output
  7197. A device must be supplied for the output, either directly or with the
  7198. @option{derive_device} option. The input and output devices must be of
  7199. different types and compatible - the exact meaning of this is
  7200. system-dependent, but typically it means that they must refer to the same
  7201. underlying hardware context (for example, refer to the same graphics card).
  7202. If the input frames were originally created on the output device, then unmap
  7203. to retrieve the original frames.
  7204. Otherwise, map the frames to the output device - create new hardware frames
  7205. on the output corresponding to the frames on the input.
  7206. @end itemize
  7207. The following additional parameters are accepted:
  7208. @table @option
  7209. @item mode
  7210. Set the frame mapping mode. Some combination of:
  7211. @table @var
  7212. @item read
  7213. The mapped frame should be readable.
  7214. @item write
  7215. The mapped frame should be writeable.
  7216. @item overwrite
  7217. The mapping will always overwrite the entire frame.
  7218. This may improve performance in some cases, as the original contents of the
  7219. frame need not be loaded.
  7220. @item direct
  7221. The mapping must not involve any copying.
  7222. Indirect mappings to copies of frames are created in some cases where either
  7223. direct mapping is not possible or it would have unexpected properties.
  7224. Setting this flag ensures that the mapping is direct and will fail if that is
  7225. not possible.
  7226. @end table
  7227. Defaults to @var{read+write} if not specified.
  7228. @item derive_device @var{type}
  7229. Rather than using the device supplied at initialisation, instead derive a new
  7230. device of type @var{type} from the device the input frames exist on.
  7231. @item reverse
  7232. In a hardware to hardware mapping, map in reverse - create frames in the sink
  7233. and map them back to the source. This may be necessary in some cases where
  7234. a mapping in one direction is required but only the opposite direction is
  7235. supported by the devices being used.
  7236. This option is dangerous - it may break the preceding filter in undefined
  7237. ways if there are any additional constraints on that filter's output.
  7238. Do not use it without fully understanding the implications of its use.
  7239. @end table
  7240. @section hwupload
  7241. Upload system memory frames to hardware surfaces.
  7242. The device to upload to must be supplied when the filter is initialised. If
  7243. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  7244. option.
  7245. @anchor{hwupload_cuda}
  7246. @section hwupload_cuda
  7247. Upload system memory frames to a CUDA device.
  7248. It accepts the following optional parameters:
  7249. @table @option
  7250. @item device
  7251. The number of the CUDA device to use
  7252. @end table
  7253. @section hqx
  7254. Apply a high-quality magnification filter designed for pixel art. This filter
  7255. was originally created by Maxim Stepin.
  7256. It accepts the following option:
  7257. @table @option
  7258. @item n
  7259. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  7260. @code{hq3x} and @code{4} for @code{hq4x}.
  7261. Default is @code{3}.
  7262. @end table
  7263. @section hstack
  7264. Stack input videos horizontally.
  7265. All streams must be of same pixel format and of same height.
  7266. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  7267. to create same output.
  7268. The filter accept the following option:
  7269. @table @option
  7270. @item inputs
  7271. Set number of input streams. Default is 2.
  7272. @item shortest
  7273. If set to 1, force the output to terminate when the shortest input
  7274. terminates. Default value is 0.
  7275. @end table
  7276. @section hue
  7277. Modify the hue and/or the saturation of the input.
  7278. It accepts the following parameters:
  7279. @table @option
  7280. @item h
  7281. Specify the hue angle as a number of degrees. It accepts an expression,
  7282. and defaults to "0".
  7283. @item s
  7284. Specify the saturation in the [-10,10] range. It accepts an expression and
  7285. defaults to "1".
  7286. @item H
  7287. Specify the hue angle as a number of radians. It accepts an
  7288. expression, and defaults to "0".
  7289. @item b
  7290. Specify the brightness in the [-10,10] range. It accepts an expression and
  7291. defaults to "0".
  7292. @end table
  7293. @option{h} and @option{H} are mutually exclusive, and can't be
  7294. specified at the same time.
  7295. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  7296. expressions containing the following constants:
  7297. @table @option
  7298. @item n
  7299. frame count of the input frame starting from 0
  7300. @item pts
  7301. presentation timestamp of the input frame expressed in time base units
  7302. @item r
  7303. frame rate of the input video, NAN if the input frame rate is unknown
  7304. @item t
  7305. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7306. @item tb
  7307. time base of the input video
  7308. @end table
  7309. @subsection Examples
  7310. @itemize
  7311. @item
  7312. Set the hue to 90 degrees and the saturation to 1.0:
  7313. @example
  7314. hue=h=90:s=1
  7315. @end example
  7316. @item
  7317. Same command but expressing the hue in radians:
  7318. @example
  7319. hue=H=PI/2:s=1
  7320. @end example
  7321. @item
  7322. Rotate hue and make the saturation swing between 0
  7323. and 2 over a period of 1 second:
  7324. @example
  7325. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  7326. @end example
  7327. @item
  7328. Apply a 3 seconds saturation fade-in effect starting at 0:
  7329. @example
  7330. hue="s=min(t/3\,1)"
  7331. @end example
  7332. The general fade-in expression can be written as:
  7333. @example
  7334. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  7335. @end example
  7336. @item
  7337. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  7338. @example
  7339. hue="s=max(0\, min(1\, (8-t)/3))"
  7340. @end example
  7341. The general fade-out expression can be written as:
  7342. @example
  7343. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  7344. @end example
  7345. @end itemize
  7346. @subsection Commands
  7347. This filter supports the following commands:
  7348. @table @option
  7349. @item b
  7350. @item s
  7351. @item h
  7352. @item H
  7353. Modify the hue and/or the saturation and/or brightness of the input video.
  7354. The command accepts the same syntax of the corresponding option.
  7355. If the specified expression is not valid, it is kept at its current
  7356. value.
  7357. @end table
  7358. @section hysteresis
  7359. Grow first stream into second stream by connecting components.
  7360. This makes it possible to build more robust edge masks.
  7361. This filter accepts the following options:
  7362. @table @option
  7363. @item planes
  7364. Set which planes will be processed as bitmap, unprocessed planes will be
  7365. copied from first stream.
  7366. By default value 0xf, all planes will be processed.
  7367. @item threshold
  7368. Set threshold which is used in filtering. If pixel component value is higher than
  7369. this value filter algorithm for connecting components is activated.
  7370. By default value is 0.
  7371. @end table
  7372. @section idet
  7373. Detect video interlacing type.
  7374. This filter tries to detect if the input frames are interlaced, progressive,
  7375. top or bottom field first. It will also try to detect fields that are
  7376. repeated between adjacent frames (a sign of telecine).
  7377. Single frame detection considers only immediately adjacent frames when classifying each frame.
  7378. Multiple frame detection incorporates the classification history of previous frames.
  7379. The filter will log these metadata values:
  7380. @table @option
  7381. @item single.current_frame
  7382. Detected type of current frame using single-frame detection. One of:
  7383. ``tff'' (top field first), ``bff'' (bottom field first),
  7384. ``progressive'', or ``undetermined''
  7385. @item single.tff
  7386. Cumulative number of frames detected as top field first using single-frame detection.
  7387. @item multiple.tff
  7388. Cumulative number of frames detected as top field first using multiple-frame detection.
  7389. @item single.bff
  7390. Cumulative number of frames detected as bottom field first using single-frame detection.
  7391. @item multiple.current_frame
  7392. Detected type of current frame using multiple-frame detection. One of:
  7393. ``tff'' (top field first), ``bff'' (bottom field first),
  7394. ``progressive'', or ``undetermined''
  7395. @item multiple.bff
  7396. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  7397. @item single.progressive
  7398. Cumulative number of frames detected as progressive using single-frame detection.
  7399. @item multiple.progressive
  7400. Cumulative number of frames detected as progressive using multiple-frame detection.
  7401. @item single.undetermined
  7402. Cumulative number of frames that could not be classified using single-frame detection.
  7403. @item multiple.undetermined
  7404. Cumulative number of frames that could not be classified using multiple-frame detection.
  7405. @item repeated.current_frame
  7406. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  7407. @item repeated.neither
  7408. Cumulative number of frames with no repeated field.
  7409. @item repeated.top
  7410. Cumulative number of frames with the top field repeated from the previous frame's top field.
  7411. @item repeated.bottom
  7412. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  7413. @end table
  7414. The filter accepts the following options:
  7415. @table @option
  7416. @item intl_thres
  7417. Set interlacing threshold.
  7418. @item prog_thres
  7419. Set progressive threshold.
  7420. @item rep_thres
  7421. Threshold for repeated field detection.
  7422. @item half_life
  7423. Number of frames after which a given frame's contribution to the
  7424. statistics is halved (i.e., it contributes only 0.5 to its
  7425. classification). The default of 0 means that all frames seen are given
  7426. full weight of 1.0 forever.
  7427. @item analyze_interlaced_flag
  7428. When this is not 0 then idet will use the specified number of frames to determine
  7429. if the interlaced flag is accurate, it will not count undetermined frames.
  7430. If the flag is found to be accurate it will be used without any further
  7431. computations, if it is found to be inaccurate it will be cleared without any
  7432. further computations. This allows inserting the idet filter as a low computational
  7433. method to clean up the interlaced flag
  7434. @end table
  7435. @section il
  7436. Deinterleave or interleave fields.
  7437. This filter allows one to process interlaced images fields without
  7438. deinterlacing them. Deinterleaving splits the input frame into 2
  7439. fields (so called half pictures). Odd lines are moved to the top
  7440. half of the output image, even lines to the bottom half.
  7441. You can process (filter) them independently and then re-interleave them.
  7442. The filter accepts the following options:
  7443. @table @option
  7444. @item luma_mode, l
  7445. @item chroma_mode, c
  7446. @item alpha_mode, a
  7447. Available values for @var{luma_mode}, @var{chroma_mode} and
  7448. @var{alpha_mode} are:
  7449. @table @samp
  7450. @item none
  7451. Do nothing.
  7452. @item deinterleave, d
  7453. Deinterleave fields, placing one above the other.
  7454. @item interleave, i
  7455. Interleave fields. Reverse the effect of deinterleaving.
  7456. @end table
  7457. Default value is @code{none}.
  7458. @item luma_swap, ls
  7459. @item chroma_swap, cs
  7460. @item alpha_swap, as
  7461. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  7462. @end table
  7463. @section inflate
  7464. Apply inflate effect to the video.
  7465. This filter replaces the pixel by the local(3x3) average by taking into account
  7466. only values higher than the pixel.
  7467. It accepts the following options:
  7468. @table @option
  7469. @item threshold0
  7470. @item threshold1
  7471. @item threshold2
  7472. @item threshold3
  7473. Limit the maximum change for each plane, default is 65535.
  7474. If 0, plane will remain unchanged.
  7475. @end table
  7476. @section interlace
  7477. Simple interlacing filter from progressive contents. This interleaves upper (or
  7478. lower) lines from odd frames with lower (or upper) lines from even frames,
  7479. halving the frame rate and preserving image height.
  7480. @example
  7481. Original Original New Frame
  7482. Frame 'j' Frame 'j+1' (tff)
  7483. ========== =========== ==================
  7484. Line 0 --------------------> Frame 'j' Line 0
  7485. Line 1 Line 1 ----> Frame 'j+1' Line 1
  7486. Line 2 ---------------------> Frame 'j' Line 2
  7487. Line 3 Line 3 ----> Frame 'j+1' Line 3
  7488. ... ... ...
  7489. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  7490. @end example
  7491. It accepts the following optional parameters:
  7492. @table @option
  7493. @item scan
  7494. This determines whether the interlaced frame is taken from the even
  7495. (tff - default) or odd (bff) lines of the progressive frame.
  7496. @item lowpass
  7497. Vertical lowpass filter to avoid twitter interlacing and
  7498. reduce moire patterns.
  7499. @table @samp
  7500. @item 0, off
  7501. Disable vertical lowpass filter
  7502. @item 1, linear
  7503. Enable linear filter (default)
  7504. @item 2, complex
  7505. Enable complex filter. This will slightly less reduce twitter and moire
  7506. but better retain detail and subjective sharpness impression.
  7507. @end table
  7508. @end table
  7509. @section kerndeint
  7510. Deinterlace input video by applying Donald Graft's adaptive kernel
  7511. deinterling. Work on interlaced parts of a video to produce
  7512. progressive frames.
  7513. The description of the accepted parameters follows.
  7514. @table @option
  7515. @item thresh
  7516. Set the threshold which affects the filter's tolerance when
  7517. determining if a pixel line must be processed. It must be an integer
  7518. in the range [0,255] and defaults to 10. A value of 0 will result in
  7519. applying the process on every pixels.
  7520. @item map
  7521. Paint pixels exceeding the threshold value to white if set to 1.
  7522. Default is 0.
  7523. @item order
  7524. Set the fields order. Swap fields if set to 1, leave fields alone if
  7525. 0. Default is 0.
  7526. @item sharp
  7527. Enable additional sharpening if set to 1. Default is 0.
  7528. @item twoway
  7529. Enable twoway sharpening if set to 1. Default is 0.
  7530. @end table
  7531. @subsection Examples
  7532. @itemize
  7533. @item
  7534. Apply default values:
  7535. @example
  7536. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  7537. @end example
  7538. @item
  7539. Enable additional sharpening:
  7540. @example
  7541. kerndeint=sharp=1
  7542. @end example
  7543. @item
  7544. Paint processed pixels in white:
  7545. @example
  7546. kerndeint=map=1
  7547. @end example
  7548. @end itemize
  7549. @section lenscorrection
  7550. Correct radial lens distortion
  7551. This filter can be used to correct for radial distortion as can result from the use
  7552. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  7553. one can use tools available for example as part of opencv or simply trial-and-error.
  7554. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  7555. and extract the k1 and k2 coefficients from the resulting matrix.
  7556. Note that effectively the same filter is available in the open-source tools Krita and
  7557. Digikam from the KDE project.
  7558. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  7559. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  7560. brightness distribution, so you may want to use both filters together in certain
  7561. cases, though you will have to take care of ordering, i.e. whether vignetting should
  7562. be applied before or after lens correction.
  7563. @subsection Options
  7564. The filter accepts the following options:
  7565. @table @option
  7566. @item cx
  7567. Relative x-coordinate of the focal point of the image, and thereby the center of the
  7568. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7569. width.
  7570. @item cy
  7571. Relative y-coordinate of the focal point of the image, and thereby the center of the
  7572. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7573. height.
  7574. @item k1
  7575. Coefficient of the quadratic correction term. 0.5 means no correction.
  7576. @item k2
  7577. Coefficient of the double quadratic correction term. 0.5 means no correction.
  7578. @end table
  7579. The formula that generates the correction is:
  7580. @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)
  7581. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  7582. distances from the focal point in the source and target images, respectively.
  7583. @section libvmaf
  7584. Obtain the average VMAF (Video Multi-Method Assessment Fusion)
  7585. score between two input videos.
  7586. This filter takes two input videos.
  7587. Both video inputs must have the same resolution and pixel format for
  7588. this filter to work correctly. Also it assumes that both inputs
  7589. have the same number of frames, which are compared one by one.
  7590. The obtained average VMAF score is printed through the logging system.
  7591. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  7592. After installing the library it can be enabled using:
  7593. @code{./configure --enable-libvmaf}.
  7594. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  7595. On the below examples the input file @file{main.mpg} being processed is
  7596. compared with the reference file @file{ref.mpg}.
  7597. The filter has following options:
  7598. @table @option
  7599. @item model_path
  7600. Set the model path which is to be used for SVM.
  7601. Default value: @code{"vmaf_v0.6.1.pkl"}
  7602. @item log_path
  7603. Set the file path to be used to store logs.
  7604. @item log_fmt
  7605. Set the format of the log file (xml or json).
  7606. @item enable_transform
  7607. Enables transform for computing vmaf.
  7608. @item phone_model
  7609. Invokes the phone model which will generate VMAF scores higher than in the
  7610. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  7611. @item psnr
  7612. Enables computing psnr along with vmaf.
  7613. @item ssim
  7614. Enables computing ssim along with vmaf.
  7615. @item ms_ssim
  7616. Enables computing ms_ssim along with vmaf.
  7617. @item pool
  7618. Set the pool method to be used for computing vmaf.
  7619. @end table
  7620. This filter also supports the @ref{framesync} options.
  7621. For example:
  7622. @example
  7623. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  7624. @end example
  7625. Example with options:
  7626. @example
  7627. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
  7628. @end example
  7629. @section limiter
  7630. Limits the pixel components values to the specified range [min, max].
  7631. The filter accepts the following options:
  7632. @table @option
  7633. @item min
  7634. Lower bound. Defaults to the lowest allowed value for the input.
  7635. @item max
  7636. Upper bound. Defaults to the highest allowed value for the input.
  7637. @item planes
  7638. Specify which planes will be processed. Defaults to all available.
  7639. @end table
  7640. @section loop
  7641. Loop video frames.
  7642. The filter accepts the following options:
  7643. @table @option
  7644. @item loop
  7645. Set the number of loops.
  7646. @item size
  7647. Set maximal size in number of frames.
  7648. @item start
  7649. Set first frame of loop.
  7650. @end table
  7651. @anchor{lut3d}
  7652. @section lut3d
  7653. Apply a 3D LUT to an input video.
  7654. The filter accepts the following options:
  7655. @table @option
  7656. @item file
  7657. Set the 3D LUT file name.
  7658. Currently supported formats:
  7659. @table @samp
  7660. @item 3dl
  7661. AfterEffects
  7662. @item cube
  7663. Iridas
  7664. @item dat
  7665. DaVinci
  7666. @item m3d
  7667. Pandora
  7668. @end table
  7669. @item interp
  7670. Select interpolation mode.
  7671. Available values are:
  7672. @table @samp
  7673. @item nearest
  7674. Use values from the nearest defined point.
  7675. @item trilinear
  7676. Interpolate values using the 8 points defining a cube.
  7677. @item tetrahedral
  7678. Interpolate values using a tetrahedron.
  7679. @end table
  7680. @end table
  7681. This filter also supports the @ref{framesync} options.
  7682. @section lumakey
  7683. Turn certain luma values into transparency.
  7684. The filter accepts the following options:
  7685. @table @option
  7686. @item threshold
  7687. Set the luma which will be used as base for transparency.
  7688. Default value is @code{0}.
  7689. @item tolerance
  7690. Set the range of luma values to be keyed out.
  7691. Default value is @code{0}.
  7692. @item softness
  7693. Set the range of softness. Default value is @code{0}.
  7694. Use this to control gradual transition from zero to full transparency.
  7695. @end table
  7696. @section lut, lutrgb, lutyuv
  7697. Compute a look-up table for binding each pixel component input value
  7698. to an output value, and apply it to the input video.
  7699. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  7700. to an RGB input video.
  7701. These filters accept the following parameters:
  7702. @table @option
  7703. @item c0
  7704. set first pixel component expression
  7705. @item c1
  7706. set second pixel component expression
  7707. @item c2
  7708. set third pixel component expression
  7709. @item c3
  7710. set fourth pixel component expression, corresponds to the alpha component
  7711. @item r
  7712. set red component expression
  7713. @item g
  7714. set green component expression
  7715. @item b
  7716. set blue component expression
  7717. @item a
  7718. alpha component expression
  7719. @item y
  7720. set Y/luminance component expression
  7721. @item u
  7722. set U/Cb component expression
  7723. @item v
  7724. set V/Cr component expression
  7725. @end table
  7726. Each of them specifies the expression to use for computing the lookup table for
  7727. the corresponding pixel component values.
  7728. The exact component associated to each of the @var{c*} options depends on the
  7729. format in input.
  7730. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  7731. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  7732. The expressions can contain the following constants and functions:
  7733. @table @option
  7734. @item w
  7735. @item h
  7736. The input width and height.
  7737. @item val
  7738. The input value for the pixel component.
  7739. @item clipval
  7740. The input value, clipped to the @var{minval}-@var{maxval} range.
  7741. @item maxval
  7742. The maximum value for the pixel component.
  7743. @item minval
  7744. The minimum value for the pixel component.
  7745. @item negval
  7746. The negated value for the pixel component value, clipped to the
  7747. @var{minval}-@var{maxval} range; it corresponds to the expression
  7748. "maxval-clipval+minval".
  7749. @item clip(val)
  7750. The computed value in @var{val}, clipped to the
  7751. @var{minval}-@var{maxval} range.
  7752. @item gammaval(gamma)
  7753. The computed gamma correction value of the pixel component value,
  7754. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  7755. expression
  7756. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  7757. @end table
  7758. All expressions default to "val".
  7759. @subsection Examples
  7760. @itemize
  7761. @item
  7762. Negate input video:
  7763. @example
  7764. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  7765. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  7766. @end example
  7767. The above is the same as:
  7768. @example
  7769. lutrgb="r=negval:g=negval:b=negval"
  7770. lutyuv="y=negval:u=negval:v=negval"
  7771. @end example
  7772. @item
  7773. Negate luminance:
  7774. @example
  7775. lutyuv=y=negval
  7776. @end example
  7777. @item
  7778. Remove chroma components, turning the video into a graytone image:
  7779. @example
  7780. lutyuv="u=128:v=128"
  7781. @end example
  7782. @item
  7783. Apply a luma burning effect:
  7784. @example
  7785. lutyuv="y=2*val"
  7786. @end example
  7787. @item
  7788. Remove green and blue components:
  7789. @example
  7790. lutrgb="g=0:b=0"
  7791. @end example
  7792. @item
  7793. Set a constant alpha channel value on input:
  7794. @example
  7795. format=rgba,lutrgb=a="maxval-minval/2"
  7796. @end example
  7797. @item
  7798. Correct luminance gamma by a factor of 0.5:
  7799. @example
  7800. lutyuv=y=gammaval(0.5)
  7801. @end example
  7802. @item
  7803. Discard least significant bits of luma:
  7804. @example
  7805. lutyuv=y='bitand(val, 128+64+32)'
  7806. @end example
  7807. @item
  7808. Technicolor like effect:
  7809. @example
  7810. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  7811. @end example
  7812. @end itemize
  7813. @section lut2, tlut2
  7814. The @code{lut2} filter takes two input streams and outputs one
  7815. stream.
  7816. The @code{tlut2} (time lut2) filter takes two consecutive frames
  7817. from one single stream.
  7818. This filter accepts the following parameters:
  7819. @table @option
  7820. @item c0
  7821. set first pixel component expression
  7822. @item c1
  7823. set second pixel component expression
  7824. @item c2
  7825. set third pixel component expression
  7826. @item c3
  7827. set fourth pixel component expression, corresponds to the alpha component
  7828. @end table
  7829. Each of them specifies the expression to use for computing the lookup table for
  7830. the corresponding pixel component values.
  7831. The exact component associated to each of the @var{c*} options depends on the
  7832. format in inputs.
  7833. The expressions can contain the following constants:
  7834. @table @option
  7835. @item w
  7836. @item h
  7837. The input width and height.
  7838. @item x
  7839. The first input value for the pixel component.
  7840. @item y
  7841. The second input value for the pixel component.
  7842. @item bdx
  7843. The first input video bit depth.
  7844. @item bdy
  7845. The second input video bit depth.
  7846. @end table
  7847. All expressions default to "x".
  7848. @subsection Examples
  7849. @itemize
  7850. @item
  7851. Highlight differences between two RGB video streams:
  7852. @example
  7853. 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)'
  7854. @end example
  7855. @item
  7856. Highlight differences between two YUV video streams:
  7857. @example
  7858. 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)'
  7859. @end example
  7860. @item
  7861. Show max difference between two video streams:
  7862. @example
  7863. 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)))'
  7864. @end example
  7865. @end itemize
  7866. @section maskedclamp
  7867. Clamp the first input stream with the second input and third input stream.
  7868. Returns the value of first stream to be between second input
  7869. stream - @code{undershoot} and third input stream + @code{overshoot}.
  7870. This filter accepts the following options:
  7871. @table @option
  7872. @item undershoot
  7873. Default value is @code{0}.
  7874. @item overshoot
  7875. Default value is @code{0}.
  7876. @item planes
  7877. Set which planes will be processed as bitmap, unprocessed planes will be
  7878. copied from first stream.
  7879. By default value 0xf, all planes will be processed.
  7880. @end table
  7881. @section maskedmerge
  7882. Merge the first input stream with the second input stream using per pixel
  7883. weights in the third input stream.
  7884. A value of 0 in the third stream pixel component means that pixel component
  7885. from first stream is returned unchanged, while maximum value (eg. 255 for
  7886. 8-bit videos) means that pixel component from second stream is returned
  7887. unchanged. Intermediate values define the amount of merging between both
  7888. input stream's pixel components.
  7889. This filter accepts the following options:
  7890. @table @option
  7891. @item planes
  7892. Set which planes will be processed as bitmap, unprocessed planes will be
  7893. copied from first stream.
  7894. By default value 0xf, all planes will be processed.
  7895. @end table
  7896. @section mcdeint
  7897. Apply motion-compensation deinterlacing.
  7898. It needs one field per frame as input and must thus be used together
  7899. with yadif=1/3 or equivalent.
  7900. This filter accepts the following options:
  7901. @table @option
  7902. @item mode
  7903. Set the deinterlacing mode.
  7904. It accepts one of the following values:
  7905. @table @samp
  7906. @item fast
  7907. @item medium
  7908. @item slow
  7909. use iterative motion estimation
  7910. @item extra_slow
  7911. like @samp{slow}, but use multiple reference frames.
  7912. @end table
  7913. Default value is @samp{fast}.
  7914. @item parity
  7915. Set the picture field parity assumed for the input video. It must be
  7916. one of the following values:
  7917. @table @samp
  7918. @item 0, tff
  7919. assume top field first
  7920. @item 1, bff
  7921. assume bottom field first
  7922. @end table
  7923. Default value is @samp{bff}.
  7924. @item qp
  7925. Set per-block quantization parameter (QP) used by the internal
  7926. encoder.
  7927. Higher values should result in a smoother motion vector field but less
  7928. optimal individual vectors. Default value is 1.
  7929. @end table
  7930. @section mergeplanes
  7931. Merge color channel components from several video streams.
  7932. The filter accepts up to 4 input streams, and merge selected input
  7933. planes to the output video.
  7934. This filter accepts the following options:
  7935. @table @option
  7936. @item mapping
  7937. Set input to output plane mapping. Default is @code{0}.
  7938. The mappings is specified as a bitmap. It should be specified as a
  7939. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  7940. mapping for the first plane of the output stream. 'A' sets the number of
  7941. the input stream to use (from 0 to 3), and 'a' the plane number of the
  7942. corresponding input to use (from 0 to 3). The rest of the mappings is
  7943. similar, 'Bb' describes the mapping for the output stream second
  7944. plane, 'Cc' describes the mapping for the output stream third plane and
  7945. 'Dd' describes the mapping for the output stream fourth plane.
  7946. @item format
  7947. Set output pixel format. Default is @code{yuva444p}.
  7948. @end table
  7949. @subsection Examples
  7950. @itemize
  7951. @item
  7952. Merge three gray video streams of same width and height into single video stream:
  7953. @example
  7954. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  7955. @end example
  7956. @item
  7957. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  7958. @example
  7959. [a0][a1]mergeplanes=0x00010210:yuva444p
  7960. @end example
  7961. @item
  7962. Swap Y and A plane in yuva444p stream:
  7963. @example
  7964. format=yuva444p,mergeplanes=0x03010200:yuva444p
  7965. @end example
  7966. @item
  7967. Swap U and V plane in yuv420p stream:
  7968. @example
  7969. format=yuv420p,mergeplanes=0x000201:yuv420p
  7970. @end example
  7971. @item
  7972. Cast a rgb24 clip to yuv444p:
  7973. @example
  7974. format=rgb24,mergeplanes=0x000102:yuv444p
  7975. @end example
  7976. @end itemize
  7977. @section mestimate
  7978. Estimate and export motion vectors using block matching algorithms.
  7979. Motion vectors are stored in frame side data to be used by other filters.
  7980. This filter accepts the following options:
  7981. @table @option
  7982. @item method
  7983. Specify the motion estimation method. Accepts one of the following values:
  7984. @table @samp
  7985. @item esa
  7986. Exhaustive search algorithm.
  7987. @item tss
  7988. Three step search algorithm.
  7989. @item tdls
  7990. Two dimensional logarithmic search algorithm.
  7991. @item ntss
  7992. New three step search algorithm.
  7993. @item fss
  7994. Four step search algorithm.
  7995. @item ds
  7996. Diamond search algorithm.
  7997. @item hexbs
  7998. Hexagon-based search algorithm.
  7999. @item epzs
  8000. Enhanced predictive zonal search algorithm.
  8001. @item umh
  8002. Uneven multi-hexagon search algorithm.
  8003. @end table
  8004. Default value is @samp{esa}.
  8005. @item mb_size
  8006. Macroblock size. Default @code{16}.
  8007. @item search_param
  8008. Search parameter. Default @code{7}.
  8009. @end table
  8010. @section midequalizer
  8011. Apply Midway Image Equalization effect using two video streams.
  8012. Midway Image Equalization adjusts a pair of images to have the same
  8013. histogram, while maintaining their dynamics as much as possible. It's
  8014. useful for e.g. matching exposures from a pair of stereo cameras.
  8015. This filter has two inputs and one output, which must be of same pixel format, but
  8016. may be of different sizes. The output of filter is first input adjusted with
  8017. midway histogram of both inputs.
  8018. This filter accepts the following option:
  8019. @table @option
  8020. @item planes
  8021. Set which planes to process. Default is @code{15}, which is all available planes.
  8022. @end table
  8023. @section minterpolate
  8024. Convert the video to specified frame rate using motion interpolation.
  8025. This filter accepts the following options:
  8026. @table @option
  8027. @item fps
  8028. 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}.
  8029. @item mi_mode
  8030. Motion interpolation mode. Following values are accepted:
  8031. @table @samp
  8032. @item dup
  8033. Duplicate previous or next frame for interpolating new ones.
  8034. @item blend
  8035. Blend source frames. Interpolated frame is mean of previous and next frames.
  8036. @item mci
  8037. Motion compensated interpolation. Following options are effective when this mode is selected:
  8038. @table @samp
  8039. @item mc_mode
  8040. Motion compensation mode. Following values are accepted:
  8041. @table @samp
  8042. @item obmc
  8043. Overlapped block motion compensation.
  8044. @item aobmc
  8045. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  8046. @end table
  8047. Default mode is @samp{obmc}.
  8048. @item me_mode
  8049. Motion estimation mode. Following values are accepted:
  8050. @table @samp
  8051. @item bidir
  8052. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  8053. @item bilat
  8054. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  8055. @end table
  8056. Default mode is @samp{bilat}.
  8057. @item me
  8058. The algorithm to be used for motion estimation. Following values are accepted:
  8059. @table @samp
  8060. @item esa
  8061. Exhaustive search algorithm.
  8062. @item tss
  8063. Three step search algorithm.
  8064. @item tdls
  8065. Two dimensional logarithmic search algorithm.
  8066. @item ntss
  8067. New three step search algorithm.
  8068. @item fss
  8069. Four step search algorithm.
  8070. @item ds
  8071. Diamond search algorithm.
  8072. @item hexbs
  8073. Hexagon-based search algorithm.
  8074. @item epzs
  8075. Enhanced predictive zonal search algorithm.
  8076. @item umh
  8077. Uneven multi-hexagon search algorithm.
  8078. @end table
  8079. Default algorithm is @samp{epzs}.
  8080. @item mb_size
  8081. Macroblock size. Default @code{16}.
  8082. @item search_param
  8083. Motion estimation search parameter. Default @code{32}.
  8084. @item vsbmc
  8085. 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).
  8086. @end table
  8087. @end table
  8088. @item scd
  8089. 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:
  8090. @table @samp
  8091. @item none
  8092. Disable scene change detection.
  8093. @item fdiff
  8094. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  8095. @end table
  8096. Default method is @samp{fdiff}.
  8097. @item scd_threshold
  8098. Scene change detection threshold. Default is @code{5.0}.
  8099. @end table
  8100. @section mpdecimate
  8101. Drop frames that do not differ greatly from the previous frame in
  8102. order to reduce frame rate.
  8103. The main use of this filter is for very-low-bitrate encoding
  8104. (e.g. streaming over dialup modem), but it could in theory be used for
  8105. fixing movies that were inverse-telecined incorrectly.
  8106. A description of the accepted options follows.
  8107. @table @option
  8108. @item max
  8109. Set the maximum number of consecutive frames which can be dropped (if
  8110. positive), or the minimum interval between dropped frames (if
  8111. negative). If the value is 0, the frame is dropped disregarding the
  8112. number of previous sequentially dropped frames.
  8113. Default value is 0.
  8114. @item hi
  8115. @item lo
  8116. @item frac
  8117. Set the dropping threshold values.
  8118. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  8119. represent actual pixel value differences, so a threshold of 64
  8120. corresponds to 1 unit of difference for each pixel, or the same spread
  8121. out differently over the block.
  8122. A frame is a candidate for dropping if no 8x8 blocks differ by more
  8123. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  8124. meaning the whole image) differ by more than a threshold of @option{lo}.
  8125. Default value for @option{hi} is 64*12, default value for @option{lo} is
  8126. 64*5, and default value for @option{frac} is 0.33.
  8127. @end table
  8128. @section negate
  8129. Negate input video.
  8130. It accepts an integer in input; if non-zero it negates the
  8131. alpha component (if available). The default value in input is 0.
  8132. @section nlmeans
  8133. Denoise frames using Non-Local Means algorithm.
  8134. Each pixel is adjusted by looking for other pixels with similar contexts. This
  8135. context similarity is defined by comparing their surrounding patches of size
  8136. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  8137. around the pixel.
  8138. Note that the research area defines centers for patches, which means some
  8139. patches will be made of pixels outside that research area.
  8140. The filter accepts the following options.
  8141. @table @option
  8142. @item s
  8143. Set denoising strength.
  8144. @item p
  8145. Set patch size.
  8146. @item pc
  8147. Same as @option{p} but for chroma planes.
  8148. The default value is @var{0} and means automatic.
  8149. @item r
  8150. Set research size.
  8151. @item rc
  8152. Same as @option{r} but for chroma planes.
  8153. The default value is @var{0} and means automatic.
  8154. @end table
  8155. @section nnedi
  8156. Deinterlace video using neural network edge directed interpolation.
  8157. This filter accepts the following options:
  8158. @table @option
  8159. @item weights
  8160. Mandatory option, without binary file filter can not work.
  8161. Currently file can be found here:
  8162. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  8163. @item deint
  8164. Set which frames to deinterlace, by default it is @code{all}.
  8165. Can be @code{all} or @code{interlaced}.
  8166. @item field
  8167. Set mode of operation.
  8168. Can be one of the following:
  8169. @table @samp
  8170. @item af
  8171. Use frame flags, both fields.
  8172. @item a
  8173. Use frame flags, single field.
  8174. @item t
  8175. Use top field only.
  8176. @item b
  8177. Use bottom field only.
  8178. @item tf
  8179. Use both fields, top first.
  8180. @item bf
  8181. Use both fields, bottom first.
  8182. @end table
  8183. @item planes
  8184. Set which planes to process, by default filter process all frames.
  8185. @item nsize
  8186. Set size of local neighborhood around each pixel, used by the predictor neural
  8187. network.
  8188. Can be one of the following:
  8189. @table @samp
  8190. @item s8x6
  8191. @item s16x6
  8192. @item s32x6
  8193. @item s48x6
  8194. @item s8x4
  8195. @item s16x4
  8196. @item s32x4
  8197. @end table
  8198. @item nns
  8199. Set the number of neurons in predictor neural network.
  8200. Can be one of the following:
  8201. @table @samp
  8202. @item n16
  8203. @item n32
  8204. @item n64
  8205. @item n128
  8206. @item n256
  8207. @end table
  8208. @item qual
  8209. Controls the number of different neural network predictions that are blended
  8210. together to compute the final output value. Can be @code{fast}, default or
  8211. @code{slow}.
  8212. @item etype
  8213. Set which set of weights to use in the predictor.
  8214. Can be one of the following:
  8215. @table @samp
  8216. @item a
  8217. weights trained to minimize absolute error
  8218. @item s
  8219. weights trained to minimize squared error
  8220. @end table
  8221. @item pscrn
  8222. Controls whether or not the prescreener neural network is used to decide
  8223. which pixels should be processed by the predictor neural network and which
  8224. can be handled by simple cubic interpolation.
  8225. The prescreener is trained to know whether cubic interpolation will be
  8226. sufficient for a pixel or whether it should be predicted by the predictor nn.
  8227. The computational complexity of the prescreener nn is much less than that of
  8228. the predictor nn. Since most pixels can be handled by cubic interpolation,
  8229. using the prescreener generally results in much faster processing.
  8230. The prescreener is pretty accurate, so the difference between using it and not
  8231. using it is almost always unnoticeable.
  8232. Can be one of the following:
  8233. @table @samp
  8234. @item none
  8235. @item original
  8236. @item new
  8237. @end table
  8238. Default is @code{new}.
  8239. @item fapprox
  8240. Set various debugging flags.
  8241. @end table
  8242. @section noformat
  8243. Force libavfilter not to use any of the specified pixel formats for the
  8244. input to the next filter.
  8245. It accepts the following parameters:
  8246. @table @option
  8247. @item pix_fmts
  8248. A '|'-separated list of pixel format names, such as
  8249. pix_fmts=yuv420p|monow|rgb24".
  8250. @end table
  8251. @subsection Examples
  8252. @itemize
  8253. @item
  8254. Force libavfilter to use a format different from @var{yuv420p} for the
  8255. input to the vflip filter:
  8256. @example
  8257. noformat=pix_fmts=yuv420p,vflip
  8258. @end example
  8259. @item
  8260. Convert the input video to any of the formats not contained in the list:
  8261. @example
  8262. noformat=yuv420p|yuv444p|yuv410p
  8263. @end example
  8264. @end itemize
  8265. @section noise
  8266. Add noise on video input frame.
  8267. The filter accepts the following options:
  8268. @table @option
  8269. @item all_seed
  8270. @item c0_seed
  8271. @item c1_seed
  8272. @item c2_seed
  8273. @item c3_seed
  8274. Set noise seed for specific pixel component or all pixel components in case
  8275. of @var{all_seed}. Default value is @code{123457}.
  8276. @item all_strength, alls
  8277. @item c0_strength, c0s
  8278. @item c1_strength, c1s
  8279. @item c2_strength, c2s
  8280. @item c3_strength, c3s
  8281. Set noise strength for specific pixel component or all pixel components in case
  8282. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  8283. @item all_flags, allf
  8284. @item c0_flags, c0f
  8285. @item c1_flags, c1f
  8286. @item c2_flags, c2f
  8287. @item c3_flags, c3f
  8288. Set pixel component flags or set flags for all components if @var{all_flags}.
  8289. Available values for component flags are:
  8290. @table @samp
  8291. @item a
  8292. averaged temporal noise (smoother)
  8293. @item p
  8294. mix random noise with a (semi)regular pattern
  8295. @item t
  8296. temporal noise (noise pattern changes between frames)
  8297. @item u
  8298. uniform noise (gaussian otherwise)
  8299. @end table
  8300. @end table
  8301. @subsection Examples
  8302. Add temporal and uniform noise to input video:
  8303. @example
  8304. noise=alls=20:allf=t+u
  8305. @end example
  8306. @section null
  8307. Pass the video source unchanged to the output.
  8308. @section ocr
  8309. Optical Character Recognition
  8310. This filter uses Tesseract for optical character recognition.
  8311. It accepts the following options:
  8312. @table @option
  8313. @item datapath
  8314. Set datapath to tesseract data. Default is to use whatever was
  8315. set at installation.
  8316. @item language
  8317. Set language, default is "eng".
  8318. @item whitelist
  8319. Set character whitelist.
  8320. @item blacklist
  8321. Set character blacklist.
  8322. @end table
  8323. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  8324. @section ocv
  8325. Apply a video transform using libopencv.
  8326. To enable this filter, install the libopencv library and headers and
  8327. configure FFmpeg with @code{--enable-libopencv}.
  8328. It accepts the following parameters:
  8329. @table @option
  8330. @item filter_name
  8331. The name of the libopencv filter to apply.
  8332. @item filter_params
  8333. The parameters to pass to the libopencv filter. If not specified, the default
  8334. values are assumed.
  8335. @end table
  8336. Refer to the official libopencv documentation for more precise
  8337. information:
  8338. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  8339. Several libopencv filters are supported; see the following subsections.
  8340. @anchor{dilate}
  8341. @subsection dilate
  8342. Dilate an image by using a specific structuring element.
  8343. It corresponds to the libopencv function @code{cvDilate}.
  8344. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  8345. @var{struct_el} represents a structuring element, and has the syntax:
  8346. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  8347. @var{cols} and @var{rows} represent the number of columns and rows of
  8348. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  8349. point, and @var{shape} the shape for the structuring element. @var{shape}
  8350. must be "rect", "cross", "ellipse", or "custom".
  8351. If the value for @var{shape} is "custom", it must be followed by a
  8352. string of the form "=@var{filename}". The file with name
  8353. @var{filename} is assumed to represent a binary image, with each
  8354. printable character corresponding to a bright pixel. When a custom
  8355. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  8356. or columns and rows of the read file are assumed instead.
  8357. The default value for @var{struct_el} is "3x3+0x0/rect".
  8358. @var{nb_iterations} specifies the number of times the transform is
  8359. applied to the image, and defaults to 1.
  8360. Some examples:
  8361. @example
  8362. # Use the default values
  8363. ocv=dilate
  8364. # Dilate using a structuring element with a 5x5 cross, iterating two times
  8365. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  8366. # Read the shape from the file diamond.shape, iterating two times.
  8367. # The file diamond.shape may contain a pattern of characters like this
  8368. # *
  8369. # ***
  8370. # *****
  8371. # ***
  8372. # *
  8373. # The specified columns and rows are ignored
  8374. # but the anchor point coordinates are not
  8375. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  8376. @end example
  8377. @subsection erode
  8378. Erode an image by using a specific structuring element.
  8379. It corresponds to the libopencv function @code{cvErode}.
  8380. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  8381. with the same syntax and semantics as the @ref{dilate} filter.
  8382. @subsection smooth
  8383. Smooth the input video.
  8384. The filter takes the following parameters:
  8385. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  8386. @var{type} is the type of smooth filter to apply, and must be one of
  8387. the following values: "blur", "blur_no_scale", "median", "gaussian",
  8388. or "bilateral". The default value is "gaussian".
  8389. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  8390. depend on the smooth type. @var{param1} and
  8391. @var{param2} accept integer positive values or 0. @var{param3} and
  8392. @var{param4} accept floating point values.
  8393. The default value for @var{param1} is 3. The default value for the
  8394. other parameters is 0.
  8395. These parameters correspond to the parameters assigned to the
  8396. libopencv function @code{cvSmooth}.
  8397. @section oscilloscope
  8398. 2D Video Oscilloscope.
  8399. Useful to measure spatial impulse, step responses, chroma delays, etc.
  8400. It accepts the following parameters:
  8401. @table @option
  8402. @item x
  8403. Set scope center x position.
  8404. @item y
  8405. Set scope center y position.
  8406. @item s
  8407. Set scope size, relative to frame diagonal.
  8408. @item t
  8409. Set scope tilt/rotation.
  8410. @item o
  8411. Set trace opacity.
  8412. @item tx
  8413. Set trace center x position.
  8414. @item ty
  8415. Set trace center y position.
  8416. @item tw
  8417. Set trace width, relative to width of frame.
  8418. @item th
  8419. Set trace height, relative to height of frame.
  8420. @item c
  8421. Set which components to trace. By default it traces first three components.
  8422. @item g
  8423. Draw trace grid. By default is enabled.
  8424. @item st
  8425. Draw some statistics. By default is enabled.
  8426. @item sc
  8427. Draw scope. By default is enabled.
  8428. @end table
  8429. @subsection Examples
  8430. @itemize
  8431. @item
  8432. Inspect full first row of video frame.
  8433. @example
  8434. oscilloscope=x=0.5:y=0:s=1
  8435. @end example
  8436. @item
  8437. Inspect full last row of video frame.
  8438. @example
  8439. oscilloscope=x=0.5:y=1:s=1
  8440. @end example
  8441. @item
  8442. Inspect full 5th line of video frame of height 1080.
  8443. @example
  8444. oscilloscope=x=0.5:y=5/1080:s=1
  8445. @end example
  8446. @item
  8447. Inspect full last column of video frame.
  8448. @example
  8449. oscilloscope=x=1:y=0.5:s=1:t=1
  8450. @end example
  8451. @end itemize
  8452. @anchor{overlay}
  8453. @section overlay
  8454. Overlay one video on top of another.
  8455. It takes two inputs and has one output. The first input is the "main"
  8456. video on which the second input is overlaid.
  8457. It accepts the following parameters:
  8458. A description of the accepted options follows.
  8459. @table @option
  8460. @item x
  8461. @item y
  8462. Set the expression for the x and y coordinates of the overlaid video
  8463. on the main video. Default value is "0" for both expressions. In case
  8464. the expression is invalid, it is set to a huge value (meaning that the
  8465. overlay will not be displayed within the output visible area).
  8466. @item eof_action
  8467. See @ref{framesync}.
  8468. @item eval
  8469. Set when the expressions for @option{x}, and @option{y} are evaluated.
  8470. It accepts the following values:
  8471. @table @samp
  8472. @item init
  8473. only evaluate expressions once during the filter initialization or
  8474. when a command is processed
  8475. @item frame
  8476. evaluate expressions for each incoming frame
  8477. @end table
  8478. Default value is @samp{frame}.
  8479. @item shortest
  8480. See @ref{framesync}.
  8481. @item format
  8482. Set the format for the output video.
  8483. It accepts the following values:
  8484. @table @samp
  8485. @item yuv420
  8486. force YUV420 output
  8487. @item yuv422
  8488. force YUV422 output
  8489. @item yuv444
  8490. force YUV444 output
  8491. @item rgb
  8492. force packed RGB output
  8493. @item gbrp
  8494. force planar RGB output
  8495. @item auto
  8496. automatically pick format
  8497. @end table
  8498. Default value is @samp{yuv420}.
  8499. @item repeatlast
  8500. See @ref{framesync}.
  8501. @end table
  8502. The @option{x}, and @option{y} expressions can contain the following
  8503. parameters.
  8504. @table @option
  8505. @item main_w, W
  8506. @item main_h, H
  8507. The main input width and height.
  8508. @item overlay_w, w
  8509. @item overlay_h, h
  8510. The overlay input width and height.
  8511. @item x
  8512. @item y
  8513. The computed values for @var{x} and @var{y}. They are evaluated for
  8514. each new frame.
  8515. @item hsub
  8516. @item vsub
  8517. horizontal and vertical chroma subsample values of the output
  8518. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  8519. @var{vsub} is 1.
  8520. @item n
  8521. the number of input frame, starting from 0
  8522. @item pos
  8523. the position in the file of the input frame, NAN if unknown
  8524. @item t
  8525. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  8526. @end table
  8527. This filter also supports the @ref{framesync} options.
  8528. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  8529. when evaluation is done @emph{per frame}, and will evaluate to NAN
  8530. when @option{eval} is set to @samp{init}.
  8531. Be aware that frames are taken from each input video in timestamp
  8532. order, hence, if their initial timestamps differ, it is a good idea
  8533. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  8534. have them begin in the same zero timestamp, as the example for
  8535. the @var{movie} filter does.
  8536. You can chain together more overlays but you should test the
  8537. efficiency of such approach.
  8538. @subsection Commands
  8539. This filter supports the following commands:
  8540. @table @option
  8541. @item x
  8542. @item y
  8543. Modify the x and y of the overlay input.
  8544. The command accepts the same syntax of the corresponding option.
  8545. If the specified expression is not valid, it is kept at its current
  8546. value.
  8547. @end table
  8548. @subsection Examples
  8549. @itemize
  8550. @item
  8551. Draw the overlay at 10 pixels from the bottom right corner of the main
  8552. video:
  8553. @example
  8554. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  8555. @end example
  8556. Using named options the example above becomes:
  8557. @example
  8558. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  8559. @end example
  8560. @item
  8561. Insert a transparent PNG logo in the bottom left corner of the input,
  8562. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  8563. @example
  8564. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  8565. @end example
  8566. @item
  8567. Insert 2 different transparent PNG logos (second logo on bottom
  8568. right corner) using the @command{ffmpeg} tool:
  8569. @example
  8570. 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
  8571. @end example
  8572. @item
  8573. Add a transparent color layer on top of the main video; @code{WxH}
  8574. must specify the size of the main input to the overlay filter:
  8575. @example
  8576. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  8577. @end example
  8578. @item
  8579. Play an original video and a filtered version (here with the deshake
  8580. filter) side by side using the @command{ffplay} tool:
  8581. @example
  8582. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  8583. @end example
  8584. The above command is the same as:
  8585. @example
  8586. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  8587. @end example
  8588. @item
  8589. Make a sliding overlay appearing from the left to the right top part of the
  8590. screen starting since time 2:
  8591. @example
  8592. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  8593. @end example
  8594. @item
  8595. Compose output by putting two input videos side to side:
  8596. @example
  8597. ffmpeg -i left.avi -i right.avi -filter_complex "
  8598. nullsrc=size=200x100 [background];
  8599. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  8600. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  8601. [background][left] overlay=shortest=1 [background+left];
  8602. [background+left][right] overlay=shortest=1:x=100 [left+right]
  8603. "
  8604. @end example
  8605. @item
  8606. Mask 10-20 seconds of a video by applying the delogo filter to a section
  8607. @example
  8608. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  8609. -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]'
  8610. masked.avi
  8611. @end example
  8612. @item
  8613. Chain several overlays in cascade:
  8614. @example
  8615. nullsrc=s=200x200 [bg];
  8616. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  8617. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  8618. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  8619. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  8620. [in3] null, [mid2] overlay=100:100 [out0]
  8621. @end example
  8622. @end itemize
  8623. @section owdenoise
  8624. Apply Overcomplete Wavelet denoiser.
  8625. The filter accepts the following options:
  8626. @table @option
  8627. @item depth
  8628. Set depth.
  8629. Larger depth values will denoise lower frequency components more, but
  8630. slow down filtering.
  8631. Must be an int in the range 8-16, default is @code{8}.
  8632. @item luma_strength, ls
  8633. Set luma strength.
  8634. Must be a double value in the range 0-1000, default is @code{1.0}.
  8635. @item chroma_strength, cs
  8636. Set chroma strength.
  8637. Must be a double value in the range 0-1000, default is @code{1.0}.
  8638. @end table
  8639. @anchor{pad}
  8640. @section pad
  8641. Add paddings to the input image, and place the original input at the
  8642. provided @var{x}, @var{y} coordinates.
  8643. It accepts the following parameters:
  8644. @table @option
  8645. @item width, w
  8646. @item height, h
  8647. Specify an expression for the size of the output image with the
  8648. paddings added. If the value for @var{width} or @var{height} is 0, the
  8649. corresponding input size is used for the output.
  8650. The @var{width} expression can reference the value set by the
  8651. @var{height} expression, and vice versa.
  8652. The default value of @var{width} and @var{height} is 0.
  8653. @item x
  8654. @item y
  8655. Specify the offsets to place the input image at within the padded area,
  8656. with respect to the top/left border of the output image.
  8657. The @var{x} expression can reference the value set by the @var{y}
  8658. expression, and vice versa.
  8659. The default value of @var{x} and @var{y} is 0.
  8660. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  8661. so the input image is centered on the padded area.
  8662. @item color
  8663. Specify the color of the padded area. For the syntax of this option,
  8664. check the "Color" section in the ffmpeg-utils manual.
  8665. The default value of @var{color} is "black".
  8666. @item eval
  8667. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  8668. It accepts the following values:
  8669. @table @samp
  8670. @item init
  8671. Only evaluate expressions once during the filter initialization or when
  8672. a command is processed.
  8673. @item frame
  8674. Evaluate expressions for each incoming frame.
  8675. @end table
  8676. Default value is @samp{init}.
  8677. @item aspect
  8678. Pad to aspect instead to a resolution.
  8679. @end table
  8680. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  8681. options are expressions containing the following constants:
  8682. @table @option
  8683. @item in_w
  8684. @item in_h
  8685. The input video width and height.
  8686. @item iw
  8687. @item ih
  8688. These are the same as @var{in_w} and @var{in_h}.
  8689. @item out_w
  8690. @item out_h
  8691. The output width and height (the size of the padded area), as
  8692. specified by the @var{width} and @var{height} expressions.
  8693. @item ow
  8694. @item oh
  8695. These are the same as @var{out_w} and @var{out_h}.
  8696. @item x
  8697. @item y
  8698. The x and y offsets as specified by the @var{x} and @var{y}
  8699. expressions, or NAN if not yet specified.
  8700. @item a
  8701. same as @var{iw} / @var{ih}
  8702. @item sar
  8703. input sample aspect ratio
  8704. @item dar
  8705. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  8706. @item hsub
  8707. @item vsub
  8708. The horizontal and vertical chroma subsample values. For example for the
  8709. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8710. @end table
  8711. @subsection Examples
  8712. @itemize
  8713. @item
  8714. Add paddings with the color "violet" to the input video. The output video
  8715. size is 640x480, and the top-left corner of the input video is placed at
  8716. column 0, row 40
  8717. @example
  8718. pad=640:480:0:40:violet
  8719. @end example
  8720. The example above is equivalent to the following command:
  8721. @example
  8722. pad=width=640:height=480:x=0:y=40:color=violet
  8723. @end example
  8724. @item
  8725. Pad the input to get an output with dimensions increased by 3/2,
  8726. and put the input video at the center of the padded area:
  8727. @example
  8728. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  8729. @end example
  8730. @item
  8731. Pad the input to get a squared output with size equal to the maximum
  8732. value between the input width and height, and put the input video at
  8733. the center of the padded area:
  8734. @example
  8735. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  8736. @end example
  8737. @item
  8738. Pad the input to get a final w/h ratio of 16:9:
  8739. @example
  8740. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  8741. @end example
  8742. @item
  8743. In case of anamorphic video, in order to set the output display aspect
  8744. correctly, it is necessary to use @var{sar} in the expression,
  8745. according to the relation:
  8746. @example
  8747. (ih * X / ih) * sar = output_dar
  8748. X = output_dar / sar
  8749. @end example
  8750. Thus the previous example needs to be modified to:
  8751. @example
  8752. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  8753. @end example
  8754. @item
  8755. Double the output size and put the input video in the bottom-right
  8756. corner of the output padded area:
  8757. @example
  8758. pad="2*iw:2*ih:ow-iw:oh-ih"
  8759. @end example
  8760. @end itemize
  8761. @anchor{palettegen}
  8762. @section palettegen
  8763. Generate one palette for a whole video stream.
  8764. It accepts the following options:
  8765. @table @option
  8766. @item max_colors
  8767. Set the maximum number of colors to quantize in the palette.
  8768. Note: the palette will still contain 256 colors; the unused palette entries
  8769. will be black.
  8770. @item reserve_transparent
  8771. Create a palette of 255 colors maximum and reserve the last one for
  8772. transparency. Reserving the transparency color is useful for GIF optimization.
  8773. If not set, the maximum of colors in the palette will be 256. You probably want
  8774. to disable this option for a standalone image.
  8775. Set by default.
  8776. @item transparency_color
  8777. Set the color that will be used as background for transparency.
  8778. @item stats_mode
  8779. Set statistics mode.
  8780. It accepts the following values:
  8781. @table @samp
  8782. @item full
  8783. Compute full frame histograms.
  8784. @item diff
  8785. Compute histograms only for the part that differs from previous frame. This
  8786. might be relevant to give more importance to the moving part of your input if
  8787. the background is static.
  8788. @item single
  8789. Compute new histogram for each frame.
  8790. @end table
  8791. Default value is @var{full}.
  8792. @end table
  8793. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  8794. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  8795. color quantization of the palette. This information is also visible at
  8796. @var{info} logging level.
  8797. @subsection Examples
  8798. @itemize
  8799. @item
  8800. Generate a representative palette of a given video using @command{ffmpeg}:
  8801. @example
  8802. ffmpeg -i input.mkv -vf palettegen palette.png
  8803. @end example
  8804. @end itemize
  8805. @section paletteuse
  8806. Use a palette to downsample an input video stream.
  8807. The filter takes two inputs: one video stream and a palette. The palette must
  8808. be a 256 pixels image.
  8809. It accepts the following options:
  8810. @table @option
  8811. @item dither
  8812. Select dithering mode. Available algorithms are:
  8813. @table @samp
  8814. @item bayer
  8815. Ordered 8x8 bayer dithering (deterministic)
  8816. @item heckbert
  8817. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  8818. Note: this dithering is sometimes considered "wrong" and is included as a
  8819. reference.
  8820. @item floyd_steinberg
  8821. Floyd and Steingberg dithering (error diffusion)
  8822. @item sierra2
  8823. Frankie Sierra dithering v2 (error diffusion)
  8824. @item sierra2_4a
  8825. Frankie Sierra dithering v2 "Lite" (error diffusion)
  8826. @end table
  8827. Default is @var{sierra2_4a}.
  8828. @item bayer_scale
  8829. When @var{bayer} dithering is selected, this option defines the scale of the
  8830. pattern (how much the crosshatch pattern is visible). A low value means more
  8831. visible pattern for less banding, and higher value means less visible pattern
  8832. at the cost of more banding.
  8833. The option must be an integer value in the range [0,5]. Default is @var{2}.
  8834. @item diff_mode
  8835. If set, define the zone to process
  8836. @table @samp
  8837. @item rectangle
  8838. Only the changing rectangle will be reprocessed. This is similar to GIF
  8839. cropping/offsetting compression mechanism. This option can be useful for speed
  8840. if only a part of the image is changing, and has use cases such as limiting the
  8841. scope of the error diffusal @option{dither} to the rectangle that bounds the
  8842. moving scene (it leads to more deterministic output if the scene doesn't change
  8843. much, and as a result less moving noise and better GIF compression).
  8844. @end table
  8845. Default is @var{none}.
  8846. @item new
  8847. Take new palette for each output frame.
  8848. @item alpha_threshold
  8849. Sets the alpha threshold for transparency. Alpha values above this threshold
  8850. will be treated as completely opaque, and values below this threshold will be
  8851. treated as completely transparent.
  8852. The option must be an integer value in the range [0,255]. Default is @var{128}.
  8853. @end table
  8854. @subsection Examples
  8855. @itemize
  8856. @item
  8857. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  8858. using @command{ffmpeg}:
  8859. @example
  8860. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  8861. @end example
  8862. @end itemize
  8863. @section perspective
  8864. Correct perspective of video not recorded perpendicular to the screen.
  8865. A description of the accepted parameters follows.
  8866. @table @option
  8867. @item x0
  8868. @item y0
  8869. @item x1
  8870. @item y1
  8871. @item x2
  8872. @item y2
  8873. @item x3
  8874. @item y3
  8875. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  8876. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  8877. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  8878. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  8879. then the corners of the source will be sent to the specified coordinates.
  8880. The expressions can use the following variables:
  8881. @table @option
  8882. @item W
  8883. @item H
  8884. the width and height of video frame.
  8885. @item in
  8886. Input frame count.
  8887. @item on
  8888. Output frame count.
  8889. @end table
  8890. @item interpolation
  8891. Set interpolation for perspective correction.
  8892. It accepts the following values:
  8893. @table @samp
  8894. @item linear
  8895. @item cubic
  8896. @end table
  8897. Default value is @samp{linear}.
  8898. @item sense
  8899. Set interpretation of coordinate options.
  8900. It accepts the following values:
  8901. @table @samp
  8902. @item 0, source
  8903. Send point in the source specified by the given coordinates to
  8904. the corners of the destination.
  8905. @item 1, destination
  8906. Send the corners of the source to the point in the destination specified
  8907. by the given coordinates.
  8908. Default value is @samp{source}.
  8909. @end table
  8910. @item eval
  8911. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  8912. It accepts the following values:
  8913. @table @samp
  8914. @item init
  8915. only evaluate expressions once during the filter initialization or
  8916. when a command is processed
  8917. @item frame
  8918. evaluate expressions for each incoming frame
  8919. @end table
  8920. Default value is @samp{init}.
  8921. @end table
  8922. @section phase
  8923. Delay interlaced video by one field time so that the field order changes.
  8924. The intended use is to fix PAL movies that have been captured with the
  8925. opposite field order to the film-to-video transfer.
  8926. A description of the accepted parameters follows.
  8927. @table @option
  8928. @item mode
  8929. Set phase mode.
  8930. It accepts the following values:
  8931. @table @samp
  8932. @item t
  8933. Capture field order top-first, transfer bottom-first.
  8934. Filter will delay the bottom field.
  8935. @item b
  8936. Capture field order bottom-first, transfer top-first.
  8937. Filter will delay the top field.
  8938. @item p
  8939. Capture and transfer with the same field order. This mode only exists
  8940. for the documentation of the other options to refer to, but if you
  8941. actually select it, the filter will faithfully do nothing.
  8942. @item a
  8943. Capture field order determined automatically by field flags, transfer
  8944. opposite.
  8945. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  8946. basis using field flags. If no field information is available,
  8947. then this works just like @samp{u}.
  8948. @item u
  8949. Capture unknown or varying, transfer opposite.
  8950. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  8951. analyzing the images and selecting the alternative that produces best
  8952. match between the fields.
  8953. @item T
  8954. Capture top-first, transfer unknown or varying.
  8955. Filter selects among @samp{t} and @samp{p} using image analysis.
  8956. @item B
  8957. Capture bottom-first, transfer unknown or varying.
  8958. Filter selects among @samp{b} and @samp{p} using image analysis.
  8959. @item A
  8960. Capture determined by field flags, transfer unknown or varying.
  8961. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  8962. image analysis. If no field information is available, then this works just
  8963. like @samp{U}. This is the default mode.
  8964. @item U
  8965. Both capture and transfer unknown or varying.
  8966. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  8967. @end table
  8968. @end table
  8969. @section pixdesctest
  8970. Pixel format descriptor test filter, mainly useful for internal
  8971. testing. The output video should be equal to the input video.
  8972. For example:
  8973. @example
  8974. format=monow, pixdesctest
  8975. @end example
  8976. can be used to test the monowhite pixel format descriptor definition.
  8977. @section pixscope
  8978. Display sample values of color channels. Mainly useful for checking color
  8979. and levels. Minimum supported resolution is 640x480.
  8980. The filters accept the following options:
  8981. @table @option
  8982. @item x
  8983. Set scope X position, relative offset on X axis.
  8984. @item y
  8985. Set scope Y position, relative offset on Y axis.
  8986. @item w
  8987. Set scope width.
  8988. @item h
  8989. Set scope height.
  8990. @item o
  8991. Set window opacity. This window also holds statistics about pixel area.
  8992. @item wx
  8993. Set window X position, relative offset on X axis.
  8994. @item wy
  8995. Set window Y position, relative offset on Y axis.
  8996. @end table
  8997. @section pp
  8998. Enable the specified chain of postprocessing subfilters using libpostproc. This
  8999. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  9000. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  9001. Each subfilter and some options have a short and a long name that can be used
  9002. interchangeably, i.e. dr/dering are the same.
  9003. The filters accept the following options:
  9004. @table @option
  9005. @item subfilters
  9006. Set postprocessing subfilters string.
  9007. @end table
  9008. All subfilters share common options to determine their scope:
  9009. @table @option
  9010. @item a/autoq
  9011. Honor the quality commands for this subfilter.
  9012. @item c/chrom
  9013. Do chrominance filtering, too (default).
  9014. @item y/nochrom
  9015. Do luminance filtering only (no chrominance).
  9016. @item n/noluma
  9017. Do chrominance filtering only (no luminance).
  9018. @end table
  9019. These options can be appended after the subfilter name, separated by a '|'.
  9020. Available subfilters are:
  9021. @table @option
  9022. @item hb/hdeblock[|difference[|flatness]]
  9023. Horizontal deblocking filter
  9024. @table @option
  9025. @item difference
  9026. Difference factor where higher values mean more deblocking (default: @code{32}).
  9027. @item flatness
  9028. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9029. @end table
  9030. @item vb/vdeblock[|difference[|flatness]]
  9031. Vertical deblocking filter
  9032. @table @option
  9033. @item difference
  9034. Difference factor where higher values mean more deblocking (default: @code{32}).
  9035. @item flatness
  9036. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9037. @end table
  9038. @item ha/hadeblock[|difference[|flatness]]
  9039. Accurate horizontal deblocking filter
  9040. @table @option
  9041. @item difference
  9042. Difference factor where higher values mean more deblocking (default: @code{32}).
  9043. @item flatness
  9044. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9045. @end table
  9046. @item va/vadeblock[|difference[|flatness]]
  9047. Accurate vertical deblocking filter
  9048. @table @option
  9049. @item difference
  9050. Difference factor where higher values mean more deblocking (default: @code{32}).
  9051. @item flatness
  9052. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9053. @end table
  9054. @end table
  9055. The horizontal and vertical deblocking filters share the difference and
  9056. flatness values so you cannot set different horizontal and vertical
  9057. thresholds.
  9058. @table @option
  9059. @item h1/x1hdeblock
  9060. Experimental horizontal deblocking filter
  9061. @item v1/x1vdeblock
  9062. Experimental vertical deblocking filter
  9063. @item dr/dering
  9064. Deringing filter
  9065. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  9066. @table @option
  9067. @item threshold1
  9068. larger -> stronger filtering
  9069. @item threshold2
  9070. larger -> stronger filtering
  9071. @item threshold3
  9072. larger -> stronger filtering
  9073. @end table
  9074. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  9075. @table @option
  9076. @item f/fullyrange
  9077. Stretch luminance to @code{0-255}.
  9078. @end table
  9079. @item lb/linblenddeint
  9080. Linear blend deinterlacing filter that deinterlaces the given block by
  9081. filtering all lines with a @code{(1 2 1)} filter.
  9082. @item li/linipoldeint
  9083. Linear interpolating deinterlacing filter that deinterlaces the given block by
  9084. linearly interpolating every second line.
  9085. @item ci/cubicipoldeint
  9086. Cubic interpolating deinterlacing filter deinterlaces the given block by
  9087. cubically interpolating every second line.
  9088. @item md/mediandeint
  9089. Median deinterlacing filter that deinterlaces the given block by applying a
  9090. median filter to every second line.
  9091. @item fd/ffmpegdeint
  9092. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  9093. second line with a @code{(-1 4 2 4 -1)} filter.
  9094. @item l5/lowpass5
  9095. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  9096. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  9097. @item fq/forceQuant[|quantizer]
  9098. Overrides the quantizer table from the input with the constant quantizer you
  9099. specify.
  9100. @table @option
  9101. @item quantizer
  9102. Quantizer to use
  9103. @end table
  9104. @item de/default
  9105. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  9106. @item fa/fast
  9107. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  9108. @item ac
  9109. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  9110. @end table
  9111. @subsection Examples
  9112. @itemize
  9113. @item
  9114. Apply horizontal and vertical deblocking, deringing and automatic
  9115. brightness/contrast:
  9116. @example
  9117. pp=hb/vb/dr/al
  9118. @end example
  9119. @item
  9120. Apply default filters without brightness/contrast correction:
  9121. @example
  9122. pp=de/-al
  9123. @end example
  9124. @item
  9125. Apply default filters and temporal denoiser:
  9126. @example
  9127. pp=default/tmpnoise|1|2|3
  9128. @end example
  9129. @item
  9130. Apply deblocking on luminance only, and switch vertical deblocking on or off
  9131. automatically depending on available CPU time:
  9132. @example
  9133. pp=hb|y/vb|a
  9134. @end example
  9135. @end itemize
  9136. @section pp7
  9137. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  9138. similar to spp = 6 with 7 point DCT, where only the center sample is
  9139. used after IDCT.
  9140. The filter accepts the following options:
  9141. @table @option
  9142. @item qp
  9143. Force a constant quantization parameter. It accepts an integer in range
  9144. 0 to 63. If not set, the filter will use the QP from the video stream
  9145. (if available).
  9146. @item mode
  9147. Set thresholding mode. Available modes are:
  9148. @table @samp
  9149. @item hard
  9150. Set hard thresholding.
  9151. @item soft
  9152. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9153. @item medium
  9154. Set medium thresholding (good results, default).
  9155. @end table
  9156. @end table
  9157. @section premultiply
  9158. Apply alpha premultiply effect to input video stream using first plane
  9159. of second stream as alpha.
  9160. Both streams must have same dimensions and same pixel format.
  9161. The filter accepts the following option:
  9162. @table @option
  9163. @item planes
  9164. Set which planes will be processed, unprocessed planes will be copied.
  9165. By default value 0xf, all planes will be processed.
  9166. @item inplace
  9167. Do not require 2nd input for processing, instead use alpha plane from input stream.
  9168. @end table
  9169. @section prewitt
  9170. Apply prewitt operator to input video stream.
  9171. The filter accepts the following option:
  9172. @table @option
  9173. @item planes
  9174. Set which planes will be processed, unprocessed planes will be copied.
  9175. By default value 0xf, all planes will be processed.
  9176. @item scale
  9177. Set value which will be multiplied with filtered result.
  9178. @item delta
  9179. Set value which will be added to filtered result.
  9180. @end table
  9181. @section pseudocolor
  9182. Alter frame colors in video with pseudocolors.
  9183. This filter accept the following options:
  9184. @table @option
  9185. @item c0
  9186. set pixel first component expression
  9187. @item c1
  9188. set pixel second component expression
  9189. @item c2
  9190. set pixel third component expression
  9191. @item c3
  9192. set pixel fourth component expression, corresponds to the alpha component
  9193. @item i
  9194. set component to use as base for altering colors
  9195. @end table
  9196. Each of them specifies the expression to use for computing the lookup table for
  9197. the corresponding pixel component values.
  9198. The expressions can contain the following constants and functions:
  9199. @table @option
  9200. @item w
  9201. @item h
  9202. The input width and height.
  9203. @item val
  9204. The input value for the pixel component.
  9205. @item ymin, umin, vmin, amin
  9206. The minimum allowed component value.
  9207. @item ymax, umax, vmax, amax
  9208. The maximum allowed component value.
  9209. @end table
  9210. All expressions default to "val".
  9211. @subsection Examples
  9212. @itemize
  9213. @item
  9214. Change too high luma values to gradient:
  9215. @example
  9216. 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'"
  9217. @end example
  9218. @end itemize
  9219. @section psnr
  9220. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  9221. Ratio) between two input videos.
  9222. This filter takes in input two input videos, the first input is
  9223. considered the "main" source and is passed unchanged to the
  9224. output. The second input is used as a "reference" video for computing
  9225. the PSNR.
  9226. Both video inputs must have the same resolution and pixel format for
  9227. this filter to work correctly. Also it assumes that both inputs
  9228. have the same number of frames, which are compared one by one.
  9229. The obtained average PSNR is printed through the logging system.
  9230. The filter stores the accumulated MSE (mean squared error) of each
  9231. frame, and at the end of the processing it is averaged across all frames
  9232. equally, and the following formula is applied to obtain the PSNR:
  9233. @example
  9234. PSNR = 10*log10(MAX^2/MSE)
  9235. @end example
  9236. Where MAX is the average of the maximum values of each component of the
  9237. image.
  9238. The description of the accepted parameters follows.
  9239. @table @option
  9240. @item stats_file, f
  9241. If specified the filter will use the named file to save the PSNR of
  9242. each individual frame. When filename equals "-" the data is sent to
  9243. standard output.
  9244. @item stats_version
  9245. Specifies which version of the stats file format to use. Details of
  9246. each format are written below.
  9247. Default value is 1.
  9248. @item stats_add_max
  9249. Determines whether the max value is output to the stats log.
  9250. Default value is 0.
  9251. Requires stats_version >= 2. If this is set and stats_version < 2,
  9252. the filter will return an error.
  9253. @end table
  9254. This filter also supports the @ref{framesync} options.
  9255. The file printed if @var{stats_file} is selected, contains a sequence of
  9256. key/value pairs of the form @var{key}:@var{value} for each compared
  9257. couple of frames.
  9258. If a @var{stats_version} greater than 1 is specified, a header line precedes
  9259. the list of per-frame-pair stats, with key value pairs following the frame
  9260. format with the following parameters:
  9261. @table @option
  9262. @item psnr_log_version
  9263. The version of the log file format. Will match @var{stats_version}.
  9264. @item fields
  9265. A comma separated list of the per-frame-pair parameters included in
  9266. the log.
  9267. @end table
  9268. A description of each shown per-frame-pair parameter follows:
  9269. @table @option
  9270. @item n
  9271. sequential number of the input frame, starting from 1
  9272. @item mse_avg
  9273. Mean Square Error pixel-by-pixel average difference of the compared
  9274. frames, averaged over all the image components.
  9275. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  9276. Mean Square Error pixel-by-pixel average difference of the compared
  9277. frames for the component specified by the suffix.
  9278. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  9279. Peak Signal to Noise ratio of the compared frames for the component
  9280. specified by the suffix.
  9281. @item max_avg, max_y, max_u, max_v
  9282. Maximum allowed value for each channel, and average over all
  9283. channels.
  9284. @end table
  9285. For example:
  9286. @example
  9287. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9288. [main][ref] psnr="stats_file=stats.log" [out]
  9289. @end example
  9290. On this example the input file being processed is compared with the
  9291. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  9292. is stored in @file{stats.log}.
  9293. @anchor{pullup}
  9294. @section pullup
  9295. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  9296. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  9297. content.
  9298. The pullup filter is designed to take advantage of future context in making
  9299. its decisions. This filter is stateless in the sense that it does not lock
  9300. onto a pattern to follow, but it instead looks forward to the following
  9301. fields in order to identify matches and rebuild progressive frames.
  9302. To produce content with an even framerate, insert the fps filter after
  9303. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  9304. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  9305. The filter accepts the following options:
  9306. @table @option
  9307. @item jl
  9308. @item jr
  9309. @item jt
  9310. @item jb
  9311. These options set the amount of "junk" to ignore at the left, right, top, and
  9312. bottom of the image, respectively. Left and right are in units of 8 pixels,
  9313. while top and bottom are in units of 2 lines.
  9314. The default is 8 pixels on each side.
  9315. @item sb
  9316. Set the strict breaks. Setting this option to 1 will reduce the chances of
  9317. filter generating an occasional mismatched frame, but it may also cause an
  9318. excessive number of frames to be dropped during high motion sequences.
  9319. Conversely, setting it to -1 will make filter match fields more easily.
  9320. This may help processing of video where there is slight blurring between
  9321. the fields, but may also cause there to be interlaced frames in the output.
  9322. Default value is @code{0}.
  9323. @item mp
  9324. Set the metric plane to use. It accepts the following values:
  9325. @table @samp
  9326. @item l
  9327. Use luma plane.
  9328. @item u
  9329. Use chroma blue plane.
  9330. @item v
  9331. Use chroma red plane.
  9332. @end table
  9333. This option may be set to use chroma plane instead of the default luma plane
  9334. for doing filter's computations. This may improve accuracy on very clean
  9335. source material, but more likely will decrease accuracy, especially if there
  9336. is chroma noise (rainbow effect) or any grayscale video.
  9337. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  9338. load and make pullup usable in realtime on slow machines.
  9339. @end table
  9340. For best results (without duplicated frames in the output file) it is
  9341. necessary to change the output frame rate. For example, to inverse
  9342. telecine NTSC input:
  9343. @example
  9344. ffmpeg -i input -vf pullup -r 24000/1001 ...
  9345. @end example
  9346. @section qp
  9347. Change video quantization parameters (QP).
  9348. The filter accepts the following option:
  9349. @table @option
  9350. @item qp
  9351. Set expression for quantization parameter.
  9352. @end table
  9353. The expression is evaluated through the eval API and can contain, among others,
  9354. the following constants:
  9355. @table @var
  9356. @item known
  9357. 1 if index is not 129, 0 otherwise.
  9358. @item qp
  9359. Sequential index starting from -129 to 128.
  9360. @end table
  9361. @subsection Examples
  9362. @itemize
  9363. @item
  9364. Some equation like:
  9365. @example
  9366. qp=2+2*sin(PI*qp)
  9367. @end example
  9368. @end itemize
  9369. @section random
  9370. Flush video frames from internal cache of frames into a random order.
  9371. No frame is discarded.
  9372. Inspired by @ref{frei0r} nervous filter.
  9373. @table @option
  9374. @item frames
  9375. Set size in number of frames of internal cache, in range from @code{2} to
  9376. @code{512}. Default is @code{30}.
  9377. @item seed
  9378. Set seed for random number generator, must be an integer included between
  9379. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  9380. less than @code{0}, the filter will try to use a good random seed on a
  9381. best effort basis.
  9382. @end table
  9383. @section readeia608
  9384. Read closed captioning (EIA-608) information from the top lines of a video frame.
  9385. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  9386. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  9387. with EIA-608 data (starting from 0). A description of each metadata value follows:
  9388. @table @option
  9389. @item lavfi.readeia608.X.cc
  9390. The two bytes stored as EIA-608 data (printed in hexadecimal).
  9391. @item lavfi.readeia608.X.line
  9392. The number of the line on which the EIA-608 data was identified and read.
  9393. @end table
  9394. This filter accepts the following options:
  9395. @table @option
  9396. @item scan_min
  9397. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  9398. @item scan_max
  9399. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  9400. @item mac
  9401. Set minimal acceptable amplitude change for sync codes detection.
  9402. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  9403. @item spw
  9404. Set the ratio of width reserved for sync code detection.
  9405. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  9406. @item mhd
  9407. Set the max peaks height difference for sync code detection.
  9408. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9409. @item mpd
  9410. Set max peaks period difference for sync code detection.
  9411. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9412. @item msd
  9413. Set the first two max start code bits differences.
  9414. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  9415. @item bhd
  9416. Set the minimum ratio of bits height compared to 3rd start code bit.
  9417. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  9418. @item th_w
  9419. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  9420. @item th_b
  9421. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  9422. @item chp
  9423. Enable checking the parity bit. In the event of a parity error, the filter will output
  9424. @code{0x00} for that character. Default is false.
  9425. @end table
  9426. @subsection Examples
  9427. @itemize
  9428. @item
  9429. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  9430. @example
  9431. 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
  9432. @end example
  9433. @end itemize
  9434. @section readvitc
  9435. Read vertical interval timecode (VITC) information from the top lines of a
  9436. video frame.
  9437. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  9438. timecode value, if a valid timecode has been detected. Further metadata key
  9439. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  9440. timecode data has been found or not.
  9441. This filter accepts the following options:
  9442. @table @option
  9443. @item scan_max
  9444. Set the maximum number of lines to scan for VITC data. If the value is set to
  9445. @code{-1} the full video frame is scanned. Default is @code{45}.
  9446. @item thr_b
  9447. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  9448. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  9449. @item thr_w
  9450. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  9451. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  9452. @end table
  9453. @subsection Examples
  9454. @itemize
  9455. @item
  9456. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  9457. draw @code{--:--:--:--} as a placeholder:
  9458. @example
  9459. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  9460. @end example
  9461. @end itemize
  9462. @section remap
  9463. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  9464. Destination pixel at position (X, Y) will be picked from source (x, y) position
  9465. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  9466. value for pixel will be used for destination pixel.
  9467. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  9468. will have Xmap/Ymap video stream dimensions.
  9469. Xmap and Ymap input video streams are 16bit depth, single channel.
  9470. @section removegrain
  9471. The removegrain filter is a spatial denoiser for progressive video.
  9472. @table @option
  9473. @item m0
  9474. Set mode for the first plane.
  9475. @item m1
  9476. Set mode for the second plane.
  9477. @item m2
  9478. Set mode for the third plane.
  9479. @item m3
  9480. Set mode for the fourth plane.
  9481. @end table
  9482. Range of mode is from 0 to 24. Description of each mode follows:
  9483. @table @var
  9484. @item 0
  9485. Leave input plane unchanged. Default.
  9486. @item 1
  9487. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  9488. @item 2
  9489. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  9490. @item 3
  9491. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  9492. @item 4
  9493. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  9494. This is equivalent to a median filter.
  9495. @item 5
  9496. Line-sensitive clipping giving the minimal change.
  9497. @item 6
  9498. Line-sensitive clipping, intermediate.
  9499. @item 7
  9500. Line-sensitive clipping, intermediate.
  9501. @item 8
  9502. Line-sensitive clipping, intermediate.
  9503. @item 9
  9504. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  9505. @item 10
  9506. Replaces the target pixel with the closest neighbour.
  9507. @item 11
  9508. [1 2 1] horizontal and vertical kernel blur.
  9509. @item 12
  9510. Same as mode 11.
  9511. @item 13
  9512. Bob mode, interpolates top field from the line where the neighbours
  9513. pixels are the closest.
  9514. @item 14
  9515. Bob mode, interpolates bottom field from the line where the neighbours
  9516. pixels are the closest.
  9517. @item 15
  9518. Bob mode, interpolates top field. Same as 13 but with a more complicated
  9519. interpolation formula.
  9520. @item 16
  9521. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  9522. interpolation formula.
  9523. @item 17
  9524. Clips the pixel with the minimum and maximum of respectively the maximum and
  9525. minimum of each pair of opposite neighbour pixels.
  9526. @item 18
  9527. Line-sensitive clipping using opposite neighbours whose greatest distance from
  9528. the current pixel is minimal.
  9529. @item 19
  9530. Replaces the pixel with the average of its 8 neighbours.
  9531. @item 20
  9532. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  9533. @item 21
  9534. Clips pixels using the averages of opposite neighbour.
  9535. @item 22
  9536. Same as mode 21 but simpler and faster.
  9537. @item 23
  9538. Small edge and halo removal, but reputed useless.
  9539. @item 24
  9540. Similar as 23.
  9541. @end table
  9542. @section removelogo
  9543. Suppress a TV station logo, using an image file to determine which
  9544. pixels comprise the logo. It works by filling in the pixels that
  9545. comprise the logo with neighboring pixels.
  9546. The filter accepts the following options:
  9547. @table @option
  9548. @item filename, f
  9549. Set the filter bitmap file, which can be any image format supported by
  9550. libavformat. The width and height of the image file must match those of the
  9551. video stream being processed.
  9552. @end table
  9553. Pixels in the provided bitmap image with a value of zero are not
  9554. considered part of the logo, non-zero pixels are considered part of
  9555. the logo. If you use white (255) for the logo and black (0) for the
  9556. rest, you will be safe. For making the filter bitmap, it is
  9557. recommended to take a screen capture of a black frame with the logo
  9558. visible, and then using a threshold filter followed by the erode
  9559. filter once or twice.
  9560. If needed, little splotches can be fixed manually. Remember that if
  9561. logo pixels are not covered, the filter quality will be much
  9562. reduced. Marking too many pixels as part of the logo does not hurt as
  9563. much, but it will increase the amount of blurring needed to cover over
  9564. the image and will destroy more information than necessary, and extra
  9565. pixels will slow things down on a large logo.
  9566. @section repeatfields
  9567. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  9568. fields based on its value.
  9569. @section reverse
  9570. Reverse a video clip.
  9571. Warning: This filter requires memory to buffer the entire clip, so trimming
  9572. is suggested.
  9573. @subsection Examples
  9574. @itemize
  9575. @item
  9576. Take the first 5 seconds of a clip, and reverse it.
  9577. @example
  9578. trim=end=5,reverse
  9579. @end example
  9580. @end itemize
  9581. @section roberts
  9582. Apply roberts cross operator to input video stream.
  9583. The filter accepts the following option:
  9584. @table @option
  9585. @item planes
  9586. Set which planes will be processed, unprocessed planes will be copied.
  9587. By default value 0xf, all planes will be processed.
  9588. @item scale
  9589. Set value which will be multiplied with filtered result.
  9590. @item delta
  9591. Set value which will be added to filtered result.
  9592. @end table
  9593. @section rotate
  9594. Rotate video by an arbitrary angle expressed in radians.
  9595. The filter accepts the following options:
  9596. A description of the optional parameters follows.
  9597. @table @option
  9598. @item angle, a
  9599. Set an expression for the angle by which to rotate the input video
  9600. clockwise, expressed as a number of radians. A negative value will
  9601. result in a counter-clockwise rotation. By default it is set to "0".
  9602. This expression is evaluated for each frame.
  9603. @item out_w, ow
  9604. Set the output width expression, default value is "iw".
  9605. This expression is evaluated just once during configuration.
  9606. @item out_h, oh
  9607. Set the output height expression, default value is "ih".
  9608. This expression is evaluated just once during configuration.
  9609. @item bilinear
  9610. Enable bilinear interpolation if set to 1, a value of 0 disables
  9611. it. Default value is 1.
  9612. @item fillcolor, c
  9613. Set the color used to fill the output area not covered by the rotated
  9614. image. For the general syntax of this option, check the "Color" section in the
  9615. ffmpeg-utils manual. If the special value "none" is selected then no
  9616. background is printed (useful for example if the background is never shown).
  9617. Default value is "black".
  9618. @end table
  9619. The expressions for the angle and the output size can contain the
  9620. following constants and functions:
  9621. @table @option
  9622. @item n
  9623. sequential number of the input frame, starting from 0. It is always NAN
  9624. before the first frame is filtered.
  9625. @item t
  9626. time in seconds of the input frame, it is set to 0 when the filter is
  9627. configured. It is always NAN before the first frame is filtered.
  9628. @item hsub
  9629. @item vsub
  9630. horizontal and vertical chroma subsample values. For example for the
  9631. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9632. @item in_w, iw
  9633. @item in_h, ih
  9634. the input video width and height
  9635. @item out_w, ow
  9636. @item out_h, oh
  9637. the output width and height, that is the size of the padded area as
  9638. specified by the @var{width} and @var{height} expressions
  9639. @item rotw(a)
  9640. @item roth(a)
  9641. the minimal width/height required for completely containing the input
  9642. video rotated by @var{a} radians.
  9643. These are only available when computing the @option{out_w} and
  9644. @option{out_h} expressions.
  9645. @end table
  9646. @subsection Examples
  9647. @itemize
  9648. @item
  9649. Rotate the input by PI/6 radians clockwise:
  9650. @example
  9651. rotate=PI/6
  9652. @end example
  9653. @item
  9654. Rotate the input by PI/6 radians counter-clockwise:
  9655. @example
  9656. rotate=-PI/6
  9657. @end example
  9658. @item
  9659. Rotate the input by 45 degrees clockwise:
  9660. @example
  9661. rotate=45*PI/180
  9662. @end example
  9663. @item
  9664. Apply a constant rotation with period T, starting from an angle of PI/3:
  9665. @example
  9666. rotate=PI/3+2*PI*t/T
  9667. @end example
  9668. @item
  9669. Make the input video rotation oscillating with a period of T
  9670. seconds and an amplitude of A radians:
  9671. @example
  9672. rotate=A*sin(2*PI/T*t)
  9673. @end example
  9674. @item
  9675. Rotate the video, output size is chosen so that the whole rotating
  9676. input video is always completely contained in the output:
  9677. @example
  9678. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  9679. @end example
  9680. @item
  9681. Rotate the video, reduce the output size so that no background is ever
  9682. shown:
  9683. @example
  9684. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  9685. @end example
  9686. @end itemize
  9687. @subsection Commands
  9688. The filter supports the following commands:
  9689. @table @option
  9690. @item a, angle
  9691. Set the angle expression.
  9692. The command accepts the same syntax of the corresponding option.
  9693. If the specified expression is not valid, it is kept at its current
  9694. value.
  9695. @end table
  9696. @section sab
  9697. Apply Shape Adaptive Blur.
  9698. The filter accepts the following options:
  9699. @table @option
  9700. @item luma_radius, lr
  9701. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  9702. value is 1.0. A greater value will result in a more blurred image, and
  9703. in slower processing.
  9704. @item luma_pre_filter_radius, lpfr
  9705. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  9706. value is 1.0.
  9707. @item luma_strength, ls
  9708. Set luma maximum difference between pixels to still be considered, must
  9709. be a value in the 0.1-100.0 range, default value is 1.0.
  9710. @item chroma_radius, cr
  9711. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  9712. greater value will result in a more blurred image, and in slower
  9713. processing.
  9714. @item chroma_pre_filter_radius, cpfr
  9715. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  9716. @item chroma_strength, cs
  9717. Set chroma maximum difference between pixels to still be considered,
  9718. must be a value in the -0.9-100.0 range.
  9719. @end table
  9720. Each chroma option value, if not explicitly specified, is set to the
  9721. corresponding luma option value.
  9722. @anchor{scale}
  9723. @section scale
  9724. Scale (resize) the input video, using the libswscale library.
  9725. The scale filter forces the output display aspect ratio to be the same
  9726. of the input, by changing the output sample aspect ratio.
  9727. If the input image format is different from the format requested by
  9728. the next filter, the scale filter will convert the input to the
  9729. requested format.
  9730. @subsection Options
  9731. The filter accepts the following options, or any of the options
  9732. supported by the libswscale scaler.
  9733. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  9734. the complete list of scaler options.
  9735. @table @option
  9736. @item width, w
  9737. @item height, h
  9738. Set the output video dimension expression. Default value is the input
  9739. dimension.
  9740. If the @var{width} or @var{w} value is 0, the input width is used for
  9741. the output. If the @var{height} or @var{h} value is 0, the input height
  9742. is used for the output.
  9743. If one and only one of the values is -n with n >= 1, the scale filter
  9744. will use a value that maintains the aspect ratio of the input image,
  9745. calculated from the other specified dimension. After that it will,
  9746. however, make sure that the calculated dimension is divisible by n and
  9747. adjust the value if necessary.
  9748. If both values are -n with n >= 1, the behavior will be identical to
  9749. both values being set to 0 as previously detailed.
  9750. See below for the list of accepted constants for use in the dimension
  9751. expression.
  9752. @item eval
  9753. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  9754. @table @samp
  9755. @item init
  9756. Only evaluate expressions once during the filter initialization or when a command is processed.
  9757. @item frame
  9758. Evaluate expressions for each incoming frame.
  9759. @end table
  9760. Default value is @samp{init}.
  9761. @item interl
  9762. Set the interlacing mode. It accepts the following values:
  9763. @table @samp
  9764. @item 1
  9765. Force interlaced aware scaling.
  9766. @item 0
  9767. Do not apply interlaced scaling.
  9768. @item -1
  9769. Select interlaced aware scaling depending on whether the source frames
  9770. are flagged as interlaced or not.
  9771. @end table
  9772. Default value is @samp{0}.
  9773. @item flags
  9774. Set libswscale scaling flags. See
  9775. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9776. complete list of values. If not explicitly specified the filter applies
  9777. the default flags.
  9778. @item param0, param1
  9779. Set libswscale input parameters for scaling algorithms that need them. See
  9780. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9781. complete documentation. If not explicitly specified the filter applies
  9782. empty parameters.
  9783. @item size, s
  9784. Set the video size. For the syntax of this option, check the
  9785. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9786. @item in_color_matrix
  9787. @item out_color_matrix
  9788. Set in/output YCbCr color space type.
  9789. This allows the autodetected value to be overridden as well as allows forcing
  9790. a specific value used for the output and encoder.
  9791. If not specified, the color space type depends on the pixel format.
  9792. Possible values:
  9793. @table @samp
  9794. @item auto
  9795. Choose automatically.
  9796. @item bt709
  9797. Format conforming to International Telecommunication Union (ITU)
  9798. Recommendation BT.709.
  9799. @item fcc
  9800. Set color space conforming to the United States Federal Communications
  9801. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  9802. @item bt601
  9803. Set color space conforming to:
  9804. @itemize
  9805. @item
  9806. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  9807. @item
  9808. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  9809. @item
  9810. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  9811. @end itemize
  9812. @item smpte240m
  9813. Set color space conforming to SMPTE ST 240:1999.
  9814. @end table
  9815. @item in_range
  9816. @item out_range
  9817. Set in/output YCbCr sample range.
  9818. This allows the autodetected value to be overridden as well as allows forcing
  9819. a specific value used for the output and encoder. If not specified, the
  9820. range depends on the pixel format. Possible values:
  9821. @table @samp
  9822. @item auto
  9823. Choose automatically.
  9824. @item jpeg/full/pc
  9825. Set full range (0-255 in case of 8-bit luma).
  9826. @item mpeg/tv
  9827. Set "MPEG" range (16-235 in case of 8-bit luma).
  9828. @end table
  9829. @item force_original_aspect_ratio
  9830. Enable decreasing or increasing output video width or height if necessary to
  9831. keep the original aspect ratio. Possible values:
  9832. @table @samp
  9833. @item disable
  9834. Scale the video as specified and disable this feature.
  9835. @item decrease
  9836. The output video dimensions will automatically be decreased if needed.
  9837. @item increase
  9838. The output video dimensions will automatically be increased if needed.
  9839. @end table
  9840. One useful instance of this option is that when you know a specific device's
  9841. maximum allowed resolution, you can use this to limit the output video to
  9842. that, while retaining the aspect ratio. For example, device A allows
  9843. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  9844. decrease) and specifying 1280x720 to the command line makes the output
  9845. 1280x533.
  9846. Please note that this is a different thing than specifying -1 for @option{w}
  9847. or @option{h}, you still need to specify the output resolution for this option
  9848. to work.
  9849. @end table
  9850. The values of the @option{w} and @option{h} options are expressions
  9851. containing the following constants:
  9852. @table @var
  9853. @item in_w
  9854. @item in_h
  9855. The input width and height
  9856. @item iw
  9857. @item ih
  9858. These are the same as @var{in_w} and @var{in_h}.
  9859. @item out_w
  9860. @item out_h
  9861. The output (scaled) width and height
  9862. @item ow
  9863. @item oh
  9864. These are the same as @var{out_w} and @var{out_h}
  9865. @item a
  9866. The same as @var{iw} / @var{ih}
  9867. @item sar
  9868. input sample aspect ratio
  9869. @item dar
  9870. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  9871. @item hsub
  9872. @item vsub
  9873. horizontal and vertical input chroma subsample values. For example for the
  9874. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9875. @item ohsub
  9876. @item ovsub
  9877. horizontal and vertical output chroma subsample values. For example for the
  9878. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9879. @end table
  9880. @subsection Examples
  9881. @itemize
  9882. @item
  9883. Scale the input video to a size of 200x100
  9884. @example
  9885. scale=w=200:h=100
  9886. @end example
  9887. This is equivalent to:
  9888. @example
  9889. scale=200:100
  9890. @end example
  9891. or:
  9892. @example
  9893. scale=200x100
  9894. @end example
  9895. @item
  9896. Specify a size abbreviation for the output size:
  9897. @example
  9898. scale=qcif
  9899. @end example
  9900. which can also be written as:
  9901. @example
  9902. scale=size=qcif
  9903. @end example
  9904. @item
  9905. Scale the input to 2x:
  9906. @example
  9907. scale=w=2*iw:h=2*ih
  9908. @end example
  9909. @item
  9910. The above is the same as:
  9911. @example
  9912. scale=2*in_w:2*in_h
  9913. @end example
  9914. @item
  9915. Scale the input to 2x with forced interlaced scaling:
  9916. @example
  9917. scale=2*iw:2*ih:interl=1
  9918. @end example
  9919. @item
  9920. Scale the input to half size:
  9921. @example
  9922. scale=w=iw/2:h=ih/2
  9923. @end example
  9924. @item
  9925. Increase the width, and set the height to the same size:
  9926. @example
  9927. scale=3/2*iw:ow
  9928. @end example
  9929. @item
  9930. Seek Greek harmony:
  9931. @example
  9932. scale=iw:1/PHI*iw
  9933. scale=ih*PHI:ih
  9934. @end example
  9935. @item
  9936. Increase the height, and set the width to 3/2 of the height:
  9937. @example
  9938. scale=w=3/2*oh:h=3/5*ih
  9939. @end example
  9940. @item
  9941. Increase the size, making the size a multiple of the chroma
  9942. subsample values:
  9943. @example
  9944. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  9945. @end example
  9946. @item
  9947. Increase the width to a maximum of 500 pixels,
  9948. keeping the same aspect ratio as the input:
  9949. @example
  9950. scale=w='min(500\, iw*3/2):h=-1'
  9951. @end example
  9952. @end itemize
  9953. @subsection Commands
  9954. This filter supports the following commands:
  9955. @table @option
  9956. @item width, w
  9957. @item height, h
  9958. Set the output video dimension expression.
  9959. The command accepts the same syntax of the corresponding option.
  9960. If the specified expression is not valid, it is kept at its current
  9961. value.
  9962. @end table
  9963. @section scale_npp
  9964. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  9965. format conversion on CUDA video frames. Setting the output width and height
  9966. works in the same way as for the @var{scale} filter.
  9967. The following additional options are accepted:
  9968. @table @option
  9969. @item format
  9970. The pixel format of the output CUDA frames. If set to the string "same" (the
  9971. default), the input format will be kept. Note that automatic format negotiation
  9972. and conversion is not yet supported for hardware frames
  9973. @item interp_algo
  9974. The interpolation algorithm used for resizing. One of the following:
  9975. @table @option
  9976. @item nn
  9977. Nearest neighbour.
  9978. @item linear
  9979. @item cubic
  9980. @item cubic2p_bspline
  9981. 2-parameter cubic (B=1, C=0)
  9982. @item cubic2p_catmullrom
  9983. 2-parameter cubic (B=0, C=1/2)
  9984. @item cubic2p_b05c03
  9985. 2-parameter cubic (B=1/2, C=3/10)
  9986. @item super
  9987. Supersampling
  9988. @item lanczos
  9989. @end table
  9990. @end table
  9991. @section scale2ref
  9992. Scale (resize) the input video, based on a reference video.
  9993. See the scale filter for available options, scale2ref supports the same but
  9994. uses the reference video instead of the main input as basis. scale2ref also
  9995. supports the following additional constants for the @option{w} and
  9996. @option{h} options:
  9997. @table @var
  9998. @item main_w
  9999. @item main_h
  10000. The main input video's width and height
  10001. @item main_a
  10002. The same as @var{main_w} / @var{main_h}
  10003. @item main_sar
  10004. The main input video's sample aspect ratio
  10005. @item main_dar, mdar
  10006. The main input video's display aspect ratio. Calculated from
  10007. @code{(main_w / main_h) * main_sar}.
  10008. @item main_hsub
  10009. @item main_vsub
  10010. The main input video's horizontal and vertical chroma subsample values.
  10011. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  10012. is 1.
  10013. @end table
  10014. @subsection Examples
  10015. @itemize
  10016. @item
  10017. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  10018. @example
  10019. 'scale2ref[b][a];[a][b]overlay'
  10020. @end example
  10021. @end itemize
  10022. @anchor{selectivecolor}
  10023. @section selectivecolor
  10024. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  10025. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  10026. by the "purity" of the color (that is, how saturated it already is).
  10027. This filter is similar to the Adobe Photoshop Selective Color tool.
  10028. The filter accepts the following options:
  10029. @table @option
  10030. @item correction_method
  10031. Select color correction method.
  10032. Available values are:
  10033. @table @samp
  10034. @item absolute
  10035. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  10036. component value).
  10037. @item relative
  10038. Specified adjustments are relative to the original component value.
  10039. @end table
  10040. Default is @code{absolute}.
  10041. @item reds
  10042. Adjustments for red pixels (pixels where the red component is the maximum)
  10043. @item yellows
  10044. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  10045. @item greens
  10046. Adjustments for green pixels (pixels where the green component is the maximum)
  10047. @item cyans
  10048. Adjustments for cyan pixels (pixels where the red component is the minimum)
  10049. @item blues
  10050. Adjustments for blue pixels (pixels where the blue component is the maximum)
  10051. @item magentas
  10052. Adjustments for magenta pixels (pixels where the green component is the minimum)
  10053. @item whites
  10054. Adjustments for white pixels (pixels where all components are greater than 128)
  10055. @item neutrals
  10056. Adjustments for all pixels except pure black and pure white
  10057. @item blacks
  10058. Adjustments for black pixels (pixels where all components are lesser than 128)
  10059. @item psfile
  10060. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  10061. @end table
  10062. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  10063. 4 space separated floating point adjustment values in the [-1,1] range,
  10064. respectively to adjust the amount of cyan, magenta, yellow and black for the
  10065. pixels of its range.
  10066. @subsection Examples
  10067. @itemize
  10068. @item
  10069. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  10070. increase magenta by 27% in blue areas:
  10071. @example
  10072. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  10073. @end example
  10074. @item
  10075. Use a Photoshop selective color preset:
  10076. @example
  10077. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  10078. @end example
  10079. @end itemize
  10080. @anchor{separatefields}
  10081. @section separatefields
  10082. The @code{separatefields} takes a frame-based video input and splits
  10083. each frame into its components fields, producing a new half height clip
  10084. with twice the frame rate and twice the frame count.
  10085. This filter use field-dominance information in frame to decide which
  10086. of each pair of fields to place first in the output.
  10087. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  10088. @section setdar, setsar
  10089. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  10090. output video.
  10091. This is done by changing the specified Sample (aka Pixel) Aspect
  10092. Ratio, according to the following equation:
  10093. @example
  10094. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  10095. @end example
  10096. Keep in mind that the @code{setdar} filter does not modify the pixel
  10097. dimensions of the video frame. Also, the display aspect ratio set by
  10098. this filter may be changed by later filters in the filterchain,
  10099. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  10100. applied.
  10101. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  10102. the filter output video.
  10103. Note that as a consequence of the application of this filter, the
  10104. output display aspect ratio will change according to the equation
  10105. above.
  10106. Keep in mind that the sample aspect ratio set by the @code{setsar}
  10107. filter may be changed by later filters in the filterchain, e.g. if
  10108. another "setsar" or a "setdar" filter is applied.
  10109. It accepts the following parameters:
  10110. @table @option
  10111. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  10112. Set the aspect ratio used by the filter.
  10113. The parameter can be a floating point number string, an expression, or
  10114. a string of the form @var{num}:@var{den}, where @var{num} and
  10115. @var{den} are the numerator and denominator of the aspect ratio. If
  10116. the parameter is not specified, it is assumed the value "0".
  10117. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  10118. should be escaped.
  10119. @item max
  10120. Set the maximum integer value to use for expressing numerator and
  10121. denominator when reducing the expressed aspect ratio to a rational.
  10122. Default value is @code{100}.
  10123. @end table
  10124. The parameter @var{sar} is an expression containing
  10125. the following constants:
  10126. @table @option
  10127. @item E, PI, PHI
  10128. These are approximated values for the mathematical constants e
  10129. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  10130. @item w, h
  10131. The input width and height.
  10132. @item a
  10133. These are the same as @var{w} / @var{h}.
  10134. @item sar
  10135. The input sample aspect ratio.
  10136. @item dar
  10137. The input display aspect ratio. It is the same as
  10138. (@var{w} / @var{h}) * @var{sar}.
  10139. @item hsub, vsub
  10140. Horizontal and vertical chroma subsample values. For example, for the
  10141. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10142. @end table
  10143. @subsection Examples
  10144. @itemize
  10145. @item
  10146. To change the display aspect ratio to 16:9, specify one of the following:
  10147. @example
  10148. setdar=dar=1.77777
  10149. setdar=dar=16/9
  10150. @end example
  10151. @item
  10152. To change the sample aspect ratio to 10:11, specify:
  10153. @example
  10154. setsar=sar=10/11
  10155. @end example
  10156. @item
  10157. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  10158. 1000 in the aspect ratio reduction, use the command:
  10159. @example
  10160. setdar=ratio=16/9:max=1000
  10161. @end example
  10162. @end itemize
  10163. @anchor{setfield}
  10164. @section setfield
  10165. Force field for the output video frame.
  10166. The @code{setfield} filter marks the interlace type field for the
  10167. output frames. It does not change the input frame, but only sets the
  10168. corresponding property, which affects how the frame is treated by
  10169. following filters (e.g. @code{fieldorder} or @code{yadif}).
  10170. The filter accepts the following options:
  10171. @table @option
  10172. @item mode
  10173. Available values are:
  10174. @table @samp
  10175. @item auto
  10176. Keep the same field property.
  10177. @item bff
  10178. Mark the frame as bottom-field-first.
  10179. @item tff
  10180. Mark the frame as top-field-first.
  10181. @item prog
  10182. Mark the frame as progressive.
  10183. @end table
  10184. @end table
  10185. @section showinfo
  10186. Show a line containing various information for each input video frame.
  10187. The input video is not modified.
  10188. The shown line contains a sequence of key/value pairs of the form
  10189. @var{key}:@var{value}.
  10190. The following values are shown in the output:
  10191. @table @option
  10192. @item n
  10193. The (sequential) number of the input frame, starting from 0.
  10194. @item pts
  10195. The Presentation TimeStamp of the input frame, expressed as a number of
  10196. time base units. The time base unit depends on the filter input pad.
  10197. @item pts_time
  10198. The Presentation TimeStamp of the input frame, expressed as a number of
  10199. seconds.
  10200. @item pos
  10201. The position of the frame in the input stream, or -1 if this information is
  10202. unavailable and/or meaningless (for example in case of synthetic video).
  10203. @item fmt
  10204. The pixel format name.
  10205. @item sar
  10206. The sample aspect ratio of the input frame, expressed in the form
  10207. @var{num}/@var{den}.
  10208. @item s
  10209. The size of the input frame. For the syntax of this option, check the
  10210. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10211. @item i
  10212. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  10213. for bottom field first).
  10214. @item iskey
  10215. This is 1 if the frame is a key frame, 0 otherwise.
  10216. @item type
  10217. The picture type of the input frame ("I" for an I-frame, "P" for a
  10218. P-frame, "B" for a B-frame, or "?" for an unknown type).
  10219. Also refer to the documentation of the @code{AVPictureType} enum and of
  10220. the @code{av_get_picture_type_char} function defined in
  10221. @file{libavutil/avutil.h}.
  10222. @item checksum
  10223. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  10224. @item plane_checksum
  10225. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  10226. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  10227. @end table
  10228. @section showpalette
  10229. Displays the 256 colors palette of each frame. This filter is only relevant for
  10230. @var{pal8} pixel format frames.
  10231. It accepts the following option:
  10232. @table @option
  10233. @item s
  10234. Set the size of the box used to represent one palette color entry. Default is
  10235. @code{30} (for a @code{30x30} pixel box).
  10236. @end table
  10237. @section shuffleframes
  10238. Reorder and/or duplicate and/or drop video frames.
  10239. It accepts the following parameters:
  10240. @table @option
  10241. @item mapping
  10242. Set the destination indexes of input frames.
  10243. This is space or '|' separated list of indexes that maps input frames to output
  10244. frames. Number of indexes also sets maximal value that each index may have.
  10245. '-1' index have special meaning and that is to drop frame.
  10246. @end table
  10247. The first frame has the index 0. The default is to keep the input unchanged.
  10248. @subsection Examples
  10249. @itemize
  10250. @item
  10251. Swap second and third frame of every three frames of the input:
  10252. @example
  10253. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  10254. @end example
  10255. @item
  10256. Swap 10th and 1st frame of every ten frames of the input:
  10257. @example
  10258. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  10259. @end example
  10260. @end itemize
  10261. @section shuffleplanes
  10262. Reorder and/or duplicate video planes.
  10263. It accepts the following parameters:
  10264. @table @option
  10265. @item map0
  10266. The index of the input plane to be used as the first output plane.
  10267. @item map1
  10268. The index of the input plane to be used as the second output plane.
  10269. @item map2
  10270. The index of the input plane to be used as the third output plane.
  10271. @item map3
  10272. The index of the input plane to be used as the fourth output plane.
  10273. @end table
  10274. The first plane has the index 0. The default is to keep the input unchanged.
  10275. @subsection Examples
  10276. @itemize
  10277. @item
  10278. Swap the second and third planes of the input:
  10279. @example
  10280. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  10281. @end example
  10282. @end itemize
  10283. @anchor{signalstats}
  10284. @section signalstats
  10285. Evaluate various visual metrics that assist in determining issues associated
  10286. with the digitization of analog video media.
  10287. By default the filter will log these metadata values:
  10288. @table @option
  10289. @item YMIN
  10290. Display the minimal Y value contained within the input frame. Expressed in
  10291. range of [0-255].
  10292. @item YLOW
  10293. Display the Y value at the 10% percentile within the input frame. Expressed in
  10294. range of [0-255].
  10295. @item YAVG
  10296. Display the average Y value within the input frame. Expressed in range of
  10297. [0-255].
  10298. @item YHIGH
  10299. Display the Y value at the 90% percentile within the input frame. Expressed in
  10300. range of [0-255].
  10301. @item YMAX
  10302. Display the maximum Y value contained within the input frame. Expressed in
  10303. range of [0-255].
  10304. @item UMIN
  10305. Display the minimal U value contained within the input frame. Expressed in
  10306. range of [0-255].
  10307. @item ULOW
  10308. Display the U value at the 10% percentile within the input frame. Expressed in
  10309. range of [0-255].
  10310. @item UAVG
  10311. Display the average U value within the input frame. Expressed in range of
  10312. [0-255].
  10313. @item UHIGH
  10314. Display the U value at the 90% percentile within the input frame. Expressed in
  10315. range of [0-255].
  10316. @item UMAX
  10317. Display the maximum U value contained within the input frame. Expressed in
  10318. range of [0-255].
  10319. @item VMIN
  10320. Display the minimal V value contained within the input frame. Expressed in
  10321. range of [0-255].
  10322. @item VLOW
  10323. Display the V value at the 10% percentile within the input frame. Expressed in
  10324. range of [0-255].
  10325. @item VAVG
  10326. Display the average V value within the input frame. Expressed in range of
  10327. [0-255].
  10328. @item VHIGH
  10329. Display the V value at the 90% percentile within the input frame. Expressed in
  10330. range of [0-255].
  10331. @item VMAX
  10332. Display the maximum V value contained within the input frame. Expressed in
  10333. range of [0-255].
  10334. @item SATMIN
  10335. Display the minimal saturation value contained within the input frame.
  10336. Expressed in range of [0-~181.02].
  10337. @item SATLOW
  10338. Display the saturation value at the 10% percentile within the input frame.
  10339. Expressed in range of [0-~181.02].
  10340. @item SATAVG
  10341. Display the average saturation value within the input frame. Expressed in range
  10342. of [0-~181.02].
  10343. @item SATHIGH
  10344. Display the saturation value at the 90% percentile within the input frame.
  10345. Expressed in range of [0-~181.02].
  10346. @item SATMAX
  10347. Display the maximum saturation value contained within the input frame.
  10348. Expressed in range of [0-~181.02].
  10349. @item HUEMED
  10350. Display the median value for hue within the input frame. Expressed in range of
  10351. [0-360].
  10352. @item HUEAVG
  10353. Display the average value for hue within the input frame. Expressed in range of
  10354. [0-360].
  10355. @item YDIF
  10356. Display the average of sample value difference between all values of the Y
  10357. plane in the current frame and corresponding values of the previous input frame.
  10358. Expressed in range of [0-255].
  10359. @item UDIF
  10360. Display the average of sample value difference between all values of the U
  10361. plane in the current frame and corresponding values of the previous input frame.
  10362. Expressed in range of [0-255].
  10363. @item VDIF
  10364. Display the average of sample value difference between all values of the V
  10365. plane in the current frame and corresponding values of the previous input frame.
  10366. Expressed in range of [0-255].
  10367. @item YBITDEPTH
  10368. Display bit depth of Y plane in current frame.
  10369. Expressed in range of [0-16].
  10370. @item UBITDEPTH
  10371. Display bit depth of U plane in current frame.
  10372. Expressed in range of [0-16].
  10373. @item VBITDEPTH
  10374. Display bit depth of V plane in current frame.
  10375. Expressed in range of [0-16].
  10376. @end table
  10377. The filter accepts the following options:
  10378. @table @option
  10379. @item stat
  10380. @item out
  10381. @option{stat} specify an additional form of image analysis.
  10382. @option{out} output video with the specified type of pixel highlighted.
  10383. Both options accept the following values:
  10384. @table @samp
  10385. @item tout
  10386. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  10387. unlike the neighboring pixels of the same field. Examples of temporal outliers
  10388. include the results of video dropouts, head clogs, or tape tracking issues.
  10389. @item vrep
  10390. Identify @var{vertical line repetition}. Vertical line repetition includes
  10391. similar rows of pixels within a frame. In born-digital video vertical line
  10392. repetition is common, but this pattern is uncommon in video digitized from an
  10393. analog source. When it occurs in video that results from the digitization of an
  10394. analog source it can indicate concealment from a dropout compensator.
  10395. @item brng
  10396. Identify pixels that fall outside of legal broadcast range.
  10397. @end table
  10398. @item color, c
  10399. Set the highlight color for the @option{out} option. The default color is
  10400. yellow.
  10401. @end table
  10402. @subsection Examples
  10403. @itemize
  10404. @item
  10405. Output data of various video metrics:
  10406. @example
  10407. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  10408. @end example
  10409. @item
  10410. Output specific data about the minimum and maximum values of the Y plane per frame:
  10411. @example
  10412. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  10413. @end example
  10414. @item
  10415. Playback video while highlighting pixels that are outside of broadcast range in red.
  10416. @example
  10417. ffplay example.mov -vf signalstats="out=brng:color=red"
  10418. @end example
  10419. @item
  10420. Playback video with signalstats metadata drawn over the frame.
  10421. @example
  10422. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  10423. @end example
  10424. The contents of signalstat_drawtext.txt used in the command are:
  10425. @example
  10426. time %@{pts:hms@}
  10427. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  10428. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  10429. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  10430. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  10431. @end example
  10432. @end itemize
  10433. @anchor{signature}
  10434. @section signature
  10435. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  10436. input. In this case the matching between the inputs can be calculated additionally.
  10437. The filter always passes through the first input. The signature of each stream can
  10438. be written into a file.
  10439. It accepts the following options:
  10440. @table @option
  10441. @item detectmode
  10442. Enable or disable the matching process.
  10443. Available values are:
  10444. @table @samp
  10445. @item off
  10446. Disable the calculation of a matching (default).
  10447. @item full
  10448. Calculate the matching for the whole video and output whether the whole video
  10449. matches or only parts.
  10450. @item fast
  10451. Calculate only until a matching is found or the video ends. Should be faster in
  10452. some cases.
  10453. @end table
  10454. @item nb_inputs
  10455. Set the number of inputs. The option value must be a non negative integer.
  10456. Default value is 1.
  10457. @item filename
  10458. Set the path to which the output is written. If there is more than one input,
  10459. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  10460. integer), that will be replaced with the input number. If no filename is
  10461. specified, no output will be written. This is the default.
  10462. @item format
  10463. Choose the output format.
  10464. Available values are:
  10465. @table @samp
  10466. @item binary
  10467. Use the specified binary representation (default).
  10468. @item xml
  10469. Use the specified xml representation.
  10470. @end table
  10471. @item th_d
  10472. Set threshold to detect one word as similar. The option value must be an integer
  10473. greater than zero. The default value is 9000.
  10474. @item th_dc
  10475. Set threshold to detect all words as similar. The option value must be an integer
  10476. greater than zero. The default value is 60000.
  10477. @item th_xh
  10478. Set threshold to detect frames as similar. The option value must be an integer
  10479. greater than zero. The default value is 116.
  10480. @item th_di
  10481. Set the minimum length of a sequence in frames to recognize it as matching
  10482. sequence. The option value must be a non negative integer value.
  10483. The default value is 0.
  10484. @item th_it
  10485. Set the minimum relation, that matching frames to all frames must have.
  10486. The option value must be a double value between 0 and 1. The default value is 0.5.
  10487. @end table
  10488. @subsection Examples
  10489. @itemize
  10490. @item
  10491. To calculate the signature of an input video and store it in signature.bin:
  10492. @example
  10493. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  10494. @end example
  10495. @item
  10496. To detect whether two videos match and store the signatures in XML format in
  10497. signature0.xml and signature1.xml:
  10498. @example
  10499. 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 -
  10500. @end example
  10501. @end itemize
  10502. @anchor{smartblur}
  10503. @section smartblur
  10504. Blur the input video without impacting the outlines.
  10505. It accepts the following options:
  10506. @table @option
  10507. @item luma_radius, lr
  10508. Set the luma radius. The option value must be a float number in
  10509. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10510. used to blur the image (slower if larger). Default value is 1.0.
  10511. @item luma_strength, ls
  10512. Set the luma strength. The option value must be a float number
  10513. in the range [-1.0,1.0] that configures the blurring. A value included
  10514. in [0.0,1.0] will blur the image whereas a value included in
  10515. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  10516. @item luma_threshold, lt
  10517. Set the luma threshold used as a coefficient to determine
  10518. whether a pixel should be blurred or not. The option value must be an
  10519. integer in the range [-30,30]. A value of 0 will filter all the image,
  10520. a value included in [0,30] will filter flat areas and a value included
  10521. in [-30,0] will filter edges. Default value is 0.
  10522. @item chroma_radius, cr
  10523. Set the chroma radius. The option value must be a float number in
  10524. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10525. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  10526. @item chroma_strength, cs
  10527. Set the chroma strength. The option value must be a float number
  10528. in the range [-1.0,1.0] that configures the blurring. A value included
  10529. in [0.0,1.0] will blur the image whereas a value included in
  10530. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  10531. @item chroma_threshold, ct
  10532. Set the chroma threshold used as a coefficient to determine
  10533. whether a pixel should be blurred or not. The option value must be an
  10534. integer in the range [-30,30]. A value of 0 will filter all the image,
  10535. a value included in [0,30] will filter flat areas and a value included
  10536. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  10537. @end table
  10538. If a chroma option is not explicitly set, the corresponding luma value
  10539. is set.
  10540. @section ssim
  10541. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  10542. This filter takes in input two input videos, the first input is
  10543. considered the "main" source and is passed unchanged to the
  10544. output. The second input is used as a "reference" video for computing
  10545. the SSIM.
  10546. Both video inputs must have the same resolution and pixel format for
  10547. this filter to work correctly. Also it assumes that both inputs
  10548. have the same number of frames, which are compared one by one.
  10549. The filter stores the calculated SSIM of each frame.
  10550. The description of the accepted parameters follows.
  10551. @table @option
  10552. @item stats_file, f
  10553. If specified the filter will use the named file to save the SSIM of
  10554. each individual frame. When filename equals "-" the data is sent to
  10555. standard output.
  10556. @end table
  10557. The file printed if @var{stats_file} is selected, contains a sequence of
  10558. key/value pairs of the form @var{key}:@var{value} for each compared
  10559. couple of frames.
  10560. A description of each shown parameter follows:
  10561. @table @option
  10562. @item n
  10563. sequential number of the input frame, starting from 1
  10564. @item Y, U, V, R, G, B
  10565. SSIM of the compared frames for the component specified by the suffix.
  10566. @item All
  10567. SSIM of the compared frames for the whole frame.
  10568. @item dB
  10569. Same as above but in dB representation.
  10570. @end table
  10571. This filter also supports the @ref{framesync} options.
  10572. For example:
  10573. @example
  10574. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10575. [main][ref] ssim="stats_file=stats.log" [out]
  10576. @end example
  10577. On this example the input file being processed is compared with the
  10578. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  10579. is stored in @file{stats.log}.
  10580. Another example with both psnr and ssim at same time:
  10581. @example
  10582. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  10583. @end example
  10584. @section stereo3d
  10585. Convert between different stereoscopic image formats.
  10586. The filters accept the following options:
  10587. @table @option
  10588. @item in
  10589. Set stereoscopic image format of input.
  10590. Available values for input image formats are:
  10591. @table @samp
  10592. @item sbsl
  10593. side by side parallel (left eye left, right eye right)
  10594. @item sbsr
  10595. side by side crosseye (right eye left, left eye right)
  10596. @item sbs2l
  10597. side by side parallel with half width resolution
  10598. (left eye left, right eye right)
  10599. @item sbs2r
  10600. side by side crosseye with half width resolution
  10601. (right eye left, left eye right)
  10602. @item abl
  10603. above-below (left eye above, right eye below)
  10604. @item abr
  10605. above-below (right eye above, left eye below)
  10606. @item ab2l
  10607. above-below with half height resolution
  10608. (left eye above, right eye below)
  10609. @item ab2r
  10610. above-below with half height resolution
  10611. (right eye above, left eye below)
  10612. @item al
  10613. alternating frames (left eye first, right eye second)
  10614. @item ar
  10615. alternating frames (right eye first, left eye second)
  10616. @item irl
  10617. interleaved rows (left eye has top row, right eye starts on next row)
  10618. @item irr
  10619. interleaved rows (right eye has top row, left eye starts on next row)
  10620. @item icl
  10621. interleaved columns, left eye first
  10622. @item icr
  10623. interleaved columns, right eye first
  10624. Default value is @samp{sbsl}.
  10625. @end table
  10626. @item out
  10627. Set stereoscopic image format of output.
  10628. @table @samp
  10629. @item sbsl
  10630. side by side parallel (left eye left, right eye right)
  10631. @item sbsr
  10632. side by side crosseye (right eye left, left eye right)
  10633. @item sbs2l
  10634. side by side parallel with half width resolution
  10635. (left eye left, right eye right)
  10636. @item sbs2r
  10637. side by side crosseye with half width resolution
  10638. (right eye left, left eye right)
  10639. @item abl
  10640. above-below (left eye above, right eye below)
  10641. @item abr
  10642. above-below (right eye above, left eye below)
  10643. @item ab2l
  10644. above-below with half height resolution
  10645. (left eye above, right eye below)
  10646. @item ab2r
  10647. above-below with half height resolution
  10648. (right eye above, left eye below)
  10649. @item al
  10650. alternating frames (left eye first, right eye second)
  10651. @item ar
  10652. alternating frames (right eye first, left eye second)
  10653. @item irl
  10654. interleaved rows (left eye has top row, right eye starts on next row)
  10655. @item irr
  10656. interleaved rows (right eye has top row, left eye starts on next row)
  10657. @item arbg
  10658. anaglyph red/blue gray
  10659. (red filter on left eye, blue filter on right eye)
  10660. @item argg
  10661. anaglyph red/green gray
  10662. (red filter on left eye, green filter on right eye)
  10663. @item arcg
  10664. anaglyph red/cyan gray
  10665. (red filter on left eye, cyan filter on right eye)
  10666. @item arch
  10667. anaglyph red/cyan half colored
  10668. (red filter on left eye, cyan filter on right eye)
  10669. @item arcc
  10670. anaglyph red/cyan color
  10671. (red filter on left eye, cyan filter on right eye)
  10672. @item arcd
  10673. anaglyph red/cyan color optimized with the least squares projection of dubois
  10674. (red filter on left eye, cyan filter on right eye)
  10675. @item agmg
  10676. anaglyph green/magenta gray
  10677. (green filter on left eye, magenta filter on right eye)
  10678. @item agmh
  10679. anaglyph green/magenta half colored
  10680. (green filter on left eye, magenta filter on right eye)
  10681. @item agmc
  10682. anaglyph green/magenta colored
  10683. (green filter on left eye, magenta filter on right eye)
  10684. @item agmd
  10685. anaglyph green/magenta color optimized with the least squares projection of dubois
  10686. (green filter on left eye, magenta filter on right eye)
  10687. @item aybg
  10688. anaglyph yellow/blue gray
  10689. (yellow filter on left eye, blue filter on right eye)
  10690. @item aybh
  10691. anaglyph yellow/blue half colored
  10692. (yellow filter on left eye, blue filter on right eye)
  10693. @item aybc
  10694. anaglyph yellow/blue colored
  10695. (yellow filter on left eye, blue filter on right eye)
  10696. @item aybd
  10697. anaglyph yellow/blue color optimized with the least squares projection of dubois
  10698. (yellow filter on left eye, blue filter on right eye)
  10699. @item ml
  10700. mono output (left eye only)
  10701. @item mr
  10702. mono output (right eye only)
  10703. @item chl
  10704. checkerboard, left eye first
  10705. @item chr
  10706. checkerboard, right eye first
  10707. @item icl
  10708. interleaved columns, left eye first
  10709. @item icr
  10710. interleaved columns, right eye first
  10711. @item hdmi
  10712. HDMI frame pack
  10713. @end table
  10714. Default value is @samp{arcd}.
  10715. @end table
  10716. @subsection Examples
  10717. @itemize
  10718. @item
  10719. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  10720. @example
  10721. stereo3d=sbsl:aybd
  10722. @end example
  10723. @item
  10724. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  10725. @example
  10726. stereo3d=abl:sbsr
  10727. @end example
  10728. @end itemize
  10729. @section streamselect, astreamselect
  10730. Select video or audio streams.
  10731. The filter accepts the following options:
  10732. @table @option
  10733. @item inputs
  10734. Set number of inputs. Default is 2.
  10735. @item map
  10736. Set input indexes to remap to outputs.
  10737. @end table
  10738. @subsection Commands
  10739. The @code{streamselect} and @code{astreamselect} filter supports the following
  10740. commands:
  10741. @table @option
  10742. @item map
  10743. Set input indexes to remap to outputs.
  10744. @end table
  10745. @subsection Examples
  10746. @itemize
  10747. @item
  10748. Select first 5 seconds 1st stream and rest of time 2nd stream:
  10749. @example
  10750. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  10751. @end example
  10752. @item
  10753. Same as above, but for audio:
  10754. @example
  10755. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  10756. @end example
  10757. @end itemize
  10758. @section sobel
  10759. Apply sobel operator to input video stream.
  10760. The filter accepts the following option:
  10761. @table @option
  10762. @item planes
  10763. Set which planes will be processed, unprocessed planes will be copied.
  10764. By default value 0xf, all planes will be processed.
  10765. @item scale
  10766. Set value which will be multiplied with filtered result.
  10767. @item delta
  10768. Set value which will be added to filtered result.
  10769. @end table
  10770. @anchor{spp}
  10771. @section spp
  10772. Apply a simple postprocessing filter that compresses and decompresses the image
  10773. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  10774. and average the results.
  10775. The filter accepts the following options:
  10776. @table @option
  10777. @item quality
  10778. Set quality. This option defines the number of levels for averaging. It accepts
  10779. an integer in the range 0-6. If set to @code{0}, the filter will have no
  10780. effect. A value of @code{6} means the higher quality. For each increment of
  10781. that value the speed drops by a factor of approximately 2. Default value is
  10782. @code{3}.
  10783. @item qp
  10784. Force a constant quantization parameter. If not set, the filter will use the QP
  10785. from the video stream (if available).
  10786. @item mode
  10787. Set thresholding mode. Available modes are:
  10788. @table @samp
  10789. @item hard
  10790. Set hard thresholding (default).
  10791. @item soft
  10792. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10793. @end table
  10794. @item use_bframe_qp
  10795. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  10796. option may cause flicker since the B-Frames have often larger QP. Default is
  10797. @code{0} (not enabled).
  10798. @end table
  10799. @anchor{subtitles}
  10800. @section subtitles
  10801. Draw subtitles on top of input video using the libass library.
  10802. To enable compilation of this filter you need to configure FFmpeg with
  10803. @code{--enable-libass}. This filter also requires a build with libavcodec and
  10804. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  10805. Alpha) subtitles format.
  10806. The filter accepts the following options:
  10807. @table @option
  10808. @item filename, f
  10809. Set the filename of the subtitle file to read. It must be specified.
  10810. @item original_size
  10811. Specify the size of the original video, the video for which the ASS file
  10812. was composed. For the syntax of this option, check the
  10813. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10814. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  10815. correctly scale the fonts if the aspect ratio has been changed.
  10816. @item fontsdir
  10817. Set a directory path containing fonts that can be used by the filter.
  10818. These fonts will be used in addition to whatever the font provider uses.
  10819. @item alpha
  10820. Process alpha channel, by default alpha channel is untouched.
  10821. @item charenc
  10822. Set subtitles input character encoding. @code{subtitles} filter only. Only
  10823. useful if not UTF-8.
  10824. @item stream_index, si
  10825. Set subtitles stream index. @code{subtitles} filter only.
  10826. @item force_style
  10827. Override default style or script info parameters of the subtitles. It accepts a
  10828. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  10829. @end table
  10830. If the first key is not specified, it is assumed that the first value
  10831. specifies the @option{filename}.
  10832. For example, to render the file @file{sub.srt} on top of the input
  10833. video, use the command:
  10834. @example
  10835. subtitles=sub.srt
  10836. @end example
  10837. which is equivalent to:
  10838. @example
  10839. subtitles=filename=sub.srt
  10840. @end example
  10841. To render the default subtitles stream from file @file{video.mkv}, use:
  10842. @example
  10843. subtitles=video.mkv
  10844. @end example
  10845. To render the second subtitles stream from that file, use:
  10846. @example
  10847. subtitles=video.mkv:si=1
  10848. @end example
  10849. To make the subtitles stream from @file{sub.srt} appear in transparent green
  10850. @code{DejaVu Serif}, use:
  10851. @example
  10852. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  10853. @end example
  10854. @section super2xsai
  10855. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  10856. Interpolate) pixel art scaling algorithm.
  10857. Useful for enlarging pixel art images without reducing sharpness.
  10858. @section swaprect
  10859. Swap two rectangular objects in video.
  10860. This filter accepts the following options:
  10861. @table @option
  10862. @item w
  10863. Set object width.
  10864. @item h
  10865. Set object height.
  10866. @item x1
  10867. Set 1st rect x coordinate.
  10868. @item y1
  10869. Set 1st rect y coordinate.
  10870. @item x2
  10871. Set 2nd rect x coordinate.
  10872. @item y2
  10873. Set 2nd rect y coordinate.
  10874. All expressions are evaluated once for each frame.
  10875. @end table
  10876. The all options are expressions containing the following constants:
  10877. @table @option
  10878. @item w
  10879. @item h
  10880. The input width and height.
  10881. @item a
  10882. same as @var{w} / @var{h}
  10883. @item sar
  10884. input sample aspect ratio
  10885. @item dar
  10886. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  10887. @item n
  10888. The number of the input frame, starting from 0.
  10889. @item t
  10890. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  10891. @item pos
  10892. the position in the file of the input frame, NAN if unknown
  10893. @end table
  10894. @section swapuv
  10895. Swap U & V plane.
  10896. @section telecine
  10897. Apply telecine process to the video.
  10898. This filter accepts the following options:
  10899. @table @option
  10900. @item first_field
  10901. @table @samp
  10902. @item top, t
  10903. top field first
  10904. @item bottom, b
  10905. bottom field first
  10906. The default value is @code{top}.
  10907. @end table
  10908. @item pattern
  10909. A string of numbers representing the pulldown pattern you wish to apply.
  10910. The default value is @code{23}.
  10911. @end table
  10912. @example
  10913. Some typical patterns:
  10914. NTSC output (30i):
  10915. 27.5p: 32222
  10916. 24p: 23 (classic)
  10917. 24p: 2332 (preferred)
  10918. 20p: 33
  10919. 18p: 334
  10920. 16p: 3444
  10921. PAL output (25i):
  10922. 27.5p: 12222
  10923. 24p: 222222222223 ("Euro pulldown")
  10924. 16.67p: 33
  10925. 16p: 33333334
  10926. @end example
  10927. @section threshold
  10928. Apply threshold effect to video stream.
  10929. This filter needs four video streams to perform thresholding.
  10930. First stream is stream we are filtering.
  10931. Second stream is holding threshold values, third stream is holding min values,
  10932. and last, fourth stream is holding max values.
  10933. The filter accepts the following option:
  10934. @table @option
  10935. @item planes
  10936. Set which planes will be processed, unprocessed planes will be copied.
  10937. By default value 0xf, all planes will be processed.
  10938. @end table
  10939. For example if first stream pixel's component value is less then threshold value
  10940. of pixel component from 2nd threshold stream, third stream value will picked,
  10941. otherwise fourth stream pixel component value will be picked.
  10942. Using color source filter one can perform various types of thresholding:
  10943. @subsection Examples
  10944. @itemize
  10945. @item
  10946. Binary threshold, using gray color as threshold:
  10947. @example
  10948. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  10949. @end example
  10950. @item
  10951. Inverted binary threshold, using gray color as threshold:
  10952. @example
  10953. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  10954. @end example
  10955. @item
  10956. Truncate binary threshold, using gray color as threshold:
  10957. @example
  10958. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  10959. @end example
  10960. @item
  10961. Threshold to zero, using gray color as threshold:
  10962. @example
  10963. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  10964. @end example
  10965. @item
  10966. Inverted threshold to zero, using gray color as threshold:
  10967. @example
  10968. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  10969. @end example
  10970. @end itemize
  10971. @section thumbnail
  10972. Select the most representative frame in a given sequence of consecutive frames.
  10973. The filter accepts the following options:
  10974. @table @option
  10975. @item n
  10976. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  10977. will pick one of them, and then handle the next batch of @var{n} frames until
  10978. the end. Default is @code{100}.
  10979. @end table
  10980. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  10981. value will result in a higher memory usage, so a high value is not recommended.
  10982. @subsection Examples
  10983. @itemize
  10984. @item
  10985. Extract one picture each 50 frames:
  10986. @example
  10987. thumbnail=50
  10988. @end example
  10989. @item
  10990. Complete example of a thumbnail creation with @command{ffmpeg}:
  10991. @example
  10992. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  10993. @end example
  10994. @end itemize
  10995. @section tile
  10996. Tile several successive frames together.
  10997. The filter accepts the following options:
  10998. @table @option
  10999. @item layout
  11000. Set the grid size (i.e. the number of lines and columns). For the syntax of
  11001. this option, check the
  11002. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11003. @item nb_frames
  11004. Set the maximum number of frames to render in the given area. It must be less
  11005. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  11006. the area will be used.
  11007. @item margin
  11008. Set the outer border margin in pixels.
  11009. @item padding
  11010. Set the inner border thickness (i.e. the number of pixels between frames). For
  11011. more advanced padding options (such as having different values for the edges),
  11012. refer to the pad video filter.
  11013. @item color
  11014. Specify the color of the unused area. For the syntax of this option, check the
  11015. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  11016. is "black".
  11017. @end table
  11018. @subsection Examples
  11019. @itemize
  11020. @item
  11021. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  11022. @example
  11023. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  11024. @end example
  11025. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  11026. duplicating each output frame to accommodate the originally detected frame
  11027. rate.
  11028. @item
  11029. Display @code{5} pictures in an area of @code{3x2} frames,
  11030. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  11031. mixed flat and named options:
  11032. @example
  11033. tile=3x2:nb_frames=5:padding=7:margin=2
  11034. @end example
  11035. @end itemize
  11036. @section tinterlace
  11037. Perform various types of temporal field interlacing.
  11038. Frames are counted starting from 1, so the first input frame is
  11039. considered odd.
  11040. The filter accepts the following options:
  11041. @table @option
  11042. @item mode
  11043. Specify the mode of the interlacing. This option can also be specified
  11044. as a value alone. See below for a list of values for this option.
  11045. Available values are:
  11046. @table @samp
  11047. @item merge, 0
  11048. Move odd frames into the upper field, even into the lower field,
  11049. generating a double height frame at half frame rate.
  11050. @example
  11051. ------> time
  11052. Input:
  11053. Frame 1 Frame 2 Frame 3 Frame 4
  11054. 11111 22222 33333 44444
  11055. 11111 22222 33333 44444
  11056. 11111 22222 33333 44444
  11057. 11111 22222 33333 44444
  11058. Output:
  11059. 11111 33333
  11060. 22222 44444
  11061. 11111 33333
  11062. 22222 44444
  11063. 11111 33333
  11064. 22222 44444
  11065. 11111 33333
  11066. 22222 44444
  11067. @end example
  11068. @item drop_even, 1
  11069. Only output odd frames, even frames are dropped, generating a frame with
  11070. unchanged height at half frame rate.
  11071. @example
  11072. ------> time
  11073. Input:
  11074. Frame 1 Frame 2 Frame 3 Frame 4
  11075. 11111 22222 33333 44444
  11076. 11111 22222 33333 44444
  11077. 11111 22222 33333 44444
  11078. 11111 22222 33333 44444
  11079. Output:
  11080. 11111 33333
  11081. 11111 33333
  11082. 11111 33333
  11083. 11111 33333
  11084. @end example
  11085. @item drop_odd, 2
  11086. Only output even frames, odd frames are dropped, generating a frame with
  11087. unchanged height at half frame rate.
  11088. @example
  11089. ------> time
  11090. Input:
  11091. Frame 1 Frame 2 Frame 3 Frame 4
  11092. 11111 22222 33333 44444
  11093. 11111 22222 33333 44444
  11094. 11111 22222 33333 44444
  11095. 11111 22222 33333 44444
  11096. Output:
  11097. 22222 44444
  11098. 22222 44444
  11099. 22222 44444
  11100. 22222 44444
  11101. @end example
  11102. @item pad, 3
  11103. Expand each frame to full height, but pad alternate lines with black,
  11104. generating a frame with double height at the same input frame rate.
  11105. @example
  11106. ------> time
  11107. Input:
  11108. Frame 1 Frame 2 Frame 3 Frame 4
  11109. 11111 22222 33333 44444
  11110. 11111 22222 33333 44444
  11111. 11111 22222 33333 44444
  11112. 11111 22222 33333 44444
  11113. Output:
  11114. 11111 ..... 33333 .....
  11115. ..... 22222 ..... 44444
  11116. 11111 ..... 33333 .....
  11117. ..... 22222 ..... 44444
  11118. 11111 ..... 33333 .....
  11119. ..... 22222 ..... 44444
  11120. 11111 ..... 33333 .....
  11121. ..... 22222 ..... 44444
  11122. @end example
  11123. @item interleave_top, 4
  11124. Interleave the upper field from odd frames with the lower field from
  11125. even frames, generating a frame with unchanged height at half frame rate.
  11126. @example
  11127. ------> time
  11128. Input:
  11129. Frame 1 Frame 2 Frame 3 Frame 4
  11130. 11111<- 22222 33333<- 44444
  11131. 11111 22222<- 33333 44444<-
  11132. 11111<- 22222 33333<- 44444
  11133. 11111 22222<- 33333 44444<-
  11134. Output:
  11135. 11111 33333
  11136. 22222 44444
  11137. 11111 33333
  11138. 22222 44444
  11139. @end example
  11140. @item interleave_bottom, 5
  11141. Interleave the lower field from odd frames with the upper field from
  11142. even frames, generating a frame with unchanged height at half frame rate.
  11143. @example
  11144. ------> time
  11145. Input:
  11146. Frame 1 Frame 2 Frame 3 Frame 4
  11147. 11111 22222<- 33333 44444<-
  11148. 11111<- 22222 33333<- 44444
  11149. 11111 22222<- 33333 44444<-
  11150. 11111<- 22222 33333<- 44444
  11151. Output:
  11152. 22222 44444
  11153. 11111 33333
  11154. 22222 44444
  11155. 11111 33333
  11156. @end example
  11157. @item interlacex2, 6
  11158. Double frame rate with unchanged height. Frames are inserted each
  11159. containing the second temporal field from the previous input frame and
  11160. the first temporal field from the next input frame. This mode relies on
  11161. the top_field_first flag. Useful for interlaced video displays with no
  11162. field synchronisation.
  11163. @example
  11164. ------> time
  11165. Input:
  11166. Frame 1 Frame 2 Frame 3 Frame 4
  11167. 11111 22222 33333 44444
  11168. 11111 22222 33333 44444
  11169. 11111 22222 33333 44444
  11170. 11111 22222 33333 44444
  11171. Output:
  11172. 11111 22222 22222 33333 33333 44444 44444
  11173. 11111 11111 22222 22222 33333 33333 44444
  11174. 11111 22222 22222 33333 33333 44444 44444
  11175. 11111 11111 22222 22222 33333 33333 44444
  11176. @end example
  11177. @item mergex2, 7
  11178. Move odd frames into the upper field, even into the lower field,
  11179. generating a double height frame at same frame rate.
  11180. @example
  11181. ------> time
  11182. Input:
  11183. Frame 1 Frame 2 Frame 3 Frame 4
  11184. 11111 22222 33333 44444
  11185. 11111 22222 33333 44444
  11186. 11111 22222 33333 44444
  11187. 11111 22222 33333 44444
  11188. Output:
  11189. 11111 33333 33333 55555
  11190. 22222 22222 44444 44444
  11191. 11111 33333 33333 55555
  11192. 22222 22222 44444 44444
  11193. 11111 33333 33333 55555
  11194. 22222 22222 44444 44444
  11195. 11111 33333 33333 55555
  11196. 22222 22222 44444 44444
  11197. @end example
  11198. @end table
  11199. Numeric values are deprecated but are accepted for backward
  11200. compatibility reasons.
  11201. Default mode is @code{merge}.
  11202. @item flags
  11203. Specify flags influencing the filter process.
  11204. Available value for @var{flags} is:
  11205. @table @option
  11206. @item low_pass_filter, vlfp
  11207. Enable linear vertical low-pass filtering in the filter.
  11208. Vertical low-pass filtering is required when creating an interlaced
  11209. destination from a progressive source which contains high-frequency
  11210. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  11211. patterning.
  11212. @item complex_filter, cvlfp
  11213. Enable complex vertical low-pass filtering.
  11214. This will slightly less reduce interlace 'twitter' and Moire
  11215. patterning but better retain detail and subjective sharpness impression.
  11216. @end table
  11217. Vertical low-pass filtering can only be enabled for @option{mode}
  11218. @var{interleave_top} and @var{interleave_bottom}.
  11219. @end table
  11220. @section tonemap
  11221. Tone map colors from different dynamic ranges.
  11222. This filter expects data in single precision floating point, as it needs to
  11223. operate on (and can output) out-of-range values. Another filter, such as
  11224. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  11225. The tonemapping algorithms implemented only work on linear light, so input
  11226. data should be linearized beforehand (and possibly correctly tagged).
  11227. @example
  11228. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  11229. @end example
  11230. @subsection Options
  11231. The filter accepts the following options.
  11232. @table @option
  11233. @item tonemap
  11234. Set the tone map algorithm to use.
  11235. Possible values are:
  11236. @table @var
  11237. @item none
  11238. Do not apply any tone map, only desaturate overbright pixels.
  11239. @item clip
  11240. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  11241. in-range values, while distorting out-of-range values.
  11242. @item linear
  11243. Stretch the entire reference gamut to a linear multiple of the display.
  11244. @item gamma
  11245. Fit a logarithmic transfer between the tone curves.
  11246. @item reinhard
  11247. Preserve overall image brightness with a simple curve, using nonlinear
  11248. contrast, which results in flattening details and degrading color accuracy.
  11249. @item hable
  11250. Preserve both dark and bright details better than @var{reinhard}, at the cost
  11251. of slightly darkening everything. Use it when detail preservation is more
  11252. important than color and brightness accuracy.
  11253. @item mobius
  11254. Smoothly map out-of-range values, while retaining contrast and colors for
  11255. in-range material as much as possible. Use it when color accuracy is more
  11256. important than detail preservation.
  11257. @end table
  11258. Default is none.
  11259. @item param
  11260. Tune the tone mapping algorithm.
  11261. This affects the following algorithms:
  11262. @table @var
  11263. @item none
  11264. Ignored.
  11265. @item linear
  11266. Specifies the scale factor to use while stretching.
  11267. Default to 1.0.
  11268. @item gamma
  11269. Specifies the exponent of the function.
  11270. Default to 1.8.
  11271. @item clip
  11272. Specify an extra linear coefficient to multiply into the signal before clipping.
  11273. Default to 1.0.
  11274. @item reinhard
  11275. Specify the local contrast coefficient at the display peak.
  11276. Default to 0.5, which means that in-gamut values will be about half as bright
  11277. as when clipping.
  11278. @item hable
  11279. Ignored.
  11280. @item mobius
  11281. Specify the transition point from linear to mobius transform. Every value
  11282. below this point is guaranteed to be mapped 1:1. The higher the value, the
  11283. more accurate the result will be, at the cost of losing bright details.
  11284. Default to 0.3, which due to the steep initial slope still preserves in-range
  11285. colors fairly accurately.
  11286. @end table
  11287. @item desat
  11288. Apply desaturation for highlights that exceed this level of brightness. The
  11289. higher the parameter, the more color information will be preserved. This
  11290. setting helps prevent unnaturally blown-out colors for super-highlights, by
  11291. (smoothly) turning into white instead. This makes images feel more natural,
  11292. at the cost of reducing information about out-of-range colors.
  11293. The default of 2.0 is somewhat conservative and will mostly just apply to
  11294. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  11295. This option works only if the input frame has a supported color tag.
  11296. @item peak
  11297. Override signal/nominal/reference peak with this value. Useful when the
  11298. embedded peak information in display metadata is not reliable or when tone
  11299. mapping from a lower range to a higher range.
  11300. @end table
  11301. @section transpose
  11302. Transpose rows with columns in the input video and optionally flip it.
  11303. It accepts the following parameters:
  11304. @table @option
  11305. @item dir
  11306. Specify the transposition direction.
  11307. Can assume the following values:
  11308. @table @samp
  11309. @item 0, 4, cclock_flip
  11310. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  11311. @example
  11312. L.R L.l
  11313. . . -> . .
  11314. l.r R.r
  11315. @end example
  11316. @item 1, 5, clock
  11317. Rotate by 90 degrees clockwise, that is:
  11318. @example
  11319. L.R l.L
  11320. . . -> . .
  11321. l.r r.R
  11322. @end example
  11323. @item 2, 6, cclock
  11324. Rotate by 90 degrees counterclockwise, that is:
  11325. @example
  11326. L.R R.r
  11327. . . -> . .
  11328. l.r L.l
  11329. @end example
  11330. @item 3, 7, clock_flip
  11331. Rotate by 90 degrees clockwise and vertically flip, that is:
  11332. @example
  11333. L.R r.R
  11334. . . -> . .
  11335. l.r l.L
  11336. @end example
  11337. @end table
  11338. For values between 4-7, the transposition is only done if the input
  11339. video geometry is portrait and not landscape. These values are
  11340. deprecated, the @code{passthrough} option should be used instead.
  11341. Numerical values are deprecated, and should be dropped in favor of
  11342. symbolic constants.
  11343. @item passthrough
  11344. Do not apply the transposition if the input geometry matches the one
  11345. specified by the specified value. It accepts the following values:
  11346. @table @samp
  11347. @item none
  11348. Always apply transposition.
  11349. @item portrait
  11350. Preserve portrait geometry (when @var{height} >= @var{width}).
  11351. @item landscape
  11352. Preserve landscape geometry (when @var{width} >= @var{height}).
  11353. @end table
  11354. Default value is @code{none}.
  11355. @end table
  11356. For example to rotate by 90 degrees clockwise and preserve portrait
  11357. layout:
  11358. @example
  11359. transpose=dir=1:passthrough=portrait
  11360. @end example
  11361. The command above can also be specified as:
  11362. @example
  11363. transpose=1:portrait
  11364. @end example
  11365. @section trim
  11366. Trim the input so that the output contains one continuous subpart of the input.
  11367. It accepts the following parameters:
  11368. @table @option
  11369. @item start
  11370. Specify the time of the start of the kept section, i.e. the frame with the
  11371. timestamp @var{start} will be the first frame in the output.
  11372. @item end
  11373. Specify the time of the first frame that will be dropped, i.e. the frame
  11374. immediately preceding the one with the timestamp @var{end} will be the last
  11375. frame in the output.
  11376. @item start_pts
  11377. This is the same as @var{start}, except this option sets the start timestamp
  11378. in timebase units instead of seconds.
  11379. @item end_pts
  11380. This is the same as @var{end}, except this option sets the end timestamp
  11381. in timebase units instead of seconds.
  11382. @item duration
  11383. The maximum duration of the output in seconds.
  11384. @item start_frame
  11385. The number of the first frame that should be passed to the output.
  11386. @item end_frame
  11387. The number of the first frame that should be dropped.
  11388. @end table
  11389. @option{start}, @option{end}, and @option{duration} are expressed as time
  11390. duration specifications; see
  11391. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11392. for the accepted syntax.
  11393. Note that the first two sets of the start/end options and the @option{duration}
  11394. option look at the frame timestamp, while the _frame variants simply count the
  11395. frames that pass through the filter. Also note that this filter does not modify
  11396. the timestamps. If you wish for the output timestamps to start at zero, insert a
  11397. setpts filter after the trim filter.
  11398. If multiple start or end options are set, this filter tries to be greedy and
  11399. keep all the frames that match at least one of the specified constraints. To keep
  11400. only the part that matches all the constraints at once, chain multiple trim
  11401. filters.
  11402. The defaults are such that all the input is kept. So it is possible to set e.g.
  11403. just the end values to keep everything before the specified time.
  11404. Examples:
  11405. @itemize
  11406. @item
  11407. Drop everything except the second minute of input:
  11408. @example
  11409. ffmpeg -i INPUT -vf trim=60:120
  11410. @end example
  11411. @item
  11412. Keep only the first second:
  11413. @example
  11414. ffmpeg -i INPUT -vf trim=duration=1
  11415. @end example
  11416. @end itemize
  11417. @section unpremultiply
  11418. Apply alpha unpremultiply effect to input video stream using first plane
  11419. of second stream as alpha.
  11420. Both streams must have same dimensions and same pixel format.
  11421. The filter accepts the following option:
  11422. @table @option
  11423. @item planes
  11424. Set which planes will be processed, unprocessed planes will be copied.
  11425. By default value 0xf, all planes will be processed.
  11426. If the format has 1 or 2 components, then luma is bit 0.
  11427. If the format has 3 or 4 components:
  11428. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  11429. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  11430. If present, the alpha channel is always the last bit.
  11431. @item inplace
  11432. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11433. @end table
  11434. @anchor{unsharp}
  11435. @section unsharp
  11436. Sharpen or blur the input video.
  11437. It accepts the following parameters:
  11438. @table @option
  11439. @item luma_msize_x, lx
  11440. Set the luma matrix horizontal size. It must be an odd integer between
  11441. 3 and 23. The default value is 5.
  11442. @item luma_msize_y, ly
  11443. Set the luma matrix vertical size. It must be an odd integer between 3
  11444. and 23. The default value is 5.
  11445. @item luma_amount, la
  11446. Set the luma effect strength. It must be a floating point number, reasonable
  11447. values lay between -1.5 and 1.5.
  11448. Negative values will blur the input video, while positive values will
  11449. sharpen it, a value of zero will disable the effect.
  11450. Default value is 1.0.
  11451. @item chroma_msize_x, cx
  11452. Set the chroma matrix horizontal size. It must be an odd integer
  11453. between 3 and 23. The default value is 5.
  11454. @item chroma_msize_y, cy
  11455. Set the chroma matrix vertical size. It must be an odd integer
  11456. between 3 and 23. The default value is 5.
  11457. @item chroma_amount, ca
  11458. Set the chroma effect strength. It must be a floating point number, reasonable
  11459. values lay between -1.5 and 1.5.
  11460. Negative values will blur the input video, while positive values will
  11461. sharpen it, a value of zero will disable the effect.
  11462. Default value is 0.0.
  11463. @item opencl
  11464. If set to 1, specify using OpenCL capabilities, only available if
  11465. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  11466. @end table
  11467. All parameters are optional and default to the equivalent of the
  11468. string '5:5:1.0:5:5:0.0'.
  11469. @subsection Examples
  11470. @itemize
  11471. @item
  11472. Apply strong luma sharpen effect:
  11473. @example
  11474. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  11475. @end example
  11476. @item
  11477. Apply a strong blur of both luma and chroma parameters:
  11478. @example
  11479. unsharp=7:7:-2:7:7:-2
  11480. @end example
  11481. @end itemize
  11482. @section uspp
  11483. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  11484. the image at several (or - in the case of @option{quality} level @code{8} - all)
  11485. shifts and average the results.
  11486. The way this differs from the behavior of spp is that uspp actually encodes &
  11487. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  11488. DCT similar to MJPEG.
  11489. The filter accepts the following options:
  11490. @table @option
  11491. @item quality
  11492. Set quality. This option defines the number of levels for averaging. It accepts
  11493. an integer in the range 0-8. If set to @code{0}, the filter will have no
  11494. effect. A value of @code{8} means the higher quality. For each increment of
  11495. that value the speed drops by a factor of approximately 2. Default value is
  11496. @code{3}.
  11497. @item qp
  11498. Force a constant quantization parameter. If not set, the filter will use the QP
  11499. from the video stream (if available).
  11500. @end table
  11501. @section vaguedenoiser
  11502. Apply a wavelet based denoiser.
  11503. It transforms each frame from the video input into the wavelet domain,
  11504. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  11505. the obtained coefficients. It does an inverse wavelet transform after.
  11506. Due to wavelet properties, it should give a nice smoothed result, and
  11507. reduced noise, without blurring picture features.
  11508. This filter accepts the following options:
  11509. @table @option
  11510. @item threshold
  11511. The filtering strength. The higher, the more filtered the video will be.
  11512. Hard thresholding can use a higher threshold than soft thresholding
  11513. before the video looks overfiltered. Default value is 2.
  11514. @item method
  11515. The filtering method the filter will use.
  11516. It accepts the following values:
  11517. @table @samp
  11518. @item hard
  11519. All values under the threshold will be zeroed.
  11520. @item soft
  11521. All values under the threshold will be zeroed. All values above will be
  11522. reduced by the threshold.
  11523. @item garrote
  11524. Scales or nullifies coefficients - intermediary between (more) soft and
  11525. (less) hard thresholding.
  11526. @end table
  11527. Default is garrote.
  11528. @item nsteps
  11529. Number of times, the wavelet will decompose the picture. Picture can't
  11530. be decomposed beyond a particular point (typically, 8 for a 640x480
  11531. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  11532. @item percent
  11533. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  11534. @item planes
  11535. A list of the planes to process. By default all planes are processed.
  11536. @end table
  11537. @section vectorscope
  11538. Display 2 color component values in the two dimensional graph (which is called
  11539. a vectorscope).
  11540. This filter accepts the following options:
  11541. @table @option
  11542. @item mode, m
  11543. Set vectorscope mode.
  11544. It accepts the following values:
  11545. @table @samp
  11546. @item gray
  11547. Gray values are displayed on graph, higher brightness means more pixels have
  11548. same component color value on location in graph. This is the default mode.
  11549. @item color
  11550. Gray values are displayed on graph. Surrounding pixels values which are not
  11551. present in video frame are drawn in gradient of 2 color components which are
  11552. set by option @code{x} and @code{y}. The 3rd color component is static.
  11553. @item color2
  11554. Actual color components values present in video frame are displayed on graph.
  11555. @item color3
  11556. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  11557. on graph increases value of another color component, which is luminance by
  11558. default values of @code{x} and @code{y}.
  11559. @item color4
  11560. Actual colors present in video frame are displayed on graph. If two different
  11561. colors map to same position on graph then color with higher value of component
  11562. not present in graph is picked.
  11563. @item color5
  11564. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  11565. component picked from radial gradient.
  11566. @end table
  11567. @item x
  11568. Set which color component will be represented on X-axis. Default is @code{1}.
  11569. @item y
  11570. Set which color component will be represented on Y-axis. Default is @code{2}.
  11571. @item intensity, i
  11572. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  11573. of color component which represents frequency of (X, Y) location in graph.
  11574. @item envelope, e
  11575. @table @samp
  11576. @item none
  11577. No envelope, this is default.
  11578. @item instant
  11579. Instant envelope, even darkest single pixel will be clearly highlighted.
  11580. @item peak
  11581. Hold maximum and minimum values presented in graph over time. This way you
  11582. can still spot out of range values without constantly looking at vectorscope.
  11583. @item peak+instant
  11584. Peak and instant envelope combined together.
  11585. @end table
  11586. @item graticule, g
  11587. Set what kind of graticule to draw.
  11588. @table @samp
  11589. @item none
  11590. @item green
  11591. @item color
  11592. @end table
  11593. @item opacity, o
  11594. Set graticule opacity.
  11595. @item flags, f
  11596. Set graticule flags.
  11597. @table @samp
  11598. @item white
  11599. Draw graticule for white point.
  11600. @item black
  11601. Draw graticule for black point.
  11602. @item name
  11603. Draw color points short names.
  11604. @end table
  11605. @item bgopacity, b
  11606. Set background opacity.
  11607. @item lthreshold, l
  11608. Set low threshold for color component not represented on X or Y axis.
  11609. Values lower than this value will be ignored. Default is 0.
  11610. Note this value is multiplied with actual max possible value one pixel component
  11611. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  11612. is 0.1 * 255 = 25.
  11613. @item hthreshold, h
  11614. Set high threshold for color component not represented on X or Y axis.
  11615. Values higher than this value will be ignored. Default is 1.
  11616. Note this value is multiplied with actual max possible value one pixel component
  11617. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  11618. is 0.9 * 255 = 230.
  11619. @item colorspace, c
  11620. Set what kind of colorspace to use when drawing graticule.
  11621. @table @samp
  11622. @item auto
  11623. @item 601
  11624. @item 709
  11625. @end table
  11626. Default is auto.
  11627. @end table
  11628. @anchor{vidstabdetect}
  11629. @section vidstabdetect
  11630. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  11631. @ref{vidstabtransform} for pass 2.
  11632. This filter generates a file with relative translation and rotation
  11633. transform information about subsequent frames, which is then used by
  11634. the @ref{vidstabtransform} filter.
  11635. To enable compilation of this filter you need to configure FFmpeg with
  11636. @code{--enable-libvidstab}.
  11637. This filter accepts the following options:
  11638. @table @option
  11639. @item result
  11640. Set the path to the file used to write the transforms information.
  11641. Default value is @file{transforms.trf}.
  11642. @item shakiness
  11643. Set how shaky the video is and how quick the camera is. It accepts an
  11644. integer in the range 1-10, a value of 1 means little shakiness, a
  11645. value of 10 means strong shakiness. Default value is 5.
  11646. @item accuracy
  11647. Set the accuracy of the detection process. It must be a value in the
  11648. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  11649. accuracy. Default value is 15.
  11650. @item stepsize
  11651. Set stepsize of the search process. The region around minimum is
  11652. scanned with 1 pixel resolution. Default value is 6.
  11653. @item mincontrast
  11654. Set minimum contrast. Below this value a local measurement field is
  11655. discarded. Must be a floating point value in the range 0-1. Default
  11656. value is 0.3.
  11657. @item tripod
  11658. Set reference frame number for tripod mode.
  11659. If enabled, the motion of the frames is compared to a reference frame
  11660. in the filtered stream, identified by the specified number. The idea
  11661. is to compensate all movements in a more-or-less static scene and keep
  11662. the camera view absolutely still.
  11663. If set to 0, it is disabled. The frames are counted starting from 1.
  11664. @item show
  11665. Show fields and transforms in the resulting frames. It accepts an
  11666. integer in the range 0-2. Default value is 0, which disables any
  11667. visualization.
  11668. @end table
  11669. @subsection Examples
  11670. @itemize
  11671. @item
  11672. Use default values:
  11673. @example
  11674. vidstabdetect
  11675. @end example
  11676. @item
  11677. Analyze strongly shaky movie and put the results in file
  11678. @file{mytransforms.trf}:
  11679. @example
  11680. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  11681. @end example
  11682. @item
  11683. Visualize the result of internal transformations in the resulting
  11684. video:
  11685. @example
  11686. vidstabdetect=show=1
  11687. @end example
  11688. @item
  11689. Analyze a video with medium shakiness using @command{ffmpeg}:
  11690. @example
  11691. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  11692. @end example
  11693. @end itemize
  11694. @anchor{vidstabtransform}
  11695. @section vidstabtransform
  11696. Video stabilization/deshaking: pass 2 of 2,
  11697. see @ref{vidstabdetect} for pass 1.
  11698. Read a file with transform information for each frame and
  11699. apply/compensate them. Together with the @ref{vidstabdetect}
  11700. filter this can be used to deshake videos. See also
  11701. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  11702. the @ref{unsharp} filter, see below.
  11703. To enable compilation of this filter you need to configure FFmpeg with
  11704. @code{--enable-libvidstab}.
  11705. @subsection Options
  11706. @table @option
  11707. @item input
  11708. Set path to the file used to read the transforms. Default value is
  11709. @file{transforms.trf}.
  11710. @item smoothing
  11711. Set the number of frames (value*2 + 1) used for lowpass filtering the
  11712. camera movements. Default value is 10.
  11713. For example a number of 10 means that 21 frames are used (10 in the
  11714. past and 10 in the future) to smoothen the motion in the video. A
  11715. larger value leads to a smoother video, but limits the acceleration of
  11716. the camera (pan/tilt movements). 0 is a special case where a static
  11717. camera is simulated.
  11718. @item optalgo
  11719. Set the camera path optimization algorithm.
  11720. Accepted values are:
  11721. @table @samp
  11722. @item gauss
  11723. gaussian kernel low-pass filter on camera motion (default)
  11724. @item avg
  11725. averaging on transformations
  11726. @end table
  11727. @item maxshift
  11728. Set maximal number of pixels to translate frames. Default value is -1,
  11729. meaning no limit.
  11730. @item maxangle
  11731. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  11732. value is -1, meaning no limit.
  11733. @item crop
  11734. Specify how to deal with borders that may be visible due to movement
  11735. compensation.
  11736. Available values are:
  11737. @table @samp
  11738. @item keep
  11739. keep image information from previous frame (default)
  11740. @item black
  11741. fill the border black
  11742. @end table
  11743. @item invert
  11744. Invert transforms if set to 1. Default value is 0.
  11745. @item relative
  11746. Consider transforms as relative to previous frame if set to 1,
  11747. absolute if set to 0. Default value is 0.
  11748. @item zoom
  11749. Set percentage to zoom. A positive value will result in a zoom-in
  11750. effect, a negative value in a zoom-out effect. Default value is 0 (no
  11751. zoom).
  11752. @item optzoom
  11753. Set optimal zooming to avoid borders.
  11754. Accepted values are:
  11755. @table @samp
  11756. @item 0
  11757. disabled
  11758. @item 1
  11759. optimal static zoom value is determined (only very strong movements
  11760. will lead to visible borders) (default)
  11761. @item 2
  11762. optimal adaptive zoom value is determined (no borders will be
  11763. visible), see @option{zoomspeed}
  11764. @end table
  11765. Note that the value given at zoom is added to the one calculated here.
  11766. @item zoomspeed
  11767. Set percent to zoom maximally each frame (enabled when
  11768. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  11769. 0.25.
  11770. @item interpol
  11771. Specify type of interpolation.
  11772. Available values are:
  11773. @table @samp
  11774. @item no
  11775. no interpolation
  11776. @item linear
  11777. linear only horizontal
  11778. @item bilinear
  11779. linear in both directions (default)
  11780. @item bicubic
  11781. cubic in both directions (slow)
  11782. @end table
  11783. @item tripod
  11784. Enable virtual tripod mode if set to 1, which is equivalent to
  11785. @code{relative=0:smoothing=0}. Default value is 0.
  11786. Use also @code{tripod} option of @ref{vidstabdetect}.
  11787. @item debug
  11788. Increase log verbosity if set to 1. Also the detected global motions
  11789. are written to the temporary file @file{global_motions.trf}. Default
  11790. value is 0.
  11791. @end table
  11792. @subsection Examples
  11793. @itemize
  11794. @item
  11795. Use @command{ffmpeg} for a typical stabilization with default values:
  11796. @example
  11797. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  11798. @end example
  11799. Note the use of the @ref{unsharp} filter which is always recommended.
  11800. @item
  11801. Zoom in a bit more and load transform data from a given file:
  11802. @example
  11803. vidstabtransform=zoom=5:input="mytransforms.trf"
  11804. @end example
  11805. @item
  11806. Smoothen the video even more:
  11807. @example
  11808. vidstabtransform=smoothing=30
  11809. @end example
  11810. @end itemize
  11811. @section vflip
  11812. Flip the input video vertically.
  11813. For example, to vertically flip a video with @command{ffmpeg}:
  11814. @example
  11815. ffmpeg -i in.avi -vf "vflip" out.avi
  11816. @end example
  11817. @anchor{vignette}
  11818. @section vignette
  11819. Make or reverse a natural vignetting effect.
  11820. The filter accepts the following options:
  11821. @table @option
  11822. @item angle, a
  11823. Set lens angle expression as a number of radians.
  11824. The value is clipped in the @code{[0,PI/2]} range.
  11825. Default value: @code{"PI/5"}
  11826. @item x0
  11827. @item y0
  11828. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  11829. by default.
  11830. @item mode
  11831. Set forward/backward mode.
  11832. Available modes are:
  11833. @table @samp
  11834. @item forward
  11835. The larger the distance from the central point, the darker the image becomes.
  11836. @item backward
  11837. The larger the distance from the central point, the brighter the image becomes.
  11838. This can be used to reverse a vignette effect, though there is no automatic
  11839. detection to extract the lens @option{angle} and other settings (yet). It can
  11840. also be used to create a burning effect.
  11841. @end table
  11842. Default value is @samp{forward}.
  11843. @item eval
  11844. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  11845. It accepts the following values:
  11846. @table @samp
  11847. @item init
  11848. Evaluate expressions only once during the filter initialization.
  11849. @item frame
  11850. Evaluate expressions for each incoming frame. This is way slower than the
  11851. @samp{init} mode since it requires all the scalers to be re-computed, but it
  11852. allows advanced dynamic expressions.
  11853. @end table
  11854. Default value is @samp{init}.
  11855. @item dither
  11856. Set dithering to reduce the circular banding effects. Default is @code{1}
  11857. (enabled).
  11858. @item aspect
  11859. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  11860. Setting this value to the SAR of the input will make a rectangular vignetting
  11861. following the dimensions of the video.
  11862. Default is @code{1/1}.
  11863. @end table
  11864. @subsection Expressions
  11865. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  11866. following parameters.
  11867. @table @option
  11868. @item w
  11869. @item h
  11870. input width and height
  11871. @item n
  11872. the number of input frame, starting from 0
  11873. @item pts
  11874. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  11875. @var{TB} units, NAN if undefined
  11876. @item r
  11877. frame rate of the input video, NAN if the input frame rate is unknown
  11878. @item t
  11879. the PTS (Presentation TimeStamp) of the filtered video frame,
  11880. expressed in seconds, NAN if undefined
  11881. @item tb
  11882. time base of the input video
  11883. @end table
  11884. @subsection Examples
  11885. @itemize
  11886. @item
  11887. Apply simple strong vignetting effect:
  11888. @example
  11889. vignette=PI/4
  11890. @end example
  11891. @item
  11892. Make a flickering vignetting:
  11893. @example
  11894. vignette='PI/4+random(1)*PI/50':eval=frame
  11895. @end example
  11896. @end itemize
  11897. @section vmafmotion
  11898. Obtain the average vmaf motion score of a video.
  11899. It is one of the component filters of VMAF.
  11900. The obtained average motion score is printed through the logging system.
  11901. In the below example the input file @file{ref.mpg} is being processed and score
  11902. is computed.
  11903. @example
  11904. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  11905. @end example
  11906. @section vstack
  11907. Stack input videos vertically.
  11908. All streams must be of same pixel format and of same width.
  11909. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  11910. to create same output.
  11911. The filter accept the following option:
  11912. @table @option
  11913. @item inputs
  11914. Set number of input streams. Default is 2.
  11915. @item shortest
  11916. If set to 1, force the output to terminate when the shortest input
  11917. terminates. Default value is 0.
  11918. @end table
  11919. @section w3fdif
  11920. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  11921. Deinterlacing Filter").
  11922. Based on the process described by Martin Weston for BBC R&D, and
  11923. implemented based on the de-interlace algorithm written by Jim
  11924. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  11925. uses filter coefficients calculated by BBC R&D.
  11926. There are two sets of filter coefficients, so called "simple":
  11927. and "complex". Which set of filter coefficients is used can
  11928. be set by passing an optional parameter:
  11929. @table @option
  11930. @item filter
  11931. Set the interlacing filter coefficients. Accepts one of the following values:
  11932. @table @samp
  11933. @item simple
  11934. Simple filter coefficient set.
  11935. @item complex
  11936. More-complex filter coefficient set.
  11937. @end table
  11938. Default value is @samp{complex}.
  11939. @item deint
  11940. Specify which frames to deinterlace. Accept one of the following values:
  11941. @table @samp
  11942. @item all
  11943. Deinterlace all frames,
  11944. @item interlaced
  11945. Only deinterlace frames marked as interlaced.
  11946. @end table
  11947. Default value is @samp{all}.
  11948. @end table
  11949. @section waveform
  11950. Video waveform monitor.
  11951. The waveform monitor plots color component intensity. By default luminance
  11952. only. Each column of the waveform corresponds to a column of pixels in the
  11953. source video.
  11954. It accepts the following options:
  11955. @table @option
  11956. @item mode, m
  11957. Can be either @code{row}, or @code{column}. Default is @code{column}.
  11958. In row mode, the graph on the left side represents color component value 0 and
  11959. the right side represents value = 255. In column mode, the top side represents
  11960. color component value = 0 and bottom side represents value = 255.
  11961. @item intensity, i
  11962. Set intensity. Smaller values are useful to find out how many values of the same
  11963. luminance are distributed across input rows/columns.
  11964. Default value is @code{0.04}. Allowed range is [0, 1].
  11965. @item mirror, r
  11966. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  11967. In mirrored mode, higher values will be represented on the left
  11968. side for @code{row} mode and at the top for @code{column} mode. Default is
  11969. @code{1} (mirrored).
  11970. @item display, d
  11971. Set display mode.
  11972. It accepts the following values:
  11973. @table @samp
  11974. @item overlay
  11975. Presents information identical to that in the @code{parade}, except
  11976. that the graphs representing color components are superimposed directly
  11977. over one another.
  11978. This display mode makes it easier to spot relative differences or similarities
  11979. in overlapping areas of the color components that are supposed to be identical,
  11980. such as neutral whites, grays, or blacks.
  11981. @item stack
  11982. Display separate graph for the color components side by side in
  11983. @code{row} mode or one below the other in @code{column} mode.
  11984. @item parade
  11985. Display separate graph for the color components side by side in
  11986. @code{column} mode or one below the other in @code{row} mode.
  11987. Using this display mode makes it easy to spot color casts in the highlights
  11988. and shadows of an image, by comparing the contours of the top and the bottom
  11989. graphs of each waveform. Since whites, grays, and blacks are characterized
  11990. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  11991. should display three waveforms of roughly equal width/height. If not, the
  11992. correction is easy to perform by making level adjustments the three waveforms.
  11993. @end table
  11994. Default is @code{stack}.
  11995. @item components, c
  11996. Set which color components to display. Default is 1, which means only luminance
  11997. or red color component if input is in RGB colorspace. If is set for example to
  11998. 7 it will display all 3 (if) available color components.
  11999. @item envelope, e
  12000. @table @samp
  12001. @item none
  12002. No envelope, this is default.
  12003. @item instant
  12004. Instant envelope, minimum and maximum values presented in graph will be easily
  12005. visible even with small @code{step} value.
  12006. @item peak
  12007. Hold minimum and maximum values presented in graph across time. This way you
  12008. can still spot out of range values without constantly looking at waveforms.
  12009. @item peak+instant
  12010. Peak and instant envelope combined together.
  12011. @end table
  12012. @item filter, f
  12013. @table @samp
  12014. @item lowpass
  12015. No filtering, this is default.
  12016. @item flat
  12017. Luma and chroma combined together.
  12018. @item aflat
  12019. Similar as above, but shows difference between blue and red chroma.
  12020. @item chroma
  12021. Displays only chroma.
  12022. @item color
  12023. Displays actual color value on waveform.
  12024. @item acolor
  12025. Similar as above, but with luma showing frequency of chroma values.
  12026. @end table
  12027. @item graticule, g
  12028. Set which graticule to display.
  12029. @table @samp
  12030. @item none
  12031. Do not display graticule.
  12032. @item green
  12033. Display green graticule showing legal broadcast ranges.
  12034. @end table
  12035. @item opacity, o
  12036. Set graticule opacity.
  12037. @item flags, fl
  12038. Set graticule flags.
  12039. @table @samp
  12040. @item numbers
  12041. Draw numbers above lines. By default enabled.
  12042. @item dots
  12043. Draw dots instead of lines.
  12044. @end table
  12045. @item scale, s
  12046. Set scale used for displaying graticule.
  12047. @table @samp
  12048. @item digital
  12049. @item millivolts
  12050. @item ire
  12051. @end table
  12052. Default is digital.
  12053. @item bgopacity, b
  12054. Set background opacity.
  12055. @end table
  12056. @section weave, doubleweave
  12057. The @code{weave} takes a field-based video input and join
  12058. each two sequential fields into single frame, producing a new double
  12059. height clip with half the frame rate and half the frame count.
  12060. The @code{doubleweave} works same as @code{weave} but without
  12061. halving frame rate and frame count.
  12062. It accepts the following option:
  12063. @table @option
  12064. @item first_field
  12065. Set first field. Available values are:
  12066. @table @samp
  12067. @item top, t
  12068. Set the frame as top-field-first.
  12069. @item bottom, b
  12070. Set the frame as bottom-field-first.
  12071. @end table
  12072. @end table
  12073. @subsection Examples
  12074. @itemize
  12075. @item
  12076. Interlace video using @ref{select} and @ref{separatefields} filter:
  12077. @example
  12078. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  12079. @end example
  12080. @end itemize
  12081. @section xbr
  12082. Apply the xBR high-quality magnification filter which is designed for pixel
  12083. art. It follows a set of edge-detection rules, see
  12084. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  12085. It accepts the following option:
  12086. @table @option
  12087. @item n
  12088. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  12089. @code{3xBR} and @code{4} for @code{4xBR}.
  12090. Default is @code{3}.
  12091. @end table
  12092. @anchor{yadif}
  12093. @section yadif
  12094. Deinterlace the input video ("yadif" means "yet another deinterlacing
  12095. filter").
  12096. It accepts the following parameters:
  12097. @table @option
  12098. @item mode
  12099. The interlacing mode to adopt. It accepts one of the following values:
  12100. @table @option
  12101. @item 0, send_frame
  12102. Output one frame for each frame.
  12103. @item 1, send_field
  12104. Output one frame for each field.
  12105. @item 2, send_frame_nospatial
  12106. Like @code{send_frame}, but it skips the spatial interlacing check.
  12107. @item 3, send_field_nospatial
  12108. Like @code{send_field}, but it skips the spatial interlacing check.
  12109. @end table
  12110. The default value is @code{send_frame}.
  12111. @item parity
  12112. The picture field parity assumed for the input interlaced video. It accepts one
  12113. of the following values:
  12114. @table @option
  12115. @item 0, tff
  12116. Assume the top field is first.
  12117. @item 1, bff
  12118. Assume the bottom field is first.
  12119. @item -1, auto
  12120. Enable automatic detection of field parity.
  12121. @end table
  12122. The default value is @code{auto}.
  12123. If the interlacing is unknown or the decoder does not export this information,
  12124. top field first will be assumed.
  12125. @item deint
  12126. Specify which frames to deinterlace. Accept one of the following
  12127. values:
  12128. @table @option
  12129. @item 0, all
  12130. Deinterlace all frames.
  12131. @item 1, interlaced
  12132. Only deinterlace frames marked as interlaced.
  12133. @end table
  12134. The default value is @code{all}.
  12135. @end table
  12136. @section zoompan
  12137. Apply Zoom & Pan effect.
  12138. This filter accepts the following options:
  12139. @table @option
  12140. @item zoom, z
  12141. Set the zoom expression. Default is 1.
  12142. @item x
  12143. @item y
  12144. Set the x and y expression. Default is 0.
  12145. @item d
  12146. Set the duration expression in number of frames.
  12147. This sets for how many number of frames effect will last for
  12148. single input image.
  12149. @item s
  12150. Set the output image size, default is 'hd720'.
  12151. @item fps
  12152. Set the output frame rate, default is '25'.
  12153. @end table
  12154. Each expression can contain the following constants:
  12155. @table @option
  12156. @item in_w, iw
  12157. Input width.
  12158. @item in_h, ih
  12159. Input height.
  12160. @item out_w, ow
  12161. Output width.
  12162. @item out_h, oh
  12163. Output height.
  12164. @item in
  12165. Input frame count.
  12166. @item on
  12167. Output frame count.
  12168. @item x
  12169. @item y
  12170. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  12171. for current input frame.
  12172. @item px
  12173. @item py
  12174. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  12175. not yet such frame (first input frame).
  12176. @item zoom
  12177. Last calculated zoom from 'z' expression for current input frame.
  12178. @item pzoom
  12179. Last calculated zoom of last output frame of previous input frame.
  12180. @item duration
  12181. Number of output frames for current input frame. Calculated from 'd' expression
  12182. for each input frame.
  12183. @item pduration
  12184. number of output frames created for previous input frame
  12185. @item a
  12186. Rational number: input width / input height
  12187. @item sar
  12188. sample aspect ratio
  12189. @item dar
  12190. display aspect ratio
  12191. @end table
  12192. @subsection Examples
  12193. @itemize
  12194. @item
  12195. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  12196. @example
  12197. 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
  12198. @end example
  12199. @item
  12200. Zoom-in up to 1.5 and pan always at center of picture:
  12201. @example
  12202. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12203. @end example
  12204. @item
  12205. Same as above but without pausing:
  12206. @example
  12207. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12208. @end example
  12209. @end itemize
  12210. @anchor{zscale}
  12211. @section zscale
  12212. Scale (resize) the input video, using the z.lib library:
  12213. https://github.com/sekrit-twc/zimg.
  12214. The zscale filter forces the output display aspect ratio to be the same
  12215. as the input, by changing the output sample aspect ratio.
  12216. If the input image format is different from the format requested by
  12217. the next filter, the zscale filter will convert the input to the
  12218. requested format.
  12219. @subsection Options
  12220. The filter accepts the following options.
  12221. @table @option
  12222. @item width, w
  12223. @item height, h
  12224. Set the output video dimension expression. Default value is the input
  12225. dimension.
  12226. If the @var{width} or @var{w} value is 0, the input width is used for
  12227. the output. If the @var{height} or @var{h} value is 0, the input height
  12228. is used for the output.
  12229. If one and only one of the values is -n with n >= 1, the zscale filter
  12230. will use a value that maintains the aspect ratio of the input image,
  12231. calculated from the other specified dimension. After that it will,
  12232. however, make sure that the calculated dimension is divisible by n and
  12233. adjust the value if necessary.
  12234. If both values are -n with n >= 1, the behavior will be identical to
  12235. both values being set to 0 as previously detailed.
  12236. See below for the list of accepted constants for use in the dimension
  12237. expression.
  12238. @item size, s
  12239. Set the video size. For the syntax of this option, check the
  12240. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12241. @item dither, d
  12242. Set the dither type.
  12243. Possible values are:
  12244. @table @var
  12245. @item none
  12246. @item ordered
  12247. @item random
  12248. @item error_diffusion
  12249. @end table
  12250. Default is none.
  12251. @item filter, f
  12252. Set the resize filter type.
  12253. Possible values are:
  12254. @table @var
  12255. @item point
  12256. @item bilinear
  12257. @item bicubic
  12258. @item spline16
  12259. @item spline36
  12260. @item lanczos
  12261. @end table
  12262. Default is bilinear.
  12263. @item range, r
  12264. Set the color range.
  12265. Possible values are:
  12266. @table @var
  12267. @item input
  12268. @item limited
  12269. @item full
  12270. @end table
  12271. Default is same as input.
  12272. @item primaries, p
  12273. Set the color primaries.
  12274. Possible values are:
  12275. @table @var
  12276. @item input
  12277. @item 709
  12278. @item unspecified
  12279. @item 170m
  12280. @item 240m
  12281. @item 2020
  12282. @end table
  12283. Default is same as input.
  12284. @item transfer, t
  12285. Set the transfer characteristics.
  12286. Possible values are:
  12287. @table @var
  12288. @item input
  12289. @item 709
  12290. @item unspecified
  12291. @item 601
  12292. @item linear
  12293. @item 2020_10
  12294. @item 2020_12
  12295. @item smpte2084
  12296. @item iec61966-2-1
  12297. @item arib-std-b67
  12298. @end table
  12299. Default is same as input.
  12300. @item matrix, m
  12301. Set the colorspace matrix.
  12302. Possible value are:
  12303. @table @var
  12304. @item input
  12305. @item 709
  12306. @item unspecified
  12307. @item 470bg
  12308. @item 170m
  12309. @item 2020_ncl
  12310. @item 2020_cl
  12311. @end table
  12312. Default is same as input.
  12313. @item rangein, rin
  12314. Set the input color range.
  12315. Possible values are:
  12316. @table @var
  12317. @item input
  12318. @item limited
  12319. @item full
  12320. @end table
  12321. Default is same as input.
  12322. @item primariesin, pin
  12323. Set the input color primaries.
  12324. Possible values are:
  12325. @table @var
  12326. @item input
  12327. @item 709
  12328. @item unspecified
  12329. @item 170m
  12330. @item 240m
  12331. @item 2020
  12332. @end table
  12333. Default is same as input.
  12334. @item transferin, tin
  12335. Set the input transfer characteristics.
  12336. Possible values are:
  12337. @table @var
  12338. @item input
  12339. @item 709
  12340. @item unspecified
  12341. @item 601
  12342. @item linear
  12343. @item 2020_10
  12344. @item 2020_12
  12345. @end table
  12346. Default is same as input.
  12347. @item matrixin, min
  12348. Set the input colorspace matrix.
  12349. Possible value are:
  12350. @table @var
  12351. @item input
  12352. @item 709
  12353. @item unspecified
  12354. @item 470bg
  12355. @item 170m
  12356. @item 2020_ncl
  12357. @item 2020_cl
  12358. @end table
  12359. @item chromal, c
  12360. Set the output chroma location.
  12361. Possible values are:
  12362. @table @var
  12363. @item input
  12364. @item left
  12365. @item center
  12366. @item topleft
  12367. @item top
  12368. @item bottomleft
  12369. @item bottom
  12370. @end table
  12371. @item chromalin, cin
  12372. Set the input chroma location.
  12373. Possible values are:
  12374. @table @var
  12375. @item input
  12376. @item left
  12377. @item center
  12378. @item topleft
  12379. @item top
  12380. @item bottomleft
  12381. @item bottom
  12382. @end table
  12383. @item npl
  12384. Set the nominal peak luminance.
  12385. @end table
  12386. The values of the @option{w} and @option{h} options are expressions
  12387. containing the following constants:
  12388. @table @var
  12389. @item in_w
  12390. @item in_h
  12391. The input width and height
  12392. @item iw
  12393. @item ih
  12394. These are the same as @var{in_w} and @var{in_h}.
  12395. @item out_w
  12396. @item out_h
  12397. The output (scaled) width and height
  12398. @item ow
  12399. @item oh
  12400. These are the same as @var{out_w} and @var{out_h}
  12401. @item a
  12402. The same as @var{iw} / @var{ih}
  12403. @item sar
  12404. input sample aspect ratio
  12405. @item dar
  12406. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12407. @item hsub
  12408. @item vsub
  12409. horizontal and vertical input chroma subsample values. For example for the
  12410. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12411. @item ohsub
  12412. @item ovsub
  12413. horizontal and vertical output chroma subsample values. For example for the
  12414. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12415. @end table
  12416. @table @option
  12417. @end table
  12418. @c man end VIDEO FILTERS
  12419. @chapter Video Sources
  12420. @c man begin VIDEO SOURCES
  12421. Below is a description of the currently available video sources.
  12422. @section buffer
  12423. Buffer video frames, and make them available to the filter chain.
  12424. This source is mainly intended for a programmatic use, in particular
  12425. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  12426. It accepts the following parameters:
  12427. @table @option
  12428. @item video_size
  12429. Specify the size (width and height) of the buffered video frames. For the
  12430. syntax of this option, check the
  12431. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12432. @item width
  12433. The input video width.
  12434. @item height
  12435. The input video height.
  12436. @item pix_fmt
  12437. A string representing the pixel format of the buffered video frames.
  12438. It may be a number corresponding to a pixel format, or a pixel format
  12439. name.
  12440. @item time_base
  12441. Specify the timebase assumed by the timestamps of the buffered frames.
  12442. @item frame_rate
  12443. Specify the frame rate expected for the video stream.
  12444. @item pixel_aspect, sar
  12445. The sample (pixel) aspect ratio of the input video.
  12446. @item sws_param
  12447. Specify the optional parameters to be used for the scale filter which
  12448. is automatically inserted when an input change is detected in the
  12449. input size or format.
  12450. @item hw_frames_ctx
  12451. When using a hardware pixel format, this should be a reference to an
  12452. AVHWFramesContext describing input frames.
  12453. @end table
  12454. For example:
  12455. @example
  12456. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  12457. @end example
  12458. will instruct the source to accept video frames with size 320x240 and
  12459. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  12460. square pixels (1:1 sample aspect ratio).
  12461. Since the pixel format with name "yuv410p" corresponds to the number 6
  12462. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  12463. this example corresponds to:
  12464. @example
  12465. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  12466. @end example
  12467. Alternatively, the options can be specified as a flat string, but this
  12468. syntax is deprecated:
  12469. @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}]
  12470. @section cellauto
  12471. Create a pattern generated by an elementary cellular automaton.
  12472. The initial state of the cellular automaton can be defined through the
  12473. @option{filename} and @option{pattern} options. If such options are
  12474. not specified an initial state is created randomly.
  12475. At each new frame a new row in the video is filled with the result of
  12476. the cellular automaton next generation. The behavior when the whole
  12477. frame is filled is defined by the @option{scroll} option.
  12478. This source accepts the following options:
  12479. @table @option
  12480. @item filename, f
  12481. Read the initial cellular automaton state, i.e. the starting row, from
  12482. the specified file.
  12483. In the file, each non-whitespace character is considered an alive
  12484. cell, a newline will terminate the row, and further characters in the
  12485. file will be ignored.
  12486. @item pattern, p
  12487. Read the initial cellular automaton state, i.e. the starting row, from
  12488. the specified string.
  12489. Each non-whitespace character in the string is considered an alive
  12490. cell, a newline will terminate the row, and further characters in the
  12491. string will be ignored.
  12492. @item rate, r
  12493. Set the video rate, that is the number of frames generated per second.
  12494. Default is 25.
  12495. @item random_fill_ratio, ratio
  12496. Set the random fill ratio for the initial cellular automaton row. It
  12497. is a floating point number value ranging from 0 to 1, defaults to
  12498. 1/PHI.
  12499. This option is ignored when a file or a pattern is specified.
  12500. @item random_seed, seed
  12501. Set the seed for filling randomly the initial row, must be an integer
  12502. included between 0 and UINT32_MAX. If not specified, or if explicitly
  12503. set to -1, the filter will try to use a good random seed on a best
  12504. effort basis.
  12505. @item rule
  12506. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  12507. Default value is 110.
  12508. @item size, s
  12509. Set the size of the output video. For the syntax of this option, check the
  12510. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12511. If @option{filename} or @option{pattern} is specified, the size is set
  12512. by default to the width of the specified initial state row, and the
  12513. height is set to @var{width} * PHI.
  12514. If @option{size} is set, it must contain the width of the specified
  12515. pattern string, and the specified pattern will be centered in the
  12516. larger row.
  12517. If a filename or a pattern string is not specified, the size value
  12518. defaults to "320x518" (used for a randomly generated initial state).
  12519. @item scroll
  12520. If set to 1, scroll the output upward when all the rows in the output
  12521. have been already filled. If set to 0, the new generated row will be
  12522. written over the top row just after the bottom row is filled.
  12523. Defaults to 1.
  12524. @item start_full, full
  12525. If set to 1, completely fill the output with generated rows before
  12526. outputting the first frame.
  12527. This is the default behavior, for disabling set the value to 0.
  12528. @item stitch
  12529. If set to 1, stitch the left and right row edges together.
  12530. This is the default behavior, for disabling set the value to 0.
  12531. @end table
  12532. @subsection Examples
  12533. @itemize
  12534. @item
  12535. Read the initial state from @file{pattern}, and specify an output of
  12536. size 200x400.
  12537. @example
  12538. cellauto=f=pattern:s=200x400
  12539. @end example
  12540. @item
  12541. Generate a random initial row with a width of 200 cells, with a fill
  12542. ratio of 2/3:
  12543. @example
  12544. cellauto=ratio=2/3:s=200x200
  12545. @end example
  12546. @item
  12547. Create a pattern generated by rule 18 starting by a single alive cell
  12548. centered on an initial row with width 100:
  12549. @example
  12550. cellauto=p=@@:s=100x400:full=0:rule=18
  12551. @end example
  12552. @item
  12553. Specify a more elaborated initial pattern:
  12554. @example
  12555. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  12556. @end example
  12557. @end itemize
  12558. @anchor{coreimagesrc}
  12559. @section coreimagesrc
  12560. Video source generated on GPU using Apple's CoreImage API on OSX.
  12561. This video source is a specialized version of the @ref{coreimage} video filter.
  12562. Use a core image generator at the beginning of the applied filterchain to
  12563. generate the content.
  12564. The coreimagesrc video source accepts the following options:
  12565. @table @option
  12566. @item list_generators
  12567. List all available generators along with all their respective options as well as
  12568. possible minimum and maximum values along with the default values.
  12569. @example
  12570. list_generators=true
  12571. @end example
  12572. @item size, s
  12573. Specify the size of the sourced video. For the syntax of this option, check the
  12574. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12575. The default value is @code{320x240}.
  12576. @item rate, r
  12577. Specify the frame rate of the sourced video, as the number of frames
  12578. generated per second. It has to be a string in the format
  12579. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12580. number or a valid video frame rate abbreviation. The default value is
  12581. "25".
  12582. @item sar
  12583. Set the sample aspect ratio of the sourced video.
  12584. @item duration, d
  12585. Set the duration of the sourced video. See
  12586. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12587. for the accepted syntax.
  12588. If not specified, or the expressed duration is negative, the video is
  12589. supposed to be generated forever.
  12590. @end table
  12591. Additionally, all options of the @ref{coreimage} video filter are accepted.
  12592. A complete filterchain can be used for further processing of the
  12593. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  12594. and examples for details.
  12595. @subsection Examples
  12596. @itemize
  12597. @item
  12598. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  12599. given as complete and escaped command-line for Apple's standard bash shell:
  12600. @example
  12601. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  12602. @end example
  12603. This example is equivalent to the QRCode example of @ref{coreimage} without the
  12604. need for a nullsrc video source.
  12605. @end itemize
  12606. @section mandelbrot
  12607. Generate a Mandelbrot set fractal, and progressively zoom towards the
  12608. point specified with @var{start_x} and @var{start_y}.
  12609. This source accepts the following options:
  12610. @table @option
  12611. @item end_pts
  12612. Set the terminal pts value. Default value is 400.
  12613. @item end_scale
  12614. Set the terminal scale value.
  12615. Must be a floating point value. Default value is 0.3.
  12616. @item inner
  12617. Set the inner coloring mode, that is the algorithm used to draw the
  12618. Mandelbrot fractal internal region.
  12619. It shall assume one of the following values:
  12620. @table @option
  12621. @item black
  12622. Set black mode.
  12623. @item convergence
  12624. Show time until convergence.
  12625. @item mincol
  12626. Set color based on point closest to the origin of the iterations.
  12627. @item period
  12628. Set period mode.
  12629. @end table
  12630. Default value is @var{mincol}.
  12631. @item bailout
  12632. Set the bailout value. Default value is 10.0.
  12633. @item maxiter
  12634. Set the maximum of iterations performed by the rendering
  12635. algorithm. Default value is 7189.
  12636. @item outer
  12637. Set outer coloring mode.
  12638. It shall assume one of following values:
  12639. @table @option
  12640. @item iteration_count
  12641. Set iteration cound mode.
  12642. @item normalized_iteration_count
  12643. set normalized iteration count mode.
  12644. @end table
  12645. Default value is @var{normalized_iteration_count}.
  12646. @item rate, r
  12647. Set frame rate, expressed as number of frames per second. Default
  12648. value is "25".
  12649. @item size, s
  12650. Set frame size. For the syntax of this option, check the "Video
  12651. size" section in the ffmpeg-utils manual. Default value is "640x480".
  12652. @item start_scale
  12653. Set the initial scale value. Default value is 3.0.
  12654. @item start_x
  12655. Set the initial x position. Must be a floating point value between
  12656. -100 and 100. Default value is -0.743643887037158704752191506114774.
  12657. @item start_y
  12658. Set the initial y position. Must be a floating point value between
  12659. -100 and 100. Default value is -0.131825904205311970493132056385139.
  12660. @end table
  12661. @section mptestsrc
  12662. Generate various test patterns, as generated by the MPlayer test filter.
  12663. The size of the generated video is fixed, and is 256x256.
  12664. This source is useful in particular for testing encoding features.
  12665. This source accepts the following options:
  12666. @table @option
  12667. @item rate, r
  12668. Specify the frame rate of the sourced video, as the number of frames
  12669. generated per second. It has to be a string in the format
  12670. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12671. number or a valid video frame rate abbreviation. The default value is
  12672. "25".
  12673. @item duration, d
  12674. Set the duration of the sourced video. See
  12675. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12676. for the accepted syntax.
  12677. If not specified, or the expressed duration is negative, the video is
  12678. supposed to be generated forever.
  12679. @item test, t
  12680. Set the number or the name of the test to perform. Supported tests are:
  12681. @table @option
  12682. @item dc_luma
  12683. @item dc_chroma
  12684. @item freq_luma
  12685. @item freq_chroma
  12686. @item amp_luma
  12687. @item amp_chroma
  12688. @item cbp
  12689. @item mv
  12690. @item ring1
  12691. @item ring2
  12692. @item all
  12693. @end table
  12694. Default value is "all", which will cycle through the list of all tests.
  12695. @end table
  12696. Some examples:
  12697. @example
  12698. mptestsrc=t=dc_luma
  12699. @end example
  12700. will generate a "dc_luma" test pattern.
  12701. @section frei0r_src
  12702. Provide a frei0r source.
  12703. To enable compilation of this filter you need to install the frei0r
  12704. header and configure FFmpeg with @code{--enable-frei0r}.
  12705. This source accepts the following parameters:
  12706. @table @option
  12707. @item size
  12708. The size of the video to generate. For the syntax of this option, check the
  12709. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12710. @item framerate
  12711. The framerate of the generated video. It may be a string of the form
  12712. @var{num}/@var{den} or a frame rate abbreviation.
  12713. @item filter_name
  12714. The name to the frei0r source to load. For more information regarding frei0r and
  12715. how to set the parameters, read the @ref{frei0r} section in the video filters
  12716. documentation.
  12717. @item filter_params
  12718. A '|'-separated list of parameters to pass to the frei0r source.
  12719. @end table
  12720. For example, to generate a frei0r partik0l source with size 200x200
  12721. and frame rate 10 which is overlaid on the overlay filter main input:
  12722. @example
  12723. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  12724. @end example
  12725. @section life
  12726. Generate a life pattern.
  12727. This source is based on a generalization of John Conway's life game.
  12728. The sourced input represents a life grid, each pixel represents a cell
  12729. which can be in one of two possible states, alive or dead. Every cell
  12730. interacts with its eight neighbours, which are the cells that are
  12731. horizontally, vertically, or diagonally adjacent.
  12732. At each interaction the grid evolves according to the adopted rule,
  12733. which specifies the number of neighbor alive cells which will make a
  12734. cell stay alive or born. The @option{rule} option allows one to specify
  12735. the rule to adopt.
  12736. This source accepts the following options:
  12737. @table @option
  12738. @item filename, f
  12739. Set the file from which to read the initial grid state. In the file,
  12740. each non-whitespace character is considered an alive cell, and newline
  12741. is used to delimit the end of each row.
  12742. If this option is not specified, the initial grid is generated
  12743. randomly.
  12744. @item rate, r
  12745. Set the video rate, that is the number of frames generated per second.
  12746. Default is 25.
  12747. @item random_fill_ratio, ratio
  12748. Set the random fill ratio for the initial random grid. It is a
  12749. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  12750. It is ignored when a file is specified.
  12751. @item random_seed, seed
  12752. Set the seed for filling the initial random grid, must be an integer
  12753. included between 0 and UINT32_MAX. If not specified, or if explicitly
  12754. set to -1, the filter will try to use a good random seed on a best
  12755. effort basis.
  12756. @item rule
  12757. Set the life rule.
  12758. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  12759. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  12760. @var{NS} specifies the number of alive neighbor cells which make a
  12761. live cell stay alive, and @var{NB} the number of alive neighbor cells
  12762. which make a dead cell to become alive (i.e. to "born").
  12763. "s" and "b" can be used in place of "S" and "B", respectively.
  12764. Alternatively a rule can be specified by an 18-bits integer. The 9
  12765. high order bits are used to encode the next cell state if it is alive
  12766. for each number of neighbor alive cells, the low order bits specify
  12767. the rule for "borning" new cells. Higher order bits encode for an
  12768. higher number of neighbor cells.
  12769. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  12770. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  12771. Default value is "S23/B3", which is the original Conway's game of life
  12772. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  12773. cells, and will born a new cell if there are three alive cells around
  12774. a dead cell.
  12775. @item size, s
  12776. Set the size of the output video. For the syntax of this option, check the
  12777. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12778. If @option{filename} is specified, the size is set by default to the
  12779. same size of the input file. If @option{size} is set, it must contain
  12780. the size specified in the input file, and the initial grid defined in
  12781. that file is centered in the larger resulting area.
  12782. If a filename is not specified, the size value defaults to "320x240"
  12783. (used for a randomly generated initial grid).
  12784. @item stitch
  12785. If set to 1, stitch the left and right grid edges together, and the
  12786. top and bottom edges also. Defaults to 1.
  12787. @item mold
  12788. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  12789. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  12790. value from 0 to 255.
  12791. @item life_color
  12792. Set the color of living (or new born) cells.
  12793. @item death_color
  12794. Set the color of dead cells. If @option{mold} is set, this is the first color
  12795. used to represent a dead cell.
  12796. @item mold_color
  12797. Set mold color, for definitely dead and moldy cells.
  12798. For the syntax of these 3 color options, check the "Color" section in the
  12799. ffmpeg-utils manual.
  12800. @end table
  12801. @subsection Examples
  12802. @itemize
  12803. @item
  12804. Read a grid from @file{pattern}, and center it on a grid of size
  12805. 300x300 pixels:
  12806. @example
  12807. life=f=pattern:s=300x300
  12808. @end example
  12809. @item
  12810. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  12811. @example
  12812. life=ratio=2/3:s=200x200
  12813. @end example
  12814. @item
  12815. Specify a custom rule for evolving a randomly generated grid:
  12816. @example
  12817. life=rule=S14/B34
  12818. @end example
  12819. @item
  12820. Full example with slow death effect (mold) using @command{ffplay}:
  12821. @example
  12822. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  12823. @end example
  12824. @end itemize
  12825. @anchor{allrgb}
  12826. @anchor{allyuv}
  12827. @anchor{color}
  12828. @anchor{haldclutsrc}
  12829. @anchor{nullsrc}
  12830. @anchor{rgbtestsrc}
  12831. @anchor{smptebars}
  12832. @anchor{smptehdbars}
  12833. @anchor{testsrc}
  12834. @anchor{testsrc2}
  12835. @anchor{yuvtestsrc}
  12836. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  12837. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  12838. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  12839. The @code{color} source provides an uniformly colored input.
  12840. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  12841. @ref{haldclut} filter.
  12842. The @code{nullsrc} source returns unprocessed video frames. It is
  12843. mainly useful to be employed in analysis / debugging tools, or as the
  12844. source for filters which ignore the input data.
  12845. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  12846. detecting RGB vs BGR issues. You should see a red, green and blue
  12847. stripe from top to bottom.
  12848. The @code{smptebars} source generates a color bars pattern, based on
  12849. the SMPTE Engineering Guideline EG 1-1990.
  12850. The @code{smptehdbars} source generates a color bars pattern, based on
  12851. the SMPTE RP 219-2002.
  12852. The @code{testsrc} source generates a test video pattern, showing a
  12853. color pattern, a scrolling gradient and a timestamp. This is mainly
  12854. intended for testing purposes.
  12855. The @code{testsrc2} source is similar to testsrc, but supports more
  12856. pixel formats instead of just @code{rgb24}. This allows using it as an
  12857. input for other tests without requiring a format conversion.
  12858. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  12859. see a y, cb and cr stripe from top to bottom.
  12860. The sources accept the following parameters:
  12861. @table @option
  12862. @item alpha
  12863. Specify the alpha (opacity) of the background, only available in the
  12864. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  12865. 255 (fully opaque, the default).
  12866. @item color, c
  12867. Specify the color of the source, only available in the @code{color}
  12868. source. For the syntax of this option, check the "Color" section in the
  12869. ffmpeg-utils manual.
  12870. @item level
  12871. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  12872. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  12873. pixels to be used as identity matrix for 3D lookup tables. Each component is
  12874. coded on a @code{1/(N*N)} scale.
  12875. @item size, s
  12876. Specify the size of the sourced video. For the syntax of this option, check the
  12877. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12878. The default value is @code{320x240}.
  12879. This option is not available with the @code{haldclutsrc} filter.
  12880. @item rate, r
  12881. Specify the frame rate of the sourced video, as the number of frames
  12882. generated per second. It has to be a string in the format
  12883. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12884. number or a valid video frame rate abbreviation. The default value is
  12885. "25".
  12886. @item sar
  12887. Set the sample aspect ratio of the sourced video.
  12888. @item duration, d
  12889. Set the duration of the sourced video. See
  12890. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12891. for the accepted syntax.
  12892. If not specified, or the expressed duration is negative, the video is
  12893. supposed to be generated forever.
  12894. @item decimals, n
  12895. Set the number of decimals to show in the timestamp, only available in the
  12896. @code{testsrc} source.
  12897. The displayed timestamp value will correspond to the original
  12898. timestamp value multiplied by the power of 10 of the specified
  12899. value. Default value is 0.
  12900. @end table
  12901. For example the following:
  12902. @example
  12903. testsrc=duration=5.3:size=qcif:rate=10
  12904. @end example
  12905. will generate a video with a duration of 5.3 seconds, with size
  12906. 176x144 and a frame rate of 10 frames per second.
  12907. The following graph description will generate a red source
  12908. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  12909. frames per second.
  12910. @example
  12911. color=c=red@@0.2:s=qcif:r=10
  12912. @end example
  12913. If the input content is to be ignored, @code{nullsrc} can be used. The
  12914. following command generates noise in the luminance plane by employing
  12915. the @code{geq} filter:
  12916. @example
  12917. nullsrc=s=256x256, geq=random(1)*255:128:128
  12918. @end example
  12919. @subsection Commands
  12920. The @code{color} source supports the following commands:
  12921. @table @option
  12922. @item c, color
  12923. Set the color of the created image. Accepts the same syntax of the
  12924. corresponding @option{color} option.
  12925. @end table
  12926. @c man end VIDEO SOURCES
  12927. @chapter Video Sinks
  12928. @c man begin VIDEO SINKS
  12929. Below is a description of the currently available video sinks.
  12930. @section buffersink
  12931. Buffer video frames, and make them available to the end of the filter
  12932. graph.
  12933. This sink is mainly intended for programmatic use, in particular
  12934. through the interface defined in @file{libavfilter/buffersink.h}
  12935. or the options system.
  12936. It accepts a pointer to an AVBufferSinkContext structure, which
  12937. defines the incoming buffers' formats, to be passed as the opaque
  12938. parameter to @code{avfilter_init_filter} for initialization.
  12939. @section nullsink
  12940. Null video sink: do absolutely nothing with the input video. It is
  12941. mainly useful as a template and for use in analysis / debugging
  12942. tools.
  12943. @c man end VIDEO SINKS
  12944. @chapter Multimedia Filters
  12945. @c man begin MULTIMEDIA FILTERS
  12946. Below is a description of the currently available multimedia filters.
  12947. @section abitscope
  12948. Convert input audio to a video output, displaying the audio bit scope.
  12949. The filter accepts the following options:
  12950. @table @option
  12951. @item rate, r
  12952. Set frame rate, expressed as number of frames per second. Default
  12953. value is "25".
  12954. @item size, s
  12955. Specify the video size for the output. For the syntax of this option, check the
  12956. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12957. Default value is @code{1024x256}.
  12958. @item colors
  12959. Specify list of colors separated by space or by '|' which will be used to
  12960. draw channels. Unrecognized or missing colors will be replaced
  12961. by white color.
  12962. @end table
  12963. @section ahistogram
  12964. Convert input audio to a video output, displaying the volume histogram.
  12965. The filter accepts the following options:
  12966. @table @option
  12967. @item dmode
  12968. Specify how histogram is calculated.
  12969. It accepts the following values:
  12970. @table @samp
  12971. @item single
  12972. Use single histogram for all channels.
  12973. @item separate
  12974. Use separate histogram for each channel.
  12975. @end table
  12976. Default is @code{single}.
  12977. @item rate, r
  12978. Set frame rate, expressed as number of frames per second. Default
  12979. value is "25".
  12980. @item size, s
  12981. Specify the video size for the output. For the syntax of this option, check the
  12982. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12983. Default value is @code{hd720}.
  12984. @item scale
  12985. Set display scale.
  12986. It accepts the following values:
  12987. @table @samp
  12988. @item log
  12989. logarithmic
  12990. @item sqrt
  12991. square root
  12992. @item cbrt
  12993. cubic root
  12994. @item lin
  12995. linear
  12996. @item rlog
  12997. reverse logarithmic
  12998. @end table
  12999. Default is @code{log}.
  13000. @item ascale
  13001. Set amplitude scale.
  13002. It accepts the following values:
  13003. @table @samp
  13004. @item log
  13005. logarithmic
  13006. @item lin
  13007. linear
  13008. @end table
  13009. Default is @code{log}.
  13010. @item acount
  13011. Set how much frames to accumulate in histogram.
  13012. Defauls is 1. Setting this to -1 accumulates all frames.
  13013. @item rheight
  13014. Set histogram ratio of window height.
  13015. @item slide
  13016. Set sonogram sliding.
  13017. It accepts the following values:
  13018. @table @samp
  13019. @item replace
  13020. replace old rows with new ones.
  13021. @item scroll
  13022. scroll from top to bottom.
  13023. @end table
  13024. Default is @code{replace}.
  13025. @end table
  13026. @section aphasemeter
  13027. Convert input audio to a video output, displaying the audio phase.
  13028. The filter accepts the following options:
  13029. @table @option
  13030. @item rate, r
  13031. Set the output frame rate. Default value is @code{25}.
  13032. @item size, s
  13033. Set the video size for the output. For the syntax of this option, check the
  13034. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13035. Default value is @code{800x400}.
  13036. @item rc
  13037. @item gc
  13038. @item bc
  13039. Specify the red, green, blue contrast. Default values are @code{2},
  13040. @code{7} and @code{1}.
  13041. Allowed range is @code{[0, 255]}.
  13042. @item mpc
  13043. Set color which will be used for drawing median phase. If color is
  13044. @code{none} which is default, no median phase value will be drawn.
  13045. @item video
  13046. Enable video output. Default is enabled.
  13047. @end table
  13048. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  13049. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  13050. The @code{-1} means left and right channels are completely out of phase and
  13051. @code{1} means channels are in phase.
  13052. @section avectorscope
  13053. Convert input audio to a video output, representing the audio vector
  13054. scope.
  13055. The filter is used to measure the difference between channels of stereo
  13056. audio stream. A monoaural signal, consisting of identical left and right
  13057. signal, results in straight vertical line. Any stereo separation is visible
  13058. as a deviation from this line, creating a Lissajous figure.
  13059. If the straight (or deviation from it) but horizontal line appears this
  13060. indicates that the left and right channels are out of phase.
  13061. The filter accepts the following options:
  13062. @table @option
  13063. @item mode, m
  13064. Set the vectorscope mode.
  13065. Available values are:
  13066. @table @samp
  13067. @item lissajous
  13068. Lissajous rotated by 45 degrees.
  13069. @item lissajous_xy
  13070. Same as above but not rotated.
  13071. @item polar
  13072. Shape resembling half of circle.
  13073. @end table
  13074. Default value is @samp{lissajous}.
  13075. @item size, s
  13076. Set the video size for the output. For the syntax of this option, check the
  13077. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13078. Default value is @code{400x400}.
  13079. @item rate, r
  13080. Set the output frame rate. Default value is @code{25}.
  13081. @item rc
  13082. @item gc
  13083. @item bc
  13084. @item ac
  13085. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  13086. @code{160}, @code{80} and @code{255}.
  13087. Allowed range is @code{[0, 255]}.
  13088. @item rf
  13089. @item gf
  13090. @item bf
  13091. @item af
  13092. Specify the red, green, blue and alpha fade. Default values are @code{15},
  13093. @code{10}, @code{5} and @code{5}.
  13094. Allowed range is @code{[0, 255]}.
  13095. @item zoom
  13096. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  13097. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  13098. @item draw
  13099. Set the vectorscope drawing mode.
  13100. Available values are:
  13101. @table @samp
  13102. @item dot
  13103. Draw dot for each sample.
  13104. @item line
  13105. Draw line between previous and current sample.
  13106. @end table
  13107. Default value is @samp{dot}.
  13108. @item scale
  13109. Specify amplitude scale of audio samples.
  13110. Available values are:
  13111. @table @samp
  13112. @item lin
  13113. Linear.
  13114. @item sqrt
  13115. Square root.
  13116. @item cbrt
  13117. Cubic root.
  13118. @item log
  13119. Logarithmic.
  13120. @end table
  13121. @end table
  13122. @subsection Examples
  13123. @itemize
  13124. @item
  13125. Complete example using @command{ffplay}:
  13126. @example
  13127. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  13128. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  13129. @end example
  13130. @end itemize
  13131. @section bench, abench
  13132. Benchmark part of a filtergraph.
  13133. The filter accepts the following options:
  13134. @table @option
  13135. @item action
  13136. Start or stop a timer.
  13137. Available values are:
  13138. @table @samp
  13139. @item start
  13140. Get the current time, set it as frame metadata (using the key
  13141. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  13142. @item stop
  13143. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  13144. the input frame metadata to get the time difference. Time difference, average,
  13145. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  13146. @code{min}) are then printed. The timestamps are expressed in seconds.
  13147. @end table
  13148. @end table
  13149. @subsection Examples
  13150. @itemize
  13151. @item
  13152. Benchmark @ref{selectivecolor} filter:
  13153. @example
  13154. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  13155. @end example
  13156. @end itemize
  13157. @section concat
  13158. Concatenate audio and video streams, joining them together one after the
  13159. other.
  13160. The filter works on segments of synchronized video and audio streams. All
  13161. segments must have the same number of streams of each type, and that will
  13162. also be the number of streams at output.
  13163. The filter accepts the following options:
  13164. @table @option
  13165. @item n
  13166. Set the number of segments. Default is 2.
  13167. @item v
  13168. Set the number of output video streams, that is also the number of video
  13169. streams in each segment. Default is 1.
  13170. @item a
  13171. Set the number of output audio streams, that is also the number of audio
  13172. streams in each segment. Default is 0.
  13173. @item unsafe
  13174. Activate unsafe mode: do not fail if segments have a different format.
  13175. @end table
  13176. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  13177. @var{a} audio outputs.
  13178. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  13179. segment, in the same order as the outputs, then the inputs for the second
  13180. segment, etc.
  13181. Related streams do not always have exactly the same duration, for various
  13182. reasons including codec frame size or sloppy authoring. For that reason,
  13183. related synchronized streams (e.g. a video and its audio track) should be
  13184. concatenated at once. The concat filter will use the duration of the longest
  13185. stream in each segment (except the last one), and if necessary pad shorter
  13186. audio streams with silence.
  13187. For this filter to work correctly, all segments must start at timestamp 0.
  13188. All corresponding streams must have the same parameters in all segments; the
  13189. filtering system will automatically select a common pixel format for video
  13190. streams, and a common sample format, sample rate and channel layout for
  13191. audio streams, but other settings, such as resolution, must be converted
  13192. explicitly by the user.
  13193. Different frame rates are acceptable but will result in variable frame rate
  13194. at output; be sure to configure the output file to handle it.
  13195. @subsection Examples
  13196. @itemize
  13197. @item
  13198. Concatenate an opening, an episode and an ending, all in bilingual version
  13199. (video in stream 0, audio in streams 1 and 2):
  13200. @example
  13201. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  13202. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  13203. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  13204. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  13205. @end example
  13206. @item
  13207. Concatenate two parts, handling audio and video separately, using the
  13208. (a)movie sources, and adjusting the resolution:
  13209. @example
  13210. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  13211. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  13212. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  13213. @end example
  13214. Note that a desync will happen at the stitch if the audio and video streams
  13215. do not have exactly the same duration in the first file.
  13216. @end itemize
  13217. @section drawgraph, adrawgraph
  13218. Draw a graph using input video or audio metadata.
  13219. It accepts the following parameters:
  13220. @table @option
  13221. @item m1
  13222. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  13223. @item fg1
  13224. Set 1st foreground color expression.
  13225. @item m2
  13226. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  13227. @item fg2
  13228. Set 2nd foreground color expression.
  13229. @item m3
  13230. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  13231. @item fg3
  13232. Set 3rd foreground color expression.
  13233. @item m4
  13234. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  13235. @item fg4
  13236. Set 4th foreground color expression.
  13237. @item min
  13238. Set minimal value of metadata value.
  13239. @item max
  13240. Set maximal value of metadata value.
  13241. @item bg
  13242. Set graph background color. Default is white.
  13243. @item mode
  13244. Set graph mode.
  13245. Available values for mode is:
  13246. @table @samp
  13247. @item bar
  13248. @item dot
  13249. @item line
  13250. @end table
  13251. Default is @code{line}.
  13252. @item slide
  13253. Set slide mode.
  13254. Available values for slide is:
  13255. @table @samp
  13256. @item frame
  13257. Draw new frame when right border is reached.
  13258. @item replace
  13259. Replace old columns with new ones.
  13260. @item scroll
  13261. Scroll from right to left.
  13262. @item rscroll
  13263. Scroll from left to right.
  13264. @item picture
  13265. Draw single picture.
  13266. @end table
  13267. Default is @code{frame}.
  13268. @item size
  13269. Set size of graph video. For the syntax of this option, check the
  13270. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13271. The default value is @code{900x256}.
  13272. The foreground color expressions can use the following variables:
  13273. @table @option
  13274. @item MIN
  13275. Minimal value of metadata value.
  13276. @item MAX
  13277. Maximal value of metadata value.
  13278. @item VAL
  13279. Current metadata key value.
  13280. @end table
  13281. The color is defined as 0xAABBGGRR.
  13282. @end table
  13283. Example using metadata from @ref{signalstats} filter:
  13284. @example
  13285. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  13286. @end example
  13287. Example using metadata from @ref{ebur128} filter:
  13288. @example
  13289. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  13290. @end example
  13291. @anchor{ebur128}
  13292. @section ebur128
  13293. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  13294. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  13295. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  13296. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  13297. The filter also has a video output (see the @var{video} option) with a real
  13298. time graph to observe the loudness evolution. The graphic contains the logged
  13299. message mentioned above, so it is not printed anymore when this option is set,
  13300. unless the verbose logging is set. The main graphing area contains the
  13301. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  13302. the momentary loudness (400 milliseconds).
  13303. More information about the Loudness Recommendation EBU R128 on
  13304. @url{http://tech.ebu.ch/loudness}.
  13305. The filter accepts the following options:
  13306. @table @option
  13307. @item video
  13308. Activate the video output. The audio stream is passed unchanged whether this
  13309. option is set or no. The video stream will be the first output stream if
  13310. activated. Default is @code{0}.
  13311. @item size
  13312. Set the video size. This option is for video only. For the syntax of this
  13313. option, check the
  13314. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13315. Default and minimum resolution is @code{640x480}.
  13316. @item meter
  13317. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  13318. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  13319. other integer value between this range is allowed.
  13320. @item metadata
  13321. Set metadata injection. If set to @code{1}, the audio input will be segmented
  13322. into 100ms output frames, each of them containing various loudness information
  13323. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  13324. Default is @code{0}.
  13325. @item framelog
  13326. Force the frame logging level.
  13327. Available values are:
  13328. @table @samp
  13329. @item info
  13330. information logging level
  13331. @item verbose
  13332. verbose logging level
  13333. @end table
  13334. By default, the logging level is set to @var{info}. If the @option{video} or
  13335. the @option{metadata} options are set, it switches to @var{verbose}.
  13336. @item peak
  13337. Set peak mode(s).
  13338. Available modes can be cumulated (the option is a @code{flag} type). Possible
  13339. values are:
  13340. @table @samp
  13341. @item none
  13342. Disable any peak mode (default).
  13343. @item sample
  13344. Enable sample-peak mode.
  13345. Simple peak mode looking for the higher sample value. It logs a message
  13346. for sample-peak (identified by @code{SPK}).
  13347. @item true
  13348. Enable true-peak mode.
  13349. If enabled, the peak lookup is done on an over-sampled version of the input
  13350. stream for better peak accuracy. It logs a message for true-peak.
  13351. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  13352. This mode requires a build with @code{libswresample}.
  13353. @end table
  13354. @item dualmono
  13355. Treat mono input files as "dual mono". If a mono file is intended for playback
  13356. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  13357. If set to @code{true}, this option will compensate for this effect.
  13358. Multi-channel input files are not affected by this option.
  13359. @item panlaw
  13360. Set a specific pan law to be used for the measurement of dual mono files.
  13361. This parameter is optional, and has a default value of -3.01dB.
  13362. @end table
  13363. @subsection Examples
  13364. @itemize
  13365. @item
  13366. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  13367. @example
  13368. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  13369. @end example
  13370. @item
  13371. Run an analysis with @command{ffmpeg}:
  13372. @example
  13373. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  13374. @end example
  13375. @end itemize
  13376. @section interleave, ainterleave
  13377. Temporally interleave frames from several inputs.
  13378. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  13379. These filters read frames from several inputs and send the oldest
  13380. queued frame to the output.
  13381. Input streams must have well defined, monotonically increasing frame
  13382. timestamp values.
  13383. In order to submit one frame to output, these filters need to enqueue
  13384. at least one frame for each input, so they cannot work in case one
  13385. input is not yet terminated and will not receive incoming frames.
  13386. For example consider the case when one input is a @code{select} filter
  13387. which always drops input frames. The @code{interleave} filter will keep
  13388. reading from that input, but it will never be able to send new frames
  13389. to output until the input sends an end-of-stream signal.
  13390. Also, depending on inputs synchronization, the filters will drop
  13391. frames in case one input receives more frames than the other ones, and
  13392. the queue is already filled.
  13393. These filters accept the following options:
  13394. @table @option
  13395. @item nb_inputs, n
  13396. Set the number of different inputs, it is 2 by default.
  13397. @end table
  13398. @subsection Examples
  13399. @itemize
  13400. @item
  13401. Interleave frames belonging to different streams using @command{ffmpeg}:
  13402. @example
  13403. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  13404. @end example
  13405. @item
  13406. Add flickering blur effect:
  13407. @example
  13408. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  13409. @end example
  13410. @end itemize
  13411. @section metadata, ametadata
  13412. Manipulate frame metadata.
  13413. This filter accepts the following options:
  13414. @table @option
  13415. @item mode
  13416. Set mode of operation of the filter.
  13417. Can be one of the following:
  13418. @table @samp
  13419. @item select
  13420. If both @code{value} and @code{key} is set, select frames
  13421. which have such metadata. If only @code{key} is set, select
  13422. every frame that has such key in metadata.
  13423. @item add
  13424. Add new metadata @code{key} and @code{value}. If key is already available
  13425. do nothing.
  13426. @item modify
  13427. Modify value of already present key.
  13428. @item delete
  13429. If @code{value} is set, delete only keys that have such value.
  13430. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  13431. the frame.
  13432. @item print
  13433. Print key and its value if metadata was found. If @code{key} is not set print all
  13434. metadata values available in frame.
  13435. @end table
  13436. @item key
  13437. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  13438. @item value
  13439. Set metadata value which will be used. This option is mandatory for
  13440. @code{modify} and @code{add} mode.
  13441. @item function
  13442. Which function to use when comparing metadata value and @code{value}.
  13443. Can be one of following:
  13444. @table @samp
  13445. @item same_str
  13446. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  13447. @item starts_with
  13448. Values are interpreted as strings, returns true if metadata value starts with
  13449. the @code{value} option string.
  13450. @item less
  13451. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  13452. @item equal
  13453. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  13454. @item greater
  13455. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  13456. @item expr
  13457. Values are interpreted as floats, returns true if expression from option @code{expr}
  13458. evaluates to true.
  13459. @end table
  13460. @item expr
  13461. Set expression which is used when @code{function} is set to @code{expr}.
  13462. The expression is evaluated through the eval API and can contain the following
  13463. constants:
  13464. @table @option
  13465. @item VALUE1
  13466. Float representation of @code{value} from metadata key.
  13467. @item VALUE2
  13468. Float representation of @code{value} as supplied by user in @code{value} option.
  13469. @end table
  13470. @item file
  13471. If specified in @code{print} mode, output is written to the named file. Instead of
  13472. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  13473. for standard output. If @code{file} option is not set, output is written to the log
  13474. with AV_LOG_INFO loglevel.
  13475. @end table
  13476. @subsection Examples
  13477. @itemize
  13478. @item
  13479. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  13480. between 0 and 1.
  13481. @example
  13482. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  13483. @end example
  13484. @item
  13485. Print silencedetect output to file @file{metadata.txt}.
  13486. @example
  13487. silencedetect,ametadata=mode=print:file=metadata.txt
  13488. @end example
  13489. @item
  13490. Direct all metadata to a pipe with file descriptor 4.
  13491. @example
  13492. metadata=mode=print:file='pipe\:4'
  13493. @end example
  13494. @end itemize
  13495. @section perms, aperms
  13496. Set read/write permissions for the output frames.
  13497. These filters are mainly aimed at developers to test direct path in the
  13498. following filter in the filtergraph.
  13499. The filters accept the following options:
  13500. @table @option
  13501. @item mode
  13502. Select the permissions mode.
  13503. It accepts the following values:
  13504. @table @samp
  13505. @item none
  13506. Do nothing. This is the default.
  13507. @item ro
  13508. Set all the output frames read-only.
  13509. @item rw
  13510. Set all the output frames directly writable.
  13511. @item toggle
  13512. Make the frame read-only if writable, and writable if read-only.
  13513. @item random
  13514. Set each output frame read-only or writable randomly.
  13515. @end table
  13516. @item seed
  13517. Set the seed for the @var{random} mode, must be an integer included between
  13518. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  13519. @code{-1}, the filter will try to use a good random seed on a best effort
  13520. basis.
  13521. @end table
  13522. Note: in case of auto-inserted filter between the permission filter and the
  13523. following one, the permission might not be received as expected in that
  13524. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  13525. perms/aperms filter can avoid this problem.
  13526. @section realtime, arealtime
  13527. Slow down filtering to match real time approximately.
  13528. These filters will pause the filtering for a variable amount of time to
  13529. match the output rate with the input timestamps.
  13530. They are similar to the @option{re} option to @code{ffmpeg}.
  13531. They accept the following options:
  13532. @table @option
  13533. @item limit
  13534. Time limit for the pauses. Any pause longer than that will be considered
  13535. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  13536. @end table
  13537. @anchor{select}
  13538. @section select, aselect
  13539. Select frames to pass in output.
  13540. This filter accepts the following options:
  13541. @table @option
  13542. @item expr, e
  13543. Set expression, which is evaluated for each input frame.
  13544. If the expression is evaluated to zero, the frame is discarded.
  13545. If the evaluation result is negative or NaN, the frame is sent to the
  13546. first output; otherwise it is sent to the output with index
  13547. @code{ceil(val)-1}, assuming that the input index starts from 0.
  13548. For example a value of @code{1.2} corresponds to the output with index
  13549. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  13550. @item outputs, n
  13551. Set the number of outputs. The output to which to send the selected
  13552. frame is based on the result of the evaluation. Default value is 1.
  13553. @end table
  13554. The expression can contain the following constants:
  13555. @table @option
  13556. @item n
  13557. The (sequential) number of the filtered frame, starting from 0.
  13558. @item selected_n
  13559. The (sequential) number of the selected frame, starting from 0.
  13560. @item prev_selected_n
  13561. The sequential number of the last selected frame. It's NAN if undefined.
  13562. @item TB
  13563. The timebase of the input timestamps.
  13564. @item pts
  13565. The PTS (Presentation TimeStamp) of the filtered video frame,
  13566. expressed in @var{TB} units. It's NAN if undefined.
  13567. @item t
  13568. The PTS of the filtered video frame,
  13569. expressed in seconds. It's NAN if undefined.
  13570. @item prev_pts
  13571. The PTS of the previously filtered video frame. It's NAN if undefined.
  13572. @item prev_selected_pts
  13573. The PTS of the last previously filtered video frame. It's NAN if undefined.
  13574. @item prev_selected_t
  13575. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  13576. @item start_pts
  13577. The PTS of the first video frame in the video. It's NAN if undefined.
  13578. @item start_t
  13579. The time of the first video frame in the video. It's NAN if undefined.
  13580. @item pict_type @emph{(video only)}
  13581. The type of the filtered frame. It can assume one of the following
  13582. values:
  13583. @table @option
  13584. @item I
  13585. @item P
  13586. @item B
  13587. @item S
  13588. @item SI
  13589. @item SP
  13590. @item BI
  13591. @end table
  13592. @item interlace_type @emph{(video only)}
  13593. The frame interlace type. It can assume one of the following values:
  13594. @table @option
  13595. @item PROGRESSIVE
  13596. The frame is progressive (not interlaced).
  13597. @item TOPFIRST
  13598. The frame is top-field-first.
  13599. @item BOTTOMFIRST
  13600. The frame is bottom-field-first.
  13601. @end table
  13602. @item consumed_sample_n @emph{(audio only)}
  13603. the number of selected samples before the current frame
  13604. @item samples_n @emph{(audio only)}
  13605. the number of samples in the current frame
  13606. @item sample_rate @emph{(audio only)}
  13607. the input sample rate
  13608. @item key
  13609. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  13610. @item pos
  13611. the position in the file of the filtered frame, -1 if the information
  13612. is not available (e.g. for synthetic video)
  13613. @item scene @emph{(video only)}
  13614. value between 0 and 1 to indicate a new scene; a low value reflects a low
  13615. probability for the current frame to introduce a new scene, while a higher
  13616. value means the current frame is more likely to be one (see the example below)
  13617. @item concatdec_select
  13618. The concat demuxer can select only part of a concat input file by setting an
  13619. inpoint and an outpoint, but the output packets may not be entirely contained
  13620. in the selected interval. By using this variable, it is possible to skip frames
  13621. generated by the concat demuxer which are not exactly contained in the selected
  13622. interval.
  13623. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  13624. and the @var{lavf.concat.duration} packet metadata values which are also
  13625. present in the decoded frames.
  13626. The @var{concatdec_select} variable is -1 if the frame pts is at least
  13627. start_time and either the duration metadata is missing or the frame pts is less
  13628. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  13629. missing.
  13630. That basically means that an input frame is selected if its pts is within the
  13631. interval set by the concat demuxer.
  13632. @end table
  13633. The default value of the select expression is "1".
  13634. @subsection Examples
  13635. @itemize
  13636. @item
  13637. Select all frames in input:
  13638. @example
  13639. select
  13640. @end example
  13641. The example above is the same as:
  13642. @example
  13643. select=1
  13644. @end example
  13645. @item
  13646. Skip all frames:
  13647. @example
  13648. select=0
  13649. @end example
  13650. @item
  13651. Select only I-frames:
  13652. @example
  13653. select='eq(pict_type\,I)'
  13654. @end example
  13655. @item
  13656. Select one frame every 100:
  13657. @example
  13658. select='not(mod(n\,100))'
  13659. @end example
  13660. @item
  13661. Select only frames contained in the 10-20 time interval:
  13662. @example
  13663. select=between(t\,10\,20)
  13664. @end example
  13665. @item
  13666. Select only I-frames contained in the 10-20 time interval:
  13667. @example
  13668. select=between(t\,10\,20)*eq(pict_type\,I)
  13669. @end example
  13670. @item
  13671. Select frames with a minimum distance of 10 seconds:
  13672. @example
  13673. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  13674. @end example
  13675. @item
  13676. Use aselect to select only audio frames with samples number > 100:
  13677. @example
  13678. aselect='gt(samples_n\,100)'
  13679. @end example
  13680. @item
  13681. Create a mosaic of the first scenes:
  13682. @example
  13683. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  13684. @end example
  13685. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  13686. choice.
  13687. @item
  13688. Send even and odd frames to separate outputs, and compose them:
  13689. @example
  13690. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  13691. @end example
  13692. @item
  13693. Select useful frames from an ffconcat file which is using inpoints and
  13694. outpoints but where the source files are not intra frame only.
  13695. @example
  13696. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  13697. @end example
  13698. @end itemize
  13699. @section sendcmd, asendcmd
  13700. Send commands to filters in the filtergraph.
  13701. These filters read commands to be sent to other filters in the
  13702. filtergraph.
  13703. @code{sendcmd} must be inserted between two video filters,
  13704. @code{asendcmd} must be inserted between two audio filters, but apart
  13705. from that they act the same way.
  13706. The specification of commands can be provided in the filter arguments
  13707. with the @var{commands} option, or in a file specified by the
  13708. @var{filename} option.
  13709. These filters accept the following options:
  13710. @table @option
  13711. @item commands, c
  13712. Set the commands to be read and sent to the other filters.
  13713. @item filename, f
  13714. Set the filename of the commands to be read and sent to the other
  13715. filters.
  13716. @end table
  13717. @subsection Commands syntax
  13718. A commands description consists of a sequence of interval
  13719. specifications, comprising a list of commands to be executed when a
  13720. particular event related to that interval occurs. The occurring event
  13721. is typically the current frame time entering or leaving a given time
  13722. interval.
  13723. An interval is specified by the following syntax:
  13724. @example
  13725. @var{START}[-@var{END}] @var{COMMANDS};
  13726. @end example
  13727. The time interval is specified by the @var{START} and @var{END} times.
  13728. @var{END} is optional and defaults to the maximum time.
  13729. The current frame time is considered within the specified interval if
  13730. it is included in the interval [@var{START}, @var{END}), that is when
  13731. the time is greater or equal to @var{START} and is lesser than
  13732. @var{END}.
  13733. @var{COMMANDS} consists of a sequence of one or more command
  13734. specifications, separated by ",", relating to that interval. The
  13735. syntax of a command specification is given by:
  13736. @example
  13737. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  13738. @end example
  13739. @var{FLAGS} is optional and specifies the type of events relating to
  13740. the time interval which enable sending the specified command, and must
  13741. be a non-null sequence of identifier flags separated by "+" or "|" and
  13742. enclosed between "[" and "]".
  13743. The following flags are recognized:
  13744. @table @option
  13745. @item enter
  13746. The command is sent when the current frame timestamp enters the
  13747. specified interval. In other words, the command is sent when the
  13748. previous frame timestamp was not in the given interval, and the
  13749. current is.
  13750. @item leave
  13751. The command is sent when the current frame timestamp leaves the
  13752. specified interval. In other words, the command is sent when the
  13753. previous frame timestamp was in the given interval, and the
  13754. current is not.
  13755. @end table
  13756. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  13757. assumed.
  13758. @var{TARGET} specifies the target of the command, usually the name of
  13759. the filter class or a specific filter instance name.
  13760. @var{COMMAND} specifies the name of the command for the target filter.
  13761. @var{ARG} is optional and specifies the optional list of argument for
  13762. the given @var{COMMAND}.
  13763. Between one interval specification and another, whitespaces, or
  13764. sequences of characters starting with @code{#} until the end of line,
  13765. are ignored and can be used to annotate comments.
  13766. A simplified BNF description of the commands specification syntax
  13767. follows:
  13768. @example
  13769. @var{COMMAND_FLAG} ::= "enter" | "leave"
  13770. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  13771. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  13772. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  13773. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  13774. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  13775. @end example
  13776. @subsection Examples
  13777. @itemize
  13778. @item
  13779. Specify audio tempo change at second 4:
  13780. @example
  13781. asendcmd=c='4.0 atempo tempo 1.5',atempo
  13782. @end example
  13783. @item
  13784. Target a specific filter instance:
  13785. @example
  13786. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  13787. @end example
  13788. @item
  13789. Specify a list of drawtext and hue commands in a file.
  13790. @example
  13791. # show text in the interval 5-10
  13792. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  13793. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  13794. # desaturate the image in the interval 15-20
  13795. 15.0-20.0 [enter] hue s 0,
  13796. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  13797. [leave] hue s 1,
  13798. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  13799. # apply an exponential saturation fade-out effect, starting from time 25
  13800. 25 [enter] hue s exp(25-t)
  13801. @end example
  13802. A filtergraph allowing to read and process the above command list
  13803. stored in a file @file{test.cmd}, can be specified with:
  13804. @example
  13805. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  13806. @end example
  13807. @end itemize
  13808. @anchor{setpts}
  13809. @section setpts, asetpts
  13810. Change the PTS (presentation timestamp) of the input frames.
  13811. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  13812. This filter accepts the following options:
  13813. @table @option
  13814. @item expr
  13815. The expression which is evaluated for each frame to construct its timestamp.
  13816. @end table
  13817. The expression is evaluated through the eval API and can contain the following
  13818. constants:
  13819. @table @option
  13820. @item FRAME_RATE
  13821. frame rate, only defined for constant frame-rate video
  13822. @item PTS
  13823. The presentation timestamp in input
  13824. @item N
  13825. The count of the input frame for video or the number of consumed samples,
  13826. not including the current frame for audio, starting from 0.
  13827. @item NB_CONSUMED_SAMPLES
  13828. The number of consumed samples, not including the current frame (only
  13829. audio)
  13830. @item NB_SAMPLES, S
  13831. The number of samples in the current frame (only audio)
  13832. @item SAMPLE_RATE, SR
  13833. The audio sample rate.
  13834. @item STARTPTS
  13835. The PTS of the first frame.
  13836. @item STARTT
  13837. the time in seconds of the first frame
  13838. @item INTERLACED
  13839. State whether the current frame is interlaced.
  13840. @item T
  13841. the time in seconds of the current frame
  13842. @item POS
  13843. original position in the file of the frame, or undefined if undefined
  13844. for the current frame
  13845. @item PREV_INPTS
  13846. The previous input PTS.
  13847. @item PREV_INT
  13848. previous input time in seconds
  13849. @item PREV_OUTPTS
  13850. The previous output PTS.
  13851. @item PREV_OUTT
  13852. previous output time in seconds
  13853. @item RTCTIME
  13854. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  13855. instead.
  13856. @item RTCSTART
  13857. The wallclock (RTC) time at the start of the movie in microseconds.
  13858. @item TB
  13859. The timebase of the input timestamps.
  13860. @end table
  13861. @subsection Examples
  13862. @itemize
  13863. @item
  13864. Start counting PTS from zero
  13865. @example
  13866. setpts=PTS-STARTPTS
  13867. @end example
  13868. @item
  13869. Apply fast motion effect:
  13870. @example
  13871. setpts=0.5*PTS
  13872. @end example
  13873. @item
  13874. Apply slow motion effect:
  13875. @example
  13876. setpts=2.0*PTS
  13877. @end example
  13878. @item
  13879. Set fixed rate of 25 frames per second:
  13880. @example
  13881. setpts=N/(25*TB)
  13882. @end example
  13883. @item
  13884. Set fixed rate 25 fps with some jitter:
  13885. @example
  13886. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  13887. @end example
  13888. @item
  13889. Apply an offset of 10 seconds to the input PTS:
  13890. @example
  13891. setpts=PTS+10/TB
  13892. @end example
  13893. @item
  13894. Generate timestamps from a "live source" and rebase onto the current timebase:
  13895. @example
  13896. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  13897. @end example
  13898. @item
  13899. Generate timestamps by counting samples:
  13900. @example
  13901. asetpts=N/SR/TB
  13902. @end example
  13903. @end itemize
  13904. @section settb, asettb
  13905. Set the timebase to use for the output frames timestamps.
  13906. It is mainly useful for testing timebase configuration.
  13907. It accepts the following parameters:
  13908. @table @option
  13909. @item expr, tb
  13910. The expression which is evaluated into the output timebase.
  13911. @end table
  13912. The value for @option{tb} is an arithmetic expression representing a
  13913. rational. The expression can contain the constants "AVTB" (the default
  13914. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  13915. audio only). Default value is "intb".
  13916. @subsection Examples
  13917. @itemize
  13918. @item
  13919. Set the timebase to 1/25:
  13920. @example
  13921. settb=expr=1/25
  13922. @end example
  13923. @item
  13924. Set the timebase to 1/10:
  13925. @example
  13926. settb=expr=0.1
  13927. @end example
  13928. @item
  13929. Set the timebase to 1001/1000:
  13930. @example
  13931. settb=1+0.001
  13932. @end example
  13933. @item
  13934. Set the timebase to 2*intb:
  13935. @example
  13936. settb=2*intb
  13937. @end example
  13938. @item
  13939. Set the default timebase value:
  13940. @example
  13941. settb=AVTB
  13942. @end example
  13943. @end itemize
  13944. @section showcqt
  13945. Convert input audio to a video output representing frequency spectrum
  13946. logarithmically using Brown-Puckette constant Q transform algorithm with
  13947. direct frequency domain coefficient calculation (but the transform itself
  13948. is not really constant Q, instead the Q factor is actually variable/clamped),
  13949. with musical tone scale, from E0 to D#10.
  13950. The filter accepts the following options:
  13951. @table @option
  13952. @item size, s
  13953. Specify the video size for the output. It must be even. For the syntax of this option,
  13954. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13955. Default value is @code{1920x1080}.
  13956. @item fps, rate, r
  13957. Set the output frame rate. Default value is @code{25}.
  13958. @item bar_h
  13959. Set the bargraph height. It must be even. Default value is @code{-1} which
  13960. computes the bargraph height automatically.
  13961. @item axis_h
  13962. Set the axis height. It must be even. Default value is @code{-1} which computes
  13963. the axis height automatically.
  13964. @item sono_h
  13965. Set the sonogram height. It must be even. Default value is @code{-1} which
  13966. computes the sonogram height automatically.
  13967. @item fullhd
  13968. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  13969. instead. Default value is @code{1}.
  13970. @item sono_v, volume
  13971. Specify the sonogram volume expression. It can contain variables:
  13972. @table @option
  13973. @item bar_v
  13974. the @var{bar_v} evaluated expression
  13975. @item frequency, freq, f
  13976. the frequency where it is evaluated
  13977. @item timeclamp, tc
  13978. the value of @var{timeclamp} option
  13979. @end table
  13980. and functions:
  13981. @table @option
  13982. @item a_weighting(f)
  13983. A-weighting of equal loudness
  13984. @item b_weighting(f)
  13985. B-weighting of equal loudness
  13986. @item c_weighting(f)
  13987. C-weighting of equal loudness.
  13988. @end table
  13989. Default value is @code{16}.
  13990. @item bar_v, volume2
  13991. Specify the bargraph volume expression. It can contain variables:
  13992. @table @option
  13993. @item sono_v
  13994. the @var{sono_v} evaluated expression
  13995. @item frequency, freq, f
  13996. the frequency where it is evaluated
  13997. @item timeclamp, tc
  13998. the value of @var{timeclamp} option
  13999. @end table
  14000. and functions:
  14001. @table @option
  14002. @item a_weighting(f)
  14003. A-weighting of equal loudness
  14004. @item b_weighting(f)
  14005. B-weighting of equal loudness
  14006. @item c_weighting(f)
  14007. C-weighting of equal loudness.
  14008. @end table
  14009. Default value is @code{sono_v}.
  14010. @item sono_g, gamma
  14011. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  14012. higher gamma makes the spectrum having more range. Default value is @code{3}.
  14013. Acceptable range is @code{[1, 7]}.
  14014. @item bar_g, gamma2
  14015. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  14016. @code{[1, 7]}.
  14017. @item bar_t
  14018. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  14019. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  14020. @item timeclamp, tc
  14021. Specify the transform timeclamp. At low frequency, there is trade-off between
  14022. accuracy in time domain and frequency domain. If timeclamp is lower,
  14023. event in time domain is represented more accurately (such as fast bass drum),
  14024. otherwise event in frequency domain is represented more accurately
  14025. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  14026. @item attack
  14027. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  14028. limits future samples by applying asymmetric windowing in time domain, useful
  14029. when low latency is required. Accepted range is @code{[0, 1]}.
  14030. @item basefreq
  14031. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  14032. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  14033. @item endfreq
  14034. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  14035. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  14036. @item coeffclamp
  14037. This option is deprecated and ignored.
  14038. @item tlength
  14039. Specify the transform length in time domain. Use this option to control accuracy
  14040. trade-off between time domain and frequency domain at every frequency sample.
  14041. It can contain variables:
  14042. @table @option
  14043. @item frequency, freq, f
  14044. the frequency where it is evaluated
  14045. @item timeclamp, tc
  14046. the value of @var{timeclamp} option.
  14047. @end table
  14048. Default value is @code{384*tc/(384+tc*f)}.
  14049. @item count
  14050. Specify the transform count for every video frame. Default value is @code{6}.
  14051. Acceptable range is @code{[1, 30]}.
  14052. @item fcount
  14053. Specify the transform count for every single pixel. Default value is @code{0},
  14054. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  14055. @item fontfile
  14056. Specify font file for use with freetype to draw the axis. If not specified,
  14057. use embedded font. Note that drawing with font file or embedded font is not
  14058. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  14059. option instead.
  14060. @item font
  14061. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  14062. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  14063. @item fontcolor
  14064. Specify font color expression. This is arithmetic expression that should return
  14065. integer value 0xRRGGBB. It can contain variables:
  14066. @table @option
  14067. @item frequency, freq, f
  14068. the frequency where it is evaluated
  14069. @item timeclamp, tc
  14070. the value of @var{timeclamp} option
  14071. @end table
  14072. and functions:
  14073. @table @option
  14074. @item midi(f)
  14075. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  14076. @item r(x), g(x), b(x)
  14077. red, green, and blue value of intensity x.
  14078. @end table
  14079. Default value is @code{st(0, (midi(f)-59.5)/12);
  14080. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  14081. r(1-ld(1)) + b(ld(1))}.
  14082. @item axisfile
  14083. Specify image file to draw the axis. This option override @var{fontfile} and
  14084. @var{fontcolor} option.
  14085. @item axis, text
  14086. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  14087. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  14088. Default value is @code{1}.
  14089. @item csp
  14090. Set colorspace. The accepted values are:
  14091. @table @samp
  14092. @item unspecified
  14093. Unspecified (default)
  14094. @item bt709
  14095. BT.709
  14096. @item fcc
  14097. FCC
  14098. @item bt470bg
  14099. BT.470BG or BT.601-6 625
  14100. @item smpte170m
  14101. SMPTE-170M or BT.601-6 525
  14102. @item smpte240m
  14103. SMPTE-240M
  14104. @item bt2020ncl
  14105. BT.2020 with non-constant luminance
  14106. @end table
  14107. @item cscheme
  14108. Set spectrogram color scheme. This is list of floating point values with format
  14109. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  14110. The default is @code{1|0.5|0|0|0.5|1}.
  14111. @end table
  14112. @subsection Examples
  14113. @itemize
  14114. @item
  14115. Playing audio while showing the spectrum:
  14116. @example
  14117. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  14118. @end example
  14119. @item
  14120. Same as above, but with frame rate 30 fps:
  14121. @example
  14122. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  14123. @end example
  14124. @item
  14125. Playing at 1280x720:
  14126. @example
  14127. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  14128. @end example
  14129. @item
  14130. Disable sonogram display:
  14131. @example
  14132. sono_h=0
  14133. @end example
  14134. @item
  14135. A1 and its harmonics: A1, A2, (near)E3, A3:
  14136. @example
  14137. 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),
  14138. asplit[a][out1]; [a] showcqt [out0]'
  14139. @end example
  14140. @item
  14141. Same as above, but with more accuracy in frequency domain:
  14142. @example
  14143. 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),
  14144. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  14145. @end example
  14146. @item
  14147. Custom volume:
  14148. @example
  14149. bar_v=10:sono_v=bar_v*a_weighting(f)
  14150. @end example
  14151. @item
  14152. Custom gamma, now spectrum is linear to the amplitude.
  14153. @example
  14154. bar_g=2:sono_g=2
  14155. @end example
  14156. @item
  14157. Custom tlength equation:
  14158. @example
  14159. 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)))'
  14160. @end example
  14161. @item
  14162. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  14163. @example
  14164. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  14165. @end example
  14166. @item
  14167. Custom font using fontconfig:
  14168. @example
  14169. font='Courier New,Monospace,mono|bold'
  14170. @end example
  14171. @item
  14172. Custom frequency range with custom axis using image file:
  14173. @example
  14174. axisfile=myaxis.png:basefreq=40:endfreq=10000
  14175. @end example
  14176. @end itemize
  14177. @section showfreqs
  14178. Convert input audio to video output representing the audio power spectrum.
  14179. Audio amplitude is on Y-axis while frequency is on X-axis.
  14180. The filter accepts the following options:
  14181. @table @option
  14182. @item size, s
  14183. Specify size of video. For the syntax of this option, check the
  14184. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14185. Default is @code{1024x512}.
  14186. @item mode
  14187. Set display mode.
  14188. This set how each frequency bin will be represented.
  14189. It accepts the following values:
  14190. @table @samp
  14191. @item line
  14192. @item bar
  14193. @item dot
  14194. @end table
  14195. Default is @code{bar}.
  14196. @item ascale
  14197. Set amplitude scale.
  14198. It accepts the following values:
  14199. @table @samp
  14200. @item lin
  14201. Linear scale.
  14202. @item sqrt
  14203. Square root scale.
  14204. @item cbrt
  14205. Cubic root scale.
  14206. @item log
  14207. Logarithmic scale.
  14208. @end table
  14209. Default is @code{log}.
  14210. @item fscale
  14211. Set frequency scale.
  14212. It accepts the following values:
  14213. @table @samp
  14214. @item lin
  14215. Linear scale.
  14216. @item log
  14217. Logarithmic scale.
  14218. @item rlog
  14219. Reverse logarithmic scale.
  14220. @end table
  14221. Default is @code{lin}.
  14222. @item win_size
  14223. Set window size.
  14224. It accepts the following values:
  14225. @table @samp
  14226. @item w16
  14227. @item w32
  14228. @item w64
  14229. @item w128
  14230. @item w256
  14231. @item w512
  14232. @item w1024
  14233. @item w2048
  14234. @item w4096
  14235. @item w8192
  14236. @item w16384
  14237. @item w32768
  14238. @item w65536
  14239. @end table
  14240. Default is @code{w2048}
  14241. @item win_func
  14242. Set windowing function.
  14243. It accepts the following values:
  14244. @table @samp
  14245. @item rect
  14246. @item bartlett
  14247. @item hanning
  14248. @item hamming
  14249. @item blackman
  14250. @item welch
  14251. @item flattop
  14252. @item bharris
  14253. @item bnuttall
  14254. @item bhann
  14255. @item sine
  14256. @item nuttall
  14257. @item lanczos
  14258. @item gauss
  14259. @item tukey
  14260. @item dolph
  14261. @item cauchy
  14262. @item parzen
  14263. @item poisson
  14264. @end table
  14265. Default is @code{hanning}.
  14266. @item overlap
  14267. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14268. which means optimal overlap for selected window function will be picked.
  14269. @item averaging
  14270. Set time averaging. Setting this to 0 will display current maximal peaks.
  14271. Default is @code{1}, which means time averaging is disabled.
  14272. @item colors
  14273. Specify list of colors separated by space or by '|' which will be used to
  14274. draw channel frequencies. Unrecognized or missing colors will be replaced
  14275. by white color.
  14276. @item cmode
  14277. Set channel display mode.
  14278. It accepts the following values:
  14279. @table @samp
  14280. @item combined
  14281. @item separate
  14282. @end table
  14283. Default is @code{combined}.
  14284. @item minamp
  14285. Set minimum amplitude used in @code{log} amplitude scaler.
  14286. @end table
  14287. @anchor{showspectrum}
  14288. @section showspectrum
  14289. Convert input audio to a video output, representing the audio frequency
  14290. spectrum.
  14291. The filter accepts the following options:
  14292. @table @option
  14293. @item size, s
  14294. Specify the video size for the output. For the syntax of this option, check the
  14295. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14296. Default value is @code{640x512}.
  14297. @item slide
  14298. Specify how the spectrum should slide along the window.
  14299. It accepts the following values:
  14300. @table @samp
  14301. @item replace
  14302. the samples start again on the left when they reach the right
  14303. @item scroll
  14304. the samples scroll from right to left
  14305. @item fullframe
  14306. frames are only produced when the samples reach the right
  14307. @item rscroll
  14308. the samples scroll from left to right
  14309. @end table
  14310. Default value is @code{replace}.
  14311. @item mode
  14312. Specify display mode.
  14313. It accepts the following values:
  14314. @table @samp
  14315. @item combined
  14316. all channels are displayed in the same row
  14317. @item separate
  14318. all channels are displayed in separate rows
  14319. @end table
  14320. Default value is @samp{combined}.
  14321. @item color
  14322. Specify display color mode.
  14323. It accepts the following values:
  14324. @table @samp
  14325. @item channel
  14326. each channel is displayed in a separate color
  14327. @item intensity
  14328. each channel is displayed using the same color scheme
  14329. @item rainbow
  14330. each channel is displayed using the rainbow color scheme
  14331. @item moreland
  14332. each channel is displayed using the moreland color scheme
  14333. @item nebulae
  14334. each channel is displayed using the nebulae color scheme
  14335. @item fire
  14336. each channel is displayed using the fire color scheme
  14337. @item fiery
  14338. each channel is displayed using the fiery color scheme
  14339. @item fruit
  14340. each channel is displayed using the fruit color scheme
  14341. @item cool
  14342. each channel is displayed using the cool color scheme
  14343. @end table
  14344. Default value is @samp{channel}.
  14345. @item scale
  14346. Specify scale used for calculating intensity color values.
  14347. It accepts the following values:
  14348. @table @samp
  14349. @item lin
  14350. linear
  14351. @item sqrt
  14352. square root, default
  14353. @item cbrt
  14354. cubic root
  14355. @item log
  14356. logarithmic
  14357. @item 4thrt
  14358. 4th root
  14359. @item 5thrt
  14360. 5th root
  14361. @end table
  14362. Default value is @samp{sqrt}.
  14363. @item saturation
  14364. Set saturation modifier for displayed colors. Negative values provide
  14365. alternative color scheme. @code{0} is no saturation at all.
  14366. Saturation must be in [-10.0, 10.0] range.
  14367. Default value is @code{1}.
  14368. @item win_func
  14369. Set window function.
  14370. It accepts the following values:
  14371. @table @samp
  14372. @item rect
  14373. @item bartlett
  14374. @item hann
  14375. @item hanning
  14376. @item hamming
  14377. @item blackman
  14378. @item welch
  14379. @item flattop
  14380. @item bharris
  14381. @item bnuttall
  14382. @item bhann
  14383. @item sine
  14384. @item nuttall
  14385. @item lanczos
  14386. @item gauss
  14387. @item tukey
  14388. @item dolph
  14389. @item cauchy
  14390. @item parzen
  14391. @item poisson
  14392. @end table
  14393. Default value is @code{hann}.
  14394. @item orientation
  14395. Set orientation of time vs frequency axis. Can be @code{vertical} or
  14396. @code{horizontal}. Default is @code{vertical}.
  14397. @item overlap
  14398. Set ratio of overlap window. Default value is @code{0}.
  14399. When value is @code{1} overlap is set to recommended size for specific
  14400. window function currently used.
  14401. @item gain
  14402. Set scale gain for calculating intensity color values.
  14403. Default value is @code{1}.
  14404. @item data
  14405. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  14406. @item rotation
  14407. Set color rotation, must be in [-1.0, 1.0] range.
  14408. Default value is @code{0}.
  14409. @end table
  14410. The usage is very similar to the showwaves filter; see the examples in that
  14411. section.
  14412. @subsection Examples
  14413. @itemize
  14414. @item
  14415. Large window with logarithmic color scaling:
  14416. @example
  14417. showspectrum=s=1280x480:scale=log
  14418. @end example
  14419. @item
  14420. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  14421. @example
  14422. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  14423. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  14424. @end example
  14425. @end itemize
  14426. @section showspectrumpic
  14427. Convert input audio to a single video frame, representing the audio frequency
  14428. spectrum.
  14429. The filter accepts the following options:
  14430. @table @option
  14431. @item size, s
  14432. Specify the video size for the output. For the syntax of this option, check the
  14433. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14434. Default value is @code{4096x2048}.
  14435. @item mode
  14436. Specify display mode.
  14437. It accepts the following values:
  14438. @table @samp
  14439. @item combined
  14440. all channels are displayed in the same row
  14441. @item separate
  14442. all channels are displayed in separate rows
  14443. @end table
  14444. Default value is @samp{combined}.
  14445. @item color
  14446. Specify display color mode.
  14447. It accepts the following values:
  14448. @table @samp
  14449. @item channel
  14450. each channel is displayed in a separate color
  14451. @item intensity
  14452. each channel is displayed using the same color scheme
  14453. @item rainbow
  14454. each channel is displayed using the rainbow color scheme
  14455. @item moreland
  14456. each channel is displayed using the moreland color scheme
  14457. @item nebulae
  14458. each channel is displayed using the nebulae color scheme
  14459. @item fire
  14460. each channel is displayed using the fire color scheme
  14461. @item fiery
  14462. each channel is displayed using the fiery color scheme
  14463. @item fruit
  14464. each channel is displayed using the fruit color scheme
  14465. @item cool
  14466. each channel is displayed using the cool color scheme
  14467. @end table
  14468. Default value is @samp{intensity}.
  14469. @item scale
  14470. Specify scale used for calculating intensity color values.
  14471. It accepts the following values:
  14472. @table @samp
  14473. @item lin
  14474. linear
  14475. @item sqrt
  14476. square root, default
  14477. @item cbrt
  14478. cubic root
  14479. @item log
  14480. logarithmic
  14481. @item 4thrt
  14482. 4th root
  14483. @item 5thrt
  14484. 5th root
  14485. @end table
  14486. Default value is @samp{log}.
  14487. @item saturation
  14488. Set saturation modifier for displayed colors. Negative values provide
  14489. alternative color scheme. @code{0} is no saturation at all.
  14490. Saturation must be in [-10.0, 10.0] range.
  14491. Default value is @code{1}.
  14492. @item win_func
  14493. Set window function.
  14494. It accepts the following values:
  14495. @table @samp
  14496. @item rect
  14497. @item bartlett
  14498. @item hann
  14499. @item hanning
  14500. @item hamming
  14501. @item blackman
  14502. @item welch
  14503. @item flattop
  14504. @item bharris
  14505. @item bnuttall
  14506. @item bhann
  14507. @item sine
  14508. @item nuttall
  14509. @item lanczos
  14510. @item gauss
  14511. @item tukey
  14512. @item dolph
  14513. @item cauchy
  14514. @item parzen
  14515. @item poisson
  14516. @end table
  14517. Default value is @code{hann}.
  14518. @item orientation
  14519. Set orientation of time vs frequency axis. Can be @code{vertical} or
  14520. @code{horizontal}. Default is @code{vertical}.
  14521. @item gain
  14522. Set scale gain for calculating intensity color values.
  14523. Default value is @code{1}.
  14524. @item legend
  14525. Draw time and frequency axes and legends. Default is enabled.
  14526. @item rotation
  14527. Set color rotation, must be in [-1.0, 1.0] range.
  14528. Default value is @code{0}.
  14529. @end table
  14530. @subsection Examples
  14531. @itemize
  14532. @item
  14533. Extract an audio spectrogram of a whole audio track
  14534. in a 1024x1024 picture using @command{ffmpeg}:
  14535. @example
  14536. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  14537. @end example
  14538. @end itemize
  14539. @section showvolume
  14540. Convert input audio volume to a video output.
  14541. The filter accepts the following options:
  14542. @table @option
  14543. @item rate, r
  14544. Set video rate.
  14545. @item b
  14546. Set border width, allowed range is [0, 5]. Default is 1.
  14547. @item w
  14548. Set channel width, allowed range is [80, 8192]. Default is 400.
  14549. @item h
  14550. Set channel height, allowed range is [1, 900]. Default is 20.
  14551. @item f
  14552. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  14553. @item c
  14554. Set volume color expression.
  14555. The expression can use the following variables:
  14556. @table @option
  14557. @item VOLUME
  14558. Current max volume of channel in dB.
  14559. @item PEAK
  14560. Current peak.
  14561. @item CHANNEL
  14562. Current channel number, starting from 0.
  14563. @end table
  14564. @item t
  14565. If set, displays channel names. Default is enabled.
  14566. @item v
  14567. If set, displays volume values. Default is enabled.
  14568. @item o
  14569. Set orientation, can be @code{horizontal} or @code{vertical},
  14570. default is @code{horizontal}.
  14571. @item s
  14572. Set step size, allowed range s [0, 5]. Default is 0, which means
  14573. step is disabled.
  14574. @end table
  14575. @section showwaves
  14576. Convert input audio to a video output, representing the samples waves.
  14577. The filter accepts the following options:
  14578. @table @option
  14579. @item size, s
  14580. Specify the video size for the output. For the syntax of this option, check the
  14581. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14582. Default value is @code{600x240}.
  14583. @item mode
  14584. Set display mode.
  14585. Available values are:
  14586. @table @samp
  14587. @item point
  14588. Draw a point for each sample.
  14589. @item line
  14590. Draw a vertical line for each sample.
  14591. @item p2p
  14592. Draw a point for each sample and a line between them.
  14593. @item cline
  14594. Draw a centered vertical line for each sample.
  14595. @end table
  14596. Default value is @code{point}.
  14597. @item n
  14598. Set the number of samples which are printed on the same column. A
  14599. larger value will decrease the frame rate. Must be a positive
  14600. integer. This option can be set only if the value for @var{rate}
  14601. is not explicitly specified.
  14602. @item rate, r
  14603. Set the (approximate) output frame rate. This is done by setting the
  14604. option @var{n}. Default value is "25".
  14605. @item split_channels
  14606. Set if channels should be drawn separately or overlap. Default value is 0.
  14607. @item colors
  14608. Set colors separated by '|' which are going to be used for drawing of each channel.
  14609. @item scale
  14610. Set amplitude scale.
  14611. Available values are:
  14612. @table @samp
  14613. @item lin
  14614. Linear.
  14615. @item log
  14616. Logarithmic.
  14617. @item sqrt
  14618. Square root.
  14619. @item cbrt
  14620. Cubic root.
  14621. @end table
  14622. Default is linear.
  14623. @end table
  14624. @subsection Examples
  14625. @itemize
  14626. @item
  14627. Output the input file audio and the corresponding video representation
  14628. at the same time:
  14629. @example
  14630. amovie=a.mp3,asplit[out0],showwaves[out1]
  14631. @end example
  14632. @item
  14633. Create a synthetic signal and show it with showwaves, forcing a
  14634. frame rate of 30 frames per second:
  14635. @example
  14636. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  14637. @end example
  14638. @end itemize
  14639. @section showwavespic
  14640. Convert input audio to a single video frame, representing the samples waves.
  14641. The filter accepts the following options:
  14642. @table @option
  14643. @item size, s
  14644. Specify the video size for the output. For the syntax of this option, check the
  14645. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14646. Default value is @code{600x240}.
  14647. @item split_channels
  14648. Set if channels should be drawn separately or overlap. Default value is 0.
  14649. @item colors
  14650. Set colors separated by '|' which are going to be used for drawing of each channel.
  14651. @item scale
  14652. Set amplitude scale.
  14653. Available values are:
  14654. @table @samp
  14655. @item lin
  14656. Linear.
  14657. @item log
  14658. Logarithmic.
  14659. @item sqrt
  14660. Square root.
  14661. @item cbrt
  14662. Cubic root.
  14663. @end table
  14664. Default is linear.
  14665. @end table
  14666. @subsection Examples
  14667. @itemize
  14668. @item
  14669. Extract a channel split representation of the wave form of a whole audio track
  14670. in a 1024x800 picture using @command{ffmpeg}:
  14671. @example
  14672. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  14673. @end example
  14674. @end itemize
  14675. @section sidedata, asidedata
  14676. Delete frame side data, or select frames based on it.
  14677. This filter accepts the following options:
  14678. @table @option
  14679. @item mode
  14680. Set mode of operation of the filter.
  14681. Can be one of the following:
  14682. @table @samp
  14683. @item select
  14684. Select every frame with side data of @code{type}.
  14685. @item delete
  14686. Delete side data of @code{type}. If @code{type} is not set, delete all side
  14687. data in the frame.
  14688. @end table
  14689. @item type
  14690. Set side data type used with all modes. Must be set for @code{select} mode. For
  14691. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  14692. in @file{libavutil/frame.h}. For example, to choose
  14693. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  14694. @end table
  14695. @section spectrumsynth
  14696. Sythesize audio from 2 input video spectrums, first input stream represents
  14697. magnitude across time and second represents phase across time.
  14698. The filter will transform from frequency domain as displayed in videos back
  14699. to time domain as presented in audio output.
  14700. This filter is primarily created for reversing processed @ref{showspectrum}
  14701. filter outputs, but can synthesize sound from other spectrograms too.
  14702. But in such case results are going to be poor if the phase data is not
  14703. available, because in such cases phase data need to be recreated, usually
  14704. its just recreated from random noise.
  14705. For best results use gray only output (@code{channel} color mode in
  14706. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  14707. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  14708. @code{data} option. Inputs videos should generally use @code{fullframe}
  14709. slide mode as that saves resources needed for decoding video.
  14710. The filter accepts the following options:
  14711. @table @option
  14712. @item sample_rate
  14713. Specify sample rate of output audio, the sample rate of audio from which
  14714. spectrum was generated may differ.
  14715. @item channels
  14716. Set number of channels represented in input video spectrums.
  14717. @item scale
  14718. Set scale which was used when generating magnitude input spectrum.
  14719. Can be @code{lin} or @code{log}. Default is @code{log}.
  14720. @item slide
  14721. Set slide which was used when generating inputs spectrums.
  14722. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  14723. Default is @code{fullframe}.
  14724. @item win_func
  14725. Set window function used for resynthesis.
  14726. @item overlap
  14727. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14728. which means optimal overlap for selected window function will be picked.
  14729. @item orientation
  14730. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  14731. Default is @code{vertical}.
  14732. @end table
  14733. @subsection Examples
  14734. @itemize
  14735. @item
  14736. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  14737. then resynthesize videos back to audio with spectrumsynth:
  14738. @example
  14739. 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
  14740. 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
  14741. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  14742. @end example
  14743. @end itemize
  14744. @section split, asplit
  14745. Split input into several identical outputs.
  14746. @code{asplit} works with audio input, @code{split} with video.
  14747. The filter accepts a single parameter which specifies the number of outputs. If
  14748. unspecified, it defaults to 2.
  14749. @subsection Examples
  14750. @itemize
  14751. @item
  14752. Create two separate outputs from the same input:
  14753. @example
  14754. [in] split [out0][out1]
  14755. @end example
  14756. @item
  14757. To create 3 or more outputs, you need to specify the number of
  14758. outputs, like in:
  14759. @example
  14760. [in] asplit=3 [out0][out1][out2]
  14761. @end example
  14762. @item
  14763. Create two separate outputs from the same input, one cropped and
  14764. one padded:
  14765. @example
  14766. [in] split [splitout1][splitout2];
  14767. [splitout1] crop=100:100:0:0 [cropout];
  14768. [splitout2] pad=200:200:100:100 [padout];
  14769. @end example
  14770. @item
  14771. Create 5 copies of the input audio with @command{ffmpeg}:
  14772. @example
  14773. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  14774. @end example
  14775. @end itemize
  14776. @section zmq, azmq
  14777. Receive commands sent through a libzmq client, and forward them to
  14778. filters in the filtergraph.
  14779. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  14780. must be inserted between two video filters, @code{azmq} between two
  14781. audio filters.
  14782. To enable these filters you need to install the libzmq library and
  14783. headers and configure FFmpeg with @code{--enable-libzmq}.
  14784. For more information about libzmq see:
  14785. @url{http://www.zeromq.org/}
  14786. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  14787. receives messages sent through a network interface defined by the
  14788. @option{bind_address} option.
  14789. The received message must be in the form:
  14790. @example
  14791. @var{TARGET} @var{COMMAND} [@var{ARG}]
  14792. @end example
  14793. @var{TARGET} specifies the target of the command, usually the name of
  14794. the filter class or a specific filter instance name.
  14795. @var{COMMAND} specifies the name of the command for the target filter.
  14796. @var{ARG} is optional and specifies the optional argument list for the
  14797. given @var{COMMAND}.
  14798. Upon reception, the message is processed and the corresponding command
  14799. is injected into the filtergraph. Depending on the result, the filter
  14800. will send a reply to the client, adopting the format:
  14801. @example
  14802. @var{ERROR_CODE} @var{ERROR_REASON}
  14803. @var{MESSAGE}
  14804. @end example
  14805. @var{MESSAGE} is optional.
  14806. @subsection Examples
  14807. Look at @file{tools/zmqsend} for an example of a zmq client which can
  14808. be used to send commands processed by these filters.
  14809. Consider the following filtergraph generated by @command{ffplay}
  14810. @example
  14811. ffplay -dumpgraph 1 -f lavfi "
  14812. color=s=100x100:c=red [l];
  14813. color=s=100x100:c=blue [r];
  14814. nullsrc=s=200x100, zmq [bg];
  14815. [bg][l] overlay [bg+l];
  14816. [bg+l][r] overlay=x=100 "
  14817. @end example
  14818. To change the color of the left side of the video, the following
  14819. command can be used:
  14820. @example
  14821. echo Parsed_color_0 c yellow | tools/zmqsend
  14822. @end example
  14823. To change the right side:
  14824. @example
  14825. echo Parsed_color_1 c pink | tools/zmqsend
  14826. @end example
  14827. @c man end MULTIMEDIA FILTERS
  14828. @chapter Multimedia Sources
  14829. @c man begin MULTIMEDIA SOURCES
  14830. Below is a description of the currently available multimedia sources.
  14831. @section amovie
  14832. This is the same as @ref{movie} source, except it selects an audio
  14833. stream by default.
  14834. @anchor{movie}
  14835. @section movie
  14836. Read audio and/or video stream(s) from a movie container.
  14837. It accepts the following parameters:
  14838. @table @option
  14839. @item filename
  14840. The name of the resource to read (not necessarily a file; it can also be a
  14841. device or a stream accessed through some protocol).
  14842. @item format_name, f
  14843. Specifies the format assumed for the movie to read, and can be either
  14844. the name of a container or an input device. If not specified, the
  14845. format is guessed from @var{movie_name} or by probing.
  14846. @item seek_point, sp
  14847. Specifies the seek point in seconds. The frames will be output
  14848. starting from this seek point. The parameter is evaluated with
  14849. @code{av_strtod}, so the numerical value may be suffixed by an IS
  14850. postfix. The default value is "0".
  14851. @item streams, s
  14852. Specifies the streams to read. Several streams can be specified,
  14853. separated by "+". The source will then have as many outputs, in the
  14854. same order. The syntax is explained in the ``Stream specifiers''
  14855. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  14856. respectively the default (best suited) video and audio stream. Default
  14857. is "dv", or "da" if the filter is called as "amovie".
  14858. @item stream_index, si
  14859. Specifies the index of the video stream to read. If the value is -1,
  14860. the most suitable video stream will be automatically selected. The default
  14861. value is "-1". Deprecated. If the filter is called "amovie", it will select
  14862. audio instead of video.
  14863. @item loop
  14864. Specifies how many times to read the stream in sequence.
  14865. If the value is 0, the stream will be looped infinitely.
  14866. Default value is "1".
  14867. Note that when the movie is looped the source timestamps are not
  14868. changed, so it will generate non monotonically increasing timestamps.
  14869. @item discontinuity
  14870. Specifies the time difference between frames above which the point is
  14871. considered a timestamp discontinuity which is removed by adjusting the later
  14872. timestamps.
  14873. @end table
  14874. It allows overlaying a second video on top of the main input of
  14875. a filtergraph, as shown in this graph:
  14876. @example
  14877. input -----------> deltapts0 --> overlay --> output
  14878. ^
  14879. |
  14880. movie --> scale--> deltapts1 -------+
  14881. @end example
  14882. @subsection Examples
  14883. @itemize
  14884. @item
  14885. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  14886. on top of the input labelled "in":
  14887. @example
  14888. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  14889. [in] setpts=PTS-STARTPTS [main];
  14890. [main][over] overlay=16:16 [out]
  14891. @end example
  14892. @item
  14893. Read from a video4linux2 device, and overlay it on top of the input
  14894. labelled "in":
  14895. @example
  14896. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  14897. [in] setpts=PTS-STARTPTS [main];
  14898. [main][over] overlay=16:16 [out]
  14899. @end example
  14900. @item
  14901. Read the first video stream and the audio stream with id 0x81 from
  14902. dvd.vob; the video is connected to the pad named "video" and the audio is
  14903. connected to the pad named "audio":
  14904. @example
  14905. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  14906. @end example
  14907. @end itemize
  14908. @subsection Commands
  14909. Both movie and amovie support the following commands:
  14910. @table @option
  14911. @item seek
  14912. Perform seek using "av_seek_frame".
  14913. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  14914. @itemize
  14915. @item
  14916. @var{stream_index}: If stream_index is -1, a default
  14917. stream is selected, and @var{timestamp} is automatically converted
  14918. from AV_TIME_BASE units to the stream specific time_base.
  14919. @item
  14920. @var{timestamp}: Timestamp in AVStream.time_base units
  14921. or, if no stream is specified, in AV_TIME_BASE units.
  14922. @item
  14923. @var{flags}: Flags which select direction and seeking mode.
  14924. @end itemize
  14925. @item get_duration
  14926. Get movie duration in AV_TIME_BASE units.
  14927. @end table
  14928. @c man end MULTIMEDIA SOURCES