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.

20589 lines
546KB

  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. @anchor{filtergraph escaping}
  181. @section Notes on filtergraph escaping
  182. Filtergraph description composition entails several levels of
  183. escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
  184. section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
  185. information about the employed escaping procedure.
  186. A first level escaping affects the content of each filter option
  187. value, which may contain the special character @code{:} used to
  188. separate values, or one of the escaping characters @code{\'}.
  189. A second level escaping affects the whole filter description, which
  190. may contain the escaping characters @code{\'} or the special
  191. characters @code{[],;} used by the filtergraph description.
  192. Finally, when you specify a filtergraph on a shell commandline, you
  193. need to perform a third level escaping for the shell special
  194. characters contained within it.
  195. For example, consider the following string to be embedded in
  196. the @ref{drawtext} filter description @option{text} value:
  197. @example
  198. this is a 'string': may contain one, or more, special characters
  199. @end example
  200. This string contains the @code{'} special escaping character, and the
  201. @code{:} special character, so it needs to be escaped in this way:
  202. @example
  203. text=this is a \'string\'\: may contain one, or more, special characters
  204. @end example
  205. A second level of escaping is required when embedding the filter
  206. description in a filtergraph description, in order to escape all the
  207. filtergraph special characters. Thus the example above becomes:
  208. @example
  209. drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
  210. @end example
  211. (note that in addition to the @code{\'} escaping special characters,
  212. also @code{,} needs to be escaped).
  213. Finally an additional level of escaping is needed when writing the
  214. filtergraph description in a shell command, which depends on the
  215. escaping rules of the adopted shell. For example, assuming that
  216. @code{\} is special and needs to be escaped with another @code{\}, the
  217. previous string will finally result in:
  218. @example
  219. -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
  220. @end example
  221. @chapter Timeline editing
  222. Some filters support a generic @option{enable} option. For the filters
  223. supporting timeline editing, this option can be set to an expression which is
  224. evaluated before sending a frame to the filter. If the evaluation is non-zero,
  225. the filter will be enabled, otherwise the frame will be sent unchanged to the
  226. next filter in the filtergraph.
  227. The expression accepts the following values:
  228. @table @samp
  229. @item t
  230. timestamp expressed in seconds, NAN if the input timestamp is unknown
  231. @item n
  232. sequential number of the input frame, starting from 0
  233. @item pos
  234. the position in the file of the input frame, NAN if unknown
  235. @item w
  236. @item h
  237. width and height of the input frame if video
  238. @end table
  239. Additionally, these filters support an @option{enable} command that can be used
  240. to re-define the expression.
  241. Like any other filtering option, the @option{enable} option follows the same
  242. rules.
  243. For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
  244. minutes, and a @ref{curves} filter starting at 3 seconds:
  245. @example
  246. smartblur = enable='between(t,10,3*60)',
  247. curves = enable='gte(t,3)' : preset=cross_process
  248. @end example
  249. See @code{ffmpeg -filters} to view which filters have timeline support.
  250. @c man end FILTERGRAPH DESCRIPTION
  251. @anchor{framesync}
  252. @chapter Options for filters with several inputs (framesync)
  253. @c man begin OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  254. Some filters with several inputs support a common set of options.
  255. These options can only be set by name, not with the short notation.
  256. @table @option
  257. @item eof_action
  258. The action to take when EOF is encountered on the secondary input; it accepts
  259. one of the following values:
  260. @table @option
  261. @item repeat
  262. Repeat the last frame (the default).
  263. @item endall
  264. End both streams.
  265. @item pass
  266. Pass the main input through.
  267. @end table
  268. @item shortest
  269. If set to 1, force the output to terminate when the shortest input
  270. terminates. Default value is 0.
  271. @item repeatlast
  272. If set to 1, force the filter to extend the last frame of secondary streams
  273. until the end of the primary stream. A value of 0 disables this behavior.
  274. Default value is 1.
  275. @end table
  276. @c man end OPTIONS FOR FILTERS WITH SEVERAL INPUTS
  277. @chapter Audio Filters
  278. @c man begin AUDIO FILTERS
  279. When you configure your FFmpeg build, you can disable any of the
  280. existing filters using @code{--disable-filters}.
  281. The configure output will show the audio filters included in your
  282. build.
  283. Below is a description of the currently available audio filters.
  284. @section acompressor
  285. A compressor is mainly used to reduce the dynamic range of a signal.
  286. Especially modern music is mostly compressed at a high ratio to
  287. improve the overall loudness. It's done to get the highest attention
  288. of a listener, "fatten" the sound and bring more "power" to the track.
  289. If a signal is compressed too much it may sound dull or "dead"
  290. afterwards or it may start to "pump" (which could be a powerful effect
  291. but can also destroy a track completely).
  292. The right compression is the key to reach a professional sound and is
  293. the high art of mixing and mastering. Because of its complex settings
  294. it may take a long time to get the right feeling for this kind of effect.
  295. Compression is done by detecting the volume above a chosen level
  296. @code{threshold} and dividing it by the factor set with @code{ratio}.
  297. So if you set the threshold to -12dB and your signal reaches -6dB a ratio
  298. of 2:1 will result in a signal at -9dB. Because an exact manipulation of
  299. the signal would cause distortion of the waveform the reduction can be
  300. levelled over the time. This is done by setting "Attack" and "Release".
  301. @code{attack} determines how long the signal has to rise above the threshold
  302. before any reduction will occur and @code{release} sets the time the signal
  303. has to fall below the threshold to reduce the reduction again. Shorter signals
  304. than the chosen attack time will be left untouched.
  305. The overall reduction of the signal can be made up afterwards with the
  306. @code{makeup} setting. So compressing the peaks of a signal about 6dB and
  307. raising the makeup to this level results in a signal twice as loud than the
  308. source. To gain a softer entry in the compression the @code{knee} flattens the
  309. hard edge at the threshold in the range of the chosen decibels.
  310. The filter accepts the following options:
  311. @table @option
  312. @item level_in
  313. Set input gain. Default is 1. Range is between 0.015625 and 64.
  314. @item threshold
  315. If a signal of stream rises above this level it will affect the gain
  316. reduction.
  317. By default it is 0.125. Range is between 0.00097563 and 1.
  318. @item ratio
  319. Set a ratio by which the signal is reduced. 1:2 means that if the level
  320. rose 4dB above the threshold, it will be only 2dB above after the reduction.
  321. Default is 2. Range is between 1 and 20.
  322. @item attack
  323. Amount of milliseconds the signal has to rise above the threshold before gain
  324. reduction starts. Default is 20. Range is between 0.01 and 2000.
  325. @item release
  326. Amount of milliseconds the signal has to fall below the threshold before
  327. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  328. @item makeup
  329. Set the amount by how much signal will be amplified after processing.
  330. Default is 1. Range is from 1 to 64.
  331. @item knee
  332. Curve the sharp knee around the threshold to enter gain reduction more softly.
  333. Default is 2.82843. Range is between 1 and 8.
  334. @item link
  335. Choose if the @code{average} level between all channels of input stream
  336. or the louder(@code{maximum}) channel of input stream affects the
  337. reduction. Default is @code{average}.
  338. @item detection
  339. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  340. of @code{rms}. Default is @code{rms} which is mostly smoother.
  341. @item mix
  342. How much to use compressed signal in output. Default is 1.
  343. Range is between 0 and 1.
  344. @end table
  345. @section acontrast
  346. Simple audio dynamic range commpression/expansion filter.
  347. The filter accepts the following options:
  348. @table @option
  349. @item contrast
  350. Set contrast. Default is 33. Allowed range is between 0 and 100.
  351. @end table
  352. @section acopy
  353. Copy the input audio source unchanged to the output. This is mainly useful for
  354. testing purposes.
  355. @section acrossfade
  356. Apply cross fade from one input audio stream to another input audio stream.
  357. The cross fade is applied for specified duration near the end of first stream.
  358. The filter accepts the following options:
  359. @table @option
  360. @item nb_samples, ns
  361. Specify the number of samples for which the cross fade effect has to last.
  362. At the end of the cross fade effect the first input audio will be completely
  363. silent. Default is 44100.
  364. @item duration, d
  365. Specify the duration of the cross fade effect. See
  366. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  367. for the accepted syntax.
  368. By default the duration is determined by @var{nb_samples}.
  369. If set this option is used instead of @var{nb_samples}.
  370. @item overlap, o
  371. Should first stream end overlap with second stream start. Default is enabled.
  372. @item curve1
  373. Set curve for cross fade transition for first stream.
  374. @item curve2
  375. Set curve for cross fade transition for second stream.
  376. For description of available curve types see @ref{afade} filter description.
  377. @end table
  378. @subsection Examples
  379. @itemize
  380. @item
  381. Cross fade from one input to another:
  382. @example
  383. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:c1=exp:c2=exp output.flac
  384. @end example
  385. @item
  386. Cross fade from one input to another but without overlapping:
  387. @example
  388. ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=10:o=0:c1=exp:c2=exp output.flac
  389. @end example
  390. @end itemize
  391. @section acrusher
  392. Reduce audio bit resolution.
  393. This filter is bit crusher with enhanced functionality. A bit crusher
  394. is used to audibly reduce number of bits an audio signal is sampled
  395. with. This doesn't change the bit depth at all, it just produces the
  396. effect. Material reduced in bit depth sounds more harsh and "digital".
  397. This filter is able to even round to continuous values instead of discrete
  398. bit depths.
  399. Additionally it has a D/C offset which results in different crushing of
  400. the lower and the upper half of the signal.
  401. An Anti-Aliasing setting is able to produce "softer" crushing sounds.
  402. Another feature of this filter is the logarithmic mode.
  403. This setting switches from linear distances between bits to logarithmic ones.
  404. The result is a much more "natural" sounding crusher which doesn't gate low
  405. signals for example. The human ear has a logarithmic perception,
  406. so this kind of crushing is much more pleasant.
  407. Logarithmic crushing is also able to get anti-aliased.
  408. The filter accepts the following options:
  409. @table @option
  410. @item level_in
  411. Set level in.
  412. @item level_out
  413. Set level out.
  414. @item bits
  415. Set bit reduction.
  416. @item mix
  417. Set mixing amount.
  418. @item mode
  419. Can be linear: @code{lin} or logarithmic: @code{log}.
  420. @item dc
  421. Set DC.
  422. @item aa
  423. Set anti-aliasing.
  424. @item samples
  425. Set sample reduction.
  426. @item lfo
  427. Enable LFO. By default disabled.
  428. @item lforange
  429. Set LFO range.
  430. @item lforate
  431. Set LFO rate.
  432. @end table
  433. @section adelay
  434. Delay one or more audio channels.
  435. Samples in delayed channel are filled with silence.
  436. The filter accepts the following option:
  437. @table @option
  438. @item delays
  439. Set list of delays in milliseconds for each channel separated by '|'.
  440. Unused delays will be silently ignored. If number of given delays is
  441. smaller than number of channels all remaining channels will not be delayed.
  442. If you want to delay exact number of samples, append 'S' to number.
  443. @end table
  444. @subsection Examples
  445. @itemize
  446. @item
  447. Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
  448. the second channel (and any other channels that may be present) unchanged.
  449. @example
  450. adelay=1500|0|500
  451. @end example
  452. @item
  453. Delay second channel by 500 samples, the third channel by 700 samples and leave
  454. the first channel (and any other channels that may be present) unchanged.
  455. @example
  456. adelay=0|500S|700S
  457. @end example
  458. @end itemize
  459. @section aecho
  460. Apply echoing to the input audio.
  461. Echoes are reflected sound and can occur naturally amongst mountains
  462. (and sometimes large buildings) when talking or shouting; digital echo
  463. effects emulate this behaviour and are often used to help fill out the
  464. sound of a single instrument or vocal. The time difference between the
  465. original signal and the reflection is the @code{delay}, and the
  466. loudness of the reflected signal is the @code{decay}.
  467. Multiple echoes can have different delays and decays.
  468. A description of the accepted parameters follows.
  469. @table @option
  470. @item in_gain
  471. Set input gain of reflected signal. Default is @code{0.6}.
  472. @item out_gain
  473. Set output gain of reflected signal. Default is @code{0.3}.
  474. @item delays
  475. Set list of time intervals in milliseconds between original signal and reflections
  476. separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
  477. Default is @code{1000}.
  478. @item decays
  479. Set list of loudness of reflected signals separated by '|'.
  480. Allowed range for each @code{decay} is @code{(0 - 1.0]}.
  481. Default is @code{0.5}.
  482. @end table
  483. @subsection Examples
  484. @itemize
  485. @item
  486. Make it sound as if there are twice as many instruments as are actually playing:
  487. @example
  488. aecho=0.8:0.88:60:0.4
  489. @end example
  490. @item
  491. If delay is very short, then it sound like a (metallic) robot playing music:
  492. @example
  493. aecho=0.8:0.88:6:0.4
  494. @end example
  495. @item
  496. A longer delay will sound like an open air concert in the mountains:
  497. @example
  498. aecho=0.8:0.9:1000:0.3
  499. @end example
  500. @item
  501. Same as above but with one more mountain:
  502. @example
  503. aecho=0.8:0.9:1000|1800:0.3|0.25
  504. @end example
  505. @end itemize
  506. @section aemphasis
  507. Audio emphasis filter creates or restores material directly taken from LPs or
  508. emphased CDs with different filter curves. E.g. to store music on vinyl the
  509. signal has to be altered by a filter first to even out the disadvantages of
  510. this recording medium.
  511. Once the material is played back the inverse filter has to be applied to
  512. restore the distortion of the frequency response.
  513. The filter accepts the following options:
  514. @table @option
  515. @item level_in
  516. Set input gain.
  517. @item level_out
  518. Set output gain.
  519. @item mode
  520. Set filter mode. For restoring material use @code{reproduction} mode, otherwise
  521. use @code{production} mode. Default is @code{reproduction} mode.
  522. @item type
  523. Set filter type. Selects medium. Can be one of the following:
  524. @table @option
  525. @item col
  526. select Columbia.
  527. @item emi
  528. select EMI.
  529. @item bsi
  530. select BSI (78RPM).
  531. @item riaa
  532. select RIAA.
  533. @item cd
  534. select Compact Disc (CD).
  535. @item 50fm
  536. select 50µs (FM).
  537. @item 75fm
  538. select 75µs (FM).
  539. @item 50kf
  540. select 50µs (FM-KF).
  541. @item 75kf
  542. select 75µs (FM-KF).
  543. @end table
  544. @end table
  545. @section aeval
  546. Modify an audio signal according to the specified expressions.
  547. This filter accepts one or more expressions (one for each channel),
  548. which are evaluated and used to modify a corresponding audio signal.
  549. It accepts the following parameters:
  550. @table @option
  551. @item exprs
  552. Set the '|'-separated expressions list for each separate channel. If
  553. the number of input channels is greater than the number of
  554. expressions, the last specified expression is used for the remaining
  555. output channels.
  556. @item channel_layout, c
  557. Set output channel layout. If not specified, the channel layout is
  558. specified by the number of expressions. If set to @samp{same}, it will
  559. use by default the same input channel layout.
  560. @end table
  561. Each expression in @var{exprs} can contain the following constants and functions:
  562. @table @option
  563. @item ch
  564. channel number of the current expression
  565. @item n
  566. number of the evaluated sample, starting from 0
  567. @item s
  568. sample rate
  569. @item t
  570. time of the evaluated sample expressed in seconds
  571. @item nb_in_channels
  572. @item nb_out_channels
  573. input and output number of channels
  574. @item val(CH)
  575. the value of input channel with number @var{CH}
  576. @end table
  577. Note: this filter is slow. For faster processing you should use a
  578. dedicated filter.
  579. @subsection Examples
  580. @itemize
  581. @item
  582. Half volume:
  583. @example
  584. aeval=val(ch)/2:c=same
  585. @end example
  586. @item
  587. Invert phase of the second channel:
  588. @example
  589. aeval=val(0)|-val(1)
  590. @end example
  591. @end itemize
  592. @anchor{afade}
  593. @section afade
  594. Apply fade-in/out effect to input audio.
  595. A description of the accepted parameters follows.
  596. @table @option
  597. @item type, t
  598. Specify the effect type, can be either @code{in} for fade-in, or
  599. @code{out} for a fade-out effect. Default is @code{in}.
  600. @item start_sample, ss
  601. Specify the number of the start sample for starting to apply the fade
  602. effect. Default is 0.
  603. @item nb_samples, ns
  604. Specify the number of samples for which the fade effect has to last. At
  605. the end of the fade-in effect the output audio will have the same
  606. volume as the input audio, at the end of the fade-out transition
  607. the output audio will be silence. Default is 44100.
  608. @item start_time, st
  609. Specify the start time of the fade effect. Default is 0.
  610. The value must be specified as a time duration; see
  611. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  612. for the accepted syntax.
  613. If set this option is used instead of @var{start_sample}.
  614. @item duration, d
  615. Specify the duration of the fade effect. See
  616. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  617. for the accepted syntax.
  618. At the end of the fade-in effect the output audio will have the same
  619. volume as the input audio, at the end of the fade-out transition
  620. the output audio will be silence.
  621. By default the duration is determined by @var{nb_samples}.
  622. If set this option is used instead of @var{nb_samples}.
  623. @item curve
  624. Set curve for fade transition.
  625. It accepts the following values:
  626. @table @option
  627. @item tri
  628. select triangular, linear slope (default)
  629. @item qsin
  630. select quarter of sine wave
  631. @item hsin
  632. select half of sine wave
  633. @item esin
  634. select exponential sine wave
  635. @item log
  636. select logarithmic
  637. @item ipar
  638. select inverted parabola
  639. @item qua
  640. select quadratic
  641. @item cub
  642. select cubic
  643. @item squ
  644. select square root
  645. @item cbr
  646. select cubic root
  647. @item par
  648. select parabola
  649. @item exp
  650. select exponential
  651. @item iqsin
  652. select inverted quarter of sine wave
  653. @item ihsin
  654. select inverted half of sine wave
  655. @item dese
  656. select double-exponential seat
  657. @item desi
  658. select double-exponential sigmoid
  659. @end table
  660. @end table
  661. @subsection Examples
  662. @itemize
  663. @item
  664. Fade in first 15 seconds of audio:
  665. @example
  666. afade=t=in:ss=0:d=15
  667. @end example
  668. @item
  669. Fade out last 25 seconds of a 900 seconds audio:
  670. @example
  671. afade=t=out:st=875:d=25
  672. @end example
  673. @end itemize
  674. @section afftfilt
  675. Apply arbitrary expressions to samples in frequency domain.
  676. @table @option
  677. @item real
  678. Set frequency domain real expression for each separate channel separated
  679. by '|'. Default is "1".
  680. If the number of input channels is greater than the number of
  681. expressions, the last specified expression is used for the remaining
  682. output channels.
  683. @item imag
  684. Set frequency domain imaginary expression for each separate channel
  685. separated by '|'. If not set, @var{real} option is used.
  686. Each expression in @var{real} and @var{imag} can contain the following
  687. constants:
  688. @table @option
  689. @item sr
  690. sample rate
  691. @item b
  692. current frequency bin number
  693. @item nb
  694. number of available bins
  695. @item ch
  696. channel number of the current expression
  697. @item chs
  698. number of channels
  699. @item pts
  700. current frame pts
  701. @end table
  702. @item win_size
  703. Set window size.
  704. It accepts the following values:
  705. @table @samp
  706. @item w16
  707. @item w32
  708. @item w64
  709. @item w128
  710. @item w256
  711. @item w512
  712. @item w1024
  713. @item w2048
  714. @item w4096
  715. @item w8192
  716. @item w16384
  717. @item w32768
  718. @item w65536
  719. @end table
  720. Default is @code{w4096}
  721. @item win_func
  722. Set window function. Default is @code{hann}.
  723. @item overlap
  724. Set window overlap. If set to 1, the recommended overlap for selected
  725. window function will be picked. Default is @code{0.75}.
  726. @end table
  727. @subsection Examples
  728. @itemize
  729. @item
  730. Leave almost only low frequencies in audio:
  731. @example
  732. afftfilt="1-clip((b/nb)*b,0,1)"
  733. @end example
  734. @end itemize
  735. @anchor{afir}
  736. @section afir
  737. Apply an arbitrary Frequency Impulse Response filter.
  738. This filter is designed for applying long FIR filters,
  739. up to 30 seconds long.
  740. It can be used as component for digital crossover filters,
  741. room equalization, cross talk cancellation, wavefield synthesis,
  742. auralization, ambiophonics and ambisonics.
  743. This filter uses second stream as FIR coefficients.
  744. If second stream holds single channel, it will be used
  745. for all input channels in first stream, otherwise
  746. number of channels in second stream must be same as
  747. number of channels in first stream.
  748. It accepts the following parameters:
  749. @table @option
  750. @item dry
  751. Set dry gain. This sets input gain.
  752. @item wet
  753. Set wet gain. This sets final output gain.
  754. @item length
  755. Set Impulse Response filter length. Default is 1, which means whole IR is processed.
  756. @item again
  757. Enable applying gain measured from power of IR.
  758. @item maxir
  759. Set max allowed Impulse Response filter duration in seconds. Default is 30 seconds.
  760. Allowed range is 0.1 to 60 seconds.
  761. @end table
  762. @subsection Examples
  763. @itemize
  764. @item
  765. Apply reverb to stream using mono IR file as second input, complete command using ffmpeg:
  766. @example
  767. ffmpeg -i input.wav -i middle_tunnel_1way_mono.wav -lavfi afir output.wav
  768. @end example
  769. @end itemize
  770. @anchor{aformat}
  771. @section aformat
  772. Set output format constraints for the input audio. The framework will
  773. negotiate the most appropriate format to minimize conversions.
  774. It accepts the following parameters:
  775. @table @option
  776. @item sample_fmts
  777. A '|'-separated list of requested sample formats.
  778. @item sample_rates
  779. A '|'-separated list of requested sample rates.
  780. @item channel_layouts
  781. A '|'-separated list of requested channel layouts.
  782. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  783. for the required syntax.
  784. @end table
  785. If a parameter is omitted, all values are allowed.
  786. Force the output to either unsigned 8-bit or signed 16-bit stereo
  787. @example
  788. aformat=sample_fmts=u8|s16:channel_layouts=stereo
  789. @end example
  790. @section agate
  791. A gate is mainly used to reduce lower parts of a signal. This kind of signal
  792. processing reduces disturbing noise between useful signals.
  793. Gating is done by detecting the volume below a chosen level @var{threshold}
  794. and dividing it by the factor set with @var{ratio}. The bottom of the noise
  795. floor is set via @var{range}. Because an exact manipulation of the signal
  796. would cause distortion of the waveform the reduction can be levelled over
  797. time. This is done by setting @var{attack} and @var{release}.
  798. @var{attack} determines how long the signal has to fall below the threshold
  799. before any reduction will occur and @var{release} sets the time the signal
  800. has to rise above the threshold to reduce the reduction again.
  801. Shorter signals than the chosen attack time will be left untouched.
  802. @table @option
  803. @item level_in
  804. Set input level before filtering.
  805. Default is 1. Allowed range is from 0.015625 to 64.
  806. @item range
  807. Set the level of gain reduction when the signal is below the threshold.
  808. Default is 0.06125. Allowed range is from 0 to 1.
  809. @item threshold
  810. If a signal rises above this level the gain reduction is released.
  811. Default is 0.125. Allowed range is from 0 to 1.
  812. @item ratio
  813. Set a ratio by which the signal is reduced.
  814. Default is 2. Allowed range is from 1 to 9000.
  815. @item attack
  816. Amount of milliseconds the signal has to rise above the threshold before gain
  817. reduction stops.
  818. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  819. @item release
  820. Amount of milliseconds the signal has to fall below the threshold before the
  821. reduction is increased again. Default is 250 milliseconds.
  822. Allowed range is from 0.01 to 9000.
  823. @item makeup
  824. Set amount of amplification of signal after processing.
  825. Default is 1. Allowed range is from 1 to 64.
  826. @item knee
  827. Curve the sharp knee around the threshold to enter gain reduction more softly.
  828. Default is 2.828427125. Allowed range is from 1 to 8.
  829. @item detection
  830. Choose if exact signal should be taken for detection or an RMS like one.
  831. Default is @code{rms}. Can be @code{peak} or @code{rms}.
  832. @item link
  833. Choose if the average level between all channels or the louder channel affects
  834. the reduction.
  835. Default is @code{average}. Can be @code{average} or @code{maximum}.
  836. @end table
  837. @section aiir
  838. Apply an arbitrary Infinite Impulse Response filter.
  839. It accepts the following parameters:
  840. @table @option
  841. @item z
  842. Set numerator/zeros coefficients.
  843. @item p
  844. Set denominator/poles coefficients.
  845. @item k
  846. Set channels gains.
  847. @item dry_gain
  848. Set input gain.
  849. @item wet_gain
  850. Set output gain.
  851. @item f
  852. Set coefficients format.
  853. @table @samp
  854. @item tf
  855. transfer function
  856. @item zp
  857. Z-plane zeros/poles, cartesian (default)
  858. @item pr
  859. Z-plane zeros/poles, polar radians
  860. @item pd
  861. Z-plane zeros/poles, polar degrees
  862. @end table
  863. @item r
  864. Set kind of processing.
  865. Can be @code{d} - direct or @code{s} - serial cascading. Defauls is @code{s}.
  866. @item e
  867. Set filtering precision.
  868. @table @samp
  869. @item dbl
  870. double-precision floating-point (default)
  871. @item flt
  872. single-precision floating-point
  873. @item i32
  874. 32-bit integers
  875. @item i16
  876. 16-bit integers
  877. @end table
  878. @end table
  879. Coefficients in @code{tf} format are separated by spaces and are in ascending
  880. order.
  881. Coefficients in @code{zp} format are separated by spaces and order of coefficients
  882. doesn't matter. Coefficients in @code{zp} format are complex numbers with @var{i}
  883. imaginary unit.
  884. Different coefficients and gains can be provided for every channel, in such case
  885. use '|' to separate coefficients or gains. Last provided coefficients will be
  886. used for all remaining channels.
  887. @subsection Examples
  888. @itemize
  889. @item
  890. Apply 2 pole elliptic notch at arround 5000Hz for 48000 Hz sample rate:
  891. @example
  892. aiir=k=1:z=7.957584807809675810E-1 -2.575128568908332300 3.674839853930788710 -2.57512875289799137 7.957586296317130880E-1:p=1 -2.86950072432325953 3.63022088054647218 -2.28075678147272232 6.361362326477423500E-1:f=tf:r=d
  893. @end example
  894. @item
  895. Same as above but in @code{zp} format:
  896. @example
  897. aiir=k=0.79575848078096756:z=0.80918701+0.58773007i 0.80918701-0.58773007i 0.80884700+0.58784055i 0.80884700-0.58784055i:p=0.63892345+0.59951235i 0.63892345-0.59951235i 0.79582691+0.44198673i 0.79582691-0.44198673i:f=zp:r=s
  898. @end example
  899. @end itemize
  900. @section alimiter
  901. The limiter prevents an input signal from rising over a desired threshold.
  902. This limiter uses lookahead technology to prevent your signal from distorting.
  903. It means that there is a small delay after the signal is processed. Keep in mind
  904. that the delay it produces is the attack time you set.
  905. The filter accepts the following options:
  906. @table @option
  907. @item level_in
  908. Set input gain. Default is 1.
  909. @item level_out
  910. Set output gain. Default is 1.
  911. @item limit
  912. Don't let signals above this level pass the limiter. Default is 1.
  913. @item attack
  914. The limiter will reach its attenuation level in this amount of time in
  915. milliseconds. Default is 5 milliseconds.
  916. @item release
  917. Come back from limiting to attenuation 1.0 in this amount of milliseconds.
  918. Default is 50 milliseconds.
  919. @item asc
  920. When gain reduction is always needed ASC takes care of releasing to an
  921. average reduction level rather than reaching a reduction of 0 in the release
  922. time.
  923. @item asc_level
  924. Select how much the release time is affected by ASC, 0 means nearly no changes
  925. in release time while 1 produces higher release times.
  926. @item level
  927. Auto level output signal. Default is enabled.
  928. This normalizes audio back to 0dB if enabled.
  929. @end table
  930. Depending on picked setting it is recommended to upsample input 2x or 4x times
  931. with @ref{aresample} before applying this filter.
  932. @section allpass
  933. Apply a two-pole all-pass filter with central frequency (in Hz)
  934. @var{frequency}, and filter-width @var{width}.
  935. An all-pass filter changes the audio's frequency to phase relationship
  936. without changing its frequency to amplitude relationship.
  937. The filter accepts the following options:
  938. @table @option
  939. @item frequency, f
  940. Set frequency in Hz.
  941. @item width_type, t
  942. Set method to specify band-width of filter.
  943. @table @option
  944. @item h
  945. Hz
  946. @item q
  947. Q-Factor
  948. @item o
  949. octave
  950. @item s
  951. slope
  952. @item k
  953. kHz
  954. @end table
  955. @item width, w
  956. Specify the band-width of a filter in width_type units.
  957. @item channels, c
  958. Specify which channels to filter, by default all available are filtered.
  959. @end table
  960. @subsection Commands
  961. This filter supports the following commands:
  962. @table @option
  963. @item frequency, f
  964. Change allpass frequency.
  965. Syntax for the command is : "@var{frequency}"
  966. @item width_type, t
  967. Change allpass width_type.
  968. Syntax for the command is : "@var{width_type}"
  969. @item width, w
  970. Change allpass width.
  971. Syntax for the command is : "@var{width}"
  972. @end table
  973. @section aloop
  974. Loop audio samples.
  975. The filter accepts the following options:
  976. @table @option
  977. @item loop
  978. Set the number of loops. Setting this value to -1 will result in infinite loops.
  979. Default is 0.
  980. @item size
  981. Set maximal number of samples. Default is 0.
  982. @item start
  983. Set first sample of loop. Default is 0.
  984. @end table
  985. @anchor{amerge}
  986. @section amerge
  987. Merge two or more audio streams into a single multi-channel stream.
  988. The filter accepts the following options:
  989. @table @option
  990. @item inputs
  991. Set the number of inputs. Default is 2.
  992. @end table
  993. If the channel layouts of the inputs are disjoint, and therefore compatible,
  994. the channel layout of the output will be set accordingly and the channels
  995. will be reordered as necessary. If the channel layouts of the inputs are not
  996. disjoint, the output will have all the channels of the first input then all
  997. the channels of the second input, in that order, and the channel layout of
  998. the output will be the default value corresponding to the total number of
  999. channels.
  1000. For example, if the first input is in 2.1 (FL+FR+LF) and the second input
  1001. is FC+BL+BR, then the output will be in 5.1, with the channels in the
  1002. following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
  1003. first input, b1 is the first channel of the second input).
  1004. On the other hand, if both input are in stereo, the output channels will be
  1005. in the default order: a1, a2, b1, b2, and the channel layout will be
  1006. arbitrarily set to 4.0, which may or may not be the expected value.
  1007. All inputs must have the same sample rate, and format.
  1008. If inputs do not have the same duration, the output will stop with the
  1009. shortest.
  1010. @subsection Examples
  1011. @itemize
  1012. @item
  1013. Merge two mono files into a stereo stream:
  1014. @example
  1015. amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
  1016. @end example
  1017. @item
  1018. Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
  1019. @example
  1020. 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
  1021. @end example
  1022. @end itemize
  1023. @section amix
  1024. Mixes multiple audio inputs into a single output.
  1025. Note that this filter only supports float samples (the @var{amerge}
  1026. and @var{pan} audio filters support many formats). If the @var{amix}
  1027. input has integer samples then @ref{aresample} will be automatically
  1028. inserted to perform the conversion to float samples.
  1029. For example
  1030. @example
  1031. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
  1032. @end example
  1033. will mix 3 input audio streams to a single output with the same duration as the
  1034. first input and a dropout transition time of 3 seconds.
  1035. It accepts the following parameters:
  1036. @table @option
  1037. @item inputs
  1038. The number of inputs. If unspecified, it defaults to 2.
  1039. @item duration
  1040. How to determine the end-of-stream.
  1041. @table @option
  1042. @item longest
  1043. The duration of the longest input. (default)
  1044. @item shortest
  1045. The duration of the shortest input.
  1046. @item first
  1047. The duration of the first input.
  1048. @end table
  1049. @item dropout_transition
  1050. The transition time, in seconds, for volume renormalization when an input
  1051. stream ends. The default value is 2 seconds.
  1052. @item weights
  1053. Specify weight of each input audio stream as sequence.
  1054. Each weight is separated by space. By default all inputs have same weight.
  1055. @end table
  1056. @section anequalizer
  1057. High-order parametric multiband equalizer for each channel.
  1058. It accepts the following parameters:
  1059. @table @option
  1060. @item params
  1061. This option string is in format:
  1062. "c@var{chn} f=@var{cf} w=@var{w} g=@var{g} t=@var{f} | ..."
  1063. Each equalizer band is separated by '|'.
  1064. @table @option
  1065. @item chn
  1066. Set channel number to which equalization will be applied.
  1067. If input doesn't have that channel the entry is ignored.
  1068. @item f
  1069. Set central frequency for band.
  1070. If input doesn't have that frequency the entry is ignored.
  1071. @item w
  1072. Set band width in hertz.
  1073. @item g
  1074. Set band gain in dB.
  1075. @item t
  1076. Set filter type for band, optional, can be:
  1077. @table @samp
  1078. @item 0
  1079. Butterworth, this is default.
  1080. @item 1
  1081. Chebyshev type 1.
  1082. @item 2
  1083. Chebyshev type 2.
  1084. @end table
  1085. @end table
  1086. @item curves
  1087. With this option activated frequency response of anequalizer is displayed
  1088. in video stream.
  1089. @item size
  1090. Set video stream size. Only useful if curves option is activated.
  1091. @item mgain
  1092. Set max gain that will be displayed. Only useful if curves option is activated.
  1093. Setting this to a reasonable value makes it possible to display gain which is derived from
  1094. neighbour bands which are too close to each other and thus produce higher gain
  1095. when both are activated.
  1096. @item fscale
  1097. Set frequency scale used to draw frequency response in video output.
  1098. Can be linear or logarithmic. Default is logarithmic.
  1099. @item colors
  1100. Set color for each channel curve which is going to be displayed in video stream.
  1101. This is list of color names separated by space or by '|'.
  1102. Unrecognised or missing colors will be replaced by white color.
  1103. @end table
  1104. @subsection Examples
  1105. @itemize
  1106. @item
  1107. Lower gain by 10 of central frequency 200Hz and width 100 Hz
  1108. for first 2 channels using Chebyshev type 1 filter:
  1109. @example
  1110. anequalizer=c0 f=200 w=100 g=-10 t=1|c1 f=200 w=100 g=-10 t=1
  1111. @end example
  1112. @end itemize
  1113. @subsection Commands
  1114. This filter supports the following commands:
  1115. @table @option
  1116. @item change
  1117. Alter existing filter parameters.
  1118. Syntax for the commands is : "@var{fN}|f=@var{freq}|w=@var{width}|g=@var{gain}"
  1119. @var{fN} is existing filter number, starting from 0, if no such filter is available
  1120. error is returned.
  1121. @var{freq} set new frequency parameter.
  1122. @var{width} set new width parameter in herz.
  1123. @var{gain} set new gain parameter in dB.
  1124. Full filter invocation with asendcmd may look like this:
  1125. asendcmd=c='4.0 anequalizer change 0|f=200|w=50|g=1',anequalizer=...
  1126. @end table
  1127. @section anull
  1128. Pass the audio source unchanged to the output.
  1129. @section apad
  1130. Pad the end of an audio stream with silence.
  1131. This can be used together with @command{ffmpeg} @option{-shortest} to
  1132. extend audio streams to the same length as the video stream.
  1133. A description of the accepted options follows.
  1134. @table @option
  1135. @item packet_size
  1136. Set silence packet size. Default value is 4096.
  1137. @item pad_len
  1138. Set the number of samples of silence to add to the end. After the
  1139. value is reached, the stream is terminated. This option is mutually
  1140. exclusive with @option{whole_len}.
  1141. @item whole_len
  1142. Set the minimum total number of samples in the output audio stream. If
  1143. the value is longer than the input audio length, silence is added to
  1144. the end, until the value is reached. This option is mutually exclusive
  1145. with @option{pad_len}.
  1146. @end table
  1147. If neither the @option{pad_len} nor the @option{whole_len} option is
  1148. set, the filter will add silence to the end of the input stream
  1149. indefinitely.
  1150. @subsection Examples
  1151. @itemize
  1152. @item
  1153. Add 1024 samples of silence to the end of the input:
  1154. @example
  1155. apad=pad_len=1024
  1156. @end example
  1157. @item
  1158. Make sure the audio output will contain at least 10000 samples, pad
  1159. the input with silence if required:
  1160. @example
  1161. apad=whole_len=10000
  1162. @end example
  1163. @item
  1164. Use @command{ffmpeg} to pad the audio input with silence, so that the
  1165. video stream will always result the shortest and will be converted
  1166. until the end in the output file when using the @option{shortest}
  1167. option:
  1168. @example
  1169. ffmpeg -i VIDEO -i AUDIO -filter_complex "[1:0]apad" -shortest OUTPUT
  1170. @end example
  1171. @end itemize
  1172. @section aphaser
  1173. Add a phasing effect to the input audio.
  1174. A phaser filter creates series of peaks and troughs in the frequency spectrum.
  1175. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
  1176. A description of the accepted parameters follows.
  1177. @table @option
  1178. @item in_gain
  1179. Set input gain. Default is 0.4.
  1180. @item out_gain
  1181. Set output gain. Default is 0.74
  1182. @item delay
  1183. Set delay in milliseconds. Default is 3.0.
  1184. @item decay
  1185. Set decay. Default is 0.4.
  1186. @item speed
  1187. Set modulation speed in Hz. Default is 0.5.
  1188. @item type
  1189. Set modulation type. Default is triangular.
  1190. It accepts the following values:
  1191. @table @samp
  1192. @item triangular, t
  1193. @item sinusoidal, s
  1194. @end table
  1195. @end table
  1196. @section apulsator
  1197. Audio pulsator is something between an autopanner and a tremolo.
  1198. But it can produce funny stereo effects as well. Pulsator changes the volume
  1199. of the left and right channel based on a LFO (low frequency oscillator) with
  1200. different waveforms and shifted phases.
  1201. This filter have the ability to define an offset between left and right
  1202. channel. An offset of 0 means that both LFO shapes match each other.
  1203. The left and right channel are altered equally - a conventional tremolo.
  1204. An offset of 50% means that the shape of the right channel is exactly shifted
  1205. in phase (or moved backwards about half of the frequency) - pulsator acts as
  1206. an autopanner. At 1 both curves match again. Every setting in between moves the
  1207. phase shift gapless between all stages and produces some "bypassing" sounds with
  1208. sine and triangle waveforms. The more you set the offset near 1 (starting from
  1209. the 0.5) the faster the signal passes from the left to the right speaker.
  1210. The filter accepts the following options:
  1211. @table @option
  1212. @item level_in
  1213. Set input gain. By default it is 1. Range is [0.015625 - 64].
  1214. @item level_out
  1215. Set output gain. By default it is 1. Range is [0.015625 - 64].
  1216. @item mode
  1217. Set waveform shape the LFO will use. Can be one of: sine, triangle, square,
  1218. sawup or sawdown. Default is sine.
  1219. @item amount
  1220. Set modulation. Define how much of original signal is affected by the LFO.
  1221. @item offset_l
  1222. Set left channel offset. Default is 0. Allowed range is [0 - 1].
  1223. @item offset_r
  1224. Set right channel offset. Default is 0.5. Allowed range is [0 - 1].
  1225. @item width
  1226. Set pulse width. Default is 1. Allowed range is [0 - 2].
  1227. @item timing
  1228. Set possible timing mode. Can be one of: bpm, ms or hz. Default is hz.
  1229. @item bpm
  1230. Set bpm. Default is 120. Allowed range is [30 - 300]. Only used if timing
  1231. is set to bpm.
  1232. @item ms
  1233. Set ms. Default is 500. Allowed range is [10 - 2000]. Only used if timing
  1234. is set to ms.
  1235. @item hz
  1236. Set frequency in Hz. Default is 2. Allowed range is [0.01 - 100]. Only used
  1237. if timing is set to hz.
  1238. @end table
  1239. @anchor{aresample}
  1240. @section aresample
  1241. Resample the input audio to the specified parameters, using the
  1242. libswresample library. If none are specified then the filter will
  1243. automatically convert between its input and output.
  1244. This filter is also able to stretch/squeeze the audio data to make it match
  1245. the timestamps or to inject silence / cut out audio to make it match the
  1246. timestamps, do a combination of both or do neither.
  1247. The filter accepts the syntax
  1248. [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
  1249. expresses a sample rate and @var{resampler_options} is a list of
  1250. @var{key}=@var{value} pairs, separated by ":". See the
  1251. @ref{Resampler Options,,"Resampler Options" section in the
  1252. ffmpeg-resampler(1) manual,ffmpeg-resampler}
  1253. for the complete list of supported options.
  1254. @subsection Examples
  1255. @itemize
  1256. @item
  1257. Resample the input audio to 44100Hz:
  1258. @example
  1259. aresample=44100
  1260. @end example
  1261. @item
  1262. Stretch/squeeze samples to the given timestamps, with a maximum of 1000
  1263. samples per second compensation:
  1264. @example
  1265. aresample=async=1000
  1266. @end example
  1267. @end itemize
  1268. @section areverse
  1269. Reverse an audio clip.
  1270. Warning: This filter requires memory to buffer the entire clip, so trimming
  1271. is suggested.
  1272. @subsection Examples
  1273. @itemize
  1274. @item
  1275. Take the first 5 seconds of a clip, and reverse it.
  1276. @example
  1277. atrim=end=5,areverse
  1278. @end example
  1279. @end itemize
  1280. @section asetnsamples
  1281. Set the number of samples per each output audio frame.
  1282. The last output packet may contain a different number of samples, as
  1283. the filter will flush all the remaining samples when the input audio
  1284. signals its end.
  1285. The filter accepts the following options:
  1286. @table @option
  1287. @item nb_out_samples, n
  1288. Set the number of frames per each output audio frame. The number is
  1289. intended as the number of samples @emph{per each channel}.
  1290. Default value is 1024.
  1291. @item pad, p
  1292. If set to 1, the filter will pad the last audio frame with zeroes, so
  1293. that the last frame will contain the same number of samples as the
  1294. previous ones. Default value is 1.
  1295. @end table
  1296. For example, to set the number of per-frame samples to 1234 and
  1297. disable padding for the last frame, use:
  1298. @example
  1299. asetnsamples=n=1234:p=0
  1300. @end example
  1301. @section asetrate
  1302. Set the sample rate without altering the PCM data.
  1303. This will result in a change of speed and pitch.
  1304. The filter accepts the following options:
  1305. @table @option
  1306. @item sample_rate, r
  1307. Set the output sample rate. Default is 44100 Hz.
  1308. @end table
  1309. @section ashowinfo
  1310. Show a line containing various information for each input audio frame.
  1311. The input audio is not modified.
  1312. The shown line contains a sequence of key/value pairs of the form
  1313. @var{key}:@var{value}.
  1314. The following values are shown in the output:
  1315. @table @option
  1316. @item n
  1317. The (sequential) number of the input frame, starting from 0.
  1318. @item pts
  1319. The presentation timestamp of the input frame, in time base units; the time base
  1320. depends on the filter input pad, and is usually 1/@var{sample_rate}.
  1321. @item pts_time
  1322. The presentation timestamp of the input frame in seconds.
  1323. @item pos
  1324. position of the frame in the input stream, -1 if this information in
  1325. unavailable and/or meaningless (for example in case of synthetic audio)
  1326. @item fmt
  1327. The sample format.
  1328. @item chlayout
  1329. The channel layout.
  1330. @item rate
  1331. The sample rate for the audio frame.
  1332. @item nb_samples
  1333. The number of samples (per channel) in the frame.
  1334. @item checksum
  1335. The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
  1336. audio, the data is treated as if all the planes were concatenated.
  1337. @item plane_checksums
  1338. A list of Adler-32 checksums for each data plane.
  1339. @end table
  1340. @anchor{astats}
  1341. @section astats
  1342. Display time domain statistical information about the audio channels.
  1343. Statistics are calculated and displayed for each audio channel and,
  1344. where applicable, an overall figure is also given.
  1345. It accepts the following option:
  1346. @table @option
  1347. @item length
  1348. Short window length in seconds, used for peak and trough RMS measurement.
  1349. Default is @code{0.05} (50 milliseconds). Allowed range is @code{[0.01 - 10]}.
  1350. @item metadata
  1351. Set metadata injection. All the metadata keys are prefixed with @code{lavfi.astats.X},
  1352. where @code{X} is channel number starting from 1 or string @code{Overall}. Default is
  1353. disabled.
  1354. Available keys for each channel are:
  1355. DC_offset
  1356. Min_level
  1357. Max_level
  1358. Min_difference
  1359. Max_difference
  1360. Mean_difference
  1361. RMS_difference
  1362. Peak_level
  1363. RMS_peak
  1364. RMS_trough
  1365. Crest_factor
  1366. Flat_factor
  1367. Peak_count
  1368. Bit_depth
  1369. Dynamic_range
  1370. and for Overall:
  1371. DC_offset
  1372. Min_level
  1373. Max_level
  1374. Min_difference
  1375. Max_difference
  1376. Mean_difference
  1377. RMS_difference
  1378. Peak_level
  1379. RMS_level
  1380. RMS_peak
  1381. RMS_trough
  1382. Flat_factor
  1383. Peak_count
  1384. Bit_depth
  1385. Number_of_samples
  1386. For example full key look like this @code{lavfi.astats.1.DC_offset} or
  1387. this @code{lavfi.astats.Overall.Peak_count}.
  1388. For description what each key means read below.
  1389. @item reset
  1390. Set number of frame after which stats are going to be recalculated.
  1391. Default is disabled.
  1392. @end table
  1393. A description of each shown parameter follows:
  1394. @table @option
  1395. @item DC offset
  1396. Mean amplitude displacement from zero.
  1397. @item Min level
  1398. Minimal sample level.
  1399. @item Max level
  1400. Maximal sample level.
  1401. @item Min difference
  1402. Minimal difference between two consecutive samples.
  1403. @item Max difference
  1404. Maximal difference between two consecutive samples.
  1405. @item Mean difference
  1406. Mean difference between two consecutive samples.
  1407. The average of each difference between two consecutive samples.
  1408. @item RMS difference
  1409. Root Mean Square difference between two consecutive samples.
  1410. @item Peak level dB
  1411. @item RMS level dB
  1412. Standard peak and RMS level measured in dBFS.
  1413. @item RMS peak dB
  1414. @item RMS trough dB
  1415. Peak and trough values for RMS level measured over a short window.
  1416. @item Crest factor
  1417. Standard ratio of peak to RMS level (note: not in dB).
  1418. @item Flat factor
  1419. Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
  1420. (i.e. either @var{Min level} or @var{Max level}).
  1421. @item Peak count
  1422. Number of occasions (not the number of samples) that the signal attained either
  1423. @var{Min level} or @var{Max level}.
  1424. @item Bit depth
  1425. Overall bit depth of audio. Number of bits used for each sample.
  1426. @item Dynamic range
  1427. Measured dynamic range of audio in dB.
  1428. @end table
  1429. @section atempo
  1430. Adjust audio tempo.
  1431. The filter accepts exactly one parameter, the audio tempo. If not
  1432. specified then the filter will assume nominal 1.0 tempo. Tempo must
  1433. be in the [0.5, 2.0] range.
  1434. @subsection Examples
  1435. @itemize
  1436. @item
  1437. Slow down audio to 80% tempo:
  1438. @example
  1439. atempo=0.8
  1440. @end example
  1441. @item
  1442. To speed up audio to 125% tempo:
  1443. @example
  1444. atempo=1.25
  1445. @end example
  1446. @end itemize
  1447. @section atrim
  1448. Trim the input so that the output contains one continuous subpart of the input.
  1449. It accepts the following parameters:
  1450. @table @option
  1451. @item start
  1452. Timestamp (in seconds) of the start of the section to keep. I.e. the audio
  1453. sample with the timestamp @var{start} will be the first sample in the output.
  1454. @item end
  1455. Specify time of the first audio sample that will be dropped, i.e. the
  1456. audio sample immediately preceding the one with the timestamp @var{end} will be
  1457. the last sample in the output.
  1458. @item start_pts
  1459. Same as @var{start}, except this option sets the start timestamp in samples
  1460. instead of seconds.
  1461. @item end_pts
  1462. Same as @var{end}, except this option sets the end timestamp in samples instead
  1463. of seconds.
  1464. @item duration
  1465. The maximum duration of the output in seconds.
  1466. @item start_sample
  1467. The number of the first sample that should be output.
  1468. @item end_sample
  1469. The number of the first sample that should be dropped.
  1470. @end table
  1471. @option{start}, @option{end}, and @option{duration} are expressed as time
  1472. duration specifications; see
  1473. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}.
  1474. Note that the first two sets of the start/end options and the @option{duration}
  1475. option look at the frame timestamp, while the _sample options simply count the
  1476. samples that pass through the filter. So start/end_pts and start/end_sample will
  1477. give different results when the timestamps are wrong, inexact or do not start at
  1478. zero. Also note that this filter does not modify the timestamps. If you wish
  1479. to have the output timestamps start at zero, insert the asetpts filter after the
  1480. atrim filter.
  1481. If multiple start or end options are set, this filter tries to be greedy and
  1482. keep all samples that match at least one of the specified constraints. To keep
  1483. only the part that matches all the constraints at once, chain multiple atrim
  1484. filters.
  1485. The defaults are such that all the input is kept. So it is possible to set e.g.
  1486. just the end values to keep everything before the specified time.
  1487. Examples:
  1488. @itemize
  1489. @item
  1490. Drop everything except the second minute of input:
  1491. @example
  1492. ffmpeg -i INPUT -af atrim=60:120
  1493. @end example
  1494. @item
  1495. Keep only the first 1000 samples:
  1496. @example
  1497. ffmpeg -i INPUT -af atrim=end_sample=1000
  1498. @end example
  1499. @end itemize
  1500. @section bandpass
  1501. Apply a two-pole Butterworth band-pass filter with central
  1502. frequency @var{frequency}, and (3dB-point) band-width width.
  1503. The @var{csg} option selects a constant skirt gain (peak gain = Q)
  1504. instead of the default: constant 0dB peak gain.
  1505. The filter roll off at 6dB per octave (20dB per decade).
  1506. The filter accepts the following options:
  1507. @table @option
  1508. @item frequency, f
  1509. Set the filter's central frequency. Default is @code{3000}.
  1510. @item csg
  1511. Constant skirt gain if set to 1. Defaults to 0.
  1512. @item width_type, t
  1513. Set method to specify band-width of filter.
  1514. @table @option
  1515. @item h
  1516. Hz
  1517. @item q
  1518. Q-Factor
  1519. @item o
  1520. octave
  1521. @item s
  1522. slope
  1523. @item k
  1524. kHz
  1525. @end table
  1526. @item width, w
  1527. Specify the band-width of a filter in width_type units.
  1528. @item channels, c
  1529. Specify which channels to filter, by default all available are filtered.
  1530. @end table
  1531. @subsection Commands
  1532. This filter supports the following commands:
  1533. @table @option
  1534. @item frequency, f
  1535. Change bandpass frequency.
  1536. Syntax for the command is : "@var{frequency}"
  1537. @item width_type, t
  1538. Change bandpass width_type.
  1539. Syntax for the command is : "@var{width_type}"
  1540. @item width, w
  1541. Change bandpass width.
  1542. Syntax for the command is : "@var{width}"
  1543. @end table
  1544. @section bandreject
  1545. Apply a two-pole Butterworth band-reject filter with central
  1546. frequency @var{frequency}, and (3dB-point) band-width @var{width}.
  1547. The filter roll off at 6dB per octave (20dB per decade).
  1548. The filter accepts the following options:
  1549. @table @option
  1550. @item frequency, f
  1551. Set the filter's central frequency. Default is @code{3000}.
  1552. @item width_type, t
  1553. Set method to specify band-width of filter.
  1554. @table @option
  1555. @item h
  1556. Hz
  1557. @item q
  1558. Q-Factor
  1559. @item o
  1560. octave
  1561. @item s
  1562. slope
  1563. @item k
  1564. kHz
  1565. @end table
  1566. @item width, w
  1567. Specify the band-width of a filter in width_type units.
  1568. @item channels, c
  1569. Specify which channels to filter, by default all available are filtered.
  1570. @end table
  1571. @subsection Commands
  1572. This filter supports the following commands:
  1573. @table @option
  1574. @item frequency, f
  1575. Change bandreject frequency.
  1576. Syntax for the command is : "@var{frequency}"
  1577. @item width_type, t
  1578. Change bandreject width_type.
  1579. Syntax for the command is : "@var{width_type}"
  1580. @item width, w
  1581. Change bandreject width.
  1582. Syntax for the command is : "@var{width}"
  1583. @end table
  1584. @section bass, lowshelf
  1585. Boost or cut the bass (lower) frequencies of the audio using a two-pole
  1586. shelving filter with a response similar to that of a standard
  1587. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  1588. The filter accepts the following options:
  1589. @table @option
  1590. @item gain, g
  1591. Give the gain at 0 Hz. Its useful range is about -20
  1592. (for a large cut) to +20 (for a large boost).
  1593. Beware of clipping when using a positive gain.
  1594. @item frequency, f
  1595. Set the filter's central frequency and so can be used
  1596. to extend or reduce the frequency range to be boosted or cut.
  1597. The default value is @code{100} Hz.
  1598. @item width_type, t
  1599. Set method to specify band-width of filter.
  1600. @table @option
  1601. @item h
  1602. Hz
  1603. @item q
  1604. Q-Factor
  1605. @item o
  1606. octave
  1607. @item s
  1608. slope
  1609. @item k
  1610. kHz
  1611. @end table
  1612. @item width, w
  1613. Determine how steep is the filter's shelf transition.
  1614. @item channels, c
  1615. Specify which channels to filter, by default all available are filtered.
  1616. @end table
  1617. @subsection Commands
  1618. This filter supports the following commands:
  1619. @table @option
  1620. @item frequency, f
  1621. Change bass frequency.
  1622. Syntax for the command is : "@var{frequency}"
  1623. @item width_type, t
  1624. Change bass width_type.
  1625. Syntax for the command is : "@var{width_type}"
  1626. @item width, w
  1627. Change bass width.
  1628. Syntax for the command is : "@var{width}"
  1629. @item gain, g
  1630. Change bass gain.
  1631. Syntax for the command is : "@var{gain}"
  1632. @end table
  1633. @section biquad
  1634. Apply a biquad IIR filter with the given coefficients.
  1635. Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
  1636. are the numerator and denominator coefficients respectively.
  1637. and @var{channels}, @var{c} specify which channels to filter, by default all
  1638. available are filtered.
  1639. @subsection Commands
  1640. This filter supports the following commands:
  1641. @table @option
  1642. @item a0
  1643. @item a1
  1644. @item a2
  1645. @item b0
  1646. @item b1
  1647. @item b2
  1648. Change biquad parameter.
  1649. Syntax for the command is : "@var{value}"
  1650. @end table
  1651. @section bs2b
  1652. Bauer stereo to binaural transformation, which improves headphone listening of
  1653. stereo audio records.
  1654. To enable compilation of this filter you need to configure FFmpeg with
  1655. @code{--enable-libbs2b}.
  1656. It accepts the following parameters:
  1657. @table @option
  1658. @item profile
  1659. Pre-defined crossfeed level.
  1660. @table @option
  1661. @item default
  1662. Default level (fcut=700, feed=50).
  1663. @item cmoy
  1664. Chu Moy circuit (fcut=700, feed=60).
  1665. @item jmeier
  1666. Jan Meier circuit (fcut=650, feed=95).
  1667. @end table
  1668. @item fcut
  1669. Cut frequency (in Hz).
  1670. @item feed
  1671. Feed level (in Hz).
  1672. @end table
  1673. @section channelmap
  1674. Remap input channels to new locations.
  1675. It accepts the following parameters:
  1676. @table @option
  1677. @item map
  1678. Map channels from input to output. The argument is a '|'-separated list of
  1679. mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
  1680. @var{in_channel} form. @var{in_channel} can be either the name of the input
  1681. channel (e.g. FL for front left) or its index in the input channel layout.
  1682. @var{out_channel} is the name of the output channel or its index in the output
  1683. channel layout. If @var{out_channel} is not given then it is implicitly an
  1684. index, starting with zero and increasing by one for each mapping.
  1685. @item channel_layout
  1686. The channel layout of the output stream.
  1687. @end table
  1688. If no mapping is present, the filter will implicitly map input channels to
  1689. output channels, preserving indices.
  1690. @subsection Examples
  1691. @itemize
  1692. @item
  1693. For example, assuming a 5.1+downmix input MOV file,
  1694. @example
  1695. ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
  1696. @end example
  1697. will create an output WAV file tagged as stereo from the downmix channels of
  1698. the input.
  1699. @item
  1700. To fix a 5.1 WAV improperly encoded in AAC's native channel order
  1701. @example
  1702. ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:5.1' out.wav
  1703. @end example
  1704. @end itemize
  1705. @section channelsplit
  1706. Split each channel from an input audio stream into a separate output stream.
  1707. It accepts the following parameters:
  1708. @table @option
  1709. @item channel_layout
  1710. The channel layout of the input stream. The default is "stereo".
  1711. @item channels
  1712. A channel layout describing the channels to be extracted as separate output streams
  1713. or "all" to extract each input channel as a separate stream. The default is "all".
  1714. Choosing channels not present in channel layout in the input will result in an error.
  1715. @end table
  1716. @subsection Examples
  1717. @itemize
  1718. @item
  1719. For example, assuming a stereo input MP3 file,
  1720. @example
  1721. ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
  1722. @end example
  1723. will create an output Matroska file with two audio streams, one containing only
  1724. the left channel and the other the right channel.
  1725. @item
  1726. Split a 5.1 WAV file into per-channel files:
  1727. @example
  1728. ffmpeg -i in.wav -filter_complex
  1729. 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
  1730. -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
  1731. front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
  1732. side_right.wav
  1733. @end example
  1734. @item
  1735. Extract only LFE from a 5.1 WAV file:
  1736. @example
  1737. ffmpeg -i in.wav -filter_complex 'channelsplit=channel_layout=5.1:channels=LFE[LFE]'
  1738. -map '[LFE]' lfe.wav
  1739. @end example
  1740. @end itemize
  1741. @section chorus
  1742. Add a chorus effect to the audio.
  1743. Can make a single vocal sound like a chorus, but can also be applied to instrumentation.
  1744. Chorus resembles an echo effect with a short delay, but whereas with echo the delay is
  1745. constant, with chorus, it is varied using using sinusoidal or triangular modulation.
  1746. The modulation depth defines the range the modulated delay is played before or after
  1747. the delay. Hence the delayed sound will sound slower or faster, that is the delayed
  1748. sound tuned around the original one, like in a chorus where some vocals are slightly
  1749. off key.
  1750. It accepts the following parameters:
  1751. @table @option
  1752. @item in_gain
  1753. Set input gain. Default is 0.4.
  1754. @item out_gain
  1755. Set output gain. Default is 0.4.
  1756. @item delays
  1757. Set delays. A typical delay is around 40ms to 60ms.
  1758. @item decays
  1759. Set decays.
  1760. @item speeds
  1761. Set speeds.
  1762. @item depths
  1763. Set depths.
  1764. @end table
  1765. @subsection Examples
  1766. @itemize
  1767. @item
  1768. A single delay:
  1769. @example
  1770. chorus=0.7:0.9:55:0.4:0.25:2
  1771. @end example
  1772. @item
  1773. Two delays:
  1774. @example
  1775. chorus=0.6:0.9:50|60:0.4|0.32:0.25|0.4:2|1.3
  1776. @end example
  1777. @item
  1778. Fuller sounding chorus with three delays:
  1779. @example
  1780. 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
  1781. @end example
  1782. @end itemize
  1783. @section compand
  1784. Compress or expand the audio's dynamic range.
  1785. It accepts the following parameters:
  1786. @table @option
  1787. @item attacks
  1788. @item decays
  1789. A list of times in seconds for each channel over which the instantaneous level
  1790. of the input signal is averaged to determine its volume. @var{attacks} refers to
  1791. increase of volume and @var{decays} refers to decrease of volume. For most
  1792. situations, the attack time (response to the audio getting louder) should be
  1793. shorter than the decay time, because the human ear is more sensitive to sudden
  1794. loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
  1795. a typical value for decay is 0.8 seconds.
  1796. If specified number of attacks & decays is lower than number of channels, the last
  1797. set attack/decay will be used for all remaining channels.
  1798. @item points
  1799. A list of points for the transfer function, specified in dB relative to the
  1800. maximum possible signal amplitude. Each key points list must be defined using
  1801. the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
  1802. @code{x0/y0 x1/y1 x2/y2 ....}
  1803. The input values must be in strictly increasing order but the transfer function
  1804. does not have to be monotonically rising. The point @code{0/0} is assumed but
  1805. may be overridden (by @code{0/out-dBn}). Typical values for the transfer
  1806. function are @code{-70/-70|-60/-20|1/0}.
  1807. @item soft-knee
  1808. Set the curve radius in dB for all joints. It defaults to 0.01.
  1809. @item gain
  1810. Set the additional gain in dB to be applied at all points on the transfer
  1811. function. This allows for easy adjustment of the overall gain.
  1812. It defaults to 0.
  1813. @item volume
  1814. Set an initial volume, in dB, to be assumed for each channel when filtering
  1815. starts. This permits the user to supply a nominal level initially, so that, for
  1816. example, a very large gain is not applied to initial signal levels before the
  1817. companding has begun to operate. A typical value for audio which is initially
  1818. quiet is -90 dB. It defaults to 0.
  1819. @item delay
  1820. Set a delay, in seconds. The input audio is analyzed immediately, but audio is
  1821. delayed before being fed to the volume adjuster. Specifying a delay
  1822. approximately equal to the attack/decay times allows the filter to effectively
  1823. operate in predictive rather than reactive mode. It defaults to 0.
  1824. @end table
  1825. @subsection Examples
  1826. @itemize
  1827. @item
  1828. Make music with both quiet and loud passages suitable for listening to in a
  1829. noisy environment:
  1830. @example
  1831. compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
  1832. @end example
  1833. Another example for audio with whisper and explosion parts:
  1834. @example
  1835. compand=0|0:1|1:-90/-900|-70/-70|-30/-9|0/-3:6:0:0:0
  1836. @end example
  1837. @item
  1838. A noise gate for when the noise is at a lower level than the signal:
  1839. @example
  1840. compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
  1841. @end example
  1842. @item
  1843. Here is another noise gate, this time for when the noise is at a higher level
  1844. than the signal (making it, in some ways, similar to squelch):
  1845. @example
  1846. compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
  1847. @end example
  1848. @item
  1849. 2:1 compression starting at -6dB:
  1850. @example
  1851. compand=points=-80/-80|-6/-6|0/-3.8|20/3.5
  1852. @end example
  1853. @item
  1854. 2:1 compression starting at -9dB:
  1855. @example
  1856. compand=points=-80/-80|-9/-9|0/-5.3|20/2.9
  1857. @end example
  1858. @item
  1859. 2:1 compression starting at -12dB:
  1860. @example
  1861. compand=points=-80/-80|-12/-12|0/-6.8|20/1.9
  1862. @end example
  1863. @item
  1864. 2:1 compression starting at -18dB:
  1865. @example
  1866. compand=points=-80/-80|-18/-18|0/-9.8|20/0.7
  1867. @end example
  1868. @item
  1869. 3:1 compression starting at -15dB:
  1870. @example
  1871. compand=points=-80/-80|-15/-15|0/-10.8|20/-5.2
  1872. @end example
  1873. @item
  1874. Compressor/Gate:
  1875. @example
  1876. compand=points=-80/-105|-62/-80|-15.4/-15.4|0/-12|20/-7.6
  1877. @end example
  1878. @item
  1879. Expander:
  1880. @example
  1881. 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
  1882. @end example
  1883. @item
  1884. Hard limiter at -6dB:
  1885. @example
  1886. compand=attacks=0:points=-80/-80|-6/-6|20/-6
  1887. @end example
  1888. @item
  1889. Hard limiter at -12dB:
  1890. @example
  1891. compand=attacks=0:points=-80/-80|-12/-12|20/-12
  1892. @end example
  1893. @item
  1894. Hard noise gate at -35 dB:
  1895. @example
  1896. compand=attacks=0:points=-80/-115|-35.1/-80|-35/-35|20/20
  1897. @end example
  1898. @item
  1899. Soft limiter:
  1900. @example
  1901. compand=attacks=0:points=-80/-80|-12.4/-12.4|-6/-8|0/-6.8|20/-2.8
  1902. @end example
  1903. @end itemize
  1904. @section compensationdelay
  1905. Compensation Delay Line is a metric based delay to compensate differing
  1906. positions of microphones or speakers.
  1907. For example, you have recorded guitar with two microphones placed in
  1908. different location. Because the front of sound wave has fixed speed in
  1909. normal conditions, the phasing of microphones can vary and depends on
  1910. their location and interposition. The best sound mix can be achieved when
  1911. these microphones are in phase (synchronized). Note that distance of
  1912. ~30 cm between microphones makes one microphone to capture signal in
  1913. antiphase to another microphone. That makes the final mix sounding moody.
  1914. This filter helps to solve phasing problems by adding different delays
  1915. to each microphone track and make them synchronized.
  1916. The best result can be reached when you take one track as base and
  1917. synchronize other tracks one by one with it.
  1918. Remember that synchronization/delay tolerance depends on sample rate, too.
  1919. Higher sample rates will give more tolerance.
  1920. It accepts the following parameters:
  1921. @table @option
  1922. @item mm
  1923. Set millimeters distance. This is compensation distance for fine tuning.
  1924. Default is 0.
  1925. @item cm
  1926. Set cm distance. This is compensation distance for tightening distance setup.
  1927. Default is 0.
  1928. @item m
  1929. Set meters distance. This is compensation distance for hard distance setup.
  1930. Default is 0.
  1931. @item dry
  1932. Set dry amount. Amount of unprocessed (dry) signal.
  1933. Default is 0.
  1934. @item wet
  1935. Set wet amount. Amount of processed (wet) signal.
  1936. Default is 1.
  1937. @item temp
  1938. Set temperature degree in Celsius. This is the temperature of the environment.
  1939. Default is 20.
  1940. @end table
  1941. @section crossfeed
  1942. Apply headphone crossfeed filter.
  1943. Crossfeed is the process of blending the left and right channels of stereo
  1944. audio recording.
  1945. It is mainly used to reduce extreme stereo separation of low frequencies.
  1946. The intent is to produce more speaker like sound to the listener.
  1947. The filter accepts the following options:
  1948. @table @option
  1949. @item strength
  1950. Set strength of crossfeed. Default is 0.2. Allowed range is from 0 to 1.
  1951. This sets gain of low shelf filter for side part of stereo image.
  1952. Default is -6dB. Max allowed is -30db when strength is set to 1.
  1953. @item range
  1954. Set soundstage wideness. Default is 0.5. Allowed range is from 0 to 1.
  1955. This sets cut off frequency of low shelf filter. Default is cut off near
  1956. 1550 Hz. With range set to 1 cut off frequency is set to 2100 Hz.
  1957. @item level_in
  1958. Set input gain. Default is 0.9.
  1959. @item level_out
  1960. Set output gain. Default is 1.
  1961. @end table
  1962. @section crystalizer
  1963. Simple algorithm to expand audio dynamic range.
  1964. The filter accepts the following options:
  1965. @table @option
  1966. @item i
  1967. Sets the intensity of effect (default: 2.0). Must be in range between 0.0
  1968. (unchanged sound) to 10.0 (maximum effect).
  1969. @item c
  1970. Enable clipping. By default is enabled.
  1971. @end table
  1972. @section dcshift
  1973. Apply a DC shift to the audio.
  1974. This can be useful to remove a DC offset (caused perhaps by a hardware problem
  1975. in the recording chain) from the audio. The effect of a DC offset is reduced
  1976. headroom and hence volume. The @ref{astats} filter can be used to determine if
  1977. a signal has a DC offset.
  1978. @table @option
  1979. @item shift
  1980. Set the DC shift, allowed range is [-1, 1]. It indicates the amount to shift
  1981. the audio.
  1982. @item limitergain
  1983. Optional. It should have a value much less than 1 (e.g. 0.05 or 0.02) and is
  1984. used to prevent clipping.
  1985. @end table
  1986. @section drmeter
  1987. Measure audio dynamic range.
  1988. DR values of 14 and higher is found in very dynamic material. DR of 8 to 13
  1989. is found in transition material. And anything less that 8 have very poor dynamics
  1990. and is very compressed.
  1991. The filter accepts the following options:
  1992. @table @option
  1993. @item length
  1994. Set window length in seconds used to split audio into segments of equal length.
  1995. Default is 3 seconds.
  1996. @end table
  1997. @section dynaudnorm
  1998. Dynamic Audio Normalizer.
  1999. This filter applies a certain amount of gain to the input audio in order
  2000. to bring its peak magnitude to a target level (e.g. 0 dBFS). However, in
  2001. contrast to more "simple" normalization algorithms, the Dynamic Audio
  2002. Normalizer *dynamically* re-adjusts the gain factor to the input audio.
  2003. This allows for applying extra gain to the "quiet" sections of the audio
  2004. while avoiding distortions or clipping the "loud" sections. In other words:
  2005. The Dynamic Audio Normalizer will "even out" the volume of quiet and loud
  2006. sections, in the sense that the volume of each section is brought to the
  2007. same target level. Note, however, that the Dynamic Audio Normalizer achieves
  2008. this goal *without* applying "dynamic range compressing". It will retain 100%
  2009. of the dynamic range *within* each section of the audio file.
  2010. @table @option
  2011. @item f
  2012. Set the frame length in milliseconds. In range from 10 to 8000 milliseconds.
  2013. Default is 500 milliseconds.
  2014. The Dynamic Audio Normalizer processes the input audio in small chunks,
  2015. referred to as frames. This is required, because a peak magnitude has no
  2016. meaning for just a single sample value. Instead, we need to determine the
  2017. peak magnitude for a contiguous sequence of sample values. While a "standard"
  2018. normalizer would simply use the peak magnitude of the complete file, the
  2019. Dynamic Audio Normalizer determines the peak magnitude individually for each
  2020. frame. The length of a frame is specified in milliseconds. By default, the
  2021. Dynamic Audio Normalizer uses a frame length of 500 milliseconds, which has
  2022. been found to give good results with most files.
  2023. Note that the exact frame length, in number of samples, will be determined
  2024. automatically, based on the sampling rate of the individual input audio file.
  2025. @item g
  2026. Set the Gaussian filter window size. In range from 3 to 301, must be odd
  2027. number. Default is 31.
  2028. Probably the most important parameter of the Dynamic Audio Normalizer is the
  2029. @code{window size} of the Gaussian smoothing filter. The filter's window size
  2030. is specified in frames, centered around the current frame. For the sake of
  2031. simplicity, this must be an odd number. Consequently, the default value of 31
  2032. takes into account the current frame, as well as the 15 preceding frames and
  2033. the 15 subsequent frames. Using a larger window results in a stronger
  2034. smoothing effect and thus in less gain variation, i.e. slower gain
  2035. adaptation. Conversely, using a smaller window results in a weaker smoothing
  2036. effect and thus in more gain variation, i.e. faster gain adaptation.
  2037. In other words, the more you increase this value, the more the Dynamic Audio
  2038. Normalizer will behave like a "traditional" normalization filter. On the
  2039. contrary, the more you decrease this value, the more the Dynamic Audio
  2040. Normalizer will behave like a dynamic range compressor.
  2041. @item p
  2042. Set the target peak value. This specifies the highest permissible magnitude
  2043. level for the normalized audio input. This filter will try to approach the
  2044. target peak magnitude as closely as possible, but at the same time it also
  2045. makes sure that the normalized signal will never exceed the peak magnitude.
  2046. A frame's maximum local gain factor is imposed directly by the target peak
  2047. magnitude. The default value is 0.95 and thus leaves a headroom of 5%*.
  2048. It is not recommended to go above this value.
  2049. @item m
  2050. Set the maximum gain factor. In range from 1.0 to 100.0. Default is 10.0.
  2051. The Dynamic Audio Normalizer determines the maximum possible (local) gain
  2052. factor for each input frame, i.e. the maximum gain factor that does not
  2053. result in clipping or distortion. The maximum gain factor is determined by
  2054. the frame's highest magnitude sample. However, the Dynamic Audio Normalizer
  2055. additionally bounds the frame's maximum gain factor by a predetermined
  2056. (global) maximum gain factor. This is done in order to avoid excessive gain
  2057. factors in "silent" or almost silent frames. By default, the maximum gain
  2058. factor is 10.0, For most inputs the default value should be sufficient and
  2059. it usually is not recommended to increase this value. Though, for input
  2060. with an extremely low overall volume level, it may be necessary to allow even
  2061. higher gain factors. Note, however, that the Dynamic Audio Normalizer does
  2062. not simply apply a "hard" threshold (i.e. cut off values above the threshold).
  2063. Instead, a "sigmoid" threshold function will be applied. This way, the
  2064. gain factors will smoothly approach the threshold value, but never exceed that
  2065. value.
  2066. @item r
  2067. Set the target RMS. In range from 0.0 to 1.0. Default is 0.0 - disabled.
  2068. By default, the Dynamic Audio Normalizer performs "peak" normalization.
  2069. This means that the maximum local gain factor for each frame is defined
  2070. (only) by the frame's highest magnitude sample. This way, the samples can
  2071. be amplified as much as possible without exceeding the maximum signal
  2072. level, i.e. without clipping. Optionally, however, the Dynamic Audio
  2073. Normalizer can also take into account the frame's root mean square,
  2074. abbreviated RMS. In electrical engineering, the RMS is commonly used to
  2075. determine the power of a time-varying signal. It is therefore considered
  2076. that the RMS is a better approximation of the "perceived loudness" than
  2077. just looking at the signal's peak magnitude. Consequently, by adjusting all
  2078. frames to a constant RMS value, a uniform "perceived loudness" can be
  2079. established. If a target RMS value has been specified, a frame's local gain
  2080. factor is defined as the factor that would result in exactly that RMS value.
  2081. Note, however, that the maximum local gain factor is still restricted by the
  2082. frame's highest magnitude sample, in order to prevent clipping.
  2083. @item n
  2084. Enable channels coupling. By default is enabled.
  2085. By default, the Dynamic Audio Normalizer will amplify all channels by the same
  2086. amount. This means the same gain factor will be applied to all channels, i.e.
  2087. the maximum possible gain factor is determined by the "loudest" channel.
  2088. However, in some recordings, it may happen that the volume of the different
  2089. channels is uneven, e.g. one channel may be "quieter" than the other one(s).
  2090. In this case, this option can be used to disable the channel coupling. This way,
  2091. the gain factor will be determined independently for each channel, depending
  2092. only on the individual channel's highest magnitude sample. This allows for
  2093. harmonizing the volume of the different channels.
  2094. @item c
  2095. Enable DC bias correction. By default is disabled.
  2096. An audio signal (in the time domain) is a sequence of sample values.
  2097. In the Dynamic Audio Normalizer these sample values are represented in the
  2098. -1.0 to 1.0 range, regardless of the original input format. Normally, the
  2099. audio signal, or "waveform", should be centered around the zero point.
  2100. That means if we calculate the mean value of all samples in a file, or in a
  2101. single frame, then the result should be 0.0 or at least very close to that
  2102. value. If, however, there is a significant deviation of the mean value from
  2103. 0.0, in either positive or negative direction, this is referred to as a
  2104. DC bias or DC offset. Since a DC bias is clearly undesirable, the Dynamic
  2105. Audio Normalizer provides optional DC bias correction.
  2106. With DC bias correction enabled, the Dynamic Audio Normalizer will determine
  2107. the mean value, or "DC correction" offset, of each input frame and subtract
  2108. that value from all of the frame's sample values which ensures those samples
  2109. are centered around 0.0 again. Also, in order to avoid "gaps" at the frame
  2110. boundaries, the DC correction offset values will be interpolated smoothly
  2111. between neighbouring frames.
  2112. @item b
  2113. Enable alternative boundary mode. By default is disabled.
  2114. The Dynamic Audio Normalizer takes into account a certain neighbourhood
  2115. around each frame. This includes the preceding frames as well as the
  2116. subsequent frames. However, for the "boundary" frames, located at the very
  2117. beginning and at the very end of the audio file, not all neighbouring
  2118. frames are available. In particular, for the first few frames in the audio
  2119. file, the preceding frames are not known. And, similarly, for the last few
  2120. frames in the audio file, the subsequent frames are not known. Thus, the
  2121. question arises which gain factors should be assumed for the missing frames
  2122. in the "boundary" region. The Dynamic Audio Normalizer implements two modes
  2123. to deal with this situation. The default boundary mode assumes a gain factor
  2124. of exactly 1.0 for the missing frames, resulting in a smooth "fade in" and
  2125. "fade out" at the beginning and at the end of the input, respectively.
  2126. @item s
  2127. Set the compress factor. In range from 0.0 to 30.0. Default is 0.0.
  2128. By default, the Dynamic Audio Normalizer does not apply "traditional"
  2129. compression. This means that signal peaks will not be pruned and thus the
  2130. full dynamic range will be retained within each local neighbourhood. However,
  2131. in some cases it may be desirable to combine the Dynamic Audio Normalizer's
  2132. normalization algorithm with a more "traditional" compression.
  2133. For this purpose, the Dynamic Audio Normalizer provides an optional compression
  2134. (thresholding) function. If (and only if) the compression feature is enabled,
  2135. all input frames will be processed by a soft knee thresholding function prior
  2136. to the actual normalization process. Put simply, the thresholding function is
  2137. going to prune all samples whose magnitude exceeds a certain threshold value.
  2138. However, the Dynamic Audio Normalizer does not simply apply a fixed threshold
  2139. value. Instead, the threshold value will be adjusted for each individual
  2140. frame.
  2141. In general, smaller parameters result in stronger compression, and vice versa.
  2142. Values below 3.0 are not recommended, because audible distortion may appear.
  2143. @end table
  2144. @section earwax
  2145. Make audio easier to listen to on headphones.
  2146. This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
  2147. so that when listened to on headphones the stereo image is moved from
  2148. inside your head (standard for headphones) to outside and in front of
  2149. the listener (standard for speakers).
  2150. Ported from SoX.
  2151. @section equalizer
  2152. Apply a two-pole peaking equalisation (EQ) filter. With this
  2153. filter, the signal-level at and around a selected frequency can
  2154. be increased or decreased, whilst (unlike bandpass and bandreject
  2155. filters) that at all other frequencies is unchanged.
  2156. In order to produce complex equalisation curves, this filter can
  2157. be given several times, each with a different central frequency.
  2158. The filter accepts the following options:
  2159. @table @option
  2160. @item frequency, f
  2161. Set the filter's central frequency in Hz.
  2162. @item width_type, t
  2163. Set method to specify band-width of filter.
  2164. @table @option
  2165. @item h
  2166. Hz
  2167. @item q
  2168. Q-Factor
  2169. @item o
  2170. octave
  2171. @item s
  2172. slope
  2173. @item k
  2174. kHz
  2175. @end table
  2176. @item width, w
  2177. Specify the band-width of a filter in width_type units.
  2178. @item gain, g
  2179. Set the required gain or attenuation in dB.
  2180. Beware of clipping when using a positive gain.
  2181. @item channels, c
  2182. Specify which channels to filter, by default all available are filtered.
  2183. @end table
  2184. @subsection Examples
  2185. @itemize
  2186. @item
  2187. Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
  2188. @example
  2189. equalizer=f=1000:t=h:width=200:g=-10
  2190. @end example
  2191. @item
  2192. Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
  2193. @example
  2194. equalizer=f=1000:t=q:w=1:g=2,equalizer=f=100:t=q:w=2:g=-5
  2195. @end example
  2196. @end itemize
  2197. @subsection Commands
  2198. This filter supports the following commands:
  2199. @table @option
  2200. @item frequency, f
  2201. Change equalizer frequency.
  2202. Syntax for the command is : "@var{frequency}"
  2203. @item width_type, t
  2204. Change equalizer width_type.
  2205. Syntax for the command is : "@var{width_type}"
  2206. @item width, w
  2207. Change equalizer width.
  2208. Syntax for the command is : "@var{width}"
  2209. @item gain, g
  2210. Change equalizer gain.
  2211. Syntax for the command is : "@var{gain}"
  2212. @end table
  2213. @section extrastereo
  2214. Linearly increases the difference between left and right channels which
  2215. adds some sort of "live" effect to playback.
  2216. The filter accepts the following options:
  2217. @table @option
  2218. @item m
  2219. Sets the difference coefficient (default: 2.5). 0.0 means mono sound
  2220. (average of both channels), with 1.0 sound will be unchanged, with
  2221. -1.0 left and right channels will be swapped.
  2222. @item c
  2223. Enable clipping. By default is enabled.
  2224. @end table
  2225. @section firequalizer
  2226. Apply FIR Equalization using arbitrary frequency response.
  2227. The filter accepts the following option:
  2228. @table @option
  2229. @item gain
  2230. Set gain curve equation (in dB). The expression can contain variables:
  2231. @table @option
  2232. @item f
  2233. the evaluated frequency
  2234. @item sr
  2235. sample rate
  2236. @item ch
  2237. channel number, set to 0 when multichannels evaluation is disabled
  2238. @item chid
  2239. channel id, see libavutil/channel_layout.h, set to the first channel id when
  2240. multichannels evaluation is disabled
  2241. @item chs
  2242. number of channels
  2243. @item chlayout
  2244. channel_layout, see libavutil/channel_layout.h
  2245. @end table
  2246. and functions:
  2247. @table @option
  2248. @item gain_interpolate(f)
  2249. interpolate gain on frequency f based on gain_entry
  2250. @item cubic_interpolate(f)
  2251. same as gain_interpolate, but smoother
  2252. @end table
  2253. This option is also available as command. Default is @code{gain_interpolate(f)}.
  2254. @item gain_entry
  2255. Set gain entry for gain_interpolate function. The expression can
  2256. contain functions:
  2257. @table @option
  2258. @item entry(f, g)
  2259. store gain entry at frequency f with value g
  2260. @end table
  2261. This option is also available as command.
  2262. @item delay
  2263. Set filter delay in seconds. Higher value means more accurate.
  2264. Default is @code{0.01}.
  2265. @item accuracy
  2266. Set filter accuracy in Hz. Lower value means more accurate.
  2267. Default is @code{5}.
  2268. @item wfunc
  2269. Set window function. Acceptable values are:
  2270. @table @option
  2271. @item rectangular
  2272. rectangular window, useful when gain curve is already smooth
  2273. @item hann
  2274. hann window (default)
  2275. @item hamming
  2276. hamming window
  2277. @item blackman
  2278. blackman window
  2279. @item nuttall3
  2280. 3-terms continuous 1st derivative nuttall window
  2281. @item mnuttall3
  2282. minimum 3-terms discontinuous nuttall window
  2283. @item nuttall
  2284. 4-terms continuous 1st derivative nuttall window
  2285. @item bnuttall
  2286. minimum 4-terms discontinuous nuttall (blackman-nuttall) window
  2287. @item bharris
  2288. blackman-harris window
  2289. @item tukey
  2290. tukey window
  2291. @end table
  2292. @item fixed
  2293. If enabled, use fixed number of audio samples. This improves speed when
  2294. filtering with large delay. Default is disabled.
  2295. @item multi
  2296. Enable multichannels evaluation on gain. Default is disabled.
  2297. @item zero_phase
  2298. Enable zero phase mode by subtracting timestamp to compensate delay.
  2299. Default is disabled.
  2300. @item scale
  2301. Set scale used by gain. Acceptable values are:
  2302. @table @option
  2303. @item linlin
  2304. linear frequency, linear gain
  2305. @item linlog
  2306. linear frequency, logarithmic (in dB) gain (default)
  2307. @item loglin
  2308. logarithmic (in octave scale where 20 Hz is 0) frequency, linear gain
  2309. @item loglog
  2310. logarithmic frequency, logarithmic gain
  2311. @end table
  2312. @item dumpfile
  2313. Set file for dumping, suitable for gnuplot.
  2314. @item dumpscale
  2315. Set scale for dumpfile. Acceptable values are same with scale option.
  2316. Default is linlog.
  2317. @item fft2
  2318. Enable 2-channel convolution using complex FFT. This improves speed significantly.
  2319. Default is disabled.
  2320. @item min_phase
  2321. Enable minimum phase impulse response. Default is disabled.
  2322. @end table
  2323. @subsection Examples
  2324. @itemize
  2325. @item
  2326. lowpass at 1000 Hz:
  2327. @example
  2328. firequalizer=gain='if(lt(f,1000), 0, -INF)'
  2329. @end example
  2330. @item
  2331. lowpass at 1000 Hz with gain_entry:
  2332. @example
  2333. firequalizer=gain_entry='entry(1000,0); entry(1001, -INF)'
  2334. @end example
  2335. @item
  2336. custom equalization:
  2337. @example
  2338. firequalizer=gain_entry='entry(100,0); entry(400, -4); entry(1000, -6); entry(2000, 0)'
  2339. @end example
  2340. @item
  2341. higher delay with zero phase to compensate delay:
  2342. @example
  2343. firequalizer=delay=0.1:fixed=on:zero_phase=on
  2344. @end example
  2345. @item
  2346. lowpass on left channel, highpass on right channel:
  2347. @example
  2348. firequalizer=gain='if(eq(chid,1), gain_interpolate(f), if(eq(chid,2), gain_interpolate(1e6+f), 0))'
  2349. :gain_entry='entry(1000, 0); entry(1001,-INF); entry(1e6+1000,0)':multi=on
  2350. @end example
  2351. @end itemize
  2352. @section flanger
  2353. Apply a flanging effect to the audio.
  2354. The filter accepts the following options:
  2355. @table @option
  2356. @item delay
  2357. Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
  2358. @item depth
  2359. Set added sweep delay in milliseconds. Range from 0 to 10. Default value is 2.
  2360. @item regen
  2361. Set percentage regeneration (delayed signal feedback). Range from -95 to 95.
  2362. Default value is 0.
  2363. @item width
  2364. Set percentage of delayed signal mixed with original. Range from 0 to 100.
  2365. Default value is 71.
  2366. @item speed
  2367. Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
  2368. @item shape
  2369. Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
  2370. Default value is @var{sinusoidal}.
  2371. @item phase
  2372. Set swept wave percentage-shift for multi channel. Range from 0 to 100.
  2373. Default value is 25.
  2374. @item interp
  2375. Set delay-line interpolation, @var{linear} or @var{quadratic}.
  2376. Default is @var{linear}.
  2377. @end table
  2378. @section haas
  2379. Apply Haas effect to audio.
  2380. Note that this makes most sense to apply on mono signals.
  2381. With this filter applied to mono signals it give some directionality and
  2382. stretches its stereo image.
  2383. The filter accepts the following options:
  2384. @table @option
  2385. @item level_in
  2386. Set input level. By default is @var{1}, or 0dB
  2387. @item level_out
  2388. Set output level. By default is @var{1}, or 0dB.
  2389. @item side_gain
  2390. Set gain applied to side part of signal. By default is @var{1}.
  2391. @item middle_source
  2392. Set kind of middle source. Can be one of the following:
  2393. @table @samp
  2394. @item left
  2395. Pick left channel.
  2396. @item right
  2397. Pick right channel.
  2398. @item mid
  2399. Pick middle part signal of stereo image.
  2400. @item side
  2401. Pick side part signal of stereo image.
  2402. @end table
  2403. @item middle_phase
  2404. Change middle phase. By default is disabled.
  2405. @item left_delay
  2406. Set left channel delay. By default is @var{2.05} milliseconds.
  2407. @item left_balance
  2408. Set left channel balance. By default is @var{-1}.
  2409. @item left_gain
  2410. Set left channel gain. By default is @var{1}.
  2411. @item left_phase
  2412. Change left phase. By default is disabled.
  2413. @item right_delay
  2414. Set right channel delay. By defaults is @var{2.12} milliseconds.
  2415. @item right_balance
  2416. Set right channel balance. By default is @var{1}.
  2417. @item right_gain
  2418. Set right channel gain. By default is @var{1}.
  2419. @item right_phase
  2420. Change right phase. By default is enabled.
  2421. @end table
  2422. @section hdcd
  2423. Decodes High Definition Compatible Digital (HDCD) data. A 16-bit PCM stream with
  2424. embedded HDCD codes is expanded into a 20-bit PCM stream.
  2425. The filter supports the Peak Extend and Low-level Gain Adjustment features
  2426. of HDCD, and detects the Transient Filter flag.
  2427. @example
  2428. ffmpeg -i HDCD16.flac -af hdcd OUT24.flac
  2429. @end example
  2430. When using the filter with wav, note the default encoding for wav is 16-bit,
  2431. so the resulting 20-bit stream will be truncated back to 16-bit. Use something
  2432. like @command{-acodec pcm_s24le} after the filter to get 24-bit PCM output.
  2433. @example
  2434. ffmpeg -i HDCD16.wav -af hdcd OUT16.wav
  2435. ffmpeg -i HDCD16.wav -af hdcd -c:a pcm_s24le OUT24.wav
  2436. @end example
  2437. The filter accepts the following options:
  2438. @table @option
  2439. @item disable_autoconvert
  2440. Disable any automatic format conversion or resampling in the filter graph.
  2441. @item process_stereo
  2442. Process the stereo channels together. If target_gain does not match between
  2443. channels, consider it invalid and use the last valid target_gain.
  2444. @item cdt_ms
  2445. Set the code detect timer period in ms.
  2446. @item force_pe
  2447. Always extend peaks above -3dBFS even if PE isn't signaled.
  2448. @item analyze_mode
  2449. Replace audio with a solid tone and adjust the amplitude to signal some
  2450. specific aspect of the decoding process. The output file can be loaded in
  2451. an audio editor alongside the original to aid analysis.
  2452. @code{analyze_mode=pe:force_pe=true} can be used to see all samples above the PE level.
  2453. Modes are:
  2454. @table @samp
  2455. @item 0, off
  2456. Disabled
  2457. @item 1, lle
  2458. Gain adjustment level at each sample
  2459. @item 2, pe
  2460. Samples where peak extend occurs
  2461. @item 3, cdt
  2462. Samples where the code detect timer is active
  2463. @item 4, tgm
  2464. Samples where the target gain does not match between channels
  2465. @end table
  2466. @end table
  2467. @section headphone
  2468. Apply head-related transfer functions (HRTFs) to create virtual
  2469. loudspeakers around the user for binaural listening via headphones.
  2470. The HRIRs are provided via additional streams, for each channel
  2471. one stereo input stream is needed.
  2472. The filter accepts the following options:
  2473. @table @option
  2474. @item map
  2475. Set mapping of input streams for convolution.
  2476. The argument is a '|'-separated list of channel names in order as they
  2477. are given as additional stream inputs for filter.
  2478. This also specify number of input streams. Number of input streams
  2479. must be not less than number of channels in first stream plus one.
  2480. @item gain
  2481. Set gain applied to audio. Value is in dB. Default is 0.
  2482. @item type
  2483. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  2484. processing audio in time domain which is slow.
  2485. @var{freq} is processing audio in frequency domain which is fast.
  2486. Default is @var{freq}.
  2487. @item lfe
  2488. Set custom gain for LFE channels. Value is in dB. Default is 0.
  2489. @item size
  2490. Set size of frame in number of samples which will be processed at once.
  2491. Default value is @var{1024}. Allowed range is from 1024 to 96000.
  2492. @item hrir
  2493. Set format of hrir stream.
  2494. Default value is @var{stereo}. Alternative value is @var{multich}.
  2495. If value is set to @var{stereo}, number of additional streams should
  2496. be greater or equal to number of input channels in first input stream.
  2497. Also each additional stream should have stereo number of channels.
  2498. If value is set to @var{multich}, number of additional streams should
  2499. be exactly one. Also number of input channels of additional stream
  2500. should be equal or greater than twice number of channels of first input
  2501. stream.
  2502. @end table
  2503. @subsection Examples
  2504. @itemize
  2505. @item
  2506. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2507. each amovie filter use stereo file with IR coefficients as input.
  2508. The files give coefficients for each position of virtual loudspeaker:
  2509. @example
  2510. 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"
  2511. output.wav
  2512. @end example
  2513. @item
  2514. Full example using wav files as coefficients with amovie filters for 7.1 downmix,
  2515. but now in @var{multich} @var{hrir} format.
  2516. @example
  2517. ffmpeg -i input.wav -lavfi-complex "amovie=minp.wav[hrirs],[a:0][hrirs]headphone=map=FL|FR|FC|LFE|BL|BR|SL|SR:hrir=multich"
  2518. output.wav
  2519. @end example
  2520. @end itemize
  2521. @section highpass
  2522. Apply a high-pass filter with 3dB point frequency.
  2523. The filter can be either single-pole, or double-pole (the default).
  2524. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2525. The filter accepts the following options:
  2526. @table @option
  2527. @item frequency, f
  2528. Set frequency in Hz. Default is 3000.
  2529. @item poles, p
  2530. Set number of poles. Default is 2.
  2531. @item width_type, t
  2532. Set method to specify band-width of filter.
  2533. @table @option
  2534. @item h
  2535. Hz
  2536. @item q
  2537. Q-Factor
  2538. @item o
  2539. octave
  2540. @item s
  2541. slope
  2542. @item k
  2543. kHz
  2544. @end table
  2545. @item width, w
  2546. Specify the band-width of a filter in width_type units.
  2547. Applies only to double-pole filter.
  2548. The default is 0.707q and gives a Butterworth response.
  2549. @item channels, c
  2550. Specify which channels to filter, by default all available are filtered.
  2551. @end table
  2552. @subsection Commands
  2553. This filter supports the following commands:
  2554. @table @option
  2555. @item frequency, f
  2556. Change highpass frequency.
  2557. Syntax for the command is : "@var{frequency}"
  2558. @item width_type, t
  2559. Change highpass width_type.
  2560. Syntax for the command is : "@var{width_type}"
  2561. @item width, w
  2562. Change highpass width.
  2563. Syntax for the command is : "@var{width}"
  2564. @end table
  2565. @section join
  2566. Join multiple input streams into one multi-channel stream.
  2567. It accepts the following parameters:
  2568. @table @option
  2569. @item inputs
  2570. The number of input streams. It defaults to 2.
  2571. @item channel_layout
  2572. The desired output channel layout. It defaults to stereo.
  2573. @item map
  2574. Map channels from inputs to output. The argument is a '|'-separated list of
  2575. mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
  2576. form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
  2577. can be either the name of the input channel (e.g. FL for front left) or its
  2578. index in the specified input stream. @var{out_channel} is the name of the output
  2579. channel.
  2580. @end table
  2581. The filter will attempt to guess the mappings when they are not specified
  2582. explicitly. It does so by first trying to find an unused matching input channel
  2583. and if that fails it picks the first unused input channel.
  2584. Join 3 inputs (with properly set channel layouts):
  2585. @example
  2586. ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
  2587. @end example
  2588. Build a 5.1 output from 6 single-channel streams:
  2589. @example
  2590. ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
  2591. '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'
  2592. out
  2593. @end example
  2594. @section ladspa
  2595. Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
  2596. To enable compilation of this filter you need to configure FFmpeg with
  2597. @code{--enable-ladspa}.
  2598. @table @option
  2599. @item file, f
  2600. Specifies the name of LADSPA plugin library to load. If the environment
  2601. variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
  2602. each one of the directories specified by the colon separated list in
  2603. @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
  2604. this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
  2605. @file{/usr/lib/ladspa/}.
  2606. @item plugin, p
  2607. Specifies the plugin within the library. Some libraries contain only
  2608. one plugin, but others contain many of them. If this is not set filter
  2609. will list all available plugins within the specified library.
  2610. @item controls, c
  2611. Set the '|' separated list of controls which are zero or more floating point
  2612. values that determine the behavior of the loaded plugin (for example delay,
  2613. threshold or gain).
  2614. Controls need to be defined using the following syntax:
  2615. c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
  2616. @var{valuei} is the value set on the @var{i}-th control.
  2617. Alternatively they can be also defined using the following syntax:
  2618. @var{value0}|@var{value1}|@var{value2}|..., where
  2619. @var{valuei} is the value set on the @var{i}-th control.
  2620. If @option{controls} is set to @code{help}, all available controls and
  2621. their valid ranges are printed.
  2622. @item sample_rate, s
  2623. Specify the sample rate, default to 44100. Only used if plugin have
  2624. zero inputs.
  2625. @item nb_samples, n
  2626. Set the number of samples per channel per each output frame, default
  2627. is 1024. Only used if plugin have zero inputs.
  2628. @item duration, d
  2629. Set the minimum duration of the sourced audio. See
  2630. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2631. for the accepted syntax.
  2632. Note that the resulting duration may be greater than the specified duration,
  2633. as the generated audio is always cut at the end of a complete frame.
  2634. If not specified, or the expressed duration is negative, the audio is
  2635. supposed to be generated forever.
  2636. Only used if plugin have zero inputs.
  2637. @end table
  2638. @subsection Examples
  2639. @itemize
  2640. @item
  2641. List all available plugins within amp (LADSPA example plugin) library:
  2642. @example
  2643. ladspa=file=amp
  2644. @end example
  2645. @item
  2646. List all available controls and their valid ranges for @code{vcf_notch}
  2647. plugin from @code{VCF} library:
  2648. @example
  2649. ladspa=f=vcf:p=vcf_notch:c=help
  2650. @end example
  2651. @item
  2652. Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
  2653. plugin library:
  2654. @example
  2655. ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
  2656. @end example
  2657. @item
  2658. Add reverberation to the audio using TAP-plugins
  2659. (Tom's Audio Processing plugins):
  2660. @example
  2661. ladspa=file=tap_reverb:tap_reverb
  2662. @end example
  2663. @item
  2664. Generate white noise, with 0.2 amplitude:
  2665. @example
  2666. ladspa=file=cmt:noise_source_white:c=c0=.2
  2667. @end example
  2668. @item
  2669. Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
  2670. @code{C* Audio Plugin Suite} (CAPS) library:
  2671. @example
  2672. ladspa=file=caps:Click:c=c1=20'
  2673. @end example
  2674. @item
  2675. Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
  2676. @example
  2677. ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
  2678. @end example
  2679. @item
  2680. Increase volume by 20dB using fast lookahead limiter from Steve Harris
  2681. @code{SWH Plugins} collection:
  2682. @example
  2683. ladspa=fast_lookahead_limiter_1913:fastLookaheadLimiter:20|0|2
  2684. @end example
  2685. @item
  2686. Attenuate low frequencies using Multiband EQ from Steve Harris
  2687. @code{SWH Plugins} collection:
  2688. @example
  2689. ladspa=mbeq_1197:mbeq:-24|-24|-24|0|0|0|0|0|0|0|0|0|0|0|0
  2690. @end example
  2691. @item
  2692. Reduce stereo image using @code{Narrower} from the @code{C* Audio Plugin Suite}
  2693. (CAPS) library:
  2694. @example
  2695. ladspa=caps:Narrower
  2696. @end example
  2697. @item
  2698. Another white noise, now using @code{C* Audio Plugin Suite} (CAPS) library:
  2699. @example
  2700. ladspa=caps:White:.2
  2701. @end example
  2702. @item
  2703. Some fractal noise, using @code{C* Audio Plugin Suite} (CAPS) library:
  2704. @example
  2705. ladspa=caps:Fractal:c=c1=1
  2706. @end example
  2707. @item
  2708. Dynamic volume normalization using @code{VLevel} plugin:
  2709. @example
  2710. ladspa=vlevel-ladspa:vlevel_mono
  2711. @end example
  2712. @end itemize
  2713. @subsection Commands
  2714. This filter supports the following commands:
  2715. @table @option
  2716. @item cN
  2717. Modify the @var{N}-th control value.
  2718. If the specified value is not valid, it is ignored and prior one is kept.
  2719. @end table
  2720. @section loudnorm
  2721. EBU R128 loudness normalization. Includes both dynamic and linear normalization modes.
  2722. Support for both single pass (livestreams, files) and double pass (files) modes.
  2723. This algorithm can target IL, LRA, and maximum true peak. To accurately detect true peaks,
  2724. the audio stream will be upsampled to 192 kHz unless the normalization mode is linear.
  2725. Use the @code{-ar} option or @code{aresample} filter to explicitly set an output sample rate.
  2726. The filter accepts the following options:
  2727. @table @option
  2728. @item I, i
  2729. Set integrated loudness target.
  2730. Range is -70.0 - -5.0. Default value is -24.0.
  2731. @item LRA, lra
  2732. Set loudness range target.
  2733. Range is 1.0 - 20.0. Default value is 7.0.
  2734. @item TP, tp
  2735. Set maximum true peak.
  2736. Range is -9.0 - +0.0. Default value is -2.0.
  2737. @item measured_I, measured_i
  2738. Measured IL of input file.
  2739. Range is -99.0 - +0.0.
  2740. @item measured_LRA, measured_lra
  2741. Measured LRA of input file.
  2742. Range is 0.0 - 99.0.
  2743. @item measured_TP, measured_tp
  2744. Measured true peak of input file.
  2745. Range is -99.0 - +99.0.
  2746. @item measured_thresh
  2747. Measured threshold of input file.
  2748. Range is -99.0 - +0.0.
  2749. @item offset
  2750. Set offset gain. Gain is applied before the true-peak limiter.
  2751. Range is -99.0 - +99.0. Default is +0.0.
  2752. @item linear
  2753. Normalize linearly if possible.
  2754. measured_I, measured_LRA, measured_TP, and measured_thresh must also
  2755. to be specified in order to use this mode.
  2756. Options are true or false. Default is true.
  2757. @item dual_mono
  2758. Treat mono input files as "dual-mono". If a mono file is intended for playback
  2759. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  2760. If set to @code{true}, this option will compensate for this effect.
  2761. Multi-channel input files are not affected by this option.
  2762. Options are true or false. Default is false.
  2763. @item print_format
  2764. Set print format for stats. Options are summary, json, or none.
  2765. Default value is none.
  2766. @end table
  2767. @section lowpass
  2768. Apply a low-pass filter with 3dB point frequency.
  2769. The filter can be either single-pole or double-pole (the default).
  2770. The filter roll off at 6dB per pole per octave (20dB per pole per decade).
  2771. The filter accepts the following options:
  2772. @table @option
  2773. @item frequency, f
  2774. Set frequency in Hz. Default is 500.
  2775. @item poles, p
  2776. Set number of poles. Default is 2.
  2777. @item width_type, t
  2778. Set method to specify band-width of filter.
  2779. @table @option
  2780. @item h
  2781. Hz
  2782. @item q
  2783. Q-Factor
  2784. @item o
  2785. octave
  2786. @item s
  2787. slope
  2788. @item k
  2789. kHz
  2790. @end table
  2791. @item width, w
  2792. Specify the band-width of a filter in width_type units.
  2793. Applies only to double-pole filter.
  2794. The default is 0.707q and gives a Butterworth response.
  2795. @item channels, c
  2796. Specify which channels to filter, by default all available are filtered.
  2797. @end table
  2798. @subsection Examples
  2799. @itemize
  2800. @item
  2801. Lowpass only LFE channel, it LFE is not present it does nothing:
  2802. @example
  2803. lowpass=c=LFE
  2804. @end example
  2805. @end itemize
  2806. @subsection Commands
  2807. This filter supports the following commands:
  2808. @table @option
  2809. @item frequency, f
  2810. Change lowpass frequency.
  2811. Syntax for the command is : "@var{frequency}"
  2812. @item width_type, t
  2813. Change lowpass width_type.
  2814. Syntax for the command is : "@var{width_type}"
  2815. @item width, w
  2816. Change lowpass width.
  2817. Syntax for the command is : "@var{width}"
  2818. @end table
  2819. @section lv2
  2820. Load a LV2 (LADSPA Version 2) plugin.
  2821. To enable compilation of this filter you need to configure FFmpeg with
  2822. @code{--enable-lv2}.
  2823. @table @option
  2824. @item plugin, p
  2825. Specifies the plugin URI. You may need to escape ':'.
  2826. @item controls, c
  2827. Set the '|' separated list of controls which are zero or more floating point
  2828. values that determine the behavior of the loaded plugin (for example delay,
  2829. threshold or gain).
  2830. If @option{controls} is set to @code{help}, all available controls and
  2831. their valid ranges are printed.
  2832. @item sample_rate, s
  2833. Specify the sample rate, default to 44100. Only used if plugin have
  2834. zero inputs.
  2835. @item nb_samples, n
  2836. Set the number of samples per channel per each output frame, default
  2837. is 1024. Only used if plugin have zero inputs.
  2838. @item duration, d
  2839. Set the minimum duration of the sourced audio. See
  2840. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  2841. for the accepted syntax.
  2842. Note that the resulting duration may be greater than the specified duration,
  2843. as the generated audio is always cut at the end of a complete frame.
  2844. If not specified, or the expressed duration is negative, the audio is
  2845. supposed to be generated forever.
  2846. Only used if plugin have zero inputs.
  2847. @end table
  2848. @subsection Examples
  2849. @itemize
  2850. @item
  2851. Apply bass enhancer plugin from Calf:
  2852. @example
  2853. lv2=p=http\\\\://calf.sourceforge.net/plugins/BassEnhancer:c=amount=2
  2854. @end example
  2855. @item
  2856. Apply vinyl plugin from Calf:
  2857. @example
  2858. lv2=p=http\\\\://calf.sourceforge.net/plugins/Vinyl:c=drone=0.2|aging=0.5
  2859. @end example
  2860. @item
  2861. Apply bit crusher plugin from ArtyFX:
  2862. @example
  2863. lv2=p=http\\\\://www.openavproductions.com/artyfx#bitta:c=crush=0.3
  2864. @end example
  2865. @end itemize
  2866. @section mcompand
  2867. Multiband Compress or expand the audio's dynamic range.
  2868. The input audio is divided into bands using 4th order Linkwitz-Riley IIRs.
  2869. This is akin to the crossover of a loudspeaker, and results in flat frequency
  2870. response when absent compander action.
  2871. It accepts the following parameters:
  2872. @table @option
  2873. @item args
  2874. This option syntax is:
  2875. attack,decay,[attack,decay..] soft-knee points crossover_frequency [delay [initial_volume [gain]]] | attack,decay ...
  2876. For explanation of each item refer to compand filter documentation.
  2877. @end table
  2878. @anchor{pan}
  2879. @section pan
  2880. Mix channels with specific gain levels. The filter accepts the output
  2881. channel layout followed by a set of channels definitions.
  2882. This filter is also designed to efficiently remap the channels of an audio
  2883. stream.
  2884. The filter accepts parameters of the form:
  2885. "@var{l}|@var{outdef}|@var{outdef}|..."
  2886. @table @option
  2887. @item l
  2888. output channel layout or number of channels
  2889. @item outdef
  2890. output channel specification, of the form:
  2891. "@var{out_name}=[@var{gain}*]@var{in_name}[(+-)[@var{gain}*]@var{in_name}...]"
  2892. @item out_name
  2893. output channel to define, either a channel name (FL, FR, etc.) or a channel
  2894. number (c0, c1, etc.)
  2895. @item gain
  2896. multiplicative coefficient for the channel, 1 leaving the volume unchanged
  2897. @item in_name
  2898. input channel to use, see out_name for details; it is not possible to mix
  2899. named and numbered input channels
  2900. @end table
  2901. If the `=' in a channel specification is replaced by `<', then the gains for
  2902. that specification will be renormalized so that the total is 1, thus
  2903. avoiding clipping noise.
  2904. @subsection Mixing examples
  2905. For example, if you want to down-mix from stereo to mono, but with a bigger
  2906. factor for the left channel:
  2907. @example
  2908. pan=1c|c0=0.9*c0+0.1*c1
  2909. @end example
  2910. A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
  2911. 7-channels surround:
  2912. @example
  2913. pan=stereo| FL < FL + 0.5*FC + 0.6*BL + 0.6*SL | FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
  2914. @end example
  2915. Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
  2916. that should be preferred (see "-ac" option) unless you have very specific
  2917. needs.
  2918. @subsection Remapping examples
  2919. The channel remapping will be effective if, and only if:
  2920. @itemize
  2921. @item gain coefficients are zeroes or ones,
  2922. @item only one input per channel output,
  2923. @end itemize
  2924. If all these conditions are satisfied, the filter will notify the user ("Pure
  2925. channel mapping detected"), and use an optimized and lossless method to do the
  2926. remapping.
  2927. For example, if you have a 5.1 source and want a stereo audio stream by
  2928. dropping the extra channels:
  2929. @example
  2930. pan="stereo| c0=FL | c1=FR"
  2931. @end example
  2932. Given the same source, you can also switch front left and front right channels
  2933. and keep the input channel layout:
  2934. @example
  2935. pan="5.1| c0=c1 | c1=c0 | c2=c2 | c3=c3 | c4=c4 | c5=c5"
  2936. @end example
  2937. If the input is a stereo audio stream, you can mute the front left channel (and
  2938. still keep the stereo channel layout) with:
  2939. @example
  2940. pan="stereo|c1=c1"
  2941. @end example
  2942. Still with a stereo audio stream input, you can copy the right channel in both
  2943. front left and right:
  2944. @example
  2945. pan="stereo| c0=FR | c1=FR"
  2946. @end example
  2947. @section replaygain
  2948. ReplayGain scanner filter. This filter takes an audio stream as an input and
  2949. outputs it unchanged.
  2950. At end of filtering it displays @code{track_gain} and @code{track_peak}.
  2951. @section resample
  2952. Convert the audio sample format, sample rate and channel layout. It is
  2953. not meant to be used directly.
  2954. @section rubberband
  2955. Apply time-stretching and pitch-shifting with librubberband.
  2956. The filter accepts the following options:
  2957. @table @option
  2958. @item tempo
  2959. Set tempo scale factor.
  2960. @item pitch
  2961. Set pitch scale factor.
  2962. @item transients
  2963. Set transients detector.
  2964. Possible values are:
  2965. @table @var
  2966. @item crisp
  2967. @item mixed
  2968. @item smooth
  2969. @end table
  2970. @item detector
  2971. Set detector.
  2972. Possible values are:
  2973. @table @var
  2974. @item compound
  2975. @item percussive
  2976. @item soft
  2977. @end table
  2978. @item phase
  2979. Set phase.
  2980. Possible values are:
  2981. @table @var
  2982. @item laminar
  2983. @item independent
  2984. @end table
  2985. @item window
  2986. Set processing window size.
  2987. Possible values are:
  2988. @table @var
  2989. @item standard
  2990. @item short
  2991. @item long
  2992. @end table
  2993. @item smoothing
  2994. Set smoothing.
  2995. Possible values are:
  2996. @table @var
  2997. @item off
  2998. @item on
  2999. @end table
  3000. @item formant
  3001. Enable formant preservation when shift pitching.
  3002. Possible values are:
  3003. @table @var
  3004. @item shifted
  3005. @item preserved
  3006. @end table
  3007. @item pitchq
  3008. Set pitch quality.
  3009. Possible values are:
  3010. @table @var
  3011. @item quality
  3012. @item speed
  3013. @item consistency
  3014. @end table
  3015. @item channels
  3016. Set channels.
  3017. Possible values are:
  3018. @table @var
  3019. @item apart
  3020. @item together
  3021. @end table
  3022. @end table
  3023. @section sidechaincompress
  3024. This filter acts like normal compressor but has the ability to compress
  3025. detected signal using second input signal.
  3026. It needs two input streams and returns one output stream.
  3027. First input stream will be processed depending on second stream signal.
  3028. The filtered signal then can be filtered with other filters in later stages of
  3029. processing. See @ref{pan} and @ref{amerge} filter.
  3030. The filter accepts the following options:
  3031. @table @option
  3032. @item level_in
  3033. Set input gain. Default is 1. Range is between 0.015625 and 64.
  3034. @item threshold
  3035. If a signal of second stream raises above this level it will affect the gain
  3036. reduction of first stream.
  3037. By default is 0.125. Range is between 0.00097563 and 1.
  3038. @item ratio
  3039. Set a ratio about which the signal is reduced. 1:2 means that if the level
  3040. raised 4dB above the threshold, it will be only 2dB above after the reduction.
  3041. Default is 2. Range is between 1 and 20.
  3042. @item attack
  3043. Amount of milliseconds the signal has to rise above the threshold before gain
  3044. reduction starts. Default is 20. Range is between 0.01 and 2000.
  3045. @item release
  3046. Amount of milliseconds the signal has to fall below the threshold before
  3047. reduction is decreased again. Default is 250. Range is between 0.01 and 9000.
  3048. @item makeup
  3049. Set the amount by how much signal will be amplified after processing.
  3050. Default is 1. Range is from 1 to 64.
  3051. @item knee
  3052. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3053. Default is 2.82843. Range is between 1 and 8.
  3054. @item link
  3055. Choose if the @code{average} level between all channels of side-chain stream
  3056. or the louder(@code{maximum}) channel of side-chain stream affects the
  3057. reduction. Default is @code{average}.
  3058. @item detection
  3059. Should the exact signal be taken in case of @code{peak} or an RMS one in case
  3060. of @code{rms}. Default is @code{rms} which is mainly smoother.
  3061. @item level_sc
  3062. Set sidechain gain. Default is 1. Range is between 0.015625 and 64.
  3063. @item mix
  3064. How much to use compressed signal in output. Default is 1.
  3065. Range is between 0 and 1.
  3066. @end table
  3067. @subsection Examples
  3068. @itemize
  3069. @item
  3070. Full ffmpeg example taking 2 audio inputs, 1st input to be compressed
  3071. depending on the signal of 2nd input and later compressed signal to be
  3072. merged with 2nd input:
  3073. @example
  3074. ffmpeg -i main.flac -i sidechain.flac -filter_complex "[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress[compr];[compr][mix]amerge"
  3075. @end example
  3076. @end itemize
  3077. @section sidechaingate
  3078. A sidechain gate acts like a normal (wideband) gate but has the ability to
  3079. filter the detected signal before sending it to the gain reduction stage.
  3080. Normally a gate uses the full range signal to detect a level above the
  3081. threshold.
  3082. For example: If you cut all lower frequencies from your sidechain signal
  3083. the gate will decrease the volume of your track only if not enough highs
  3084. appear. With this technique you are able to reduce the resonation of a
  3085. natural drum or remove "rumbling" of muted strokes from a heavily distorted
  3086. guitar.
  3087. It needs two input streams and returns one output stream.
  3088. First input stream will be processed depending on second stream signal.
  3089. The filter accepts the following options:
  3090. @table @option
  3091. @item level_in
  3092. Set input level before filtering.
  3093. Default is 1. Allowed range is from 0.015625 to 64.
  3094. @item range
  3095. Set the level of gain reduction when the signal is below the threshold.
  3096. Default is 0.06125. Allowed range is from 0 to 1.
  3097. @item threshold
  3098. If a signal rises above this level the gain reduction is released.
  3099. Default is 0.125. Allowed range is from 0 to 1.
  3100. @item ratio
  3101. Set a ratio about which the signal is reduced.
  3102. Default is 2. Allowed range is from 1 to 9000.
  3103. @item attack
  3104. Amount of milliseconds the signal has to rise above the threshold before gain
  3105. reduction stops.
  3106. Default is 20 milliseconds. Allowed range is from 0.01 to 9000.
  3107. @item release
  3108. Amount of milliseconds the signal has to fall below the threshold before the
  3109. reduction is increased again. Default is 250 milliseconds.
  3110. Allowed range is from 0.01 to 9000.
  3111. @item makeup
  3112. Set amount of amplification of signal after processing.
  3113. Default is 1. Allowed range is from 1 to 64.
  3114. @item knee
  3115. Curve the sharp knee around the threshold to enter gain reduction more softly.
  3116. Default is 2.828427125. Allowed range is from 1 to 8.
  3117. @item detection
  3118. Choose if exact signal should be taken for detection or an RMS like one.
  3119. Default is rms. Can be peak or rms.
  3120. @item link
  3121. Choose if the average level between all channels or the louder channel affects
  3122. the reduction.
  3123. Default is average. Can be average or maximum.
  3124. @item level_sc
  3125. Set sidechain gain. Default is 1. Range is from 0.015625 to 64.
  3126. @end table
  3127. @section silencedetect
  3128. Detect silence in an audio stream.
  3129. This filter logs a message when it detects that the input audio volume is less
  3130. or equal to a noise tolerance value for a duration greater or equal to the
  3131. minimum detected noise duration.
  3132. The printed times and duration are expressed in seconds.
  3133. The filter accepts the following options:
  3134. @table @option
  3135. @item duration, d
  3136. Set silence duration until notification (default is 2 seconds).
  3137. @item noise, n
  3138. Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
  3139. specified value) or amplitude ratio. Default is -60dB, or 0.001.
  3140. @end table
  3141. @subsection Examples
  3142. @itemize
  3143. @item
  3144. Detect 5 seconds of silence with -50dB noise tolerance:
  3145. @example
  3146. silencedetect=n=-50dB:d=5
  3147. @end example
  3148. @item
  3149. Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
  3150. tolerance in @file{silence.mp3}:
  3151. @example
  3152. ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
  3153. @end example
  3154. @end itemize
  3155. @section silenceremove
  3156. Remove silence from the beginning, middle or end of the audio.
  3157. The filter accepts the following options:
  3158. @table @option
  3159. @item start_periods
  3160. This value is used to indicate if audio should be trimmed at beginning of
  3161. the audio. A value of zero indicates no silence should be trimmed from the
  3162. beginning. When specifying a non-zero value, it trims audio up until it
  3163. finds non-silence. Normally, when trimming silence from beginning of audio
  3164. the @var{start_periods} will be @code{1} but it can be increased to higher
  3165. values to trim all audio up to specific count of non-silence periods.
  3166. Default value is @code{0}.
  3167. @item start_duration
  3168. Specify the amount of time that non-silence must be detected before it stops
  3169. trimming audio. By increasing the duration, bursts of noises can be treated
  3170. as silence and trimmed off. Default value is @code{0}.
  3171. @item start_threshold
  3172. This indicates what sample value should be treated as silence. For digital
  3173. audio, a value of @code{0} may be fine but for audio recorded from analog,
  3174. you may wish to increase the value to account for background noise.
  3175. Can be specified in dB (in case "dB" is appended to the specified value)
  3176. or amplitude ratio. Default value is @code{0}.
  3177. @item stop_periods
  3178. Set the count for trimming silence from the end of audio.
  3179. To remove silence from the middle of a file, specify a @var{stop_periods}
  3180. that is negative. This value is then treated as a positive value and is
  3181. used to indicate the effect should restart processing as specified by
  3182. @var{start_periods}, making it suitable for removing periods of silence
  3183. in the middle of the audio.
  3184. Default value is @code{0}.
  3185. @item stop_duration
  3186. Specify a duration of silence that must exist before audio is not copied any
  3187. more. By specifying a higher duration, silence that is wanted can be left in
  3188. the audio.
  3189. Default value is @code{0}.
  3190. @item stop_threshold
  3191. This is the same as @option{start_threshold} but for trimming silence from
  3192. the end of audio.
  3193. Can be specified in dB (in case "dB" is appended to the specified value)
  3194. or amplitude ratio. Default value is @code{0}.
  3195. @item leave_silence
  3196. This indicates that @var{stop_duration} length of audio should be left intact
  3197. at the beginning of each period of silence.
  3198. For example, if you want to remove long pauses between words but do not want
  3199. to remove the pauses completely. Default value is @code{0}.
  3200. @item detection
  3201. Set how is silence detected. Can be @code{rms} or @code{peak}. Second is faster
  3202. and works better with digital silence which is exactly 0.
  3203. Default value is @code{rms}.
  3204. @item window
  3205. Set ratio used to calculate size of window for detecting silence.
  3206. Default value is @code{0.02}. Allowed range is from @code{0} to @code{10}.
  3207. @end table
  3208. @subsection Examples
  3209. @itemize
  3210. @item
  3211. The following example shows how this filter can be used to start a recording
  3212. that does not contain the delay at the start which usually occurs between
  3213. pressing the record button and the start of the performance:
  3214. @example
  3215. silenceremove=1:5:0.02
  3216. @end example
  3217. @item
  3218. Trim all silence encountered from beginning to end where there is more than 1
  3219. second of silence in audio:
  3220. @example
  3221. silenceremove=0:0:0:-1:1:-90dB
  3222. @end example
  3223. @end itemize
  3224. @section sofalizer
  3225. SOFAlizer uses head-related transfer functions (HRTFs) to create virtual
  3226. loudspeakers around the user for binaural listening via headphones (audio
  3227. formats up to 9 channels supported).
  3228. The HRTFs are stored in SOFA files (see @url{http://www.sofacoustics.org/} for a database).
  3229. SOFAlizer is developed at the Acoustics Research Institute (ARI) of the
  3230. Austrian Academy of Sciences.
  3231. To enable compilation of this filter you need to configure FFmpeg with
  3232. @code{--enable-libmysofa}.
  3233. The filter accepts the following options:
  3234. @table @option
  3235. @item sofa
  3236. Set the SOFA file used for rendering.
  3237. @item gain
  3238. Set gain applied to audio. Value is in dB. Default is 0.
  3239. @item rotation
  3240. Set rotation of virtual loudspeakers in deg. Default is 0.
  3241. @item elevation
  3242. Set elevation of virtual speakers in deg. Default is 0.
  3243. @item radius
  3244. Set distance in meters between loudspeakers and the listener with near-field
  3245. HRTFs. Default is 1.
  3246. @item type
  3247. Set processing type. Can be @var{time} or @var{freq}. @var{time} is
  3248. processing audio in time domain which is slow.
  3249. @var{freq} is processing audio in frequency domain which is fast.
  3250. Default is @var{freq}.
  3251. @item speakers
  3252. Set custom positions of virtual loudspeakers. Syntax for this option is:
  3253. <CH> <AZIM> <ELEV>[|<CH> <AZIM> <ELEV>|...].
  3254. Each virtual loudspeaker is described with short channel name following with
  3255. azimuth and elevation in degrees.
  3256. Each virtual loudspeaker description is separated by '|'.
  3257. For example to override front left and front right channel positions use:
  3258. 'speakers=FL 45 15|FR 345 15'.
  3259. Descriptions with unrecognised channel names are ignored.
  3260. @item lfegain
  3261. Set custom gain for LFE channels. Value is in dB. Default is 0.
  3262. @end table
  3263. @subsection Examples
  3264. @itemize
  3265. @item
  3266. Using ClubFritz6 sofa file:
  3267. @example
  3268. sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=1
  3269. @end example
  3270. @item
  3271. Using ClubFritz12 sofa file and bigger radius with small rotation:
  3272. @example
  3273. sofalizer=sofa=/path/to/ClubFritz12.sofa:type=freq:radius=2:rotation=5
  3274. @end example
  3275. @item
  3276. Similar as above but with custom speaker positions for front left, front right, back left and back right
  3277. and also with custom gain:
  3278. @example
  3279. "sofalizer=sofa=/path/to/ClubFritz6.sofa:type=freq:radius=2:speakers=FL 45|FR 315|BL 135|BR 225:gain=28"
  3280. @end example
  3281. @end itemize
  3282. @section stereotools
  3283. This filter has some handy utilities to manage stereo signals, for converting
  3284. M/S stereo recordings to L/R signal while having control over the parameters
  3285. or spreading the stereo image of master track.
  3286. The filter accepts the following options:
  3287. @table @option
  3288. @item level_in
  3289. Set input level before filtering for both channels. Defaults is 1.
  3290. Allowed range is from 0.015625 to 64.
  3291. @item level_out
  3292. Set output level after filtering for both channels. Defaults is 1.
  3293. Allowed range is from 0.015625 to 64.
  3294. @item balance_in
  3295. Set input balance between both channels. Default is 0.
  3296. Allowed range is from -1 to 1.
  3297. @item balance_out
  3298. Set output balance between both channels. Default is 0.
  3299. Allowed range is from -1 to 1.
  3300. @item softclip
  3301. Enable softclipping. Results in analog distortion instead of harsh digital 0dB
  3302. clipping. Disabled by default.
  3303. @item mutel
  3304. Mute the left channel. Disabled by default.
  3305. @item muter
  3306. Mute the right channel. Disabled by default.
  3307. @item phasel
  3308. Change the phase of the left channel. Disabled by default.
  3309. @item phaser
  3310. Change the phase of the right channel. Disabled by default.
  3311. @item mode
  3312. Set stereo mode. Available values are:
  3313. @table @samp
  3314. @item lr>lr
  3315. Left/Right to Left/Right, this is default.
  3316. @item lr>ms
  3317. Left/Right to Mid/Side.
  3318. @item ms>lr
  3319. Mid/Side to Left/Right.
  3320. @item lr>ll
  3321. Left/Right to Left/Left.
  3322. @item lr>rr
  3323. Left/Right to Right/Right.
  3324. @item lr>l+r
  3325. Left/Right to Left + Right.
  3326. @item lr>rl
  3327. Left/Right to Right/Left.
  3328. @item ms>ll
  3329. Mid/Side to Left/Left.
  3330. @item ms>rr
  3331. Mid/Side to Right/Right.
  3332. @end table
  3333. @item slev
  3334. Set level of side signal. Default is 1.
  3335. Allowed range is from 0.015625 to 64.
  3336. @item sbal
  3337. Set balance of side signal. Default is 0.
  3338. Allowed range is from -1 to 1.
  3339. @item mlev
  3340. Set level of the middle signal. Default is 1.
  3341. Allowed range is from 0.015625 to 64.
  3342. @item mpan
  3343. Set middle signal pan. Default is 0. Allowed range is from -1 to 1.
  3344. @item base
  3345. Set stereo base between mono and inversed channels. Default is 0.
  3346. Allowed range is from -1 to 1.
  3347. @item delay
  3348. Set delay in milliseconds how much to delay left from right channel and
  3349. vice versa. Default is 0. Allowed range is from -20 to 20.
  3350. @item sclevel
  3351. Set S/C level. Default is 1. Allowed range is from 1 to 100.
  3352. @item phase
  3353. Set the stereo phase in degrees. Default is 0. Allowed range is from 0 to 360.
  3354. @item bmode_in, bmode_out
  3355. Set balance mode for balance_in/balance_out option.
  3356. Can be one of the following:
  3357. @table @samp
  3358. @item balance
  3359. Classic balance mode. Attenuate one channel at time.
  3360. Gain is raised up to 1.
  3361. @item amplitude
  3362. Similar as classic mode above but gain is raised up to 2.
  3363. @item power
  3364. Equal power distribution, from -6dB to +6dB range.
  3365. @end table
  3366. @end table
  3367. @subsection Examples
  3368. @itemize
  3369. @item
  3370. Apply karaoke like effect:
  3371. @example
  3372. stereotools=mlev=0.015625
  3373. @end example
  3374. @item
  3375. Convert M/S signal to L/R:
  3376. @example
  3377. "stereotools=mode=ms>lr"
  3378. @end example
  3379. @end itemize
  3380. @section stereowiden
  3381. This filter enhance the stereo effect by suppressing signal common to both
  3382. channels and by delaying the signal of left into right and vice versa,
  3383. thereby widening the stereo effect.
  3384. The filter accepts the following options:
  3385. @table @option
  3386. @item delay
  3387. Time in milliseconds of the delay of left signal into right and vice versa.
  3388. Default is 20 milliseconds.
  3389. @item feedback
  3390. Amount of gain in delayed signal into right and vice versa. Gives a delay
  3391. effect of left signal in right output and vice versa which gives widening
  3392. effect. Default is 0.3.
  3393. @item crossfeed
  3394. Cross feed of left into right with inverted phase. This helps in suppressing
  3395. the mono. If the value is 1 it will cancel all the signal common to both
  3396. channels. Default is 0.3.
  3397. @item drymix
  3398. Set level of input signal of original channel. Default is 0.8.
  3399. @end table
  3400. @section superequalizer
  3401. Apply 18 band equalizer.
  3402. The filter accepts the following options:
  3403. @table @option
  3404. @item 1b
  3405. Set 65Hz band gain.
  3406. @item 2b
  3407. Set 92Hz band gain.
  3408. @item 3b
  3409. Set 131Hz band gain.
  3410. @item 4b
  3411. Set 185Hz band gain.
  3412. @item 5b
  3413. Set 262Hz band gain.
  3414. @item 6b
  3415. Set 370Hz band gain.
  3416. @item 7b
  3417. Set 523Hz band gain.
  3418. @item 8b
  3419. Set 740Hz band gain.
  3420. @item 9b
  3421. Set 1047Hz band gain.
  3422. @item 10b
  3423. Set 1480Hz band gain.
  3424. @item 11b
  3425. Set 2093Hz band gain.
  3426. @item 12b
  3427. Set 2960Hz band gain.
  3428. @item 13b
  3429. Set 4186Hz band gain.
  3430. @item 14b
  3431. Set 5920Hz band gain.
  3432. @item 15b
  3433. Set 8372Hz band gain.
  3434. @item 16b
  3435. Set 11840Hz band gain.
  3436. @item 17b
  3437. Set 16744Hz band gain.
  3438. @item 18b
  3439. Set 20000Hz band gain.
  3440. @end table
  3441. @section surround
  3442. Apply audio surround upmix filter.
  3443. This filter allows to produce multichannel output from audio stream.
  3444. The filter accepts the following options:
  3445. @table @option
  3446. @item chl_out
  3447. Set output channel layout. By default, this is @var{5.1}.
  3448. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3449. for the required syntax.
  3450. @item chl_in
  3451. Set input channel layout. By default, this is @var{stereo}.
  3452. See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3453. for the required syntax.
  3454. @item level_in
  3455. Set input volume level. By default, this is @var{1}.
  3456. @item level_out
  3457. Set output volume level. By default, this is @var{1}.
  3458. @item lfe
  3459. Enable LFE channel output if output channel layout has it. By default, this is enabled.
  3460. @item lfe_low
  3461. Set LFE low cut off frequency. By default, this is @var{128} Hz.
  3462. @item lfe_high
  3463. Set LFE high cut off frequency. By default, this is @var{256} Hz.
  3464. @item fc_in
  3465. Set front center input volume. By default, this is @var{1}.
  3466. @item fc_out
  3467. Set front center output volume. By default, this is @var{1}.
  3468. @item lfe_in
  3469. Set LFE input volume. By default, this is @var{1}.
  3470. @item lfe_out
  3471. Set LFE output volume. By default, this is @var{1}.
  3472. @end table
  3473. @section treble, highshelf
  3474. Boost or cut treble (upper) frequencies of the audio using a two-pole
  3475. shelving filter with a response similar to that of a standard
  3476. hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
  3477. The filter accepts the following options:
  3478. @table @option
  3479. @item gain, g
  3480. Give the gain at whichever is the lower of ~22 kHz and the
  3481. Nyquist frequency. Its useful range is about -20 (for a large cut)
  3482. to +20 (for a large boost). Beware of clipping when using a positive gain.
  3483. @item frequency, f
  3484. Set the filter's central frequency and so can be used
  3485. to extend or reduce the frequency range to be boosted or cut.
  3486. The default value is @code{3000} Hz.
  3487. @item width_type, t
  3488. Set method to specify band-width of filter.
  3489. @table @option
  3490. @item h
  3491. Hz
  3492. @item q
  3493. Q-Factor
  3494. @item o
  3495. octave
  3496. @item s
  3497. slope
  3498. @item k
  3499. kHz
  3500. @end table
  3501. @item width, w
  3502. Determine how steep is the filter's shelf transition.
  3503. @item channels, c
  3504. Specify which channels to filter, by default all available are filtered.
  3505. @end table
  3506. @subsection Commands
  3507. This filter supports the following commands:
  3508. @table @option
  3509. @item frequency, f
  3510. Change treble frequency.
  3511. Syntax for the command is : "@var{frequency}"
  3512. @item width_type, t
  3513. Change treble width_type.
  3514. Syntax for the command is : "@var{width_type}"
  3515. @item width, w
  3516. Change treble width.
  3517. Syntax for the command is : "@var{width}"
  3518. @item gain, g
  3519. Change treble gain.
  3520. Syntax for the command is : "@var{gain}"
  3521. @end table
  3522. @section tremolo
  3523. Sinusoidal amplitude modulation.
  3524. The filter accepts the following options:
  3525. @table @option
  3526. @item f
  3527. Modulation frequency in Hertz. Modulation frequencies in the subharmonic range
  3528. (20 Hz or lower) will result in a tremolo effect.
  3529. This filter may also be used as a ring modulator by specifying
  3530. a modulation frequency higher than 20 Hz.
  3531. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3532. @item d
  3533. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3534. Default value is 0.5.
  3535. @end table
  3536. @section vibrato
  3537. Sinusoidal phase modulation.
  3538. The filter accepts the following options:
  3539. @table @option
  3540. @item f
  3541. Modulation frequency in Hertz.
  3542. Range is 0.1 - 20000.0. Default value is 5.0 Hz.
  3543. @item d
  3544. Depth of modulation as a percentage. Range is 0.0 - 1.0.
  3545. Default value is 0.5.
  3546. @end table
  3547. @section volume
  3548. Adjust the input audio volume.
  3549. It accepts the following parameters:
  3550. @table @option
  3551. @item volume
  3552. Set audio volume expression.
  3553. Output values are clipped to the maximum value.
  3554. The output audio volume is given by the relation:
  3555. @example
  3556. @var{output_volume} = @var{volume} * @var{input_volume}
  3557. @end example
  3558. The default value for @var{volume} is "1.0".
  3559. @item precision
  3560. This parameter represents the mathematical precision.
  3561. It determines which input sample formats will be allowed, which affects the
  3562. precision of the volume scaling.
  3563. @table @option
  3564. @item fixed
  3565. 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
  3566. @item float
  3567. 32-bit floating-point; this limits input sample format to FLT. (default)
  3568. @item double
  3569. 64-bit floating-point; this limits input sample format to DBL.
  3570. @end table
  3571. @item replaygain
  3572. Choose the behaviour on encountering ReplayGain side data in input frames.
  3573. @table @option
  3574. @item drop
  3575. Remove ReplayGain side data, ignoring its contents (the default).
  3576. @item ignore
  3577. Ignore ReplayGain side data, but leave it in the frame.
  3578. @item track
  3579. Prefer the track gain, if present.
  3580. @item album
  3581. Prefer the album gain, if present.
  3582. @end table
  3583. @item replaygain_preamp
  3584. Pre-amplification gain in dB to apply to the selected replaygain gain.
  3585. Default value for @var{replaygain_preamp} is 0.0.
  3586. @item eval
  3587. Set when the volume expression is evaluated.
  3588. It accepts the following values:
  3589. @table @samp
  3590. @item once
  3591. only evaluate expression once during the filter initialization, or
  3592. when the @samp{volume} command is sent
  3593. @item frame
  3594. evaluate expression for each incoming frame
  3595. @end table
  3596. Default value is @samp{once}.
  3597. @end table
  3598. The volume expression can contain the following parameters.
  3599. @table @option
  3600. @item n
  3601. frame number (starting at zero)
  3602. @item nb_channels
  3603. number of channels
  3604. @item nb_consumed_samples
  3605. number of samples consumed by the filter
  3606. @item nb_samples
  3607. number of samples in the current frame
  3608. @item pos
  3609. original frame position in the file
  3610. @item pts
  3611. frame PTS
  3612. @item sample_rate
  3613. sample rate
  3614. @item startpts
  3615. PTS at start of stream
  3616. @item startt
  3617. time at start of stream
  3618. @item t
  3619. frame time
  3620. @item tb
  3621. timestamp timebase
  3622. @item volume
  3623. last set volume value
  3624. @end table
  3625. Note that when @option{eval} is set to @samp{once} only the
  3626. @var{sample_rate} and @var{tb} variables are available, all other
  3627. variables will evaluate to NAN.
  3628. @subsection Commands
  3629. This filter supports the following commands:
  3630. @table @option
  3631. @item volume
  3632. Modify the volume expression.
  3633. The command accepts the same syntax of the corresponding option.
  3634. If the specified expression is not valid, it is kept at its current
  3635. value.
  3636. @item replaygain_noclip
  3637. Prevent clipping by limiting the gain applied.
  3638. Default value for @var{replaygain_noclip} is 1.
  3639. @end table
  3640. @subsection Examples
  3641. @itemize
  3642. @item
  3643. Halve the input audio volume:
  3644. @example
  3645. volume=volume=0.5
  3646. volume=volume=1/2
  3647. volume=volume=-6.0206dB
  3648. @end example
  3649. In all the above example the named key for @option{volume} can be
  3650. omitted, for example like in:
  3651. @example
  3652. volume=0.5
  3653. @end example
  3654. @item
  3655. Increase input audio power by 6 decibels using fixed-point precision:
  3656. @example
  3657. volume=volume=6dB:precision=fixed
  3658. @end example
  3659. @item
  3660. Fade volume after time 10 with an annihilation period of 5 seconds:
  3661. @example
  3662. volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
  3663. @end example
  3664. @end itemize
  3665. @section volumedetect
  3666. Detect the volume of the input video.
  3667. The filter has no parameters. The input is not modified. Statistics about
  3668. the volume will be printed in the log when the input stream end is reached.
  3669. In particular it will show the mean volume (root mean square), maximum
  3670. volume (on a per-sample basis), and the beginning of a histogram of the
  3671. registered volume values (from the maximum value to a cumulated 1/1000 of
  3672. the samples).
  3673. All volumes are in decibels relative to the maximum PCM value.
  3674. @subsection Examples
  3675. Here is an excerpt of the output:
  3676. @example
  3677. [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
  3678. [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
  3679. [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
  3680. [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
  3681. [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
  3682. [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
  3683. [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
  3684. [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
  3685. [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
  3686. @end example
  3687. It means that:
  3688. @itemize
  3689. @item
  3690. The mean square energy is approximately -27 dB, or 10^-2.7.
  3691. @item
  3692. The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
  3693. @item
  3694. There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
  3695. @end itemize
  3696. In other words, raising the volume by +4 dB does not cause any clipping,
  3697. raising it by +5 dB causes clipping for 6 samples, etc.
  3698. @c man end AUDIO FILTERS
  3699. @chapter Audio Sources
  3700. @c man begin AUDIO SOURCES
  3701. Below is a description of the currently available audio sources.
  3702. @section abuffer
  3703. Buffer audio frames, and make them available to the filter chain.
  3704. This source is mainly intended for a programmatic use, in particular
  3705. through the interface defined in @file{libavfilter/asrc_abuffer.h}.
  3706. It accepts the following parameters:
  3707. @table @option
  3708. @item time_base
  3709. The timebase which will be used for timestamps of submitted frames. It must be
  3710. either a floating-point number or in @var{numerator}/@var{denominator} form.
  3711. @item sample_rate
  3712. The sample rate of the incoming audio buffers.
  3713. @item sample_fmt
  3714. The sample format of the incoming audio buffers.
  3715. Either a sample format name or its corresponding integer representation from
  3716. the enum AVSampleFormat in @file{libavutil/samplefmt.h}
  3717. @item channel_layout
  3718. The channel layout of the incoming audio buffers.
  3719. Either a channel layout name from channel_layout_map in
  3720. @file{libavutil/channel_layout.c} or its corresponding integer representation
  3721. from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
  3722. @item channels
  3723. The number of channels of the incoming audio buffers.
  3724. If both @var{channels} and @var{channel_layout} are specified, then they
  3725. must be consistent.
  3726. @end table
  3727. @subsection Examples
  3728. @example
  3729. abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
  3730. @end example
  3731. will instruct the source to accept planar 16bit signed stereo at 44100Hz.
  3732. Since the sample format with name "s16p" corresponds to the number
  3733. 6 and the "stereo" channel layout corresponds to the value 0x3, this is
  3734. equivalent to:
  3735. @example
  3736. abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
  3737. @end example
  3738. @section aevalsrc
  3739. Generate an audio signal specified by an expression.
  3740. This source accepts in input one or more expressions (one for each
  3741. channel), which are evaluated and used to generate a corresponding
  3742. audio signal.
  3743. This source accepts the following options:
  3744. @table @option
  3745. @item exprs
  3746. Set the '|'-separated expressions list for each separate channel. In case the
  3747. @option{channel_layout} option is not specified, the selected channel layout
  3748. depends on the number of provided expressions. Otherwise the last
  3749. specified expression is applied to the remaining output channels.
  3750. @item channel_layout, c
  3751. Set the channel layout. The number of channels in the specified layout
  3752. must be equal to the number of specified expressions.
  3753. @item duration, d
  3754. Set the minimum duration of the sourced audio. See
  3755. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  3756. for the accepted syntax.
  3757. Note that the resulting duration may be greater than the specified
  3758. duration, as the generated audio is always cut at the end of a
  3759. complete frame.
  3760. If not specified, or the expressed duration is negative, the audio is
  3761. supposed to be generated forever.
  3762. @item nb_samples, n
  3763. Set the number of samples per channel per each output frame,
  3764. default to 1024.
  3765. @item sample_rate, s
  3766. Specify the sample rate, default to 44100.
  3767. @end table
  3768. Each expression in @var{exprs} can contain the following constants:
  3769. @table @option
  3770. @item n
  3771. number of the evaluated sample, starting from 0
  3772. @item t
  3773. time of the evaluated sample expressed in seconds, starting from 0
  3774. @item s
  3775. sample rate
  3776. @end table
  3777. @subsection Examples
  3778. @itemize
  3779. @item
  3780. Generate silence:
  3781. @example
  3782. aevalsrc=0
  3783. @end example
  3784. @item
  3785. Generate a sin signal with frequency of 440 Hz, set sample rate to
  3786. 8000 Hz:
  3787. @example
  3788. aevalsrc="sin(440*2*PI*t):s=8000"
  3789. @end example
  3790. @item
  3791. Generate a two channels signal, specify the channel layout (Front
  3792. Center + Back Center) explicitly:
  3793. @example
  3794. aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
  3795. @end example
  3796. @item
  3797. Generate white noise:
  3798. @example
  3799. aevalsrc="-2+random(0)"
  3800. @end example
  3801. @item
  3802. Generate an amplitude modulated signal:
  3803. @example
  3804. aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
  3805. @end example
  3806. @item
  3807. Generate 2.5 Hz binaural beats on a 360 Hz carrier:
  3808. @example
  3809. aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
  3810. @end example
  3811. @end itemize
  3812. @section anullsrc
  3813. The null audio source, return unprocessed audio frames. It is mainly useful
  3814. as a template and to be employed in analysis / debugging tools, or as
  3815. the source for filters which ignore the input data (for example the sox
  3816. synth filter).
  3817. This source accepts the following options:
  3818. @table @option
  3819. @item channel_layout, cl
  3820. Specifies the channel layout, and can be either an integer or a string
  3821. representing a channel layout. The default value of @var{channel_layout}
  3822. is "stereo".
  3823. Check the channel_layout_map definition in
  3824. @file{libavutil/channel_layout.c} for the mapping between strings and
  3825. channel layout values.
  3826. @item sample_rate, r
  3827. Specifies the sample rate, and defaults to 44100.
  3828. @item nb_samples, n
  3829. Set the number of samples per requested frames.
  3830. @end table
  3831. @subsection Examples
  3832. @itemize
  3833. @item
  3834. Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
  3835. @example
  3836. anullsrc=r=48000:cl=4
  3837. @end example
  3838. @item
  3839. Do the same operation with a more obvious syntax:
  3840. @example
  3841. anullsrc=r=48000:cl=mono
  3842. @end example
  3843. @end itemize
  3844. All the parameters need to be explicitly defined.
  3845. @section flite
  3846. Synthesize a voice utterance using the libflite library.
  3847. To enable compilation of this filter you need to configure FFmpeg with
  3848. @code{--enable-libflite}.
  3849. Note that versions of the flite library prior to 2.0 are not thread-safe.
  3850. The filter accepts the following options:
  3851. @table @option
  3852. @item list_voices
  3853. If set to 1, list the names of the available voices and exit
  3854. immediately. Default value is 0.
  3855. @item nb_samples, n
  3856. Set the maximum number of samples per frame. Default value is 512.
  3857. @item textfile
  3858. Set the filename containing the text to speak.
  3859. @item text
  3860. Set the text to speak.
  3861. @item voice, v
  3862. Set the voice to use for the speech synthesis. Default value is
  3863. @code{kal}. See also the @var{list_voices} option.
  3864. @end table
  3865. @subsection Examples
  3866. @itemize
  3867. @item
  3868. Read from file @file{speech.txt}, and synthesize the text using the
  3869. standard flite voice:
  3870. @example
  3871. flite=textfile=speech.txt
  3872. @end example
  3873. @item
  3874. Read the specified text selecting the @code{slt} voice:
  3875. @example
  3876. flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3877. @end example
  3878. @item
  3879. Input text to ffmpeg:
  3880. @example
  3881. ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
  3882. @end example
  3883. @item
  3884. Make @file{ffplay} speak the specified text, using @code{flite} and
  3885. the @code{lavfi} device:
  3886. @example
  3887. ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
  3888. @end example
  3889. @end itemize
  3890. For more information about libflite, check:
  3891. @url{http://www.festvox.org/flite/}
  3892. @section anoisesrc
  3893. Generate a noise audio signal.
  3894. The filter accepts the following options:
  3895. @table @option
  3896. @item sample_rate, r
  3897. Specify the sample rate. Default value is 48000 Hz.
  3898. @item amplitude, a
  3899. Specify the amplitude (0.0 - 1.0) of the generated audio stream. Default value
  3900. is 1.0.
  3901. @item duration, d
  3902. Specify the duration of the generated audio stream. Not specifying this option
  3903. results in noise with an infinite length.
  3904. @item color, colour, c
  3905. Specify the color of noise. Available noise colors are white, pink, brown,
  3906. blue and violet. Default color is white.
  3907. @item seed, s
  3908. Specify a value used to seed the PRNG.
  3909. @item nb_samples, n
  3910. Set the number of samples per each output frame, default is 1024.
  3911. @end table
  3912. @subsection Examples
  3913. @itemize
  3914. @item
  3915. Generate 60 seconds of pink noise, with a 44.1 kHz sampling rate and an amplitude of 0.5:
  3916. @example
  3917. anoisesrc=d=60:c=pink:r=44100:a=0.5
  3918. @end example
  3919. @end itemize
  3920. @section hilbert
  3921. Generate odd-tap Hilbert transform FIR coefficients.
  3922. The resulting stream can be used with @ref{afir} filter for phase-shifting
  3923. the signal by 90 degrees.
  3924. This is used in many matrix coding schemes and for analytic signal generation.
  3925. The process is often written as a multiplication by i (or j), the imaginary unit.
  3926. The filter accepts the following options:
  3927. @table @option
  3928. @item sample_rate, s
  3929. Set sample rate, default is 44100.
  3930. @item taps, t
  3931. Set length of FIR filter, default is 22051.
  3932. @item nb_samples, n
  3933. Set number of samples per each frame.
  3934. @item win_func, w
  3935. Set window function to be used when generating FIR coefficients.
  3936. @end table
  3937. @section sine
  3938. Generate an audio signal made of a sine wave with amplitude 1/8.
  3939. The audio signal is bit-exact.
  3940. The filter accepts the following options:
  3941. @table @option
  3942. @item frequency, f
  3943. Set the carrier frequency. Default is 440 Hz.
  3944. @item beep_factor, b
  3945. Enable a periodic beep every second with frequency @var{beep_factor} times
  3946. the carrier frequency. Default is 0, meaning the beep is disabled.
  3947. @item sample_rate, r
  3948. Specify the sample rate, default is 44100.
  3949. @item duration, d
  3950. Specify the duration of the generated audio stream.
  3951. @item samples_per_frame
  3952. Set the number of samples per output frame.
  3953. The expression can contain the following constants:
  3954. @table @option
  3955. @item n
  3956. The (sequential) number of the output audio frame, starting from 0.
  3957. @item pts
  3958. The PTS (Presentation TimeStamp) of the output audio frame,
  3959. expressed in @var{TB} units.
  3960. @item t
  3961. The PTS of the output audio frame, expressed in seconds.
  3962. @item TB
  3963. The timebase of the output audio frames.
  3964. @end table
  3965. Default is @code{1024}.
  3966. @end table
  3967. @subsection Examples
  3968. @itemize
  3969. @item
  3970. Generate a simple 440 Hz sine wave:
  3971. @example
  3972. sine
  3973. @end example
  3974. @item
  3975. Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
  3976. @example
  3977. sine=220:4:d=5
  3978. sine=f=220:b=4:d=5
  3979. sine=frequency=220:beep_factor=4:duration=5
  3980. @end example
  3981. @item
  3982. Generate a 1 kHz sine wave following @code{1602,1601,1602,1601,1602} NTSC
  3983. pattern:
  3984. @example
  3985. sine=1000:samples_per_frame='st(0,mod(n,5)); 1602-not(not(eq(ld(0),1)+eq(ld(0),3)))'
  3986. @end example
  3987. @end itemize
  3988. @c man end AUDIO SOURCES
  3989. @chapter Audio Sinks
  3990. @c man begin AUDIO SINKS
  3991. Below is a description of the currently available audio sinks.
  3992. @section abuffersink
  3993. Buffer audio frames, and make them available to the end of filter chain.
  3994. This sink is mainly intended for programmatic use, in particular
  3995. through the interface defined in @file{libavfilter/buffersink.h}
  3996. or the options system.
  3997. It accepts a pointer to an AVABufferSinkContext structure, which
  3998. defines the incoming buffers' formats, to be passed as the opaque
  3999. parameter to @code{avfilter_init_filter} for initialization.
  4000. @section anullsink
  4001. Null audio sink; do absolutely nothing with the input audio. It is
  4002. mainly useful as a template and for use in analysis / debugging
  4003. tools.
  4004. @c man end AUDIO SINKS
  4005. @chapter Video Filters
  4006. @c man begin VIDEO FILTERS
  4007. When you configure your FFmpeg build, you can disable any of the
  4008. existing filters using @code{--disable-filters}.
  4009. The configure output will show the video filters included in your
  4010. build.
  4011. Below is a description of the currently available video filters.
  4012. @section alphaextract
  4013. Extract the alpha component from the input as a grayscale video. This
  4014. is especially useful with the @var{alphamerge} filter.
  4015. @section alphamerge
  4016. Add or replace the alpha component of the primary input with the
  4017. grayscale value of a second input. This is intended for use with
  4018. @var{alphaextract} to allow the transmission or storage of frame
  4019. sequences that have alpha in a format that doesn't support an alpha
  4020. channel.
  4021. For example, to reconstruct full frames from a normal YUV-encoded video
  4022. and a separate video created with @var{alphaextract}, you might use:
  4023. @example
  4024. movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
  4025. @end example
  4026. Since this filter is designed for reconstruction, it operates on frame
  4027. sequences without considering timestamps, and terminates when either
  4028. input reaches end of stream. This will cause problems if your encoding
  4029. pipeline drops frames. If you're trying to apply an image as an
  4030. overlay to a video stream, consider the @var{overlay} filter instead.
  4031. @section ass
  4032. Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
  4033. and libavformat to work. On the other hand, it is limited to ASS (Advanced
  4034. Substation Alpha) subtitles files.
  4035. This filter accepts the following option in addition to the common options from
  4036. the @ref{subtitles} filter:
  4037. @table @option
  4038. @item shaping
  4039. Set the shaping engine
  4040. Available values are:
  4041. @table @samp
  4042. @item auto
  4043. The default libass shaping engine, which is the best available.
  4044. @item simple
  4045. Fast, font-agnostic shaper that can do only substitutions
  4046. @item complex
  4047. Slower shaper using OpenType for substitutions and positioning
  4048. @end table
  4049. The default is @code{auto}.
  4050. @end table
  4051. @section atadenoise
  4052. Apply an Adaptive Temporal Averaging Denoiser to the video input.
  4053. The filter accepts the following options:
  4054. @table @option
  4055. @item 0a
  4056. Set threshold A for 1st plane. Default is 0.02.
  4057. Valid range is 0 to 0.3.
  4058. @item 0b
  4059. Set threshold B for 1st plane. Default is 0.04.
  4060. Valid range is 0 to 5.
  4061. @item 1a
  4062. Set threshold A for 2nd plane. Default is 0.02.
  4063. Valid range is 0 to 0.3.
  4064. @item 1b
  4065. Set threshold B for 2nd plane. Default is 0.04.
  4066. Valid range is 0 to 5.
  4067. @item 2a
  4068. Set threshold A for 3rd plane. Default is 0.02.
  4069. Valid range is 0 to 0.3.
  4070. @item 2b
  4071. Set threshold B for 3rd plane. Default is 0.04.
  4072. Valid range is 0 to 5.
  4073. Threshold A is designed to react on abrupt changes in the input signal and
  4074. threshold B is designed to react on continuous changes in the input signal.
  4075. @item s
  4076. Set number of frames filter will use for averaging. Default is 33. Must be odd
  4077. number in range [5, 129].
  4078. @item p
  4079. Set what planes of frame filter will use for averaging. Default is all.
  4080. @end table
  4081. @section avgblur
  4082. Apply average blur filter.
  4083. The filter accepts the following options:
  4084. @table @option
  4085. @item sizeX
  4086. Set horizontal kernel size.
  4087. @item planes
  4088. Set which planes to filter. By default all planes are filtered.
  4089. @item sizeY
  4090. Set vertical kernel size, if zero it will be same as @code{sizeX}.
  4091. Default is @code{0}.
  4092. @end table
  4093. @section bbox
  4094. Compute the bounding box for the non-black pixels in the input frame
  4095. luminance plane.
  4096. This filter computes the bounding box containing all the pixels with a
  4097. luminance value greater than the minimum allowed value.
  4098. The parameters describing the bounding box are printed on the filter
  4099. log.
  4100. The filter accepts the following option:
  4101. @table @option
  4102. @item min_val
  4103. Set the minimal luminance value. Default is @code{16}.
  4104. @end table
  4105. @section bitplanenoise
  4106. Show and measure bit plane noise.
  4107. The filter accepts the following options:
  4108. @table @option
  4109. @item bitplane
  4110. Set which plane to analyze. Default is @code{1}.
  4111. @item filter
  4112. Filter out noisy pixels from @code{bitplane} set above.
  4113. Default is disabled.
  4114. @end table
  4115. @section blackdetect
  4116. Detect video intervals that are (almost) completely black. Can be
  4117. useful to detect chapter transitions, commercials, or invalid
  4118. recordings. Output lines contains the time for the start, end and
  4119. duration of the detected black interval expressed in seconds.
  4120. In order to display the output lines, you need to set the loglevel at
  4121. least to the AV_LOG_INFO value.
  4122. The filter accepts the following options:
  4123. @table @option
  4124. @item black_min_duration, d
  4125. Set the minimum detected black duration expressed in seconds. It must
  4126. be a non-negative floating point number.
  4127. Default value is 2.0.
  4128. @item picture_black_ratio_th, pic_th
  4129. Set the threshold for considering a picture "black".
  4130. Express the minimum value for the ratio:
  4131. @example
  4132. @var{nb_black_pixels} / @var{nb_pixels}
  4133. @end example
  4134. for which a picture is considered black.
  4135. Default value is 0.98.
  4136. @item pixel_black_th, pix_th
  4137. Set the threshold for considering a pixel "black".
  4138. The threshold expresses the maximum pixel luminance value for which a
  4139. pixel is considered "black". The provided value is scaled according to
  4140. the following equation:
  4141. @example
  4142. @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
  4143. @end example
  4144. @var{luminance_range_size} and @var{luminance_minimum_value} depend on
  4145. the input video format, the range is [0-255] for YUV full-range
  4146. formats and [16-235] for YUV non full-range formats.
  4147. Default value is 0.10.
  4148. @end table
  4149. The following example sets the maximum pixel threshold to the minimum
  4150. value, and detects only black intervals of 2 or more seconds:
  4151. @example
  4152. blackdetect=d=2:pix_th=0.00
  4153. @end example
  4154. @section blackframe
  4155. Detect frames that are (almost) completely black. Can be useful to
  4156. detect chapter transitions or commercials. Output lines consist of
  4157. the frame number of the detected frame, the percentage of blackness,
  4158. the position in the file if known or -1 and the timestamp in seconds.
  4159. In order to display the output lines, you need to set the loglevel at
  4160. least to the AV_LOG_INFO value.
  4161. This filter exports frame metadata @code{lavfi.blackframe.pblack}.
  4162. The value represents the percentage of pixels in the picture that
  4163. are below the threshold value.
  4164. It accepts the following parameters:
  4165. @table @option
  4166. @item amount
  4167. The percentage of the pixels that have to be below the threshold; it defaults to
  4168. @code{98}.
  4169. @item threshold, thresh
  4170. The threshold below which a pixel value is considered black; it defaults to
  4171. @code{32}.
  4172. @end table
  4173. @section blend, tblend
  4174. Blend two video frames into each other.
  4175. The @code{blend} filter takes two input streams and outputs one
  4176. stream, the first input is the "top" layer and second input is
  4177. "bottom" layer. By default, the output terminates when the longest input terminates.
  4178. The @code{tblend} (time blend) filter takes two consecutive frames
  4179. from one single stream, and outputs the result obtained by blending
  4180. the new frame on top of the old frame.
  4181. A description of the accepted options follows.
  4182. @table @option
  4183. @item c0_mode
  4184. @item c1_mode
  4185. @item c2_mode
  4186. @item c3_mode
  4187. @item all_mode
  4188. Set blend mode for specific pixel component or all pixel components in case
  4189. of @var{all_mode}. Default value is @code{normal}.
  4190. Available values for component modes are:
  4191. @table @samp
  4192. @item addition
  4193. @item grainmerge
  4194. @item and
  4195. @item average
  4196. @item burn
  4197. @item darken
  4198. @item difference
  4199. @item grainextract
  4200. @item divide
  4201. @item dodge
  4202. @item freeze
  4203. @item exclusion
  4204. @item extremity
  4205. @item glow
  4206. @item hardlight
  4207. @item hardmix
  4208. @item heat
  4209. @item lighten
  4210. @item linearlight
  4211. @item multiply
  4212. @item multiply128
  4213. @item negation
  4214. @item normal
  4215. @item or
  4216. @item overlay
  4217. @item phoenix
  4218. @item pinlight
  4219. @item reflect
  4220. @item screen
  4221. @item softlight
  4222. @item subtract
  4223. @item vividlight
  4224. @item xor
  4225. @end table
  4226. @item c0_opacity
  4227. @item c1_opacity
  4228. @item c2_opacity
  4229. @item c3_opacity
  4230. @item all_opacity
  4231. Set blend opacity for specific pixel component or all pixel components in case
  4232. of @var{all_opacity}. Only used in combination with pixel component blend modes.
  4233. @item c0_expr
  4234. @item c1_expr
  4235. @item c2_expr
  4236. @item c3_expr
  4237. @item all_expr
  4238. Set blend expression for specific pixel component or all pixel components in case
  4239. of @var{all_expr}. Note that related mode options will be ignored if those are set.
  4240. The expressions can use the following variables:
  4241. @table @option
  4242. @item N
  4243. The sequential number of the filtered frame, starting from @code{0}.
  4244. @item X
  4245. @item Y
  4246. the coordinates of the current sample
  4247. @item W
  4248. @item H
  4249. the width and height of currently filtered plane
  4250. @item SW
  4251. @item SH
  4252. Width and height scale depending on the currently filtered plane. It is the
  4253. ratio between the corresponding luma plane number of pixels and the current
  4254. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  4255. @code{0.5,0.5} for chroma planes.
  4256. @item T
  4257. Time of the current frame, expressed in seconds.
  4258. @item TOP, A
  4259. Value of pixel component at current location for first video frame (top layer).
  4260. @item BOTTOM, B
  4261. Value of pixel component at current location for second video frame (bottom layer).
  4262. @end table
  4263. @end table
  4264. The @code{blend} filter also supports the @ref{framesync} options.
  4265. @subsection Examples
  4266. @itemize
  4267. @item
  4268. Apply transition from bottom layer to top layer in first 10 seconds:
  4269. @example
  4270. blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
  4271. @end example
  4272. @item
  4273. Apply linear horizontal transition from top layer to bottom layer:
  4274. @example
  4275. blend=all_expr='A*(X/W)+B*(1-X/W)'
  4276. @end example
  4277. @item
  4278. Apply 1x1 checkerboard effect:
  4279. @example
  4280. blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
  4281. @end example
  4282. @item
  4283. Apply uncover left effect:
  4284. @example
  4285. blend=all_expr='if(gte(N*SW+X,W),A,B)'
  4286. @end example
  4287. @item
  4288. Apply uncover down effect:
  4289. @example
  4290. blend=all_expr='if(gte(Y-N*SH,0),A,B)'
  4291. @end example
  4292. @item
  4293. Apply uncover up-left effect:
  4294. @example
  4295. blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
  4296. @end example
  4297. @item
  4298. Split diagonally video and shows top and bottom layer on each side:
  4299. @example
  4300. blend=all_expr='if(gt(X,Y*(W/H)),A,B)'
  4301. @end example
  4302. @item
  4303. Display differences between the current and the previous frame:
  4304. @example
  4305. tblend=all_mode=grainextract
  4306. @end example
  4307. @end itemize
  4308. @section boxblur
  4309. Apply a boxblur algorithm to the input video.
  4310. It accepts the following parameters:
  4311. @table @option
  4312. @item luma_radius, lr
  4313. @item luma_power, lp
  4314. @item chroma_radius, cr
  4315. @item chroma_power, cp
  4316. @item alpha_radius, ar
  4317. @item alpha_power, ap
  4318. @end table
  4319. A description of the accepted options follows.
  4320. @table @option
  4321. @item luma_radius, lr
  4322. @item chroma_radius, cr
  4323. @item alpha_radius, ar
  4324. Set an expression for the box radius in pixels used for blurring the
  4325. corresponding input plane.
  4326. The radius value must be a non-negative number, and must not be
  4327. greater than the value of the expression @code{min(w,h)/2} for the
  4328. luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
  4329. planes.
  4330. Default value for @option{luma_radius} is "2". If not specified,
  4331. @option{chroma_radius} and @option{alpha_radius} default to the
  4332. corresponding value set for @option{luma_radius}.
  4333. The expressions can contain the following constants:
  4334. @table @option
  4335. @item w
  4336. @item h
  4337. The input width and height in pixels.
  4338. @item cw
  4339. @item ch
  4340. The input chroma image width and height in pixels.
  4341. @item hsub
  4342. @item vsub
  4343. The horizontal and vertical chroma subsample values. For example, for the
  4344. pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
  4345. @end table
  4346. @item luma_power, lp
  4347. @item chroma_power, cp
  4348. @item alpha_power, ap
  4349. Specify how many times the boxblur filter is applied to the
  4350. corresponding plane.
  4351. Default value for @option{luma_power} is 2. If not specified,
  4352. @option{chroma_power} and @option{alpha_power} default to the
  4353. corresponding value set for @option{luma_power}.
  4354. A value of 0 will disable the effect.
  4355. @end table
  4356. @subsection Examples
  4357. @itemize
  4358. @item
  4359. Apply a boxblur filter with the luma, chroma, and alpha radii
  4360. set to 2:
  4361. @example
  4362. boxblur=luma_radius=2:luma_power=1
  4363. boxblur=2:1
  4364. @end example
  4365. @item
  4366. Set the luma radius to 2, and alpha and chroma radius to 0:
  4367. @example
  4368. boxblur=2:1:cr=0:ar=0
  4369. @end example
  4370. @item
  4371. Set the luma and chroma radii to a fraction of the video dimension:
  4372. @example
  4373. boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
  4374. @end example
  4375. @end itemize
  4376. @section bwdif
  4377. Deinterlace the input video ("bwdif" stands for "Bob Weaver
  4378. Deinterlacing Filter").
  4379. Motion adaptive deinterlacing based on yadif with the use of w3fdif and cubic
  4380. interpolation algorithms.
  4381. It accepts the following parameters:
  4382. @table @option
  4383. @item mode
  4384. The interlacing mode to adopt. It accepts one of the following values:
  4385. @table @option
  4386. @item 0, send_frame
  4387. Output one frame for each frame.
  4388. @item 1, send_field
  4389. Output one frame for each field.
  4390. @end table
  4391. The default value is @code{send_field}.
  4392. @item parity
  4393. The picture field parity assumed for the input interlaced video. It accepts one
  4394. of the following values:
  4395. @table @option
  4396. @item 0, tff
  4397. Assume the top field is first.
  4398. @item 1, bff
  4399. Assume the bottom field is first.
  4400. @item -1, auto
  4401. Enable automatic detection of field parity.
  4402. @end table
  4403. The default value is @code{auto}.
  4404. If the interlacing is unknown or the decoder does not export this information,
  4405. top field first will be assumed.
  4406. @item deint
  4407. Specify which frames to deinterlace. Accept one of the following
  4408. values:
  4409. @table @option
  4410. @item 0, all
  4411. Deinterlace all frames.
  4412. @item 1, interlaced
  4413. Only deinterlace frames marked as interlaced.
  4414. @end table
  4415. The default value is @code{all}.
  4416. @end table
  4417. @section chromakey
  4418. YUV colorspace color/chroma keying.
  4419. The filter accepts the following options:
  4420. @table @option
  4421. @item color
  4422. The color which will be replaced with transparency.
  4423. @item similarity
  4424. Similarity percentage with the key color.
  4425. 0.01 matches only the exact key color, while 1.0 matches everything.
  4426. @item blend
  4427. Blend percentage.
  4428. 0.0 makes pixels either fully transparent, or not transparent at all.
  4429. Higher values result in semi-transparent pixels, with a higher transparency
  4430. the more similar the pixels color is to the key color.
  4431. @item yuv
  4432. Signals that the color passed is already in YUV instead of RGB.
  4433. Literal colors like "green" or "red" don't make sense with this enabled anymore.
  4434. This can be used to pass exact YUV values as hexadecimal numbers.
  4435. @end table
  4436. @subsection Examples
  4437. @itemize
  4438. @item
  4439. Make every green pixel in the input image transparent:
  4440. @example
  4441. ffmpeg -i input.png -vf chromakey=green out.png
  4442. @end example
  4443. @item
  4444. Overlay a greenscreen-video on top of a static black background.
  4445. @example
  4446. 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
  4447. @end example
  4448. @end itemize
  4449. @section ciescope
  4450. Display CIE color diagram with pixels overlaid onto it.
  4451. The filter accepts the following options:
  4452. @table @option
  4453. @item system
  4454. Set color system.
  4455. @table @samp
  4456. @item ntsc, 470m
  4457. @item ebu, 470bg
  4458. @item smpte
  4459. @item 240m
  4460. @item apple
  4461. @item widergb
  4462. @item cie1931
  4463. @item rec709, hdtv
  4464. @item uhdtv, rec2020
  4465. @end table
  4466. @item cie
  4467. Set CIE system.
  4468. @table @samp
  4469. @item xyy
  4470. @item ucs
  4471. @item luv
  4472. @end table
  4473. @item gamuts
  4474. Set what gamuts to draw.
  4475. See @code{system} option for available values.
  4476. @item size, s
  4477. Set ciescope size, by default set to 512.
  4478. @item intensity, i
  4479. Set intensity used to map input pixel values to CIE diagram.
  4480. @item contrast
  4481. Set contrast used to draw tongue colors that are out of active color system gamut.
  4482. @item corrgamma
  4483. Correct gamma displayed on scope, by default enabled.
  4484. @item showwhite
  4485. Show white point on CIE diagram, by default disabled.
  4486. @item gamma
  4487. Set input gamma. Used only with XYZ input color space.
  4488. @end table
  4489. @section codecview
  4490. Visualize information exported by some codecs.
  4491. Some codecs can export information through frames using side-data or other
  4492. means. For example, some MPEG based codecs export motion vectors through the
  4493. @var{export_mvs} flag in the codec @option{flags2} option.
  4494. The filter accepts the following option:
  4495. @table @option
  4496. @item mv
  4497. Set motion vectors to visualize.
  4498. Available flags for @var{mv} are:
  4499. @table @samp
  4500. @item pf
  4501. forward predicted MVs of P-frames
  4502. @item bf
  4503. forward predicted MVs of B-frames
  4504. @item bb
  4505. backward predicted MVs of B-frames
  4506. @end table
  4507. @item qp
  4508. Display quantization parameters using the chroma planes.
  4509. @item mv_type, mvt
  4510. Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option.
  4511. Available flags for @var{mv_type} are:
  4512. @table @samp
  4513. @item fp
  4514. forward predicted MVs
  4515. @item bp
  4516. backward predicted MVs
  4517. @end table
  4518. @item frame_type, ft
  4519. Set frame type to visualize motion vectors of.
  4520. Available flags for @var{frame_type} are:
  4521. @table @samp
  4522. @item if
  4523. intra-coded frames (I-frames)
  4524. @item pf
  4525. predicted frames (P-frames)
  4526. @item bf
  4527. bi-directionally predicted frames (B-frames)
  4528. @end table
  4529. @end table
  4530. @subsection Examples
  4531. @itemize
  4532. @item
  4533. Visualize forward predicted MVs of all frames using @command{ffplay}:
  4534. @example
  4535. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv_type=fp
  4536. @end example
  4537. @item
  4538. Visualize multi-directionals MVs of P and B-Frames using @command{ffplay}:
  4539. @example
  4540. ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb
  4541. @end example
  4542. @end itemize
  4543. @section colorbalance
  4544. Modify intensity of primary colors (red, green and blue) of input frames.
  4545. The filter allows an input frame to be adjusted in the shadows, midtones or highlights
  4546. regions for the red-cyan, green-magenta or blue-yellow balance.
  4547. A positive adjustment value shifts the balance towards the primary color, a negative
  4548. value towards the complementary color.
  4549. The filter accepts the following options:
  4550. @table @option
  4551. @item rs
  4552. @item gs
  4553. @item bs
  4554. Adjust red, green and blue shadows (darkest pixels).
  4555. @item rm
  4556. @item gm
  4557. @item bm
  4558. Adjust red, green and blue midtones (medium pixels).
  4559. @item rh
  4560. @item gh
  4561. @item bh
  4562. Adjust red, green and blue highlights (brightest pixels).
  4563. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4564. @end table
  4565. @subsection Examples
  4566. @itemize
  4567. @item
  4568. Add red color cast to shadows:
  4569. @example
  4570. colorbalance=rs=.3
  4571. @end example
  4572. @end itemize
  4573. @section colorkey
  4574. RGB colorspace color keying.
  4575. The filter accepts the following options:
  4576. @table @option
  4577. @item color
  4578. The color which will be replaced with transparency.
  4579. @item similarity
  4580. Similarity percentage with the key color.
  4581. 0.01 matches only the exact key color, while 1.0 matches everything.
  4582. @item blend
  4583. Blend percentage.
  4584. 0.0 makes pixels either fully transparent, or not transparent at all.
  4585. Higher values result in semi-transparent pixels, with a higher transparency
  4586. the more similar the pixels color is to the key color.
  4587. @end table
  4588. @subsection Examples
  4589. @itemize
  4590. @item
  4591. Make every green pixel in the input image transparent:
  4592. @example
  4593. ffmpeg -i input.png -vf colorkey=green out.png
  4594. @end example
  4595. @item
  4596. Overlay a greenscreen-video on top of a static background image.
  4597. @example
  4598. 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
  4599. @end example
  4600. @end itemize
  4601. @section colorlevels
  4602. Adjust video input frames using levels.
  4603. The filter accepts the following options:
  4604. @table @option
  4605. @item rimin
  4606. @item gimin
  4607. @item bimin
  4608. @item aimin
  4609. Adjust red, green, blue and alpha input black point.
  4610. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
  4611. @item rimax
  4612. @item gimax
  4613. @item bimax
  4614. @item aimax
  4615. Adjust red, green, blue and alpha input white point.
  4616. Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{1}.
  4617. Input levels are used to lighten highlights (bright tones), darken shadows
  4618. (dark tones), change the balance of bright and dark tones.
  4619. @item romin
  4620. @item gomin
  4621. @item bomin
  4622. @item aomin
  4623. Adjust red, green, blue and alpha output black point.
  4624. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{0}.
  4625. @item romax
  4626. @item gomax
  4627. @item bomax
  4628. @item aomax
  4629. Adjust red, green, blue and alpha output white point.
  4630. Allowed ranges for options are @code{[0, 1.0]}. Defaults are @code{1}.
  4631. Output levels allows manual selection of a constrained output level range.
  4632. @end table
  4633. @subsection Examples
  4634. @itemize
  4635. @item
  4636. Make video output darker:
  4637. @example
  4638. colorlevels=rimin=0.058:gimin=0.058:bimin=0.058
  4639. @end example
  4640. @item
  4641. Increase contrast:
  4642. @example
  4643. colorlevels=rimin=0.039:gimin=0.039:bimin=0.039:rimax=0.96:gimax=0.96:bimax=0.96
  4644. @end example
  4645. @item
  4646. Make video output lighter:
  4647. @example
  4648. colorlevels=rimax=0.902:gimax=0.902:bimax=0.902
  4649. @end example
  4650. @item
  4651. Increase brightness:
  4652. @example
  4653. colorlevels=romin=0.5:gomin=0.5:bomin=0.5
  4654. @end example
  4655. @end itemize
  4656. @section colorchannelmixer
  4657. Adjust video input frames by re-mixing color channels.
  4658. This filter modifies a color channel by adding the values associated to
  4659. the other channels of the same pixels. For example if the value to
  4660. modify is red, the output value will be:
  4661. @example
  4662. @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
  4663. @end example
  4664. The filter accepts the following options:
  4665. @table @option
  4666. @item rr
  4667. @item rg
  4668. @item rb
  4669. @item ra
  4670. Adjust contribution of input red, green, blue and alpha channels for output red channel.
  4671. Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
  4672. @item gr
  4673. @item gg
  4674. @item gb
  4675. @item ga
  4676. Adjust contribution of input red, green, blue and alpha channels for output green channel.
  4677. Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
  4678. @item br
  4679. @item bg
  4680. @item bb
  4681. @item ba
  4682. Adjust contribution of input red, green, blue and alpha channels for output blue channel.
  4683. Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
  4684. @item ar
  4685. @item ag
  4686. @item ab
  4687. @item aa
  4688. Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
  4689. Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
  4690. Allowed ranges for options are @code{[-2.0, 2.0]}.
  4691. @end table
  4692. @subsection Examples
  4693. @itemize
  4694. @item
  4695. Convert source to grayscale:
  4696. @example
  4697. colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
  4698. @end example
  4699. @item
  4700. Simulate sepia tones:
  4701. @example
  4702. colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
  4703. @end example
  4704. @end itemize
  4705. @section colormatrix
  4706. Convert color matrix.
  4707. The filter accepts the following options:
  4708. @table @option
  4709. @item src
  4710. @item dst
  4711. Specify the source and destination color matrix. Both values must be
  4712. specified.
  4713. The accepted values are:
  4714. @table @samp
  4715. @item bt709
  4716. BT.709
  4717. @item fcc
  4718. FCC
  4719. @item bt601
  4720. BT.601
  4721. @item bt470
  4722. BT.470
  4723. @item bt470bg
  4724. BT.470BG
  4725. @item smpte170m
  4726. SMPTE-170M
  4727. @item smpte240m
  4728. SMPTE-240M
  4729. @item bt2020
  4730. BT.2020
  4731. @end table
  4732. @end table
  4733. For example to convert from BT.601 to SMPTE-240M, use the command:
  4734. @example
  4735. colormatrix=bt601:smpte240m
  4736. @end example
  4737. @section colorspace
  4738. Convert colorspace, transfer characteristics or color primaries.
  4739. Input video needs to have an even size.
  4740. The filter accepts the following options:
  4741. @table @option
  4742. @anchor{all}
  4743. @item all
  4744. Specify all color properties at once.
  4745. The accepted values are:
  4746. @table @samp
  4747. @item bt470m
  4748. BT.470M
  4749. @item bt470bg
  4750. BT.470BG
  4751. @item bt601-6-525
  4752. BT.601-6 525
  4753. @item bt601-6-625
  4754. BT.601-6 625
  4755. @item bt709
  4756. BT.709
  4757. @item smpte170m
  4758. SMPTE-170M
  4759. @item smpte240m
  4760. SMPTE-240M
  4761. @item bt2020
  4762. BT.2020
  4763. @end table
  4764. @anchor{space}
  4765. @item space
  4766. Specify output colorspace.
  4767. The accepted values are:
  4768. @table @samp
  4769. @item bt709
  4770. BT.709
  4771. @item fcc
  4772. FCC
  4773. @item bt470bg
  4774. BT.470BG or BT.601-6 625
  4775. @item smpte170m
  4776. SMPTE-170M or BT.601-6 525
  4777. @item smpte240m
  4778. SMPTE-240M
  4779. @item ycgco
  4780. YCgCo
  4781. @item bt2020ncl
  4782. BT.2020 with non-constant luminance
  4783. @end table
  4784. @anchor{trc}
  4785. @item trc
  4786. Specify output transfer characteristics.
  4787. The accepted values are:
  4788. @table @samp
  4789. @item bt709
  4790. BT.709
  4791. @item bt470m
  4792. BT.470M
  4793. @item bt470bg
  4794. BT.470BG
  4795. @item gamma22
  4796. Constant gamma of 2.2
  4797. @item gamma28
  4798. Constant gamma of 2.8
  4799. @item smpte170m
  4800. SMPTE-170M, BT.601-6 625 or BT.601-6 525
  4801. @item smpte240m
  4802. SMPTE-240M
  4803. @item srgb
  4804. SRGB
  4805. @item iec61966-2-1
  4806. iec61966-2-1
  4807. @item iec61966-2-4
  4808. iec61966-2-4
  4809. @item xvycc
  4810. xvycc
  4811. @item bt2020-10
  4812. BT.2020 for 10-bits content
  4813. @item bt2020-12
  4814. BT.2020 for 12-bits content
  4815. @end table
  4816. @anchor{primaries}
  4817. @item primaries
  4818. Specify output color primaries.
  4819. The accepted values are:
  4820. @table @samp
  4821. @item bt709
  4822. BT.709
  4823. @item bt470m
  4824. BT.470M
  4825. @item bt470bg
  4826. BT.470BG or BT.601-6 625
  4827. @item smpte170m
  4828. SMPTE-170M or BT.601-6 525
  4829. @item smpte240m
  4830. SMPTE-240M
  4831. @item film
  4832. film
  4833. @item smpte431
  4834. SMPTE-431
  4835. @item smpte432
  4836. SMPTE-432
  4837. @item bt2020
  4838. BT.2020
  4839. @item jedec-p22
  4840. JEDEC P22 phosphors
  4841. @end table
  4842. @anchor{range}
  4843. @item range
  4844. Specify output color range.
  4845. The accepted values are:
  4846. @table @samp
  4847. @item tv
  4848. TV (restricted) range
  4849. @item mpeg
  4850. MPEG (restricted) range
  4851. @item pc
  4852. PC (full) range
  4853. @item jpeg
  4854. JPEG (full) range
  4855. @end table
  4856. @item format
  4857. Specify output color format.
  4858. The accepted values are:
  4859. @table @samp
  4860. @item yuv420p
  4861. YUV 4:2:0 planar 8-bits
  4862. @item yuv420p10
  4863. YUV 4:2:0 planar 10-bits
  4864. @item yuv420p12
  4865. YUV 4:2:0 planar 12-bits
  4866. @item yuv422p
  4867. YUV 4:2:2 planar 8-bits
  4868. @item yuv422p10
  4869. YUV 4:2:2 planar 10-bits
  4870. @item yuv422p12
  4871. YUV 4:2:2 planar 12-bits
  4872. @item yuv444p
  4873. YUV 4:4:4 planar 8-bits
  4874. @item yuv444p10
  4875. YUV 4:4:4 planar 10-bits
  4876. @item yuv444p12
  4877. YUV 4:4:4 planar 12-bits
  4878. @end table
  4879. @item fast
  4880. Do a fast conversion, which skips gamma/primary correction. This will take
  4881. significantly less CPU, but will be mathematically incorrect. To get output
  4882. compatible with that produced by the colormatrix filter, use fast=1.
  4883. @item dither
  4884. Specify dithering mode.
  4885. The accepted values are:
  4886. @table @samp
  4887. @item none
  4888. No dithering
  4889. @item fsb
  4890. Floyd-Steinberg dithering
  4891. @end table
  4892. @item wpadapt
  4893. Whitepoint adaptation mode.
  4894. The accepted values are:
  4895. @table @samp
  4896. @item bradford
  4897. Bradford whitepoint adaptation
  4898. @item vonkries
  4899. von Kries whitepoint adaptation
  4900. @item identity
  4901. identity whitepoint adaptation (i.e. no whitepoint adaptation)
  4902. @end table
  4903. @item iall
  4904. Override all input properties at once. Same accepted values as @ref{all}.
  4905. @item ispace
  4906. Override input colorspace. Same accepted values as @ref{space}.
  4907. @item iprimaries
  4908. Override input color primaries. Same accepted values as @ref{primaries}.
  4909. @item itrc
  4910. Override input transfer characteristics. Same accepted values as @ref{trc}.
  4911. @item irange
  4912. Override input color range. Same accepted values as @ref{range}.
  4913. @end table
  4914. The filter converts the transfer characteristics, color space and color
  4915. primaries to the specified user values. The output value, if not specified,
  4916. is set to a default value based on the "all" property. If that property is
  4917. also not specified, the filter will log an error. The output color range and
  4918. format default to the same value as the input color range and format. The
  4919. input transfer characteristics, color space, color primaries and color range
  4920. should be set on the input data. If any of these are missing, the filter will
  4921. log an error and no conversion will take place.
  4922. For example to convert the input to SMPTE-240M, use the command:
  4923. @example
  4924. colorspace=smpte240m
  4925. @end example
  4926. @section convolution
  4927. Apply convolution 3x3, 5x5 or 7x7 filter.
  4928. The filter accepts the following options:
  4929. @table @option
  4930. @item 0m
  4931. @item 1m
  4932. @item 2m
  4933. @item 3m
  4934. Set matrix for each plane.
  4935. Matrix is sequence of 9, 25 or 49 signed integers.
  4936. @item 0rdiv
  4937. @item 1rdiv
  4938. @item 2rdiv
  4939. @item 3rdiv
  4940. Set multiplier for calculated value for each plane.
  4941. @item 0bias
  4942. @item 1bias
  4943. @item 2bias
  4944. @item 3bias
  4945. Set bias for each plane. This value is added to the result of the multiplication.
  4946. Useful for making the overall image brighter or darker. Default is 0.0.
  4947. @end table
  4948. @subsection Examples
  4949. @itemize
  4950. @item
  4951. Apply sharpen:
  4952. @example
  4953. 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"
  4954. @end example
  4955. @item
  4956. Apply blur:
  4957. @example
  4958. 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"
  4959. @end example
  4960. @item
  4961. Apply edge enhance:
  4962. @example
  4963. 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"
  4964. @end example
  4965. @item
  4966. Apply edge detect:
  4967. @example
  4968. 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"
  4969. @end example
  4970. @item
  4971. Apply laplacian edge detector which includes diagonals:
  4972. @example
  4973. 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"
  4974. @end example
  4975. @item
  4976. Apply emboss:
  4977. @example
  4978. 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"
  4979. @end example
  4980. @end itemize
  4981. @section convolve
  4982. Apply 2D convolution of video stream in frequency domain using second stream
  4983. as impulse.
  4984. The filter accepts the following options:
  4985. @table @option
  4986. @item planes
  4987. Set which planes to process.
  4988. @item impulse
  4989. Set which impulse video frames will be processed, can be @var{first}
  4990. or @var{all}. Default is @var{all}.
  4991. @end table
  4992. The @code{convolve} filter also supports the @ref{framesync} options.
  4993. @section copy
  4994. Copy the input video source unchanged to the output. This is mainly useful for
  4995. testing purposes.
  4996. @anchor{coreimage}
  4997. @section coreimage
  4998. Video filtering on GPU using Apple's CoreImage API on OSX.
  4999. Hardware acceleration is based on an OpenGL context. Usually, this means it is
  5000. processed by video hardware. However, software-based OpenGL implementations
  5001. exist which means there is no guarantee for hardware processing. It depends on
  5002. the respective OSX.
  5003. There are many filters and image generators provided by Apple that come with a
  5004. large variety of options. The filter has to be referenced by its name along
  5005. with its options.
  5006. The coreimage filter accepts the following options:
  5007. @table @option
  5008. @item list_filters
  5009. List all available filters and generators along with all their respective
  5010. options as well as possible minimum and maximum values along with the default
  5011. values.
  5012. @example
  5013. list_filters=true
  5014. @end example
  5015. @item filter
  5016. Specify all filters by their respective name and options.
  5017. Use @var{list_filters} to determine all valid filter names and options.
  5018. Numerical options are specified by a float value and are automatically clamped
  5019. to their respective value range. Vector and color options have to be specified
  5020. by a list of space separated float values. Character escaping has to be done.
  5021. A special option name @code{default} is available to use default options for a
  5022. filter.
  5023. It is required to specify either @code{default} or at least one of the filter options.
  5024. All omitted options are used with their default values.
  5025. The syntax of the filter string is as follows:
  5026. @example
  5027. filter=<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...][#<NAME>@@<OPTION>=<VALUE>[@@<OPTION>=<VALUE>][@@...]][#...]
  5028. @end example
  5029. @item output_rect
  5030. Specify a rectangle where the output of the filter chain is copied into the
  5031. input image. It is given by a list of space separated float values:
  5032. @example
  5033. output_rect=x\ y\ width\ height
  5034. @end example
  5035. If not given, the output rectangle equals the dimensions of the input image.
  5036. The output rectangle is automatically cropped at the borders of the input
  5037. image. Negative values are valid for each component.
  5038. @example
  5039. output_rect=25\ 25\ 100\ 100
  5040. @end example
  5041. @end table
  5042. Several filters can be chained for successive processing without GPU-HOST
  5043. transfers allowing for fast processing of complex filter chains.
  5044. Currently, only filters with zero (generators) or exactly one (filters) input
  5045. image and one output image are supported. Also, transition filters are not yet
  5046. usable as intended.
  5047. Some filters generate output images with additional padding depending on the
  5048. respective filter kernel. The padding is automatically removed to ensure the
  5049. filter output has the same size as the input image.
  5050. For image generators, the size of the output image is determined by the
  5051. previous output image of the filter chain or the input image of the whole
  5052. filterchain, respectively. The generators do not use the pixel information of
  5053. this image to generate their output. However, the generated output is
  5054. blended onto this image, resulting in partial or complete coverage of the
  5055. output image.
  5056. The @ref{coreimagesrc} video source can be used for generating input images
  5057. which are directly fed into the filter chain. By using it, providing input
  5058. images by another video source or an input video is not required.
  5059. @subsection Examples
  5060. @itemize
  5061. @item
  5062. List all filters available:
  5063. @example
  5064. coreimage=list_filters=true
  5065. @end example
  5066. @item
  5067. Use the CIBoxBlur filter with default options to blur an image:
  5068. @example
  5069. coreimage=filter=CIBoxBlur@@default
  5070. @end example
  5071. @item
  5072. Use a filter chain with CISepiaTone at default values and CIVignetteEffect with
  5073. its center at 100x100 and a radius of 50 pixels:
  5074. @example
  5075. coreimage=filter=CIBoxBlur@@default#CIVignetteEffect@@inputCenter=100\ 100@@inputRadius=50
  5076. @end example
  5077. @item
  5078. Use nullsrc and CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  5079. given as complete and escaped command-line for Apple's standard bash shell:
  5080. @example
  5081. ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  5082. @end example
  5083. @end itemize
  5084. @section crop
  5085. Crop the input video to given dimensions.
  5086. It accepts the following parameters:
  5087. @table @option
  5088. @item w, out_w
  5089. The width of the output video. It defaults to @code{iw}.
  5090. This expression is evaluated only once during the filter
  5091. configuration, or when the @samp{w} or @samp{out_w} command is sent.
  5092. @item h, out_h
  5093. The height of the output video. It defaults to @code{ih}.
  5094. This expression is evaluated only once during the filter
  5095. configuration, or when the @samp{h} or @samp{out_h} command is sent.
  5096. @item x
  5097. The horizontal position, in the input video, of the left edge of the output
  5098. video. It defaults to @code{(in_w-out_w)/2}.
  5099. This expression is evaluated per-frame.
  5100. @item y
  5101. The vertical position, in the input video, of the top edge of the output video.
  5102. It defaults to @code{(in_h-out_h)/2}.
  5103. This expression is evaluated per-frame.
  5104. @item keep_aspect
  5105. If set to 1 will force the output display aspect ratio
  5106. to be the same of the input, by changing the output sample aspect
  5107. ratio. It defaults to 0.
  5108. @item exact
  5109. Enable exact cropping. If enabled, subsampled videos will be cropped at exact
  5110. width/height/x/y as specified and will not be rounded to nearest smaller value.
  5111. It defaults to 0.
  5112. @end table
  5113. The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
  5114. expressions containing the following constants:
  5115. @table @option
  5116. @item x
  5117. @item y
  5118. The computed values for @var{x} and @var{y}. They are evaluated for
  5119. each new frame.
  5120. @item in_w
  5121. @item in_h
  5122. The input width and height.
  5123. @item iw
  5124. @item ih
  5125. These are the same as @var{in_w} and @var{in_h}.
  5126. @item out_w
  5127. @item out_h
  5128. The output (cropped) width and height.
  5129. @item ow
  5130. @item oh
  5131. These are the same as @var{out_w} and @var{out_h}.
  5132. @item a
  5133. same as @var{iw} / @var{ih}
  5134. @item sar
  5135. input sample aspect ratio
  5136. @item dar
  5137. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  5138. @item hsub
  5139. @item vsub
  5140. horizontal and vertical chroma subsample values. For example for the
  5141. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5142. @item n
  5143. The number of the input frame, starting from 0.
  5144. @item pos
  5145. the position in the file of the input frame, NAN if unknown
  5146. @item t
  5147. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  5148. @end table
  5149. The expression for @var{out_w} may depend on the value of @var{out_h},
  5150. and the expression for @var{out_h} may depend on @var{out_w}, but they
  5151. cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
  5152. evaluated after @var{out_w} and @var{out_h}.
  5153. The @var{x} and @var{y} parameters specify the expressions for the
  5154. position of the top-left corner of the output (non-cropped) area. They
  5155. are evaluated for each frame. If the evaluated value is not valid, it
  5156. is approximated to the nearest valid value.
  5157. The expression for @var{x} may depend on @var{y}, and the expression
  5158. for @var{y} may depend on @var{x}.
  5159. @subsection Examples
  5160. @itemize
  5161. @item
  5162. Crop area with size 100x100 at position (12,34).
  5163. @example
  5164. crop=100:100:12:34
  5165. @end example
  5166. Using named options, the example above becomes:
  5167. @example
  5168. crop=w=100:h=100:x=12:y=34
  5169. @end example
  5170. @item
  5171. Crop the central input area with size 100x100:
  5172. @example
  5173. crop=100:100
  5174. @end example
  5175. @item
  5176. Crop the central input area with size 2/3 of the input video:
  5177. @example
  5178. crop=2/3*in_w:2/3*in_h
  5179. @end example
  5180. @item
  5181. Crop the input video central square:
  5182. @example
  5183. crop=out_w=in_h
  5184. crop=in_h
  5185. @end example
  5186. @item
  5187. Delimit the rectangle with the top-left corner placed at position
  5188. 100:100 and the right-bottom corner corresponding to the right-bottom
  5189. corner of the input image.
  5190. @example
  5191. crop=in_w-100:in_h-100:100:100
  5192. @end example
  5193. @item
  5194. Crop 10 pixels from the left and right borders, and 20 pixels from
  5195. the top and bottom borders
  5196. @example
  5197. crop=in_w-2*10:in_h-2*20
  5198. @end example
  5199. @item
  5200. Keep only the bottom right quarter of the input image:
  5201. @example
  5202. crop=in_w/2:in_h/2:in_w/2:in_h/2
  5203. @end example
  5204. @item
  5205. Crop height for getting Greek harmony:
  5206. @example
  5207. crop=in_w:1/PHI*in_w
  5208. @end example
  5209. @item
  5210. Apply trembling effect:
  5211. @example
  5212. 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)
  5213. @end example
  5214. @item
  5215. Apply erratic camera effect depending on timestamp:
  5216. @example
  5217. 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)"
  5218. @end example
  5219. @item
  5220. Set x depending on the value of y:
  5221. @example
  5222. crop=in_w/2:in_h/2:y:10+10*sin(n/10)
  5223. @end example
  5224. @end itemize
  5225. @subsection Commands
  5226. This filter supports the following commands:
  5227. @table @option
  5228. @item w, out_w
  5229. @item h, out_h
  5230. @item x
  5231. @item y
  5232. Set width/height of the output video and the horizontal/vertical position
  5233. in the input video.
  5234. The command accepts the same syntax of the corresponding option.
  5235. If the specified expression is not valid, it is kept at its current
  5236. value.
  5237. @end table
  5238. @section cropdetect
  5239. Auto-detect the crop size.
  5240. It calculates the necessary cropping parameters and prints the
  5241. recommended parameters via the logging system. The detected dimensions
  5242. correspond to the non-black area of the input video.
  5243. It accepts the following parameters:
  5244. @table @option
  5245. @item limit
  5246. Set higher black value threshold, which can be optionally specified
  5247. from nothing (0) to everything (255 for 8-bit based formats). An intensity
  5248. value greater to the set value is considered non-black. It defaults to 24.
  5249. You can also specify a value between 0.0 and 1.0 which will be scaled depending
  5250. on the bitdepth of the pixel format.
  5251. @item round
  5252. The value which the width/height should be divisible by. It defaults to
  5253. 16. The offset is automatically adjusted to center the video. Use 2 to
  5254. get only even dimensions (needed for 4:2:2 video). 16 is best when
  5255. encoding to most video codecs.
  5256. @item reset_count, reset
  5257. Set the counter that determines after how many frames cropdetect will
  5258. reset the previously detected largest video area and start over to
  5259. detect the current optimal crop area. Default value is 0.
  5260. This can be useful when channel logos distort the video area. 0
  5261. indicates 'never reset', and returns the largest area encountered during
  5262. playback.
  5263. @end table
  5264. @anchor{curves}
  5265. @section curves
  5266. Apply color adjustments using curves.
  5267. This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
  5268. component (red, green and blue) has its values defined by @var{N} key points
  5269. tied from each other using a smooth curve. The x-axis represents the pixel
  5270. values from the input frame, and the y-axis the new pixel values to be set for
  5271. the output frame.
  5272. By default, a component curve is defined by the two points @var{(0;0)} and
  5273. @var{(1;1)}. This creates a straight line where each original pixel value is
  5274. "adjusted" to its own value, which means no change to the image.
  5275. The filter allows you to redefine these two points and add some more. A new
  5276. curve (using a natural cubic spline interpolation) will be define to pass
  5277. smoothly through all these new coordinates. The new defined points needs to be
  5278. strictly increasing over the x-axis, and their @var{x} and @var{y} values must
  5279. be in the @var{[0;1]} interval. If the computed curves happened to go outside
  5280. the vector spaces, the values will be clipped accordingly.
  5281. The filter accepts the following options:
  5282. @table @option
  5283. @item preset
  5284. Select one of the available color presets. This option can be used in addition
  5285. to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
  5286. options takes priority on the preset values.
  5287. Available presets are:
  5288. @table @samp
  5289. @item none
  5290. @item color_negative
  5291. @item cross_process
  5292. @item darker
  5293. @item increase_contrast
  5294. @item lighter
  5295. @item linear_contrast
  5296. @item medium_contrast
  5297. @item negative
  5298. @item strong_contrast
  5299. @item vintage
  5300. @end table
  5301. Default is @code{none}.
  5302. @item master, m
  5303. Set the master key points. These points will define a second pass mapping. It
  5304. is sometimes called a "luminance" or "value" mapping. It can be used with
  5305. @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
  5306. post-processing LUT.
  5307. @item red, r
  5308. Set the key points for the red component.
  5309. @item green, g
  5310. Set the key points for the green component.
  5311. @item blue, b
  5312. Set the key points for the blue component.
  5313. @item all
  5314. Set the key points for all components (not including master).
  5315. Can be used in addition to the other key points component
  5316. options. In this case, the unset component(s) will fallback on this
  5317. @option{all} setting.
  5318. @item psfile
  5319. Specify a Photoshop curves file (@code{.acv}) to import the settings from.
  5320. @item plot
  5321. Save Gnuplot script of the curves in specified file.
  5322. @end table
  5323. To avoid some filtergraph syntax conflicts, each key points list need to be
  5324. defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
  5325. @subsection Examples
  5326. @itemize
  5327. @item
  5328. Increase slightly the middle level of blue:
  5329. @example
  5330. curves=blue='0/0 0.5/0.58 1/1'
  5331. @end example
  5332. @item
  5333. Vintage effect:
  5334. @example
  5335. 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'
  5336. @end example
  5337. Here we obtain the following coordinates for each components:
  5338. @table @var
  5339. @item red
  5340. @code{(0;0.11) (0.42;0.51) (1;0.95)}
  5341. @item green
  5342. @code{(0;0) (0.50;0.48) (1;1)}
  5343. @item blue
  5344. @code{(0;0.22) (0.49;0.44) (1;0.80)}
  5345. @end table
  5346. @item
  5347. The previous example can also be achieved with the associated built-in preset:
  5348. @example
  5349. curves=preset=vintage
  5350. @end example
  5351. @item
  5352. Or simply:
  5353. @example
  5354. curves=vintage
  5355. @end example
  5356. @item
  5357. Use a Photoshop preset and redefine the points of the green component:
  5358. @example
  5359. curves=psfile='MyCurvesPresets/purple.acv':green='0/0 0.45/0.53 1/1'
  5360. @end example
  5361. @item
  5362. Check out the curves of the @code{cross_process} profile using @command{ffmpeg}
  5363. and @command{gnuplot}:
  5364. @example
  5365. ffmpeg -f lavfi -i color -vf curves=cross_process:plot=/tmp/curves.plt -frames:v 1 -f null -
  5366. gnuplot -p /tmp/curves.plt
  5367. @end example
  5368. @end itemize
  5369. @section datascope
  5370. Video data analysis filter.
  5371. This filter shows hexadecimal pixel values of part of video.
  5372. The filter accepts the following options:
  5373. @table @option
  5374. @item size, s
  5375. Set output video size.
  5376. @item x
  5377. Set x offset from where to pick pixels.
  5378. @item y
  5379. Set y offset from where to pick pixels.
  5380. @item mode
  5381. Set scope mode, can be one of the following:
  5382. @table @samp
  5383. @item mono
  5384. Draw hexadecimal pixel values with white color on black background.
  5385. @item color
  5386. Draw hexadecimal pixel values with input video pixel color on black
  5387. background.
  5388. @item color2
  5389. Draw hexadecimal pixel values on color background picked from input video,
  5390. the text color is picked in such way so its always visible.
  5391. @end table
  5392. @item axis
  5393. Draw rows and columns numbers on left and top of video.
  5394. @item opacity
  5395. Set background opacity.
  5396. @end table
  5397. @section dctdnoiz
  5398. Denoise frames using 2D DCT (frequency domain filtering).
  5399. This filter is not designed for real time.
  5400. The filter accepts the following options:
  5401. @table @option
  5402. @item sigma, s
  5403. Set the noise sigma constant.
  5404. This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
  5405. coefficient (absolute value) below this threshold with be dropped.
  5406. If you need a more advanced filtering, see @option{expr}.
  5407. Default is @code{0}.
  5408. @item overlap
  5409. Set number overlapping pixels for each block. Since the filter can be slow, you
  5410. may want to reduce this value, at the cost of a less effective filter and the
  5411. risk of various artefacts.
  5412. If the overlapping value doesn't permit processing the whole input width or
  5413. height, a warning will be displayed and according borders won't be denoised.
  5414. Default value is @var{blocksize}-1, which is the best possible setting.
  5415. @item expr, e
  5416. Set the coefficient factor expression.
  5417. For each coefficient of a DCT block, this expression will be evaluated as a
  5418. multiplier value for the coefficient.
  5419. If this is option is set, the @option{sigma} option will be ignored.
  5420. The absolute value of the coefficient can be accessed through the @var{c}
  5421. variable.
  5422. @item n
  5423. Set the @var{blocksize} using the number of bits. @code{1<<@var{n}} defines the
  5424. @var{blocksize}, which is the width and height of the processed blocks.
  5425. The default value is @var{3} (8x8) and can be raised to @var{4} for a
  5426. @var{blocksize} of 16x16. Note that changing this setting has huge consequences
  5427. on the speed processing. Also, a larger block size does not necessarily means a
  5428. better de-noising.
  5429. @end table
  5430. @subsection Examples
  5431. Apply a denoise with a @option{sigma} of @code{4.5}:
  5432. @example
  5433. dctdnoiz=4.5
  5434. @end example
  5435. The same operation can be achieved using the expression system:
  5436. @example
  5437. dctdnoiz=e='gte(c, 4.5*3)'
  5438. @end example
  5439. Violent denoise using a block size of @code{16x16}:
  5440. @example
  5441. dctdnoiz=15:n=4
  5442. @end example
  5443. @section deband
  5444. Remove banding artifacts from input video.
  5445. It works by replacing banded pixels with average value of referenced pixels.
  5446. The filter accepts the following options:
  5447. @table @option
  5448. @item 1thr
  5449. @item 2thr
  5450. @item 3thr
  5451. @item 4thr
  5452. Set banding detection threshold for each plane. Default is 0.02.
  5453. Valid range is 0.00003 to 0.5.
  5454. If difference between current pixel and reference pixel is less than threshold,
  5455. it will be considered as banded.
  5456. @item range, r
  5457. Banding detection range in pixels. Default is 16. If positive, random number
  5458. in range 0 to set value will be used. If negative, exact absolute value
  5459. will be used.
  5460. The range defines square of four pixels around current pixel.
  5461. @item direction, d
  5462. Set direction in radians from which four pixel will be compared. If positive,
  5463. random direction from 0 to set direction will be picked. If negative, exact of
  5464. absolute value will be picked. For example direction 0, -PI or -2*PI radians
  5465. will pick only pixels on same row and -PI/2 will pick only pixels on same
  5466. column.
  5467. @item blur, b
  5468. If enabled, current pixel is compared with average value of all four
  5469. surrounding pixels. The default is enabled. If disabled current pixel is
  5470. compared with all four surrounding pixels. The pixel is considered banded
  5471. if only all four differences with surrounding pixels are less than threshold.
  5472. @item coupling, c
  5473. If enabled, current pixel is changed if and only if all pixel components are banded,
  5474. e.g. banding detection threshold is triggered for all color components.
  5475. The default is disabled.
  5476. @end table
  5477. @section deblock
  5478. Remove blocking artifacts from input video.
  5479. The filter accepts the following options:
  5480. @table @option
  5481. @item filter
  5482. Set filter type, can be @var{weak} or @var{strong}. Default is @var{strong}.
  5483. This controls what kind of deblocking is applied.
  5484. @item block
  5485. Set size of block, allowed range is from 4 to 512. Default is @var{8}.
  5486. @item alpha
  5487. @item beta
  5488. @item gamma
  5489. @item delta
  5490. Set blocking detection thresholds. Allowed range is 0 to 1.
  5491. Defaults are: @var{0.098} for @var{alpha} and @var{0.05} for the rest.
  5492. Using higher threshold gives more deblocking strength.
  5493. Setting @var{alpha} controls threshold detection at exact edge of block.
  5494. Remaining options controls threshold detection near the edge. Each one for
  5495. below/above or left/right. Setting any of those to @var{0} disables
  5496. deblocking.
  5497. @item planes
  5498. Set planes to filter. Default is to filter all available planes.
  5499. @end table
  5500. @subsection Examples
  5501. @itemize
  5502. @item
  5503. Deblock using weak filter and block size of 4 pixels.
  5504. @example
  5505. deblock=filter=weak:block=4
  5506. @end example
  5507. @item
  5508. Deblock using strong filter, block size of 4 pixels and custom thresholds for
  5509. deblocking more edges.
  5510. @example
  5511. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05
  5512. @end example
  5513. @item
  5514. Similar as above, but filter only first plane.
  5515. @example
  5516. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=1
  5517. @end example
  5518. @item
  5519. Similar as above, but filter only second and third plane.
  5520. @example
  5521. deblock=filter=strong:block=4:alpha=0.12:beta=0.07:gamma=0.06:delta=0.05:planes=6
  5522. @end example
  5523. @end itemize
  5524. @anchor{decimate}
  5525. @section decimate
  5526. Drop duplicated frames at regular intervals.
  5527. The filter accepts the following options:
  5528. @table @option
  5529. @item cycle
  5530. Set the number of frames from which one will be dropped. Setting this to
  5531. @var{N} means one frame in every batch of @var{N} frames will be dropped.
  5532. Default is @code{5}.
  5533. @item dupthresh
  5534. Set the threshold for duplicate detection. If the difference metric for a frame
  5535. is less than or equal to this value, then it is declared as duplicate. Default
  5536. is @code{1.1}
  5537. @item scthresh
  5538. Set scene change threshold. Default is @code{15}.
  5539. @item blockx
  5540. @item blocky
  5541. Set the size of the x and y-axis blocks used during metric calculations.
  5542. Larger blocks give better noise suppression, but also give worse detection of
  5543. small movements. Must be a power of two. Default is @code{32}.
  5544. @item ppsrc
  5545. Mark main input as a pre-processed input and activate clean source input
  5546. stream. This allows the input to be pre-processed with various filters to help
  5547. the metrics calculation while keeping the frame selection lossless. When set to
  5548. @code{1}, the first stream is for the pre-processed input, and the second
  5549. stream is the clean source from where the kept frames are chosen. Default is
  5550. @code{0}.
  5551. @item chroma
  5552. Set whether or not chroma is considered in the metric calculations. Default is
  5553. @code{1}.
  5554. @end table
  5555. @section deconvolve
  5556. Apply 2D deconvolution of video stream in frequency domain using second stream
  5557. as impulse.
  5558. The filter accepts the following options:
  5559. @table @option
  5560. @item planes
  5561. Set which planes to process.
  5562. @item impulse
  5563. Set which impulse video frames will be processed, can be @var{first}
  5564. or @var{all}. Default is @var{all}.
  5565. @item noise
  5566. Set noise when doing divisions. Default is @var{0.0000001}. Useful when width
  5567. and height are not same and not power of 2 or if stream prior to convolving
  5568. had noise.
  5569. @end table
  5570. The @code{deconvolve} filter also supports the @ref{framesync} options.
  5571. @section deflate
  5572. Apply deflate effect to the video.
  5573. This filter replaces the pixel by the local(3x3) average by taking into account
  5574. only values lower than the pixel.
  5575. It accepts the following options:
  5576. @table @option
  5577. @item threshold0
  5578. @item threshold1
  5579. @item threshold2
  5580. @item threshold3
  5581. Limit the maximum change for each plane, default is 65535.
  5582. If 0, plane will remain unchanged.
  5583. @end table
  5584. @section deflicker
  5585. Remove temporal frame luminance variations.
  5586. It accepts the following options:
  5587. @table @option
  5588. @item size, s
  5589. Set moving-average filter size in frames. Default is 5. Allowed range is 2 - 129.
  5590. @item mode, m
  5591. Set averaging mode to smooth temporal luminance variations.
  5592. Available values are:
  5593. @table @samp
  5594. @item am
  5595. Arithmetic mean
  5596. @item gm
  5597. Geometric mean
  5598. @item hm
  5599. Harmonic mean
  5600. @item qm
  5601. Quadratic mean
  5602. @item cm
  5603. Cubic mean
  5604. @item pm
  5605. Power mean
  5606. @item median
  5607. Median
  5608. @end table
  5609. @item bypass
  5610. Do not actually modify frame. Useful when one only wants metadata.
  5611. @end table
  5612. @section dejudder
  5613. Remove judder produced by partially interlaced telecined content.
  5614. Judder can be introduced, for instance, by @ref{pullup} filter. If the original
  5615. source was partially telecined content then the output of @code{pullup,dejudder}
  5616. will have a variable frame rate. May change the recorded frame rate of the
  5617. container. Aside from that change, this filter will not affect constant frame
  5618. rate video.
  5619. The option available in this filter is:
  5620. @table @option
  5621. @item cycle
  5622. Specify the length of the window over which the judder repeats.
  5623. Accepts any integer greater than 1. Useful values are:
  5624. @table @samp
  5625. @item 4
  5626. If the original was telecined from 24 to 30 fps (Film to NTSC).
  5627. @item 5
  5628. If the original was telecined from 25 to 30 fps (PAL to NTSC).
  5629. @item 20
  5630. If a mixture of the two.
  5631. @end table
  5632. The default is @samp{4}.
  5633. @end table
  5634. @section delogo
  5635. Suppress a TV station logo by a simple interpolation of the surrounding
  5636. pixels. Just set a rectangle covering the logo and watch it disappear
  5637. (and sometimes something even uglier appear - your mileage may vary).
  5638. It accepts the following parameters:
  5639. @table @option
  5640. @item x
  5641. @item y
  5642. Specify the top left corner coordinates of the logo. They must be
  5643. specified.
  5644. @item w
  5645. @item h
  5646. Specify the width and height of the logo to clear. They must be
  5647. specified.
  5648. @item band, t
  5649. Specify the thickness of the fuzzy edge of the rectangle (added to
  5650. @var{w} and @var{h}). The default value is 1. This option is
  5651. deprecated, setting higher values should no longer be necessary and
  5652. is not recommended.
  5653. @item show
  5654. When set to 1, a green rectangle is drawn on the screen to simplify
  5655. finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
  5656. The default value is 0.
  5657. The rectangle is drawn on the outermost pixels which will be (partly)
  5658. replaced with interpolated values. The values of the next pixels
  5659. immediately outside this rectangle in each direction will be used to
  5660. compute the interpolated pixel values inside the rectangle.
  5661. @end table
  5662. @subsection Examples
  5663. @itemize
  5664. @item
  5665. Set a rectangle covering the area with top left corner coordinates 0,0
  5666. and size 100x77, and a band of size 10:
  5667. @example
  5668. delogo=x=0:y=0:w=100:h=77:band=10
  5669. @end example
  5670. @end itemize
  5671. @section deshake
  5672. Attempt to fix small changes in horizontal and/or vertical shift. This
  5673. filter helps remove camera shake from hand-holding a camera, bumping a
  5674. tripod, moving on a vehicle, etc.
  5675. The filter accepts the following options:
  5676. @table @option
  5677. @item x
  5678. @item y
  5679. @item w
  5680. @item h
  5681. Specify a rectangular area where to limit the search for motion
  5682. vectors.
  5683. If desired the search for motion vectors can be limited to a
  5684. rectangular area of the frame defined by its top left corner, width
  5685. and height. These parameters have the same meaning as the drawbox
  5686. filter which can be used to visualise the position of the bounding
  5687. box.
  5688. This is useful when simultaneous movement of subjects within the frame
  5689. might be confused for camera motion by the motion vector search.
  5690. If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
  5691. then the full frame is used. This allows later options to be set
  5692. without specifying the bounding box for the motion vector search.
  5693. Default - search the whole frame.
  5694. @item rx
  5695. @item ry
  5696. Specify the maximum extent of movement in x and y directions in the
  5697. range 0-64 pixels. Default 16.
  5698. @item edge
  5699. Specify how to generate pixels to fill blanks at the edge of the
  5700. frame. Available values are:
  5701. @table @samp
  5702. @item blank, 0
  5703. Fill zeroes at blank locations
  5704. @item original, 1
  5705. Original image at blank locations
  5706. @item clamp, 2
  5707. Extruded edge value at blank locations
  5708. @item mirror, 3
  5709. Mirrored edge at blank locations
  5710. @end table
  5711. Default value is @samp{mirror}.
  5712. @item blocksize
  5713. Specify the blocksize to use for motion search. Range 4-128 pixels,
  5714. default 8.
  5715. @item contrast
  5716. Specify the contrast threshold for blocks. Only blocks with more than
  5717. the specified contrast (difference between darkest and lightest
  5718. pixels) will be considered. Range 1-255, default 125.
  5719. @item search
  5720. Specify the search strategy. Available values are:
  5721. @table @samp
  5722. @item exhaustive, 0
  5723. Set exhaustive search
  5724. @item less, 1
  5725. Set less exhaustive search.
  5726. @end table
  5727. Default value is @samp{exhaustive}.
  5728. @item filename
  5729. If set then a detailed log of the motion search is written to the
  5730. specified file.
  5731. @end table
  5732. @section despill
  5733. Remove unwanted contamination of foreground colors, caused by reflected color of
  5734. greenscreen or bluescreen.
  5735. This filter accepts the following options:
  5736. @table @option
  5737. @item type
  5738. Set what type of despill to use.
  5739. @item mix
  5740. Set how spillmap will be generated.
  5741. @item expand
  5742. Set how much to get rid of still remaining spill.
  5743. @item red
  5744. Controls amount of red in spill area.
  5745. @item green
  5746. Controls amount of green in spill area.
  5747. Should be -1 for greenscreen.
  5748. @item blue
  5749. Controls amount of blue in spill area.
  5750. Should be -1 for bluescreen.
  5751. @item brightness
  5752. Controls brightness of spill area, preserving colors.
  5753. @item alpha
  5754. Modify alpha from generated spillmap.
  5755. @end table
  5756. @section detelecine
  5757. Apply an exact inverse of the telecine operation. It requires a predefined
  5758. pattern specified using the pattern option which must be the same as that passed
  5759. to the telecine filter.
  5760. This filter accepts the following options:
  5761. @table @option
  5762. @item first_field
  5763. @table @samp
  5764. @item top, t
  5765. top field first
  5766. @item bottom, b
  5767. bottom field first
  5768. The default value is @code{top}.
  5769. @end table
  5770. @item pattern
  5771. A string of numbers representing the pulldown pattern you wish to apply.
  5772. The default value is @code{23}.
  5773. @item start_frame
  5774. A number representing position of the first frame with respect to the telecine
  5775. pattern. This is to be used if the stream is cut. The default value is @code{0}.
  5776. @end table
  5777. @section dilation
  5778. Apply dilation effect to the video.
  5779. This filter replaces the pixel by the local(3x3) maximum.
  5780. It accepts the following options:
  5781. @table @option
  5782. @item threshold0
  5783. @item threshold1
  5784. @item threshold2
  5785. @item threshold3
  5786. Limit the maximum change for each plane, default is 65535.
  5787. If 0, plane will remain unchanged.
  5788. @item coordinates
  5789. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  5790. pixels are used.
  5791. Flags to local 3x3 coordinates maps like this:
  5792. 1 2 3
  5793. 4 5
  5794. 6 7 8
  5795. @end table
  5796. @section displace
  5797. Displace pixels as indicated by second and third input stream.
  5798. It takes three input streams and outputs one stream, the first input is the
  5799. source, and second and third input are displacement maps.
  5800. The second input specifies how much to displace pixels along the
  5801. x-axis, while the third input specifies how much to displace pixels
  5802. along the y-axis.
  5803. If one of displacement map streams terminates, last frame from that
  5804. displacement map will be used.
  5805. Note that once generated, displacements maps can be reused over and over again.
  5806. A description of the accepted options follows.
  5807. @table @option
  5808. @item edge
  5809. Set displace behavior for pixels that are out of range.
  5810. Available values are:
  5811. @table @samp
  5812. @item blank
  5813. Missing pixels are replaced by black pixels.
  5814. @item smear
  5815. Adjacent pixels will spread out to replace missing pixels.
  5816. @item wrap
  5817. Out of range pixels are wrapped so they point to pixels of other side.
  5818. @item mirror
  5819. Out of range pixels will be replaced with mirrored pixels.
  5820. @end table
  5821. Default is @samp{smear}.
  5822. @end table
  5823. @subsection Examples
  5824. @itemize
  5825. @item
  5826. Add ripple effect to rgb input of video size hd720:
  5827. @example
  5828. 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
  5829. @end example
  5830. @item
  5831. Add wave effect to rgb input of video size hd720:
  5832. @example
  5833. 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
  5834. @end example
  5835. @end itemize
  5836. @section drawbox
  5837. Draw a colored box on the input image.
  5838. It accepts the following parameters:
  5839. @table @option
  5840. @item x
  5841. @item y
  5842. The expressions which specify the top left corner coordinates of the box. It defaults to 0.
  5843. @item width, w
  5844. @item height, h
  5845. The expressions which specify the width and height of the box; if 0 they are interpreted as
  5846. the input width and height. It defaults to 0.
  5847. @item color, c
  5848. Specify the color of the box to write. For the general syntax of this option,
  5849. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  5850. value @code{invert} is used, the box edge color is the same as the
  5851. video with inverted luma.
  5852. @item thickness, t
  5853. The expression which sets the thickness of the box edge.
  5854. A value of @code{fill} will create a filled box. Default value is @code{3}.
  5855. See below for the list of accepted constants.
  5856. @item replace
  5857. Applicable if the input has alpha. With value @code{1}, the pixels of the painted box
  5858. will overwrite the video's color and alpha pixels.
  5859. Default is @code{0}, which composites the box onto the input, leaving the video's alpha intact.
  5860. @end table
  5861. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5862. following constants:
  5863. @table @option
  5864. @item dar
  5865. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5866. @item hsub
  5867. @item vsub
  5868. horizontal and vertical chroma subsample values. For example for the
  5869. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5870. @item in_h, ih
  5871. @item in_w, iw
  5872. The input width and height.
  5873. @item sar
  5874. The input sample aspect ratio.
  5875. @item x
  5876. @item y
  5877. The x and y offset coordinates where the box is drawn.
  5878. @item w
  5879. @item h
  5880. The width and height of the drawn box.
  5881. @item t
  5882. The thickness of the drawn box.
  5883. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5884. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5885. @end table
  5886. @subsection Examples
  5887. @itemize
  5888. @item
  5889. Draw a black box around the edge of the input image:
  5890. @example
  5891. drawbox
  5892. @end example
  5893. @item
  5894. Draw a box with color red and an opacity of 50%:
  5895. @example
  5896. drawbox=10:20:200:60:red@@0.5
  5897. @end example
  5898. The previous example can be specified as:
  5899. @example
  5900. drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
  5901. @end example
  5902. @item
  5903. Fill the box with pink color:
  5904. @example
  5905. drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=fill
  5906. @end example
  5907. @item
  5908. Draw a 2-pixel red 2.40:1 mask:
  5909. @example
  5910. 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
  5911. @end example
  5912. @end itemize
  5913. @section drawgrid
  5914. Draw a grid on the input image.
  5915. It accepts the following parameters:
  5916. @table @option
  5917. @item x
  5918. @item y
  5919. The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
  5920. @item width, w
  5921. @item height, h
  5922. The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
  5923. input width and height, respectively, minus @code{thickness}, so image gets
  5924. framed. Default to 0.
  5925. @item color, c
  5926. Specify the color of the grid. For the general syntax of this option,
  5927. check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}. If the special
  5928. value @code{invert} is used, the grid color is the same as the
  5929. video with inverted luma.
  5930. @item thickness, t
  5931. The expression which sets the thickness of the grid line. Default value is @code{1}.
  5932. See below for the list of accepted constants.
  5933. @item replace
  5934. Applicable if the input has alpha. With @code{1} the pixels of the painted grid
  5935. will overwrite the video's color and alpha pixels.
  5936. Default is @code{0}, which composites the grid onto the input, leaving the video's alpha intact.
  5937. @end table
  5938. The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
  5939. following constants:
  5940. @table @option
  5941. @item dar
  5942. The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
  5943. @item hsub
  5944. @item vsub
  5945. horizontal and vertical chroma subsample values. For example for the
  5946. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  5947. @item in_h, ih
  5948. @item in_w, iw
  5949. The input grid cell width and height.
  5950. @item sar
  5951. The input sample aspect ratio.
  5952. @item x
  5953. @item y
  5954. The x and y coordinates of some point of grid intersection (meant to configure offset).
  5955. @item w
  5956. @item h
  5957. The width and height of the drawn cell.
  5958. @item t
  5959. The thickness of the drawn cell.
  5960. These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
  5961. each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
  5962. @end table
  5963. @subsection Examples
  5964. @itemize
  5965. @item
  5966. Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
  5967. @example
  5968. drawgrid=width=100:height=100:thickness=2:color=red@@0.5
  5969. @end example
  5970. @item
  5971. Draw a white 3x3 grid with an opacity of 50%:
  5972. @example
  5973. drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
  5974. @end example
  5975. @end itemize
  5976. @anchor{drawtext}
  5977. @section drawtext
  5978. Draw a text string or text from a specified file on top of a video, using the
  5979. libfreetype library.
  5980. To enable compilation of this filter, you need to configure FFmpeg with
  5981. @code{--enable-libfreetype}.
  5982. To enable default font fallback and the @var{font} option you need to
  5983. configure FFmpeg with @code{--enable-libfontconfig}.
  5984. To enable the @var{text_shaping} option, you need to configure FFmpeg with
  5985. @code{--enable-libfribidi}.
  5986. @subsection Syntax
  5987. It accepts the following parameters:
  5988. @table @option
  5989. @item box
  5990. Used to draw a box around text using the background color.
  5991. The value must be either 1 (enable) or 0 (disable).
  5992. The default value of @var{box} is 0.
  5993. @item boxborderw
  5994. Set the width of the border to be drawn around the box using @var{boxcolor}.
  5995. The default value of @var{boxborderw} is 0.
  5996. @item boxcolor
  5997. The color to be used for drawing box around text. For the syntax of this
  5998. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  5999. The default value of @var{boxcolor} is "white".
  6000. @item line_spacing
  6001. Set the line spacing in pixels of the border to be drawn around the box using @var{box}.
  6002. The default value of @var{line_spacing} is 0.
  6003. @item borderw
  6004. Set the width of the border to be drawn around the text using @var{bordercolor}.
  6005. The default value of @var{borderw} is 0.
  6006. @item bordercolor
  6007. Set the color to be used for drawing border around text. For the syntax of this
  6008. option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6009. The default value of @var{bordercolor} is "black".
  6010. @item expansion
  6011. Select how the @var{text} is expanded. Can be either @code{none},
  6012. @code{strftime} (deprecated) or
  6013. @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
  6014. below for details.
  6015. @item basetime
  6016. Set a start time for the count. Value is in microseconds. Only applied
  6017. in the deprecated strftime expansion mode. To emulate in normal expansion
  6018. mode use the @code{pts} function, supplying the start time (in seconds)
  6019. as the second argument.
  6020. @item fix_bounds
  6021. If true, check and fix text coords to avoid clipping.
  6022. @item fontcolor
  6023. The color to be used for drawing fonts. For the syntax of this option, check
  6024. the @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  6025. The default value of @var{fontcolor} is "black".
  6026. @item fontcolor_expr
  6027. String which is expanded the same way as @var{text} to obtain dynamic
  6028. @var{fontcolor} value. By default this option has empty value and is not
  6029. processed. When this option is set, it overrides @var{fontcolor} option.
  6030. @item font
  6031. The font family to be used for drawing text. By default Sans.
  6032. @item fontfile
  6033. The font file to be used for drawing text. The path must be included.
  6034. This parameter is mandatory if the fontconfig support is disabled.
  6035. @item alpha
  6036. Draw the text applying alpha blending. The value can
  6037. be a number between 0.0 and 1.0.
  6038. The expression accepts the same variables @var{x, y} as well.
  6039. The default value is 1.
  6040. Please see @var{fontcolor_expr}.
  6041. @item fontsize
  6042. The font size to be used for drawing text.
  6043. The default value of @var{fontsize} is 16.
  6044. @item text_shaping
  6045. If set to 1, attempt to shape the text (for example, reverse the order of
  6046. right-to-left text and join Arabic characters) before drawing it.
  6047. Otherwise, just draw the text exactly as given.
  6048. By default 1 (if supported).
  6049. @item ft_load_flags
  6050. The flags to be used for loading the fonts.
  6051. The flags map the corresponding flags supported by libfreetype, and are
  6052. a combination of the following values:
  6053. @table @var
  6054. @item default
  6055. @item no_scale
  6056. @item no_hinting
  6057. @item render
  6058. @item no_bitmap
  6059. @item vertical_layout
  6060. @item force_autohint
  6061. @item crop_bitmap
  6062. @item pedantic
  6063. @item ignore_global_advance_width
  6064. @item no_recurse
  6065. @item ignore_transform
  6066. @item monochrome
  6067. @item linear_design
  6068. @item no_autohint
  6069. @end table
  6070. Default value is "default".
  6071. For more information consult the documentation for the FT_LOAD_*
  6072. libfreetype flags.
  6073. @item shadowcolor
  6074. The color to be used for drawing a shadow behind the drawn text. For the
  6075. syntax of this option, check the @ref{color syntax,,"Color" section in the
  6076. ffmpeg-utils manual,ffmpeg-utils}.
  6077. The default value of @var{shadowcolor} is "black".
  6078. @item shadowx
  6079. @item shadowy
  6080. The x and y offsets for the text shadow position with respect to the
  6081. position of the text. They can be either positive or negative
  6082. values. The default value for both is "0".
  6083. @item start_number
  6084. The starting frame number for the n/frame_num variable. The default value
  6085. is "0".
  6086. @item tabsize
  6087. The size in number of spaces to use for rendering the tab.
  6088. Default value is 4.
  6089. @item timecode
  6090. Set the initial timecode representation in "hh:mm:ss[:;.]ff"
  6091. format. It can be used with or without text parameter. @var{timecode_rate}
  6092. option must be specified.
  6093. @item timecode_rate, rate, r
  6094. Set the timecode frame rate (timecode only). Value will be rounded to nearest
  6095. integer. Minimum value is "1".
  6096. Drop-frame timecode is supported for frame rates 30 & 60.
  6097. @item tc24hmax
  6098. If set to 1, the output of the timecode option will wrap around at 24 hours.
  6099. Default is 0 (disabled).
  6100. @item text
  6101. The text string to be drawn. The text must be a sequence of UTF-8
  6102. encoded characters.
  6103. This parameter is mandatory if no file is specified with the parameter
  6104. @var{textfile}.
  6105. @item textfile
  6106. A text file containing text to be drawn. The text must be a sequence
  6107. of UTF-8 encoded characters.
  6108. This parameter is mandatory if no text string is specified with the
  6109. parameter @var{text}.
  6110. If both @var{text} and @var{textfile} are specified, an error is thrown.
  6111. @item reload
  6112. If set to 1, the @var{textfile} will be reloaded before each frame.
  6113. Be sure to update it atomically, or it may be read partially, or even fail.
  6114. @item x
  6115. @item y
  6116. The expressions which specify the offsets where text will be drawn
  6117. within the video frame. They are relative to the top/left border of the
  6118. output image.
  6119. The default value of @var{x} and @var{y} is "0".
  6120. See below for the list of accepted constants and functions.
  6121. @end table
  6122. The parameters for @var{x} and @var{y} are expressions containing the
  6123. following constants and functions:
  6124. @table @option
  6125. @item dar
  6126. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  6127. @item hsub
  6128. @item vsub
  6129. horizontal and vertical chroma subsample values. For example for the
  6130. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  6131. @item line_h, lh
  6132. the height of each text line
  6133. @item main_h, h, H
  6134. the input height
  6135. @item main_w, w, W
  6136. the input width
  6137. @item max_glyph_a, ascent
  6138. the maximum distance from the baseline to the highest/upper grid
  6139. coordinate used to place a glyph outline point, for all the rendered
  6140. glyphs.
  6141. It is a positive value, due to the grid's orientation with the Y axis
  6142. upwards.
  6143. @item max_glyph_d, descent
  6144. the maximum distance from the baseline to the lowest grid coordinate
  6145. used to place a glyph outline point, for all the rendered glyphs.
  6146. This is a negative value, due to the grid's orientation, with the Y axis
  6147. upwards.
  6148. @item max_glyph_h
  6149. maximum glyph height, that is the maximum height for all the glyphs
  6150. contained in the rendered text, it is equivalent to @var{ascent} -
  6151. @var{descent}.
  6152. @item max_glyph_w
  6153. maximum glyph width, that is the maximum width for all the glyphs
  6154. contained in the rendered text
  6155. @item n
  6156. the number of input frame, starting from 0
  6157. @item rand(min, max)
  6158. return a random number included between @var{min} and @var{max}
  6159. @item sar
  6160. The input sample aspect ratio.
  6161. @item t
  6162. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6163. @item text_h, th
  6164. the height of the rendered text
  6165. @item text_w, tw
  6166. the width of the rendered text
  6167. @item x
  6168. @item y
  6169. the x and y offset coordinates where the text is drawn.
  6170. These parameters allow the @var{x} and @var{y} expressions to refer
  6171. each other, so you can for example specify @code{y=x/dar}.
  6172. @end table
  6173. @anchor{drawtext_expansion}
  6174. @subsection Text expansion
  6175. If @option{expansion} is set to @code{strftime},
  6176. the filter recognizes strftime() sequences in the provided text and
  6177. expands them accordingly. Check the documentation of strftime(). This
  6178. feature is deprecated.
  6179. If @option{expansion} is set to @code{none}, the text is printed verbatim.
  6180. If @option{expansion} is set to @code{normal} (which is the default),
  6181. the following expansion mechanism is used.
  6182. The backslash character @samp{\}, followed by any character, always expands to
  6183. the second character.
  6184. Sequences of the form @code{%@{...@}} are expanded. The text between the
  6185. braces is a function name, possibly followed by arguments separated by ':'.
  6186. If the arguments contain special characters or delimiters (':' or '@}'),
  6187. they should be escaped.
  6188. Note that they probably must also be escaped as the value for the
  6189. @option{text} option in the filter argument string and as the filter
  6190. argument in the filtergraph description, and possibly also for the shell,
  6191. that makes up to four levels of escaping; using a text file avoids these
  6192. problems.
  6193. The following functions are available:
  6194. @table @command
  6195. @item expr, e
  6196. The expression evaluation result.
  6197. It must take one argument specifying the expression to be evaluated,
  6198. which accepts the same constants and functions as the @var{x} and
  6199. @var{y} values. Note that not all constants should be used, for
  6200. example the text size is not known when evaluating the expression, so
  6201. the constants @var{text_w} and @var{text_h} will have an undefined
  6202. value.
  6203. @item expr_int_format, eif
  6204. Evaluate the expression's value and output as formatted integer.
  6205. The first argument is the expression to be evaluated, just as for the @var{expr} function.
  6206. The second argument specifies the output format. Allowed values are @samp{x},
  6207. @samp{X}, @samp{d} and @samp{u}. They are treated exactly as in the
  6208. @code{printf} function.
  6209. The third parameter is optional and sets the number of positions taken by the output.
  6210. It can be used to add padding with zeros from the left.
  6211. @item gmtime
  6212. The time at which the filter is running, expressed in UTC.
  6213. It can accept an argument: a strftime() format string.
  6214. @item localtime
  6215. The time at which the filter is running, expressed in the local time zone.
  6216. It can accept an argument: a strftime() format string.
  6217. @item metadata
  6218. Frame metadata. Takes one or two arguments.
  6219. The first argument is mandatory and specifies the metadata key.
  6220. The second argument is optional and specifies a default value, used when the
  6221. metadata key is not found or empty.
  6222. @item n, frame_num
  6223. The frame number, starting from 0.
  6224. @item pict_type
  6225. A 1 character description of the current picture type.
  6226. @item pts
  6227. The timestamp of the current frame.
  6228. It can take up to three arguments.
  6229. The first argument is the format of the timestamp; it defaults to @code{flt}
  6230. for seconds as a decimal number with microsecond accuracy; @code{hms} stands
  6231. for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
  6232. @code{gmtime} stands for the timestamp of the frame formatted as UTC time;
  6233. @code{localtime} stands for the timestamp of the frame formatted as
  6234. local time zone time.
  6235. The second argument is an offset added to the timestamp.
  6236. If the format is set to @code{localtime} or @code{gmtime},
  6237. a third argument may be supplied: a strftime() format string.
  6238. By default, @var{YYYY-MM-DD HH:MM:SS} format will be used.
  6239. @end table
  6240. @subsection Examples
  6241. @itemize
  6242. @item
  6243. Draw "Test Text" with font FreeSerif, using the default values for the
  6244. optional parameters.
  6245. @example
  6246. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
  6247. @end example
  6248. @item
  6249. Draw 'Test Text' with font FreeSerif of size 24 at position x=100
  6250. and y=50 (counting from the top-left corner of the screen), text is
  6251. yellow with a red box around it. Both the text and the box have an
  6252. opacity of 20%.
  6253. @example
  6254. drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
  6255. x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
  6256. @end example
  6257. Note that the double quotes are not necessary if spaces are not used
  6258. within the parameter list.
  6259. @item
  6260. Show the text at the center of the video frame:
  6261. @example
  6262. drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
  6263. @end example
  6264. @item
  6265. Show the text at a random position, switching to a new position every 30 seconds:
  6266. @example
  6267. 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)"
  6268. @end example
  6269. @item
  6270. Show a text line sliding from right to left in the last row of the video
  6271. frame. The file @file{LONG_LINE} is assumed to contain a single line
  6272. with no newlines.
  6273. @example
  6274. drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
  6275. @end example
  6276. @item
  6277. Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
  6278. @example
  6279. drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
  6280. @end example
  6281. @item
  6282. Draw a single green letter "g", at the center of the input video.
  6283. The glyph baseline is placed at half screen height.
  6284. @example
  6285. drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
  6286. @end example
  6287. @item
  6288. Show text for 1 second every 3 seconds:
  6289. @example
  6290. drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
  6291. @end example
  6292. @item
  6293. Use fontconfig to set the font. Note that the colons need to be escaped.
  6294. @example
  6295. drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
  6296. @end example
  6297. @item
  6298. Print the date of a real-time encoding (see strftime(3)):
  6299. @example
  6300. drawtext='fontfile=FreeSans.ttf:text=%@{localtime\:%a %b %d %Y@}'
  6301. @end example
  6302. @item
  6303. Show text fading in and out (appearing/disappearing):
  6304. @example
  6305. #!/bin/sh
  6306. DS=1.0 # display start
  6307. DE=10.0 # display end
  6308. FID=1.5 # fade in duration
  6309. FOD=5 # fade out duration
  6310. 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 @}"
  6311. @end example
  6312. @item
  6313. Horizontally align multiple separate texts. Note that @option{max_glyph_a}
  6314. and the @option{fontsize} value are included in the @option{y} offset.
  6315. @example
  6316. drawtext=fontfile=FreeSans.ttf:text=DOG:fontsize=24:x=10:y=20+24-max_glyph_a,
  6317. drawtext=fontfile=FreeSans.ttf:text=cow:fontsize=24:x=80:y=20+24-max_glyph_a
  6318. @end example
  6319. @end itemize
  6320. For more information about libfreetype, check:
  6321. @url{http://www.freetype.org/}.
  6322. For more information about fontconfig, check:
  6323. @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
  6324. For more information about libfribidi, check:
  6325. @url{http://fribidi.org/}.
  6326. @section edgedetect
  6327. Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
  6328. The filter accepts the following options:
  6329. @table @option
  6330. @item low
  6331. @item high
  6332. Set low and high threshold values used by the Canny thresholding
  6333. algorithm.
  6334. The high threshold selects the "strong" edge pixels, which are then
  6335. connected through 8-connectivity with the "weak" edge pixels selected
  6336. by the low threshold.
  6337. @var{low} and @var{high} threshold values must be chosen in the range
  6338. [0,1], and @var{low} should be lesser or equal to @var{high}.
  6339. Default value for @var{low} is @code{20/255}, and default value for @var{high}
  6340. is @code{50/255}.
  6341. @item mode
  6342. Define the drawing mode.
  6343. @table @samp
  6344. @item wires
  6345. Draw white/gray wires on black background.
  6346. @item colormix
  6347. Mix the colors to create a paint/cartoon effect.
  6348. @end table
  6349. Default value is @var{wires}.
  6350. @end table
  6351. @subsection Examples
  6352. @itemize
  6353. @item
  6354. Standard edge detection with custom values for the hysteresis thresholding:
  6355. @example
  6356. edgedetect=low=0.1:high=0.4
  6357. @end example
  6358. @item
  6359. Painting effect without thresholding:
  6360. @example
  6361. edgedetect=mode=colormix:high=0
  6362. @end example
  6363. @end itemize
  6364. @section eq
  6365. Set brightness, contrast, saturation and approximate gamma adjustment.
  6366. The filter accepts the following options:
  6367. @table @option
  6368. @item contrast
  6369. Set the contrast expression. The value must be a float value in range
  6370. @code{-2.0} to @code{2.0}. The default value is "1".
  6371. @item brightness
  6372. Set the brightness expression. The value must be a float value in
  6373. range @code{-1.0} to @code{1.0}. The default value is "0".
  6374. @item saturation
  6375. Set the saturation expression. The value must be a float in
  6376. range @code{0.0} to @code{3.0}. The default value is "1".
  6377. @item gamma
  6378. Set the gamma expression. The value must be a float in range
  6379. @code{0.1} to @code{10.0}. The default value is "1".
  6380. @item gamma_r
  6381. Set the gamma expression for red. The value must be a float in
  6382. range @code{0.1} to @code{10.0}. The default value is "1".
  6383. @item gamma_g
  6384. Set the gamma expression for green. The value must be a float in range
  6385. @code{0.1} to @code{10.0}. The default value is "1".
  6386. @item gamma_b
  6387. Set the gamma expression for blue. The value must be a float in range
  6388. @code{0.1} to @code{10.0}. The default value is "1".
  6389. @item gamma_weight
  6390. Set the gamma weight expression. It can be used to reduce the effect
  6391. of a high gamma value on bright image areas, e.g. keep them from
  6392. getting overamplified and just plain white. The value must be a float
  6393. in range @code{0.0} to @code{1.0}. A value of @code{0.0} turns the
  6394. gamma correction all the way down while @code{1.0} leaves it at its
  6395. full strength. Default is "1".
  6396. @item eval
  6397. Set when the expressions for brightness, contrast, saturation and
  6398. gamma expressions are evaluated.
  6399. It accepts the following values:
  6400. @table @samp
  6401. @item init
  6402. only evaluate expressions once during the filter initialization or
  6403. when a command is processed
  6404. @item frame
  6405. evaluate expressions for each incoming frame
  6406. @end table
  6407. Default value is @samp{init}.
  6408. @end table
  6409. The expressions accept the following parameters:
  6410. @table @option
  6411. @item n
  6412. frame count of the input frame starting from 0
  6413. @item pos
  6414. byte position of the corresponding packet in the input file, NAN if
  6415. unspecified
  6416. @item r
  6417. frame rate of the input video, NAN if the input frame rate is unknown
  6418. @item t
  6419. timestamp expressed in seconds, NAN if the input timestamp is unknown
  6420. @end table
  6421. @subsection Commands
  6422. The filter supports the following commands:
  6423. @table @option
  6424. @item contrast
  6425. Set the contrast expression.
  6426. @item brightness
  6427. Set the brightness expression.
  6428. @item saturation
  6429. Set the saturation expression.
  6430. @item gamma
  6431. Set the gamma expression.
  6432. @item gamma_r
  6433. Set the gamma_r expression.
  6434. @item gamma_g
  6435. Set gamma_g expression.
  6436. @item gamma_b
  6437. Set gamma_b expression.
  6438. @item gamma_weight
  6439. Set gamma_weight expression.
  6440. The command accepts the same syntax of the corresponding option.
  6441. If the specified expression is not valid, it is kept at its current
  6442. value.
  6443. @end table
  6444. @section erosion
  6445. Apply erosion effect to the video.
  6446. This filter replaces the pixel by the local(3x3) minimum.
  6447. It accepts the following options:
  6448. @table @option
  6449. @item threshold0
  6450. @item threshold1
  6451. @item threshold2
  6452. @item threshold3
  6453. Limit the maximum change for each plane, default is 65535.
  6454. If 0, plane will remain unchanged.
  6455. @item coordinates
  6456. Flag which specifies the pixel to refer to. Default is 255 i.e. all eight
  6457. pixels are used.
  6458. Flags to local 3x3 coordinates maps like this:
  6459. 1 2 3
  6460. 4 5
  6461. 6 7 8
  6462. @end table
  6463. @section extractplanes
  6464. Extract color channel components from input video stream into
  6465. separate grayscale video streams.
  6466. The filter accepts the following option:
  6467. @table @option
  6468. @item planes
  6469. Set plane(s) to extract.
  6470. Available values for planes are:
  6471. @table @samp
  6472. @item y
  6473. @item u
  6474. @item v
  6475. @item a
  6476. @item r
  6477. @item g
  6478. @item b
  6479. @end table
  6480. Choosing planes not available in the input will result in an error.
  6481. That means you cannot select @code{r}, @code{g}, @code{b} planes
  6482. with @code{y}, @code{u}, @code{v} planes at same time.
  6483. @end table
  6484. @subsection Examples
  6485. @itemize
  6486. @item
  6487. Extract luma, u and v color channel component from input video frame
  6488. into 3 grayscale outputs:
  6489. @example
  6490. 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
  6491. @end example
  6492. @end itemize
  6493. @section elbg
  6494. Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
  6495. For each input image, the filter will compute the optimal mapping from
  6496. the input to the output given the codebook length, that is the number
  6497. of distinct output colors.
  6498. This filter accepts the following options.
  6499. @table @option
  6500. @item codebook_length, l
  6501. Set codebook length. The value must be a positive integer, and
  6502. represents the number of distinct output colors. Default value is 256.
  6503. @item nb_steps, n
  6504. Set the maximum number of iterations to apply for computing the optimal
  6505. mapping. The higher the value the better the result and the higher the
  6506. computation time. Default value is 1.
  6507. @item seed, s
  6508. Set a random seed, must be an integer included between 0 and
  6509. UINT32_MAX. If not specified, or if explicitly set to -1, the filter
  6510. will try to use a good random seed on a best effort basis.
  6511. @item pal8
  6512. Set pal8 output pixel format. This option does not work with codebook
  6513. length greater than 256.
  6514. @end table
  6515. @section entropy
  6516. Measure graylevel entropy in histogram of color channels of video frames.
  6517. It accepts the following parameters:
  6518. @table @option
  6519. @item mode
  6520. Can be either @var{normal} or @var{diff}. Default is @var{normal}.
  6521. @var{diff} mode measures entropy of histogram delta values, absolute differences
  6522. between neighbour histogram values.
  6523. @end table
  6524. @section fade
  6525. Apply a fade-in/out effect to the input video.
  6526. It accepts the following parameters:
  6527. @table @option
  6528. @item type, t
  6529. The effect type can be either "in" for a fade-in, or "out" for a fade-out
  6530. effect.
  6531. Default is @code{in}.
  6532. @item start_frame, s
  6533. Specify the number of the frame to start applying the fade
  6534. effect at. Default is 0.
  6535. @item nb_frames, n
  6536. The number of frames that the fade effect lasts. At the end of the
  6537. fade-in effect, the output video will have the same intensity as the input video.
  6538. At the end of the fade-out transition, the output video will be filled with the
  6539. selected @option{color}.
  6540. Default is 25.
  6541. @item alpha
  6542. If set to 1, fade only alpha channel, if one exists on the input.
  6543. Default value is 0.
  6544. @item start_time, st
  6545. Specify the timestamp (in seconds) of the frame to start to apply the fade
  6546. effect. If both start_frame and start_time are specified, the fade will start at
  6547. whichever comes last. Default is 0.
  6548. @item duration, d
  6549. The number of seconds for which the fade effect has to last. At the end of the
  6550. fade-in effect the output video will have the same intensity as the input video,
  6551. at the end of the fade-out transition the output video will be filled with the
  6552. selected @option{color}.
  6553. If both duration and nb_frames are specified, duration is used. Default is 0
  6554. (nb_frames is used by default).
  6555. @item color, c
  6556. Specify the color of the fade. Default is "black".
  6557. @end table
  6558. @subsection Examples
  6559. @itemize
  6560. @item
  6561. Fade in the first 30 frames of video:
  6562. @example
  6563. fade=in:0:30
  6564. @end example
  6565. The command above is equivalent to:
  6566. @example
  6567. fade=t=in:s=0:n=30
  6568. @end example
  6569. @item
  6570. Fade out the last 45 frames of a 200-frame video:
  6571. @example
  6572. fade=out:155:45
  6573. fade=type=out:start_frame=155:nb_frames=45
  6574. @end example
  6575. @item
  6576. Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
  6577. @example
  6578. fade=in:0:25, fade=out:975:25
  6579. @end example
  6580. @item
  6581. Make the first 5 frames yellow, then fade in from frame 5-24:
  6582. @example
  6583. fade=in:5:20:color=yellow
  6584. @end example
  6585. @item
  6586. Fade in alpha over first 25 frames of video:
  6587. @example
  6588. fade=in:0:25:alpha=1
  6589. @end example
  6590. @item
  6591. Make the first 5.5 seconds black, then fade in for 0.5 seconds:
  6592. @example
  6593. fade=t=in:st=5.5:d=0.5
  6594. @end example
  6595. @end itemize
  6596. @section fftfilt
  6597. Apply arbitrary expressions to samples in frequency domain
  6598. @table @option
  6599. @item dc_Y
  6600. Adjust the dc value (gain) of the luma plane of the image. The filter
  6601. accepts an integer value in range @code{0} to @code{1000}. The default
  6602. value is set to @code{0}.
  6603. @item dc_U
  6604. Adjust the dc value (gain) of the 1st chroma plane of the image. The
  6605. filter accepts an integer value in range @code{0} to @code{1000}. The
  6606. default value is set to @code{0}.
  6607. @item dc_V
  6608. Adjust the dc value (gain) of the 2nd chroma plane of the image. The
  6609. filter accepts an integer value in range @code{0} to @code{1000}. The
  6610. default value is set to @code{0}.
  6611. @item weight_Y
  6612. Set the frequency domain weight expression for the luma plane.
  6613. @item weight_U
  6614. Set the frequency domain weight expression for the 1st chroma plane.
  6615. @item weight_V
  6616. Set the frequency domain weight expression for the 2nd chroma plane.
  6617. @item eval
  6618. Set when the expressions are evaluated.
  6619. It accepts the following values:
  6620. @table @samp
  6621. @item init
  6622. Only evaluate expressions once during the filter initialization.
  6623. @item frame
  6624. Evaluate expressions for each incoming frame.
  6625. @end table
  6626. Default value is @samp{init}.
  6627. The filter accepts the following variables:
  6628. @item X
  6629. @item Y
  6630. The coordinates of the current sample.
  6631. @item W
  6632. @item H
  6633. The width and height of the image.
  6634. @item N
  6635. The number of input frame, starting from 0.
  6636. @end table
  6637. @subsection Examples
  6638. @itemize
  6639. @item
  6640. High-pass:
  6641. @example
  6642. fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
  6643. @end example
  6644. @item
  6645. Low-pass:
  6646. @example
  6647. fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
  6648. @end example
  6649. @item
  6650. Sharpen:
  6651. @example
  6652. fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
  6653. @end example
  6654. @item
  6655. Blur:
  6656. @example
  6657. fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
  6658. @end example
  6659. @end itemize
  6660. @section field
  6661. Extract a single field from an interlaced image using stride
  6662. arithmetic to avoid wasting CPU time. The output frames are marked as
  6663. non-interlaced.
  6664. The filter accepts the following options:
  6665. @table @option
  6666. @item type
  6667. Specify whether to extract the top (if the value is @code{0} or
  6668. @code{top}) or the bottom field (if the value is @code{1} or
  6669. @code{bottom}).
  6670. @end table
  6671. @section fieldhint
  6672. Create new frames by copying the top and bottom fields from surrounding frames
  6673. supplied as numbers by the hint file.
  6674. @table @option
  6675. @item hint
  6676. Set file containing hints: absolute/relative frame numbers.
  6677. There must be one line for each frame in a clip. Each line must contain two
  6678. numbers separated by the comma, optionally followed by @code{-} or @code{+}.
  6679. Numbers supplied on each line of file can not be out of [N-1,N+1] where N
  6680. is current frame number for @code{absolute} mode or out of [-1, 1] range
  6681. for @code{relative} mode. First number tells from which frame to pick up top
  6682. field and second number tells from which frame to pick up bottom field.
  6683. If optionally followed by @code{+} output frame will be marked as interlaced,
  6684. else if followed by @code{-} output frame will be marked as progressive, else
  6685. it will be marked same as input frame.
  6686. If line starts with @code{#} or @code{;} that line is skipped.
  6687. @item mode
  6688. Can be item @code{absolute} or @code{relative}. Default is @code{absolute}.
  6689. @end table
  6690. Example of first several lines of @code{hint} file for @code{relative} mode:
  6691. @example
  6692. 0,0 - # first frame
  6693. 1,0 - # second frame, use third's frame top field and second's frame bottom field
  6694. 1,0 - # third frame, use fourth's frame top field and third's frame bottom field
  6695. 1,0 -
  6696. 0,0 -
  6697. 0,0 -
  6698. 1,0 -
  6699. 1,0 -
  6700. 1,0 -
  6701. 0,0 -
  6702. 0,0 -
  6703. 1,0 -
  6704. 1,0 -
  6705. 1,0 -
  6706. 0,0 -
  6707. @end example
  6708. @section fieldmatch
  6709. Field matching filter for inverse telecine. It is meant to reconstruct the
  6710. progressive frames from a telecined stream. The filter does not drop duplicated
  6711. frames, so to achieve a complete inverse telecine @code{fieldmatch} needs to be
  6712. followed by a decimation filter such as @ref{decimate} in the filtergraph.
  6713. The separation of the field matching and the decimation is notably motivated by
  6714. the possibility of inserting a de-interlacing filter fallback between the two.
  6715. If the source has mixed telecined and real interlaced content,
  6716. @code{fieldmatch} will not be able to match fields for the interlaced parts.
  6717. But these remaining combed frames will be marked as interlaced, and thus can be
  6718. de-interlaced by a later filter such as @ref{yadif} before decimation.
  6719. In addition to the various configuration options, @code{fieldmatch} can take an
  6720. optional second stream, activated through the @option{ppsrc} option. If
  6721. enabled, the frames reconstruction will be based on the fields and frames from
  6722. this second stream. This allows the first input to be pre-processed in order to
  6723. help the various algorithms of the filter, while keeping the output lossless
  6724. (assuming the fields are matched properly). Typically, a field-aware denoiser,
  6725. or brightness/contrast adjustments can help.
  6726. Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
  6727. and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
  6728. which @code{fieldmatch} is based on. While the semantic and usage are very
  6729. close, some behaviour and options names can differ.
  6730. The @ref{decimate} filter currently only works for constant frame rate input.
  6731. If your input has mixed telecined (30fps) and progressive content with a lower
  6732. framerate like 24fps use the following filterchain to produce the necessary cfr
  6733. stream: @code{dejudder,fps=30000/1001,fieldmatch,decimate}.
  6734. The filter accepts the following options:
  6735. @table @option
  6736. @item order
  6737. Specify the assumed field order of the input stream. Available values are:
  6738. @table @samp
  6739. @item auto
  6740. Auto detect parity (use FFmpeg's internal parity value).
  6741. @item bff
  6742. Assume bottom field first.
  6743. @item tff
  6744. Assume top field first.
  6745. @end table
  6746. Note that it is sometimes recommended not to trust the parity announced by the
  6747. stream.
  6748. Default value is @var{auto}.
  6749. @item mode
  6750. Set the matching mode or strategy to use. @option{pc} mode is the safest in the
  6751. sense that it won't risk creating jerkiness due to duplicate frames when
  6752. possible, but if there are bad edits or blended fields it will end up
  6753. outputting combed frames when a good match might actually exist. On the other
  6754. hand, @option{pcn_ub} mode is the most risky in terms of creating jerkiness,
  6755. but will almost always find a good frame if there is one. The other values are
  6756. all somewhere in between @option{pc} and @option{pcn_ub} in terms of risking
  6757. jerkiness and creating duplicate frames versus finding good matches in sections
  6758. with bad edits, orphaned fields, blended fields, etc.
  6759. More details about p/c/n/u/b are available in @ref{p/c/n/u/b meaning} section.
  6760. Available values are:
  6761. @table @samp
  6762. @item pc
  6763. 2-way matching (p/c)
  6764. @item pc_n
  6765. 2-way matching, and trying 3rd match if still combed (p/c + n)
  6766. @item pc_u
  6767. 2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
  6768. @item pc_n_ub
  6769. 2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
  6770. still combed (p/c + n + u/b)
  6771. @item pcn
  6772. 3-way matching (p/c/n)
  6773. @item pcn_ub
  6774. 3-way matching, and trying 4th/5th matches if all 3 of the original matches are
  6775. detected as combed (p/c/n + u/b)
  6776. @end table
  6777. The parenthesis at the end indicate the matches that would be used for that
  6778. mode assuming @option{order}=@var{tff} (and @option{field} on @var{auto} or
  6779. @var{top}).
  6780. In terms of speed @option{pc} mode is by far the fastest and @option{pcn_ub} is
  6781. the slowest.
  6782. Default value is @var{pc_n}.
  6783. @item ppsrc
  6784. Mark the main input stream as a pre-processed input, and enable the secondary
  6785. input stream as the clean source to pick the fields from. See the filter
  6786. introduction for more details. It is similar to the @option{clip2} feature from
  6787. VFM/TFM.
  6788. Default value is @code{0} (disabled).
  6789. @item field
  6790. Set the field to match from. It is recommended to set this to the same value as
  6791. @option{order} unless you experience matching failures with that setting. In
  6792. certain circumstances changing the field that is used to match from can have a
  6793. large impact on matching performance. Available values are:
  6794. @table @samp
  6795. @item auto
  6796. Automatic (same value as @option{order}).
  6797. @item bottom
  6798. Match from the bottom field.
  6799. @item top
  6800. Match from the top field.
  6801. @end table
  6802. Default value is @var{auto}.
  6803. @item mchroma
  6804. Set whether or not chroma is included during the match comparisons. In most
  6805. cases it is recommended to leave this enabled. You should set this to @code{0}
  6806. only if your clip has bad chroma problems such as heavy rainbowing or other
  6807. artifacts. Setting this to @code{0} could also be used to speed things up at
  6808. the cost of some accuracy.
  6809. Default value is @code{1}.
  6810. @item y0
  6811. @item y1
  6812. These define an exclusion band which excludes the lines between @option{y0} and
  6813. @option{y1} from being included in the field matching decision. An exclusion
  6814. band can be used to ignore subtitles, a logo, or other things that may
  6815. interfere with the matching. @option{y0} sets the starting scan line and
  6816. @option{y1} sets the ending line; all lines in between @option{y0} and
  6817. @option{y1} (including @option{y0} and @option{y1}) will be ignored. Setting
  6818. @option{y0} and @option{y1} to the same value will disable the feature.
  6819. @option{y0} and @option{y1} defaults to @code{0}.
  6820. @item scthresh
  6821. Set the scene change detection threshold as a percentage of maximum change on
  6822. the luma plane. Good values are in the @code{[8.0, 14.0]} range. Scene change
  6823. detection is only relevant in case @option{combmatch}=@var{sc}. The range for
  6824. @option{scthresh} is @code{[0.0, 100.0]}.
  6825. Default value is @code{12.0}.
  6826. @item combmatch
  6827. When @option{combatch} is not @var{none}, @code{fieldmatch} will take into
  6828. account the combed scores of matches when deciding what match to use as the
  6829. final match. Available values are:
  6830. @table @samp
  6831. @item none
  6832. No final matching based on combed scores.
  6833. @item sc
  6834. Combed scores are only used when a scene change is detected.
  6835. @item full
  6836. Use combed scores all the time.
  6837. @end table
  6838. Default is @var{sc}.
  6839. @item combdbg
  6840. Force @code{fieldmatch} to calculate the combed metrics for certain matches and
  6841. print them. This setting is known as @option{micout} in TFM/VFM vocabulary.
  6842. Available values are:
  6843. @table @samp
  6844. @item none
  6845. No forced calculation.
  6846. @item pcn
  6847. Force p/c/n calculations.
  6848. @item pcnub
  6849. Force p/c/n/u/b calculations.
  6850. @end table
  6851. Default value is @var{none}.
  6852. @item cthresh
  6853. This is the area combing threshold used for combed frame detection. This
  6854. essentially controls how "strong" or "visible" combing must be to be detected.
  6855. Larger values mean combing must be more visible and smaller values mean combing
  6856. can be less visible or strong and still be detected. Valid settings are from
  6857. @code{-1} (every pixel will be detected as combed) to @code{255} (no pixel will
  6858. be detected as combed). This is basically a pixel difference value. A good
  6859. range is @code{[8, 12]}.
  6860. Default value is @code{9}.
  6861. @item chroma
  6862. Sets whether or not chroma is considered in the combed frame decision. Only
  6863. disable this if your source has chroma problems (rainbowing, etc.) that are
  6864. causing problems for the combed frame detection with chroma enabled. Actually,
  6865. using @option{chroma}=@var{0} is usually more reliable, except for the case
  6866. where there is chroma only combing in the source.
  6867. Default value is @code{0}.
  6868. @item blockx
  6869. @item blocky
  6870. Respectively set the x-axis and y-axis size of the window used during combed
  6871. frame detection. This has to do with the size of the area in which
  6872. @option{combpel} pixels are required to be detected as combed for a frame to be
  6873. declared combed. See the @option{combpel} parameter description for more info.
  6874. Possible values are any number that is a power of 2 starting at 4 and going up
  6875. to 512.
  6876. Default value is @code{16}.
  6877. @item combpel
  6878. The number of combed pixels inside any of the @option{blocky} by
  6879. @option{blockx} size blocks on the frame for the frame to be detected as
  6880. combed. While @option{cthresh} controls how "visible" the combing must be, this
  6881. setting controls "how much" combing there must be in any localized area (a
  6882. window defined by the @option{blockx} and @option{blocky} settings) on the
  6883. frame. Minimum value is @code{0} and maximum is @code{blocky x blockx} (at
  6884. which point no frames will ever be detected as combed). This setting is known
  6885. as @option{MI} in TFM/VFM vocabulary.
  6886. Default value is @code{80}.
  6887. @end table
  6888. @anchor{p/c/n/u/b meaning}
  6889. @subsection p/c/n/u/b meaning
  6890. @subsubsection p/c/n
  6891. We assume the following telecined stream:
  6892. @example
  6893. Top fields: 1 2 2 3 4
  6894. Bottom fields: 1 2 3 4 4
  6895. @end example
  6896. The numbers correspond to the progressive frame the fields relate to. Here, the
  6897. first two frames are progressive, the 3rd and 4th are combed, and so on.
  6898. When @code{fieldmatch} is configured to run a matching from bottom
  6899. (@option{field}=@var{bottom}) this is how this input stream get transformed:
  6900. @example
  6901. Input stream:
  6902. T 1 2 2 3 4
  6903. B 1 2 3 4 4 <-- matching reference
  6904. Matches: c c n n c
  6905. Output stream:
  6906. T 1 2 3 4 4
  6907. B 1 2 3 4 4
  6908. @end example
  6909. As a result of the field matching, we can see that some frames get duplicated.
  6910. To perform a complete inverse telecine, you need to rely on a decimation filter
  6911. after this operation. See for instance the @ref{decimate} filter.
  6912. The same operation now matching from top fields (@option{field}=@var{top})
  6913. looks like this:
  6914. @example
  6915. Input stream:
  6916. T 1 2 2 3 4 <-- matching reference
  6917. B 1 2 3 4 4
  6918. Matches: c c p p c
  6919. Output stream:
  6920. T 1 2 2 3 4
  6921. B 1 2 2 3 4
  6922. @end example
  6923. In these examples, we can see what @var{p}, @var{c} and @var{n} mean;
  6924. basically, they refer to the frame and field of the opposite parity:
  6925. @itemize
  6926. @item @var{p} matches the field of the opposite parity in the previous frame
  6927. @item @var{c} matches the field of the opposite parity in the current frame
  6928. @item @var{n} matches the field of the opposite parity in the next frame
  6929. @end itemize
  6930. @subsubsection u/b
  6931. The @var{u} and @var{b} matching are a bit special in the sense that they match
  6932. from the opposite parity flag. In the following examples, we assume that we are
  6933. currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
  6934. 'x' is placed above and below each matched fields.
  6935. With bottom matching (@option{field}=@var{bottom}):
  6936. @example
  6937. Match: c p n b u
  6938. x x x x x
  6939. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6940. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6941. x x x x x
  6942. Output frames:
  6943. 2 1 2 2 2
  6944. 2 2 2 1 3
  6945. @end example
  6946. With top matching (@option{field}=@var{top}):
  6947. @example
  6948. Match: c p n b u
  6949. x x x x x
  6950. Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
  6951. Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
  6952. x x x x x
  6953. Output frames:
  6954. 2 2 2 1 2
  6955. 2 1 3 2 2
  6956. @end example
  6957. @subsection Examples
  6958. Simple IVTC of a top field first telecined stream:
  6959. @example
  6960. fieldmatch=order=tff:combmatch=none, decimate
  6961. @end example
  6962. Advanced IVTC, with fallback on @ref{yadif} for still combed frames:
  6963. @example
  6964. fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
  6965. @end example
  6966. @section fieldorder
  6967. Transform the field order of the input video.
  6968. It accepts the following parameters:
  6969. @table @option
  6970. @item order
  6971. The output field order. Valid values are @var{tff} for top field first or @var{bff}
  6972. for bottom field first.
  6973. @end table
  6974. The default value is @samp{tff}.
  6975. The transformation is done by shifting the picture content up or down
  6976. by one line, and filling the remaining line with appropriate picture content.
  6977. This method is consistent with most broadcast field order converters.
  6978. If the input video is not flagged as being interlaced, or it is already
  6979. flagged as being of the required output field order, then this filter does
  6980. not alter the incoming video.
  6981. It is very useful when converting to or from PAL DV material,
  6982. which is bottom field first.
  6983. For example:
  6984. @example
  6985. ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
  6986. @end example
  6987. @section fifo, afifo
  6988. Buffer input images and send them when they are requested.
  6989. It is mainly useful when auto-inserted by the libavfilter
  6990. framework.
  6991. It does not take parameters.
  6992. @section fillborders
  6993. Fill borders of the input video, without changing video stream dimensions.
  6994. Sometimes video can have garbage at the four edges and you may not want to
  6995. crop video input to keep size multiple of some number.
  6996. This filter accepts the following options:
  6997. @table @option
  6998. @item left
  6999. Number of pixels to fill from left border.
  7000. @item right
  7001. Number of pixels to fill from right border.
  7002. @item top
  7003. Number of pixels to fill from top border.
  7004. @item bottom
  7005. Number of pixels to fill from bottom border.
  7006. @item mode
  7007. Set fill mode.
  7008. It accepts the following values:
  7009. @table @samp
  7010. @item smear
  7011. fill pixels using outermost pixels
  7012. @item mirror
  7013. fill pixels using mirroring
  7014. @item fixed
  7015. fill pixels with constant value
  7016. @end table
  7017. Default is @var{smear}.
  7018. @item color
  7019. Set color for pixels in fixed mode. Default is @var{black}.
  7020. @end table
  7021. @section find_rect
  7022. Find a rectangular object
  7023. It accepts the following options:
  7024. @table @option
  7025. @item object
  7026. Filepath of the object image, needs to be in gray8.
  7027. @item threshold
  7028. Detection threshold, default is 0.5.
  7029. @item mipmaps
  7030. Number of mipmaps, default is 3.
  7031. @item xmin, ymin, xmax, ymax
  7032. Specifies the rectangle in which to search.
  7033. @end table
  7034. @subsection Examples
  7035. @itemize
  7036. @item
  7037. Generate a representative palette of a given video using @command{ffmpeg}:
  7038. @example
  7039. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7040. @end example
  7041. @end itemize
  7042. @section cover_rect
  7043. Cover a rectangular object
  7044. It accepts the following options:
  7045. @table @option
  7046. @item cover
  7047. Filepath of the optional cover image, needs to be in yuv420.
  7048. @item mode
  7049. Set covering mode.
  7050. It accepts the following values:
  7051. @table @samp
  7052. @item cover
  7053. cover it by the supplied image
  7054. @item blur
  7055. cover it by interpolating the surrounding pixels
  7056. @end table
  7057. Default value is @var{blur}.
  7058. @end table
  7059. @subsection Examples
  7060. @itemize
  7061. @item
  7062. Generate a representative palette of a given video using @command{ffmpeg}:
  7063. @example
  7064. ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
  7065. @end example
  7066. @end itemize
  7067. @section floodfill
  7068. Flood area with values of same pixel components with another values.
  7069. It accepts the following options:
  7070. @table @option
  7071. @item x
  7072. Set pixel x coordinate.
  7073. @item y
  7074. Set pixel y coordinate.
  7075. @item s0
  7076. Set source #0 component value.
  7077. @item s1
  7078. Set source #1 component value.
  7079. @item s2
  7080. Set source #2 component value.
  7081. @item s3
  7082. Set source #3 component value.
  7083. @item d0
  7084. Set destination #0 component value.
  7085. @item d1
  7086. Set destination #1 component value.
  7087. @item d2
  7088. Set destination #2 component value.
  7089. @item d3
  7090. Set destination #3 component value.
  7091. @end table
  7092. @anchor{format}
  7093. @section format
  7094. Convert the input video to one of the specified pixel formats.
  7095. Libavfilter will try to pick one that is suitable as input to
  7096. the next filter.
  7097. It accepts the following parameters:
  7098. @table @option
  7099. @item pix_fmts
  7100. A '|'-separated list of pixel format names, such as
  7101. "pix_fmts=yuv420p|monow|rgb24".
  7102. @end table
  7103. @subsection Examples
  7104. @itemize
  7105. @item
  7106. Convert the input video to the @var{yuv420p} format
  7107. @example
  7108. format=pix_fmts=yuv420p
  7109. @end example
  7110. Convert the input video to any of the formats in the list
  7111. @example
  7112. format=pix_fmts=yuv420p|yuv444p|yuv410p
  7113. @end example
  7114. @end itemize
  7115. @anchor{fps}
  7116. @section fps
  7117. Convert the video to specified constant frame rate by duplicating or dropping
  7118. frames as necessary.
  7119. It accepts the following parameters:
  7120. @table @option
  7121. @item fps
  7122. The desired output frame rate. The default is @code{25}.
  7123. @item start_time
  7124. Assume the first PTS should be the given value, in seconds. This allows for
  7125. padding/trimming at the start of stream. By default, no assumption is made
  7126. about the first frame's expected PTS, so no padding or trimming is done.
  7127. For example, this could be set to 0 to pad the beginning with duplicates of
  7128. the first frame if a video stream starts after the audio stream or to trim any
  7129. frames with a negative PTS.
  7130. @item round
  7131. Timestamp (PTS) rounding method.
  7132. Possible values are:
  7133. @table @option
  7134. @item zero
  7135. round towards 0
  7136. @item inf
  7137. round away from 0
  7138. @item down
  7139. round towards -infinity
  7140. @item up
  7141. round towards +infinity
  7142. @item near
  7143. round to nearest
  7144. @end table
  7145. The default is @code{near}.
  7146. @item eof_action
  7147. Action performed when reading the last frame.
  7148. Possible values are:
  7149. @table @option
  7150. @item round
  7151. Use same timestamp rounding method as used for other frames.
  7152. @item pass
  7153. Pass through last frame if input duration has not been reached yet.
  7154. @end table
  7155. The default is @code{round}.
  7156. @end table
  7157. Alternatively, the options can be specified as a flat string:
  7158. @var{fps}[:@var{start_time}[:@var{round}]].
  7159. See also the @ref{setpts} filter.
  7160. @subsection Examples
  7161. @itemize
  7162. @item
  7163. A typical usage in order to set the fps to 25:
  7164. @example
  7165. fps=fps=25
  7166. @end example
  7167. @item
  7168. Sets the fps to 24, using abbreviation and rounding method to round to nearest:
  7169. @example
  7170. fps=fps=film:round=near
  7171. @end example
  7172. @end itemize
  7173. @section framepack
  7174. Pack two different video streams into a stereoscopic video, setting proper
  7175. metadata on supported codecs. The two views should have the same size and
  7176. framerate and processing will stop when the shorter video ends. Please note
  7177. that you may conveniently adjust view properties with the @ref{scale} and
  7178. @ref{fps} filters.
  7179. It accepts the following parameters:
  7180. @table @option
  7181. @item format
  7182. The desired packing format. Supported values are:
  7183. @table @option
  7184. @item sbs
  7185. The views are next to each other (default).
  7186. @item tab
  7187. The views are on top of each other.
  7188. @item lines
  7189. The views are packed by line.
  7190. @item columns
  7191. The views are packed by column.
  7192. @item frameseq
  7193. The views are temporally interleaved.
  7194. @end table
  7195. @end table
  7196. Some examples:
  7197. @example
  7198. # Convert left and right views into a frame-sequential video
  7199. ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
  7200. # Convert views into a side-by-side video with the same output resolution as the input
  7201. 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
  7202. @end example
  7203. @section framerate
  7204. Change the frame rate by interpolating new video output frames from the source
  7205. frames.
  7206. This filter is not designed to function correctly with interlaced media. If
  7207. you wish to change the frame rate of interlaced media then you are required
  7208. to deinterlace before this filter and re-interlace after this filter.
  7209. A description of the accepted options follows.
  7210. @table @option
  7211. @item fps
  7212. Specify the output frames per second. This option can also be specified
  7213. as a value alone. The default is @code{50}.
  7214. @item interp_start
  7215. Specify the start of a range where the output frame will be created as a
  7216. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7217. the default is @code{15}.
  7218. @item interp_end
  7219. Specify the end of a range where the output frame will be created as a
  7220. linear interpolation of two frames. The range is [@code{0}-@code{255}],
  7221. the default is @code{240}.
  7222. @item scene
  7223. Specify the level at which a scene change is detected as a value between
  7224. 0 and 100 to indicate a new scene; a low value reflects a low
  7225. probability for the current frame to introduce a new scene, while a higher
  7226. value means the current frame is more likely to be one.
  7227. The default is @code{8.2}.
  7228. @item flags
  7229. Specify flags influencing the filter process.
  7230. Available value for @var{flags} is:
  7231. @table @option
  7232. @item scene_change_detect, scd
  7233. Enable scene change detection using the value of the option @var{scene}.
  7234. This flag is enabled by default.
  7235. @end table
  7236. @end table
  7237. @section framestep
  7238. Select one frame every N-th frame.
  7239. This filter accepts the following option:
  7240. @table @option
  7241. @item step
  7242. Select frame after every @code{step} frames.
  7243. Allowed values are positive integers higher than 0. Default value is @code{1}.
  7244. @end table
  7245. @anchor{frei0r}
  7246. @section frei0r
  7247. Apply a frei0r effect to the input video.
  7248. To enable the compilation of this filter, you need to install the frei0r
  7249. header and configure FFmpeg with @code{--enable-frei0r}.
  7250. It accepts the following parameters:
  7251. @table @option
  7252. @item filter_name
  7253. The name of the frei0r effect to load. If the environment variable
  7254. @env{FREI0R_PATH} is defined, the frei0r effect is searched for in each of the
  7255. directories specified by the colon-separated list in @env{FREI0R_PATH}.
  7256. Otherwise, the standard frei0r paths are searched, in this order:
  7257. @file{HOME/.frei0r-1/lib/}, @file{/usr/local/lib/frei0r-1/},
  7258. @file{/usr/lib/frei0r-1/}.
  7259. @item filter_params
  7260. A '|'-separated list of parameters to pass to the frei0r effect.
  7261. @end table
  7262. A frei0r effect parameter can be a boolean (its value is either
  7263. "y" or "n"), a double, a color (specified as
  7264. @var{R}/@var{G}/@var{B}, where @var{R}, @var{G}, and @var{B} are floating point
  7265. numbers between 0.0 and 1.0, inclusive) or a color description as specified in the
  7266. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils},
  7267. a position (specified as @var{X}/@var{Y}, where
  7268. @var{X} and @var{Y} are floating point numbers) and/or a string.
  7269. The number and types of parameters depend on the loaded effect. If an
  7270. effect parameter is not specified, the default value is set.
  7271. @subsection Examples
  7272. @itemize
  7273. @item
  7274. Apply the distort0r effect, setting the first two double parameters:
  7275. @example
  7276. frei0r=filter_name=distort0r:filter_params=0.5|0.01
  7277. @end example
  7278. @item
  7279. Apply the colordistance effect, taking a color as the first parameter:
  7280. @example
  7281. frei0r=colordistance:0.2/0.3/0.4
  7282. frei0r=colordistance:violet
  7283. frei0r=colordistance:0x112233
  7284. @end example
  7285. @item
  7286. Apply the perspective effect, specifying the top left and top right image
  7287. positions:
  7288. @example
  7289. frei0r=perspective:0.2/0.2|0.8/0.2
  7290. @end example
  7291. @end itemize
  7292. For more information, see
  7293. @url{http://frei0r.dyne.org}
  7294. @section fspp
  7295. Apply fast and simple postprocessing. It is a faster version of @ref{spp}.
  7296. It splits (I)DCT into horizontal/vertical passes. Unlike the simple post-
  7297. processing filter, one of them is performed once per block, not per pixel.
  7298. This allows for much higher speed.
  7299. The filter accepts the following options:
  7300. @table @option
  7301. @item quality
  7302. Set quality. This option defines the number of levels for averaging. It accepts
  7303. an integer in the range 4-5. Default value is @code{4}.
  7304. @item qp
  7305. Force a constant quantization parameter. It accepts an integer in range 0-63.
  7306. If not set, the filter will use the QP from the video stream (if available).
  7307. @item strength
  7308. Set filter strength. It accepts an integer in range -15 to 32. Lower values mean
  7309. more details but also more artifacts, while higher values make the image smoother
  7310. but also blurrier. Default value is @code{0} − PSNR optimal.
  7311. @item use_bframe_qp
  7312. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  7313. option may cause flicker since the B-Frames have often larger QP. Default is
  7314. @code{0} (not enabled).
  7315. @end table
  7316. @section gblur
  7317. Apply Gaussian blur filter.
  7318. The filter accepts the following options:
  7319. @table @option
  7320. @item sigma
  7321. Set horizontal sigma, standard deviation of Gaussian blur. Default is @code{0.5}.
  7322. @item steps
  7323. Set number of steps for Gaussian approximation. Defauls is @code{1}.
  7324. @item planes
  7325. Set which planes to filter. By default all planes are filtered.
  7326. @item sigmaV
  7327. Set vertical sigma, if negative it will be same as @code{sigma}.
  7328. Default is @code{-1}.
  7329. @end table
  7330. @section geq
  7331. The filter accepts the following options:
  7332. @table @option
  7333. @item lum_expr, lum
  7334. Set the luminance expression.
  7335. @item cb_expr, cb
  7336. Set the chrominance blue expression.
  7337. @item cr_expr, cr
  7338. Set the chrominance red expression.
  7339. @item alpha_expr, a
  7340. Set the alpha expression.
  7341. @item red_expr, r
  7342. Set the red expression.
  7343. @item green_expr, g
  7344. Set the green expression.
  7345. @item blue_expr, b
  7346. Set the blue expression.
  7347. @end table
  7348. The colorspace is selected according to the specified options. If one
  7349. of the @option{lum_expr}, @option{cb_expr}, or @option{cr_expr}
  7350. options is specified, the filter will automatically select a YCbCr
  7351. colorspace. If one of the @option{red_expr}, @option{green_expr}, or
  7352. @option{blue_expr} options is specified, it will select an RGB
  7353. colorspace.
  7354. If one of the chrominance expression is not defined, it falls back on the other
  7355. one. If no alpha expression is specified it will evaluate to opaque value.
  7356. If none of chrominance expressions are specified, they will evaluate
  7357. to the luminance expression.
  7358. The expressions can use the following variables and functions:
  7359. @table @option
  7360. @item N
  7361. The sequential number of the filtered frame, starting from @code{0}.
  7362. @item X
  7363. @item Y
  7364. The coordinates of the current sample.
  7365. @item W
  7366. @item H
  7367. The width and height of the image.
  7368. @item SW
  7369. @item SH
  7370. Width and height scale depending on the currently filtered plane. It is the
  7371. ratio between the corresponding luma plane number of pixels and the current
  7372. plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
  7373. @code{0.5,0.5} for chroma planes.
  7374. @item T
  7375. Time of the current frame, expressed in seconds.
  7376. @item p(x, y)
  7377. Return the value of the pixel at location (@var{x},@var{y}) of the current
  7378. plane.
  7379. @item lum(x, y)
  7380. Return the value of the pixel at location (@var{x},@var{y}) of the luminance
  7381. plane.
  7382. @item cb(x, y)
  7383. Return the value of the pixel at location (@var{x},@var{y}) of the
  7384. blue-difference chroma plane. Return 0 if there is no such plane.
  7385. @item cr(x, y)
  7386. Return the value of the pixel at location (@var{x},@var{y}) of the
  7387. red-difference chroma plane. Return 0 if there is no such plane.
  7388. @item r(x, y)
  7389. @item g(x, y)
  7390. @item b(x, y)
  7391. Return the value of the pixel at location (@var{x},@var{y}) of the
  7392. red/green/blue component. Return 0 if there is no such component.
  7393. @item alpha(x, y)
  7394. Return the value of the pixel at location (@var{x},@var{y}) of the alpha
  7395. plane. Return 0 if there is no such plane.
  7396. @end table
  7397. For functions, if @var{x} and @var{y} are outside the area, the value will be
  7398. automatically clipped to the closer edge.
  7399. @subsection Examples
  7400. @itemize
  7401. @item
  7402. Flip the image horizontally:
  7403. @example
  7404. geq=p(W-X\,Y)
  7405. @end example
  7406. @item
  7407. Generate a bidimensional sine wave, with angle @code{PI/3} and a
  7408. wavelength of 100 pixels:
  7409. @example
  7410. geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
  7411. @end example
  7412. @item
  7413. Generate a fancy enigmatic moving light:
  7414. @example
  7415. 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
  7416. @end example
  7417. @item
  7418. Generate a quick emboss effect:
  7419. @example
  7420. format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
  7421. @end example
  7422. @item
  7423. Modify RGB components depending on pixel position:
  7424. @example
  7425. geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
  7426. @end example
  7427. @item
  7428. Create a radial gradient that is the same size as the input (also see
  7429. the @ref{vignette} filter):
  7430. @example
  7431. geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
  7432. @end example
  7433. @end itemize
  7434. @section gradfun
  7435. Fix the banding artifacts that are sometimes introduced into nearly flat
  7436. regions by truncation to 8-bit color depth.
  7437. Interpolate the gradients that should go where the bands are, and
  7438. dither them.
  7439. It is designed for playback only. Do not use it prior to
  7440. lossy compression, because compression tends to lose the dither and
  7441. bring back the bands.
  7442. It accepts the following parameters:
  7443. @table @option
  7444. @item strength
  7445. The maximum amount by which the filter will change any one pixel. This is also
  7446. the threshold for detecting nearly flat regions. Acceptable values range from
  7447. .51 to 64; the default value is 1.2. Out-of-range values will be clipped to the
  7448. valid range.
  7449. @item radius
  7450. The neighborhood to fit the gradient to. A larger radius makes for smoother
  7451. gradients, but also prevents the filter from modifying the pixels near detailed
  7452. regions. Acceptable values are 8-32; the default value is 16. Out-of-range
  7453. values will be clipped to the valid range.
  7454. @end table
  7455. Alternatively, the options can be specified as a flat string:
  7456. @var{strength}[:@var{radius}]
  7457. @subsection Examples
  7458. @itemize
  7459. @item
  7460. Apply the filter with a @code{3.5} strength and radius of @code{8}:
  7461. @example
  7462. gradfun=3.5:8
  7463. @end example
  7464. @item
  7465. Specify radius, omitting the strength (which will fall-back to the default
  7466. value):
  7467. @example
  7468. gradfun=radius=8
  7469. @end example
  7470. @end itemize
  7471. @anchor{haldclut}
  7472. @section haldclut
  7473. Apply a Hald CLUT to a video stream.
  7474. First input is the video stream to process, and second one is the Hald CLUT.
  7475. The Hald CLUT input can be a simple picture or a complete video stream.
  7476. The filter accepts the following options:
  7477. @table @option
  7478. @item shortest
  7479. Force termination when the shortest input terminates. Default is @code{0}.
  7480. @item repeatlast
  7481. Continue applying the last CLUT after the end of the stream. A value of
  7482. @code{0} disable the filter after the last frame of the CLUT is reached.
  7483. Default is @code{1}.
  7484. @end table
  7485. @code{haldclut} also has the same interpolation options as @ref{lut3d} (both
  7486. filters share the same internals).
  7487. More information about the Hald CLUT can be found on Eskil Steenberg's website
  7488. (Hald CLUT author) at @url{http://www.quelsolaar.com/technology/clut.html}.
  7489. @subsection Workflow examples
  7490. @subsubsection Hald CLUT video stream
  7491. Generate an identity Hald CLUT stream altered with various effects:
  7492. @example
  7493. 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
  7494. @end example
  7495. Note: make sure you use a lossless codec.
  7496. Then use it with @code{haldclut} to apply it on some random stream:
  7497. @example
  7498. ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
  7499. @end example
  7500. The Hald CLUT will be applied to the 10 first seconds (duration of
  7501. @file{clut.nut}), then the latest picture of that CLUT stream will be applied
  7502. to the remaining frames of the @code{mandelbrot} stream.
  7503. @subsubsection Hald CLUT with preview
  7504. A Hald CLUT is supposed to be a squared image of @code{Level*Level*Level} by
  7505. @code{Level*Level*Level} pixels. For a given Hald CLUT, FFmpeg will select the
  7506. biggest possible square starting at the top left of the picture. The remaining
  7507. padding pixels (bottom or right) will be ignored. This area can be used to add
  7508. a preview of the Hald CLUT.
  7509. Typically, the following generated Hald CLUT will be supported by the
  7510. @code{haldclut} filter:
  7511. @example
  7512. ffmpeg -f lavfi -i @ref{haldclutsrc}=8 -vf "
  7513. pad=iw+320 [padded_clut];
  7514. smptebars=s=320x256, split [a][b];
  7515. [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
  7516. [main][b] overlay=W-320" -frames:v 1 clut.png
  7517. @end example
  7518. It contains the original and a preview of the effect of the CLUT: SMPTE color
  7519. bars are displayed on the right-top, and below the same color bars processed by
  7520. the color changes.
  7521. Then, the effect of this Hald CLUT can be visualized with:
  7522. @example
  7523. ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
  7524. @end example
  7525. @section hflip
  7526. Flip the input video horizontally.
  7527. For example, to horizontally flip the input video with @command{ffmpeg}:
  7528. @example
  7529. ffmpeg -i in.avi -vf "hflip" out.avi
  7530. @end example
  7531. @section histeq
  7532. This filter applies a global color histogram equalization on a
  7533. per-frame basis.
  7534. It can be used to correct video that has a compressed range of pixel
  7535. intensities. The filter redistributes the pixel intensities to
  7536. equalize their distribution across the intensity range. It may be
  7537. viewed as an "automatically adjusting contrast filter". This filter is
  7538. useful only for correcting degraded or poorly captured source
  7539. video.
  7540. The filter accepts the following options:
  7541. @table @option
  7542. @item strength
  7543. Determine the amount of equalization to be applied. As the strength
  7544. is reduced, the distribution of pixel intensities more-and-more
  7545. approaches that of the input frame. The value must be a float number
  7546. in the range [0,1] and defaults to 0.200.
  7547. @item intensity
  7548. Set the maximum intensity that can generated and scale the output
  7549. values appropriately. The strength should be set as desired and then
  7550. the intensity can be limited if needed to avoid washing-out. The value
  7551. must be a float number in the range [0,1] and defaults to 0.210.
  7552. @item antibanding
  7553. Set the antibanding level. If enabled the filter will randomly vary
  7554. the luminance of output pixels by a small amount to avoid banding of
  7555. the histogram. Possible values are @code{none}, @code{weak} or
  7556. @code{strong}. It defaults to @code{none}.
  7557. @end table
  7558. @section histogram
  7559. Compute and draw a color distribution histogram for the input video.
  7560. The computed histogram is a representation of the color component
  7561. distribution in an image.
  7562. Standard histogram displays the color components distribution in an image.
  7563. Displays color graph for each color component. Shows distribution of
  7564. the Y, U, V, A or R, G, B components, depending on input format, in the
  7565. current frame. Below each graph a color component scale meter is shown.
  7566. The filter accepts the following options:
  7567. @table @option
  7568. @item level_height
  7569. Set height of level. Default value is @code{200}.
  7570. Allowed range is [50, 2048].
  7571. @item scale_height
  7572. Set height of color scale. Default value is @code{12}.
  7573. Allowed range is [0, 40].
  7574. @item display_mode
  7575. Set display mode.
  7576. It accepts the following values:
  7577. @table @samp
  7578. @item stack
  7579. Per color component graphs are placed below each other.
  7580. @item parade
  7581. Per color component graphs are placed side by side.
  7582. @item overlay
  7583. Presents information identical to that in the @code{parade}, except
  7584. that the graphs representing color components are superimposed directly
  7585. over one another.
  7586. @end table
  7587. Default is @code{stack}.
  7588. @item levels_mode
  7589. Set mode. Can be either @code{linear}, or @code{logarithmic}.
  7590. Default is @code{linear}.
  7591. @item components
  7592. Set what color components to display.
  7593. Default is @code{7}.
  7594. @item fgopacity
  7595. Set foreground opacity. Default is @code{0.7}.
  7596. @item bgopacity
  7597. Set background opacity. Default is @code{0.5}.
  7598. @end table
  7599. @subsection Examples
  7600. @itemize
  7601. @item
  7602. Calculate and draw histogram:
  7603. @example
  7604. ffplay -i input -vf histogram
  7605. @end example
  7606. @end itemize
  7607. @anchor{hqdn3d}
  7608. @section hqdn3d
  7609. This is a high precision/quality 3d denoise filter. It aims to reduce
  7610. image noise, producing smooth images and making still images really
  7611. still. It should enhance compressibility.
  7612. It accepts the following optional parameters:
  7613. @table @option
  7614. @item luma_spatial
  7615. A non-negative floating point number which specifies spatial luma strength.
  7616. It defaults to 4.0.
  7617. @item chroma_spatial
  7618. A non-negative floating point number which specifies spatial chroma strength.
  7619. It defaults to 3.0*@var{luma_spatial}/4.0.
  7620. @item luma_tmp
  7621. A floating point number which specifies luma temporal strength. It defaults to
  7622. 6.0*@var{luma_spatial}/4.0.
  7623. @item chroma_tmp
  7624. A floating point number which specifies chroma temporal strength. It defaults to
  7625. @var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}.
  7626. @end table
  7627. @section hwdownload
  7628. Download hardware frames to system memory.
  7629. The input must be in hardware frames, and the output a non-hardware format.
  7630. Not all formats will be supported on the output - it may be necessary to insert
  7631. an additional @option{format} filter immediately following in the graph to get
  7632. the output in a supported format.
  7633. @section hwmap
  7634. Map hardware frames to system memory or to another device.
  7635. This filter has several different modes of operation; which one is used depends
  7636. on the input and output formats:
  7637. @itemize
  7638. @item
  7639. Hardware frame input, normal frame output
  7640. Map the input frames to system memory and pass them to the output. If the
  7641. original hardware frame is later required (for example, after overlaying
  7642. something else on part of it), the @option{hwmap} filter can be used again
  7643. in the next mode to retrieve it.
  7644. @item
  7645. Normal frame input, hardware frame output
  7646. If the input is actually a software-mapped hardware frame, then unmap it -
  7647. that is, return the original hardware frame.
  7648. Otherwise, a device must be provided. Create new hardware surfaces on that
  7649. device for the output, then map them back to the software format at the input
  7650. and give those frames to the preceding filter. This will then act like the
  7651. @option{hwupload} filter, but may be able to avoid an additional copy when
  7652. the input is already in a compatible format.
  7653. @item
  7654. Hardware frame input and output
  7655. A device must be supplied for the output, either directly or with the
  7656. @option{derive_device} option. The input and output devices must be of
  7657. different types and compatible - the exact meaning of this is
  7658. system-dependent, but typically it means that they must refer to the same
  7659. underlying hardware context (for example, refer to the same graphics card).
  7660. If the input frames were originally created on the output device, then unmap
  7661. to retrieve the original frames.
  7662. Otherwise, map the frames to the output device - create new hardware frames
  7663. on the output corresponding to the frames on the input.
  7664. @end itemize
  7665. The following additional parameters are accepted:
  7666. @table @option
  7667. @item mode
  7668. Set the frame mapping mode. Some combination of:
  7669. @table @var
  7670. @item read
  7671. The mapped frame should be readable.
  7672. @item write
  7673. The mapped frame should be writeable.
  7674. @item overwrite
  7675. The mapping will always overwrite the entire frame.
  7676. This may improve performance in some cases, as the original contents of the
  7677. frame need not be loaded.
  7678. @item direct
  7679. The mapping must not involve any copying.
  7680. Indirect mappings to copies of frames are created in some cases where either
  7681. direct mapping is not possible or it would have unexpected properties.
  7682. Setting this flag ensures that the mapping is direct and will fail if that is
  7683. not possible.
  7684. @end table
  7685. Defaults to @var{read+write} if not specified.
  7686. @item derive_device @var{type}
  7687. Rather than using the device supplied at initialisation, instead derive a new
  7688. device of type @var{type} from the device the input frames exist on.
  7689. @item reverse
  7690. In a hardware to hardware mapping, map in reverse - create frames in the sink
  7691. and map them back to the source. This may be necessary in some cases where
  7692. a mapping in one direction is required but only the opposite direction is
  7693. supported by the devices being used.
  7694. This option is dangerous - it may break the preceding filter in undefined
  7695. ways if there are any additional constraints on that filter's output.
  7696. Do not use it without fully understanding the implications of its use.
  7697. @end table
  7698. @section hwupload
  7699. Upload system memory frames to hardware surfaces.
  7700. The device to upload to must be supplied when the filter is initialised. If
  7701. using ffmpeg, select the appropriate device with the @option{-filter_hw_device}
  7702. option.
  7703. @anchor{hwupload_cuda}
  7704. @section hwupload_cuda
  7705. Upload system memory frames to a CUDA device.
  7706. It accepts the following optional parameters:
  7707. @table @option
  7708. @item device
  7709. The number of the CUDA device to use
  7710. @end table
  7711. @section hqx
  7712. Apply a high-quality magnification filter designed for pixel art. This filter
  7713. was originally created by Maxim Stepin.
  7714. It accepts the following option:
  7715. @table @option
  7716. @item n
  7717. Set the scaling dimension: @code{2} for @code{hq2x}, @code{3} for
  7718. @code{hq3x} and @code{4} for @code{hq4x}.
  7719. Default is @code{3}.
  7720. @end table
  7721. @section hstack
  7722. Stack input videos horizontally.
  7723. All streams must be of same pixel format and of same height.
  7724. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  7725. to create same output.
  7726. The filter accept the following option:
  7727. @table @option
  7728. @item inputs
  7729. Set number of input streams. Default is 2.
  7730. @item shortest
  7731. If set to 1, force the output to terminate when the shortest input
  7732. terminates. Default value is 0.
  7733. @end table
  7734. @section hue
  7735. Modify the hue and/or the saturation of the input.
  7736. It accepts the following parameters:
  7737. @table @option
  7738. @item h
  7739. Specify the hue angle as a number of degrees. It accepts an expression,
  7740. and defaults to "0".
  7741. @item s
  7742. Specify the saturation in the [-10,10] range. It accepts an expression and
  7743. defaults to "1".
  7744. @item H
  7745. Specify the hue angle as a number of radians. It accepts an
  7746. expression, and defaults to "0".
  7747. @item b
  7748. Specify the brightness in the [-10,10] range. It accepts an expression and
  7749. defaults to "0".
  7750. @end table
  7751. @option{h} and @option{H} are mutually exclusive, and can't be
  7752. specified at the same time.
  7753. The @option{b}, @option{h}, @option{H} and @option{s} option values are
  7754. expressions containing the following constants:
  7755. @table @option
  7756. @item n
  7757. frame count of the input frame starting from 0
  7758. @item pts
  7759. presentation timestamp of the input frame expressed in time base units
  7760. @item r
  7761. frame rate of the input video, NAN if the input frame rate is unknown
  7762. @item t
  7763. timestamp expressed in seconds, NAN if the input timestamp is unknown
  7764. @item tb
  7765. time base of the input video
  7766. @end table
  7767. @subsection Examples
  7768. @itemize
  7769. @item
  7770. Set the hue to 90 degrees and the saturation to 1.0:
  7771. @example
  7772. hue=h=90:s=1
  7773. @end example
  7774. @item
  7775. Same command but expressing the hue in radians:
  7776. @example
  7777. hue=H=PI/2:s=1
  7778. @end example
  7779. @item
  7780. Rotate hue and make the saturation swing between 0
  7781. and 2 over a period of 1 second:
  7782. @example
  7783. hue="H=2*PI*t: s=sin(2*PI*t)+1"
  7784. @end example
  7785. @item
  7786. Apply a 3 seconds saturation fade-in effect starting at 0:
  7787. @example
  7788. hue="s=min(t/3\,1)"
  7789. @end example
  7790. The general fade-in expression can be written as:
  7791. @example
  7792. hue="s=min(0\, max((t-START)/DURATION\, 1))"
  7793. @end example
  7794. @item
  7795. Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
  7796. @example
  7797. hue="s=max(0\, min(1\, (8-t)/3))"
  7798. @end example
  7799. The general fade-out expression can be written as:
  7800. @example
  7801. hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
  7802. @end example
  7803. @end itemize
  7804. @subsection Commands
  7805. This filter supports the following commands:
  7806. @table @option
  7807. @item b
  7808. @item s
  7809. @item h
  7810. @item H
  7811. Modify the hue and/or the saturation and/or brightness of the input video.
  7812. The command accepts the same syntax of the corresponding option.
  7813. If the specified expression is not valid, it is kept at its current
  7814. value.
  7815. @end table
  7816. @section hysteresis
  7817. Grow first stream into second stream by connecting components.
  7818. This makes it possible to build more robust edge masks.
  7819. This filter accepts the following options:
  7820. @table @option
  7821. @item planes
  7822. Set which planes will be processed as bitmap, unprocessed planes will be
  7823. copied from first stream.
  7824. By default value 0xf, all planes will be processed.
  7825. @item threshold
  7826. Set threshold which is used in filtering. If pixel component value is higher than
  7827. this value filter algorithm for connecting components is activated.
  7828. By default value is 0.
  7829. @end table
  7830. @section idet
  7831. Detect video interlacing type.
  7832. This filter tries to detect if the input frames are interlaced, progressive,
  7833. top or bottom field first. It will also try to detect fields that are
  7834. repeated between adjacent frames (a sign of telecine).
  7835. Single frame detection considers only immediately adjacent frames when classifying each frame.
  7836. Multiple frame detection incorporates the classification history of previous frames.
  7837. The filter will log these metadata values:
  7838. @table @option
  7839. @item single.current_frame
  7840. Detected type of current frame using single-frame detection. One of:
  7841. ``tff'' (top field first), ``bff'' (bottom field first),
  7842. ``progressive'', or ``undetermined''
  7843. @item single.tff
  7844. Cumulative number of frames detected as top field first using single-frame detection.
  7845. @item multiple.tff
  7846. Cumulative number of frames detected as top field first using multiple-frame detection.
  7847. @item single.bff
  7848. Cumulative number of frames detected as bottom field first using single-frame detection.
  7849. @item multiple.current_frame
  7850. Detected type of current frame using multiple-frame detection. One of:
  7851. ``tff'' (top field first), ``bff'' (bottom field first),
  7852. ``progressive'', or ``undetermined''
  7853. @item multiple.bff
  7854. Cumulative number of frames detected as bottom field first using multiple-frame detection.
  7855. @item single.progressive
  7856. Cumulative number of frames detected as progressive using single-frame detection.
  7857. @item multiple.progressive
  7858. Cumulative number of frames detected as progressive using multiple-frame detection.
  7859. @item single.undetermined
  7860. Cumulative number of frames that could not be classified using single-frame detection.
  7861. @item multiple.undetermined
  7862. Cumulative number of frames that could not be classified using multiple-frame detection.
  7863. @item repeated.current_frame
  7864. Which field in the current frame is repeated from the last. One of ``neither'', ``top'', or ``bottom''.
  7865. @item repeated.neither
  7866. Cumulative number of frames with no repeated field.
  7867. @item repeated.top
  7868. Cumulative number of frames with the top field repeated from the previous frame's top field.
  7869. @item repeated.bottom
  7870. Cumulative number of frames with the bottom field repeated from the previous frame's bottom field.
  7871. @end table
  7872. The filter accepts the following options:
  7873. @table @option
  7874. @item intl_thres
  7875. Set interlacing threshold.
  7876. @item prog_thres
  7877. Set progressive threshold.
  7878. @item rep_thres
  7879. Threshold for repeated field detection.
  7880. @item half_life
  7881. Number of frames after which a given frame's contribution to the
  7882. statistics is halved (i.e., it contributes only 0.5 to its
  7883. classification). The default of 0 means that all frames seen are given
  7884. full weight of 1.0 forever.
  7885. @item analyze_interlaced_flag
  7886. When this is not 0 then idet will use the specified number of frames to determine
  7887. if the interlaced flag is accurate, it will not count undetermined frames.
  7888. If the flag is found to be accurate it will be used without any further
  7889. computations, if it is found to be inaccurate it will be cleared without any
  7890. further computations. This allows inserting the idet filter as a low computational
  7891. method to clean up the interlaced flag
  7892. @end table
  7893. @section il
  7894. Deinterleave or interleave fields.
  7895. This filter allows one to process interlaced images fields without
  7896. deinterlacing them. Deinterleaving splits the input frame into 2
  7897. fields (so called half pictures). Odd lines are moved to the top
  7898. half of the output image, even lines to the bottom half.
  7899. You can process (filter) them independently and then re-interleave them.
  7900. The filter accepts the following options:
  7901. @table @option
  7902. @item luma_mode, l
  7903. @item chroma_mode, c
  7904. @item alpha_mode, a
  7905. Available values for @var{luma_mode}, @var{chroma_mode} and
  7906. @var{alpha_mode} are:
  7907. @table @samp
  7908. @item none
  7909. Do nothing.
  7910. @item deinterleave, d
  7911. Deinterleave fields, placing one above the other.
  7912. @item interleave, i
  7913. Interleave fields. Reverse the effect of deinterleaving.
  7914. @end table
  7915. Default value is @code{none}.
  7916. @item luma_swap, ls
  7917. @item chroma_swap, cs
  7918. @item alpha_swap, as
  7919. Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is @code{0}.
  7920. @end table
  7921. @section inflate
  7922. Apply inflate effect to the video.
  7923. This filter replaces the pixel by the local(3x3) average by taking into account
  7924. only values higher than the pixel.
  7925. It accepts the following options:
  7926. @table @option
  7927. @item threshold0
  7928. @item threshold1
  7929. @item threshold2
  7930. @item threshold3
  7931. Limit the maximum change for each plane, default is 65535.
  7932. If 0, plane will remain unchanged.
  7933. @end table
  7934. @section interlace
  7935. Simple interlacing filter from progressive contents. This interleaves upper (or
  7936. lower) lines from odd frames with lower (or upper) lines from even frames,
  7937. halving the frame rate and preserving image height.
  7938. @example
  7939. Original Original New Frame
  7940. Frame 'j' Frame 'j+1' (tff)
  7941. ========== =========== ==================
  7942. Line 0 --------------------> Frame 'j' Line 0
  7943. Line 1 Line 1 ----> Frame 'j+1' Line 1
  7944. Line 2 ---------------------> Frame 'j' Line 2
  7945. Line 3 Line 3 ----> Frame 'j+1' Line 3
  7946. ... ... ...
  7947. New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
  7948. @end example
  7949. It accepts the following optional parameters:
  7950. @table @option
  7951. @item scan
  7952. This determines whether the interlaced frame is taken from the even
  7953. (tff - default) or odd (bff) lines of the progressive frame.
  7954. @item lowpass
  7955. Vertical lowpass filter to avoid twitter interlacing and
  7956. reduce moire patterns.
  7957. @table @samp
  7958. @item 0, off
  7959. Disable vertical lowpass filter
  7960. @item 1, linear
  7961. Enable linear filter (default)
  7962. @item 2, complex
  7963. Enable complex filter. This will slightly less reduce twitter and moire
  7964. but better retain detail and subjective sharpness impression.
  7965. @end table
  7966. @end table
  7967. @section kerndeint
  7968. Deinterlace input video by applying Donald Graft's adaptive kernel
  7969. deinterling. Work on interlaced parts of a video to produce
  7970. progressive frames.
  7971. The description of the accepted parameters follows.
  7972. @table @option
  7973. @item thresh
  7974. Set the threshold which affects the filter's tolerance when
  7975. determining if a pixel line must be processed. It must be an integer
  7976. in the range [0,255] and defaults to 10. A value of 0 will result in
  7977. applying the process on every pixels.
  7978. @item map
  7979. Paint pixels exceeding the threshold value to white if set to 1.
  7980. Default is 0.
  7981. @item order
  7982. Set the fields order. Swap fields if set to 1, leave fields alone if
  7983. 0. Default is 0.
  7984. @item sharp
  7985. Enable additional sharpening if set to 1. Default is 0.
  7986. @item twoway
  7987. Enable twoway sharpening if set to 1. Default is 0.
  7988. @end table
  7989. @subsection Examples
  7990. @itemize
  7991. @item
  7992. Apply default values:
  7993. @example
  7994. kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
  7995. @end example
  7996. @item
  7997. Enable additional sharpening:
  7998. @example
  7999. kerndeint=sharp=1
  8000. @end example
  8001. @item
  8002. Paint processed pixels in white:
  8003. @example
  8004. kerndeint=map=1
  8005. @end example
  8006. @end itemize
  8007. @section lenscorrection
  8008. Correct radial lens distortion
  8009. This filter can be used to correct for radial distortion as can result from the use
  8010. of wide angle lenses, and thereby re-rectify the image. To find the right parameters
  8011. one can use tools available for example as part of opencv or simply trial-and-error.
  8012. To use opencv use the calibration sample (under samples/cpp) from the opencv sources
  8013. and extract the k1 and k2 coefficients from the resulting matrix.
  8014. Note that effectively the same filter is available in the open-source tools Krita and
  8015. Digikam from the KDE project.
  8016. In contrast to the @ref{vignette} filter, which can also be used to compensate lens errors,
  8017. this filter corrects the distortion of the image, whereas @ref{vignette} corrects the
  8018. brightness distribution, so you may want to use both filters together in certain
  8019. cases, though you will have to take care of ordering, i.e. whether vignetting should
  8020. be applied before or after lens correction.
  8021. @subsection Options
  8022. The filter accepts the following options:
  8023. @table @option
  8024. @item cx
  8025. Relative x-coordinate of the focal point of the image, and thereby the center of the
  8026. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8027. width. Default is 0.5.
  8028. @item cy
  8029. Relative y-coordinate of the focal point of the image, and thereby the center of the
  8030. distortion. This value has a range [0,1] and is expressed as fractions of the image
  8031. height. Default is 0.5.
  8032. @item k1
  8033. Coefficient of the quadratic correction term. This value has a range [-1,1]. 0 means
  8034. no correction. Default is 0.
  8035. @item k2
  8036. Coefficient of the double quadratic correction term. This value has a range [-1,1].
  8037. 0 means no correction. Default is 0.
  8038. @end table
  8039. The formula that generates the correction is:
  8040. @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)
  8041. where @var{r_0} is halve of the image diagonal and @var{r_src} and @var{r_tgt} are the
  8042. distances from the focal point in the source and target images, respectively.
  8043. @section libvmaf
  8044. Obtain the VMAF (Video Multi-Method Assessment Fusion)
  8045. score between two input videos.
  8046. The obtained VMAF score is printed through the logging system.
  8047. It requires Netflix's vmaf library (libvmaf) as a pre-requisite.
  8048. After installing the library it can be enabled using:
  8049. @code{./configure --enable-libvmaf}.
  8050. If no model path is specified it uses the default model: @code{vmaf_v0.6.1.pkl}.
  8051. The filter has following options:
  8052. @table @option
  8053. @item model_path
  8054. Set the model path which is to be used for SVM.
  8055. Default value: @code{"vmaf_v0.6.1.pkl"}
  8056. @item log_path
  8057. Set the file path to be used to store logs.
  8058. @item log_fmt
  8059. Set the format of the log file (xml or json).
  8060. @item enable_transform
  8061. Enables transform for computing vmaf.
  8062. @item phone_model
  8063. Invokes the phone model which will generate VMAF scores higher than in the
  8064. regular model, which is more suitable for laptop, TV, etc. viewing conditions.
  8065. @item psnr
  8066. Enables computing psnr along with vmaf.
  8067. @item ssim
  8068. Enables computing ssim along with vmaf.
  8069. @item ms_ssim
  8070. Enables computing ms_ssim along with vmaf.
  8071. @item pool
  8072. Set the pool method (mean, min or harmonic mean) to be used for computing vmaf.
  8073. @end table
  8074. This filter also supports the @ref{framesync} options.
  8075. On the below examples the input file @file{main.mpg} being processed is
  8076. compared with the reference file @file{ref.mpg}.
  8077. @example
  8078. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf -f null -
  8079. @end example
  8080. Example with options:
  8081. @example
  8082. ffmpeg -i main.mpg -i ref.mpg -lavfi libvmaf="psnr=1:enable-transform=1" -f null -
  8083. @end example
  8084. @section limiter
  8085. Limits the pixel components values to the specified range [min, max].
  8086. The filter accepts the following options:
  8087. @table @option
  8088. @item min
  8089. Lower bound. Defaults to the lowest allowed value for the input.
  8090. @item max
  8091. Upper bound. Defaults to the highest allowed value for the input.
  8092. @item planes
  8093. Specify which planes will be processed. Defaults to all available.
  8094. @end table
  8095. @section loop
  8096. Loop video frames.
  8097. The filter accepts the following options:
  8098. @table @option
  8099. @item loop
  8100. Set the number of loops. Setting this value to -1 will result in infinite loops.
  8101. Default is 0.
  8102. @item size
  8103. Set maximal size in number of frames. Default is 0.
  8104. @item start
  8105. Set first frame of loop. Default is 0.
  8106. @end table
  8107. @anchor{lut3d}
  8108. @section lut3d
  8109. Apply a 3D LUT to an input video.
  8110. The filter accepts the following options:
  8111. @table @option
  8112. @item file
  8113. Set the 3D LUT file name.
  8114. Currently supported formats:
  8115. @table @samp
  8116. @item 3dl
  8117. AfterEffects
  8118. @item cube
  8119. Iridas
  8120. @item dat
  8121. DaVinci
  8122. @item m3d
  8123. Pandora
  8124. @end table
  8125. @item interp
  8126. Select interpolation mode.
  8127. Available values are:
  8128. @table @samp
  8129. @item nearest
  8130. Use values from the nearest defined point.
  8131. @item trilinear
  8132. Interpolate values using the 8 points defining a cube.
  8133. @item tetrahedral
  8134. Interpolate values using a tetrahedron.
  8135. @end table
  8136. @end table
  8137. This filter also supports the @ref{framesync} options.
  8138. @section lumakey
  8139. Turn certain luma values into transparency.
  8140. The filter accepts the following options:
  8141. @table @option
  8142. @item threshold
  8143. Set the luma which will be used as base for transparency.
  8144. Default value is @code{0}.
  8145. @item tolerance
  8146. Set the range of luma values to be keyed out.
  8147. Default value is @code{0}.
  8148. @item softness
  8149. Set the range of softness. Default value is @code{0}.
  8150. Use this to control gradual transition from zero to full transparency.
  8151. @end table
  8152. @section lut, lutrgb, lutyuv
  8153. Compute a look-up table for binding each pixel component input value
  8154. to an output value, and apply it to the input video.
  8155. @var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
  8156. to an RGB input video.
  8157. These filters accept the following parameters:
  8158. @table @option
  8159. @item c0
  8160. set first pixel component expression
  8161. @item c1
  8162. set second pixel component expression
  8163. @item c2
  8164. set third pixel component expression
  8165. @item c3
  8166. set fourth pixel component expression, corresponds to the alpha component
  8167. @item r
  8168. set red component expression
  8169. @item g
  8170. set green component expression
  8171. @item b
  8172. set blue component expression
  8173. @item a
  8174. alpha component expression
  8175. @item y
  8176. set Y/luminance component expression
  8177. @item u
  8178. set U/Cb component expression
  8179. @item v
  8180. set V/Cr component expression
  8181. @end table
  8182. Each of them specifies the expression to use for computing the lookup table for
  8183. the corresponding pixel component values.
  8184. The exact component associated to each of the @var{c*} options depends on the
  8185. format in input.
  8186. The @var{lut} filter requires either YUV or RGB pixel formats in input,
  8187. @var{lutrgb} requires RGB pixel formats in input, and @var{lutyuv} requires YUV.
  8188. The expressions can contain the following constants and functions:
  8189. @table @option
  8190. @item w
  8191. @item h
  8192. The input width and height.
  8193. @item val
  8194. The input value for the pixel component.
  8195. @item clipval
  8196. The input value, clipped to the @var{minval}-@var{maxval} range.
  8197. @item maxval
  8198. The maximum value for the pixel component.
  8199. @item minval
  8200. The minimum value for the pixel component.
  8201. @item negval
  8202. The negated value for the pixel component value, clipped to the
  8203. @var{minval}-@var{maxval} range; it corresponds to the expression
  8204. "maxval-clipval+minval".
  8205. @item clip(val)
  8206. The computed value in @var{val}, clipped to the
  8207. @var{minval}-@var{maxval} range.
  8208. @item gammaval(gamma)
  8209. The computed gamma correction value of the pixel component value,
  8210. clipped to the @var{minval}-@var{maxval} range. It corresponds to the
  8211. expression
  8212. "pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
  8213. @end table
  8214. All expressions default to "val".
  8215. @subsection Examples
  8216. @itemize
  8217. @item
  8218. Negate input video:
  8219. @example
  8220. lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
  8221. lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
  8222. @end example
  8223. The above is the same as:
  8224. @example
  8225. lutrgb="r=negval:g=negval:b=negval"
  8226. lutyuv="y=negval:u=negval:v=negval"
  8227. @end example
  8228. @item
  8229. Negate luminance:
  8230. @example
  8231. lutyuv=y=negval
  8232. @end example
  8233. @item
  8234. Remove chroma components, turning the video into a graytone image:
  8235. @example
  8236. lutyuv="u=128:v=128"
  8237. @end example
  8238. @item
  8239. Apply a luma burning effect:
  8240. @example
  8241. lutyuv="y=2*val"
  8242. @end example
  8243. @item
  8244. Remove green and blue components:
  8245. @example
  8246. lutrgb="g=0:b=0"
  8247. @end example
  8248. @item
  8249. Set a constant alpha channel value on input:
  8250. @example
  8251. format=rgba,lutrgb=a="maxval-minval/2"
  8252. @end example
  8253. @item
  8254. Correct luminance gamma by a factor of 0.5:
  8255. @example
  8256. lutyuv=y=gammaval(0.5)
  8257. @end example
  8258. @item
  8259. Discard least significant bits of luma:
  8260. @example
  8261. lutyuv=y='bitand(val, 128+64+32)'
  8262. @end example
  8263. @item
  8264. Technicolor like effect:
  8265. @example
  8266. lutyuv=u='(val-maxval/2)*2+maxval/2':v='(val-maxval/2)*2+maxval/2'
  8267. @end example
  8268. @end itemize
  8269. @section lut2, tlut2
  8270. The @code{lut2} filter takes two input streams and outputs one
  8271. stream.
  8272. The @code{tlut2} (time lut2) filter takes two consecutive frames
  8273. from one single stream.
  8274. This filter accepts the following parameters:
  8275. @table @option
  8276. @item c0
  8277. set first pixel component expression
  8278. @item c1
  8279. set second pixel component expression
  8280. @item c2
  8281. set third pixel component expression
  8282. @item c3
  8283. set fourth pixel component expression, corresponds to the alpha component
  8284. @end table
  8285. Each of them specifies the expression to use for computing the lookup table for
  8286. the corresponding pixel component values.
  8287. The exact component associated to each of the @var{c*} options depends on the
  8288. format in inputs.
  8289. The expressions can contain the following constants:
  8290. @table @option
  8291. @item w
  8292. @item h
  8293. The input width and height.
  8294. @item x
  8295. The first input value for the pixel component.
  8296. @item y
  8297. The second input value for the pixel component.
  8298. @item bdx
  8299. The first input video bit depth.
  8300. @item bdy
  8301. The second input video bit depth.
  8302. @end table
  8303. All expressions default to "x".
  8304. @subsection Examples
  8305. @itemize
  8306. @item
  8307. Highlight differences between two RGB video streams:
  8308. @example
  8309. 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)'
  8310. @end example
  8311. @item
  8312. Highlight differences between two YUV video streams:
  8313. @example
  8314. 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)'
  8315. @end example
  8316. @item
  8317. Show max difference between two video streams:
  8318. @example
  8319. 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)))'
  8320. @end example
  8321. @end itemize
  8322. @section maskedclamp
  8323. Clamp the first input stream with the second input and third input stream.
  8324. Returns the value of first stream to be between second input
  8325. stream - @code{undershoot} and third input stream + @code{overshoot}.
  8326. This filter accepts the following options:
  8327. @table @option
  8328. @item undershoot
  8329. Default value is @code{0}.
  8330. @item overshoot
  8331. Default value is @code{0}.
  8332. @item planes
  8333. Set which planes will be processed as bitmap, unprocessed planes will be
  8334. copied from first stream.
  8335. By default value 0xf, all planes will be processed.
  8336. @end table
  8337. @section maskedmerge
  8338. Merge the first input stream with the second input stream using per pixel
  8339. weights in the third input stream.
  8340. A value of 0 in the third stream pixel component means that pixel component
  8341. from first stream is returned unchanged, while maximum value (eg. 255 for
  8342. 8-bit videos) means that pixel component from second stream is returned
  8343. unchanged. Intermediate values define the amount of merging between both
  8344. input stream's pixel components.
  8345. This filter accepts the following options:
  8346. @table @option
  8347. @item planes
  8348. Set which planes will be processed as bitmap, unprocessed planes will be
  8349. copied from first stream.
  8350. By default value 0xf, all planes will be processed.
  8351. @end table
  8352. @section mcdeint
  8353. Apply motion-compensation deinterlacing.
  8354. It needs one field per frame as input and must thus be used together
  8355. with yadif=1/3 or equivalent.
  8356. This filter accepts the following options:
  8357. @table @option
  8358. @item mode
  8359. Set the deinterlacing mode.
  8360. It accepts one of the following values:
  8361. @table @samp
  8362. @item fast
  8363. @item medium
  8364. @item slow
  8365. use iterative motion estimation
  8366. @item extra_slow
  8367. like @samp{slow}, but use multiple reference frames.
  8368. @end table
  8369. Default value is @samp{fast}.
  8370. @item parity
  8371. Set the picture field parity assumed for the input video. It must be
  8372. one of the following values:
  8373. @table @samp
  8374. @item 0, tff
  8375. assume top field first
  8376. @item 1, bff
  8377. assume bottom field first
  8378. @end table
  8379. Default value is @samp{bff}.
  8380. @item qp
  8381. Set per-block quantization parameter (QP) used by the internal
  8382. encoder.
  8383. Higher values should result in a smoother motion vector field but less
  8384. optimal individual vectors. Default value is 1.
  8385. @end table
  8386. @section mergeplanes
  8387. Merge color channel components from several video streams.
  8388. The filter accepts up to 4 input streams, and merge selected input
  8389. planes to the output video.
  8390. This filter accepts the following options:
  8391. @table @option
  8392. @item mapping
  8393. Set input to output plane mapping. Default is @code{0}.
  8394. The mappings is specified as a bitmap. It should be specified as a
  8395. hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. 'Aa' describes the
  8396. mapping for the first plane of the output stream. 'A' sets the number of
  8397. the input stream to use (from 0 to 3), and 'a' the plane number of the
  8398. corresponding input to use (from 0 to 3). The rest of the mappings is
  8399. similar, 'Bb' describes the mapping for the output stream second
  8400. plane, 'Cc' describes the mapping for the output stream third plane and
  8401. 'Dd' describes the mapping for the output stream fourth plane.
  8402. @item format
  8403. Set output pixel format. Default is @code{yuva444p}.
  8404. @end table
  8405. @subsection Examples
  8406. @itemize
  8407. @item
  8408. Merge three gray video streams of same width and height into single video stream:
  8409. @example
  8410. [a0][a1][a2]mergeplanes=0x001020:yuv444p
  8411. @end example
  8412. @item
  8413. Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
  8414. @example
  8415. [a0][a1]mergeplanes=0x00010210:yuva444p
  8416. @end example
  8417. @item
  8418. Swap Y and A plane in yuva444p stream:
  8419. @example
  8420. format=yuva444p,mergeplanes=0x03010200:yuva444p
  8421. @end example
  8422. @item
  8423. Swap U and V plane in yuv420p stream:
  8424. @example
  8425. format=yuv420p,mergeplanes=0x000201:yuv420p
  8426. @end example
  8427. @item
  8428. Cast a rgb24 clip to yuv444p:
  8429. @example
  8430. format=rgb24,mergeplanes=0x000102:yuv444p
  8431. @end example
  8432. @end itemize
  8433. @section mestimate
  8434. Estimate and export motion vectors using block matching algorithms.
  8435. Motion vectors are stored in frame side data to be used by other filters.
  8436. This filter accepts the following options:
  8437. @table @option
  8438. @item method
  8439. Specify the motion estimation method. Accepts one of the following values:
  8440. @table @samp
  8441. @item esa
  8442. Exhaustive search algorithm.
  8443. @item tss
  8444. Three step search algorithm.
  8445. @item tdls
  8446. Two dimensional logarithmic search algorithm.
  8447. @item ntss
  8448. New three step search algorithm.
  8449. @item fss
  8450. Four step search algorithm.
  8451. @item ds
  8452. Diamond search algorithm.
  8453. @item hexbs
  8454. Hexagon-based search algorithm.
  8455. @item epzs
  8456. Enhanced predictive zonal search algorithm.
  8457. @item umh
  8458. Uneven multi-hexagon search algorithm.
  8459. @end table
  8460. Default value is @samp{esa}.
  8461. @item mb_size
  8462. Macroblock size. Default @code{16}.
  8463. @item search_param
  8464. Search parameter. Default @code{7}.
  8465. @end table
  8466. @section midequalizer
  8467. Apply Midway Image Equalization effect using two video streams.
  8468. Midway Image Equalization adjusts a pair of images to have the same
  8469. histogram, while maintaining their dynamics as much as possible. It's
  8470. useful for e.g. matching exposures from a pair of stereo cameras.
  8471. This filter has two inputs and one output, which must be of same pixel format, but
  8472. may be of different sizes. The output of filter is first input adjusted with
  8473. midway histogram of both inputs.
  8474. This filter accepts the following option:
  8475. @table @option
  8476. @item planes
  8477. Set which planes to process. Default is @code{15}, which is all available planes.
  8478. @end table
  8479. @section minterpolate
  8480. Convert the video to specified frame rate using motion interpolation.
  8481. This filter accepts the following options:
  8482. @table @option
  8483. @item fps
  8484. 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}.
  8485. @item mi_mode
  8486. Motion interpolation mode. Following values are accepted:
  8487. @table @samp
  8488. @item dup
  8489. Duplicate previous or next frame for interpolating new ones.
  8490. @item blend
  8491. Blend source frames. Interpolated frame is mean of previous and next frames.
  8492. @item mci
  8493. Motion compensated interpolation. Following options are effective when this mode is selected:
  8494. @table @samp
  8495. @item mc_mode
  8496. Motion compensation mode. Following values are accepted:
  8497. @table @samp
  8498. @item obmc
  8499. Overlapped block motion compensation.
  8500. @item aobmc
  8501. Adaptive overlapped block motion compensation. Window weighting coefficients are controlled adaptively according to the reliabilities of the neighboring motion vectors to reduce oversmoothing.
  8502. @end table
  8503. Default mode is @samp{obmc}.
  8504. @item me_mode
  8505. Motion estimation mode. Following values are accepted:
  8506. @table @samp
  8507. @item bidir
  8508. Bidirectional motion estimation. Motion vectors are estimated for each source frame in both forward and backward directions.
  8509. @item bilat
  8510. Bilateral motion estimation. Motion vectors are estimated directly for interpolated frame.
  8511. @end table
  8512. Default mode is @samp{bilat}.
  8513. @item me
  8514. The algorithm to be used for motion estimation. Following values are accepted:
  8515. @table @samp
  8516. @item esa
  8517. Exhaustive search algorithm.
  8518. @item tss
  8519. Three step search algorithm.
  8520. @item tdls
  8521. Two dimensional logarithmic search algorithm.
  8522. @item ntss
  8523. New three step search algorithm.
  8524. @item fss
  8525. Four step search algorithm.
  8526. @item ds
  8527. Diamond search algorithm.
  8528. @item hexbs
  8529. Hexagon-based search algorithm.
  8530. @item epzs
  8531. Enhanced predictive zonal search algorithm.
  8532. @item umh
  8533. Uneven multi-hexagon search algorithm.
  8534. @end table
  8535. Default algorithm is @samp{epzs}.
  8536. @item mb_size
  8537. Macroblock size. Default @code{16}.
  8538. @item search_param
  8539. Motion estimation search parameter. Default @code{32}.
  8540. @item vsbmc
  8541. 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).
  8542. @end table
  8543. @end table
  8544. @item scd
  8545. 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:
  8546. @table @samp
  8547. @item none
  8548. Disable scene change detection.
  8549. @item fdiff
  8550. Frame difference. Corresponding pixel values are compared and if it satisfies @var{scd_threshold} scene change is detected.
  8551. @end table
  8552. Default method is @samp{fdiff}.
  8553. @item scd_threshold
  8554. Scene change detection threshold. Default is @code{5.0}.
  8555. @end table
  8556. @section mix
  8557. Mix several video input streams into one video stream.
  8558. A description of the accepted options follows.
  8559. @table @option
  8560. @item nb_inputs
  8561. The number of inputs. If unspecified, it defaults to 2.
  8562. @item weights
  8563. Specify weight of each input video stream as sequence.
  8564. Each weight is separated by space.
  8565. @item duration
  8566. Specify how end of stream is determined.
  8567. @table @samp
  8568. @item longest
  8569. The duration of the longest input. (default)
  8570. @item shortest
  8571. The duration of the shortest input.
  8572. @item first
  8573. The duration of the first input.
  8574. @end table
  8575. @end table
  8576. @section mpdecimate
  8577. Drop frames that do not differ greatly from the previous frame in
  8578. order to reduce frame rate.
  8579. The main use of this filter is for very-low-bitrate encoding
  8580. (e.g. streaming over dialup modem), but it could in theory be used for
  8581. fixing movies that were inverse-telecined incorrectly.
  8582. A description of the accepted options follows.
  8583. @table @option
  8584. @item max
  8585. Set the maximum number of consecutive frames which can be dropped (if
  8586. positive), or the minimum interval between dropped frames (if
  8587. negative). If the value is 0, the frame is dropped disregarding the
  8588. number of previous sequentially dropped frames.
  8589. Default value is 0.
  8590. @item hi
  8591. @item lo
  8592. @item frac
  8593. Set the dropping threshold values.
  8594. Values for @option{hi} and @option{lo} are for 8x8 pixel blocks and
  8595. represent actual pixel value differences, so a threshold of 64
  8596. corresponds to 1 unit of difference for each pixel, or the same spread
  8597. out differently over the block.
  8598. A frame is a candidate for dropping if no 8x8 blocks differ by more
  8599. than a threshold of @option{hi}, and if no more than @option{frac} blocks (1
  8600. meaning the whole image) differ by more than a threshold of @option{lo}.
  8601. Default value for @option{hi} is 64*12, default value for @option{lo} is
  8602. 64*5, and default value for @option{frac} is 0.33.
  8603. @end table
  8604. @section negate
  8605. Negate input video.
  8606. It accepts an integer in input; if non-zero it negates the
  8607. alpha component (if available). The default value in input is 0.
  8608. @section nlmeans
  8609. Denoise frames using Non-Local Means algorithm.
  8610. Each pixel is adjusted by looking for other pixels with similar contexts. This
  8611. context similarity is defined by comparing their surrounding patches of size
  8612. @option{p}x@option{p}. Patches are searched in an area of @option{r}x@option{r}
  8613. around the pixel.
  8614. Note that the research area defines centers for patches, which means some
  8615. patches will be made of pixels outside that research area.
  8616. The filter accepts the following options.
  8617. @table @option
  8618. @item s
  8619. Set denoising strength.
  8620. @item p
  8621. Set patch size.
  8622. @item pc
  8623. Same as @option{p} but for chroma planes.
  8624. The default value is @var{0} and means automatic.
  8625. @item r
  8626. Set research size.
  8627. @item rc
  8628. Same as @option{r} but for chroma planes.
  8629. The default value is @var{0} and means automatic.
  8630. @end table
  8631. @section nnedi
  8632. Deinterlace video using neural network edge directed interpolation.
  8633. This filter accepts the following options:
  8634. @table @option
  8635. @item weights
  8636. Mandatory option, without binary file filter can not work.
  8637. Currently file can be found here:
  8638. https://github.com/dubhater/vapoursynth-nnedi3/blob/master/src/nnedi3_weights.bin
  8639. @item deint
  8640. Set which frames to deinterlace, by default it is @code{all}.
  8641. Can be @code{all} or @code{interlaced}.
  8642. @item field
  8643. Set mode of operation.
  8644. Can be one of the following:
  8645. @table @samp
  8646. @item af
  8647. Use frame flags, both fields.
  8648. @item a
  8649. Use frame flags, single field.
  8650. @item t
  8651. Use top field only.
  8652. @item b
  8653. Use bottom field only.
  8654. @item tf
  8655. Use both fields, top first.
  8656. @item bf
  8657. Use both fields, bottom first.
  8658. @end table
  8659. @item planes
  8660. Set which planes to process, by default filter process all frames.
  8661. @item nsize
  8662. Set size of local neighborhood around each pixel, used by the predictor neural
  8663. network.
  8664. Can be one of the following:
  8665. @table @samp
  8666. @item s8x6
  8667. @item s16x6
  8668. @item s32x6
  8669. @item s48x6
  8670. @item s8x4
  8671. @item s16x4
  8672. @item s32x4
  8673. @end table
  8674. @item nns
  8675. Set the number of neurons in predictor neural network.
  8676. Can be one of the following:
  8677. @table @samp
  8678. @item n16
  8679. @item n32
  8680. @item n64
  8681. @item n128
  8682. @item n256
  8683. @end table
  8684. @item qual
  8685. Controls the number of different neural network predictions that are blended
  8686. together to compute the final output value. Can be @code{fast}, default or
  8687. @code{slow}.
  8688. @item etype
  8689. Set which set of weights to use in the predictor.
  8690. Can be one of the following:
  8691. @table @samp
  8692. @item a
  8693. weights trained to minimize absolute error
  8694. @item s
  8695. weights trained to minimize squared error
  8696. @end table
  8697. @item pscrn
  8698. Controls whether or not the prescreener neural network is used to decide
  8699. which pixels should be processed by the predictor neural network and which
  8700. can be handled by simple cubic interpolation.
  8701. The prescreener is trained to know whether cubic interpolation will be
  8702. sufficient for a pixel or whether it should be predicted by the predictor nn.
  8703. The computational complexity of the prescreener nn is much less than that of
  8704. the predictor nn. Since most pixels can be handled by cubic interpolation,
  8705. using the prescreener generally results in much faster processing.
  8706. The prescreener is pretty accurate, so the difference between using it and not
  8707. using it is almost always unnoticeable.
  8708. Can be one of the following:
  8709. @table @samp
  8710. @item none
  8711. @item original
  8712. @item new
  8713. @end table
  8714. Default is @code{new}.
  8715. @item fapprox
  8716. Set various debugging flags.
  8717. @end table
  8718. @section noformat
  8719. Force libavfilter not to use any of the specified pixel formats for the
  8720. input to the next filter.
  8721. It accepts the following parameters:
  8722. @table @option
  8723. @item pix_fmts
  8724. A '|'-separated list of pixel format names, such as
  8725. pix_fmts=yuv420p|monow|rgb24".
  8726. @end table
  8727. @subsection Examples
  8728. @itemize
  8729. @item
  8730. Force libavfilter to use a format different from @var{yuv420p} for the
  8731. input to the vflip filter:
  8732. @example
  8733. noformat=pix_fmts=yuv420p,vflip
  8734. @end example
  8735. @item
  8736. Convert the input video to any of the formats not contained in the list:
  8737. @example
  8738. noformat=yuv420p|yuv444p|yuv410p
  8739. @end example
  8740. @end itemize
  8741. @section noise
  8742. Add noise on video input frame.
  8743. The filter accepts the following options:
  8744. @table @option
  8745. @item all_seed
  8746. @item c0_seed
  8747. @item c1_seed
  8748. @item c2_seed
  8749. @item c3_seed
  8750. Set noise seed for specific pixel component or all pixel components in case
  8751. of @var{all_seed}. Default value is @code{123457}.
  8752. @item all_strength, alls
  8753. @item c0_strength, c0s
  8754. @item c1_strength, c1s
  8755. @item c2_strength, c2s
  8756. @item c3_strength, c3s
  8757. Set noise strength for specific pixel component or all pixel components in case
  8758. @var{all_strength}. Default value is @code{0}. Allowed range is [0, 100].
  8759. @item all_flags, allf
  8760. @item c0_flags, c0f
  8761. @item c1_flags, c1f
  8762. @item c2_flags, c2f
  8763. @item c3_flags, c3f
  8764. Set pixel component flags or set flags for all components if @var{all_flags}.
  8765. Available values for component flags are:
  8766. @table @samp
  8767. @item a
  8768. averaged temporal noise (smoother)
  8769. @item p
  8770. mix random noise with a (semi)regular pattern
  8771. @item t
  8772. temporal noise (noise pattern changes between frames)
  8773. @item u
  8774. uniform noise (gaussian otherwise)
  8775. @end table
  8776. @end table
  8777. @subsection Examples
  8778. Add temporal and uniform noise to input video:
  8779. @example
  8780. noise=alls=20:allf=t+u
  8781. @end example
  8782. @section normalize
  8783. Normalize RGB video (aka histogram stretching, contrast stretching).
  8784. See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
  8785. For each channel of each frame, the filter computes the input range and maps
  8786. it linearly to the user-specified output range. The output range defaults
  8787. to the full dynamic range from pure black to pure white.
  8788. Temporal smoothing can be used on the input range to reduce flickering (rapid
  8789. changes in brightness) caused when small dark or bright objects enter or leave
  8790. the scene. This is similar to the auto-exposure (automatic gain control) on a
  8791. video camera, and, like a video camera, it may cause a period of over- or
  8792. under-exposure of the video.
  8793. The R,G,B channels can be normalized independently, which may cause some
  8794. color shifting, or linked together as a single channel, which prevents
  8795. color shifting. Linked normalization preserves hue. Independent normalization
  8796. does not, so it can be used to remove some color casts. Independent and linked
  8797. normalization can be combined in any ratio.
  8798. The normalize filter accepts the following options:
  8799. @table @option
  8800. @item blackpt
  8801. @item whitept
  8802. Colors which define the output range. The minimum input value is mapped to
  8803. the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
  8804. The defaults are black and white respectively. Specifying white for
  8805. @var{blackpt} and black for @var{whitept} will give color-inverted,
  8806. normalized video. Shades of grey can be used to reduce the dynamic range
  8807. (contrast). Specifying saturated colors here can create some interesting
  8808. effects.
  8809. @item smoothing
  8810. The number of previous frames to use for temporal smoothing. The input range
  8811. of each channel is smoothed using a rolling average over the current frame
  8812. and the @var{smoothing} previous frames. The default is 0 (no temporal
  8813. smoothing).
  8814. @item independence
  8815. Controls the ratio of independent (color shifting) channel normalization to
  8816. linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
  8817. independent. Defaults to 1.0 (fully independent).
  8818. @item strength
  8819. Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
  8820. expensive no-op. Defaults to 1.0 (full strength).
  8821. @end table
  8822. @subsection Examples
  8823. Stretch video contrast to use the full dynamic range, with no temporal
  8824. smoothing; may flicker depending on the source content:
  8825. @example
  8826. normalize=blackpt=black:whitept=white:smoothing=0
  8827. @end example
  8828. As above, but with 50 frames of temporal smoothing; flicker should be
  8829. reduced, depending on the source content:
  8830. @example
  8831. normalize=blackpt=black:whitept=white:smoothing=50
  8832. @end example
  8833. As above, but with hue-preserving linked channel normalization:
  8834. @example
  8835. normalize=blackpt=black:whitept=white:smoothing=50:independence=0
  8836. @end example
  8837. As above, but with half strength:
  8838. @example
  8839. normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
  8840. @end example
  8841. Map the darkest input color to red, the brightest input color to cyan:
  8842. @example
  8843. normalize=blackpt=red:whitept=cyan
  8844. @end example
  8845. @section null
  8846. Pass the video source unchanged to the output.
  8847. @section ocr
  8848. Optical Character Recognition
  8849. This filter uses Tesseract for optical character recognition.
  8850. It accepts the following options:
  8851. @table @option
  8852. @item datapath
  8853. Set datapath to tesseract data. Default is to use whatever was
  8854. set at installation.
  8855. @item language
  8856. Set language, default is "eng".
  8857. @item whitelist
  8858. Set character whitelist.
  8859. @item blacklist
  8860. Set character blacklist.
  8861. @end table
  8862. The filter exports recognized text as the frame metadata @code{lavfi.ocr.text}.
  8863. @section ocv
  8864. Apply a video transform using libopencv.
  8865. To enable this filter, install the libopencv library and headers and
  8866. configure FFmpeg with @code{--enable-libopencv}.
  8867. It accepts the following parameters:
  8868. @table @option
  8869. @item filter_name
  8870. The name of the libopencv filter to apply.
  8871. @item filter_params
  8872. The parameters to pass to the libopencv filter. If not specified, the default
  8873. values are assumed.
  8874. @end table
  8875. Refer to the official libopencv documentation for more precise
  8876. information:
  8877. @url{http://docs.opencv.org/master/modules/imgproc/doc/filtering.html}
  8878. Several libopencv filters are supported; see the following subsections.
  8879. @anchor{dilate}
  8880. @subsection dilate
  8881. Dilate an image by using a specific structuring element.
  8882. It corresponds to the libopencv function @code{cvDilate}.
  8883. It accepts the parameters: @var{struct_el}|@var{nb_iterations}.
  8884. @var{struct_el} represents a structuring element, and has the syntax:
  8885. @var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
  8886. @var{cols} and @var{rows} represent the number of columns and rows of
  8887. the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
  8888. point, and @var{shape} the shape for the structuring element. @var{shape}
  8889. must be "rect", "cross", "ellipse", or "custom".
  8890. If the value for @var{shape} is "custom", it must be followed by a
  8891. string of the form "=@var{filename}". The file with name
  8892. @var{filename} is assumed to represent a binary image, with each
  8893. printable character corresponding to a bright pixel. When a custom
  8894. @var{shape} is used, @var{cols} and @var{rows} are ignored, the number
  8895. or columns and rows of the read file are assumed instead.
  8896. The default value for @var{struct_el} is "3x3+0x0/rect".
  8897. @var{nb_iterations} specifies the number of times the transform is
  8898. applied to the image, and defaults to 1.
  8899. Some examples:
  8900. @example
  8901. # Use the default values
  8902. ocv=dilate
  8903. # Dilate using a structuring element with a 5x5 cross, iterating two times
  8904. ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
  8905. # Read the shape from the file diamond.shape, iterating two times.
  8906. # The file diamond.shape may contain a pattern of characters like this
  8907. # *
  8908. # ***
  8909. # *****
  8910. # ***
  8911. # *
  8912. # The specified columns and rows are ignored
  8913. # but the anchor point coordinates are not
  8914. ocv=dilate:0x0+2x2/custom=diamond.shape|2
  8915. @end example
  8916. @subsection erode
  8917. Erode an image by using a specific structuring element.
  8918. It corresponds to the libopencv function @code{cvErode}.
  8919. It accepts the parameters: @var{struct_el}:@var{nb_iterations},
  8920. with the same syntax and semantics as the @ref{dilate} filter.
  8921. @subsection smooth
  8922. Smooth the input video.
  8923. The filter takes the following parameters:
  8924. @var{type}|@var{param1}|@var{param2}|@var{param3}|@var{param4}.
  8925. @var{type} is the type of smooth filter to apply, and must be one of
  8926. the following values: "blur", "blur_no_scale", "median", "gaussian",
  8927. or "bilateral". The default value is "gaussian".
  8928. The meaning of @var{param1}, @var{param2}, @var{param3}, and @var{param4}
  8929. depend on the smooth type. @var{param1} and
  8930. @var{param2} accept integer positive values or 0. @var{param3} and
  8931. @var{param4} accept floating point values.
  8932. The default value for @var{param1} is 3. The default value for the
  8933. other parameters is 0.
  8934. These parameters correspond to the parameters assigned to the
  8935. libopencv function @code{cvSmooth}.
  8936. @section oscilloscope
  8937. 2D Video Oscilloscope.
  8938. Useful to measure spatial impulse, step responses, chroma delays, etc.
  8939. It accepts the following parameters:
  8940. @table @option
  8941. @item x
  8942. Set scope center x position.
  8943. @item y
  8944. Set scope center y position.
  8945. @item s
  8946. Set scope size, relative to frame diagonal.
  8947. @item t
  8948. Set scope tilt/rotation.
  8949. @item o
  8950. Set trace opacity.
  8951. @item tx
  8952. Set trace center x position.
  8953. @item ty
  8954. Set trace center y position.
  8955. @item tw
  8956. Set trace width, relative to width of frame.
  8957. @item th
  8958. Set trace height, relative to height of frame.
  8959. @item c
  8960. Set which components to trace. By default it traces first three components.
  8961. @item g
  8962. Draw trace grid. By default is enabled.
  8963. @item st
  8964. Draw some statistics. By default is enabled.
  8965. @item sc
  8966. Draw scope. By default is enabled.
  8967. @end table
  8968. @subsection Examples
  8969. @itemize
  8970. @item
  8971. Inspect full first row of video frame.
  8972. @example
  8973. oscilloscope=x=0.5:y=0:s=1
  8974. @end example
  8975. @item
  8976. Inspect full last row of video frame.
  8977. @example
  8978. oscilloscope=x=0.5:y=1:s=1
  8979. @end example
  8980. @item
  8981. Inspect full 5th line of video frame of height 1080.
  8982. @example
  8983. oscilloscope=x=0.5:y=5/1080:s=1
  8984. @end example
  8985. @item
  8986. Inspect full last column of video frame.
  8987. @example
  8988. oscilloscope=x=1:y=0.5:s=1:t=1
  8989. @end example
  8990. @end itemize
  8991. @anchor{overlay}
  8992. @section overlay
  8993. Overlay one video on top of another.
  8994. It takes two inputs and has one output. The first input is the "main"
  8995. video on which the second input is overlaid.
  8996. It accepts the following parameters:
  8997. A description of the accepted options follows.
  8998. @table @option
  8999. @item x
  9000. @item y
  9001. Set the expression for the x and y coordinates of the overlaid video
  9002. on the main video. Default value is "0" for both expressions. In case
  9003. the expression is invalid, it is set to a huge value (meaning that the
  9004. overlay will not be displayed within the output visible area).
  9005. @item eof_action
  9006. See @ref{framesync}.
  9007. @item eval
  9008. Set when the expressions for @option{x}, and @option{y} are evaluated.
  9009. It accepts the following values:
  9010. @table @samp
  9011. @item init
  9012. only evaluate expressions once during the filter initialization or
  9013. when a command is processed
  9014. @item frame
  9015. evaluate expressions for each incoming frame
  9016. @end table
  9017. Default value is @samp{frame}.
  9018. @item shortest
  9019. See @ref{framesync}.
  9020. @item format
  9021. Set the format for the output video.
  9022. It accepts the following values:
  9023. @table @samp
  9024. @item yuv420
  9025. force YUV420 output
  9026. @item yuv422
  9027. force YUV422 output
  9028. @item yuv444
  9029. force YUV444 output
  9030. @item rgb
  9031. force packed RGB output
  9032. @item gbrp
  9033. force planar RGB output
  9034. @item auto
  9035. automatically pick format
  9036. @end table
  9037. Default value is @samp{yuv420}.
  9038. @item repeatlast
  9039. See @ref{framesync}.
  9040. @item alpha
  9041. Set format of alpha of the overlaid video, it can be @var{straight} or
  9042. @var{premultiplied}. Default is @var{straight}.
  9043. @end table
  9044. The @option{x}, and @option{y} expressions can contain the following
  9045. parameters.
  9046. @table @option
  9047. @item main_w, W
  9048. @item main_h, H
  9049. The main input width and height.
  9050. @item overlay_w, w
  9051. @item overlay_h, h
  9052. The overlay input width and height.
  9053. @item x
  9054. @item y
  9055. The computed values for @var{x} and @var{y}. They are evaluated for
  9056. each new frame.
  9057. @item hsub
  9058. @item vsub
  9059. horizontal and vertical chroma subsample values of the output
  9060. format. For example for the pixel format "yuv422p" @var{hsub} is 2 and
  9061. @var{vsub} is 1.
  9062. @item n
  9063. the number of input frame, starting from 0
  9064. @item pos
  9065. the position in the file of the input frame, NAN if unknown
  9066. @item t
  9067. The timestamp, expressed in seconds. It's NAN if the input timestamp is unknown.
  9068. @end table
  9069. This filter also supports the @ref{framesync} options.
  9070. Note that the @var{n}, @var{pos}, @var{t} variables are available only
  9071. when evaluation is done @emph{per frame}, and will evaluate to NAN
  9072. when @option{eval} is set to @samp{init}.
  9073. Be aware that frames are taken from each input video in timestamp
  9074. order, hence, if their initial timestamps differ, it is a good idea
  9075. to pass the two inputs through a @var{setpts=PTS-STARTPTS} filter to
  9076. have them begin in the same zero timestamp, as the example for
  9077. the @var{movie} filter does.
  9078. You can chain together more overlays but you should test the
  9079. efficiency of such approach.
  9080. @subsection Commands
  9081. This filter supports the following commands:
  9082. @table @option
  9083. @item x
  9084. @item y
  9085. Modify the x and y of the overlay input.
  9086. The command accepts the same syntax of the corresponding option.
  9087. If the specified expression is not valid, it is kept at its current
  9088. value.
  9089. @end table
  9090. @subsection Examples
  9091. @itemize
  9092. @item
  9093. Draw the overlay at 10 pixels from the bottom right corner of the main
  9094. video:
  9095. @example
  9096. overlay=main_w-overlay_w-10:main_h-overlay_h-10
  9097. @end example
  9098. Using named options the example above becomes:
  9099. @example
  9100. overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
  9101. @end example
  9102. @item
  9103. Insert a transparent PNG logo in the bottom left corner of the input,
  9104. using the @command{ffmpeg} tool with the @code{-filter_complex} option:
  9105. @example
  9106. ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
  9107. @end example
  9108. @item
  9109. Insert 2 different transparent PNG logos (second logo on bottom
  9110. right corner) using the @command{ffmpeg} tool:
  9111. @example
  9112. 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
  9113. @end example
  9114. @item
  9115. Add a transparent color layer on top of the main video; @code{WxH}
  9116. must specify the size of the main input to the overlay filter:
  9117. @example
  9118. color=color=red@@.3:size=WxH [over]; [in][over] overlay [out]
  9119. @end example
  9120. @item
  9121. Play an original video and a filtered version (here with the deshake
  9122. filter) side by side using the @command{ffplay} tool:
  9123. @example
  9124. ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
  9125. @end example
  9126. The above command is the same as:
  9127. @example
  9128. ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
  9129. @end example
  9130. @item
  9131. Make a sliding overlay appearing from the left to the right top part of the
  9132. screen starting since time 2:
  9133. @example
  9134. overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
  9135. @end example
  9136. @item
  9137. Compose output by putting two input videos side to side:
  9138. @example
  9139. ffmpeg -i left.avi -i right.avi -filter_complex "
  9140. nullsrc=size=200x100 [background];
  9141. [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
  9142. [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
  9143. [background][left] overlay=shortest=1 [background+left];
  9144. [background+left][right] overlay=shortest=1:x=100 [left+right]
  9145. "
  9146. @end example
  9147. @item
  9148. Mask 10-20 seconds of a video by applying the delogo filter to a section
  9149. @example
  9150. ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
  9151. -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]'
  9152. masked.avi
  9153. @end example
  9154. @item
  9155. Chain several overlays in cascade:
  9156. @example
  9157. nullsrc=s=200x200 [bg];
  9158. testsrc=s=100x100, split=4 [in0][in1][in2][in3];
  9159. [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0];
  9160. [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1];
  9161. [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2];
  9162. [in3] null, [mid2] overlay=100:100 [out0]
  9163. @end example
  9164. @end itemize
  9165. @section owdenoise
  9166. Apply Overcomplete Wavelet denoiser.
  9167. The filter accepts the following options:
  9168. @table @option
  9169. @item depth
  9170. Set depth.
  9171. Larger depth values will denoise lower frequency components more, but
  9172. slow down filtering.
  9173. Must be an int in the range 8-16, default is @code{8}.
  9174. @item luma_strength, ls
  9175. Set luma strength.
  9176. Must be a double value in the range 0-1000, default is @code{1.0}.
  9177. @item chroma_strength, cs
  9178. Set chroma strength.
  9179. Must be a double value in the range 0-1000, default is @code{1.0}.
  9180. @end table
  9181. @anchor{pad}
  9182. @section pad
  9183. Add paddings to the input image, and place the original input at the
  9184. provided @var{x}, @var{y} coordinates.
  9185. It accepts the following parameters:
  9186. @table @option
  9187. @item width, w
  9188. @item height, h
  9189. Specify an expression for the size of the output image with the
  9190. paddings added. If the value for @var{width} or @var{height} is 0, the
  9191. corresponding input size is used for the output.
  9192. The @var{width} expression can reference the value set by the
  9193. @var{height} expression, and vice versa.
  9194. The default value of @var{width} and @var{height} is 0.
  9195. @item x
  9196. @item y
  9197. Specify the offsets to place the input image at within the padded area,
  9198. with respect to the top/left border of the output image.
  9199. The @var{x} expression can reference the value set by the @var{y}
  9200. expression, and vice versa.
  9201. The default value of @var{x} and @var{y} is 0.
  9202. If @var{x} or @var{y} evaluate to a negative number, they'll be changed
  9203. so the input image is centered on the padded area.
  9204. @item color
  9205. Specify the color of the padded area. For the syntax of this option,
  9206. check the @ref{color syntax,,"Color" section in the ffmpeg-utils
  9207. manual,ffmpeg-utils}.
  9208. The default value of @var{color} is "black".
  9209. @item eval
  9210. Specify when to evaluate @var{width}, @var{height}, @var{x} and @var{y} expression.
  9211. It accepts the following values:
  9212. @table @samp
  9213. @item init
  9214. Only evaluate expressions once during the filter initialization or when
  9215. a command is processed.
  9216. @item frame
  9217. Evaluate expressions for each incoming frame.
  9218. @end table
  9219. Default value is @samp{init}.
  9220. @item aspect
  9221. Pad to aspect instead to a resolution.
  9222. @end table
  9223. The value for the @var{width}, @var{height}, @var{x}, and @var{y}
  9224. options are expressions containing the following constants:
  9225. @table @option
  9226. @item in_w
  9227. @item in_h
  9228. The input video width and height.
  9229. @item iw
  9230. @item ih
  9231. These are the same as @var{in_w} and @var{in_h}.
  9232. @item out_w
  9233. @item out_h
  9234. The output width and height (the size of the padded area), as
  9235. specified by the @var{width} and @var{height} expressions.
  9236. @item ow
  9237. @item oh
  9238. These are the same as @var{out_w} and @var{out_h}.
  9239. @item x
  9240. @item y
  9241. The x and y offsets as specified by the @var{x} and @var{y}
  9242. expressions, or NAN if not yet specified.
  9243. @item a
  9244. same as @var{iw} / @var{ih}
  9245. @item sar
  9246. input sample aspect ratio
  9247. @item dar
  9248. input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
  9249. @item hsub
  9250. @item vsub
  9251. The horizontal and vertical chroma subsample values. For example for the
  9252. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  9253. @end table
  9254. @subsection Examples
  9255. @itemize
  9256. @item
  9257. Add paddings with the color "violet" to the input video. The output video
  9258. size is 640x480, and the top-left corner of the input video is placed at
  9259. column 0, row 40
  9260. @example
  9261. pad=640:480:0:40:violet
  9262. @end example
  9263. The example above is equivalent to the following command:
  9264. @example
  9265. pad=width=640:height=480:x=0:y=40:color=violet
  9266. @end example
  9267. @item
  9268. Pad the input to get an output with dimensions increased by 3/2,
  9269. and put the input video at the center of the padded area:
  9270. @example
  9271. pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
  9272. @end example
  9273. @item
  9274. Pad the input to get a squared output with size equal to the maximum
  9275. value between the input width and height, and put the input video at
  9276. the center of the padded area:
  9277. @example
  9278. pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
  9279. @end example
  9280. @item
  9281. Pad the input to get a final w/h ratio of 16:9:
  9282. @example
  9283. pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
  9284. @end example
  9285. @item
  9286. In case of anamorphic video, in order to set the output display aspect
  9287. correctly, it is necessary to use @var{sar} in the expression,
  9288. according to the relation:
  9289. @example
  9290. (ih * X / ih) * sar = output_dar
  9291. X = output_dar / sar
  9292. @end example
  9293. Thus the previous example needs to be modified to:
  9294. @example
  9295. pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
  9296. @end example
  9297. @item
  9298. Double the output size and put the input video in the bottom-right
  9299. corner of the output padded area:
  9300. @example
  9301. pad="2*iw:2*ih:ow-iw:oh-ih"
  9302. @end example
  9303. @end itemize
  9304. @anchor{palettegen}
  9305. @section palettegen
  9306. Generate one palette for a whole video stream.
  9307. It accepts the following options:
  9308. @table @option
  9309. @item max_colors
  9310. Set the maximum number of colors to quantize in the palette.
  9311. Note: the palette will still contain 256 colors; the unused palette entries
  9312. will be black.
  9313. @item reserve_transparent
  9314. Create a palette of 255 colors maximum and reserve the last one for
  9315. transparency. Reserving the transparency color is useful for GIF optimization.
  9316. If not set, the maximum of colors in the palette will be 256. You probably want
  9317. to disable this option for a standalone image.
  9318. Set by default.
  9319. @item transparency_color
  9320. Set the color that will be used as background for transparency.
  9321. @item stats_mode
  9322. Set statistics mode.
  9323. It accepts the following values:
  9324. @table @samp
  9325. @item full
  9326. Compute full frame histograms.
  9327. @item diff
  9328. Compute histograms only for the part that differs from previous frame. This
  9329. might be relevant to give more importance to the moving part of your input if
  9330. the background is static.
  9331. @item single
  9332. Compute new histogram for each frame.
  9333. @end table
  9334. Default value is @var{full}.
  9335. @end table
  9336. The filter also exports the frame metadata @code{lavfi.color_quant_ratio}
  9337. (@code{nb_color_in / nb_color_out}) which you can use to evaluate the degree of
  9338. color quantization of the palette. This information is also visible at
  9339. @var{info} logging level.
  9340. @subsection Examples
  9341. @itemize
  9342. @item
  9343. Generate a representative palette of a given video using @command{ffmpeg}:
  9344. @example
  9345. ffmpeg -i input.mkv -vf palettegen palette.png
  9346. @end example
  9347. @end itemize
  9348. @section paletteuse
  9349. Use a palette to downsample an input video stream.
  9350. The filter takes two inputs: one video stream and a palette. The palette must
  9351. be a 256 pixels image.
  9352. It accepts the following options:
  9353. @table @option
  9354. @item dither
  9355. Select dithering mode. Available algorithms are:
  9356. @table @samp
  9357. @item bayer
  9358. Ordered 8x8 bayer dithering (deterministic)
  9359. @item heckbert
  9360. Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
  9361. Note: this dithering is sometimes considered "wrong" and is included as a
  9362. reference.
  9363. @item floyd_steinberg
  9364. Floyd and Steingberg dithering (error diffusion)
  9365. @item sierra2
  9366. Frankie Sierra dithering v2 (error diffusion)
  9367. @item sierra2_4a
  9368. Frankie Sierra dithering v2 "Lite" (error diffusion)
  9369. @end table
  9370. Default is @var{sierra2_4a}.
  9371. @item bayer_scale
  9372. When @var{bayer} dithering is selected, this option defines the scale of the
  9373. pattern (how much the crosshatch pattern is visible). A low value means more
  9374. visible pattern for less banding, and higher value means less visible pattern
  9375. at the cost of more banding.
  9376. The option must be an integer value in the range [0,5]. Default is @var{2}.
  9377. @item diff_mode
  9378. If set, define the zone to process
  9379. @table @samp
  9380. @item rectangle
  9381. Only the changing rectangle will be reprocessed. This is similar to GIF
  9382. cropping/offsetting compression mechanism. This option can be useful for speed
  9383. if only a part of the image is changing, and has use cases such as limiting the
  9384. scope of the error diffusal @option{dither} to the rectangle that bounds the
  9385. moving scene (it leads to more deterministic output if the scene doesn't change
  9386. much, and as a result less moving noise and better GIF compression).
  9387. @end table
  9388. Default is @var{none}.
  9389. @item new
  9390. Take new palette for each output frame.
  9391. @item alpha_threshold
  9392. Sets the alpha threshold for transparency. Alpha values above this threshold
  9393. will be treated as completely opaque, and values below this threshold will be
  9394. treated as completely transparent.
  9395. The option must be an integer value in the range [0,255]. Default is @var{128}.
  9396. @end table
  9397. @subsection Examples
  9398. @itemize
  9399. @item
  9400. Use a palette (generated for example with @ref{palettegen}) to encode a GIF
  9401. using @command{ffmpeg}:
  9402. @example
  9403. ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
  9404. @end example
  9405. @end itemize
  9406. @section perspective
  9407. Correct perspective of video not recorded perpendicular to the screen.
  9408. A description of the accepted parameters follows.
  9409. @table @option
  9410. @item x0
  9411. @item y0
  9412. @item x1
  9413. @item y1
  9414. @item x2
  9415. @item y2
  9416. @item x3
  9417. @item y3
  9418. Set coordinates expression for top left, top right, bottom left and bottom right corners.
  9419. Default values are @code{0:0:W:0:0:H:W:H} with which perspective will remain unchanged.
  9420. If the @code{sense} option is set to @code{source}, then the specified points will be sent
  9421. to the corners of the destination. If the @code{sense} option is set to @code{destination},
  9422. then the corners of the source will be sent to the specified coordinates.
  9423. The expressions can use the following variables:
  9424. @table @option
  9425. @item W
  9426. @item H
  9427. the width and height of video frame.
  9428. @item in
  9429. Input frame count.
  9430. @item on
  9431. Output frame count.
  9432. @end table
  9433. @item interpolation
  9434. Set interpolation for perspective correction.
  9435. It accepts the following values:
  9436. @table @samp
  9437. @item linear
  9438. @item cubic
  9439. @end table
  9440. Default value is @samp{linear}.
  9441. @item sense
  9442. Set interpretation of coordinate options.
  9443. It accepts the following values:
  9444. @table @samp
  9445. @item 0, source
  9446. Send point in the source specified by the given coordinates to
  9447. the corners of the destination.
  9448. @item 1, destination
  9449. Send the corners of the source to the point in the destination specified
  9450. by the given coordinates.
  9451. Default value is @samp{source}.
  9452. @end table
  9453. @item eval
  9454. Set when the expressions for coordinates @option{x0,y0,...x3,y3} are evaluated.
  9455. It accepts the following values:
  9456. @table @samp
  9457. @item init
  9458. only evaluate expressions once during the filter initialization or
  9459. when a command is processed
  9460. @item frame
  9461. evaluate expressions for each incoming frame
  9462. @end table
  9463. Default value is @samp{init}.
  9464. @end table
  9465. @section phase
  9466. Delay interlaced video by one field time so that the field order changes.
  9467. The intended use is to fix PAL movies that have been captured with the
  9468. opposite field order to the film-to-video transfer.
  9469. A description of the accepted parameters follows.
  9470. @table @option
  9471. @item mode
  9472. Set phase mode.
  9473. It accepts the following values:
  9474. @table @samp
  9475. @item t
  9476. Capture field order top-first, transfer bottom-first.
  9477. Filter will delay the bottom field.
  9478. @item b
  9479. Capture field order bottom-first, transfer top-first.
  9480. Filter will delay the top field.
  9481. @item p
  9482. Capture and transfer with the same field order. This mode only exists
  9483. for the documentation of the other options to refer to, but if you
  9484. actually select it, the filter will faithfully do nothing.
  9485. @item a
  9486. Capture field order determined automatically by field flags, transfer
  9487. opposite.
  9488. Filter selects among @samp{t} and @samp{b} modes on a frame by frame
  9489. basis using field flags. If no field information is available,
  9490. then this works just like @samp{u}.
  9491. @item u
  9492. Capture unknown or varying, transfer opposite.
  9493. Filter selects among @samp{t} and @samp{b} on a frame by frame basis by
  9494. analyzing the images and selecting the alternative that produces best
  9495. match between the fields.
  9496. @item T
  9497. Capture top-first, transfer unknown or varying.
  9498. Filter selects among @samp{t} and @samp{p} using image analysis.
  9499. @item B
  9500. Capture bottom-first, transfer unknown or varying.
  9501. Filter selects among @samp{b} and @samp{p} using image analysis.
  9502. @item A
  9503. Capture determined by field flags, transfer unknown or varying.
  9504. Filter selects among @samp{t}, @samp{b} and @samp{p} using field flags and
  9505. image analysis. If no field information is available, then this works just
  9506. like @samp{U}. This is the default mode.
  9507. @item U
  9508. Both capture and transfer unknown or varying.
  9509. Filter selects among @samp{t}, @samp{b} and @samp{p} using image analysis only.
  9510. @end table
  9511. @end table
  9512. @section pixdesctest
  9513. Pixel format descriptor test filter, mainly useful for internal
  9514. testing. The output video should be equal to the input video.
  9515. For example:
  9516. @example
  9517. format=monow, pixdesctest
  9518. @end example
  9519. can be used to test the monowhite pixel format descriptor definition.
  9520. @section pixscope
  9521. Display sample values of color channels. Mainly useful for checking color
  9522. and levels. Minimum supported resolution is 640x480.
  9523. The filters accept the following options:
  9524. @table @option
  9525. @item x
  9526. Set scope X position, relative offset on X axis.
  9527. @item y
  9528. Set scope Y position, relative offset on Y axis.
  9529. @item w
  9530. Set scope width.
  9531. @item h
  9532. Set scope height.
  9533. @item o
  9534. Set window opacity. This window also holds statistics about pixel area.
  9535. @item wx
  9536. Set window X position, relative offset on X axis.
  9537. @item wy
  9538. Set window Y position, relative offset on Y axis.
  9539. @end table
  9540. @section pp
  9541. Enable the specified chain of postprocessing subfilters using libpostproc. This
  9542. library should be automatically selected with a GPL build (@code{--enable-gpl}).
  9543. Subfilters must be separated by '/' and can be disabled by prepending a '-'.
  9544. Each subfilter and some options have a short and a long name that can be used
  9545. interchangeably, i.e. dr/dering are the same.
  9546. The filters accept the following options:
  9547. @table @option
  9548. @item subfilters
  9549. Set postprocessing subfilters string.
  9550. @end table
  9551. All subfilters share common options to determine their scope:
  9552. @table @option
  9553. @item a/autoq
  9554. Honor the quality commands for this subfilter.
  9555. @item c/chrom
  9556. Do chrominance filtering, too (default).
  9557. @item y/nochrom
  9558. Do luminance filtering only (no chrominance).
  9559. @item n/noluma
  9560. Do chrominance filtering only (no luminance).
  9561. @end table
  9562. These options can be appended after the subfilter name, separated by a '|'.
  9563. Available subfilters are:
  9564. @table @option
  9565. @item hb/hdeblock[|difference[|flatness]]
  9566. Horizontal deblocking filter
  9567. @table @option
  9568. @item difference
  9569. Difference factor where higher values mean more deblocking (default: @code{32}).
  9570. @item flatness
  9571. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9572. @end table
  9573. @item vb/vdeblock[|difference[|flatness]]
  9574. Vertical deblocking filter
  9575. @table @option
  9576. @item difference
  9577. Difference factor where higher values mean more deblocking (default: @code{32}).
  9578. @item flatness
  9579. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9580. @end table
  9581. @item ha/hadeblock[|difference[|flatness]]
  9582. Accurate horizontal deblocking filter
  9583. @table @option
  9584. @item difference
  9585. Difference factor where higher values mean more deblocking (default: @code{32}).
  9586. @item flatness
  9587. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9588. @end table
  9589. @item va/vadeblock[|difference[|flatness]]
  9590. Accurate vertical deblocking filter
  9591. @table @option
  9592. @item difference
  9593. Difference factor where higher values mean more deblocking (default: @code{32}).
  9594. @item flatness
  9595. Flatness threshold where lower values mean more deblocking (default: @code{39}).
  9596. @end table
  9597. @end table
  9598. The horizontal and vertical deblocking filters share the difference and
  9599. flatness values so you cannot set different horizontal and vertical
  9600. thresholds.
  9601. @table @option
  9602. @item h1/x1hdeblock
  9603. Experimental horizontal deblocking filter
  9604. @item v1/x1vdeblock
  9605. Experimental vertical deblocking filter
  9606. @item dr/dering
  9607. Deringing filter
  9608. @item tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer
  9609. @table @option
  9610. @item threshold1
  9611. larger -> stronger filtering
  9612. @item threshold2
  9613. larger -> stronger filtering
  9614. @item threshold3
  9615. larger -> stronger filtering
  9616. @end table
  9617. @item al/autolevels[:f/fullyrange], automatic brightness / contrast correction
  9618. @table @option
  9619. @item f/fullyrange
  9620. Stretch luminance to @code{0-255}.
  9621. @end table
  9622. @item lb/linblenddeint
  9623. Linear blend deinterlacing filter that deinterlaces the given block by
  9624. filtering all lines with a @code{(1 2 1)} filter.
  9625. @item li/linipoldeint
  9626. Linear interpolating deinterlacing filter that deinterlaces the given block by
  9627. linearly interpolating every second line.
  9628. @item ci/cubicipoldeint
  9629. Cubic interpolating deinterlacing filter deinterlaces the given block by
  9630. cubically interpolating every second line.
  9631. @item md/mediandeint
  9632. Median deinterlacing filter that deinterlaces the given block by applying a
  9633. median filter to every second line.
  9634. @item fd/ffmpegdeint
  9635. FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
  9636. second line with a @code{(-1 4 2 4 -1)} filter.
  9637. @item l5/lowpass5
  9638. Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
  9639. block by filtering all lines with a @code{(-1 2 6 2 -1)} filter.
  9640. @item fq/forceQuant[|quantizer]
  9641. Overrides the quantizer table from the input with the constant quantizer you
  9642. specify.
  9643. @table @option
  9644. @item quantizer
  9645. Quantizer to use
  9646. @end table
  9647. @item de/default
  9648. Default pp filter combination (@code{hb|a,vb|a,dr|a})
  9649. @item fa/fast
  9650. Fast pp filter combination (@code{h1|a,v1|a,dr|a})
  9651. @item ac
  9652. High quality pp filter combination (@code{ha|a|128|7,va|a,dr|a})
  9653. @end table
  9654. @subsection Examples
  9655. @itemize
  9656. @item
  9657. Apply horizontal and vertical deblocking, deringing and automatic
  9658. brightness/contrast:
  9659. @example
  9660. pp=hb/vb/dr/al
  9661. @end example
  9662. @item
  9663. Apply default filters without brightness/contrast correction:
  9664. @example
  9665. pp=de/-al
  9666. @end example
  9667. @item
  9668. Apply default filters and temporal denoiser:
  9669. @example
  9670. pp=default/tmpnoise|1|2|3
  9671. @end example
  9672. @item
  9673. Apply deblocking on luminance only, and switch vertical deblocking on or off
  9674. automatically depending on available CPU time:
  9675. @example
  9676. pp=hb|y/vb|a
  9677. @end example
  9678. @end itemize
  9679. @section pp7
  9680. Apply Postprocessing filter 7. It is variant of the @ref{spp} filter,
  9681. similar to spp = 6 with 7 point DCT, where only the center sample is
  9682. used after IDCT.
  9683. The filter accepts the following options:
  9684. @table @option
  9685. @item qp
  9686. Force a constant quantization parameter. It accepts an integer in range
  9687. 0 to 63. If not set, the filter will use the QP from the video stream
  9688. (if available).
  9689. @item mode
  9690. Set thresholding mode. Available modes are:
  9691. @table @samp
  9692. @item hard
  9693. Set hard thresholding.
  9694. @item soft
  9695. Set soft thresholding (better de-ringing effect, but likely blurrier).
  9696. @item medium
  9697. Set medium thresholding (good results, default).
  9698. @end table
  9699. @end table
  9700. @section premultiply
  9701. Apply alpha premultiply effect to input video stream using first plane
  9702. of second stream as alpha.
  9703. Both streams must have same dimensions and same pixel format.
  9704. The filter accepts the following option:
  9705. @table @option
  9706. @item planes
  9707. Set which planes will be processed, unprocessed planes will be copied.
  9708. By default value 0xf, all planes will be processed.
  9709. @item inplace
  9710. Do not require 2nd input for processing, instead use alpha plane from input stream.
  9711. @end table
  9712. @section prewitt
  9713. Apply prewitt operator to input video stream.
  9714. The filter accepts the following option:
  9715. @table @option
  9716. @item planes
  9717. Set which planes will be processed, unprocessed planes will be copied.
  9718. By default value 0xf, all planes will be processed.
  9719. @item scale
  9720. Set value which will be multiplied with filtered result.
  9721. @item delta
  9722. Set value which will be added to filtered result.
  9723. @end table
  9724. @anchor{program_opencl}
  9725. @section program_opencl
  9726. Filter video using an OpenCL program.
  9727. @table @option
  9728. @item source
  9729. OpenCL program source file.
  9730. @item kernel
  9731. Kernel name in program.
  9732. @item inputs
  9733. Number of inputs to the filter. Defaults to 1.
  9734. @item size, s
  9735. Size of output frames. Defaults to the same as the first input.
  9736. @end table
  9737. The program source file must contain a kernel function with the given name,
  9738. which will be run once for each plane of the output. Each run on a plane
  9739. gets enqueued as a separate 2D global NDRange with one work-item for each
  9740. pixel to be generated. The global ID offset for each work-item is therefore
  9741. the coordinates of a pixel in the destination image.
  9742. The kernel function needs to take the following arguments:
  9743. @itemize
  9744. @item
  9745. Destination image, @var{__write_only image2d_t}.
  9746. This image will become the output; the kernel should write all of it.
  9747. @item
  9748. Frame index, @var{unsigned int}.
  9749. This is a counter starting from zero and increasing by one for each frame.
  9750. @item
  9751. Source images, @var{__read_only image2d_t}.
  9752. These are the most recent images on each input. The kernel may read from
  9753. them to generate the output, but they can't be written to.
  9754. @end itemize
  9755. Example programs:
  9756. @itemize
  9757. @item
  9758. Copy the input to the output (output must be the same size as the input).
  9759. @verbatim
  9760. __kernel void copy(__write_only image2d_t destination,
  9761. unsigned int index,
  9762. __read_only image2d_t source)
  9763. {
  9764. const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE;
  9765. int2 location = (int2)(get_global_id(0), get_global_id(1));
  9766. float4 value = read_imagef(source, sampler, location);
  9767. write_imagef(destination, location, value);
  9768. }
  9769. @end verbatim
  9770. @item
  9771. Apply a simple transformation, rotating the input by an amount increasing
  9772. with the index counter. Pixel values are linearly interpolated by the
  9773. sampler, and the output need not have the same dimensions as the input.
  9774. @verbatim
  9775. __kernel void rotate_image(__write_only image2d_t dst,
  9776. unsigned int index,
  9777. __read_only image2d_t src)
  9778. {
  9779. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  9780. CLK_FILTER_LINEAR);
  9781. float angle = (float)index / 100.0f;
  9782. float2 dst_dim = convert_float2(get_image_dim(dst));
  9783. float2 src_dim = convert_float2(get_image_dim(src));
  9784. float2 dst_cen = dst_dim / 2.0f;
  9785. float2 src_cen = src_dim / 2.0f;
  9786. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  9787. float2 dst_pos = convert_float2(dst_loc) - dst_cen;
  9788. float2 src_pos = {
  9789. cos(angle) * dst_pos.x - sin(angle) * dst_pos.y,
  9790. sin(angle) * dst_pos.x + cos(angle) * dst_pos.y
  9791. };
  9792. src_pos = src_pos * src_dim / dst_dim;
  9793. float2 src_loc = src_pos + src_cen;
  9794. if (src_loc.x < 0.0f || src_loc.y < 0.0f ||
  9795. src_loc.x > src_dim.x || src_loc.y > src_dim.y)
  9796. write_imagef(dst, dst_loc, 0.5f);
  9797. else
  9798. write_imagef(dst, dst_loc, read_imagef(src, sampler, src_loc));
  9799. }
  9800. @end verbatim
  9801. @item
  9802. Blend two inputs together, with the amount of each input used varying
  9803. with the index counter.
  9804. @verbatim
  9805. __kernel void blend_images(__write_only image2d_t dst,
  9806. unsigned int index,
  9807. __read_only image2d_t src1,
  9808. __read_only image2d_t src2)
  9809. {
  9810. const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
  9811. CLK_FILTER_LINEAR);
  9812. float blend = (cos((float)index / 50.0f) + 1.0f) / 2.0f;
  9813. int2 dst_loc = (int2)(get_global_id(0), get_global_id(1));
  9814. int2 src1_loc = dst_loc * get_image_dim(src1) / get_image_dim(dst);
  9815. int2 src2_loc = dst_loc * get_image_dim(src2) / get_image_dim(dst);
  9816. float4 val1 = read_imagef(src1, sampler, src1_loc);
  9817. float4 val2 = read_imagef(src2, sampler, src2_loc);
  9818. write_imagef(dst, dst_loc, val1 * blend + val2 * (1.0f - blend));
  9819. }
  9820. @end verbatim
  9821. @end itemize
  9822. @section pseudocolor
  9823. Alter frame colors in video with pseudocolors.
  9824. This filter accept the following options:
  9825. @table @option
  9826. @item c0
  9827. set pixel first component expression
  9828. @item c1
  9829. set pixel second component expression
  9830. @item c2
  9831. set pixel third component expression
  9832. @item c3
  9833. set pixel fourth component expression, corresponds to the alpha component
  9834. @item i
  9835. set component to use as base for altering colors
  9836. @end table
  9837. Each of them specifies the expression to use for computing the lookup table for
  9838. the corresponding pixel component values.
  9839. The expressions can contain the following constants and functions:
  9840. @table @option
  9841. @item w
  9842. @item h
  9843. The input width and height.
  9844. @item val
  9845. The input value for the pixel component.
  9846. @item ymin, umin, vmin, amin
  9847. The minimum allowed component value.
  9848. @item ymax, umax, vmax, amax
  9849. The maximum allowed component value.
  9850. @end table
  9851. All expressions default to "val".
  9852. @subsection Examples
  9853. @itemize
  9854. @item
  9855. Change too high luma values to gradient:
  9856. @example
  9857. 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'"
  9858. @end example
  9859. @end itemize
  9860. @section psnr
  9861. Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
  9862. Ratio) between two input videos.
  9863. This filter takes in input two input videos, the first input is
  9864. considered the "main" source and is passed unchanged to the
  9865. output. The second input is used as a "reference" video for computing
  9866. the PSNR.
  9867. Both video inputs must have the same resolution and pixel format for
  9868. this filter to work correctly. Also it assumes that both inputs
  9869. have the same number of frames, which are compared one by one.
  9870. The obtained average PSNR is printed through the logging system.
  9871. The filter stores the accumulated MSE (mean squared error) of each
  9872. frame, and at the end of the processing it is averaged across all frames
  9873. equally, and the following formula is applied to obtain the PSNR:
  9874. @example
  9875. PSNR = 10*log10(MAX^2/MSE)
  9876. @end example
  9877. Where MAX is the average of the maximum values of each component of the
  9878. image.
  9879. The description of the accepted parameters follows.
  9880. @table @option
  9881. @item stats_file, f
  9882. If specified the filter will use the named file to save the PSNR of
  9883. each individual frame. When filename equals "-" the data is sent to
  9884. standard output.
  9885. @item stats_version
  9886. Specifies which version of the stats file format to use. Details of
  9887. each format are written below.
  9888. Default value is 1.
  9889. @item stats_add_max
  9890. Determines whether the max value is output to the stats log.
  9891. Default value is 0.
  9892. Requires stats_version >= 2. If this is set and stats_version < 2,
  9893. the filter will return an error.
  9894. @end table
  9895. This filter also supports the @ref{framesync} options.
  9896. The file printed if @var{stats_file} is selected, contains a sequence of
  9897. key/value pairs of the form @var{key}:@var{value} for each compared
  9898. couple of frames.
  9899. If a @var{stats_version} greater than 1 is specified, a header line precedes
  9900. the list of per-frame-pair stats, with key value pairs following the frame
  9901. format with the following parameters:
  9902. @table @option
  9903. @item psnr_log_version
  9904. The version of the log file format. Will match @var{stats_version}.
  9905. @item fields
  9906. A comma separated list of the per-frame-pair parameters included in
  9907. the log.
  9908. @end table
  9909. A description of each shown per-frame-pair parameter follows:
  9910. @table @option
  9911. @item n
  9912. sequential number of the input frame, starting from 1
  9913. @item mse_avg
  9914. Mean Square Error pixel-by-pixel average difference of the compared
  9915. frames, averaged over all the image components.
  9916. @item mse_y, mse_u, mse_v, mse_r, mse_g, mse_b, mse_a
  9917. Mean Square Error pixel-by-pixel average difference of the compared
  9918. frames for the component specified by the suffix.
  9919. @item psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a
  9920. Peak Signal to Noise ratio of the compared frames for the component
  9921. specified by the suffix.
  9922. @item max_avg, max_y, max_u, max_v
  9923. Maximum allowed value for each channel, and average over all
  9924. channels.
  9925. @end table
  9926. For example:
  9927. @example
  9928. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  9929. [main][ref] psnr="stats_file=stats.log" [out]
  9930. @end example
  9931. On this example the input file being processed is compared with the
  9932. reference file @file{ref_movie.mpg}. The PSNR of each individual frame
  9933. is stored in @file{stats.log}.
  9934. @anchor{pullup}
  9935. @section pullup
  9936. Pulldown reversal (inverse telecine) filter, capable of handling mixed
  9937. hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
  9938. content.
  9939. The pullup filter is designed to take advantage of future context in making
  9940. its decisions. This filter is stateless in the sense that it does not lock
  9941. onto a pattern to follow, but it instead looks forward to the following
  9942. fields in order to identify matches and rebuild progressive frames.
  9943. To produce content with an even framerate, insert the fps filter after
  9944. pullup, use @code{fps=24000/1001} if the input frame rate is 29.97fps,
  9945. @code{fps=24} for 30fps and the (rare) telecined 25fps input.
  9946. The filter accepts the following options:
  9947. @table @option
  9948. @item jl
  9949. @item jr
  9950. @item jt
  9951. @item jb
  9952. These options set the amount of "junk" to ignore at the left, right, top, and
  9953. bottom of the image, respectively. Left and right are in units of 8 pixels,
  9954. while top and bottom are in units of 2 lines.
  9955. The default is 8 pixels on each side.
  9956. @item sb
  9957. Set the strict breaks. Setting this option to 1 will reduce the chances of
  9958. filter generating an occasional mismatched frame, but it may also cause an
  9959. excessive number of frames to be dropped during high motion sequences.
  9960. Conversely, setting it to -1 will make filter match fields more easily.
  9961. This may help processing of video where there is slight blurring between
  9962. the fields, but may also cause there to be interlaced frames in the output.
  9963. Default value is @code{0}.
  9964. @item mp
  9965. Set the metric plane to use. It accepts the following values:
  9966. @table @samp
  9967. @item l
  9968. Use luma plane.
  9969. @item u
  9970. Use chroma blue plane.
  9971. @item v
  9972. Use chroma red plane.
  9973. @end table
  9974. This option may be set to use chroma plane instead of the default luma plane
  9975. for doing filter's computations. This may improve accuracy on very clean
  9976. source material, but more likely will decrease accuracy, especially if there
  9977. is chroma noise (rainbow effect) or any grayscale video.
  9978. The main purpose of setting @option{mp} to a chroma plane is to reduce CPU
  9979. load and make pullup usable in realtime on slow machines.
  9980. @end table
  9981. For best results (without duplicated frames in the output file) it is
  9982. necessary to change the output frame rate. For example, to inverse
  9983. telecine NTSC input:
  9984. @example
  9985. ffmpeg -i input -vf pullup -r 24000/1001 ...
  9986. @end example
  9987. @section qp
  9988. Change video quantization parameters (QP).
  9989. The filter accepts the following option:
  9990. @table @option
  9991. @item qp
  9992. Set expression for quantization parameter.
  9993. @end table
  9994. The expression is evaluated through the eval API and can contain, among others,
  9995. the following constants:
  9996. @table @var
  9997. @item known
  9998. 1 if index is not 129, 0 otherwise.
  9999. @item qp
  10000. Sequential index starting from -129 to 128.
  10001. @end table
  10002. @subsection Examples
  10003. @itemize
  10004. @item
  10005. Some equation like:
  10006. @example
  10007. qp=2+2*sin(PI*qp)
  10008. @end example
  10009. @end itemize
  10010. @section random
  10011. Flush video frames from internal cache of frames into a random order.
  10012. No frame is discarded.
  10013. Inspired by @ref{frei0r} nervous filter.
  10014. @table @option
  10015. @item frames
  10016. Set size in number of frames of internal cache, in range from @code{2} to
  10017. @code{512}. Default is @code{30}.
  10018. @item seed
  10019. Set seed for random number generator, must be an integer included between
  10020. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  10021. less than @code{0}, the filter will try to use a good random seed on a
  10022. best effort basis.
  10023. @end table
  10024. @section readeia608
  10025. Read closed captioning (EIA-608) information from the top lines of a video frame.
  10026. This filter adds frame metadata for @code{lavfi.readeia608.X.cc} and
  10027. @code{lavfi.readeia608.X.line}, where @code{X} is the number of the identified line
  10028. with EIA-608 data (starting from 0). A description of each metadata value follows:
  10029. @table @option
  10030. @item lavfi.readeia608.X.cc
  10031. The two bytes stored as EIA-608 data (printed in hexadecimal).
  10032. @item lavfi.readeia608.X.line
  10033. The number of the line on which the EIA-608 data was identified and read.
  10034. @end table
  10035. This filter accepts the following options:
  10036. @table @option
  10037. @item scan_min
  10038. Set the line to start scanning for EIA-608 data. Default is @code{0}.
  10039. @item scan_max
  10040. Set the line to end scanning for EIA-608 data. Default is @code{29}.
  10041. @item mac
  10042. Set minimal acceptable amplitude change for sync codes detection.
  10043. Default is @code{0.2}. Allowed range is @code{[0.001 - 1]}.
  10044. @item spw
  10045. Set the ratio of width reserved for sync code detection.
  10046. Default is @code{0.27}. Allowed range is @code{[0.01 - 0.7]}.
  10047. @item mhd
  10048. Set the max peaks height difference for sync code detection.
  10049. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10050. @item mpd
  10051. Set max peaks period difference for sync code detection.
  10052. Default is @code{0.1}. Allowed range is @code{[0.0 - 0.5]}.
  10053. @item msd
  10054. Set the first two max start code bits differences.
  10055. Default is @code{0.02}. Allowed range is @code{[0.0 - 0.5]}.
  10056. @item bhd
  10057. Set the minimum ratio of bits height compared to 3rd start code bit.
  10058. Default is @code{0.75}. Allowed range is @code{[0.01 - 1]}.
  10059. @item th_w
  10060. Set the white color threshold. Default is @code{0.35}. Allowed range is @code{[0.1 - 1]}.
  10061. @item th_b
  10062. Set the black color threshold. Default is @code{0.15}. Allowed range is @code{[0.0 - 0.5]}.
  10063. @item chp
  10064. Enable checking the parity bit. In the event of a parity error, the filter will output
  10065. @code{0x00} for that character. Default is false.
  10066. @end table
  10067. @subsection Examples
  10068. @itemize
  10069. @item
  10070. Output a csv with presentation time and the first two lines of identified EIA-608 captioning data.
  10071. @example
  10072. 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
  10073. @end example
  10074. @end itemize
  10075. @section readvitc
  10076. Read vertical interval timecode (VITC) information from the top lines of a
  10077. video frame.
  10078. The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
  10079. timecode value, if a valid timecode has been detected. Further metadata key
  10080. @code{lavfi.readvitc.found} is set to 0/1 depending on whether
  10081. timecode data has been found or not.
  10082. This filter accepts the following options:
  10083. @table @option
  10084. @item scan_max
  10085. Set the maximum number of lines to scan for VITC data. If the value is set to
  10086. @code{-1} the full video frame is scanned. Default is @code{45}.
  10087. @item thr_b
  10088. Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
  10089. default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
  10090. @item thr_w
  10091. Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],
  10092. default value is @code{0.6}. The value must be equal or greater than @code{thr_b}.
  10093. @end table
  10094. @subsection Examples
  10095. @itemize
  10096. @item
  10097. Detect and draw VITC data onto the video frame; if no valid VITC is detected,
  10098. draw @code{--:--:--:--} as a placeholder:
  10099. @example
  10100. ffmpeg -i input.avi -filter:v 'readvitc,drawtext=fontfile=FreeMono.ttf:text=%@{metadata\\:lavfi.readvitc.tc_str\\:--\\\\\\:--\\\\\\:--\\\\\\:--@}:x=(w-tw)/2:y=400-ascent'
  10101. @end example
  10102. @end itemize
  10103. @section remap
  10104. Remap pixels using 2nd: Xmap and 3rd: Ymap input video stream.
  10105. Destination pixel at position (X, Y) will be picked from source (x, y) position
  10106. where x = Xmap(X, Y) and y = Ymap(X, Y). If mapping values are out of range, zero
  10107. value for pixel will be used for destination pixel.
  10108. Xmap and Ymap input video streams must be of same dimensions. Output video stream
  10109. will have Xmap/Ymap video stream dimensions.
  10110. Xmap and Ymap input video streams are 16bit depth, single channel.
  10111. @section removegrain
  10112. The removegrain filter is a spatial denoiser for progressive video.
  10113. @table @option
  10114. @item m0
  10115. Set mode for the first plane.
  10116. @item m1
  10117. Set mode for the second plane.
  10118. @item m2
  10119. Set mode for the third plane.
  10120. @item m3
  10121. Set mode for the fourth plane.
  10122. @end table
  10123. Range of mode is from 0 to 24. Description of each mode follows:
  10124. @table @var
  10125. @item 0
  10126. Leave input plane unchanged. Default.
  10127. @item 1
  10128. Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  10129. @item 2
  10130. Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
  10131. @item 3
  10132. Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  10133. @item 4
  10134. Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
  10135. This is equivalent to a median filter.
  10136. @item 5
  10137. Line-sensitive clipping giving the minimal change.
  10138. @item 6
  10139. Line-sensitive clipping, intermediate.
  10140. @item 7
  10141. Line-sensitive clipping, intermediate.
  10142. @item 8
  10143. Line-sensitive clipping, intermediate.
  10144. @item 9
  10145. Line-sensitive clipping on a line where the neighbours pixels are the closest.
  10146. @item 10
  10147. Replaces the target pixel with the closest neighbour.
  10148. @item 11
  10149. [1 2 1] horizontal and vertical kernel blur.
  10150. @item 12
  10151. Same as mode 11.
  10152. @item 13
  10153. Bob mode, interpolates top field from the line where the neighbours
  10154. pixels are the closest.
  10155. @item 14
  10156. Bob mode, interpolates bottom field from the line where the neighbours
  10157. pixels are the closest.
  10158. @item 15
  10159. Bob mode, interpolates top field. Same as 13 but with a more complicated
  10160. interpolation formula.
  10161. @item 16
  10162. Bob mode, interpolates bottom field. Same as 14 but with a more complicated
  10163. interpolation formula.
  10164. @item 17
  10165. Clips the pixel with the minimum and maximum of respectively the maximum and
  10166. minimum of each pair of opposite neighbour pixels.
  10167. @item 18
  10168. Line-sensitive clipping using opposite neighbours whose greatest distance from
  10169. the current pixel is minimal.
  10170. @item 19
  10171. Replaces the pixel with the average of its 8 neighbours.
  10172. @item 20
  10173. Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
  10174. @item 21
  10175. Clips pixels using the averages of opposite neighbour.
  10176. @item 22
  10177. Same as mode 21 but simpler and faster.
  10178. @item 23
  10179. Small edge and halo removal, but reputed useless.
  10180. @item 24
  10181. Similar as 23.
  10182. @end table
  10183. @section removelogo
  10184. Suppress a TV station logo, using an image file to determine which
  10185. pixels comprise the logo. It works by filling in the pixels that
  10186. comprise the logo with neighboring pixels.
  10187. The filter accepts the following options:
  10188. @table @option
  10189. @item filename, f
  10190. Set the filter bitmap file, which can be any image format supported by
  10191. libavformat. The width and height of the image file must match those of the
  10192. video stream being processed.
  10193. @end table
  10194. Pixels in the provided bitmap image with a value of zero are not
  10195. considered part of the logo, non-zero pixels are considered part of
  10196. the logo. If you use white (255) for the logo and black (0) for the
  10197. rest, you will be safe. For making the filter bitmap, it is
  10198. recommended to take a screen capture of a black frame with the logo
  10199. visible, and then using a threshold filter followed by the erode
  10200. filter once or twice.
  10201. If needed, little splotches can be fixed manually. Remember that if
  10202. logo pixels are not covered, the filter quality will be much
  10203. reduced. Marking too many pixels as part of the logo does not hurt as
  10204. much, but it will increase the amount of blurring needed to cover over
  10205. the image and will destroy more information than necessary, and extra
  10206. pixels will slow things down on a large logo.
  10207. @section repeatfields
  10208. This filter uses the repeat_field flag from the Video ES headers and hard repeats
  10209. fields based on its value.
  10210. @section reverse
  10211. Reverse a video clip.
  10212. Warning: This filter requires memory to buffer the entire clip, so trimming
  10213. is suggested.
  10214. @subsection Examples
  10215. @itemize
  10216. @item
  10217. Take the first 5 seconds of a clip, and reverse it.
  10218. @example
  10219. trim=end=5,reverse
  10220. @end example
  10221. @end itemize
  10222. @section roberts
  10223. Apply roberts cross operator to input video stream.
  10224. The filter accepts the following option:
  10225. @table @option
  10226. @item planes
  10227. Set which planes will be processed, unprocessed planes will be copied.
  10228. By default value 0xf, all planes will be processed.
  10229. @item scale
  10230. Set value which will be multiplied with filtered result.
  10231. @item delta
  10232. Set value which will be added to filtered result.
  10233. @end table
  10234. @section rotate
  10235. Rotate video by an arbitrary angle expressed in radians.
  10236. The filter accepts the following options:
  10237. A description of the optional parameters follows.
  10238. @table @option
  10239. @item angle, a
  10240. Set an expression for the angle by which to rotate the input video
  10241. clockwise, expressed as a number of radians. A negative value will
  10242. result in a counter-clockwise rotation. By default it is set to "0".
  10243. This expression is evaluated for each frame.
  10244. @item out_w, ow
  10245. Set the output width expression, default value is "iw".
  10246. This expression is evaluated just once during configuration.
  10247. @item out_h, oh
  10248. Set the output height expression, default value is "ih".
  10249. This expression is evaluated just once during configuration.
  10250. @item bilinear
  10251. Enable bilinear interpolation if set to 1, a value of 0 disables
  10252. it. Default value is 1.
  10253. @item fillcolor, c
  10254. Set the color used to fill the output area not covered by the rotated
  10255. image. For the general syntax of this option, check the
  10256. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10257. If the special value "none" is selected then no
  10258. background is printed (useful for example if the background is never shown).
  10259. Default value is "black".
  10260. @end table
  10261. The expressions for the angle and the output size can contain the
  10262. following constants and functions:
  10263. @table @option
  10264. @item n
  10265. sequential number of the input frame, starting from 0. It is always NAN
  10266. before the first frame is filtered.
  10267. @item t
  10268. time in seconds of the input frame, it is set to 0 when the filter is
  10269. configured. It is always NAN before the first frame is filtered.
  10270. @item hsub
  10271. @item vsub
  10272. horizontal and vertical chroma subsample values. For example for the
  10273. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10274. @item in_w, iw
  10275. @item in_h, ih
  10276. the input video width and height
  10277. @item out_w, ow
  10278. @item out_h, oh
  10279. the output width and height, that is the size of the padded area as
  10280. specified by the @var{width} and @var{height} expressions
  10281. @item rotw(a)
  10282. @item roth(a)
  10283. the minimal width/height required for completely containing the input
  10284. video rotated by @var{a} radians.
  10285. These are only available when computing the @option{out_w} and
  10286. @option{out_h} expressions.
  10287. @end table
  10288. @subsection Examples
  10289. @itemize
  10290. @item
  10291. Rotate the input by PI/6 radians clockwise:
  10292. @example
  10293. rotate=PI/6
  10294. @end example
  10295. @item
  10296. Rotate the input by PI/6 radians counter-clockwise:
  10297. @example
  10298. rotate=-PI/6
  10299. @end example
  10300. @item
  10301. Rotate the input by 45 degrees clockwise:
  10302. @example
  10303. rotate=45*PI/180
  10304. @end example
  10305. @item
  10306. Apply a constant rotation with period T, starting from an angle of PI/3:
  10307. @example
  10308. rotate=PI/3+2*PI*t/T
  10309. @end example
  10310. @item
  10311. Make the input video rotation oscillating with a period of T
  10312. seconds and an amplitude of A radians:
  10313. @example
  10314. rotate=A*sin(2*PI/T*t)
  10315. @end example
  10316. @item
  10317. Rotate the video, output size is chosen so that the whole rotating
  10318. input video is always completely contained in the output:
  10319. @example
  10320. rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
  10321. @end example
  10322. @item
  10323. Rotate the video, reduce the output size so that no background is ever
  10324. shown:
  10325. @example
  10326. rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
  10327. @end example
  10328. @end itemize
  10329. @subsection Commands
  10330. The filter supports the following commands:
  10331. @table @option
  10332. @item a, angle
  10333. Set the angle expression.
  10334. The command accepts the same syntax of the corresponding option.
  10335. If the specified expression is not valid, it is kept at its current
  10336. value.
  10337. @end table
  10338. @section sab
  10339. Apply Shape Adaptive Blur.
  10340. The filter accepts the following options:
  10341. @table @option
  10342. @item luma_radius, lr
  10343. Set luma blur filter strength, must be a value in range 0.1-4.0, default
  10344. value is 1.0. A greater value will result in a more blurred image, and
  10345. in slower processing.
  10346. @item luma_pre_filter_radius, lpfr
  10347. Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
  10348. value is 1.0.
  10349. @item luma_strength, ls
  10350. Set luma maximum difference between pixels to still be considered, must
  10351. be a value in the 0.1-100.0 range, default value is 1.0.
  10352. @item chroma_radius, cr
  10353. Set chroma blur filter strength, must be a value in range -0.9-4.0. A
  10354. greater value will result in a more blurred image, and in slower
  10355. processing.
  10356. @item chroma_pre_filter_radius, cpfr
  10357. Set chroma pre-filter radius, must be a value in the -0.9-2.0 range.
  10358. @item chroma_strength, cs
  10359. Set chroma maximum difference between pixels to still be considered,
  10360. must be a value in the -0.9-100.0 range.
  10361. @end table
  10362. Each chroma option value, if not explicitly specified, is set to the
  10363. corresponding luma option value.
  10364. @anchor{scale}
  10365. @section scale
  10366. Scale (resize) the input video, using the libswscale library.
  10367. The scale filter forces the output display aspect ratio to be the same
  10368. of the input, by changing the output sample aspect ratio.
  10369. If the input image format is different from the format requested by
  10370. the next filter, the scale filter will convert the input to the
  10371. requested format.
  10372. @subsection Options
  10373. The filter accepts the following options, or any of the options
  10374. supported by the libswscale scaler.
  10375. See @ref{scaler_options,,the ffmpeg-scaler manual,ffmpeg-scaler} for
  10376. the complete list of scaler options.
  10377. @table @option
  10378. @item width, w
  10379. @item height, h
  10380. Set the output video dimension expression. Default value is the input
  10381. dimension.
  10382. If the @var{width} or @var{w} value is 0, the input width is used for
  10383. the output. If the @var{height} or @var{h} value is 0, the input height
  10384. is used for the output.
  10385. If one and only one of the values is -n with n >= 1, the scale filter
  10386. will use a value that maintains the aspect ratio of the input image,
  10387. calculated from the other specified dimension. After that it will,
  10388. however, make sure that the calculated dimension is divisible by n and
  10389. adjust the value if necessary.
  10390. If both values are -n with n >= 1, the behavior will be identical to
  10391. both values being set to 0 as previously detailed.
  10392. See below for the list of accepted constants for use in the dimension
  10393. expression.
  10394. @item eval
  10395. Specify when to evaluate @var{width} and @var{height} expression. It accepts the following values:
  10396. @table @samp
  10397. @item init
  10398. Only evaluate expressions once during the filter initialization or when a command is processed.
  10399. @item frame
  10400. Evaluate expressions for each incoming frame.
  10401. @end table
  10402. Default value is @samp{init}.
  10403. @item interl
  10404. Set the interlacing mode. It accepts the following values:
  10405. @table @samp
  10406. @item 1
  10407. Force interlaced aware scaling.
  10408. @item 0
  10409. Do not apply interlaced scaling.
  10410. @item -1
  10411. Select interlaced aware scaling depending on whether the source frames
  10412. are flagged as interlaced or not.
  10413. @end table
  10414. Default value is @samp{0}.
  10415. @item flags
  10416. Set libswscale scaling flags. See
  10417. @ref{sws_flags,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10418. complete list of values. If not explicitly specified the filter applies
  10419. the default flags.
  10420. @item param0, param1
  10421. Set libswscale input parameters for scaling algorithms that need them. See
  10422. @ref{sws_params,,the ffmpeg-scaler manual,ffmpeg-scaler} for the
  10423. complete documentation. If not explicitly specified the filter applies
  10424. empty parameters.
  10425. @item size, s
  10426. Set the video size. For the syntax of this option, check the
  10427. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10428. @item in_color_matrix
  10429. @item out_color_matrix
  10430. Set in/output YCbCr color space type.
  10431. This allows the autodetected value to be overridden as well as allows forcing
  10432. a specific value used for the output and encoder.
  10433. If not specified, the color space type depends on the pixel format.
  10434. Possible values:
  10435. @table @samp
  10436. @item auto
  10437. Choose automatically.
  10438. @item bt709
  10439. Format conforming to International Telecommunication Union (ITU)
  10440. Recommendation BT.709.
  10441. @item fcc
  10442. Set color space conforming to the United States Federal Communications
  10443. Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
  10444. @item bt601
  10445. Set color space conforming to:
  10446. @itemize
  10447. @item
  10448. ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
  10449. @item
  10450. ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
  10451. @item
  10452. Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
  10453. @end itemize
  10454. @item smpte240m
  10455. Set color space conforming to SMPTE ST 240:1999.
  10456. @end table
  10457. @item in_range
  10458. @item out_range
  10459. Set in/output YCbCr sample range.
  10460. This allows the autodetected value to be overridden as well as allows forcing
  10461. a specific value used for the output and encoder. If not specified, the
  10462. range depends on the pixel format. Possible values:
  10463. @table @samp
  10464. @item auto/unknown
  10465. Choose automatically.
  10466. @item jpeg/full/pc
  10467. Set full range (0-255 in case of 8-bit luma).
  10468. @item mpeg/limited/tv
  10469. Set "MPEG" range (16-235 in case of 8-bit luma).
  10470. @end table
  10471. @item force_original_aspect_ratio
  10472. Enable decreasing or increasing output video width or height if necessary to
  10473. keep the original aspect ratio. Possible values:
  10474. @table @samp
  10475. @item disable
  10476. Scale the video as specified and disable this feature.
  10477. @item decrease
  10478. The output video dimensions will automatically be decreased if needed.
  10479. @item increase
  10480. The output video dimensions will automatically be increased if needed.
  10481. @end table
  10482. One useful instance of this option is that when you know a specific device's
  10483. maximum allowed resolution, you can use this to limit the output video to
  10484. that, while retaining the aspect ratio. For example, device A allows
  10485. 1280x720 playback, and your video is 1920x800. Using this option (set it to
  10486. decrease) and specifying 1280x720 to the command line makes the output
  10487. 1280x533.
  10488. Please note that this is a different thing than specifying -1 for @option{w}
  10489. or @option{h}, you still need to specify the output resolution for this option
  10490. to work.
  10491. @end table
  10492. The values of the @option{w} and @option{h} options are expressions
  10493. containing the following constants:
  10494. @table @var
  10495. @item in_w
  10496. @item in_h
  10497. The input width and height
  10498. @item iw
  10499. @item ih
  10500. These are the same as @var{in_w} and @var{in_h}.
  10501. @item out_w
  10502. @item out_h
  10503. The output (scaled) width and height
  10504. @item ow
  10505. @item oh
  10506. These are the same as @var{out_w} and @var{out_h}
  10507. @item a
  10508. The same as @var{iw} / @var{ih}
  10509. @item sar
  10510. input sample aspect ratio
  10511. @item dar
  10512. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  10513. @item hsub
  10514. @item vsub
  10515. horizontal and vertical input chroma subsample values. For example for the
  10516. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10517. @item ohsub
  10518. @item ovsub
  10519. horizontal and vertical output chroma subsample values. For example for the
  10520. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10521. @end table
  10522. @subsection Examples
  10523. @itemize
  10524. @item
  10525. Scale the input video to a size of 200x100
  10526. @example
  10527. scale=w=200:h=100
  10528. @end example
  10529. This is equivalent to:
  10530. @example
  10531. scale=200:100
  10532. @end example
  10533. or:
  10534. @example
  10535. scale=200x100
  10536. @end example
  10537. @item
  10538. Specify a size abbreviation for the output size:
  10539. @example
  10540. scale=qcif
  10541. @end example
  10542. which can also be written as:
  10543. @example
  10544. scale=size=qcif
  10545. @end example
  10546. @item
  10547. Scale the input to 2x:
  10548. @example
  10549. scale=w=2*iw:h=2*ih
  10550. @end example
  10551. @item
  10552. The above is the same as:
  10553. @example
  10554. scale=2*in_w:2*in_h
  10555. @end example
  10556. @item
  10557. Scale the input to 2x with forced interlaced scaling:
  10558. @example
  10559. scale=2*iw:2*ih:interl=1
  10560. @end example
  10561. @item
  10562. Scale the input to half size:
  10563. @example
  10564. scale=w=iw/2:h=ih/2
  10565. @end example
  10566. @item
  10567. Increase the width, and set the height to the same size:
  10568. @example
  10569. scale=3/2*iw:ow
  10570. @end example
  10571. @item
  10572. Seek Greek harmony:
  10573. @example
  10574. scale=iw:1/PHI*iw
  10575. scale=ih*PHI:ih
  10576. @end example
  10577. @item
  10578. Increase the height, and set the width to 3/2 of the height:
  10579. @example
  10580. scale=w=3/2*oh:h=3/5*ih
  10581. @end example
  10582. @item
  10583. Increase the size, making the size a multiple of the chroma
  10584. subsample values:
  10585. @example
  10586. scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
  10587. @end example
  10588. @item
  10589. Increase the width to a maximum of 500 pixels,
  10590. keeping the same aspect ratio as the input:
  10591. @example
  10592. scale=w='min(500\, iw*3/2):h=-1'
  10593. @end example
  10594. @item
  10595. Make pixels square by combining scale and setsar:
  10596. @example
  10597. scale='trunc(ih*dar):ih',setsar=1/1
  10598. @end example
  10599. @item
  10600. Make pixels square by combining scale and setsar,
  10601. making sure the resulting resolution is even (required by some codecs):
  10602. @example
  10603. scale='trunc(ih*dar/2)*2:trunc(ih/2)*2',setsar=1/1
  10604. @end example
  10605. @end itemize
  10606. @subsection Commands
  10607. This filter supports the following commands:
  10608. @table @option
  10609. @item width, w
  10610. @item height, h
  10611. Set the output video dimension expression.
  10612. The command accepts the same syntax of the corresponding option.
  10613. If the specified expression is not valid, it is kept at its current
  10614. value.
  10615. @end table
  10616. @section scale_npp
  10617. Use the NVIDIA Performance Primitives (libnpp) to perform scaling and/or pixel
  10618. format conversion on CUDA video frames. Setting the output width and height
  10619. works in the same way as for the @var{scale} filter.
  10620. The following additional options are accepted:
  10621. @table @option
  10622. @item format
  10623. The pixel format of the output CUDA frames. If set to the string "same" (the
  10624. default), the input format will be kept. Note that automatic format negotiation
  10625. and conversion is not yet supported for hardware frames
  10626. @item interp_algo
  10627. The interpolation algorithm used for resizing. One of the following:
  10628. @table @option
  10629. @item nn
  10630. Nearest neighbour.
  10631. @item linear
  10632. @item cubic
  10633. @item cubic2p_bspline
  10634. 2-parameter cubic (B=1, C=0)
  10635. @item cubic2p_catmullrom
  10636. 2-parameter cubic (B=0, C=1/2)
  10637. @item cubic2p_b05c03
  10638. 2-parameter cubic (B=1/2, C=3/10)
  10639. @item super
  10640. Supersampling
  10641. @item lanczos
  10642. @end table
  10643. @end table
  10644. @section scale2ref
  10645. Scale (resize) the input video, based on a reference video.
  10646. See the scale filter for available options, scale2ref supports the same but
  10647. uses the reference video instead of the main input as basis. scale2ref also
  10648. supports the following additional constants for the @option{w} and
  10649. @option{h} options:
  10650. @table @var
  10651. @item main_w
  10652. @item main_h
  10653. The main input video's width and height
  10654. @item main_a
  10655. The same as @var{main_w} / @var{main_h}
  10656. @item main_sar
  10657. The main input video's sample aspect ratio
  10658. @item main_dar, mdar
  10659. The main input video's display aspect ratio. Calculated from
  10660. @code{(main_w / main_h) * main_sar}.
  10661. @item main_hsub
  10662. @item main_vsub
  10663. The main input video's horizontal and vertical chroma subsample values.
  10664. For example for the pixel format "yuv422p" @var{hsub} is 2 and @var{vsub}
  10665. is 1.
  10666. @end table
  10667. @subsection Examples
  10668. @itemize
  10669. @item
  10670. Scale a subtitle stream (b) to match the main video (a) in size before overlaying
  10671. @example
  10672. 'scale2ref[b][a];[a][b]overlay'
  10673. @end example
  10674. @end itemize
  10675. @anchor{selectivecolor}
  10676. @section selectivecolor
  10677. Adjust cyan, magenta, yellow and black (CMYK) to certain ranges of colors (such
  10678. as "reds", "yellows", "greens", "cyans", ...). The adjustment range is defined
  10679. by the "purity" of the color (that is, how saturated it already is).
  10680. This filter is similar to the Adobe Photoshop Selective Color tool.
  10681. The filter accepts the following options:
  10682. @table @option
  10683. @item correction_method
  10684. Select color correction method.
  10685. Available values are:
  10686. @table @samp
  10687. @item absolute
  10688. Specified adjustments are applied "as-is" (added/subtracted to original pixel
  10689. component value).
  10690. @item relative
  10691. Specified adjustments are relative to the original component value.
  10692. @end table
  10693. Default is @code{absolute}.
  10694. @item reds
  10695. Adjustments for red pixels (pixels where the red component is the maximum)
  10696. @item yellows
  10697. Adjustments for yellow pixels (pixels where the blue component is the minimum)
  10698. @item greens
  10699. Adjustments for green pixels (pixels where the green component is the maximum)
  10700. @item cyans
  10701. Adjustments for cyan pixels (pixels where the red component is the minimum)
  10702. @item blues
  10703. Adjustments for blue pixels (pixels where the blue component is the maximum)
  10704. @item magentas
  10705. Adjustments for magenta pixels (pixels where the green component is the minimum)
  10706. @item whites
  10707. Adjustments for white pixels (pixels where all components are greater than 128)
  10708. @item neutrals
  10709. Adjustments for all pixels except pure black and pure white
  10710. @item blacks
  10711. Adjustments for black pixels (pixels where all components are lesser than 128)
  10712. @item psfile
  10713. Specify a Photoshop selective color file (@code{.asv}) to import the settings from.
  10714. @end table
  10715. All the adjustment settings (@option{reds}, @option{yellows}, ...) accept up to
  10716. 4 space separated floating point adjustment values in the [-1,1] range,
  10717. respectively to adjust the amount of cyan, magenta, yellow and black for the
  10718. pixels of its range.
  10719. @subsection Examples
  10720. @itemize
  10721. @item
  10722. Increase cyan by 50% and reduce yellow by 33% in every green areas, and
  10723. increase magenta by 27% in blue areas:
  10724. @example
  10725. selectivecolor=greens=.5 0 -.33 0:blues=0 .27
  10726. @end example
  10727. @item
  10728. Use a Photoshop selective color preset:
  10729. @example
  10730. selectivecolor=psfile=MySelectiveColorPresets/Misty.asv
  10731. @end example
  10732. @end itemize
  10733. @anchor{separatefields}
  10734. @section separatefields
  10735. The @code{separatefields} takes a frame-based video input and splits
  10736. each frame into its components fields, producing a new half height clip
  10737. with twice the frame rate and twice the frame count.
  10738. This filter use field-dominance information in frame to decide which
  10739. of each pair of fields to place first in the output.
  10740. If it gets it wrong use @ref{setfield} filter before @code{separatefields} filter.
  10741. @section setdar, setsar
  10742. The @code{setdar} filter sets the Display Aspect Ratio for the filter
  10743. output video.
  10744. This is done by changing the specified Sample (aka Pixel) Aspect
  10745. Ratio, according to the following equation:
  10746. @example
  10747. @var{DAR} = @var{HORIZONTAL_RESOLUTION} / @var{VERTICAL_RESOLUTION} * @var{SAR}
  10748. @end example
  10749. Keep in mind that the @code{setdar} filter does not modify the pixel
  10750. dimensions of the video frame. Also, the display aspect ratio set by
  10751. this filter may be changed by later filters in the filterchain,
  10752. e.g. in case of scaling or if another "setdar" or a "setsar" filter is
  10753. applied.
  10754. The @code{setsar} filter sets the Sample (aka Pixel) Aspect Ratio for
  10755. the filter output video.
  10756. Note that as a consequence of the application of this filter, the
  10757. output display aspect ratio will change according to the equation
  10758. above.
  10759. Keep in mind that the sample aspect ratio set by the @code{setsar}
  10760. filter may be changed by later filters in the filterchain, e.g. if
  10761. another "setsar" or a "setdar" filter is applied.
  10762. It accepts the following parameters:
  10763. @table @option
  10764. @item r, ratio, dar (@code{setdar} only), sar (@code{setsar} only)
  10765. Set the aspect ratio used by the filter.
  10766. The parameter can be a floating point number string, an expression, or
  10767. a string of the form @var{num}:@var{den}, where @var{num} and
  10768. @var{den} are the numerator and denominator of the aspect ratio. If
  10769. the parameter is not specified, it is assumed the value "0".
  10770. In case the form "@var{num}:@var{den}" is used, the @code{:} character
  10771. should be escaped.
  10772. @item max
  10773. Set the maximum integer value to use for expressing numerator and
  10774. denominator when reducing the expressed aspect ratio to a rational.
  10775. Default value is @code{100}.
  10776. @end table
  10777. The parameter @var{sar} is an expression containing
  10778. the following constants:
  10779. @table @option
  10780. @item E, PI, PHI
  10781. These are approximated values for the mathematical constants e
  10782. (Euler's number), pi (Greek pi), and phi (the golden ratio).
  10783. @item w, h
  10784. The input width and height.
  10785. @item a
  10786. These are the same as @var{w} / @var{h}.
  10787. @item sar
  10788. The input sample aspect ratio.
  10789. @item dar
  10790. The input display aspect ratio. It is the same as
  10791. (@var{w} / @var{h}) * @var{sar}.
  10792. @item hsub, vsub
  10793. Horizontal and vertical chroma subsample values. For example, for the
  10794. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  10795. @end table
  10796. @subsection Examples
  10797. @itemize
  10798. @item
  10799. To change the display aspect ratio to 16:9, specify one of the following:
  10800. @example
  10801. setdar=dar=1.77777
  10802. setdar=dar=16/9
  10803. @end example
  10804. @item
  10805. To change the sample aspect ratio to 10:11, specify:
  10806. @example
  10807. setsar=sar=10/11
  10808. @end example
  10809. @item
  10810. To set a display aspect ratio of 16:9, and specify a maximum integer value of
  10811. 1000 in the aspect ratio reduction, use the command:
  10812. @example
  10813. setdar=ratio=16/9:max=1000
  10814. @end example
  10815. @end itemize
  10816. @anchor{setfield}
  10817. @section setfield
  10818. Force field for the output video frame.
  10819. The @code{setfield} filter marks the interlace type field for the
  10820. output frames. It does not change the input frame, but only sets the
  10821. corresponding property, which affects how the frame is treated by
  10822. following filters (e.g. @code{fieldorder} or @code{yadif}).
  10823. The filter accepts the following options:
  10824. @table @option
  10825. @item mode
  10826. Available values are:
  10827. @table @samp
  10828. @item auto
  10829. Keep the same field property.
  10830. @item bff
  10831. Mark the frame as bottom-field-first.
  10832. @item tff
  10833. Mark the frame as top-field-first.
  10834. @item prog
  10835. Mark the frame as progressive.
  10836. @end table
  10837. @end table
  10838. @section showinfo
  10839. Show a line containing various information for each input video frame.
  10840. The input video is not modified.
  10841. The shown line contains a sequence of key/value pairs of the form
  10842. @var{key}:@var{value}.
  10843. The following values are shown in the output:
  10844. @table @option
  10845. @item n
  10846. The (sequential) number of the input frame, starting from 0.
  10847. @item pts
  10848. The Presentation TimeStamp of the input frame, expressed as a number of
  10849. time base units. The time base unit depends on the filter input pad.
  10850. @item pts_time
  10851. The Presentation TimeStamp of the input frame, expressed as a number of
  10852. seconds.
  10853. @item pos
  10854. The position of the frame in the input stream, or -1 if this information is
  10855. unavailable and/or meaningless (for example in case of synthetic video).
  10856. @item fmt
  10857. The pixel format name.
  10858. @item sar
  10859. The sample aspect ratio of the input frame, expressed in the form
  10860. @var{num}/@var{den}.
  10861. @item s
  10862. The size of the input frame. For the syntax of this option, check the
  10863. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  10864. @item i
  10865. The type of interlaced mode ("P" for "progressive", "T" for top field first, "B"
  10866. for bottom field first).
  10867. @item iskey
  10868. This is 1 if the frame is a key frame, 0 otherwise.
  10869. @item type
  10870. The picture type of the input frame ("I" for an I-frame, "P" for a
  10871. P-frame, "B" for a B-frame, or "?" for an unknown type).
  10872. Also refer to the documentation of the @code{AVPictureType} enum and of
  10873. the @code{av_get_picture_type_char} function defined in
  10874. @file{libavutil/avutil.h}.
  10875. @item checksum
  10876. The Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame.
  10877. @item plane_checksum
  10878. The Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
  10879. expressed in the form "[@var{c0} @var{c1} @var{c2} @var{c3}]".
  10880. @end table
  10881. @section showpalette
  10882. Displays the 256 colors palette of each frame. This filter is only relevant for
  10883. @var{pal8} pixel format frames.
  10884. It accepts the following option:
  10885. @table @option
  10886. @item s
  10887. Set the size of the box used to represent one palette color entry. Default is
  10888. @code{30} (for a @code{30x30} pixel box).
  10889. @end table
  10890. @section shuffleframes
  10891. Reorder and/or duplicate and/or drop video frames.
  10892. It accepts the following parameters:
  10893. @table @option
  10894. @item mapping
  10895. Set the destination indexes of input frames.
  10896. This is space or '|' separated list of indexes that maps input frames to output
  10897. frames. Number of indexes also sets maximal value that each index may have.
  10898. '-1' index have special meaning and that is to drop frame.
  10899. @end table
  10900. The first frame has the index 0. The default is to keep the input unchanged.
  10901. @subsection Examples
  10902. @itemize
  10903. @item
  10904. Swap second and third frame of every three frames of the input:
  10905. @example
  10906. ffmpeg -i INPUT -vf "shuffleframes=0 2 1" OUTPUT
  10907. @end example
  10908. @item
  10909. Swap 10th and 1st frame of every ten frames of the input:
  10910. @example
  10911. ffmpeg -i INPUT -vf "shuffleframes=9 1 2 3 4 5 6 7 8 0" OUTPUT
  10912. @end example
  10913. @end itemize
  10914. @section shuffleplanes
  10915. Reorder and/or duplicate video planes.
  10916. It accepts the following parameters:
  10917. @table @option
  10918. @item map0
  10919. The index of the input plane to be used as the first output plane.
  10920. @item map1
  10921. The index of the input plane to be used as the second output plane.
  10922. @item map2
  10923. The index of the input plane to be used as the third output plane.
  10924. @item map3
  10925. The index of the input plane to be used as the fourth output plane.
  10926. @end table
  10927. The first plane has the index 0. The default is to keep the input unchanged.
  10928. @subsection Examples
  10929. @itemize
  10930. @item
  10931. Swap the second and third planes of the input:
  10932. @example
  10933. ffmpeg -i INPUT -vf shuffleplanes=0:2:1:3 OUTPUT
  10934. @end example
  10935. @end itemize
  10936. @anchor{signalstats}
  10937. @section signalstats
  10938. Evaluate various visual metrics that assist in determining issues associated
  10939. with the digitization of analog video media.
  10940. By default the filter will log these metadata values:
  10941. @table @option
  10942. @item YMIN
  10943. Display the minimal Y value contained within the input frame. Expressed in
  10944. range of [0-255].
  10945. @item YLOW
  10946. Display the Y value at the 10% percentile within the input frame. Expressed in
  10947. range of [0-255].
  10948. @item YAVG
  10949. Display the average Y value within the input frame. Expressed in range of
  10950. [0-255].
  10951. @item YHIGH
  10952. Display the Y value at the 90% percentile within the input frame. Expressed in
  10953. range of [0-255].
  10954. @item YMAX
  10955. Display the maximum Y value contained within the input frame. Expressed in
  10956. range of [0-255].
  10957. @item UMIN
  10958. Display the minimal U value contained within the input frame. Expressed in
  10959. range of [0-255].
  10960. @item ULOW
  10961. Display the U value at the 10% percentile within the input frame. Expressed in
  10962. range of [0-255].
  10963. @item UAVG
  10964. Display the average U value within the input frame. Expressed in range of
  10965. [0-255].
  10966. @item UHIGH
  10967. Display the U value at the 90% percentile within the input frame. Expressed in
  10968. range of [0-255].
  10969. @item UMAX
  10970. Display the maximum U value contained within the input frame. Expressed in
  10971. range of [0-255].
  10972. @item VMIN
  10973. Display the minimal V value contained within the input frame. Expressed in
  10974. range of [0-255].
  10975. @item VLOW
  10976. Display the V value at the 10% percentile within the input frame. Expressed in
  10977. range of [0-255].
  10978. @item VAVG
  10979. Display the average V value within the input frame. Expressed in range of
  10980. [0-255].
  10981. @item VHIGH
  10982. Display the V value at the 90% percentile within the input frame. Expressed in
  10983. range of [0-255].
  10984. @item VMAX
  10985. Display the maximum V value contained within the input frame. Expressed in
  10986. range of [0-255].
  10987. @item SATMIN
  10988. Display the minimal saturation value contained within the input frame.
  10989. Expressed in range of [0-~181.02].
  10990. @item SATLOW
  10991. Display the saturation value at the 10% percentile within the input frame.
  10992. Expressed in range of [0-~181.02].
  10993. @item SATAVG
  10994. Display the average saturation value within the input frame. Expressed in range
  10995. of [0-~181.02].
  10996. @item SATHIGH
  10997. Display the saturation value at the 90% percentile within the input frame.
  10998. Expressed in range of [0-~181.02].
  10999. @item SATMAX
  11000. Display the maximum saturation value contained within the input frame.
  11001. Expressed in range of [0-~181.02].
  11002. @item HUEMED
  11003. Display the median value for hue within the input frame. Expressed in range of
  11004. [0-360].
  11005. @item HUEAVG
  11006. Display the average value for hue within the input frame. Expressed in range of
  11007. [0-360].
  11008. @item YDIF
  11009. Display the average of sample value difference between all values of the Y
  11010. plane in the current frame and corresponding values of the previous input frame.
  11011. Expressed in range of [0-255].
  11012. @item UDIF
  11013. Display the average of sample value difference between all values of the U
  11014. plane in the current frame and corresponding values of the previous input frame.
  11015. Expressed in range of [0-255].
  11016. @item VDIF
  11017. Display the average of sample value difference between all values of the V
  11018. plane in the current frame and corresponding values of the previous input frame.
  11019. Expressed in range of [0-255].
  11020. @item YBITDEPTH
  11021. Display bit depth of Y plane in current frame.
  11022. Expressed in range of [0-16].
  11023. @item UBITDEPTH
  11024. Display bit depth of U plane in current frame.
  11025. Expressed in range of [0-16].
  11026. @item VBITDEPTH
  11027. Display bit depth of V plane in current frame.
  11028. Expressed in range of [0-16].
  11029. @end table
  11030. The filter accepts the following options:
  11031. @table @option
  11032. @item stat
  11033. @item out
  11034. @option{stat} specify an additional form of image analysis.
  11035. @option{out} output video with the specified type of pixel highlighted.
  11036. Both options accept the following values:
  11037. @table @samp
  11038. @item tout
  11039. Identify @var{temporal outliers} pixels. A @var{temporal outlier} is a pixel
  11040. unlike the neighboring pixels of the same field. Examples of temporal outliers
  11041. include the results of video dropouts, head clogs, or tape tracking issues.
  11042. @item vrep
  11043. Identify @var{vertical line repetition}. Vertical line repetition includes
  11044. similar rows of pixels within a frame. In born-digital video vertical line
  11045. repetition is common, but this pattern is uncommon in video digitized from an
  11046. analog source. When it occurs in video that results from the digitization of an
  11047. analog source it can indicate concealment from a dropout compensator.
  11048. @item brng
  11049. Identify pixels that fall outside of legal broadcast range.
  11050. @end table
  11051. @item color, c
  11052. Set the highlight color for the @option{out} option. The default color is
  11053. yellow.
  11054. @end table
  11055. @subsection Examples
  11056. @itemize
  11057. @item
  11058. Output data of various video metrics:
  11059. @example
  11060. ffprobe -f lavfi movie=example.mov,signalstats="stat=tout+vrep+brng" -show_frames
  11061. @end example
  11062. @item
  11063. Output specific data about the minimum and maximum values of the Y plane per frame:
  11064. @example
  11065. ffprobe -f lavfi movie=example.mov,signalstats -show_entries frame_tags=lavfi.signalstats.YMAX,lavfi.signalstats.YMIN
  11066. @end example
  11067. @item
  11068. Playback video while highlighting pixels that are outside of broadcast range in red.
  11069. @example
  11070. ffplay example.mov -vf signalstats="out=brng:color=red"
  11071. @end example
  11072. @item
  11073. Playback video with signalstats metadata drawn over the frame.
  11074. @example
  11075. ffplay example.mov -vf signalstats=stat=brng+vrep+tout,drawtext=fontfile=FreeSerif.ttf:textfile=signalstat_drawtext.txt
  11076. @end example
  11077. The contents of signalstat_drawtext.txt used in the command are:
  11078. @example
  11079. time %@{pts:hms@}
  11080. Y (%@{metadata:lavfi.signalstats.YMIN@}-%@{metadata:lavfi.signalstats.YMAX@})
  11081. U (%@{metadata:lavfi.signalstats.UMIN@}-%@{metadata:lavfi.signalstats.UMAX@})
  11082. V (%@{metadata:lavfi.signalstats.VMIN@}-%@{metadata:lavfi.signalstats.VMAX@})
  11083. saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
  11084. @end example
  11085. @end itemize
  11086. @anchor{signature}
  11087. @section signature
  11088. Calculates the MPEG-7 Video Signature. The filter can handle more than one
  11089. input. In this case the matching between the inputs can be calculated additionally.
  11090. The filter always passes through the first input. The signature of each stream can
  11091. be written into a file.
  11092. It accepts the following options:
  11093. @table @option
  11094. @item detectmode
  11095. Enable or disable the matching process.
  11096. Available values are:
  11097. @table @samp
  11098. @item off
  11099. Disable the calculation of a matching (default).
  11100. @item full
  11101. Calculate the matching for the whole video and output whether the whole video
  11102. matches or only parts.
  11103. @item fast
  11104. Calculate only until a matching is found or the video ends. Should be faster in
  11105. some cases.
  11106. @end table
  11107. @item nb_inputs
  11108. Set the number of inputs. The option value must be a non negative integer.
  11109. Default value is 1.
  11110. @item filename
  11111. Set the path to which the output is written. If there is more than one input,
  11112. the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
  11113. integer), that will be replaced with the input number. If no filename is
  11114. specified, no output will be written. This is the default.
  11115. @item format
  11116. Choose the output format.
  11117. Available values are:
  11118. @table @samp
  11119. @item binary
  11120. Use the specified binary representation (default).
  11121. @item xml
  11122. Use the specified xml representation.
  11123. @end table
  11124. @item th_d
  11125. Set threshold to detect one word as similar. The option value must be an integer
  11126. greater than zero. The default value is 9000.
  11127. @item th_dc
  11128. Set threshold to detect all words as similar. The option value must be an integer
  11129. greater than zero. The default value is 60000.
  11130. @item th_xh
  11131. Set threshold to detect frames as similar. The option value must be an integer
  11132. greater than zero. The default value is 116.
  11133. @item th_di
  11134. Set the minimum length of a sequence in frames to recognize it as matching
  11135. sequence. The option value must be a non negative integer value.
  11136. The default value is 0.
  11137. @item th_it
  11138. Set the minimum relation, that matching frames to all frames must have.
  11139. The option value must be a double value between 0 and 1. The default value is 0.5.
  11140. @end table
  11141. @subsection Examples
  11142. @itemize
  11143. @item
  11144. To calculate the signature of an input video and store it in signature.bin:
  11145. @example
  11146. ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
  11147. @end example
  11148. @item
  11149. To detect whether two videos match and store the signatures in XML format in
  11150. signature0.xml and signature1.xml:
  11151. @example
  11152. 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 -
  11153. @end example
  11154. @end itemize
  11155. @anchor{smartblur}
  11156. @section smartblur
  11157. Blur the input video without impacting the outlines.
  11158. It accepts the following options:
  11159. @table @option
  11160. @item luma_radius, lr
  11161. Set the luma radius. The option value must be a float number in
  11162. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11163. used to blur the image (slower if larger). Default value is 1.0.
  11164. @item luma_strength, ls
  11165. Set the luma strength. The option value must be a float number
  11166. in the range [-1.0,1.0] that configures the blurring. A value included
  11167. in [0.0,1.0] will blur the image whereas a value included in
  11168. [-1.0,0.0] will sharpen the image. Default value is 1.0.
  11169. @item luma_threshold, lt
  11170. Set the luma threshold used as a coefficient to determine
  11171. whether a pixel should be blurred or not. The option value must be an
  11172. integer in the range [-30,30]. A value of 0 will filter all the image,
  11173. a value included in [0,30] will filter flat areas and a value included
  11174. in [-30,0] will filter edges. Default value is 0.
  11175. @item chroma_radius, cr
  11176. Set the chroma radius. The option value must be a float number in
  11177. the range [0.1,5.0] that specifies the variance of the gaussian filter
  11178. used to blur the image (slower if larger). Default value is @option{luma_radius}.
  11179. @item chroma_strength, cs
  11180. Set the chroma strength. The option value must be a float number
  11181. in the range [-1.0,1.0] that configures the blurring. A value included
  11182. in [0.0,1.0] will blur the image whereas a value included in
  11183. [-1.0,0.0] will sharpen the image. Default value is @option{luma_strength}.
  11184. @item chroma_threshold, ct
  11185. Set the chroma threshold used as a coefficient to determine
  11186. whether a pixel should be blurred or not. The option value must be an
  11187. integer in the range [-30,30]. A value of 0 will filter all the image,
  11188. a value included in [0,30] will filter flat areas and a value included
  11189. in [-30,0] will filter edges. Default value is @option{luma_threshold}.
  11190. @end table
  11191. If a chroma option is not explicitly set, the corresponding luma value
  11192. is set.
  11193. @section ssim
  11194. Obtain the SSIM (Structural SImilarity Metric) between two input videos.
  11195. This filter takes in input two input videos, the first input is
  11196. considered the "main" source and is passed unchanged to the
  11197. output. The second input is used as a "reference" video for computing
  11198. the SSIM.
  11199. Both video inputs must have the same resolution and pixel format for
  11200. this filter to work correctly. Also it assumes that both inputs
  11201. have the same number of frames, which are compared one by one.
  11202. The filter stores the calculated SSIM of each frame.
  11203. The description of the accepted parameters follows.
  11204. @table @option
  11205. @item stats_file, f
  11206. If specified the filter will use the named file to save the SSIM of
  11207. each individual frame. When filename equals "-" the data is sent to
  11208. standard output.
  11209. @end table
  11210. The file printed if @var{stats_file} is selected, contains a sequence of
  11211. key/value pairs of the form @var{key}:@var{value} for each compared
  11212. couple of frames.
  11213. A description of each shown parameter follows:
  11214. @table @option
  11215. @item n
  11216. sequential number of the input frame, starting from 1
  11217. @item Y, U, V, R, G, B
  11218. SSIM of the compared frames for the component specified by the suffix.
  11219. @item All
  11220. SSIM of the compared frames for the whole frame.
  11221. @item dB
  11222. Same as above but in dB representation.
  11223. @end table
  11224. This filter also supports the @ref{framesync} options.
  11225. For example:
  11226. @example
  11227. movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
  11228. [main][ref] ssim="stats_file=stats.log" [out]
  11229. @end example
  11230. On this example the input file being processed is compared with the
  11231. reference file @file{ref_movie.mpg}. The SSIM of each individual frame
  11232. is stored in @file{stats.log}.
  11233. Another example with both psnr and ssim at same time:
  11234. @example
  11235. ffmpeg -i main.mpg -i ref.mpg -lavfi "ssim;[0:v][1:v]psnr" -f null -
  11236. @end example
  11237. @section stereo3d
  11238. Convert between different stereoscopic image formats.
  11239. The filters accept the following options:
  11240. @table @option
  11241. @item in
  11242. Set stereoscopic image format of input.
  11243. Available values for input image formats are:
  11244. @table @samp
  11245. @item sbsl
  11246. side by side parallel (left eye left, right eye right)
  11247. @item sbsr
  11248. side by side crosseye (right eye left, left eye right)
  11249. @item sbs2l
  11250. side by side parallel with half width resolution
  11251. (left eye left, right eye right)
  11252. @item sbs2r
  11253. side by side crosseye with half width resolution
  11254. (right eye left, left eye right)
  11255. @item abl
  11256. above-below (left eye above, right eye below)
  11257. @item abr
  11258. above-below (right eye above, left eye below)
  11259. @item ab2l
  11260. above-below with half height resolution
  11261. (left eye above, right eye below)
  11262. @item ab2r
  11263. above-below with half height resolution
  11264. (right eye above, left eye below)
  11265. @item al
  11266. alternating frames (left eye first, right eye second)
  11267. @item ar
  11268. alternating frames (right eye first, left eye second)
  11269. @item irl
  11270. interleaved rows (left eye has top row, right eye starts on next row)
  11271. @item irr
  11272. interleaved rows (right eye has top row, left eye starts on next row)
  11273. @item icl
  11274. interleaved columns, left eye first
  11275. @item icr
  11276. interleaved columns, right eye first
  11277. Default value is @samp{sbsl}.
  11278. @end table
  11279. @item out
  11280. Set stereoscopic image format of output.
  11281. @table @samp
  11282. @item sbsl
  11283. side by side parallel (left eye left, right eye right)
  11284. @item sbsr
  11285. side by side crosseye (right eye left, left eye right)
  11286. @item sbs2l
  11287. side by side parallel with half width resolution
  11288. (left eye left, right eye right)
  11289. @item sbs2r
  11290. side by side crosseye with half width resolution
  11291. (right eye left, left eye right)
  11292. @item abl
  11293. above-below (left eye above, right eye below)
  11294. @item abr
  11295. above-below (right eye above, left eye below)
  11296. @item ab2l
  11297. above-below with half height resolution
  11298. (left eye above, right eye below)
  11299. @item ab2r
  11300. above-below with half height resolution
  11301. (right eye above, left eye below)
  11302. @item al
  11303. alternating frames (left eye first, right eye second)
  11304. @item ar
  11305. alternating frames (right eye first, left eye second)
  11306. @item irl
  11307. interleaved rows (left eye has top row, right eye starts on next row)
  11308. @item irr
  11309. interleaved rows (right eye has top row, left eye starts on next row)
  11310. @item arbg
  11311. anaglyph red/blue gray
  11312. (red filter on left eye, blue filter on right eye)
  11313. @item argg
  11314. anaglyph red/green gray
  11315. (red filter on left eye, green filter on right eye)
  11316. @item arcg
  11317. anaglyph red/cyan gray
  11318. (red filter on left eye, cyan filter on right eye)
  11319. @item arch
  11320. anaglyph red/cyan half colored
  11321. (red filter on left eye, cyan filter on right eye)
  11322. @item arcc
  11323. anaglyph red/cyan color
  11324. (red filter on left eye, cyan filter on right eye)
  11325. @item arcd
  11326. anaglyph red/cyan color optimized with the least squares projection of dubois
  11327. (red filter on left eye, cyan filter on right eye)
  11328. @item agmg
  11329. anaglyph green/magenta gray
  11330. (green filter on left eye, magenta filter on right eye)
  11331. @item agmh
  11332. anaglyph green/magenta half colored
  11333. (green filter on left eye, magenta filter on right eye)
  11334. @item agmc
  11335. anaglyph green/magenta colored
  11336. (green filter on left eye, magenta filter on right eye)
  11337. @item agmd
  11338. anaglyph green/magenta color optimized with the least squares projection of dubois
  11339. (green filter on left eye, magenta filter on right eye)
  11340. @item aybg
  11341. anaglyph yellow/blue gray
  11342. (yellow filter on left eye, blue filter on right eye)
  11343. @item aybh
  11344. anaglyph yellow/blue half colored
  11345. (yellow filter on left eye, blue filter on right eye)
  11346. @item aybc
  11347. anaglyph yellow/blue colored
  11348. (yellow filter on left eye, blue filter on right eye)
  11349. @item aybd
  11350. anaglyph yellow/blue color optimized with the least squares projection of dubois
  11351. (yellow filter on left eye, blue filter on right eye)
  11352. @item ml
  11353. mono output (left eye only)
  11354. @item mr
  11355. mono output (right eye only)
  11356. @item chl
  11357. checkerboard, left eye first
  11358. @item chr
  11359. checkerboard, right eye first
  11360. @item icl
  11361. interleaved columns, left eye first
  11362. @item icr
  11363. interleaved columns, right eye first
  11364. @item hdmi
  11365. HDMI frame pack
  11366. @end table
  11367. Default value is @samp{arcd}.
  11368. @end table
  11369. @subsection Examples
  11370. @itemize
  11371. @item
  11372. Convert input video from side by side parallel to anaglyph yellow/blue dubois:
  11373. @example
  11374. stereo3d=sbsl:aybd
  11375. @end example
  11376. @item
  11377. Convert input video from above below (left eye above, right eye below) to side by side crosseye.
  11378. @example
  11379. stereo3d=abl:sbsr
  11380. @end example
  11381. @end itemize
  11382. @section streamselect, astreamselect
  11383. Select video or audio streams.
  11384. The filter accepts the following options:
  11385. @table @option
  11386. @item inputs
  11387. Set number of inputs. Default is 2.
  11388. @item map
  11389. Set input indexes to remap to outputs.
  11390. @end table
  11391. @subsection Commands
  11392. The @code{streamselect} and @code{astreamselect} filter supports the following
  11393. commands:
  11394. @table @option
  11395. @item map
  11396. Set input indexes to remap to outputs.
  11397. @end table
  11398. @subsection Examples
  11399. @itemize
  11400. @item
  11401. Select first 5 seconds 1st stream and rest of time 2nd stream:
  11402. @example
  11403. sendcmd='5.0 streamselect map 1',streamselect=inputs=2:map=0
  11404. @end example
  11405. @item
  11406. Same as above, but for audio:
  11407. @example
  11408. asendcmd='5.0 astreamselect map 1',astreamselect=inputs=2:map=0
  11409. @end example
  11410. @end itemize
  11411. @section sobel
  11412. Apply sobel operator to input video stream.
  11413. The filter accepts the following option:
  11414. @table @option
  11415. @item planes
  11416. Set which planes will be processed, unprocessed planes will be copied.
  11417. By default value 0xf, all planes will be processed.
  11418. @item scale
  11419. Set value which will be multiplied with filtered result.
  11420. @item delta
  11421. Set value which will be added to filtered result.
  11422. @end table
  11423. @anchor{spp}
  11424. @section spp
  11425. Apply a simple postprocessing filter that compresses and decompresses the image
  11426. at several (or - in the case of @option{quality} level @code{6} - all) shifts
  11427. and average the results.
  11428. The filter accepts the following options:
  11429. @table @option
  11430. @item quality
  11431. Set quality. This option defines the number of levels for averaging. It accepts
  11432. an integer in the range 0-6. If set to @code{0}, the filter will have no
  11433. effect. A value of @code{6} means the higher quality. For each increment of
  11434. that value the speed drops by a factor of approximately 2. Default value is
  11435. @code{3}.
  11436. @item qp
  11437. Force a constant quantization parameter. If not set, the filter will use the QP
  11438. from the video stream (if available).
  11439. @item mode
  11440. Set thresholding mode. Available modes are:
  11441. @table @samp
  11442. @item hard
  11443. Set hard thresholding (default).
  11444. @item soft
  11445. Set soft thresholding (better de-ringing effect, but likely blurrier).
  11446. @end table
  11447. @item use_bframe_qp
  11448. Enable the use of the QP from the B-Frames if set to @code{1}. Using this
  11449. option may cause flicker since the B-Frames have often larger QP. Default is
  11450. @code{0} (not enabled).
  11451. @end table
  11452. @anchor{subtitles}
  11453. @section subtitles
  11454. Draw subtitles on top of input video using the libass library.
  11455. To enable compilation of this filter you need to configure FFmpeg with
  11456. @code{--enable-libass}. This filter also requires a build with libavcodec and
  11457. libavformat to convert the passed subtitles file to ASS (Advanced Substation
  11458. Alpha) subtitles format.
  11459. The filter accepts the following options:
  11460. @table @option
  11461. @item filename, f
  11462. Set the filename of the subtitle file to read. It must be specified.
  11463. @item original_size
  11464. Specify the size of the original video, the video for which the ASS file
  11465. was composed. For the syntax of this option, check the
  11466. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11467. Due to a misdesign in ASS aspect ratio arithmetic, this is necessary to
  11468. correctly scale the fonts if the aspect ratio has been changed.
  11469. @item fontsdir
  11470. Set a directory path containing fonts that can be used by the filter.
  11471. These fonts will be used in addition to whatever the font provider uses.
  11472. @item alpha
  11473. Process alpha channel, by default alpha channel is untouched.
  11474. @item charenc
  11475. Set subtitles input character encoding. @code{subtitles} filter only. Only
  11476. useful if not UTF-8.
  11477. @item stream_index, si
  11478. Set subtitles stream index. @code{subtitles} filter only.
  11479. @item force_style
  11480. Override default style or script info parameters of the subtitles. It accepts a
  11481. string containing ASS style format @code{KEY=VALUE} couples separated by ",".
  11482. @end table
  11483. If the first key is not specified, it is assumed that the first value
  11484. specifies the @option{filename}.
  11485. For example, to render the file @file{sub.srt} on top of the input
  11486. video, use the command:
  11487. @example
  11488. subtitles=sub.srt
  11489. @end example
  11490. which is equivalent to:
  11491. @example
  11492. subtitles=filename=sub.srt
  11493. @end example
  11494. To render the default subtitles stream from file @file{video.mkv}, use:
  11495. @example
  11496. subtitles=video.mkv
  11497. @end example
  11498. To render the second subtitles stream from that file, use:
  11499. @example
  11500. subtitles=video.mkv:si=1
  11501. @end example
  11502. To make the subtitles stream from @file{sub.srt} appear in transparent green
  11503. @code{DejaVu Serif}, use:
  11504. @example
  11505. subtitles=sub.srt:force_style='FontName=DejaVu Serif,PrimaryColour=&HAA00FF00'
  11506. @end example
  11507. @section super2xsai
  11508. Scale the input by 2x and smooth using the Super2xSaI (Scale and
  11509. Interpolate) pixel art scaling algorithm.
  11510. Useful for enlarging pixel art images without reducing sharpness.
  11511. @section swaprect
  11512. Swap two rectangular objects in video.
  11513. This filter accepts the following options:
  11514. @table @option
  11515. @item w
  11516. Set object width.
  11517. @item h
  11518. Set object height.
  11519. @item x1
  11520. Set 1st rect x coordinate.
  11521. @item y1
  11522. Set 1st rect y coordinate.
  11523. @item x2
  11524. Set 2nd rect x coordinate.
  11525. @item y2
  11526. Set 2nd rect y coordinate.
  11527. All expressions are evaluated once for each frame.
  11528. @end table
  11529. The all options are expressions containing the following constants:
  11530. @table @option
  11531. @item w
  11532. @item h
  11533. The input width and height.
  11534. @item a
  11535. same as @var{w} / @var{h}
  11536. @item sar
  11537. input sample aspect ratio
  11538. @item dar
  11539. input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
  11540. @item n
  11541. The number of the input frame, starting from 0.
  11542. @item t
  11543. The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
  11544. @item pos
  11545. the position in the file of the input frame, NAN if unknown
  11546. @end table
  11547. @section swapuv
  11548. Swap U & V plane.
  11549. @section telecine
  11550. Apply telecine process to the video.
  11551. This filter accepts the following options:
  11552. @table @option
  11553. @item first_field
  11554. @table @samp
  11555. @item top, t
  11556. top field first
  11557. @item bottom, b
  11558. bottom field first
  11559. The default value is @code{top}.
  11560. @end table
  11561. @item pattern
  11562. A string of numbers representing the pulldown pattern you wish to apply.
  11563. The default value is @code{23}.
  11564. @end table
  11565. @example
  11566. Some typical patterns:
  11567. NTSC output (30i):
  11568. 27.5p: 32222
  11569. 24p: 23 (classic)
  11570. 24p: 2332 (preferred)
  11571. 20p: 33
  11572. 18p: 334
  11573. 16p: 3444
  11574. PAL output (25i):
  11575. 27.5p: 12222
  11576. 24p: 222222222223 ("Euro pulldown")
  11577. 16.67p: 33
  11578. 16p: 33333334
  11579. @end example
  11580. @section threshold
  11581. Apply threshold effect to video stream.
  11582. This filter needs four video streams to perform thresholding.
  11583. First stream is stream we are filtering.
  11584. Second stream is holding threshold values, third stream is holding min values,
  11585. and last, fourth stream is holding max values.
  11586. The filter accepts the following option:
  11587. @table @option
  11588. @item planes
  11589. Set which planes will be processed, unprocessed planes will be copied.
  11590. By default value 0xf, all planes will be processed.
  11591. @end table
  11592. For example if first stream pixel's component value is less then threshold value
  11593. of pixel component from 2nd threshold stream, third stream value will picked,
  11594. otherwise fourth stream pixel component value will be picked.
  11595. Using color source filter one can perform various types of thresholding:
  11596. @subsection Examples
  11597. @itemize
  11598. @item
  11599. Binary threshold, using gray color as threshold:
  11600. @example
  11601. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
  11602. @end example
  11603. @item
  11604. Inverted binary threshold, using gray color as threshold:
  11605. @example
  11606. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
  11607. @end example
  11608. @item
  11609. Truncate binary threshold, using gray color as threshold:
  11610. @example
  11611. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
  11612. @end example
  11613. @item
  11614. Threshold to zero, using gray color as threshold:
  11615. @example
  11616. ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
  11617. @end example
  11618. @item
  11619. Inverted threshold to zero, using gray color as threshold:
  11620. @example
  11621. ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
  11622. @end example
  11623. @end itemize
  11624. @section thumbnail
  11625. Select the most representative frame in a given sequence of consecutive frames.
  11626. The filter accepts the following options:
  11627. @table @option
  11628. @item n
  11629. Set the frames batch size to analyze; in a set of @var{n} frames, the filter
  11630. will pick one of them, and then handle the next batch of @var{n} frames until
  11631. the end. Default is @code{100}.
  11632. @end table
  11633. Since the filter keeps track of the whole frames sequence, a bigger @var{n}
  11634. value will result in a higher memory usage, so a high value is not recommended.
  11635. @subsection Examples
  11636. @itemize
  11637. @item
  11638. Extract one picture each 50 frames:
  11639. @example
  11640. thumbnail=50
  11641. @end example
  11642. @item
  11643. Complete example of a thumbnail creation with @command{ffmpeg}:
  11644. @example
  11645. ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
  11646. @end example
  11647. @end itemize
  11648. @section tile
  11649. Tile several successive frames together.
  11650. The filter accepts the following options:
  11651. @table @option
  11652. @item layout
  11653. Set the grid size (i.e. the number of lines and columns). For the syntax of
  11654. this option, check the
  11655. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11656. @item nb_frames
  11657. Set the maximum number of frames to render in the given area. It must be less
  11658. than or equal to @var{w}x@var{h}. The default value is @code{0}, meaning all
  11659. the area will be used.
  11660. @item margin
  11661. Set the outer border margin in pixels.
  11662. @item padding
  11663. Set the inner border thickness (i.e. the number of pixels between frames). For
  11664. more advanced padding options (such as having different values for the edges),
  11665. refer to the pad video filter.
  11666. @item color
  11667. Specify the color of the unused area. For the syntax of this option, check the
  11668. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  11669. The default value of @var{color} is "black".
  11670. @item overlap
  11671. Set the number of frames to overlap when tiling several successive frames together.
  11672. The value must be between @code{0} and @var{nb_frames - 1}.
  11673. @item init_padding
  11674. Set the number of frames to initially be empty before displaying first output frame.
  11675. This controls how soon will one get first output frame.
  11676. The value must be between @code{0} and @var{nb_frames - 1}.
  11677. @end table
  11678. @subsection Examples
  11679. @itemize
  11680. @item
  11681. Produce 8x8 PNG tiles of all keyframes (@option{-skip_frame nokey}) in a movie:
  11682. @example
  11683. ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
  11684. @end example
  11685. The @option{-vsync 0} is necessary to prevent @command{ffmpeg} from
  11686. duplicating each output frame to accommodate the originally detected frame
  11687. rate.
  11688. @item
  11689. Display @code{5} pictures in an area of @code{3x2} frames,
  11690. with @code{7} pixels between them, and @code{2} pixels of initial margin, using
  11691. mixed flat and named options:
  11692. @example
  11693. tile=3x2:nb_frames=5:padding=7:margin=2
  11694. @end example
  11695. @end itemize
  11696. @section tinterlace
  11697. Perform various types of temporal field interlacing.
  11698. Frames are counted starting from 1, so the first input frame is
  11699. considered odd.
  11700. The filter accepts the following options:
  11701. @table @option
  11702. @item mode
  11703. Specify the mode of the interlacing. This option can also be specified
  11704. as a value alone. See below for a list of values for this option.
  11705. Available values are:
  11706. @table @samp
  11707. @item merge, 0
  11708. Move odd frames into the upper field, even into the lower field,
  11709. generating a double height frame at half frame rate.
  11710. @example
  11711. ------> time
  11712. Input:
  11713. Frame 1 Frame 2 Frame 3 Frame 4
  11714. 11111 22222 33333 44444
  11715. 11111 22222 33333 44444
  11716. 11111 22222 33333 44444
  11717. 11111 22222 33333 44444
  11718. Output:
  11719. 11111 33333
  11720. 22222 44444
  11721. 11111 33333
  11722. 22222 44444
  11723. 11111 33333
  11724. 22222 44444
  11725. 11111 33333
  11726. 22222 44444
  11727. @end example
  11728. @item drop_even, 1
  11729. Only output odd frames, even frames are dropped, generating a frame with
  11730. unchanged height at half frame rate.
  11731. @example
  11732. ------> time
  11733. Input:
  11734. Frame 1 Frame 2 Frame 3 Frame 4
  11735. 11111 22222 33333 44444
  11736. 11111 22222 33333 44444
  11737. 11111 22222 33333 44444
  11738. 11111 22222 33333 44444
  11739. Output:
  11740. 11111 33333
  11741. 11111 33333
  11742. 11111 33333
  11743. 11111 33333
  11744. @end example
  11745. @item drop_odd, 2
  11746. Only output even frames, odd frames are dropped, generating a frame with
  11747. unchanged height at half frame rate.
  11748. @example
  11749. ------> time
  11750. Input:
  11751. Frame 1 Frame 2 Frame 3 Frame 4
  11752. 11111 22222 33333 44444
  11753. 11111 22222 33333 44444
  11754. 11111 22222 33333 44444
  11755. 11111 22222 33333 44444
  11756. Output:
  11757. 22222 44444
  11758. 22222 44444
  11759. 22222 44444
  11760. 22222 44444
  11761. @end example
  11762. @item pad, 3
  11763. Expand each frame to full height, but pad alternate lines with black,
  11764. generating a frame with double height at the same input frame rate.
  11765. @example
  11766. ------> time
  11767. Input:
  11768. Frame 1 Frame 2 Frame 3 Frame 4
  11769. 11111 22222 33333 44444
  11770. 11111 22222 33333 44444
  11771. 11111 22222 33333 44444
  11772. 11111 22222 33333 44444
  11773. Output:
  11774. 11111 ..... 33333 .....
  11775. ..... 22222 ..... 44444
  11776. 11111 ..... 33333 .....
  11777. ..... 22222 ..... 44444
  11778. 11111 ..... 33333 .....
  11779. ..... 22222 ..... 44444
  11780. 11111 ..... 33333 .....
  11781. ..... 22222 ..... 44444
  11782. @end example
  11783. @item interleave_top, 4
  11784. Interleave the upper field from odd frames with the lower field from
  11785. even frames, generating a frame with unchanged height at half frame rate.
  11786. @example
  11787. ------> time
  11788. Input:
  11789. Frame 1 Frame 2 Frame 3 Frame 4
  11790. 11111<- 22222 33333<- 44444
  11791. 11111 22222<- 33333 44444<-
  11792. 11111<- 22222 33333<- 44444
  11793. 11111 22222<- 33333 44444<-
  11794. Output:
  11795. 11111 33333
  11796. 22222 44444
  11797. 11111 33333
  11798. 22222 44444
  11799. @end example
  11800. @item interleave_bottom, 5
  11801. Interleave the lower field from odd frames with the upper field from
  11802. even frames, generating a frame with unchanged height at half frame rate.
  11803. @example
  11804. ------> time
  11805. Input:
  11806. Frame 1 Frame 2 Frame 3 Frame 4
  11807. 11111 22222<- 33333 44444<-
  11808. 11111<- 22222 33333<- 44444
  11809. 11111 22222<- 33333 44444<-
  11810. 11111<- 22222 33333<- 44444
  11811. Output:
  11812. 22222 44444
  11813. 11111 33333
  11814. 22222 44444
  11815. 11111 33333
  11816. @end example
  11817. @item interlacex2, 6
  11818. Double frame rate with unchanged height. Frames are inserted each
  11819. containing the second temporal field from the previous input frame and
  11820. the first temporal field from the next input frame. This mode relies on
  11821. the top_field_first flag. Useful for interlaced video displays with no
  11822. field synchronisation.
  11823. @example
  11824. ------> time
  11825. Input:
  11826. Frame 1 Frame 2 Frame 3 Frame 4
  11827. 11111 22222 33333 44444
  11828. 11111 22222 33333 44444
  11829. 11111 22222 33333 44444
  11830. 11111 22222 33333 44444
  11831. Output:
  11832. 11111 22222 22222 33333 33333 44444 44444
  11833. 11111 11111 22222 22222 33333 33333 44444
  11834. 11111 22222 22222 33333 33333 44444 44444
  11835. 11111 11111 22222 22222 33333 33333 44444
  11836. @end example
  11837. @item mergex2, 7
  11838. Move odd frames into the upper field, even into the lower field,
  11839. generating a double height frame at same frame rate.
  11840. @example
  11841. ------> time
  11842. Input:
  11843. Frame 1 Frame 2 Frame 3 Frame 4
  11844. 11111 22222 33333 44444
  11845. 11111 22222 33333 44444
  11846. 11111 22222 33333 44444
  11847. 11111 22222 33333 44444
  11848. Output:
  11849. 11111 33333 33333 55555
  11850. 22222 22222 44444 44444
  11851. 11111 33333 33333 55555
  11852. 22222 22222 44444 44444
  11853. 11111 33333 33333 55555
  11854. 22222 22222 44444 44444
  11855. 11111 33333 33333 55555
  11856. 22222 22222 44444 44444
  11857. @end example
  11858. @end table
  11859. Numeric values are deprecated but are accepted for backward
  11860. compatibility reasons.
  11861. Default mode is @code{merge}.
  11862. @item flags
  11863. Specify flags influencing the filter process.
  11864. Available value for @var{flags} is:
  11865. @table @option
  11866. @item low_pass_filter, vlfp
  11867. Enable linear vertical low-pass filtering in the filter.
  11868. Vertical low-pass filtering is required when creating an interlaced
  11869. destination from a progressive source which contains high-frequency
  11870. vertical detail. Filtering will reduce interlace 'twitter' and Moire
  11871. patterning.
  11872. @item complex_filter, cvlfp
  11873. Enable complex vertical low-pass filtering.
  11874. This will slightly less reduce interlace 'twitter' and Moire
  11875. patterning but better retain detail and subjective sharpness impression.
  11876. @end table
  11877. Vertical low-pass filtering can only be enabled for @option{mode}
  11878. @var{interleave_top} and @var{interleave_bottom}.
  11879. @end table
  11880. @section tonemap
  11881. Tone map colors from different dynamic ranges.
  11882. This filter expects data in single precision floating point, as it needs to
  11883. operate on (and can output) out-of-range values. Another filter, such as
  11884. @ref{zscale}, is needed to convert the resulting frame to a usable format.
  11885. The tonemapping algorithms implemented only work on linear light, so input
  11886. data should be linearized beforehand (and possibly correctly tagged).
  11887. @example
  11888. ffmpeg -i INPUT -vf zscale=transfer=linear,tonemap=clip,zscale=transfer=bt709,format=yuv420p OUTPUT
  11889. @end example
  11890. @subsection Options
  11891. The filter accepts the following options.
  11892. @table @option
  11893. @item tonemap
  11894. Set the tone map algorithm to use.
  11895. Possible values are:
  11896. @table @var
  11897. @item none
  11898. Do not apply any tone map, only desaturate overbright pixels.
  11899. @item clip
  11900. Hard-clip any out-of-range values. Use it for perfect color accuracy for
  11901. in-range values, while distorting out-of-range values.
  11902. @item linear
  11903. Stretch the entire reference gamut to a linear multiple of the display.
  11904. @item gamma
  11905. Fit a logarithmic transfer between the tone curves.
  11906. @item reinhard
  11907. Preserve overall image brightness with a simple curve, using nonlinear
  11908. contrast, which results in flattening details and degrading color accuracy.
  11909. @item hable
  11910. Preserve both dark and bright details better than @var{reinhard}, at the cost
  11911. of slightly darkening everything. Use it when detail preservation is more
  11912. important than color and brightness accuracy.
  11913. @item mobius
  11914. Smoothly map out-of-range values, while retaining contrast and colors for
  11915. in-range material as much as possible. Use it when color accuracy is more
  11916. important than detail preservation.
  11917. @end table
  11918. Default is none.
  11919. @item param
  11920. Tune the tone mapping algorithm.
  11921. This affects the following algorithms:
  11922. @table @var
  11923. @item none
  11924. Ignored.
  11925. @item linear
  11926. Specifies the scale factor to use while stretching.
  11927. Default to 1.0.
  11928. @item gamma
  11929. Specifies the exponent of the function.
  11930. Default to 1.8.
  11931. @item clip
  11932. Specify an extra linear coefficient to multiply into the signal before clipping.
  11933. Default to 1.0.
  11934. @item reinhard
  11935. Specify the local contrast coefficient at the display peak.
  11936. Default to 0.5, which means that in-gamut values will be about half as bright
  11937. as when clipping.
  11938. @item hable
  11939. Ignored.
  11940. @item mobius
  11941. Specify the transition point from linear to mobius transform. Every value
  11942. below this point is guaranteed to be mapped 1:1. The higher the value, the
  11943. more accurate the result will be, at the cost of losing bright details.
  11944. Default to 0.3, which due to the steep initial slope still preserves in-range
  11945. colors fairly accurately.
  11946. @end table
  11947. @item desat
  11948. Apply desaturation for highlights that exceed this level of brightness. The
  11949. higher the parameter, the more color information will be preserved. This
  11950. setting helps prevent unnaturally blown-out colors for super-highlights, by
  11951. (smoothly) turning into white instead. This makes images feel more natural,
  11952. at the cost of reducing information about out-of-range colors.
  11953. The default of 2.0 is somewhat conservative and will mostly just apply to
  11954. skies or directly sunlit surfaces. A setting of 0.0 disables this option.
  11955. This option works only if the input frame has a supported color tag.
  11956. @item peak
  11957. Override signal/nominal/reference peak with this value. Useful when the
  11958. embedded peak information in display metadata is not reliable or when tone
  11959. mapping from a lower range to a higher range.
  11960. @end table
  11961. @section transpose
  11962. Transpose rows with columns in the input video and optionally flip it.
  11963. It accepts the following parameters:
  11964. @table @option
  11965. @item dir
  11966. Specify the transposition direction.
  11967. Can assume the following values:
  11968. @table @samp
  11969. @item 0, 4, cclock_flip
  11970. Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
  11971. @example
  11972. L.R L.l
  11973. . . -> . .
  11974. l.r R.r
  11975. @end example
  11976. @item 1, 5, clock
  11977. Rotate by 90 degrees clockwise, that is:
  11978. @example
  11979. L.R l.L
  11980. . . -> . .
  11981. l.r r.R
  11982. @end example
  11983. @item 2, 6, cclock
  11984. Rotate by 90 degrees counterclockwise, that is:
  11985. @example
  11986. L.R R.r
  11987. . . -> . .
  11988. l.r L.l
  11989. @end example
  11990. @item 3, 7, clock_flip
  11991. Rotate by 90 degrees clockwise and vertically flip, that is:
  11992. @example
  11993. L.R r.R
  11994. . . -> . .
  11995. l.r l.L
  11996. @end example
  11997. @end table
  11998. For values between 4-7, the transposition is only done if the input
  11999. video geometry is portrait and not landscape. These values are
  12000. deprecated, the @code{passthrough} option should be used instead.
  12001. Numerical values are deprecated, and should be dropped in favor of
  12002. symbolic constants.
  12003. @item passthrough
  12004. Do not apply the transposition if the input geometry matches the one
  12005. specified by the specified value. It accepts the following values:
  12006. @table @samp
  12007. @item none
  12008. Always apply transposition.
  12009. @item portrait
  12010. Preserve portrait geometry (when @var{height} >= @var{width}).
  12011. @item landscape
  12012. Preserve landscape geometry (when @var{width} >= @var{height}).
  12013. @end table
  12014. Default value is @code{none}.
  12015. @end table
  12016. For example to rotate by 90 degrees clockwise and preserve portrait
  12017. layout:
  12018. @example
  12019. transpose=dir=1:passthrough=portrait
  12020. @end example
  12021. The command above can also be specified as:
  12022. @example
  12023. transpose=1:portrait
  12024. @end example
  12025. @section trim
  12026. Trim the input so that the output contains one continuous subpart of the input.
  12027. It accepts the following parameters:
  12028. @table @option
  12029. @item start
  12030. Specify the time of the start of the kept section, i.e. the frame with the
  12031. timestamp @var{start} will be the first frame in the output.
  12032. @item end
  12033. Specify the time of the first frame that will be dropped, i.e. the frame
  12034. immediately preceding the one with the timestamp @var{end} will be the last
  12035. frame in the output.
  12036. @item start_pts
  12037. This is the same as @var{start}, except this option sets the start timestamp
  12038. in timebase units instead of seconds.
  12039. @item end_pts
  12040. This is the same as @var{end}, except this option sets the end timestamp
  12041. in timebase units instead of seconds.
  12042. @item duration
  12043. The maximum duration of the output in seconds.
  12044. @item start_frame
  12045. The number of the first frame that should be passed to the output.
  12046. @item end_frame
  12047. The number of the first frame that should be dropped.
  12048. @end table
  12049. @option{start}, @option{end}, and @option{duration} are expressed as time
  12050. duration specifications; see
  12051. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  12052. for the accepted syntax.
  12053. Note that the first two sets of the start/end options and the @option{duration}
  12054. option look at the frame timestamp, while the _frame variants simply count the
  12055. frames that pass through the filter. Also note that this filter does not modify
  12056. the timestamps. If you wish for the output timestamps to start at zero, insert a
  12057. setpts filter after the trim filter.
  12058. If multiple start or end options are set, this filter tries to be greedy and
  12059. keep all the frames that match at least one of the specified constraints. To keep
  12060. only the part that matches all the constraints at once, chain multiple trim
  12061. filters.
  12062. The defaults are such that all the input is kept. So it is possible to set e.g.
  12063. just the end values to keep everything before the specified time.
  12064. Examples:
  12065. @itemize
  12066. @item
  12067. Drop everything except the second minute of input:
  12068. @example
  12069. ffmpeg -i INPUT -vf trim=60:120
  12070. @end example
  12071. @item
  12072. Keep only the first second:
  12073. @example
  12074. ffmpeg -i INPUT -vf trim=duration=1
  12075. @end example
  12076. @end itemize
  12077. @section unpremultiply
  12078. Apply alpha unpremultiply effect to input video stream using first plane
  12079. of second stream as alpha.
  12080. Both streams must have same dimensions and same pixel format.
  12081. The filter accepts the following option:
  12082. @table @option
  12083. @item planes
  12084. Set which planes will be processed, unprocessed planes will be copied.
  12085. By default value 0xf, all planes will be processed.
  12086. If the format has 1 or 2 components, then luma is bit 0.
  12087. If the format has 3 or 4 components:
  12088. for RGB formats bit 0 is green, bit 1 is blue and bit 2 is red;
  12089. for YUV formats bit 0 is luma, bit 1 is chroma-U and bit 2 is chroma-V.
  12090. If present, the alpha channel is always the last bit.
  12091. @item inplace
  12092. Do not require 2nd input for processing, instead use alpha plane from input stream.
  12093. @end table
  12094. @anchor{unsharp}
  12095. @section unsharp
  12096. Sharpen or blur the input video.
  12097. It accepts the following parameters:
  12098. @table @option
  12099. @item luma_msize_x, lx
  12100. Set the luma matrix horizontal size. It must be an odd integer between
  12101. 3 and 23. The default value is 5.
  12102. @item luma_msize_y, ly
  12103. Set the luma matrix vertical size. It must be an odd integer between 3
  12104. and 23. The default value is 5.
  12105. @item luma_amount, la
  12106. Set the luma effect strength. It must be a floating point number, reasonable
  12107. values lay between -1.5 and 1.5.
  12108. Negative values will blur the input video, while positive values will
  12109. sharpen it, a value of zero will disable the effect.
  12110. Default value is 1.0.
  12111. @item chroma_msize_x, cx
  12112. Set the chroma matrix horizontal size. It must be an odd integer
  12113. between 3 and 23. The default value is 5.
  12114. @item chroma_msize_y, cy
  12115. Set the chroma matrix vertical size. It must be an odd integer
  12116. between 3 and 23. The default value is 5.
  12117. @item chroma_amount, ca
  12118. Set the chroma effect strength. It must be a floating point number, reasonable
  12119. values lay between -1.5 and 1.5.
  12120. Negative values will blur the input video, while positive values will
  12121. sharpen it, a value of zero will disable the effect.
  12122. Default value is 0.0.
  12123. @end table
  12124. All parameters are optional and default to the equivalent of the
  12125. string '5:5:1.0:5:5:0.0'.
  12126. @subsection Examples
  12127. @itemize
  12128. @item
  12129. Apply strong luma sharpen effect:
  12130. @example
  12131. unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
  12132. @end example
  12133. @item
  12134. Apply a strong blur of both luma and chroma parameters:
  12135. @example
  12136. unsharp=7:7:-2:7:7:-2
  12137. @end example
  12138. @end itemize
  12139. @section uspp
  12140. Apply ultra slow/simple postprocessing filter that compresses and decompresses
  12141. the image at several (or - in the case of @option{quality} level @code{8} - all)
  12142. shifts and average the results.
  12143. The way this differs from the behavior of spp is that uspp actually encodes &
  12144. decodes each case with libavcodec Snow, whereas spp uses a simplified intra only 8x8
  12145. DCT similar to MJPEG.
  12146. The filter accepts the following options:
  12147. @table @option
  12148. @item quality
  12149. Set quality. This option defines the number of levels for averaging. It accepts
  12150. an integer in the range 0-8. If set to @code{0}, the filter will have no
  12151. effect. A value of @code{8} means the higher quality. For each increment of
  12152. that value the speed drops by a factor of approximately 2. Default value is
  12153. @code{3}.
  12154. @item qp
  12155. Force a constant quantization parameter. If not set, the filter will use the QP
  12156. from the video stream (if available).
  12157. @end table
  12158. @section vaguedenoiser
  12159. Apply a wavelet based denoiser.
  12160. It transforms each frame from the video input into the wavelet domain,
  12161. using Cohen-Daubechies-Feauveau 9/7. Then it applies some filtering to
  12162. the obtained coefficients. It does an inverse wavelet transform after.
  12163. Due to wavelet properties, it should give a nice smoothed result, and
  12164. reduced noise, without blurring picture features.
  12165. This filter accepts the following options:
  12166. @table @option
  12167. @item threshold
  12168. The filtering strength. The higher, the more filtered the video will be.
  12169. Hard thresholding can use a higher threshold than soft thresholding
  12170. before the video looks overfiltered. Default value is 2.
  12171. @item method
  12172. The filtering method the filter will use.
  12173. It accepts the following values:
  12174. @table @samp
  12175. @item hard
  12176. All values under the threshold will be zeroed.
  12177. @item soft
  12178. All values under the threshold will be zeroed. All values above will be
  12179. reduced by the threshold.
  12180. @item garrote
  12181. Scales or nullifies coefficients - intermediary between (more) soft and
  12182. (less) hard thresholding.
  12183. @end table
  12184. Default is garrote.
  12185. @item nsteps
  12186. Number of times, the wavelet will decompose the picture. Picture can't
  12187. be decomposed beyond a particular point (typically, 8 for a 640x480
  12188. frame - as 2^9 = 512 > 480). Valid values are integers between 1 and 32. Default value is 6.
  12189. @item percent
  12190. Partial of full denoising (limited coefficients shrinking), from 0 to 100. Default value is 85.
  12191. @item planes
  12192. A list of the planes to process. By default all planes are processed.
  12193. @end table
  12194. @section vectorscope
  12195. Display 2 color component values in the two dimensional graph (which is called
  12196. a vectorscope).
  12197. This filter accepts the following options:
  12198. @table @option
  12199. @item mode, m
  12200. Set vectorscope mode.
  12201. It accepts the following values:
  12202. @table @samp
  12203. @item gray
  12204. Gray values are displayed on graph, higher brightness means more pixels have
  12205. same component color value on location in graph. This is the default mode.
  12206. @item color
  12207. Gray values are displayed on graph. Surrounding pixels values which are not
  12208. present in video frame are drawn in gradient of 2 color components which are
  12209. set by option @code{x} and @code{y}. The 3rd color component is static.
  12210. @item color2
  12211. Actual color components values present in video frame are displayed on graph.
  12212. @item color3
  12213. Similar as color2 but higher frequency of same values @code{x} and @code{y}
  12214. on graph increases value of another color component, which is luminance by
  12215. default values of @code{x} and @code{y}.
  12216. @item color4
  12217. Actual colors present in video frame are displayed on graph. If two different
  12218. colors map to same position on graph then color with higher value of component
  12219. not present in graph is picked.
  12220. @item color5
  12221. Gray values are displayed on graph. Similar to @code{color} but with 3rd color
  12222. component picked from radial gradient.
  12223. @end table
  12224. @item x
  12225. Set which color component will be represented on X-axis. Default is @code{1}.
  12226. @item y
  12227. Set which color component will be represented on Y-axis. Default is @code{2}.
  12228. @item intensity, i
  12229. Set intensity, used by modes: gray, color, color3 and color5 for increasing brightness
  12230. of color component which represents frequency of (X, Y) location in graph.
  12231. @item envelope, e
  12232. @table @samp
  12233. @item none
  12234. No envelope, this is default.
  12235. @item instant
  12236. Instant envelope, even darkest single pixel will be clearly highlighted.
  12237. @item peak
  12238. Hold maximum and minimum values presented in graph over time. This way you
  12239. can still spot out of range values without constantly looking at vectorscope.
  12240. @item peak+instant
  12241. Peak and instant envelope combined together.
  12242. @end table
  12243. @item graticule, g
  12244. Set what kind of graticule to draw.
  12245. @table @samp
  12246. @item none
  12247. @item green
  12248. @item color
  12249. @end table
  12250. @item opacity, o
  12251. Set graticule opacity.
  12252. @item flags, f
  12253. Set graticule flags.
  12254. @table @samp
  12255. @item white
  12256. Draw graticule for white point.
  12257. @item black
  12258. Draw graticule for black point.
  12259. @item name
  12260. Draw color points short names.
  12261. @end table
  12262. @item bgopacity, b
  12263. Set background opacity.
  12264. @item lthreshold, l
  12265. Set low threshold for color component not represented on X or Y axis.
  12266. Values lower than this value will be ignored. Default is 0.
  12267. Note this value is multiplied with actual max possible value one pixel component
  12268. can have. So for 8-bit input and low threshold value of 0.1 actual threshold
  12269. is 0.1 * 255 = 25.
  12270. @item hthreshold, h
  12271. Set high threshold for color component not represented on X or Y axis.
  12272. Values higher than this value will be ignored. Default is 1.
  12273. Note this value is multiplied with actual max possible value one pixel component
  12274. can have. So for 8-bit input and high threshold value of 0.9 actual threshold
  12275. is 0.9 * 255 = 230.
  12276. @item colorspace, c
  12277. Set what kind of colorspace to use when drawing graticule.
  12278. @table @samp
  12279. @item auto
  12280. @item 601
  12281. @item 709
  12282. @end table
  12283. Default is auto.
  12284. @end table
  12285. @anchor{vidstabdetect}
  12286. @section vidstabdetect
  12287. Analyze video stabilization/deshaking. Perform pass 1 of 2, see
  12288. @ref{vidstabtransform} for pass 2.
  12289. This filter generates a file with relative translation and rotation
  12290. transform information about subsequent frames, which is then used by
  12291. the @ref{vidstabtransform} filter.
  12292. To enable compilation of this filter you need to configure FFmpeg with
  12293. @code{--enable-libvidstab}.
  12294. This filter accepts the following options:
  12295. @table @option
  12296. @item result
  12297. Set the path to the file used to write the transforms information.
  12298. Default value is @file{transforms.trf}.
  12299. @item shakiness
  12300. Set how shaky the video is and how quick the camera is. It accepts an
  12301. integer in the range 1-10, a value of 1 means little shakiness, a
  12302. value of 10 means strong shakiness. Default value is 5.
  12303. @item accuracy
  12304. Set the accuracy of the detection process. It must be a value in the
  12305. range 1-15. A value of 1 means low accuracy, a value of 15 means high
  12306. accuracy. Default value is 15.
  12307. @item stepsize
  12308. Set stepsize of the search process. The region around minimum is
  12309. scanned with 1 pixel resolution. Default value is 6.
  12310. @item mincontrast
  12311. Set minimum contrast. Below this value a local measurement field is
  12312. discarded. Must be a floating point value in the range 0-1. Default
  12313. value is 0.3.
  12314. @item tripod
  12315. Set reference frame number for tripod mode.
  12316. If enabled, the motion of the frames is compared to a reference frame
  12317. in the filtered stream, identified by the specified number. The idea
  12318. is to compensate all movements in a more-or-less static scene and keep
  12319. the camera view absolutely still.
  12320. If set to 0, it is disabled. The frames are counted starting from 1.
  12321. @item show
  12322. Show fields and transforms in the resulting frames. It accepts an
  12323. integer in the range 0-2. Default value is 0, which disables any
  12324. visualization.
  12325. @end table
  12326. @subsection Examples
  12327. @itemize
  12328. @item
  12329. Use default values:
  12330. @example
  12331. vidstabdetect
  12332. @end example
  12333. @item
  12334. Analyze strongly shaky movie and put the results in file
  12335. @file{mytransforms.trf}:
  12336. @example
  12337. vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
  12338. @end example
  12339. @item
  12340. Visualize the result of internal transformations in the resulting
  12341. video:
  12342. @example
  12343. vidstabdetect=show=1
  12344. @end example
  12345. @item
  12346. Analyze a video with medium shakiness using @command{ffmpeg}:
  12347. @example
  12348. ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
  12349. @end example
  12350. @end itemize
  12351. @anchor{vidstabtransform}
  12352. @section vidstabtransform
  12353. Video stabilization/deshaking: pass 2 of 2,
  12354. see @ref{vidstabdetect} for pass 1.
  12355. Read a file with transform information for each frame and
  12356. apply/compensate them. Together with the @ref{vidstabdetect}
  12357. filter this can be used to deshake videos. See also
  12358. @url{http://public.hronopik.de/vid.stab}. It is important to also use
  12359. the @ref{unsharp} filter, see below.
  12360. To enable compilation of this filter you need to configure FFmpeg with
  12361. @code{--enable-libvidstab}.
  12362. @subsection Options
  12363. @table @option
  12364. @item input
  12365. Set path to the file used to read the transforms. Default value is
  12366. @file{transforms.trf}.
  12367. @item smoothing
  12368. Set the number of frames (value*2 + 1) used for lowpass filtering the
  12369. camera movements. Default value is 10.
  12370. For example a number of 10 means that 21 frames are used (10 in the
  12371. past and 10 in the future) to smoothen the motion in the video. A
  12372. larger value leads to a smoother video, but limits the acceleration of
  12373. the camera (pan/tilt movements). 0 is a special case where a static
  12374. camera is simulated.
  12375. @item optalgo
  12376. Set the camera path optimization algorithm.
  12377. Accepted values are:
  12378. @table @samp
  12379. @item gauss
  12380. gaussian kernel low-pass filter on camera motion (default)
  12381. @item avg
  12382. averaging on transformations
  12383. @end table
  12384. @item maxshift
  12385. Set maximal number of pixels to translate frames. Default value is -1,
  12386. meaning no limit.
  12387. @item maxangle
  12388. Set maximal angle in radians (degree*PI/180) to rotate frames. Default
  12389. value is -1, meaning no limit.
  12390. @item crop
  12391. Specify how to deal with borders that may be visible due to movement
  12392. compensation.
  12393. Available values are:
  12394. @table @samp
  12395. @item keep
  12396. keep image information from previous frame (default)
  12397. @item black
  12398. fill the border black
  12399. @end table
  12400. @item invert
  12401. Invert transforms if set to 1. Default value is 0.
  12402. @item relative
  12403. Consider transforms as relative to previous frame if set to 1,
  12404. absolute if set to 0. Default value is 0.
  12405. @item zoom
  12406. Set percentage to zoom. A positive value will result in a zoom-in
  12407. effect, a negative value in a zoom-out effect. Default value is 0 (no
  12408. zoom).
  12409. @item optzoom
  12410. Set optimal zooming to avoid borders.
  12411. Accepted values are:
  12412. @table @samp
  12413. @item 0
  12414. disabled
  12415. @item 1
  12416. optimal static zoom value is determined (only very strong movements
  12417. will lead to visible borders) (default)
  12418. @item 2
  12419. optimal adaptive zoom value is determined (no borders will be
  12420. visible), see @option{zoomspeed}
  12421. @end table
  12422. Note that the value given at zoom is added to the one calculated here.
  12423. @item zoomspeed
  12424. Set percent to zoom maximally each frame (enabled when
  12425. @option{optzoom} is set to 2). Range is from 0 to 5, default value is
  12426. 0.25.
  12427. @item interpol
  12428. Specify type of interpolation.
  12429. Available values are:
  12430. @table @samp
  12431. @item no
  12432. no interpolation
  12433. @item linear
  12434. linear only horizontal
  12435. @item bilinear
  12436. linear in both directions (default)
  12437. @item bicubic
  12438. cubic in both directions (slow)
  12439. @end table
  12440. @item tripod
  12441. Enable virtual tripod mode if set to 1, which is equivalent to
  12442. @code{relative=0:smoothing=0}. Default value is 0.
  12443. Use also @code{tripod} option of @ref{vidstabdetect}.
  12444. @item debug
  12445. Increase log verbosity if set to 1. Also the detected global motions
  12446. are written to the temporary file @file{global_motions.trf}. Default
  12447. value is 0.
  12448. @end table
  12449. @subsection Examples
  12450. @itemize
  12451. @item
  12452. Use @command{ffmpeg} for a typical stabilization with default values:
  12453. @example
  12454. ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
  12455. @end example
  12456. Note the use of the @ref{unsharp} filter which is always recommended.
  12457. @item
  12458. Zoom in a bit more and load transform data from a given file:
  12459. @example
  12460. vidstabtransform=zoom=5:input="mytransforms.trf"
  12461. @end example
  12462. @item
  12463. Smoothen the video even more:
  12464. @example
  12465. vidstabtransform=smoothing=30
  12466. @end example
  12467. @end itemize
  12468. @section vflip
  12469. Flip the input video vertically.
  12470. For example, to vertically flip a video with @command{ffmpeg}:
  12471. @example
  12472. ffmpeg -i in.avi -vf "vflip" out.avi
  12473. @end example
  12474. @section vfrdet
  12475. Detect variable frame rate video.
  12476. This filter tries to detect if the input is variable or constant frame rate.
  12477. At end it will output number of frames detected as having variable delta pts,
  12478. and ones with constant delta pts.
  12479. If there was frames with variable delta, than it will also show min and max delta
  12480. encountered.
  12481. @anchor{vignette}
  12482. @section vignette
  12483. Make or reverse a natural vignetting effect.
  12484. The filter accepts the following options:
  12485. @table @option
  12486. @item angle, a
  12487. Set lens angle expression as a number of radians.
  12488. The value is clipped in the @code{[0,PI/2]} range.
  12489. Default value: @code{"PI/5"}
  12490. @item x0
  12491. @item y0
  12492. Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
  12493. by default.
  12494. @item mode
  12495. Set forward/backward mode.
  12496. Available modes are:
  12497. @table @samp
  12498. @item forward
  12499. The larger the distance from the central point, the darker the image becomes.
  12500. @item backward
  12501. The larger the distance from the central point, the brighter the image becomes.
  12502. This can be used to reverse a vignette effect, though there is no automatic
  12503. detection to extract the lens @option{angle} and other settings (yet). It can
  12504. also be used to create a burning effect.
  12505. @end table
  12506. Default value is @samp{forward}.
  12507. @item eval
  12508. Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
  12509. It accepts the following values:
  12510. @table @samp
  12511. @item init
  12512. Evaluate expressions only once during the filter initialization.
  12513. @item frame
  12514. Evaluate expressions for each incoming frame. This is way slower than the
  12515. @samp{init} mode since it requires all the scalers to be re-computed, but it
  12516. allows advanced dynamic expressions.
  12517. @end table
  12518. Default value is @samp{init}.
  12519. @item dither
  12520. Set dithering to reduce the circular banding effects. Default is @code{1}
  12521. (enabled).
  12522. @item aspect
  12523. Set vignette aspect. This setting allows one to adjust the shape of the vignette.
  12524. Setting this value to the SAR of the input will make a rectangular vignetting
  12525. following the dimensions of the video.
  12526. Default is @code{1/1}.
  12527. @end table
  12528. @subsection Expressions
  12529. The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
  12530. following parameters.
  12531. @table @option
  12532. @item w
  12533. @item h
  12534. input width and height
  12535. @item n
  12536. the number of input frame, starting from 0
  12537. @item pts
  12538. the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
  12539. @var{TB} units, NAN if undefined
  12540. @item r
  12541. frame rate of the input video, NAN if the input frame rate is unknown
  12542. @item t
  12543. the PTS (Presentation TimeStamp) of the filtered video frame,
  12544. expressed in seconds, NAN if undefined
  12545. @item tb
  12546. time base of the input video
  12547. @end table
  12548. @subsection Examples
  12549. @itemize
  12550. @item
  12551. Apply simple strong vignetting effect:
  12552. @example
  12553. vignette=PI/4
  12554. @end example
  12555. @item
  12556. Make a flickering vignetting:
  12557. @example
  12558. vignette='PI/4+random(1)*PI/50':eval=frame
  12559. @end example
  12560. @end itemize
  12561. @section vmafmotion
  12562. Obtain the average vmaf motion score of a video.
  12563. It is one of the component filters of VMAF.
  12564. The obtained average motion score is printed through the logging system.
  12565. In the below example the input file @file{ref.mpg} is being processed and score
  12566. is computed.
  12567. @example
  12568. ffmpeg -i ref.mpg -lavfi vmafmotion -f null -
  12569. @end example
  12570. @section vstack
  12571. Stack input videos vertically.
  12572. All streams must be of same pixel format and of same width.
  12573. Note that this filter is faster than using @ref{overlay} and @ref{pad} filter
  12574. to create same output.
  12575. The filter accept the following option:
  12576. @table @option
  12577. @item inputs
  12578. Set number of input streams. Default is 2.
  12579. @item shortest
  12580. If set to 1, force the output to terminate when the shortest input
  12581. terminates. Default value is 0.
  12582. @end table
  12583. @section w3fdif
  12584. Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
  12585. Deinterlacing Filter").
  12586. Based on the process described by Martin Weston for BBC R&D, and
  12587. implemented based on the de-interlace algorithm written by Jim
  12588. Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
  12589. uses filter coefficients calculated by BBC R&D.
  12590. There are two sets of filter coefficients, so called "simple":
  12591. and "complex". Which set of filter coefficients is used can
  12592. be set by passing an optional parameter:
  12593. @table @option
  12594. @item filter
  12595. Set the interlacing filter coefficients. Accepts one of the following values:
  12596. @table @samp
  12597. @item simple
  12598. Simple filter coefficient set.
  12599. @item complex
  12600. More-complex filter coefficient set.
  12601. @end table
  12602. Default value is @samp{complex}.
  12603. @item deint
  12604. Specify which frames to deinterlace. Accept one of the following values:
  12605. @table @samp
  12606. @item all
  12607. Deinterlace all frames,
  12608. @item interlaced
  12609. Only deinterlace frames marked as interlaced.
  12610. @end table
  12611. Default value is @samp{all}.
  12612. @end table
  12613. @section waveform
  12614. Video waveform monitor.
  12615. The waveform monitor plots color component intensity. By default luminance
  12616. only. Each column of the waveform corresponds to a column of pixels in the
  12617. source video.
  12618. It accepts the following options:
  12619. @table @option
  12620. @item mode, m
  12621. Can be either @code{row}, or @code{column}. Default is @code{column}.
  12622. In row mode, the graph on the left side represents color component value 0 and
  12623. the right side represents value = 255. In column mode, the top side represents
  12624. color component value = 0 and bottom side represents value = 255.
  12625. @item intensity, i
  12626. Set intensity. Smaller values are useful to find out how many values of the same
  12627. luminance are distributed across input rows/columns.
  12628. Default value is @code{0.04}. Allowed range is [0, 1].
  12629. @item mirror, r
  12630. Set mirroring mode. @code{0} means unmirrored, @code{1} means mirrored.
  12631. In mirrored mode, higher values will be represented on the left
  12632. side for @code{row} mode and at the top for @code{column} mode. Default is
  12633. @code{1} (mirrored).
  12634. @item display, d
  12635. Set display mode.
  12636. It accepts the following values:
  12637. @table @samp
  12638. @item overlay
  12639. Presents information identical to that in the @code{parade}, except
  12640. that the graphs representing color components are superimposed directly
  12641. over one another.
  12642. This display mode makes it easier to spot relative differences or similarities
  12643. in overlapping areas of the color components that are supposed to be identical,
  12644. such as neutral whites, grays, or blacks.
  12645. @item stack
  12646. Display separate graph for the color components side by side in
  12647. @code{row} mode or one below the other in @code{column} mode.
  12648. @item parade
  12649. Display separate graph for the color components side by side in
  12650. @code{column} mode or one below the other in @code{row} mode.
  12651. Using this display mode makes it easy to spot color casts in the highlights
  12652. and shadows of an image, by comparing the contours of the top and the bottom
  12653. graphs of each waveform. Since whites, grays, and blacks are characterized
  12654. by exactly equal amounts of red, green, and blue, neutral areas of the picture
  12655. should display three waveforms of roughly equal width/height. If not, the
  12656. correction is easy to perform by making level adjustments the three waveforms.
  12657. @end table
  12658. Default is @code{stack}.
  12659. @item components, c
  12660. Set which color components to display. Default is 1, which means only luminance
  12661. or red color component if input is in RGB colorspace. If is set for example to
  12662. 7 it will display all 3 (if) available color components.
  12663. @item envelope, e
  12664. @table @samp
  12665. @item none
  12666. No envelope, this is default.
  12667. @item instant
  12668. Instant envelope, minimum and maximum values presented in graph will be easily
  12669. visible even with small @code{step} value.
  12670. @item peak
  12671. Hold minimum and maximum values presented in graph across time. This way you
  12672. can still spot out of range values without constantly looking at waveforms.
  12673. @item peak+instant
  12674. Peak and instant envelope combined together.
  12675. @end table
  12676. @item filter, f
  12677. @table @samp
  12678. @item lowpass
  12679. No filtering, this is default.
  12680. @item flat
  12681. Luma and chroma combined together.
  12682. @item aflat
  12683. Similar as above, but shows difference between blue and red chroma.
  12684. @item xflat
  12685. Similar as above, but use different colors.
  12686. @item chroma
  12687. Displays only chroma.
  12688. @item color
  12689. Displays actual color value on waveform.
  12690. @item acolor
  12691. Similar as above, but with luma showing frequency of chroma values.
  12692. @end table
  12693. @item graticule, g
  12694. Set which graticule to display.
  12695. @table @samp
  12696. @item none
  12697. Do not display graticule.
  12698. @item green
  12699. Display green graticule showing legal broadcast ranges.
  12700. @item orange
  12701. Display orange graticule showing legal broadcast ranges.
  12702. @end table
  12703. @item opacity, o
  12704. Set graticule opacity.
  12705. @item flags, fl
  12706. Set graticule flags.
  12707. @table @samp
  12708. @item numbers
  12709. Draw numbers above lines. By default enabled.
  12710. @item dots
  12711. Draw dots instead of lines.
  12712. @end table
  12713. @item scale, s
  12714. Set scale used for displaying graticule.
  12715. @table @samp
  12716. @item digital
  12717. @item millivolts
  12718. @item ire
  12719. @end table
  12720. Default is digital.
  12721. @item bgopacity, b
  12722. Set background opacity.
  12723. @end table
  12724. @section weave, doubleweave
  12725. The @code{weave} takes a field-based video input and join
  12726. each two sequential fields into single frame, producing a new double
  12727. height clip with half the frame rate and half the frame count.
  12728. The @code{doubleweave} works same as @code{weave} but without
  12729. halving frame rate and frame count.
  12730. It accepts the following option:
  12731. @table @option
  12732. @item first_field
  12733. Set first field. Available values are:
  12734. @table @samp
  12735. @item top, t
  12736. Set the frame as top-field-first.
  12737. @item bottom, b
  12738. Set the frame as bottom-field-first.
  12739. @end table
  12740. @end table
  12741. @subsection Examples
  12742. @itemize
  12743. @item
  12744. Interlace video using @ref{select} and @ref{separatefields} filter:
  12745. @example
  12746. separatefields,select=eq(mod(n,4),0)+eq(mod(n,4),3),weave
  12747. @end example
  12748. @end itemize
  12749. @section xbr
  12750. Apply the xBR high-quality magnification filter which is designed for pixel
  12751. art. It follows a set of edge-detection rules, see
  12752. @url{http://www.libretro.com/forums/viewtopic.php?f=6&t=134}.
  12753. It accepts the following option:
  12754. @table @option
  12755. @item n
  12756. Set the scaling dimension: @code{2} for @code{2xBR}, @code{3} for
  12757. @code{3xBR} and @code{4} for @code{4xBR}.
  12758. Default is @code{3}.
  12759. @end table
  12760. @anchor{yadif}
  12761. @section yadif
  12762. Deinterlace the input video ("yadif" means "yet another deinterlacing
  12763. filter").
  12764. It accepts the following parameters:
  12765. @table @option
  12766. @item mode
  12767. The interlacing mode to adopt. It accepts one of the following values:
  12768. @table @option
  12769. @item 0, send_frame
  12770. Output one frame for each frame.
  12771. @item 1, send_field
  12772. Output one frame for each field.
  12773. @item 2, send_frame_nospatial
  12774. Like @code{send_frame}, but it skips the spatial interlacing check.
  12775. @item 3, send_field_nospatial
  12776. Like @code{send_field}, but it skips the spatial interlacing check.
  12777. @end table
  12778. The default value is @code{send_frame}.
  12779. @item parity
  12780. The picture field parity assumed for the input interlaced video. It accepts one
  12781. of the following values:
  12782. @table @option
  12783. @item 0, tff
  12784. Assume the top field is first.
  12785. @item 1, bff
  12786. Assume the bottom field is first.
  12787. @item -1, auto
  12788. Enable automatic detection of field parity.
  12789. @end table
  12790. The default value is @code{auto}.
  12791. If the interlacing is unknown or the decoder does not export this information,
  12792. top field first will be assumed.
  12793. @item deint
  12794. Specify which frames to deinterlace. Accept one of the following
  12795. values:
  12796. @table @option
  12797. @item 0, all
  12798. Deinterlace all frames.
  12799. @item 1, interlaced
  12800. Only deinterlace frames marked as interlaced.
  12801. @end table
  12802. The default value is @code{all}.
  12803. @end table
  12804. @section zoompan
  12805. Apply Zoom & Pan effect.
  12806. This filter accepts the following options:
  12807. @table @option
  12808. @item zoom, z
  12809. Set the zoom expression. Default is 1.
  12810. @item x
  12811. @item y
  12812. Set the x and y expression. Default is 0.
  12813. @item d
  12814. Set the duration expression in number of frames.
  12815. This sets for how many number of frames effect will last for
  12816. single input image.
  12817. @item s
  12818. Set the output image size, default is 'hd720'.
  12819. @item fps
  12820. Set the output frame rate, default is '25'.
  12821. @end table
  12822. Each expression can contain the following constants:
  12823. @table @option
  12824. @item in_w, iw
  12825. Input width.
  12826. @item in_h, ih
  12827. Input height.
  12828. @item out_w, ow
  12829. Output width.
  12830. @item out_h, oh
  12831. Output height.
  12832. @item in
  12833. Input frame count.
  12834. @item on
  12835. Output frame count.
  12836. @item x
  12837. @item y
  12838. Last calculated 'x' and 'y' position from 'x' and 'y' expression
  12839. for current input frame.
  12840. @item px
  12841. @item py
  12842. 'x' and 'y' of last output frame of previous input frame or 0 when there was
  12843. not yet such frame (first input frame).
  12844. @item zoom
  12845. Last calculated zoom from 'z' expression for current input frame.
  12846. @item pzoom
  12847. Last calculated zoom of last output frame of previous input frame.
  12848. @item duration
  12849. Number of output frames for current input frame. Calculated from 'd' expression
  12850. for each input frame.
  12851. @item pduration
  12852. number of output frames created for previous input frame
  12853. @item a
  12854. Rational number: input width / input height
  12855. @item sar
  12856. sample aspect ratio
  12857. @item dar
  12858. display aspect ratio
  12859. @end table
  12860. @subsection Examples
  12861. @itemize
  12862. @item
  12863. Zoom-in up to 1.5 and pan at same time to some spot near center of picture:
  12864. @example
  12865. 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
  12866. @end example
  12867. @item
  12868. Zoom-in up to 1.5 and pan always at center of picture:
  12869. @example
  12870. zoompan=z='min(zoom+0.0015,1.5)':d=700:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12871. @end example
  12872. @item
  12873. Same as above but without pausing:
  12874. @example
  12875. zoompan=z='min(max(zoom,pzoom)+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'
  12876. @end example
  12877. @end itemize
  12878. @anchor{zscale}
  12879. @section zscale
  12880. Scale (resize) the input video, using the z.lib library:
  12881. https://github.com/sekrit-twc/zimg.
  12882. The zscale filter forces the output display aspect ratio to be the same
  12883. as the input, by changing the output sample aspect ratio.
  12884. If the input image format is different from the format requested by
  12885. the next filter, the zscale filter will convert the input to the
  12886. requested format.
  12887. @subsection Options
  12888. The filter accepts the following options.
  12889. @table @option
  12890. @item width, w
  12891. @item height, h
  12892. Set the output video dimension expression. Default value is the input
  12893. dimension.
  12894. If the @var{width} or @var{w} value is 0, the input width is used for
  12895. the output. If the @var{height} or @var{h} value is 0, the input height
  12896. is used for the output.
  12897. If one and only one of the values is -n with n >= 1, the zscale filter
  12898. will use a value that maintains the aspect ratio of the input image,
  12899. calculated from the other specified dimension. After that it will,
  12900. however, make sure that the calculated dimension is divisible by n and
  12901. adjust the value if necessary.
  12902. If both values are -n with n >= 1, the behavior will be identical to
  12903. both values being set to 0 as previously detailed.
  12904. See below for the list of accepted constants for use in the dimension
  12905. expression.
  12906. @item size, s
  12907. Set the video size. For the syntax of this option, check the
  12908. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  12909. @item dither, d
  12910. Set the dither type.
  12911. Possible values are:
  12912. @table @var
  12913. @item none
  12914. @item ordered
  12915. @item random
  12916. @item error_diffusion
  12917. @end table
  12918. Default is none.
  12919. @item filter, f
  12920. Set the resize filter type.
  12921. Possible values are:
  12922. @table @var
  12923. @item point
  12924. @item bilinear
  12925. @item bicubic
  12926. @item spline16
  12927. @item spline36
  12928. @item lanczos
  12929. @end table
  12930. Default is bilinear.
  12931. @item range, r
  12932. Set the color range.
  12933. Possible values are:
  12934. @table @var
  12935. @item input
  12936. @item limited
  12937. @item full
  12938. @end table
  12939. Default is same as input.
  12940. @item primaries, p
  12941. Set the color primaries.
  12942. Possible values are:
  12943. @table @var
  12944. @item input
  12945. @item 709
  12946. @item unspecified
  12947. @item 170m
  12948. @item 240m
  12949. @item 2020
  12950. @end table
  12951. Default is same as input.
  12952. @item transfer, t
  12953. Set the transfer characteristics.
  12954. Possible values are:
  12955. @table @var
  12956. @item input
  12957. @item 709
  12958. @item unspecified
  12959. @item 601
  12960. @item linear
  12961. @item 2020_10
  12962. @item 2020_12
  12963. @item smpte2084
  12964. @item iec61966-2-1
  12965. @item arib-std-b67
  12966. @end table
  12967. Default is same as input.
  12968. @item matrix, m
  12969. Set the colorspace matrix.
  12970. Possible value are:
  12971. @table @var
  12972. @item input
  12973. @item 709
  12974. @item unspecified
  12975. @item 470bg
  12976. @item 170m
  12977. @item 2020_ncl
  12978. @item 2020_cl
  12979. @end table
  12980. Default is same as input.
  12981. @item rangein, rin
  12982. Set the input color range.
  12983. Possible values are:
  12984. @table @var
  12985. @item input
  12986. @item limited
  12987. @item full
  12988. @end table
  12989. Default is same as input.
  12990. @item primariesin, pin
  12991. Set the input color primaries.
  12992. Possible values are:
  12993. @table @var
  12994. @item input
  12995. @item 709
  12996. @item unspecified
  12997. @item 170m
  12998. @item 240m
  12999. @item 2020
  13000. @end table
  13001. Default is same as input.
  13002. @item transferin, tin
  13003. Set the input transfer characteristics.
  13004. Possible values are:
  13005. @table @var
  13006. @item input
  13007. @item 709
  13008. @item unspecified
  13009. @item 601
  13010. @item linear
  13011. @item 2020_10
  13012. @item 2020_12
  13013. @end table
  13014. Default is same as input.
  13015. @item matrixin, min
  13016. Set the input colorspace matrix.
  13017. Possible value are:
  13018. @table @var
  13019. @item input
  13020. @item 709
  13021. @item unspecified
  13022. @item 470bg
  13023. @item 170m
  13024. @item 2020_ncl
  13025. @item 2020_cl
  13026. @end table
  13027. @item chromal, c
  13028. Set the output chroma location.
  13029. Possible values are:
  13030. @table @var
  13031. @item input
  13032. @item left
  13033. @item center
  13034. @item topleft
  13035. @item top
  13036. @item bottomleft
  13037. @item bottom
  13038. @end table
  13039. @item chromalin, cin
  13040. Set the input chroma location.
  13041. Possible values are:
  13042. @table @var
  13043. @item input
  13044. @item left
  13045. @item center
  13046. @item topleft
  13047. @item top
  13048. @item bottomleft
  13049. @item bottom
  13050. @end table
  13051. @item npl
  13052. Set the nominal peak luminance.
  13053. @end table
  13054. The values of the @option{w} and @option{h} options are expressions
  13055. containing the following constants:
  13056. @table @var
  13057. @item in_w
  13058. @item in_h
  13059. The input width and height
  13060. @item iw
  13061. @item ih
  13062. These are the same as @var{in_w} and @var{in_h}.
  13063. @item out_w
  13064. @item out_h
  13065. The output (scaled) width and height
  13066. @item ow
  13067. @item oh
  13068. These are the same as @var{out_w} and @var{out_h}
  13069. @item a
  13070. The same as @var{iw} / @var{ih}
  13071. @item sar
  13072. input sample aspect ratio
  13073. @item dar
  13074. The input display aspect ratio. Calculated from @code{(iw / ih) * sar}.
  13075. @item hsub
  13076. @item vsub
  13077. horizontal and vertical input chroma subsample values. For example for the
  13078. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13079. @item ohsub
  13080. @item ovsub
  13081. horizontal and vertical output chroma subsample values. For example for the
  13082. pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
  13083. @end table
  13084. @table @option
  13085. @end table
  13086. @c man end VIDEO FILTERS
  13087. @chapter Video Sources
  13088. @c man begin VIDEO SOURCES
  13089. Below is a description of the currently available video sources.
  13090. @section buffer
  13091. Buffer video frames, and make them available to the filter chain.
  13092. This source is mainly intended for a programmatic use, in particular
  13093. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  13094. It accepts the following parameters:
  13095. @table @option
  13096. @item video_size
  13097. Specify the size (width and height) of the buffered video frames. For the
  13098. syntax of this option, check the
  13099. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13100. @item width
  13101. The input video width.
  13102. @item height
  13103. The input video height.
  13104. @item pix_fmt
  13105. A string representing the pixel format of the buffered video frames.
  13106. It may be a number corresponding to a pixel format, or a pixel format
  13107. name.
  13108. @item time_base
  13109. Specify the timebase assumed by the timestamps of the buffered frames.
  13110. @item frame_rate
  13111. Specify the frame rate expected for the video stream.
  13112. @item pixel_aspect, sar
  13113. The sample (pixel) aspect ratio of the input video.
  13114. @item sws_param
  13115. Specify the optional parameters to be used for the scale filter which
  13116. is automatically inserted when an input change is detected in the
  13117. input size or format.
  13118. @item hw_frames_ctx
  13119. When using a hardware pixel format, this should be a reference to an
  13120. AVHWFramesContext describing input frames.
  13121. @end table
  13122. For example:
  13123. @example
  13124. buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
  13125. @end example
  13126. will instruct the source to accept video frames with size 320x240 and
  13127. with format "yuv410p", assuming 1/24 as the timestamps timebase and
  13128. square pixels (1:1 sample aspect ratio).
  13129. Since the pixel format with name "yuv410p" corresponds to the number 6
  13130. (check the enum AVPixelFormat definition in @file{libavutil/pixfmt.h}),
  13131. this example corresponds to:
  13132. @example
  13133. buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
  13134. @end example
  13135. Alternatively, the options can be specified as a flat string, but this
  13136. syntax is deprecated:
  13137. @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}]
  13138. @section cellauto
  13139. Create a pattern generated by an elementary cellular automaton.
  13140. The initial state of the cellular automaton can be defined through the
  13141. @option{filename} and @option{pattern} options. If such options are
  13142. not specified an initial state is created randomly.
  13143. At each new frame a new row in the video is filled with the result of
  13144. the cellular automaton next generation. The behavior when the whole
  13145. frame is filled is defined by the @option{scroll} option.
  13146. This source accepts the following options:
  13147. @table @option
  13148. @item filename, f
  13149. Read the initial cellular automaton state, i.e. the starting row, from
  13150. the specified file.
  13151. In the file, each non-whitespace character is considered an alive
  13152. cell, a newline will terminate the row, and further characters in the
  13153. file will be ignored.
  13154. @item pattern, p
  13155. Read the initial cellular automaton state, i.e. the starting row, from
  13156. the specified string.
  13157. Each non-whitespace character in the string is considered an alive
  13158. cell, a newline will terminate the row, and further characters in the
  13159. string will be ignored.
  13160. @item rate, r
  13161. Set the video rate, that is the number of frames generated per second.
  13162. Default is 25.
  13163. @item random_fill_ratio, ratio
  13164. Set the random fill ratio for the initial cellular automaton row. It
  13165. is a floating point number value ranging from 0 to 1, defaults to
  13166. 1/PHI.
  13167. This option is ignored when a file or a pattern is specified.
  13168. @item random_seed, seed
  13169. Set the seed for filling randomly the initial row, must be an integer
  13170. included between 0 and UINT32_MAX. If not specified, or if explicitly
  13171. set to -1, the filter will try to use a good random seed on a best
  13172. effort basis.
  13173. @item rule
  13174. Set the cellular automaton rule, it is a number ranging from 0 to 255.
  13175. Default value is 110.
  13176. @item size, s
  13177. Set the size of the output video. For the syntax of this option, check the
  13178. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13179. If @option{filename} or @option{pattern} is specified, the size is set
  13180. by default to the width of the specified initial state row, and the
  13181. height is set to @var{width} * PHI.
  13182. If @option{size} is set, it must contain the width of the specified
  13183. pattern string, and the specified pattern will be centered in the
  13184. larger row.
  13185. If a filename or a pattern string is not specified, the size value
  13186. defaults to "320x518" (used for a randomly generated initial state).
  13187. @item scroll
  13188. If set to 1, scroll the output upward when all the rows in the output
  13189. have been already filled. If set to 0, the new generated row will be
  13190. written over the top row just after the bottom row is filled.
  13191. Defaults to 1.
  13192. @item start_full, full
  13193. If set to 1, completely fill the output with generated rows before
  13194. outputting the first frame.
  13195. This is the default behavior, for disabling set the value to 0.
  13196. @item stitch
  13197. If set to 1, stitch the left and right row edges together.
  13198. This is the default behavior, for disabling set the value to 0.
  13199. @end table
  13200. @subsection Examples
  13201. @itemize
  13202. @item
  13203. Read the initial state from @file{pattern}, and specify an output of
  13204. size 200x400.
  13205. @example
  13206. cellauto=f=pattern:s=200x400
  13207. @end example
  13208. @item
  13209. Generate a random initial row with a width of 200 cells, with a fill
  13210. ratio of 2/3:
  13211. @example
  13212. cellauto=ratio=2/3:s=200x200
  13213. @end example
  13214. @item
  13215. Create a pattern generated by rule 18 starting by a single alive cell
  13216. centered on an initial row with width 100:
  13217. @example
  13218. cellauto=p=@@:s=100x400:full=0:rule=18
  13219. @end example
  13220. @item
  13221. Specify a more elaborated initial pattern:
  13222. @example
  13223. cellauto=p='@@@@ @@ @@@@':s=100x400:full=0:rule=18
  13224. @end example
  13225. @end itemize
  13226. @anchor{coreimagesrc}
  13227. @section coreimagesrc
  13228. Video source generated on GPU using Apple's CoreImage API on OSX.
  13229. This video source is a specialized version of the @ref{coreimage} video filter.
  13230. Use a core image generator at the beginning of the applied filterchain to
  13231. generate the content.
  13232. The coreimagesrc video source accepts the following options:
  13233. @table @option
  13234. @item list_generators
  13235. List all available generators along with all their respective options as well as
  13236. possible minimum and maximum values along with the default values.
  13237. @example
  13238. list_generators=true
  13239. @end example
  13240. @item size, s
  13241. Specify the size of the sourced video. For the syntax of this option, check the
  13242. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13243. The default value is @code{320x240}.
  13244. @item rate, r
  13245. Specify the frame rate of the sourced video, as the number of frames
  13246. generated per second. It has to be a string in the format
  13247. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13248. number or a valid video frame rate abbreviation. The default value is
  13249. "25".
  13250. @item sar
  13251. Set the sample aspect ratio of the sourced video.
  13252. @item duration, d
  13253. Set the duration of the sourced video. See
  13254. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13255. for the accepted syntax.
  13256. If not specified, or the expressed duration is negative, the video is
  13257. supposed to be generated forever.
  13258. @end table
  13259. Additionally, all options of the @ref{coreimage} video filter are accepted.
  13260. A complete filterchain can be used for further processing of the
  13261. generated input without CPU-HOST transfer. See @ref{coreimage} documentation
  13262. and examples for details.
  13263. @subsection Examples
  13264. @itemize
  13265. @item
  13266. Use CIQRCodeGenerator to create a QR code for the FFmpeg homepage,
  13267. given as complete and escaped command-line for Apple's standard bash shell:
  13268. @example
  13269. ffmpeg -f lavfi -i coreimagesrc=s=100x100:filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
  13270. @end example
  13271. This example is equivalent to the QRCode example of @ref{coreimage} without the
  13272. need for a nullsrc video source.
  13273. @end itemize
  13274. @section mandelbrot
  13275. Generate a Mandelbrot set fractal, and progressively zoom towards the
  13276. point specified with @var{start_x} and @var{start_y}.
  13277. This source accepts the following options:
  13278. @table @option
  13279. @item end_pts
  13280. Set the terminal pts value. Default value is 400.
  13281. @item end_scale
  13282. Set the terminal scale value.
  13283. Must be a floating point value. Default value is 0.3.
  13284. @item inner
  13285. Set the inner coloring mode, that is the algorithm used to draw the
  13286. Mandelbrot fractal internal region.
  13287. It shall assume one of the following values:
  13288. @table @option
  13289. @item black
  13290. Set black mode.
  13291. @item convergence
  13292. Show time until convergence.
  13293. @item mincol
  13294. Set color based on point closest to the origin of the iterations.
  13295. @item period
  13296. Set period mode.
  13297. @end table
  13298. Default value is @var{mincol}.
  13299. @item bailout
  13300. Set the bailout value. Default value is 10.0.
  13301. @item maxiter
  13302. Set the maximum of iterations performed by the rendering
  13303. algorithm. Default value is 7189.
  13304. @item outer
  13305. Set outer coloring mode.
  13306. It shall assume one of following values:
  13307. @table @option
  13308. @item iteration_count
  13309. Set iteration cound mode.
  13310. @item normalized_iteration_count
  13311. set normalized iteration count mode.
  13312. @end table
  13313. Default value is @var{normalized_iteration_count}.
  13314. @item rate, r
  13315. Set frame rate, expressed as number of frames per second. Default
  13316. value is "25".
  13317. @item size, s
  13318. Set frame size. For the syntax of this option, check the @ref{video size syntax,,"Video
  13319. size" section in the ffmpeg-utils manual,ffmpeg-utils}. Default value is "640x480".
  13320. @item start_scale
  13321. Set the initial scale value. Default value is 3.0.
  13322. @item start_x
  13323. Set the initial x position. Must be a floating point value between
  13324. -100 and 100. Default value is -0.743643887037158704752191506114774.
  13325. @item start_y
  13326. Set the initial y position. Must be a floating point value between
  13327. -100 and 100. Default value is -0.131825904205311970493132056385139.
  13328. @end table
  13329. @section mptestsrc
  13330. Generate various test patterns, as generated by the MPlayer test filter.
  13331. The size of the generated video is fixed, and is 256x256.
  13332. This source is useful in particular for testing encoding features.
  13333. This source accepts the following options:
  13334. @table @option
  13335. @item rate, r
  13336. Specify the frame rate of the sourced video, as the number of frames
  13337. generated per second. It has to be a string in the format
  13338. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13339. number or a valid video frame rate abbreviation. The default value is
  13340. "25".
  13341. @item duration, d
  13342. Set the duration of the sourced video. See
  13343. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13344. for the accepted syntax.
  13345. If not specified, or the expressed duration is negative, the video is
  13346. supposed to be generated forever.
  13347. @item test, t
  13348. Set the number or the name of the test to perform. Supported tests are:
  13349. @table @option
  13350. @item dc_luma
  13351. @item dc_chroma
  13352. @item freq_luma
  13353. @item freq_chroma
  13354. @item amp_luma
  13355. @item amp_chroma
  13356. @item cbp
  13357. @item mv
  13358. @item ring1
  13359. @item ring2
  13360. @item all
  13361. @end table
  13362. Default value is "all", which will cycle through the list of all tests.
  13363. @end table
  13364. Some examples:
  13365. @example
  13366. mptestsrc=t=dc_luma
  13367. @end example
  13368. will generate a "dc_luma" test pattern.
  13369. @section frei0r_src
  13370. Provide a frei0r source.
  13371. To enable compilation of this filter you need to install the frei0r
  13372. header and configure FFmpeg with @code{--enable-frei0r}.
  13373. This source accepts the following parameters:
  13374. @table @option
  13375. @item size
  13376. The size of the video to generate. For the syntax of this option, check the
  13377. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13378. @item framerate
  13379. The framerate of the generated video. It may be a string of the form
  13380. @var{num}/@var{den} or a frame rate abbreviation.
  13381. @item filter_name
  13382. The name to the frei0r source to load. For more information regarding frei0r and
  13383. how to set the parameters, read the @ref{frei0r} section in the video filters
  13384. documentation.
  13385. @item filter_params
  13386. A '|'-separated list of parameters to pass to the frei0r source.
  13387. @end table
  13388. For example, to generate a frei0r partik0l source with size 200x200
  13389. and frame rate 10 which is overlaid on the overlay filter main input:
  13390. @example
  13391. frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
  13392. @end example
  13393. @section life
  13394. Generate a life pattern.
  13395. This source is based on a generalization of John Conway's life game.
  13396. The sourced input represents a life grid, each pixel represents a cell
  13397. which can be in one of two possible states, alive or dead. Every cell
  13398. interacts with its eight neighbours, which are the cells that are
  13399. horizontally, vertically, or diagonally adjacent.
  13400. At each interaction the grid evolves according to the adopted rule,
  13401. which specifies the number of neighbor alive cells which will make a
  13402. cell stay alive or born. The @option{rule} option allows one to specify
  13403. the rule to adopt.
  13404. This source accepts the following options:
  13405. @table @option
  13406. @item filename, f
  13407. Set the file from which to read the initial grid state. In the file,
  13408. each non-whitespace character is considered an alive cell, and newline
  13409. is used to delimit the end of each row.
  13410. If this option is not specified, the initial grid is generated
  13411. randomly.
  13412. @item rate, r
  13413. Set the video rate, that is the number of frames generated per second.
  13414. Default is 25.
  13415. @item random_fill_ratio, ratio
  13416. Set the random fill ratio for the initial random grid. It is a
  13417. floating point number value ranging from 0 to 1, defaults to 1/PHI.
  13418. It is ignored when a file is specified.
  13419. @item random_seed, seed
  13420. Set the seed for filling the initial random grid, must be an integer
  13421. included between 0 and UINT32_MAX. If not specified, or if explicitly
  13422. set to -1, the filter will try to use a good random seed on a best
  13423. effort basis.
  13424. @item rule
  13425. Set the life rule.
  13426. A rule can be specified with a code of the kind "S@var{NS}/B@var{NB}",
  13427. where @var{NS} and @var{NB} are sequences of numbers in the range 0-8,
  13428. @var{NS} specifies the number of alive neighbor cells which make a
  13429. live cell stay alive, and @var{NB} the number of alive neighbor cells
  13430. which make a dead cell to become alive (i.e. to "born").
  13431. "s" and "b" can be used in place of "S" and "B", respectively.
  13432. Alternatively a rule can be specified by an 18-bits integer. The 9
  13433. high order bits are used to encode the next cell state if it is alive
  13434. for each number of neighbor alive cells, the low order bits specify
  13435. the rule for "borning" new cells. Higher order bits encode for an
  13436. higher number of neighbor cells.
  13437. For example the number 6153 = @code{(12<<9)+9} specifies a stay alive
  13438. rule of 12 and a born rule of 9, which corresponds to "S23/B03".
  13439. Default value is "S23/B3", which is the original Conway's game of life
  13440. rule, and will keep a cell alive if it has 2 or 3 neighbor alive
  13441. cells, and will born a new cell if there are three alive cells around
  13442. a dead cell.
  13443. @item size, s
  13444. Set the size of the output video. For the syntax of this option, check the
  13445. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13446. If @option{filename} is specified, the size is set by default to the
  13447. same size of the input file. If @option{size} is set, it must contain
  13448. the size specified in the input file, and the initial grid defined in
  13449. that file is centered in the larger resulting area.
  13450. If a filename is not specified, the size value defaults to "320x240"
  13451. (used for a randomly generated initial grid).
  13452. @item stitch
  13453. If set to 1, stitch the left and right grid edges together, and the
  13454. top and bottom edges also. Defaults to 1.
  13455. @item mold
  13456. Set cell mold speed. If set, a dead cell will go from @option{death_color} to
  13457. @option{mold_color} with a step of @option{mold}. @option{mold} can have a
  13458. value from 0 to 255.
  13459. @item life_color
  13460. Set the color of living (or new born) cells.
  13461. @item death_color
  13462. Set the color of dead cells. If @option{mold} is set, this is the first color
  13463. used to represent a dead cell.
  13464. @item mold_color
  13465. Set mold color, for definitely dead and moldy cells.
  13466. For the syntax of these 3 color options, check the @ref{color syntax,,"Color" section in the
  13467. ffmpeg-utils manual,ffmpeg-utils}.
  13468. @end table
  13469. @subsection Examples
  13470. @itemize
  13471. @item
  13472. Read a grid from @file{pattern}, and center it on a grid of size
  13473. 300x300 pixels:
  13474. @example
  13475. life=f=pattern:s=300x300
  13476. @end example
  13477. @item
  13478. Generate a random grid of size 200x200, with a fill ratio of 2/3:
  13479. @example
  13480. life=ratio=2/3:s=200x200
  13481. @end example
  13482. @item
  13483. Specify a custom rule for evolving a randomly generated grid:
  13484. @example
  13485. life=rule=S14/B34
  13486. @end example
  13487. @item
  13488. Full example with slow death effect (mold) using @command{ffplay}:
  13489. @example
  13490. ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
  13491. @end example
  13492. @end itemize
  13493. @anchor{allrgb}
  13494. @anchor{allyuv}
  13495. @anchor{color}
  13496. @anchor{haldclutsrc}
  13497. @anchor{nullsrc}
  13498. @anchor{rgbtestsrc}
  13499. @anchor{smptebars}
  13500. @anchor{smptehdbars}
  13501. @anchor{testsrc}
  13502. @anchor{testsrc2}
  13503. @anchor{yuvtestsrc}
  13504. @section allrgb, allyuv, color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
  13505. The @code{allrgb} source returns frames of size 4096x4096 of all rgb colors.
  13506. The @code{allyuv} source returns frames of size 4096x4096 of all yuv colors.
  13507. The @code{color} source provides an uniformly colored input.
  13508. The @code{haldclutsrc} source provides an identity Hald CLUT. See also
  13509. @ref{haldclut} filter.
  13510. The @code{nullsrc} source returns unprocessed video frames. It is
  13511. mainly useful to be employed in analysis / debugging tools, or as the
  13512. source for filters which ignore the input data.
  13513. The @code{rgbtestsrc} source generates an RGB test pattern useful for
  13514. detecting RGB vs BGR issues. You should see a red, green and blue
  13515. stripe from top to bottom.
  13516. The @code{smptebars} source generates a color bars pattern, based on
  13517. the SMPTE Engineering Guideline EG 1-1990.
  13518. The @code{smptehdbars} source generates a color bars pattern, based on
  13519. the SMPTE RP 219-2002.
  13520. The @code{testsrc} source generates a test video pattern, showing a
  13521. color pattern, a scrolling gradient and a timestamp. This is mainly
  13522. intended for testing purposes.
  13523. The @code{testsrc2} source is similar to testsrc, but supports more
  13524. pixel formats instead of just @code{rgb24}. This allows using it as an
  13525. input for other tests without requiring a format conversion.
  13526. The @code{yuvtestsrc} source generates an YUV test pattern. You should
  13527. see a y, cb and cr stripe from top to bottom.
  13528. The sources accept the following parameters:
  13529. @table @option
  13530. @item level
  13531. Specify the level of the Hald CLUT, only available in the @code{haldclutsrc}
  13532. source. A level of @code{N} generates a picture of @code{N*N*N} by @code{N*N*N}
  13533. pixels to be used as identity matrix for 3D lookup tables. Each component is
  13534. coded on a @code{1/(N*N)} scale.
  13535. @item color, c
  13536. Specify the color of the source, only available in the @code{color}
  13537. source. For the syntax of this option, check the
  13538. @ref{color syntax,,"Color" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13539. @item size, s
  13540. Specify the size of the sourced video. For the syntax of this option, check the
  13541. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13542. The default value is @code{320x240}.
  13543. This option is not available with the @code{allrgb}, @code{allyuv}, and
  13544. @code{haldclutsrc} filters.
  13545. @item rate, r
  13546. Specify the frame rate of the sourced video, as the number of frames
  13547. generated per second. It has to be a string in the format
  13548. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a floating point
  13549. number or a valid video frame rate abbreviation. The default value is
  13550. "25".
  13551. @item duration, d
  13552. Set the duration of the sourced video. See
  13553. @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}
  13554. for the accepted syntax.
  13555. If not specified, or the expressed duration is negative, the video is
  13556. supposed to be generated forever.
  13557. @item sar
  13558. Set the sample aspect ratio of the sourced video.
  13559. @item alpha
  13560. Specify the alpha (opacity) of the background, only available in the
  13561. @code{testsrc2} source. The value must be between 0 (fully transparent) and
  13562. 255 (fully opaque, the default).
  13563. @item decimals, n
  13564. Set the number of decimals to show in the timestamp, only available in the
  13565. @code{testsrc} source.
  13566. The displayed timestamp value will correspond to the original
  13567. timestamp value multiplied by the power of 10 of the specified
  13568. value. Default value is 0.
  13569. @end table
  13570. @subsection Examples
  13571. @itemize
  13572. @item
  13573. Generate a video with a duration of 5.3 seconds, with size
  13574. 176x144 and a frame rate of 10 frames per second:
  13575. @example
  13576. testsrc=duration=5.3:size=qcif:rate=10
  13577. @end example
  13578. @item
  13579. The following graph description will generate a red source
  13580. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  13581. frames per second:
  13582. @example
  13583. color=c=red@@0.2:s=qcif:r=10
  13584. @end example
  13585. @item
  13586. If the input content is to be ignored, @code{nullsrc} can be used. The
  13587. following command generates noise in the luminance plane by employing
  13588. the @code{geq} filter:
  13589. @example
  13590. nullsrc=s=256x256, geq=random(1)*255:128:128
  13591. @end example
  13592. @end itemize
  13593. @subsection Commands
  13594. The @code{color} source supports the following commands:
  13595. @table @option
  13596. @item c, color
  13597. Set the color of the created image. Accepts the same syntax of the
  13598. corresponding @option{color} option.
  13599. @end table
  13600. @section openclsrc
  13601. Generate video using an OpenCL program.
  13602. @table @option
  13603. @item source
  13604. OpenCL program source file.
  13605. @item kernel
  13606. Kernel name in program.
  13607. @item size, s
  13608. Size of frames to generate. This must be set.
  13609. @item format
  13610. Pixel format to use for the generated frames. This must be set.
  13611. @item rate, r
  13612. Number of frames generated every second. Default value is '25'.
  13613. @end table
  13614. For details of how the program loading works, see the @ref{program_opencl}
  13615. filter.
  13616. Example programs:
  13617. @itemize
  13618. @item
  13619. Generate a colour ramp by setting pixel values from the position of the pixel
  13620. in the output image. (Note that this will work with all pixel formats, but
  13621. the generated output will not be the same.)
  13622. @verbatim
  13623. __kernel void ramp(__write_only image2d_t dst,
  13624. unsigned int index)
  13625. {
  13626. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  13627. float4 val;
  13628. val.xy = val.zw = convert_float2(loc) / convert_float2(get_image_dim(dst));
  13629. write_imagef(dst, loc, val);
  13630. }
  13631. @end verbatim
  13632. @item
  13633. Generate a Sierpinski carpet pattern, panning by a single pixel each frame.
  13634. @verbatim
  13635. __kernel void sierpinski_carpet(__write_only image2d_t dst,
  13636. unsigned int index)
  13637. {
  13638. int2 loc = (int2)(get_global_id(0), get_global_id(1));
  13639. float4 value = 0.0f;
  13640. int x = loc.x + index;
  13641. int y = loc.y + index;
  13642. while (x > 0 || y > 0) {
  13643. if (x % 3 == 1 && y % 3 == 1) {
  13644. value = 1.0f;
  13645. break;
  13646. }
  13647. x /= 3;
  13648. y /= 3;
  13649. }
  13650. write_imagef(dst, loc, value);
  13651. }
  13652. @end verbatim
  13653. @end itemize
  13654. @c man end VIDEO SOURCES
  13655. @chapter Video Sinks
  13656. @c man begin VIDEO SINKS
  13657. Below is a description of the currently available video sinks.
  13658. @section buffersink
  13659. Buffer video frames, and make them available to the end of the filter
  13660. graph.
  13661. This sink is mainly intended for programmatic use, in particular
  13662. through the interface defined in @file{libavfilter/buffersink.h}
  13663. or the options system.
  13664. It accepts a pointer to an AVBufferSinkContext structure, which
  13665. defines the incoming buffers' formats, to be passed as the opaque
  13666. parameter to @code{avfilter_init_filter} for initialization.
  13667. @section nullsink
  13668. Null video sink: do absolutely nothing with the input video. It is
  13669. mainly useful as a template and for use in analysis / debugging
  13670. tools.
  13671. @c man end VIDEO SINKS
  13672. @chapter Multimedia Filters
  13673. @c man begin MULTIMEDIA FILTERS
  13674. Below is a description of the currently available multimedia filters.
  13675. @section abitscope
  13676. Convert input audio to a video output, displaying the audio bit scope.
  13677. The filter accepts the following options:
  13678. @table @option
  13679. @item rate, r
  13680. Set frame rate, expressed as number of frames per second. Default
  13681. value is "25".
  13682. @item size, s
  13683. Specify the video size for the output. For the syntax of this option, check the
  13684. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13685. Default value is @code{1024x256}.
  13686. @item colors
  13687. Specify list of colors separated by space or by '|' which will be used to
  13688. draw channels. Unrecognized or missing colors will be replaced
  13689. by white color.
  13690. @end table
  13691. @section ahistogram
  13692. Convert input audio to a video output, displaying the volume histogram.
  13693. The filter accepts the following options:
  13694. @table @option
  13695. @item dmode
  13696. Specify how histogram is calculated.
  13697. It accepts the following values:
  13698. @table @samp
  13699. @item single
  13700. Use single histogram for all channels.
  13701. @item separate
  13702. Use separate histogram for each channel.
  13703. @end table
  13704. Default is @code{single}.
  13705. @item rate, r
  13706. Set frame rate, expressed as number of frames per second. Default
  13707. value is "25".
  13708. @item size, s
  13709. Specify the video size for the output. For the syntax of this option, check the
  13710. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13711. Default value is @code{hd720}.
  13712. @item scale
  13713. Set display scale.
  13714. It accepts the following values:
  13715. @table @samp
  13716. @item log
  13717. logarithmic
  13718. @item sqrt
  13719. square root
  13720. @item cbrt
  13721. cubic root
  13722. @item lin
  13723. linear
  13724. @item rlog
  13725. reverse logarithmic
  13726. @end table
  13727. Default is @code{log}.
  13728. @item ascale
  13729. Set amplitude scale.
  13730. It accepts the following values:
  13731. @table @samp
  13732. @item log
  13733. logarithmic
  13734. @item lin
  13735. linear
  13736. @end table
  13737. Default is @code{log}.
  13738. @item acount
  13739. Set how much frames to accumulate in histogram.
  13740. Defauls is 1. Setting this to -1 accumulates all frames.
  13741. @item rheight
  13742. Set histogram ratio of window height.
  13743. @item slide
  13744. Set sonogram sliding.
  13745. It accepts the following values:
  13746. @table @samp
  13747. @item replace
  13748. replace old rows with new ones.
  13749. @item scroll
  13750. scroll from top to bottom.
  13751. @end table
  13752. Default is @code{replace}.
  13753. @end table
  13754. @section aphasemeter
  13755. Convert input audio to a video output, displaying the audio phase.
  13756. The filter accepts the following options:
  13757. @table @option
  13758. @item rate, r
  13759. Set the output frame rate. Default value is @code{25}.
  13760. @item size, s
  13761. Set the video size for the output. For the syntax of this option, check the
  13762. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13763. Default value is @code{800x400}.
  13764. @item rc
  13765. @item gc
  13766. @item bc
  13767. Specify the red, green, blue contrast. Default values are @code{2},
  13768. @code{7} and @code{1}.
  13769. Allowed range is @code{[0, 255]}.
  13770. @item mpc
  13771. Set color which will be used for drawing median phase. If color is
  13772. @code{none} which is default, no median phase value will be drawn.
  13773. @item video
  13774. Enable video output. Default is enabled.
  13775. @end table
  13776. The filter also exports the frame metadata @code{lavfi.aphasemeter.phase} which
  13777. represents mean phase of current audio frame. Value is in range @code{[-1, 1]}.
  13778. The @code{-1} means left and right channels are completely out of phase and
  13779. @code{1} means channels are in phase.
  13780. @section avectorscope
  13781. Convert input audio to a video output, representing the audio vector
  13782. scope.
  13783. The filter is used to measure the difference between channels of stereo
  13784. audio stream. A monoaural signal, consisting of identical left and right
  13785. signal, results in straight vertical line. Any stereo separation is visible
  13786. as a deviation from this line, creating a Lissajous figure.
  13787. If the straight (or deviation from it) but horizontal line appears this
  13788. indicates that the left and right channels are out of phase.
  13789. The filter accepts the following options:
  13790. @table @option
  13791. @item mode, m
  13792. Set the vectorscope mode.
  13793. Available values are:
  13794. @table @samp
  13795. @item lissajous
  13796. Lissajous rotated by 45 degrees.
  13797. @item lissajous_xy
  13798. Same as above but not rotated.
  13799. @item polar
  13800. Shape resembling half of circle.
  13801. @end table
  13802. Default value is @samp{lissajous}.
  13803. @item size, s
  13804. Set the video size for the output. For the syntax of this option, check the
  13805. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  13806. Default value is @code{400x400}.
  13807. @item rate, r
  13808. Set the output frame rate. Default value is @code{25}.
  13809. @item rc
  13810. @item gc
  13811. @item bc
  13812. @item ac
  13813. Specify the red, green, blue and alpha contrast. Default values are @code{40},
  13814. @code{160}, @code{80} and @code{255}.
  13815. Allowed range is @code{[0, 255]}.
  13816. @item rf
  13817. @item gf
  13818. @item bf
  13819. @item af
  13820. Specify the red, green, blue and alpha fade. Default values are @code{15},
  13821. @code{10}, @code{5} and @code{5}.
  13822. Allowed range is @code{[0, 255]}.
  13823. @item zoom
  13824. Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
  13825. Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
  13826. @item draw
  13827. Set the vectorscope drawing mode.
  13828. Available values are:
  13829. @table @samp
  13830. @item dot
  13831. Draw dot for each sample.
  13832. @item line
  13833. Draw line between previous and current sample.
  13834. @end table
  13835. Default value is @samp{dot}.
  13836. @item scale
  13837. Specify amplitude scale of audio samples.
  13838. Available values are:
  13839. @table @samp
  13840. @item lin
  13841. Linear.
  13842. @item sqrt
  13843. Square root.
  13844. @item cbrt
  13845. Cubic root.
  13846. @item log
  13847. Logarithmic.
  13848. @end table
  13849. @item swap
  13850. Swap left channel axis with right channel axis.
  13851. @item mirror
  13852. Mirror axis.
  13853. @table @samp
  13854. @item none
  13855. No mirror.
  13856. @item x
  13857. Mirror only x axis.
  13858. @item y
  13859. Mirror only y axis.
  13860. @item xy
  13861. Mirror both axis.
  13862. @end table
  13863. @end table
  13864. @subsection Examples
  13865. @itemize
  13866. @item
  13867. Complete example using @command{ffplay}:
  13868. @example
  13869. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  13870. [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
  13871. @end example
  13872. @end itemize
  13873. @section bench, abench
  13874. Benchmark part of a filtergraph.
  13875. The filter accepts the following options:
  13876. @table @option
  13877. @item action
  13878. Start or stop a timer.
  13879. Available values are:
  13880. @table @samp
  13881. @item start
  13882. Get the current time, set it as frame metadata (using the key
  13883. @code{lavfi.bench.start_time}), and forward the frame to the next filter.
  13884. @item stop
  13885. Get the current time and fetch the @code{lavfi.bench.start_time} metadata from
  13886. the input frame metadata to get the time difference. Time difference, average,
  13887. maximum and minimum time (respectively @code{t}, @code{avg}, @code{max} and
  13888. @code{min}) are then printed. The timestamps are expressed in seconds.
  13889. @end table
  13890. @end table
  13891. @subsection Examples
  13892. @itemize
  13893. @item
  13894. Benchmark @ref{selectivecolor} filter:
  13895. @example
  13896. bench=start,selectivecolor=reds=-.2 .12 -.49,bench=stop
  13897. @end example
  13898. @end itemize
  13899. @section concat
  13900. Concatenate audio and video streams, joining them together one after the
  13901. other.
  13902. The filter works on segments of synchronized video and audio streams. All
  13903. segments must have the same number of streams of each type, and that will
  13904. also be the number of streams at output.
  13905. The filter accepts the following options:
  13906. @table @option
  13907. @item n
  13908. Set the number of segments. Default is 2.
  13909. @item v
  13910. Set the number of output video streams, that is also the number of video
  13911. streams in each segment. Default is 1.
  13912. @item a
  13913. Set the number of output audio streams, that is also the number of audio
  13914. streams in each segment. Default is 0.
  13915. @item unsafe
  13916. Activate unsafe mode: do not fail if segments have a different format.
  13917. @end table
  13918. The filter has @var{v}+@var{a} outputs: first @var{v} video outputs, then
  13919. @var{a} audio outputs.
  13920. There are @var{n}x(@var{v}+@var{a}) inputs: first the inputs for the first
  13921. segment, in the same order as the outputs, then the inputs for the second
  13922. segment, etc.
  13923. Related streams do not always have exactly the same duration, for various
  13924. reasons including codec frame size or sloppy authoring. For that reason,
  13925. related synchronized streams (e.g. a video and its audio track) should be
  13926. concatenated at once. The concat filter will use the duration of the longest
  13927. stream in each segment (except the last one), and if necessary pad shorter
  13928. audio streams with silence.
  13929. For this filter to work correctly, all segments must start at timestamp 0.
  13930. All corresponding streams must have the same parameters in all segments; the
  13931. filtering system will automatically select a common pixel format for video
  13932. streams, and a common sample format, sample rate and channel layout for
  13933. audio streams, but other settings, such as resolution, must be converted
  13934. explicitly by the user.
  13935. Different frame rates are acceptable but will result in variable frame rate
  13936. at output; be sure to configure the output file to handle it.
  13937. @subsection Examples
  13938. @itemize
  13939. @item
  13940. Concatenate an opening, an episode and an ending, all in bilingual version
  13941. (video in stream 0, audio in streams 1 and 2):
  13942. @example
  13943. ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
  13944. '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
  13945. concat=n=3:v=1:a=2 [v] [a1] [a2]' \
  13946. -map '[v]' -map '[a1]' -map '[a2]' output.mkv
  13947. @end example
  13948. @item
  13949. Concatenate two parts, handling audio and video separately, using the
  13950. (a)movie sources, and adjusting the resolution:
  13951. @example
  13952. movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
  13953. movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
  13954. [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
  13955. @end example
  13956. Note that a desync will happen at the stitch if the audio and video streams
  13957. do not have exactly the same duration in the first file.
  13958. @end itemize
  13959. @subsection Commands
  13960. This filter supports the following commands:
  13961. @table @option
  13962. @item next
  13963. Close the current segment and step to the next one
  13964. @end table
  13965. @section drawgraph, adrawgraph
  13966. Draw a graph using input video or audio metadata.
  13967. It accepts the following parameters:
  13968. @table @option
  13969. @item m1
  13970. Set 1st frame metadata key from which metadata values will be used to draw a graph.
  13971. @item fg1
  13972. Set 1st foreground color expression.
  13973. @item m2
  13974. Set 2nd frame metadata key from which metadata values will be used to draw a graph.
  13975. @item fg2
  13976. Set 2nd foreground color expression.
  13977. @item m3
  13978. Set 3rd frame metadata key from which metadata values will be used to draw a graph.
  13979. @item fg3
  13980. Set 3rd foreground color expression.
  13981. @item m4
  13982. Set 4th frame metadata key from which metadata values will be used to draw a graph.
  13983. @item fg4
  13984. Set 4th foreground color expression.
  13985. @item min
  13986. Set minimal value of metadata value.
  13987. @item max
  13988. Set maximal value of metadata value.
  13989. @item bg
  13990. Set graph background color. Default is white.
  13991. @item mode
  13992. Set graph mode.
  13993. Available values for mode is:
  13994. @table @samp
  13995. @item bar
  13996. @item dot
  13997. @item line
  13998. @end table
  13999. Default is @code{line}.
  14000. @item slide
  14001. Set slide mode.
  14002. Available values for slide is:
  14003. @table @samp
  14004. @item frame
  14005. Draw new frame when right border is reached.
  14006. @item replace
  14007. Replace old columns with new ones.
  14008. @item scroll
  14009. Scroll from right to left.
  14010. @item rscroll
  14011. Scroll from left to right.
  14012. @item picture
  14013. Draw single picture.
  14014. @end table
  14015. Default is @code{frame}.
  14016. @item size
  14017. Set size of graph video. For the syntax of this option, check the
  14018. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14019. The default value is @code{900x256}.
  14020. The foreground color expressions can use the following variables:
  14021. @table @option
  14022. @item MIN
  14023. Minimal value of metadata value.
  14024. @item MAX
  14025. Maximal value of metadata value.
  14026. @item VAL
  14027. Current metadata key value.
  14028. @end table
  14029. The color is defined as 0xAABBGGRR.
  14030. @end table
  14031. Example using metadata from @ref{signalstats} filter:
  14032. @example
  14033. signalstats,drawgraph=lavfi.signalstats.YAVG:min=0:max=255
  14034. @end example
  14035. Example using metadata from @ref{ebur128} filter:
  14036. @example
  14037. ebur128=metadata=1,adrawgraph=lavfi.r128.M:min=-120:max=5
  14038. @end example
  14039. @anchor{ebur128}
  14040. @section ebur128
  14041. EBU R128 scanner filter. This filter takes an audio stream as input and outputs
  14042. it unchanged. By default, it logs a message at a frequency of 10Hz with the
  14043. Momentary loudness (identified by @code{M}), Short-term loudness (@code{S}),
  14044. Integrated loudness (@code{I}) and Loudness Range (@code{LRA}).
  14045. The filter also has a video output (see the @var{video} option) with a real
  14046. time graph to observe the loudness evolution. The graphic contains the logged
  14047. message mentioned above, so it is not printed anymore when this option is set,
  14048. unless the verbose logging is set. The main graphing area contains the
  14049. short-term loudness (3 seconds of analysis), and the gauge on the right is for
  14050. the momentary loudness (400 milliseconds).
  14051. More information about the Loudness Recommendation EBU R128 on
  14052. @url{http://tech.ebu.ch/loudness}.
  14053. The filter accepts the following options:
  14054. @table @option
  14055. @item video
  14056. Activate the video output. The audio stream is passed unchanged whether this
  14057. option is set or no. The video stream will be the first output stream if
  14058. activated. Default is @code{0}.
  14059. @item size
  14060. Set the video size. This option is for video only. For the syntax of this
  14061. option, check the
  14062. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14063. Default and minimum resolution is @code{640x480}.
  14064. @item meter
  14065. Set the EBU scale meter. Default is @code{9}. Common values are @code{9} and
  14066. @code{18}, respectively for EBU scale meter +9 and EBU scale meter +18. Any
  14067. other integer value between this range is allowed.
  14068. @item metadata
  14069. Set metadata injection. If set to @code{1}, the audio input will be segmented
  14070. into 100ms output frames, each of them containing various loudness information
  14071. in metadata. All the metadata keys are prefixed with @code{lavfi.r128.}.
  14072. Default is @code{0}.
  14073. @item framelog
  14074. Force the frame logging level.
  14075. Available values are:
  14076. @table @samp
  14077. @item info
  14078. information logging level
  14079. @item verbose
  14080. verbose logging level
  14081. @end table
  14082. By default, the logging level is set to @var{info}. If the @option{video} or
  14083. the @option{metadata} options are set, it switches to @var{verbose}.
  14084. @item peak
  14085. Set peak mode(s).
  14086. Available modes can be cumulated (the option is a @code{flag} type). Possible
  14087. values are:
  14088. @table @samp
  14089. @item none
  14090. Disable any peak mode (default).
  14091. @item sample
  14092. Enable sample-peak mode.
  14093. Simple peak mode looking for the higher sample value. It logs a message
  14094. for sample-peak (identified by @code{SPK}).
  14095. @item true
  14096. Enable true-peak mode.
  14097. If enabled, the peak lookup is done on an over-sampled version of the input
  14098. stream for better peak accuracy. It logs a message for true-peak.
  14099. (identified by @code{TPK}) and true-peak per frame (identified by @code{FTPK}).
  14100. This mode requires a build with @code{libswresample}.
  14101. @end table
  14102. @item dualmono
  14103. Treat mono input files as "dual mono". If a mono file is intended for playback
  14104. on a stereo system, its EBU R128 measurement will be perceptually incorrect.
  14105. If set to @code{true}, this option will compensate for this effect.
  14106. Multi-channel input files are not affected by this option.
  14107. @item panlaw
  14108. Set a specific pan law to be used for the measurement of dual mono files.
  14109. This parameter is optional, and has a default value of -3.01dB.
  14110. @end table
  14111. @subsection Examples
  14112. @itemize
  14113. @item
  14114. Real-time graph using @command{ffplay}, with a EBU scale meter +18:
  14115. @example
  14116. ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
  14117. @end example
  14118. @item
  14119. Run an analysis with @command{ffmpeg}:
  14120. @example
  14121. ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
  14122. @end example
  14123. @end itemize
  14124. @section interleave, ainterleave
  14125. Temporally interleave frames from several inputs.
  14126. @code{interleave} works with video inputs, @code{ainterleave} with audio.
  14127. These filters read frames from several inputs and send the oldest
  14128. queued frame to the output.
  14129. Input streams must have well defined, monotonically increasing frame
  14130. timestamp values.
  14131. In order to submit one frame to output, these filters need to enqueue
  14132. at least one frame for each input, so they cannot work in case one
  14133. input is not yet terminated and will not receive incoming frames.
  14134. For example consider the case when one input is a @code{select} filter
  14135. which always drops input frames. The @code{interleave} filter will keep
  14136. reading from that input, but it will never be able to send new frames
  14137. to output until the input sends an end-of-stream signal.
  14138. Also, depending on inputs synchronization, the filters will drop
  14139. frames in case one input receives more frames than the other ones, and
  14140. the queue is already filled.
  14141. These filters accept the following options:
  14142. @table @option
  14143. @item nb_inputs, n
  14144. Set the number of different inputs, it is 2 by default.
  14145. @end table
  14146. @subsection Examples
  14147. @itemize
  14148. @item
  14149. Interleave frames belonging to different streams using @command{ffmpeg}:
  14150. @example
  14151. ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
  14152. @end example
  14153. @item
  14154. Add flickering blur effect:
  14155. @example
  14156. select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
  14157. @end example
  14158. @end itemize
  14159. @section metadata, ametadata
  14160. Manipulate frame metadata.
  14161. This filter accepts the following options:
  14162. @table @option
  14163. @item mode
  14164. Set mode of operation of the filter.
  14165. Can be one of the following:
  14166. @table @samp
  14167. @item select
  14168. If both @code{value} and @code{key} is set, select frames
  14169. which have such metadata. If only @code{key} is set, select
  14170. every frame that has such key in metadata.
  14171. @item add
  14172. Add new metadata @code{key} and @code{value}. If key is already available
  14173. do nothing.
  14174. @item modify
  14175. Modify value of already present key.
  14176. @item delete
  14177. If @code{value} is set, delete only keys that have such value.
  14178. Otherwise, delete key. If @code{key} is not set, delete all metadata values in
  14179. the frame.
  14180. @item print
  14181. Print key and its value if metadata was found. If @code{key} is not set print all
  14182. metadata values available in frame.
  14183. @end table
  14184. @item key
  14185. Set key used with all modes. Must be set for all modes except @code{print} and @code{delete}.
  14186. @item value
  14187. Set metadata value which will be used. This option is mandatory for
  14188. @code{modify} and @code{add} mode.
  14189. @item function
  14190. Which function to use when comparing metadata value and @code{value}.
  14191. Can be one of following:
  14192. @table @samp
  14193. @item same_str
  14194. Values are interpreted as strings, returns true if metadata value is same as @code{value}.
  14195. @item starts_with
  14196. Values are interpreted as strings, returns true if metadata value starts with
  14197. the @code{value} option string.
  14198. @item less
  14199. Values are interpreted as floats, returns true if metadata value is less than @code{value}.
  14200. @item equal
  14201. Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
  14202. @item greater
  14203. Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
  14204. @item expr
  14205. Values are interpreted as floats, returns true if expression from option @code{expr}
  14206. evaluates to true.
  14207. @end table
  14208. @item expr
  14209. Set expression which is used when @code{function} is set to @code{expr}.
  14210. The expression is evaluated through the eval API and can contain the following
  14211. constants:
  14212. @table @option
  14213. @item VALUE1
  14214. Float representation of @code{value} from metadata key.
  14215. @item VALUE2
  14216. Float representation of @code{value} as supplied by user in @code{value} option.
  14217. @end table
  14218. @item file
  14219. If specified in @code{print} mode, output is written to the named file. Instead of
  14220. plain filename any writable url can be specified. Filename ``-'' is a shorthand
  14221. for standard output. If @code{file} option is not set, output is written to the log
  14222. with AV_LOG_INFO loglevel.
  14223. @end table
  14224. @subsection Examples
  14225. @itemize
  14226. @item
  14227. Print all metadata values for frames with key @code{lavfi.signalstats.YDIF} with values
  14228. between 0 and 1.
  14229. @example
  14230. signalstats,metadata=print:key=lavfi.signalstats.YDIF:value=0:function=expr:expr='between(VALUE1,0,1)'
  14231. @end example
  14232. @item
  14233. Print silencedetect output to file @file{metadata.txt}.
  14234. @example
  14235. silencedetect,ametadata=mode=print:file=metadata.txt
  14236. @end example
  14237. @item
  14238. Direct all metadata to a pipe with file descriptor 4.
  14239. @example
  14240. metadata=mode=print:file='pipe\:4'
  14241. @end example
  14242. @end itemize
  14243. @section perms, aperms
  14244. Set read/write permissions for the output frames.
  14245. These filters are mainly aimed at developers to test direct path in the
  14246. following filter in the filtergraph.
  14247. The filters accept the following options:
  14248. @table @option
  14249. @item mode
  14250. Select the permissions mode.
  14251. It accepts the following values:
  14252. @table @samp
  14253. @item none
  14254. Do nothing. This is the default.
  14255. @item ro
  14256. Set all the output frames read-only.
  14257. @item rw
  14258. Set all the output frames directly writable.
  14259. @item toggle
  14260. Make the frame read-only if writable, and writable if read-only.
  14261. @item random
  14262. Set each output frame read-only or writable randomly.
  14263. @end table
  14264. @item seed
  14265. Set the seed for the @var{random} mode, must be an integer included between
  14266. @code{0} and @code{UINT32_MAX}. If not specified, or if explicitly set to
  14267. @code{-1}, the filter will try to use a good random seed on a best effort
  14268. basis.
  14269. @end table
  14270. Note: in case of auto-inserted filter between the permission filter and the
  14271. following one, the permission might not be received as expected in that
  14272. following filter. Inserting a @ref{format} or @ref{aformat} filter before the
  14273. perms/aperms filter can avoid this problem.
  14274. @section realtime, arealtime
  14275. Slow down filtering to match real time approximately.
  14276. These filters will pause the filtering for a variable amount of time to
  14277. match the output rate with the input timestamps.
  14278. They are similar to the @option{re} option to @code{ffmpeg}.
  14279. They accept the following options:
  14280. @table @option
  14281. @item limit
  14282. Time limit for the pauses. Any pause longer than that will be considered
  14283. a timestamp discontinuity and reset the timer. Default is 2 seconds.
  14284. @end table
  14285. @anchor{select}
  14286. @section select, aselect
  14287. Select frames to pass in output.
  14288. This filter accepts the following options:
  14289. @table @option
  14290. @item expr, e
  14291. Set expression, which is evaluated for each input frame.
  14292. If the expression is evaluated to zero, the frame is discarded.
  14293. If the evaluation result is negative or NaN, the frame is sent to the
  14294. first output; otherwise it is sent to the output with index
  14295. @code{ceil(val)-1}, assuming that the input index starts from 0.
  14296. For example a value of @code{1.2} corresponds to the output with index
  14297. @code{ceil(1.2)-1 = 2-1 = 1}, that is the second output.
  14298. @item outputs, n
  14299. Set the number of outputs. The output to which to send the selected
  14300. frame is based on the result of the evaluation. Default value is 1.
  14301. @end table
  14302. The expression can contain the following constants:
  14303. @table @option
  14304. @item n
  14305. The (sequential) number of the filtered frame, starting from 0.
  14306. @item selected_n
  14307. The (sequential) number of the selected frame, starting from 0.
  14308. @item prev_selected_n
  14309. The sequential number of the last selected frame. It's NAN if undefined.
  14310. @item TB
  14311. The timebase of the input timestamps.
  14312. @item pts
  14313. The PTS (Presentation TimeStamp) of the filtered video frame,
  14314. expressed in @var{TB} units. It's NAN if undefined.
  14315. @item t
  14316. The PTS of the filtered video frame,
  14317. expressed in seconds. It's NAN if undefined.
  14318. @item prev_pts
  14319. The PTS of the previously filtered video frame. It's NAN if undefined.
  14320. @item prev_selected_pts
  14321. The PTS of the last previously filtered video frame. It's NAN if undefined.
  14322. @item prev_selected_t
  14323. The PTS of the last previously selected video frame, expressed in seconds. It's NAN if undefined.
  14324. @item start_pts
  14325. The PTS of the first video frame in the video. It's NAN if undefined.
  14326. @item start_t
  14327. The time of the first video frame in the video. It's NAN if undefined.
  14328. @item pict_type @emph{(video only)}
  14329. The type of the filtered frame. It can assume one of the following
  14330. values:
  14331. @table @option
  14332. @item I
  14333. @item P
  14334. @item B
  14335. @item S
  14336. @item SI
  14337. @item SP
  14338. @item BI
  14339. @end table
  14340. @item interlace_type @emph{(video only)}
  14341. The frame interlace type. It can assume one of the following values:
  14342. @table @option
  14343. @item PROGRESSIVE
  14344. The frame is progressive (not interlaced).
  14345. @item TOPFIRST
  14346. The frame is top-field-first.
  14347. @item BOTTOMFIRST
  14348. The frame is bottom-field-first.
  14349. @end table
  14350. @item consumed_sample_n @emph{(audio only)}
  14351. the number of selected samples before the current frame
  14352. @item samples_n @emph{(audio only)}
  14353. the number of samples in the current frame
  14354. @item sample_rate @emph{(audio only)}
  14355. the input sample rate
  14356. @item key
  14357. This is 1 if the filtered frame is a key-frame, 0 otherwise.
  14358. @item pos
  14359. the position in the file of the filtered frame, -1 if the information
  14360. is not available (e.g. for synthetic video)
  14361. @item scene @emph{(video only)}
  14362. value between 0 and 1 to indicate a new scene; a low value reflects a low
  14363. probability for the current frame to introduce a new scene, while a higher
  14364. value means the current frame is more likely to be one (see the example below)
  14365. @item concatdec_select
  14366. The concat demuxer can select only part of a concat input file by setting an
  14367. inpoint and an outpoint, but the output packets may not be entirely contained
  14368. in the selected interval. By using this variable, it is possible to skip frames
  14369. generated by the concat demuxer which are not exactly contained in the selected
  14370. interval.
  14371. This works by comparing the frame pts against the @var{lavf.concat.start_time}
  14372. and the @var{lavf.concat.duration} packet metadata values which are also
  14373. present in the decoded frames.
  14374. The @var{concatdec_select} variable is -1 if the frame pts is at least
  14375. start_time and either the duration metadata is missing or the frame pts is less
  14376. than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
  14377. missing.
  14378. That basically means that an input frame is selected if its pts is within the
  14379. interval set by the concat demuxer.
  14380. @end table
  14381. The default value of the select expression is "1".
  14382. @subsection Examples
  14383. @itemize
  14384. @item
  14385. Select all frames in input:
  14386. @example
  14387. select
  14388. @end example
  14389. The example above is the same as:
  14390. @example
  14391. select=1
  14392. @end example
  14393. @item
  14394. Skip all frames:
  14395. @example
  14396. select=0
  14397. @end example
  14398. @item
  14399. Select only I-frames:
  14400. @example
  14401. select='eq(pict_type\,I)'
  14402. @end example
  14403. @item
  14404. Select one frame every 100:
  14405. @example
  14406. select='not(mod(n\,100))'
  14407. @end example
  14408. @item
  14409. Select only frames contained in the 10-20 time interval:
  14410. @example
  14411. select=between(t\,10\,20)
  14412. @end example
  14413. @item
  14414. Select only I-frames contained in the 10-20 time interval:
  14415. @example
  14416. select=between(t\,10\,20)*eq(pict_type\,I)
  14417. @end example
  14418. @item
  14419. Select frames with a minimum distance of 10 seconds:
  14420. @example
  14421. select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
  14422. @end example
  14423. @item
  14424. Use aselect to select only audio frames with samples number > 100:
  14425. @example
  14426. aselect='gt(samples_n\,100)'
  14427. @end example
  14428. @item
  14429. Create a mosaic of the first scenes:
  14430. @example
  14431. ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
  14432. @end example
  14433. Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
  14434. choice.
  14435. @item
  14436. Send even and odd frames to separate outputs, and compose them:
  14437. @example
  14438. select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
  14439. @end example
  14440. @item
  14441. Select useful frames from an ffconcat file which is using inpoints and
  14442. outpoints but where the source files are not intra frame only.
  14443. @example
  14444. ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
  14445. @end example
  14446. @end itemize
  14447. @section sendcmd, asendcmd
  14448. Send commands to filters in the filtergraph.
  14449. These filters read commands to be sent to other filters in the
  14450. filtergraph.
  14451. @code{sendcmd} must be inserted between two video filters,
  14452. @code{asendcmd} must be inserted between two audio filters, but apart
  14453. from that they act the same way.
  14454. The specification of commands can be provided in the filter arguments
  14455. with the @var{commands} option, or in a file specified by the
  14456. @var{filename} option.
  14457. These filters accept the following options:
  14458. @table @option
  14459. @item commands, c
  14460. Set the commands to be read and sent to the other filters.
  14461. @item filename, f
  14462. Set the filename of the commands to be read and sent to the other
  14463. filters.
  14464. @end table
  14465. @subsection Commands syntax
  14466. A commands description consists of a sequence of interval
  14467. specifications, comprising a list of commands to be executed when a
  14468. particular event related to that interval occurs. The occurring event
  14469. is typically the current frame time entering or leaving a given time
  14470. interval.
  14471. An interval is specified by the following syntax:
  14472. @example
  14473. @var{START}[-@var{END}] @var{COMMANDS};
  14474. @end example
  14475. The time interval is specified by the @var{START} and @var{END} times.
  14476. @var{END} is optional and defaults to the maximum time.
  14477. The current frame time is considered within the specified interval if
  14478. it is included in the interval [@var{START}, @var{END}), that is when
  14479. the time is greater or equal to @var{START} and is lesser than
  14480. @var{END}.
  14481. @var{COMMANDS} consists of a sequence of one or more command
  14482. specifications, separated by ",", relating to that interval. The
  14483. syntax of a command specification is given by:
  14484. @example
  14485. [@var{FLAGS}] @var{TARGET} @var{COMMAND} @var{ARG}
  14486. @end example
  14487. @var{FLAGS} is optional and specifies the type of events relating to
  14488. the time interval which enable sending the specified command, and must
  14489. be a non-null sequence of identifier flags separated by "+" or "|" and
  14490. enclosed between "[" and "]".
  14491. The following flags are recognized:
  14492. @table @option
  14493. @item enter
  14494. The command is sent when the current frame timestamp enters the
  14495. specified interval. In other words, the command is sent when the
  14496. previous frame timestamp was not in the given interval, and the
  14497. current is.
  14498. @item leave
  14499. The command is sent when the current frame timestamp leaves the
  14500. specified interval. In other words, the command is sent when the
  14501. previous frame timestamp was in the given interval, and the
  14502. current is not.
  14503. @end table
  14504. If @var{FLAGS} is not specified, a default value of @code{[enter]} is
  14505. assumed.
  14506. @var{TARGET} specifies the target of the command, usually the name of
  14507. the filter class or a specific filter instance name.
  14508. @var{COMMAND} specifies the name of the command for the target filter.
  14509. @var{ARG} is optional and specifies the optional list of argument for
  14510. the given @var{COMMAND}.
  14511. Between one interval specification and another, whitespaces, or
  14512. sequences of characters starting with @code{#} until the end of line,
  14513. are ignored and can be used to annotate comments.
  14514. A simplified BNF description of the commands specification syntax
  14515. follows:
  14516. @example
  14517. @var{COMMAND_FLAG} ::= "enter" | "leave"
  14518. @var{COMMAND_FLAGS} ::= @var{COMMAND_FLAG} [(+|"|")@var{COMMAND_FLAG}]
  14519. @var{COMMAND} ::= ["[" @var{COMMAND_FLAGS} "]"] @var{TARGET} @var{COMMAND} [@var{ARG}]
  14520. @var{COMMANDS} ::= @var{COMMAND} [,@var{COMMANDS}]
  14521. @var{INTERVAL} ::= @var{START}[-@var{END}] @var{COMMANDS}
  14522. @var{INTERVALS} ::= @var{INTERVAL}[;@var{INTERVALS}]
  14523. @end example
  14524. @subsection Examples
  14525. @itemize
  14526. @item
  14527. Specify audio tempo change at second 4:
  14528. @example
  14529. asendcmd=c='4.0 atempo tempo 1.5',atempo
  14530. @end example
  14531. @item
  14532. Target a specific filter instance:
  14533. @example
  14534. asendcmd=c='4.0 atempo@@my tempo 1.5',atempo@@my
  14535. @end example
  14536. @item
  14537. Specify a list of drawtext and hue commands in a file.
  14538. @example
  14539. # show text in the interval 5-10
  14540. 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
  14541. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
  14542. # desaturate the image in the interval 15-20
  14543. 15.0-20.0 [enter] hue s 0,
  14544. [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
  14545. [leave] hue s 1,
  14546. [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
  14547. # apply an exponential saturation fade-out effect, starting from time 25
  14548. 25 [enter] hue s exp(25-t)
  14549. @end example
  14550. A filtergraph allowing to read and process the above command list
  14551. stored in a file @file{test.cmd}, can be specified with:
  14552. @example
  14553. sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
  14554. @end example
  14555. @end itemize
  14556. @anchor{setpts}
  14557. @section setpts, asetpts
  14558. Change the PTS (presentation timestamp) of the input frames.
  14559. @code{setpts} works on video frames, @code{asetpts} on audio frames.
  14560. This filter accepts the following options:
  14561. @table @option
  14562. @item expr
  14563. The expression which is evaluated for each frame to construct its timestamp.
  14564. @end table
  14565. The expression is evaluated through the eval API and can contain the following
  14566. constants:
  14567. @table @option
  14568. @item FRAME_RATE
  14569. frame rate, only defined for constant frame-rate video
  14570. @item PTS
  14571. The presentation timestamp in input
  14572. @item N
  14573. The count of the input frame for video or the number of consumed samples,
  14574. not including the current frame for audio, starting from 0.
  14575. @item NB_CONSUMED_SAMPLES
  14576. The number of consumed samples, not including the current frame (only
  14577. audio)
  14578. @item NB_SAMPLES, S
  14579. The number of samples in the current frame (only audio)
  14580. @item SAMPLE_RATE, SR
  14581. The audio sample rate.
  14582. @item STARTPTS
  14583. The PTS of the first frame.
  14584. @item STARTT
  14585. the time in seconds of the first frame
  14586. @item INTERLACED
  14587. State whether the current frame is interlaced.
  14588. @item T
  14589. the time in seconds of the current frame
  14590. @item POS
  14591. original position in the file of the frame, or undefined if undefined
  14592. for the current frame
  14593. @item PREV_INPTS
  14594. The previous input PTS.
  14595. @item PREV_INT
  14596. previous input time in seconds
  14597. @item PREV_OUTPTS
  14598. The previous output PTS.
  14599. @item PREV_OUTT
  14600. previous output time in seconds
  14601. @item RTCTIME
  14602. The wallclock (RTC) time in microseconds. This is deprecated, use time(0)
  14603. instead.
  14604. @item RTCSTART
  14605. The wallclock (RTC) time at the start of the movie in microseconds.
  14606. @item TB
  14607. The timebase of the input timestamps.
  14608. @end table
  14609. @subsection Examples
  14610. @itemize
  14611. @item
  14612. Start counting PTS from zero
  14613. @example
  14614. setpts=PTS-STARTPTS
  14615. @end example
  14616. @item
  14617. Apply fast motion effect:
  14618. @example
  14619. setpts=0.5*PTS
  14620. @end example
  14621. @item
  14622. Apply slow motion effect:
  14623. @example
  14624. setpts=2.0*PTS
  14625. @end example
  14626. @item
  14627. Set fixed rate of 25 frames per second:
  14628. @example
  14629. setpts=N/(25*TB)
  14630. @end example
  14631. @item
  14632. Set fixed rate 25 fps with some jitter:
  14633. @example
  14634. setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
  14635. @end example
  14636. @item
  14637. Apply an offset of 10 seconds to the input PTS:
  14638. @example
  14639. setpts=PTS+10/TB
  14640. @end example
  14641. @item
  14642. Generate timestamps from a "live source" and rebase onto the current timebase:
  14643. @example
  14644. setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
  14645. @end example
  14646. @item
  14647. Generate timestamps by counting samples:
  14648. @example
  14649. asetpts=N/SR/TB
  14650. @end example
  14651. @end itemize
  14652. @section setrange
  14653. Force color range for the output video frame.
  14654. The @code{setrange} filter marks the color range property for the
  14655. output frames. It does not change the input frame, but only sets the
  14656. corresponding property, which affects how the frame is treated by
  14657. following filters.
  14658. The filter accepts the following options:
  14659. @table @option
  14660. @item range
  14661. Available values are:
  14662. @table @samp
  14663. @item auto
  14664. Keep the same color range property.
  14665. @item unspecified, unknown
  14666. Set the color range as unspecified.
  14667. @item limited, tv, mpeg
  14668. Set the color range as limited.
  14669. @item full, pc, jpeg
  14670. Set the color range as full.
  14671. @end table
  14672. @end table
  14673. @section settb, asettb
  14674. Set the timebase to use for the output frames timestamps.
  14675. It is mainly useful for testing timebase configuration.
  14676. It accepts the following parameters:
  14677. @table @option
  14678. @item expr, tb
  14679. The expression which is evaluated into the output timebase.
  14680. @end table
  14681. The value for @option{tb} is an arithmetic expression representing a
  14682. rational. The expression can contain the constants "AVTB" (the default
  14683. timebase), "intb" (the input timebase) and "sr" (the sample rate,
  14684. audio only). Default value is "intb".
  14685. @subsection Examples
  14686. @itemize
  14687. @item
  14688. Set the timebase to 1/25:
  14689. @example
  14690. settb=expr=1/25
  14691. @end example
  14692. @item
  14693. Set the timebase to 1/10:
  14694. @example
  14695. settb=expr=0.1
  14696. @end example
  14697. @item
  14698. Set the timebase to 1001/1000:
  14699. @example
  14700. settb=1+0.001
  14701. @end example
  14702. @item
  14703. Set the timebase to 2*intb:
  14704. @example
  14705. settb=2*intb
  14706. @end example
  14707. @item
  14708. Set the default timebase value:
  14709. @example
  14710. settb=AVTB
  14711. @end example
  14712. @end itemize
  14713. @section showcqt
  14714. Convert input audio to a video output representing frequency spectrum
  14715. logarithmically using Brown-Puckette constant Q transform algorithm with
  14716. direct frequency domain coefficient calculation (but the transform itself
  14717. is not really constant Q, instead the Q factor is actually variable/clamped),
  14718. with musical tone scale, from E0 to D#10.
  14719. The filter accepts the following options:
  14720. @table @option
  14721. @item size, s
  14722. Specify the video size for the output. It must be even. For the syntax of this option,
  14723. check the @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14724. Default value is @code{1920x1080}.
  14725. @item fps, rate, r
  14726. Set the output frame rate. Default value is @code{25}.
  14727. @item bar_h
  14728. Set the bargraph height. It must be even. Default value is @code{-1} which
  14729. computes the bargraph height automatically.
  14730. @item axis_h
  14731. Set the axis height. It must be even. Default value is @code{-1} which computes
  14732. the axis height automatically.
  14733. @item sono_h
  14734. Set the sonogram height. It must be even. Default value is @code{-1} which
  14735. computes the sonogram height automatically.
  14736. @item fullhd
  14737. Set the fullhd resolution. This option is deprecated, use @var{size}, @var{s}
  14738. instead. Default value is @code{1}.
  14739. @item sono_v, volume
  14740. Specify the sonogram volume expression. It can contain variables:
  14741. @table @option
  14742. @item bar_v
  14743. the @var{bar_v} evaluated expression
  14744. @item frequency, freq, f
  14745. the frequency where it is evaluated
  14746. @item timeclamp, tc
  14747. the value of @var{timeclamp} option
  14748. @end table
  14749. and functions:
  14750. @table @option
  14751. @item a_weighting(f)
  14752. A-weighting of equal loudness
  14753. @item b_weighting(f)
  14754. B-weighting of equal loudness
  14755. @item c_weighting(f)
  14756. C-weighting of equal loudness.
  14757. @end table
  14758. Default value is @code{16}.
  14759. @item bar_v, volume2
  14760. Specify the bargraph volume expression. It can contain variables:
  14761. @table @option
  14762. @item sono_v
  14763. the @var{sono_v} evaluated expression
  14764. @item frequency, freq, f
  14765. the frequency where it is evaluated
  14766. @item timeclamp, tc
  14767. the value of @var{timeclamp} option
  14768. @end table
  14769. and functions:
  14770. @table @option
  14771. @item a_weighting(f)
  14772. A-weighting of equal loudness
  14773. @item b_weighting(f)
  14774. B-weighting of equal loudness
  14775. @item c_weighting(f)
  14776. C-weighting of equal loudness.
  14777. @end table
  14778. Default value is @code{sono_v}.
  14779. @item sono_g, gamma
  14780. Specify the sonogram gamma. Lower gamma makes the spectrum more contrast,
  14781. higher gamma makes the spectrum having more range. Default value is @code{3}.
  14782. Acceptable range is @code{[1, 7]}.
  14783. @item bar_g, gamma2
  14784. Specify the bargraph gamma. Default value is @code{1}. Acceptable range is
  14785. @code{[1, 7]}.
  14786. @item bar_t
  14787. Specify the bargraph transparency level. Lower value makes the bargraph sharper.
  14788. Default value is @code{1}. Acceptable range is @code{[0, 1]}.
  14789. @item timeclamp, tc
  14790. Specify the transform timeclamp. At low frequency, there is trade-off between
  14791. accuracy in time domain and frequency domain. If timeclamp is lower,
  14792. event in time domain is represented more accurately (such as fast bass drum),
  14793. otherwise event in frequency domain is represented more accurately
  14794. (such as bass guitar). Acceptable range is @code{[0.002, 1]}. Default value is @code{0.17}.
  14795. @item attack
  14796. Set attack time in seconds. The default is @code{0} (disabled). Otherwise, it
  14797. limits future samples by applying asymmetric windowing in time domain, useful
  14798. when low latency is required. Accepted range is @code{[0, 1]}.
  14799. @item basefreq
  14800. Specify the transform base frequency. Default value is @code{20.01523126408007475},
  14801. which is frequency 50 cents below E0. Acceptable range is @code{[10, 100000]}.
  14802. @item endfreq
  14803. Specify the transform end frequency. Default value is @code{20495.59681441799654},
  14804. which is frequency 50 cents above D#10. Acceptable range is @code{[10, 100000]}.
  14805. @item coeffclamp
  14806. This option is deprecated and ignored.
  14807. @item tlength
  14808. Specify the transform length in time domain. Use this option to control accuracy
  14809. trade-off between time domain and frequency domain at every frequency sample.
  14810. It can contain variables:
  14811. @table @option
  14812. @item frequency, freq, f
  14813. the frequency where it is evaluated
  14814. @item timeclamp, tc
  14815. the value of @var{timeclamp} option.
  14816. @end table
  14817. Default value is @code{384*tc/(384+tc*f)}.
  14818. @item count
  14819. Specify the transform count for every video frame. Default value is @code{6}.
  14820. Acceptable range is @code{[1, 30]}.
  14821. @item fcount
  14822. Specify the transform count for every single pixel. Default value is @code{0},
  14823. which makes it computed automatically. Acceptable range is @code{[0, 10]}.
  14824. @item fontfile
  14825. Specify font file for use with freetype to draw the axis. If not specified,
  14826. use embedded font. Note that drawing with font file or embedded font is not
  14827. implemented with custom @var{basefreq} and @var{endfreq}, use @var{axisfile}
  14828. option instead.
  14829. @item font
  14830. Specify fontconfig pattern. This has lower priority than @var{fontfile}.
  14831. The : in the pattern may be replaced by | to avoid unnecessary escaping.
  14832. @item fontcolor
  14833. Specify font color expression. This is arithmetic expression that should return
  14834. integer value 0xRRGGBB. It can contain variables:
  14835. @table @option
  14836. @item frequency, freq, f
  14837. the frequency where it is evaluated
  14838. @item timeclamp, tc
  14839. the value of @var{timeclamp} option
  14840. @end table
  14841. and functions:
  14842. @table @option
  14843. @item midi(f)
  14844. midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)
  14845. @item r(x), g(x), b(x)
  14846. red, green, and blue value of intensity x.
  14847. @end table
  14848. Default value is @code{st(0, (midi(f)-59.5)/12);
  14849. st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0));
  14850. r(1-ld(1)) + b(ld(1))}.
  14851. @item axisfile
  14852. Specify image file to draw the axis. This option override @var{fontfile} and
  14853. @var{fontcolor} option.
  14854. @item axis, text
  14855. Enable/disable drawing text to the axis. If it is set to @code{0}, drawing to
  14856. the axis is disabled, ignoring @var{fontfile} and @var{axisfile} option.
  14857. Default value is @code{1}.
  14858. @item csp
  14859. Set colorspace. The accepted values are:
  14860. @table @samp
  14861. @item unspecified
  14862. Unspecified (default)
  14863. @item bt709
  14864. BT.709
  14865. @item fcc
  14866. FCC
  14867. @item bt470bg
  14868. BT.470BG or BT.601-6 625
  14869. @item smpte170m
  14870. SMPTE-170M or BT.601-6 525
  14871. @item smpte240m
  14872. SMPTE-240M
  14873. @item bt2020ncl
  14874. BT.2020 with non-constant luminance
  14875. @end table
  14876. @item cscheme
  14877. Set spectrogram color scheme. This is list of floating point values with format
  14878. @code{left_r|left_g|left_b|right_r|right_g|right_b}.
  14879. The default is @code{1|0.5|0|0|0.5|1}.
  14880. @end table
  14881. @subsection Examples
  14882. @itemize
  14883. @item
  14884. Playing audio while showing the spectrum:
  14885. @example
  14886. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  14887. @end example
  14888. @item
  14889. Same as above, but with frame rate 30 fps:
  14890. @example
  14891. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  14892. @end example
  14893. @item
  14894. Playing at 1280x720:
  14895. @example
  14896. ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=s=1280x720:count=4 [out0]'
  14897. @end example
  14898. @item
  14899. Disable sonogram display:
  14900. @example
  14901. sono_h=0
  14902. @end example
  14903. @item
  14904. A1 and its harmonics: A1, A2, (near)E3, A3:
  14905. @example
  14906. 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),
  14907. asplit[a][out1]; [a] showcqt [out0]'
  14908. @end example
  14909. @item
  14910. Same as above, but with more accuracy in frequency domain:
  14911. @example
  14912. 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),
  14913. asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  14914. @end example
  14915. @item
  14916. Custom volume:
  14917. @example
  14918. bar_v=10:sono_v=bar_v*a_weighting(f)
  14919. @end example
  14920. @item
  14921. Custom gamma, now spectrum is linear to the amplitude.
  14922. @example
  14923. bar_g=2:sono_g=2
  14924. @end example
  14925. @item
  14926. Custom tlength equation:
  14927. @example
  14928. 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)))'
  14929. @end example
  14930. @item
  14931. Custom fontcolor and fontfile, C-note is colored green, others are colored blue:
  14932. @example
  14933. fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))':fontfile=myfont.ttf
  14934. @end example
  14935. @item
  14936. Custom font using fontconfig:
  14937. @example
  14938. font='Courier New,Monospace,mono|bold'
  14939. @end example
  14940. @item
  14941. Custom frequency range with custom axis using image file:
  14942. @example
  14943. axisfile=myaxis.png:basefreq=40:endfreq=10000
  14944. @end example
  14945. @end itemize
  14946. @section showfreqs
  14947. Convert input audio to video output representing the audio power spectrum.
  14948. Audio amplitude is on Y-axis while frequency is on X-axis.
  14949. The filter accepts the following options:
  14950. @table @option
  14951. @item size, s
  14952. Specify size of video. For the syntax of this option, check the
  14953. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  14954. Default is @code{1024x512}.
  14955. @item mode
  14956. Set display mode.
  14957. This set how each frequency bin will be represented.
  14958. It accepts the following values:
  14959. @table @samp
  14960. @item line
  14961. @item bar
  14962. @item dot
  14963. @end table
  14964. Default is @code{bar}.
  14965. @item ascale
  14966. Set amplitude scale.
  14967. It accepts the following values:
  14968. @table @samp
  14969. @item lin
  14970. Linear scale.
  14971. @item sqrt
  14972. Square root scale.
  14973. @item cbrt
  14974. Cubic root scale.
  14975. @item log
  14976. Logarithmic scale.
  14977. @end table
  14978. Default is @code{log}.
  14979. @item fscale
  14980. Set frequency scale.
  14981. It accepts the following values:
  14982. @table @samp
  14983. @item lin
  14984. Linear scale.
  14985. @item log
  14986. Logarithmic scale.
  14987. @item rlog
  14988. Reverse logarithmic scale.
  14989. @end table
  14990. Default is @code{lin}.
  14991. @item win_size
  14992. Set window size.
  14993. It accepts the following values:
  14994. @table @samp
  14995. @item w16
  14996. @item w32
  14997. @item w64
  14998. @item w128
  14999. @item w256
  15000. @item w512
  15001. @item w1024
  15002. @item w2048
  15003. @item w4096
  15004. @item w8192
  15005. @item w16384
  15006. @item w32768
  15007. @item w65536
  15008. @end table
  15009. Default is @code{w2048}
  15010. @item win_func
  15011. Set windowing function.
  15012. It accepts the following values:
  15013. @table @samp
  15014. @item rect
  15015. @item bartlett
  15016. @item hanning
  15017. @item hamming
  15018. @item blackman
  15019. @item welch
  15020. @item flattop
  15021. @item bharris
  15022. @item bnuttall
  15023. @item bhann
  15024. @item sine
  15025. @item nuttall
  15026. @item lanczos
  15027. @item gauss
  15028. @item tukey
  15029. @item dolph
  15030. @item cauchy
  15031. @item parzen
  15032. @item poisson
  15033. @end table
  15034. Default is @code{hanning}.
  15035. @item overlap
  15036. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  15037. which means optimal overlap for selected window function will be picked.
  15038. @item averaging
  15039. Set time averaging. Setting this to 0 will display current maximal peaks.
  15040. Default is @code{1}, which means time averaging is disabled.
  15041. @item colors
  15042. Specify list of colors separated by space or by '|' which will be used to
  15043. draw channel frequencies. Unrecognized or missing colors will be replaced
  15044. by white color.
  15045. @item cmode
  15046. Set channel display mode.
  15047. It accepts the following values:
  15048. @table @samp
  15049. @item combined
  15050. @item separate
  15051. @end table
  15052. Default is @code{combined}.
  15053. @item minamp
  15054. Set minimum amplitude used in @code{log} amplitude scaler.
  15055. @end table
  15056. @anchor{showspectrum}
  15057. @section showspectrum
  15058. Convert input audio to a video output, representing the audio frequency
  15059. spectrum.
  15060. The filter accepts the following options:
  15061. @table @option
  15062. @item size, s
  15063. Specify the video size for the output. For the syntax of this option, check the
  15064. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15065. Default value is @code{640x512}.
  15066. @item slide
  15067. Specify how the spectrum should slide along the window.
  15068. It accepts the following values:
  15069. @table @samp
  15070. @item replace
  15071. the samples start again on the left when they reach the right
  15072. @item scroll
  15073. the samples scroll from right to left
  15074. @item fullframe
  15075. frames are only produced when the samples reach the right
  15076. @item rscroll
  15077. the samples scroll from left to right
  15078. @end table
  15079. Default value is @code{replace}.
  15080. @item mode
  15081. Specify display mode.
  15082. It accepts the following values:
  15083. @table @samp
  15084. @item combined
  15085. all channels are displayed in the same row
  15086. @item separate
  15087. all channels are displayed in separate rows
  15088. @end table
  15089. Default value is @samp{combined}.
  15090. @item color
  15091. Specify display color mode.
  15092. It accepts the following values:
  15093. @table @samp
  15094. @item channel
  15095. each channel is displayed in a separate color
  15096. @item intensity
  15097. each channel is displayed using the same color scheme
  15098. @item rainbow
  15099. each channel is displayed using the rainbow color scheme
  15100. @item moreland
  15101. each channel is displayed using the moreland color scheme
  15102. @item nebulae
  15103. each channel is displayed using the nebulae color scheme
  15104. @item fire
  15105. each channel is displayed using the fire color scheme
  15106. @item fiery
  15107. each channel is displayed using the fiery color scheme
  15108. @item fruit
  15109. each channel is displayed using the fruit color scheme
  15110. @item cool
  15111. each channel is displayed using the cool color scheme
  15112. @end table
  15113. Default value is @samp{channel}.
  15114. @item scale
  15115. Specify scale used for calculating intensity color values.
  15116. It accepts the following values:
  15117. @table @samp
  15118. @item lin
  15119. linear
  15120. @item sqrt
  15121. square root, default
  15122. @item cbrt
  15123. cubic root
  15124. @item log
  15125. logarithmic
  15126. @item 4thrt
  15127. 4th root
  15128. @item 5thrt
  15129. 5th root
  15130. @end table
  15131. Default value is @samp{sqrt}.
  15132. @item saturation
  15133. Set saturation modifier for displayed colors. Negative values provide
  15134. alternative color scheme. @code{0} is no saturation at all.
  15135. Saturation must be in [-10.0, 10.0] range.
  15136. Default value is @code{1}.
  15137. @item win_func
  15138. Set window function.
  15139. It accepts the following values:
  15140. @table @samp
  15141. @item rect
  15142. @item bartlett
  15143. @item hann
  15144. @item hanning
  15145. @item hamming
  15146. @item blackman
  15147. @item welch
  15148. @item flattop
  15149. @item bharris
  15150. @item bnuttall
  15151. @item bhann
  15152. @item sine
  15153. @item nuttall
  15154. @item lanczos
  15155. @item gauss
  15156. @item tukey
  15157. @item dolph
  15158. @item cauchy
  15159. @item parzen
  15160. @item poisson
  15161. @end table
  15162. Default value is @code{hann}.
  15163. @item orientation
  15164. Set orientation of time vs frequency axis. Can be @code{vertical} or
  15165. @code{horizontal}. Default is @code{vertical}.
  15166. @item overlap
  15167. Set ratio of overlap window. Default value is @code{0}.
  15168. When value is @code{1} overlap is set to recommended size for specific
  15169. window function currently used.
  15170. @item gain
  15171. Set scale gain for calculating intensity color values.
  15172. Default value is @code{1}.
  15173. @item data
  15174. Set which data to display. Can be @code{magnitude}, default or @code{phase}.
  15175. @item rotation
  15176. Set color rotation, must be in [-1.0, 1.0] range.
  15177. Default value is @code{0}.
  15178. @end table
  15179. The usage is very similar to the showwaves filter; see the examples in that
  15180. section.
  15181. @subsection Examples
  15182. @itemize
  15183. @item
  15184. Large window with logarithmic color scaling:
  15185. @example
  15186. showspectrum=s=1280x480:scale=log
  15187. @end example
  15188. @item
  15189. Complete example for a colored and sliding spectrum per channel using @command{ffplay}:
  15190. @example
  15191. ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
  15192. [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
  15193. @end example
  15194. @end itemize
  15195. @section showspectrumpic
  15196. Convert input audio to a single video frame, representing the audio frequency
  15197. spectrum.
  15198. The filter accepts the following options:
  15199. @table @option
  15200. @item size, s
  15201. Specify the video size for the output. For the syntax of this option, check the
  15202. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15203. Default value is @code{4096x2048}.
  15204. @item mode
  15205. Specify display mode.
  15206. It accepts the following values:
  15207. @table @samp
  15208. @item combined
  15209. all channels are displayed in the same row
  15210. @item separate
  15211. all channels are displayed in separate rows
  15212. @end table
  15213. Default value is @samp{combined}.
  15214. @item color
  15215. Specify display color mode.
  15216. It accepts the following values:
  15217. @table @samp
  15218. @item channel
  15219. each channel is displayed in a separate color
  15220. @item intensity
  15221. each channel is displayed using the same color scheme
  15222. @item rainbow
  15223. each channel is displayed using the rainbow color scheme
  15224. @item moreland
  15225. each channel is displayed using the moreland color scheme
  15226. @item nebulae
  15227. each channel is displayed using the nebulae color scheme
  15228. @item fire
  15229. each channel is displayed using the fire color scheme
  15230. @item fiery
  15231. each channel is displayed using the fiery color scheme
  15232. @item fruit
  15233. each channel is displayed using the fruit color scheme
  15234. @item cool
  15235. each channel is displayed using the cool color scheme
  15236. @end table
  15237. Default value is @samp{intensity}.
  15238. @item scale
  15239. Specify scale used for calculating intensity color values.
  15240. It accepts the following values:
  15241. @table @samp
  15242. @item lin
  15243. linear
  15244. @item sqrt
  15245. square root, default
  15246. @item cbrt
  15247. cubic root
  15248. @item log
  15249. logarithmic
  15250. @item 4thrt
  15251. 4th root
  15252. @item 5thrt
  15253. 5th root
  15254. @end table
  15255. Default value is @samp{log}.
  15256. @item saturation
  15257. Set saturation modifier for displayed colors. Negative values provide
  15258. alternative color scheme. @code{0} is no saturation at all.
  15259. Saturation must be in [-10.0, 10.0] range.
  15260. Default value is @code{1}.
  15261. @item win_func
  15262. Set window function.
  15263. It accepts the following values:
  15264. @table @samp
  15265. @item rect
  15266. @item bartlett
  15267. @item hann
  15268. @item hanning
  15269. @item hamming
  15270. @item blackman
  15271. @item welch
  15272. @item flattop
  15273. @item bharris
  15274. @item bnuttall
  15275. @item bhann
  15276. @item sine
  15277. @item nuttall
  15278. @item lanczos
  15279. @item gauss
  15280. @item tukey
  15281. @item dolph
  15282. @item cauchy
  15283. @item parzen
  15284. @item poisson
  15285. @end table
  15286. Default value is @code{hann}.
  15287. @item orientation
  15288. Set orientation of time vs frequency axis. Can be @code{vertical} or
  15289. @code{horizontal}. Default is @code{vertical}.
  15290. @item gain
  15291. Set scale gain for calculating intensity color values.
  15292. Default value is @code{1}.
  15293. @item legend
  15294. Draw time and frequency axes and legends. Default is enabled.
  15295. @item rotation
  15296. Set color rotation, must be in [-1.0, 1.0] range.
  15297. Default value is @code{0}.
  15298. @end table
  15299. @subsection Examples
  15300. @itemize
  15301. @item
  15302. Extract an audio spectrogram of a whole audio track
  15303. in a 1024x1024 picture using @command{ffmpeg}:
  15304. @example
  15305. ffmpeg -i audio.flac -lavfi showspectrumpic=s=1024x1024 spectrogram.png
  15306. @end example
  15307. @end itemize
  15308. @section showvolume
  15309. Convert input audio volume to a video output.
  15310. The filter accepts the following options:
  15311. @table @option
  15312. @item rate, r
  15313. Set video rate.
  15314. @item b
  15315. Set border width, allowed range is [0, 5]. Default is 1.
  15316. @item w
  15317. Set channel width, allowed range is [80, 8192]. Default is 400.
  15318. @item h
  15319. Set channel height, allowed range is [1, 900]. Default is 20.
  15320. @item f
  15321. Set fade, allowed range is [0, 1]. Default is 0.95.
  15322. @item c
  15323. Set volume color expression.
  15324. The expression can use the following variables:
  15325. @table @option
  15326. @item VOLUME
  15327. Current max volume of channel in dB.
  15328. @item PEAK
  15329. Current peak.
  15330. @item CHANNEL
  15331. Current channel number, starting from 0.
  15332. @end table
  15333. @item t
  15334. If set, displays channel names. Default is enabled.
  15335. @item v
  15336. If set, displays volume values. Default is enabled.
  15337. @item o
  15338. Set orientation, can be horizontal: @code{h} or vertical: @code{v},
  15339. default is @code{h}.
  15340. @item s
  15341. Set step size, allowed range is [0, 5]. Default is 0, which means
  15342. step is disabled.
  15343. @item p
  15344. Set background opacity, allowed range is [0, 1]. Default is 0.
  15345. @item m
  15346. Set metering mode, can be peak: @code{p} or rms: @code{r},
  15347. default is @code{p}.
  15348. @item ds
  15349. Set display scale, can be linear: @code{lin} or log: @code{log},
  15350. default is @code{lin}.
  15351. @item dm
  15352. In second.
  15353. If set to > 0., display a line for the max level
  15354. in the previous seconds.
  15355. default is disabled: @code{0.}
  15356. @item dmc
  15357. The color of the max line. Use when @code{dm} option is set to > 0.
  15358. default is: @code{orange}
  15359. @end table
  15360. @section showwaves
  15361. Convert input audio to a video output, representing the samples waves.
  15362. The filter accepts the following options:
  15363. @table @option
  15364. @item size, s
  15365. Specify the video size for the output. For the syntax of this option, check the
  15366. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15367. Default value is @code{600x240}.
  15368. @item mode
  15369. Set display mode.
  15370. Available values are:
  15371. @table @samp
  15372. @item point
  15373. Draw a point for each sample.
  15374. @item line
  15375. Draw a vertical line for each sample.
  15376. @item p2p
  15377. Draw a point for each sample and a line between them.
  15378. @item cline
  15379. Draw a centered vertical line for each sample.
  15380. @end table
  15381. Default value is @code{point}.
  15382. @item n
  15383. Set the number of samples which are printed on the same column. A
  15384. larger value will decrease the frame rate. Must be a positive
  15385. integer. This option can be set only if the value for @var{rate}
  15386. is not explicitly specified.
  15387. @item rate, r
  15388. Set the (approximate) output frame rate. This is done by setting the
  15389. option @var{n}. Default value is "25".
  15390. @item split_channels
  15391. Set if channels should be drawn separately or overlap. Default value is 0.
  15392. @item colors
  15393. Set colors separated by '|' which are going to be used for drawing of each channel.
  15394. @item scale
  15395. Set amplitude scale.
  15396. Available values are:
  15397. @table @samp
  15398. @item lin
  15399. Linear.
  15400. @item log
  15401. Logarithmic.
  15402. @item sqrt
  15403. Square root.
  15404. @item cbrt
  15405. Cubic root.
  15406. @end table
  15407. Default is linear.
  15408. @item draw
  15409. Set the draw mode. This is mostly useful to set for high @var{n}.
  15410. Available values are:
  15411. @table @samp
  15412. @item scale
  15413. Scale pixel values for each drawn sample.
  15414. @item full
  15415. Draw every sample directly.
  15416. @end table
  15417. Default value is @code{scale}.
  15418. @end table
  15419. @subsection Examples
  15420. @itemize
  15421. @item
  15422. Output the input file audio and the corresponding video representation
  15423. at the same time:
  15424. @example
  15425. amovie=a.mp3,asplit[out0],showwaves[out1]
  15426. @end example
  15427. @item
  15428. Create a synthetic signal and show it with showwaves, forcing a
  15429. frame rate of 30 frames per second:
  15430. @example
  15431. aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
  15432. @end example
  15433. @end itemize
  15434. @section showwavespic
  15435. Convert input audio to a single video frame, representing the samples waves.
  15436. The filter accepts the following options:
  15437. @table @option
  15438. @item size, s
  15439. Specify the video size for the output. For the syntax of this option, check the
  15440. @ref{video size syntax,,"Video size" section in the ffmpeg-utils manual,ffmpeg-utils}.
  15441. Default value is @code{600x240}.
  15442. @item split_channels
  15443. Set if channels should be drawn separately or overlap. Default value is 0.
  15444. @item colors
  15445. Set colors separated by '|' which are going to be used for drawing of each channel.
  15446. @item scale
  15447. Set amplitude scale.
  15448. Available values are:
  15449. @table @samp
  15450. @item lin
  15451. Linear.
  15452. @item log
  15453. Logarithmic.
  15454. @item sqrt
  15455. Square root.
  15456. @item cbrt
  15457. Cubic root.
  15458. @end table
  15459. Default is linear.
  15460. @end table
  15461. @subsection Examples
  15462. @itemize
  15463. @item
  15464. Extract a channel split representation of the wave form of a whole audio track
  15465. in a 1024x800 picture using @command{ffmpeg}:
  15466. @example
  15467. ffmpeg -i audio.flac -lavfi showwavespic=split_channels=1:s=1024x800 waveform.png
  15468. @end example
  15469. @end itemize
  15470. @section sidedata, asidedata
  15471. Delete frame side data, or select frames based on it.
  15472. This filter accepts the following options:
  15473. @table @option
  15474. @item mode
  15475. Set mode of operation of the filter.
  15476. Can be one of the following:
  15477. @table @samp
  15478. @item select
  15479. Select every frame with side data of @code{type}.
  15480. @item delete
  15481. Delete side data of @code{type}. If @code{type} is not set, delete all side
  15482. data in the frame.
  15483. @end table
  15484. @item type
  15485. Set side data type used with all modes. Must be set for @code{select} mode. For
  15486. the list of frame side data types, refer to the @code{AVFrameSideDataType} enum
  15487. in @file{libavutil/frame.h}. For example, to choose
  15488. @code{AV_FRAME_DATA_PANSCAN} side data, you must specify @code{PANSCAN}.
  15489. @end table
  15490. @section spectrumsynth
  15491. Sythesize audio from 2 input video spectrums, first input stream represents
  15492. magnitude across time and second represents phase across time.
  15493. The filter will transform from frequency domain as displayed in videos back
  15494. to time domain as presented in audio output.
  15495. This filter is primarily created for reversing processed @ref{showspectrum}
  15496. filter outputs, but can synthesize sound from other spectrograms too.
  15497. But in such case results are going to be poor if the phase data is not
  15498. available, because in such cases phase data need to be recreated, usually
  15499. its just recreated from random noise.
  15500. For best results use gray only output (@code{channel} color mode in
  15501. @ref{showspectrum} filter) and @code{log} scale for magnitude video and
  15502. @code{lin} scale for phase video. To produce phase, for 2nd video, use
  15503. @code{data} option. Inputs videos should generally use @code{fullframe}
  15504. slide mode as that saves resources needed for decoding video.
  15505. The filter accepts the following options:
  15506. @table @option
  15507. @item sample_rate
  15508. Specify sample rate of output audio, the sample rate of audio from which
  15509. spectrum was generated may differ.
  15510. @item channels
  15511. Set number of channels represented in input video spectrums.
  15512. @item scale
  15513. Set scale which was used when generating magnitude input spectrum.
  15514. Can be @code{lin} or @code{log}. Default is @code{log}.
  15515. @item slide
  15516. Set slide which was used when generating inputs spectrums.
  15517. Can be @code{replace}, @code{scroll}, @code{fullframe} or @code{rscroll}.
  15518. Default is @code{fullframe}.
  15519. @item win_func
  15520. Set window function used for resynthesis.
  15521. @item overlap
  15522. Set window overlap. In range @code{[0, 1]}. Default is @code{1},
  15523. which means optimal overlap for selected window function will be picked.
  15524. @item orientation
  15525. Set orientation of input videos. Can be @code{vertical} or @code{horizontal}.
  15526. Default is @code{vertical}.
  15527. @end table
  15528. @subsection Examples
  15529. @itemize
  15530. @item
  15531. First create magnitude and phase videos from audio, assuming audio is stereo with 44100 sample rate,
  15532. then resynthesize videos back to audio with spectrumsynth:
  15533. @example
  15534. 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
  15535. 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
  15536. ffmpeg -i magnitude.nut -i phase.nut -lavfi spectrumsynth=channels=2:sample_rate=44100:win_func=hann:overlap=0.875:slide=fullframe output.flac
  15537. @end example
  15538. @end itemize
  15539. @section split, asplit
  15540. Split input into several identical outputs.
  15541. @code{asplit} works with audio input, @code{split} with video.
  15542. The filter accepts a single parameter which specifies the number of outputs. If
  15543. unspecified, it defaults to 2.
  15544. @subsection Examples
  15545. @itemize
  15546. @item
  15547. Create two separate outputs from the same input:
  15548. @example
  15549. [in] split [out0][out1]
  15550. @end example
  15551. @item
  15552. To create 3 or more outputs, you need to specify the number of
  15553. outputs, like in:
  15554. @example
  15555. [in] asplit=3 [out0][out1][out2]
  15556. @end example
  15557. @item
  15558. Create two separate outputs from the same input, one cropped and
  15559. one padded:
  15560. @example
  15561. [in] split [splitout1][splitout2];
  15562. [splitout1] crop=100:100:0:0 [cropout];
  15563. [splitout2] pad=200:200:100:100 [padout];
  15564. @end example
  15565. @item
  15566. Create 5 copies of the input audio with @command{ffmpeg}:
  15567. @example
  15568. ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
  15569. @end example
  15570. @end itemize
  15571. @section zmq, azmq
  15572. Receive commands sent through a libzmq client, and forward them to
  15573. filters in the filtergraph.
  15574. @code{zmq} and @code{azmq} work as a pass-through filters. @code{zmq}
  15575. must be inserted between two video filters, @code{azmq} between two
  15576. audio filters. Both are capable to send messages to any filter type.
  15577. To enable these filters you need to install the libzmq library and
  15578. headers and configure FFmpeg with @code{--enable-libzmq}.
  15579. For more information about libzmq see:
  15580. @url{http://www.zeromq.org/}
  15581. The @code{zmq} and @code{azmq} filters work as a libzmq server, which
  15582. receives messages sent through a network interface defined by the
  15583. @option{bind_address} (or the abbreviation "@option{b}") option.
  15584. Default value of this option is @file{tcp://localhost:5555}. You may
  15585. want to alter this value to your needs, but do not forget to escape any
  15586. ':' signs (see @ref{filtergraph escaping}).
  15587. The received message must be in the form:
  15588. @example
  15589. @var{TARGET} @var{COMMAND} [@var{ARG}]
  15590. @end example
  15591. @var{TARGET} specifies the target of the command, usually the name of
  15592. the filter class or a specific filter instance name. The default
  15593. filter instance name uses the pattern @samp{Parsed_<filter_name>_<index>},
  15594. but you can override this by using the @samp{filter_name@@id} syntax
  15595. (see @ref{Filtergraph syntax}).
  15596. @var{COMMAND} specifies the name of the command for the target filter.
  15597. @var{ARG} is optional and specifies the optional argument list for the
  15598. given @var{COMMAND}.
  15599. Upon reception, the message is processed and the corresponding command
  15600. is injected into the filtergraph. Depending on the result, the filter
  15601. will send a reply to the client, adopting the format:
  15602. @example
  15603. @var{ERROR_CODE} @var{ERROR_REASON}
  15604. @var{MESSAGE}
  15605. @end example
  15606. @var{MESSAGE} is optional.
  15607. @subsection Examples
  15608. Look at @file{tools/zmqsend} for an example of a zmq client which can
  15609. be used to send commands processed by these filters.
  15610. Consider the following filtergraph generated by @command{ffplay}.
  15611. In this example the last overlay filter has an instance name. All other
  15612. filters will have default instance names.
  15613. @example
  15614. ffplay -dumpgraph 1 -f lavfi "
  15615. color=s=100x100:c=red [l];
  15616. color=s=100x100:c=blue [r];
  15617. nullsrc=s=200x100, zmq [bg];
  15618. [bg][l] overlay [bg+l];
  15619. [bg+l][r] overlay@@my=x=100 "
  15620. @end example
  15621. To change the color of the left side of the video, the following
  15622. command can be used:
  15623. @example
  15624. echo Parsed_color_0 c yellow | tools/zmqsend
  15625. @end example
  15626. To change the right side:
  15627. @example
  15628. echo Parsed_color_1 c pink | tools/zmqsend
  15629. @end example
  15630. To change the position of the right side:
  15631. @example
  15632. echo overlay@@my x 150 | tools/zmqsend
  15633. @end example
  15634. @c man end MULTIMEDIA FILTERS
  15635. @chapter Multimedia Sources
  15636. @c man begin MULTIMEDIA SOURCES
  15637. Below is a description of the currently available multimedia sources.
  15638. @section amovie
  15639. This is the same as @ref{movie} source, except it selects an audio
  15640. stream by default.
  15641. @anchor{movie}
  15642. @section movie
  15643. Read audio and/or video stream(s) from a movie container.
  15644. It accepts the following parameters:
  15645. @table @option
  15646. @item filename
  15647. The name of the resource to read (not necessarily a file; it can also be a
  15648. device or a stream accessed through some protocol).
  15649. @item format_name, f
  15650. Specifies the format assumed for the movie to read, and can be either
  15651. the name of a container or an input device. If not specified, the
  15652. format is guessed from @var{movie_name} or by probing.
  15653. @item seek_point, sp
  15654. Specifies the seek point in seconds. The frames will be output
  15655. starting from this seek point. The parameter is evaluated with
  15656. @code{av_strtod}, so the numerical value may be suffixed by an IS
  15657. postfix. The default value is "0".
  15658. @item streams, s
  15659. Specifies the streams to read. Several streams can be specified,
  15660. separated by "+". The source will then have as many outputs, in the
  15661. same order. The syntax is explained in the @ref{Stream specifiers,,"Stream specifiers"
  15662. section in the ffmpeg manual,ffmpeg}. Two special names, "dv" and "da" specify
  15663. respectively the default (best suited) video and audio stream. Default
  15664. is "dv", or "da" if the filter is called as "amovie".
  15665. @item stream_index, si
  15666. Specifies the index of the video stream to read. If the value is -1,
  15667. the most suitable video stream will be automatically selected. The default
  15668. value is "-1". Deprecated. If the filter is called "amovie", it will select
  15669. audio instead of video.
  15670. @item loop
  15671. Specifies how many times to read the stream in sequence.
  15672. If the value is 0, the stream will be looped infinitely.
  15673. Default value is "1".
  15674. Note that when the movie is looped the source timestamps are not
  15675. changed, so it will generate non monotonically increasing timestamps.
  15676. @item discontinuity
  15677. Specifies the time difference between frames above which the point is
  15678. considered a timestamp discontinuity which is removed by adjusting the later
  15679. timestamps.
  15680. @end table
  15681. It allows overlaying a second video on top of the main input of
  15682. a filtergraph, as shown in this graph:
  15683. @example
  15684. input -----------> deltapts0 --> overlay --> output
  15685. ^
  15686. |
  15687. movie --> scale--> deltapts1 -------+
  15688. @end example
  15689. @subsection Examples
  15690. @itemize
  15691. @item
  15692. Skip 3.2 seconds from the start of the AVI file in.avi, and overlay it
  15693. on top of the input labelled "in":
  15694. @example
  15695. movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
  15696. [in] setpts=PTS-STARTPTS [main];
  15697. [main][over] overlay=16:16 [out]
  15698. @end example
  15699. @item
  15700. Read from a video4linux2 device, and overlay it on top of the input
  15701. labelled "in":
  15702. @example
  15703. movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
  15704. [in] setpts=PTS-STARTPTS [main];
  15705. [main][over] overlay=16:16 [out]
  15706. @end example
  15707. @item
  15708. Read the first video stream and the audio stream with id 0x81 from
  15709. dvd.vob; the video is connected to the pad named "video" and the audio is
  15710. connected to the pad named "audio":
  15711. @example
  15712. movie=dvd.vob:s=v:0+#0x81 [video] [audio]
  15713. @end example
  15714. @end itemize
  15715. @subsection Commands
  15716. Both movie and amovie support the following commands:
  15717. @table @option
  15718. @item seek
  15719. Perform seek using "av_seek_frame".
  15720. The syntax is: seek @var{stream_index}|@var{timestamp}|@var{flags}
  15721. @itemize
  15722. @item
  15723. @var{stream_index}: If stream_index is -1, a default
  15724. stream is selected, and @var{timestamp} is automatically converted
  15725. from AV_TIME_BASE units to the stream specific time_base.
  15726. @item
  15727. @var{timestamp}: Timestamp in AVStream.time_base units
  15728. or, if no stream is specified, in AV_TIME_BASE units.
  15729. @item
  15730. @var{flags}: Flags which select direction and seeking mode.
  15731. @end itemize
  15732. @item get_duration
  15733. Get movie duration in AV_TIME_BASE units.
  15734. @end table
  15735. @c man end MULTIMEDIA SOURCES