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.

19414 lines
515KB

  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 draw the last overlay frame over the
  272. main input until the end of the stream. A value of 0 disables this
  273. behavior. 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 loudnesses 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 swep 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 hdcd
  2176. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2177. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2178. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2179. of HDCD, and detects the Transient Filter flag.
  2180. @example
  2181. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2182. @end example
  2183. When using the filter with wav, note the default encoding for wav is 16-bit,
  2184. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2185. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2186. @example
  2187. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2188. ffmpeg -i HDCD16.wav -af hdcd -acodec pcm_s24le OUT24.wav
  2189. @end example
  2190. The filter accepts the following options:
  2191. @table @option
  2192. @item disable_autoconvert
  2193. Disable any automatic format conversion or resampling in the filter graph.
  2194. @item process_stereo
  2195. Process the stereo channels together. If target_gain does not match between
  2196. channels, consider it invalid and use the last valid target_gain.
  2197. @item cdt_ms
  2198. Set the code detect timer period in ms.
  2199. @item force_pe
  2200. Always extend peaks above -3dBFS even if PE isn't signaled.
  2201. @item analyze_mode
  2202. Replace audio with a solid tone and adjust the amplitude to signal some
  2203. specific aspect of the decoding process. The output file can be loaded in
  2204. an audio editor alongside the original to aid analysis.
  2205. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2206. Modes are:
  2207. @table @samp
  2208. @item 0, off
  2209. Disabled
  2210. @item 1, lle
  2211. Gain adjustment level at each sample
  2212. @item 2, pe
  2213. Samples where peak extend occurs
  2214. @item 3, cdt
  2215. Samples where the code detect timer is active
  2216. @item 4, tgm
  2217. Samples where the target gain does not match between channels
  2218. @end table
  2219. @end table
  2220. @section headphone
  2221. Apply head-related transfer functions (HRTFs) to create virtual
  2222. loudspeakers around the user for binaural listening via headphones.
  2223. The HRIRs are provided via additional streams, for each channel
  2224. one stereo input stream is needed.
  2225. The filter accepts the following options:
  2226. @table @option
  2227. @item map
  2228. Set mapping of input streams for convolution.
  2229. The argument is a '|'-separated list of channel names in order as they
  2230. are given as additional stream inputs for filter.
  2231. This also specify number of input streams. Number of input streams
  2232. must be not less than number of channels in first stream plus one.
  2233. @item gain
  2234. Set gain applied to audio. Value is in dB. Default is 0.
  2235. @item type
  2236. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2237. processing audio in time domain which is slow.
  2238. @var{freq} is processing audio in frequency domain which is fast.
  2239. Default is @var{freq}.
  2240. @item lfe
  2241. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2242. @end table
  2243. @subsection Examples
  2244. @itemize
  2245. @item
  2246. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2247. each amovie filter use stereo file with IR coefficients as input.
  2248. The files give coefficients for each position of virtual loudspeaker:
  2249. @example
  2250. 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"
  2251. output.wav
  2252. @end example
  2253. @end itemize
  2254. @section highpass
  2255. Apply a high-pass filter with 3dB point frequency.
  2256. The filter can be either single-pole, or double-pole (the default).
  2257. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2258. The filter accepts the following options:
  2259. @table @option
  2260. @item frequency, f
  2261. Set frequency in Hz. Default is 3000.
  2262. @item poles, p
  2263. Set number of poles. Default is 2.
  2264. @item width_type, t
  2265. Set method to specify band-width of filter.
  2266. @table @option
  2267. @item h
  2268. Hz
  2269. @item q
  2270. Q-Factor
  2271. @item o
  2272. octave
  2273. @item s
  2274. slope
  2275. @end table
  2276. @item width, w
  2277. Specify the band-width of a filter in width_type units.
  2278. Applies only to double-pole filter.
  2279. The default is 0.707q and gives a Butterworth response.
  2280. @item channels, c
  2281. Specify which channels to filter, by default all available are filtered.
  2282. @end table
  2283. @section join
  2284. Join multiple input streams into one multi-channel stream.
  2285. It accepts the following parameters:
  2286. @table @option
  2287. @item inputs
  2288. The number of input streams. It defaults to 2.
  2289. @item channel_layout
  2290. The desired output channel layout. It defaults to stereo.
  2291. @item map
  2292. Map channels from inputs to output. The argument is a '|'-separated list of
  2293. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2294. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2295. can be either the name of the input channel (e.g. FL for front left) or its
  2296. index in the specified input stream. @var{out_channel} is the name of the output
  2297. channel.
  2298. @end table
  2299. The filter will attempt to guess the mappings when they are not specified
  2300. explicitly. It does so by first trying to find an unused matching input channel
  2301. and if that fails it picks the first unused input channel.
  2302. Join 3 inputs (with properly set channel layouts):
  2303. @example
  2304. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2305. @end example
  2306. Build a 5.1 output from 6 single-channel streams:
  2307. @example
  2308. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2309. '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'
  2310. out
  2311. @end example
  2312. @section ladspa
  2313. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2314. To enable compilation of this filter you need to configure FFmpeg with
  2315. @code{--enable-ladspa}.
  2316. @table @option
  2317. @item file, f
  2318. Specifies the name of LADSPA plugin library to load. If the environment
  2319. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2320. each one of the directories specified by the colon separated list in
  2321. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2322. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2323. @file{/usr/lib/ladspa/}.
  2324. @item plugin, p
  2325. Specifies the plugin within the library. Some libraries contain only
  2326. one plugin, but others contain many of them. If this is not set filter
  2327. will list all available plugins within the specified library.
  2328. @item controls, c
  2329. Set the '|' separated list of controls which are zero or more floating point
  2330. values that determine the behavior of the loaded plugin (for example delay,
  2331. threshold or gain).
  2332. Controls need to be defined using the following syntax:
  2333. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2334. @var{valuei} is the value set on the @var{i}-th control.
  2335. Alternatively they can be also defined using the following syntax:
  2336. @var{value0}|@var{value1}|@var{value2}|..., where
  2337. @var{valuei} is the value set on the @var{i}-th control.
  2338. If @option{controls} is set to @code{help}, all available controls and
  2339. their valid ranges are printed.
  2340. @item sample_rate, s
  2341. Specify the sample rate, default to 44100. Only used if plugin have
  2342. zero inputs.
  2343. @item nb_samples, n
  2344. Set the number of samples per channel per each output frame, default
  2345. is 1024. Only used if plugin have zero inputs.
  2346. @item duration, d
  2347. Set the minimum duration of the sourced audio. See
  2348. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2349. for the accepted syntax.
  2350. Note that the resulting duration may be greater than the specified duration,
  2351. as the generated audio is always cut at the end of a complete frame.
  2352. If not specified, or the expressed duration is negative, the audio is
  2353. supposed to be generated forever.
  2354. Only used if plugin have zero inputs.
  2355. @end table
  2356. @subsection Examples
  2357. @itemize
  2358. @item
  2359. List all available plugins within amp (LADSPA example plugin) library:
  2360. @example
  2361. ladspa=file=amp
  2362. @end example
  2363. @item
  2364. List all available controls and their valid ranges for @code{vcf_notch}
  2365. plugin from @code{VCF} library:
  2366. @example
  2367. ladspa=f=vcf:p=vcf_notch:c=help
  2368. @end example
  2369. @item
  2370. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2371. plugin library:
  2372. @example
  2373. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2374. @end example
  2375. @item
  2376. Add reverberation to the audio using TAP-plugins
  2377. (Tom's Audio Processing plugins):
  2378. @example
  2379. ladspa=file=tap_reverb:tap_reverb
  2380. @end example
  2381. @item
  2382. Generate white noise, with 0.2 amplitude:
  2383. @example
  2384. ladspa=file=cmt:noise_source_white:c=c0=.2
  2385. @end example
  2386. @item
  2387. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2388. @code{C* Audio Plugin Suite} (CAPS) library:
  2389. @example
  2390. ladspa=file=caps:Click:c=c1=20'
  2391. @end example
  2392. @item
  2393. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2394. @example
  2395. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2396. @end example
  2397. @item
  2398. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2399. @code{SWH Plugins} collection:
  2400. @example
  2401. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2402. @end example
  2403. @item
  2404. Attenuate low frequencies using Multiband EQ from Steve Harris
  2405. @code{SWH Plugins} collection:
  2406. @example
  2407. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2408. @end example
  2409. @item
  2410. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2411. (CAPS) library:
  2412. @example
  2413. ladspa=caps:Narrower
  2414. @end example
  2415. @item
  2416. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2417. @example
  2418. ladspa=caps:White:.2
  2419. @end example
  2420. @item
  2421. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2422. @example
  2423. ladspa=caps:Fractal:c=c1=1
  2424. @end example
  2425. @item
  2426. Dynamic volume normalization using @code{VLevel} plugin:
  2427. @example
  2428. ladspa=vlevel-ladspa:vlevel_mono
  2429. @end example
  2430. @end itemize
  2431. @subsection Commands
  2432. This filter supports the following commands:
  2433. @table @option
  2434. @item cN
  2435. Modify the @var{N}-th control value.
  2436. If the specified value is not valid, it is ignored and prior one is kept.
  2437. @end table
  2438. @section loudnorm
  2439. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2440. Support for both single pass (livestreams, files) and double pass (files) modes.
  2441. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  2442. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  2443. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  2444. The filter accepts the following options:
  2445. @table @option
  2446. @item I, i
  2447. Set integrated loudness target.
  2448. Range is -70.0 - -5.0. Default value is -24.0.
  2449. @item LRA, lra
  2450. Set loudness range target.
  2451. Range is 1.0 - 20.0. Default value is 7.0.
  2452. @item TP, tp
  2453. Set maximum true peak.
  2454. Range is -9.0 - +0.0. Default value is -2.0.
  2455. @item measured_I, measured_i
  2456. Measured IL of input file.
  2457. Range is -99.0 - +0.0.
  2458. @item measured_LRA, measured_lra
  2459. Measured LRA of input file.
  2460. Range is 0.0 - 99.0.
  2461. @item measured_TP, measured_tp
  2462. Measured true peak of input file.
  2463. Range is -99.0 - +99.0.
  2464. @item measured_thresh
  2465. Measured threshold of input file.
  2466. Range is -99.0 - +0.0.
  2467. @item offset
  2468. Set offset gain. Gain is applied before the true-peak limiter.
  2469. Range is -99.0 - +99.0. Default is +0.0.
  2470. @item linear
  2471. Normalize linearly if possible.
  2472. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2473. to be specified in order to use this mode.
  2474. Options are true or false. Default is true.
  2475. @item dual_mono
  2476. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2477. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2478. If set to @code{true}, this option will compensate for this effect.
  2479. Multi-channel input files are not affected by this option.
  2480. Options are true or false. Default is false.
  2481. @item print_format
  2482. Set print format for stats. Options are summary, json, or none.
  2483. Default value is none.
  2484. @end table
  2485. @section lowpass
  2486. Apply a low-pass filter with 3dB point frequency.
  2487. The filter can be either single-pole or double-pole (the default).
  2488. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2489. The filter accepts the following options:
  2490. @table @option
  2491. @item frequency, f
  2492. Set frequency in Hz. Default is 500.
  2493. @item poles, p
  2494. Set number of poles. Default is 2.
  2495. @item width_type, t
  2496. Set method to specify band-width of filter.
  2497. @table @option
  2498. @item h
  2499. Hz
  2500. @item q
  2501. Q-Factor
  2502. @item o
  2503. octave
  2504. @item s
  2505. slope
  2506. @end table
  2507. @item width, w
  2508. Specify the band-width of a filter in width_type units.
  2509. Applies only to double-pole filter.
  2510. The default is 0.707q and gives a Butterworth response.
  2511. @item channels, c
  2512. Specify which channels to filter, by default all available are filtered.
  2513. @end table
  2514. @subsection Examples
  2515. @itemize
  2516. @item
  2517. Lowpass only LFE channel, it LFE is not present it does nothing:
  2518. @example
  2519. lowpass=c=LFE
  2520. @end example
  2521. @end itemize
  2522. @anchor{pan}
  2523. @section pan
  2524. Mix channels with specific gain levels. The filter accepts the output
  2525. channel layout followed by a set of channels definitions.
  2526. This filter is also designed to efficiently remap the channels of an audio
  2527. stream.
  2528. The filter accepts parameters of the form:
  2529. "@var{l}|@var{outdef}|@var{outdef}|..."
  2530. @table @option
  2531. @item l
  2532. output channel layout or number of channels
  2533. @item outdef
  2534. output channel specification, of the form:
  2535. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  2536. @item out_name
  2537. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2538. number (c0, c1, etc.)
  2539. @item gain
  2540. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2541. @item in_name
  2542. input channel to use, see out_name for details; it is not possible to mix
  2543. named and numbered input channels
  2544. @end table
  2545. If the `=' in a channel specification is replaced by `<', then the gains for
  2546. that specification will be renormalized so that the total is 1, thus
  2547. avoiding clipping noise.
  2548. @subsection Mixing examples
  2549. For example, if you want to down-mix from stereo to mono, but with a bigger
  2550. factor for the left channel:
  2551. @example
  2552. pan=1c|c0=0.9*c0+0.1*c1
  2553. @end example
  2554. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2555. 7-channels surround:
  2556. @example
  2557. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2558. @end example
  2559. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2560. that should be preferred (see "-ac" option) unless you have very specific
  2561. needs.
  2562. @subsection Remapping examples
  2563. The channel remapping will be effective if, and only if:
  2564. @itemize
  2565. @item gain coefficients are zeroes or ones,
  2566. @item only one input per channel output,
  2567. @end itemize
  2568. If all these conditions are satisfied, the filter will notify the user ("Pure
  2569. channel mapping detected"), and use an optimized and lossless method to do the
  2570. remapping.
  2571. For example, if you have a 5.1 source and want a stereo audio stream by
  2572. dropping the extra channels:
  2573. @example
  2574. pan="stereo| c0=FL | c1=FR"
  2575. @end example
  2576. Given the same source, you can also switch front left and front right channels
  2577. and keep the input channel layout:
  2578. @example
  2579. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2580. @end example
  2581. If the input is a stereo audio stream, you can mute the front left channel (and
  2582. still keep the stereo channel layout) with:
  2583. @example
  2584. pan="stereo|c1=c1"
  2585. @end example
  2586. Still with a stereo audio stream input, you can copy the right channel in both
  2587. front left and right:
  2588. @example
  2589. pan="stereo| c0=FR | c1=FR"
  2590. @end example
  2591. @section replaygain
  2592. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2593. outputs it unchanged.
  2594. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2595. @section resample
  2596. Convert the audio sample format, sample rate and channel layout. It is
  2597. not meant to be used directly.
  2598. @section rubberband
  2599. Apply time-stretching and pitch-shifting with librubberband.
  2600. The filter accepts the following options:
  2601. @table @option
  2602. @item tempo
  2603. Set tempo scale factor.
  2604. @item pitch
  2605. Set pitch scale factor.
  2606. @item transients
  2607. Set transients detector.
  2608. Possible values are:
  2609. @table @var
  2610. @item crisp
  2611. @item mixed
  2612. @item smooth
  2613. @end table
  2614. @item detector
  2615. Set detector.
  2616. Possible values are:
  2617. @table @var
  2618. @item compound
  2619. @item percussive
  2620. @item soft
  2621. @end table
  2622. @item phase
  2623. Set phase.
  2624. Possible values are:
  2625. @table @var
  2626. @item laminar
  2627. @item independent
  2628. @end table
  2629. @item window
  2630. Set processing window size.
  2631. Possible values are:
  2632. @table @var
  2633. @item standard
  2634. @item short
  2635. @item long
  2636. @end table
  2637. @item smoothing
  2638. Set smoothing.
  2639. Possible values are:
  2640. @table @var
  2641. @item off
  2642. @item on
  2643. @end table
  2644. @item formant
  2645. Enable formant preservation when shift pitching.
  2646. Possible values are:
  2647. @table @var
  2648. @item shifted
  2649. @item preserved
  2650. @end table
  2651. @item pitchq
  2652. Set pitch quality.
  2653. Possible values are:
  2654. @table @var
  2655. @item quality
  2656. @item speed
  2657. @item consistency
  2658. @end table
  2659. @item channels
  2660. Set channels.
  2661. Possible values are:
  2662. @table @var
  2663. @item apart
  2664. @item together
  2665. @end table
  2666. @end table
  2667. @section sidechaincompress
  2668. This filter acts like normal compressor but has the ability to compress
  2669. detected signal using second input signal.
  2670. It needs two input streams and returns one output stream.
  2671. First input stream will be processed depending on second stream signal.
  2672. The filtered signal then can be filtered with other filters in later stages of
  2673. processing. See @ref{pan} and @ref{amerge} filter.
  2674. The filter accepts the following options:
  2675. @table @option
  2676. @item level_in
  2677. Set input gain. Default is 1. Range is between 0.015625 and 64.
  2678. @item threshold
  2679. If a signal of second stream raises above this level it will affect the gain
  2680. reduction of first stream.
  2681. By default is 0.125. Range is between 0.00097563 and 1.
  2682. @item ratio
  2683. Set a ratio about which the signal is reduced. 1:2 means that if the level
  2684. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  2685. Default is 2. Range is between 1 and 20.
  2686. @item attack
  2687. Amount of milliseconds the signal has to rise above the threshold before gain
  2688. reduction starts. Default is 20. Range is between 0.01 and 2000.
  2689. @item release
  2690. Amount of milliseconds the signal has to fall below the threshold before
  2691. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  2692. @item makeup
  2693. Set the amount by how much signal will be amplified after processing.
  2694. Default is 1. Range is from 1 to 64.
  2695. @item knee
  2696. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2697. Default is 2.82843. Range is between 1 and 8.
  2698. @item link
  2699. Choose if the @code{average} level between all channels of side-chain stream
  2700. or the louder(@code{maximum}) channel of side-chain stream affects the
  2701. reduction. Default is @code{average}.
  2702. @item detection
  2703. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  2704. of @code{rms}. Default is @code{rms} which is mainly smoother.
  2705. @item level_sc
  2706. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  2707. @item mix
  2708. How much to use compressed signal in output. Default is 1.
  2709. Range is between 0 and 1.
  2710. @end table
  2711. @subsection Examples
  2712. @itemize
  2713. @item
  2714. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  2715. depending on the signal of 2nd input and later compressed signal to be
  2716. merged with 2nd input:
  2717. @example
  2718. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  2719. @end example
  2720. @end itemize
  2721. @section sidechaingate
  2722. A sidechain gate acts like a normal (wideband) gate but has the ability to
  2723. filter the detected signal before sending it to the gain reduction stage.
  2724. Normally a gate uses the full range signal to detect a level above the
  2725. threshold.
  2726. For example: If you cut all lower frequencies from your sidechain signal
  2727. the gate will decrease the volume of your track only if not enough highs
  2728. appear. With this technique you are able to reduce the resonation of a
  2729. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  2730. guitar.
  2731. It needs two input streams and returns one output stream.
  2732. First input stream will be processed depending on second stream signal.
  2733. The filter accepts the following options:
  2734. @table @option
  2735. @item level_in
  2736. Set input level before filtering.
  2737. Default is 1. Allowed range is from 0.015625 to 64.
  2738. @item range
  2739. Set the level of gain reduction when the signal is below the threshold.
  2740. Default is 0.06125. Allowed range is from 0 to 1.
  2741. @item threshold
  2742. If a signal rises above this level the gain reduction is released.
  2743. Default is 0.125. Allowed range is from 0 to 1.
  2744. @item ratio
  2745. Set a ratio about which the signal is reduced.
  2746. Default is 2. Allowed range is from 1 to 9000.
  2747. @item attack
  2748. Amount of milliseconds the signal has to rise above the threshold before gain
  2749. reduction stops.
  2750. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  2751. @item release
  2752. Amount of milliseconds the signal has to fall below the threshold before the
  2753. reduction is increased again. Default is 250 milliseconds.
  2754. Allowed range is from 0.01 to 9000.
  2755. @item makeup
  2756. Set amount of amplification of signal after processing.
  2757. Default is 1. Allowed range is from 1 to 64.
  2758. @item knee
  2759. Curve the sharp knee around the threshold to enter gain reduction more softly.
  2760. Default is 2.828427125. Allowed range is from 1 to 8.
  2761. @item detection
  2762. Choose if exact signal should be taken for detection or an RMS like one.
  2763. Default is rms. Can be peak or rms.
  2764. @item link
  2765. Choose if the average level between all channels or the louder channel affects
  2766. the reduction.
  2767. Default is average. Can be average or maximum.
  2768. @item level_sc
  2769. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  2770. @end table
  2771. @section silencedetect
  2772. Detect silence in an audio stream.
  2773. This filter logs a message when it detects that the input audio volume is less
  2774. or equal to a noise tolerance value for a duration greater or equal to the
  2775. minimum detected noise duration.
  2776. The printed times and duration are expressed in seconds.
  2777. The filter accepts the following options:
  2778. @table @option
  2779. @item duration, d
  2780. Set silence duration until notification (default is 2 seconds).
  2781. @item noise, n
  2782. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  2783. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  2784. @end table
  2785. @subsection Examples
  2786. @itemize
  2787. @item
  2788. Detect 5 seconds of silence with -50dB noise tolerance:
  2789. @example
  2790. silencedetect=n=-50dB:d=5
  2791. @end example
  2792. @item
  2793. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  2794. tolerance in @file{silence.mp3}:
  2795. @example
  2796. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  2797. @end example
  2798. @end itemize
  2799. @section silenceremove
  2800. Remove silence from the beginning, middle or end of the audio.
  2801. The filter accepts the following options:
  2802. @table @option
  2803. @item start_periods
  2804. This value is used to indicate if audio should be trimmed at beginning of
  2805. the audio. A value of zero indicates no silence should be trimmed from the
  2806. beginning. When specifying a non-zero value, it trims audio up until it
  2807. finds non-silence. Normally, when trimming silence from beginning of audio
  2808. the @var{start_periods} will be @code{1} but it can be increased to higher
  2809. values to trim all audio up to specific count of non-silence periods.
  2810. Default value is @code{0}.
  2811. @item start_duration
  2812. Specify the amount of time that non-silence must be detected before it stops
  2813. trimming audio. By increasing the duration, bursts of noises can be treated
  2814. as silence and trimmed off. Default value is @code{0}.
  2815. @item start_threshold
  2816. This indicates what sample value should be treated as silence. For digital
  2817. audio, a value of @code{0} may be fine but for audio recorded from analog,
  2818. you may wish to increase the value to account for background noise.
  2819. Can be specified in dB (in case "dB" is appended to the specified value)
  2820. or amplitude ratio. Default value is @code{0}.
  2821. @item stop_periods
  2822. Set the count for trimming silence from the end of audio.
  2823. To remove silence from the middle of a file, specify a @var{stop_periods}
  2824. that is negative. This value is then treated as a positive value and is
  2825. used to indicate the effect should restart processing as specified by
  2826. @var{start_periods}, making it suitable for removing periods of silence
  2827. in the middle of the audio.
  2828. Default value is @code{0}.
  2829. @item stop_duration
  2830. Specify a duration of silence that must exist before audio is not copied any
  2831. more. By specifying a higher duration, silence that is wanted can be left in
  2832. the audio.
  2833. Default value is @code{0}.
  2834. @item stop_threshold
  2835. This is the same as @option{start_threshold} but for trimming silence from
  2836. the end of audio.
  2837. Can be specified in dB (in case "dB" is appended to the specified value)
  2838. or amplitude ratio. Default value is @code{0}.
  2839. @item leave_silence
  2840. This indicates that @var{stop_duration} length of audio should be left intact
  2841. at the beginning of each period of silence.
  2842. For example, if you want to remove long pauses between words but do not want
  2843. to remove the pauses completely. Default value is @code{0}.
  2844. @item detection
  2845. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  2846. and works better with digital silence which is exactly 0.
  2847. Default value is @code{rms}.
  2848. @item window
  2849. Set ratio used to calculate size of window for detecting silence.
  2850. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  2851. @end table
  2852. @subsection Examples
  2853. @itemize
  2854. @item
  2855. The following example shows how this filter can be used to start a recording
  2856. that does not contain the delay at the start which usually occurs between
  2857. pressing the record button and the start of the performance:
  2858. @example
  2859. silenceremove=1:5:0.02
  2860. @end example
  2861. @item
  2862. Trim all silence encountered from beginning to end where there is more than 1
  2863. second of silence in audio:
  2864. @example
  2865. silenceremove=0:0:0:-1:1:-90dB
  2866. @end example
  2867. @end itemize
  2868. @section sofalizer
  2869. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  2870. loudspeakers around the user for binaural listening via headphones (audio
  2871. formats up to 9 channels supported).
  2872. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  2873. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  2874. Austrian Academy of Sciences.
  2875. To enable compilation of this filter you need to configure FFmpeg with
  2876. @code{--enable-libmysofa}.
  2877. The filter accepts the following options:
  2878. @table @option
  2879. @item sofa
  2880. Set the SOFA file used for rendering.
  2881. @item gain
  2882. Set gain applied to audio. Value is in dB. Default is 0.
  2883. @item rotation
  2884. Set rotation of virtual loudspeakers in deg. Default is 0.
  2885. @item elevation
  2886. Set elevation of virtual speakers in deg. Default is 0.
  2887. @item radius
  2888. Set distance in meters between loudspeakers and the listener with near-field
  2889. HRTFs. Default is 1.
  2890. @item type
  2891. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2892. processing audio in time domain which is slow.
  2893. @var{freq} is processing audio in frequency domain which is fast.
  2894. Default is @var{freq}.
  2895. @item speakers
  2896. Set custom positions of virtual loudspeakers. Syntax for this option is:
  2897. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  2898. Each virtual loudspeaker is described with short channel name following with
  2899. azimuth and elevation in degreees.
  2900. Each virtual loudspeaker description is separated by '|'.
  2901. For example to override front left and front right channel positions use:
  2902. 'speakers=FL 45 15|FR 345 15'.
  2903. Descriptions with unrecognised channel names are ignored.
  2904. @item lfegain
  2905. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2906. @end table
  2907. @subsection Examples
  2908. @itemize
  2909. @item
  2910. Using ClubFritz6 sofa file:
  2911. @example
  2912. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  2913. @end example
  2914. @item
  2915. Using ClubFritz12 sofa file and bigger radius with small rotation:
  2916. @example
  2917. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  2918. @end example
  2919. @item
  2920. Similar as above but with custom speaker positions for front left, front right, back left and back right
  2921. and also with custom gain:
  2922. @example
  2923. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  2924. @end example
  2925. @end itemize
  2926. @section stereotools
  2927. This filter has some handy utilities to manage stereo signals, for converting
  2928. M/S stereo recordings to L/R signal while having control over the parameters
  2929. or spreading the stereo image of master track.
  2930. The filter accepts the following options:
  2931. @table @option
  2932. @item level_in
  2933. Set input level before filtering for both channels. Defaults is 1.
  2934. Allowed range is from 0.015625 to 64.
  2935. @item level_out
  2936. Set output level after filtering for both channels. Defaults is 1.
  2937. Allowed range is from 0.015625 to 64.
  2938. @item balance_in
  2939. Set input balance between both channels. Default is 0.
  2940. Allowed range is from -1 to 1.
  2941. @item balance_out
  2942. Set output balance between both channels. Default is 0.
  2943. Allowed range is from -1 to 1.
  2944. @item softclip
  2945. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  2946. clipping. Disabled by default.
  2947. @item mutel
  2948. Mute the left channel. Disabled by default.
  2949. @item muter
  2950. Mute the right channel. Disabled by default.
  2951. @item phasel
  2952. Change the phase of the left channel. Disabled by default.
  2953. @item phaser
  2954. Change the phase of the right channel. Disabled by default.
  2955. @item mode
  2956. Set stereo mode. Available values are:
  2957. @table @samp
  2958. @item lr>lr
  2959. Left/Right to Left/Right, this is default.
  2960. @item lr>ms
  2961. Left/Right to Mid/Side.
  2962. @item ms>lr
  2963. Mid/Side to Left/Right.
  2964. @item lr>ll
  2965. Left/Right to Left/Left.
  2966. @item lr>rr
  2967. Left/Right to Right/Right.
  2968. @item lr>l+r
  2969. Left/Right to Left + Right.
  2970. @item lr>rl
  2971. Left/Right to Right/Left.
  2972. @item ms>ll
  2973. Mid/Side to Left/Left.
  2974. @item ms>rr
  2975. Mid/Side to Right/Right.
  2976. @end table
  2977. @item slev
  2978. Set level of side signal. Default is 1.
  2979. Allowed range is from 0.015625 to 64.
  2980. @item sbal
  2981. Set balance of side signal. Default is 0.
  2982. Allowed range is from -1 to 1.
  2983. @item mlev
  2984. Set level of the middle signal. Default is 1.
  2985. Allowed range is from 0.015625 to 64.
  2986. @item mpan
  2987. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  2988. @item base
  2989. Set stereo base between mono and inversed channels. Default is 0.
  2990. Allowed range is from -1 to 1.
  2991. @item delay
  2992. Set delay in milliseconds how much to delay left from right channel and
  2993. vice versa. Default is 0. Allowed range is from -20 to 20.
  2994. @item sclevel
  2995. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  2996. @item phase
  2997. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  2998. @item bmode_in, bmode_out
  2999. Set balance mode for balance_in/balance_out option.
  3000. Can be one of the following:
  3001. @table @samp
  3002. @item balance
  3003. Classic balance mode. Attenuate one channel at time.
  3004. Gain is raised up to 1.
  3005. @item amplitude
  3006. Similar as classic mode above but gain is raised up to 2.
  3007. @item power
  3008. Equal power distribution, from -6dB to +6dB range.
  3009. @end table
  3010. @end table
  3011. @subsection Examples
  3012. @itemize
  3013. @item
  3014. Apply karaoke like effect:
  3015. @example
  3016. stereotools=mlev=0.015625
  3017. @end example
  3018. @item
  3019. Convert M/S signal to L/R:
  3020. @example
  3021. "stereotools=mode=ms>lr"
  3022. @end example
  3023. @end itemize
  3024. @section stereowiden
  3025. This filter enhance the stereo effect by suppressing signal common to both
  3026. channels and by delaying the signal of left into right and vice versa,
  3027. thereby widening the stereo effect.
  3028. The filter accepts the following options:
  3029. @table @option
  3030. @item delay
  3031. Time in milliseconds of the delay of left signal into right and vice versa.
  3032. Default is 20 milliseconds.
  3033. @item feedback
  3034. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3035. effect of left signal in right output and vice versa which gives widening
  3036. effect. Default is 0.3.
  3037. @item crossfeed
  3038. Cross feed of left into right with inverted phase. This helps in suppressing
  3039. the mono. If the value is 1 it will cancel all the signal common to both
  3040. channels. Default is 0.3.
  3041. @item drymix
  3042. Set level of input signal of original channel. Default is 0.8.
  3043. @end table
  3044. @section superequalizer
  3045. Apply 18 band equalizer.
  3046. The filter accepts the following options:
  3047. @table @option
  3048. @item 1b
  3049. Set 65Hz band gain.
  3050. @item 2b
  3051. Set 92Hz band gain.
  3052. @item 3b
  3053. Set 131Hz band gain.
  3054. @item 4b
  3055. Set 185Hz band gain.
  3056. @item 5b
  3057. Set 262Hz band gain.
  3058. @item 6b
  3059. Set 370Hz band gain.
  3060. @item 7b
  3061. Set 523Hz band gain.
  3062. @item 8b
  3063. Set 740Hz band gain.
  3064. @item 9b
  3065. Set 1047Hz band gain.
  3066. @item 10b
  3067. Set 1480Hz band gain.
  3068. @item 11b
  3069. Set 2093Hz band gain.
  3070. @item 12b
  3071. Set 2960Hz band gain.
  3072. @item 13b
  3073. Set 4186Hz band gain.
  3074. @item 14b
  3075. Set 5920Hz band gain.
  3076. @item 15b
  3077. Set 8372Hz band gain.
  3078. @item 16b
  3079. Set 11840Hz band gain.
  3080. @item 17b
  3081. Set 16744Hz band gain.
  3082. @item 18b
  3083. Set 20000Hz band gain.
  3084. @end table
  3085. @section surround
  3086. Apply audio surround upmix filter.
  3087. This filter allows to produce multichannel output from audio stream.
  3088. The filter accepts the following options:
  3089. @table @option
  3090. @item chl_out
  3091. Set output channel layout. By default, this is @var{5.1}.
  3092. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3093. for the required syntax.
  3094. @item chl_in
  3095. Set input channel layout. By default, this is @var{stereo}.
  3096. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3097. for the required syntax.
  3098. @item level_in
  3099. Set input volume level. By default, this is @var{1}.
  3100. @item level_out
  3101. Set output volume level. By default, this is @var{1}.
  3102. @item lfe
  3103. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3104. @item lfe_low
  3105. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3106. @item lfe_high
  3107. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3108. @item fc_in
  3109. Set front center input volume. By default, this is @var{1}.
  3110. @item fc_out
  3111. Set front center output volume. By default, this is @var{1}.
  3112. @item lfe_in
  3113. Set LFE input volume. By default, this is @var{1}.
  3114. @item lfe_out
  3115. Set LFE output volume. By default, this is @var{1}.
  3116. @end table
  3117. @section treble
  3118. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3119. shelving filter with a response similar to that of a standard
  3120. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3121. The filter accepts the following options:
  3122. @table @option
  3123. @item gain, g
  3124. Give the gain at whichever is the lower of ~22 kHz and the
  3125. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3126. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3127. @item frequency, f
  3128. Set the filter's central frequency and so can be used
  3129. to extend or reduce the frequency range to be boosted or cut.
  3130. The default value is @code{3000} Hz.
  3131. @item width_type, t
  3132. Set method to specify band-width of filter.
  3133. @table @option
  3134. @item h
  3135. Hz
  3136. @item q
  3137. Q-Factor
  3138. @item o
  3139. octave
  3140. @item s
  3141. slope
  3142. @end table
  3143. @item width, w
  3144. Determine how steep is the filter's shelf transition.
  3145. @item channels, c
  3146. Specify which channels to filter, by default all available are filtered.
  3147. @end table
  3148. @section tremolo
  3149. Sinusoidal amplitude modulation.
  3150. The filter accepts the following options:
  3151. @table @option
  3152. @item f
  3153. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3154. (20 Hz or lower) will result in a tremolo effect.
  3155. This filter may also be used as a ring modulator by specifying
  3156. a modulation frequency higher than 20 Hz.
  3157. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3158. @item d
  3159. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3160. Default value is 0.5.
  3161. @end table
  3162. @section vibrato
  3163. Sinusoidal phase modulation.
  3164. The filter accepts the following options:
  3165. @table @option
  3166. @item f
  3167. Modulation frequency in Hertz.
  3168. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3169. @item d
  3170. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3171. Default value is 0.5.
  3172. @end table
  3173. @section volume
  3174. Adjust the input audio volume.
  3175. It accepts the following parameters:
  3176. @table @option
  3177. @item volume
  3178. Set audio volume expression.
  3179. Output values are clipped to the maximum value.
  3180. The output audio volume is given by the relation:
  3181. @example
  3182. @var{output_volume} = @var{volume} * @var{input_volume}
  3183. @end example
  3184. The default value for @var{volume} is "1.0".
  3185. @item precision
  3186. This parameter represents the mathematical precision.
  3187. It determines which input sample formats will be allowed, which affects the
  3188. precision of the volume scaling.
  3189. @table @option
  3190. @item fixed
  3191. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3192. @item float
  3193. 32-bit floating-point; this limits input sample format to FLT. (default)
  3194. @item double
  3195. 64-bit floating-point; this limits input sample format to DBL.
  3196. @end table
  3197. @item replaygain
  3198. Choose the behaviour on encountering ReplayGain side data in input frames.
  3199. @table @option
  3200. @item drop
  3201. Remove ReplayGain side data, ignoring its contents (the default).
  3202. @item ignore
  3203. Ignore ReplayGain side data, but leave it in the frame.
  3204. @item track
  3205. Prefer the track gain, if present.
  3206. @item album
  3207. Prefer the album gain, if present.
  3208. @end table
  3209. @item replaygain_preamp
  3210. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3211. Default value for @var{replaygain_preamp} is 0.0.
  3212. @item eval
  3213. Set when the volume expression is evaluated.
  3214. It accepts the following values:
  3215. @table @samp
  3216. @item once
  3217. only evaluate expression once during the filter initialization, or
  3218. when the @samp{volume} command is sent
  3219. @item frame
  3220. evaluate expression for each incoming frame
  3221. @end table
  3222. Default value is @samp{once}.
  3223. @end table
  3224. The volume expression can contain the following parameters.
  3225. @table @option
  3226. @item n
  3227. frame number (starting at zero)
  3228. @item nb_channels
  3229. number of channels
  3230. @item nb_consumed_samples
  3231. number of samples consumed by the filter
  3232. @item nb_samples
  3233. number of samples in the current frame
  3234. @item pos
  3235. original frame position in the file
  3236. @item pts
  3237. frame PTS
  3238. @item sample_rate
  3239. sample rate
  3240. @item startpts
  3241. PTS at start of stream
  3242. @item startt
  3243. time at start of stream
  3244. @item t
  3245. frame time
  3246. @item tb
  3247. timestamp timebase
  3248. @item volume
  3249. last set volume value
  3250. @end table
  3251. Note that when @option{eval} is set to @samp{once} only the
  3252. @var{sample_rate} and @var{tb} variables are available, all other
  3253. variables will evaluate to NAN.
  3254. @subsection Commands
  3255. This filter supports the following commands:
  3256. @table @option
  3257. @item volume
  3258. Modify the volume expression.
  3259. The command accepts the same syntax of the corresponding option.
  3260. If the specified expression is not valid, it is kept at its current
  3261. value.
  3262. @item replaygain_noclip
  3263. Prevent clipping by limiting the gain applied.
  3264. Default value for @var{replaygain_noclip} is 1.
  3265. @end table
  3266. @subsection Examples
  3267. @itemize
  3268. @item
  3269. Halve the input audio volume:
  3270. @example
  3271. volume=volume=0.5
  3272. volume=volume=1/2
  3273. volume=volume=-6.0206dB
  3274. @end example
  3275. In all the above example the named key for @option{volume} can be
  3276. omitted, for example like in:
  3277. @example
  3278. volume=0.5
  3279. @end example
  3280. @item
  3281. Increase input audio power by 6 decibels using fixed-point precision:
  3282. @example
  3283. volume=volume=6dB:precision=fixed
  3284. @end example
  3285. @item
  3286. Fade volume after time 10 with an annihilation period of 5 seconds:
  3287. @example
  3288. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3289. @end example
  3290. @end itemize
  3291. @section volumedetect
  3292. Detect the volume of the input video.
  3293. The filter has no parameters. The input is not modified. Statistics about
  3294. the volume will be printed in the log when the input stream end is reached.
  3295. In particular it will show the mean volume (root mean square), maximum
  3296. volume (on a per-sample basis), and the beginning of a histogram of the
  3297. registered volume values (from the maximum value to a cumulated 1/1000 of
  3298. the samples).
  3299. All volumes are in decibels relative to the maximum PCM value.
  3300. @subsection Examples
  3301. Here is an excerpt of the output:
  3302. @example
  3303. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3304. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3305. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3306. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3307. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3308. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3309. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3310. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3311. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3312. @end example
  3313. It means that:
  3314. @itemize
  3315. @item
  3316. The mean square energy is approximately -27 dB, or 10^-2.7.
  3317. @item
  3318. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3319. @item
  3320. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3321. @end itemize
  3322. In other words, raising the volume by +4 dB does not cause any clipping,
  3323. raising it by +5 dB causes clipping for 6 samples, etc.
  3324. @c man end AUDIO FILTERS
  3325. @chapter Audio Sources
  3326. @c man begin AUDIO SOURCES
  3327. Below is a description of the currently available audio sources.
  3328. @section abuffer
  3329. Buffer audio frames, and make them available to the filter chain.
  3330. This source is mainly intended for a programmatic use, in particular
  3331. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3332. It accepts the following parameters:
  3333. @table @option
  3334. @item time_base
  3335. The timebase which will be used for timestamps of submitted frames. It must be
  3336. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3337. @item sample_rate
  3338. The sample rate of the incoming audio buffers.
  3339. @item sample_fmt
  3340. The sample format of the incoming audio buffers.
  3341. Either a sample format name or its corresponding integer representation from
  3342. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3343. @item channel_layout
  3344. The channel layout of the incoming audio buffers.
  3345. Either a channel layout name from channel_layout_map in
  3346. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3347. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3348. @item channels
  3349. The number of channels of the incoming audio buffers.
  3350. If both @var{channels} and @var{channel_layout} are specified, then they
  3351. must be consistent.
  3352. @end table
  3353. @subsection Examples
  3354. @example
  3355. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3356. @end example
  3357. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3358. Since the sample format with name "s16p" corresponds to the number
  3359. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3360. equivalent to:
  3361. @example
  3362. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3363. @end example
  3364. @section aevalsrc
  3365. Generate an audio signal specified by an expression.
  3366. This source accepts in input one or more expressions (one for each
  3367. channel), which are evaluated and used to generate a corresponding
  3368. audio signal.
  3369. This source accepts the following options:
  3370. @table @option
  3371. @item exprs
  3372. Set the '|'-separated expressions list for each separate channel. In case the
  3373. @option{channel_layout} option is not specified, the selected channel layout
  3374. depends on the number of provided expressions. Otherwise the last
  3375. specified expression is applied to the remaining output channels.
  3376. @item channel_layout, c
  3377. Set the channel layout. The number of channels in the specified layout
  3378. must be equal to the number of specified expressions.
  3379. @item duration, d
  3380. Set the minimum duration of the sourced audio. See
  3381. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3382. for the accepted syntax.
  3383. Note that the resulting duration may be greater than the specified
  3384. duration, as the generated audio is always cut at the end of a
  3385. complete frame.
  3386. If not specified, or the expressed duration is negative, the audio is
  3387. supposed to be generated forever.
  3388. @item nb_samples, n
  3389. Set the number of samples per channel per each output frame,
  3390. default to 1024.
  3391. @item sample_rate, s
  3392. Specify the sample rate, default to 44100.
  3393. @end table
  3394. Each expression in @var{exprs} can contain the following constants:
  3395. @table @option
  3396. @item n
  3397. number of the evaluated sample, starting from 0
  3398. @item t
  3399. time of the evaluated sample expressed in seconds, starting from 0
  3400. @item s
  3401. sample rate
  3402. @end table
  3403. @subsection Examples
  3404. @itemize
  3405. @item
  3406. Generate silence:
  3407. @example
  3408. aevalsrc=0
  3409. @end example
  3410. @item
  3411. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3412. 8000 Hz:
  3413. @example
  3414. aevalsrc="sin(440*2*PI*t):s=8000"
  3415. @end example
  3416. @item
  3417. Generate a two channels signal, specify the channel layout (Front
  3418. Center + Back Center) explicitly:
  3419. @example
  3420. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3421. @end example
  3422. @item
  3423. Generate white noise:
  3424. @example
  3425. aevalsrc="-2+random(0)"
  3426. @end example
  3427. @item
  3428. Generate an amplitude modulated signal:
  3429. @example
  3430. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3431. @end example
  3432. @item
  3433. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3434. @example
  3435. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3436. @end example
  3437. @end itemize
  3438. @section anullsrc
  3439. The null audio source, return unprocessed audio frames. It is mainly useful
  3440. as a template and to be employed in analysis / debugging tools, or as
  3441. the source for filters which ignore the input data (for example the sox
  3442. synth filter).
  3443. This source accepts the following options:
  3444. @table @option
  3445. @item channel_layout, cl
  3446. Specifies the channel layout, and can be either an integer or a string
  3447. representing a channel layout. The default value of @var{channel_layout}
  3448. is "stereo".
  3449. Check the channel_layout_map definition in
  3450. @file{libavutil/channel_layout.c} for the mapping between strings and
  3451. channel layout values.
  3452. @item sample_rate, r
  3453. Specifies the sample rate, and defaults to 44100.
  3454. @item nb_samples, n
  3455. Set the number of samples per requested frames.
  3456. @end table
  3457. @subsection Examples
  3458. @itemize
  3459. @item
  3460. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3461. @example
  3462. anullsrc=r=48000:cl=4
  3463. @end example
  3464. @item
  3465. Do the same operation with a more obvious syntax:
  3466. @example
  3467. anullsrc=r=48000:cl=mono
  3468. @end example
  3469. @end itemize
  3470. All the parameters need to be explicitly defined.
  3471. @section flite
  3472. Synthesize a voice utterance using the libflite library.
  3473. To enable compilation of this filter you need to configure FFmpeg with
  3474. @code{--enable-libflite}.
  3475. Note that the flite library is not thread-safe.
  3476. The filter accepts the following options:
  3477. @table @option
  3478. @item list_voices
  3479. If set to 1, list the names of the available voices and exit
  3480. immediately. Default value is 0.
  3481. @item nb_samples, n
  3482. Set the maximum number of samples per frame. Default value is 512.
  3483. @item textfile
  3484. Set the filename containing the text to speak.
  3485. @item text
  3486. Set the text to speak.
  3487. @item voice, v
  3488. Set the voice to use for the speech synthesis. Default value is
  3489. @code{kal}. See also the @var{list_voices} option.
  3490. @end table
  3491. @subsection Examples
  3492. @itemize
  3493. @item
  3494. Read from file @file{speech.txt}, and synthesize the text using the
  3495. standard flite voice:
  3496. @example
  3497. flite=textfile=speech.txt
  3498. @end example
  3499. @item
  3500. Read the specified text selecting the @code{slt} voice:
  3501. @example
  3502. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3503. @end example
  3504. @item
  3505. Input text to ffmpeg:
  3506. @example
  3507. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3508. @end example
  3509. @item
  3510. Make @file{ffplay} speak the specified text, using @code{flite} and
  3511. the @code{lavfi} device:
  3512. @example
  3513. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3514. @end example
  3515. @end itemize
  3516. For more information about libflite, check:
  3517. @url{http://www.speech.cs.cmu.edu/flite/}
  3518. @section anoisesrc
  3519. Generate a noise audio signal.
  3520. The filter accepts the following options:
  3521. @table @option
  3522. @item sample_rate, r
  3523. Specify the sample rate. Default value is 48000 Hz.
  3524. @item amplitude, a
  3525. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3526. is 1.0.
  3527. @item duration, d
  3528. Specify the duration of the generated audio stream. Not specifying this option
  3529. results in noise with an infinite length.
  3530. @item color, colour, c
  3531. Specify the color of noise. Available noise colors are white, pink, brown,
  3532. blue and violet. Default color is white.
  3533. @item seed, s
  3534. Specify a value used to seed the PRNG.
  3535. @item nb_samples, n
  3536. Set the number of samples per each output frame, default is 1024.
  3537. @end table
  3538. @subsection Examples
  3539. @itemize
  3540. @item
  3541. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3542. @example
  3543. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3544. @end example
  3545. @end itemize
  3546. @section sine
  3547. Generate an audio signal made of a sine wave with amplitude 1/8.
  3548. The audio signal is bit-exact.
  3549. The filter accepts the following options:
  3550. @table @option
  3551. @item frequency, f
  3552. Set the carrier frequency. Default is 440 Hz.
  3553. @item beep_factor, b
  3554. Enable a periodic beep every second with frequency @var{beep_factor} times
  3555. the carrier frequency. Default is 0, meaning the beep is disabled.
  3556. @item sample_rate, r
  3557. Specify the sample rate, default is 44100.
  3558. @item duration, d
  3559. Specify the duration of the generated audio stream.
  3560. @item samples_per_frame
  3561. Set the number of samples per output frame.
  3562. The expression can contain the following constants:
  3563. @table @option
  3564. @item n
  3565. The (sequential) number of the output audio frame, starting from 0.
  3566. @item pts
  3567. The PTS (Presentation TimeStamp) of the output audio frame,
  3568. expressed in @var{TB} units.
  3569. @item t
  3570. The PTS of the output audio frame, expressed in seconds.
  3571. @item TB
  3572. The timebase of the output audio frames.
  3573. @end table
  3574. Default is @code{1024}.
  3575. @end table
  3576. @subsection Examples
  3577. @itemize
  3578. @item
  3579. Generate a simple 440 Hz sine wave:
  3580. @example
  3581. sine
  3582. @end example
  3583. @item
  3584. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3585. @example
  3586. sine=220:4:d=5
  3587. sine=f=220:b=4:d=5
  3588. sine=frequency=220:beep_factor=4:duration=5
  3589. @end example
  3590. @item
  3591. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3592. pattern:
  3593. @example
  3594. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3595. @end example
  3596. @end itemize
  3597. @c man end AUDIO SOURCES
  3598. @chapter Audio Sinks
  3599. @c man begin AUDIO SINKS
  3600. Below is a description of the currently available audio sinks.
  3601. @section abuffersink
  3602. Buffer audio frames, and make them available to the end of filter chain.
  3603. This sink is mainly intended for programmatic use, in particular
  3604. through the interface defined in @file{libavfilter/buffersink.h}
  3605. or the options system.
  3606. It accepts a pointer to an AVABufferSinkContext structure, which
  3607. defines the incoming buffers' formats, to be passed as the opaque
  3608. parameter to @code{avfilter_init_filter} for initialization.
  3609. @section anullsink
  3610. Null audio sink; do absolutely nothing with the input audio. It is
  3611. mainly useful as a template and for use in analysis / debugging
  3612. tools.
  3613. @c man end AUDIO SINKS
  3614. @chapter Video Filters
  3615. @c man begin VIDEO FILTERS
  3616. When you configure your FFmpeg build, you can disable any of the
  3617. existing filters using @code{--disable-filters}.
  3618. The configure output will show the video filters included in your
  3619. build.
  3620. Below is a description of the currently available video filters.
  3621. @section alphaextract
  3622. Extract the alpha component from the input as a grayscale video. This
  3623. is especially useful with the @var{alphamerge} filter.
  3624. @section alphamerge
  3625. Add or replace the alpha component of the primary input with the
  3626. grayscale value of a second input. This is intended for use with
  3627. @var{alphaextract} to allow the transmission or storage of frame
  3628. sequences that have alpha in a format that doesn't support an alpha
  3629. channel.
  3630. For example, to reconstruct full frames from a normal YUV-encoded video
  3631. and a separate video created with @var{alphaextract}, you might use:
  3632. @example
  3633. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  3634. @end example
  3635. Since this filter is designed for reconstruction, it operates on frame
  3636. sequences without considering timestamps, and terminates when either
  3637. input reaches end of stream. This will cause problems if your encoding
  3638. pipeline drops frames. If you're trying to apply an image as an
  3639. overlay to a video stream, consider the @var{overlay} filter instead.
  3640. @section ass
  3641. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  3642. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  3643. Substation Alpha) subtitles files.
  3644. This filter accepts the following option in addition to the common options from
  3645. the @ref{subtitles} filter:
  3646. @table @option
  3647. @item shaping
  3648. Set the shaping engine
  3649. Available values are:
  3650. @table @samp
  3651. @item auto
  3652. The default libass shaping engine, which is the best available.
  3653. @item simple
  3654. Fast, font-agnostic shaper that can do only substitutions
  3655. @item complex
  3656. Slower shaper using OpenType for substitutions and positioning
  3657. @end table
  3658. The default is @code{auto}.
  3659. @end table
  3660. @section atadenoise
  3661. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  3662. The filter accepts the following options:
  3663. @table @option
  3664. @item 0a
  3665. Set threshold A for 1st plane. Default is 0.02.
  3666. Valid range is 0 to 0.3.
  3667. @item 0b
  3668. Set threshold B for 1st plane. Default is 0.04.
  3669. Valid range is 0 to 5.
  3670. @item 1a
  3671. Set threshold A for 2nd plane. Default is 0.02.
  3672. Valid range is 0 to 0.3.
  3673. @item 1b
  3674. Set threshold B for 2nd plane. Default is 0.04.
  3675. Valid range is 0 to 5.
  3676. @item 2a
  3677. Set threshold A for 3rd plane. Default is 0.02.
  3678. Valid range is 0 to 0.3.
  3679. @item 2b
  3680. Set threshold B for 3rd plane. Default is 0.04.
  3681. Valid range is 0 to 5.
  3682. Threshold A is designed to react on abrupt changes in the input signal and
  3683. threshold B is designed to react on continuous changes in the input signal.
  3684. @item s
  3685. Set number of frames filter will use for averaging. Default is 33. Must be odd
  3686. number in range [5, 129].
  3687. @item p
  3688. Set what planes of frame filter will use for averaging. Default is all.
  3689. @end table
  3690. @section avgblur
  3691. Apply average blur filter.
  3692. The filter accepts the following options:
  3693. @table @option
  3694. @item sizeX
  3695. Set horizontal kernel size.
  3696. @item planes
  3697. Set which planes to filter. By default all planes are filtered.
  3698. @item sizeY
  3699. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  3700. Default is @code{0}.
  3701. @end table
  3702. @section bbox
  3703. Compute the bounding box for the non-black pixels in the input frame
  3704. luminance plane.
  3705. This filter computes the bounding box containing all the pixels with a
  3706. luminance value greater than the minimum allowed value.
  3707. The parameters describing the bounding box are printed on the filter
  3708. log.
  3709. The filter accepts the following option:
  3710. @table @option
  3711. @item min_val
  3712. Set the minimal luminance value. Default is @code{16}.
  3713. @end table
  3714. @section bitplanenoise
  3715. Show and measure bit plane noise.
  3716. The filter accepts the following options:
  3717. @table @option
  3718. @item bitplane
  3719. Set which plane to analyze. Default is @code{1}.
  3720. @item filter
  3721. Filter out noisy pixels from @code{bitplane} set above.
  3722. Default is disabled.
  3723. @end table
  3724. @section blackdetect
  3725. Detect video intervals that are (almost) completely black. Can be
  3726. useful to detect chapter transitions, commercials, or invalid
  3727. recordings. Output lines contains the time for the start, end and
  3728. duration of the detected black interval expressed in seconds.
  3729. In order to display the output lines, you need to set the loglevel at
  3730. least to the AV_LOG_INFO value.
  3731. The filter accepts the following options:
  3732. @table @option
  3733. @item black_min_duration, d
  3734. Set the minimum detected black duration expressed in seconds. It must
  3735. be a non-negative floating point number.
  3736. Default value is 2.0.
  3737. @item picture_black_ratio_th, pic_th
  3738. Set the threshold for considering a picture "black".
  3739. Express the minimum value for the ratio:
  3740. @example
  3741. @var{nb_black_pixels} / @var{nb_pixels}
  3742. @end example
  3743. for which a picture is considered black.
  3744. Default value is 0.98.
  3745. @item pixel_black_th, pix_th
  3746. Set the threshold for considering a pixel "black".
  3747. The threshold expresses the maximum pixel luminance value for which a
  3748. pixel is considered "black". The provided value is scaled according to
  3749. the following equation:
  3750. @example
  3751. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  3752. @end example
  3753. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  3754. the input video format, the range is [0-255] for YUV full-range
  3755. formats and [16-235] for YUV non full-range formats.
  3756. Default value is 0.10.
  3757. @end table
  3758. The following example sets the maximum pixel threshold to the minimum
  3759. value, and detects only black intervals of 2 or more seconds:
  3760. @example
  3761. blackdetect=d=2:pix_th=0.00
  3762. @end example
  3763. @section blackframe
  3764. Detect frames that are (almost) completely black. Can be useful to
  3765. detect chapter transitions or commercials. Output lines consist of
  3766. the frame number of the detected frame, the percentage of blackness,
  3767. the position in the file if known or -1 and the timestamp in seconds.
  3768. In order to display the output lines, you need to set the loglevel at
  3769. least to the AV_LOG_INFO value.
  3770. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  3771. The value represents the percentage of pixels in the picture that
  3772. are below the threshold value.
  3773. It accepts the following parameters:
  3774. @table @option
  3775. @item amount
  3776. The percentage of the pixels that have to be below the threshold; it defaults to
  3777. @code{98}.
  3778. @item threshold, thresh
  3779. The threshold below which a pixel value is considered black; it defaults to
  3780. @code{32}.
  3781. @end table
  3782. @section blend, tblend
  3783. Blend two video frames into each other.
  3784. The @code{blend} filter takes two input streams and outputs one
  3785. stream, the first input is the "top" layer and second input is
  3786. "bottom" layer. By default, the output terminates when the longest input terminates.
  3787. The @code{tblend} (time blend) filter takes two consecutive frames
  3788. from one single stream, and outputs the result obtained by blending
  3789. the new frame on top of the old frame.
  3790. A description of the accepted options follows.
  3791. @table @option
  3792. @item c0_mode
  3793. @item c1_mode
  3794. @item c2_mode
  3795. @item c3_mode
  3796. @item all_mode
  3797. Set blend mode for specific pixel component or all pixel components in case
  3798. of @var{all_mode}. Default value is @code{normal}.
  3799. Available values for component modes are:
  3800. @table @samp
  3801. @item addition
  3802. @item grainmerge
  3803. @item and
  3804. @item average
  3805. @item burn
  3806. @item darken
  3807. @item difference
  3808. @item grainextract
  3809. @item divide
  3810. @item dodge
  3811. @item freeze
  3812. @item exclusion
  3813. @item extremity
  3814. @item glow
  3815. @item hardlight
  3816. @item hardmix
  3817. @item heat
  3818. @item lighten
  3819. @item linearlight
  3820. @item multiply
  3821. @item multiply128
  3822. @item negation
  3823. @item normal
  3824. @item or
  3825. @item overlay
  3826. @item phoenix
  3827. @item pinlight
  3828. @item reflect
  3829. @item screen
  3830. @item softlight
  3831. @item subtract
  3832. @item vividlight
  3833. @item xor
  3834. @end table
  3835. @item c0_opacity
  3836. @item c1_opacity
  3837. @item c2_opacity
  3838. @item c3_opacity
  3839. @item all_opacity
  3840. Set blend opacity for specific pixel component or all pixel components in case
  3841. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  3842. @item c0_expr
  3843. @item c1_expr
  3844. @item c2_expr
  3845. @item c3_expr
  3846. @item all_expr
  3847. Set blend expression for specific pixel component or all pixel components in case
  3848. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  3849. The expressions can use the following variables:
  3850. @table @option
  3851. @item N
  3852. The sequential number of the filtered frame, starting from @code{0}.
  3853. @item X
  3854. @item Y
  3855. the coordinates of the current sample
  3856. @item W
  3857. @item H
  3858. the width and height of currently filtered plane
  3859. @item SW
  3860. @item SH
  3861. Width and height scale depending on the currently filtered plane. It is the
  3862. ratio between the corresponding luma plane number of pixels and the current
  3863. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  3864. @code{0.5,0.5} for chroma planes.
  3865. @item T
  3866. Time of the current frame, expressed in seconds.
  3867. @item TOP, A
  3868. Value of pixel component at current location for first video frame (top layer).
  3869. @item BOTTOM, B
  3870. Value of pixel component at current location for second video frame (bottom layer).
  3871. @end table
  3872. @end table
  3873. The @code{blend} filter also supports the @ref{framesync} options.
  3874. @subsection Examples
  3875. @itemize
  3876. @item
  3877. Apply transition from bottom layer to top layer in first 10 seconds:
  3878. @example
  3879. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  3880. @end example
  3881. @item
  3882. Apply linear horizontal transition from top layer to bottom layer:
  3883. @example
  3884. blend=all_expr='A*(X/W)+B*(1-X/W)'
  3885. @end example
  3886. @item
  3887. Apply 1x1 checkerboard effect:
  3888. @example
  3889. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  3890. @end example
  3891. @item
  3892. Apply uncover left effect:
  3893. @example
  3894. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  3895. @end example
  3896. @item
  3897. Apply uncover down effect:
  3898. @example
  3899. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  3900. @end example
  3901. @item
  3902. Apply uncover up-left effect:
  3903. @example
  3904. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  3905. @end example
  3906. @item
  3907. Split diagonally video and shows top and bottom layer on each side:
  3908. @example
  3909. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  3910. @end example
  3911. @item
  3912. Display differences between the current and the previous frame:
  3913. @example
  3914. tblend=all_mode=grainextract
  3915. @end example
  3916. @end itemize
  3917. @section boxblur
  3918. Apply a boxblur algorithm to the input video.
  3919. It accepts the following parameters:
  3920. @table @option
  3921. @item luma_radius, lr
  3922. @item luma_power, lp
  3923. @item chroma_radius, cr
  3924. @item chroma_power, cp
  3925. @item alpha_radius, ar
  3926. @item alpha_power, ap
  3927. @end table
  3928. A description of the accepted options follows.
  3929. @table @option
  3930. @item luma_radius, lr
  3931. @item chroma_radius, cr
  3932. @item alpha_radius, ar
  3933. Set an expression for the box radius in pixels used for blurring the
  3934. corresponding input plane.
  3935. The radius value must be a non-negative number, and must not be
  3936. greater than the value of the expression @code{min(w,h)/2} for the
  3937. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  3938. planes.
  3939. Default value for @option{luma_radius} is "2". If not specified,
  3940. @option{chroma_radius} and @option{alpha_radius} default to the
  3941. corresponding value set for @option{luma_radius}.
  3942. The expressions can contain the following constants:
  3943. @table @option
  3944. @item w
  3945. @item h
  3946. The input width and height in pixels.
  3947. @item cw
  3948. @item ch
  3949. The input chroma image width and height in pixels.
  3950. @item hsub
  3951. @item vsub
  3952. The horizontal and vertical chroma subsample values. For example, for the
  3953. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  3954. @end table
  3955. @item luma_power, lp
  3956. @item chroma_power, cp
  3957. @item alpha_power, ap
  3958. Specify how many times the boxblur filter is applied to the
  3959. corresponding plane.
  3960. Default value for @option{luma_power} is 2. If not specified,
  3961. @option{chroma_power} and @option{alpha_power} default to the
  3962. corresponding value set for @option{luma_power}.
  3963. A value of 0 will disable the effect.
  3964. @end table
  3965. @subsection Examples
  3966. @itemize
  3967. @item
  3968. Apply a boxblur filter with the luma, chroma, and alpha radii
  3969. set to 2:
  3970. @example
  3971. boxblur=luma_radius=2:luma_power=1
  3972. boxblur=2:1
  3973. @end example
  3974. @item
  3975. Set the luma radius to 2, and alpha and chroma radius to 0:
  3976. @example
  3977. boxblur=2:1:cr=0:ar=0
  3978. @end example
  3979. @item
  3980. Set the luma and chroma radii to a fraction of the video dimension:
  3981. @example
  3982. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  3983. @end example
  3984. @end itemize
  3985. @section bwdif
  3986. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  3987. Deinterlacing Filter").
  3988. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  3989. interpolation algorithms.
  3990. It accepts the following parameters:
  3991. @table @option
  3992. @item mode
  3993. The interlacing mode to adopt. It accepts one of the following values:
  3994. @table @option
  3995. @item 0, send_frame
  3996. Output one frame for each frame.
  3997. @item 1, send_field
  3998. Output one frame for each field.
  3999. @end table
  4000. The default value is @code{send_field}.
  4001. @item parity
  4002. The picture field parity assumed for the input interlaced video. It accepts one
  4003. of the following values:
  4004. @table @option
  4005. @item 0, tff
  4006. Assume the top field is first.
  4007. @item 1, bff
  4008. Assume the bottom field is first.
  4009. @item -1, auto
  4010. Enable automatic detection of field parity.
  4011. @end table
  4012. The default value is @code{auto}.
  4013. If the interlacing is unknown or the decoder does not export this information,
  4014. top field first will be assumed.
  4015. @item deint
  4016. Specify which frames to deinterlace. Accept one of the following
  4017. values:
  4018. @table @option
  4019. @item 0, all
  4020. Deinterlace all frames.
  4021. @item 1, interlaced
  4022. Only deinterlace frames marked as interlaced.
  4023. @end table
  4024. The default value is @code{all}.
  4025. @end table
  4026. @section chromakey
  4027. YUV colorspace color/chroma keying.
  4028. The filter accepts the following options:
  4029. @table @option
  4030. @item color
  4031. The color which will be replaced with transparency.
  4032. @item similarity
  4033. Similarity percentage with the key color.
  4034. 0.01 matches only the exact key color, while 1.0 matches everything.
  4035. @item blend
  4036. Blend percentage.
  4037. 0.0 makes pixels either fully transparent, or not transparent at all.
  4038. Higher values result in semi-transparent pixels, with a higher transparency
  4039. the more similar the pixels color is to the key color.
  4040. @item yuv
  4041. Signals that the color passed is already in YUV instead of RGB.
  4042. Litteral colors like "green" or "red" don't make sense with this enabled anymore.
  4043. This can be used to pass exact YUV values as hexadecimal numbers.
  4044. @end table
  4045. @subsection Examples
  4046. @itemize
  4047. @item
  4048. Make every green pixel in the input image transparent:
  4049. @example
  4050. ffmpeg -i input.png -vf chromakey=green out.png
  4051. @end example
  4052. @item
  4053. Overlay a greenscreen-video on top of a static black background.
  4054. @example
  4055. 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
  4056. @end example
  4057. @end itemize
  4058. @section ciescope
  4059. Display CIE color diagram with pixels overlaid onto it.
  4060. The filter accepts the following options:
  4061. @table @option
  4062. @item system
  4063. Set color system.
  4064. @table @samp
  4065. @item ntsc, 470m
  4066. @item ebu, 470bg
  4067. @item smpte
  4068. @item 240m
  4069. @item apple
  4070. @item widergb
  4071. @item cie1931
  4072. @item rec709, hdtv
  4073. @item uhdtv, rec2020
  4074. @end table
  4075. @item cie
  4076. Set CIE system.
  4077. @table @samp
  4078. @item xyy
  4079. @item ucs
  4080. @item luv
  4081. @end table
  4082. @item gamuts
  4083. Set what gamuts to draw.
  4084. See @code{system} option for available values.
  4085. @item size, s
  4086. Set ciescope size, by default set to 512.
  4087. @item intensity, i
  4088. Set intensity used to map input pixel values to CIE diagram.
  4089. @item contrast
  4090. Set contrast used to draw tongue colors that are out of active color system gamut.
  4091. @item corrgamma
  4092. Correct gamma displayed on scope, by default enabled.
  4093. @item showwhite
  4094. Show white point on CIE diagram, by default disabled.
  4095. @item gamma
  4096. Set input gamma. Used only with XYZ input color space.
  4097. @end table
  4098. @section codecview
  4099. Visualize information exported by some codecs.
  4100. Some codecs can export information through frames using side-data or other
  4101. means. For example, some MPEG based codecs export motion vectors through the
  4102. @var{export_mvs} flag in the codec @option{flags2} option.
  4103. The filter accepts the following option:
  4104. @table @option
  4105. @item mv
  4106. Set motion vectors to visualize.
  4107. Available flags for @var{mv} are:
  4108. @table @samp
  4109. @item pf
  4110. forward predicted MVs of P-frames
  4111. @item bf
  4112. forward predicted MVs of B-frames
  4113. @item bb
  4114. backward predicted MVs of B-frames
  4115. @end table
  4116. @item qp
  4117. Display quantization parameters using the chroma planes.
  4118. @item mv_type, mvt
  4119. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4120. Available flags for @var{mv_type} are:
  4121. @table @samp
  4122. @item fp
  4123. forward predicted MVs
  4124. @item bp
  4125. backward predicted MVs
  4126. @end table
  4127. @item frame_type, ft
  4128. Set frame type to visualize motion vectors of.
  4129. Available flags for @var{frame_type} are:
  4130. @table @samp
  4131. @item if
  4132. intra-coded frames (I-frames)
  4133. @item pf
  4134. predicted frames (P-frames)
  4135. @item bf
  4136. bi-directionally predicted frames (B-frames)
  4137. @end table
  4138. @end table
  4139. @subsection Examples
  4140. @itemize
  4141. @item
  4142. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4143. @example
  4144. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4145. @end example
  4146. @item
  4147. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4148. @example
  4149. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4150. @end example
  4151. @end itemize
  4152. @section colorbalance
  4153. Modify intensity of primary colors (red, green and blue) of input frames.
  4154. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4155. regions for the red-cyan, green-magenta or blue-yellow balance.
  4156. A positive adjustment value shifts the balance towards the primary color, a negative
  4157. value towards the complementary color.
  4158. The filter accepts the following options:
  4159. @table @option
  4160. @item rs
  4161. @item gs
  4162. @item bs
  4163. Adjust red, green and blue shadows (darkest pixels).
  4164. @item rm
  4165. @item gm
  4166. @item bm
  4167. Adjust red, green and blue midtones (medium pixels).
  4168. @item rh
  4169. @item gh
  4170. @item bh
  4171. Adjust red, green and blue highlights (brightest pixels).
  4172. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4173. @end table
  4174. @subsection Examples
  4175. @itemize
  4176. @item
  4177. Add red color cast to shadows:
  4178. @example
  4179. colorbalance=rs=.3
  4180. @end example
  4181. @end itemize
  4182. @section colorkey
  4183. RGB colorspace color keying.
  4184. The filter accepts the following options:
  4185. @table @option
  4186. @item color
  4187. The color which will be replaced with transparency.
  4188. @item similarity
  4189. Similarity percentage with the key color.
  4190. 0.01 matches only the exact key color, while 1.0 matches everything.
  4191. @item blend
  4192. Blend percentage.
  4193. 0.0 makes pixels either fully transparent, or not transparent at all.
  4194. Higher values result in semi-transparent pixels, with a higher transparency
  4195. the more similar the pixels color is to the key color.
  4196. @end table
  4197. @subsection Examples
  4198. @itemize
  4199. @item
  4200. Make every green pixel in the input image transparent:
  4201. @example
  4202. ffmpeg -i input.png -vf colorkey=green out.png
  4203. @end example
  4204. @item
  4205. Overlay a greenscreen-video on top of a static background image.
  4206. @example
  4207. 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
  4208. @end example
  4209. @end itemize
  4210. @section colorlevels
  4211. Adjust video input frames using levels.
  4212. The filter accepts the following options:
  4213. @table @option
  4214. @item rimin
  4215. @item gimin
  4216. @item bimin
  4217. @item aimin
  4218. Adjust red, green, blue and alpha input black point.
  4219. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4220. @item rimax
  4221. @item gimax
  4222. @item bimax
  4223. @item aimax
  4224. Adjust red, green, blue and alpha input white point.
  4225. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  4226. Input levels are used to lighten highlights (bright tones), darken shadows
  4227. (dark tones), change the balance of bright and dark tones.
  4228. @item romin
  4229. @item gomin
  4230. @item bomin
  4231. @item aomin
  4232. Adjust red, green, blue and alpha output black point.
  4233. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  4234. @item romax
  4235. @item gomax
  4236. @item bomax
  4237. @item aomax
  4238. Adjust red, green, blue and alpha output white point.
  4239. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  4240. Output levels allows manual selection of a constrained output level range.
  4241. @end table
  4242. @subsection Examples
  4243. @itemize
  4244. @item
  4245. Make video output darker:
  4246. @example
  4247. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4248. @end example
  4249. @item
  4250. Increase contrast:
  4251. @example
  4252. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4253. @end example
  4254. @item
  4255. Make video output lighter:
  4256. @example
  4257. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4258. @end example
  4259. @item
  4260. Increase brightness:
  4261. @example
  4262. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4263. @end example
  4264. @end itemize
  4265. @section colorchannelmixer
  4266. Adjust video input frames by re-mixing color channels.
  4267. This filter modifies a color channel by adding the values associated to
  4268. the other channels of the same pixels. For example if the value to
  4269. modify is red, the output value will be:
  4270. @example
  4271. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4272. @end example
  4273. The filter accepts the following options:
  4274. @table @option
  4275. @item rr
  4276. @item rg
  4277. @item rb
  4278. @item ra
  4279. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4280. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4281. @item gr
  4282. @item gg
  4283. @item gb
  4284. @item ga
  4285. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4286. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4287. @item br
  4288. @item bg
  4289. @item bb
  4290. @item ba
  4291. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4292. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4293. @item ar
  4294. @item ag
  4295. @item ab
  4296. @item aa
  4297. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4298. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4299. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4300. @end table
  4301. @subsection Examples
  4302. @itemize
  4303. @item
  4304. Convert source to grayscale:
  4305. @example
  4306. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4307. @end example
  4308. @item
  4309. Simulate sepia tones:
  4310. @example
  4311. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4312. @end example
  4313. @end itemize
  4314. @section colormatrix
  4315. Convert color matrix.
  4316. The filter accepts the following options:
  4317. @table @option
  4318. @item src
  4319. @item dst
  4320. Specify the source and destination color matrix. Both values must be
  4321. specified.
  4322. The accepted values are:
  4323. @table @samp
  4324. @item bt709
  4325. BT.709
  4326. @item fcc
  4327. FCC
  4328. @item bt601
  4329. BT.601
  4330. @item bt470
  4331. BT.470
  4332. @item bt470bg
  4333. BT.470BG
  4334. @item smpte170m
  4335. SMPTE-170M
  4336. @item smpte240m
  4337. SMPTE-240M
  4338. @item bt2020
  4339. BT.2020
  4340. @end table
  4341. @end table
  4342. For example to convert from BT.601 to SMPTE-240M, use the command:
  4343. @example
  4344. colormatrix=bt601:smpte240m
  4345. @end example
  4346. @section colorspace
  4347. Convert colorspace, transfer characteristics or color primaries.
  4348. Input video needs to have an even size.
  4349. The filter accepts the following options:
  4350. @table @option
  4351. @anchor{all}
  4352. @item all
  4353. Specify all color properties at once.
  4354. The accepted values are:
  4355. @table @samp
  4356. @item bt470m
  4357. BT.470M
  4358. @item bt470bg
  4359. BT.470BG
  4360. @item bt601-6-525
  4361. BT.601-6 525
  4362. @item bt601-6-625
  4363. BT.601-6 625
  4364. @item bt709
  4365. BT.709
  4366. @item smpte170m
  4367. SMPTE-170M
  4368. @item smpte240m
  4369. SMPTE-240M
  4370. @item bt2020
  4371. BT.2020
  4372. @end table
  4373. @anchor{space}
  4374. @item space
  4375. Specify output colorspace.
  4376. The accepted values are:
  4377. @table @samp
  4378. @item bt709
  4379. BT.709
  4380. @item fcc
  4381. FCC
  4382. @item bt470bg
  4383. BT.470BG or BT.601-6 625
  4384. @item smpte170m
  4385. SMPTE-170M or BT.601-6 525
  4386. @item smpte240m
  4387. SMPTE-240M
  4388. @item ycgco
  4389. YCgCo
  4390. @item bt2020ncl
  4391. BT.2020 with non-constant luminance
  4392. @end table
  4393. @anchor{trc}
  4394. @item trc
  4395. Specify output transfer characteristics.
  4396. The accepted values are:
  4397. @table @samp
  4398. @item bt709
  4399. BT.709
  4400. @item bt470m
  4401. BT.470M
  4402. @item bt470bg
  4403. BT.470BG
  4404. @item gamma22
  4405. Constant gamma of 2.2
  4406. @item gamma28
  4407. Constant gamma of 2.8
  4408. @item smpte170m
  4409. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4410. @item smpte240m
  4411. SMPTE-240M
  4412. @item srgb
  4413. SRGB
  4414. @item iec61966-2-1
  4415. iec61966-2-1
  4416. @item iec61966-2-4
  4417. iec61966-2-4
  4418. @item xvycc
  4419. xvycc
  4420. @item bt2020-10
  4421. BT.2020 for 10-bits content
  4422. @item bt2020-12
  4423. BT.2020 for 12-bits content
  4424. @end table
  4425. @anchor{primaries}
  4426. @item primaries
  4427. Specify output color primaries.
  4428. The accepted values are:
  4429. @table @samp
  4430. @item bt709
  4431. BT.709
  4432. @item bt470m
  4433. BT.470M
  4434. @item bt470bg
  4435. BT.470BG or BT.601-6 625
  4436. @item smpte170m
  4437. SMPTE-170M or BT.601-6 525
  4438. @item smpte240m
  4439. SMPTE-240M
  4440. @item film
  4441. film
  4442. @item smpte431
  4443. SMPTE-431
  4444. @item smpte432
  4445. SMPTE-432
  4446. @item bt2020
  4447. BT.2020
  4448. @item jedec-p22
  4449. JEDEC P22 phosphors
  4450. @end table
  4451. @anchor{range}
  4452. @item range
  4453. Specify output color range.
  4454. The accepted values are:
  4455. @table @samp
  4456. @item tv
  4457. TV (restricted) range
  4458. @item mpeg
  4459. MPEG (restricted) range
  4460. @item pc
  4461. PC (full) range
  4462. @item jpeg
  4463. JPEG (full) range
  4464. @end table
  4465. @item format
  4466. Specify output color format.
  4467. The accepted values are:
  4468. @table @samp
  4469. @item yuv420p
  4470. YUV 4:2:0 planar 8-bits
  4471. @item yuv420p10
  4472. YUV 4:2:0 planar 10-bits
  4473. @item yuv420p12
  4474. YUV 4:2:0 planar 12-bits
  4475. @item yuv422p
  4476. YUV 4:2:2 planar 8-bits
  4477. @item yuv422p10
  4478. YUV 4:2:2 planar 10-bits
  4479. @item yuv422p12
  4480. YUV 4:2:2 planar 12-bits
  4481. @item yuv444p
  4482. YUV 4:4:4 planar 8-bits
  4483. @item yuv444p10
  4484. YUV 4:4:4 planar 10-bits
  4485. @item yuv444p12
  4486. YUV 4:4:4 planar 12-bits
  4487. @end table
  4488. @item fast
  4489. Do a fast conversion, which skips gamma/primary correction. This will take
  4490. significantly less CPU, but will be mathematically incorrect. To get output
  4491. compatible with that produced by the colormatrix filter, use fast=1.
  4492. @item dither
  4493. Specify dithering mode.
  4494. The accepted values are:
  4495. @table @samp
  4496. @item none
  4497. No dithering
  4498. @item fsb
  4499. Floyd-Steinberg dithering
  4500. @end table
  4501. @item wpadapt
  4502. Whitepoint adaptation mode.
  4503. The accepted values are:
  4504. @table @samp
  4505. @item bradford
  4506. Bradford whitepoint adaptation
  4507. @item vonkries
  4508. von Kries whitepoint adaptation
  4509. @item identity
  4510. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4511. @end table
  4512. @item iall
  4513. Override all input properties at once. Same accepted values as @ref{all}.
  4514. @item ispace
  4515. Override input colorspace. Same accepted values as @ref{space}.
  4516. @item iprimaries
  4517. Override input color primaries. Same accepted values as @ref{primaries}.
  4518. @item itrc
  4519. Override input transfer characteristics. Same accepted values as @ref{trc}.
  4520. @item irange
  4521. Override input color range. Same accepted values as @ref{range}.
  4522. @end table
  4523. The filter converts the transfer characteristics, color space and color
  4524. primaries to the specified user values. The output value, if not specified,
  4525. is set to a default value based on the "all" property. If that property is
  4526. also not specified, the filter will log an error. The output color range and
  4527. format default to the same value as the input color range and format. The
  4528. input transfer characteristics, color space, color primaries and color range
  4529. should be set on the input data. If any of these are missing, the filter will
  4530. log an error and no conversion will take place.
  4531. For example to convert the input to SMPTE-240M, use the command:
  4532. @example
  4533. colorspace=smpte240m
  4534. @end example
  4535. @section convolution
  4536. Apply convolution 3x3 or 5x5 filter.
  4537. The filter accepts the following options:
  4538. @table @option
  4539. @item 0m
  4540. @item 1m
  4541. @item 2m
  4542. @item 3m
  4543. Set matrix for each plane.
  4544. Matrix is sequence of 9 or 25 signed integers.
  4545. @item 0rdiv
  4546. @item 1rdiv
  4547. @item 2rdiv
  4548. @item 3rdiv
  4549. Set multiplier for calculated value for each plane.
  4550. @item 0bias
  4551. @item 1bias
  4552. @item 2bias
  4553. @item 3bias
  4554. Set bias for each plane. This value is added to the result of the multiplication.
  4555. Useful for making the overall image brighter or darker. Default is 0.0.
  4556. @end table
  4557. @subsection Examples
  4558. @itemize
  4559. @item
  4560. Apply sharpen:
  4561. @example
  4562. 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"
  4563. @end example
  4564. @item
  4565. Apply blur:
  4566. @example
  4567. 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"
  4568. @end example
  4569. @item
  4570. Apply edge enhance:
  4571. @example
  4572. 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"
  4573. @end example
  4574. @item
  4575. Apply edge detect:
  4576. @example
  4577. 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"
  4578. @end example
  4579. @item
  4580. Apply laplacian edge detector which includes diagonals:
  4581. @example
  4582. 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"
  4583. @end example
  4584. @item
  4585. Apply emboss:
  4586. @example
  4587. 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"
  4588. @end example
  4589. @end itemize
  4590. @section copy
  4591. Copy the input video source unchanged to the output. This is mainly useful for
  4592. testing purposes.
  4593. @anchor{coreimage}
  4594. @section coreimage
  4595. Video filtering on GPU using Apple's CoreImage API on OSX.
  4596. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  4597. processed by video hardware. However, software-based OpenGL implementations
  4598. exist which means there is no guarantee for hardware processing. It depends on
  4599. the respective OSX.
  4600. There are many filters and image generators provided by Apple that come with a
  4601. large variety of options. The filter has to be referenced by its name along
  4602. with its options.
  4603. The coreimage filter accepts the following options:
  4604. @table @option
  4605. @item list_filters
  4606. List all available filters and generators along with all their respective
  4607. options as well as possible minimum and maximum values along with the default
  4608. values.
  4609. @example
  4610. list_filters=true
  4611. @end example
  4612. @item filter
  4613. Specify all filters by their respective name and options.
  4614. Use @var{list_filters} to determine all valid filter names and options.
  4615. Numerical options are specified by a float value and are automatically clamped
  4616. to their respective value range. Vector and color options have to be specified
  4617. by a list of space separated float values. Character escaping has to be done.
  4618. A special option name @code{default} is available to use default options for a
  4619. filter.
  4620. It is required to specify either @code{default} or at least one of the filter options.
  4621. All omitted options are used with their default values.
  4622. The syntax of the filter string is as follows:
  4623. @example
  4624. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  4625. @end example
  4626. @item output_rect
  4627. Specify a rectangle where the output of the filter chain is copied into the
  4628. input image. It is given by a list of space separated float values:
  4629. @example
  4630. output_rect=x\ y\ width\ height
  4631. @end example
  4632. If not given, the output rectangle equals the dimensions of the input image.
  4633. The output rectangle is automatically cropped at the borders of the input
  4634. image. Negative values are valid for each component.
  4635. @example
  4636. output_rect=25\ 25\ 100\ 100
  4637. @end example
  4638. @end table
  4639. Several filters can be chained for successive processing without GPU-HOST
  4640. transfers allowing for fast processing of complex filter chains.
  4641. Currently, only filters with zero (generators) or exactly one (filters) input
  4642. image and one output image are supported. Also, transition filters are not yet
  4643. usable as intended.
  4644. Some filters generate output images with additional padding depending on the
  4645. respective filter kernel. The padding is automatically removed to ensure the
  4646. filter output has the same size as the input image.
  4647. For image generators, the size of the output image is determined by the
  4648. previous output image of the filter chain or the input image of the whole
  4649. filterchain, respectively. The generators do not use the pixel information of
  4650. this image to generate their output. However, the generated output is
  4651. blended onto this image, resulting in partial or complete coverage of the
  4652. output image.
  4653. The @ref{coreimagesrc} video source can be used for generating input images
  4654. which are directly fed into the filter chain. By using it, providing input
  4655. images by another video source or an input video is not required.
  4656. @subsection Examples
  4657. @itemize
  4658. @item
  4659. List all filters available:
  4660. @example
  4661. coreimage=list_filters=true
  4662. @end example
  4663. @item
  4664. Use the CIBoxBlur filter with default options to blur an image:
  4665. @example
  4666. coreimage=filter=CIBoxBlur@@default
  4667. @end example
  4668. @item
  4669. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  4670. its center at 100x100 and a radius of 50 pixels:
  4671. @example
  4672. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  4673. @end example
  4674. @item
  4675. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  4676. given as complete and escaped command-line for Apple's standard bash shell:
  4677. @example
  4678. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  4679. @end example
  4680. @end itemize
  4681. @section crop
  4682. Crop the input video to given dimensions.
  4683. It accepts the following parameters:
  4684. @table @option
  4685. @item w, out_w
  4686. The width of the output video. It defaults to @code{iw}.
  4687. This expression is evaluated only once during the filter
  4688. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  4689. @item h, out_h
  4690. The height of the output video. It defaults to @code{ih}.
  4691. This expression is evaluated only once during the filter
  4692. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  4693. @item x
  4694. The horizontal position, in the input video, of the left edge of the output
  4695. video. It defaults to @code{(in_w-out_w)/2}.
  4696. This expression is evaluated per-frame.
  4697. @item y
  4698. The vertical position, in the input video, of the top edge of the output video.
  4699. It defaults to @code{(in_h-out_h)/2}.
  4700. This expression is evaluated per-frame.
  4701. @item keep_aspect
  4702. If set to 1 will force the output display aspect ratio
  4703. to be the same of the input, by changing the output sample aspect
  4704. ratio. It defaults to 0.
  4705. @item exact
  4706. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  4707. width/height/x/y as specified and will not be rounded to nearest smaller value.
  4708. It defaults to 0.
  4709. @end table
  4710. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  4711. expressions containing the following constants:
  4712. @table @option
  4713. @item x
  4714. @item y
  4715. The computed values for @var{x} and @var{y}. They are evaluated for
  4716. each new frame.
  4717. @item in_w
  4718. @item in_h
  4719. The input width and height.
  4720. @item iw
  4721. @item ih
  4722. These are the same as @var{in_w} and @var{in_h}.
  4723. @item out_w
  4724. @item out_h
  4725. The output (cropped) width and height.
  4726. @item ow
  4727. @item oh
  4728. These are the same as @var{out_w} and @var{out_h}.
  4729. @item a
  4730. same as @var{iw} / @var{ih}
  4731. @item sar
  4732. input sample aspect ratio
  4733. @item dar
  4734. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  4735. @item hsub
  4736. @item vsub
  4737. horizontal and vertical chroma subsample values. For example for the
  4738. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  4739. @item n
  4740. The number of the input frame, starting from 0.
  4741. @item pos
  4742. the position in the file of the input frame, NAN if unknown
  4743. @item t
  4744. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  4745. @end table
  4746. The expression for @var{out_w} may depend on the value of @var{out_h},
  4747. and the expression for @var{out_h} may depend on @var{out_w}, but they
  4748. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  4749. evaluated after @var{out_w} and @var{out_h}.
  4750. The @var{x} and @var{y} parameters specify the expressions for the
  4751. position of the top-left corner of the output (non-cropped) area. They
  4752. are evaluated for each frame. If the evaluated value is not valid, it
  4753. is approximated to the nearest valid value.
  4754. The expression for @var{x} may depend on @var{y}, and the expression
  4755. for @var{y} may depend on @var{x}.
  4756. @subsection Examples
  4757. @itemize
  4758. @item
  4759. Crop area with size 100x100 at position (12,34).
  4760. @example
  4761. crop=100:100:12:34
  4762. @end example
  4763. Using named options, the example above becomes:
  4764. @example
  4765. crop=w=100:h=100:x=12:y=34
  4766. @end example
  4767. @item
  4768. Crop the central input area with size 100x100:
  4769. @example
  4770. crop=100:100
  4771. @end example
  4772. @item
  4773. Crop the central input area with size 2/3 of the input video:
  4774. @example
  4775. crop=2/3*in_w:2/3*in_h
  4776. @end example
  4777. @item
  4778. Crop the input video central square:
  4779. @example
  4780. crop=out_w=in_h
  4781. crop=in_h
  4782. @end example
  4783. @item
  4784. Delimit the rectangle with the top-left corner placed at position
  4785. 100:100 and the right-bottom corner corresponding to the right-bottom
  4786. corner of the input image.
  4787. @example
  4788. crop=in_w-100:in_h-100:100:100
  4789. @end example
  4790. @item
  4791. Crop 10 pixels from the left and right borders, and 20 pixels from
  4792. the top and bottom borders
  4793. @example
  4794. crop=in_w-2*10:in_h-2*20
  4795. @end example
  4796. @item
  4797. Keep only the bottom right quarter of the input image:
  4798. @example
  4799. crop=in_w/2:in_h/2:in_w/2:in_h/2
  4800. @end example
  4801. @item
  4802. Crop height for getting Greek harmony:
  4803. @example
  4804. crop=in_w:1/PHI*in_w
  4805. @end example
  4806. @item
  4807. Apply trembling effect:
  4808. @example
  4809. 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)
  4810. @end example
  4811. @item
  4812. Apply erratic camera effect depending on timestamp:
  4813. @example
  4814. 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)"
  4815. @end example
  4816. @item
  4817. Set x depending on the value of y:
  4818. @example
  4819. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  4820. @end example
  4821. @end itemize
  4822. @subsection Commands
  4823. This filter supports the following commands:
  4824. @table @option
  4825. @item w, out_w
  4826. @item h, out_h
  4827. @item x
  4828. @item y
  4829. Set width/height of the output video and the horizontal/vertical position
  4830. in the input video.
  4831. The command accepts the same syntax of the corresponding option.
  4832. If the specified expression is not valid, it is kept at its current
  4833. value.
  4834. @end table
  4835. @section cropdetect
  4836. Auto-detect the crop size.
  4837. It calculates the necessary cropping parameters and prints the
  4838. recommended parameters via the logging system. The detected dimensions
  4839. correspond to the non-black area of the input video.
  4840. It accepts the following parameters:
  4841. @table @option
  4842. @item limit
  4843. Set higher black value threshold, which can be optionally specified
  4844. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  4845. value greater to the set value is considered non-black. It defaults to 24.
  4846. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  4847. on the bitdepth of the pixel format.
  4848. @item round
  4849. The value which the width/height should be divisible by. It defaults to
  4850. 16. The offset is automatically adjusted to center the video. Use 2 to
  4851. get only even dimensions (needed for 4:2:2 video). 16 is best when
  4852. encoding to most video codecs.
  4853. @item reset_count, reset
  4854. Set the counter that determines after how many frames cropdetect will
  4855. reset the previously detected largest video area and start over to
  4856. detect the current optimal crop area. Default value is 0.
  4857. This can be useful when channel logos distort the video area. 0
  4858. indicates 'never reset', and returns the largest area encountered during
  4859. playback.
  4860. @end table
  4861. @anchor{curves}
  4862. @section curves
  4863. Apply color adjustments using curves.
  4864. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  4865. component (red, green and blue) has its values defined by @var{N} key points
  4866. tied from each other using a smooth curve. The x-axis represents the pixel
  4867. values from the input frame, and the y-axis the new pixel values to be set for
  4868. the output frame.
  4869. By default, a component curve is defined by the two points @var{(0;0)} and
  4870. @var{(1;1)}. This creates a straight line where each original pixel value is
  4871. "adjusted" to its own value, which means no change to the image.
  4872. The filter allows you to redefine these two points and add some more. A new
  4873. curve (using a natural cubic spline interpolation) will be define to pass
  4874. smoothly through all these new coordinates. The new defined points needs to be
  4875. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  4876. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  4877. the vector spaces, the values will be clipped accordingly.
  4878. The filter accepts the following options:
  4879. @table @option
  4880. @item preset
  4881. Select one of the available color presets. This option can be used in addition
  4882. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  4883. options takes priority on the preset values.
  4884. Available presets are:
  4885. @table @samp
  4886. @item none
  4887. @item color_negative
  4888. @item cross_process
  4889. @item darker
  4890. @item increase_contrast
  4891. @item lighter
  4892. @item linear_contrast
  4893. @item medium_contrast
  4894. @item negative
  4895. @item strong_contrast
  4896. @item vintage
  4897. @end table
  4898. Default is @code{none}.
  4899. @item master, m
  4900. Set the master key points. These points will define a second pass mapping. It
  4901. is sometimes called a "luminance" or "value" mapping. It can be used with
  4902. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  4903. post-processing LUT.
  4904. @item red, r
  4905. Set the key points for the red component.
  4906. @item green, g
  4907. Set the key points for the green component.
  4908. @item blue, b
  4909. Set the key points for the blue component.
  4910. @item all
  4911. Set the key points for all components (not including master).
  4912. Can be used in addition to the other key points component
  4913. options. In this case, the unset component(s) will fallback on this
  4914. @option{all} setting.
  4915. @item psfile
  4916. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  4917. @item plot
  4918. Save Gnuplot script of the curves in specified file.
  4919. @end table
  4920. To avoid some filtergraph syntax conflicts, each key points list need to be
  4921. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  4922. @subsection Examples
  4923. @itemize
  4924. @item
  4925. Increase slightly the middle level of blue:
  4926. @example
  4927. curves=blue='0/0 0.5/0.58 1/1'
  4928. @end example
  4929. @item
  4930. Vintage effect:
  4931. @example
  4932. 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'
  4933. @end example
  4934. Here we obtain the following coordinates for each components:
  4935. @table @var
  4936. @item red
  4937. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  4938. @item green
  4939. @code{(0;0) (0.50;0.48) (1;1)}
  4940. @item blue
  4941. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  4942. @end table
  4943. @item
  4944. The previous example can also be achieved with the associated built-in preset:
  4945. @example
  4946. curves=preset=vintage
  4947. @end example
  4948. @item
  4949. Or simply:
  4950. @example
  4951. curves=vintage
  4952. @end example
  4953. @item
  4954. Use a Photoshop preset and redefine the points of the green component:
  4955. @example
  4956. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  4957. @end example
  4958. @item
  4959. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  4960. and @command{gnuplot}:
  4961. @example
  4962. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  4963. gnuplot -p /tmp/curves.plt
  4964. @end example
  4965. @end itemize
  4966. @section datascope
  4967. Video data analysis filter.
  4968. This filter shows hexadecimal pixel values of part of video.
  4969. The filter accepts the following options:
  4970. @table @option
  4971. @item size, s
  4972. Set output video size.
  4973. @item x
  4974. Set x offset from where to pick pixels.
  4975. @item y
  4976. Set y offset from where to pick pixels.
  4977. @item mode
  4978. Set scope mode, can be one of the following:
  4979. @table @samp
  4980. @item mono
  4981. Draw hexadecimal pixel values with white color on black background.
  4982. @item color
  4983. Draw hexadecimal pixel values with input video pixel color on black
  4984. background.
  4985. @item color2
  4986. Draw hexadecimal pixel values on color background picked from input video,
  4987. the text color is picked in such way so its always visible.
  4988. @end table
  4989. @item axis
  4990. Draw rows and columns numbers on left and top of video.
  4991. @item opacity
  4992. Set background opacity.
  4993. @end table
  4994. @section dctdnoiz
  4995. Denoise frames using 2D DCT (frequency domain filtering).
  4996. This filter is not designed for real time.
  4997. The filter accepts the following options:
  4998. @table @option
  4999. @item sigma, s
  5000. Set the noise sigma constant.
  5001. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  5002. coefficient (absolute value) below this threshold with be dropped.
  5003. If you need a more advanced filtering, see @option{expr}.
  5004. Default is @code{0}.
  5005. @item overlap
  5006. Set number overlapping pixels for each block. Since the filter can be slow, you
  5007. may want to reduce this value, at the cost of a less effective filter and the
  5008. risk of various artefacts.
  5009. If the overlapping value doesn't permit processing the whole input width or
  5010. height, a warning will be displayed and according borders won't be denoised.
  5011. Default value is @var{blocksize}-1, which is the best possible setting.
  5012. @item expr, e
  5013. Set the coefficient factor expression.
  5014. For each coefficient of a DCT block, this expression will be evaluated as a
  5015. multiplier value for the coefficient.
  5016. If this is option is set, the @option{sigma} option will be ignored.
  5017. The absolute value of the coefficient can be accessed through the @var{c}
  5018. variable.
  5019. @item n
  5020. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  5021. @var{blocksize}, which is the width and height of the processed blocks.
  5022. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  5023. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5024. on the speed processing. Also, a larger block size does not necessarily means a
  5025. better de-noising.
  5026. @end table
  5027. @subsection Examples
  5028. Apply a denoise with a @option{sigma} of @code{4.5}:
  5029. @example
  5030. dctdnoiz=4.5
  5031. @end example
  5032. The same operation can be achieved using the expression system:
  5033. @example
  5034. dctdnoiz=e='gte(c, 4.5*3)'
  5035. @end example
  5036. Violent denoise using a block size of @code{16x16}:
  5037. @example
  5038. dctdnoiz=15:n=4
  5039. @end example
  5040. @section deband
  5041. Remove banding artifacts from input video.
  5042. It works by replacing banded pixels with average value of referenced pixels.
  5043. The filter accepts the following options:
  5044. @table @option
  5045. @item 1thr
  5046. @item 2thr
  5047. @item 3thr
  5048. @item 4thr
  5049. Set banding detection threshold for each plane. Default is 0.02.
  5050. Valid range is 0.00003 to 0.5.
  5051. If difference between current pixel and reference pixel is less than threshold,
  5052. it will be considered as banded.
  5053. @item range, r
  5054. Banding detection range in pixels. Default is 16. If positive, random number
  5055. in range 0 to set value will be used. If negative, exact absolute value
  5056. will be used.
  5057. The range defines square of four pixels around current pixel.
  5058. @item direction, d
  5059. Set direction in radians from which four pixel will be compared. If positive,
  5060. random direction from 0 to set direction will be picked. If negative, exact of
  5061. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5062. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5063. column.
  5064. @item blur, b
  5065. If enabled, current pixel is compared with average value of all four
  5066. surrounding pixels. The default is enabled. If disabled current pixel is
  5067. compared with all four surrounding pixels. The pixel is considered banded
  5068. if only all four differences with surrounding pixels are less than threshold.
  5069. @item coupling, c
  5070. If enabled, current pixel is changed if and only if all pixel components are banded,
  5071. e.g. banding detection threshold is triggered for all color components.
  5072. The default is disabled.
  5073. @end table
  5074. @anchor{decimate}
  5075. @section decimate
  5076. Drop duplicated frames at regular intervals.
  5077. The filter accepts the following options:
  5078. @table @option
  5079. @item cycle
  5080. Set the number of frames from which one will be dropped. Setting this to
  5081. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  5082. Default is @code{5}.
  5083. @item dupthresh
  5084. Set the threshold for duplicate detection. If the difference metric for a frame
  5085. is less than or equal to this value, then it is declared as duplicate. Default
  5086. is @code{1.1}
  5087. @item scthresh
  5088. Set scene change threshold. Default is @code{15}.
  5089. @item blockx
  5090. @item blocky
  5091. Set the size of the x and y-axis blocks used during metric calculations.
  5092. Larger blocks give better noise suppression, but also give worse detection of
  5093. small movements. Must be a power of two. Default is @code{32}.
  5094. @item ppsrc
  5095. Mark main input as a pre-processed input and activate clean source input
  5096. stream. This allows the input to be pre-processed with various filters to help
  5097. the metrics calculation while keeping the frame selection lossless. When set to
  5098. @code{1}, the first stream is for the pre-processed input, and the second
  5099. stream is the clean source from where the kept frames are chosen. Default is
  5100. @code{0}.
  5101. @item chroma
  5102. Set whether or not chroma is considered in the metric calculations. Default is
  5103. @code{1}.
  5104. @end table
  5105. @section deflate
  5106. Apply deflate effect to the video.
  5107. This filter replaces the pixel by the local(3x3) average by taking into account
  5108. only values lower than the pixel.
  5109. It accepts the following options:
  5110. @table @option
  5111. @item threshold0
  5112. @item threshold1
  5113. @item threshold2
  5114. @item threshold3
  5115. Limit the maximum change for each plane, default is 65535.
  5116. If 0, plane will remain unchanged.
  5117. @end table
  5118. @section deflicker
  5119. Remove temporal frame luminance variations.
  5120. It accepts the following options:
  5121. @table @option
  5122. @item size, s
  5123. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  5124. @item mode, m
  5125. Set averaging mode to smooth temporal luminance variations.
  5126. Available values are:
  5127. @table @samp
  5128. @item am
  5129. Arithmetic mean
  5130. @item gm
  5131. Geometric mean
  5132. @item hm
  5133. Harmonic mean
  5134. @item qm
  5135. Quadratic mean
  5136. @item cm
  5137. Cubic mean
  5138. @item pm
  5139. Power mean
  5140. @item median
  5141. Median
  5142. @end table
  5143. @item bypass
  5144. Do not actually modify frame. Useful when one only wants metadata.
  5145. @end table
  5146. @section dejudder
  5147. Remove judder produced by partially interlaced telecined content.
  5148. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  5149. source was partially telecined content then the output of @code{pullup,dejudder}
  5150. will have a variable frame rate. May change the recorded frame rate of the
  5151. container. Aside from that change, this filter will not affect constant frame
  5152. rate video.
  5153. The option available in this filter is:
  5154. @table @option
  5155. @item cycle
  5156. Specify the length of the window over which the judder repeats.
  5157. Accepts any integer greater than 1. Useful values are:
  5158. @table @samp
  5159. @item 4
  5160. If the original was telecined from 24 to 30 fps (Film to NTSC).
  5161. @item 5
  5162. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  5163. @item 20
  5164. If a mixture of the two.
  5165. @end table
  5166. The default is @samp{4}.
  5167. @end table
  5168. @section delogo
  5169. Suppress a TV station logo by a simple interpolation of the surrounding
  5170. pixels. Just set a rectangle covering the logo and watch it disappear
  5171. (and sometimes something even uglier appear - your mileage may vary).
  5172. It accepts the following parameters:
  5173. @table @option
  5174. @item x
  5175. @item y
  5176. Specify the top left corner coordinates of the logo. They must be
  5177. specified.
  5178. @item w
  5179. @item h
  5180. Specify the width and height of the logo to clear. They must be
  5181. specified.
  5182. @item band, t
  5183. Specify the thickness of the fuzzy edge of the rectangle (added to
  5184. @var{w} and @var{h}). The default value is 1. This option is
  5185. deprecated, setting higher values should no longer be necessary and
  5186. is not recommended.
  5187. @item show
  5188. When set to 1, a green rectangle is drawn on the screen to simplify
  5189. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  5190. The default value is 0.
  5191. The rectangle is drawn on the outermost pixels which will be (partly)
  5192. replaced with interpolated values. The values of the next pixels
  5193. immediately outside this rectangle in each direction will be used to
  5194. compute the interpolated pixel values inside the rectangle.
  5195. @end table
  5196. @subsection Examples
  5197. @itemize
  5198. @item
  5199. Set a rectangle covering the area with top left corner coordinates 0,0
  5200. and size 100x77, and a band of size 10:
  5201. @example
  5202. delogo=x=0:y=0:w=100:h=77:band=10
  5203. @end example
  5204. @end itemize
  5205. @section deshake
  5206. Attempt to fix small changes in horizontal and/or vertical shift. This
  5207. filter helps remove camera shake from hand-holding a camera, bumping a
  5208. tripod, moving on a vehicle, etc.
  5209. The filter accepts the following options:
  5210. @table @option
  5211. @item x
  5212. @item y
  5213. @item w
  5214. @item h
  5215. Specify a rectangular area where to limit the search for motion
  5216. vectors.
  5217. If desired the search for motion vectors can be limited to a
  5218. rectangular area of the frame defined by its top left corner, width
  5219. and height. These parameters have the same meaning as the drawbox
  5220. filter which can be used to visualise the position of the bounding
  5221. box.
  5222. This is useful when simultaneous movement of subjects within the frame
  5223. might be confused for camera motion by the motion vector search.
  5224. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  5225. then the full frame is used. This allows later options to be set
  5226. without specifying the bounding box for the motion vector search.
  5227. Default - search the whole frame.
  5228. @item rx
  5229. @item ry
  5230. Specify the maximum extent of movement in x and y directions in the
  5231. range 0-64 pixels. Default 16.
  5232. @item edge
  5233. Specify how to generate pixels to fill blanks at the edge of the
  5234. frame. Available values are:
  5235. @table @samp
  5236. @item blank, 0
  5237. Fill zeroes at blank locations
  5238. @item original, 1
  5239. Original image at blank locations
  5240. @item clamp, 2
  5241. Extruded edge value at blank locations
  5242. @item mirror, 3
  5243. Mirrored edge at blank locations
  5244. @end table
  5245. Default value is @samp{mirror}.
  5246. @item blocksize
  5247. Specify the blocksize to use for motion search. Range 4-128 pixels,
  5248. default 8.
  5249. @item contrast
  5250. Specify the contrast threshold for blocks. Only blocks with more than
  5251. the specified contrast (difference between darkest and lightest
  5252. pixels) will be considered. Range 1-255, default 125.
  5253. @item search
  5254. Specify the search strategy. Available values are:
  5255. @table @samp
  5256. @item exhaustive, 0
  5257. Set exhaustive search
  5258. @item less, 1
  5259. Set less exhaustive search.
  5260. @end table
  5261. Default value is @samp{exhaustive}.
  5262. @item filename
  5263. If set then a detailed log of the motion search is written to the
  5264. specified file.
  5265. @item opencl
  5266. If set to 1, specify using OpenCL capabilities, only available if
  5267. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  5268. @end table
  5269. @section despill
  5270. Remove unwanted contamination of foreground colors, caused by reflected color of
  5271. greenscreen or bluescreen.
  5272. This filter accepts the following options:
  5273. @table @option
  5274. @item type
  5275. Set what type of despill to use.
  5276. @item mix
  5277. Set how spillmap will be generated.
  5278. @item expand
  5279. Set how much to get rid of still remaining spill.
  5280. @item red
  5281. Controls ammount of red in spill area.
  5282. @item green
  5283. Controls ammount of green in spill area.
  5284. Should be -1 for greenscreen.
  5285. @item blue
  5286. Controls ammount of blue in spill area.
  5287. Should be -1 for bluescreen.
  5288. @item brightness
  5289. Controls brightness of spill area, preserving colors.
  5290. @item alpha
  5291. Modify alpha from generated spillmap.
  5292. @end table
  5293. @section detelecine
  5294. Apply an exact inverse of the telecine operation. It requires a predefined
  5295. pattern specified using the pattern option which must be the same as that passed
  5296. to the telecine filter.
  5297. This filter accepts the following options:
  5298. @table @option
  5299. @item first_field
  5300. @table @samp
  5301. @item top, t
  5302. top field first
  5303. @item bottom, b
  5304. bottom field first
  5305. The default value is @code{top}.
  5306. @end table
  5307. @item pattern
  5308. A string of numbers representing the pulldown pattern you wish to apply.
  5309. The default value is @code{23}.
  5310. @item start_frame
  5311. A number representing position of the first frame with respect to the telecine
  5312. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  5313. @end table
  5314. @section dilation
  5315. Apply dilation effect to the video.
  5316. This filter replaces the pixel by the local(3x3) maximum.
  5317. It accepts the following options:
  5318. @table @option
  5319. @item threshold0
  5320. @item threshold1
  5321. @item threshold2
  5322. @item threshold3
  5323. Limit the maximum change for each plane, default is 65535.
  5324. If 0, plane will remain unchanged.
  5325. @item coordinates
  5326. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5327. pixels are used.
  5328. Flags to local 3x3 coordinates maps like this:
  5329. 1 2 3
  5330. 4 5
  5331. 6 7 8
  5332. @end table
  5333. @section displace
  5334. Displace pixels as indicated by second and third input stream.
  5335. It takes three input streams and outputs one stream, the first input is the
  5336. source, and second and third input are displacement maps.
  5337. The second input specifies how much to displace pixels along the
  5338. x-axis, while the third input specifies how much to displace pixels
  5339. along the y-axis.
  5340. If one of displacement map streams terminates, last frame from that
  5341. displacement map will be used.
  5342. Note that once generated, displacements maps can be reused over and over again.
  5343. A description of the accepted options follows.
  5344. @table @option
  5345. @item edge
  5346. Set displace behavior for pixels that are out of range.
  5347. Available values are:
  5348. @table @samp
  5349. @item blank
  5350. Missing pixels are replaced by black pixels.
  5351. @item smear
  5352. Adjacent pixels will spread out to replace missing pixels.
  5353. @item wrap
  5354. Out of range pixels are wrapped so they point to pixels of other side.
  5355. @item mirror
  5356. Out of range pixels will be replaced with mirrored pixels.
  5357. @end table
  5358. Default is @samp{smear}.
  5359. @end table
  5360. @subsection Examples
  5361. @itemize
  5362. @item
  5363. Add ripple effect to rgb input of video size hd720:
  5364. @example
  5365. 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
  5366. @end example
  5367. @item
  5368. Add wave effect to rgb input of video size hd720:
  5369. @example
  5370. 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
  5371. @end example
  5372. @end itemize
  5373. @section drawbox
  5374. Draw a colored box on the input image.
  5375. It accepts the following parameters:
  5376. @table @option
  5377. @item x
  5378. @item y
  5379. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5380. @item width, w
  5381. @item height, h
  5382. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5383. the input width and height. It defaults to 0.
  5384. @item color, c
  5385. Specify the color of the box to write. For the general syntax of this option,
  5386. check the "Color" section in the ffmpeg-utils manual. If the special
  5387. value @code{invert} is used, the box edge color is the same as the
  5388. video with inverted luma.
  5389. @item thickness, t
  5390. The expression which sets the thickness of the box edge. Default value is @code{3}.
  5391. See below for the list of accepted constants.
  5392. @end table
  5393. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5394. following constants:
  5395. @table @option
  5396. @item dar
  5397. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5398. @item hsub
  5399. @item vsub
  5400. horizontal and vertical chroma subsample values. For example for the
  5401. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5402. @item in_h, ih
  5403. @item in_w, iw
  5404. The input width and height.
  5405. @item sar
  5406. The input sample aspect ratio.
  5407. @item x
  5408. @item y
  5409. The x and y offset coordinates where the box is drawn.
  5410. @item w
  5411. @item h
  5412. The width and height of the drawn box.
  5413. @item t
  5414. The thickness of the drawn box.
  5415. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5416. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5417. @end table
  5418. @subsection Examples
  5419. @itemize
  5420. @item
  5421. Draw a black box around the edge of the input image:
  5422. @example
  5423. drawbox
  5424. @end example
  5425. @item
  5426. Draw a box with color red and an opacity of 50%:
  5427. @example
  5428. drawbox=10:20:200:60:red@@0.5
  5429. @end example
  5430. The previous example can be specified as:
  5431. @example
  5432. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5433. @end example
  5434. @item
  5435. Fill the box with pink color:
  5436. @example
  5437. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
  5438. @end example
  5439. @item
  5440. Draw a 2-pixel red 2.40:1 mask:
  5441. @example
  5442. 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
  5443. @end example
  5444. @end itemize
  5445. @section drawgrid
  5446. Draw a grid on the input image.
  5447. It accepts the following parameters:
  5448. @table @option
  5449. @item x
  5450. @item y
  5451. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5452. @item width, w
  5453. @item height, h
  5454. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5455. input width and height, respectively, minus @code{thickness}, so image gets
  5456. framed. Default to 0.
  5457. @item color, c
  5458. Specify the color of the grid. For the general syntax of this option,
  5459. check the "Color" section in the ffmpeg-utils manual. If the special
  5460. value @code{invert} is used, the grid color is the same as the
  5461. video with inverted luma.
  5462. @item thickness, t
  5463. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5464. See below for the list of accepted constants.
  5465. @end table
  5466. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5467. following constants:
  5468. @table @option
  5469. @item dar
  5470. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5471. @item hsub
  5472. @item vsub
  5473. horizontal and vertical chroma subsample values. For example for the
  5474. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5475. @item in_h, ih
  5476. @item in_w, iw
  5477. The input grid cell width and height.
  5478. @item sar
  5479. The input sample aspect ratio.
  5480. @item x
  5481. @item y
  5482. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5483. @item w
  5484. @item h
  5485. The width and height of the drawn cell.
  5486. @item t
  5487. The thickness of the drawn cell.
  5488. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5489. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5490. @end table
  5491. @subsection Examples
  5492. @itemize
  5493. @item
  5494. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5495. @example
  5496. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5497. @end example
  5498. @item
  5499. Draw a white 3x3 grid with an opacity of 50%:
  5500. @example
  5501. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5502. @end example
  5503. @end itemize
  5504. @anchor{drawtext}
  5505. @section drawtext
  5506. Draw a text string or text from a specified file on top of a video, using the
  5507. libfreetype library.
  5508. To enable compilation of this filter, you need to configure FFmpeg with
  5509. @code{--enable-libfreetype}.
  5510. To enable default font fallback and the @var{font} option you need to
  5511. configure FFmpeg with @code{--enable-libfontconfig}.
  5512. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5513. @code{--enable-libfribidi}.
  5514. @subsection Syntax
  5515. It accepts the following parameters:
  5516. @table @option
  5517. @item box
  5518. Used to draw a box around text using the background color.
  5519. The value must be either 1 (enable) or 0 (disable).
  5520. The default value of @var{box} is 0.
  5521. @item boxborderw
  5522. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5523. The default value of @var{boxborderw} is 0.
  5524. @item boxcolor
  5525. The color to be used for drawing box around text. For the syntax of this
  5526. option, check the "Color" section in the ffmpeg-utils manual.
  5527. The default value of @var{boxcolor} is "white".
  5528. @item line_spacing
  5529. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  5530. The default value of @var{line_spacing} is 0.
  5531. @item borderw
  5532. Set the width of the border to be drawn around the text using @var{bordercolor}.
  5533. The default value of @var{borderw} is 0.
  5534. @item bordercolor
  5535. Set the color to be used for drawing border around text. For the syntax of this
  5536. option, check the "Color" section in the ffmpeg-utils manual.
  5537. The default value of @var{bordercolor} is "black".
  5538. @item expansion
  5539. Select how the @var{text} is expanded. Can be either @code{none},
  5540. @code{strftime} (deprecated) or
  5541. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  5542. below for details.
  5543. @item basetime
  5544. Set a start time for the count. Value is in microseconds. Only applied
  5545. in the deprecated strftime expansion mode. To emulate in normal expansion
  5546. mode use the @code{pts} function, supplying the start time (in seconds)
  5547. as the second argument.
  5548. @item fix_bounds
  5549. If true, check and fix text coords to avoid clipping.
  5550. @item fontcolor
  5551. The color to be used for drawing fonts. For the syntax of this option, check
  5552. the "Color" section in the ffmpeg-utils manual.
  5553. The default value of @var{fontcolor} is "black".
  5554. @item fontcolor_expr
  5555. String which is expanded the same way as @var{text} to obtain dynamic
  5556. @var{fontcolor} value. By default this option has empty value and is not
  5557. processed. When this option is set, it overrides @var{fontcolor} option.
  5558. @item font
  5559. The font family to be used for drawing text. By default Sans.
  5560. @item fontfile
  5561. The font file to be used for drawing text. The path must be included.
  5562. This parameter is mandatory if the fontconfig support is disabled.
  5563. @item alpha
  5564. Draw the text applying alpha blending. The value can
  5565. be a number between 0.0 and 1.0.
  5566. The expression accepts the same variables @var{x, y} as well.
  5567. The default value is 1.
  5568. Please see @var{fontcolor_expr}.
  5569. @item fontsize
  5570. The font size to be used for drawing text.
  5571. The default value of @var{fontsize} is 16.
  5572. @item text_shaping
  5573. If set to 1, attempt to shape the text (for example, reverse the order of
  5574. right-to-left text and join Arabic characters) before drawing it.
  5575. Otherwise, just draw the text exactly as given.
  5576. By default 1 (if supported).
  5577. @item ft_load_flags
  5578. The flags to be used for loading the fonts.
  5579. The flags map the corresponding flags supported by libfreetype, and are
  5580. a combination of the following values:
  5581. @table @var
  5582. @item default
  5583. @item no_scale
  5584. @item no_hinting
  5585. @item render
  5586. @item no_bitmap
  5587. @item vertical_layout
  5588. @item force_autohint
  5589. @item crop_bitmap
  5590. @item pedantic
  5591. @item ignore_global_advance_width
  5592. @item no_recurse
  5593. @item ignore_transform
  5594. @item monochrome
  5595. @item linear_design
  5596. @item no_autohint
  5597. @end table
  5598. Default value is "default".
  5599. For more information consult the documentation for the FT_LOAD_*
  5600. libfreetype flags.
  5601. @item shadowcolor
  5602. The color to be used for drawing a shadow behind the drawn text. For the
  5603. syntax of this option, check the "Color" section in the ffmpeg-utils manual.
  5604. The default value of @var{shadowcolor} is "black".
  5605. @item shadowx
  5606. @item shadowy
  5607. The x and y offsets for the text shadow position with respect to the
  5608. position of the text. They can be either positive or negative
  5609. values. The default value for both is "0".
  5610. @item start_number
  5611. The starting frame number for the n/frame_num variable. The default value
  5612. is "0".
  5613. @item tabsize
  5614. The size in number of spaces to use for rendering the tab.
  5615. Default value is 4.
  5616. @item timecode
  5617. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  5618. format. It can be used with or without text parameter. @var{timecode_rate}
  5619. option must be specified.
  5620. @item timecode_rate, rate, r
  5621. Set the timecode frame rate (timecode only).
  5622. @item tc24hmax
  5623. If set to 1, the output of the timecode option will wrap around at 24 hours.
  5624. Default is 0 (disabled).
  5625. @item text
  5626. The text string to be drawn. The text must be a sequence of UTF-8
  5627. encoded characters.
  5628. This parameter is mandatory if no file is specified with the parameter
  5629. @var{textfile}.
  5630. @item textfile
  5631. A text file containing text to be drawn. The text must be a sequence
  5632. of UTF-8 encoded characters.
  5633. This parameter is mandatory if no text string is specified with the
  5634. parameter @var{text}.
  5635. If both @var{text} and @var{textfile} are specified, an error is thrown.
  5636. @item reload
  5637. If set to 1, the @var{textfile} will be reloaded before each frame.
  5638. Be sure to update it atomically, or it may be read partially, or even fail.
  5639. @item x
  5640. @item y
  5641. The expressions which specify the offsets where text will be drawn
  5642. within the video frame. They are relative to the top/left border of the
  5643. output image.
  5644. The default value of @var{x} and @var{y} is "0".
  5645. See below for the list of accepted constants and functions.
  5646. @end table
  5647. The parameters for @var{x} and @var{y} are expressions containing the
  5648. following constants and functions:
  5649. @table @option
  5650. @item dar
  5651. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  5652. @item hsub
  5653. @item vsub
  5654. horizontal and vertical chroma subsample values. For example for the
  5655. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5656. @item line_h, lh
  5657. the height of each text line
  5658. @item main_h, h, H
  5659. the input height
  5660. @item main_w, w, W
  5661. the input width
  5662. @item max_glyph_a, ascent
  5663. the maximum distance from the baseline to the highest/upper grid
  5664. coordinate used to place a glyph outline point, for all the rendered
  5665. glyphs.
  5666. It is a positive value, due to the grid's orientation with the Y axis
  5667. upwards.
  5668. @item max_glyph_d, descent
  5669. the maximum distance from the baseline to the lowest grid coordinate
  5670. used to place a glyph outline point, for all the rendered glyphs.
  5671. This is a negative value, due to the grid's orientation, with the Y axis
  5672. upwards.
  5673. @item max_glyph_h
  5674. maximum glyph height, that is the maximum height for all the glyphs
  5675. contained in the rendered text, it is equivalent to @var{ascent} -
  5676. @var{descent}.
  5677. @item max_glyph_w
  5678. maximum glyph width, that is the maximum width for all the glyphs
  5679. contained in the rendered text
  5680. @item n
  5681. the number of input frame, starting from 0
  5682. @item rand(min, max)
  5683. return a random number included between @var{min} and @var{max}
  5684. @item sar
  5685. The input sample aspect ratio.
  5686. @item t
  5687. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5688. @item text_h, th
  5689. the height of the rendered text
  5690. @item text_w, tw
  5691. the width of the rendered text
  5692. @item x
  5693. @item y
  5694. the x and y offset coordinates where the text is drawn.
  5695. These parameters allow the @var{x} and @var{y} expressions to refer
  5696. each other, so you can for example specify @code{y=x/dar}.
  5697. @end table
  5698. @anchor{drawtext_expansion}
  5699. @subsection Text expansion
  5700. If @option{expansion} is set to @code{strftime},
  5701. the filter recognizes strftime() sequences in the provided text and
  5702. expands them accordingly. Check the documentation of strftime(). This
  5703. feature is deprecated.
  5704. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  5705. If @option{expansion} is set to @code{normal} (which is the default),
  5706. the following expansion mechanism is used.
  5707. The backslash character @samp{\}, followed by any character, always expands to
  5708. the second character.
  5709. Sequences of the form @code{%@{...@}} are expanded. The text between the
  5710. braces is a function name, possibly followed by arguments separated by ':'.
  5711. If the arguments contain special characters or delimiters (':' or '@}'),
  5712. they should be escaped.
  5713. Note that they probably must also be escaped as the value for the
  5714. @option{text} option in the filter argument string and as the filter
  5715. argument in the filtergraph description, and possibly also for the shell,
  5716. that makes up to four levels of escaping; using a text file avoids these
  5717. problems.
  5718. The following functions are available:
  5719. @table @command
  5720. @item expr, e
  5721. The expression evaluation result.
  5722. It must take one argument specifying the expression to be evaluated,
  5723. which accepts the same constants and functions as the @var{x} and
  5724. @var{y} values. Note that not all constants should be used, for
  5725. example the text size is not known when evaluating the expression, so
  5726. the constants @var{text_w} and @var{text_h} will have an undefined
  5727. value.
  5728. @item expr_int_format, eif
  5729. Evaluate the expression's value and output as formatted integer.
  5730. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  5731. The second argument specifies the output format. Allowed values are @samp{x},
  5732. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  5733. @code{printf} function.
  5734. The third parameter is optional and sets the number of positions taken by the output.
  5735. It can be used to add padding with zeros from the left.
  5736. @item gmtime
  5737. The time at which the filter is running, expressed in UTC.
  5738. It can accept an argument: a strftime() format string.
  5739. @item localtime
  5740. The time at which the filter is running, expressed in the local time zone.
  5741. It can accept an argument: a strftime() format string.
  5742. @item metadata
  5743. Frame metadata. Takes one or two arguments.
  5744. The first argument is mandatory and specifies the metadata key.
  5745. The second argument is optional and specifies a default value, used when the
  5746. metadata key is not found or empty.
  5747. @item n, frame_num
  5748. The frame number, starting from 0.
  5749. @item pict_type
  5750. A 1 character description of the current picture type.
  5751. @item pts
  5752. The timestamp of the current frame.
  5753. It can take up to three arguments.
  5754. The first argument is the format of the timestamp; it defaults to @code{flt}
  5755. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  5756. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  5757. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  5758. @code{localtime} stands for the timestamp of the frame formatted as
  5759. local time zone time.
  5760. The second argument is an offset added to the timestamp.
  5761. If the format is set to @code{localtime} or @code{gmtime},
  5762. a third argument may be supplied: a strftime() format string.
  5763. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  5764. @end table
  5765. @subsection Examples
  5766. @itemize
  5767. @item
  5768. Draw "Test Text" with font FreeSerif, using the default values for the
  5769. optional parameters.
  5770. @example
  5771. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  5772. @end example
  5773. @item
  5774. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  5775. and y=50 (counting from the top-left corner of the screen), text is
  5776. yellow with a red box around it. Both the text and the box have an
  5777. opacity of 20%.
  5778. @example
  5779. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  5780. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  5781. @end example
  5782. Note that the double quotes are not necessary if spaces are not used
  5783. within the parameter list.
  5784. @item
  5785. Show the text at the center of the video frame:
  5786. @example
  5787. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  5788. @end example
  5789. @item
  5790. Show the text at a random position, switching to a new position every 30 seconds:
  5791. @example
  5792. 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)"
  5793. @end example
  5794. @item
  5795. Show a text line sliding from right to left in the last row of the video
  5796. frame. The file @file{LONG_LINE} is assumed to contain a single line
  5797. with no newlines.
  5798. @example
  5799. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  5800. @end example
  5801. @item
  5802. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  5803. @example
  5804. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  5805. @end example
  5806. @item
  5807. Draw a single green letter "g", at the center of the input video.
  5808. The glyph baseline is placed at half screen height.
  5809. @example
  5810. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  5811. @end example
  5812. @item
  5813. Show text for 1 second every 3 seconds:
  5814. @example
  5815. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  5816. @end example
  5817. @item
  5818. Use fontconfig to set the font. Note that the colons need to be escaped.
  5819. @example
  5820. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  5821. @end example
  5822. @item
  5823. Print the date of a real-time encoding (see strftime(3)):
  5824. @example
  5825. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  5826. @end example
  5827. @item
  5828. Show text fading in and out (appearing/disappearing):
  5829. @example
  5830. #!/bin/sh
  5831. DS=1.0 # display start
  5832. DE=10.0 # display end
  5833. FID=1.5 # fade in duration
  5834. FOD=5 # fade out duration
  5835. 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 @}"
  5836. @end example
  5837. @item
  5838. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  5839. and the @option{fontsize} value are included in the @option{y} offset.
  5840. @example
  5841. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  5842. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  5843. @end example
  5844. @end itemize
  5845. For more information about libfreetype, check:
  5846. @url{http://www.freetype.org/}.
  5847. For more information about fontconfig, check:
  5848. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  5849. For more information about libfribidi, check:
  5850. @url{http://fribidi.org/}.
  5851. @section edgedetect
  5852. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  5853. The filter accepts the following options:
  5854. @table @option
  5855. @item low
  5856. @item high
  5857. Set low and high threshold values used by the Canny thresholding
  5858. algorithm.
  5859. The high threshold selects the "strong" edge pixels, which are then
  5860. connected through 8-connectivity with the "weak" edge pixels selected
  5861. by the low threshold.
  5862. @var{low} and @var{high} threshold values must be chosen in the range
  5863. [0,1], and @var{low} should be lesser or equal to @var{high}.
  5864. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  5865. is @code{50/255}.
  5866. @item mode
  5867. Define the drawing mode.
  5868. @table @samp
  5869. @item wires
  5870. Draw white/gray wires on black background.
  5871. @item colormix
  5872. Mix the colors to create a paint/cartoon effect.
  5873. @end table
  5874. Default value is @var{wires}.
  5875. @end table
  5876. @subsection Examples
  5877. @itemize
  5878. @item
  5879. Standard edge detection with custom values for the hysteresis thresholding:
  5880. @example
  5881. edgedetect=low=0.1:high=0.4
  5882. @end example
  5883. @item
  5884. Painting effect without thresholding:
  5885. @example
  5886. edgedetect=mode=colormix:high=0
  5887. @end example
  5888. @end itemize
  5889. @section eq
  5890. Set brightness, contrast, saturation and approximate gamma adjustment.
  5891. The filter accepts the following options:
  5892. @table @option
  5893. @item contrast
  5894. Set the contrast expression. The value must be a float value in range
  5895. @code{-2.0} to @code{2.0}. The default value is "1".
  5896. @item brightness
  5897. Set the brightness expression. The value must be a float value in
  5898. range @code{-1.0} to @code{1.0}. The default value is "0".
  5899. @item saturation
  5900. Set the saturation expression. The value must be a float in
  5901. range @code{0.0} to @code{3.0}. The default value is "1".
  5902. @item gamma
  5903. Set the gamma expression. The value must be a float in range
  5904. @code{0.1} to @code{10.0}. The default value is "1".
  5905. @item gamma_r
  5906. Set the gamma expression for red. The value must be a float in
  5907. range @code{0.1} to @code{10.0}. The default value is "1".
  5908. @item gamma_g
  5909. Set the gamma expression for green. The value must be a float in range
  5910. @code{0.1} to @code{10.0}. The default value is "1".
  5911. @item gamma_b
  5912. Set the gamma expression for blue. The value must be a float in range
  5913. @code{0.1} to @code{10.0}. The default value is "1".
  5914. @item gamma_weight
  5915. Set the gamma weight expression. It can be used to reduce the effect
  5916. of a high gamma value on bright image areas, e.g. keep them from
  5917. getting overamplified and just plain white. The value must be a float
  5918. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  5919. gamma correction all the way down while @code{1.0} leaves it at its
  5920. full strength. Default is "1".
  5921. @item eval
  5922. Set when the expressions for brightness, contrast, saturation and
  5923. gamma expressions are evaluated.
  5924. It accepts the following values:
  5925. @table @samp
  5926. @item init
  5927. only evaluate expressions once during the filter initialization or
  5928. when a command is processed
  5929. @item frame
  5930. evaluate expressions for each incoming frame
  5931. @end table
  5932. Default value is @samp{init}.
  5933. @end table
  5934. The expressions accept the following parameters:
  5935. @table @option
  5936. @item n
  5937. frame count of the input frame starting from 0
  5938. @item pos
  5939. byte position of the corresponding packet in the input file, NAN if
  5940. unspecified
  5941. @item r
  5942. frame rate of the input video, NAN if the input frame rate is unknown
  5943. @item t
  5944. timestamp expressed in seconds, NAN if the input timestamp is unknown
  5945. @end table
  5946. @subsection Commands
  5947. The filter supports the following commands:
  5948. @table @option
  5949. @item contrast
  5950. Set the contrast expression.
  5951. @item brightness
  5952. Set the brightness expression.
  5953. @item saturation
  5954. Set the saturation expression.
  5955. @item gamma
  5956. Set the gamma expression.
  5957. @item gamma_r
  5958. Set the gamma_r expression.
  5959. @item gamma_g
  5960. Set gamma_g expression.
  5961. @item gamma_b
  5962. Set gamma_b expression.
  5963. @item gamma_weight
  5964. Set gamma_weight expression.
  5965. The command accepts the same syntax of the corresponding option.
  5966. If the specified expression is not valid, it is kept at its current
  5967. value.
  5968. @end table
  5969. @section erosion
  5970. Apply erosion effect to the video.
  5971. This filter replaces the pixel by the local(3x3) minimum.
  5972. It accepts the following options:
  5973. @table @option
  5974. @item threshold0
  5975. @item threshold1
  5976. @item threshold2
  5977. @item threshold3
  5978. Limit the maximum change for each plane, default is 65535.
  5979. If 0, plane will remain unchanged.
  5980. @item coordinates
  5981. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5982. pixels are used.
  5983. Flags to local 3x3 coordinates maps like this:
  5984. 1 2 3
  5985. 4 5
  5986. 6 7 8
  5987. @end table
  5988. @section extractplanes
  5989. Extract color channel components from input video stream into
  5990. separate grayscale video streams.
  5991. The filter accepts the following option:
  5992. @table @option
  5993. @item planes
  5994. Set plane(s) to extract.
  5995. Available values for planes are:
  5996. @table @samp
  5997. @item y
  5998. @item u
  5999. @item v
  6000. @item a
  6001. @item r
  6002. @item g
  6003. @item b
  6004. @end table
  6005. Choosing planes not available in the input will result in an error.
  6006. That means you cannot select @code{r}, @code{g}, @code{b} planes
  6007. with @code{y}, @code{u}, @code{v} planes at same time.
  6008. @end table
  6009. @subsection Examples
  6010. @itemize
  6011. @item
  6012. Extract luma, u and v color channel component from input video frame
  6013. into 3 grayscale outputs:
  6014. @example
  6015. 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
  6016. @end example
  6017. @end itemize
  6018. @section elbg
  6019. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  6020. For each input image, the filter will compute the optimal mapping from
  6021. the input to the output given the codebook length, that is the number
  6022. of distinct output colors.
  6023. This filter accepts the following options.
  6024. @table @option
  6025. @item codebook_length, l
  6026. Set codebook length. The value must be a positive integer, and
  6027. represents the number of distinct output colors. Default value is 256.
  6028. @item nb_steps, n
  6029. Set the maximum number of iterations to apply for computing the optimal
  6030. mapping. The higher the value the better the result and the higher the
  6031. computation time. Default value is 1.
  6032. @item seed, s
  6033. Set a random seed, must be an integer included between 0 and
  6034. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  6035. will try to use a good random seed on a best effort basis.
  6036. @item pal8
  6037. Set pal8 output pixel format. This option does not work with codebook
  6038. length greater than 256.
  6039. @end table
  6040. @section fade
  6041. Apply a fade-in/out effect to the input video.
  6042. It accepts the following parameters:
  6043. @table @option
  6044. @item type, t
  6045. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  6046. effect.
  6047. Default is @code{in}.
  6048. @item start_frame, s
  6049. Specify the number of the frame to start applying the fade
  6050. effect at. Default is 0.
  6051. @item nb_frames, n
  6052. The number of frames that the fade effect lasts. At the end of the
  6053. fade-in effect, the output video will have the same intensity as the input video.
  6054. At the end of the fade-out transition, the output video will be filled with the
  6055. selected @option{color}.
  6056. Default is 25.
  6057. @item alpha
  6058. If set to 1, fade only alpha channel, if one exists on the input.
  6059. Default value is 0.
  6060. @item start_time, st
  6061. Specify the timestamp (in seconds) of the frame to start to apply the fade
  6062. effect. If both start_frame and start_time are specified, the fade will start at
  6063. whichever comes last. Default is 0.
  6064. @item duration, d
  6065. The number of seconds for which the fade effect has to last. At the end of the
  6066. fade-in effect the output video will have the same intensity as the input video,
  6067. at the end of the fade-out transition the output video will be filled with the
  6068. selected @option{color}.
  6069. If both duration and nb_frames are specified, duration is used. Default is 0
  6070. (nb_frames is used by default).
  6071. @item color, c
  6072. Specify the color of the fade. Default is "black".
  6073. @end table
  6074. @subsection Examples
  6075. @itemize
  6076. @item
  6077. Fade in the first 30 frames of video:
  6078. @example
  6079. fade=in:0:30
  6080. @end example
  6081. The command above is equivalent to:
  6082. @example
  6083. fade=t=in:s=0:n=30
  6084. @end example
  6085. @item
  6086. Fade out the last 45 frames of a 200-frame video:
  6087. @example
  6088. fade=out:155:45
  6089. fade=type=out:start_frame=155:nb_frames=45
  6090. @end example
  6091. @item
  6092. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  6093. @example
  6094. fade=in:0:25, fade=out:975:25
  6095. @end example
  6096. @item
  6097. Make the first 5 frames yellow, then fade in from frame 5-24:
  6098. @example
  6099. fade=in:5:20:color=yellow
  6100. @end example
  6101. @item
  6102. Fade in alpha over first 25 frames of video:
  6103. @example
  6104. fade=in:0:25:alpha=1
  6105. @end example
  6106. @item
  6107. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  6108. @example
  6109. fade=t=in:st=5.5:d=0.5
  6110. @end example
  6111. @end itemize
  6112. @section fftfilt
  6113. Apply arbitrary expressions to samples in frequency domain
  6114. @table @option
  6115. @item dc_Y
  6116. Adjust the dc value (gain) of the luma plane of the image. The filter
  6117. accepts an integer value in range @code{0} to @code{1000}. The default
  6118. value is set to @code{0}.
  6119. @item dc_U
  6120. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  6121. filter accepts an integer value in range @code{0} to @code{1000}. The
  6122. default value is set to @code{0}.
  6123. @item dc_V
  6124. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  6125. filter accepts an integer value in range @code{0} to @code{1000}. The
  6126. default value is set to @code{0}.
  6127. @item weight_Y
  6128. Set the frequency domain weight expression for the luma plane.
  6129. @item weight_U
  6130. Set the frequency domain weight expression for the 1st chroma plane.
  6131. @item weight_V
  6132. Set the frequency domain weight expression for the 2nd chroma plane.
  6133. @item eval
  6134. Set when the expressions are evaluated.
  6135. It accepts the following values:
  6136. @table @samp
  6137. @item init
  6138. Only evaluate expressions once during the filter initialization.
  6139. @item frame
  6140. Evaluate expressions for each incoming frame.
  6141. @end table
  6142. Default value is @samp{init}.
  6143. The filter accepts the following variables:
  6144. @item X
  6145. @item Y
  6146. The coordinates of the current sample.
  6147. @item W
  6148. @item H
  6149. The width and height of the image.
  6150. @item N
  6151. The number of input frame, starting from 0.
  6152. @end table
  6153. @subsection Examples
  6154. @itemize
  6155. @item
  6156. High-pass:
  6157. @example
  6158. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  6159. @end example
  6160. @item
  6161. Low-pass:
  6162. @example
  6163. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  6164. @end example
  6165. @item
  6166. Sharpen:
  6167. @example
  6168. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  6169. @end example
  6170. @item
  6171. Blur:
  6172. @example
  6173. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  6174. @end example
  6175. @end itemize
  6176. @section field
  6177. Extract a single field from an interlaced image using stride
  6178. arithmetic to avoid wasting CPU time. The output frames are marked as
  6179. non-interlaced.
  6180. The filter accepts the following options:
  6181. @table @option
  6182. @item type
  6183. Specify whether to extract the top (if the value is @code{0} or
  6184. @code{top}) or the bottom field (if the value is @code{1} or
  6185. @code{bottom}).
  6186. @end table
  6187. @section fieldhint
  6188. Create new frames by copying the top and bottom fields from surrounding frames
  6189. supplied as numbers by the hint file.
  6190. @table @option
  6191. @item hint
  6192. Set file containing hints: absolute/relative frame numbers.
  6193. There must be one line for each frame in a clip. Each line must contain two
  6194. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  6195. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  6196. is current frame number for @code{absolute} mode or out of [-1, 1] range
  6197. for @code{relative} mode. First number tells from which frame to pick up top
  6198. field and second number tells from which frame to pick up bottom field.
  6199. If optionally followed by @code{+} output frame will be marked as interlaced,
  6200. else if followed by @code{-} output frame will be marked as progressive, else
  6201. it will be marked same as input frame.
  6202. If line starts with @code{#} or @code{;} that line is skipped.
  6203. @item mode
  6204. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  6205. @end table
  6206. Example of first several lines of @code{hint} file for @code{relative} mode:
  6207. @example
  6208. 0,0 - # first frame
  6209. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  6210. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  6211. 1,0 -
  6212. 0,0 -
  6213. 0,0 -
  6214. 1,0 -
  6215. 1,0 -
  6216. 1,0 -
  6217. 0,0 -
  6218. 0,0 -
  6219. 1,0 -
  6220. 1,0 -
  6221. 1,0 -
  6222. 0,0 -
  6223. @end example
  6224. @section fieldmatch
  6225. Field matching filter for inverse telecine. It is meant to reconstruct the
  6226. progressive frames from a telecined stream. The filter does not drop duplicated
  6227. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  6228. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  6229. The separation of the field matching and the decimation is notably motivated by
  6230. the possibility of inserting a de-interlacing filter fallback between the two.
  6231. If the source has mixed telecined and real interlaced content,
  6232. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  6233. But these remaining combed frames will be marked as interlaced, and thus can be
  6234. de-interlaced by a later filter such as @ref{yadif} before decimation.
  6235. In addition to the various configuration options, @code{fieldmatch} can take an
  6236. optional second stream, activated through the @option{ppsrc} option. If
  6237. enabled, the frames reconstruction will be based on the fields and frames from
  6238. this second stream. This allows the first input to be pre-processed in order to
  6239. help the various algorithms of the filter, while keeping the output lossless
  6240. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  6241. or brightness/contrast adjustments can help.
  6242. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  6243. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  6244. which @code{fieldmatch} is based on. While the semantic and usage are very
  6245. close, some behaviour and options names can differ.
  6246. The @ref{decimate} filter currently only works for constant frame rate input.
  6247. If your input has mixed telecined (30fps) and progressive content with a lower
  6248. framerate like 24fps use the following filterchain to produce the necessary cfr
  6249. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  6250. The filter accepts the following options:
  6251. @table @option
  6252. @item order
  6253. Specify the assumed field order of the input stream. Available values are:
  6254. @table @samp
  6255. @item auto
  6256. Auto detect parity (use FFmpeg's internal parity value).
  6257. @item bff
  6258. Assume bottom field first.
  6259. @item tff
  6260. Assume top field first.
  6261. @end table
  6262. Note that it is sometimes recommended not to trust the parity announced by the
  6263. stream.
  6264. Default value is @var{auto}.
  6265. @item mode
  6266. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  6267. sense that it won't risk creating jerkiness due to duplicate frames when
  6268. possible, but if there are bad edits or blended fields it will end up
  6269. outputting combed frames when a good match might actually exist. On the other
  6270. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  6271. but will almost always find a good frame if there is one. The other values are
  6272. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  6273. jerkiness and creating duplicate frames versus finding good matches in sections
  6274. with bad edits, orphaned fields, blended fields, etc.
  6275. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  6276. Available values are:
  6277. @table @samp
  6278. @item pc
  6279. 2-way matching (p/c)
  6280. @item pc_n
  6281. 2-way matching, and trying 3rd match if still combed (p/c + n)
  6282. @item pc_u
  6283. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  6284. @item pc_n_ub
  6285. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  6286. still combed (p/c + n + u/b)
  6287. @item pcn
  6288. 3-way matching (p/c/n)
  6289. @item pcn_ub
  6290. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  6291. detected as combed (p/c/n + u/b)
  6292. @end table
  6293. The parenthesis at the end indicate the matches that would be used for that
  6294. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  6295. @var{top}).
  6296. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  6297. the slowest.
  6298. Default value is @var{pc_n}.
  6299. @item ppsrc
  6300. Mark the main input stream as a pre-processed input, and enable the secondary
  6301. input stream as the clean source to pick the fields from. See the filter
  6302. introduction for more details. It is similar to the @option{clip2} feature from
  6303. VFM/TFM.
  6304. Default value is @code{0} (disabled).
  6305. @item field
  6306. Set the field to match from. It is recommended to set this to the same value as
  6307. @option{order} unless you experience matching failures with that setting. In
  6308. certain circumstances changing the field that is used to match from can have a
  6309. large impact on matching performance. Available values are:
  6310. @table @samp
  6311. @item auto
  6312. Automatic (same value as @option{order}).
  6313. @item bottom
  6314. Match from the bottom field.
  6315. @item top
  6316. Match from the top field.
  6317. @end table
  6318. Default value is @var{auto}.
  6319. @item mchroma
  6320. Set whether or not chroma is included during the match comparisons. In most
  6321. cases it is recommended to leave this enabled. You should set this to @code{0}
  6322. only if your clip has bad chroma problems such as heavy rainbowing or other
  6323. artifacts. Setting this to @code{0} could also be used to speed things up at
  6324. the cost of some accuracy.
  6325. Default value is @code{1}.
  6326. @item y0
  6327. @item y1
  6328. These define an exclusion band which excludes the lines between @option{y0} and
  6329. @option{y1} from being included in the field matching decision. An exclusion
  6330. band can be used to ignore subtitles, a logo, or other things that may
  6331. interfere with the matching. @option{y0} sets the starting scan line and
  6332. @option{y1} sets the ending line; all lines in between @option{y0} and
  6333. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6334. @option{y0} and @option{y1} to the same value will disable the feature.
  6335. @option{y0} and @option{y1} defaults to @code{0}.
  6336. @item scthresh
  6337. Set the scene change detection threshold as a percentage of maximum change on
  6338. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6339. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6340. @option{scthresh} is @code{[0.0, 100.0]}.
  6341. Default value is @code{12.0}.
  6342. @item combmatch
  6343. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6344. account the combed scores of matches when deciding what match to use as the
  6345. final match. Available values are:
  6346. @table @samp
  6347. @item none
  6348. No final matching based on combed scores.
  6349. @item sc
  6350. Combed scores are only used when a scene change is detected.
  6351. @item full
  6352. Use combed scores all the time.
  6353. @end table
  6354. Default is @var{sc}.
  6355. @item combdbg
  6356. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  6357. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  6358. Available values are:
  6359. @table @samp
  6360. @item none
  6361. No forced calculation.
  6362. @item pcn
  6363. Force p/c/n calculations.
  6364. @item pcnub
  6365. Force p/c/n/u/b calculations.
  6366. @end table
  6367. Default value is @var{none}.
  6368. @item cthresh
  6369. This is the area combing threshold used for combed frame detection. This
  6370. essentially controls how "strong" or "visible" combing must be to be detected.
  6371. Larger values mean combing must be more visible and smaller values mean combing
  6372. can be less visible or strong and still be detected. Valid settings are from
  6373. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6374. be detected as combed). This is basically a pixel difference value. A good
  6375. range is @code{[8, 12]}.
  6376. Default value is @code{9}.
  6377. @item chroma
  6378. Sets whether or not chroma is considered in the combed frame decision. Only
  6379. disable this if your source has chroma problems (rainbowing, etc.) that are
  6380. causing problems for the combed frame detection with chroma enabled. Actually,
  6381. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6382. where there is chroma only combing in the source.
  6383. Default value is @code{0}.
  6384. @item blockx
  6385. @item blocky
  6386. Respectively set the x-axis and y-axis size of the window used during combed
  6387. frame detection. This has to do with the size of the area in which
  6388. @option{combpel} pixels are required to be detected as combed for a frame to be
  6389. declared combed. See the @option{combpel} parameter description for more info.
  6390. Possible values are any number that is a power of 2 starting at 4 and going up
  6391. to 512.
  6392. Default value is @code{16}.
  6393. @item combpel
  6394. The number of combed pixels inside any of the @option{blocky} by
  6395. @option{blockx} size blocks on the frame for the frame to be detected as
  6396. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6397. setting controls "how much" combing there must be in any localized area (a
  6398. window defined by the @option{blockx} and @option{blocky} settings) on the
  6399. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6400. which point no frames will ever be detected as combed). This setting is known
  6401. as @option{MI} in TFM/VFM vocabulary.
  6402. Default value is @code{80}.
  6403. @end table
  6404. @anchor{p/c/n/u/b meaning}
  6405. @subsection p/c/n/u/b meaning
  6406. @subsubsection p/c/n
  6407. We assume the following telecined stream:
  6408. @example
  6409. Top fields: 1 2 2 3 4
  6410. Bottom fields: 1 2 3 4 4
  6411. @end example
  6412. The numbers correspond to the progressive frame the fields relate to. Here, the
  6413. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6414. When @code{fieldmatch} is configured to run a matching from bottom
  6415. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6416. @example
  6417. Input stream:
  6418. T 1 2 2 3 4
  6419. B 1 2 3 4 4 <-- matching reference
  6420. Matches: c c n n c
  6421. Output stream:
  6422. T 1 2 3 4 4
  6423. B 1 2 3 4 4
  6424. @end example
  6425. As a result of the field matching, we can see that some frames get duplicated.
  6426. To perform a complete inverse telecine, you need to rely on a decimation filter
  6427. after this operation. See for instance the @ref{decimate} filter.
  6428. The same operation now matching from top fields (@option{field}=@var{top})
  6429. looks like this:
  6430. @example
  6431. Input stream:
  6432. T 1 2 2 3 4 <-- matching reference
  6433. B 1 2 3 4 4
  6434. Matches: c c p p c
  6435. Output stream:
  6436. T 1 2 2 3 4
  6437. B 1 2 2 3 4
  6438. @end example
  6439. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6440. basically, they refer to the frame and field of the opposite parity:
  6441. @itemize
  6442. @item @var{p} matches the field of the opposite parity in the previous frame
  6443. @item @var{c} matches the field of the opposite parity in the current frame
  6444. @item @var{n} matches the field of the opposite parity in the next frame
  6445. @end itemize
  6446. @subsubsection u/b
  6447. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6448. from the opposite parity flag. In the following examples, we assume that we are
  6449. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6450. 'x' is placed above and below each matched fields.
  6451. With bottom matching (@option{field}=@var{bottom}):
  6452. @example
  6453. Match: c p n b u
  6454. x x x x x
  6455. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6456. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6457. x x x x x
  6458. Output frames:
  6459. 2 1 2 2 2
  6460. 2 2 2 1 3
  6461. @end example
  6462. With top matching (@option{field}=@var{top}):
  6463. @example
  6464. Match: c p n b u
  6465. x x x x x
  6466. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6467. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6468. x x x x x
  6469. Output frames:
  6470. 2 2 2 1 2
  6471. 2 1 3 2 2
  6472. @end example
  6473. @subsection Examples
  6474. Simple IVTC of a top field first telecined stream:
  6475. @example
  6476. fieldmatch=order=tff:combmatch=none, decimate
  6477. @end example
  6478. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6479. @example
  6480. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6481. @end example
  6482. @section fieldorder
  6483. Transform the field order of the input video.
  6484. It accepts the following parameters:
  6485. @table @option
  6486. @item order
  6487. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6488. for bottom field first.
  6489. @end table
  6490. The default value is @samp{tff}.
  6491. The transformation is done by shifting the picture content up or down
  6492. by one line, and filling the remaining line with appropriate picture content.
  6493. This method is consistent with most broadcast field order converters.
  6494. If the input video is not flagged as being interlaced, or it is already
  6495. flagged as being of the required output field order, then this filter does
  6496. not alter the incoming video.
  6497. It is very useful when converting to or from PAL DV material,
  6498. which is bottom field first.
  6499. For example:
  6500. @example
  6501. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6502. @end example
  6503. @section fifo, afifo
  6504. Buffer input images and send them when they are requested.
  6505. It is mainly useful when auto-inserted by the libavfilter
  6506. framework.
  6507. It does not take parameters.
  6508. @section find_rect
  6509. Find a rectangular object
  6510. It accepts the following options:
  6511. @table @option
  6512. @item object
  6513. Filepath of the object image, needs to be in gray8.
  6514. @item threshold
  6515. Detection threshold, default is 0.5.
  6516. @item mipmaps
  6517. Number of mipmaps, default is 3.
  6518. @item xmin, ymin, xmax, ymax
  6519. Specifies the rectangle in which to search.
  6520. @end table
  6521. @subsection Examples
  6522. @itemize
  6523. @item
  6524. Generate a representative palette of a given video using @command{ffmpeg}:
  6525. @example
  6526. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6527. @end example
  6528. @end itemize
  6529. @section cover_rect
  6530. Cover a rectangular object
  6531. It accepts the following options:
  6532. @table @option
  6533. @item cover
  6534. Filepath of the optional cover image, needs to be in yuv420.
  6535. @item mode
  6536. Set covering mode.
  6537. It accepts the following values:
  6538. @table @samp
  6539. @item cover
  6540. cover it by the supplied image
  6541. @item blur
  6542. cover it by interpolating the surrounding pixels
  6543. @end table
  6544. Default value is @var{blur}.
  6545. @end table
  6546. @subsection Examples
  6547. @itemize
  6548. @item
  6549. Generate a representative palette of a given video using @command{ffmpeg}:
  6550. @example
  6551. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  6552. @end example
  6553. @end itemize
  6554. @section floodfill
  6555. Flood area with values of same pixel components with another values.
  6556. It accepts the following options:
  6557. @table @option
  6558. @item x
  6559. Set pixel x coordinate.
  6560. @item y
  6561. Set pixel y coordinate.
  6562. @item s0
  6563. Set source #0 component value.
  6564. @item s1
  6565. Set source #1 component value.
  6566. @item s2
  6567. Set source #2 component value.
  6568. @item s3
  6569. Set source #3 component value.
  6570. @item d0
  6571. Set destination #0 component value.
  6572. @item d1
  6573. Set destination #1 component value.
  6574. @item d2
  6575. Set destination #2 component value.
  6576. @item d3
  6577. Set destination #3 component value.
  6578. @end table
  6579. @anchor{format}
  6580. @section format
  6581. Convert the input video to one of the specified pixel formats.
  6582. Libavfilter will try to pick one that is suitable as input to
  6583. the next filter.
  6584. It accepts the following parameters:
  6585. @table @option
  6586. @item pix_fmts
  6587. A '|'-separated list of pixel format names, such as
  6588. "pix_fmts=yuv420p|monow|rgb24".
  6589. @end table
  6590. @subsection Examples
  6591. @itemize
  6592. @item
  6593. Convert the input video to the @var{yuv420p} format
  6594. @example
  6595. format=pix_fmts=yuv420p
  6596. @end example
  6597. Convert the input video to any of the formats in the list
  6598. @example
  6599. format=pix_fmts=yuv420p|yuv444p|yuv410p
  6600. @end example
  6601. @end itemize
  6602. @anchor{fps}
  6603. @section fps
  6604. Convert the video to specified constant frame rate by duplicating or dropping
  6605. frames as necessary.
  6606. It accepts the following parameters:
  6607. @table @option
  6608. @item fps
  6609. The desired output frame rate. The default is @code{25}.
  6610. @item round
  6611. Rounding method.
  6612. Possible values are:
  6613. @table @option
  6614. @item zero
  6615. zero round towards 0
  6616. @item inf
  6617. round away from 0
  6618. @item down
  6619. round towards -infinity
  6620. @item up
  6621. round towards +infinity
  6622. @item near
  6623. round to nearest
  6624. @end table
  6625. The default is @code{near}.
  6626. @item start_time
  6627. Assume the first PTS should be the given value, in seconds. This allows for
  6628. padding/trimming at the start of stream. By default, no assumption is made
  6629. about the first frame's expected PTS, so no padding or trimming is done.
  6630. For example, this could be set to 0 to pad the beginning with duplicates of
  6631. the first frame if a video stream starts after the audio stream or to trim any
  6632. frames with a negative PTS.
  6633. @end table
  6634. Alternatively, the options can be specified as a flat string:
  6635. @var{fps}[:@var{round}].
  6636. See also the @ref{setpts} filter.
  6637. @subsection Examples
  6638. @itemize
  6639. @item
  6640. A typical usage in order to set the fps to 25:
  6641. @example
  6642. fps=fps=25
  6643. @end example
  6644. @item
  6645. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  6646. @example
  6647. fps=fps=film:round=near
  6648. @end example
  6649. @end itemize
  6650. @section framepack
  6651. Pack two different video streams into a stereoscopic video, setting proper
  6652. metadata on supported codecs. The two views should have the same size and
  6653. framerate and processing will stop when the shorter video ends. Please note
  6654. that you may conveniently adjust view properties with the @ref{scale} and
  6655. @ref{fps} filters.
  6656. It accepts the following parameters:
  6657. @table @option
  6658. @item format
  6659. The desired packing format. Supported values are:
  6660. @table @option
  6661. @item sbs
  6662. The views are next to each other (default).
  6663. @item tab
  6664. The views are on top of each other.
  6665. @item lines
  6666. The views are packed by line.
  6667. @item columns
  6668. The views are packed by column.
  6669. @item frameseq
  6670. The views are temporally interleaved.
  6671. @end table
  6672. @end table
  6673. Some examples:
  6674. @example
  6675. # Convert left and right views into a frame-sequential video
  6676. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  6677. # Convert views into a side-by-side video with the same output resolution as the input
  6678. 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
  6679. @end example
  6680. @section framerate
  6681. Change the frame rate by interpolating new video output frames from the source
  6682. frames.
  6683. This filter is not designed to function correctly with interlaced media. If
  6684. you wish to change the frame rate of interlaced media then you are required
  6685. to deinterlace before this filter and re-interlace after this filter.
  6686. A description of the accepted options follows.
  6687. @table @option
  6688. @item fps
  6689. Specify the output frames per second. This option can also be specified
  6690. as a value alone. The default is @code{50}.
  6691. @item interp_start
  6692. Specify the start of a range where the output frame will be created as a
  6693. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6694. the default is @code{15}.
  6695. @item interp_end
  6696. Specify the end of a range where the output frame will be created as a
  6697. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  6698. the default is @code{240}.
  6699. @item scene
  6700. Specify the level at which a scene change is detected as a value between
  6701. 0 and 100 to indicate a new scene; a low value reflects a low
  6702. probability for the current frame to introduce a new scene, while a higher
  6703. value means the current frame is more likely to be one.
  6704. The default is @code{7}.
  6705. @item flags
  6706. Specify flags influencing the filter process.
  6707. Available value for @var{flags} is:
  6708. @table @option
  6709. @item scene_change_detect, scd
  6710. Enable scene change detection using the value of the option @var{scene}.
  6711. This flag is enabled by default.
  6712. @end table
  6713. @end table
  6714. @section framestep
  6715. Select one frame every N-th frame.
  6716. This filter accepts the following option:
  6717. @table @option
  6718. @item step
  6719. Select frame after every @code{step} frames.
  6720. Allowed values are positive integers higher than 0. Default value is @code{1}.
  6721. @end table
  6722. @anchor{frei0r}
  6723. @section frei0r
  6724. Apply a frei0r effect to the input video.
  6725. To enable the compilation of this filter, you need to install the frei0r
  6726. header and configure FFmpeg with @code{--enable-frei0r}.
  6727. It accepts the following parameters:
  6728. @table @option
  6729. @item filter_name
  6730. The name of the frei0r effect to load. If the environment variable
  6731. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  6732. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  6733. Otherwise, the standard frei0r paths are searched, in this order:
  6734. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  6735. @file{/usr/lib/frei0r-1/}.
  6736. @item filter_params
  6737. A '|'-separated list of parameters to pass to the frei0r effect.
  6738. @end table
  6739. A frei0r effect parameter can be a boolean (its value is either
  6740. "y" or "n"), a double, a color (specified as
  6741. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  6742. numbers between 0.0 and 1.0, inclusive) or by a color description specified in the "Color"
  6743. section in the ffmpeg-utils manual), a position (specified as @var{X}/@var{Y}, where
  6744. @var{X} and @var{Y} are floating point numbers) and/or a string.
  6745. The number and types of parameters depend on the loaded effect. If an
  6746. effect parameter is not specified, the default value is set.
  6747. @subsection Examples
  6748. @itemize
  6749. @item
  6750. Apply the distort0r effect, setting the first two double parameters:
  6751. @example
  6752. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  6753. @end example
  6754. @item
  6755. Apply the colordistance effect, taking a color as the first parameter:
  6756. @example
  6757. frei0r=colordistance:0.2/0.3/0.4
  6758. frei0r=colordistance:violet
  6759. frei0r=colordistance:0x112233
  6760. @end example
  6761. @item
  6762. Apply the perspective effect, specifying the top left and top right image
  6763. positions:
  6764. @example
  6765. frei0r=perspective:0.2/0.2|0.8/0.2
  6766. @end example
  6767. @end itemize
  6768. For more information, see
  6769. @url{http://frei0r.dyne.org}
  6770. @section fspp
  6771. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  6772. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  6773. processing filter, one of them is performed once per block, not per pixel.
  6774. This allows for much higher speed.
  6775. The filter accepts the following options:
  6776. @table @option
  6777. @item quality
  6778. Set quality. This option defines the number of levels for averaging. It accepts
  6779. an integer in the range 4-5. Default value is @code{4}.
  6780. @item qp
  6781. Force a constant quantization parameter. It accepts an integer in range 0-63.
  6782. If not set, the filter will use the QP from the video stream (if available).
  6783. @item strength
  6784. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  6785. more details but also more artifacts, while higher values make the image smoother
  6786. but also blurrier. Default value is @code{0} − PSNR optimal.
  6787. @item use_bframe_qp
  6788. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  6789. option may cause flicker since the B-Frames have often larger QP. Default is
  6790. @code{0} (not enabled).
  6791. @end table
  6792. @section gblur
  6793. Apply Gaussian blur filter.
  6794. The filter accepts the following options:
  6795. @table @option
  6796. @item sigma
  6797. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  6798. @item steps
  6799. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  6800. @item planes
  6801. Set which planes to filter. By default all planes are filtered.
  6802. @item sigmaV
  6803. Set vertical sigma, if negative it will be same as @code{sigma}.
  6804. Default is @code{-1}.
  6805. @end table
  6806. @section geq
  6807. The filter accepts the following options:
  6808. @table @option
  6809. @item lum_expr, lum
  6810. Set the luminance expression.
  6811. @item cb_expr, cb
  6812. Set the chrominance blue expression.
  6813. @item cr_expr, cr
  6814. Set the chrominance red expression.
  6815. @item alpha_expr, a
  6816. Set the alpha expression.
  6817. @item red_expr, r
  6818. Set the red expression.
  6819. @item green_expr, g
  6820. Set the green expression.
  6821. @item blue_expr, b
  6822. Set the blue expression.
  6823. @end table
  6824. The colorspace is selected according to the specified options. If one
  6825. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  6826. options is specified, the filter will automatically select a YCbCr
  6827. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  6828. @option{blue_expr} options is specified, it will select an RGB
  6829. colorspace.
  6830. If one of the chrominance expression is not defined, it falls back on the other
  6831. one. If no alpha expression is specified it will evaluate to opaque value.
  6832. If none of chrominance expressions are specified, they will evaluate
  6833. to the luminance expression.
  6834. The expressions can use the following variables and functions:
  6835. @table @option
  6836. @item N
  6837. The sequential number of the filtered frame, starting from @code{0}.
  6838. @item X
  6839. @item Y
  6840. The coordinates of the current sample.
  6841. @item W
  6842. @item H
  6843. The width and height of the image.
  6844. @item SW
  6845. @item SH
  6846. Width and height scale depending on the currently filtered plane. It is the
  6847. ratio between the corresponding luma plane number of pixels and the current
  6848. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  6849. @code{0.5,0.5} for chroma planes.
  6850. @item T
  6851. Time of the current frame, expressed in seconds.
  6852. @item p(x, y)
  6853. Return the value of the pixel at location (@var{x},@var{y}) of the current
  6854. plane.
  6855. @item lum(x, y)
  6856. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  6857. plane.
  6858. @item cb(x, y)
  6859. Return the value of the pixel at location (@var{x},@var{y}) of the
  6860. blue-difference chroma plane. Return 0 if there is no such plane.
  6861. @item cr(x, y)
  6862. Return the value of the pixel at location (@var{x},@var{y}) of the
  6863. red-difference chroma plane. Return 0 if there is no such plane.
  6864. @item r(x, y)
  6865. @item g(x, y)
  6866. @item b(x, y)
  6867. Return the value of the pixel at location (@var{x},@var{y}) of the
  6868. red/green/blue component. Return 0 if there is no such component.
  6869. @item alpha(x, y)
  6870. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  6871. plane. Return 0 if there is no such plane.
  6872. @end table
  6873. For functions, if @var{x} and @var{y} are outside the area, the value will be
  6874. automatically clipped to the closer edge.
  6875. @subsection Examples
  6876. @itemize
  6877. @item
  6878. Flip the image horizontally:
  6879. @example
  6880. geq=p(W-X\,Y)
  6881. @end example
  6882. @item
  6883. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  6884. wavelength of 100 pixels:
  6885. @example
  6886. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  6887. @end example
  6888. @item
  6889. Generate a fancy enigmatic moving light:
  6890. @example
  6891. 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
  6892. @end example
  6893. @item
  6894. Generate a quick emboss effect:
  6895. @example
  6896. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  6897. @end example
  6898. @item
  6899. Modify RGB components depending on pixel position:
  6900. @example
  6901. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  6902. @end example
  6903. @item
  6904. Create a radial gradient that is the same size as the input (also see
  6905. the @ref{vignette} filter):
  6906. @example
  6907. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  6908. @end example
  6909. @end itemize
  6910. @section gradfun
  6911. Fix the banding artifacts that are sometimes introduced into nearly flat
  6912. regions by truncation to 8-bit color depth.
  6913. Interpolate the gradients that should go where the bands are, and
  6914. dither them.
  6915. It is designed for playback only. Do not use it prior to
  6916. lossy compression, because compression tends to lose the dither and
  6917. bring back the bands.
  6918. It accepts the following parameters:
  6919. @table @option
  6920. @item strength
  6921. The maximum amount by which the filter will change any one pixel. This is also
  6922. the threshold for detecting nearly flat regions. Acceptable values range from
  6923. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  6924. valid range.
  6925. @item radius
  6926. The neighborhood to fit the gradient to. A larger radius makes for smoother
  6927. gradients, but also prevents the filter from modifying the pixels near detailed
  6928. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  6929. values will be clipped to the valid range.
  6930. @end table
  6931. Alternatively, the options can be specified as a flat string:
  6932. @var{strength}[:@var{radius}]
  6933. @subsection Examples
  6934. @itemize
  6935. @item
  6936. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  6937. @example
  6938. gradfun=3.5:8
  6939. @end example
  6940. @item
  6941. Specify radius, omitting the strength (which will fall-back to the default
  6942. value):
  6943. @example
  6944. gradfun=radius=8
  6945. @end example
  6946. @end itemize
  6947. @anchor{haldclut}
  6948. @section haldclut
  6949. Apply a Hald CLUT to a video stream.
  6950. First input is the video stream to process, and second one is the Hald CLUT.
  6951. The Hald CLUT input can be a simple picture or a complete video stream.
  6952. The filter accepts the following options:
  6953. @table @option
  6954. @item shortest
  6955. Force termination when the shortest input terminates. Default is @code{0}.
  6956. @item repeatlast
  6957. Continue applying the last CLUT after the end of the stream. A value of
  6958. @code{0} disable the filter after the last frame of the CLUT is reached.
  6959. Default is @code{1}.
  6960. @end table
  6961. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  6962. filters share the same internals).
  6963. More information about the Hald CLUT can be found on Eskil Steenberg's website
  6964. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  6965. @subsection Workflow examples
  6966. @subsubsection Hald CLUT video stream
  6967. Generate an identity Hald CLUT stream altered with various effects:
  6968. @example
  6969. 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
  6970. @end example
  6971. Note: make sure you use a lossless codec.
  6972. Then use it with @code{haldclut} to apply it on some random stream:
  6973. @example
  6974. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  6975. @end example
  6976. The Hald CLUT will be applied to the 10 first seconds (duration of
  6977. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  6978. to the remaining frames of the @code{mandelbrot} stream.
  6979. @subsubsection Hald CLUT with preview
  6980. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  6981. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  6982. biggest possible square starting at the top left of the picture. The remaining
  6983. padding pixels (bottom or right) will be ignored. This area can be used to add
  6984. a preview of the Hald CLUT.
  6985. Typically, the following generated Hald CLUT will be supported by the
  6986. @code{haldclut} filter:
  6987. @example
  6988. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  6989. pad=iw+320 [padded_clut];
  6990. smptebars=s=320x256, split [a][b];
  6991. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  6992. [main][b] overlay=W-320" -frames:v 1 clut.png
  6993. @end example
  6994. It contains the original and a preview of the effect of the CLUT: SMPTE color
  6995. bars are displayed on the right-top, and below the same color bars processed by
  6996. the color changes.
  6997. Then, the effect of this Hald CLUT can be visualized with:
  6998. @example
  6999. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  7000. @end example
  7001. @section hflip
  7002. Flip the input video horizontally.
  7003. For example, to horizontally flip the input video with @command{ffmpeg}:
  7004. @example
  7005. ffmpeg -i in.avi -vf "hflip" out.avi
  7006. @end example
  7007. @section histeq
  7008. This filter applies a global color histogram equalization on a
  7009. per-frame basis.
  7010. It can be used to correct video that has a compressed range of pixel
  7011. intensities. The filter redistributes the pixel intensities to
  7012. equalize their distribution across the intensity range. It may be
  7013. viewed as an "automatically adjusting contrast filter". This filter is
  7014. useful only for correcting degraded or poorly captured source
  7015. video.
  7016. The filter accepts the following options:
  7017. @table @option
  7018. @item strength
  7019. Determine the amount of equalization to be applied. As the strength
  7020. is reduced, the distribution of pixel intensities more-and-more
  7021. approaches that of the input frame. The value must be a float number
  7022. in the range [0,1] and defaults to 0.200.
  7023. @item intensity
  7024. Set the maximum intensity that can generated and scale the output
  7025. values appropriately. The strength should be set as desired and then
  7026. the intensity can be limited if needed to avoid washing-out. The value
  7027. must be a float number in the range [0,1] and defaults to 0.210.
  7028. @item antibanding
  7029. Set the antibanding level. If enabled the filter will randomly vary
  7030. the luminance of output pixels by a small amount to avoid banding of
  7031. the histogram. Possible values are @code{none}, @code{weak} or
  7032. @code{strong}. It defaults to @code{none}.
  7033. @end table
  7034. @section histogram
  7035. Compute and draw a color distribution histogram for the input video.
  7036. The computed histogram is a representation of the color component
  7037. distribution in an image.
  7038. Standard histogram displays the color components distribution in an image.
  7039. Displays color graph for each color component. Shows distribution of
  7040. the Y, U, V, A or R, G, B components, depending on input format, in the
  7041. current frame. Below each graph a color component scale meter is shown.
  7042. The filter accepts the following options:
  7043. @table @option
  7044. @item level_height
  7045. Set height of level. Default value is @code{200}.
  7046. Allowed range is [50, 2048].
  7047. @item scale_height
  7048. Set height of color scale. Default value is @code{12}.
  7049. Allowed range is [0, 40].
  7050. @item display_mode
  7051. Set display mode.
  7052. It accepts the following values:
  7053. @table @samp
  7054. @item stack
  7055. Per color component graphs are placed below each other.
  7056. @item parade
  7057. Per color component graphs are placed side by side.
  7058. @item overlay
  7059. Presents information identical to that in the @code{parade}, except
  7060. that the graphs representing color components are superimposed directly
  7061. over one another.
  7062. @end table
  7063. Default is @code{stack}.
  7064. @item levels_mode
  7065. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  7066. Default is @code{linear}.
  7067. @item components
  7068. Set what color components to display.
  7069. Default is @code{7}.
  7070. @item fgopacity
  7071. Set foreground opacity. Default is @code{0.7}.
  7072. @item bgopacity
  7073. Set background opacity. Default is @code{0.5}.
  7074. @end table
  7075. @subsection Examples
  7076. @itemize
  7077. @item
  7078. Calculate and draw histogram:
  7079. @example
  7080. ffplay -i input -vf histogram
  7081. @end example
  7082. @end itemize
  7083. @anchor{hqdn3d}
  7084. @section hqdn3d
  7085. This is a high precision/quality 3d denoise filter. It aims to reduce
  7086. image noise, producing smooth images and making still images really
  7087. still. It should enhance compressibility.
  7088. It accepts the following optional parameters:
  7089. @table @option
  7090. @item luma_spatial
  7091. A non-negative floating point number which specifies spatial luma strength.
  7092. It defaults to 4.0.
  7093. @item chroma_spatial
  7094. A non-negative floating point number which specifies spatial chroma strength.
  7095. It defaults to 3.0*@var{luma_spatial}/4.0.
  7096. @item luma_tmp
  7097. A floating point number which specifies luma temporal strength. It defaults to
  7098. 6.0*@var{luma_spatial}/4.0.
  7099. @item chroma_tmp
  7100. A floating point number which specifies chroma temporal strength. It defaults to
  7101. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  7102. @end table
  7103. @section hwdownload
  7104. Download hardware frames to system memory.
  7105. The input must be in hardware frames, and the output a non-hardware format.
  7106. Not all formats will be supported on the output - it may be necessary to insert
  7107. an additional @option{format} filter immediately following in the graph to get
  7108. the output in a supported format.
  7109. @section hwmap
  7110. Map hardware frames to system memory or to another device.
  7111. This filter has several different modes of operation; which one is used depends
  7112. on the input and output formats:
  7113. @itemize
  7114. @item
  7115. Hardware frame input, normal frame output
  7116. Map the input frames to system memory and pass them to the output. If the
  7117. original hardware frame is later required (for example, after overlaying
  7118. something else on part of it), the @option{hwmap} filter can be used again
  7119. in the next mode to retrieve it.
  7120. @item
  7121. Normal frame input, hardware frame output
  7122. If the input is actually a software-mapped hardware frame, then unmap it -
  7123. that is, return the original hardware frame.
  7124. Otherwise, a device must be provided. Create new hardware surfaces on that
  7125. device for the output, then map them back to the software format at the input
  7126. and give those frames to the preceding filter. This will then act like the
  7127. @option{hwupload} filter, but may be able to avoid an additional copy when
  7128. the input is already in a compatible format.
  7129. @item
  7130. Hardware frame input and output
  7131. A device must be supplied for the output, either directly or with the
  7132. @option{derive_device} option. The input and output devices must be of
  7133. different types and compatible - the exact meaning of this is
  7134. system-dependent, but typically it means that they must refer to the same
  7135. underlying hardware context (for example, refer to the same graphics card).
  7136. If the input frames were originally created on the output device, then unmap
  7137. to retrieve the original frames.
  7138. Otherwise, map the frames to the output device - create new hardware frames
  7139. on the output corresponding to the frames on the input.
  7140. @end itemize
  7141. The following additional parameters are accepted:
  7142. @table @option
  7143. @item mode
  7144. Set the frame mapping mode. Some combination of:
  7145. @table @var
  7146. @item read
  7147. The mapped frame should be readable.
  7148. @item write
  7149. The mapped frame should be writeable.
  7150. @item overwrite
  7151. The mapping will always overwrite the entire frame.
  7152. This may improve performance in some cases, as the original contents of the
  7153. frame need not be loaded.
  7154. @item direct
  7155. The mapping must not involve any copying.
  7156. Indirect mappings to copies of frames are created in some cases where either
  7157. direct mapping is not possible or it would have unexpected properties.
  7158. Setting this flag ensures that the mapping is direct and will fail if that is
  7159. not possible.
  7160. @end table
  7161. Defaults to @var{read+write} if not specified.
  7162. @item derive_device @var{type}
  7163. Rather than using the device supplied at initialisation, instead derive a new
  7164. device of type @var{type} from the device the input frames exist on.
  7165. @item reverse
  7166. In a hardware to hardware mapping, map in reverse - create frames in the sink
  7167. and map them back to the source. This may be necessary in some cases where
  7168. a mapping in one direction is required but only the opposite direction is
  7169. supported by the devices being used.
  7170. This option is dangerous - it may break the preceding filter in undefined
  7171. ways if there are any additional constraints on that filter's output.
  7172. Do not use it without fully understanding the implications of its use.
  7173. @end table
  7174. @section hwupload
  7175. Upload system memory frames to hardware surfaces.
  7176. The device to upload to must be supplied when the filter is initialised. If
  7177. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  7178. option.
  7179. @anchor{hwupload_cuda}
  7180. @section hwupload_cuda
  7181. Upload system memory frames to a CUDA device.
  7182. It accepts the following optional parameters:
  7183. @table @option
  7184. @item device
  7185. The number of the CUDA device to use
  7186. @end table
  7187. @section hqx
  7188. Apply a high-quality magnification filter designed for pixel art. This filter
  7189. was originally created by Maxim Stepin.
  7190. It accepts the following option:
  7191. @table @option
  7192. @item n
  7193. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  7194. @code{hq3x} and @code{4} for @code{hq4x}.
  7195. Default is @code{3}.
  7196. @end table
  7197. @section hstack
  7198. Stack input videos horizontally.
  7199. All streams must be of same pixel format and of same height.
  7200. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  7201. to create same output.
  7202. The filter accept the following option:
  7203. @table @option
  7204. @item inputs
  7205. Set number of input streams. Default is 2.
  7206. @item shortest
  7207. If set to 1, force the output to terminate when the shortest input
  7208. terminates. Default value is 0.
  7209. @end table
  7210. @section hue
  7211. Modify the hue and/or the saturation of the input.
  7212. It accepts the following parameters:
  7213. @table @option
  7214. @item h
  7215. Specify the hue angle as a number of degrees. It accepts an expression,
  7216. and defaults to "0".
  7217. @item s
  7218. Specify the saturation in the [-10,10] range. It accepts an expression and
  7219. defaults to "1".
  7220. @item H
  7221. Specify the hue angle as a number of radians. It accepts an
  7222. expression, and defaults to "0".
  7223. @item b
  7224. Specify the brightness in the [-10,10] range. It accepts an expression and
  7225. defaults to "0".
  7226. @end table
  7227. @option{h} and @option{H} are mutually exclusive, and can't be
  7228. specified at the same time.
  7229. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  7230. expressions containing the following constants:
  7231. @table @option
  7232. @item n
  7233. frame count of the input frame starting from 0
  7234. @item pts
  7235. presentation timestamp of the input frame expressed in time base units
  7236. @item r
  7237. frame rate of the input video, NAN if the input frame rate is unknown
  7238. @item t
  7239. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7240. @item tb
  7241. time base of the input video
  7242. @end table
  7243. @subsection Examples
  7244. @itemize
  7245. @item
  7246. Set the hue to 90 degrees and the saturation to 1.0:
  7247. @example
  7248. hue=h=90:s=1
  7249. @end example
  7250. @item
  7251. Same command but expressing the hue in radians:
  7252. @example
  7253. hue=H=PI/2:s=1
  7254. @end example
  7255. @item
  7256. Rotate hue and make the saturation swing between 0
  7257. and 2 over a period of 1 second:
  7258. @example
  7259. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  7260. @end example
  7261. @item
  7262. Apply a 3 seconds saturation fade-in effect starting at 0:
  7263. @example
  7264. hue="s=min(t/3\,1)"
  7265. @end example
  7266. The general fade-in expression can be written as:
  7267. @example
  7268. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  7269. @end example
  7270. @item
  7271. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  7272. @example
  7273. hue="s=max(0\, min(1\, (8-t)/3))"
  7274. @end example
  7275. The general fade-out expression can be written as:
  7276. @example
  7277. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  7278. @end example
  7279. @end itemize
  7280. @subsection Commands
  7281. This filter supports the following commands:
  7282. @table @option
  7283. @item b
  7284. @item s
  7285. @item h
  7286. @item H
  7287. Modify the hue and/or the saturation and/or brightness of the input video.
  7288. The command accepts the same syntax of the corresponding option.
  7289. If the specified expression is not valid, it is kept at its current
  7290. value.
  7291. @end table
  7292. @section hysteresis
  7293. Grow first stream into second stream by connecting components.
  7294. This makes it possible to build more robust edge masks.
  7295. This filter accepts the following options:
  7296. @table @option
  7297. @item planes
  7298. Set which planes will be processed as bitmap, unprocessed planes will be
  7299. copied from first stream.
  7300. By default value 0xf, all planes will be processed.
  7301. @item threshold
  7302. Set threshold which is used in filtering. If pixel component value is higher than
  7303. this value filter algorithm for connecting components is activated.
  7304. By default value is 0.
  7305. @end table
  7306. @section idet
  7307. Detect video interlacing type.
  7308. This filter tries to detect if the input frames are interlaced, progressive,
  7309. top or bottom field first. It will also try to detect fields that are
  7310. repeated between adjacent frames (a sign of telecine).
  7311. Single frame detection considers only immediately adjacent frames when classifying each frame.
  7312. Multiple frame detection incorporates the classification history of previous frames.
  7313. The filter will log these metadata values:
  7314. @table @option
  7315. @item single.current_frame
  7316. Detected type of current frame using single-frame detection. One of:
  7317. ``tff'' (top field first), ``bff'' (bottom field first),
  7318. ``progressive'', or ``undetermined''
  7319. @item single.tff
  7320. Cumulative number of frames detected as top field first using single-frame detection.
  7321. @item multiple.tff
  7322. Cumulative number of frames detected as top field first using multiple-frame detection.
  7323. @item single.bff
  7324. Cumulative number of frames detected as bottom field first using single-frame detection.
  7325. @item multiple.current_frame
  7326. Detected type of current frame using multiple-frame detection. One of:
  7327. ``tff'' (top field first), ``bff'' (bottom field first),
  7328. ``progressive'', or ``undetermined''
  7329. @item multiple.bff
  7330. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  7331. @item single.progressive
  7332. Cumulative number of frames detected as progressive using single-frame detection.
  7333. @item multiple.progressive
  7334. Cumulative number of frames detected as progressive using multiple-frame detection.
  7335. @item single.undetermined
  7336. Cumulative number of frames that could not be classified using single-frame detection.
  7337. @item multiple.undetermined
  7338. Cumulative number of frames that could not be classified using multiple-frame detection.
  7339. @item repeated.current_frame
  7340. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  7341. @item repeated.neither
  7342. Cumulative number of frames with no repeated field.
  7343. @item repeated.top
  7344. Cumulative number of frames with the top field repeated from the previous frame's top field.
  7345. @item repeated.bottom
  7346. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  7347. @end table
  7348. The filter accepts the following options:
  7349. @table @option
  7350. @item intl_thres
  7351. Set interlacing threshold.
  7352. @item prog_thres
  7353. Set progressive threshold.
  7354. @item rep_thres
  7355. Threshold for repeated field detection.
  7356. @item half_life
  7357. Number of frames after which a given frame's contribution to the
  7358. statistics is halved (i.e., it contributes only 0.5 to its
  7359. classification). The default of 0 means that all frames seen are given
  7360. full weight of 1.0 forever.
  7361. @item analyze_interlaced_flag
  7362. When this is not 0 then idet will use the specified number of frames to determine
  7363. if the interlaced flag is accurate, it will not count undetermined frames.
  7364. If the flag is found to be accurate it will be used without any further
  7365. computations, if it is found to be inaccurate it will be cleared without any
  7366. further computations. This allows inserting the idet filter as a low computational
  7367. method to clean up the interlaced flag
  7368. @end table
  7369. @section il
  7370. Deinterleave or interleave fields.
  7371. This filter allows one to process interlaced images fields without
  7372. deinterlacing them. Deinterleaving splits the input frame into 2
  7373. fields (so called half pictures). Odd lines are moved to the top
  7374. half of the output image, even lines to the bottom half.
  7375. You can process (filter) them independently and then re-interleave them.
  7376. The filter accepts the following options:
  7377. @table @option
  7378. @item luma_mode, l
  7379. @item chroma_mode, c
  7380. @item alpha_mode, a
  7381. Available values for @var{luma_mode}, @var{chroma_mode} and
  7382. @var{alpha_mode} are:
  7383. @table @samp
  7384. @item none
  7385. Do nothing.
  7386. @item deinterleave, d
  7387. Deinterleave fields, placing one above the other.
  7388. @item interleave, i
  7389. Interleave fields. Reverse the effect of deinterleaving.
  7390. @end table
  7391. Default value is @code{none}.
  7392. @item luma_swap, ls
  7393. @item chroma_swap, cs
  7394. @item alpha_swap, as
  7395. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  7396. @end table
  7397. @section inflate
  7398. Apply inflate effect to the video.
  7399. This filter replaces the pixel by the local(3x3) average by taking into account
  7400. only values higher than the pixel.
  7401. It accepts the following options:
  7402. @table @option
  7403. @item threshold0
  7404. @item threshold1
  7405. @item threshold2
  7406. @item threshold3
  7407. Limit the maximum change for each plane, default is 65535.
  7408. If 0, plane will remain unchanged.
  7409. @end table
  7410. @section interlace
  7411. Simple interlacing filter from progressive contents. This interleaves upper (or
  7412. lower) lines from odd frames with lower (or upper) lines from even frames,
  7413. halving the frame rate and preserving image height.
  7414. @example
  7415. Original Original New Frame
  7416. Frame 'j' Frame 'j+1' (tff)
  7417. ========== =========== ==================
  7418. Line 0 --------------------> Frame 'j' Line 0
  7419. Line 1 Line 1 ----> Frame 'j+1' Line 1
  7420. Line 2 ---------------------> Frame 'j' Line 2
  7421. Line 3 Line 3 ----> Frame 'j+1' Line 3
  7422. ... ... ...
  7423. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  7424. @end example
  7425. It accepts the following optional parameters:
  7426. @table @option
  7427. @item scan
  7428. This determines whether the interlaced frame is taken from the even
  7429. (tff - default) or odd (bff) lines of the progressive frame.
  7430. @item lowpass
  7431. Vertical lowpass filter to avoid twitter interlacing and
  7432. reduce moire patterns.
  7433. @table @samp
  7434. @item 0, off
  7435. Disable vertical lowpass filter
  7436. @item 1, linear
  7437. Enable linear filter (default)
  7438. @item 2, complex
  7439. Enable complex filter. This will slightly less reduce twitter and moire
  7440. but better retain detail and subjective sharpness impression.
  7441. @end table
  7442. @end table
  7443. @section kerndeint
  7444. Deinterlace input video by applying Donald Graft's adaptive kernel
  7445. deinterling. Work on interlaced parts of a video to produce
  7446. progressive frames.
  7447. The description of the accepted parameters follows.
  7448. @table @option
  7449. @item thresh
  7450. Set the threshold which affects the filter's tolerance when
  7451. determining if a pixel line must be processed. It must be an integer
  7452. in the range [0,255] and defaults to 10. A value of 0 will result in
  7453. applying the process on every pixels.
  7454. @item map
  7455. Paint pixels exceeding the threshold value to white if set to 1.
  7456. Default is 0.
  7457. @item order
  7458. Set the fields order. Swap fields if set to 1, leave fields alone if
  7459. 0. Default is 0.
  7460. @item sharp
  7461. Enable additional sharpening if set to 1. Default is 0.
  7462. @item twoway
  7463. Enable twoway sharpening if set to 1. Default is 0.
  7464. @end table
  7465. @subsection Examples
  7466. @itemize
  7467. @item
  7468. Apply default values:
  7469. @example
  7470. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  7471. @end example
  7472. @item
  7473. Enable additional sharpening:
  7474. @example
  7475. kerndeint=sharp=1
  7476. @end example
  7477. @item
  7478. Paint processed pixels in white:
  7479. @example
  7480. kerndeint=map=1
  7481. @end example
  7482. @end itemize
  7483. @section lenscorrection
  7484. Correct radial lens distortion
  7485. This filter can be used to correct for radial distortion as can result from the use
  7486. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  7487. one can use tools available for example as part of opencv or simply trial-and-error.
  7488. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  7489. and extract the k1 and k2 coefficients from the resulting matrix.
  7490. Note that effectively the same filter is available in the open-source tools Krita and
  7491. Digikam from the KDE project.
  7492. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  7493. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  7494. brightness distribution, so you may want to use both filters together in certain
  7495. cases, though you will have to take care of ordering, i.e. whether vignetting should
  7496. be applied before or after lens correction.
  7497. @subsection Options
  7498. The filter accepts the following options:
  7499. @table @option
  7500. @item cx
  7501. Relative x-coordinate of the focal point of the image, and thereby the center of the
  7502. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7503. width.
  7504. @item cy
  7505. Relative y-coordinate of the focal point of the image, and thereby the center of the
  7506. distortion. This value has a range [0,1] and is expressed as fractions of the image
  7507. height.
  7508. @item k1
  7509. Coefficient of the quadratic correction term. 0.5 means no correction.
  7510. @item k2
  7511. Coefficient of the double quadratic correction term. 0.5 means no correction.
  7512. @end table
  7513. The formula that generates the correction is:
  7514. @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)
  7515. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  7516. distances from the focal point in the source and target images, respectively.
  7517. @section libvmaf
  7518. Obtain the average VMAF (Video Multi-Method Assessment Fusion)
  7519. score between two input videos.
  7520. This filter takes two input videos.
  7521. Both video inputs must have the same resolution and pixel format for
  7522. this filter to work correctly. Also it assumes that both inputs
  7523. have the same number of frames, which are compared one by one.
  7524. The obtained average VMAF score is printed through the logging system.
  7525. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  7526. After installing the library it can be enabled using:
  7527. @code{./configure --enable-libvmaf}.
  7528. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  7529. On the below examples the input file @file{main.mpg} being processed is
  7530. compared with the reference file @file{ref.mpg}.
  7531. The filter has following options:
  7532. @table @option
  7533. @item model_path
  7534. Set the model path which is to be used for SVM.
  7535. Default value: @code{"vmaf_v0.6.1.pkl"}
  7536. @item log_path
  7537. Set the file path to be used to store logs.
  7538. @item log_fmt
  7539. Set the format of the log file (xml or json).
  7540. @item enable_transform
  7541. Enables transform for computing vmaf.
  7542. @item phone_model
  7543. Invokes the phone model which will generate VMAF scores higher than in the
  7544. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  7545. @item psnr
  7546. Enables computing psnr along with vmaf.
  7547. @item ssim
  7548. Enables computing ssim along with vmaf.
  7549. @item ms_ssim
  7550. Enables computing ms_ssim along with vmaf.
  7551. @item pool
  7552. Set the pool method to be used for computing vmaf.
  7553. @end table
  7554. This filter also supports the @ref{framesync} options.
  7555. For example:
  7556. @example
  7557. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  7558. @end example
  7559. Example with options:
  7560. @example
  7561. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
  7562. @end example
  7563. @section limiter
  7564. Limits the pixel components values to the specified range [min, max].
  7565. The filter accepts the following options:
  7566. @table @option
  7567. @item min
  7568. Lower bound. Defaults to the lowest allowed value for the input.
  7569. @item max
  7570. Upper bound. Defaults to the highest allowed value for the input.
  7571. @item planes
  7572. Specify which planes will be processed. Defaults to all available.
  7573. @end table
  7574. @section loop
  7575. Loop video frames.
  7576. The filter accepts the following options:
  7577. @table @option
  7578. @item loop
  7579. Set the number of loops.
  7580. @item size
  7581. Set maximal size in number of frames.
  7582. @item start
  7583. Set first frame of loop.
  7584. @end table
  7585. @anchor{lut3d}
  7586. @section lut3d
  7587. Apply a 3D LUT to an input video.
  7588. The filter accepts the following options:
  7589. @table @option
  7590. @item file
  7591. Set the 3D LUT file name.
  7592. Currently supported formats:
  7593. @table @samp
  7594. @item 3dl
  7595. AfterEffects
  7596. @item cube
  7597. Iridas
  7598. @item dat
  7599. DaVinci
  7600. @item m3d
  7601. Pandora
  7602. @end table
  7603. @item interp
  7604. Select interpolation mode.
  7605. Available values are:
  7606. @table @samp
  7607. @item nearest
  7608. Use values from the nearest defined point.
  7609. @item trilinear
  7610. Interpolate values using the 8 points defining a cube.
  7611. @item tetrahedral
  7612. Interpolate values using a tetrahedron.
  7613. @end table
  7614. @end table
  7615. This filter also supports the @ref{framesync} options.
  7616. @section lumakey
  7617. Turn certain luma values into transparency.
  7618. The filter accepts the following options:
  7619. @table @option
  7620. @item threshold
  7621. Set the luma which will be used as base for transparency.
  7622. Default value is @code{0}.
  7623. @item tolerance
  7624. Set the range of luma values to be keyed out.
  7625. Default value is @code{0}.
  7626. @item softness
  7627. Set the range of softness. Default value is @code{0}.
  7628. Use this to control gradual transition from zero to full transparency.
  7629. @end table
  7630. @section lut, lutrgb, lutyuv
  7631. Compute a look-up table for binding each pixel component input value
  7632. to an output value, and apply it to the input video.
  7633. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  7634. to an RGB input video.
  7635. These filters accept the following parameters:
  7636. @table @option
  7637. @item c0
  7638. set first pixel component expression
  7639. @item c1
  7640. set second pixel component expression
  7641. @item c2
  7642. set third pixel component expression
  7643. @item c3
  7644. set fourth pixel component expression, corresponds to the alpha component
  7645. @item r
  7646. set red component expression
  7647. @item g
  7648. set green component expression
  7649. @item b
  7650. set blue component expression
  7651. @item a
  7652. alpha component expression
  7653. @item y
  7654. set Y/luminance component expression
  7655. @item u
  7656. set U/Cb component expression
  7657. @item v
  7658. set V/Cr component expression
  7659. @end table
  7660. Each of them specifies the expression to use for computing the lookup table for
  7661. the corresponding pixel component values.
  7662. The exact component associated to each of the @var{c*} options depends on the
  7663. format in input.
  7664. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  7665. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  7666. The expressions can contain the following constants and functions:
  7667. @table @option
  7668. @item w
  7669. @item h
  7670. The input width and height.
  7671. @item val
  7672. The input value for the pixel component.
  7673. @item clipval
  7674. The input value, clipped to the @var{minval}-@var{maxval} range.
  7675. @item maxval
  7676. The maximum value for the pixel component.
  7677. @item minval
  7678. The minimum value for the pixel component.
  7679. @item negval
  7680. The negated value for the pixel component value, clipped to the
  7681. @var{minval}-@var{maxval} range; it corresponds to the expression
  7682. "maxval-clipval+minval".
  7683. @item clip(val)
  7684. The computed value in @var{val}, clipped to the
  7685. @var{minval}-@var{maxval} range.
  7686. @item gammaval(gamma)
  7687. The computed gamma correction value of the pixel component value,
  7688. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  7689. expression
  7690. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  7691. @end table
  7692. All expressions default to "val".
  7693. @subsection Examples
  7694. @itemize
  7695. @item
  7696. Negate input video:
  7697. @example
  7698. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  7699. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  7700. @end example
  7701. The above is the same as:
  7702. @example
  7703. lutrgb="r=negval:g=negval:b=negval"
  7704. lutyuv="y=negval:u=negval:v=negval"
  7705. @end example
  7706. @item
  7707. Negate luminance:
  7708. @example
  7709. lutyuv=y=negval
  7710. @end example
  7711. @item
  7712. Remove chroma components, turning the video into a graytone image:
  7713. @example
  7714. lutyuv="u=128:v=128"
  7715. @end example
  7716. @item
  7717. Apply a luma burning effect:
  7718. @example
  7719. lutyuv="y=2*val"
  7720. @end example
  7721. @item
  7722. Remove green and blue components:
  7723. @example
  7724. lutrgb="g=0:b=0"
  7725. @end example
  7726. @item
  7727. Set a constant alpha channel value on input:
  7728. @example
  7729. format=rgba,lutrgb=a="maxval-minval/2"
  7730. @end example
  7731. @item
  7732. Correct luminance gamma by a factor of 0.5:
  7733. @example
  7734. lutyuv=y=gammaval(0.5)
  7735. @end example
  7736. @item
  7737. Discard least significant bits of luma:
  7738. @example
  7739. lutyuv=y='bitand(val, 128+64+32)'
  7740. @end example
  7741. @item
  7742. Technicolor like effect:
  7743. @example
  7744. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  7745. @end example
  7746. @end itemize
  7747. @section lut2, tlut2
  7748. The @code{lut2} filter takes two input streams and outputs one
  7749. stream.
  7750. The @code{tlut2} (time lut2) filter takes two consecutive frames
  7751. from one single stream.
  7752. This filter accepts the following parameters:
  7753. @table @option
  7754. @item c0
  7755. set first pixel component expression
  7756. @item c1
  7757. set second pixel component expression
  7758. @item c2
  7759. set third pixel component expression
  7760. @item c3
  7761. set fourth pixel component expression, corresponds to the alpha component
  7762. @end table
  7763. Each of them specifies the expression to use for computing the lookup table for
  7764. the corresponding pixel component values.
  7765. The exact component associated to each of the @var{c*} options depends on the
  7766. format in inputs.
  7767. The expressions can contain the following constants:
  7768. @table @option
  7769. @item w
  7770. @item h
  7771. The input width and height.
  7772. @item x
  7773. The first input value for the pixel component.
  7774. @item y
  7775. The second input value for the pixel component.
  7776. @item bdx
  7777. The first input video bit depth.
  7778. @item bdy
  7779. The second input video bit depth.
  7780. @end table
  7781. All expressions default to "x".
  7782. @subsection Examples
  7783. @itemize
  7784. @item
  7785. Highlight differences between two RGB video streams:
  7786. @example
  7787. 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)'
  7788. @end example
  7789. @item
  7790. Highlight differences between two YUV video streams:
  7791. @example
  7792. 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)'
  7793. @end example
  7794. @item
  7795. Show max difference between two video streams:
  7796. @example
  7797. 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)))'
  7798. @end example
  7799. @end itemize
  7800. @section maskedclamp
  7801. Clamp the first input stream with the second input and third input stream.
  7802. Returns the value of first stream to be between second input
  7803. stream - @code{undershoot} and third input stream + @code{overshoot}.
  7804. This filter accepts the following options:
  7805. @table @option
  7806. @item undershoot
  7807. Default value is @code{0}.
  7808. @item overshoot
  7809. Default value is @code{0}.
  7810. @item planes
  7811. Set which planes will be processed as bitmap, unprocessed planes will be
  7812. copied from first stream.
  7813. By default value 0xf, all planes will be processed.
  7814. @end table
  7815. @section maskedmerge
  7816. Merge the first input stream with the second input stream using per pixel
  7817. weights in the third input stream.
  7818. A value of 0 in the third stream pixel component means that pixel component
  7819. from first stream is returned unchanged, while maximum value (eg. 255 for
  7820. 8-bit videos) means that pixel component from second stream is returned
  7821. unchanged. Intermediate values define the amount of merging between both
  7822. input stream's pixel components.
  7823. This filter accepts the following options:
  7824. @table @option
  7825. @item planes
  7826. Set which planes will be processed as bitmap, unprocessed planes will be
  7827. copied from first stream.
  7828. By default value 0xf, all planes will be processed.
  7829. @end table
  7830. @section mcdeint
  7831. Apply motion-compensation deinterlacing.
  7832. It needs one field per frame as input and must thus be used together
  7833. with yadif=1/3 or equivalent.
  7834. This filter accepts the following options:
  7835. @table @option
  7836. @item mode
  7837. Set the deinterlacing mode.
  7838. It accepts one of the following values:
  7839. @table @samp
  7840. @item fast
  7841. @item medium
  7842. @item slow
  7843. use iterative motion estimation
  7844. @item extra_slow
  7845. like @samp{slow}, but use multiple reference frames.
  7846. @end table
  7847. Default value is @samp{fast}.
  7848. @item parity
  7849. Set the picture field parity assumed for the input video. It must be
  7850. one of the following values:
  7851. @table @samp
  7852. @item 0, tff
  7853. assume top field first
  7854. @item 1, bff
  7855. assume bottom field first
  7856. @end table
  7857. Default value is @samp{bff}.
  7858. @item qp
  7859. Set per-block quantization parameter (QP) used by the internal
  7860. encoder.
  7861. Higher values should result in a smoother motion vector field but less
  7862. optimal individual vectors. Default value is 1.
  7863. @end table
  7864. @section mergeplanes
  7865. Merge color channel components from several video streams.
  7866. The filter accepts up to 4 input streams, and merge selected input
  7867. planes to the output video.
  7868. This filter accepts the following options:
  7869. @table @option
  7870. @item mapping
  7871. Set input to output plane mapping. Default is @code{0}.
  7872. The mappings is specified as a bitmap. It should be specified as a
  7873. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  7874. mapping for the first plane of the output stream. 'A' sets the number of
  7875. the input stream to use (from 0 to 3), and 'a' the plane number of the
  7876. corresponding input to use (from 0 to 3). The rest of the mappings is
  7877. similar, 'Bb' describes the mapping for the output stream second
  7878. plane, 'Cc' describes the mapping for the output stream third plane and
  7879. 'Dd' describes the mapping for the output stream fourth plane.
  7880. @item format
  7881. Set output pixel format. Default is @code{yuva444p}.
  7882. @end table
  7883. @subsection Examples
  7884. @itemize
  7885. @item
  7886. Merge three gray video streams of same width and height into single video stream:
  7887. @example
  7888. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  7889. @end example
  7890. @item
  7891. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  7892. @example
  7893. [a0][a1]mergeplanes=0x00010210:yuva444p
  7894. @end example
  7895. @item
  7896. Swap Y and A plane in yuva444p stream:
  7897. @example
  7898. format=yuva444p,mergeplanes=0x03010200:yuva444p
  7899. @end example
  7900. @item
  7901. Swap U and V plane in yuv420p stream:
  7902. @example
  7903. format=yuv420p,mergeplanes=0x000201:yuv420p
  7904. @end example
  7905. @item
  7906. Cast a rgb24 clip to yuv444p:
  7907. @example
  7908. format=rgb24,mergeplanes=0x000102:yuv444p
  7909. @end example
  7910. @end itemize
  7911. @section mestimate
  7912. Estimate and export motion vectors using block matching algorithms.
  7913. Motion vectors are stored in frame side data to be used by other filters.
  7914. This filter accepts the following options:
  7915. @table @option
  7916. @item method
  7917. Specify the motion estimation method. Accepts one of the following values:
  7918. @table @samp
  7919. @item esa
  7920. Exhaustive search algorithm.
  7921. @item tss
  7922. Three step search algorithm.
  7923. @item tdls
  7924. Two dimensional logarithmic search algorithm.
  7925. @item ntss
  7926. New three step search algorithm.
  7927. @item fss
  7928. Four step search algorithm.
  7929. @item ds
  7930. Diamond search algorithm.
  7931. @item hexbs
  7932. Hexagon-based search algorithm.
  7933. @item epzs
  7934. Enhanced predictive zonal search algorithm.
  7935. @item umh
  7936. Uneven multi-hexagon search algorithm.
  7937. @end table
  7938. Default value is @samp{esa}.
  7939. @item mb_size
  7940. Macroblock size. Default @code{16}.
  7941. @item search_param
  7942. Search parameter. Default @code{7}.
  7943. @end table
  7944. @section midequalizer
  7945. Apply Midway Image Equalization effect using two video streams.
  7946. Midway Image Equalization adjusts a pair of images to have the same
  7947. histogram, while maintaining their dynamics as much as possible. It's
  7948. useful for e.g. matching exposures from a pair of stereo cameras.
  7949. This filter has two inputs and one output, which must be of same pixel format, but
  7950. may be of different sizes. The output of filter is first input adjusted with
  7951. midway histogram of both inputs.
  7952. This filter accepts the following option:
  7953. @table @option
  7954. @item planes
  7955. Set which planes to process. Default is @code{15}, which is all available planes.
  7956. @end table
  7957. @section minterpolate
  7958. Convert the video to specified frame rate using motion interpolation.
  7959. This filter accepts the following options:
  7960. @table @option
  7961. @item fps
  7962. 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}.
  7963. @item mi_mode
  7964. Motion interpolation mode. Following values are accepted:
  7965. @table @samp
  7966. @item dup
  7967. Duplicate previous or next frame for interpolating new ones.
  7968. @item blend
  7969. Blend source frames. Interpolated frame is mean of previous and next frames.
  7970. @item mci
  7971. Motion compensated interpolation. Following options are effective when this mode is selected:
  7972. @table @samp
  7973. @item mc_mode
  7974. Motion compensation mode. Following values are accepted:
  7975. @table @samp
  7976. @item obmc
  7977. Overlapped block motion compensation.
  7978. @item aobmc
  7979. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  7980. @end table
  7981. Default mode is @samp{obmc}.
  7982. @item me_mode
  7983. Motion estimation mode. Following values are accepted:
  7984. @table @samp
  7985. @item bidir
  7986. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  7987. @item bilat
  7988. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  7989. @end table
  7990. Default mode is @samp{bilat}.
  7991. @item me
  7992. The algorithm to be used for motion estimation. Following values are accepted:
  7993. @table @samp
  7994. @item esa
  7995. Exhaustive search algorithm.
  7996. @item tss
  7997. Three step search algorithm.
  7998. @item tdls
  7999. Two dimensional logarithmic search algorithm.
  8000. @item ntss
  8001. New three step search algorithm.
  8002. @item fss
  8003. Four step search algorithm.
  8004. @item ds
  8005. Diamond search algorithm.
  8006. @item hexbs
  8007. Hexagon-based search algorithm.
  8008. @item epzs
  8009. Enhanced predictive zonal search algorithm.
  8010. @item umh
  8011. Uneven multi-hexagon search algorithm.
  8012. @end table
  8013. Default algorithm is @samp{epzs}.
  8014. @item mb_size
  8015. Macroblock size. Default @code{16}.
  8016. @item search_param
  8017. Motion estimation search parameter. Default @code{32}.
  8018. @item vsbmc
  8019. 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).
  8020. @end table
  8021. @end table
  8022. @item scd
  8023. 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:
  8024. @table @samp
  8025. @item none
  8026. Disable scene change detection.
  8027. @item fdiff
  8028. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  8029. @end table
  8030. Default method is @samp{fdiff}.
  8031. @item scd_threshold
  8032. Scene change detection threshold. Default is @code{5.0}.
  8033. @end table
  8034. @section mpdecimate
  8035. Drop frames that do not differ greatly from the previous frame in
  8036. order to reduce frame rate.
  8037. The main use of this filter is for very-low-bitrate encoding
  8038. (e.g. streaming over dialup modem), but it could in theory be used for
  8039. fixing movies that were inverse-telecined incorrectly.
  8040. A description of the accepted options follows.
  8041. @table @option
  8042. @item max
  8043. Set the maximum number of consecutive frames which can be dropped (if
  8044. positive), or the minimum interval between dropped frames (if
  8045. negative). If the value is 0, the frame is dropped unregarding the
  8046. number of previous sequentially dropped frames.
  8047. Default value is 0.
  8048. @item hi
  8049. @item lo
  8050. @item frac
  8051. Set the dropping threshold values.
  8052. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  8053. represent actual pixel value differences, so a threshold of 64
  8054. corresponds to 1 unit of difference for each pixel, or the same spread
  8055. out differently over the block.
  8056. A frame is a candidate for dropping if no 8x8 blocks differ by more
  8057. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  8058. meaning the whole image) differ by more than a threshold of @option{lo}.
  8059. Default value for @option{hi} is 64*12, default value for @option{lo} is
  8060. 64*5, and default value for @option{frac} is 0.33.
  8061. @end table
  8062. @section negate
  8063. Negate input video.
  8064. It accepts an integer in input; if non-zero it negates the
  8065. alpha component (if available). The default value in input is 0.
  8066. @section nlmeans
  8067. Denoise frames using Non-Local Means algorithm.
  8068. Each pixel is adjusted by looking for other pixels with similar contexts. This
  8069. context similarity is defined by comparing their surrounding patches of size
  8070. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  8071. around the pixel.
  8072. Note that the research area defines centers for patches, which means some
  8073. patches will be made of pixels outside that research area.
  8074. The filter accepts the following options.
  8075. @table @option
  8076. @item s
  8077. Set denoising strength.
  8078. @item p
  8079. Set patch size.
  8080. @item pc
  8081. Same as @option{p} but for chroma planes.
  8082. The default value is @var{0} and means automatic.
  8083. @item r
  8084. Set research size.
  8085. @item rc
  8086. Same as @option{r} but for chroma planes.
  8087. The default value is @var{0} and means automatic.
  8088. @end table
  8089. @section nnedi
  8090. Deinterlace video using neural network edge directed interpolation.
  8091. This filter accepts the following options:
  8092. @table @option
  8093. @item weights
  8094. Mandatory option, without binary file filter can not work.
  8095. Currently file can be found here:
  8096. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  8097. @item deint
  8098. Set which frames to deinterlace, by default it is @code{all}.
  8099. Can be @code{all} or @code{interlaced}.
  8100. @item field
  8101. Set mode of operation.
  8102. Can be one of the following:
  8103. @table @samp
  8104. @item af
  8105. Use frame flags, both fields.
  8106. @item a
  8107. Use frame flags, single field.
  8108. @item t
  8109. Use top field only.
  8110. @item b
  8111. Use bottom field only.
  8112. @item tf
  8113. Use both fields, top first.
  8114. @item bf
  8115. Use both fields, bottom first.
  8116. @end table
  8117. @item planes
  8118. Set which planes to process, by default filter process all frames.
  8119. @item nsize
  8120. Set size of local neighborhood around each pixel, used by the predictor neural
  8121. network.
  8122. Can be one of the following:
  8123. @table @samp
  8124. @item s8x6
  8125. @item s16x6
  8126. @item s32x6
  8127. @item s48x6
  8128. @item s8x4
  8129. @item s16x4
  8130. @item s32x4
  8131. @end table
  8132. @item nns
  8133. Set the number of neurons in predicctor neural network.
  8134. Can be one of the following:
  8135. @table @samp
  8136. @item n16
  8137. @item n32
  8138. @item n64
  8139. @item n128
  8140. @item n256
  8141. @end table
  8142. @item qual
  8143. Controls the number of different neural network predictions that are blended
  8144. together to compute the final output value. Can be @code{fast}, default or
  8145. @code{slow}.
  8146. @item etype
  8147. Set which set of weights to use in the predictor.
  8148. Can be one of the following:
  8149. @table @samp
  8150. @item a
  8151. weights trained to minimize absolute error
  8152. @item s
  8153. weights trained to minimize squared error
  8154. @end table
  8155. @item pscrn
  8156. Controls whether or not the prescreener neural network is used to decide
  8157. which pixels should be processed by the predictor neural network and which
  8158. can be handled by simple cubic interpolation.
  8159. The prescreener is trained to know whether cubic interpolation will be
  8160. sufficient for a pixel or whether it should be predicted by the predictor nn.
  8161. The computational complexity of the prescreener nn is much less than that of
  8162. the predictor nn. Since most pixels can be handled by cubic interpolation,
  8163. using the prescreener generally results in much faster processing.
  8164. The prescreener is pretty accurate, so the difference between using it and not
  8165. using it is almost always unnoticeable.
  8166. Can be one of the following:
  8167. @table @samp
  8168. @item none
  8169. @item original
  8170. @item new
  8171. @end table
  8172. Default is @code{new}.
  8173. @item fapprox
  8174. Set various debugging flags.
  8175. @end table
  8176. @section noformat
  8177. Force libavfilter not to use any of the specified pixel formats for the
  8178. input to the next filter.
  8179. It accepts the following parameters:
  8180. @table @option
  8181. @item pix_fmts
  8182. A '|'-separated list of pixel format names, such as
  8183. apix_fmts=yuv420p|monow|rgb24".
  8184. @end table
  8185. @subsection Examples
  8186. @itemize
  8187. @item
  8188. Force libavfilter to use a format different from @var{yuv420p} for the
  8189. input to the vflip filter:
  8190. @example
  8191. noformat=pix_fmts=yuv420p,vflip
  8192. @end example
  8193. @item
  8194. Convert the input video to any of the formats not contained in the list:
  8195. @example
  8196. noformat=yuv420p|yuv444p|yuv410p
  8197. @end example
  8198. @end itemize
  8199. @section noise
  8200. Add noise on video input frame.
  8201. The filter accepts the following options:
  8202. @table @option
  8203. @item all_seed
  8204. @item c0_seed
  8205. @item c1_seed
  8206. @item c2_seed
  8207. @item c3_seed
  8208. Set noise seed for specific pixel component or all pixel components in case
  8209. of @var{all_seed}. Default value is @code{123457}.
  8210. @item all_strength, alls
  8211. @item c0_strength, c0s
  8212. @item c1_strength, c1s
  8213. @item c2_strength, c2s
  8214. @item c3_strength, c3s
  8215. Set noise strength for specific pixel component or all pixel components in case
  8216. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  8217. @item all_flags, allf
  8218. @item c0_flags, c0f
  8219. @item c1_flags, c1f
  8220. @item c2_flags, c2f
  8221. @item c3_flags, c3f
  8222. Set pixel component flags or set flags for all components if @var{all_flags}.
  8223. Available values for component flags are:
  8224. @table @samp
  8225. @item a
  8226. averaged temporal noise (smoother)
  8227. @item p
  8228. mix random noise with a (semi)regular pattern
  8229. @item t
  8230. temporal noise (noise pattern changes between frames)
  8231. @item u
  8232. uniform noise (gaussian otherwise)
  8233. @end table
  8234. @end table
  8235. @subsection Examples
  8236. Add temporal and uniform noise to input video:
  8237. @example
  8238. noise=alls=20:allf=t+u
  8239. @end example
  8240. @section null
  8241. Pass the video source unchanged to the output.
  8242. @section ocr
  8243. Optical Character Recognition
  8244. This filter uses Tesseract for optical character recognition.
  8245. It accepts the following options:
  8246. @table @option
  8247. @item datapath
  8248. Set datapath to tesseract data. Default is to use whatever was
  8249. set at installation.
  8250. @item language
  8251. Set language, default is "eng".
  8252. @item whitelist
  8253. Set character whitelist.
  8254. @item blacklist
  8255. Set character blacklist.
  8256. @end table
  8257. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  8258. @section ocv
  8259. Apply a video transform using libopencv.
  8260. To enable this filter, install the libopencv library and headers and
  8261. configure FFmpeg with @code{--enable-libopencv}.
  8262. It accepts the following parameters:
  8263. @table @option
  8264. @item filter_name
  8265. The name of the libopencv filter to apply.
  8266. @item filter_params
  8267. The parameters to pass to the libopencv filter. If not specified, the default
  8268. values are assumed.
  8269. @end table
  8270. Refer to the official libopencv documentation for more precise
  8271. information:
  8272. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  8273. Several libopencv filters are supported; see the following subsections.
  8274. @anchor{dilate}
  8275. @subsection dilate
  8276. Dilate an image by using a specific structuring element.
  8277. It corresponds to the libopencv function @code{cvDilate}.
  8278. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  8279. @var{struct_el} represents a structuring element, and has the syntax:
  8280. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  8281. @var{cols} and @var{rows} represent the number of columns and rows of
  8282. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  8283. point, and @var{shape} the shape for the structuring element. @var{shape}
  8284. must be "rect", "cross", "ellipse", or "custom".
  8285. If the value for @var{shape} is "custom", it must be followed by a
  8286. string of the form "=@var{filename}". The file with name
  8287. @var{filename} is assumed to represent a binary image, with each
  8288. printable character corresponding to a bright pixel. When a custom
  8289. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  8290. or columns and rows of the read file are assumed instead.
  8291. The default value for @var{struct_el} is "3x3+0x0/rect".
  8292. @var{nb_iterations} specifies the number of times the transform is
  8293. applied to the image, and defaults to 1.
  8294. Some examples:
  8295. @example
  8296. # Use the default values
  8297. ocv=dilate
  8298. # Dilate using a structuring element with a 5x5 cross, iterating two times
  8299. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  8300. # Read the shape from the file diamond.shape, iterating two times.
  8301. # The file diamond.shape may contain a pattern of characters like this
  8302. # *
  8303. # ***
  8304. # *****
  8305. # ***
  8306. # *
  8307. # The specified columns and rows are ignored
  8308. # but the anchor point coordinates are not
  8309. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  8310. @end example
  8311. @subsection erode
  8312. Erode an image by using a specific structuring element.
  8313. It corresponds to the libopencv function @code{cvErode}.
  8314. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  8315. with the same syntax and semantics as the @ref{dilate} filter.
  8316. @subsection smooth
  8317. Smooth the input video.
  8318. The filter takes the following parameters:
  8319. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  8320. @var{type} is the type of smooth filter to apply, and must be one of
  8321. the following values: "blur", "blur_no_scale", "median", "gaussian",
  8322. or "bilateral". The default value is "gaussian".
  8323. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  8324. depend on the smooth type. @var{param1} and
  8325. @var{param2} accept integer positive values or 0. @var{param3} and
  8326. @var{param4} accept floating point values.
  8327. The default value for @var{param1} is 3. The default value for the
  8328. other parameters is 0.
  8329. These parameters correspond to the parameters assigned to the
  8330. libopencv function @code{cvSmooth}.
  8331. @section oscilloscope
  8332. 2D Video Oscilloscope.
  8333. Useful to measure spatial impulse, step responses, chroma delays, etc.
  8334. It accepts the following parameters:
  8335. @table @option
  8336. @item x
  8337. Set scope center x position.
  8338. @item y
  8339. Set scope center y position.
  8340. @item s
  8341. Set scope size, relative to frame diagonal.
  8342. @item t
  8343. Set scope tilt/rotation.
  8344. @item o
  8345. Set trace opacity.
  8346. @item tx
  8347. Set trace center x position.
  8348. @item ty
  8349. Set trace center y position.
  8350. @item tw
  8351. Set trace width, relative to width of frame.
  8352. @item th
  8353. Set trace height, relative to height of frame.
  8354. @item c
  8355. Set which components to trace. By default it traces first three components.
  8356. @item g
  8357. Draw trace grid. By default is enabled.
  8358. @item st
  8359. Draw some statistics. By default is enabled.
  8360. @item sc
  8361. Draw scope. By default is enabled.
  8362. @end table
  8363. @subsection Examples
  8364. @itemize
  8365. @item
  8366. Inspect full first row of video frame.
  8367. @example
  8368. oscilloscope=x=0.5:y=0:s=1
  8369. @end example
  8370. @item
  8371. Inspect full last row of video frame.
  8372. @example
  8373. oscilloscope=x=0.5:y=1:s=1
  8374. @end example
  8375. @item
  8376. Inspect full 5th line of video frame of height 1080.
  8377. @example
  8378. oscilloscope=x=0.5:y=5/1080:s=1
  8379. @end example
  8380. @item
  8381. Inspect full last column of video frame.
  8382. @example
  8383. oscilloscope=x=1:y=0.5:s=1:t=1
  8384. @end example
  8385. @end itemize
  8386. @anchor{overlay}
  8387. @section overlay
  8388. Overlay one video on top of another.
  8389. It takes two inputs and has one output. The first input is the "main"
  8390. video on which the second input is overlaid.
  8391. It accepts the following parameters:
  8392. A description of the accepted options follows.
  8393. @table @option
  8394. @item x
  8395. @item y
  8396. Set the expression for the x and y coordinates of the overlaid video
  8397. on the main video. Default value is "0" for both expressions. In case
  8398. the expression is invalid, it is set to a huge value (meaning that the
  8399. overlay will not be displayed within the output visible area).
  8400. @item eof_action
  8401. See @ref{framesync}.
  8402. @item eval
  8403. Set when the expressions for @option{x}, and @option{y} are evaluated.
  8404. It accepts the following values:
  8405. @table @samp
  8406. @item init
  8407. only evaluate expressions once during the filter initialization or
  8408. when a command is processed
  8409. @item frame
  8410. evaluate expressions for each incoming frame
  8411. @end table
  8412. Default value is @samp{frame}.
  8413. @item shortest
  8414. See @ref{framesync}.
  8415. @item format
  8416. Set the format for the output video.
  8417. It accepts the following values:
  8418. @table @samp
  8419. @item yuv420
  8420. force YUV420 output
  8421. @item yuv422
  8422. force YUV422 output
  8423. @item yuv444
  8424. force YUV444 output
  8425. @item rgb
  8426. force packed RGB output
  8427. @item gbrp
  8428. force planar RGB output
  8429. @item auto
  8430. automatically pick format
  8431. @end table
  8432. Default value is @samp{yuv420}.
  8433. @item repeatlast
  8434. See @ref{framesync}.
  8435. @end table
  8436. The @option{x}, and @option{y} expressions can contain the following
  8437. parameters.
  8438. @table @option
  8439. @item main_w, W
  8440. @item main_h, H
  8441. The main input width and height.
  8442. @item overlay_w, w
  8443. @item overlay_h, h
  8444. The overlay input width and height.
  8445. @item x
  8446. @item y
  8447. The computed values for @var{x} and @var{y}. They are evaluated for
  8448. each new frame.
  8449. @item hsub
  8450. @item vsub
  8451. horizontal and vertical chroma subsample values of the output
  8452. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  8453. @var{vsub} is 1.
  8454. @item n
  8455. the number of input frame, starting from 0
  8456. @item pos
  8457. the position in the file of the input frame, NAN if unknown
  8458. @item t
  8459. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  8460. @end table
  8461. This filter also supports the @ref{framesync} options.
  8462. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  8463. when evaluation is done @emph{per frame}, and will evaluate to NAN
  8464. when @option{eval} is set to @samp{init}.
  8465. Be aware that frames are taken from each input video in timestamp
  8466. order, hence, if their initial timestamps differ, it is a good idea
  8467. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  8468. have them begin in the same zero timestamp, as the example for
  8469. the @var{movie} filter does.
  8470. You can chain together more overlays but you should test the
  8471. efficiency of such approach.
  8472. @subsection Commands
  8473. This filter supports the following commands:
  8474. @table @option
  8475. @item x
  8476. @item y
  8477. Modify the x and y of the overlay input.
  8478. The command accepts the same syntax of the corresponding option.
  8479. If the specified expression is not valid, it is kept at its current
  8480. value.
  8481. @end table
  8482. @subsection Examples
  8483. @itemize
  8484. @item
  8485. Draw the overlay at 10 pixels from the bottom right corner of the main
  8486. video:
  8487. @example
  8488. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  8489. @end example
  8490. Using named options the example above becomes:
  8491. @example
  8492. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  8493. @end example
  8494. @item
  8495. Insert a transparent PNG logo in the bottom left corner of the input,
  8496. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  8497. @example
  8498. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  8499. @end example
  8500. @item
  8501. Insert 2 different transparent PNG logos (second logo on bottom
  8502. right corner) using the @command{ffmpeg} tool:
  8503. @example
  8504. 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
  8505. @end example
  8506. @item
  8507. Add a transparent color layer on top of the main video; @code{WxH}
  8508. must specify the size of the main input to the overlay filter:
  8509. @example
  8510. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  8511. @end example
  8512. @item
  8513. Play an original video and a filtered version (here with the deshake
  8514. filter) side by side using the @command{ffplay} tool:
  8515. @example
  8516. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  8517. @end example
  8518. The above command is the same as:
  8519. @example
  8520. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  8521. @end example
  8522. @item
  8523. Make a sliding overlay appearing from the left to the right top part of the
  8524. screen starting since time 2:
  8525. @example
  8526. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  8527. @end example
  8528. @item
  8529. Compose output by putting two input videos side to side:
  8530. @example
  8531. ffmpeg -i left.avi -i right.avi -filter_complex "
  8532. nullsrc=size=200x100 [background];
  8533. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  8534. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  8535. [background][left] overlay=shortest=1 [background+left];
  8536. [background+left][right] overlay=shortest=1:x=100 [left+right]
  8537. "
  8538. @end example
  8539. @item
  8540. Mask 10-20 seconds of a video by applying the delogo filter to a section
  8541. @example
  8542. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  8543. -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]'
  8544. masked.avi
  8545. @end example
  8546. @item
  8547. Chain several overlays in cascade:
  8548. @example
  8549. nullsrc=s=200x200 [bg];
  8550. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  8551. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  8552. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  8553. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  8554. [in3] null, [mid2] overlay=100:100 [out0]
  8555. @end example
  8556. @end itemize
  8557. @section owdenoise
  8558. Apply Overcomplete Wavelet denoiser.
  8559. The filter accepts the following options:
  8560. @table @option
  8561. @item depth
  8562. Set depth.
  8563. Larger depth values will denoise lower frequency components more, but
  8564. slow down filtering.
  8565. Must be an int in the range 8-16, default is @code{8}.
  8566. @item luma_strength, ls
  8567. Set luma strength.
  8568. Must be a double value in the range 0-1000, default is @code{1.0}.
  8569. @item chroma_strength, cs
  8570. Set chroma strength.
  8571. Must be a double value in the range 0-1000, default is @code{1.0}.
  8572. @end table
  8573. @anchor{pad}
  8574. @section pad
  8575. Add paddings to the input image, and place the original input at the
  8576. provided @var{x}, @var{y} coordinates.
  8577. It accepts the following parameters:
  8578. @table @option
  8579. @item width, w
  8580. @item height, h
  8581. Specify an expression for the size of the output image with the
  8582. paddings added. If the value for @var{width} or @var{height} is 0, the
  8583. corresponding input size is used for the output.
  8584. The @var{width} expression can reference the value set by the
  8585. @var{height} expression, and vice versa.
  8586. The default value of @var{width} and @var{height} is 0.
  8587. @item x
  8588. @item y
  8589. Specify the offsets to place the input image at within the padded area,
  8590. with respect to the top/left border of the output image.
  8591. The @var{x} expression can reference the value set by the @var{y}
  8592. expression, and vice versa.
  8593. The default value of @var{x} and @var{y} is 0.
  8594. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  8595. so the input image is centered on the padded area.
  8596. @item color
  8597. Specify the color of the padded area. For the syntax of this option,
  8598. check the "Color" section in the ffmpeg-utils manual.
  8599. The default value of @var{color} is "black".
  8600. @item eval
  8601. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  8602. It accepts the following values:
  8603. @table @samp
  8604. @item init
  8605. Only evaluate expressions once during the filter initialization or when
  8606. a command is processed.
  8607. @item frame
  8608. Evaluate expressions for each incoming frame.
  8609. @end table
  8610. Default value is @samp{init}.
  8611. @item aspect
  8612. Pad to aspect instead to a resolution.
  8613. @end table
  8614. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  8615. options are expressions containing the following constants:
  8616. @table @option
  8617. @item in_w
  8618. @item in_h
  8619. The input video width and height.
  8620. @item iw
  8621. @item ih
  8622. These are the same as @var{in_w} and @var{in_h}.
  8623. @item out_w
  8624. @item out_h
  8625. The output width and height (the size of the padded area), as
  8626. specified by the @var{width} and @var{height} expressions.
  8627. @item ow
  8628. @item oh
  8629. These are the same as @var{out_w} and @var{out_h}.
  8630. @item x
  8631. @item y
  8632. The x and y offsets as specified by the @var{x} and @var{y}
  8633. expressions, or NAN if not yet specified.
  8634. @item a
  8635. same as @var{iw} / @var{ih}
  8636. @item sar
  8637. input sample aspect ratio
  8638. @item dar
  8639. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  8640. @item hsub
  8641. @item vsub
  8642. The horizontal and vertical chroma subsample values. For example for the
  8643. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  8644. @end table
  8645. @subsection Examples
  8646. @itemize
  8647. @item
  8648. Add paddings with the color "violet" to the input video. The output video
  8649. size is 640x480, and the top-left corner of the input video is placed at
  8650. column 0, row 40
  8651. @example
  8652. pad=640:480:0:40:violet
  8653. @end example
  8654. The example above is equivalent to the following command:
  8655. @example
  8656. pad=width=640:height=480:x=0:y=40:color=violet
  8657. @end example
  8658. @item
  8659. Pad the input to get an output with dimensions increased by 3/2,
  8660. and put the input video at the center of the padded area:
  8661. @example
  8662. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  8663. @end example
  8664. @item
  8665. Pad the input to get a squared output with size equal to the maximum
  8666. value between the input width and height, and put the input video at
  8667. the center of the padded area:
  8668. @example
  8669. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  8670. @end example
  8671. @item
  8672. Pad the input to get a final w/h ratio of 16:9:
  8673. @example
  8674. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  8675. @end example
  8676. @item
  8677. In case of anamorphic video, in order to set the output display aspect
  8678. correctly, it is necessary to use @var{sar} in the expression,
  8679. according to the relation:
  8680. @example
  8681. (ih * X / ih) * sar = output_dar
  8682. X = output_dar / sar
  8683. @end example
  8684. Thus the previous example needs to be modified to:
  8685. @example
  8686. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  8687. @end example
  8688. @item
  8689. Double the output size and put the input video in the bottom-right
  8690. corner of the output padded area:
  8691. @example
  8692. pad="2*iw:2*ih:ow-iw:oh-ih"
  8693. @end example
  8694. @end itemize
  8695. @anchor{palettegen}
  8696. @section palettegen
  8697. Generate one palette for a whole video stream.
  8698. It accepts the following options:
  8699. @table @option
  8700. @item max_colors
  8701. Set the maximum number of colors to quantize in the palette.
  8702. Note: the palette will still contain 256 colors; the unused palette entries
  8703. will be black.
  8704. @item reserve_transparent
  8705. Create a palette of 255 colors maximum and reserve the last one for
  8706. transparency. Reserving the transparency color is useful for GIF optimization.
  8707. If not set, the maximum of colors in the palette will be 256. You probably want
  8708. to disable this option for a standalone image.
  8709. Set by default.
  8710. @item stats_mode
  8711. Set statistics mode.
  8712. It accepts the following values:
  8713. @table @samp
  8714. @item full
  8715. Compute full frame histograms.
  8716. @item diff
  8717. Compute histograms only for the part that differs from previous frame. This
  8718. might be relevant to give more importance to the moving part of your input if
  8719. the background is static.
  8720. @item single
  8721. Compute new histogram for each frame.
  8722. @end table
  8723. Default value is @var{full}.
  8724. @end table
  8725. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  8726. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  8727. color quantization of the palette. This information is also visible at
  8728. @var{info} logging level.
  8729. @subsection Examples
  8730. @itemize
  8731. @item
  8732. Generate a representative palette of a given video using @command{ffmpeg}:
  8733. @example
  8734. ffmpeg -i input.mkv -vf palettegen palette.png
  8735. @end example
  8736. @end itemize
  8737. @section paletteuse
  8738. Use a palette to downsample an input video stream.
  8739. The filter takes two inputs: one video stream and a palette. The palette must
  8740. be a 256 pixels image.
  8741. It accepts the following options:
  8742. @table @option
  8743. @item dither
  8744. Select dithering mode. Available algorithms are:
  8745. @table @samp
  8746. @item bayer
  8747. Ordered 8x8 bayer dithering (deterministic)
  8748. @item heckbert
  8749. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  8750. Note: this dithering is sometimes considered "wrong" and is included as a
  8751. reference.
  8752. @item floyd_steinberg
  8753. Floyd and Steingberg dithering (error diffusion)
  8754. @item sierra2
  8755. Frankie Sierra dithering v2 (error diffusion)
  8756. @item sierra2_4a
  8757. Frankie Sierra dithering v2 "Lite" (error diffusion)
  8758. @end table
  8759. Default is @var{sierra2_4a}.
  8760. @item bayer_scale
  8761. When @var{bayer} dithering is selected, this option defines the scale of the
  8762. pattern (how much the crosshatch pattern is visible). A low value means more
  8763. visible pattern for less banding, and higher value means less visible pattern
  8764. at the cost of more banding.
  8765. The option must be an integer value in the range [0,5]. Default is @var{2}.
  8766. @item diff_mode
  8767. If set, define the zone to process
  8768. @table @samp
  8769. @item rectangle
  8770. Only the changing rectangle will be reprocessed. This is similar to GIF
  8771. cropping/offsetting compression mechanism. This option can be useful for speed
  8772. if only a part of the image is changing, and has use cases such as limiting the
  8773. scope of the error diffusal @option{dither} to the rectangle that bounds the
  8774. moving scene (it leads to more deterministic output if the scene doesn't change
  8775. much, and as a result less moving noise and better GIF compression).
  8776. @end table
  8777. Default is @var{none}.
  8778. @item new
  8779. Take new palette for each output frame.
  8780. @end table
  8781. @subsection Examples
  8782. @itemize
  8783. @item
  8784. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  8785. using @command{ffmpeg}:
  8786. @example
  8787. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  8788. @end example
  8789. @end itemize
  8790. @section perspective
  8791. Correct perspective of video not recorded perpendicular to the screen.
  8792. A description of the accepted parameters follows.
  8793. @table @option
  8794. @item x0
  8795. @item y0
  8796. @item x1
  8797. @item y1
  8798. @item x2
  8799. @item y2
  8800. @item x3
  8801. @item y3
  8802. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  8803. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  8804. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  8805. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  8806. then the corners of the source will be sent to the specified coordinates.
  8807. The expressions can use the following variables:
  8808. @table @option
  8809. @item W
  8810. @item H
  8811. the width and height of video frame.
  8812. @item in
  8813. Input frame count.
  8814. @item on
  8815. Output frame count.
  8816. @end table
  8817. @item interpolation
  8818. Set interpolation for perspective correction.
  8819. It accepts the following values:
  8820. @table @samp
  8821. @item linear
  8822. @item cubic
  8823. @end table
  8824. Default value is @samp{linear}.
  8825. @item sense
  8826. Set interpretation of coordinate options.
  8827. It accepts the following values:
  8828. @table @samp
  8829. @item 0, source
  8830. Send point in the source specified by the given coordinates to
  8831. the corners of the destination.
  8832. @item 1, destination
  8833. Send the corners of the source to the point in the destination specified
  8834. by the given coordinates.
  8835. Default value is @samp{source}.
  8836. @end table
  8837. @item eval
  8838. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  8839. It accepts the following values:
  8840. @table @samp
  8841. @item init
  8842. only evaluate expressions once during the filter initialization or
  8843. when a command is processed
  8844. @item frame
  8845. evaluate expressions for each incoming frame
  8846. @end table
  8847. Default value is @samp{init}.
  8848. @end table
  8849. @section phase
  8850. Delay interlaced video by one field time so that the field order changes.
  8851. The intended use is to fix PAL movies that have been captured with the
  8852. opposite field order to the film-to-video transfer.
  8853. A description of the accepted parameters follows.
  8854. @table @option
  8855. @item mode
  8856. Set phase mode.
  8857. It accepts the following values:
  8858. @table @samp
  8859. @item t
  8860. Capture field order top-first, transfer bottom-first.
  8861. Filter will delay the bottom field.
  8862. @item b
  8863. Capture field order bottom-first, transfer top-first.
  8864. Filter will delay the top field.
  8865. @item p
  8866. Capture and transfer with the same field order. This mode only exists
  8867. for the documentation of the other options to refer to, but if you
  8868. actually select it, the filter will faithfully do nothing.
  8869. @item a
  8870. Capture field order determined automatically by field flags, transfer
  8871. opposite.
  8872. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  8873. basis using field flags. If no field information is available,
  8874. then this works just like @samp{u}.
  8875. @item u
  8876. Capture unknown or varying, transfer opposite.
  8877. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  8878. analyzing the images and selecting the alternative that produces best
  8879. match between the fields.
  8880. @item T
  8881. Capture top-first, transfer unknown or varying.
  8882. Filter selects among @samp{t} and @samp{p} using image analysis.
  8883. @item B
  8884. Capture bottom-first, transfer unknown or varying.
  8885. Filter selects among @samp{b} and @samp{p} using image analysis.
  8886. @item A
  8887. Capture determined by field flags, transfer unknown or varying.
  8888. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  8889. image analysis. If no field information is available, then this works just
  8890. like @samp{U}. This is the default mode.
  8891. @item U
  8892. Both capture and transfer unknown or varying.
  8893. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  8894. @end table
  8895. @end table
  8896. @section pixdesctest
  8897. Pixel format descriptor test filter, mainly useful for internal
  8898. testing. The output video should be equal to the input video.
  8899. For example:
  8900. @example
  8901. format=monow, pixdesctest
  8902. @end example
  8903. can be used to test the monowhite pixel format descriptor definition.
  8904. @section pixscope
  8905. Display sample values of color channels. Mainly useful for checking color and levels.
  8906. The filters accept the following options:
  8907. @table @option
  8908. @item x
  8909. Set scope X position, relative offset on X axis.
  8910. @item y
  8911. Set scope Y position, relative offset on Y axis.
  8912. @item w
  8913. Set scope width.
  8914. @item h
  8915. Set scope height.
  8916. @item o
  8917. Set window opacity. This window also holds statistics about pixel area.
  8918. @item wx
  8919. Set window X position, relative offset on X axis.
  8920. @item wy
  8921. Set window Y position, relative offset on Y axis.
  8922. @end table
  8923. @section pp
  8924. Enable the specified chain of postprocessing subfilters using libpostproc. This
  8925. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  8926. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  8927. Each subfilter and some options have a short and a long name that can be used
  8928. interchangeably, i.e. dr/dering are the same.
  8929. The filters accept the following options:
  8930. @table @option
  8931. @item subfilters
  8932. Set postprocessing subfilters string.
  8933. @end table
  8934. All subfilters share common options to determine their scope:
  8935. @table @option
  8936. @item a/autoq
  8937. Honor the quality commands for this subfilter.
  8938. @item c/chrom
  8939. Do chrominance filtering, too (default).
  8940. @item y/nochrom
  8941. Do luminance filtering only (no chrominance).
  8942. @item n/noluma
  8943. Do chrominance filtering only (no luminance).
  8944. @end table
  8945. These options can be appended after the subfilter name, separated by a '|'.
  8946. Available subfilters are:
  8947. @table @option
  8948. @item hb/hdeblock[|difference[|flatness]]
  8949. Horizontal deblocking filter
  8950. @table @option
  8951. @item difference
  8952. Difference factor where higher values mean more deblocking (default: @code{32}).
  8953. @item flatness
  8954. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8955. @end table
  8956. @item vb/vdeblock[|difference[|flatness]]
  8957. Vertical deblocking filter
  8958. @table @option
  8959. @item difference
  8960. Difference factor where higher values mean more deblocking (default: @code{32}).
  8961. @item flatness
  8962. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8963. @end table
  8964. @item ha/hadeblock[|difference[|flatness]]
  8965. Accurate horizontal deblocking filter
  8966. @table @option
  8967. @item difference
  8968. Difference factor where higher values mean more deblocking (default: @code{32}).
  8969. @item flatness
  8970. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8971. @end table
  8972. @item va/vadeblock[|difference[|flatness]]
  8973. Accurate vertical deblocking filter
  8974. @table @option
  8975. @item difference
  8976. Difference factor where higher values mean more deblocking (default: @code{32}).
  8977. @item flatness
  8978. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  8979. @end table
  8980. @end table
  8981. The horizontal and vertical deblocking filters share the difference and
  8982. flatness values so you cannot set different horizontal and vertical
  8983. thresholds.
  8984. @table @option
  8985. @item h1/x1hdeblock
  8986. Experimental horizontal deblocking filter
  8987. @item v1/x1vdeblock
  8988. Experimental vertical deblocking filter
  8989. @item dr/dering
  8990. Deringing filter
  8991. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  8992. @table @option
  8993. @item threshold1
  8994. larger -> stronger filtering
  8995. @item threshold2
  8996. larger -> stronger filtering
  8997. @item threshold3
  8998. larger -> stronger filtering
  8999. @end table
  9000. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  9001. @table @option
  9002. @item f/fullyrange
  9003. Stretch luminance to @code{0-255}.
  9004. @end table
  9005. @item lb/linblenddeint
  9006. Linear blend deinterlacing filter that deinterlaces the given block by
  9007. filtering all lines with a @code{(1 2 1)} filter.
  9008. @item li/linipoldeint
  9009. Linear interpolating deinterlacing filter that deinterlaces the given block by
  9010. linearly interpolating every second line.
  9011. @item ci/cubicipoldeint
  9012. Cubic interpolating deinterlacing filter deinterlaces the given block by
  9013. cubically interpolating every second line.
  9014. @item md/mediandeint
  9015. Median deinterlacing filter that deinterlaces the given block by applying a
  9016. median filter to every second line.
  9017. @item fd/ffmpegdeint
  9018. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  9019. second line with a @code{(-1 4 2 4 -1)} filter.
  9020. @item l5/lowpass5
  9021. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  9022. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  9023. @item fq/forceQuant[|quantizer]
  9024. Overrides the quantizer table from the input with the constant quantizer you
  9025. specify.
  9026. @table @option
  9027. @item quantizer
  9028. Quantizer to use
  9029. @end table
  9030. @item de/default
  9031. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  9032. @item fa/fast
  9033. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  9034. @item ac
  9035. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  9036. @end table
  9037. @subsection Examples
  9038. @itemize
  9039. @item
  9040. Apply horizontal and vertical deblocking, deringing and automatic
  9041. brightness/contrast:
  9042. @example
  9043. pp=hb/vb/dr/al
  9044. @end example
  9045. @item
  9046. Apply default filters without brightness/contrast correction:
  9047. @example
  9048. pp=de/-al
  9049. @end example
  9050. @item
  9051. Apply default filters and temporal denoiser:
  9052. @example
  9053. pp=default/tmpnoise|1|2|3
  9054. @end example
  9055. @item
  9056. Apply deblocking on luminance only, and switch vertical deblocking on or off
  9057. automatically depending on available CPU time:
  9058. @example
  9059. pp=hb|y/vb|a
  9060. @end example
  9061. @end itemize
  9062. @section pp7
  9063. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  9064. similar to spp = 6 with 7 point DCT, where only the center sample is
  9065. used after IDCT.
  9066. The filter accepts the following options:
  9067. @table @option
  9068. @item qp
  9069. Force a constant quantization parameter. It accepts an integer in range
  9070. 0 to 63. If not set, the filter will use the QP from the video stream
  9071. (if available).
  9072. @item mode
  9073. Set thresholding mode. Available modes are:
  9074. @table @samp
  9075. @item hard
  9076. Set hard thresholding.
  9077. @item soft
  9078. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9079. @item medium
  9080. Set medium thresholding (good results, default).
  9081. @end table
  9082. @end table
  9083. @section premultiply
  9084. Apply alpha premultiply effect to input video stream using first plane
  9085. of second stream as alpha.
  9086. Both streams must have same dimensions and same pixel format.
  9087. The filter accepts the following option:
  9088. @table @option
  9089. @item planes
  9090. Set which planes will be processed, unprocessed planes will be copied.
  9091. By default value 0xf, all planes will be processed.
  9092. @item inplace
  9093. Do not require 2nd input for processing, instead use alpha plane from input stream.
  9094. @end table
  9095. @section prewitt
  9096. Apply prewitt operator to input video stream.
  9097. The filter accepts the following option:
  9098. @table @option
  9099. @item planes
  9100. Set which planes will be processed, unprocessed planes will be copied.
  9101. By default value 0xf, all planes will be processed.
  9102. @item scale
  9103. Set value which will be multiplied with filtered result.
  9104. @item delta
  9105. Set value which will be added to filtered result.
  9106. @end table
  9107. @section pseudocolor
  9108. Alter frame colors in video with pseudocolors.
  9109. This filter accept the following options:
  9110. @table @option
  9111. @item c0
  9112. set pixel first component expression
  9113. @item c1
  9114. set pixel second component expression
  9115. @item c2
  9116. set pixel third component expression
  9117. @item c3
  9118. set pixel fourth component expression, corresponds to the alpha component
  9119. @item i
  9120. set component to use as base for altering colors
  9121. @end table
  9122. Each of them specifies the expression to use for computing the lookup table for
  9123. the corresponding pixel component values.
  9124. The expressions can contain the following constants and functions:
  9125. @table @option
  9126. @item w
  9127. @item h
  9128. The input width and height.
  9129. @item val
  9130. The input value for the pixel component.
  9131. @item ymin, umin, vmin, amin
  9132. The minimum allowed component value.
  9133. @item ymax, umax, vmax, amax
  9134. The maximum allowed component value.
  9135. @end table
  9136. All expressions default to "val".
  9137. @subsection Examples
  9138. @itemize
  9139. @item
  9140. Change too high luma values to gradient:
  9141. @example
  9142. 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'"
  9143. @end example
  9144. @end itemize
  9145. @section psnr
  9146. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  9147. Ratio) between two input videos.
  9148. This filter takes in input two input videos, the first input is
  9149. considered the "main" source and is passed unchanged to the
  9150. output. The second input is used as a "reference" video for computing
  9151. the PSNR.
  9152. Both video inputs must have the same resolution and pixel format for
  9153. this filter to work correctly. Also it assumes that both inputs
  9154. have the same number of frames, which are compared one by one.
  9155. The obtained average PSNR is printed through the logging system.
  9156. The filter stores the accumulated MSE (mean squared error) of each
  9157. frame, and at the end of the processing it is averaged across all frames
  9158. equally, and the following formula is applied to obtain the PSNR:
  9159. @example
  9160. PSNR = 10*log10(MAX^2/MSE)
  9161. @end example
  9162. Where MAX is the average of the maximum values of each component of the
  9163. image.
  9164. The description of the accepted parameters follows.
  9165. @table @option
  9166. @item stats_file, f
  9167. If specified the filter will use the named file to save the PSNR of
  9168. each individual frame. When filename equals "-" the data is sent to
  9169. standard output.
  9170. @item stats_version
  9171. Specifies which version of the stats file format to use. Details of
  9172. each format are written below.
  9173. Default value is 1.
  9174. @item stats_add_max
  9175. Determines whether the max value is output to the stats log.
  9176. Default value is 0.
  9177. Requires stats_version >= 2. If this is set and stats_version < 2,
  9178. the filter will return an error.
  9179. @end table
  9180. This filter also supports the @ref{framesync} options.
  9181. The file printed if @var{stats_file} is selected, contains a sequence of
  9182. key/value pairs of the form @var{key}:@var{value} for each compared
  9183. couple of frames.
  9184. If a @var{stats_version} greater than 1 is specified, a header line precedes
  9185. the list of per-frame-pair stats, with key value pairs following the frame
  9186. format with the following parameters:
  9187. @table @option
  9188. @item psnr_log_version
  9189. The version of the log file format. Will match @var{stats_version}.
  9190. @item fields
  9191. A comma separated list of the per-frame-pair parameters included in
  9192. the log.
  9193. @end table
  9194. A description of each shown per-frame-pair parameter follows:
  9195. @table @option
  9196. @item n
  9197. sequential number of the input frame, starting from 1
  9198. @item mse_avg
  9199. Mean Square Error pixel-by-pixel average difference of the compared
  9200. frames, averaged over all the image components.
  9201. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a
  9202. Mean Square Error pixel-by-pixel average difference of the compared
  9203. frames for the component specified by the suffix.
  9204. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  9205. Peak Signal to Noise ratio of the compared frames for the component
  9206. specified by the suffix.
  9207. @item max_avg, max_y, max_u, max_v
  9208. Maximum allowed value for each channel, and average over all
  9209. channels.
  9210. @end table
  9211. For example:
  9212. @example
  9213. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9214. [main][ref] psnr="stats_file=stats.log" [out]
  9215. @end example
  9216. On this example the input file being processed is compared with the
  9217. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  9218. is stored in @file{stats.log}.
  9219. @anchor{pullup}
  9220. @section pullup
  9221. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  9222. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  9223. content.
  9224. The pullup filter is designed to take advantage of future context in making
  9225. its decisions. This filter is stateless in the sense that it does not lock
  9226. onto a pattern to follow, but it instead looks forward to the following
  9227. fields in order to identify matches and rebuild progressive frames.
  9228. To produce content with an even framerate, insert the fps filter after
  9229. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  9230. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  9231. The filter accepts the following options:
  9232. @table @option
  9233. @item jl
  9234. @item jr
  9235. @item jt
  9236. @item jb
  9237. These options set the amount of "junk" to ignore at the left, right, top, and
  9238. bottom of the image, respectively. Left and right are in units of 8 pixels,
  9239. while top and bottom are in units of 2 lines.
  9240. The default is 8 pixels on each side.
  9241. @item sb
  9242. Set the strict breaks. Setting this option to 1 will reduce the chances of
  9243. filter generating an occasional mismatched frame, but it may also cause an
  9244. excessive number of frames to be dropped during high motion sequences.
  9245. Conversely, setting it to -1 will make filter match fields more easily.
  9246. This may help processing of video where there is slight blurring between
  9247. the fields, but may also cause there to be interlaced frames in the output.
  9248. Default value is @code{0}.
  9249. @item mp
  9250. Set the metric plane to use. It accepts the following values:
  9251. @table @samp
  9252. @item l
  9253. Use luma plane.
  9254. @item u
  9255. Use chroma blue plane.
  9256. @item v
  9257. Use chroma red plane.
  9258. @end table
  9259. This option may be set to use chroma plane instead of the default luma plane
  9260. for doing filter's computations. This may improve accuracy on very clean
  9261. source material, but more likely will decrease accuracy, especially if there
  9262. is chroma noise (rainbow effect) or any grayscale video.
  9263. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  9264. load and make pullup usable in realtime on slow machines.
  9265. @end table
  9266. For best results (without duplicated frames in the output file) it is
  9267. necessary to change the output frame rate. For example, to inverse
  9268. telecine NTSC input:
  9269. @example
  9270. ffmpeg -i input -vf pullup -r 24000/1001 ...
  9271. @end example
  9272. @section qp
  9273. Change video quantization parameters (QP).
  9274. The filter accepts the following option:
  9275. @table @option
  9276. @item qp
  9277. Set expression for quantization parameter.
  9278. @end table
  9279. The expression is evaluated through the eval API and can contain, among others,
  9280. the following constants:
  9281. @table @var
  9282. @item known
  9283. 1 if index is not 129, 0 otherwise.
  9284. @item qp
  9285. Sequentional index starting from -129 to 128.
  9286. @end table
  9287. @subsection Examples
  9288. @itemize
  9289. @item
  9290. Some equation like:
  9291. @example
  9292. qp=2+2*sin(PI*qp)
  9293. @end example
  9294. @end itemize
  9295. @section random
  9296. Flush video frames from internal cache of frames into a random order.
  9297. No frame is discarded.
  9298. Inspired by @ref{frei0r} nervous filter.
  9299. @table @option
  9300. @item frames
  9301. Set size in number of frames of internal cache, in range from @code{2} to
  9302. @code{512}. Default is @code{30}.
  9303. @item seed
  9304. Set seed for random number generator, must be an integer included between
  9305. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  9306. less than @code{0}, the filter will try to use a good random seed on a
  9307. best effort basis.
  9308. @end table
  9309. @section readeia608
  9310. Read closed captioning (EIA-608) information from the top lines of a video frame.
  9311. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  9312. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  9313. with EIA-608 data (starting from 0). A description of each metadata value follows:
  9314. @table @option
  9315. @item lavfi.readeia608.X.cc
  9316. The two bytes stored as EIA-608 data (printed in hexadecimal).
  9317. @item lavfi.readeia608.X.line
  9318. The number of the line on which the EIA-608 data was identified and read.
  9319. @end table
  9320. This filter accepts the following options:
  9321. @table @option
  9322. @item scan_min
  9323. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  9324. @item scan_max
  9325. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  9326. @item mac
  9327. Set minimal acceptable amplitude change for sync codes detection.
  9328. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  9329. @item spw
  9330. Set the ratio of width reserved for sync code detection.
  9331. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  9332. @item mhd
  9333. Set the max peaks height difference for sync code detection.
  9334. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9335. @item mpd
  9336. Set max peaks period difference for sync code detection.
  9337. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  9338. @item msd
  9339. Set the first two max start code bits differences.
  9340. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  9341. @item bhd
  9342. Set the minimum ratio of bits height compared to 3rd start code bit.
  9343. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  9344. @item th_w
  9345. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  9346. @item th_b
  9347. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  9348. @item chp
  9349. Enable checking the parity bit. In the event of a parity error, the filter will output
  9350. @code{0x00} for that character. Default is false.
  9351. @end table
  9352. @subsection Examples
  9353. @itemize
  9354. @item
  9355. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  9356. @example
  9357. 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
  9358. @end example
  9359. @end itemize
  9360. @section readvitc
  9361. Read vertical interval timecode (VITC) information from the top lines of a
  9362. video frame.
  9363. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  9364. timecode value, if a valid timecode has been detected. Further metadata key
  9365. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  9366. timecode data has been found or not.
  9367. This filter accepts the following options:
  9368. @table @option
  9369. @item scan_max
  9370. Set the maximum number of lines to scan for VITC data. If the value is set to
  9371. @code{-1} the full video frame is scanned. Default is @code{45}.
  9372. @item thr_b
  9373. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  9374. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  9375. @item thr_w
  9376. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  9377. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  9378. @end table
  9379. @subsection Examples
  9380. @itemize
  9381. @item
  9382. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  9383. draw @code{--:--:--:--} as a placeholder:
  9384. @example
  9385. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  9386. @end example
  9387. @end itemize
  9388. @section remap
  9389. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  9390. Destination pixel at position (X, Y) will be picked from source (x, y) position
  9391. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  9392. value for pixel will be used for destination pixel.
  9393. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  9394. will have Xmap/Ymap video stream dimensions.
  9395. Xmap and Ymap input video streams are 16bit depth, single channel.
  9396. @section removegrain
  9397. The removegrain filter is a spatial denoiser for progressive video.
  9398. @table @option
  9399. @item m0
  9400. Set mode for the first plane.
  9401. @item m1
  9402. Set mode for the second plane.
  9403. @item m2
  9404. Set mode for the third plane.
  9405. @item m3
  9406. Set mode for the fourth plane.
  9407. @end table
  9408. Range of mode is from 0 to 24. Description of each mode follows:
  9409. @table @var
  9410. @item 0
  9411. Leave input plane unchanged. Default.
  9412. @item 1
  9413. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  9414. @item 2
  9415. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  9416. @item 3
  9417. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  9418. @item 4
  9419. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  9420. This is equivalent to a median filter.
  9421. @item 5
  9422. Line-sensitive clipping giving the minimal change.
  9423. @item 6
  9424. Line-sensitive clipping, intermediate.
  9425. @item 7
  9426. Line-sensitive clipping, intermediate.
  9427. @item 8
  9428. Line-sensitive clipping, intermediate.
  9429. @item 9
  9430. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  9431. @item 10
  9432. Replaces the target pixel with the closest neighbour.
  9433. @item 11
  9434. [1 2 1] horizontal and vertical kernel blur.
  9435. @item 12
  9436. Same as mode 11.
  9437. @item 13
  9438. Bob mode, interpolates top field from the line where the neighbours
  9439. pixels are the closest.
  9440. @item 14
  9441. Bob mode, interpolates bottom field from the line where the neighbours
  9442. pixels are the closest.
  9443. @item 15
  9444. Bob mode, interpolates top field. Same as 13 but with a more complicated
  9445. interpolation formula.
  9446. @item 16
  9447. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  9448. interpolation formula.
  9449. @item 17
  9450. Clips the pixel with the minimum and maximum of respectively the maximum and
  9451. minimum of each pair of opposite neighbour pixels.
  9452. @item 18
  9453. Line-sensitive clipping using opposite neighbours whose greatest distance from
  9454. the current pixel is minimal.
  9455. @item 19
  9456. Replaces the pixel with the average of its 8 neighbours.
  9457. @item 20
  9458. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  9459. @item 21
  9460. Clips pixels using the averages of opposite neighbour.
  9461. @item 22
  9462. Same as mode 21 but simpler and faster.
  9463. @item 23
  9464. Small edge and halo removal, but reputed useless.
  9465. @item 24
  9466. Similar as 23.
  9467. @end table
  9468. @section removelogo
  9469. Suppress a TV station logo, using an image file to determine which
  9470. pixels comprise the logo. It works by filling in the pixels that
  9471. comprise the logo with neighboring pixels.
  9472. The filter accepts the following options:
  9473. @table @option
  9474. @item filename, f
  9475. Set the filter bitmap file, which can be any image format supported by
  9476. libavformat. The width and height of the image file must match those of the
  9477. video stream being processed.
  9478. @end table
  9479. Pixels in the provided bitmap image with a value of zero are not
  9480. considered part of the logo, non-zero pixels are considered part of
  9481. the logo. If you use white (255) for the logo and black (0) for the
  9482. rest, you will be safe. For making the filter bitmap, it is
  9483. recommended to take a screen capture of a black frame with the logo
  9484. visible, and then using a threshold filter followed by the erode
  9485. filter once or twice.
  9486. If needed, little splotches can be fixed manually. Remember that if
  9487. logo pixels are not covered, the filter quality will be much
  9488. reduced. Marking too many pixels as part of the logo does not hurt as
  9489. much, but it will increase the amount of blurring needed to cover over
  9490. the image and will destroy more information than necessary, and extra
  9491. pixels will slow things down on a large logo.
  9492. @section repeatfields
  9493. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  9494. fields based on its value.
  9495. @section reverse
  9496. Reverse a video clip.
  9497. Warning: This filter requires memory to buffer the entire clip, so trimming
  9498. is suggested.
  9499. @subsection Examples
  9500. @itemize
  9501. @item
  9502. Take the first 5 seconds of a clip, and reverse it.
  9503. @example
  9504. trim=end=5,reverse
  9505. @end example
  9506. @end itemize
  9507. @section roberts
  9508. Apply roberts cross operator to input video stream.
  9509. The filter accepts the following option:
  9510. @table @option
  9511. @item planes
  9512. Set which planes will be processed, unprocessed planes will be copied.
  9513. By default value 0xf, all planes will be processed.
  9514. @item scale
  9515. Set value which will be multiplied with filtered result.
  9516. @item delta
  9517. Set value which will be added to filtered result.
  9518. @end table
  9519. @section rotate
  9520. Rotate video by an arbitrary angle expressed in radians.
  9521. The filter accepts the following options:
  9522. A description of the optional parameters follows.
  9523. @table @option
  9524. @item angle, a
  9525. Set an expression for the angle by which to rotate the input video
  9526. clockwise, expressed as a number of radians. A negative value will
  9527. result in a counter-clockwise rotation. By default it is set to "0".
  9528. This expression is evaluated for each frame.
  9529. @item out_w, ow
  9530. Set the output width expression, default value is "iw".
  9531. This expression is evaluated just once during configuration.
  9532. @item out_h, oh
  9533. Set the output height expression, default value is "ih".
  9534. This expression is evaluated just once during configuration.
  9535. @item bilinear
  9536. Enable bilinear interpolation if set to 1, a value of 0 disables
  9537. it. Default value is 1.
  9538. @item fillcolor, c
  9539. Set the color used to fill the output area not covered by the rotated
  9540. image. For the general syntax of this option, check the "Color" section in the
  9541. ffmpeg-utils manual. If the special value "none" is selected then no
  9542. background is printed (useful for example if the background is never shown).
  9543. Default value is "black".
  9544. @end table
  9545. The expressions for the angle and the output size can contain the
  9546. following constants and functions:
  9547. @table @option
  9548. @item n
  9549. sequential number of the input frame, starting from 0. It is always NAN
  9550. before the first frame is filtered.
  9551. @item t
  9552. time in seconds of the input frame, it is set to 0 when the filter is
  9553. configured. It is always NAN before the first frame is filtered.
  9554. @item hsub
  9555. @item vsub
  9556. horizontal and vertical chroma subsample values. For example for the
  9557. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9558. @item in_w, iw
  9559. @item in_h, ih
  9560. the input video width and height
  9561. @item out_w, ow
  9562. @item out_h, oh
  9563. the output width and height, that is the size of the padded area as
  9564. specified by the @var{width} and @var{height} expressions
  9565. @item rotw(a)
  9566. @item roth(a)
  9567. the minimal width/height required for completely containing the input
  9568. video rotated by @var{a} radians.
  9569. These are only available when computing the @option{out_w} and
  9570. @option{out_h} expressions.
  9571. @end table
  9572. @subsection Examples
  9573. @itemize
  9574. @item
  9575. Rotate the input by PI/6 radians clockwise:
  9576. @example
  9577. rotate=PI/6
  9578. @end example
  9579. @item
  9580. Rotate the input by PI/6 radians counter-clockwise:
  9581. @example
  9582. rotate=-PI/6
  9583. @end example
  9584. @item
  9585. Rotate the input by 45 degrees clockwise:
  9586. @example
  9587. rotate=45*PI/180
  9588. @end example
  9589. @item
  9590. Apply a constant rotation with period T, starting from an angle of PI/3:
  9591. @example
  9592. rotate=PI/3+2*PI*t/T
  9593. @end example
  9594. @item
  9595. Make the input video rotation oscillating with a period of T
  9596. seconds and an amplitude of A radians:
  9597. @example
  9598. rotate=A*sin(2*PI/T*t)
  9599. @end example
  9600. @item
  9601. Rotate the video, output size is chosen so that the whole rotating
  9602. input video is always completely contained in the output:
  9603. @example
  9604. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  9605. @end example
  9606. @item
  9607. Rotate the video, reduce the output size so that no background is ever
  9608. shown:
  9609. @example
  9610. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  9611. @end example
  9612. @end itemize
  9613. @subsection Commands
  9614. The filter supports the following commands:
  9615. @table @option
  9616. @item a, angle
  9617. Set the angle expression.
  9618. The command accepts the same syntax of the corresponding option.
  9619. If the specified expression is not valid, it is kept at its current
  9620. value.
  9621. @end table
  9622. @section sab
  9623. Apply Shape Adaptive Blur.
  9624. The filter accepts the following options:
  9625. @table @option
  9626. @item luma_radius, lr
  9627. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  9628. value is 1.0. A greater value will result in a more blurred image, and
  9629. in slower processing.
  9630. @item luma_pre_filter_radius, lpfr
  9631. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  9632. value is 1.0.
  9633. @item luma_strength, ls
  9634. Set luma maximum difference between pixels to still be considered, must
  9635. be a value in the 0.1-100.0 range, default value is 1.0.
  9636. @item chroma_radius, cr
  9637. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  9638. greater value will result in a more blurred image, and in slower
  9639. processing.
  9640. @item chroma_pre_filter_radius, cpfr
  9641. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  9642. @item chroma_strength, cs
  9643. Set chroma maximum difference between pixels to still be considered,
  9644. must be a value in the -0.9-100.0 range.
  9645. @end table
  9646. Each chroma option value, if not explicitly specified, is set to the
  9647. corresponding luma option value.
  9648. @anchor{scale}
  9649. @section scale
  9650. Scale (resize) the input video, using the libswscale library.
  9651. The scale filter forces the output display aspect ratio to be the same
  9652. of the input, by changing the output sample aspect ratio.
  9653. If the input image format is different from the format requested by
  9654. the next filter, the scale filter will convert the input to the
  9655. requested format.
  9656. @subsection Options
  9657. The filter accepts the following options, or any of the options
  9658. supported by the libswscale scaler.
  9659. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  9660. the complete list of scaler options.
  9661. @table @option
  9662. @item width, w
  9663. @item height, h
  9664. Set the output video dimension expression. Default value is the input
  9665. dimension.
  9666. If the @var{width} or @var{w} value is 0, the input width is used for
  9667. the output. If the @var{height} or @var{h} value is 0, the input height
  9668. is used for the output.
  9669. If one and only one of the values is -n with n >= 1, the scale filter
  9670. will use a value that maintains the aspect ratio of the input image,
  9671. calculated from the other specified dimension. After that it will,
  9672. however, make sure that the calculated dimension is divisible by n and
  9673. adjust the value if necessary.
  9674. If both values are -n with n >= 1, the behavior will be identical to
  9675. both values being set to 0 as previously detailed.
  9676. See below for the list of accepted constants for use in the dimension
  9677. expression.
  9678. @item eval
  9679. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  9680. @table @samp
  9681. @item init
  9682. Only evaluate expressions once during the filter initialization or when a command is processed.
  9683. @item frame
  9684. Evaluate expressions for each incoming frame.
  9685. @end table
  9686. Default value is @samp{init}.
  9687. @item interl
  9688. Set the interlacing mode. It accepts the following values:
  9689. @table @samp
  9690. @item 1
  9691. Force interlaced aware scaling.
  9692. @item 0
  9693. Do not apply interlaced scaling.
  9694. @item -1
  9695. Select interlaced aware scaling depending on whether the source frames
  9696. are flagged as interlaced or not.
  9697. @end table
  9698. Default value is @samp{0}.
  9699. @item flags
  9700. Set libswscale scaling flags. See
  9701. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9702. complete list of values. If not explicitly specified the filter applies
  9703. the default flags.
  9704. @item param0, param1
  9705. Set libswscale input parameters for scaling algorithms that need them. See
  9706. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  9707. complete documentation. If not explicitly specified the filter applies
  9708. empty parameters.
  9709. @item size, s
  9710. Set the video size. For the syntax of this option, check the
  9711. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  9712. @item in_color_matrix
  9713. @item out_color_matrix
  9714. Set in/output YCbCr color space type.
  9715. This allows the autodetected value to be overridden as well as allows forcing
  9716. a specific value used for the output and encoder.
  9717. If not specified, the color space type depends on the pixel format.
  9718. Possible values:
  9719. @table @samp
  9720. @item auto
  9721. Choose automatically.
  9722. @item bt709
  9723. Format conforming to International Telecommunication Union (ITU)
  9724. Recommendation BT.709.
  9725. @item fcc
  9726. Set color space conforming to the United States Federal Communications
  9727. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  9728. @item bt601
  9729. Set color space conforming to:
  9730. @itemize
  9731. @item
  9732. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  9733. @item
  9734. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  9735. @item
  9736. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  9737. @end itemize
  9738. @item smpte240m
  9739. Set color space conforming to SMPTE ST 240:1999.
  9740. @end table
  9741. @item in_range
  9742. @item out_range
  9743. Set in/output YCbCr sample range.
  9744. This allows the autodetected value to be overridden as well as allows forcing
  9745. a specific value used for the output and encoder. If not specified, the
  9746. range depends on the pixel format. Possible values:
  9747. @table @samp
  9748. @item auto
  9749. Choose automatically.
  9750. @item jpeg/full/pc
  9751. Set full range (0-255 in case of 8-bit luma).
  9752. @item mpeg/tv
  9753. Set "MPEG" range (16-235 in case of 8-bit luma).
  9754. @end table
  9755. @item force_original_aspect_ratio
  9756. Enable decreasing or increasing output video width or height if necessary to
  9757. keep the original aspect ratio. Possible values:
  9758. @table @samp
  9759. @item disable
  9760. Scale the video as specified and disable this feature.
  9761. @item decrease
  9762. The output video dimensions will automatically be decreased if needed.
  9763. @item increase
  9764. The output video dimensions will automatically be increased if needed.
  9765. @end table
  9766. One useful instance of this option is that when you know a specific device's
  9767. maximum allowed resolution, you can use this to limit the output video to
  9768. that, while retaining the aspect ratio. For example, device A allows
  9769. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  9770. decrease) and specifying 1280x720 to the command line makes the output
  9771. 1280x533.
  9772. Please note that this is a different thing than specifying -1 for @option{w}
  9773. or @option{h}, you still need to specify the output resolution for this option
  9774. to work.
  9775. @end table
  9776. The values of the @option{w} and @option{h} options are expressions
  9777. containing the following constants:
  9778. @table @var
  9779. @item in_w
  9780. @item in_h
  9781. The input width and height
  9782. @item iw
  9783. @item ih
  9784. These are the same as @var{in_w} and @var{in_h}.
  9785. @item out_w
  9786. @item out_h
  9787. The output (scaled) width and height
  9788. @item ow
  9789. @item oh
  9790. These are the same as @var{out_w} and @var{out_h}
  9791. @item a
  9792. The same as @var{iw} / @var{ih}
  9793. @item sar
  9794. input sample aspect ratio
  9795. @item dar
  9796. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  9797. @item hsub
  9798. @item vsub
  9799. horizontal and vertical input chroma subsample values. For example for the
  9800. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9801. @item ohsub
  9802. @item ovsub
  9803. horizontal and vertical output chroma subsample values. For example for the
  9804. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9805. @end table
  9806. @subsection Examples
  9807. @itemize
  9808. @item
  9809. Scale the input video to a size of 200x100
  9810. @example
  9811. scale=w=200:h=100
  9812. @end example
  9813. This is equivalent to:
  9814. @example
  9815. scale=200:100
  9816. @end example
  9817. or:
  9818. @example
  9819. scale=200x100
  9820. @end example
  9821. @item
  9822. Specify a size abbreviation for the output size:
  9823. @example
  9824. scale=qcif
  9825. @end example
  9826. which can also be written as:
  9827. @example
  9828. scale=size=qcif
  9829. @end example
  9830. @item
  9831. Scale the input to 2x:
  9832. @example
  9833. scale=w=2*iw:h=2*ih
  9834. @end example
  9835. @item
  9836. The above is the same as:
  9837. @example
  9838. scale=2*in_w:2*in_h
  9839. @end example
  9840. @item
  9841. Scale the input to 2x with forced interlaced scaling:
  9842. @example
  9843. scale=2*iw:2*ih:interl=1
  9844. @end example
  9845. @item
  9846. Scale the input to half size:
  9847. @example
  9848. scale=w=iw/2:h=ih/2
  9849. @end example
  9850. @item
  9851. Increase the width, and set the height to the same size:
  9852. @example
  9853. scale=3/2*iw:ow
  9854. @end example
  9855. @item
  9856. Seek Greek harmony:
  9857. @example
  9858. scale=iw:1/PHI*iw
  9859. scale=ih*PHI:ih
  9860. @end example
  9861. @item
  9862. Increase the height, and set the width to 3/2 of the height:
  9863. @example
  9864. scale=w=3/2*oh:h=3/5*ih
  9865. @end example
  9866. @item
  9867. Increase the size, making the size a multiple of the chroma
  9868. subsample values:
  9869. @example
  9870. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  9871. @end example
  9872. @item
  9873. Increase the width to a maximum of 500 pixels,
  9874. keeping the same aspect ratio as the input:
  9875. @example
  9876. scale=w='min(500\, iw*3/2):h=-1'
  9877. @end example
  9878. @end itemize
  9879. @subsection Commands
  9880. This filter supports the following commands:
  9881. @table @option
  9882. @item width, w
  9883. @item height, h
  9884. Set the output video dimension expression.
  9885. The command accepts the same syntax of the corresponding option.
  9886. If the specified expression is not valid, it is kept at its current
  9887. value.
  9888. @end table
  9889. @section scale_npp
  9890. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  9891. format conversion on CUDA video frames. Setting the output width and height
  9892. works in the same way as for the @var{scale} filter.
  9893. The following additional options are accepted:
  9894. @table @option
  9895. @item format
  9896. The pixel format of the output CUDA frames. If set to the string "same" (the
  9897. default), the input format will be kept. Note that automatic format negotiation
  9898. and conversion is not yet supported for hardware frames
  9899. @item interp_algo
  9900. The interpolation algorithm used for resizing. One of the following:
  9901. @table @option
  9902. @item nn
  9903. Nearest neighbour.
  9904. @item linear
  9905. @item cubic
  9906. @item cubic2p_bspline
  9907. 2-parameter cubic (B=1, C=0)
  9908. @item cubic2p_catmullrom
  9909. 2-parameter cubic (B=0, C=1/2)
  9910. @item cubic2p_b05c03
  9911. 2-parameter cubic (B=1/2, C=3/10)
  9912. @item super
  9913. Supersampling
  9914. @item lanczos
  9915. @end table
  9916. @end table
  9917. @section scale2ref
  9918. Scale (resize) the input video, based on a reference video.
  9919. See the scale filter for available options, scale2ref supports the same but
  9920. uses the reference video instead of the main input as basis. scale2ref also
  9921. supports the following additional constants for the @option{w} and
  9922. @option{h} options:
  9923. @table @var
  9924. @item main_w
  9925. @item main_h
  9926. The main input video's width and height
  9927. @item main_a
  9928. The same as @var{main_w} / @var{main_h}
  9929. @item main_sar
  9930. The main input video's sample aspect ratio
  9931. @item main_dar, mdar
  9932. The main input video's display aspect ratio. Calculated from
  9933. @code{(main_w / main_h) * main_sar}.
  9934. @item main_hsub
  9935. @item main_vsub
  9936. The main input video's horizontal and vertical chroma subsample values.
  9937. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  9938. is 1.
  9939. @end table
  9940. @subsection Examples
  9941. @itemize
  9942. @item
  9943. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  9944. @example
  9945. 'scale2ref[b][a];[a][b]overlay'
  9946. @end example
  9947. @end itemize
  9948. @anchor{selectivecolor}
  9949. @section selectivecolor
  9950. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  9951. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  9952. by the "purity" of the color (that is, how saturated it already is).
  9953. This filter is similar to the Adobe Photoshop Selective Color tool.
  9954. The filter accepts the following options:
  9955. @table @option
  9956. @item correction_method
  9957. Select color correction method.
  9958. Available values are:
  9959. @table @samp
  9960. @item absolute
  9961. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  9962. component value).
  9963. @item relative
  9964. Specified adjustments are relative to the original component value.
  9965. @end table
  9966. Default is @code{absolute}.
  9967. @item reds
  9968. Adjustments for red pixels (pixels where the red component is the maximum)
  9969. @item yellows
  9970. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  9971. @item greens
  9972. Adjustments for green pixels (pixels where the green component is the maximum)
  9973. @item cyans
  9974. Adjustments for cyan pixels (pixels where the red component is the minimum)
  9975. @item blues
  9976. Adjustments for blue pixels (pixels where the blue component is the maximum)
  9977. @item magentas
  9978. Adjustments for magenta pixels (pixels where the green component is the minimum)
  9979. @item whites
  9980. Adjustments for white pixels (pixels where all components are greater than 128)
  9981. @item neutrals
  9982. Adjustments for all pixels except pure black and pure white
  9983. @item blacks
  9984. Adjustments for black pixels (pixels where all components are lesser than 128)
  9985. @item psfile
  9986. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  9987. @end table
  9988. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  9989. 4 space separated floating point adjustment values in the [-1,1] range,
  9990. respectively to adjust the amount of cyan, magenta, yellow and black for the
  9991. pixels of its range.
  9992. @subsection Examples
  9993. @itemize
  9994. @item
  9995. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  9996. increase magenta by 27% in blue areas:
  9997. @example
  9998. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  9999. @end example
  10000. @item
  10001. Use a Photoshop selective color preset:
  10002. @example
  10003. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  10004. @end example
  10005. @end itemize
  10006. @anchor{separatefields}
  10007. @section separatefields
  10008. The @code{separatefields} takes a frame-based video input and splits
  10009. each frame into its components fields, producing a new half height clip
  10010. with twice the frame rate and twice the frame count.
  10011. This filter use field-dominance information in frame to decide which
  10012. of each pair of fields to place first in the output.
  10013. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  10014. @section setdar, setsar
  10015. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  10016. output video.
  10017. This is done by changing the specified Sample (aka Pixel) Aspect
  10018. Ratio, according to the following equation:
  10019. @example
  10020. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  10021. @end example
  10022. Keep in mind that the @code{setdar} filter does not modify the pixel
  10023. dimensions of the video frame. Also, the display aspect ratio set by
  10024. this filter may be changed by later filters in the filterchain,
  10025. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  10026. applied.
  10027. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  10028. the filter output video.
  10029. Note that as a consequence of the application of this filter, the
  10030. output display aspect ratio will change according to the equation
  10031. above.
  10032. Keep in mind that the sample aspect ratio set by the @code{setsar}
  10033. filter may be changed by later filters in the filterchain, e.g. if
  10034. another "setsar" or a "setdar" filter is applied.
  10035. It accepts the following parameters:
  10036. @table @option
  10037. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  10038. Set the aspect ratio used by the filter.
  10039. The parameter can be a floating point number string, an expression, or
  10040. a string of the form @var{num}:@var{den}, where @var{num} and
  10041. @var{den} are the numerator and denominator of the aspect ratio. If
  10042. the parameter is not specified, it is assumed the value "0".
  10043. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  10044. should be escaped.
  10045. @item max
  10046. Set the maximum integer value to use for expressing numerator and
  10047. denominator when reducing the expressed aspect ratio to a rational.
  10048. Default value is @code{100}.
  10049. @end table
  10050. The parameter @var{sar} is an expression containing
  10051. the following constants:
  10052. @table @option
  10053. @item E, PI, PHI
  10054. These are approximated values for the mathematical constants e
  10055. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  10056. @item w, h
  10057. The input width and height.
  10058. @item a
  10059. These are the same as @var{w} / @var{h}.
  10060. @item sar
  10061. The input sample aspect ratio.
  10062. @item dar
  10063. The input display aspect ratio. It is the same as
  10064. (@var{w} / @var{h}) * @var{sar}.
  10065. @item hsub, vsub
  10066. Horizontal and vertical chroma subsample values. For example, for the
  10067. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10068. @end table
  10069. @subsection Examples
  10070. @itemize
  10071. @item
  10072. To change the display aspect ratio to 16:9, specify one of the following:
  10073. @example
  10074. setdar=dar=1.77777
  10075. setdar=dar=16/9
  10076. @end example
  10077. @item
  10078. To change the sample aspect ratio to 10:11, specify:
  10079. @example
  10080. setsar=sar=10/11
  10081. @end example
  10082. @item
  10083. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  10084. 1000 in the aspect ratio reduction, use the command:
  10085. @example
  10086. setdar=ratio=16/9:max=1000
  10087. @end example
  10088. @end itemize
  10089. @anchor{setfield}
  10090. @section setfield
  10091. Force field for the output video frame.
  10092. The @code{setfield} filter marks the interlace type field for the
  10093. output frames. It does not change the input frame, but only sets the
  10094. corresponding property, which affects how the frame is treated by
  10095. following filters (e.g. @code{fieldorder} or @code{yadif}).
  10096. The filter accepts the following options:
  10097. @table @option
  10098. @item mode
  10099. Available values are:
  10100. @table @samp
  10101. @item auto
  10102. Keep the same field property.
  10103. @item bff
  10104. Mark the frame as bottom-field-first.
  10105. @item tff
  10106. Mark the frame as top-field-first.
  10107. @item prog
  10108. Mark the frame as progressive.
  10109. @end table
  10110. @end table
  10111. @section showinfo
  10112. Show a line containing various information for each input video frame.
  10113. The input video is not modified.
  10114. The shown line contains a sequence of key/value pairs of the form
  10115. @var{key}:@var{value}.
  10116. The following values are shown in the output:
  10117. @table @option
  10118. @item n
  10119. The (sequential) number of the input frame, starting from 0.
  10120. @item pts
  10121. The Presentation TimeStamp of the input frame, expressed as a number of
  10122. time base units. The time base unit depends on the filter input pad.
  10123. @item pts_time
  10124. The Presentation TimeStamp of the input frame, expressed as a number of
  10125. seconds.
  10126. @item pos
  10127. The position of the frame in the input stream, or -1 if this information is
  10128. unavailable and/or meaningless (for example in case of synthetic video).
  10129. @item fmt
  10130. The pixel format name.
  10131. @item sar
  10132. The sample aspect ratio of the input frame, expressed in the form
  10133. @var{num}/@var{den}.
  10134. @item s
  10135. The size of the input frame. For the syntax of this option, check the
  10136. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10137. @item i
  10138. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  10139. for bottom field first).
  10140. @item iskey
  10141. This is 1 if the frame is a key frame, 0 otherwise.
  10142. @item type
  10143. The picture type of the input frame ("I" for an I-frame, "P" for a
  10144. P-frame, "B" for a B-frame, or "?" for an unknown type).
  10145. Also refer to the documentation of the @code{AVPictureType} enum and of
  10146. the @code{av_get_picture_type_char} function defined in
  10147. @file{libavutil/avutil.h}.
  10148. @item checksum
  10149. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  10150. @item plane_checksum
  10151. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  10152. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  10153. @end table
  10154. @section showpalette
  10155. Displays the 256 colors palette of each frame. This filter is only relevant for
  10156. @var{pal8} pixel format frames.
  10157. It accepts the following option:
  10158. @table @option
  10159. @item s
  10160. Set the size of the box used to represent one palette color entry. Default is
  10161. @code{30} (for a @code{30x30} pixel box).
  10162. @end table
  10163. @section shuffleframes
  10164. Reorder and/or duplicate and/or drop video frames.
  10165. It accepts the following parameters:
  10166. @table @option
  10167. @item mapping
  10168. Set the destination indexes of input frames.
  10169. This is space or '|' separated list of indexes that maps input frames to output
  10170. frames. Number of indexes also sets maximal value that each index may have.
  10171. '-1' index have special meaning and that is to drop frame.
  10172. @end table
  10173. The first frame has the index 0. The default is to keep the input unchanged.
  10174. @subsection Examples
  10175. @itemize
  10176. @item
  10177. Swap second and third frame of every three frames of the input:
  10178. @example
  10179. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  10180. @end example
  10181. @item
  10182. Swap 10th and 1st frame of every ten frames of the input:
  10183. @example
  10184. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  10185. @end example
  10186. @end itemize
  10187. @section shuffleplanes
  10188. Reorder and/or duplicate video planes.
  10189. It accepts the following parameters:
  10190. @table @option
  10191. @item map0
  10192. The index of the input plane to be used as the first output plane.
  10193. @item map1
  10194. The index of the input plane to be used as the second output plane.
  10195. @item map2
  10196. The index of the input plane to be used as the third output plane.
  10197. @item map3
  10198. The index of the input plane to be used as the fourth output plane.
  10199. @end table
  10200. The first plane has the index 0. The default is to keep the input unchanged.
  10201. @subsection Examples
  10202. @itemize
  10203. @item
  10204. Swap the second and third planes of the input:
  10205. @example
  10206. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  10207. @end example
  10208. @end itemize
  10209. @anchor{signalstats}
  10210. @section signalstats
  10211. Evaluate various visual metrics that assist in determining issues associated
  10212. with the digitization of analog video media.
  10213. By default the filter will log these metadata values:
  10214. @table @option
  10215. @item YMIN
  10216. Display the minimal Y value contained within the input frame. Expressed in
  10217. range of [0-255].
  10218. @item YLOW
  10219. Display the Y value at the 10% percentile within the input frame. Expressed in
  10220. range of [0-255].
  10221. @item YAVG
  10222. Display the average Y value within the input frame. Expressed in range of
  10223. [0-255].
  10224. @item YHIGH
  10225. Display the Y value at the 90% percentile within the input frame. Expressed in
  10226. range of [0-255].
  10227. @item YMAX
  10228. Display the maximum Y value contained within the input frame. Expressed in
  10229. range of [0-255].
  10230. @item UMIN
  10231. Display the minimal U value contained within the input frame. Expressed in
  10232. range of [0-255].
  10233. @item ULOW
  10234. Display the U value at the 10% percentile within the input frame. Expressed in
  10235. range of [0-255].
  10236. @item UAVG
  10237. Display the average U value within the input frame. Expressed in range of
  10238. [0-255].
  10239. @item UHIGH
  10240. Display the U value at the 90% percentile within the input frame. Expressed in
  10241. range of [0-255].
  10242. @item UMAX
  10243. Display the maximum U value contained within the input frame. Expressed in
  10244. range of [0-255].
  10245. @item VMIN
  10246. Display the minimal V value contained within the input frame. Expressed in
  10247. range of [0-255].
  10248. @item VLOW
  10249. Display the V value at the 10% percentile within the input frame. Expressed in
  10250. range of [0-255].
  10251. @item VAVG
  10252. Display the average V value within the input frame. Expressed in range of
  10253. [0-255].
  10254. @item VHIGH
  10255. Display the V value at the 90% percentile within the input frame. Expressed in
  10256. range of [0-255].
  10257. @item VMAX
  10258. Display the maximum V value contained within the input frame. Expressed in
  10259. range of [0-255].
  10260. @item SATMIN
  10261. Display the minimal saturation value contained within the input frame.
  10262. Expressed in range of [0-~181.02].
  10263. @item SATLOW
  10264. Display the saturation value at the 10% percentile within the input frame.
  10265. Expressed in range of [0-~181.02].
  10266. @item SATAVG
  10267. Display the average saturation value within the input frame. Expressed in range
  10268. of [0-~181.02].
  10269. @item SATHIGH
  10270. Display the saturation value at the 90% percentile within the input frame.
  10271. Expressed in range of [0-~181.02].
  10272. @item SATMAX
  10273. Display the maximum saturation value contained within the input frame.
  10274. Expressed in range of [0-~181.02].
  10275. @item HUEMED
  10276. Display the median value for hue within the input frame. Expressed in range of
  10277. [0-360].
  10278. @item HUEAVG
  10279. Display the average value for hue within the input frame. Expressed in range of
  10280. [0-360].
  10281. @item YDIF
  10282. Display the average of sample value difference between all values of the Y
  10283. plane in the current frame and corresponding values of the previous input frame.
  10284. Expressed in range of [0-255].
  10285. @item UDIF
  10286. Display the average of sample value difference between all values of the U
  10287. plane in the current frame and corresponding values of the previous input frame.
  10288. Expressed in range of [0-255].
  10289. @item VDIF
  10290. Display the average of sample value difference between all values of the V
  10291. plane in the current frame and corresponding values of the previous input frame.
  10292. Expressed in range of [0-255].
  10293. @item YBITDEPTH
  10294. Display bit depth of Y plane in current frame.
  10295. Expressed in range of [0-16].
  10296. @item UBITDEPTH
  10297. Display bit depth of U plane in current frame.
  10298. Expressed in range of [0-16].
  10299. @item VBITDEPTH
  10300. Display bit depth of V plane in current frame.
  10301. Expressed in range of [0-16].
  10302. @end table
  10303. The filter accepts the following options:
  10304. @table @option
  10305. @item stat
  10306. @item out
  10307. @option{stat} specify an additional form of image analysis.
  10308. @option{out} output video with the specified type of pixel highlighted.
  10309. Both options accept the following values:
  10310. @table @samp
  10311. @item tout
  10312. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  10313. unlike the neighboring pixels of the same field. Examples of temporal outliers
  10314. include the results of video dropouts, head clogs, or tape tracking issues.
  10315. @item vrep
  10316. Identify @var{vertical line repetition}. Vertical line repetition includes
  10317. similar rows of pixels within a frame. In born-digital video vertical line
  10318. repetition is common, but this pattern is uncommon in video digitized from an
  10319. analog source. When it occurs in video that results from the digitization of an
  10320. analog source it can indicate concealment from a dropout compensator.
  10321. @item brng
  10322. Identify pixels that fall outside of legal broadcast range.
  10323. @end table
  10324. @item color, c
  10325. Set the highlight color for the @option{out} option. The default color is
  10326. yellow.
  10327. @end table
  10328. @subsection Examples
  10329. @itemize
  10330. @item
  10331. Output data of various video metrics:
  10332. @example
  10333. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  10334. @end example
  10335. @item
  10336. Output specific data about the minimum and maximum values of the Y plane per frame:
  10337. @example
  10338. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  10339. @end example
  10340. @item
  10341. Playback video while highlighting pixels that are outside of broadcast range in red.
  10342. @example
  10343. ffplay example.mov -vf signalstats="out=brng:color=red"
  10344. @end example
  10345. @item
  10346. Playback video with signalstats metadata drawn over the frame.
  10347. @example
  10348. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  10349. @end example
  10350. The contents of signalstat_drawtext.txt used in the command are:
  10351. @example
  10352. time %@{pts:hms@}
  10353. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  10354. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  10355. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  10356. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  10357. @end example
  10358. @end itemize
  10359. @anchor{signature}
  10360. @section signature
  10361. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  10362. input. In this case the matching between the inputs can be calculated additionally.
  10363. The filter always passes through the first input. The signature of each stream can
  10364. be written into a file.
  10365. It accepts the following options:
  10366. @table @option
  10367. @item detectmode
  10368. Enable or disable the matching process.
  10369. Available values are:
  10370. @table @samp
  10371. @item off
  10372. Disable the calculation of a matching (default).
  10373. @item full
  10374. Calculate the matching for the whole video and output whether the whole video
  10375. matches or only parts.
  10376. @item fast
  10377. Calculate only until a matching is found or the video ends. Should be faster in
  10378. some cases.
  10379. @end table
  10380. @item nb_inputs
  10381. Set the number of inputs. The option value must be a non negative integer.
  10382. Default value is 1.
  10383. @item filename
  10384. Set the path to which the output is written. If there is more than one input,
  10385. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  10386. integer), that will be replaced with the input number. If no filename is
  10387. specified, no output will be written. This is the default.
  10388. @item format
  10389. Choose the output format.
  10390. Available values are:
  10391. @table @samp
  10392. @item binary
  10393. Use the specified binary representation (default).
  10394. @item xml
  10395. Use the specified xml representation.
  10396. @end table
  10397. @item th_d
  10398. Set threshold to detect one word as similar. The option value must be an integer
  10399. greater than zero. The default value is 9000.
  10400. @item th_dc
  10401. Set threshold to detect all words as similar. The option value must be an integer
  10402. greater than zero. The default value is 60000.
  10403. @item th_xh
  10404. Set threshold to detect frames as similar. The option value must be an integer
  10405. greater than zero. The default value is 116.
  10406. @item th_di
  10407. Set the minimum length of a sequence in frames to recognize it as matching
  10408. sequence. The option value must be a non negative integer value.
  10409. The default value is 0.
  10410. @item th_it
  10411. Set the minimum relation, that matching frames to all frames must have.
  10412. The option value must be a double value between 0 and 1. The default value is 0.5.
  10413. @end table
  10414. @subsection Examples
  10415. @itemize
  10416. @item
  10417. To calculate the signature of an input video and store it in signature.bin:
  10418. @example
  10419. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  10420. @end example
  10421. @item
  10422. To detect whether two videos match and store the signatures in XML format in
  10423. signature0.xml and signature1.xml:
  10424. @example
  10425. 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 -
  10426. @end example
  10427. @end itemize
  10428. @anchor{smartblur}
  10429. @section smartblur
  10430. Blur the input video without impacting the outlines.
  10431. It accepts the following options:
  10432. @table @option
  10433. @item luma_radius, lr
  10434. Set the luma radius. The option value must be a float number in
  10435. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10436. used to blur the image (slower if larger). Default value is 1.0.
  10437. @item luma_strength, ls
  10438. Set the luma strength. The option value must be a float number
  10439. in the range [-1.0,1.0] that configures the blurring. A value included
  10440. in [0.0,1.0] will blur the image whereas a value included in
  10441. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  10442. @item luma_threshold, lt
  10443. Set the luma threshold used as a coefficient to determine
  10444. whether a pixel should be blurred or not. The option value must be an
  10445. integer in the range [-30,30]. A value of 0 will filter all the image,
  10446. a value included in [0,30] will filter flat areas and a value included
  10447. in [-30,0] will filter edges. Default value is 0.
  10448. @item chroma_radius, cr
  10449. Set the chroma radius. The option value must be a float number in
  10450. the range [0.1,5.0] that specifies the variance of the gaussian filter
  10451. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  10452. @item chroma_strength, cs
  10453. Set the chroma strength. The option value must be a float number
  10454. in the range [-1.0,1.0] that configures the blurring. A value included
  10455. in [0.0,1.0] will blur the image whereas a value included in
  10456. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  10457. @item chroma_threshold, ct
  10458. Set the chroma threshold used as a coefficient to determine
  10459. whether a pixel should be blurred or not. The option value must be an
  10460. integer in the range [-30,30]. A value of 0 will filter all the image,
  10461. a value included in [0,30] will filter flat areas and a value included
  10462. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  10463. @end table
  10464. If a chroma option is not explicitly set, the corresponding luma value
  10465. is set.
  10466. @section ssim
  10467. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  10468. This filter takes in input two input videos, the first input is
  10469. considered the "main" source and is passed unchanged to the
  10470. output. The second input is used as a "reference" video for computing
  10471. the SSIM.
  10472. Both video inputs must have the same resolution and pixel format for
  10473. this filter to work correctly. Also it assumes that both inputs
  10474. have the same number of frames, which are compared one by one.
  10475. The filter stores the calculated SSIM of each frame.
  10476. The description of the accepted parameters follows.
  10477. @table @option
  10478. @item stats_file, f
  10479. If specified the filter will use the named file to save the SSIM of
  10480. each individual frame. When filename equals "-" the data is sent to
  10481. standard output.
  10482. @end table
  10483. The file printed if @var{stats_file} is selected, contains a sequence of
  10484. key/value pairs of the form @var{key}:@var{value} for each compared
  10485. couple of frames.
  10486. A description of each shown parameter follows:
  10487. @table @option
  10488. @item n
  10489. sequential number of the input frame, starting from 1
  10490. @item Y, U, V, R, G, B
  10491. SSIM of the compared frames for the component specified by the suffix.
  10492. @item All
  10493. SSIM of the compared frames for the whole frame.
  10494. @item dB
  10495. Same as above but in dB representation.
  10496. @end table
  10497. This filter also supports the @ref{framesync} options.
  10498. For example:
  10499. @example
  10500. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  10501. [main][ref] ssim="stats_file=stats.log" [out]
  10502. @end example
  10503. On this example the input file being processed is compared with the
  10504. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  10505. is stored in @file{stats.log}.
  10506. Another example with both psnr and ssim at same time:
  10507. @example
  10508. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  10509. @end example
  10510. @section stereo3d
  10511. Convert between different stereoscopic image formats.
  10512. The filters accept the following options:
  10513. @table @option
  10514. @item in
  10515. Set stereoscopic image format of input.
  10516. Available values for input image formats are:
  10517. @table @samp
  10518. @item sbsl
  10519. side by side parallel (left eye left, right eye right)
  10520. @item sbsr
  10521. side by side crosseye (right eye left, left eye right)
  10522. @item sbs2l
  10523. side by side parallel with half width resolution
  10524. (left eye left, right eye right)
  10525. @item sbs2r
  10526. side by side crosseye with half width resolution
  10527. (right eye left, left eye right)
  10528. @item abl
  10529. above-below (left eye above, right eye below)
  10530. @item abr
  10531. above-below (right eye above, left eye below)
  10532. @item ab2l
  10533. above-below with half height resolution
  10534. (left eye above, right eye below)
  10535. @item ab2r
  10536. above-below with half height resolution
  10537. (right eye above, left eye below)
  10538. @item al
  10539. alternating frames (left eye first, right eye second)
  10540. @item ar
  10541. alternating frames (right eye first, left eye second)
  10542. @item irl
  10543. interleaved rows (left eye has top row, right eye starts on next row)
  10544. @item irr
  10545. interleaved rows (right eye has top row, left eye starts on next row)
  10546. @item icl
  10547. interleaved columns, left eye first
  10548. @item icr
  10549. interleaved columns, right eye first
  10550. Default value is @samp{sbsl}.
  10551. @end table
  10552. @item out
  10553. Set stereoscopic image format of output.
  10554. @table @samp
  10555. @item sbsl
  10556. side by side parallel (left eye left, right eye right)
  10557. @item sbsr
  10558. side by side crosseye (right eye left, left eye right)
  10559. @item sbs2l
  10560. side by side parallel with half width resolution
  10561. (left eye left, right eye right)
  10562. @item sbs2r
  10563. side by side crosseye with half width resolution
  10564. (right eye left, left eye right)
  10565. @item abl
  10566. above-below (left eye above, right eye below)
  10567. @item abr
  10568. above-below (right eye above, left eye below)
  10569. @item ab2l
  10570. above-below with half height resolution
  10571. (left eye above, right eye below)
  10572. @item ab2r
  10573. above-below with half height resolution
  10574. (right eye above, left eye below)
  10575. @item al
  10576. alternating frames (left eye first, right eye second)
  10577. @item ar
  10578. alternating frames (right eye first, left eye second)
  10579. @item irl
  10580. interleaved rows (left eye has top row, right eye starts on next row)
  10581. @item irr
  10582. interleaved rows (right eye has top row, left eye starts on next row)
  10583. @item arbg
  10584. anaglyph red/blue gray
  10585. (red filter on left eye, blue filter on right eye)
  10586. @item argg
  10587. anaglyph red/green gray
  10588. (red filter on left eye, green filter on right eye)
  10589. @item arcg
  10590. anaglyph red/cyan gray
  10591. (red filter on left eye, cyan filter on right eye)
  10592. @item arch
  10593. anaglyph red/cyan half colored
  10594. (red filter on left eye, cyan filter on right eye)
  10595. @item arcc
  10596. anaglyph red/cyan color
  10597. (red filter on left eye, cyan filter on right eye)
  10598. @item arcd
  10599. anaglyph red/cyan color optimized with the least squares projection of dubois
  10600. (red filter on left eye, cyan filter on right eye)
  10601. @item agmg
  10602. anaglyph green/magenta gray
  10603. (green filter on left eye, magenta filter on right eye)
  10604. @item agmh
  10605. anaglyph green/magenta half colored
  10606. (green filter on left eye, magenta filter on right eye)
  10607. @item agmc
  10608. anaglyph green/magenta colored
  10609. (green filter on left eye, magenta filter on right eye)
  10610. @item agmd
  10611. anaglyph green/magenta color optimized with the least squares projection of dubois
  10612. (green filter on left eye, magenta filter on right eye)
  10613. @item aybg
  10614. anaglyph yellow/blue gray
  10615. (yellow filter on left eye, blue filter on right eye)
  10616. @item aybh
  10617. anaglyph yellow/blue half colored
  10618. (yellow filter on left eye, blue filter on right eye)
  10619. @item aybc
  10620. anaglyph yellow/blue colored
  10621. (yellow filter on left eye, blue filter on right eye)
  10622. @item aybd
  10623. anaglyph yellow/blue color optimized with the least squares projection of dubois
  10624. (yellow filter on left eye, blue filter on right eye)
  10625. @item ml
  10626. mono output (left eye only)
  10627. @item mr
  10628. mono output (right eye only)
  10629. @item chl
  10630. checkerboard, left eye first
  10631. @item chr
  10632. checkerboard, right eye first
  10633. @item icl
  10634. interleaved columns, left eye first
  10635. @item icr
  10636. interleaved columns, right eye first
  10637. @item hdmi
  10638. HDMI frame pack
  10639. @end table
  10640. Default value is @samp{arcd}.
  10641. @end table
  10642. @subsection Examples
  10643. @itemize
  10644. @item
  10645. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  10646. @example
  10647. stereo3d=sbsl:aybd
  10648. @end example
  10649. @item
  10650. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  10651. @example
  10652. stereo3d=abl:sbsr
  10653. @end example
  10654. @end itemize
  10655. @section streamselect, astreamselect
  10656. Select video or audio streams.
  10657. The filter accepts the following options:
  10658. @table @option
  10659. @item inputs
  10660. Set number of inputs. Default is 2.
  10661. @item map
  10662. Set input indexes to remap to outputs.
  10663. @end table
  10664. @subsection Commands
  10665. The @code{streamselect} and @code{astreamselect} filter supports the following
  10666. commands:
  10667. @table @option
  10668. @item map
  10669. Set input indexes to remap to outputs.
  10670. @end table
  10671. @subsection Examples
  10672. @itemize
  10673. @item
  10674. Select first 5 seconds 1st stream and rest of time 2nd stream:
  10675. @example
  10676. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  10677. @end example
  10678. @item
  10679. Same as above, but for audio:
  10680. @example
  10681. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  10682. @end example
  10683. @end itemize
  10684. @section sobel
  10685. Apply sobel operator to input video stream.
  10686. The filter accepts the following option:
  10687. @table @option
  10688. @item planes
  10689. Set which planes will be processed, unprocessed planes will be copied.
  10690. By default value 0xf, all planes will be processed.
  10691. @item scale
  10692. Set value which will be multiplied with filtered result.
  10693. @item delta
  10694. Set value which will be added to filtered result.
  10695. @end table
  10696. @anchor{spp}
  10697. @section spp
  10698. Apply a simple postprocessing filter that compresses and decompresses the image
  10699. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  10700. and average the results.
  10701. The filter accepts the following options:
  10702. @table @option
  10703. @item quality
  10704. Set quality. This option defines the number of levels for averaging. It accepts
  10705. an integer in the range 0-6. If set to @code{0}, the filter will have no
  10706. effect. A value of @code{6} means the higher quality. For each increment of
  10707. that value the speed drops by a factor of approximately 2. Default value is
  10708. @code{3}.
  10709. @item qp
  10710. Force a constant quantization parameter. If not set, the filter will use the QP
  10711. from the video stream (if available).
  10712. @item mode
  10713. Set thresholding mode. Available modes are:
  10714. @table @samp
  10715. @item hard
  10716. Set hard thresholding (default).
  10717. @item soft
  10718. Set soft thresholding (better de-ringing effect, but likely blurrier).
  10719. @end table
  10720. @item use_bframe_qp
  10721. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  10722. option may cause flicker since the B-Frames have often larger QP. Default is
  10723. @code{0} (not enabled).
  10724. @end table
  10725. @anchor{subtitles}
  10726. @section subtitles
  10727. Draw subtitles on top of input video using the libass library.
  10728. To enable compilation of this filter you need to configure FFmpeg with
  10729. @code{--enable-libass}. This filter also requires a build with libavcodec and
  10730. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  10731. Alpha) subtitles format.
  10732. The filter accepts the following options:
  10733. @table @option
  10734. @item filename, f
  10735. Set the filename of the subtitle file to read. It must be specified.
  10736. @item original_size
  10737. Specify the size of the original video, the video for which the ASS file
  10738. was composed. For the syntax of this option, check the
  10739. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10740. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  10741. correctly scale the fonts if the aspect ratio has been changed.
  10742. @item fontsdir
  10743. Set a directory path containing fonts that can be used by the filter.
  10744. These fonts will be used in addition to whatever the font provider uses.
  10745. @item alpha
  10746. Process alpha channel, by default alpha channel is untouched.
  10747. @item charenc
  10748. Set subtitles input character encoding. @code{subtitles} filter only. Only
  10749. useful if not UTF-8.
  10750. @item stream_index, si
  10751. Set subtitles stream index. @code{subtitles} filter only.
  10752. @item force_style
  10753. Override default style or script info parameters of the subtitles. It accepts a
  10754. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  10755. @end table
  10756. If the first key is not specified, it is assumed that the first value
  10757. specifies the @option{filename}.
  10758. For example, to render the file @file{sub.srt} on top of the input
  10759. video, use the command:
  10760. @example
  10761. subtitles=sub.srt
  10762. @end example
  10763. which is equivalent to:
  10764. @example
  10765. subtitles=filename=sub.srt
  10766. @end example
  10767. To render the default subtitles stream from file @file{video.mkv}, use:
  10768. @example
  10769. subtitles=video.mkv
  10770. @end example
  10771. To render the second subtitles stream from that file, use:
  10772. @example
  10773. subtitles=video.mkv:si=1
  10774. @end example
  10775. To make the subtitles stream from @file{sub.srt} appear in transparent green
  10776. @code{DejaVu Serif}, use:
  10777. @example
  10778. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  10779. @end example
  10780. @section super2xsai
  10781. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  10782. Interpolate) pixel art scaling algorithm.
  10783. Useful for enlarging pixel art images without reducing sharpness.
  10784. @section swaprect
  10785. Swap two rectangular objects in video.
  10786. This filter accepts the following options:
  10787. @table @option
  10788. @item w
  10789. Set object width.
  10790. @item h
  10791. Set object height.
  10792. @item x1
  10793. Set 1st rect x coordinate.
  10794. @item y1
  10795. Set 1st rect y coordinate.
  10796. @item x2
  10797. Set 2nd rect x coordinate.
  10798. @item y2
  10799. Set 2nd rect y coordinate.
  10800. All expressions are evaluated once for each frame.
  10801. @end table
  10802. The all options are expressions containing the following constants:
  10803. @table @option
  10804. @item w
  10805. @item h
  10806. The input width and height.
  10807. @item a
  10808. same as @var{w} / @var{h}
  10809. @item sar
  10810. input sample aspect ratio
  10811. @item dar
  10812. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  10813. @item n
  10814. The number of the input frame, starting from 0.
  10815. @item t
  10816. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  10817. @item pos
  10818. the position in the file of the input frame, NAN if unknown
  10819. @end table
  10820. @section swapuv
  10821. Swap U & V plane.
  10822. @section telecine
  10823. Apply telecine process to the video.
  10824. This filter accepts the following options:
  10825. @table @option
  10826. @item first_field
  10827. @table @samp
  10828. @item top, t
  10829. top field first
  10830. @item bottom, b
  10831. bottom field first
  10832. The default value is @code{top}.
  10833. @end table
  10834. @item pattern
  10835. A string of numbers representing the pulldown pattern you wish to apply.
  10836. The default value is @code{23}.
  10837. @end table
  10838. @example
  10839. Some typical patterns:
  10840. NTSC output (30i):
  10841. 27.5p: 32222
  10842. 24p: 23 (classic)
  10843. 24p: 2332 (preferred)
  10844. 20p: 33
  10845. 18p: 334
  10846. 16p: 3444
  10847. PAL output (25i):
  10848. 27.5p: 12222
  10849. 24p: 222222222223 ("Euro pulldown")
  10850. 16.67p: 33
  10851. 16p: 33333334
  10852. @end example
  10853. @section threshold
  10854. Apply threshold effect to video stream.
  10855. This filter needs four video streams to perform thresholding.
  10856. First stream is stream we are filtering.
  10857. Second stream is holding threshold values, third stream is holding min values,
  10858. and last, fourth stream is holding max values.
  10859. The filter accepts the following option:
  10860. @table @option
  10861. @item planes
  10862. Set which planes will be processed, unprocessed planes will be copied.
  10863. By default value 0xf, all planes will be processed.
  10864. @end table
  10865. For example if first stream pixel's component value is less then threshold value
  10866. of pixel component from 2nd threshold stream, third stream value will picked,
  10867. otherwise fourth stream pixel component value will be picked.
  10868. Using color source filter one can perform various types of thresholding:
  10869. @subsection Examples
  10870. @itemize
  10871. @item
  10872. Binary threshold, using gray color as threshold:
  10873. @example
  10874. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  10875. @end example
  10876. @item
  10877. Inverted binary threshold, using gray color as threshold:
  10878. @example
  10879. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  10880. @end example
  10881. @item
  10882. Truncate binary threshold, using gray color as threshold:
  10883. @example
  10884. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  10885. @end example
  10886. @item
  10887. Threshold to zero, using gray color as threshold:
  10888. @example
  10889. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  10890. @end example
  10891. @item
  10892. Inverted threshold to zero, using gray color as threshold:
  10893. @example
  10894. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  10895. @end example
  10896. @end itemize
  10897. @section thumbnail
  10898. Select the most representative frame in a given sequence of consecutive frames.
  10899. The filter accepts the following options:
  10900. @table @option
  10901. @item n
  10902. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  10903. will pick one of them, and then handle the next batch of @var{n} frames until
  10904. the end. Default is @code{100}.
  10905. @end table
  10906. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  10907. value will result in a higher memory usage, so a high value is not recommended.
  10908. @subsection Examples
  10909. @itemize
  10910. @item
  10911. Extract one picture each 50 frames:
  10912. @example
  10913. thumbnail=50
  10914. @end example
  10915. @item
  10916. Complete example of a thumbnail creation with @command{ffmpeg}:
  10917. @example
  10918. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  10919. @end example
  10920. @end itemize
  10921. @section tile
  10922. Tile several successive frames together.
  10923. The filter accepts the following options:
  10924. @table @option
  10925. @item layout
  10926. Set the grid size (i.e. the number of lines and columns). For the syntax of
  10927. this option, check the
  10928. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10929. @item nb_frames
  10930. Set the maximum number of frames to render in the given area. It must be less
  10931. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  10932. the area will be used.
  10933. @item margin
  10934. Set the outer border margin in pixels.
  10935. @item padding
  10936. Set the inner border thickness (i.e. the number of pixels between frames). For
  10937. more advanced padding options (such as having different values for the edges),
  10938. refer to the pad video filter.
  10939. @item color
  10940. Specify the color of the unused area. For the syntax of this option, check the
  10941. "Color" section in the ffmpeg-utils manual. The default value of @var{color}
  10942. is "black".
  10943. @end table
  10944. @subsection Examples
  10945. @itemize
  10946. @item
  10947. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  10948. @example
  10949. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  10950. @end example
  10951. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  10952. duplicating each output frame to accommodate the originally detected frame
  10953. rate.
  10954. @item
  10955. Display @code{5} pictures in an area of @code{3x2} frames,
  10956. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  10957. mixed flat and named options:
  10958. @example
  10959. tile=3x2:nb_frames=5:padding=7:margin=2
  10960. @end example
  10961. @end itemize
  10962. @section tinterlace
  10963. Perform various types of temporal field interlacing.
  10964. Frames are counted starting from 1, so the first input frame is
  10965. considered odd.
  10966. The filter accepts the following options:
  10967. @table @option
  10968. @item mode
  10969. Specify the mode of the interlacing. This option can also be specified
  10970. as a value alone. See below for a list of values for this option.
  10971. Available values are:
  10972. @table @samp
  10973. @item merge, 0
  10974. Move odd frames into the upper field, even into the lower field,
  10975. generating a double height frame at half frame rate.
  10976. @example
  10977. ------> time
  10978. Input:
  10979. Frame 1 Frame 2 Frame 3 Frame 4
  10980. 11111 22222 33333 44444
  10981. 11111 22222 33333 44444
  10982. 11111 22222 33333 44444
  10983. 11111 22222 33333 44444
  10984. Output:
  10985. 11111 33333
  10986. 22222 44444
  10987. 11111 33333
  10988. 22222 44444
  10989. 11111 33333
  10990. 22222 44444
  10991. 11111 33333
  10992. 22222 44444
  10993. @end example
  10994. @item drop_even, 1
  10995. Only output odd frames, even frames are dropped, generating a frame with
  10996. unchanged height at half frame rate.
  10997. @example
  10998. ------> time
  10999. Input:
  11000. Frame 1 Frame 2 Frame 3 Frame 4
  11001. 11111 22222 33333 44444
  11002. 11111 22222 33333 44444
  11003. 11111 22222 33333 44444
  11004. 11111 22222 33333 44444
  11005. Output:
  11006. 11111 33333
  11007. 11111 33333
  11008. 11111 33333
  11009. 11111 33333
  11010. @end example
  11011. @item drop_odd, 2
  11012. Only output even frames, odd frames are dropped, generating a frame with
  11013. unchanged height at half frame rate.
  11014. @example
  11015. ------> time
  11016. Input:
  11017. Frame 1 Frame 2 Frame 3 Frame 4
  11018. 11111 22222 33333 44444
  11019. 11111 22222 33333 44444
  11020. 11111 22222 33333 44444
  11021. 11111 22222 33333 44444
  11022. Output:
  11023. 22222 44444
  11024. 22222 44444
  11025. 22222 44444
  11026. 22222 44444
  11027. @end example
  11028. @item pad, 3
  11029. Expand each frame to full height, but pad alternate lines with black,
  11030. generating a frame with double height at the same input frame rate.
  11031. @example
  11032. ------> time
  11033. Input:
  11034. Frame 1 Frame 2 Frame 3 Frame 4
  11035. 11111 22222 33333 44444
  11036. 11111 22222 33333 44444
  11037. 11111 22222 33333 44444
  11038. 11111 22222 33333 44444
  11039. Output:
  11040. 11111 ..... 33333 .....
  11041. ..... 22222 ..... 44444
  11042. 11111 ..... 33333 .....
  11043. ..... 22222 ..... 44444
  11044. 11111 ..... 33333 .....
  11045. ..... 22222 ..... 44444
  11046. 11111 ..... 33333 .....
  11047. ..... 22222 ..... 44444
  11048. @end example
  11049. @item interleave_top, 4
  11050. Interleave the upper field from odd frames with the lower field from
  11051. even frames, generating a frame with unchanged height at half frame rate.
  11052. @example
  11053. ------> time
  11054. Input:
  11055. Frame 1 Frame 2 Frame 3 Frame 4
  11056. 11111<- 22222 33333<- 44444
  11057. 11111 22222<- 33333 44444<-
  11058. 11111<- 22222 33333<- 44444
  11059. 11111 22222<- 33333 44444<-
  11060. Output:
  11061. 11111 33333
  11062. 22222 44444
  11063. 11111 33333
  11064. 22222 44444
  11065. @end example
  11066. @item interleave_bottom, 5
  11067. Interleave the lower field from odd frames with the upper field from
  11068. even frames, generating a frame with unchanged height at half frame rate.
  11069. @example
  11070. ------> time
  11071. Input:
  11072. Frame 1 Frame 2 Frame 3 Frame 4
  11073. 11111 22222<- 33333 44444<-
  11074. 11111<- 22222 33333<- 44444
  11075. 11111 22222<- 33333 44444<-
  11076. 11111<- 22222 33333<- 44444
  11077. Output:
  11078. 22222 44444
  11079. 11111 33333
  11080. 22222 44444
  11081. 11111 33333
  11082. @end example
  11083. @item interlacex2, 6
  11084. Double frame rate with unchanged height. Frames are inserted each
  11085. containing the second temporal field from the previous input frame and
  11086. the first temporal field from the next input frame. This mode relies on
  11087. the top_field_first flag. Useful for interlaced video displays with no
  11088. field synchronisation.
  11089. @example
  11090. ------> time
  11091. Input:
  11092. Frame 1 Frame 2 Frame 3 Frame 4
  11093. 11111 22222 33333 44444
  11094. 11111 22222 33333 44444
  11095. 11111 22222 33333 44444
  11096. 11111 22222 33333 44444
  11097. Output:
  11098. 11111 22222 22222 33333 33333 44444 44444
  11099. 11111 11111 22222 22222 33333 33333 44444
  11100. 11111 22222 22222 33333 33333 44444 44444
  11101. 11111 11111 22222 22222 33333 33333 44444
  11102. @end example
  11103. @item mergex2, 7
  11104. Move odd frames into the upper field, even into the lower field,
  11105. generating a double height frame at same frame rate.
  11106. @example
  11107. ------> time
  11108. Input:
  11109. Frame 1 Frame 2 Frame 3 Frame 4
  11110. 11111 22222 33333 44444
  11111. 11111 22222 33333 44444
  11112. 11111 22222 33333 44444
  11113. 11111 22222 33333 44444
  11114. Output:
  11115. 11111 33333 33333 55555
  11116. 22222 22222 44444 44444
  11117. 11111 33333 33333 55555
  11118. 22222 22222 44444 44444
  11119. 11111 33333 33333 55555
  11120. 22222 22222 44444 44444
  11121. 11111 33333 33333 55555
  11122. 22222 22222 44444 44444
  11123. @end example
  11124. @end table
  11125. Numeric values are deprecated but are accepted for backward
  11126. compatibility reasons.
  11127. Default mode is @code{merge}.
  11128. @item flags
  11129. Specify flags influencing the filter process.
  11130. Available value for @var{flags} is:
  11131. @table @option
  11132. @item low_pass_filter, vlfp
  11133. Enable linear vertical low-pass filtering in the filter.
  11134. Vertical low-pass filtering is required when creating an interlaced
  11135. destination from a progressive source which contains high-frequency
  11136. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  11137. patterning.
  11138. @item complex_filter, cvlfp
  11139. Enable complex vertical low-pass filtering.
  11140. This will slightly less reduce interlace 'twitter' and Moire
  11141. patterning but better retain detail and subjective sharpness impression.
  11142. @end table
  11143. Vertical low-pass filtering can only be enabled for @option{mode}
  11144. @var{interleave_top} and @var{interleave_bottom}.
  11145. @end table
  11146. @section tonemap
  11147. Tone map colors from different dynamic ranges.
  11148. This filter expects data in single precision floating point, as it needs to
  11149. operate on (and can output) out-of-range values. Another filter, such as
  11150. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  11151. The tonemapping algorithms implemented only work on linear light, so input
  11152. data should be linearized beforehand (and possibly correctly tagged).
  11153. @example
  11154. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  11155. @end example
  11156. @subsection Options
  11157. The filter accepts the following options.
  11158. @table @option
  11159. @item tonemap
  11160. Set the tone map algorithm to use.
  11161. Possible values are:
  11162. @table @var
  11163. @item none
  11164. Do not apply any tone map, only desaturate overbright pixels.
  11165. @item clip
  11166. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  11167. in-range values, while distorting out-of-range values.
  11168. @item linear
  11169. Stretch the entire reference gamut to a linear multiple of the display.
  11170. @item gamma
  11171. Fit a logarithmic transfer between the tone curves.
  11172. @item reinhard
  11173. Preserve overall image brightness with a simple curve, using nonlinear
  11174. contrast, which results in flattening details and degrading color accuracy.
  11175. @item hable
  11176. Peserve both dark and bright details better than @var{reinhard}, at the cost
  11177. of slightly darkening everything. Use it when detail preservation is more
  11178. important than color and brightness accuracy.
  11179. @item mobius
  11180. Smoothly map out-of-range values, while retaining contrast and colors for
  11181. in-range material as much as possible. Use it when color accuracy is more
  11182. important than detail preservation.
  11183. @end table
  11184. Default is none.
  11185. @item param
  11186. Tune the tone mapping algorithm.
  11187. This affects the following algorithms:
  11188. @table @var
  11189. @item none
  11190. Ignored.
  11191. @item linear
  11192. Specifies the scale factor to use while stretching.
  11193. Default to 1.0.
  11194. @item gamma
  11195. Specifies the exponent of the function.
  11196. Default to 1.8.
  11197. @item clip
  11198. Specify an extra linear coefficient to multiply into the signal before clipping.
  11199. Default to 1.0.
  11200. @item reinhard
  11201. Specify the local contrast coefficient at the display peak.
  11202. Default to 0.5, which means that in-gamut values will be about half as bright
  11203. as when clipping.
  11204. @item hable
  11205. Ignored.
  11206. @item mobius
  11207. Specify the transition point from linear to mobius transform. Every value
  11208. below this point is guaranteed to be mapped 1:1. The higher the value, the
  11209. more accurate the result will be, at the cost of losing bright details.
  11210. Default to 0.3, which due to the steep initial slope still preserves in-range
  11211. colors fairly accurately.
  11212. @end table
  11213. @item desat
  11214. Apply desaturation for highlights that exceed this level of brightness. The
  11215. higher the parameter, the more color information will be preserved. This
  11216. setting helps prevent unnaturally blown-out colors for super-highlights, by
  11217. (smoothly) turning into white instead. This makes images feel more natural,
  11218. at the cost of reducing information about out-of-range colors.
  11219. The default of 2.0 is somewhat conservative and will mostly just apply to
  11220. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  11221. This option works only if the input frame has a supported color tag.
  11222. @item peak
  11223. Override signal/nominal/reference peak with this value. Useful when the
  11224. embedded peak information in display metadata is not reliable or when tone
  11225. mapping from a lower range to a higher range.
  11226. @end table
  11227. @section transpose
  11228. Transpose rows with columns in the input video and optionally flip it.
  11229. It accepts the following parameters:
  11230. @table @option
  11231. @item dir
  11232. Specify the transposition direction.
  11233. Can assume the following values:
  11234. @table @samp
  11235. @item 0, 4, cclock_flip
  11236. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  11237. @example
  11238. L.R L.l
  11239. . . -> . .
  11240. l.r R.r
  11241. @end example
  11242. @item 1, 5, clock
  11243. Rotate by 90 degrees clockwise, that is:
  11244. @example
  11245. L.R l.L
  11246. . . -> . .
  11247. l.r r.R
  11248. @end example
  11249. @item 2, 6, cclock
  11250. Rotate by 90 degrees counterclockwise, that is:
  11251. @example
  11252. L.R R.r
  11253. . . -> . .
  11254. l.r L.l
  11255. @end example
  11256. @item 3, 7, clock_flip
  11257. Rotate by 90 degrees clockwise and vertically flip, that is:
  11258. @example
  11259. L.R r.R
  11260. . . -> . .
  11261. l.r l.L
  11262. @end example
  11263. @end table
  11264. For values between 4-7, the transposition is only done if the input
  11265. video geometry is portrait and not landscape. These values are
  11266. deprecated, the @code{passthrough} option should be used instead.
  11267. Numerical values are deprecated, and should be dropped in favor of
  11268. symbolic constants.
  11269. @item passthrough
  11270. Do not apply the transposition if the input geometry matches the one
  11271. specified by the specified value. It accepts the following values:
  11272. @table @samp
  11273. @item none
  11274. Always apply transposition.
  11275. @item portrait
  11276. Preserve portrait geometry (when @var{height} >= @var{width}).
  11277. @item landscape
  11278. Preserve landscape geometry (when @var{width} >= @var{height}).
  11279. @end table
  11280. Default value is @code{none}.
  11281. @end table
  11282. For example to rotate by 90 degrees clockwise and preserve portrait
  11283. layout:
  11284. @example
  11285. transpose=dir=1:passthrough=portrait
  11286. @end example
  11287. The command above can also be specified as:
  11288. @example
  11289. transpose=1:portrait
  11290. @end example
  11291. @section trim
  11292. Trim the input so that the output contains one continuous subpart of the input.
  11293. It accepts the following parameters:
  11294. @table @option
  11295. @item start
  11296. Specify the time of the start of the kept section, i.e. the frame with the
  11297. timestamp @var{start} will be the first frame in the output.
  11298. @item end
  11299. Specify the time of the first frame that will be dropped, i.e. the frame
  11300. immediately preceding the one with the timestamp @var{end} will be the last
  11301. frame in the output.
  11302. @item start_pts
  11303. This is the same as @var{start}, except this option sets the start timestamp
  11304. in timebase units instead of seconds.
  11305. @item end_pts
  11306. This is the same as @var{end}, except this option sets the end timestamp
  11307. in timebase units instead of seconds.
  11308. @item duration
  11309. The maximum duration of the output in seconds.
  11310. @item start_frame
  11311. The number of the first frame that should be passed to the output.
  11312. @item end_frame
  11313. The number of the first frame that should be dropped.
  11314. @end table
  11315. @option{start}, @option{end}, and @option{duration} are expressed as time
  11316. duration specifications; see
  11317. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  11318. for the accepted syntax.
  11319. Note that the first two sets of the start/end options and the @option{duration}
  11320. option look at the frame timestamp, while the _frame variants simply count the
  11321. frames that pass through the filter. Also note that this filter does not modify
  11322. the timestamps. If you wish for the output timestamps to start at zero, insert a
  11323. setpts filter after the trim filter.
  11324. If multiple start or end options are set, this filter tries to be greedy and
  11325. keep all the frames that match at least one of the specified constraints. To keep
  11326. only the part that matches all the constraints at once, chain multiple trim
  11327. filters.
  11328. The defaults are such that all the input is kept. So it is possible to set e.g.
  11329. just the end values to keep everything before the specified time.
  11330. Examples:
  11331. @itemize
  11332. @item
  11333. Drop everything except the second minute of input:
  11334. @example
  11335. ffmpeg -i INPUT -vf trim=60:120
  11336. @end example
  11337. @item
  11338. Keep only the first second:
  11339. @example
  11340. ffmpeg -i INPUT -vf trim=duration=1
  11341. @end example
  11342. @end itemize
  11343. @section unpremultiply
  11344. Apply alpha unpremultiply effect to input video stream using first plane
  11345. of second stream as alpha.
  11346. Both streams must have same dimensions and same pixel format.
  11347. The filter accepts the following option:
  11348. @table @option
  11349. @item planes
  11350. Set which planes will be processed, unprocessed planes will be copied.
  11351. By default value 0xf, all planes will be processed.
  11352. If the format has 1 or 2 components, then luma is bit 0.
  11353. If the format has 3 or 4 components:
  11354. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  11355. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  11356. If present, the alpha channel is always the last bit.
  11357. @item inplace
  11358. Do not require 2nd input for processing, instead use alpha plane from input stream.
  11359. @end table
  11360. @anchor{unsharp}
  11361. @section unsharp
  11362. Sharpen or blur the input video.
  11363. It accepts the following parameters:
  11364. @table @option
  11365. @item luma_msize_x, lx
  11366. Set the luma matrix horizontal size. It must be an odd integer between
  11367. 3 and 23. The default value is 5.
  11368. @item luma_msize_y, ly
  11369. Set the luma matrix vertical size. It must be an odd integer between 3
  11370. and 23. The default value is 5.
  11371. @item luma_amount, la
  11372. Set the luma effect strength. It must be a floating point number, reasonable
  11373. values lay between -1.5 and 1.5.
  11374. Negative values will blur the input video, while positive values will
  11375. sharpen it, a value of zero will disable the effect.
  11376. Default value is 1.0.
  11377. @item chroma_msize_x, cx
  11378. Set the chroma matrix horizontal size. It must be an odd integer
  11379. between 3 and 23. The default value is 5.
  11380. @item chroma_msize_y, cy
  11381. Set the chroma matrix vertical size. It must be an odd integer
  11382. between 3 and 23. The default value is 5.
  11383. @item chroma_amount, ca
  11384. Set the chroma effect strength. It must be a floating point number, reasonable
  11385. values lay between -1.5 and 1.5.
  11386. Negative values will blur the input video, while positive values will
  11387. sharpen it, a value of zero will disable the effect.
  11388. Default value is 0.0.
  11389. @item opencl
  11390. If set to 1, specify using OpenCL capabilities, only available if
  11391. FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
  11392. @end table
  11393. All parameters are optional and default to the equivalent of the
  11394. string '5:5:1.0:5:5:0.0'.
  11395. @subsection Examples
  11396. @itemize
  11397. @item
  11398. Apply strong luma sharpen effect:
  11399. @example
  11400. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  11401. @end example
  11402. @item
  11403. Apply a strong blur of both luma and chroma parameters:
  11404. @example
  11405. unsharp=7:7:-2:7:7:-2
  11406. @end example
  11407. @end itemize
  11408. @section uspp
  11409. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  11410. the image at several (or - in the case of @option{quality} level @code{8} - all)
  11411. shifts and average the results.
  11412. The way this differs from the behavior of spp is that uspp actually encodes &
  11413. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  11414. DCT similar to MJPEG.
  11415. The filter accepts the following options:
  11416. @table @option
  11417. @item quality
  11418. Set quality. This option defines the number of levels for averaging. It accepts
  11419. an integer in the range 0-8. If set to @code{0}, the filter will have no
  11420. effect. A value of @code{8} means the higher quality. For each increment of
  11421. that value the speed drops by a factor of approximately 2. Default value is
  11422. @code{3}.
  11423. @item qp
  11424. Force a constant quantization parameter. If not set, the filter will use the QP
  11425. from the video stream (if available).
  11426. @end table
  11427. @section vaguedenoiser
  11428. Apply a wavelet based denoiser.
  11429. It transforms each frame from the video input into the wavelet domain,
  11430. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  11431. the obtained coefficients. It does an inverse wavelet transform after.
  11432. Due to wavelet properties, it should give a nice smoothed result, and
  11433. reduced noise, without blurring picture features.
  11434. This filter accepts the following options:
  11435. @table @option
  11436. @item threshold
  11437. The filtering strength. The higher, the more filtered the video will be.
  11438. Hard thresholding can use a higher threshold than soft thresholding
  11439. before the video looks overfiltered. Default value is 2.
  11440. @item method
  11441. The filtering method the filter will use.
  11442. It accepts the following values:
  11443. @table @samp
  11444. @item hard
  11445. All values under the threshold will be zeroed.
  11446. @item soft
  11447. All values under the threshold will be zeroed. All values above will be
  11448. reduced by the threshold.
  11449. @item garrote
  11450. Scales or nullifies coefficients - intermediary between (more) soft and
  11451. (less) hard thresholding.
  11452. @end table
  11453. Default is garrote.
  11454. @item nsteps
  11455. Number of times, the wavelet will decompose the picture. Picture can't
  11456. be decomposed beyond a particular point (typically, 8 for a 640x480
  11457. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  11458. @item percent
  11459. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  11460. @item planes
  11461. A list of the planes to process. By default all planes are processed.
  11462. @end table
  11463. @section vectorscope
  11464. Display 2 color component values in the two dimensional graph (which is called
  11465. a vectorscope).
  11466. This filter accepts the following options:
  11467. @table @option
  11468. @item mode, m
  11469. Set vectorscope mode.
  11470. It accepts the following values:
  11471. @table @samp
  11472. @item gray
  11473. Gray values are displayed on graph, higher brightness means more pixels have
  11474. same component color value on location in graph. This is the default mode.
  11475. @item color
  11476. Gray values are displayed on graph. Surrounding pixels values which are not
  11477. present in video frame are drawn in gradient of 2 color components which are
  11478. set by option @code{x} and @code{y}. The 3rd color component is static.
  11479. @item color2
  11480. Actual color components values present in video frame are displayed on graph.
  11481. @item color3
  11482. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  11483. on graph increases value of another color component, which is luminance by
  11484. default values of @code{x} and @code{y}.
  11485. @item color4
  11486. Actual colors present in video frame are displayed on graph. If two different
  11487. colors map to same position on graph then color with higher value of component
  11488. not present in graph is picked.
  11489. @item color5
  11490. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  11491. component picked from radial gradient.
  11492. @end table
  11493. @item x
  11494. Set which color component will be represented on X-axis. Default is @code{1}.
  11495. @item y
  11496. Set which color component will be represented on Y-axis. Default is @code{2}.
  11497. @item intensity, i
  11498. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  11499. of color component which represents frequency of (X, Y) location in graph.
  11500. @item envelope, e
  11501. @table @samp
  11502. @item none
  11503. No envelope, this is default.
  11504. @item instant
  11505. Instant envelope, even darkest single pixel will be clearly highlighted.
  11506. @item peak
  11507. Hold maximum and minimum values presented in graph over time. This way you
  11508. can still spot out of range values without constantly looking at vectorscope.
  11509. @item peak+instant
  11510. Peak and instant envelope combined together.
  11511. @end table
  11512. @item graticule, g
  11513. Set what kind of graticule to draw.
  11514. @table @samp
  11515. @item none
  11516. @item green
  11517. @item color
  11518. @end table
  11519. @item opacity, o
  11520. Set graticule opacity.
  11521. @item flags, f
  11522. Set graticule flags.
  11523. @table @samp
  11524. @item white
  11525. Draw graticule for white point.
  11526. @item black
  11527. Draw graticule for black point.
  11528. @item name
  11529. Draw color points short names.
  11530. @end table
  11531. @item bgopacity, b
  11532. Set background opacity.
  11533. @item lthreshold, l
  11534. Set low threshold for color component not represented on X or Y axis.
  11535. Values lower than this value will be ignored. Default is 0.
  11536. Note this value is multiplied with actual max possible value one pixel component
  11537. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  11538. is 0.1 * 255 = 25.
  11539. @item hthreshold, h
  11540. Set high threshold for color component not represented on X or Y axis.
  11541. Values higher than this value will be ignored. Default is 1.
  11542. Note this value is multiplied with actual max possible value one pixel component
  11543. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  11544. is 0.9 * 255 = 230.
  11545. @item colorspace, c
  11546. Set what kind of colorspace to use when drawing graticule.
  11547. @table @samp
  11548. @item auto
  11549. @item 601
  11550. @item 709
  11551. @end table
  11552. Default is auto.
  11553. @end table
  11554. @anchor{vidstabdetect}
  11555. @section vidstabdetect
  11556. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  11557. @ref{vidstabtransform} for pass 2.
  11558. This filter generates a file with relative translation and rotation
  11559. transform information about subsequent frames, which is then used by
  11560. the @ref{vidstabtransform} filter.
  11561. To enable compilation of this filter you need to configure FFmpeg with
  11562. @code{--enable-libvidstab}.
  11563. This filter accepts the following options:
  11564. @table @option
  11565. @item result
  11566. Set the path to the file used to write the transforms information.
  11567. Default value is @file{transforms.trf}.
  11568. @item shakiness
  11569. Set how shaky the video is and how quick the camera is. It accepts an
  11570. integer in the range 1-10, a value of 1 means little shakiness, a
  11571. value of 10 means strong shakiness. Default value is 5.
  11572. @item accuracy
  11573. Set the accuracy of the detection process. It must be a value in the
  11574. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  11575. accuracy. Default value is 15.
  11576. @item stepsize
  11577. Set stepsize of the search process. The region around minimum is
  11578. scanned with 1 pixel resolution. Default value is 6.
  11579. @item mincontrast
  11580. Set minimum contrast. Below this value a local measurement field is
  11581. discarded. Must be a floating point value in the range 0-1. Default
  11582. value is 0.3.
  11583. @item tripod
  11584. Set reference frame number for tripod mode.
  11585. If enabled, the motion of the frames is compared to a reference frame
  11586. in the filtered stream, identified by the specified number. The idea
  11587. is to compensate all movements in a more-or-less static scene and keep
  11588. the camera view absolutely still.
  11589. If set to 0, it is disabled. The frames are counted starting from 1.
  11590. @item show
  11591. Show fields and transforms in the resulting frames. It accepts an
  11592. integer in the range 0-2. Default value is 0, which disables any
  11593. visualization.
  11594. @end table
  11595. @subsection Examples
  11596. @itemize
  11597. @item
  11598. Use default values:
  11599. @example
  11600. vidstabdetect
  11601. @end example
  11602. @item
  11603. Analyze strongly shaky movie and put the results in file
  11604. @file{mytransforms.trf}:
  11605. @example
  11606. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  11607. @end example
  11608. @item
  11609. Visualize the result of internal transformations in the resulting
  11610. video:
  11611. @example
  11612. vidstabdetect=show=1
  11613. @end example
  11614. @item
  11615. Analyze a video with medium shakiness using @command{ffmpeg}:
  11616. @example
  11617. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  11618. @end example
  11619. @end itemize
  11620. @anchor{vidstabtransform}
  11621. @section vidstabtransform
  11622. Video stabilization/deshaking: pass 2 of 2,
  11623. see @ref{vidstabdetect} for pass 1.
  11624. Read a file with transform information for each frame and
  11625. apply/compensate them. Together with the @ref{vidstabdetect}
  11626. filter this can be used to deshake videos. See also
  11627. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  11628. the @ref{unsharp} filter, see below.
  11629. To enable compilation of this filter you need to configure FFmpeg with
  11630. @code{--enable-libvidstab}.
  11631. @subsection Options
  11632. @table @option
  11633. @item input
  11634. Set path to the file used to read the transforms. Default value is
  11635. @file{transforms.trf}.
  11636. @item smoothing
  11637. Set the number of frames (value*2 + 1) used for lowpass filtering the
  11638. camera movements. Default value is 10.
  11639. For example a number of 10 means that 21 frames are used (10 in the
  11640. past and 10 in the future) to smoothen the motion in the video. A
  11641. larger value leads to a smoother video, but limits the acceleration of
  11642. the camera (pan/tilt movements). 0 is a special case where a static
  11643. camera is simulated.
  11644. @item optalgo
  11645. Set the camera path optimization algorithm.
  11646. Accepted values are:
  11647. @table @samp
  11648. @item gauss
  11649. gaussian kernel low-pass filter on camera motion (default)
  11650. @item avg
  11651. averaging on transformations
  11652. @end table
  11653. @item maxshift
  11654. Set maximal number of pixels to translate frames. Default value is -1,
  11655. meaning no limit.
  11656. @item maxangle
  11657. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  11658. value is -1, meaning no limit.
  11659. @item crop
  11660. Specify how to deal with borders that may be visible due to movement
  11661. compensation.
  11662. Available values are:
  11663. @table @samp
  11664. @item keep
  11665. keep image information from previous frame (default)
  11666. @item black
  11667. fill the border black
  11668. @end table
  11669. @item invert
  11670. Invert transforms if set to 1. Default value is 0.
  11671. @item relative
  11672. Consider transforms as relative to previous frame if set to 1,
  11673. absolute if set to 0. Default value is 0.
  11674. @item zoom
  11675. Set percentage to zoom. A positive value will result in a zoom-in
  11676. effect, a negative value in a zoom-out effect. Default value is 0 (no
  11677. zoom).
  11678. @item optzoom
  11679. Set optimal zooming to avoid borders.
  11680. Accepted values are:
  11681. @table @samp
  11682. @item 0
  11683. disabled
  11684. @item 1
  11685. optimal static zoom value is determined (only very strong movements
  11686. will lead to visible borders) (default)
  11687. @item 2
  11688. optimal adaptive zoom value is determined (no borders will be
  11689. visible), see @option{zoomspeed}
  11690. @end table
  11691. Note that the value given at zoom is added to the one calculated here.
  11692. @item zoomspeed
  11693. Set percent to zoom maximally each frame (enabled when
  11694. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  11695. 0.25.
  11696. @item interpol
  11697. Specify type of interpolation.
  11698. Available values are:
  11699. @table @samp
  11700. @item no
  11701. no interpolation
  11702. @item linear
  11703. linear only horizontal
  11704. @item bilinear
  11705. linear in both directions (default)
  11706. @item bicubic
  11707. cubic in both directions (slow)
  11708. @end table
  11709. @item tripod
  11710. Enable virtual tripod mode if set to 1, which is equivalent to
  11711. @code{relative=0:smoothing=0}. Default value is 0.
  11712. Use also @code{tripod} option of @ref{vidstabdetect}.
  11713. @item debug
  11714. Increase log verbosity if set to 1. Also the detected global motions
  11715. are written to the temporary file @file{global_motions.trf}. Default
  11716. value is 0.
  11717. @end table
  11718. @subsection Examples
  11719. @itemize
  11720. @item
  11721. Use @command{ffmpeg} for a typical stabilization with default values:
  11722. @example
  11723. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  11724. @end example
  11725. Note the use of the @ref{unsharp} filter which is always recommended.
  11726. @item
  11727. Zoom in a bit more and load transform data from a given file:
  11728. @example
  11729. vidstabtransform=zoom=5:input="mytransforms.trf"
  11730. @end example
  11731. @item
  11732. Smoothen the video even more:
  11733. @example
  11734. vidstabtransform=smoothing=30
  11735. @end example
  11736. @end itemize
  11737. @section vflip
  11738. Flip the input video vertically.
  11739. For example, to vertically flip a video with @command{ffmpeg}:
  11740. @example
  11741. ffmpeg -i in.avi -vf "vflip" out.avi
  11742. @end example
  11743. @anchor{vignette}
  11744. @section vignette
  11745. Make or reverse a natural vignetting effect.
  11746. The filter accepts the following options:
  11747. @table @option
  11748. @item angle, a
  11749. Set lens angle expression as a number of radians.
  11750. The value is clipped in the @code{[0,PI/2]} range.
  11751. Default value: @code{"PI/5"}
  11752. @item x0
  11753. @item y0
  11754. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  11755. by default.
  11756. @item mode
  11757. Set forward/backward mode.
  11758. Available modes are:
  11759. @table @samp
  11760. @item forward
  11761. The larger the distance from the central point, the darker the image becomes.
  11762. @item backward
  11763. The larger the distance from the central point, the brighter the image becomes.
  11764. This can be used to reverse a vignette effect, though there is no automatic
  11765. detection to extract the lens @option{angle} and other settings (yet). It can
  11766. also be used to create a burning effect.
  11767. @end table
  11768. Default value is @samp{forward}.
  11769. @item eval
  11770. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  11771. It accepts the following values:
  11772. @table @samp
  11773. @item init
  11774. Evaluate expressions only once during the filter initialization.
  11775. @item frame
  11776. Evaluate expressions for each incoming frame. This is way slower than the
  11777. @samp{init} mode since it requires all the scalers to be re-computed, but it
  11778. allows advanced dynamic expressions.
  11779. @end table
  11780. Default value is @samp{init}.
  11781. @item dither
  11782. Set dithering to reduce the circular banding effects. Default is @code{1}
  11783. (enabled).
  11784. @item aspect
  11785. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  11786. Setting this value to the SAR of the input will make a rectangular vignetting
  11787. following the dimensions of the video.
  11788. Default is @code{1/1}.
  11789. @end table
  11790. @subsection Expressions
  11791. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  11792. following parameters.
  11793. @table @option
  11794. @item w
  11795. @item h
  11796. input width and height
  11797. @item n
  11798. the number of input frame, starting from 0
  11799. @item pts
  11800. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  11801. @var{TB} units, NAN if undefined
  11802. @item r
  11803. frame rate of the input video, NAN if the input frame rate is unknown
  11804. @item t
  11805. the PTS (Presentation TimeStamp) of the filtered video frame,
  11806. expressed in seconds, NAN if undefined
  11807. @item tb
  11808. time base of the input video
  11809. @end table
  11810. @subsection Examples
  11811. @itemize
  11812. @item
  11813. Apply simple strong vignetting effect:
  11814. @example
  11815. vignette=PI/4
  11816. @end example
  11817. @item
  11818. Make a flickering vignetting:
  11819. @example
  11820. vignette='PI/4+random(1)*PI/50':eval=frame
  11821. @end example
  11822. @end itemize
  11823. @section vstack
  11824. Stack input videos vertically.
  11825. All streams must be of same pixel format and of same width.
  11826. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  11827. to create same output.
  11828. The filter accept the following option:
  11829. @table @option
  11830. @item inputs
  11831. Set number of input streams. Default is 2.
  11832. @item shortest
  11833. If set to 1, force the output to terminate when the shortest input
  11834. terminates. Default value is 0.
  11835. @end table
  11836. @section w3fdif
  11837. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  11838. Deinterlacing Filter").
  11839. Based on the process described by Martin Weston for BBC R&D, and
  11840. implemented based on the de-interlace algorithm written by Jim
  11841. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  11842. uses filter coefficients calculated by BBC R&D.
  11843. There are two sets of filter coefficients, so called "simple":
  11844. and "complex". Which set of filter coefficients is used can
  11845. be set by passing an optional parameter:
  11846. @table @option
  11847. @item filter
  11848. Set the interlacing filter coefficients. Accepts one of the following values:
  11849. @table @samp
  11850. @item simple
  11851. Simple filter coefficient set.
  11852. @item complex
  11853. More-complex filter coefficient set.
  11854. @end table
  11855. Default value is @samp{complex}.
  11856. @item deint
  11857. Specify which frames to deinterlace. Accept one of the following values:
  11858. @table @samp
  11859. @item all
  11860. Deinterlace all frames,
  11861. @item interlaced
  11862. Only deinterlace frames marked as interlaced.
  11863. @end table
  11864. Default value is @samp{all}.
  11865. @end table
  11866. @section waveform
  11867. Video waveform monitor.
  11868. The waveform monitor plots color component intensity. By default luminance
  11869. only. Each column of the waveform corresponds to a column of pixels in the
  11870. source video.
  11871. It accepts the following options:
  11872. @table @option
  11873. @item mode, m
  11874. Can be either @code{row}, or @code{column}. Default is @code{column}.
  11875. In row mode, the graph on the left side represents color component value 0 and
  11876. the right side represents value = 255. In column mode, the top side represents
  11877. color component value = 0 and bottom side represents value = 255.
  11878. @item intensity, i
  11879. Set intensity. Smaller values are useful to find out how many values of the same
  11880. luminance are distributed across input rows/columns.
  11881. Default value is @code{0.04}. Allowed range is [0, 1].
  11882. @item mirror, r
  11883. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  11884. In mirrored mode, higher values will be represented on the left
  11885. side for @code{row} mode and at the top for @code{column} mode. Default is
  11886. @code{1} (mirrored).
  11887. @item display, d
  11888. Set display mode.
  11889. It accepts the following values:
  11890. @table @samp
  11891. @item overlay
  11892. Presents information identical to that in the @code{parade}, except
  11893. that the graphs representing color components are superimposed directly
  11894. over one another.
  11895. This display mode makes it easier to spot relative differences or similarities
  11896. in overlapping areas of the color components that are supposed to be identical,
  11897. such as neutral whites, grays, or blacks.
  11898. @item stack
  11899. Display separate graph for the color components side by side in
  11900. @code{row} mode or one below the other in @code{column} mode.
  11901. @item parade
  11902. Display separate graph for the color components side by side in
  11903. @code{column} mode or one below the other in @code{row} mode.
  11904. Using this display mode makes it easy to spot color casts in the highlights
  11905. and shadows of an image, by comparing the contours of the top and the bottom
  11906. graphs of each waveform. Since whites, grays, and blacks are characterized
  11907. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  11908. should display three waveforms of roughly equal width/height. If not, the
  11909. correction is easy to perform by making level adjustments the three waveforms.
  11910. @end table
  11911. Default is @code{stack}.
  11912. @item components, c
  11913. Set which color components to display. Default is 1, which means only luminance
  11914. or red color component if input is in RGB colorspace. If is set for example to
  11915. 7 it will display all 3 (if) available color components.
  11916. @item envelope, e
  11917. @table @samp
  11918. @item none
  11919. No envelope, this is default.
  11920. @item instant
  11921. Instant envelope, minimum and maximum values presented in graph will be easily
  11922. visible even with small @code{step} value.
  11923. @item peak
  11924. Hold minimum and maximum values presented in graph across time. This way you
  11925. can still spot out of range values without constantly looking at waveforms.
  11926. @item peak+instant
  11927. Peak and instant envelope combined together.
  11928. @end table
  11929. @item filter, f
  11930. @table @samp
  11931. @item lowpass
  11932. No filtering, this is default.
  11933. @item flat
  11934. Luma and chroma combined together.
  11935. @item aflat
  11936. Similar as above, but shows difference between blue and red chroma.
  11937. @item chroma
  11938. Displays only chroma.
  11939. @item color
  11940. Displays actual color value on waveform.
  11941. @item acolor
  11942. Similar as above, but with luma showing frequency of chroma values.
  11943. @end table
  11944. @item graticule, g
  11945. Set which graticule to display.
  11946. @table @samp
  11947. @item none
  11948. Do not display graticule.
  11949. @item green
  11950. Display green graticule showing legal broadcast ranges.
  11951. @end table
  11952. @item opacity, o
  11953. Set graticule opacity.
  11954. @item flags, fl
  11955. Set graticule flags.
  11956. @table @samp
  11957. @item numbers
  11958. Draw numbers above lines. By default enabled.
  11959. @item dots
  11960. Draw dots instead of lines.
  11961. @end table
  11962. @item scale, s
  11963. Set scale used for displaying graticule.
  11964. @table @samp
  11965. @item digital
  11966. @item millivolts
  11967. @item ire
  11968. @end table
  11969. Default is digital.
  11970. @item bgopacity, b
  11971. Set background opacity.
  11972. @end table
  11973. @section weave, doubleweave
  11974. The @code{weave} takes a field-based video input and join
  11975. each two sequential fields into single frame, producing a new double
  11976. height clip with half the frame rate and half the frame count.
  11977. The @code{doubleweave} works same as @code{weave} but without
  11978. halving frame rate and frame count.
  11979. It accepts the following option:
  11980. @table @option
  11981. @item first_field
  11982. Set first field. Available values are:
  11983. @table @samp
  11984. @item top, t
  11985. Set the frame as top-field-first.
  11986. @item bottom, b
  11987. Set the frame as bottom-field-first.
  11988. @end table
  11989. @end table
  11990. @subsection Examples
  11991. @itemize
  11992. @item
  11993. Interlace video using @ref{select} and @ref{separatefields} filter:
  11994. @example
  11995. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  11996. @end example
  11997. @end itemize
  11998. @section xbr
  11999. Apply the xBR high-quality magnification filter which is designed for pixel
  12000. art. It follows a set of edge-detection rules, see
  12001. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  12002. It accepts the following option:
  12003. @table @option
  12004. @item n
  12005. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  12006. @code{3xBR} and @code{4} for @code{4xBR}.
  12007. Default is @code{3}.
  12008. @end table
  12009. @anchor{yadif}
  12010. @section yadif
  12011. Deinterlace the input video ("yadif" means "yet another deinterlacing
  12012. filter").
  12013. It accepts the following parameters:
  12014. @table @option
  12015. @item mode
  12016. The interlacing mode to adopt. It accepts one of the following values:
  12017. @table @option
  12018. @item 0, send_frame
  12019. Output one frame for each frame.
  12020. @item 1, send_field
  12021. Output one frame for each field.
  12022. @item 2, send_frame_nospatial
  12023. Like @code{send_frame}, but it skips the spatial interlacing check.
  12024. @item 3, send_field_nospatial
  12025. Like @code{send_field}, but it skips the spatial interlacing check.
  12026. @end table
  12027. The default value is @code{send_frame}.
  12028. @item parity
  12029. The picture field parity assumed for the input interlaced video. It accepts one
  12030. of the following values:
  12031. @table @option
  12032. @item 0, tff
  12033. Assume the top field is first.
  12034. @item 1, bff
  12035. Assume the bottom field is first.
  12036. @item -1, auto
  12037. Enable automatic detection of field parity.
  12038. @end table
  12039. The default value is @code{auto}.
  12040. If the interlacing is unknown or the decoder does not export this information,
  12041. top field first will be assumed.
  12042. @item deint
  12043. Specify which frames to deinterlace. Accept one of the following
  12044. values:
  12045. @table @option
  12046. @item 0, all
  12047. Deinterlace all frames.
  12048. @item 1, interlaced
  12049. Only deinterlace frames marked as interlaced.
  12050. @end table
  12051. The default value is @code{all}.
  12052. @end table
  12053. @section zoompan
  12054. Apply Zoom & Pan effect.
  12055. This filter accepts the following options:
  12056. @table @option
  12057. @item zoom, z
  12058. Set the zoom expression. Default is 1.
  12059. @item x
  12060. @item y
  12061. Set the x and y expression. Default is 0.
  12062. @item d
  12063. Set the duration expression in number of frames.
  12064. This sets for how many number of frames effect will last for
  12065. single input image.
  12066. @item s
  12067. Set the output image size, default is 'hd720'.
  12068. @item fps
  12069. Set the output frame rate, default is '25'.
  12070. @end table
  12071. Each expression can contain the following constants:
  12072. @table @option
  12073. @item in_w, iw
  12074. Input width.
  12075. @item in_h, ih
  12076. Input height.
  12077. @item out_w, ow
  12078. Output width.
  12079. @item out_h, oh
  12080. Output height.
  12081. @item in
  12082. Input frame count.
  12083. @item on
  12084. Output frame count.
  12085. @item x
  12086. @item y
  12087. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  12088. for current input frame.
  12089. @item px
  12090. @item py
  12091. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  12092. not yet such frame (first input frame).
  12093. @item zoom
  12094. Last calculated zoom from 'z' expression for current input frame.
  12095. @item pzoom
  12096. Last calculated zoom of last output frame of previous input frame.
  12097. @item duration
  12098. Number of output frames for current input frame. Calculated from 'd' expression
  12099. for each input frame.
  12100. @item pduration
  12101. number of output frames created for previous input frame
  12102. @item a
  12103. Rational number: input width / input height
  12104. @item sar
  12105. sample aspect ratio
  12106. @item dar
  12107. display aspect ratio
  12108. @end table
  12109. @subsection Examples
  12110. @itemize
  12111. @item
  12112. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  12113. @example
  12114. 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
  12115. @end example
  12116. @item
  12117. Zoom-in up to 1.5 and pan always at center of picture:
  12118. @example
  12119. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12120. @end example
  12121. @item
  12122. Same as above but without pausing:
  12123. @example
  12124. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12125. @end example
  12126. @end itemize
  12127. @anchor{zscale}
  12128. @section zscale
  12129. Scale (resize) the input video, using the z.lib library:
  12130. https://github.com/sekrit-twc/zimg.
  12131. The zscale filter forces the output display aspect ratio to be the same
  12132. as the input, by changing the output sample aspect ratio.
  12133. If the input image format is different from the format requested by
  12134. the next filter, the zscale filter will convert the input to the
  12135. requested format.
  12136. @subsection Options
  12137. The filter accepts the following options.
  12138. @table @option
  12139. @item width, w
  12140. @item height, h
  12141. Set the output video dimension expression. Default value is the input
  12142. dimension.
  12143. If the @var{width} or @var{w} value is 0, the input width is used for
  12144. the output. If the @var{height} or @var{h} value is 0, the input height
  12145. is used for the output.
  12146. If one and only one of the values is -n with n >= 1, the zscale filter
  12147. will use a value that maintains the aspect ratio of the input image,
  12148. calculated from the other specified dimension. After that it will,
  12149. however, make sure that the calculated dimension is divisible by n and
  12150. adjust the value if necessary.
  12151. If both values are -n with n >= 1, the behavior will be identical to
  12152. both values being set to 0 as previously detailed.
  12153. See below for the list of accepted constants for use in the dimension
  12154. expression.
  12155. @item size, s
  12156. Set the video size. For the syntax of this option, check the
  12157. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12158. @item dither, d
  12159. Set the dither type.
  12160. Possible values are:
  12161. @table @var
  12162. @item none
  12163. @item ordered
  12164. @item random
  12165. @item error_diffusion
  12166. @end table
  12167. Default is none.
  12168. @item filter, f
  12169. Set the resize filter type.
  12170. Possible values are:
  12171. @table @var
  12172. @item point
  12173. @item bilinear
  12174. @item bicubic
  12175. @item spline16
  12176. @item spline36
  12177. @item lanczos
  12178. @end table
  12179. Default is bilinear.
  12180. @item range, r
  12181. Set the color range.
  12182. Possible values are:
  12183. @table @var
  12184. @item input
  12185. @item limited
  12186. @item full
  12187. @end table
  12188. Default is same as input.
  12189. @item primaries, p
  12190. Set the color primaries.
  12191. Possible values are:
  12192. @table @var
  12193. @item input
  12194. @item 709
  12195. @item unspecified
  12196. @item 170m
  12197. @item 240m
  12198. @item 2020
  12199. @end table
  12200. Default is same as input.
  12201. @item transfer, t
  12202. Set the transfer characteristics.
  12203. Possible values are:
  12204. @table @var
  12205. @item input
  12206. @item 709
  12207. @item unspecified
  12208. @item 601
  12209. @item linear
  12210. @item 2020_10
  12211. @item 2020_12
  12212. @item smpte2084
  12213. @item iec61966-2-1
  12214. @item arib-std-b67
  12215. @end table
  12216. Default is same as input.
  12217. @item matrix, m
  12218. Set the colorspace matrix.
  12219. Possible value are:
  12220. @table @var
  12221. @item input
  12222. @item 709
  12223. @item unspecified
  12224. @item 470bg
  12225. @item 170m
  12226. @item 2020_ncl
  12227. @item 2020_cl
  12228. @end table
  12229. Default is same as input.
  12230. @item rangein, rin
  12231. Set the input color range.
  12232. Possible values are:
  12233. @table @var
  12234. @item input
  12235. @item limited
  12236. @item full
  12237. @end table
  12238. Default is same as input.
  12239. @item primariesin, pin
  12240. Set the input color primaries.
  12241. Possible values are:
  12242. @table @var
  12243. @item input
  12244. @item 709
  12245. @item unspecified
  12246. @item 170m
  12247. @item 240m
  12248. @item 2020
  12249. @end table
  12250. Default is same as input.
  12251. @item transferin, tin
  12252. Set the input transfer characteristics.
  12253. Possible values are:
  12254. @table @var
  12255. @item input
  12256. @item 709
  12257. @item unspecified
  12258. @item 601
  12259. @item linear
  12260. @item 2020_10
  12261. @item 2020_12
  12262. @end table
  12263. Default is same as input.
  12264. @item matrixin, min
  12265. Set the input colorspace matrix.
  12266. Possible value are:
  12267. @table @var
  12268. @item input
  12269. @item 709
  12270. @item unspecified
  12271. @item 470bg
  12272. @item 170m
  12273. @item 2020_ncl
  12274. @item 2020_cl
  12275. @end table
  12276. @item chromal, c
  12277. Set the output chroma location.
  12278. Possible values are:
  12279. @table @var
  12280. @item input
  12281. @item left
  12282. @item center
  12283. @item topleft
  12284. @item top
  12285. @item bottomleft
  12286. @item bottom
  12287. @end table
  12288. @item chromalin, cin
  12289. Set the input chroma location.
  12290. Possible values are:
  12291. @table @var
  12292. @item input
  12293. @item left
  12294. @item center
  12295. @item topleft
  12296. @item top
  12297. @item bottomleft
  12298. @item bottom
  12299. @end table
  12300. @item npl
  12301. Set the nominal peak luminance.
  12302. @end table
  12303. The values of the @option{w} and @option{h} options are expressions
  12304. containing the following constants:
  12305. @table @var
  12306. @item in_w
  12307. @item in_h
  12308. The input width and height
  12309. @item iw
  12310. @item ih
  12311. These are the same as @var{in_w} and @var{in_h}.
  12312. @item out_w
  12313. @item out_h
  12314. The output (scaled) width and height
  12315. @item ow
  12316. @item oh
  12317. These are the same as @var{out_w} and @var{out_h}
  12318. @item a
  12319. The same as @var{iw} / @var{ih}
  12320. @item sar
  12321. input sample aspect ratio
  12322. @item dar
  12323. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  12324. @item hsub
  12325. @item vsub
  12326. horizontal and vertical input chroma subsample values. For example for the
  12327. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12328. @item ohsub
  12329. @item ovsub
  12330. horizontal and vertical output chroma subsample values. For example for the
  12331. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  12332. @end table
  12333. @table @option
  12334. @end table
  12335. @c man end VIDEO FILTERS
  12336. @chapter Video Sources
  12337. @c man begin VIDEO SOURCES
  12338. Below is a description of the currently available video sources.
  12339. @section buffer
  12340. Buffer video frames, and make them available to the filter chain.
  12341. This source is mainly intended for a programmatic use, in particular
  12342. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  12343. It accepts the following parameters:
  12344. @table @option
  12345. @item video_size
  12346. Specify the size (width and height) of the buffered video frames. For the
  12347. syntax of this option, check the
  12348. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12349. @item width
  12350. The input video width.
  12351. @item height
  12352. The input video height.
  12353. @item pix_fmt
  12354. A string representing the pixel format of the buffered video frames.
  12355. It may be a number corresponding to a pixel format, or a pixel format
  12356. name.
  12357. @item time_base
  12358. Specify the timebase assumed by the timestamps of the buffered frames.
  12359. @item frame_rate
  12360. Specify the frame rate expected for the video stream.
  12361. @item pixel_aspect, sar
  12362. The sample (pixel) aspect ratio of the input video.
  12363. @item sws_param
  12364. Specify the optional parameters to be used for the scale filter which
  12365. is automatically inserted when an input change is detected in the
  12366. input size or format.
  12367. @item hw_frames_ctx
  12368. When using a hardware pixel format, this should be a reference to an
  12369. AVHWFramesContext describing input frames.
  12370. @end table
  12371. For example:
  12372. @example
  12373. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  12374. @end example
  12375. will instruct the source to accept video frames with size 320x240 and
  12376. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  12377. square pixels (1:1 sample aspect ratio).
  12378. Since the pixel format with name "yuv410p" corresponds to the number 6
  12379. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  12380. this example corresponds to:
  12381. @example
  12382. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  12383. @end example
  12384. Alternatively, the options can be specified as a flat string, but this
  12385. syntax is deprecated:
  12386. @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}]
  12387. @section cellauto
  12388. Create a pattern generated by an elementary cellular automaton.
  12389. The initial state of the cellular automaton can be defined through the
  12390. @option{filename} and @option{pattern} options. If such options are
  12391. not specified an initial state is created randomly.
  12392. At each new frame a new row in the video is filled with the result of
  12393. the cellular automaton next generation. The behavior when the whole
  12394. frame is filled is defined by the @option{scroll} option.
  12395. This source accepts the following options:
  12396. @table @option
  12397. @item filename, f
  12398. Read the initial cellular automaton state, i.e. the starting row, from
  12399. the specified file.
  12400. In the file, each non-whitespace character is considered an alive
  12401. cell, a newline will terminate the row, and further characters in the
  12402. file will be ignored.
  12403. @item pattern, p
  12404. Read the initial cellular automaton state, i.e. the starting row, from
  12405. the specified string.
  12406. Each non-whitespace character in the string is considered an alive
  12407. cell, a newline will terminate the row, and further characters in the
  12408. string will be ignored.
  12409. @item rate, r
  12410. Set the video rate, that is the number of frames generated per second.
  12411. Default is 25.
  12412. @item random_fill_ratio, ratio
  12413. Set the random fill ratio for the initial cellular automaton row. It
  12414. is a floating point number value ranging from 0 to 1, defaults to
  12415. 1/PHI.
  12416. This option is ignored when a file or a pattern is specified.
  12417. @item random_seed, seed
  12418. Set the seed for filling randomly the initial row, must be an integer
  12419. included between 0 and UINT32_MAX. If not specified, or if explicitly
  12420. set to -1, the filter will try to use a good random seed on a best
  12421. effort basis.
  12422. @item rule
  12423. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  12424. Default value is 110.
  12425. @item size, s
  12426. Set the size of the output video. For the syntax of this option, check the
  12427. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12428. If @option{filename} or @option{pattern} is specified, the size is set
  12429. by default to the width of the specified initial state row, and the
  12430. height is set to @var{width} * PHI.
  12431. If @option{size} is set, it must contain the width of the specified
  12432. pattern string, and the specified pattern will be centered in the
  12433. larger row.
  12434. If a filename or a pattern string is not specified, the size value
  12435. defaults to "320x518" (used for a randomly generated initial state).
  12436. @item scroll
  12437. If set to 1, scroll the output upward when all the rows in the output
  12438. have been already filled. If set to 0, the new generated row will be
  12439. written over the top row just after the bottom row is filled.
  12440. Defaults to 1.
  12441. @item start_full, full
  12442. If set to 1, completely fill the output with generated rows before
  12443. outputting the first frame.
  12444. This is the default behavior, for disabling set the value to 0.
  12445. @item stitch
  12446. If set to 1, stitch the left and right row edges together.
  12447. This is the default behavior, for disabling set the value to 0.
  12448. @end table
  12449. @subsection Examples
  12450. @itemize
  12451. @item
  12452. Read the initial state from @file{pattern}, and specify an output of
  12453. size 200x400.
  12454. @example
  12455. cellauto=f=pattern:s=200x400
  12456. @end example
  12457. @item
  12458. Generate a random initial row with a width of 200 cells, with a fill
  12459. ratio of 2/3:
  12460. @example
  12461. cellauto=ratio=2/3:s=200x200
  12462. @end example
  12463. @item
  12464. Create a pattern generated by rule 18 starting by a single alive cell
  12465. centered on an initial row with width 100:
  12466. @example
  12467. cellauto=p=@@:s=100x400:full=0:rule=18
  12468. @end example
  12469. @item
  12470. Specify a more elaborated initial pattern:
  12471. @example
  12472. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  12473. @end example
  12474. @end itemize
  12475. @anchor{coreimagesrc}
  12476. @section coreimagesrc
  12477. Video source generated on GPU using Apple's CoreImage API on OSX.
  12478. This video source is a specialized version of the @ref{coreimage} video filter.
  12479. Use a core image generator at the beginning of the applied filterchain to
  12480. generate the content.
  12481. The coreimagesrc video source accepts the following options:
  12482. @table @option
  12483. @item list_generators
  12484. List all available generators along with all their respective options as well as
  12485. possible minimum and maximum values along with the default values.
  12486. @example
  12487. list_generators=true
  12488. @end example
  12489. @item size, s
  12490. Specify the size of the sourced video. For the syntax of this option, check the
  12491. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12492. The default value is @code{320x240}.
  12493. @item rate, r
  12494. Specify the frame rate of the sourced video, as the number of frames
  12495. generated per second. It has to be a string in the format
  12496. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12497. number or a valid video frame rate abbreviation. The default value is
  12498. "25".
  12499. @item sar
  12500. Set the sample aspect ratio of the sourced video.
  12501. @item duration, d
  12502. Set the duration of the sourced video. See
  12503. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12504. for the accepted syntax.
  12505. If not specified, or the expressed duration is negative, the video is
  12506. supposed to be generated forever.
  12507. @end table
  12508. Additionally, all options of the @ref{coreimage} video filter are accepted.
  12509. A complete filterchain can be used for further processing of the
  12510. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  12511. and examples for details.
  12512. @subsection Examples
  12513. @itemize
  12514. @item
  12515. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  12516. given as complete and escaped command-line for Apple's standard bash shell:
  12517. @example
  12518. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  12519. @end example
  12520. This example is equivalent to the QRCode example of @ref{coreimage} without the
  12521. need for a nullsrc video source.
  12522. @end itemize
  12523. @section mandelbrot
  12524. Generate a Mandelbrot set fractal, and progressively zoom towards the
  12525. point specified with @var{start_x} and @var{start_y}.
  12526. This source accepts the following options:
  12527. @table @option
  12528. @item end_pts
  12529. Set the terminal pts value. Default value is 400.
  12530. @item end_scale
  12531. Set the terminal scale value.
  12532. Must be a floating point value. Default value is 0.3.
  12533. @item inner
  12534. Set the inner coloring mode, that is the algorithm used to draw the
  12535. Mandelbrot fractal internal region.
  12536. It shall assume one of the following values:
  12537. @table @option
  12538. @item black
  12539. Set black mode.
  12540. @item convergence
  12541. Show time until convergence.
  12542. @item mincol
  12543. Set color based on point closest to the origin of the iterations.
  12544. @item period
  12545. Set period mode.
  12546. @end table
  12547. Default value is @var{mincol}.
  12548. @item bailout
  12549. Set the bailout value. Default value is 10.0.
  12550. @item maxiter
  12551. Set the maximum of iterations performed by the rendering
  12552. algorithm. Default value is 7189.
  12553. @item outer
  12554. Set outer coloring mode.
  12555. It shall assume one of following values:
  12556. @table @option
  12557. @item iteration_count
  12558. Set iteration cound mode.
  12559. @item normalized_iteration_count
  12560. set normalized iteration count mode.
  12561. @end table
  12562. Default value is @var{normalized_iteration_count}.
  12563. @item rate, r
  12564. Set frame rate, expressed as number of frames per second. Default
  12565. value is "25".
  12566. @item size, s
  12567. Set frame size. For the syntax of this option, check the "Video
  12568. size" section in the ffmpeg-utils manual. Default value is "640x480".
  12569. @item start_scale
  12570. Set the initial scale value. Default value is 3.0.
  12571. @item start_x
  12572. Set the initial x position. Must be a floating point value between
  12573. -100 and 100. Default value is -0.743643887037158704752191506114774.
  12574. @item start_y
  12575. Set the initial y position. Must be a floating point value between
  12576. -100 and 100. Default value is -0.131825904205311970493132056385139.
  12577. @end table
  12578. @section mptestsrc
  12579. Generate various test patterns, as generated by the MPlayer test filter.
  12580. The size of the generated video is fixed, and is 256x256.
  12581. This source is useful in particular for testing encoding features.
  12582. This source accepts the following options:
  12583. @table @option
  12584. @item rate, r
  12585. Specify the frame rate of the sourced video, as the number of frames
  12586. generated per second. It has to be a string in the format
  12587. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12588. number or a valid video frame rate abbreviation. The default value is
  12589. "25".
  12590. @item duration, d
  12591. Set the duration of the sourced video. See
  12592. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12593. for the accepted syntax.
  12594. If not specified, or the expressed duration is negative, the video is
  12595. supposed to be generated forever.
  12596. @item test, t
  12597. Set the number or the name of the test to perform. Supported tests are:
  12598. @table @option
  12599. @item dc_luma
  12600. @item dc_chroma
  12601. @item freq_luma
  12602. @item freq_chroma
  12603. @item amp_luma
  12604. @item amp_chroma
  12605. @item cbp
  12606. @item mv
  12607. @item ring1
  12608. @item ring2
  12609. @item all
  12610. @end table
  12611. Default value is "all", which will cycle through the list of all tests.
  12612. @end table
  12613. Some examples:
  12614. @example
  12615. mptestsrc=t=dc_luma
  12616. @end example
  12617. will generate a "dc_luma" test pattern.
  12618. @section frei0r_src
  12619. Provide a frei0r source.
  12620. To enable compilation of this filter you need to install the frei0r
  12621. header and configure FFmpeg with @code{--enable-frei0r}.
  12622. This source accepts the following parameters:
  12623. @table @option
  12624. @item size
  12625. The size of the video to generate. For the syntax of this option, check the
  12626. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12627. @item framerate
  12628. The framerate of the generated video. It may be a string of the form
  12629. @var{num}/@var{den} or a frame rate abbreviation.
  12630. @item filter_name
  12631. The name to the frei0r source to load. For more information regarding frei0r and
  12632. how to set the parameters, read the @ref{frei0r} section in the video filters
  12633. documentation.
  12634. @item filter_params
  12635. A '|'-separated list of parameters to pass to the frei0r source.
  12636. @end table
  12637. For example, to generate a frei0r partik0l source with size 200x200
  12638. and frame rate 10 which is overlaid on the overlay filter main input:
  12639. @example
  12640. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  12641. @end example
  12642. @section life
  12643. Generate a life pattern.
  12644. This source is based on a generalization of John Conway's life game.
  12645. The sourced input represents a life grid, each pixel represents a cell
  12646. which can be in one of two possible states, alive or dead. Every cell
  12647. interacts with its eight neighbours, which are the cells that are
  12648. horizontally, vertically, or diagonally adjacent.
  12649. At each interaction the grid evolves according to the adopted rule,
  12650. which specifies the number of neighbor alive cells which will make a
  12651. cell stay alive or born. The @option{rule} option allows one to specify
  12652. the rule to adopt.
  12653. This source accepts the following options:
  12654. @table @option
  12655. @item filename, f
  12656. Set the file from which to read the initial grid state. In the file,
  12657. each non-whitespace character is considered an alive cell, and newline
  12658. is used to delimit the end of each row.
  12659. If this option is not specified, the initial grid is generated
  12660. randomly.
  12661. @item rate, r
  12662. Set the video rate, that is the number of frames generated per second.
  12663. Default is 25.
  12664. @item random_fill_ratio, ratio
  12665. Set the random fill ratio for the initial random grid. It is a
  12666. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  12667. It is ignored when a file is specified.
  12668. @item random_seed, seed
  12669. Set the seed for filling the initial random grid, must be an integer
  12670. included between 0 and UINT32_MAX. If not specified, or if explicitly
  12671. set to -1, the filter will try to use a good random seed on a best
  12672. effort basis.
  12673. @item rule
  12674. Set the life rule.
  12675. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  12676. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  12677. @var{NS} specifies the number of alive neighbor cells which make a
  12678. live cell stay alive, and @var{NB} the number of alive neighbor cells
  12679. which make a dead cell to become alive (i.e. to "born").
  12680. "s" and "b" can be used in place of "S" and "B", respectively.
  12681. Alternatively a rule can be specified by an 18-bits integer. The 9
  12682. high order bits are used to encode the next cell state if it is alive
  12683. for each number of neighbor alive cells, the low order bits specify
  12684. the rule for "borning" new cells. Higher order bits encode for an
  12685. higher number of neighbor cells.
  12686. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  12687. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  12688. Default value is "S23/B3", which is the original Conway's game of life
  12689. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  12690. cells, and will born a new cell if there are three alive cells around
  12691. a dead cell.
  12692. @item size, s
  12693. Set the size of the output video. For the syntax of this option, check the
  12694. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12695. If @option{filename} is specified, the size is set by default to the
  12696. same size of the input file. If @option{size} is set, it must contain
  12697. the size specified in the input file, and the initial grid defined in
  12698. that file is centered in the larger resulting area.
  12699. If a filename is not specified, the size value defaults to "320x240"
  12700. (used for a randomly generated initial grid).
  12701. @item stitch
  12702. If set to 1, stitch the left and right grid edges together, and the
  12703. top and bottom edges also. Defaults to 1.
  12704. @item mold
  12705. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  12706. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  12707. value from 0 to 255.
  12708. @item life_color
  12709. Set the color of living (or new born) cells.
  12710. @item death_color
  12711. Set the color of dead cells. If @option{mold} is set, this is the first color
  12712. used to represent a dead cell.
  12713. @item mold_color
  12714. Set mold color, for definitely dead and moldy cells.
  12715. For the syntax of these 3 color options, check the "Color" section in the
  12716. ffmpeg-utils manual.
  12717. @end table
  12718. @subsection Examples
  12719. @itemize
  12720. @item
  12721. Read a grid from @file{pattern}, and center it on a grid of size
  12722. 300x300 pixels:
  12723. @example
  12724. life=f=pattern:s=300x300
  12725. @end example
  12726. @item
  12727. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  12728. @example
  12729. life=ratio=2/3:s=200x200
  12730. @end example
  12731. @item
  12732. Specify a custom rule for evolving a randomly generated grid:
  12733. @example
  12734. life=rule=S14/B34
  12735. @end example
  12736. @item
  12737. Full example with slow death effect (mold) using @command{ffplay}:
  12738. @example
  12739. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  12740. @end example
  12741. @end itemize
  12742. @anchor{allrgb}
  12743. @anchor{allyuv}
  12744. @anchor{color}
  12745. @anchor{haldclutsrc}
  12746. @anchor{nullsrc}
  12747. @anchor{rgbtestsrc}
  12748. @anchor{smptebars}
  12749. @anchor{smptehdbars}
  12750. @anchor{testsrc}
  12751. @anchor{testsrc2}
  12752. @anchor{yuvtestsrc}
  12753. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  12754. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  12755. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  12756. The @code{color} source provides an uniformly colored input.
  12757. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  12758. @ref{haldclut} filter.
  12759. The @code{nullsrc} source returns unprocessed video frames. It is
  12760. mainly useful to be employed in analysis / debugging tools, or as the
  12761. source for filters which ignore the input data.
  12762. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  12763. detecting RGB vs BGR issues. You should see a red, green and blue
  12764. stripe from top to bottom.
  12765. The @code{smptebars} source generates a color bars pattern, based on
  12766. the SMPTE Engineering Guideline EG 1-1990.
  12767. The @code{smptehdbars} source generates a color bars pattern, based on
  12768. the SMPTE RP 219-2002.
  12769. The @code{testsrc} source generates a test video pattern, showing a
  12770. color pattern, a scrolling gradient and a timestamp. This is mainly
  12771. intended for testing purposes.
  12772. The @code{testsrc2} source is similar to testsrc, but supports more
  12773. pixel formats instead of just @code{rgb24}. This allows using it as an
  12774. input for other tests without requiring a format conversion.
  12775. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  12776. see a y, cb and cr stripe from top to bottom.
  12777. The sources accept the following parameters:
  12778. @table @option
  12779. @item alpha
  12780. Specify the alpha (opacity) of the background, only available in the
  12781. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  12782. 255 (fully opaque, the default).
  12783. @item color, c
  12784. Specify the color of the source, only available in the @code{color}
  12785. source. For the syntax of this option, check the "Color" section in the
  12786. ffmpeg-utils manual.
  12787. @item level
  12788. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  12789. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  12790. pixels to be used as identity matrix for 3D lookup tables. Each component is
  12791. coded on a @code{1/(N*N)} scale.
  12792. @item size, s
  12793. Specify the size of the sourced video. For the syntax of this option, check the
  12794. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12795. The default value is @code{320x240}.
  12796. This option is not available with the @code{haldclutsrc} filter.
  12797. @item rate, r
  12798. Specify the frame rate of the sourced video, as the number of frames
  12799. generated per second. It has to be a string in the format
  12800. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  12801. number or a valid video frame rate abbreviation. The default value is
  12802. "25".
  12803. @item sar
  12804. Set the sample aspect ratio of the sourced video.
  12805. @item duration, d
  12806. Set the duration of the sourced video. See
  12807. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12808. for the accepted syntax.
  12809. If not specified, or the expressed duration is negative, the video is
  12810. supposed to be generated forever.
  12811. @item decimals, n
  12812. Set the number of decimals to show in the timestamp, only available in the
  12813. @code{testsrc} source.
  12814. The displayed timestamp value will correspond to the original
  12815. timestamp value multiplied by the power of 10 of the specified
  12816. value. Default value is 0.
  12817. @end table
  12818. For example the following:
  12819. @example
  12820. testsrc=duration=5.3:size=qcif:rate=10
  12821. @end example
  12822. will generate a video with a duration of 5.3 seconds, with size
  12823. 176x144 and a frame rate of 10 frames per second.
  12824. The following graph description will generate a red source
  12825. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  12826. frames per second.
  12827. @example
  12828. color=c=red@@0.2:s=qcif:r=10
  12829. @end example
  12830. If the input content is to be ignored, @code{nullsrc} can be used. The
  12831. following command generates noise in the luminance plane by employing
  12832. the @code{geq} filter:
  12833. @example
  12834. nullsrc=s=256x256, geq=random(1)*255:128:128
  12835. @end example
  12836. @subsection Commands
  12837. The @code{color} source supports the following commands:
  12838. @table @option
  12839. @item c, color
  12840. Set the color of the created image. Accepts the same syntax of the
  12841. corresponding @option{color} option.
  12842. @end table
  12843. @c man end VIDEO SOURCES
  12844. @chapter Video Sinks
  12845. @c man begin VIDEO SINKS
  12846. Below is a description of the currently available video sinks.
  12847. @section buffersink
  12848. Buffer video frames, and make them available to the end of the filter
  12849. graph.
  12850. This sink is mainly intended for programmatic use, in particular
  12851. through the interface defined in @file{libavfilter/buffersink.h}
  12852. or the options system.
  12853. It accepts a pointer to an AVBufferSinkContext structure, which
  12854. defines the incoming buffers' formats, to be passed as the opaque
  12855. parameter to @code{avfilter_init_filter} for initialization.
  12856. @section nullsink
  12857. Null video sink: do absolutely nothing with the input video. It is
  12858. mainly useful as a template and for use in analysis / debugging
  12859. tools.
  12860. @c man end VIDEO SINKS
  12861. @chapter Multimedia Filters
  12862. @c man begin MULTIMEDIA FILTERS
  12863. Below is a description of the currently available multimedia filters.
  12864. @section abitscope
  12865. Convert input audio to a video output, displaying the audio bit scope.
  12866. The filter accepts the following options:
  12867. @table @option
  12868. @item rate, r
  12869. Set frame rate, expressed as number of frames per second. Default
  12870. value is "25".
  12871. @item size, s
  12872. Specify the video size for the output. For the syntax of this option, check the
  12873. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12874. Default value is @code{1024x256}.
  12875. @item colors
  12876. Specify list of colors separated by space or by '|' which will be used to
  12877. draw channels. Unrecognized or missing colors will be replaced
  12878. by white color.
  12879. @end table
  12880. @section ahistogram
  12881. Convert input audio to a video output, displaying the volume histogram.
  12882. The filter accepts the following options:
  12883. @table @option
  12884. @item dmode
  12885. Specify how histogram is calculated.
  12886. It accepts the following values:
  12887. @table @samp
  12888. @item single
  12889. Use single histogram for all channels.
  12890. @item separate
  12891. Use separate histogram for each channel.
  12892. @end table
  12893. Default is @code{single}.
  12894. @item rate, r
  12895. Set frame rate, expressed as number of frames per second. Default
  12896. value is "25".
  12897. @item size, s
  12898. Specify the video size for the output. For the syntax of this option, check the
  12899. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12900. Default value is @code{hd720}.
  12901. @item scale
  12902. Set display scale.
  12903. It accepts the following values:
  12904. @table @samp
  12905. @item log
  12906. logarithmic
  12907. @item sqrt
  12908. square root
  12909. @item cbrt
  12910. cubic root
  12911. @item lin
  12912. linear
  12913. @item rlog
  12914. reverse logarithmic
  12915. @end table
  12916. Default is @code{log}.
  12917. @item ascale
  12918. Set amplitude scale.
  12919. It accepts the following values:
  12920. @table @samp
  12921. @item log
  12922. logarithmic
  12923. @item lin
  12924. linear
  12925. @end table
  12926. Default is @code{log}.
  12927. @item acount
  12928. Set how much frames to accumulate in histogram.
  12929. Defauls is 1. Setting this to -1 accumulates all frames.
  12930. @item rheight
  12931. Set histogram ratio of window height.
  12932. @item slide
  12933. Set sonogram sliding.
  12934. It accepts the following values:
  12935. @table @samp
  12936. @item replace
  12937. replace old rows with new ones.
  12938. @item scroll
  12939. scroll from top to bottom.
  12940. @end table
  12941. Default is @code{replace}.
  12942. @end table
  12943. @section aphasemeter
  12944. Convert input audio to a video output, displaying the audio phase.
  12945. The filter accepts the following options:
  12946. @table @option
  12947. @item rate, r
  12948. Set the output frame rate. Default value is @code{25}.
  12949. @item size, s
  12950. Set the video size for the output. For the syntax of this option, check the
  12951. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12952. Default value is @code{800x400}.
  12953. @item rc
  12954. @item gc
  12955. @item bc
  12956. Specify the red, green, blue contrast. Default values are @code{2},
  12957. @code{7} and @code{1}.
  12958. Allowed range is @code{[0, 255]}.
  12959. @item mpc
  12960. Set color which will be used for drawing median phase. If color is
  12961. @code{none} which is default, no median phase value will be drawn.
  12962. @item video
  12963. Enable video output. Default is enabled.
  12964. @end table
  12965. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  12966. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  12967. The @code{-1} means left and right channels are completely out of phase and
  12968. @code{1} means channels are in phase.
  12969. @section avectorscope
  12970. Convert input audio to a video output, representing the audio vector
  12971. scope.
  12972. The filter is used to measure the difference between channels of stereo
  12973. audio stream. A monoaural signal, consisting of identical left and right
  12974. signal, results in straight vertical line. Any stereo separation is visible
  12975. as a deviation from this line, creating a Lissajous figure.
  12976. If the straight (or deviation from it) but horizontal line appears this
  12977. indicates that the left and right channels are out of phase.
  12978. The filter accepts the following options:
  12979. @table @option
  12980. @item mode, m
  12981. Set the vectorscope mode.
  12982. Available values are:
  12983. @table @samp
  12984. @item lissajous
  12985. Lissajous rotated by 45 degrees.
  12986. @item lissajous_xy
  12987. Same as above but not rotated.
  12988. @item polar
  12989. Shape resembling half of circle.
  12990. @end table
  12991. Default value is @samp{lissajous}.
  12992. @item size, s
  12993. Set the video size for the output. For the syntax of this option, check the
  12994. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12995. Default value is @code{400x400}.
  12996. @item rate, r
  12997. Set the output frame rate. Default value is @code{25}.
  12998. @item rc
  12999. @item gc
  13000. @item bc
  13001. @item ac
  13002. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  13003. @code{160}, @code{80} and @code{255}.
  13004. Allowed range is @code{[0, 255]}.
  13005. @item rf
  13006. @item gf
  13007. @item bf
  13008. @item af
  13009. Specify the red, green, blue and alpha fade. Default values are @code{15},
  13010. @code{10}, @code{5} and @code{5}.
  13011. Allowed range is @code{[0, 255]}.
  13012. @item zoom
  13013. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  13014. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  13015. @item draw
  13016. Set the vectorscope drawing mode.
  13017. Available values are:
  13018. @table @samp
  13019. @item dot
  13020. Draw dot for each sample.
  13021. @item line
  13022. Draw line between previous and current sample.
  13023. @end table
  13024. Default value is @samp{dot}.
  13025. @item scale
  13026. Specify amplitude scale of audio samples.
  13027. Available values are:
  13028. @table @samp
  13029. @item lin
  13030. Linear.
  13031. @item sqrt
  13032. Square root.
  13033. @item cbrt
  13034. Cubic root.
  13035. @item log
  13036. Logarithmic.
  13037. @end table
  13038. @end table
  13039. @subsection Examples
  13040. @itemize
  13041. @item
  13042. Complete example using @command{ffplay}:
  13043. @example
  13044. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  13045. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  13046. @end example
  13047. @end itemize
  13048. @section bench, abench
  13049. Benchmark part of a filtergraph.
  13050. The filter accepts the following options:
  13051. @table @option
  13052. @item action
  13053. Start or stop a timer.
  13054. Available values are:
  13055. @table @samp
  13056. @item start
  13057. Get the current time, set it as frame metadata (using the key
  13058. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  13059. @item stop
  13060. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  13061. the input frame metadata to get the time difference. Time difference, average,
  13062. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  13063. @code{min}) are then printed. The timestamps are expressed in seconds.
  13064. @end table
  13065. @end table
  13066. @subsection Examples
  13067. @itemize
  13068. @item
  13069. Benchmark @ref{selectivecolor} filter:
  13070. @example
  13071. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  13072. @end example
  13073. @end itemize
  13074. @section concat
  13075. Concatenate audio and video streams, joining them together one after the
  13076. other.
  13077. The filter works on segments of synchronized video and audio streams. All
  13078. segments must have the same number of streams of each type, and that will
  13079. also be the number of streams at output.
  13080. The filter accepts the following options:
  13081. @table @option
  13082. @item n
  13083. Set the number of segments. Default is 2.
  13084. @item v
  13085. Set the number of output video streams, that is also the number of video
  13086. streams in each segment. Default is 1.
  13087. @item a
  13088. Set the number of output audio streams, that is also the number of audio
  13089. streams in each segment. Default is 0.
  13090. @item unsafe
  13091. Activate unsafe mode: do not fail if segments have a different format.
  13092. @end table
  13093. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  13094. @var{a} audio outputs.
  13095. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  13096. segment, in the same order as the outputs, then the inputs for the second
  13097. segment, etc.
  13098. Related streams do not always have exactly the same duration, for various
  13099. reasons including codec frame size or sloppy authoring. For that reason,
  13100. related synchronized streams (e.g. a video and its audio track) should be
  13101. concatenated at once. The concat filter will use the duration of the longest
  13102. stream in each segment (except the last one), and if necessary pad shorter
  13103. audio streams with silence.
  13104. For this filter to work correctly, all segments must start at timestamp 0.
  13105. All corresponding streams must have the same parameters in all segments; the
  13106. filtering system will automatically select a common pixel format for video
  13107. streams, and a common sample format, sample rate and channel layout for
  13108. audio streams, but other settings, such as resolution, must be converted
  13109. explicitly by the user.
  13110. Different frame rates are acceptable but will result in variable frame rate
  13111. at output; be sure to configure the output file to handle it.
  13112. @subsection Examples
  13113. @itemize
  13114. @item
  13115. Concatenate an opening, an episode and an ending, all in bilingual version
  13116. (video in stream 0, audio in streams 1 and 2):
  13117. @example
  13118. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  13119. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  13120. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  13121. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  13122. @end example
  13123. @item
  13124. Concatenate two parts, handling audio and video separately, using the
  13125. (a)movie sources, and adjusting the resolution:
  13126. @example
  13127. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  13128. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  13129. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  13130. @end example
  13131. Note that a desync will happen at the stitch if the audio and video streams
  13132. do not have exactly the same duration in the first file.
  13133. @end itemize
  13134. @section drawgraph, adrawgraph
  13135. Draw a graph using input video or audio metadata.
  13136. It accepts the following parameters:
  13137. @table @option
  13138. @item m1
  13139. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  13140. @item fg1
  13141. Set 1st foreground color expression.
  13142. @item m2
  13143. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  13144. @item fg2
  13145. Set 2nd foreground color expression.
  13146. @item m3
  13147. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  13148. @item fg3
  13149. Set 3rd foreground color expression.
  13150. @item m4
  13151. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  13152. @item fg4
  13153. Set 4th foreground color expression.
  13154. @item min
  13155. Set minimal value of metadata value.
  13156. @item max
  13157. Set maximal value of metadata value.
  13158. @item bg
  13159. Set graph background color. Default is white.
  13160. @item mode
  13161. Set graph mode.
  13162. Available values for mode is:
  13163. @table @samp
  13164. @item bar
  13165. @item dot
  13166. @item line
  13167. @end table
  13168. Default is @code{line}.
  13169. @item slide
  13170. Set slide mode.
  13171. Available values for slide is:
  13172. @table @samp
  13173. @item frame
  13174. Draw new frame when right border is reached.
  13175. @item replace
  13176. Replace old columns with new ones.
  13177. @item scroll
  13178. Scroll from right to left.
  13179. @item rscroll
  13180. Scroll from left to right.
  13181. @item picture
  13182. Draw single picture.
  13183. @end table
  13184. Default is @code{frame}.
  13185. @item size
  13186. Set size of graph video. For the syntax of this option, check the
  13187. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13188. The default value is @code{900x256}.
  13189. The foreground color expressions can use the following variables:
  13190. @table @option
  13191. @item MIN
  13192. Minimal value of metadata value.
  13193. @item MAX
  13194. Maximal value of metadata value.
  13195. @item VAL
  13196. Current metadata key value.
  13197. @end table
  13198. The color is defined as 0xAABBGGRR.
  13199. @end table
  13200. Example using metadata from @ref{signalstats} filter:
  13201. @example
  13202. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  13203. @end example
  13204. Example using metadata from @ref{ebur128} filter:
  13205. @example
  13206. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  13207. @end example
  13208. @anchor{ebur128}
  13209. @section ebur128
  13210. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  13211. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  13212. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  13213. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  13214. The filter also has a video output (see the @var{video} option) with a real
  13215. time graph to observe the loudness evolution. The graphic contains the logged
  13216. message mentioned above, so it is not printed anymore when this option is set,
  13217. unless the verbose logging is set. The main graphing area contains the
  13218. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  13219. the momentary loudness (400 milliseconds).
  13220. More information about the Loudness Recommendation EBU R128 on
  13221. @url{http://tech.ebu.ch/loudness}.
  13222. The filter accepts the following options:
  13223. @table @option
  13224. @item video
  13225. Activate the video output. The audio stream is passed unchanged whether this
  13226. option is set or no. The video stream will be the first output stream if
  13227. activated. Default is @code{0}.
  13228. @item size
  13229. Set the video size. This option is for video only. For the syntax of this
  13230. option, check the
  13231. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13232. Default and minimum resolution is @code{640x480}.
  13233. @item meter
  13234. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  13235. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  13236. other integer value between this range is allowed.
  13237. @item metadata
  13238. Set metadata injection. If set to @code{1}, the audio input will be segmented
  13239. into 100ms output frames, each of them containing various loudness information
  13240. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  13241. Default is @code{0}.
  13242. @item framelog
  13243. Force the frame logging level.
  13244. Available values are:
  13245. @table @samp
  13246. @item info
  13247. information logging level
  13248. @item verbose
  13249. verbose logging level
  13250. @end table
  13251. By default, the logging level is set to @var{info}. If the @option{video} or
  13252. the @option{metadata} options are set, it switches to @var{verbose}.
  13253. @item peak
  13254. Set peak mode(s).
  13255. Available modes can be cumulated (the option is a @code{flag} type). Possible
  13256. values are:
  13257. @table @samp
  13258. @item none
  13259. Disable any peak mode (default).
  13260. @item sample
  13261. Enable sample-peak mode.
  13262. Simple peak mode looking for the higher sample value. It logs a message
  13263. for sample-peak (identified by @code{SPK}).
  13264. @item true
  13265. Enable true-peak mode.
  13266. If enabled, the peak lookup is done on an over-sampled version of the input
  13267. stream for better peak accuracy. It logs a message for true-peak.
  13268. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  13269. This mode requires a build with @code{libswresample}.
  13270. @end table
  13271. @item dualmono
  13272. Treat mono input files as "dual mono". If a mono file is intended for playback
  13273. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  13274. If set to @code{true}, this option will compensate for this effect.
  13275. Multi-channel input files are not affected by this option.
  13276. @item panlaw
  13277. Set a specific pan law to be used for the measurement of dual mono files.
  13278. This parameter is optional, and has a default value of -3.01dB.
  13279. @end table
  13280. @subsection Examples
  13281. @itemize
  13282. @item
  13283. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  13284. @example
  13285. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  13286. @end example
  13287. @item
  13288. Run an analysis with @command{ffmpeg}:
  13289. @example
  13290. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  13291. @end example
  13292. @end itemize
  13293. @section interleave, ainterleave
  13294. Temporally interleave frames from several inputs.
  13295. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  13296. These filters read frames from several inputs and send the oldest
  13297. queued frame to the output.
  13298. Input streams must have well defined, monotonically increasing frame
  13299. timestamp values.
  13300. In order to submit one frame to output, these filters need to enqueue
  13301. at least one frame for each input, so they cannot work in case one
  13302. input is not yet terminated and will not receive incoming frames.
  13303. For example consider the case when one input is a @code{select} filter
  13304. which always drops input frames. The @code{interleave} filter will keep
  13305. reading from that input, but it will never be able to send new frames
  13306. to output until the input sends an end-of-stream signal.
  13307. Also, depending on inputs synchronization, the filters will drop
  13308. frames in case one input receives more frames than the other ones, and
  13309. the queue is already filled.
  13310. These filters accept the following options:
  13311. @table @option
  13312. @item nb_inputs, n
  13313. Set the number of different inputs, it is 2 by default.
  13314. @end table
  13315. @subsection Examples
  13316. @itemize
  13317. @item
  13318. Interleave frames belonging to different streams using @command{ffmpeg}:
  13319. @example
  13320. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  13321. @end example
  13322. @item
  13323. Add flickering blur effect:
  13324. @example
  13325. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  13326. @end example
  13327. @end itemize
  13328. @section metadata, ametadata
  13329. Manipulate frame metadata.
  13330. This filter accepts the following options:
  13331. @table @option
  13332. @item mode
  13333. Set mode of operation of the filter.
  13334. Can be one of the following:
  13335. @table @samp
  13336. @item select
  13337. If both @code{value} and @code{key} is set, select frames
  13338. which have such metadata. If only @code{key} is set, select
  13339. every frame that has such key in metadata.
  13340. @item add
  13341. Add new metadata @code{key} and @code{value}. If key is already available
  13342. do nothing.
  13343. @item modify
  13344. Modify value of already present key.
  13345. @item delete
  13346. If @code{value} is set, delete only keys that have such value.
  13347. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  13348. the frame.
  13349. @item print
  13350. Print key and its value if metadata was found. If @code{key} is not set print all
  13351. metadata values available in frame.
  13352. @end table
  13353. @item key
  13354. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  13355. @item value
  13356. Set metadata value which will be used. This option is mandatory for
  13357. @code{modify} and @code{add} mode.
  13358. @item function
  13359. Which function to use when comparing metadata value and @code{value}.
  13360. Can be one of following:
  13361. @table @samp
  13362. @item same_str
  13363. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  13364. @item starts_with
  13365. Values are interpreted as strings, returns true if metadata value starts with
  13366. the @code{value} option string.
  13367. @item less
  13368. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  13369. @item equal
  13370. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  13371. @item greater
  13372. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  13373. @item expr
  13374. Values are interpreted as floats, returns true if expression from option @code{expr}
  13375. evaluates to true.
  13376. @end table
  13377. @item expr
  13378. Set expression which is used when @code{function} is set to @code{expr}.
  13379. The expression is evaluated through the eval API and can contain the following
  13380. constants:
  13381. @table @option
  13382. @item VALUE1
  13383. Float representation of @code{value} from metadata key.
  13384. @item VALUE2
  13385. Float representation of @code{value} as supplied by user in @code{value} option.
  13386. @end table
  13387. @item file
  13388. If specified in @code{print} mode, output is written to the named file. Instead of
  13389. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  13390. for standard output. If @code{file} option is not set, output is written to the log
  13391. with AV_LOG_INFO loglevel.
  13392. @end table
  13393. @subsection Examples
  13394. @itemize
  13395. @item
  13396. Print all metadata values for frames with key @code{lavfi.singnalstats.YDIF} with values
  13397. between 0 and 1.
  13398. @example
  13399. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  13400. @end example
  13401. @item
  13402. Print silencedetect output to file @file{metadata.txt}.
  13403. @example
  13404. silencedetect,ametadata=mode=print:file=metadata.txt
  13405. @end example
  13406. @item
  13407. Direct all metadata to a pipe with file descriptor 4.
  13408. @example
  13409. metadata=mode=print:file='pipe\:4'
  13410. @end example
  13411. @end itemize
  13412. @section perms, aperms
  13413. Set read/write permissions for the output frames.
  13414. These filters are mainly aimed at developers to test direct path in the
  13415. following filter in the filtergraph.
  13416. The filters accept the following options:
  13417. @table @option
  13418. @item mode
  13419. Select the permissions mode.
  13420. It accepts the following values:
  13421. @table @samp
  13422. @item none
  13423. Do nothing. This is the default.
  13424. @item ro
  13425. Set all the output frames read-only.
  13426. @item rw
  13427. Set all the output frames directly writable.
  13428. @item toggle
  13429. Make the frame read-only if writable, and writable if read-only.
  13430. @item random
  13431. Set each output frame read-only or writable randomly.
  13432. @end table
  13433. @item seed
  13434. Set the seed for the @var{random} mode, must be an integer included between
  13435. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  13436. @code{-1}, the filter will try to use a good random seed on a best effort
  13437. basis.
  13438. @end table
  13439. Note: in case of auto-inserted filter between the permission filter and the
  13440. following one, the permission might not be received as expected in that
  13441. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  13442. perms/aperms filter can avoid this problem.
  13443. @section realtime, arealtime
  13444. Slow down filtering to match real time approximatively.
  13445. These filters will pause the filtering for a variable amount of time to
  13446. match the output rate with the input timestamps.
  13447. They are similar to the @option{re} option to @code{ffmpeg}.
  13448. They accept the following options:
  13449. @table @option
  13450. @item limit
  13451. Time limit for the pauses. Any pause longer than that will be considered
  13452. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  13453. @end table
  13454. @anchor{select}
  13455. @section select, aselect
  13456. Select frames to pass in output.
  13457. This filter accepts the following options:
  13458. @table @option
  13459. @item expr, e
  13460. Set expression, which is evaluated for each input frame.
  13461. If the expression is evaluated to zero, the frame is discarded.
  13462. If the evaluation result is negative or NaN, the frame is sent to the
  13463. first output; otherwise it is sent to the output with index
  13464. @code{ceil(val)-1}, assuming that the input index starts from 0.
  13465. For example a value of @code{1.2} corresponds to the output with index
  13466. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  13467. @item outputs, n
  13468. Set the number of outputs. The output to which to send the selected
  13469. frame is based on the result of the evaluation. Default value is 1.
  13470. @end table
  13471. The expression can contain the following constants:
  13472. @table @option
  13473. @item n
  13474. The (sequential) number of the filtered frame, starting from 0.
  13475. @item selected_n
  13476. The (sequential) number of the selected frame, starting from 0.
  13477. @item prev_selected_n
  13478. The sequential number of the last selected frame. It's NAN if undefined.
  13479. @item TB
  13480. The timebase of the input timestamps.
  13481. @item pts
  13482. The PTS (Presentation TimeStamp) of the filtered video frame,
  13483. expressed in @var{TB} units. It's NAN if undefined.
  13484. @item t
  13485. The PTS of the filtered video frame,
  13486. expressed in seconds. It's NAN if undefined.
  13487. @item prev_pts
  13488. The PTS of the previously filtered video frame. It's NAN if undefined.
  13489. @item prev_selected_pts
  13490. The PTS of the last previously filtered video frame. It's NAN if undefined.
  13491. @item prev_selected_t
  13492. The PTS of the last previously selected video frame. It's NAN if undefined.
  13493. @item start_pts
  13494. The PTS of the first video frame in the video. It's NAN if undefined.
  13495. @item start_t
  13496. The time of the first video frame in the video. It's NAN if undefined.
  13497. @item pict_type @emph{(video only)}
  13498. The type of the filtered frame. It can assume one of the following
  13499. values:
  13500. @table @option
  13501. @item I
  13502. @item P
  13503. @item B
  13504. @item S
  13505. @item SI
  13506. @item SP
  13507. @item BI
  13508. @end table
  13509. @item interlace_type @emph{(video only)}
  13510. The frame interlace type. It can assume one of the following values:
  13511. @table @option
  13512. @item PROGRESSIVE
  13513. The frame is progressive (not interlaced).
  13514. @item TOPFIRST
  13515. The frame is top-field-first.
  13516. @item BOTTOMFIRST
  13517. The frame is bottom-field-first.
  13518. @end table
  13519. @item consumed_sample_n @emph{(audio only)}
  13520. the number of selected samples before the current frame
  13521. @item samples_n @emph{(audio only)}
  13522. the number of samples in the current frame
  13523. @item sample_rate @emph{(audio only)}
  13524. the input sample rate
  13525. @item key
  13526. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  13527. @item pos
  13528. the position in the file of the filtered frame, -1 if the information
  13529. is not available (e.g. for synthetic video)
  13530. @item scene @emph{(video only)}
  13531. value between 0 and 1 to indicate a new scene; a low value reflects a low
  13532. probability for the current frame to introduce a new scene, while a higher
  13533. value means the current frame is more likely to be one (see the example below)
  13534. @item concatdec_select
  13535. The concat demuxer can select only part of a concat input file by setting an
  13536. inpoint and an outpoint, but the output packets may not be entirely contained
  13537. in the selected interval. By using this variable, it is possible to skip frames
  13538. generated by the concat demuxer which are not exactly contained in the selected
  13539. interval.
  13540. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  13541. and the @var{lavf.concat.duration} packet metadata values which are also
  13542. present in the decoded frames.
  13543. The @var{concatdec_select} variable is -1 if the frame pts is at least
  13544. start_time and either the duration metadata is missing or the frame pts is less
  13545. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  13546. missing.
  13547. That basically means that an input frame is selected if its pts is within the
  13548. interval set by the concat demuxer.
  13549. @end table
  13550. The default value of the select expression is "1".
  13551. @subsection Examples
  13552. @itemize
  13553. @item
  13554. Select all frames in input:
  13555. @example
  13556. select
  13557. @end example
  13558. The example above is the same as:
  13559. @example
  13560. select=1
  13561. @end example
  13562. @item
  13563. Skip all frames:
  13564. @example
  13565. select=0
  13566. @end example
  13567. @item
  13568. Select only I-frames:
  13569. @example
  13570. select='eq(pict_type\,I)'
  13571. @end example
  13572. @item
  13573. Select one frame every 100:
  13574. @example
  13575. select='not(mod(n\,100))'
  13576. @end example
  13577. @item
  13578. Select only frames contained in the 10-20 time interval:
  13579. @example
  13580. select=between(t\,10\,20)
  13581. @end example
  13582. @item
  13583. Select only I-frames contained in the 10-20 time interval:
  13584. @example
  13585. select=between(t\,10\,20)*eq(pict_type\,I)
  13586. @end example
  13587. @item
  13588. Select frames with a minimum distance of 10 seconds:
  13589. @example
  13590. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  13591. @end example
  13592. @item
  13593. Use aselect to select only audio frames with samples number > 100:
  13594. @example
  13595. aselect='gt(samples_n\,100)'
  13596. @end example
  13597. @item
  13598. Create a mosaic of the first scenes:
  13599. @example
  13600. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  13601. @end example
  13602. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  13603. choice.
  13604. @item
  13605. Send even and odd frames to separate outputs, and compose them:
  13606. @example
  13607. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  13608. @end example
  13609. @item
  13610. Select useful frames from an ffconcat file which is using inpoints and
  13611. outpoints but where the source files are not intra frame only.
  13612. @example
  13613. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  13614. @end example
  13615. @end itemize
  13616. @section sendcmd, asendcmd
  13617. Send commands to filters in the filtergraph.
  13618. These filters read commands to be sent to other filters in the
  13619. filtergraph.
  13620. @code{sendcmd} must be inserted between two video filters,
  13621. @code{asendcmd} must be inserted between two audio filters, but apart
  13622. from that they act the same way.
  13623. The specification of commands can be provided in the filter arguments
  13624. with the @var{commands} option, or in a file specified by the
  13625. @var{filename} option.
  13626. These filters accept the following options:
  13627. @table @option
  13628. @item commands, c
  13629. Set the commands to be read and sent to the other filters.
  13630. @item filename, f
  13631. Set the filename of the commands to be read and sent to the other
  13632. filters.
  13633. @end table
  13634. @subsection Commands syntax
  13635. A commands description consists of a sequence of interval
  13636. specifications, comprising a list of commands to be executed when a
  13637. particular event related to that interval occurs. The occurring event
  13638. is typically the current frame time entering or leaving a given time
  13639. interval.
  13640. An interval is specified by the following syntax:
  13641. @example
  13642. @var{START}[-@var{END}] @var{COMMANDS};
  13643. @end example
  13644. The time interval is specified by the @var{START} and @var{END} times.
  13645. @var{END} is optional and defaults to the maximum time.
  13646. The current frame time is considered within the specified interval if
  13647. it is included in the interval [@var{START}, @var{END}), that is when
  13648. the time is greater or equal to @var{START} and is lesser than
  13649. @var{END}.
  13650. @var{COMMANDS} consists of a sequence of one or more command
  13651. specifications, separated by ",", relating to that interval. The
  13652. syntax of a command specification is given by:
  13653. @example
  13654. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  13655. @end example
  13656. @var{FLAGS} is optional and specifies the type of events relating to
  13657. the time interval which enable sending the specified command, and must
  13658. be a non-null sequence of identifier flags separated by "+" or "|" and
  13659. enclosed between "[" and "]".
  13660. The following flags are recognized:
  13661. @table @option
  13662. @item enter
  13663. The command is sent when the current frame timestamp enters the
  13664. specified interval. In other words, the command is sent when the
  13665. previous frame timestamp was not in the given interval, and the
  13666. current is.
  13667. @item leave
  13668. The command is sent when the current frame timestamp leaves the
  13669. specified interval. In other words, the command is sent when the
  13670. previous frame timestamp was in the given interval, and the
  13671. current is not.
  13672. @end table
  13673. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  13674. assumed.
  13675. @var{TARGET} specifies the target of the command, usually the name of
  13676. the filter class or a specific filter instance name.
  13677. @var{COMMAND} specifies the name of the command for the target filter.
  13678. @var{ARG} is optional and specifies the optional list of argument for
  13679. the given @var{COMMAND}.
  13680. Between one interval specification and another, whitespaces, or
  13681. sequences of characters starting with @code{#} until the end of line,
  13682. are ignored and can be used to annotate comments.
  13683. A simplified BNF description of the commands specification syntax
  13684. follows:
  13685. @example
  13686. @var{COMMAND_FLAG} ::= "enter" | "leave"
  13687. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  13688. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  13689. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  13690. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  13691. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  13692. @end example
  13693. @subsection Examples
  13694. @itemize
  13695. @item
  13696. Specify audio tempo change at second 4:
  13697. @example
  13698. asendcmd=c='4.0 atempo tempo 1.5',atempo
  13699. @end example
  13700. @item
  13701. Target a specific filter instance:
  13702. @example
  13703. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  13704. @end example
  13705. @item
  13706. Specify a list of drawtext and hue commands in a file.
  13707. @example
  13708. # show text in the interval 5-10
  13709. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  13710. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  13711. # desaturate the image in the interval 15-20
  13712. 15.0-20.0 [enter] hue s 0,
  13713. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  13714. [leave] hue s 1,
  13715. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  13716. # apply an exponential saturation fade-out effect, starting from time 25
  13717. 25 [enter] hue s exp(25-t)
  13718. @end example
  13719. A filtergraph allowing to read and process the above command list
  13720. stored in a file @file{test.cmd}, can be specified with:
  13721. @example
  13722. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  13723. @end example
  13724. @end itemize
  13725. @anchor{setpts}
  13726. @section setpts, asetpts
  13727. Change the PTS (presentation timestamp) of the input frames.
  13728. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  13729. This filter accepts the following options:
  13730. @table @option
  13731. @item expr
  13732. The expression which is evaluated for each frame to construct its timestamp.
  13733. @end table
  13734. The expression is evaluated through the eval API and can contain the following
  13735. constants:
  13736. @table @option
  13737. @item FRAME_RATE
  13738. frame rate, only defined for constant frame-rate video
  13739. @item PTS
  13740. The presentation timestamp in input
  13741. @item N
  13742. The count of the input frame for video or the number of consumed samples,
  13743. not including the current frame for audio, starting from 0.
  13744. @item NB_CONSUMED_SAMPLES
  13745. The number of consumed samples, not including the current frame (only
  13746. audio)
  13747. @item NB_SAMPLES, S
  13748. The number of samples in the current frame (only audio)
  13749. @item SAMPLE_RATE, SR
  13750. The audio sample rate.
  13751. @item STARTPTS
  13752. The PTS of the first frame.
  13753. @item STARTT
  13754. the time in seconds of the first frame
  13755. @item INTERLACED
  13756. State whether the current frame is interlaced.
  13757. @item T
  13758. the time in seconds of the current frame
  13759. @item POS
  13760. original position in the file of the frame, or undefined if undefined
  13761. for the current frame
  13762. @item PREV_INPTS
  13763. The previous input PTS.
  13764. @item PREV_INT
  13765. previous input time in seconds
  13766. @item PREV_OUTPTS
  13767. The previous output PTS.
  13768. @item PREV_OUTT
  13769. previous output time in seconds
  13770. @item RTCTIME
  13771. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  13772. instead.
  13773. @item RTCSTART
  13774. The wallclock (RTC) time at the start of the movie in microseconds.
  13775. @item TB
  13776. The timebase of the input timestamps.
  13777. @end table
  13778. @subsection Examples
  13779. @itemize
  13780. @item
  13781. Start counting PTS from zero
  13782. @example
  13783. setpts=PTS-STARTPTS
  13784. @end example
  13785. @item
  13786. Apply fast motion effect:
  13787. @example
  13788. setpts=0.5*PTS
  13789. @end example
  13790. @item
  13791. Apply slow motion effect:
  13792. @example
  13793. setpts=2.0*PTS
  13794. @end example
  13795. @item
  13796. Set fixed rate of 25 frames per second:
  13797. @example
  13798. setpts=N/(25*TB)
  13799. @end example
  13800. @item
  13801. Set fixed rate 25 fps with some jitter:
  13802. @example
  13803. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  13804. @end example
  13805. @item
  13806. Apply an offset of 10 seconds to the input PTS:
  13807. @example
  13808. setpts=PTS+10/TB
  13809. @end example
  13810. @item
  13811. Generate timestamps from a "live source" and rebase onto the current timebase:
  13812. @example
  13813. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  13814. @end example
  13815. @item
  13816. Generate timestamps by counting samples:
  13817. @example
  13818. asetpts=N/SR/TB
  13819. @end example
  13820. @end itemize
  13821. @section settb, asettb
  13822. Set the timebase to use for the output frames timestamps.
  13823. It is mainly useful for testing timebase configuration.
  13824. It accepts the following parameters:
  13825. @table @option
  13826. @item expr, tb
  13827. The expression which is evaluated into the output timebase.
  13828. @end table
  13829. The value for @option{tb} is an arithmetic expression representing a
  13830. rational. The expression can contain the constants "AVTB" (the default
  13831. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  13832. audio only). Default value is "intb".
  13833. @subsection Examples
  13834. @itemize
  13835. @item
  13836. Set the timebase to 1/25:
  13837. @example
  13838. settb=expr=1/25
  13839. @end example
  13840. @item
  13841. Set the timebase to 1/10:
  13842. @example
  13843. settb=expr=0.1
  13844. @end example
  13845. @item
  13846. Set the timebase to 1001/1000:
  13847. @example
  13848. settb=1+0.001
  13849. @end example
  13850. @item
  13851. Set the timebase to 2*intb:
  13852. @example
  13853. settb=2*intb
  13854. @end example
  13855. @item
  13856. Set the default timebase value:
  13857. @example
  13858. settb=AVTB
  13859. @end example
  13860. @end itemize
  13861. @section showcqt
  13862. Convert input audio to a video output representing frequency spectrum
  13863. logarithmically using Brown-Puckette constant Q transform algorithm with
  13864. direct frequency domain coefficient calculation (but the transform itself
  13865. is not really constant Q, instead the Q factor is actually variable/clamped),
  13866. with musical tone scale, from E0 to D#10.
  13867. The filter accepts the following options:
  13868. @table @option
  13869. @item size, s
  13870. Specify the video size for the output. It must be even. For the syntax of this option,
  13871. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13872. Default value is @code{1920x1080}.
  13873. @item fps, rate, r
  13874. Set the output frame rate. Default value is @code{25}.
  13875. @item bar_h
  13876. Set the bargraph height. It must be even. Default value is @code{-1} which
  13877. computes the bargraph height automatically.
  13878. @item axis_h
  13879. Set the axis height. It must be even. Default value is @code{-1} which computes
  13880. the axis height automatically.
  13881. @item sono_h
  13882. Set the sonogram height. It must be even. Default value is @code{-1} which
  13883. computes the sonogram height automatically.
  13884. @item fullhd
  13885. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  13886. instead. Default value is @code{1}.
  13887. @item sono_v, volume
  13888. Specify the sonogram volume expression. It can contain variables:
  13889. @table @option
  13890. @item bar_v
  13891. the @var{bar_v} evaluated expression
  13892. @item frequency, freq, f
  13893. the frequency where it is evaluated
  13894. @item timeclamp, tc
  13895. the value of @var{timeclamp} option
  13896. @end table
  13897. and functions:
  13898. @table @option
  13899. @item a_weighting(f)
  13900. A-weighting of equal loudness
  13901. @item b_weighting(f)
  13902. B-weighting of equal loudness
  13903. @item c_weighting(f)
  13904. C-weighting of equal loudness.
  13905. @end table
  13906. Default value is @code{16}.
  13907. @item bar_v, volume2
  13908. Specify the bargraph volume expression. It can contain variables:
  13909. @table @option
  13910. @item sono_v
  13911. the @var{sono_v} evaluated expression
  13912. @item frequency, freq, f
  13913. the frequency where it is evaluated
  13914. @item timeclamp, tc
  13915. the value of @var{timeclamp} option
  13916. @end table
  13917. and functions:
  13918. @table @option
  13919. @item a_weighting(f)
  13920. A-weighting of equal loudness
  13921. @item b_weighting(f)
  13922. B-weighting of equal loudness
  13923. @item c_weighting(f)
  13924. C-weighting of equal loudness.
  13925. @end table
  13926. Default value is @code{sono_v}.
  13927. @item sono_g, gamma
  13928. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  13929. higher gamma makes the spectrum having more range. Default value is @code{3}.
  13930. Acceptable range is @code{[1, 7]}.
  13931. @item bar_g, gamma2
  13932. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  13933. @code{[1, 7]}.
  13934. @item bar_t
  13935. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  13936. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  13937. @item timeclamp, tc
  13938. Specify the transform timeclamp. At low frequency, there is trade-off between
  13939. accuracy in time domain and frequency domain. If timeclamp is lower,
  13940. event in time domain is represented more accurately (such as fast bass drum),
  13941. otherwise event in frequency domain is represented more accurately
  13942. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  13943. @item attack
  13944. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  13945. limits future samples by applying asymmetric windowing in time domain, useful
  13946. when low latency is required. Accepted range is @code{[0, 1]}.
  13947. @item basefreq
  13948. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  13949. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  13950. @item endfreq
  13951. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  13952. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  13953. @item coeffclamp
  13954. This option is deprecated and ignored.
  13955. @item tlength
  13956. Specify the transform length in time domain. Use this option to control accuracy
  13957. trade-off between time domain and frequency domain at every frequency sample.
  13958. It can contain variables:
  13959. @table @option
  13960. @item frequency, freq, f
  13961. the frequency where it is evaluated
  13962. @item timeclamp, tc
  13963. the value of @var{timeclamp} option.
  13964. @end table
  13965. Default value is @code{384*tc/(384+tc*f)}.
  13966. @item count
  13967. Specify the transform count for every video frame. Default value is @code{6}.
  13968. Acceptable range is @code{[1, 30]}.
  13969. @item fcount
  13970. Specify the transform count for every single pixel. Default value is @code{0},
  13971. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  13972. @item fontfile
  13973. Specify font file for use with freetype to draw the axis. If not specified,
  13974. use embedded font. Note that drawing with font file or embedded font is not
  13975. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  13976. option instead.
  13977. @item font
  13978. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  13979. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  13980. @item fontcolor
  13981. Specify font color expression. This is arithmetic expression that should return
  13982. integer value 0xRRGGBB. It can contain variables:
  13983. @table @option
  13984. @item frequency, freq, f
  13985. the frequency where it is evaluated
  13986. @item timeclamp, tc
  13987. the value of @var{timeclamp} option
  13988. @end table
  13989. and functions:
  13990. @table @option
  13991. @item midi(f)
  13992. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  13993. @item r(x), g(x), b(x)
  13994. red, green, and blue value of intensity x.
  13995. @end table
  13996. Default value is @code{st(0, (midi(f)-59.5)/12);
  13997. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  13998. r(1-ld(1)) + b(ld(1))}.
  13999. @item axisfile
  14000. Specify image file to draw the axis. This option override @var{fontfile} and
  14001. @var{fontcolor} option.
  14002. @item axis, text
  14003. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  14004. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  14005. Default value is @code{1}.
  14006. @item csp
  14007. Set colorspace. The accepted values are:
  14008. @table @samp
  14009. @item unspecified
  14010. Unspecified (default)
  14011. @item bt709
  14012. BT.709
  14013. @item fcc
  14014. FCC
  14015. @item bt470bg
  14016. BT.470BG or BT.601-6 625
  14017. @item smpte170m
  14018. SMPTE-170M or BT.601-6 525
  14019. @item smpte240m
  14020. SMPTE-240M
  14021. @item bt2020ncl
  14022. BT.2020 with non-constant luminance
  14023. @end table
  14024. @item cscheme
  14025. Set spectrogram color scheme. This is list of floating point values with format
  14026. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  14027. The default is @code{1|0.5|0|0|0.5|1}.
  14028. @end table
  14029. @subsection Examples
  14030. @itemize
  14031. @item
  14032. Playing audio while showing the spectrum:
  14033. @example
  14034. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  14035. @end example
  14036. @item
  14037. Same as above, but with frame rate 30 fps:
  14038. @example
  14039. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  14040. @end example
  14041. @item
  14042. Playing at 1280x720:
  14043. @example
  14044. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  14045. @end example
  14046. @item
  14047. Disable sonogram display:
  14048. @example
  14049. sono_h=0
  14050. @end example
  14051. @item
  14052. A1 and its harmonics: A1, A2, (near)E3, A3:
  14053. @example
  14054. 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),
  14055. asplit[a][out1]; [a] showcqt [out0]'
  14056. @end example
  14057. @item
  14058. Same as above, but with more accuracy in frequency domain:
  14059. @example
  14060. 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),
  14061. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  14062. @end example
  14063. @item
  14064. Custom volume:
  14065. @example
  14066. bar_v=10:sono_v=bar_v*a_weighting(f)
  14067. @end example
  14068. @item
  14069. Custom gamma, now spectrum is linear to the amplitude.
  14070. @example
  14071. bar_g=2:sono_g=2
  14072. @end example
  14073. @item
  14074. Custom tlength equation:
  14075. @example
  14076. 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)))'
  14077. @end example
  14078. @item
  14079. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  14080. @example
  14081. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  14082. @end example
  14083. @item
  14084. Custom font using fontconfig:
  14085. @example
  14086. font='Courier New,Monospace,mono|bold'
  14087. @end example
  14088. @item
  14089. Custom frequency range with custom axis using image file:
  14090. @example
  14091. axisfile=myaxis.png:basefreq=40:endfreq=10000
  14092. @end example
  14093. @end itemize
  14094. @section showfreqs
  14095. Convert input audio to video output representing the audio power spectrum.
  14096. Audio amplitude is on Y-axis while frequency is on X-axis.
  14097. The filter accepts the following options:
  14098. @table @option
  14099. @item size, s
  14100. Specify size of video. For the syntax of this option, check the
  14101. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14102. Default is @code{1024x512}.
  14103. @item mode
  14104. Set display mode.
  14105. This set how each frequency bin will be represented.
  14106. It accepts the following values:
  14107. @table @samp
  14108. @item line
  14109. @item bar
  14110. @item dot
  14111. @end table
  14112. Default is @code{bar}.
  14113. @item ascale
  14114. Set amplitude scale.
  14115. It accepts the following values:
  14116. @table @samp
  14117. @item lin
  14118. Linear scale.
  14119. @item sqrt
  14120. Square root scale.
  14121. @item cbrt
  14122. Cubic root scale.
  14123. @item log
  14124. Logarithmic scale.
  14125. @end table
  14126. Default is @code{log}.
  14127. @item fscale
  14128. Set frequency scale.
  14129. It accepts the following values:
  14130. @table @samp
  14131. @item lin
  14132. Linear scale.
  14133. @item log
  14134. Logarithmic scale.
  14135. @item rlog
  14136. Reverse logarithmic scale.
  14137. @end table
  14138. Default is @code{lin}.
  14139. @item win_size
  14140. Set window size.
  14141. It accepts the following values:
  14142. @table @samp
  14143. @item w16
  14144. @item w32
  14145. @item w64
  14146. @item w128
  14147. @item w256
  14148. @item w512
  14149. @item w1024
  14150. @item w2048
  14151. @item w4096
  14152. @item w8192
  14153. @item w16384
  14154. @item w32768
  14155. @item w65536
  14156. @end table
  14157. Default is @code{w2048}
  14158. @item win_func
  14159. Set windowing function.
  14160. It accepts the following values:
  14161. @table @samp
  14162. @item rect
  14163. @item bartlett
  14164. @item hanning
  14165. @item hamming
  14166. @item blackman
  14167. @item welch
  14168. @item flattop
  14169. @item bharris
  14170. @item bnuttall
  14171. @item bhann
  14172. @item sine
  14173. @item nuttall
  14174. @item lanczos
  14175. @item gauss
  14176. @item tukey
  14177. @item dolph
  14178. @item cauchy
  14179. @item parzen
  14180. @item poisson
  14181. @end table
  14182. Default is @code{hanning}.
  14183. @item overlap
  14184. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14185. which means optimal overlap for selected window function will be picked.
  14186. @item averaging
  14187. Set time averaging. Setting this to 0 will display current maximal peaks.
  14188. Default is @code{1}, which means time averaging is disabled.
  14189. @item colors
  14190. Specify list of colors separated by space or by '|' which will be used to
  14191. draw channel frequencies. Unrecognized or missing colors will be replaced
  14192. by white color.
  14193. @item cmode
  14194. Set channel display mode.
  14195. It accepts the following values:
  14196. @table @samp
  14197. @item combined
  14198. @item separate
  14199. @end table
  14200. Default is @code{combined}.
  14201. @item minamp
  14202. Set minimum amplitude used in @code{log} amplitude scaler.
  14203. @end table
  14204. @anchor{showspectrum}
  14205. @section showspectrum
  14206. Convert input audio to a video output, representing the audio frequency
  14207. spectrum.
  14208. The filter accepts the following options:
  14209. @table @option
  14210. @item size, s
  14211. Specify the video size for the output. For the syntax of this option, check the
  14212. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14213. Default value is @code{640x512}.
  14214. @item slide
  14215. Specify how the spectrum should slide along the window.
  14216. It accepts the following values:
  14217. @table @samp
  14218. @item replace
  14219. the samples start again on the left when they reach the right
  14220. @item scroll
  14221. the samples scroll from right to left
  14222. @item fullframe
  14223. frames are only produced when the samples reach the right
  14224. @item rscroll
  14225. the samples scroll from left to right
  14226. @end table
  14227. Default value is @code{replace}.
  14228. @item mode
  14229. Specify display mode.
  14230. It accepts the following values:
  14231. @table @samp
  14232. @item combined
  14233. all channels are displayed in the same row
  14234. @item separate
  14235. all channels are displayed in separate rows
  14236. @end table
  14237. Default value is @samp{combined}.
  14238. @item color
  14239. Specify display color mode.
  14240. It accepts the following values:
  14241. @table @samp
  14242. @item channel
  14243. each channel is displayed in a separate color
  14244. @item intensity
  14245. each channel is displayed using the same color scheme
  14246. @item rainbow
  14247. each channel is displayed using the rainbow color scheme
  14248. @item moreland
  14249. each channel is displayed using the moreland color scheme
  14250. @item nebulae
  14251. each channel is displayed using the nebulae color scheme
  14252. @item fire
  14253. each channel is displayed using the fire color scheme
  14254. @item fiery
  14255. each channel is displayed using the fiery color scheme
  14256. @item fruit
  14257. each channel is displayed using the fruit color scheme
  14258. @item cool
  14259. each channel is displayed using the cool color scheme
  14260. @end table
  14261. Default value is @samp{channel}.
  14262. @item scale
  14263. Specify scale used for calculating intensity color values.
  14264. It accepts the following values:
  14265. @table @samp
  14266. @item lin
  14267. linear
  14268. @item sqrt
  14269. square root, default
  14270. @item cbrt
  14271. cubic root
  14272. @item log
  14273. logarithmic
  14274. @item 4thrt
  14275. 4th root
  14276. @item 5thrt
  14277. 5th root
  14278. @end table
  14279. Default value is @samp{sqrt}.
  14280. @item saturation
  14281. Set saturation modifier for displayed colors. Negative values provide
  14282. alternative color scheme. @code{0} is no saturation at all.
  14283. Saturation must be in [-10.0, 10.0] range.
  14284. Default value is @code{1}.
  14285. @item win_func
  14286. Set window function.
  14287. It accepts the following values:
  14288. @table @samp
  14289. @item rect
  14290. @item bartlett
  14291. @item hann
  14292. @item hanning
  14293. @item hamming
  14294. @item blackman
  14295. @item welch
  14296. @item flattop
  14297. @item bharris
  14298. @item bnuttall
  14299. @item bhann
  14300. @item sine
  14301. @item nuttall
  14302. @item lanczos
  14303. @item gauss
  14304. @item tukey
  14305. @item dolph
  14306. @item cauchy
  14307. @item parzen
  14308. @item poisson
  14309. @end table
  14310. Default value is @code{hann}.
  14311. @item orientation
  14312. Set orientation of time vs frequency axis. Can be @code{vertical} or
  14313. @code{horizontal}. Default is @code{vertical}.
  14314. @item overlap
  14315. Set ratio of overlap window. Default value is @code{0}.
  14316. When value is @code{1} overlap is set to recommended size for specific
  14317. window function currently used.
  14318. @item gain
  14319. Set scale gain for calculating intensity color values.
  14320. Default value is @code{1}.
  14321. @item data
  14322. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  14323. @item rotation
  14324. Set color rotation, must be in [-1.0, 1.0] range.
  14325. Default value is @code{0}.
  14326. @end table
  14327. The usage is very similar to the showwaves filter; see the examples in that
  14328. section.
  14329. @subsection Examples
  14330. @itemize
  14331. @item
  14332. Large window with logarithmic color scaling:
  14333. @example
  14334. showspectrum=s=1280x480:scale=log
  14335. @end example
  14336. @item
  14337. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  14338. @example
  14339. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  14340. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  14341. @end example
  14342. @end itemize
  14343. @section showspectrumpic
  14344. Convert input audio to a single video frame, representing the audio frequency
  14345. spectrum.
  14346. The filter accepts the following options:
  14347. @table @option
  14348. @item size, s
  14349. Specify the video size for the output. For the syntax of this option, check the
  14350. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14351. Default value is @code{4096x2048}.
  14352. @item mode
  14353. Specify display mode.
  14354. It accepts the following values:
  14355. @table @samp
  14356. @item combined
  14357. all channels are displayed in the same row
  14358. @item separate
  14359. all channels are displayed in separate rows
  14360. @end table
  14361. Default value is @samp{combined}.
  14362. @item color
  14363. Specify display color mode.
  14364. It accepts the following values:
  14365. @table @samp
  14366. @item channel
  14367. each channel is displayed in a separate color
  14368. @item intensity
  14369. each channel is displayed using the same color scheme
  14370. @item rainbow
  14371. each channel is displayed using the rainbow color scheme
  14372. @item moreland
  14373. each channel is displayed using the moreland color scheme
  14374. @item nebulae
  14375. each channel is displayed using the nebulae color scheme
  14376. @item fire
  14377. each channel is displayed using the fire color scheme
  14378. @item fiery
  14379. each channel is displayed using the fiery color scheme
  14380. @item fruit
  14381. each channel is displayed using the fruit color scheme
  14382. @item cool
  14383. each channel is displayed using the cool color scheme
  14384. @end table
  14385. Default value is @samp{intensity}.
  14386. @item scale
  14387. Specify scale used for calculating intensity color values.
  14388. It accepts the following values:
  14389. @table @samp
  14390. @item lin
  14391. linear
  14392. @item sqrt
  14393. square root, default
  14394. @item cbrt
  14395. cubic root
  14396. @item log
  14397. logarithmic
  14398. @item 4thrt
  14399. 4th root
  14400. @item 5thrt
  14401. 5th root
  14402. @end table
  14403. Default value is @samp{log}.
  14404. @item saturation
  14405. Set saturation modifier for displayed colors. Negative values provide
  14406. alternative color scheme. @code{0} is no saturation at all.
  14407. Saturation must be in [-10.0, 10.0] range.
  14408. Default value is @code{1}.
  14409. @item win_func
  14410. Set window function.
  14411. It accepts the following values:
  14412. @table @samp
  14413. @item rect
  14414. @item bartlett
  14415. @item hann
  14416. @item hanning
  14417. @item hamming
  14418. @item blackman
  14419. @item welch
  14420. @item flattop
  14421. @item bharris
  14422. @item bnuttall
  14423. @item bhann
  14424. @item sine
  14425. @item nuttall
  14426. @item lanczos
  14427. @item gauss
  14428. @item tukey
  14429. @item dolph
  14430. @item cauchy
  14431. @item parzen
  14432. @item poisson
  14433. @end table
  14434. Default value is @code{hann}.
  14435. @item orientation
  14436. Set orientation of time vs frequency axis. Can be @code{vertical} or
  14437. @code{horizontal}. Default is @code{vertical}.
  14438. @item gain
  14439. Set scale gain for calculating intensity color values.
  14440. Default value is @code{1}.
  14441. @item legend
  14442. Draw time and frequency axes and legends. Default is enabled.
  14443. @item rotation
  14444. Set color rotation, must be in [-1.0, 1.0] range.
  14445. Default value is @code{0}.
  14446. @end table
  14447. @subsection Examples
  14448. @itemize
  14449. @item
  14450. Extract an audio spectrogram of a whole audio track
  14451. in a 1024x1024 picture using @command{ffmpeg}:
  14452. @example
  14453. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  14454. @end example
  14455. @end itemize
  14456. @section showvolume
  14457. Convert input audio volume to a video output.
  14458. The filter accepts the following options:
  14459. @table @option
  14460. @item rate, r
  14461. Set video rate.
  14462. @item b
  14463. Set border width, allowed range is [0, 5]. Default is 1.
  14464. @item w
  14465. Set channel width, allowed range is [80, 8192]. Default is 400.
  14466. @item h
  14467. Set channel height, allowed range is [1, 900]. Default is 20.
  14468. @item f
  14469. Set fade, allowed range is [0.001, 1]. Default is 0.95.
  14470. @item c
  14471. Set volume color expression.
  14472. The expression can use the following variables:
  14473. @table @option
  14474. @item VOLUME
  14475. Current max volume of channel in dB.
  14476. @item PEAK
  14477. Current peak.
  14478. @item CHANNEL
  14479. Current channel number, starting from 0.
  14480. @end table
  14481. @item t
  14482. If set, displays channel names. Default is enabled.
  14483. @item v
  14484. If set, displays volume values. Default is enabled.
  14485. @item o
  14486. Set orientation, can be @code{horizontal} or @code{vertical},
  14487. default is @code{horizontal}.
  14488. @item s
  14489. Set step size, allowed range s [0, 5]. Default is 0, which means
  14490. step is disabled.
  14491. @end table
  14492. @section showwaves
  14493. Convert input audio to a video output, representing the samples waves.
  14494. The filter accepts the following options:
  14495. @table @option
  14496. @item size, s
  14497. Specify the video size for the output. For the syntax of this option, check the
  14498. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14499. Default value is @code{600x240}.
  14500. @item mode
  14501. Set display mode.
  14502. Available values are:
  14503. @table @samp
  14504. @item point
  14505. Draw a point for each sample.
  14506. @item line
  14507. Draw a vertical line for each sample.
  14508. @item p2p
  14509. Draw a point for each sample and a line between them.
  14510. @item cline
  14511. Draw a centered vertical line for each sample.
  14512. @end table
  14513. Default value is @code{point}.
  14514. @item n
  14515. Set the number of samples which are printed on the same column. A
  14516. larger value will decrease the frame rate. Must be a positive
  14517. integer. This option can be set only if the value for @var{rate}
  14518. is not explicitly specified.
  14519. @item rate, r
  14520. Set the (approximate) output frame rate. This is done by setting the
  14521. option @var{n}. Default value is "25".
  14522. @item split_channels
  14523. Set if channels should be drawn separately or overlap. Default value is 0.
  14524. @item colors
  14525. Set colors separated by '|' which are going to be used for drawing of each channel.
  14526. @item scale
  14527. Set amplitude scale.
  14528. Available values are:
  14529. @table @samp
  14530. @item lin
  14531. Linear.
  14532. @item log
  14533. Logarithmic.
  14534. @item sqrt
  14535. Square root.
  14536. @item cbrt
  14537. Cubic root.
  14538. @end table
  14539. Default is linear.
  14540. @end table
  14541. @subsection Examples
  14542. @itemize
  14543. @item
  14544. Output the input file audio and the corresponding video representation
  14545. at the same time:
  14546. @example
  14547. amovie=a.mp3,asplit[out0],showwaves[out1]
  14548. @end example
  14549. @item
  14550. Create a synthetic signal and show it with showwaves, forcing a
  14551. frame rate of 30 frames per second:
  14552. @example
  14553. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  14554. @end example
  14555. @end itemize
  14556. @section showwavespic
  14557. Convert input audio to a single video frame, representing the samples waves.
  14558. The filter accepts the following options:
  14559. @table @option
  14560. @item size, s
  14561. Specify the video size for the output. For the syntax of this option, check the
  14562. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14563. Default value is @code{600x240}.
  14564. @item split_channels
  14565. Set if channels should be drawn separately or overlap. Default value is 0.
  14566. @item colors
  14567. Set colors separated by '|' which are going to be used for drawing of each channel.
  14568. @item scale
  14569. Set amplitude scale.
  14570. Available values are:
  14571. @table @samp
  14572. @item lin
  14573. Linear.
  14574. @item log
  14575. Logarithmic.
  14576. @item sqrt
  14577. Square root.
  14578. @item cbrt
  14579. Cubic root.
  14580. @end table
  14581. Default is linear.
  14582. @end table
  14583. @subsection Examples
  14584. @itemize
  14585. @item
  14586. Extract a channel split representation of the wave form of a whole audio track
  14587. in a 1024x800 picture using @command{ffmpeg}:
  14588. @example
  14589. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  14590. @end example
  14591. @end itemize
  14592. @section sidedata, asidedata
  14593. Delete frame side data, or select frames based on it.
  14594. This filter accepts the following options:
  14595. @table @option
  14596. @item mode
  14597. Set mode of operation of the filter.
  14598. Can be one of the following:
  14599. @table @samp
  14600. @item select
  14601. Select every frame with side data of @code{type}.
  14602. @item delete
  14603. Delete side data of @code{type}. If @code{type} is not set, delete all side
  14604. data in the frame.
  14605. @end table
  14606. @item type
  14607. Set side data type used with all modes. Must be set for @code{select} mode. For
  14608. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  14609. in @file{libavutil/frame.h}. For example, to choose
  14610. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  14611. @end table
  14612. @section spectrumsynth
  14613. Sythesize audio from 2 input video spectrums, first input stream represents
  14614. magnitude across time and second represents phase across time.
  14615. The filter will transform from frequency domain as displayed in videos back
  14616. to time domain as presented in audio output.
  14617. This filter is primarily created for reversing processed @ref{showspectrum}
  14618. filter outputs, but can synthesize sound from other spectrograms too.
  14619. But in such case results are going to be poor if the phase data is not
  14620. available, because in such cases phase data need to be recreated, usually
  14621. its just recreated from random noise.
  14622. For best results use gray only output (@code{channel} color mode in
  14623. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  14624. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  14625. @code{data} option. Inputs videos should generally use @code{fullframe}
  14626. slide mode as that saves resources needed for decoding video.
  14627. The filter accepts the following options:
  14628. @table @option
  14629. @item sample_rate
  14630. Specify sample rate of output audio, the sample rate of audio from which
  14631. spectrum was generated may differ.
  14632. @item channels
  14633. Set number of channels represented in input video spectrums.
  14634. @item scale
  14635. Set scale which was used when generating magnitude input spectrum.
  14636. Can be @code{lin} or @code{log}. Default is @code{log}.
  14637. @item slide
  14638. Set slide which was used when generating inputs spectrums.
  14639. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  14640. Default is @code{fullframe}.
  14641. @item win_func
  14642. Set window function used for resynthesis.
  14643. @item overlap
  14644. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  14645. which means optimal overlap for selected window function will be picked.
  14646. @item orientation
  14647. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  14648. Default is @code{vertical}.
  14649. @end table
  14650. @subsection Examples
  14651. @itemize
  14652. @item
  14653. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  14654. then resynthesize videos back to audio with spectrumsynth:
  14655. @example
  14656. 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
  14657. 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
  14658. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  14659. @end example
  14660. @end itemize
  14661. @section split, asplit
  14662. Split input into several identical outputs.
  14663. @code{asplit} works with audio input, @code{split} with video.
  14664. The filter accepts a single parameter which specifies the number of outputs. If
  14665. unspecified, it defaults to 2.
  14666. @subsection Examples
  14667. @itemize
  14668. @item
  14669. Create two separate outputs from the same input:
  14670. @example
  14671. [in] split [out0][out1]
  14672. @end example
  14673. @item
  14674. To create 3 or more outputs, you need to specify the number of
  14675. outputs, like in:
  14676. @example
  14677. [in] asplit=3 [out0][out1][out2]
  14678. @end example
  14679. @item
  14680. Create two separate outputs from the same input, one cropped and
  14681. one padded:
  14682. @example
  14683. [in] split [splitout1][splitout2];
  14684. [splitout1] crop=100:100:0:0 [cropout];
  14685. [splitout2] pad=200:200:100:100 [padout];
  14686. @end example
  14687. @item
  14688. Create 5 copies of the input audio with @command{ffmpeg}:
  14689. @example
  14690. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  14691. @end example
  14692. @end itemize
  14693. @section zmq, azmq
  14694. Receive commands sent through a libzmq client, and forward them to
  14695. filters in the filtergraph.
  14696. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  14697. must be inserted between two video filters, @code{azmq} between two
  14698. audio filters.
  14699. To enable these filters you need to install the libzmq library and
  14700. headers and configure FFmpeg with @code{--enable-libzmq}.
  14701. For more information about libzmq see:
  14702. @url{http://www.zeromq.org/}
  14703. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  14704. receives messages sent through a network interface defined by the
  14705. @option{bind_address} option.
  14706. The received message must be in the form:
  14707. @example
  14708. @var{TARGET} @var{COMMAND} [@var{ARG}]
  14709. @end example
  14710. @var{TARGET} specifies the target of the command, usually the name of
  14711. the filter class or a specific filter instance name.
  14712. @var{COMMAND} specifies the name of the command for the target filter.
  14713. @var{ARG} is optional and specifies the optional argument list for the
  14714. given @var{COMMAND}.
  14715. Upon reception, the message is processed and the corresponding command
  14716. is injected into the filtergraph. Depending on the result, the filter
  14717. will send a reply to the client, adopting the format:
  14718. @example
  14719. @var{ERROR_CODE} @var{ERROR_REASON}
  14720. @var{MESSAGE}
  14721. @end example
  14722. @var{MESSAGE} is optional.
  14723. @subsection Examples
  14724. Look at @file{tools/zmqsend} for an example of a zmq client which can
  14725. be used to send commands processed by these filters.
  14726. Consider the following filtergraph generated by @command{ffplay}
  14727. @example
  14728. ffplay -dumpgraph 1 -f lavfi "
  14729. color=s=100x100:c=red [l];
  14730. color=s=100x100:c=blue [r];
  14731. nullsrc=s=200x100, zmq [bg];
  14732. [bg][l] overlay [bg+l];
  14733. [bg+l][r] overlay=x=100 "
  14734. @end example
  14735. To change the color of the left side of the video, the following
  14736. command can be used:
  14737. @example
  14738. echo Parsed_color_0 c yellow | tools/zmqsend
  14739. @end example
  14740. To change the right side:
  14741. @example
  14742. echo Parsed_color_1 c pink | tools/zmqsend
  14743. @end example
  14744. @c man end MULTIMEDIA FILTERS
  14745. @chapter Multimedia Sources
  14746. @c man begin MULTIMEDIA SOURCES
  14747. Below is a description of the currently available multimedia sources.
  14748. @section amovie
  14749. This is the same as @ref{movie} source, except it selects an audio
  14750. stream by default.
  14751. @anchor{movie}
  14752. @section movie
  14753. Read audio and/or video stream(s) from a movie container.
  14754. It accepts the following parameters:
  14755. @table @option
  14756. @item filename
  14757. The name of the resource to read (not necessarily a file; it can also be a
  14758. device or a stream accessed through some protocol).
  14759. @item format_name, f
  14760. Specifies the format assumed for the movie to read, and can be either
  14761. the name of a container or an input device. If not specified, the
  14762. format is guessed from @var{movie_name} or by probing.
  14763. @item seek_point, sp
  14764. Specifies the seek point in seconds. The frames will be output
  14765. starting from this seek point. The parameter is evaluated with
  14766. @code{av_strtod}, so the numerical value may be suffixed by an IS
  14767. postfix. The default value is "0".
  14768. @item streams, s
  14769. Specifies the streams to read. Several streams can be specified,
  14770. separated by "+". The source will then have as many outputs, in the
  14771. same order. The syntax is explained in the ``Stream specifiers''
  14772. section in the ffmpeg manual. Two special names, "dv" and "da" specify
  14773. respectively the default (best suited) video and audio stream. Default
  14774. is "dv", or "da" if the filter is called as "amovie".
  14775. @item stream_index, si
  14776. Specifies the index of the video stream to read. If the value is -1,
  14777. the most suitable video stream will be automatically selected. The default
  14778. value is "-1". Deprecated. If the filter is called "amovie", it will select
  14779. audio instead of video.
  14780. @item loop
  14781. Specifies how many times to read the stream in sequence.
  14782. If the value is 0, the stream will be looped infinitely.
  14783. Default value is "1".
  14784. Note that when the movie is looped the source timestamps are not
  14785. changed, so it will generate non monotonically increasing timestamps.
  14786. @item discontinuity
  14787. Specifies the time difference between frames above which the point is
  14788. considered a timestamp discontinuity which is removed by adjusting the later
  14789. timestamps.
  14790. @end table
  14791. It allows overlaying a second video on top of the main input of
  14792. a filtergraph, as shown in this graph:
  14793. @example
  14794. input -----------> deltapts0 --> overlay --> output
  14795. ^
  14796. |
  14797. movie --> scale--> deltapts1 -------+
  14798. @end example
  14799. @subsection Examples
  14800. @itemize
  14801. @item
  14802. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  14803. on top of the input labelled "in":
  14804. @example
  14805. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  14806. [in] setpts=PTS-STARTPTS [main];
  14807. [main][over] overlay=16:16 [out]
  14808. @end example
  14809. @item
  14810. Read from a video4linux2 device, and overlay it on top of the input
  14811. labelled "in":
  14812. @example
  14813. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  14814. [in] setpts=PTS-STARTPTS [main];
  14815. [main][over] overlay=16:16 [out]
  14816. @end example
  14817. @item
  14818. Read the first video stream and the audio stream with id 0x81 from
  14819. dvd.vob; the video is connected to the pad named "video" and the audio is
  14820. connected to the pad named "audio":
  14821. @example
  14822. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  14823. @end example
  14824. @end itemize
  14825. @subsection Commands
  14826. Both movie and amovie support the following commands:
  14827. @table @option
  14828. @item seek
  14829. Perform seek using "av_seek_frame".
  14830. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  14831. @itemize
  14832. @item
  14833. @var{stream_index}: If stream_index is -1, a default
  14834. stream is selected, and @var{timestamp} is automatically converted
  14835. from AV_TIME_BASE units to the stream specific time_base.
  14836. @item
  14837. @var{timestamp}: Timestamp in AVStream.time_base units
  14838. or, if no stream is specified, in AV_TIME_BASE units.
  14839. @item
  14840. @var{flags}: Flags which select direction and seeking mode.
  14841. @end itemize
  14842. @item get_duration
  14843. Get movie duration in AV_TIME_BASE units.
  14844. @end table
  14845. @c man end MULTIMEDIA SOURCES